From 9717127a5be037e26afe52332a8b07f13474557a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 4 Nov 2005 23:55:38 +0000 Subject: [PATCH] Turn various gcc warnings off. Adding const, adding static, fully 2005-11-04 Behdad Esfahbod * configure.in, examples/argcontext.c examples/cairoview.c, examples/renderdemo.c, examples/renderdemo.h examples/xftview.c, modules/basic/basic-x.c, modules/hangul/hangul-fc.c, modules/hebrew/hebrew-shaper.c, modules/hebrew/hebrew-shaper.h, modules/indic/indic-fc.c, modules/indic/mprefixups.c, modules/syriac/syriac-fc.c, pango/break.c pango/fonts.c, pango/modules.c, pango/pango-coverage.c pango/pango-engine.c, pango/pango-engine.h, pango/pango-fontmap.c, pango/pango-fontset.c, pango/pango-impl-utils.h, pango/pango-layout.c, pango/pango-layout.h, pango/pango-renderer.c, pango/pango-script.c, pango/pango-utils.c, pango/pangocairo-fc.h, pango/pangocairo-font.c, pango/pangocairo-fontmap.c, pango/pangocairo-private.h, pango/pangofc-decoder.c, pango/pangofc-font.c, pango/pangofc-fontmap.c pango/pangoft2.c, pango/pangox-fontcache.c, pango/pangox-fontmap.c pango/pangox.c, pango/pangoxft-font.c, pango/querymodules.c, pango/opentype/ftglue.c, pango/opentype/ftxgpos.c, pango/opentype/ftxopen.c, pango/opentype/pango-ot-buffer.c, pango/opentype/pango-ot-info.c, pango/opentype/pango-ot-ruleset.c, tests/dump-boundaries.c, tests/testboundaries.c, tests/testcolor.c tests/testiter.c, tests/testscript.c: Turn various gcc warnings off. Adding const, adding static, fully initializing structs, match signedness in comparisons. (#317804) * tests/testscript.c, tools/gen-script-for-lang.c: (scripts_for_file): Pass error->message instead of error to fail(), which was wrong. (compare_lang): Fix typo comparing a and a instead of a and b. --- src/ftglue.c | 2 +- src/ftxgpos.c | 4 ++++ src/ftxopen.c | 1 + src/pango-ot-buffer.c | 4 ++-- src/pango-ot-info.c | 5 +++-- src/pango-ot-ruleset.c | 5 +++-- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ftglue.c b/src/ftglue.c index ebddfa74b..bf895ec36 100644 --- a/src/ftglue.c +++ b/src/ftglue.c @@ -138,7 +138,7 @@ ftglue_stream_seek( FT_Stream stream, if ( stream->read( stream, pos, 0, 0 ) ) error = FT_Err_Invalid_Stream_Operation; } - else if ( pos > stream->size ) + else if ( pos > (FT_Long)stream->size ) error = FT_Err_Invalid_Stream_Operation; LOG(( "ftglue:stream:seek(%ld) -> %d\n", pos, error )); diff --git a/src/ftxgpos.c b/src/ftxgpos.c index d47431814..ef9e6687d 100644 --- a/src/ftxgpos.c +++ b/src/ftxgpos.c @@ -2154,6 +2154,7 @@ base_offset = FILE_Pos(); + fprintf (stderr, "%04lx base offset (behdad)\n", base_offset); if ( ACCESS_Frame( 4L ) ) return error; @@ -2163,6 +2164,9 @@ FORGET_Frame(); + if (mbp->PosFormat != 1) + return TTO_Err_Invalid_SubTable_Format; + cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = Load_Coverage( &mbp->MarkCoverage, stream ) ) != TT_Err_Ok ) diff --git a/src/ftxopen.c b/src/ftxopen.c index 75f66be5f..c44e8ef8a 100644 --- a/src/ftxopen.c +++ b/src/ftxopen.c @@ -904,6 +904,7 @@ return Load_Coverage2( &c->cf.cf2, stream ); default: + fprintf (stderr, "at ftxopen.c:907, got %d (behdad)\n", c->CoverageFormat); return TTO_Err_Invalid_SubTable_Format; } diff --git a/src/pango-ot-buffer.c b/src/pango-ot-buffer.c index 057739fd3..c69abb0b5 100644 --- a/src/pango-ot-buffer.c +++ b/src/pango-ot-buffer.c @@ -211,7 +211,7 @@ pango_ot_buffer_output (PangoOTBuffer *buffer, FT_Face face; PangoOTInfo *info; TTO_GDEF gdef = NULL; - int i; + unsigned int i; int last_cluster; face = pango_fc_font_lock_face (buffer->font); @@ -240,7 +240,7 @@ pango_ot_buffer_output (PangoOTBuffer *buffer, gdef = pango_ot_info_get_gdef (info); /* Apply default positioning */ - for (i = 0; i < glyphs->num_glyphs; i++) + for (i = 0; i < (unsigned int)glyphs->num_glyphs; i++) { if (glyphs->glyphs[i].glyph) { diff --git a/src/pango-ot-info.c b/src/pango-ot-info.c index 1b6a18079..221b3110c 100644 --- a/src/pango-ot-info.c +++ b/src/pango-ot-info.c @@ -52,7 +52,8 @@ pango_ot_info_get_type (void) NULL, /* class_data */ sizeof (PangoOTInfo), 0, /* n_preallocs */ - NULL /* init */ + NULL, /* init */ + NULL, /* value_table */ }; object_type = g_type_register_static (G_TYPE_OBJECT, @@ -217,7 +218,7 @@ synthesize_class_def (PangoOTInfo *info) FT_UShort *classes; FT_ULong charcode; FT_UInt glyph; - int i, j; + unsigned int i, j; FT_CharMap old_charmap; old_charmap = info->face->charmap; diff --git a/src/pango-ot-ruleset.c b/src/pango-ot-ruleset.c index 780814bef..bfba00cb4 100644 --- a/src/pango-ot-ruleset.c +++ b/src/pango-ot-ruleset.c @@ -55,6 +55,7 @@ pango_ot_ruleset_get_type (void) sizeof (PangoOTRuleset), 0, /* n_preallocs */ (GInstanceInitFunc)pango_ot_ruleset_init, + NULL /* value_table */ }; object_type = g_type_register_static (G_TYPE_OBJECT, @@ -140,7 +141,7 @@ void pango_ot_ruleset_substitute (PangoOTRuleset *ruleset, PangoOTBuffer *buffer) { - int i; + unsigned int i; TTO_GSUB gsub = NULL; @@ -173,7 +174,7 @@ void pango_ot_ruleset_position (PangoOTRuleset *ruleset, PangoOTBuffer *buffer) { - int i; + unsigned int i; TTO_GPOS gpos = NULL;