]> git.wh0rd.org - fontconfig.git/commitdiff
Fix more gcc4 warnings:
authorPatrick Lam <plam@MIT.EDU>
Thu, 22 Sep 2005 23:45:53 +0000 (23:45 +0000)
committerPatrick Lam <plam@MIT.EDU>
Thu, 22 Sep 2005 23:45:53 +0000 (23:45 +0000)
- Cast sizeof to int, to shut up signedness warnings in comparison.
- Add consts where appropriate.
reviewed by: Patrick Lam <plam@mit.edu>

doc/edit-sgml.c
fc-case/fc-case.c
fc-glyphname/fc-glyphname.c
fc-lang/fc-lang.c
src/fccharset.c
src/fcdefault.c
src/fcfreetype.c
src/fcinit.c
src/fcmatch.c
src/fcpat.c
src/fcxml.c

index 3542a5a915c03ec10bec5c22e712da89260193f0..77cc807c1d0f16791212de7d384b7a2c0d6431f2 100644 (file)
@@ -77,7 +77,7 @@ static void
 ReplaceDispose (Replace *r);
 
 static void
-Bail (char *format, char *arg);
+Bail (const char *format, const char *arg);
 
 static Replace *
 ReplaceRead (FILE *f);
@@ -249,7 +249,7 @@ ReplaceDispose (Replace *r)
 }
 
 static void
