]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccfg.c
Port Xft1 to fontconfig
[fontconfig.git] / src / fccfg.c
index 715f09170fdd57dd220214d8b92ed7990843c7c0..f838639a852c9858663b2f65a96884ac51ef70db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.4 2002/02/24 01:23:35 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include "fcint.h"
 
-static FcConfig    *fcConfig;
+FcConfig    *_fcConfig;
 
 FcConfig *
 FcConfigCreate (void)
@@ -186,16 +186,19 @@ FcConfigSetCurrent (FcConfig *config)
        if (!FcConfigBuildFonts (config))
            return FcFalse;
 
-    if (fcConfig)
-       FcConfigDestroy (fcConfig);
-    fcConfig = config;
+    if (_fcConfig)
+       FcConfigDestroy (_fcConfig);
+    _fcConfig = config;
     return FcTrue;
 }
 
 FcConfig *
 FcConfigGetCurrent (void)
 {
-    return fcConfig;
+    if (!_fcConfig)
+       if (!FcInit ())
+           return 0;
+    return _fcConfig;
 }
 
 FcBool
@@ -221,7 +224,7 @@ FcConfigAddDir (FcConfig    *config,
        dir = (FcChar8 *) malloc (strlen ((char *) d) + 1);
        if (!dir)
            return FcFalse;
-       strcpy (dir, d);
+       strcpy ((char *) dir, (const char *) d);
     }
     if (!FcConfigAddString (&config->dirs, dir))
     {
@@ -846,7 +849,7 @@ FcConfigValues (FcPattern *p, FcExpr *e)
        l->value = FcConfigEvaluate (p, e);
        l->next  = 0;
     }
-    while (l->value.type == FcTypeVoid)
+    while (l && l->value.type == FcTypeVoid)
     {
        FcValueList     *next = l->next;
        
@@ -1189,7 +1192,7 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
     if (!path)
        return 0;
 
-    strcpy (path, dir);
+    strcpy ((char *) path, (const char *) dir);
     /* make sure there's a single separating / */
     if ((!path[0] || path[strlen((char *) path)-1] != '/') && file[0] != '/')
        strcat ((char *) path, "/");
@@ -1237,7 +1240,7 @@ FcConfigGetPath (void)
            path[i] = malloc (colon - e + 1);
            if (!path[i])
                goto bail1;
-           strncpy (path[i], e, colon - e);
+           strncpy ((char *) path[i], (const char *) e, colon - e);
            path[i][colon - e] = '\0';
            if (*colon)
                e = colon + 1;
@@ -1251,7 +1254,7 @@ FcConfigGetPath (void)
     path[i] = malloc (strlen ((char *) dir) + 1);
     if (!path[i])
        goto bail1;
-    strcpy (path[i], dir);
+    strcpy ((char *) path[i], (const char *) dir);
     return path;
 
 bail1: