summaryrefslogtreecommitdiff
path: root/tools/gen-script-for-lang.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2005-11-04 23:55:38 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2005-11-04 23:55:38 +0000
commitb6942a337fd03b0f24a49f3b7336b9137828c5f4 (patch)
treead95f548fbe6765cdea8bfcae095e42652697e26 /tools/gen-script-for-lang.c
parent933f541030f770b446d95bb0b5b3c85d561a63e5 (diff)
downloadpango-b6942a337fd03b0f24a49f3b7336b9137828c5f4.tar.gz
Turn various gcc warnings off. Adding const, adding static, fully
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.
Diffstat (limited to 'tools/gen-script-for-lang.c')
-rw-r--r--tools/gen-script-for-lang.c28
1 files changed, 11 insertions, 17 deletions
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"