-Bail (char *format, char *arg)
+Bail (const char *format, const char *arg)
 {
     fprintf (stderr, "fatal: ");
     fprintf (stderr, format, arg);
index 588ccf3a27c79644723b2272e319cefa8b8cfcf4..f7f8277e9340b1670799c7a3ef0d5aac1cf7aab9 100644 (file)
 typedef enum _caseFoldClass { CaseFoldCommon, CaseFoldFull, CaseFoldSimple, CaseFoldTurkic } CaseFoldClass;
 
 typedef struct _caseFoldClassMap {
-    char           *name;
+    const char     *name;
     CaseFoldClass   class;
 } CaseFoldClassMap;
 
-static CaseFoldClassMap        caseFoldClassMap[] = {
+static const CaseFoldClassMap  caseFoldClassMap[] = {
     { "C", CaseFoldCommon },
     { "F", CaseFoldFull },
     { "S", CaseFoldSimple },
@@ -51,7 +51,7 @@ typedef struct _caseFoldRaw {
 } CaseFoldRaw;
 
 static void
-panic (char *reason)
+panic (const char *reason)
 {
     fprintf (stderr, "fc-case: panic %s\n", reason);
     exit (1);
@@ -148,7 +148,7 @@ foldExtends (FcCaseFold *fold, CaseFoldRaw *raw)
     return 0;
 }
            
-static char *
+static const char *
 case_fold_method_name (FcChar16 method)
 {
     switch (method) {
index 2c69c2b407dbbbf1785cabcd5e58cba4f71657d7..05a22ae31174da7c720b55e15b1fffeb4033e5a5 100644 (file)
@@ -25,7 +25,7 @@
 #include "fcint.h"
 
 static int
-rawindex (FcGlyphName *gn);
+rawindex (const FcGlyphName *gn);
 
 static void
 scan (FILE *f, char *filename);
@@ -43,7 +43,7 @@ static void
 insert (FcGlyphName *gn, FcGlyphName **table, FcChar32 h);
 
 static void
-dump (FcGlyphName **table, char *name);
+dump (FcGlyphName * const *table, const char *name);
 
 static FcGlyphName *
 FcAllocGlyphName (FcChar32 ucs, FcChar8 *name)
@@ -59,9 +59,13 @@ FcAllocGlyphName (FcChar32 ucs, FcChar8 *name)
 }
 
 static void 
-fatal (char *file, int lineno, char *msg)
+fatal (const char *file, int lineno, const char *msg)
 {
-    fprintf (stderr, "%s:%d: %s\n", file, lineno, msg);
+    if (lineno)
+        fprintf (stderr, "%s:%d: %s\n", file, lineno, msg);
+    else 
+       fprintf (stderr, "%s: %s\n", file, msg);
+
     exit (1);
 }
 
@@ -77,7 +81,7 @@ FcGlyphName *ucs_to_name[MAX_GLYPHNAME*2];
 int        hash, rehash;
 
 static int
-rawindex (FcGlyphName *gn)
+rawindex (const FcGlyphName *gn)
 {
     int        i;
 
@@ -211,7 +215,7 @@ insert (FcGlyphName *gn, FcGlyphName **table, FcChar32 h)
 }
 
 static void
-dump (FcGlyphName **table, char *name)
+dump (FcGlyphName * const *table, const char *name)
 {
     int        i;
     
@@ -235,11 +239,12 @@ main (int argc, char **argv)
     int                i;
     
     i = 0;
-    while (*++argv)
+    while (argv[i+1])
     {
        if (i == MAX_GLYPHFILE)
            fatal (*argv, 0, "Too many glyphname files");
-       files[i++] = *argv;
+       files[i] = argv[i+1];
+       i++;
     }
     files[i] = 0;
     qsort (files, i, sizeof (char *), compare_string);
index 5b6c63e64615f50f645fd64b90e4db5f1f0a62e3..27508c0cfe7cb917c108c00a8cd739d5f17f0a57 100644 (file)
@@ -60,9 +60,12 @@ FcConfigHome (void)
 }
 
 static void 
-fatal (char *file, int lineno, char *msg)
+fatal (const char *file, int lineno, const char *msg)
 {
-    fprintf (stderr, "%s:%d: %s\n", file, lineno, msg);
+    if (lineno)
+       fprintf (stderr, "%s:%d: %s\n", file, lineno, msg);
+    else
+       fprintf (stderr, "%s:%d: %s\n", file, lineno, msg);
     exit (1);
 }
 
@@ -226,6 +229,7 @@ main (int argc, char **argv)
     FILE       *f;
     int                ncountry = 0;
     int                i = 0;
+    int                argi;
     FcCharLeaf **leaves;
     int                total_leaves = 0;
     int                l, sl, tl;
@@ -237,16 +241,18 @@ main (int argc, char **argv)
     int                setRangeEnd[26];
     FcChar8    setRangeChar;
     
-    while (*++argv)
+    argi = 1;
+    while (argv[argi])
     {
-       if (!strcmp (*argv, "-d"))
+       if (!strcmp (argv[argi], "-d"))
        {
-           dir = *++argv;
+           argi++;
+           dir = argv[argi++];
            continue;
        }
        if (i == MAX_LANG)
-           fatal (*argv, 0, "Too many languages");
-       files[i++] = *argv;
+           fatal (argv[0], 0, "Too many languages");
+       files[i++] = argv[argi++];
     }
     files[i] = 0;
     qsort (files, i, sizeof (char *), compare);
index d0fee82e8df6b09ce129542e9bd824097aaf3ba0..6b3aa5e0d20f44b5b093d0a025752a4a7b0abdcf 100644 (file)
@@ -347,6 +347,7 @@ FcCharSetIterStart (const FcCharSet *fcs, FcCharSetIter *iter)
     FcCharSetDump (fcs);
 #endif
     iter->ucs4 = 0;
+    iter->pos = 0;
     FcCharSetIterSet (fcs, iter);
 }
 
@@ -992,7 +993,7 @@ FcCharSetHash (FcCharSet *fcs)
     int                i;
 
     /* hash in leaves */
-    for (i = 0; i < fcs->num * sizeof (FcCharLeaf *) / sizeof (FcChar32); i++)
+    for (i = 0; i < fcs->num * (int) (sizeof (FcCharLeaf *) / sizeof (FcChar32)); i++)
        hash = ((hash << 1) | (hash >> 31)) ^ (FcChar32)(FcCharSetGetLeaf(fcs, i)->map);
     /* hash in numbers */
     for (i = 0; i < fcs->num; i++)
index 0e84311faa6f0f59bdeeb7fd7f31c9f5a044e130..5e648dc94e84fdf23482499dc7728f57c2bfe326 100644 (file)
@@ -26,7 +26,7 @@
 #include <locale.h>
 
 static struct {
-    char       *field;
+    const char *field;
     FcBool     value;
 } FcBoolDefaults[] = {
     { FC_HINTING,          FcTrue      },  /* !FT_LOAD_NO_HINTING */
@@ -35,7 +35,7 @@ static struct {
     { FC_GLOBAL_ADVANCE,    FcTrue     },  /* !FC_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
 };
 
-#define NUM_FC_BOOL_DEFAULTS   (sizeof FcBoolDefaults / sizeof FcBoolDefaults[0])
+#define NUM_FC_BOOL_DEFAULTS   (int) (sizeof FcBoolDefaults / sizeof FcBoolDefaults[0])
 
 void
 FcDefaultSubstitute (FcPattern *pattern)
@@ -127,7 +127,7 @@ FcDefaultSubstitute (FcPattern *pattern)
                        after = territory + strlen (territory);
                }
                territory_len = after - territory;
-               if (lang_len + 1 + territory_len + 1 <= sizeof (lang_local))
+               if (lang_len + 1 + territory_len + 1 <= (int) sizeof (lang_local))
                {
                    strncpy (lang_local, lang, lang_len);
                    lang_local[lang_len] = '-';
index 979a17300fb7b5d9448ff0e6a5262a3ee49e53b1..f3eeb8aa1d13dc1acce4a29477447fda63fe758b 100644 (file)
@@ -95,7 +95,7 @@ static const struct {
     { 20,      (const FcChar8 *) "zh-tw" },
 };
 
-#define NUM_CODE_PAGE_RANGE (sizeof FcCodePageRange / sizeof FcCodePageRange[0])
+#define NUM_CODE_PAGE_RANGE (int) (sizeof FcCodePageRange / sizeof FcCodePageRange[0])
 
 FcBool
 FcFreeTypeIsExclusiveLang (const FcChar8  *lang)
@@ -135,18 +135,18 @@ static const FcFtEncoding   fcFtEncoding[] = {
  {  TT_PLATFORM_ISO,           TT_ISO_ID_8859_1,       "ISO-8859-1" },
 };
 
-#define NUM_FC_FT_ENCODING  (sizeof (fcFtEncoding) / sizeof (fcFtEncoding[0]))
+#define NUM_FC_FT_ENCODING  (int) (sizeof (fcFtEncoding) / sizeof (fcFtEncoding[0]))
 
 typedef struct {
     FT_UShort  platform_id;
     FT_UShort  language_id;
-    char       *lang;
+    const char lang[8];
 } FcFtLanguage;
 
 #define TT_LANGUAGE_DONT_CARE  0xffff
 
 static const FcFtLanguage   fcFtLanguage[] = {
- {  TT_PLATFORM_APPLE_UNICODE, TT_LANGUAGE_DONT_CARE,              0 },
+ {  TT_PLATFORM_APPLE_UNICODE, TT_LANGUAGE_DONT_CARE,              "" },
  {  TT_PLATFORM_MACINTOSH,     TT_MAC_LANGID_ENGLISH,              "en" },
  {  TT_PLATFORM_MACINTOSH,     TT_MAC_LANGID_FRENCH,               "fr" },
  {  TT_PLATFORM_MACINTOSH,     TT_MAC_LANGID_GERMAN,               "de" },
@@ -545,7 +545,7 @@ static const FcFtLanguage   fcFtLanguage[] = {
  {  TT_PLATFORM_MICROSOFT,     TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES,"pap" },
 };
 
-#define NUM_FC_FT_LANGUAGE  (sizeof (fcFtLanguage) / sizeof (fcFtLanguage[0]))
+#define NUM_FC_FT_LANGUAGE  (int) (sizeof (fcFtLanguage) / sizeof (fcFtLanguage[0]))
 
 typedef struct {
     FT_UShort  language_id;
@@ -560,7 +560,7 @@ static const FcMacRomanFake fcMacRomanFake[] = {
 static FcChar8 *
 FcFontCapabilities(FT_Face face);
 
-#define NUM_FC_MAC_ROMAN_FAKE  (sizeof (fcMacRomanFake) / sizeof (fcMacRomanFake[0]))
+#define NUM_FC_MAC_ROMAN_FAKE  (int) (sizeof (fcMacRomanFake) / sizeof (fcMacRomanFake[0]))
 
 #if HAVE_ICONV && HAVE_ICONV_H
 #define USE_ICONV 1
@@ -749,7 +749,12 @@ FcSfntNameLanguage (FT_SfntName *sname)
        if (fcFtLanguage[i].platform_id == sname->platform_id &&
            (fcFtLanguage[i].language_id == TT_LANGUAGE_DONT_CARE ||
             fcFtLanguage[i].language_id == sname->language_id))
-           return (FcChar8 *) fcFtLanguage[i].lang;
+       {
+           if (fcFtLanguage[i].lang[0] == '\0')
+             return NULL;
+           else
+             return (FcChar8 *) fcFtLanguage[i].lang;
+       }
     return 0;
 }
 
@@ -781,7 +786,7 @@ static const struct {
                                        (const FcChar8 *) "hanyang" }
 };
 
-#define NUM_NOTICE_FOUNDRIES   (sizeof (FcNoticeFoundries) / sizeof (FcNoticeFoundries[0]))
+#define NUM_NOTICE_FOUNDRIES   (int) (sizeof (FcNoticeFoundries) / sizeof (FcNoticeFoundries[0]))
 
 static const FcChar8 *
 FcNoticeFoundry(const FT_String *notice)
@@ -850,7 +855,7 @@ static const struct {
     { (const FT_Char *) "Y&Y",  (const FcChar8 *) "y&y"}
 };
 
-#define NUM_VENDOR_FOUNDRIES   (sizeof (FcVendorFoundries) / sizeof (FcVendorFoundries[0]))
+#define NUM_VENDOR_FOUNDRIES   (int) (sizeof (FcVendorFoundries) / sizeof (FcVendorFoundries[0]))
 
 static const FcChar8 *
 FcVendorFoundry(const FT_Char vendor[4])
@@ -916,7 +921,7 @@ static const FcStringConst  weightConsts[] = {
     { (FC8) "heavy",           FC_WEIGHT_HEAVY },
 };
 
-#define NUM_WEIGHT_CONSTS  (sizeof (weightConsts) / sizeof (weightConsts[0]))
+#define NUM_WEIGHT_CONSTS  (int) (sizeof (weightConsts) / sizeof (weightConsts[0]))
 
 #define FcIsWeight(s)      FcStringIsConst(s,weightConsts,NUM_WEIGHT_CONSTS)
 #define FcContainsWeight(s) FcStringContainsConst (s,weightConsts,NUM_WEIGHT_CONSTS)
@@ -933,7 +938,7 @@ static const FcStringConst  widthConsts[] = {
     { (FC8) "expanded",                FC_WIDTH_EXPANDED },    /* must be after *expanded */
 };
 
-#define NUM_WIDTH_CONSTS    (sizeof (widthConsts) / sizeof (widthConsts[0]))
+#define NUM_WIDTH_CONSTS    (int) (sizeof (widthConsts) / sizeof (widthConsts[0]))
 
 #define FcIsWidth(s)       FcStringIsConst(s,widthConsts,NUM_WIDTH_CONSTS)
 #define FcContainsWidth(s)  FcStringContainsConst (s,widthConsts,NUM_WIDTH_CONSTS)
@@ -943,7 +948,7 @@ static const FcStringConst  slantConsts[] = {
     { (FC8) "oblique",         FC_SLANT_OBLIQUE },
 };
 
-#define NUM_SLANT_CONSTS    (sizeof (slantConsts) / sizeof (slantConsts[0]))
+#define NUM_SLANT_CONSTS    (int) (sizeof (slantConsts) / sizeof (slantConsts[0]))
 
 #define FcIsSlant(s)       FcStringIsConst(s,slantConsts,NUM_SLANT_CONSTS)
 #define FcContainsSlant(s)  FcStringContainsConst (s,slantConsts,NUM_SLANT_CONSTS)
@@ -970,7 +975,7 @@ FcGetPixelSize (FT_Face face, int i)
 }
 
 static FcBool
-FcStringInPatternElement (FcPattern *pat, char *elt, FcChar8 *string)
+FcStringInPatternElement (FcPattern *pat, const char *elt, FcChar8 *string)
 {
     int            e;
     FcChar8 *old;
@@ -1075,7 +1080,7 @@ FcFreeTypeQuery (const FcChar8    *file,
     {
        FcChar8         *utf8;
        FcChar8         *lang;
-       char            *elt = 0, *eltlang = 0;
+       const char      *elt = 0, *eltlang = 0;
        int             *np = 0, *nlangp = 0;
 
        if (FT_Get_Sfnt_Name (face, snamei, &sname) != 0)
@@ -2125,13 +2130,13 @@ static const FcFontDecode fcFontDecoders[] = {
     { ft_encoding_apple_roman, &AppleRoman,    (1 << 16) - 1 },
 };
 
-#define NUM_DECODE  (sizeof (fcFontDecoders) / sizeof (fcFontDecoders[0]))
+#define NUM_DECODE  (int) (sizeof (fcFontDecoders) / sizeof (fcFontDecoders[0]))
 
 static const FcChar32  prefer_unicode[] = {
     0x20ac,    /* EURO SIGN */
 };
 
-#define NUM_PREFER_UNICODE  (sizeof (prefer_unicode) / sizeof (prefer_unicode[0]))
+#define NUM_PREFER_UNICODE  (int) (sizeof (prefer_unicode) / sizeof (prefer_unicode[0]))
 
 FcChar32
 FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map)
@@ -2272,7 +2277,7 @@ FcFreeTypeGlyphNameIndex (FT_Face face, FcChar8 *name)
     FT_UInt gindex;
     FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2];
 
-    for (gindex = 0; gindex < face->num_glyphs; gindex++)
+    for (gindex = 0; gindex < (FT_UInt) face->num_glyphs; gindex++)
     {
        if (FT_Get_Glyph_Name (face, gindex, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0)
            if (!strcmp ((char *) name, (char *) name_buf))
@@ -2326,7 +2331,7 @@ FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4)
        if (fcFontDecoders[decode].map)
        {
            charcode = FcFreeTypeUcs4ToPrivate (ucs4, fcFontDecoders[decode].map);
-           if (charcode == ~0)
+           if (charcode == ~0U)
                continue;
        }
        else
@@ -2586,7 +2591,7 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing)
     {
        FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2];
 
-       for (glyph = 0; glyph < face->num_glyphs; glyph++)
+       for (glyph = 0; glyph < (FT_UInt) face->num_glyphs; glyph++)
        {
            if (FT_Get_Glyph_Name (face, glyph, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0)
            {
index 8a9bdbda8c6e1634bdbb39deb60ae221838b1d99..151c429f9115138152a15bbcbb03f7702b9d2cba 100644 (file)
@@ -161,7 +161,7 @@ FcInitBringUptoDate (void)
 }
 
 static struct {
-    char    *name;
+    char    name[16];
     int            alloc_count;
     int            alloc_mem;
     int            free_count;
index b2b2c8d519eb647878be0f3193ce0a4fb7ce32af..a359a8b883b96b5d1fee4937e387b1b581290a51 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 static double
-FcCompareNumber (char *object, FcValue *value1, FcValue *value2)
+FcCompareNumber (const char *object, FcValue *value1, FcValue *value2)
 {
     double  v1, v2, v;
     
@@ -59,7 +59,7 @@ FcCompareNumber (char *object, FcValue *value1, FcValue *value2)
 }
 
 static double
-FcCompareString (char *object, FcValue *v1, FcValue *v2)
+FcCompareString (const char *object, FcValue *v1, FcValue *v2)
 {
     FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2);
     if (value2.type != FcTypeString || value1.type != FcTypeString)
@@ -68,7 +68,7 @@ FcCompareString (char *object, FcValue *v1, FcValue *v2)
 }
 
 static double
-FcCompareFamily (char *object, FcValue *v1, FcValue *v2)
+FcCompareFamily (const char *object, FcValue *v1, FcValue *v2)
 {
     FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2);
     if (value2.type != FcTypeString || value1.type != FcTypeString)
@@ -77,7 +77,7 @@ FcCompareFamily (char *object, FcValue *v1, FcValue *v2)
 }
 
 static double
-FcCompareLang (char *object, FcValue *v1, FcValue *v2)
+FcCompareLang (const char *object, FcValue *v1, FcValue *v2)
 {
     FcLangResult    result;
     FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2);
@@ -124,7 +124,7 @@ FcCompareLang (char *object, FcValue *v1, FcValue *v2)
 }
 
 static double
-FcCompareBool (char *object, FcValue *value1, FcValue *value2)
+FcCompareBool (const char *object, FcValue *value1, FcValue *value2)
 {
     if (value2->type != FcTypeBool || value1->type != FcTypeBool)
        return -1.0;
@@ -132,7 +132,7 @@ FcCompareBool (char *object, FcValue *value1, FcValue *value2)
 }
 
 static double
-FcCompareCharSet (char *object, FcValue *v1, FcValue *v2)
+FcCompareCharSet (const char *object, FcValue *v1, FcValue *v2)
 {
     FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2);
     
@@ -142,7 +142,7 @@ FcCompareCharSet (char *object, FcValue *v1, FcValue *v2)
 }
 
 static double
-FcCompareSize (char *object, FcValue *value1, FcValue *value2)
+FcCompareSize (const char *object, FcValue *value1, FcValue *value2)
 {
     double  v1, v2, v;
 
@@ -175,8 +175,8 @@ FcCompareSize (char *object, FcValue *value1, FcValue *value2)
 }
 
 typedef struct _FcMatcher {
-    char           *object;
-    double         (*compare) (char *object, FcValue *value1, FcValue *value2);
+    const char     *object;
+    double         (*compare) (const char *object, FcValue *value1, FcValue *value2);
     int                    strong, weak;
 } FcMatcher;
 
index 84154ea2ec2f63f89fc767e892a06ca225b66e66..cfb6f45a39afe362f130523d428d4631b9bd73e0 100644 (file)
@@ -331,7 +331,7 @@ typedef union _FcValueListAlign {
 
 static int         FcValueListFrozenCount[FcTypeLangSet + 1];
 static int         FcValueListFrozenBytes[FcTypeLangSet + 1];
-static char        *FcValueListFrozenName[] = {
+static char        FcValueListFrozenName[][8] = {
     "Void", 
     "Integer", 
     "Double", 
@@ -1203,6 +1203,7 @@ FcPatternDuplicate (const FcPattern *orig)
     int                    i;
     FcValueListPtr  l;
 
+    printf("pattern duplicate %x\n", (int)orig); // XXX
     new = FcPatternCreate ();
     if (!new)
        goto bail0;
index 7a48628f96b97a7d9ce7079ea8bf3f23fe07dde7..950bc9aa015003d91e8eb6196fa8dc0c28c5fba9 100644 (file)
@@ -323,72 +323,72 @@ typedef enum _FcElement {
     FcElementUnknown
 } FcElement;
 
+static struct {
+    const char  name[16];
+    FcElement   element;
+} fcElementMap[] = {
+    { "fontconfig",    FcElementFontconfig },
+    { "dir",           FcElementDir },
+    { "cache",         FcElementCache },
+    { "include",       FcElementInclude },
+    { "config",                FcElementConfig },
+    { "match",         FcElementMatch },
+    { "alias",         FcElementAlias },
+    
+    { "blank",         FcElementBlank },
+    { "rescan",                FcElementRescan },
+
+    { "prefer",                FcElementPrefer },
+    { "accept",                FcElementAccept },
+    { "default",       FcElementDefault },
+    { "family",                FcElementFamily },
+
+    { "selectfont",    FcElementSelectfont },
+    { "acceptfont",    FcElementAcceptfont },
+    { "rejectfont",    FcElementRejectfont },
+    { "glob",          FcElementGlob },
+    { "pattern",       FcElementPattern },
+    { "patelt",                FcElementPatelt },
+
+    { "test",          FcElementTest },
+    { "edit",          FcElementEdit },
+    { "int",           FcElementInt },
+    { "double",                FcElementDouble },
+    { "string",                FcElementString },
+    { "matrix",                FcElementMatrix },
+    { "bool",          FcElementBool },
+    { "charset",       FcElementCharset },
+    { "name",          FcElementName },
+    { "const",         FcElementConst },
+    { "or",            FcElementOr },
+    { "and",           FcElementAnd },
+    { "eq",            FcElementEq },
+    { "not_eq",                FcElementNotEq },
+    { "less",          FcElementLess },
+    { "less_eq",       FcElementLessEq },
+    { "more",          FcElementMore },
+    { "more_eq",       FcElementMoreEq },
+    { "contains",      FcElementContains },
+    { "not_contains",  FcElementNotContains },
+    { "plus",          FcElementPlus },
+    { "minus",         FcElementMinus },
+    { "times",         FcElementTimes },
+    { "divide",                FcElementDivide },
+    { "not",           FcElementNot },
+    { "if",            FcElementIf },
+    { "floor",         FcElementFloor },
+    { "ceil",          FcElementCeil },
+    { "round",         FcElementRound },
+    { "trunc",         FcElementTrunc },
+};
+#define NUM_ELEMENT_MAPS (int) (sizeof fcElementMap / sizeof fcElementMap[0])
+
 static FcElement
 FcElementMap (const XML_Char *name)
 {
-    static struct {
-       char        *name;
-       FcElement   element;
-    } fcElementMap[] = {
-       { "fontconfig", FcElementFontconfig },
-       { "dir",        FcElementDir },
-       { "cache",      FcElementCache },
-       { "include",    FcElementInclude },
-       { "config",     FcElementConfig },
-       { "match",      FcElementMatch },
-       { "alias",      FcElementAlias },
-       
-       { "blank",      FcElementBlank },
-       { "rescan",     FcElementRescan },
-
-       { "prefer",     FcElementPrefer },
-       { "accept",     FcElementAccept },
-       { "default",    FcElementDefault },
-       { "family",     FcElementFamily },
-
-       { "selectfont", FcElementSelectfont },
-       { "acceptfont", FcElementAcceptfont },
-       { "rejectfont", FcElementRejectfont },
-       { "glob",       FcElementGlob },
-       { "pattern",    FcElementPattern },
-       { "patelt",     FcElementPatelt },
-
-       { "test",       FcElementTest },
-       { "edit",       FcElementEdit },
-       { "int",        FcElementInt },
-       { "double",     FcElementDouble },
-       { "string",     FcElementString },
-       { "matrix",     FcElementMatrix },
-       { "bool",       FcElementBool },
-       { "charset",    FcElementCharset },
-       { "name",       FcElementName },
-       { "const",      FcElementConst },
-       { "or",         FcElementOr },
-       { "and",        FcElementAnd },
-       { "eq",         FcElementEq },
-       { "not_eq",     FcElementNotEq },
-       { "less",       FcElementLess },
-       { "less_eq",    FcElementLessEq },
-       { "more",       FcElementMore },
-       { "more_eq",    FcElementMoreEq },
-       { "contains",   FcElementContains },
-       { "not_contains",FcElementNotContains },
-       { "plus",       FcElementPlus },
-       { "minus",      FcElementMinus },
-       { "times",      FcElementTimes },
-       { "divide",     FcElementDivide },
-       { "not",        FcElementNot },
-       { "if",         FcElementIf },
-       { "floor",      FcElementFloor },
-       { "ceil",       FcElementCeil },
-       { "round",      FcElementRound },
-       { "trunc",      FcElementTrunc },
-       
-       { 0,            0 }
-    };
 
     int            i;
-    for (i = 0; fcElementMap[i].name; i++)
+    for (i = 0; i < NUM_ELEMENT_MAPS; i++)
        if (!strcmp ((char *) name, fcElementMap[i].name))
            return fcElementMap[i].element;
     return FcElementUnknown;
@@ -461,9 +461,9 @@ typedef enum _FcConfigSeverity {
 } FcConfigSeverity;
 
 static void
-FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, char *fmt, ...)
+FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, const char *fmt, ...)
 {
-    char       *s = "unknown";
+    const char *s = "unknown";
     va_list    args;
 
     va_start (args, fmt);
@@ -492,7 +492,7 @@ FcConfigMessage (FcConfigParse *parse, FcConfigSeverity severe, char *fmt, ...)
 }
 
 
-static char *
+static const char *
 FcTypeName (FcType type)
 {
     switch (type) {
@@ -998,7 +998,7 @@ FcConfigCleanup (FcConfigParse      *parse)
 }
 
 static const FcChar8 *
-FcConfigGetAttribute (FcConfigParse *parse, char *attr)
+FcConfigGetAttribute (FcConfigParse *parse, const char *attr)
 {
     FcChar8 **attrs;
     if (!parse->pstack)
@@ -1125,7 +1125,7 @@ FcStrtod (char *s, char **end)
        int     slen = strlen (s);
        int     dlen = strlen (locale_data->decimal_point);
        
-       if (slen + dlen > sizeof (buf))
+       if (slen + dlen > (int) sizeof (buf))
        {
            if (end)
                *end = s;
@@ -1591,7 +1591,7 @@ FcParseInclude (FcConfigParse *parse)
 }
 
 typedef struct _FcOpMap {
-    char    *name;
+    char    name[16];
     FcOp    op;
 } FcOpMap;
 
@@ -1617,7 +1617,7 @@ static const FcOpMap fcCompareOps[] = {
     { "not_contains",  FcOpNotContains     }
 };
 
-#define NUM_COMPARE_OPS (sizeof fcCompareOps / sizeof fcCompareOps[0])
+#define NUM_COMPARE_OPS        (int) (sizeof fcCompareOps / sizeof fcCompareOps[0])
 
 static FcOp
 FcConfigLexCompare (const FcChar8 *compare)
@@ -1717,7 +1717,7 @@ static const FcOpMap fcModeOps[] = {
     { "append_last",   FcOpAppendLast      },
 };
 
-#define NUM_MODE_OPS (sizeof fcModeOps / sizeof fcModeOps[0])
+#define NUM_MODE_OPS (int) (sizeof fcModeOps / sizeof fcModeOps[0])
 
 static FcOp
 FcConfigLexMode (const FcChar8 *mode)