From: Patrick Lam Date: Thu, 6 Apr 2006 04:33:11 +0000 (+0000) Subject: Fix intel compiler warnings: make many variables static, eliminate X-Git-Tag: fc-2_3_95~32 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=0d745819a9ec491349d4e122a7d44d689b2d3479;p=fontconfig.git Fix intel compiler warnings: make many variables static, eliminate duplicate names, reduce variable scopes, unsigned/signed printf formatting. reviewed by: plam --- diff --git a/ChangeLog b/ChangeLog index 04fb67b..6f5e427 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2006-04-06 Kjartan Maraas + 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 reviewed by: plam * src/fccache.c (FcGlobalCacheLoad, FcCacheSkipToArch): diff --git a/fc-case/fc-case.c b/fc-case/fc-case.c index e0548f0..6f8fdb4 100644 --- a/fc-case/fc-case.c +++ b/fc-case/fc-case.c @@ -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) diff --git a/fc-glyphname/fc-glyphname.c b/fc-glyphname/fc-glyphname.c index 31dff12..4d250e0 100644 --- a/fc-glyphname/fc-glyphname.c +++ b/fc-glyphname/fc-glyphname.c @@ -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) diff --git a/fc-lang/fc-lang.c b/fc-lang/fc-lang.c index 1efd0c1..9875363 100644 --- a/fc-lang/fc-lang.c +++ b/fc-lang/fc-lang.c @@ -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; } } diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c index 3ddba74..2666620 100644 --- a/fc-match/fc-match.c +++ b/fc-match/fc-match.c @@ -47,7 +47,7 @@ #undef _GNU_SOURCE #define _GNU_SOURCE #include -const struct option longopts[] = { +static const struct option longopts[] = { {"sort", 0, 0, 's'}, {"version", 0, 0, 'V'}, {"verbose", 0, 0, 'v'}, diff --git a/src/fccache.c b/src/fccache.c index aefba02..5aa0df8 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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)) diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 455f059..6bdd733 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -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); diff --git a/src/fclang.c b/src/fclang.c index ab8105d..e33afd2 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -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) { diff --git a/src/fcxml.c b/src/fcxml.c index 1590358..fac706c 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -27,7 +27,7 @@ #include "fcint.h" #include -#if ENABLE_LIBXML2 +#ifdef ENABLE_LIBXML2 #include @@ -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))