diff options
53 files changed, 216 insertions, 148 deletions
@@ -1,3 +1,36 @@ +2005-11-04 Behdad Esfahbod <behdad@gnome.org> + + * 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. + 2005-11-04 Federico Mena Quintero <federico@ximian.com> Fixes #320665: diff --git a/configure.in b/configure.in index f5382353..b553fe39 100644 --- a/configure.in +++ b/configure.in @@ -636,7 +636,7 @@ done IFS="$pango_save_ifs" cat >> pango/module-defs-x.c <<EOTEXT - { NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL }, }; EOTEXT ]) @@ -665,7 +665,7 @@ done IFS="$pango_save_ifs" cat >> pango/module-defs-fc.c <<EOTEXT - { NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL }, }; EOTEXT ]) @@ -694,7 +694,7 @@ done IFS="$pango_save_ifs" cat >> pango/module-defs-win32.c <<EOTEXT - { NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL }, }; EOTEXT ]) diff --git a/examples/argcontext.c b/examples/argcontext.c index a68650bc..222c0e68 100644 --- a/examples/argcontext.c +++ b/examples/argcontext.c @@ -99,7 +99,7 @@ parse_int (const char *arg_name, void arg_context_print_help (ArgContext *context) { - int j, k; + unsigned int j, k; int max_name_len = 0; for (j = 0; j < context->tables->len; j++) @@ -169,7 +169,7 @@ arg_context_parse (ArgContext *context, if (strncmp (arg, table[k].name, len) == 0 && (arg[len] == '=' || arg[len] == 0)) { - char *value = NULL; + const char *value = NULL; (*argv)[i] = NULL; @@ -187,7 +187,7 @@ arg_context_parse (ArgContext *context, switch (table[k].type) { case ARG_STRING: - *(gchar **)table[k].location = value; + *(const gchar **)table[k].location = value; break; case ARG_INT: if (!parse_int (table[k].name, value, diff --git a/examples/cairoview.c b/examples/cairoview.c index c80535b7..6a532da8 100644 --- a/examples/cairoview.c +++ b/examples/cairoview.c @@ -123,7 +123,7 @@ do_cairo_transform (PangoContext *context, } void -update () +update (void) { RenderData render_data; cairo_surface_t *surface; diff --git a/examples/renderdemo.c b/examples/renderdemo.c index a1225121..07ca1615 100644 --- a/examples/renderdemo.c +++ b/examples/renderdemo.c @@ -42,7 +42,7 @@ char *prog_name; gboolean opt_display = FALSE; int opt_dpi = 96; -char *opt_font = MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE); +const char *opt_font = MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE); gboolean opt_header = FALSE; char *opt_output = NULL; int opt_margin = 10; @@ -74,7 +74,7 @@ fail (const char *format, ...) exit (1); } -PangoFontDescription * +static PangoFontDescription * get_font_description (void) { PangoFontDescription *font_description = pango_font_description_from_string (opt_font); @@ -304,6 +304,12 @@ static void show_help (ArgContext *context, const char *name, const char *arg, + gpointer data) G_GNUC_NORETURN; + +static void +show_help (ArgContext *context, + const char *name, + const char *arg, gpointer data) { g_print ("%s - An example viewer for Pango\n" @@ -379,42 +385,42 @@ parse_options (int argc, char *argv[]) { static const ArgDesc args[] = { { "no-auto-dir","Don't set layout direction according to contents", - ARG_NOBOOL, &opt_auto_dir }, + ARG_NOBOOL, &opt_auto_dir, NULL }, { "display", "Show output using ImageMagick", - ARG_BOOL, &opt_display }, + ARG_BOOL, &opt_display, NULL }, { "dpi", "Set the dpi'", - ARG_INT, &opt_dpi }, + ARG_INT, &opt_dpi, NULL }, { "ellipsize", "Ellipsization mode [=none/start/middle/end]", ARG_CALLBACK, NULL, parse_ellipsis }, { "font", "Set the font name", - ARG_STRING, &opt_font }, + ARG_STRING, &opt_font, NULL }, { "header", "Display the options in the output", - ARG_BOOL, &opt_header }, + ARG_BOOL, &opt_header, NULL }, { "help", "Show this output", - ARG_CALLBACK, NULL, show_help, }, + ARG_CALLBACK, NULL, show_help }, { "hinting", "Hinting style [=none/auto/full]", - ARG_CALLBACK, NULL, parse_hinting, }, + ARG_CALLBACK, NULL, parse_hinting }, { "margin", "Set the margin on the output in pixels", - ARG_INT, &opt_margin }, + ARG_INT, &opt_margin, NULL }, { "markup", "Interpret contents as Pango markup", - ARG_BOOL, &opt_markup }, + ARG_BOOL, &opt_markup, NULL }, { "output", "Name of output file", - ARG_STRING, &opt_output }, + ARG_STRING, &opt_output, NULL }, { "rtl", "Set base dir to RTL", - ARG_BOOL, &opt_rtl }, + ARG_BOOL, &opt_rtl, NULL }, { "rotate", "Angle at which to rotate results", - ARG_INT, &opt_rotate }, + ARG_INT, &opt_rotate, NULL }, { "text", "Text to display (instead of a file)", - ARG_STRING, &opt_text }, + ARG_STRING, &opt_text, NULL }, { "waterfall", "Create a waterfall display", - ARG_BOOL, &opt_waterfall }, + ARG_BOOL, &opt_waterfall, NULL }, { "width", "Width in points to which to wrap output", - ARG_INT, &opt_width }, + ARG_INT, &opt_width, NULL }, { "indent", "Width in points to indent paragraphs", - ARG_INT, &opt_indent }, + ARG_INT, &opt_indent, NULL }, { "runs", "Render text this many times", - ARG_INT, &opt_runs }, - { NULL } + ARG_INT, &opt_runs, NULL }, + { NULL, NULL, 0, NULL, NULL } }; ArgContext *arg_context; diff --git a/examples/renderdemo.h b/examples/renderdemo.h index db09dd23..bd283349 100644 --- a/examples/renderdemo.h +++ b/examples/renderdemo.h @@ -37,7 +37,7 @@ typedef void (*TransformCallback) (PangoContext *context, PangoMatrix *transform, gpointer data); -void fail (const char *format, ...) G_GNUC_PRINTF (1, 2); +void fail (const char *format, ...) G_GNUC_PRINTF (1, 2) G_GNUC_NORETURN; void parse_options (int argc, char *argv[]); @@ -47,7 +47,8 @@ void do_output (PangoContext *context, gpointer cb_data, int *width, int *height); -void finalize (void); +void update (void); +void finalize (void); void fc_substitute_func (FcPattern *pattern, gpointer data); gchar *get_options_string (void); @@ -56,7 +57,7 @@ extern char *prog_name; extern gboolean opt_display; extern int opt_dpi; -extern char *opt_font; +extern const char *opt_font; extern gboolean opt_header; extern char *opt_output; extern int opt_margin; diff --git a/examples/xftview.c b/examples/xftview.c index 0bfcec04..ba0a6215 100644 --- a/examples/xftview.c +++ b/examples/xftview.c @@ -51,7 +51,7 @@ xft_render (PangoLayout *layout, } void -update () +update (void) { XRectangle area; XftColor color; diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c index 22dbb671..3b440db4 100644 --- a/modules/basic/basic-x.c +++ b/modules/basic/basic-x.c @@ -51,8 +51,8 @@ typedef PangoGlyph (*ConvFunc) (CharCache *cache, struct _Charset { int index; - char *id; - char *x_charset; + const char *id; + const char *x_charset; ConvFunc conv_func; }; @@ -214,7 +214,7 @@ find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input) mask_table = cache->mask_tables[mask_index]; else { - char *charset_names[G_N_ELEMENTS(charsets)]; + const char *charset_names[G_N_ELEMENTS(charsets)]; Charset *charsets_map[G_N_ELEMENTS(charsets)]; guint mask; int n_charsets = 0; @@ -227,7 +227,7 @@ find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input) /* Find the character sets that are included in this mask */ - for (i=0; i<G_N_ELEMENTS(charsets); i++) + for (i=0; i<(int)G_N_ELEMENTS(charsets); i++) { int charset_index = cache->ordering->charsets[i]; @@ -240,7 +240,7 @@ find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input) } } - mask_table->n_subfonts = pango_x_list_subfonts (font, charset_names, n_charsets, &mask_table->subfonts, &subfont_charsets); + mask_table->n_subfonts = pango_x_list_subfonts (font, (char**)charset_names, n_charsets, &mask_table->subfonts, &subfont_charsets); mask_table->charsets = g_new (Charset *, mask_table->n_subfonts); for (i=0; i<mask_table->n_subfonts; i++) @@ -371,8 +371,8 @@ conv_16bit (CharCache *cache, static PangoGlyph conv_16bit_MSB_on (CharCache *cache, - GIConv cd, - const char *input) + GIConv cd, + const char *input) { char outbuf[2]; @@ -490,7 +490,7 @@ ordering_for_lang (PangoLanguage *lang) { int i; - for (i = 0; i < G_N_ELEMENTS (charset_orderings) - 1; i++) + for (i = 0; i < (int)G_N_ELEMENTS (charset_orderings) - 1; i++) { if (pango_language_matches (lang, charset_orderings[i].langs)) return &charset_orderings[i]; diff --git a/modules/hangul/hangul-fc.c b/modules/hangul/hangul-fc.c index ad7a239a..26485b8b 100644 --- a/modules/hangul/hangul-fc.c +++ b/modules/hangul/hangul-fc.c @@ -312,7 +312,7 @@ hangul_engine_shape (PangoEngineShape *engine, const char *p, *start; gunichar jamos_static[8]; - guint max_jamos = G_N_ELEMENTS (jamos_static); + gint max_jamos = G_N_ELEMENTS (jamos_static); gunichar *jamos = jamos_static; int n_jamos; diff --git a/modules/hebrew/hebrew-shaper.c b/modules/hebrew/hebrew-shaper.c index 6e6890fa..3e3a2183 100644 --- a/modules/hebrew/hebrew-shaper.c +++ b/modules/hebrew/hebrew-shaper.c @@ -31,6 +31,7 @@ #include <glib.h> #include "pango-engine.h" +#include "hebrew-shaper.h" /* Wrap all characters above 0xF00 to ALEF. */ #define ishebrew(wc) ((wc)>0x590 && (wc)<0x600) diff --git a/modules/hebrew/hebrew-shaper.h b/modules/hebrew/hebrew-shaper.h index 612de35b..24603433 100644 --- a/modules/hebrew/hebrew-shaper.h +++ b/modules/hebrew/hebrew-shaper.h @@ -23,7 +23,7 @@ #ifndef HEBREW_SHAPER_H #define HEBREW_SHAPER_H -char * +const char * hebrew_shaper_get_next_cluster(const char *text, gint length, gunichar *cluster, diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c index b1a8ba6e..49bbd0d9 100644 --- a/modules/indic/indic-fc.c +++ b/modules/indic/indic-fc.c @@ -45,8 +45,8 @@ struct _PangoIndicInfo { PangoOTTag scriptTag; const IndicOTClassTable *classTable; - gchar *gsubQuarkName; - gchar *gposQuarkName; + const gchar *gsubQuarkName; + const gchar *gposQuarkName; }; #define ENGINE_SUFFIX "ScriptEngineFc" @@ -250,7 +250,13 @@ get_gpos_ruleset (FT_Face face, const PangoIndicInfo *indic_info) } static void -set_glyphs (PangoFont *font, FT_Face face, const gunichar *wcs, gulong *tags, glong n_glyphs, PangoOTBuffer *buffer, gboolean process_zwj) +set_glyphs (PangoFont *font, + FT_Face face, + const gunichar *wcs, + gulong *tags, + glong n_glyphs, + PangoOTBuffer *buffer, + gboolean process_zwj) { gint i; @@ -416,7 +422,7 @@ PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, PangoEngine * PANGO_MODULE_ENTRY(create) (const char *id) { - gint i; + guint i; for (i = 0; i < G_N_ELEMENTS(script_engines); i += 1) { diff --git a/modules/indic/mprefixups.c b/modules/indic/mprefixups.c index a3a3d018..c9dba6c3 100644 --- a/modules/indic/mprefixups.c +++ b/modules/indic/mprefixups.c @@ -64,8 +64,8 @@ void indic_mprefixups_apply(MPreFixups *mprefixups, PangoOTBuffer *buffer) glong fixup; for (fixup = 0; fixup < mprefixups->fFixupCount; fixup += 1) { - glong baseIndex = mprefixups->fFixupData[fixup].fBaseIndex; - glong mpreIndex = mprefixups->fFixupData[fixup].fMPreIndex; + gulong baseIndex = mprefixups->fFixupData[fixup].fBaseIndex; + gulong mpreIndex = mprefixups->fFixupData[fixup].fMPreIndex; glong baseGlyph = -1; glong mpreGlyph = -1; glong mpreLimit = -1; diff --git a/modules/syriac/syriac-fc.c b/modules/syriac/syriac-fc.c index 8f054c55..926d486e 100644 --- a/modules/syriac/syriac-fc.c +++ b/modules/syriac/syriac-fc.c @@ -161,7 +161,11 @@ swap_range (PangoGlyphString *glyphs, int start, int end) } static void -set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGlyph glyph) +set_glyph (PangoFont *font, + PangoGlyphString *glyphs, + int i, + int offset, + PangoGlyph glyph) { glyphs->glyphs[i].glyph = glyph; glyphs->log_clusters[i] = offset; diff --git a/pango/break.c b/pango/break.c index cc123add..8b4ecceb 100644 --- a/pango/break.c +++ b/pango/break.c @@ -1523,7 +1523,7 @@ pango_get_log_attrs (const char *text, int chars_in_range; static guint engine_type_id = 0; static guint render_type_id = 0; - PangoAnalysis analysis = { NULL, NULL, NULL, 0 }; + PangoAnalysis analysis = { NULL, NULL, NULL, 0, NULL, NULL }; analysis.level = level; diff --git a/pango/fonts.c b/pango/fonts.c index ebea1783..f41a4292 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -867,7 +867,7 @@ parse_size (const char *word, char *end; double size = g_ascii_strtod (word, &end); - if (end - word == wordlen) /* word is a valid float */ + if ((size_t)(end - word) == wordlen) /* word is a valid float */ { if (pango_size) *pango_size = (int)(size * PANGO_SCALE + 0.5); diff --git a/pango/modules.c b/pango/modules.c index d0ede877..096d3b87 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -172,7 +172,7 @@ pango_module_load (GTypeModule *module) pango_module->library = g_module_open (pango_module->path, G_MODULE_BIND_LAZY); if (!pango_module->library) { - g_warning (g_module_error()); + g_warning ("%s", g_module_error()); return FALSE; } @@ -186,7 +186,7 @@ pango_module_load (GTypeModule *module) !g_module_symbol (pango_module->library, "script_engine_create", (gpointer *)&pango_module->create)) { - g_warning (g_module_error()); + g_warning ("%s", g_module_error()); g_module_close (pango_module->library); return FALSE; @@ -545,7 +545,7 @@ map_add_engine (PangoMapInfo *info, } script = pair->info.scripts[i].script; - if (script >= map->entries->len) + if ((guint)script >= map->entries->len) g_array_set_size (map->entries, script + 1); entry = &g_array_index (map->entries, PangoMapEntry, script); @@ -635,7 +635,7 @@ pango_map_get_engine (PangoMap *map, PangoMapEntry *entry = NULL; PangoMapEntry *common_entry = NULL; - if (script < map->entries->len) + if ((guint)script < map->entries->len) entry = &g_array_index (map->entries, PangoMapEntry, script); if (PANGO_SCRIPT_COMMON < map->entries->len) @@ -692,7 +692,7 @@ pango_map_get_engines (PangoMap *map, PangoMapEntry *entry = NULL; PangoMapEntry *common_entry = NULL; - if (script < map->entries->len) + if ((guint)script < map->entries->len) entry = &g_array_index (map->entries, PangoMapEntry, script); if (PANGO_SCRIPT_COMMON < map->entries->len) diff --git a/pango/opentype/ftglue.c b/pango/opentype/ftglue.c index ebddfa74..bf895ec3 100644 --- a/pango/opentype/ftglue.c +++ b/pango/opentype/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/pango/opentype/ftxgpos.c b/pango/opentype/ftxgpos.c index d4743181..ef9e6687 100644 --- a/pango/opentype/ftxgpos.c +++ b/pango/opentype/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/pango/opentype/ftxopen.c b/pango/opentype/ftxopen.c index 75f66be5..c44e8ef8 100644 --- a/pango/opentype/ftxopen.c +++ b/pango/opentype/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/pango/opentype/pango-ot-buffer.c b/pango/opentype/pango-ot-buffer.c index 057739fd..c69abb0b 100644 --- a/pango/opentype/pango-ot-buffer.c +++ b/pango/opentype/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/pango/opentype/pango-ot-info.c b/pango/opentype/pango-ot-info.c index 1b6a1807..221b3110 100644 --- a/pango/opentype/pango-ot-info.c +++ b/pango/opentype/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/pango/opentype/pango-ot-ruleset.c b/pango/opentype/pango-ot-ruleset.c index 780814be..bfba00cb 100644 --- a/pango/opentype/pango-ot-ruleset.c +++ b/pango/opentype/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; diff --git a/pango/pango-coverage.c b/pango/pango-coverage.c index 62638280..5fd7ccab 100644 --- a/pango/pango-coverage.c +++ b/pango/pango-coverage.c @@ -208,7 +208,7 @@ pango_coverage_set (PangoCoverage *coverage, g_return_if_fail (coverage != NULL); g_return_if_fail (index >= 0); - g_return_if_fail (level >= 0 || level <= 3); + g_return_if_fail (level >= 0 && level <= 3); block_index = index / 256; diff --git a/pango/pango-engine.c b/pango/pango-engine.c index d421a1ac..fac90bc1 100644 --- a/pango/pango-engine.c +++ b/pango/pango-engine.c @@ -46,7 +46,7 @@ pango_engine_shape_real_covers (PangoEngineShape *engine, return result; } -void +static void pango_engine_shape_class_init (PangoEngineShapeClass *class) { class->covers = pango_engine_shape_real_covers; diff --git a/pango/pango-engine.h b/pango/pango-engine.h index fcac62b8..daf15a3d 100644 --- a/pango/pango-engine.h +++ b/pango/pango-engine.h @@ -274,10 +274,11 @@ prefix ## _register_type (GTypeModule *module) \ (GBaseFinalizeFunc) NULL, \ (GClassInitFunc) class_init, \ (GClassFinalizeFunc) NULL, \ - NULL, /* class_data */ \ + NULL, /* class_data */ \ sizeof (name), \ 0, /* n_prelocs */ \ (GInstanceInitFunc) instance_init, \ + NULL /* value_table */ \ }; \ \ prefix ## _type = g_type_module_register_type (module, parent_type, \ diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c index 80fcfbd3..c518ae74 100644 --- a/pango/pango-fontmap.c +++ b/pango/pango-fontmap.c @@ -111,7 +111,7 @@ pango_font_map_fontset_add_fonts (PangoFontMap *fontmap, PangoContext *context, PangoFontsetSimple *fonts, PangoFontDescription *desc, - char *family) + const char *family) { char **aliases; int n_aliases; diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c index f02344a1..542c745d 100644 --- a/pango/pango-fontset.c +++ b/pango/pango-fontset.c @@ -274,7 +274,7 @@ pango_fontset_simple_finalize (GObject *object) { PangoFontsetSimple *fontset = PANGO_FONTSET_SIMPLE (object); PangoCoverage *coverage; - int i; + unsigned int i; for (i = 0; i < fontset->fonts->len; i++) g_object_unref (g_ptr_array_index(fontset->fonts, i)); @@ -352,7 +352,7 @@ pango_fontset_simple_get_font (PangoFontset *fontset, PangoFont *font; PangoCoverage *coverage; int result = -1; - int i; + unsigned int i; for (i = 0; i < simple->fonts->len; i++) { @@ -387,7 +387,7 @@ pango_fontset_simple_foreach (PangoFontset *fontset, gpointer data) { PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset); - int i; + unsigned int i; for (i = 0; i < simple->fonts->len; i++) { diff --git a/pango/pango-impl-utils.h b/pango/pango-impl-utils.h index fc2e7cf7..498a886c 100644 --- a/pango/pango-impl-utils.h +++ b/pango/pango-impl-utils.h @@ -43,10 +43,11 @@ prefix ## _get_type (void) \ (GBaseFinalizeFunc) NULL, \ (GClassInitFunc) class_init, \ (GClassFinalizeFunc) NULL, \ - NULL, /* class_data */ \ + NULL, /* class_data */ \ sizeof (name), \ 0, /* n_prelocs */ \ - (GInstanceInitFunc) instance_init \ + (GInstanceInitFunc) instance_init, \ + NULL /* value_table */ \ }; \ \ object_type = g_type_register_static (parent_type, \ diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 4ba402fd..24a1fcfb 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -3128,7 +3128,7 @@ no_shape_filter_func (PangoAttribute *attribute, int i; - for (i = 0; i < G_N_ELEMENTS (no_shape_types); i++) + for (i = 0; i < (int)G_N_ELEMENTS (no_shape_types); i++) if (attribute->klass->type == no_shape_types[i]) return TRUE; diff --git a/pango/pango-layout.h b/pango/pango-layout.h index 1c099404..06db0244 100644 --- a/pango/pango-layout.h +++ b/pango/pango-layout.h @@ -163,6 +163,11 @@ void pango_layout_get_log_attrs (PangoLayout *layout, void pango_layout_index_to_pos (PangoLayout *layout, int index_, PangoRectangle *pos); +void pango_layout_index_to_line_x (PangoLayout *layout, + int index_, + gboolean trailing, + int *line, + int *x_pos); void pango_layout_get_cursor_pos (PangoLayout *layout, int index_, PangoRectangle *strong_pos, diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c index 346d435a..c549d682 100644 --- a/pango/pango-renderer.c +++ b/pango/pango-renderer.c @@ -300,6 +300,7 @@ add_underline (PangoRenderer *renderer, new_rect.x = base_x + ink_rect->x; new_rect.width = ink_rect->width; new_rect.height = underline_thickness; + new_rect.y = base_y; switch (renderer->underline) { @@ -309,10 +310,10 @@ add_underline (PangoRenderer *renderer, case PANGO_UNDERLINE_SINGLE: case PANGO_UNDERLINE_DOUBLE: case PANGO_UNDERLINE_ERROR: - new_rect.y = base_y - underline_position; + new_rect.y -= underline_position; break; case PANGO_UNDERLINE_LOW: - new_rect.y = base_y + ink_rect->y + ink_rect->height + underline_thickness; + new_rect.y += ink_rect->y + ink_rect->height + underline_thickness; break; } diff --git a/pango/pango-script.c b/pango/pango-script.c index 9113d799..06839406 100644 --- a/pango/pango-script.c +++ b/pango/pango-script.c @@ -411,7 +411,7 @@ pango_language_includes_script (PangoLanguage *language, PangoScript script) { PangoScriptForLang *script_for_lang; - int j; + unsigned int j; g_return_val_if_fail (language != NULL, FALSE); @@ -551,7 +551,7 @@ pango_script_get_sample_language (PangoScript script) const char *sample_language; g_return_val_if_fail (script >= 0, NULL); - g_return_val_if_fail (script < G_N_ELEMENTS (sample_languages), NULL); + g_return_val_if_fail ((guint)script < G_N_ELEMENTS (sample_languages), NULL); sample_language = sample_languages[script]; diff --git a/pango/pango-utils.c b/pango/pango-utils.c index d118b6bc..f6fe3765 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -421,7 +421,7 @@ pango_scan_string (const char **pos, GString *out) gboolean pango_scan_int (const char **pos, int *out) { - int i = 0; + unsigned int i = 0; char buf[32]; const char *p = *pos; @@ -1204,6 +1204,7 @@ pango_language_copy (PangoLanguage *language) { return language; /* language tags are const */ } + static void pango_language_free (PangoLanguage *language) { diff --git a/pango/pangocairo-fc.h b/pango/pangocairo-fc.h index 7903f03b..9c35aa17 100644 --- a/pango/pangocairo-fc.h +++ b/pango/pangocairo-fc.h @@ -49,6 +49,7 @@ PangoFcFont *_pango_cairo_fc_font_new (PangoCairoFcFontMap *cffontmap, PangoContext *context, const PangoFontDescription *desc, FcPattern *pattern); +FT_Library _pango_cairo_fc_font_map_get_library (PangoCairoFcFontMap *fontmap); G_END_DECLS diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index 7bf700fb..451b9b80 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -39,6 +39,7 @@ pango_cairo_font_get_type (void) NULL, /* class_data */ 0, 0, + NULL, NULL }; diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c index 8dd82877..ff0db202 100644 --- a/pango/pangocairo-fontmap.c +++ b/pango/pangocairo-fontmap.c @@ -47,6 +47,7 @@ pango_cairo_font_map_get_type (void) NULL, /* class_data */ 0, 0, + NULL, NULL }; diff --git a/pango/pangocairo-private.h b/pango/pangocairo-private.h index e7e124b0..d0caea56 100644 --- a/pango/pangocairo-private.h +++ b/pango/pangocairo-private.h @@ -75,6 +75,7 @@ GType pango_cairo_renderer_get_type (void); const cairo_font_options_t *_pango_cairo_context_get_merged_font_options (PangoContext *context); + G_END_DECLS #endif /* __PANGOCAIRO_PRIVATE_H__ */ diff --git a/pango/pangofc-decoder.c b/pango/pangofc-decoder.c index 766e09e7..29a7e54a 100644 --- a/pango/pangofc-decoder.c +++ b/pango/pangofc-decoder.c @@ -24,12 +24,6 @@ G_DEFINE_ABSTRACT_TYPE (PangoFcDecoder, pango_fc_decoder, G_TYPE_OBJECT) static void -pango_fc_decoder_init (PangoFcDecoder *decoder); - -static void -pango_fc_decoder_class_init (PangoFcDecoderClass *klass); - -static void pango_fc_decoder_init (PangoFcDecoder *decoder) { } diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index ec3d3dcb..3ee9a6c4 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -512,7 +512,7 @@ pango_fc_font_real_get_glyph (PangoFcFont *font, face = PANGO_FC_FONT_LOCK_FACE (font); index = FcFreeTypeCharIndex (face, wc); - if (index > face->num_glyphs) + if (index > (FT_UInt)face->num_glyphs) index = 0; PANGO_FC_FONT_UNLOCK_FACE (font); diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 4f0e43f0..b11741c7 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -1836,6 +1836,7 @@ pango_fc_face_get_type (void) sizeof (PangoFcFace), 0, /* n_preallocs */ (GInstanceInitFunc) NULL, + NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, @@ -1963,6 +1964,7 @@ pango_fc_family_get_type (void) sizeof (PangoFcFamily), 0, /* n_preallocs */ (GInstanceInitFunc) pango_fc_family_init, + NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, diff --git a/pango/pangoft2.c b/pango/pangoft2.c index 75168307..4533907f 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -368,7 +368,9 @@ pango_ft2_font_real_get_unknown_glyph (PangoFcFont *font, } static gboolean -pango_ft2_free_glyph_info_callback (gpointer key, gpointer value, gpointer data) +pango_ft2_free_glyph_info_callback (gpointer key, + gpointer value, + gpointer data) { PangoFT2Font *font = PANGO_FT2_FONT (data); PangoFT2GlyphInfo *info = value; diff --git a/pango/pangox-fontcache.c b/pango/pangox-fontcache.c index b1e3ae60..2a3ecd05 100644 --- a/pango/pangox-fontcache.c +++ b/pango/pangox-fontcache.c @@ -52,7 +52,9 @@ struct _CacheEntry }; static void -free_cache_entry (char *xlfd, CacheEntry *entry, PangoXFontCache *cache) +free_cache_entry (char *xlfd, + CacheEntry *entry, + PangoXFontCache *cache) { g_free (entry->xlfd); XFreeFont (cache->display, entry->fs); diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index aaa28aad..e108bc71 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -190,6 +190,7 @@ pango_x_font_map_get_type (void) sizeof (PangoXFontMap), 0, /* n_preallocs */ (GInstanceInitFunc) pango_x_font_map_init, + NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_MAP, @@ -380,7 +381,9 @@ pango_x_font_map_finalize (GObject *object) } static void -list_families_foreach (gpointer key, gpointer value, gpointer user_data) +list_families_foreach (gpointer key, + gpointer value, + gpointer user_data) { GSList **list = user_data; @@ -527,7 +530,8 @@ pango_x_font_map_load_font (PangoFontMap *fontmap, static gboolean error_occured; static int -ignore_error (Display *d, XErrorEvent *e) +ignore_error (Display *d, + XErrorEvent *e) { return 0; } @@ -1087,7 +1091,7 @@ pango_x_insert_font (PangoXFontMap *xfontmap, PangoXFace *xface; PangoXSizeInfo *size_info; char *identifier; - int i; + unsigned int i; /* First insert the XLFD into the list of XLFDs for the "identifier" - which * is the 2-4th fields of the XLFD @@ -1205,7 +1209,7 @@ pango_x_insert_font (PangoXFontMap *xfontmap, /* Compare the tail of a to b */ static gboolean -match_end (char *a, char *b) +match_end (const char *a, const char *b) { size_t len_a = strlen (a); size_t len_b = strlen (b); @@ -1502,6 +1506,7 @@ pango_x_face_get_type (void) sizeof (PangoXFace), 0, /* n_preallocs */ (GInstanceInitFunc) NULL, + NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_FACE, @@ -1660,6 +1665,7 @@ pango_x_family_get_type (void) sizeof (PangoXFamily), 0, /* n_preallocs */ (GInstanceInitFunc) NULL, + NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT_FAMILY, diff --git a/pango/pangox.c b/pango/pangox.c index fcfada08..7fec7542 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -243,6 +243,7 @@ pango_x_font_get_type (void) sizeof (PangoXFont), 0, /* n_preallocs */ (GInstanceInitFunc) pango_x_font_init, + NULL /* value_table */ }; object_type = g_type_register_static (PANGO_TYPE_FONT, @@ -948,7 +949,7 @@ pango_x_font_get_font_map (PangoFont *font) /* Compare the tail of a to b */ static gboolean -match_end (char *a, char *b) +match_end (const char *a, const char *b) { size_t len_a = strlen (a); size_t len_b = strlen (b); diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c index f4726f59..5146ef29 100644 --- a/pango/pangoxft-font.c +++ b/pango/pangoxft-font.c @@ -358,7 +358,7 @@ load_fallback_font (PangoXftFont *xfont) _pango_xft_font_map_get_info (fcfont->fontmap, &display, &screen); size_is_absolute = pango_font_description_get_size_is_absolute (fcfont->description); - size = (double)pango_font_description_get_size (fcfont->description) / PANGO_SCALE; + size = pango_font_description_get_size (fcfont->description) / PANGO_SCALE; xft_font = XftFontOpen (display, screen, FC_FAMILY, FcTypeString, "sans", diff --git a/pango/querymodules.c b/pango/querymodules.c index 8c5553d1..fc0fbe4b 100644 --- a/pango/querymodules.c +++ b/pango/querymodules.c @@ -120,7 +120,7 @@ script_from_string (PangoScript script) return value->value_nick; } -void +static void query_module (const char *dir, const char *name) { void (*list) (PangoEngineInfo **engines, gint *n_engines); diff --git a/tests/dump-boundaries.c b/tests/dump-boundaries.c index ac507cf6..f566a54c 100644 --- a/tests/dump-boundaries.c +++ b/tests/dump-boundaries.c @@ -28,9 +28,8 @@ #define CHFORMAT "%0#6x" -static void -fail (const char *format, - ...) +static void fail (const char *format, ...) G_GNUC_PRINTF (1, 2) G_GNUC_NORETURN; +static void fail (const char *format, ...) { char *str; diff --git a/tests/testboundaries.c b/tests/testboundaries.c index f8661d15..e003aadb 100644 --- a/tests/testboundaries.c +++ b/tests/testboundaries.c @@ -66,9 +66,8 @@ static gunichar current_wc = 0; static const char *line_start = NULL; static const char *line_end = NULL; -static void -fail (const char *format, - ...) +static void fail (const char *format, ...) G_GNUC_PRINTF (1, 2) G_GNUC_NORETURN; +static void fail (const char *format, ...) { char *str; char *line_text; @@ -275,6 +274,8 @@ check_grapheme_invariants (const char *text, } +static void print_sentences (const char *text, + PangoLogAttr *attrs); static void print_sentences (const char *text, PangoLogAttr *attrs) @@ -333,12 +334,11 @@ check_invariants (const char *text) } int -main (int argc, - char **argv) +main (int argc, char *argv[]) { gchar *text; - gchar *srcdir; - gchar *filename; + const gchar *srcdir; + const gchar *filename; srcdir = getenv ("srcdir"); if (!srcdir) diff --git a/tests/testcolor.c b/tests/testcolor.c index fe23d72d..d64153d9 100644 --- a/tests/testcolor.c +++ b/tests/testcolor.c @@ -30,7 +30,7 @@ typedef struct _ColorSpec { guint16 blue; } ColorSpec; -gboolean test_color (ColorSpec *spec) +static gboolean test_color (ColorSpec *spec) { PangoColor color; gboolean accepted; @@ -63,19 +63,19 @@ ColorSpec specs [] = { { "#000000000", 1, 0x0000, 0x0000, 0x0000 }, { "#000000000000", 1, 0x0000, 0x0000, 0x0000 }, { "#AAAABBBBCCCC", 1, 0xaaaa, 0xbbbb, 0xcccc }, - { "#aa bb cc ", 0 }, - { "#aa bb ccc", 0 }, - { "#ab", 0 }, - { "#aabb", 0 }, - { "#aaabb", 0 }, - { "aaabb", 0 }, - { "", 0 }, - { "#", 0 }, - { "##fff", 0 }, - { "#0000ff+", 0 }, - { "#0000f+", 0 }, - { "#0x00x10x2", 0 }, - { NULL, 0 } + { "#aa bb cc ", 0, 0, 0, 0 }, + { "#aa bb ccc", 0, 0, 0, 0 }, + { "#ab", 0, 0, 0, 0 }, + { "#aabb", 0, 0, 0, 0 }, + { "#aaabb", 0, 0, 0, 0 }, + { "aaabb", 0, 0, 0, 0 }, + { "", 0, 0, 0, 0 }, + { "#", 0, 0, 0, 0 }, + { "##fff", 0, 0, 0, 0 }, + { "#0000ff+", 0, 0, 0, 0 }, + { "#0000f+", 0, 0, 0, 0 }, + { "#0x00x10x2", 0, 0, 0, 0 }, + { NULL, 0, 0, 0, 0 } }; int @@ -83,7 +83,6 @@ main (int argc, char *argv[]) { gboolean success; ColorSpec *spec; - gchar *blob; success = TRUE; for (spec = specs; spec->spec; spec++) @@ -91,7 +90,3 @@ main (int argc, char *argv[]) return !success; } - - - - diff --git a/tests/testiter.c b/tests/testiter.c index d0966c91..58cc2289 100644 --- a/tests/testiter.c +++ b/tests/testiter.c @@ -34,6 +34,7 @@ #undef VERBOSE +static void verbose (const char *format, ...) G_GNUC_PRINTF (1, 2); static void verbose (const char *format, ...) { @@ -53,7 +54,7 @@ verbose (const char *format, ...) * I think the iterator itself should support \r\n without trouble, * but there are comments in layout-iter.c suggesting otherwise. */ -char *test_texts[] = +const char *test_texts[] = { /* English with embedded RTL runs (from ancient-hebrew.org) */ "The Hebrew word \xd7\x90\xd7\x93\xd7\x9d\xd7\x94 (adamah) is the feminine form of \xd7\x90\xd7\x93\xd7\x9d meaning \"ground\"\n", @@ -72,7 +73,7 @@ char *test_texts[] = NULL }; -void +static void iter_char_test (PangoLayout *layout) { PangoRectangle extents, run_extents; @@ -157,7 +158,7 @@ iter_char_test (PangoLayout *layout) * - Total num of iterations match number of chars * - GlyphString's index_to_x positions match those returned by the Iter */ -void +static void iter_cluster_test (PangoLayout *layout) { PangoRectangle extents; @@ -212,7 +213,7 @@ iter_cluster_test (PangoLayout *layout) int main (int argc, char *argv[]) { - char **ptext; + const char **ptext; PangoFontMap *fontmap; PangoContext *context; PangoLayout *layout; @@ -227,8 +228,8 @@ main (int argc, char *argv[]) { verbose ("--------- checking next text ----------\n"); verbose (" <%s>\n", *ptext); - verbose ( "len=%d, bytes=%d\n", - g_utf8_strlen (*ptext, -1), strlen (*ptext)); + verbose ( "len=%ld, bytes=%ld\n", + (long)g_utf8_strlen (*ptext, -1), (long)strlen (*ptext)); pango_layout_set_text (layout, *ptext, -1); iter_char_test (layout); diff --git a/tests/testscript.c b/tests/testscript.c index 5ef39384..4594a9a9 100644 --- a/tests/testscript.c +++ b/tests/testscript.c @@ -140,10 +140,11 @@ unescape (const char *text) } static void -test_script_lookup () +test_script_lookup (void) { gunichar ch = 0; - int i, j; + unsigned int i; + int j; for (i = 0; i < G_N_ELEMENTS (pango_script_table); i++) { @@ -185,7 +186,7 @@ test_script_iter (void) const char *start; const char *end; PangoScript script; - int i; + unsigned int i; for (i = 0; i < G_N_ELEMENTS(test_data); i++) { diff --git a/tools/gen-script-for-lang.c b/tools/gen-script-for-lang.c index e51294ff..5c0573c5 100644 --- a/tools/gen-script-for-lang.c +++ b/tools/gen-script-for-lang.c @@ -40,7 +40,7 @@ static void scripts_for_file (const char *base_dir, const char *file_part, LangInfo *info); -const char *get_script_name (PangoScript script) +static const char *get_script_name (PangoScript script) { static GEnumClass *class = NULL; GEnumValue *value; @@ -53,7 +53,8 @@ const char *get_script_name (PangoScript script) return value->value_name; } -int fail (char *format, ...) +static void fail (const char *format, ...) G_GNUC_PRINTF (1, 2) G_GNUC_NORETURN; +static void fail (const char *format, ...) { va_list vap; @@ -64,7 +65,7 @@ int fail (char *format, ...) exit (1); } -gboolean scan_hex (const char **str, gunichar *result) +static gboolean scan_hex (const char **str, gunichar *result) { const char *end; @@ -76,14 +77,6 @@ gboolean scan_hex (const char **str, gunichar *result) return TRUE; } -void warn_mismatch (const char *file_part, - PangoScript script1, - PangoScript script2) -{ - g_printerr ("%s has characters for both %s and %s\n", - file_part, get_script_name (script1), get_script_name (script2)); -} - static void scripts_for_line (const char *base_dir, const char *file_part, @@ -172,11 +165,11 @@ scripts_for_file (const char *base_dir, GIOStatus status = G_IO_STATUS_NORMAL; if (!channel) - fail ("Error opening '%s': %s\n", filename, error); + fail ("Error opening '%s': %s\n", filename, error->message); /* The files have ISO-8859-1 copyright signs in them */ if (!g_io_channel_set_encoding (channel, "ISO-8859-1", &error)) - fail ("Cannot set encoding when reading '%s': %s\n", filename, error); + fail ("Cannot set encoding when reading '%s': %s\n", filename, error->message); while (status == G_IO_STATUS_NORMAL) { @@ -209,7 +202,7 @@ scripts_for_file (const char *base_dir, } if (!g_io_channel_shutdown (channel, FALSE, &error)) - fail ("Error closing '%s': %s\n", channel, error); + fail ("Error closing '%s': %s\n", filename, error->message); g_free (filename); } @@ -240,7 +233,7 @@ compare_lang (gconstpointer a, gconstpointer b) { const LangInfo *info_a = a; - const LangInfo *info_b = a; + const LangInfo *info_b = b; return strcmp (pango_language_to_string (info_a->lang), pango_language_to_string (info_b->lang)); @@ -251,7 +244,8 @@ int main (int argc, char **argv) GDir *dir; GError *error = NULL; GArray *script_array; - int i, j; + unsigned int i; + int j; int max_lang_len = 0; g_type_init (); @@ -282,7 +276,7 @@ int main (int argc, char **argv) LangInfo *info = &g_array_index (script_array, LangInfo, i); max_lang_len = MAX (max_lang_len, - 1 + strlen (pango_language_to_string (info->lang))); + 1 + (int)strlen (pango_language_to_string (info->lang))); } g_print ("typedef struct {\n" |