Enable -Wformat-signedness

And fix the codebase.
This commit is contained in:
Behdad Esfahbod 2023-01-12 17:04:24 -07:00
parent 7b5f0dd3a8
commit ed023f66df
43 changed files with 110 additions and 110 deletions

View File

@ -143,7 +143,7 @@ struct CursivePosFormat1
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"cursive attaching glyph at %d to glyph at %d",
"cursive attaching glyph at %u to glyph at %u",
i, j);
}
@ -241,7 +241,7 @@ struct CursivePosFormat1
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"cursive attached glyph at %d to glyph at %d",
"cursive attached glyph at %u to glyph at %u",
i, j);
}

View File

@ -42,7 +42,7 @@ struct MarkArray : Array16Of<MarkRecord> /* Array of MarkRecords--in Cove
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"attaching mark glyph at %d to glyph at %d",
"attaching mark glyph at %u to glyph at %u",
c->buffer->idx, glyph_pos);
}
@ -56,7 +56,7 @@ struct MarkArray : Array16Of<MarkRecord> /* Array of MarkRecords--in Cove
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"attached mark glyph at %d to glyph at %d",
"attached mark glyph at %u to glyph at %u",
c->buffer->idx, glyph_pos);
}

View File

@ -220,7 +220,7 @@ struct PairPosFormat2_4
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"try kerning glyphs at %d,%d",
"try kerning glyphs at %u,%u",
c->buffer->idx, skippy_iter.idx);
}
@ -231,14 +231,14 @@ struct PairPosFormat2_4
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"kerned glyphs at %d,%d",
"kerned glyphs at %u,%u",
c->buffer->idx, skippy_iter.idx);
}
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"tried kerning glyphs at %d,%d",
"tried kerning glyphs at %u,%u",
c->buffer->idx, skippy_iter.idx);
}

View File

@ -112,7 +112,7 @@ struct PairSet
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"try kerning glyphs at %d,%d",
"try kerning glyphs at %u,%u",
c->buffer->idx, pos);
}
@ -123,14 +123,14 @@ struct PairSet
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"kerned glyphs at %d,%d",
"kerned glyphs at %u,%u",
c->buffer->idx, pos);
}
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"tried kerning glyphs at %d,%d",
"tried kerning glyphs at %u,%u",
c->buffer->idx, pos);
}

View File

@ -63,7 +63,7 @@ struct SinglePosFormat1
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"positioning glyph at %d",
"positioning glyph at %u",
c->buffer->idx);
}
@ -72,7 +72,7 @@ struct SinglePosFormat1
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"positioned glyph at %d",
"positioned glyph at %u",
c->buffer->idx);
}

View File

@ -73,7 +73,7 @@ struct SinglePosFormat2
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"positioning glyph at %d",
"positioning glyph at %u",
c->buffer->idx);
}
@ -84,7 +84,7 @@ struct SinglePosFormat2
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"positioned glyph at %d",
"positioned glyph at %u",
c->buffer->idx);
}

View File

@ -61,7 +61,7 @@ struct AlternateSet
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"replacing glyph at %d (alternate substitution)",
"replacing glyph at %u (alternate substitution)",
c->buffer->idx);
}
@ -70,8 +70,8 @@ struct AlternateSet
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"replaced glyph at %d (alternate substitution)",
c->buffer->idx - 1);
"replaced glyph at %u (alternate substitution)",
c->buffer->idx - 1u);
}
return_trace (true);

View File

@ -69,7 +69,7 @@ struct Ligature
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"replacing glyph at %d (ligature substitution)",
"replacing glyph at %u (ligature substitution)",
c->buffer->idx);
}
@ -78,8 +78,8 @@ struct Ligature
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"replaced glyph at %d (ligature substitution)",
c->buffer->idx - 1);
"replaced glyph at %u (ligature substitution)",
c->buffer->idx - 1u);
}
return_trace (true);
@ -138,7 +138,7 @@ struct Ligature
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"ligated glyph at %d",
"ligated glyph at %u",
pos);
}

View File

@ -135,7 +135,7 @@ struct ReverseChainSingleSubstFormat1
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"replacing glyph at %d (reverse chaining substitution)",
"replacing glyph at %u (reverse chaining substitution)",
c->buffer->idx);
}
@ -144,7 +144,7 @@ struct ReverseChainSingleSubstFormat1
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"replaced glyph at %d (reverse chaining substitution)",
"replaced glyph at %u (reverse chaining substitution)",
c->buffer->idx);
}

View File

@ -44,7 +44,7 @@ struct Sequence
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"replacing glyph at %d (multiple substitution)",
"replacing glyph at %u (multiple substitution)",
c->buffer->idx);
}
@ -53,8 +53,8 @@ struct Sequence
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"replaced glyph at %d (multiple subtitution)",
c->buffer->idx - 1);
"replaced glyph at %u (multiple subtitution)",
c->buffer->idx - 1u);
}
return_trace (true);
@ -67,7 +67,7 @@ struct Sequence
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"deleting glyph at %d (multiple substitution)",
"deleting glyph at %u (multiple substitution)",
c->buffer->idx);
}
@ -77,7 +77,7 @@ struct Sequence
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"deleted glyph at %d (multiple substitution)",
"deleted glyph at %u (multiple substitution)",
c->buffer->idx);
}
@ -88,7 +88,7 @@ struct Sequence
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"multiplying glyph at %d",
"multiplying glyph at %u",
c->buffer->idx);
}

View File

@ -103,7 +103,7 @@ struct SingleSubstFormat1_3
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"replacing glyph at %d (single substitution)",
"replacing glyph at %u (single substitution)",
c->buffer->idx);
}
@ -112,8 +112,8 @@ struct SingleSubstFormat1_3
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"replaced glyph at %d (single substitution)",
c->buffer->idx - 1);
"replaced glyph at %u (single substitution)",
c->buffer->idx - 1u);
}
return_trace (true);

View File

@ -87,7 +87,7 @@ struct SingleSubstFormat2_4
{
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"replacing glyph at %d (single substitution)",
"replacing glyph at %u (single substitution)",
c->buffer->idx);
}
@ -96,8 +96,8 @@ struct SingleSubstFormat2_4
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
{
c->buffer->message (c->font,
"replaced glyph at %d (single substitution)",
c->buffer->idx - 1);
"replaced glyph at %u (single substitution)",
c->buffer->idx - 1u);
}
return_trace (true);

View File

@ -36,7 +36,7 @@ struct SubsetGlyph
hb_bytes_t dest_glyph = dest_start.copy (c);
dest_glyph = hb_bytes_t (&dest_glyph, dest_glyph.length + dest_end.copy (c).length);
unsigned int pad_length = use_short_loca ? padding () : 0;
DEBUG_MSG (SUBSET, nullptr, "serialize %d byte glyph, width %d pad %d", dest_glyph.length, dest_glyph.length + pad_length, pad_length);
DEBUG_MSG (SUBSET, nullptr, "serialize %u byte glyph, width %u pad %u", dest_glyph.length, dest_glyph.length + pad_length, pad_length);
HBUINT8 pad;
pad = 0;

View File

@ -25,7 +25,7 @@ _write_loca (IteratorIn&& it, bool short_offsets, IteratorOut&& dest)
| hb_map ([=, &offset] (unsigned int padded_size)
{
offset += padded_size;
DEBUG_MSG (SUBSET, nullptr, "loca entry offset %d", offset);
DEBUG_MSG (SUBSET, nullptr, "loca entry offset %u", offset);
return offset >> right_shift;
})
| hb_sink (dest)
@ -61,7 +61,7 @@ _add_loca_and_head (hb_subset_plan_t * plan, Iterator padded_offsets, bool use_s
if (unlikely (!loca_prime_data)) return false;
DEBUG_MSG (SUBSET, nullptr, "loca entry_size %d num_offsets %d size %d",
DEBUG_MSG (SUBSET, nullptr, "loca entry_size %u num_offsets %u size %u",
entry_size, num_offsets, entry_size * num_offsets);
if (use_short_loca)

View File

@ -123,7 +123,7 @@ struct graph_t
while (a || b)
{
DEBUG_MSG (SUBSET_REPACK, nullptr,
" 0x%x %s 0x%x", *a, (*a == *b) ? "==" : "!=", *b);
" 0x%x %s 0x%x", (unsigned) *a, (*a == *b) ? "==" : "!=", (unsigned) *b);
a++;
b++;
}
@ -918,12 +918,12 @@ struct graph_t
{
// Can't duplicate this node, doing so would orphan the original one as all remaining links
// to child are from parent.
DEBUG_MSG (SUBSET_REPACK, nullptr, " Not duplicating %d => %d",
DEBUG_MSG (SUBSET_REPACK, nullptr, " Not duplicating %u => %u",
parent_idx, child_idx);
return -1;
}
DEBUG_MSG (SUBSET_REPACK, nullptr, " Duplicating %d => %d",
DEBUG_MSG (SUBSET_REPACK, nullptr, " Duplicating %u => %u",
parent_idx, child_idx);
unsigned clone_idx = duplicate (child_idx);
@ -981,7 +981,7 @@ struct graph_t
*/
bool raise_childrens_priority (unsigned parent_idx)
{
DEBUG_MSG (SUBSET_REPACK, nullptr, " Raising priority of all children of %d",
DEBUG_MSG (SUBSET_REPACK, nullptr, " Raising priority of all children of %u",
parent_idx);
// This operation doesn't change ordering until a sort is run, so no need
// to invalidate positions. It does not change graph structure so no need

View File

@ -153,8 +153,8 @@ void print_overflows (graph_t& graph,
const auto& child = graph.vertices_[o.child];
DEBUG_MSG (SUBSET_REPACK, nullptr,
" overflow from "
"%4d (%4d in, %4d out, space %2d) => "
"%4d (%4d in, %4d out, space %2d)",
"%4u (%4u in, %4u out, space %2u) => "
"%4u (%4u in, %4u out, space %2u)",
o.parent,
parent.incoming_edges (),
parent.obj.real_links.length + parent.obj.virtual_links.length,
@ -165,7 +165,7 @@ void print_overflows (graph_t& graph,
graph.space_for (o.child));
}
if (overflows.length > 10) {
DEBUG_MSG (SUBSET_REPACK, nullptr, " ... plus %d more overflows.", overflows.length - 10);
DEBUG_MSG (SUBSET_REPACK, nullptr, " ... plus %u more overflows.", overflows.length - 10);
}
}

View File

@ -891,7 +891,7 @@ struct KerxTable
reverse = bool (st->u.header.coverage & st->u.header.Backwards) !=
HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction);
if (!c->buffer->message (c->font, "start subtable %d", c->lookup_index))
if (!c->buffer->message (c->font, "start subtable %u", c->lookup_index))
goto skip;
if (!seenCrossStream &&
@ -923,7 +923,7 @@ struct KerxTable
if (reverse)
c->buffer->reverse ();
(void) c->buffer->message (c->font, "end subtable %d", c->lookup_index);
(void) c->buffer->message (c->font, "end subtable %u", c->lookup_index);
skip:
st = &StructAfter<SubTable> (*st);

View File

@ -525,7 +525,7 @@ struct LigatureSubtable
if (unlikely (!componentData.sanitize (&c->sanitizer))) break;
ligature_idx += componentData;
DEBUG_MSG (APPLY, nullptr, "Action store %u last %u",
DEBUG_MSG (APPLY, nullptr, "Action store %d last %d",
bool (action & LigActionStore),
bool (action & LigActionLast));
if (action & (LigActionStore | LigActionLast))
@ -1063,7 +1063,7 @@ struct Chain
bool (subtable->get_coverage () & ChainSubtable<Types>::Backwards) !=
HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction);
if (!c->buffer->message (c->font, "start chainsubtable %d", c->lookup_index))
if (!c->buffer->message (c->font, "start chainsubtable %u", c->lookup_index))
goto skip;
if (reverse)
@ -1074,7 +1074,7 @@ struct Chain
if (reverse)
c->buffer->reverse ();
(void) c->buffer->message (c->font, "end chainsubtable %d", c->lookup_index);
(void) c->buffer->message (c->font, "end chainsubtable %u", c->lookup_index);
if (unlikely (!c->buffer->successful)) return;

View File

@ -150,7 +150,7 @@ buffer_verify_unsafe_to_break (hb_buffer_t *buffer,
assert (text_start < text_end);
if (0)
printf("start %d end %d text start %d end %d\n", start, end, text_start, text_end);
printf("start %u end %u text start %u end %u\n", start, end, text_start, text_end);
hb_buffer_clear_contents (fragment);
@ -292,7 +292,7 @@ buffer_verify_unsafe_to_concat (hb_buffer_t *buffer,
assert (text_start < text_end);
if (0)
printf("start %d end %d text start %d end %d\n", start, end, text_start, text_end);
printf("start %u end %u text start %u end %u\n", start, end, text_start, text_end);
#if 0
hb_buffer_flags_t flags = hb_buffer_get_flags (fragment);

View File

@ -113,7 +113,7 @@ _hb_print_func (const char *func)
const char *paren = strchr (func, '(');
if (paren)
func_len = paren - func;
fprintf (stderr, "%.*s", func_len, func);
fprintf (stderr, "%.*s", (int) func_len, func);
}
}

View File

@ -1650,7 +1650,7 @@ static inline void apply_lookup (hb_ot_apply_context_t *c,
if (buffer->have_output)
c->buffer->sync_so_far ();
c->buffer->message (c->font,
"recursing to lookup %u at %d",
"recursing to lookup %u at %u",
(unsigned) lookupRecord[i].lookupListIndex,
buffer->idx);
}

View File

@ -1913,7 +1913,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
auto &lookup = lookups[table_index][i];
unsigned int lookup_index = lookup.index;
if (!buffer->message (font, "start lookup %d feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag))) continue;
if (!buffer->message (font, "start lookup %u feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag))) continue;
/* c.digest is a digest of all the current glyphs in the buffer
* (plus some past glyphs).
@ -1933,9 +1933,9 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
proxy.accels[lookup_index]);
}
else
(void) buffer->message (font, "skipped lookup %d feature '%c%c%c%c' because no glyph matches", lookup_index, HB_UNTAG (lookup.feature_tag));
(void) buffer->message (font, "skipped lookup %u feature '%c%c%c%c' because no glyph matches", lookup_index, HB_UNTAG (lookup.feature_tag));
(void) buffer->message (font, "end lookup %d feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag));
(void) buffer->message (font, "end lookup %u feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag));
}
if (stage->pause_func)

View File

@ -556,9 +556,9 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
}
i++; // Don't touch i again.
DEBUG_MSG (ARABIC, nullptr, "%s stretch at (%d,%d,%d)",
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=%d width %d", start - context, w_total);
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);
@ -597,7 +597,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 %d copies of glyph %d; j=%d",
DEBUG_MSG (ARABIC, nullptr, "appending %u copies of glyph %u; j=%u",
repeat, info[k - 1].codepoint, j);
for (unsigned int n = 0; n < repeat; n++)
{
@ -675,15 +675,15 @@ reorder_marks_arabic (const hb_ot_shape_plan_t *plan HB_UNUSED,
{
hb_glyph_info_t *info = buffer->info;
DEBUG_MSG (ARABIC, buffer, "Reordering marks from %d to %d", start, end);
DEBUG_MSG (ARABIC, buffer, "Reordering marks from %u to %u", start, end);
unsigned int i = start;
for (unsigned int cc = 220; cc <= 230; cc += 10)
{
DEBUG_MSG (ARABIC, buffer, "Looking for %d's starting at %d", cc, i);
DEBUG_MSG (ARABIC, buffer, "Looking for %u's starting at %u", cc, i);
while (i < end && info_cc(info[i]) < cc)
i++;
DEBUG_MSG (ARABIC, buffer, "Looking for %d's stopped at %d", cc, i);
DEBUG_MSG (ARABIC, buffer, "Looking for %u's stopped at %u", cc, i);
if (i == end)
break;
@ -698,10 +698,10 @@ reorder_marks_arabic (const hb_ot_shape_plan_t *plan HB_UNUSED,
if (i == j)
continue;
DEBUG_MSG (ARABIC, buffer, "Found %d's from %d to %d", cc, i, j);
DEBUG_MSG (ARABIC, buffer, "Found %u's from %u to %u", cc, i, j);
/* Shift it! */
DEBUG_MSG (ARABIC, buffer, "Shifting %d's: %d %d", cc, i, j);
DEBUG_MSG (ARABIC, buffer, "Shifting %u's: %u %u", cc, i, j);
hb_glyph_info_t temp[HB_OT_SHAPE_MAX_COMBINING_MARKS];
assert (j - i <= ARRAY_LENGTH (temp));
buffer->merge_clusters (start, j);

View File

@ -446,7 +446,7 @@ static const int indic_syllable_machine_en_main = 31;
#define found_syllable(syllable_type) \
HB_STMT_START { \
if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \
if (0) fprintf (stderr, "syllable %u..%u %s\n", ts, te, #syllable_type); \
for (unsigned int i = ts; i < te; i++) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \

View File

@ -119,7 +119,7 @@ main := |*
#define found_syllable(syllable_type) \
HB_STMT_START { \
if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \
if (0) fprintf (stderr, "syllable %u..%u %s\n", ts, te, #syllable_type); \
for (unsigned int i = ts; i < te; i++) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \

View File

@ -280,7 +280,7 @@ static const int khmer_syllable_machine_en_main = 21;
#define found_syllable(syllable_type) \
HB_STMT_START { \
if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \
if (0) fprintf (stderr, "syllable %u..%u %s\n", ts, te, #syllable_type); \
for (unsigned int i = ts; i < te; i++) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \

View File

@ -103,7 +103,7 @@ main := |*
#define found_syllable(syllable_type) \
HB_STMT_START { \
if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \
if (0) fprintf (stderr, "syllable %u..%u %s\n", ts, te, #syllable_type); \
for (unsigned int i = ts; i < te; i++) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \

View File

@ -429,7 +429,7 @@ static const int myanmar_syllable_machine_en_main = 0;
#define found_syllable(syllable_type) \
HB_STMT_START { \
if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \
if (0) fprintf (stderr, "syllable %u..%u %s\n", ts, te, #syllable_type); \
for (unsigned int i = ts; i < te; i++) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \

View File

@ -118,7 +118,7 @@ main := |*
#define found_syllable(syllable_type) \
HB_STMT_START { \
if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \
if (0) fprintf (stderr, "syllable %u..%u %s\n", ts, te, #syllable_type); \
for (unsigned int i = ts; i < te; i++) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \

View File

@ -835,7 +835,7 @@ static const int use_syllable_machine_en_main = 0;
#define found_syllable(syllable_type) \
HB_STMT_START { \
if (0) fprintf (stderr, "syllable %d..%d %s\n", (*ts).second.first, (*te).second.first, #syllable_type); \
if (0) fprintf (stderr, "syllable %u..%u %s\n", (*ts).second.first, (*te).second.first, #syllable_type); \
for (unsigned i = (*ts).second.first; i < (*te).second.first; ++i) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \

View File

@ -183,7 +183,7 @@ main := |*
#define found_syllable(syllable_type) \
HB_STMT_START { \
if (0) fprintf (stderr, "syllable %d..%d %s\n", (*ts).second.first, (*te).second.first, #syllable_type); \
if (0) fprintf (stderr, "syllable %u..%u %s\n", (*ts).second.first, (*te).second.first, #syllable_type); \
for (unsigned i = (*ts).second.first; i < (*te).second.first; ++i) \
info[i].syllable() = (syllable_serial << 4) | syllable_type; \
syllable_serial++; \

View File

@ -626,7 +626,7 @@ test_langs_sorted ()
int c = ot_languages2[i].cmp (&ot_languages2[i - 1]);
if (c > 0)
{
fprintf (stderr, "ot_languages2 not sorted at index %d: %08x %d %08x\n",
fprintf (stderr, "ot_languages2 not sorted at index %u: %08x %d %08x\n",
i, ot_languages2[i-1].language, c, ot_languages2[i].language);
abort();
}
@ -637,7 +637,7 @@ test_langs_sorted ()
int c = ot_languages3[i].cmp (&ot_languages3[i - 1]);
if (c > 0)
{
fprintf (stderr, "ot_languages3 not sorted at index %d: %08x %d %08x\n",
fprintf (stderr, "ot_languages3 not sorted at index %u: %08x %d %08x\n",
i, ot_languages3[i-1].language, c, ot_languages3[i].language);
abort();
}

View File

@ -216,7 +216,7 @@ bool _try_isolating_subgraphs (const hb_vector_t<graph::overflow_record_t>& over
}
DEBUG_MSG (SUBSET_REPACK, nullptr,
"Overflow in space %d (%d roots). Moving %d roots to space %d.",
"Overflow in space %u (%u roots). Moving %u roots to space %u.",
space,
sorted_graph.num_roots_for_space (space),
roots_to_isolate.get_population (),
@ -326,7 +326,7 @@ hb_resolve_graph_overflows (hb_tag_t table_tag,
while (!sorted_graph.in_error ()
&& graph::will_overflow (sorted_graph, &overflows)
&& round < max_rounds) {
DEBUG_MSG (SUBSET_REPACK, nullptr, "=== Overflow resolution round %d ===", round);
DEBUG_MSG (SUBSET_REPACK, nullptr, "=== Overflow resolution round %u ===", round);
print_overflows (sorted_graph, overflows);
hb_set_t priority_bumped_parents;

View File

@ -240,7 +240,7 @@ struct hb_sanitize_context_t :
DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0,
"check_range [%p..%p]"
" (%d bytes) in [%p..%p] -> %s",
" (%u bytes) in [%p..%p] -> %s",
p, p + len, len,
this->start, this->end,
ok ? "OK" : "OUT-OF-RANGE");
@ -308,7 +308,7 @@ struct hb_sanitize_context_t :
this->edit_count++;
DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0,
"may_edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s",
"may_edit(%u) [%p..%p] (%u bytes) in [%p..%p] -> %s",
this->edit_count,
p, p + len, len,
this->start, this->end,
@ -353,13 +353,13 @@ struct hb_sanitize_context_t :
{
if (edit_count)
{
DEBUG_MSG_FUNC (SANITIZE, start, "passed first round with %d edits; going for second round", edit_count);
DEBUG_MSG_FUNC (SANITIZE, start, "passed first round with %u edits; going for second round", edit_count);
/* sanitize again to ensure no toe-stepping */
edit_count = 0;
sane = t->sanitize (this);
if (edit_count) {
DEBUG_MSG_FUNC (SANITIZE, start, "requested %d edits in second round; FAILLING", edit_count);
DEBUG_MSG_FUNC (SANITIZE, start, "requested %u edits in second round; FAILLING", edit_count);
sane = false;
}
}

View File

@ -227,7 +227,7 @@ hb_shape_plan_create2 (hb_face_t *face,
const char * const *shaper_list)
{
DEBUG_MSG_FUNC (SHAPE_PLAN, nullptr,
"face=%p num_features=%d num_coords=%d shaper_list=%p",
"face=%p num_features=%u num_coords=%u shaper_list=%p",
face,
num_user_features,
num_coords,
@ -391,7 +391,7 @@ _hb_shape_plan_execute_internal (hb_shape_plan_t *shape_plan,
unsigned int num_features)
{
DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan,
"num_features=%d shaper_func=%p, shaper_name=%s",
"num_features=%u shaper_func=%p, shaper_name=%s",
num_features,
shape_plan->key.shaper_func,
shape_plan->key.shaper_name);
@ -520,7 +520,7 @@ hb_shape_plan_create_cached2 (hb_face_t *face,
const char * const *shaper_list)
{
DEBUG_MSG_FUNC (SHAPE_PLAN, nullptr,
"face=%p num_features=%d shaper_list=%p",
"face=%p num_features=%u shaper_list=%p",
face,
num_user_features,
shaper_list);

View File

@ -281,7 +281,7 @@ struct hb_subset_plan_t
if (HB_DEBUG_SUBSET)
{
hb_blob_t *source_blob = source->reference_table (tag);
DEBUG_MSG(SUBSET, nullptr, "add table %c%c%c%c, dest %d bytes, source %d bytes",
DEBUG_MSG(SUBSET, nullptr, "add table %c%c%c%c, dest %u bytes, source %u bytes",
HB_UNTAG(tag),
hb_blob_get_length (contents),
hb_blob_get_length (source_blob));

View File

@ -103,6 +103,7 @@
#pragma GCC diagnostic warning "-Wdisabled-optimization"
#pragma GCC diagnostic warning "-Wdouble-promotion"
#pragma GCC diagnostic warning "-Wformat=2"
#pragma GCC diagnostic warning "-Wformat-signedness"
#pragma GCC diagnostic warning "-Wignored-pragma-optimize"
#pragma GCC diagnostic warning "-Wlogical-op"
#pragma GCC diagnostic warning "-Wmaybe-uninitialized"
@ -114,7 +115,6 @@
/* Ignored currently, but should be fixed at some point. */
#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED
#pragma GCC diagnostic ignored "-Wconversion" // TODO fix
#pragma GCC diagnostic ignored "-Wformat-signedness" // TODO fix
#pragma GCC diagnostic ignored "-Wshadow" // TODO fix
#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations" // TODO fix
#pragma GCC diagnostic ignored "-Wunused-parameter" // TODO fix

View File

@ -220,7 +220,7 @@ layered_glyph_dump (hb_font_t *font, hb_draw_funcs_t *funcs, unsigned face_index
hb_glyph_extents_t extents = {0};
if (!hb_font_get_glyph_extents (font, gid, &extents))
{
printf ("Skip gid: %d\n", gid);
printf ("Skip gid: %u\n", gid);
continue;
}
@ -270,7 +270,7 @@ dump_glyphs (hb_font_t *font, hb_draw_funcs_t *funcs, unsigned face_index)
hb_glyph_extents_t extents = {0};
if (!hb_font_get_glyph_extents (font, gid, &extents))
{
printf ("Skip gid: %d\n", gid);
printf ("Skip gid: %u\n", gid);
continue;
}
@ -393,18 +393,18 @@ print_layout_info_using_private_api (hb_blob_t *blob)
}
unsigned num_faces = hb_face_count (blob);
printf ("%d font(s) found in file\n", num_faces);
printf ("%u font(s) found in file\n", num_faces);
for (unsigned n_font = 0; n_font < num_faces; ++n_font)
{
const OpenTypeFontFace &font = ot.get_face (n_font);
printf ("Font %d of %d:\n", n_font, num_faces);
printf ("Font %u of %u:\n", n_font, num_faces);
unsigned num_tables = font.get_table_count ();
printf (" %d table(s) found in font\n", num_tables);
printf (" %u table(s) found in font\n", num_tables);
for (unsigned n_table = 0; n_table < num_tables; ++n_table)
{
const OpenTypeTable &table = font.get_table (n_table);
printf (" Table %2d of %2d: %.4s (0x%08x+0x%08x)\n", n_table, num_tables,
printf (" Table %2u of %2u: %.4s (0x%08x+0x%08x)\n", n_table, num_tables,
(const char *) table.tag,
(unsigned) table.offset,
(unsigned) table.length);
@ -419,11 +419,11 @@ print_layout_info_using_private_api (hb_blob_t *blob)
const GSUBGPOS &g = *reinterpret_cast<const GSUBGPOS *> (font_data + table.offset);
unsigned num_scripts = g.get_script_count ();
printf (" %d script(s) found in table\n", num_scripts);
printf (" %u script(s) found in table\n", num_scripts);
for (unsigned n_script = 0; n_script < num_scripts; ++n_script)
{
const Script &script = g.get_script (n_script);
printf (" Script %2d of %2d: %.4s\n", n_script, num_scripts,
printf (" Script %2u of %2u: %.4s\n", n_script, num_scripts,
(const char *) g.get_script_tag (n_script));
if (!script.has_default_lang_sys ())
@ -443,41 +443,41 @@ print_layout_info_using_private_api (hb_blob_t *blob)
if (!langsys.has_required_feature ())
printf (" No required feature\n");
else
printf (" Required feature index: %d\n",
printf (" Required feature index: %u\n",
langsys.get_required_feature_index ());
unsigned num_features = langsys.get_feature_count ();
printf (" %d feature(s) found in language system\n", num_features);
printf (" %u feature(s) found in language system\n", num_features);
for (unsigned n_feature = 0; n_feature < num_features; ++n_feature)
{
printf (" Feature index %2d of %2d: %d\n", n_feature, num_features,
printf (" Feature index %2u of %2u: %u\n", n_feature, num_features,
langsys.get_feature_index (n_feature));
}
}
}
unsigned num_features = g.get_feature_count ();
printf (" %d feature(s) found in table\n", num_features);
printf (" %u feature(s) found in table\n", num_features);
for (unsigned n_feature = 0; n_feature < num_features; ++n_feature)
{
const Feature &feature = g.get_feature (n_feature);
unsigned num_lookups = feature.get_lookup_count ();
printf (" Feature %2d of %2d: %c%c%c%c\n", n_feature, num_features,
printf (" Feature %2u of %2u: %c%c%c%c\n", n_feature, num_features,
HB_UNTAG (g.get_feature_tag (n_feature)));
printf (" %d lookup(s) found in feature\n", num_lookups);
printf (" %u lookup(s) found in feature\n", num_lookups);
for (unsigned n_lookup = 0; n_lookup < num_lookups; ++n_lookup) {
printf (" Lookup index %2d of %2d: %d\n", n_lookup, num_lookups,
printf (" Lookup index %2u of %2u: %u\n", n_lookup, num_lookups,
feature.get_lookup_index (n_lookup));
}
}
unsigned num_lookups = g.get_lookup_count ();
printf (" %d lookup(s) found in table\n", num_lookups);
printf (" %u lookup(s) found in table\n", num_lookups);
for (unsigned n_lookup = 0; n_lookup < num_lookups; ++n_lookup)
{
const Lookup &lookup = g.get_lookup (n_lookup);
printf (" Lookup %2d of %2d: type %d, props 0x%04X\n", n_lookup, num_lookups,
printf (" Lookup %2u of %2u: type %u, props 0x%04X\n", n_lookup, num_lookups,
lookup.get_type (), lookup.get_props ());
}
@ -519,7 +519,7 @@ main (int argc, char **argv)
hb_blob_t *blob = hb_blob_create_from_file_or_fail (argv[1]);
assert (blob);
printf ("Opened font file %s: %d bytes long\n", argv[1], hb_blob_get_length (blob));
printf ("Opened font file %s: %u bytes long\n", argv[1], hb_blob_get_length (blob));
#ifndef MAIN_CC_NO_PRIVATE_API
print_layout_info_using_private_api (blob);
#endif

View File

@ -54,9 +54,9 @@ main (int argc, char **argv)
for (unsigned i = 0; i < count; ++i)
{
hb_blob_t *entry = hb_ot_meta_reference_entry (face, tags[i]);
printf ("%c%c%c%c, size: %d: %.*s\n",
printf ("%c%c%c%c, size: %u: %.*s\n",
HB_UNTAG (tags[i]), hb_blob_get_length (entry),
hb_blob_get_length (entry), hb_blob_get_data (entry, nullptr));
(int) hb_blob_get_length (entry), hb_blob_get_data (entry, nullptr));
hb_blob_destroy (entry);
}
free (tags);

View File

@ -32,7 +32,7 @@ test (hb_codepoint_t cp, unsigned int bit)
{
if (OT::_hb_ot_os2_get_unicode_range_bit (cp) != bit)
{
fprintf (stderr, "got incorrect bit (%d) for cp 0x%X. Should have been %d.",
fprintf (stderr, "got incorrect bit (%u) for cp 0x%X. Should have been %u.",
OT::_hb_ot_os2_get_unicode_range_bit (cp),
cp,
bit);

View File

@ -75,7 +75,7 @@ main (int argc, char **argv)
hb_glyph_info_t *info = &infos[i];
hb_glyph_position_t *pos = &positions[i];
printf ("cluster %d glyph 0x%x at (%d,%d)+(%d,%d)\n",
printf ("cluster %u glyph 0x%x at (%d,%d)+(%d,%d)\n",
info->cluster,
info->codepoint,
pos->x_offset,

View File

@ -273,7 +273,7 @@ font_options_t::add_options (option_parser_t *parser)
font_size_text = (char *) "Font size (default: upem)";
else
{
font_size_text = g_strdup_printf ("Font size (default: %d)", DEFAULT_FONT_SIZE);
font_size_text = g_strdup_printf ("Font size (default: %u)", DEFAULT_FONT_SIZE);
parser->free_later (font_size_text);
}

View File

@ -124,7 +124,7 @@ shape_format_options_t::serialize_line_no (unsigned int line_no,
GString *gs)
{
if (show_line_num)
g_string_append_printf (gs, "%d: ", line_no);
g_string_append_printf (gs, "%u: ", line_no);
}
inline void
shape_format_options_t::serialize_buffer_of_text (hb_buffer_t *buffer,