Do not clean cache files for different architectures

Use filenames to clean cache files for current architecture only. This is
sufficient as cache files live in their own directory where filenames are
under fontconfig control.
This commit is contained in:
Mike FABIAN 2006-10-27 10:26:50 -07:00 committed by Keith Packard
parent 0596d7296c
commit 0334e5a294
1 changed files with 9 additions and 0 deletions

View File

@ -22,6 +22,8 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "../fc-arch/fcarch.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#else #else
@ -40,6 +42,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <dirent.h> #include <dirent.h>
#include <string.h>
#if defined (_WIN32) #if defined (_WIN32)
#define STRICT #define STRICT
@ -296,6 +299,12 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose)
if (ent->d_name[0] == '.') if (ent->d_name[0] == '.')
continue; 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); file_name = FcStrPlus (dir_base, (FcChar8 *) ent->d_name);
if (!file_name) if (!file_name)
{ {