]> git.wh0rd.org - fontconfig.git/commitdiff
Fix intel compiler warnings: make many variables static, eliminate
authorPatrick Lam <plam@MIT.EDU>
Thu, 6 Apr 2006 04:33:11 +0000 (04:33 +0000)
committerPatrick Lam <plam@MIT.EDU>
Thu, 6 Apr 2006 04:33:11 +0000 (04:33 +0000)
    duplicate names, reduce variable scopes, unsigned/signed printf
    formatting.
reviewed by: plam

ChangeLog
fc-case/fc-case.c
fc-glyphname/fc-glyphname.c
fc-lang/fc-lang.c
fc-match/fc-match.c
src/fccache.c
src/fcfreetype.c
src/fclang.c
src/fcxml.c

index 04fb67bccc43622816966ec0ec49dfff287da434..6f5e42739c769aae760dfa2e3882006d7e95278d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2006-04-06  Kjartan Maraas  <kmaraas@gnome.org>
+       reviewed by: plam
+       * fc-case/fc-case.c:
+       * fc-glyphname/fc-glyphname.c:
+       * fc-lang/fc-lang.c (main):
+       * fc-match/fc-match.c:
+       * src/fccache.c (FcGlobalCacheSave, FcCacheSkipToArch, 
+                        FcDirCacheWrite):
+       * src/fcfreetype.c (FcFreeTypeQuery):
+       * src/fclang.c (FcFreeTypeLangSet):
+       * src/fcxml.c:
+
+       Fix intel compiler warnings: make many variables static,
+       eliminate duplicate names, reduce variable scopes, unsigned/signed
+       printf formatting.
+
 2006-03-24  Mike Fabian  <mfabian@suse.de>
        reviewed by: plam
        * src/fccache.c (FcGlobalCacheLoad, FcCacheSkipToArch):
index e0548f02d2189a2f21860ffaba1e0829d2c1d76b..6f8fdb493f221e46e3e4e4098a1945ae56bfcd0b 100644 (file)
@@ -112,10 +112,10 @@ utf8_size (FcChar32 ucs4)
 }
 
 static FcChar8 *foldChars;
-int            nfoldChars;
-int            maxFoldChars;
-FcChar32       minFoldChar;
-FcChar32       maxFoldChar;
+static int     nfoldChars;
+static int     maxFoldChars;
+static FcChar32        minFoldChar;
+static FcChar32        maxFoldChar;
 
 static void
 addChar (FcChar32 c)
index 31dff12ef4c0927128fd5d642586b3befdd563bb..4d250e0086102a903cb959b92151383750199a84 100644 (file)
@@ -83,12 +83,12 @@ fatal (const char *file, int lineno, const char *msg)
 #define MAX_GLYPHNAME      10240
 #define MAX_NAMELEN        1024
 
-FcGlyphName *raw[MAX_GLYPHNAME];
-int        nraw;
-int        max_name_len;
-FcGlyphName *name_to_ucs[MAX_GLYPHNAME*2];
-FcGlyphName *ucs_to_name[MAX_GLYPHNAME*2];
-int        hash, rehash;
+static FcGlyphName *raw[MAX_GLYPHNAME];
+static int         nraw;
+static int         max_name_len;
+static FcGlyphName *name_to_ucs[MAX_GLYPHNAME*2];
+static FcGlyphName *ucs_to_name[MAX_GLYPHNAME*2];
+static unsigned int hash, rehash;
 
 static int
 rawindex (const FcGlyphName *gn)
index 1efd0c1fe66d47445b4adcac161187f69aba253a..9875363ab39c3c5022a89b14231b8bbd27287f20 100644 (file)
@@ -97,7 +97,7 @@ get_line (FILE *f, char *line, int *lineno)
     return line;
 }
 
-char   *dir = 0;
+static char    *dir = 0;
 
 static FILE *
 scanopen (char *file)
@@ -246,7 +246,6 @@ main (int argc, char **argv)
     int                total_leaves = 0;
     int                offset_count = 0;
     int                l, sl, tl;
-    int                c;
     static char                line[1024];
     static FcChar32    map[MAX_LANG_SET_MAP];
     int                num_lang_set_map;
@@ -463,6 +462,7 @@ main (int argc, char **argv)
      */
     if (ncountry)
     {
+       int     c;
        int     ncountry_ent = 0;
        printf ("\n");
        printf ("static const FcChar32 fcLangCountrySets[][NUM_LANG_SET_MAP] = {\n");
@@ -471,7 +471,7 @@ main (int argc, char **argv)
            i = country[c];
            if (i >= 0)
            {
-               int l = strchr (langs[i], '-') - langs[i];
+               int lang = strchr (langs[i], '-') - langs[i];
                int d, k;
 
                for (k = 0; k < num_lang_set_map; k++)
@@ -491,7 +491,7 @@ main (int argc, char **argv)
                for (k = 0; k < num_lang_set_map; k++)
                    printf (" 0x%08x,", map[k]);
                printf (" }, /* %*.*s */\n",
-                       l, l, langs[i]);
+                       lang, lang, langs[i]);
                ++ncountry_ent;
            }
        }
index 3ddba74c42ab0a7bd2b41488428e580be9da4708..2666620a5c1116b3471fcd694d9aa6274a913d93 100644 (file)
@@ -47,7 +47,7 @@
 #undef  _GNU_SOURCE
 #define _GNU_SOURCE
 #include <getopt.h>
-const struct option longopts[] = {
+static const struct option longopts[] = {
     {"sort", 0, 0, 's'},
     {"version", 0, 0, 'V'},
     {"verbose", 0, 0, 'v'},
index aefba02ae3ed0523ab2a77c451d3afe638528f71..5aa0df894a3e491554b22a24976d7995d44dd070 100644 (file)
@@ -410,7 +410,7 @@ FcGlobalCacheSave (FcGlobalCache    *cache,
                   const FcChar8    *cache_file,
                   FcConfig         *config)
 {
-    int                        fd, fd_orig, i;
+    int                        fd, fd_orig;
     FcGlobalCacheDir   *dir;
     FcAtomic           *atomic;
     off_t              current_arch_start = 0, truncate_to;
@@ -468,6 +468,8 @@ FcGlobalCacheSave (FcGlobalCache    *cache,
     truncate_to = current_arch_start + strlen(current_arch_machine_name) + 11;
     for (dir = cache->dirs; dir; dir = dir->next)
     {
+       int i;
+
        if (dir->state == FcGCDirDisabled)
            continue;
        truncate_to += strlen(dir->name) + 1;
@@ -488,6 +490,7 @@ FcGlobalCacheSave (FcGlobalCache    *cache,
 
     for (dir = cache->dirs; dir; dir = dir->next)
     {
+       int i;
        const char * d;
        off_t off;
 
@@ -645,8 +648,6 @@ FcCacheSkipToArch (int fd, const char * arch)
        current_arch_start += bs;
        current_arch_start = FcCacheNextOffset (current_arch_start);
     }
-
-    return -1;
 }
 
 /* Cuts out the segment at the file pointer (moves everything else
@@ -1324,8 +1325,8 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
 
     if (current_arch_start < 0)
     {
-       off_t i = lseek(fd_orig, 0, SEEK_END);
-       current_arch_start = FcCacheNextOffset (i);
+       off_t offset = lseek(fd_orig, 0, SEEK_END);
+       current_arch_start = FcCacheNextOffset (offset);
     }
 
     if (fd_orig != -1 && !FcCacheCopyOld(fd, fd_orig, current_arch_start))
index 455f059a89d43769350be3c39a9f858bb78e9c67..6bdd733dba104ead798a6106a9bd937ef1358520 100644 (file)
@@ -1221,7 +1221,7 @@ FcFreeTypeQuery (const FcChar8    *file,
      * or which are simply a FC_FAMILY and FC_STYLE glued together
      */
     {
-       int     fn, fa, st;
+       int     fn, fa;
        FcChar8 *full;
        FcChar8 *fam;
        FcChar8 *style;
@@ -1438,7 +1438,6 @@ FcFreeTypeQuery (const FcChar8    *file,
     if (!foundry)
     {
        int             rc;
-       BDF_PropertyRec prop;
        rc = FT_Get_BDF_Property(face, "FOUNDRY", &prop);
        if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM)
            foundry = (FcChar8 *) prop.u.atom;
@@ -1606,7 +1605,6 @@ FcFreeTypeQuery (const FcChar8    *file,
         if(face->num_fixed_sizes == 1) {
             int rc;
             int value;
-            BDF_PropertyRec prop;
 
            /* skip bitmap fonts which do not even have a family name */
            rc =  FT_Get_BDF_Property(face, "FAMILY_NAME", &prop);
index ab8105d965d43e49afe3baa4a38e345423ff65ab..e33afd26aff0a644417802952fea61b7629d0f95 100644 (file)
@@ -95,7 +95,7 @@ FcFreeTypeLangSet (const FcCharSet  *charset,
                FcChar32    map[FC_CHARSET_MAP_SIZE];
                FcChar32    next;
 
-               printf ("\n%s(%d) ", fcLangCharSets[i].lang, missing);
+               printf ("\n%s(%u) ", fcLangCharSets[i].lang, missing);
                printf ("{");
                for (ucs4 = FcCharSetFirstPage (missed, map, &next);
                     ucs4 != FC_CHARSET_DONE;
@@ -114,7 +114,7 @@ FcFreeTypeLangSet (const FcCharSet  *charset,
                FcCharSetDestroy (missed);
            }
            else
-               printf ("%s(%d) ", fcLangCharSets[i].lang, missing);
+               printf ("%s(%u) ", fcLangCharSets[i].lang, missing);
        }
        if (!missing)
            FcLangSetBitSet (ls, i);
@@ -388,7 +388,6 @@ FcLangSetHasLang (const FcLangSet *ls, const FcChar8 *lang)
     {
        FcStrList       *list = FcStrListCreate (ls->extra);
        FcChar8         *extra;
-       FcLangResult    r;
        
        if (list)
        {
index 1590358fbd26319fa07a15b50af7f314c1faece7..fac706c5d10a2bd410175c65510e86870737da48 100644 (file)
@@ -27,7 +27,7 @@
 #include "fcint.h"
 #include <dirent.h>
 
-#if ENABLE_LIBXML2
+#ifdef ENABLE_LIBXML2
 
 #include <libxml/parser.h>
 
@@ -2234,7 +2234,7 @@ FcStartDoctypeDecl (void      *userData,
        FcConfigMessage (parse, FcSevereError, "invalid doctype \"%s\"", doctypeName);
 }
 
-#if ENABLE_LIBXML2
+#ifdef ENABLE_LIBXML2
 
 static void
 FcInternalSubsetDecl (void            *userData,
@@ -2359,7 +2359,7 @@ FcConfigParseAndLoad (FcConfig        *config,
     FcConfigParse   parse;
     FcBool         error = FcTrue;
     
-#if ENABLE_LIBXML2
+#ifdef ENABLE_LIBXML2
     xmlSAXHandler   sax;
     char            buf[BUFSIZ];
 #else
@@ -2398,7 +2398,7 @@ FcConfigParseAndLoad (FcConfig        *config,
        goto bail0;
     }
     
-#if ENABLE_LIBXML2
+#ifdef ENABLE_LIBXML2
     memset(&sax, 0, sizeof(sax));
 
     sax.internalSubset = FcInternalSubsetDecl;
@@ -2419,7 +2419,7 @@ FcConfigParseAndLoad (FcConfig        *config,
     if (!FcConfigInit (&parse, name, config, p))
        goto bail2;
 
-#if !ENABLE_LIBXML2
+#ifndef ENABLE_LIBXML2
 
     XML_SetUserData (p, &parse);
     
@@ -2430,7 +2430,7 @@ FcConfigParseAndLoad (FcConfig        *config,
 #endif /* ENABLE_LIBXML2 */
 
     do {
-#if !ENABLE_LIBXML2
+#ifndef ENABLE_LIBXML2
        buf = XML_GetBuffer (p, BUFSIZ);
        if (!buf)
        {
@@ -2445,7 +2445,7 @@ FcConfigParseAndLoad (FcConfig        *config,
            goto bail3;
        }
 
-#if ENABLE_LIBXML2
+#ifdef ENABLE_LIBXML2
        if (xmlParseChunk (p, buf, len, len == 0))
 #else
        if (!XML_ParseBuffer (p, len, len == 0))