aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcomito <jcomito@google.com>2024-03-12 18:11:22 +0000
committerjcomito <jcomito@google.com>2024-03-12 18:16:54 +0000
commit76c8225dd6015b5b8fe880e53d820bd91a5aa2b8 (patch)
tree0203081c522e2034b6e328dfaaece46445ea890c
parent620ce3a4d8bc163b9533541e0bcebdb65d75b8a4 (diff)
downloadharfbuzz_ng-76c8225dd6015b5b8fe880e53d820bd91a5aa2b8.tar.gz
Fixing compiler warnings
All but one warning was for format specifiers (-WFormat) in sprintf(). The other warning was for *maybe* uninitialized (-Wmaybe-uninitialized) hb-ot-layout.c. The *maybe* uninitialized variables were changed to be initialized to zero, though I was unable to find a path where they were uninitialized. I chose this over silencing the warning for this file. Test: Compile only. Change-Id: I2f3faaea536687976391d66baef3a1f7bdcb8141
-rw-r--r--src/OT/glyf/glyf-helpers.hh3
-rw-r--r--src/hb-common.cc3
-rw-r--r--src/hb-font.hh3
-rw-r--r--src/hb-ot-layout.cc2
-rw-r--r--src/hb-ot-shaper-arabic.cc10
-rw-r--r--src/hb-ot-tag.cc3
6 files changed, 14 insertions, 10 deletions
diff --git a/src/OT/glyf/glyf-helpers.hh b/src/OT/glyf/glyf-helpers.hh
index d0a5a132f..635cdfd90 100644
--- a/src/OT/glyf/glyf-helpers.hh
+++ b/src/OT/glyf/glyf-helpers.hh
@@ -5,6 +5,7 @@
#include "../../hb-open-type.hh"
#include "../../hb-subset-plan.hh"
+#include "inttypes.h"
#include "loca.hh"
@@ -38,7 +39,7 @@ _write_loca (IteratorIn&& it,
unsigned padded_size = *it++;
offset += padded_size;
- DEBUG_MSG (SUBSET, nullptr, "loca entry gid %u offset %u padded-size %u", gid, offset, padded_size);
+ DEBUG_MSG (SUBSET, nullptr, "loca entry gid %" PRIu32 " offset %u padded-size %u", gid, offset, padded_size);
value = offset >> right_shift;
*dest++ = value;
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 0c13c7d17..6277f4671 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -28,6 +28,7 @@
#include "hb.hh"
#include "hb-machinery.hh"
+#include "inttypes.h"
/**
@@ -996,7 +997,7 @@ hb_feature_to_string (hb_feature_t *feature,
if (feature->value > 1)
{
s[len++] = '=';
- len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->value));
+ len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%" PRIu32 "", feature->value));
}
assert (len < ARRAY_LENGTH (s));
len = hb_min (len, size - 1);
diff --git a/src/hb-font.hh b/src/hb-font.hh
index f503575c3..a748ce508 100644
--- a/src/hb-font.hh
+++ b/src/hb-font.hh
@@ -33,6 +33,7 @@
#include "hb-face.hh"
#include "hb-shaper.hh"
+#include "inttypes.h"
/*
@@ -651,7 +652,7 @@ struct hb_font_t
{
if (get_glyph_name (glyph, s, size)) return;
- if (size && snprintf (s, size, "gid%u", glyph) < 0)
+ if (size && snprintf (s, size, "gid%" PRIu32 "", glyph) < 0)
*s = '\0';
}
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 2eb8535db..a4c13abad 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -2127,7 +2127,7 @@ hb_ot_layout_get_font_extents (hb_font_t *font,
hb_tag_t language_tag,
hb_font_extents_t *extents)
{
- hb_position_t min, max;
+ hb_position_t min = 0, max = 0;
if (font->face->table.BASE->get_min_max (font, direction, script_tag, language_tag, HB_TAG_NONE,
&min, &max))
{
diff --git a/src/hb-ot-shaper-arabic.cc b/src/hb-ot-shaper-arabic.cc
index 72dcc84df..70a1dff86 100644
--- a/src/hb-ot-shaper-arabic.cc
+++ b/src/hb-ot-shaper-arabic.cc
@@ -30,7 +30,7 @@
#include "hb-ot-shaper-arabic.hh"
#include "hb-ot-shape.hh"
-
+#include "inttypes.h"
/* buffer var allocations */
#define arabic_shaping_action() ot_shaper_var_u8_auxiliary() /* arabic shaping action */
@@ -560,9 +560,9 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
DEBUG_MSG (ARABIC, nullptr, "%s stretch at (%u,%u,%u)",
step == MEASURE ? "measuring" : "cutting", context, start, end);
- DEBUG_MSG (ARABIC, nullptr, "rest of word: count=%u width %d", start - context, w_total);
- DEBUG_MSG (ARABIC, nullptr, "fixed tiles: count=%d width=%d", n_fixed, w_fixed);
- DEBUG_MSG (ARABIC, nullptr, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
+ DEBUG_MSG (ARABIC, nullptr, "rest of word: count=%u width %" PRId32 "", start - context, w_total);
+ DEBUG_MSG (ARABIC, nullptr, "fixed tiles: count=%d width=%" PRId32 "", n_fixed, w_fixed);
+ DEBUG_MSG (ARABIC, nullptr, "repeating tiles: count=%d width=%" PRId32 "", n_repeating, w_repeating);
/* Number of additional times to repeat each repeating tile. */
int n_copies = 0;
@@ -602,7 +602,7 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
repeat += n_copies;
- DEBUG_MSG (ARABIC, nullptr, "appending %u copies of glyph %u; j=%u",
+ DEBUG_MSG (ARABIC, nullptr, "appending %u copies of glyph %" PRIu32 "; j=%u",
repeat, info[k - 1].codepoint, j);
pos[k - 1].x_advance = 0;
for (unsigned int n = 0; n < repeat; n++)
diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc
index 53b6b38f6..d8b1151a4 100644
--- a/src/hb-ot-tag.cc
+++ b/src/hb-ot-tag.cc
@@ -27,6 +27,7 @@
*/
#include "hb.hh"
+#include "inttypes.h"
#ifndef HB_NO_OT_TAG
@@ -547,7 +548,7 @@ hb_ot_tag_to_language (hb_tag_t tag)
buf[3] = '-';
str += 4;
}
- snprintf (str, 16, "x-hbot-%08x", tag);
+ snprintf (str, 16, "x-hbot-%08" PRIx32 "", tag);
return hb_language_from_string (&*buf, -1);
}
}