From: Patrick Lam Date: Fri, 27 Jan 2006 00:27:37 +0000 (+0000) Subject: Add a couple of missing normalizations to make fc-cache work right; only X-Git-Tag: fc-2_3_94~58 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=3cf9f5cec386ce97bb3cdd1dfe78d0d6999243ea;p=fontconfig.git Add a couple of missing normalizations to make fc-cache work right; only scan subdirectories once. --- diff --git a/ChangeLog b/ChangeLog index 32f20e4..e85113b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-01-26 Patrick Lam + * src/fccache.c (FcDirCacheValid, FcDirCacheHasCurrentArch): + * src/fccfg.c (FcConfigNormalizeFontDir): + + Add a couple of missing normalizations to make fc-cache work + right; only scan subdirectories once. + 2006-01-26 Mike Fabian reviewed by: plam diff --git a/src/fccache.c b/src/fccache.c index a687483..8491551 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -609,6 +609,10 @@ FcDirCacheValid (const FcChar8 *dir) struct stat file_stat, dir_stat; int fd; + dir = FcConfigNormalizeFontDir (FcConfigGetCurrent(), dir); + if (!dir) + return FcFalse; + if (stat ((char *) dir, &dir_stat) < 0) return FcFalse; @@ -644,6 +648,10 @@ FcDirCacheHasCurrentArch (const FcChar8 *dir) off_t current_arch_start; char *current_arch_machine_name; + dir = FcConfigNormalizeFontDir (FcConfigGetCurrent(), dir); + if (!dir) + return FcFalse; + fd = FcDirCacheOpen (dir); if (fd < 0) goto bail; diff --git a/src/fccfg.c b/src/fccfg.c index 6e5174b..c533006 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -432,7 +432,7 @@ FcConfigNormalizeFontDir (FcConfig *config, /* If this is a bottleneck, we can cache the fontDir inodes. */ ino_t di; dev_t dd; - int n; + int n, n0; struct stat s; if (stat ((char *)d, &s) == -1) @@ -448,7 +448,7 @@ FcConfigNormalizeFontDir (FcConfig *config, } /* Ok, we didn't find it in fontDirs; let's add subdirs.... */ - for (n = 0; n < config->fontDirs->num; n++) + for (n = 0, n0 = config->fontDirs->num; n < n0; n++) FcConfigAddFontDirSubdirs (config, config->fontDirs->strs[n]); /* ... and try again. */