]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcdir.c
Bug 44826 - <alias> must contain only a single <family>
[fontconfig.git] / src / fcdir.c
index b43c3c647ddf5382e981a89d0aeea510d8782fed..8a2b97625066eeb05eeffc014cebb8a749056441 100644 (file)
@@ -7,9 +7,9 @@
  * documentation for any purpose is hereby granted without fee, provided that
  * the above copyright notice appear in all copies and that both that
  * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
+ * documentation, and that the name of the author(s) not be used in
  * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
+ * specific, written prior permission.  The authors make no
  * representations about the suitability of this software for any purpose.  It
  * is provided "as is" without express or implied warranty.
  *
@@ -30,7 +30,7 @@ FcFileIsDir (const FcChar8 *file)
 {
     struct stat            statb;
 
-    if (FcStat ((const char *) file, &statb) != 0)
+    if (FcStat (file, &statb) != 0)
        return FcFalse;
     return S_ISDIR(statb.st_mode);
 }
@@ -45,7 +45,7 @@ FcFileScanFontConfig (FcFontSet               *set,
     FcBool     ret = FcTrue;
     int                id;
     int                count = 0;
-    
+
     id = 0;
     do
     {
@@ -65,7 +65,7 @@ FcFileScanFontConfig (FcFontSet               *set,
        /*
         * Edit pattern with user-defined rules
         */
-       if (font && config && !FcConfigSubstituteWithPat (config, font, NULL, FcMatchScan))
+       if (font && config && !FcConfigSubstitute (config, font, FcMatchScan))
        {
            FcPatternDestroy (font);
            font = NULL;
@@ -75,7 +75,7 @@ FcFileScanFontConfig (FcFontSet               *set,
        /*
         * Add the font
         */
-       if (font && (!config || FcConfigAcceptFont (config, font)))
+       if (font)
        {
            if (FcDebug() & FC_DBG_SCANV)
            {
@@ -117,7 +117,7 @@ FcFileScan (FcFontSet           *set,
            const FcChar8   *file,
            FcBool          force)
 {
-    return FcFileScanConfig (set, dirs, blanks, file, NULL);
+    return FcFileScanConfig (set, dirs, blanks, file, FcConfigGetCurrent ());
 }
 
 /*
@@ -164,7 +164,7 @@ FcDirScanConfig (FcFontSet  *set,
     strcpy ((char *) file, (char *) dir);
     strcat ((char *) file, "/");
     base = file + strlen ((char *) file);
-    
+
     if (FcDebug () & FC_DBG_SCAN)
        printf ("\tScanning dir %s\n", dir);
        
@@ -205,7 +205,7 @@ FcDirScanConfig (FcFontSet  *set,
      */
     for (i = 0; i < files->num; i++)
        FcFileScanConfig (set, dirs, blanks, files->strs[i], config);
-    
+
 bail2:
     FcStrSetDestroy (files);
 bail1:
@@ -225,7 +225,7 @@ FcDirScan (FcFontSet            *set,
     if (cache || !force)
        return FcFalse;
 
-    return FcDirScanConfig (set, dirs, blanks, dir, force, NULL);
+    return FcDirScanConfig (set, dirs, blanks, dir, force, FcConfigGetCurrent ());
 }
 
 /*
@@ -243,7 +243,7 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
     if (FcDebug () & FC_DBG_FONTSET)
        printf ("cache scan dir %s\n", dir);
 
-    if (FcStat ((char *) dir, &dir_stat) < 0)
+    if (FcStat (dir, &dir_stat) < 0)
     {
        if (errno != ENOENT)
            ret = FcFalse;
@@ -282,12 +282,12 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
        ret = FcFalse;
        goto bail2;
     }
-    
+
     /*
      * Write out the cache file, ignoring any troubles
      */
     FcDirCacheWrite (cache, config);
-    
+
  bail2:
     FcStrSetDestroy (dirs);
  bail1:
@@ -304,17 +304,14 @@ FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config)
 {
     FcCache            *cache = NULL;
 
-    if (config && !FcConfigAcceptFilename (config, dir))
-       return NULL;
-
     /* Try to use existing cache file */
     if (!force)
        cache = FcDirCacheLoad (dir, config, NULL);
-    
+
     /* Not using existing cache file, construct new cache */
     if (!cache)
        cache = FcDirCacheScan (dir, config);
-    
+
     return cache;
 }