Don't reject dirs that can't be normalized (fixes lilypond, and is correct

in the context of application font directories.)
Use normalized directory name exclusively in FcCacheReadDirs.
reviewed by: plam
This commit is contained in:
Patrick Lam 2006-02-07 22:09:01 +00:00
parent efb11b36c4
commit 5c3deb2985
3 changed files with 27 additions and 14 deletions

View File

@ -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> 2006-02-07 Dirk Mueller <dmueller@suse.com>
reviewed by: plam reviewed by: plam

View File

@ -842,7 +842,6 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
{ {
int ret = 0; int ret = 0;
FcChar8 *dir; FcChar8 *dir;
const FcChar8 *name;
FcStrSet *subdirs; FcStrSet *subdirs;
FcStrList *sublist; FcStrList *sublist;
struct stat statb; struct stat statb;
@ -858,14 +857,16 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
/* Skip this directory if already updated /* Skip this directory if already updated
* to avoid the looped directories via symlinks * to avoid the looped directories via symlinks
* Clearly a dir not in fonts.conf shouldn't be globally cached.
*/ */
name = FcConfigNormalizeFontDir (config, dir); dir = FcConfigNormalizeFontDir (config, dir);
if (name) if (!dir)
{ continue;
if (FcStrSetMember (processed_dirs, dir)) if (FcStrSetMember (processed_dirs, dir))
continue; continue;
FcStrSetAdd (processed_dirs, dir); if (!FcStrSetAdd (processed_dirs, dir))
} continue;
subdirs = FcStrSetCreate (); subdirs = FcStrSetCreate ();
if (!subdirs) if (!subdirs)
@ -907,7 +908,7 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
if (FcDirCacheValid (dir) && FcDirCacheRead (set, subdirs, dir, config)) if (FcDirCacheValid (dir) && FcDirCacheRead (set, subdirs, dir, config))
{ {
/* if an old entry is found in the global cache, disable it */ /* 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; d->state = FcGCDirDisabled;
/* save the updated config later without this entry */ /* save the updated config later without this entry */

View File

@ -120,6 +120,7 @@ FcDirScanConfig (FcFontSet *set,
DIR *d; DIR *d;
struct dirent *e; struct dirent *e;
FcChar8 *file; FcChar8 *file;
const FcChar8 *d_can = 0;
FcChar8 *base; FcChar8 *base;
FcBool ret = FcTrue; FcBool ret = FcTrue;
FcFontSet *tmpSet; FcFontSet *tmpSet;
@ -129,11 +130,9 @@ FcDirScanConfig (FcFontSet *set,
return FcTrue; return FcTrue;
if (config) if (config)
dir = FcConfigNormalizeFontDir (config, dir); d_can = FcConfigNormalizeFontDir (config, dir);
if (d_can)
/* refuse to scan a directory that can't be normalized. */ dir = d_can;
if (!dir)
return FcFalse;
if (!force) if (!force)
{ {