]> git.wh0rd.org - fontconfig.git/commitdiff
fontconfig library: build fixes and compiler warning fixes
authorKeith Packard <keithp@keithp.com>
Fri, 15 Feb 2002 06:01:28 +0000 (06:01 +0000)
committerKeith Packard <keithp@keithp.com>
Fri, 15 Feb 2002 06:01:28 +0000 (06:01 +0000)
19 files changed:
fc-cache/Imakefile
fc-list/Imakefile
fc-list/fc-list.c
fontconfig/fcfreetype.h
fontconfig/fcprivate.h
fontconfig/fcxml.h
fontconfig/fontconfig.h
src/fccache.c
src/fccfg.c
src/fccharset.c
src/fcdir.c
src/fcfreetype.c
src/fcinit.c
src/fcint.h
src/fcmatch.c
src/fcname.c
src/fcpat.c
src/fcstr.c
src/fcxml.c

index 1950b3ceea60334526500d51b393667d0da455be..eb0d4d92111ccf131b98e229f6daacbd97bd6f20 100644 (file)
@@ -1,7 +1,7 @@
 INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I..
 
 LOCAL_LIBRARIES=FontconfigClientLibs
-        DEPLIBS=FontconfigDepLibs
+        DEPLIBS=FontconfigClientDepLibs
 
 SRCS=fc-cache.c
 OBJS=fc-cache.o
index cff22bbe9ddb6e96b6bcc10501c9657e492c82ab..13a1280c1f8140a53d832144c648c0748419ce3a 100644 (file)
@@ -1,7 +1,7 @@
 INCLUDES=$(FREETYPE2INCLUDES) $(LIBXML2INCLUDES) -I..
 
 LOCAL_LIBRARIES=FontconfigClientLibs
-        DEPLIBS=FontconfigDepLibs
+        DEPLIBS=FontconfigClientDepLibs
 
 SRCS=fc-list.c
 OBJS=fc-list.o
index 67d712020320fd5c659829a6c0f0c7c33d59a020..1d2d67b30b5ceed878011414826013616b949631 100644 (file)
@@ -25,6 +25,7 @@
 #include <fontconfig/fontconfig.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <stdlib.h>
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #else
@@ -47,7 +48,7 @@ extern int optind, opterr, optopt;
 #endif
 #endif
 
-void usage (char *program)
+static void usage (char *program)
 {
     fprintf (stderr, "usage: %s [-vV?] [--verbose] [--version] [--help] [dirs]\n",
             program);
@@ -63,8 +64,6 @@ void usage (char *program)
 int
 main (int argc, char **argv)
 {
-    int                ret = 0;
-    FcFontSet  *set;
     int                verbose = 0;
     int                i;
     FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_LANG, 0);
index 14f342b3c115133efa5f1cb43a1165456acf1aca..794e8e8162029d52ad2d69b42aa16e4eea4f27d5 100644 (file)
@@ -24,6 +24,7 @@
 
 #ifndef _FCFREETYPE_H_
 #define _FCFREETYPE_H_
+#include <freetype/freetype.h>
 
 FT_UInt
 FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
index 490ca33657791a8e36adc057ee9472d6916a6090..02732e80156be268af46de824958361d9c4a3935 100644 (file)
@@ -59,7 +59,7 @@
            __v__.u.d = va_arg (va, double);                        \
            break;                                                  \
        case FcTypeString:                                          \
-           __v__.u.s = va_arg (va, char *);                        \
+           __v__.u.s = va_arg (va, FcChar8 *);                     \
            break;                                                  \
        case FcTypeBool:                                            \
            __v__.u.b = va_arg (va, FcBool);                        \
index b5d1b7d9f51c3c7251f074ff09fe5ebdb3d8bfa8..6c7e0a3bb887946e4755f2fbec9ec35b9b3c309d 100644 (file)
@@ -28,7 +28,7 @@
 #include <libxml/parser.h>
 
 xmlDocPtr
-FcConfigLoad (const char *file);
+FcConfigLoad (const FcChar8 *file);
 
 FcBool
 FcConfigParse (FcConfig            *config,
index c7105e0d1c28f5c93fc516c2a350347b3d522d3f..86b9c79c87a1d2db2bba42eca5251a2f20b2652d 100644 (file)
@@ -168,7 +168,7 @@ typedef struct _FcObjectType {
 } FcObjectType;
 
 typedef struct _FcConstant {
-    const char  *name;
+    const FcChar8  *name;
     const char *object;
     int                value;
 } FcConstant;
@@ -242,8 +242,8 @@ FcBool
 FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
 
 /* fccfg.c */
-char *
-FcConfigFilename (const char *url);
+FcChar8 *
+FcConfigFilename (const FcChar8 *url);
     
 FcConfig *
 FcConfigCreate (void);
@@ -260,13 +260,13 @@ FcConfigGetCurrent (void);
 FcBool
 FcConfigBuildFonts (FcConfig *config);
 
-char **
+FcChar8 **
 FcConfigGetDirs (FcConfig   *config);
 
-char **
+FcChar8 **
 FcConfigGetConfigFiles (FcConfig    *config);
 
-char *
+FcChar8 *
 FcConfigGetCache (FcConfig  *config);
 
 FcBlanks *
@@ -278,11 +278,11 @@ FcConfigGetFonts (FcConfig        *config,
 
 FcBool
 FcConfigAppFontAddFile (FcConfig    *config,
-                       const char  *file);
+                       const FcChar8  *file);
 
 FcBool
 FcConfigAppFontAddDir (FcConfig            *config,
-                      const char   *dir);
+                      const FcChar8   *dir);
 
 void
 FcConfigAppFontClear (FcConfig     *config);
@@ -329,12 +329,6 @@ FcCharSetIntersectCount (const FcCharSet *a, const FcCharSet *b);
 FcChar32
 FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b);
 
-#ifndef FONTCONFIG_NO_FREETYPE
-#include <freetype/freetype.h>
-FT_UInt
-FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
-#endif
-
 /* fcdbg.c */
 void
 FcPatternPrint (FcPattern *p);
@@ -345,18 +339,25 @@ FcDefaultSubstitute (FcPattern *pattern);
 
 /* fcdir.c */
 FcBool
-FcDirScan (FcFontSet   *set,
-          FcFileCache  *cache,
-          FcBlanks     *blanks,
-          const char   *dir,
-          FcBool       force);
+FcFileScan (FcFontSet      *set,
+           FcFileCache     *cache,
+           FcBlanks        *blanks,
+           const FcChar8   *file,
+           FcBool          force);
 
 FcBool
-FcDirSave (FcFontSet *set, const char *dir);
+FcDirScan (FcFontSet       *set,
+          FcFileCache      *cache,
+          FcBlanks         *blanks,
+          const FcChar8    *dir,
+          FcBool           force);
+
+FcBool
+FcDirSave (FcFontSet *set, const FcChar8 *dir);
 
 /* fcfreetype.c */
 FcPattern *
-FcFreeTypeQuery (const char *file, int id, FcBlanks *blanks, int *count);
+FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count);
 
 /* fcfs.c */
 
@@ -443,13 +444,13 @@ FcBool
 FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
     
 const FcConstant *
-FcNameGetConstant (char *string);
+FcNameGetConstant (FcChar8 *string);
 
 FcBool
-FcNameConstant (char *string, int *result);
+FcNameConstant (FcChar8 *string, int *result);
 
 FcPattern *
-FcNameParse (const char *name);
+FcNameParse (const FcChar8 *name);
 
 FcChar8 *
 FcNameUnparse (FcPattern *pat);
@@ -486,7 +487,7 @@ FcBool
 FcPatternAddDouble (FcPattern *p, const char *object, double d);
 
 FcBool
-FcPatternAddString (FcPattern *p, const char *object, const char *s);
+FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s);
 
 FcBool
 FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s);
@@ -504,7 +505,7 @@ FcResult
 FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
 
 FcResult
-FcPatternGetString (FcPattern *p, const char *object, int n, char **const s);
+FcPatternGetString (FcPattern *p, const char *object, int n, FcChar8 const** s);
 
 FcResult
 FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
@@ -523,13 +524,13 @@ FcPatternBuild (FcPattern *orig, ...);
 
 /* fcstr.c */
 
-char *
-FcStrCopy (const char *s);
+FcChar8 *
+FcStrCopy (const FcChar8 *s);
 
 #define FcToLower(c)   (('A' <= (c) && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
 
 int
