]> git.wh0rd.org - fontconfig.git/commitdiff
Don't reject dirs that can't be normalized (fixes lilypond, and is correct
authorPatrick Lam <plam@MIT.EDU>
Tue, 7 Feb 2006 22:09:01 +0000 (22:09 +0000)
committerPatrick Lam <plam@MIT.EDU>
Tue, 7 Feb 2006 22:09:01 +0000 (22:09 +0000)
    in the context of application font directories.)
Use normalized directory name exclusively in FcCacheReadDirs.
reviewed by: plam

ChangeLog
src/fccache.c
src/fcdir.c

index f61b056658221e4070c4125aabc9db74e1c302c8..4e5687b1ece478acdae5ce05faef4a505e4e55a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-02-07  Patrick Lam  <plam@mit.edu>
+       * src/fcdir.c (FcDirScanConfig):
+
+       Don't reject dirs that can't be normalized (fixes lilypond, and
+       is correct in the context of application font directories.)
+
+2006-02-07  Takashi Iwai  <tiwai@suse.de>
+       reviewed by: plam
+
+       * src/fccache.c (FcCacheReadDirs):
+
+       Use normalized directory name exclusively in FcCacheReadDirs.
+
 2006-02-07  Dirk Mueller  <dmueller@suse.com>
        reviewed by: plam
 
index aafc485cd6bba2fd59aa8090fa4f954e0a90be63..5a642031637708c22b40dac0e29cceb87b7147e3 100644 (file)
@@ -842,7 +842,6 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
 {
     int                        ret = 0;
     FcChar8            *dir;
-    const FcChar8      *name;
     FcStrSet           *subdirs;
     FcStrList          *sublist;
     struct stat                statb;
@@ -858,14 +857,16 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
 
        /* Skip this directory if already updated
         * to avoid the looped directories via symlinks
+        * Clearly a dir not in fonts.conf shouldn't be globally cached.
         */
-       name = FcConfigNormalizeFontDir (config, dir);
-       if (name) 
-       {
-           if (FcStrSetMember (processed_dirs, dir))
-               continue;
-           FcStrSetAdd (processed_dirs, dir);
-       }
+       dir = FcConfigNormalizeFontDir (config, dir);
+       if (!dir)
+           continue;
+
+       if (FcStrSetMember (processed_dirs, dir))
+           continue;
+       if (!FcStrSetAdd (processed_dirs, dir))
+           continue;
 
        subdirs = FcStrSetCreate ();
        if (!subdirs)
@@ -907,7 +908,7 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
        if (FcDirCacheValid (dir) && FcDirCacheRead (set, subdirs, dir, config))
        {
            /* if an old entry is found in the global cache, disable it */
-           if ((d = FcGlobalCacheDirFind (cache, (const char *)name)) != NULL)
+           if ((d = FcGlobalCacheDirFind (cache, (const char *)dir)) != NULL)
            {
                d->state = FcGCDirDisabled;
                /* save the updated config later without this entry */
index 0e559e5f0b3683f47d02712b47acf0ff80e9aad9..771c09b2dd5926f94a55d6acc1c0bf790a9028f2 100644 (file)
@@ -120,6 +120,7 @@ FcDirScanConfig (FcFontSet  *set,
     DIR                        *d;
     struct dirent      *e;
     FcChar8            *file;
+    const FcChar8      *d_can = 0;
     FcChar8            *base;
     FcBool             ret = FcTrue;
     FcFontSet          *tmpSet;
@@ -129,11 +130,9 @@ FcDirScanConfig (FcFontSet *set,
        return FcTrue;
 
     if (config)
-       dir = FcConfigNormalizeFontDir (config, dir);
-
-    /* refuse to scan a directory that can't be normalized. */
-    if (!dir)
-       return FcFalse;
+       d_can = FcConfigNormalizeFontDir (config, dir);
+    if (d_can)
+       dir = d_can;
 
     if (!force)
     {