Declare the global cache of a directory's contents to be stale if the
directory is newer than the (newest) configuration file. S: ----------------------------------------------------------------------
This commit is contained in:
parent
793154ed8d
commit
2b25f00c50
|
@ -1,3 +1,11 @@
|
|||
2005-11-02 Patrick Lam <plam@mit.edu>
|
||||
* src/fccache.c (FcGlobalCacheLoad):
|
||||
* src/fccfg.c (FcConfigModifiedTime, FcConfigBuildFonts):
|
||||
* src/fcint.h:
|
||||
|
||||
Declare the global cache of a directory's contents to be stale if
|
||||
the directory is newer than the (newest) configuration file.
|
||||
|
||||
2005-10-31 Patrick Lam <plam@mit.edu>
|
||||
* src/fcint.h:
|
||||
* src/fclist.c (FcListAppend):
|
||||
|
|
|
@ -152,10 +152,12 @@ FcGlobalCacheDestroy (FcGlobalCache *cache)
|
|||
void
|
||||
FcGlobalCacheLoad (FcGlobalCache *cache,
|
||||
FcStrSet *staleDirs,
|
||||
const FcChar8 *cache_file)
|
||||
const FcChar8 *cache_file,
|
||||
FcConfig *config)
|
||||
{
|
||||
char name_buf[8192];
|
||||
FcGlobalCacheDir *d, *next;
|
||||
FcFileTime config_time = FcConfigModifiedTime (config);
|
||||
char * current_arch_machine_name;
|
||||
char candidate_arch_machine_name[MACHINE_SIGNATURE_SIZE + 9];
|
||||
off_t current_arch_start;
|
||||
|
@ -191,8 +193,11 @@ FcGlobalCacheLoad (FcGlobalCache *cache,
|
|||
if (!strlen(name_buf))
|
||||
break;
|
||||
|
||||
/* Directory must be older than the global cache file, and
|
||||
also must be older than the config file. */
|
||||
if (stat ((char *) name_buf, &dir_stat) < 0 ||
|
||||
dir_stat.st_mtime > cache_stat.st_mtime)
|
||||
dir_stat.st_mtime > cache_stat.st_mtime ||
|
||||
(config_time.set && dir_stat.st_mtime > config_time.time))
|
||||
{
|
||||
FcCache md;
|
||||
|
||||
|
@ -553,8 +558,9 @@ FcDirCacheValid (const FcChar8 *dir)
|
|||
* If the directory has been modified more recently than
|
||||
* the cache file, the cache is not valid
|
||||
*/
|
||||
if (dir_stat.st_mtime - file_stat.st_mtime > 0)
|
||||
if (dir_stat.st_mtime > file_stat.st_mtime)
|
||||
return FcFalse;
|
||||
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
|
|
20
src/fccfg.c
20
src/fccfg.c
|
@ -139,11 +139,6 @@ bail0:
|
|||
return 0;
|
||||
}
|
||||
|
||||
typedef struct _FcFileTime {
|
||||
time_t time;
|
||||
FcBool set;
|
||||
} FcFileTime;
|
||||
|
||||
static FcFileTime
|
||||
FcConfigNewestFile (FcStrSet *files)
|
||||
{
|
||||
|
@ -166,6 +161,19 @@ FcConfigNewestFile (FcStrSet *files)
|
|||
return newest;
|
||||
}
|
||||
|
||||
FcFileTime
|
||||
FcConfigModifiedTime (FcConfig *config)
|
||||
{
|
||||
if (!config)
|
||||
{
|
||||
FcFileTime v = { 0, FcFalse };
|
||||
config = FcConfigGetCurrent ();
|
||||
if (!config)
|
||||
return v;
|
||||
}
|
||||
return FcConfigNewestFile (config->configFiles);
|
||||
}
|
||||
|
||||
FcBool
|
||||
FcConfigUptoDate (FcConfig *config)
|
||||
{
|
||||
|
@ -266,7 +274,7 @@ FcConfigBuildFonts (FcConfig *config)
|
|||
goto bail2;
|
||||
|
||||
if (config->cache)
|
||||
FcGlobalCacheLoad (cache, oldDirs, config->cache);
|
||||
FcGlobalCacheLoad (cache, oldDirs, config->cache, config);
|
||||
|
||||
cached_fonts = FcCacheRead(config, cache);
|
||||
if (!cached_fonts)
|
||||
|
|
11
src/fcint.h
11
src/fcint.h
|
@ -406,6 +406,11 @@ struct _FcConfig {
|
|||
|
||||
extern FcConfig *_fcConfig;
|
||||
|
||||
typedef struct _FcFileTime {
|
||||
time_t time;
|
||||
FcBool set;
|
||||
} FcFileTime;
|
||||
|
||||
typedef struct _FcCharMap FcCharMap;
|
||||
|
||||
/* fcblanks.c */
|
||||
|
@ -428,7 +433,8 @@ FcGlobalCacheReadDir (FcFontSet *set,
|
|||
void
|
||||
FcGlobalCacheLoad (FcGlobalCache *cache,
|
||||
FcStrSet *staleDirs,
|
||||
const FcChar8 *cache_file);
|
||||
const FcChar8 *cache_file,
|
||||
FcConfig *config);
|
||||
|
||||
FcBool
|
||||
FcGlobalCacheUpdate (FcGlobalCache *cache,
|
||||
|
@ -514,6 +520,9 @@ FcBool
|
|||
FcConfigAcceptFont (FcConfig *config,
|
||||
const FcPattern *font);
|
||||
|
||||
FcFileTime
|
||||
FcConfigModifiedTime (FcConfig *config);
|
||||
|
||||
/* fccharset.c */
|
||||
FcCharSet *
|
||||
FcCharSetFreeze (FcCharSet *cs);
|
||||
|
|
Loading…
Reference in New Issue