-FcStrCmpIgnoreCase (const char *s1, const char *s2);
+FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2);
 
 int
 FcUtf8ToUcs4 (FcChar8   *src_orig,
@@ -544,7 +545,7 @@ FcUtf8Len (FcChar8  *string,
 
 /* fcxml.c */
 FcBool
-FcConfigParseAndLoad (FcConfig *config, const char *file, FcBool complain);
+FcConfigParseAndLoad (FcConfig *config, const FcChar8 *file, FcBool complain);
 
 _FCFUNCPROTOEND
 
index 2251286cce4c88ae3db48560143aad96d2f496b0..477714652949ce713d388b28c75806ff2e5ae1a1 100644 (file)
 #include "fcint.h"
 
 static unsigned int
-FcFileCacheHash (const char *string)
+FcFileCacheHash (const FcChar8 *string)
 {
     unsigned int    h = 0;
-    char           c;
+    FcChar8        c;
 
     while ((c = *string++))
        h = (h << 1) ^ c;
     return h;
 }
 
-char *
+FcChar8 *
 FcFileCacheFind (FcFileCache   *cache,
-                const char     *file,
+                const FcChar8  *file,
                 int            id,
                 int            *count)
 {
     unsigned int    hash;
-    const char     *match;
-    FcFileCacheEnt *c, *name;
+    const FcChar8   *match;
+    FcFileCacheEnt  *c, *name;
     int                    maxid;
     struct stat            statb;
     
@@ -60,7 +60,7 @@ FcFileCacheFind (FcFileCache  *cache,
                maxid = c->id;
            if (c->id == id)
            {
-               if (stat (file, &statb) < 0)
+               if (stat ((char *) file, &statb) < 0)
                {
                    if (FcDebug () & FC_DBG_CACHE)
                        printf (" file missing\n");
@@ -94,11 +94,14 @@ FcFileCacheFind (FcFileCache        *cache,
  * "file_name" id time "font_name" \n
  */
  
-static FcBool
-FcFileCacheReadString (FILE *f, char *dest, int len)
+static FcChar8 *
+FcFileCacheReadString (FILE *f, FcChar8 *dest, int len)
 {
-    int            c;
-    FcBool    escape;
+    int                c;
+    FcBool     escape;
+    FcChar8    *d;
+    int                size;
+    int                i;
 
     while ((c = getc (f)) != EOF)
        if (c == '"')
@@ -108,6 +111,9 @@ FcFileCacheReadString (FILE *f, char *dest, int len)
     if (len == 0)
        return FcFalse;
     
+    size = len;
+    i = 0;
+    d = dest;
     escape = FcFalse;
     while ((c = getc (f)) != EOF)
     {
@@ -115,19 +121,32 @@ FcFileCacheReadString (FILE *f, char *dest, int len)
        {
            switch (c) {
            case '"':
-               *dest++ = '\0';
-               return FcTrue;
+               c = '\0';
+               break;
            case '\\':
                escape = FcTrue;
                continue;
            }
        }
-        if (--len <= 1)
-           return FcFalse;
-       *dest++ = c;
+       if (i == size)
+       {
+           FcChar8 *new = malloc (size * 2);
+           if (!new)
+               break;
+           memcpy (new, d, size);
+           size *= 2;
+           if (d != dest)
+               free (d);
+           d = new;
+       }
+       d[i++] = c;
+       if (c == '\0')
+           return d;
        escape = FcFalse;
     }
-    return FcFalse;
+    if (d != dest)
+       free (d);
+    return 0;
 }
 
 static FcBool
@@ -183,10 +202,10 @@ FcFileCacheReadTime (FILE *f, time_t *dest)
 
 static FcBool
 FcFileCacheAdd (FcFileCache    *cache,
-                const char     *file,
+                const FcChar8  *file,
                 int            id,
                 time_t         time,
-                const char     *name,
+                const FcChar8  *name,
                 FcBool         replace)
 {
     FcFileCacheEnt    *c;
@@ -220,16 +239,16 @@ FcFileCacheAdd (FcFileCache       *cache,
     }
        
     c = malloc (sizeof (FcFileCacheEnt) +
-               strlen (file) + 1 +
-               strlen (name) + 1);
+               strlen ((char *) file) + 1 +
+               strlen ((char *) name) + 1);
     if (!c)
        return FcFalse;
     c->next = *prev;
     *prev = c;
     c->hash = hash;
-    c->file = (char *) (c + 1);
+    c->file = (FcChar8 *) (c + 1);
     c->id = id;
-    c->name = c->file + strlen (file) + 1;
+    c->name = c->file + strlen ((char *) file) + 1;
     strcpy (c->file, file);
     c->time = time;
     c->referenced = replace;
@@ -274,42 +293,54 @@ FcFileCacheDestroy (FcFileCache *cache)
 
 void
 FcFileCacheLoad (FcFileCache   *cache,
-                const char     *cache_file)
+                const FcChar8  *cache_file)
 {
     FILE           *f;
-    char           file[8192];
+    FcChar8        file_buf[8192], *file;
     int                    id;
     time_t         time;
-    char           name[8192];
+    FcChar8        name_buf[8192], *name;
 
-    f = fopen (cache_file, "r");
+    f = fopen ((char *) cache_file, "r");
     if (!f)
        return;
 
     cache->updated = FcFalse;
-    while (FcFileCacheReadString (f, file, sizeof (file)) &&
+    file = 0;
+    name = 0;
+    while ((file = FcFileCacheReadString (f, file_buf, sizeof (file_buf))) &&
           FcFileCacheReadInt (f, &id) &&
           FcFileCacheReadTime (f, &time) &&
-          FcFileCacheReadString (f, name, sizeof (name)))
+          (name = FcFileCacheReadString (f, name_buf, sizeof (name_buf))))
     {
        (void) FcFileCacheAdd (cache, file, id, time, name, FcFalse);
+       if (file != file_buf)
+           free (file);
+       if (name != name_buf)
+           free (name);
+       file = 0;
+       name = 0;
     }
+    if (file && file != file_buf)
+       free (file);
+    if (name && name != name_buf)
+       free (name);
     fclose (f);
 }
 
 FcBool
-FcFileCacheUpdate (FcFileCache *cache,
-                  const char   *file,
-                  int          id,
-                  const char   *name)
+FcFileCacheUpdate (FcFileCache     *cache,
+                  const FcChar8    *file,
+                  int              id,
+                  const FcChar8    *name)
 {
-    const char     *match;
+    const FcChar8   *match;
     struct stat            statb;
     FcBool         ret;
 
     match = file;
 
-    if (stat (file, &statb) < 0)
+    if (stat ((char *) file, &statb) < 0)
        return FcFalse;
     ret = FcFileCacheAdd (cache, match, id, 
                            statb.st_mtime, name, FcTrue);
@@ -319,7 +350,7 @@ FcFileCacheUpdate (FcFileCache      *cache,
 }
 
 static FcBool
-FcFileCacheWriteString (FILE *f, char *string)
+FcFileCacheWriteString (FILE *f, const FcChar8 *string)
 {
     char    c;
 
@@ -382,10 +413,10 @@ FcFileCacheWriteTime (FILE *f, time_t t)
 
 FcBool
 FcFileCacheSave (FcFileCache   *cache,
-                const char     *cache_file)
+                const FcChar8  *cache_file)
 {
-    char           *lck;
-    char           *tmp;
+    FcChar8        *lck;
+    FcChar8        *tmp;
     FILE           *f;
     int                    h;
     FcFileCacheEnt *c;
@@ -393,19 +424,19 @@ FcFileCacheSave (FcFileCache      *cache,
     if (!cache->updated && cache->referenced == cache->entries)
        return FcTrue;
     
-    lck = malloc (strlen (cache_file)*2 + 4);
+    lck = malloc (strlen ((char *) cache_file)*2 + 4);
     if (!lck)
        goto bail0;
-    tmp = lck + strlen (cache_file) + 2;
-    strcpy (lck, cache_file);
-    strcat (lck, "L");
-    strcpy (tmp, cache_file);
-    strcat (tmp, "T");
-    if (link (lck, cache_file) < 0 && errno != ENOENT)
+    tmp = lck + strlen ((char *) cache_file) + 2;
+    strcpy ((char *) lck, (char *) cache_file);
+    strcat ((char *) lck, "L");
+    strcpy ((char *) tmp, (char *) cache_file);
+    strcat ((char *) tmp, "T");
+    if (link ((char *) lck, (char *) cache_file) < 0 && errno != ENOENT)
        goto bail1;
-    if (access (tmp, F_OK) == 0)
+    if (access ((char *) tmp, F_OK) == 0)
        goto bail2;
-    f = fopen (tmp, "w");
+    f = fopen ((char *) tmp, "w");
     if (!f)
        goto bail2;
 
@@ -437,19 +468,19 @@ FcFileCacheSave (FcFileCache      *cache,
     if (fclose (f) == EOF)
        goto bail3;
     
-    if (rename (tmp, cache_file) < 0)
+    if (rename ((char *) tmp, (char *) cache_file) < 0)
        goto bail3;
     
-    unlink (lck);
+    unlink ((char *) lck);
     cache->updated = FcFalse;
     return FcTrue;
 
 bail4:
     fclose (f);
 bail3:
-    unlink (tmp);
+    unlink ((char *) tmp);
 bail2:
-    unlink (lck);
+    unlink ((char *) lck);
 bail1:
     free (lck);
 bail0:
@@ -457,15 +488,15 @@ bail0:
 }
 
 FcBool
-FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
+FcFileCacheReadDir (FcFontSet *set, const FcChar8 *cache_file)
 {
     FcPattern      *font;
     FILE           *f;
-    char           *path;
-    char           *base;
-    char           file[8192];
+    FcChar8        *path;
+    FcChar8        *base;
+    FcChar8        file_buf[8192], *file;
     int                    id;
-    char           name[8192];
+    FcChar8        name_buf[8192], *name;
     FcBool         ret = FcFalse;
 
     if (FcDebug () & FC_DBG_CACHE)
@@ -473,7 +504,7 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
        printf ("FcFileCacheReadDir cache_file \"%s\"\n", cache_file);
     }
     
-    f = fopen (cache_file, "r");
+    f = fopen ((char *) cache_file, "r");
     if (!f)
     {
        if (FcDebug () & FC_DBG_CACHE)
@@ -483,7 +514,7 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
        goto bail0;
     }
 
-    base = strrchr (cache_file, '/');
+    base = (FcChar8 *) strrchr ((char *) cache_file, '/');
     if (!base)
        goto bail1;
     base++;
@@ -493,9 +524,11 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
     memcpy (path, cache_file, base - cache_file);
     base = path + (base - cache_file);
     
-    while (FcFileCacheReadString (f, file, sizeof (file)) &&
+    file = 0;
+    name = 0;
+    while ((file = FcFileCacheReadString (f, file_buf, sizeof (file_buf))) &&
           FcFileCacheReadInt (f, &id) &&
-          FcFileCacheReadString (f, name, sizeof (name)))
+          (name = FcFileCacheReadString (f, name_buf, sizeof (name_buf))))
     {
        font = FcNameParse (name);
        if (font)
@@ -509,6 +542,11 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
            if (!FcFontSetAdd (set, font))
                goto bail2;
        }
+       if (file != file_buf)
+           free (file);
+       if (name != name_buf)
+           free (name);
+       file = name = 0;
     }
     if (FcDebug () & FC_DBG_CACHE)
     {
@@ -518,6 +556,10 @@ FcFileCacheReadDir (FcFontSet *set, const char *cache_file)
     ret = FcTrue;
 bail2:
     free (path);
+    if (file && file != file_buf)
+       free (file);
+    if (name && name != name_buf)
+       free (name);
 bail1:
     fclose (f);
 bail0:
@@ -525,12 +567,12 @@ bail0:
 }
 
 FcBool
-FcFileCacheWriteDir (FcFontSet *set, const char *cache_file)
+FcFileCacheWriteDir (FcFontSet *set, const FcChar8 *cache_file)
 {
     FcPattern      *font;
     FILE           *f;
-    char           *name;
-    char           *file, *base;
+    FcChar8        *name;
+    const FcChar8   *file, *base;
     int                    n;
     int                    id;
     FcBool         ret;
@@ -538,7 +580,7 @@ FcFileCacheWriteDir (FcFontSet *set, const char *cache_file)
     if (FcDebug () & FC_DBG_CACHE)
        printf ("FcFileCacheWriteDir cache_file \"%s\"\n", cache_file);
     
-    f = fopen (cache_file, "w");
+    f = fopen ((char *) cache_file, "w");
     if (!f)
     {
        if (FcDebug () & FC_DBG_CACHE)
@@ -550,7 +592,7 @@ FcFileCacheWriteDir (FcFontSet *set, const char *cache_file)
        font = set->fonts[n];
        if (FcPatternGetString (font, FC_FILE, 0, &file) != FcResultMatch)
            goto bail1;
-       base = strrchr (file, '/');
+       base = (FcChar8 *) strrchr ((char *) file, '/');
        if (base)
            base = base + 1;
        else
@@ -587,6 +629,6 @@ FcFileCacheWriteDir (FcFontSet *set, const char *cache_file)
 bail1:
     fclose (f);
 bail0:
-    unlink (cache_file);
+    unlink ((char *) cache_file);
     return FcFalse;
 }
index 0280ee1d198ded49ad7db1ba19539a80dcd8b9f6..715f09170fdd57dd220214d8b92ed7990843c7c0 100644 (file)
@@ -50,7 +50,7 @@ FcConfigCreate (void)
     config->configFiles[0] = 0;
     
     config->cache = 0;
-    if (!FcConfigSetCache (config, "~/" FC_USER_CACHE_FILE))
+    if (!FcConfigSetCache (config, (FcChar8 *) ("~/" FC_USER_CACHE_FILE)))
        goto bail3;
 
     config->blanks = 0;
@@ -88,9 +88,9 @@ FcSubstDestroy (FcSubst *s)
 }
 
 static void
-FcConfigDestroyStrings (char **strings)
+FcConfigDestroyStrings (FcChar8 **strings)
 {
-    char    **s;
+    FcChar8    **s;
 
     for (s = strings; s && *s; s++)
        free (*s);
@@ -99,20 +99,20 @@ FcConfigDestroyStrings (char **strings)
 }
     
 static FcBool
-FcConfigAddString (char ***strings, char *string)
+FcConfigAddString (FcChar8 ***strings, FcChar8 *string)
 {
     int            n;
-    char    **s;
+    FcChar8    **s;
     
     n = 0;
     for (s = *strings; s && *s; s++)
        n++;
-    s = malloc ((n + 2) * sizeof (char *));
+    s = malloc ((n + 2) * sizeof (FcChar8 *));
     if (!s)
        return FcFalse;
     s[n] = string;
     s[n+1] = 0;
-    memcpy (s, *strings, n * sizeof (char *));
+    memcpy (s, *strings, n * sizeof (FcChar8 *));
     free (*strings);
     *strings = s;
     return FcTrue;
@@ -145,7 +145,7 @@ FcConfigBuildFonts (FcConfig *config)
 {
     FcFontSet   *fonts;
     FcFileCache *cache;
-    char       **d;
+    FcChar8    **d;
 
     fonts = FcFontSetCreate ();
     if (!fonts)
@@ -200,25 +200,25 @@ FcConfigGetCurrent (void)
 
 FcBool
 FcConfigAddDir (FcConfig    *config,
-               const char  *d)
+               const FcChar8  *d)
 {
-    char    *dir;
-    char    *h;
+    FcChar8    *dir;
+    FcChar8    *h;
 
     if (*d == '~')
     {
-       h = getenv ("HOME");
+       h = (FcChar8 *) getenv ("HOME");
        if (!h)
            return FcFalse;
-       dir = (char *) malloc (strlen (h) + strlen (d));
+       dir = (FcChar8 *) malloc (strlen ((char *) h) + strlen ((char *) d));
        if (!dir)
            return FcFalse;
-       strcpy (dir, h);
-       strcat (dir, d+1);
+       strcpy ((char *) dir, (char *) h);
+       strcat ((char *) dir, (char *) d+1);
     }
     else
     {
-       dir = (char *) malloc (strlen (d) + 1);
+       dir = (FcChar8 *) malloc (strlen ((char *) d) + 1);
        if (!dir)
            return FcFalse;
        strcpy (dir, d);
@@ -231,7 +231,7 @@ FcConfigAddDir (FcConfig    *config,
     return FcTrue;
 }
 
-char **
+FcChar8 **
 FcConfigGetDirs (FcConfig   *config)
 {
     if (!config)
@@ -245,9 +245,9 @@ FcConfigGetDirs (FcConfig   *config)
 
 FcBool
 FcConfigAddConfigFile (FcConfig            *config,
-                      const char   *f)
+                      const FcChar8   *f)
 {
-    char    *file;
+    FcChar8    *file;
     file = FcConfigFilename (f);
     if (!file)
        return FcFalse;
@@ -259,7 +259,7 @@ FcConfigAddConfigFile (FcConfig         *config,
     return FcTrue;
 }
 
-char **
+FcChar8 **
 FcConfigGetConfigFiles (FcConfig    *config)
 {
     if (!config)
@@ -273,21 +273,21 @@ FcConfigGetConfigFiles (FcConfig    *config)
 
 FcBool
 FcConfigSetCache (FcConfig     *config,
-                 const char    *c)
+                 const FcChar8 *c)
 {
-    char    *new;
-    char    *h;
+    FcChar8    *new;
+    FcChar8    *h;
 
     if (*c == '~')
     {
-       h = getenv ("HOME");
+       h = (FcChar8 *) getenv ("HOME");
        if (!h)
            return FcFalse;
-       new = (char *) malloc (strlen (h) + strlen (c));
+       new = (FcChar8 *) malloc (strlen ((char *) h) + strlen ((char *) c));
        if (!new)
            return FcFalse;
-       strcpy (new, h);
-       strcat (new, c+1);
+       strcpy ((char *) new, (char *) h);
+       strcat ((char *) new, (char *) c+1);
     }
     else
     {
@@ -299,7 +299,7 @@ FcConfigSetCache (FcConfig  *config,
     return FcTrue;
 }
 
-char *
+FcChar8 *
 FcConfigGetCache (FcConfig  *config)
 {
     if (!config)
@@ -545,7 +545,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
     FcValue    v, vl, vr;
     FcResult   r;
     FcMatrix   *m;
-    FcChar8    *s;
     
     switch (e->op) {
     case FcOpInteger:
@@ -1070,7 +1069,7 @@ FcConfigSubstitute (FcConfig      *config,
             * Locate any test associated with this field
             */
            for (t = s->test, i = 0; t; t = t->next, i++)
-               if (!FcStrCmpIgnoreCase (t->field, e->field))
+               if (!FcStrCmpIgnoreCase ((FcChar8 *) t->field, (FcChar8 *) e->field))
                    break;
            switch (e->op) {
            case FcOpAssign:
@@ -1087,6 +1086,10 @@ FcConfigSubstitute (FcConfig     *config,
                     * Append the new list of values after the current value
                     */
                    FcConfigAdd (&st[i].elt->values, thisValue, FcTrue, l);
+                   /*
+                    * Delete the marked value
+                    */
+                   FcConfigDel (&st[i].elt->values, thisValue);
                    /*
                     * Adjust any pointers into the value list to ensure
                     * future edits occur at the same place
@@ -1096,10 +1099,6 @@ FcConfigSubstitute (FcConfig     *config,
                        if (st[i].value == thisValue)
                            st[i].value = nextValue;
                    }
-                   /*
-                    * Delete the marked value
-                    */
-                   FcConfigDel (&st[i].elt->values, thisValue);
                    break;
                }
                /* fall through ... */
@@ -1179,41 +1178,41 @@ FcConfigSubstitute (FcConfig    *config,
 #define FONTCONFIG_FILE        "fonts.conf"
 #endif
 
-static char *
-FcConfigFileExists (const char *dir, const char *file)
+static FcChar8 *
+FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
 {
-    char    *path;
+    FcChar8    *path;
 
     if (!dir)
-       dir = "";
-    path = malloc (strlen (dir) + 1 + strlen (file) + 1);
+       dir = (FcChar8 *) "";
+    path = malloc (strlen ((char *) dir) + 1 + strlen ((char *) file) + 1);
     if (!path)
        return 0;
 
     strcpy (path, dir);
     /* make sure there's a single separating / */
-    if ((!path[0] || path[strlen(path)-1] != '/') && file[0] != '/')
-       strcat (path, "/");
-    strcat (path, file);
+    if ((!path[0] || path[strlen((char *) path)-1] != '/') && file[0] != '/')
+       strcat ((char *) path, "/");
+    strcat ((char *) path, (char *) file);
 
-    if (access (path, R_OK) == 0)
+    if (access ((char *) path, R_OK) == 0)
        return path;
     
     free (path);
     return 0;
 }
 
-static char **
+static FcChar8 **
 FcConfigGetPath (void)
 {
-    char    **path;
-    char    *env, *e, *colon;
-    char    *dir;
+    FcChar8    **path;
+    FcChar8    *env, *e, *colon;
+    FcChar8    *dir;
     int            npath;
     int            i;
 
     npath = 2; /* default dir + null */
-    env = getenv ("FONTCONFIG_PATH");
+    env = (FcChar8 *) getenv ("FONTCONFIG_PATH");
     if (env)
     {
        e = env;
@@ -1222,7 +1221,7 @@ FcConfigGetPath (void)
            if (*e++ == ':')
                npath++;
     }
-    path = calloc (npath, sizeof (char *));
+    path = calloc (npath, sizeof (FcChar8 *));
     if (!path)
        goto bail0;
     i = 0;
@@ -1232,9 +1231,9 @@ FcConfigGetPath (void)
        e = env;
        while (*e) 
        {
-           colon = strchr (e, ':');
+           colon = (FcChar8 *) strchr ((char *) e, ':');
            if (!colon)
-               colon = e + strlen (e);
+               colon = e + strlen ((char *) e);
            path[i] = malloc (colon - e + 1);
            if (!path[i])
                goto bail1;
@@ -1248,8 +1247,8 @@ FcConfigGetPath (void)
        }
     }
     
-    dir = FONTCONFIG_PATH;
-    path[i] = malloc (strlen (dir) + 1);
+    dir = (FcChar8 *) FONTCONFIG_PATH;
+    path[i] = malloc (strlen ((char *) dir) + 1);
     if (!path[i])
        goto bail1;
     strcpy (path[i], dir);
@@ -1264,29 +1263,30 @@ bail0:
 }
 
 static void
-FcConfigFreePath (char **path)
+FcConfigFreePath (FcChar8 **path)
 {
-    char    **p;
+    FcChar8    **p;
 
     for (p = path; *p; p++)
        free (*p);
     free (path);
 }
 
-char *
-FcConfigFilename (const char *url)
+FcChar8 *
+FcConfigFilename (const FcChar8 *url)
 {
-    char    *file, *dir, **path, **p;
+    FcChar8    *file, *dir, **path, **p;
     
     if (!url || !*url)
     {
-       url = getenv ("FONTCONFIG_FILE");
+       url = (FcChar8 *) getenv ("FONTCONFIG_FILE");
        if (!url)
-           url = FONTCONFIG_FILE;
+           url = (FcChar8 *) FONTCONFIG_FILE;
     }
+    file = 0;
     switch (*url) {
     case '~':
-       dir = getenv ("HOME");
+       dir = (FcChar8 *) getenv ("HOME");
        if (dir)
            file = FcConfigFileExists (dir, url + 1);
        else
@@ -1317,7 +1317,7 @@ FcConfigFilename (const char *url)
 
 FcBool
 FcConfigAppFontAddFile (FcConfig    *config,
-                       const char  *file)
+                       const FcChar8  *file)
 {
     FcFontSet  *set;
 
@@ -1341,7 +1341,7 @@ FcConfigAppFontAddFile (FcConfig    *config,
 
 FcBool
 FcConfigAppFontAddDir (FcConfig            *config,
-                      const char   *dir)
+                      const FcChar8   *dir)
 {
     FcFontSet  *set;
     
index b29a48a8e09c2a0213d86b17a3c104867414cc49..918f5ba1ef2588807da7869f19e3f8886ed55c34 100644 (file)
@@ -144,7 +144,7 @@ FcCharSetFindLeaf (const FcCharSet *fcs, FcChar32 ucs4)
     int                        l;
     const FcCharNode   *prev;
     FcCharNode         node;
-    FcChar           i;
+    FcChar32           i;
 
     prev = &fcs->node;
     l = fcs->levels;
@@ -167,9 +167,9 @@ FcCharSetFindLeaf (const FcCharSet *fcs, FcChar32 ucs4)
 static FcCharLeaf *
 FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4)
 {
-    int                l;
-    FcCharNode  *prev, node;
-    FcChar8    i;
+    int                    l;
+    FcCharNode     *prev, node;
+    FcChar32       i;
 
     if (!FcCharSetCheckLevel (fcs, ucs4))
        return FcFalse;
@@ -242,7 +242,7 @@ FcCharSetIterLeaf (FcCharNode node, int level, FcChar32 *ucs4)
        int         shift = ((level - 1) << 3);
        FcChar32    inc = 1 << shift;
        FcChar32    mask = ~(inc - 1);
-       FcChar    byte = (*ucs4 >> shift) & 0xff;
+       FcChar32    byte = (*ucs4 >> shift) & 0xff;
        FcCharLeaf  *leaf;
 
        for (;;)
@@ -254,7 +254,7 @@ FcCharSetIterLeaf (FcCharNode node, int level, FcChar32 *ucs4)
                break;
            /* step to next branch, resetting lower indices */
            *ucs4 = (*ucs4 & mask) + inc;
-           byte++;
+           byte = (byte + 1) & 0xff;
            if (byte == 0)
                break;
        }
@@ -567,7 +567,7 @@ FcCharSetSubtractCount (const FcCharSet *a, const FcCharSet *b)
  * it's not exactly human readable output.  As a special case, 0 is encoded as a space
  */
 
-static FcChar8 charToValue[256] = {
+static unsigned char   charToValue[256] = {
     /*     "" */ 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, 
     /*   "\b" */ 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, 
     /* "\020" */ 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, 
@@ -621,7 +621,7 @@ FcCharSetParseValue (FcChar8 *string, FcChar32 *value)
 {
     int                i;
     FcChar32   v;
-    FcChar   c;
+    FcChar32   c;
     
     if (*string == ' ')
     {
@@ -633,7 +633,7 @@ FcCharSetParseValue (FcChar8 *string, FcChar32 *value)
        v = 0;
        for (i = 0; i < 5; i++)
        {
-           if (!(c = *string++))
+           if (!(c = (FcChar32) (unsigned char) *string++))
                return 0;
            c = charToValue[c];
            if (c == 0xff)
@@ -808,8 +808,8 @@ FcNameUnparseCharSet (FcNameBuf *buf, const FcCharSet *c)
 #endif
 
 typedef struct _FcCharEnt {
-    FcChar16   bmp;
-    FcChar8    encode;
+    FcChar16       bmp;
+    unsigned char   encode;
 } FcCharEnt;
 
 typedef struct _FcCharMap {
@@ -960,6 +960,7 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4,
            return FcTrue;
        /* fall through ... */
     default:
+       break;
     }
     return FcFalse;
 }
index a49cb54bbcf309e30f1047a082bdbb8e5dc49e12..1c9f48c7707bc859b236e7cebd40183e3d088c3b 100644 (file)
 #define FC_INVALID_FONT_FILE "."
 
 FcBool
-FcFileScan (FcFontSet  *set,
-           FcFileCache *cache,
-           FcBlanks    *blanks,
-           const char  *file,
-           FcBool      force)
+FcFileScan (FcFontSet      *set,
+           FcFileCache     *cache,
+           FcBlanks        *blanks,
+           const FcChar8   *file,
+           FcBool          force)
 {
     int                    id;
-    char           *name;
+    FcChar8        *name;
     FcPattern      *font;
     FcBool         ret = FcTrue;
     int                    count;
@@ -88,7 +88,7 @@ FcFileScan (FcFontSet *set,
                else
                {
                    /* negative cache files not containing fonts */
-                   FcFileCacheUpdate (cache, file, id, FC_INVALID_FONT_FILE);
+                   FcFileCacheUpdate (cache, file, id, (FcChar8 *) FC_INVALID_FONT_FILE);
                }
            }
        }
@@ -107,28 +107,28 @@ FcFileScan (FcFontSet     *set,
 }
 
 FcBool
-FcDirScan (FcFontSet   *set,
-          FcFileCache  *cache,
-          FcBlanks     *blanks,
-          const char   *dir,
-          FcBool       force)
+FcDirScan (FcFontSet       *set,
+          FcFileCache      *cache,
+          FcBlanks         *blanks,
+          const FcChar8    *dir,
+          FcBool           force)
 {
     DIR                    *d;
     struct dirent   *e;
-    char           *file;
-    char           *base;
+    FcChar8        *file;
+    FcChar8        *base;
     FcBool         ret = FcTrue;
 
-    file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
+    file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + 256 + 1);
     if (!file)
        return FcFalse;
 
-    strcpy (file, dir);
-    strcat (file, "/");
-    base = file + strlen (file);
+    strcpy ((char *) file, (char *) dir);
+    strcat ((char *) file, "/");
+    base = file + strlen ((char *) file);
     if (!force)
     {
-       strcpy (base, FC_DIR_CACHE_FILE);
+       strcpy ((char *) base, FC_DIR_CACHE_FILE);
        
        if (FcFileCacheReadDir (set, file))
        {
@@ -137,7 +137,7 @@ FcDirScan (FcFontSet        *set,
        }
     }
     
-    d = opendir (dir);
+    d = opendir ((char *) dir);
     if (!d)
     {
        free (file);
@@ -147,7 +147,7 @@ FcDirScan (FcFontSet        *set,
     {
        if (e->d_name[0] != '.')
        {
-           strcpy (base, e->d_name);
+           strcpy ((char *) base, (char *) e->d_name);
            FcFileScan (set, cache, blanks, file, force);
        }
     }
@@ -157,20 +157,20 @@ FcDirScan (FcFontSet      *set,
 }
 
 FcBool
-FcDirSave (FcFontSet *set, const char *dir)
+FcDirSave (FcFontSet *set, const FcChar8 *dir)
 {
-    char           *file;
-    char           *base;
+    FcChar8        *file;
+    FcChar8        *base;
     FcBool         ret;
     
-    file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
+    file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + 256 + 1);
     if (!file)
        return FcFalse;
 
-    strcpy (file, dir);
-    strcat (file, "/");
-    base = file + strlen (file);
-    strcpy (base, FC_DIR_CACHE_FILE);
+    strcpy ((char *) file, (char *) dir);
+    strcat ((char *) file, "/");
+    base = file + strlen ((char *) file);
+    strcpy ((char *) base, FC_DIR_CACHE_FILE);
     ret = FcFileCacheWriteDir (set, file);
     free (file);
     return ret;
index 788b85ab337452362191829a893fbd9b14c3e378..c41492fe624bfd9348286ff2fd43bd5ee0da9a27 100644 (file)
 
 static const struct {
     int            bit;
-    char    *name;
+    FcChar8 *name;
 } FcCodePageRange[] = {
-    { 0,       FC_LANG_LATIN_1 },
-    { 1,       FC_LANG_LATIN_2_EASTERN_EUROPE },
-    { 2,       FC_LANG_CYRILLIC },
-    { 3,       FC_LANG_GREEK },
-    { 4,       FC_LANG_TURKISH },
-    { 5,       FC_LANG_HEBREW },
-    { 6,       FC_LANG_ARABIC },
-    { 7,       FC_LANG_WINDOWS_BALTIC },
-    { 8,       FC_LANG_VIETNAMESE },
+    { 0,       (FcChar8 *) FC_LANG_LATIN_1 },
+    { 1,       (FcChar8 *) FC_LANG_LATIN_2_EASTERN_EUROPE },
+    { 2,       (FcChar8 *) FC_LANG_CYRILLIC },
+    { 3,       (FcChar8 *) FC_LANG_GREEK },
+    { 4,       (FcChar8 *) FC_LANG_TURKISH },
+    { 5,       (FcChar8 *) FC_LANG_HEBREW },
+    { 6,       (FcChar8 *) FC_LANG_ARABIC },
+    { 7,       (FcChar8 *) FC_LANG_WINDOWS_BALTIC },
+    { 8,       (FcChar8 *) FC_LANG_VIETNAMESE },
 /* 9-15 reserved for Alternate ANSI */
-    { 16,      FC_LANG_THAI },
-    { 17,      FC_LANG_JAPANESE },
-    { 18,      FC_LANG_SIMPLIFIED_CHINESE },
-    { 19,      FC_LANG_KOREAN_WANSUNG },
-    { 20,      FC_LANG_TRADITIONAL_CHINESE },
-    { 21,      FC_LANG_KOREAN_JOHAB },
+    { 16,      (FcChar8 *) FC_LANG_THAI },
+    { 17,      (FcChar8 *) FC_LANG_JAPANESE },
+    { 18,      (FcChar8 *) FC_LANG_SIMPLIFIED_CHINESE },
+    { 19,      (FcChar8 *) FC_LANG_KOREAN_WANSUNG },
+    { 20,      (FcChar8 *) FC_LANG_TRADITIONAL_CHINESE },
+    { 21,      (FcChar8 *) FC_LANG_KOREAN_JOHAB },
 /* 22-28 reserved for Alternate ANSI & OEM */
-    { 29,      FC_LANG_MACINTOSH },
-    { 30,      FC_LANG_OEM },
-    { 31,      FC_LANG_SYMBOL },
+    { 29,      (FcChar8 *) FC_LANG_MACINTOSH },
+    { 30,      (FcChar8 *) FC_LANG_OEM },
+    { 31,      (FcChar8 *) FC_LANG_SYMBOL },
 /* 32-47 reserved for OEM */
-    { 48,      FC_LANG_IBM_GREEK },
-    { 49,      FC_LANG_MSDOS_RUSSIAN },
-    { 50,      FC_LANG_MSDOS_NORDIC },
-    { 51,      FC_LANG_ARABIC_864 },
-    { 52,      FC_LANG_MSDOS_CANADIAN_FRENCH },
-    { 53,      FC_LANG_HEBREW_862 },
-    { 54,      FC_LANG_MSDOS_ICELANDIC },
-    { 55,      FC_LANG_MSDOS_PORTUGUESE },
-    { 56,      FC_LANG_IBM_TURKISH },
-    { 57,      FC_LANG_IBM_CYRILLIC },
-    { 58,      FC_LANG_LATIN_2 },
-    { 59,      FC_LANG_MSDOS_BALTIC },
-    { 60,      FC_LANG_GREEK_437_G },
-    { 61,      FC_LANG_ARABIC_ASMO_708 },
-    { 62,      FC_LANG_WE_LATIN_1 },
-    { 63,      FC_LANG_US },
+    { 48,      (FcChar8 *) FC_LANG_IBM_GREEK },
+    { 49,      (FcChar8 *) FC_LANG_MSDOS_RUSSIAN },
+    { 50,      (FcChar8 *) FC_LANG_MSDOS_NORDIC },
+    { 51,      (FcChar8 *) FC_LANG_ARABIC_864 },
+    { 52,      (FcChar8 *) FC_LANG_MSDOS_CANADIAN_FRENCH },
+    { 53,      (FcChar8 *) FC_LANG_HEBREW_862 },
+    { 54,      (FcChar8 *) FC_LANG_MSDOS_ICELANDIC },
+    { 55,      (FcChar8 *) FC_LANG_MSDOS_PORTUGUESE },
+    { 56,      (FcChar8 *) FC_LANG_IBM_TURKISH },
+    { 57,      (FcChar8 *) FC_LANG_IBM_CYRILLIC },
+    { 58,      (FcChar8 *) FC_LANG_LATIN_2 },
+    { 59,      (FcChar8 *) FC_LANG_MSDOS_BALTIC },
+    { 60,      (FcChar8 *) FC_LANG_GREEK_437_G },
+    { 61,      (FcChar8 *) FC_LANG_ARABIC_ASMO_708 },
+    { 62,      (FcChar8 *) FC_LANG_WE_LATIN_1 },
+    { 63,      (FcChar8 *) FC_LANG_US },
 };
 
 #define NUM_CODE_PAGE_RANGE (sizeof FcCodePageRange / sizeof FcCodePageRange[0])
 
 FcPattern *
-FcFreeTypeQuery (const char *file,
-                int        id,
-                FcBlanks   *blanks,
-                int        *count)
+FcFreeTypeQuery (const FcChar8 *file,
+                int            id,
+                FcBlanks       *blanks,
+                int            *count)
 {
-    FT_Face    face;
-    FcPattern  *pat;
-    int                slant;
-    int                weight;
-    int                i;
-    FcCharSet  *cs;
-    FT_Library ftLibrary;
-    const char *family;
-    TT_OS2     *os2;
+    FT_Face        face;
+    FcPattern      *pat;
+    int                    slant;
+    int                    weight;
+    int                    i;
+    FcCharSet      *cs;
+    FT_Library     ftLibrary;
+    const FcChar8   *family;
+    TT_OS2         *os2;
 
     if (FT_Init_FreeType (&ftLibrary))
        return 0;
     
-    if (FT_New_Face (ftLibrary, file, id, &face))
+    if (FT_New_Face (ftLibrary, (char *) file, id, &face))
        goto bail;
 
     *count = face->num_faces;
@@ -127,10 +127,10 @@ FcFreeTypeQuery (const char *file,
     if (!FcPatternAddInteger (pat, FC_WEIGHT, weight))
        goto bail1;
 
-    family = face->family_name;
+    family = (FcChar8 *) face->family_name;
     if (!family)
     {
-       family = strrchr (file, '/');
+       family = (FcChar8 *) strrchr ((char *) file, '/');
        if (family)
            family++;
        else
@@ -141,7 +141,7 @@ FcFreeTypeQuery (const char *file,
 
     if (face->style_name)
     {
-       if (!FcPatternAddString (pat, FC_STYLE, face->style_name))
+       if (!FcPatternAddString (pat, FC_STYLE, (FcChar8 *) face->style_name))
            goto bail1;
     }
 
@@ -151,7 +151,7 @@ FcFreeTypeQuery (const char *file,
     if (!FcPatternAddInteger (pat, FC_INDEX, id))
        goto bail1;
 
-    if (!FcPatternAddString (pat, FC_SOURCE, "FreeType"))
+    if (!FcPatternAddString (pat, FC_SOURCE, (FcChar8 *) "FreeType"))
        goto bail1;
 
 #if 0
index f82e0182cb76b6bfa0863c85054bcd3cc6b49c76..b18d08a08af0446b37ab304049429efa4bb9f701 100644 (file)
@@ -48,7 +48,7 @@ FcInitFallbackConfig (void)
     config = FcConfigCreate ();
     if (!config)
        goto bail0;
-    if (!FcConfigAddDir (config, FC_FALLBACK_FONTS))
+    if (!FcConfigAddDir (config, (FcChar8 *) FC_FALLBACK_FONTS))
        goto bail1;
     FcConfigSetCurrent (config);
     return FcTrue;
index 139df3bb96b226d951ba7870f7af618e996a9ebc..2d9b13f7e1d3b8be8ce5a6746a432c309a986ffa 100644 (file)
@@ -114,12 +114,12 @@ typedef struct _FcExpr {
     union {
        int         ival;
        double      dval;
-       char        *sval;
+       FcChar8     *sval;
        FcMatrix    *mval;
        FcBool      bval;
        FcCharSet   *cval;
        char        *field;
-       char        *constant;
+       FcChar8     *constant;
        struct {
            struct _FcExpr *left, *right;
        } tree;
@@ -186,10 +186,10 @@ typedef struct _FcNameBuf {
 typedef struct _FcFileCacheEnt {
     struct _FcFileCacheEnt *next;
     unsigned int           hash;
-    char                   *file;
+    FcChar8                *file;
     int                            id;
     time_t                 time;
-    char                   *name;
+    FcChar8                *name;
     FcBool                 referenced;
 } FcFileCacheEnt;
 
@@ -214,8 +214,8 @@ struct _FcConfig {
      * cache file must be consulted before the directories are scanned,
      * and those directives may occur in any order
      */
-    char       **dirs;             /* directories containing fonts */
-    char       *cache;             /* name of per-user cache file */
+    FcChar8    **dirs;             /* directories containing fonts */
+    FcChar8    *cache;             /* name of per-user cache file */
     /*
      * Set of allowed blank chars -- used to
      * trim fonts of bogus glyphs
@@ -225,7 +225,7 @@ struct _FcConfig {
      * Names of all of the configuration files used
      * to create this configuration
      */
-    char       **configFiles;      /* config files loaded */
+    FcChar8    **configFiles;      /* config files loaded */
     /*
      * Substitution instructions for patterns and fonts;
      * maxObjects is used to allocate appropriate intermediate storage
@@ -250,9 +250,9 @@ struct _FcConfig {
 FcFileCache *
 FcFileCacheCreate (void);
 
-char *
+FcChar8 *
 FcFileCacheFind (FcFileCache   *cache,
-                const char     *file,
+                const FcChar8  *file,
                 int            id,
                 int            *count);
 
@@ -261,37 +261,37 @@ FcFileCacheDestroy (FcFileCache   *cache);
 
 void
 FcFileCacheLoad (FcFileCache   *cache,
-                const char     *cache_file);
+                const FcChar8  *cache_file);
 
 FcBool
-FcFileCacheUpdate (FcFileCache *cache,
-                  const char   *file,
-                  int          id,
-                  const char   *name);
+FcFileCacheUpdate (FcFileCache     *cache,
+                  const FcChar8    *file,
+                  int              id,
+                  const FcChar8    *name);
 
 FcBool
 FcFileCacheSave (FcFileCache   *cache,
-                const char     *cache_file);
+                const FcChar8  *cache_file);
 
 FcBool
-FcFileCacheReadDir (FcFontSet *set, const char *cache_file);
+FcFileCacheReadDir (FcFontSet *set, const FcChar8 *cache_file);
 
 FcBool
-FcFileCacheWriteDir (FcFontSet *set, const char *cache_file);
+FcFileCacheWriteDir (FcFontSet *set, const FcChar8 *cache_file);
     
 /* fccfg.c */
 
 FcBool
-FcConfigAddDir (FcConfig    *config,
-               const char  *d);
+FcConfigAddDir (FcConfig       *config,
+               const FcChar8   *d);
 
 FcBool
-FcConfigAddConfigFile (FcConfig            *config,
-                      const char   *f);
+FcConfigAddConfigFile (FcConfig                *config,
+                      const FcChar8    *f);
 
 FcBool
 FcConfigSetCache (FcConfig     *config,
-                 const char    *c);
+                 const FcChar8 *c);
 
 FcBool
 FcConfigAddBlank (FcConfig     *config,
@@ -352,22 +352,6 @@ int
 FcDebug (void);
 
 /* fcdir.c */
-FcBool
-FcFileScan (FcFontSet  *set,
-           FcFileCache *cache,
-           FcBlanks    *blanks,
-           const char  *file,
-           FcBool      force);
-
-FcBool
-FcDirScan (FcFontSet   *set,
-          FcFileCache  *cache,
-          FcBlanks     *blanks,
-          const char   *dir,
-          FcBool       force);
-
-FcBool
-FcDirSave (FcFontSet *set, const char *dir);
 
 /* fcfont.c */
 int
@@ -400,7 +384,7 @@ FcExpr *
 FcExprCreateDouble (double d);
 
 FcExpr *
-FcExprCreateString (const char *s);
+FcExprCreateString (const FcChar8 *s);
 
 FcExpr *
 FcExprCreateMatrix (const FcMatrix *m);
@@ -415,7 +399,7 @@ FcExpr *
 FcExprCreateField (const char *field);
 
 FcExpr *
-FcExprCreateConst (const char *constant);
+FcExprCreateConst (const FcChar8 *constant);
 
 FcExpr *
 FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right);
@@ -445,11 +429,9 @@ FcMemFree (int kind, int size);
 /* fcmatch.c */
 
 /* fcname.c */
-FcBool
-FcNameConstant (char *string, int *result);
 
 FcBool
-FcNameBool (char *v, FcBool *result);
+FcNameBool (FcChar8 *v, FcBool *result);
 
 FcBool
 FcNameBufChar (FcNameBuf *buf, FcChar8 c);
@@ -471,10 +453,10 @@ void
 FcMatrixFree (FcMatrix *mat);
 
 /* fcstr.c */
-char *
-FcStrPlus (const char *s1, const char *s2);
+FcChar8 *
+FcStrPlus (const FcChar8 *s1, const FcChar8 *s2);
     
 void
-FcStrFree (char *s);
+FcStrFree (FcChar8 *s);
 
 #endif /* _FC_INT_H_ */
index 069f69ff087cf5156704cf49607e882c7c3b04e4..2040515dae01a6cb83e9a7b5f61a622c62e5b346 100644 (file)
@@ -134,7 +134,8 @@ FcCompareValueList (const char  *object,
     
     for (i = 0; i < NUM_MATCHER; i++)
     {
-       if (!FcStrCmpIgnoreCase (_FcMatchers[i].object, object))
+       if (!FcStrCmpIgnoreCase ((FcChar8 *) _FcMatchers[i].object,
+                                (FcChar8 *) object))
            break;
     }
     if (i == NUM_MATCHER)
@@ -202,8 +203,8 @@ FcCompare (FcPattern        *pat,
     {
        for (i2 = 0; i2 < fnt->num; i2++)
        {
-           if (!FcStrCmpIgnoreCase (pat->elts[i1].object,
-                                    fnt->elts[i2].object))
+           if (!FcStrCmpIgnoreCase ((FcChar8 *) pat->elts[i1].object,
+                                    (FcChar8 *) fnt->elts[i2].object))
            {
                if (!FcCompareValueList (pat->elts[i1].object,
                                         pat->elts[i1].values,
index ed7c6c595ec3fe8f97e85354755d7ad2ba4ef436..784171c9e6bcf672f7a1aaac5b204fc7a9f02e10 100644 (file)
@@ -120,7 +120,7 @@ FcNameGetObjectType (const char *object)
        for (i = 0; i < l->ntypes; i++)
        {
            t = &l->types[i];
-           if (!FcStrCmpIgnoreCase (object, t->object))
+           if (!FcStrCmpIgnoreCase ((FcChar8 *) object, (FcChar8 *) t->object))
                return t;
        }
     }
@@ -128,24 +128,24 @@ FcNameGetObjectType (const char *object)
 }
 
 static const FcConstant _FcBaseConstants[] = {
-    { "light",         "weight",   FC_WEIGHT_LIGHT, },
-    { "medium",                "weight",   FC_WEIGHT_MEDIUM, },
-    { "demibold",      "weight",   FC_WEIGHT_DEMIBOLD, },
-    { "bold",          "weight",   FC_WEIGHT_BOLD, },
-    { "black",         "weight",   FC_WEIGHT_BLACK, },
-
-    { "roman",         "slant",    FC_SLANT_ROMAN, },
-    { "italic",                "slant",    FC_SLANT_ITALIC, },
-    { "oblique",       "slant",    FC_SLANT_OBLIQUE, },
-
-    { "proportional",  "spacing",  FC_PROPORTIONAL, },
-    { "mono",          "spacing",  FC_MONO, },
-    { "charcell",      "spacing",  FC_CHARCELL, },
-
-    { "rgb",           "rgba",     FC_RGBA_RGB, },
-    { "bgr",           "rgba",     FC_RGBA_BGR, },
-    { "vrgb",          "rgba",     FC_RGBA_VRGB },
-    { "vbgr",          "rgba",     FC_RGBA_VBGR },
+    { (FcChar8 *) "light",         "weight",   FC_WEIGHT_LIGHT, },
+    { (FcChar8 *) "medium",        "weight",   FC_WEIGHT_MEDIUM, },
+    { (FcChar8 *) "demibold",      "weight",   FC_WEIGHT_DEMIBOLD, },
+    { (FcChar8 *) "bold",          "weight",   FC_WEIGHT_BOLD, },
+    { (FcChar8 *) "black",         "weight",   FC_WEIGHT_BLACK, },
+
+    { (FcChar8 *) "roman",         "slant",    FC_SLANT_ROMAN, },
+    { (FcChar8 *) "italic",        "slant",    FC_SLANT_ITALIC, },
+    { (FcChar8 *) "oblique",       "slant",    FC_SLANT_OBLIQUE, },
+
+    { (FcChar8 *) "proportional",   "spacing",  FC_PROPORTIONAL, },
+    { (FcChar8 *) "mono",          "spacing",  FC_MONO, },
+    { (FcChar8 *) "charcell",      "spacing",  FC_CHARCELL, },
+
+    { (FcChar8 *) "rgb",           "rgba",         FC_RGBA_RGB, },
+    { (FcChar8 *) "bgr",           "rgba",         FC_RGBA_BGR, },
+    { (FcChar8 *) "vrgb",          "rgba",         FC_RGBA_VRGB },
+    { (FcChar8 *) "vbgr",          "rgba",         FC_RGBA_VBGR },
 };
 
 #define NUM_FC_CONSTANTS   (sizeof _FcBaseConstants/sizeof _FcBaseConstants[0])
@@ -201,7 +201,7 @@ FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
 }
 
 const FcConstant *
-FcNameGetConstant (char *string)
+FcNameGetConstant (FcChar8 *string)
 {
     const FcConstantList    *l;
     int                            i;
@@ -216,7 +216,7 @@ FcNameGetConstant (char *string)
 }
 
 FcBool
-FcNameConstant (char *string, int *result)
+FcNameConstant (FcChar8 *string, int *result)
 {
     const FcConstant   *c;
 
@@ -229,7 +229,7 @@ FcNameConstant (char *string, int *result)
 }
 
 FcBool
-FcNameBool (char *v, FcBool *result)
+FcNameBool (FcChar8 *v, FcBool *result)
 {
     char    c0, c1;
 
@@ -266,7 +266,7 @@ FcNameBool (char *v, FcBool *result)
 }
 
 static FcValue
-FcNameConvert (FcType type, char *string, FcMatrix *m)
+FcNameConvert (FcType type, FcChar8 *string, FcMatrix *m)
 {
     FcValue    v;
 
@@ -274,7 +274,7 @@ FcNameConvert (FcType type, char *string, FcMatrix *m)
     switch (v.type) {
     case FcTypeInteger:
        if (!FcNameConstant (string, &v.u.i))
-           v.u.i = atoi (string);
+           v.u.i = atoi ((char *) string);
        break;
     case FcTypeString:
        v.u.s = string;
@@ -284,11 +284,11 @@ FcNameConvert (FcType type, char *string, FcMatrix *m)
            v.u.b = FcFalse;
        break;
     case FcTypeDouble:
-       v.u.d = strtod (string, 0);
+       v.u.d = strtod ((char *) string, 0);
        break;
     case FcTypeMatrix:
        v.u.m = m;
-       sscanf (string, "%lg %lg %lg %lg", &m->xx, &m->xy, &m->yx, &m->yy);
+       sscanf ((char *) string, "%lg %lg %lg %lg", &m->xx, &m->xy, &m->yx, &m->yy);
        break;
     case FcTypeCharSet:
        v.u.c = FcNameParseCharSet (string);
@@ -299,10 +299,10 @@ FcNameConvert (FcType type, char *string, FcMatrix *m)
     return v;
 }
 
-static const char *
-FcNameFindNext (const char *cur, const char *delim, char *save, char *last)
+static const FcChar8 *
+FcNameFindNext (const FcChar8 *cur, const char *delim, FcChar8 *save, FcChar8 *last)
 {
-    char    c;
+    FcChar8    c;
     
     while ((c = *cur))
     {
@@ -325,19 +325,19 @@ FcNameFindNext (const char *cur, const char *delim, char *save, char *last)
 }
 
 FcPattern *
-FcNameParse (const char *name)
+FcNameParse (const FcChar8 *name)
 {
-    char               *save;
+    FcChar8            *save;
     FcPattern          *pat;
     double             d;
-    char               *e;
-    char               delim;
+    FcChar8            *e;
+    FcChar8            delim;
     FcValue            v;
     FcMatrix           m;
     const FcObjectType *t;
     const FcConstant   *c;
 
-    save = malloc (strlen (name) + 1);
+    save = malloc (strlen ((char *) name) + 1);
     if (!save)
        goto bail0;
     pat = FcPatternCreate ();
@@ -360,7 +360,7 @@ FcNameParse (const char *name)
        for (;;)
        {
            name = FcNameFindNext (name, "-,:", save, &delim);
-           d = strtod (save, &e);
+           d = strtod ((char *) save, (char **) &e);
            if (e != save)
            {
                if (!FcPatternAddDouble (pat, FC_SIZE, d))
@@ -377,7 +377,7 @@ FcNameParse (const char *name)
        {
            if (delim == '=' || delim == '_')
            {
-               t = FcNameGetObjectType (save);
+               t = FcNameGetObjectType ((char *) save);
                for (;;)
                {
                    name = FcNameFindNext (name, ":,", save, &delim);
@@ -534,7 +534,7 @@ FcNameUnparseValue (FcNameBuf       *buf,
     case FcTypeString:
        return FcNameUnparseString (buf, v.u.s, escape);
     case FcTypeBool:
-       return FcNameUnparseString (buf, v.u.b ? "True" : "False", 0);
+       return FcNameUnparseString (buf, v.u.b ? (FcChar8 *) "True" : (FcChar8 *) "False", 0);
     case FcTypeMatrix:
        sprintf ((char *) temp, "%g %g %g %g", 
                 v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
@@ -548,14 +548,14 @@ FcNameUnparseValue (FcNameBuf     *buf,
 static FcBool
 FcNameUnparseValueList (FcNameBuf      *buf,
                        FcValueList     *v,
-                       char            *escape)
+                       FcChar8         *escape)
 {
     while (v)
     {
        if (!FcNameUnparseValue (buf, v->value, escape))
            return FcFalse;
        if ((v = v->next))
-           if (!FcNameUnparseString (buf, ",", 0))
+           if (!FcNameUnparseString (buf, (FcChar8 *) ",", 0))
                return FcFalse;
     }
     return FcTrue;
@@ -578,15 +578,15 @@ FcNameUnparse (FcPattern *pat)
     e = FcPatternFind (pat, FC_FAMILY, FcFalse);
     if (e)
     {
-       if (!FcNameUnparseValueList (&buf, e->values, FC_ESCAPE_FIXED))
+       if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED))
            goto bail0;
     }
     e = FcPatternFind (pat, FC_SIZE, FcFalse);
     if (e)
     {
-       if (!FcNameUnparseString (&buf, "-", 0))
+       if (!FcNameUnparseString (&buf, (FcChar8 *) "-", 0))
            goto bail0;
-       if (!FcNameUnparseValueList (&buf, e->values, FC_ESCAPE_FIXED))
+       if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED))
            goto bail0;
     }
     for (l = _FcObjectTypes; l; l = l->next)
@@ -602,14 +602,14 @@ FcNameUnparse (FcPattern *pat)
            e = FcPatternFind (pat, o->object, FcFalse);
            if (e)
            {
-               if (!FcNameUnparseString (&buf, ":", 0))
+               if (!FcNameUnparseString (&buf, (FcChar8 *) ":", 0))
                    goto bail0;
-               if (!FcNameUnparseString (&buf, o->object, FC_ESCAPE_VARIABLE))
+               if (!FcNameUnparseString (&buf, (FcChar8 *) o->object, (FcChar8 *) FC_ESCAPE_VARIABLE))
                    goto bail0;
-               if (!FcNameUnparseString (&buf, "=", 0))
+               if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0))
                    goto bail0;
                if (!FcNameUnparseValueList (&buf, e->values, 
-                                            FC_ESCAPE_VARIABLE))
+                                            (FcChar8 *) FC_ESCAPE_VARIABLE))
                    goto bail0;
            }
        }
index a1fd774ae0483cc533b0c4ed318455cb9c9fb981..88bca9160d8b7ba4dd7fb16f1527dc9cb6fa19cf 100644 (file)
@@ -139,7 +139,7 @@ FcPatternFind (FcPattern *p, const char *object, FcBool insert)
     /* match existing */
     for (i = 0; i < p->num; i++)
     {
-       if (!FcStrCmpIgnoreCase (object, p->elts[i].object))
+       if (!FcStrCmpIgnoreCase ((FcChar8 *) object, (FcChar8 *) p->elts[i].object))
            return &p->elts[i];
     }
 
@@ -278,12 +278,12 @@ FcPatternAddDouble (FcPattern *p, const char *object, double d)
 
 
 FcBool
-FcPatternAddString (FcPattern *p, const char *object, const char *s)
+FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s)
 {
     FcValue    v;
 
     v.type = FcTypeString;
-    v.u.s = (char *) s;
+    v.u.s = s;
     return FcPatternAdd (p, object, v, FcTrue);
 }
 
@@ -384,7 +384,7 @@ FcPatternGetDouble (FcPattern *p, const char *object, int id, double *d)
 }
 
 FcResult
-FcPatternGetString (FcPattern *p, const char *object, int id, char ** s)
+FcPatternGetString (FcPattern *p, const char *object, int id, FcChar8 const ** s)
 {
     FcValue    v;
     FcResult   r;
@@ -394,7 +394,7 @@ FcPatternGetString (FcPattern *p, const char *object, int id, char ** s)
        return r;
     if (v.type != FcTypeString)
         return FcResultTypeMismatch;
-    *s = (char *) v.u.s;
+    *s = v.u.s;
     return FcResultMatch;
 }
 
index 658890e6920a7d31536399196b6671568f0d79f1..de6b2662df0e195bc82b9c8cad8864850257d01b 100644 (file)
 #include <string.h>
 #include "fcint.h"
 
-char *
-FcStrCopy (const char *s)
+FcChar8 *
+FcStrCopy (const FcChar8 *s)
 {
-    char       *r;
+    FcChar8    *r;
 
     if (!s)
        return 0;
-    r = (char *) malloc (strlen (s) + 1);
+    r = (FcChar8 *) malloc (strlen ((char *) s) + 1);
     if (!r)
        return 0;
-    FcMemAlloc (FC_MEM_STRING, strlen (s) + 1);
-    strcpy (r, s);
+    FcMemAlloc (FC_MEM_STRING, strlen ((char *) s) + 1);
+    strcpy ((char *) r, (char *) s);
     return r;
 }
 
-char *
-FcStrPlus (const char *s1, const char *s2)
+FcChar8 *
+FcStrPlus (const FcChar8 *s1, const FcChar8 *s2)
 {
-    int            l = strlen (s1) + strlen (s2) + 1;
-    char    *s = malloc (l);
+    int            l = strlen ((char *)s1) + strlen ((char *) s2) + 1;
+    FcChar8 *s = malloc (l);
 
     if (!s)
        return 0;
     FcMemAlloc (FC_MEM_STRING, l);
-    strcpy (s, s1);
-    strcat (s, s2);
+    strcpy ((char *) s, (char *) s1);
+    strcat ((char *) s, (char *) s2);
     return s;
 }
 
 void
-FcStrFree (char *s)
+FcStrFree (FcChar8 *s)
 {
-    FcMemFree (FC_MEM_STRING, strlen (s) + 1);
+    FcMemFree (FC_MEM_STRING, strlen ((char *) s) + 1);
     free (s);
 }
 
 int
-FcStrCmpIgnoreCase (const char *s1, const char *s2)
+FcStrCmpIgnoreCase (const FcChar8 *s1, const FcChar8 *s2)
 {
-    char    c1, c2;
+    FcChar8 c1, c2;
     
     for (;;) 
     {
index 07e24dfdb89219f882f0b6b0f308e5ec5e966883..e7725cc5e966a47f22bba72456148d0b409e1fd2 100644 (file)
@@ -29,25 +29,25 @@ static xmlParserInputPtr
 FcEntityLoader (const char *url, const char *id, xmlParserCtxtPtr ctxt)
 {
     xmlParserInputPtr  ret;
-    char               *file;
+    FcChar8            *file;
 
-    file = FcConfigFilename (url);
+    file = FcConfigFilename ((FcChar8 *) url);
     if (!file)
        return 0;
-    ret = xmlNewInputFromFile (ctxt, file);
+    ret = xmlNewInputFromFile (ctxt, (char *) file);
     free (file);
     return ret;
 }
 
 xmlDocPtr
-FcConfigLoad (const char *file)
+FcConfigLoad (const FcChar8 *file)
 {
     xmlDocPtr              doc;
     xmlExternalEntityLoader previous;
 
     previous = xmlGetExternalEntityLoader ();
     xmlSetExternalEntityLoader (FcEntityLoader);
-    doc = xmlParseFile (file);
+    doc = xmlParseFile ((char *) file);
     xmlSetExternalEntityLoader (previous);
     return doc;
 }
@@ -68,7 +68,7 @@ FcTestCreate (FcQual qual, const char *field, FcOp compare, FcExpr *expr)
     {
        test->next = 0;
        test->qual = qual;
-       test->field = FcStrCopy (field);
+       test->field = (char *) FcStrCopy ((FcChar8 *) field);
        test->op = compare;
        test->expr = expr;
     }
@@ -112,7 +112,7 @@ FcExprCreateDouble (double d)
 }
 
 FcExpr *
-FcExprCreateString (const char *s)
+FcExprCreateString (const FcChar8 *s)
 {
     FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
 
@@ -170,13 +170,13 @@ FcExprCreateField (const char *field)
     if (e)
     {
        e->op = FcOpField;
-       e->u.field = FcStrCopy (field);
+       e->u.field = (char *) FcStrCopy ((FcChar8 *) field);
     }
     return e;
 }
 
 FcExpr *
-FcExprCreateConst (const char *constant)
+FcExprCreateConst (const FcChar8 *constant)
 {
     FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
 
@@ -222,7 +222,7 @@ FcExprDestroy (FcExpr *e)
     case FcOpBool:
        break;
     case FcOpField:
-       FcStrFree (e->u.field);
+       FcStrFree ((FcChar8 *) e->u.field);
        break;
     case FcOpConst:
        FcStrFree (e->u.constant);
@@ -289,7 +289,7 @@ FcEditDestroy (FcEdit *e)
 char *
 FcConfigSaveField (const char *field)
 {
-    return FcStrCopy (field);
+    return (char *) FcStrCopy ((FcChar8 *) field);
 }
 
 static void
@@ -304,11 +304,11 @@ FcConfigParseError (char *fmt, ...)
     va_end (args);
 }
 
-static char *
+static xmlChar *
 FcConfigContent (xmlDocPtr    doc,
                 xmlNodePtr   node)
 {
-    char           *content;
+    xmlChar        *content;
     
     content = xmlNodeListGetString (doc, node->children, 1);
     if (!content)
@@ -320,11 +320,11 @@ FcConfigContent (xmlDocPtr    doc,
     return content;
 }
 
-static char *
+static xmlChar *
 FcConfigAttr (xmlDocPtr            doc,
              xmlAttrPtr    attr)
 {
-    char           *content;
+    xmlChar        *content;
     
     content = xmlNodeListGetString (doc, attr->children, 1);
     if (!content)
@@ -374,7 +374,7 @@ static struct {
 #define NUM_OPS (sizeof fcOps / sizeof fcOps[0])
 
 static FcOp
-FcConfigLexOp (const char *op)
+FcConfigLexOp (const xmlChar *op)
 {
     int        i;
 
@@ -384,7 +384,7 @@ FcConfigLexOp (const char *op)
 }
 
 static FcBool
-FcConfigLexBool (const char *bool)
+FcConfigLexBool (const xmlChar *bool)
 {
     if (*bool == 't' || *bool == 'T')
        return FcTrue;
@@ -400,11 +400,11 @@ FcConfigParseDir (FcConfig        *config,
                  xmlDocPtr     doc,
                  xmlNodePtr    dir)
 {
-    char    *content = FcConfigContent (doc, dir);
+    xmlChar *content = FcConfigContent (doc, dir);
 
     if (!content)
        return FcFalse;
-    return FcConfigAddDir (config, content);
+    return FcConfigAddDir (config, (FcChar8 *) content);
 }
 
 static FcBool
@@ -412,11 +412,11 @@ FcConfigParseCache (FcConfig      *config,
                    xmlDocPtr   doc,
                    xmlNodePtr  dir)
 {
-    char    *content = FcConfigContent (doc, dir);
+    xmlChar *content = FcConfigContent (doc, dir);
 
     if (!content)
        return FcFalse;
-    return FcConfigSetCache (config, content);
+    return FcConfigSetCache (config, (FcChar8 *) content);
 }
 
 static FcBool
@@ -424,7 +424,7 @@ FcConfigParseInclude (FcConfig          *config,
                      xmlDocPtr     doc,
                      xmlNodePtr    inc)
 {
-    char       *content = FcConfigContent (doc, inc);
+    xmlChar *content = FcConfigContent (doc, inc);
     xmlAttr    *attr;
     FcBool     complain = FcTrue;
 
@@ -438,7 +438,7 @@ FcConfigParseInclude (FcConfig          *config,
        if (!strcmp (attr->name, "ignore_missing"))
            complain = !FcConfigLexBool (FcConfigAttr (doc, attr));
     }
-    return FcConfigParseAndLoad (config, content, complain);
+    return FcConfigParseAndLoad (config, (FcChar8 *) content, complain);
 }
 
 static FcBool
@@ -455,7 +455,7 @@ FcConfigParseBlank (FcConfig            *config,
            continue;
        if (!strcmp (node->name, "int"))
        {
-           ucs4 = (FcChar32) strtol (FcConfigContent (doc, node), 0, 0);
+           ucs4 = (FcChar32) strtol ((char *) FcConfigContent (doc, node), 0, 0);
            if (!config->blanks)
            {
                config->blanks = FcBlanksCreate ();
@@ -500,7 +500,7 @@ FcConfigParseMatrix (xmlDocPtr      doc,
     static FcMatrix m;
     enum { m_xx, m_xy, m_yx, m_yy, m_done } matrix_state = m_xx;
     double  v;
-    char    *text;
+    xmlChar *text;
     
     FcMatrixInit (&m);
 
@@ -513,7 +513,7 @@ FcConfigParseMatrix (xmlDocPtr      doc,
        text = FcConfigContent (doc, node);
        if (!text)
            continue;
-       v = strtod (text, 0);
+       v = strtod ((char *) text, 0);
        switch (matrix_state) {
        case m_xx: m.xx = v; break;
        case m_xy: m.xy = v; break;
@@ -537,13 +537,13 @@ FcConfigParseExpr (xmlDocPtr      doc,
 
     switch (op) {
     case FcOpInteger:
-       l = FcExprCreateInteger (strtol (FcConfigContent (doc, expr), 0, 0));
+       l = FcExprCreateInteger (strtol ((char *) FcConfigContent (doc, expr), 0, 0));
        break;
     case FcOpDouble:
-       l = FcExprCreateDouble (strtod (FcConfigContent (doc, expr), 0));
+       l = FcExprCreateDouble (strtod ((char *) FcConfigContent (doc, expr), 0));
        break;
     case FcOpString:
-       l = FcExprCreateString (FcConfigContent (doc, expr));
+       l = FcExprCreateString ((FcChar8 *) FcConfigContent (doc, expr));
        break;
     case FcOpMatrix:
        l = FcExprCreateMatrix (FcConfigParseMatrix (doc, expr));
@@ -555,10 +555,10 @@ FcConfigParseExpr (xmlDocPtr      doc,
        /* not sure what to do here yet */
        break;
     case FcOpField:
-       l = FcExprCreateField (FcConfigContent (doc, expr));
+       l = FcExprCreateField ((char *) FcConfigContent (doc, expr));
        break;
     case FcOpConst:
-       l = FcExprCreateConst (FcConfigContent (doc, expr));
+       l = FcExprCreateConst ((FcChar8 *) FcConfigContent (doc, expr));
        break;
     case FcOpQuest:
        for (node = expr->children; node; node = node->next)
@@ -657,7 +657,7 @@ FcConfigParseTest (xmlDocPtr        doc,
     xmlAttrPtr attr;
     FcQual     qual = FcQualAny;
     FcOp       op = FcOpEqual;
-    char       *field = 0;
+    xmlChar    *field = 0;
     FcExpr     *expr = 0;
 
     for (attr = test->properties; attr; attr = attr->next)
@@ -666,26 +666,26 @@ FcConfigParseTest (xmlDocPtr      doc,
            continue;
        if (!strcmp (attr->name, "qual"))
        {
-           char    *qual_name = FcConfigAttr (doc, attr);
+           xmlChar *qual_name = FcConfigAttr (doc, attr);
            if (!qual_name)
                ;
-           else if (!strcmp (qual_name, "any"))
+           else if (!FcStrCmpIgnoreCase ((FcChar8 *) qual_name, (FcChar8 *) "any"))
                qual = FcQualAny;
-           else if (!strcmp (qual_name, "all"))
+           else if (!FcStrCmpIgnoreCase ((FcChar8 *) qual_name, (FcChar8 *) "all"))
                qual = FcQualAll;
        }
-       else if (!strcmp (attr->name, "name"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "name"))
        {
            field = FcConfigAttr (doc, attr);
        }
-       else if (!strcmp (attr->name, "compare"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "compare"))
        {
-           char    *compare = FcConfigAttr (doc, attr);
+           xmlChar *compare = FcConfigAttr (doc, attr);
            
            if (!compare || (op = FcConfigLexOp (compare)) == FcOpInvalid)
            {
                FcConfigParseError ("Invalid comparison %s", 
-                                   compare ? compare : "<missing>");
+                                   compare ? (char *) compare : "<missing>");
                return 0;
            }
        }
@@ -709,7 +709,7 @@ FcConfigParseTest (xmlDocPtr        doc,
        return 0;
     }
     
-    return FcTestCreate (qual, field, op, expr);
+    return FcTestCreate (qual, (char *) field, op, expr);
 }
 
 static FcExpr *
@@ -753,7 +753,7 @@ FcConfigParseEdit (xmlDocPtr        doc,
                   xmlNodePtr   edit)
 {
     xmlAttrPtr attr;
-    char       *name = 0;
+    xmlChar    *name = 0;
     FcOp       mode = FcOpAssign;
     FcExpr     *e;
     FcEdit     *ed;
@@ -762,15 +762,15 @@ FcConfigParseEdit (xmlDocPtr      doc,
     {
        if (attr->type != XML_ATTRIBUTE_NODE)
            continue;
-       if (!strcmp (attr->name, "name"))
+       if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "name"))
            name = FcConfigAttr (doc, attr);
-       else if (!strcmp (attr->name, "mode"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "mode"))
            mode = FcConfigLexOp (FcConfigAttr (doc, attr));
     }
 
     e = FcConfigParseExprList (doc, edit->children);
 
-    ed = FcEditCreate (name, mode, e);
+    ed = FcEditCreate ((char *) name, mode, e);
     if (!ed)
        FcExprDestroy (e);
     return ed;
@@ -785,14 +785,14 @@ FcConfigParseMatch (FcConfig      *config,
     xmlAttrPtr attr;
     FcTest     *tests = 0, **prevTest = &tests, *test;
     FcEdit     *edits = 0, **prevEdit = &edits, *edit;
-    FcMatchKind        kind;
+    FcMatchKind        kind = FcMatchPattern;
     FcBool     found_kind = FcFalse;
 
     for (node = match->children; node; node = node->next)
     {
        if (node->type != XML_ELEMENT_NODE)
            continue;
-       if (!strcmp (node->name, "test"))
+       if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "test"))
        {
            test = FcConfigParseTest (doc, node);
            if (!test)
@@ -800,7 +800,7 @@ FcConfigParseMatch (FcConfig        *config,
            *prevTest = test;
            prevTest = &test->next;
        }
-       else if (!strcmp (node->name, "edit"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "edit"))
        {
            edit = FcConfigParseEdit (doc, node);
            if (!edit)
@@ -814,20 +814,20 @@ FcConfigParseMatch (FcConfig      *config,
     {
        if (attr->type != XML_ATTRIBUTE_NODE)
            continue;
-       if (!strcmp (attr->name, "target"))
+       if (!FcStrCmpIgnoreCase ((FcChar8 *) attr->name, (FcChar8 *) "target"))
        {
-           char    *target = FcConfigAttr (doc, attr);
+           xmlChar *target = FcConfigAttr (doc, attr);
            if (!target)
            {
                FcConfigParseError ("Missing match target");
                break;
            }
-           else if (!strcmp (target, "pattern"))
+           else if (!FcStrCmpIgnoreCase ((FcChar8 *) target, (FcChar8 *) "pattern"))
            {
                kind = FcMatchPattern;
                found_kind = FcTrue;
            }
-           else if (!strcmp (target, "font"))
+           else if (!FcStrCmpIgnoreCase ((FcChar8 *) target, (FcChar8 *) "font"))
            {
                kind = FcMatchFont;
                found_kind = FcTrue;
@@ -858,9 +858,10 @@ FcConfigParseFamilies (xmlDocPtr    doc,
        return 0;
     next = FcConfigParseFamilies (doc, family->next);
     
-    if (family->type == XML_ELEMENT_NODE && !strcmp (family->name, "family"))
+    if (family->type == XML_ELEMENT_NODE && 
+       !FcStrCmpIgnoreCase ((FcChar8 *) family->name, (FcChar8 *) "family"))
     {
-       this = FcExprCreateString (FcConfigContent (doc, family));
+       this = FcExprCreateString ((FcChar8 *) FcConfigContent (doc, family));
        if (!this)
            goto bail;
        if (next)
@@ -893,7 +894,7 @@ FcConfigParseAlias (FcConfig        *config,
 {
     xmlNodePtr node;
     FcExpr     *prefer = 0, *accept = 0, *def = 0;
-    FcExpr     *family;
+    FcExpr     *family = 0;
     FcEdit     *edit = 0, *next;
     FcTest     *test;
 
@@ -901,15 +902,17 @@ FcConfigParseAlias (FcConfig      *config,
     {
        if (node->type != XML_ELEMENT_NODE)
            continue;
-       if (!strcmp (node->name, "family"))
-           family = FcExprCreateString (FcConfigContent (doc, node));
-       else if (!strcmp (node->name, "prefer"))
+       if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "family"))
+           family = FcExprCreateString ((FcChar8 *) FcConfigContent (doc, node));
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "prefer"))
            prefer = FcConfigParseFamilies (doc, node->children);
-       else if (!strcmp (node->name, "accept"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "accept"))
            accept = FcConfigParseFamilies (doc, node->children);
-       else if (!strcmp (node->name, "default"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "default"))
            def = FcConfigParseFamilies (doc, node->children);
     }
+    if (!family)
+       return FcFalse;
     
     if (prefer)
     {
@@ -962,32 +965,32 @@ FcConfigParse (FcConfig       *config,
     {
        if (node->type != XML_ELEMENT_NODE)
            continue;
-       if (!strcmp (node->name, "dir"))
+       if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "dir"))
        {
            if (!FcConfigParseDir (config, doc, node))
                break;
        }
-       else if (!strcmp (node->name, "cache"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "cache"))
        {
            if (!FcConfigParseCache (config, doc, node))
                break;
        }
-       else if (!strcmp (node->name, "include"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "include"))
        {
            if (!FcConfigParseInclude (config, doc, node))
                break;
        }
-       else if (!strcmp (node->name, "config"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "config"))
        {
            if (!FcConfigParseConfig (config, doc, node))
                break;
        }
-       else if (!strcmp (node->name, "match"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "match"))
        {
            if (!FcConfigParseMatch (config, doc, node))
                break;
        }
-       else if (!strcmp (node->name, "alias"))
+       else if (!FcStrCmpIgnoreCase ((FcChar8 *) node->name, (FcChar8 *) "alias"))
        {
            if (!FcConfigParseAlias (config, doc, node))
                break;
@@ -1005,7 +1008,7 @@ FcConfigParse (FcConfig       *config,
 
 FcBool
 FcConfigParseAndLoad (FcConfig     *config,
-                     const char    *file,
+                     const FcChar8 *file,
                      FcBool        complain)
 {
     xmlDocPtr  doc;