Keith Packard <keithp@xxxxxxxxxx> さんは書きました: > On Tue, 2006-10-24 at 17:36 +0200, Mike FABIAN wrote: > >> I tried to fix the problem with the attached patch which >> seems to work for me. > > Yes, that's obviously the right plan; ignore files which aren't of the > right form. Instead of using strstr, it would be better to just compare > the end of the filename against the provided pattern. Here is an improved patch which does this.
diff -ru fontconfig-2.4.1.orig/fc-cache/fc-cache.c fontconfig-2.4.1/fc-cache/fc-cache.c --- fontconfig-2.4.1.orig/fc-cache/fc-cache.c 2006-09-14 03:53:49.000000000 +0200 +++ fontconfig-2.4.1/fc-cache/fc-cache.c 2006-10-26 17:56:25.000000000 +0200 @@ -22,6 +22,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "../fc-arch/fcarch.h" + #ifdef HAVE_CONFIG_H #include <config.h> #else @@ -40,6 +42,7 @@ #include <errno.h> #include <fcntl.h> #include <dirent.h> +#include <string.h> #if defined (_WIN32) #define STRICT @@ -296,6 +299,12 @@ if (ent->d_name[0] == '.') continue; + /* skip cache files for different architectures and */ + /* files which are not cache files at all */ + if (strlen(ent->d_name) != 32 + strlen ("-" FC_ARCHITECTURE FC_CACHE_SUFFIX) || + strcmp(ent->d_name + 32, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX)) + continue; + file_name = FcStrPlus (dir_base, (FcChar8 *) ent->d_name); if (!file_name) {
-- Mike FABIAN <mfabian@xxxxxxx> http://www.suse.de/~mfabian 睡眠不足はいい仕事の敵だ。
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig