View | Details | Raw Unified | Return to bug 148361
Collapse All | Expand All

(-)src/fcint.h-dist (+4 lines)
Lines 414-419 struct _FcConfig { Link Here
414
     */
414
     */
415
    time_t	rescanTime;	    /* last time information was scanned */
415
    time_t	rescanTime;	    /* last time information was scanned */
416
    int		rescanInterval;	    /* interval between scans */
416
    int		rescanInterval;	    /* interval between scans */
417
    /*
418
     * Validate cache files at each open?
419
     */
420
    FcBool	validateCache;
417
};
421
};
418
 
422
 
419
extern FcConfig	*_fcConfig;
423
extern FcConfig	*_fcConfig;
(-)src/fccfg.c-dist (+1 lines)
Lines 117-122 FcConfigCreate (void) Link Here
117
117
118
    config->rescanTime = time(0);
118
    config->rescanTime = time(0);
119
    config->rescanInterval = 30;    
119
    config->rescanInterval = 30;    
120
    config->validateCache = 1;
120
    
121
    
121
    return config;
122
    return config;
122
123
(-)src/fcxml.c-dist (+19 lines)
Lines 293-298 typedef enum _FcElement { Link Here
293
	
293
	
294
    FcElementBlank,
294
    FcElementBlank,
295
    FcElementRescan,
295
    FcElementRescan,
296
    FcElementValidatecache,
296
297
297
    FcElementPrefer,
298
    FcElementPrefer,
298
    FcElementAccept,
299
    FcElementAccept,
Lines 353-358 static struct { Link Here
353
    
354
    
354
    { "blank",		FcElementBlank },
355
    { "blank",		FcElementBlank },
355
    { "rescan",		FcElementRescan },
356
    { "rescan",		FcElementRescan },
357
    { "validatecache",	FcElementValidatecache },
356
358
357
    { "prefer",		FcElementPrefer },
359
    { "prefer",		FcElementPrefer },
358
    { "accept",		FcElementAccept },
360
    { "accept",		FcElementAccept },
Lines 1099-1104 FcParseRescan (FcConfigParse *parse) Link Here
1099
}
1101
}
1100
1102
1101
static void
1103
static void
1104
FcParseValidatecache (FcConfigParse *parse)
1105
{
1106
    int	    n = FcVStackElements (parse);
1107
    while (n-- > 0)
1108
    {
1109
	FcVStack    *v = FcVStackFetch (parse, n);
1110
	if (v->tag != FcVStackBool)
1111
	    FcConfigMessage (parse, FcSevereWarning, "non-boolean validatecache");
1112
	else
1113
	    parse->config->validateCache = v->u.bool;
1114
    }
1115
}
1116
1117
static void
1102
FcParseInt (FcConfigParse *parse)
1118
FcParseInt (FcConfigParse *parse)
1103
{
1119
{
1104
    FcChar8 *s, *end;
1120
    FcChar8 *s, *end;
Lines 2086-2091 FcEndElement(void *userData, const XML_C Link Here
2086
    case FcElementRescan:
2102
    case FcElementRescan:
2087
	FcParseRescan (parse);
2103
	FcParseRescan (parse);
2088
	break;
2104
	break;
2105
    case FcElementValidatecache:
2106
	FcParseValidatecache (parse);
2107
	break;
2089
	
2108
	
2090
    case FcElementPrefer:
2109
    case FcElementPrefer:
2091
	FcParseFamilies (parse, FcVStackPrefer);
2110
	FcParseFamilies (parse, FcVStackPrefer);
(-)src/fccache.c-dist (-3 / +25 lines)
Lines 221-229 FcGlobalCacheLoad (FcGlobalCache *cac Link Here
221
221
222
	/* Directory must be older than the global cache file; also
222
	/* Directory must be older than the global cache file; also
223
	   cache must be newer than the config file. */
223
	   cache must be newer than the config file. */
224
        if (stat ((char *) name_buf, &dir_stat) < 0 || 
224
        if (config->validateCache &&
225
            dir_stat.st_mtime > cache_stat.st_mtime ||
225
	    (stat ((char *) name_buf, &dir_stat) < 0 || 
226
	    (config_time.set && cache_stat.st_mtime < config_time.time))
226
	     dir_stat.st_mtime > cache_stat.st_mtime ||
227
	     (config_time.set && cache_stat.st_mtime < config_time.time)))
227
        {
228
        {
228
            FcCache md;
229
            FcCache md;
229
	    off_t off;
230
	    off_t off;
Lines 876-881 FcCacheReadDirs (FcConfig * config, FcGl Link Here
876
	    continue;
877
	    continue;
877
	}
878
	}
878
	
879
	
880
	if (! config->validateCache)
881
	{
882
	    /* We trust cache files -- if not found, just ignore that directory
883
	     */
884
	    if ((cache && FcGlobalCacheReadDir (set, subdirs, cache, (char *)dir,
885
						config)) ||
886
		FcDirCacheRead (set, subdirs, dir, config))
887
	    {
888
		sublist = FcStrListCreate (subdirs);
889
		FcStrSetDestroy (subdirs);
890
		if (!sublist)
891
		{
892
		    fprintf (stderr, "Can't create subdir list in \"%s\"\n", dir);
893
		    ret++;
894
		    continue;
895
		}
896
		ret += FcCacheReadDirs (config, cache, sublist, set, processed_dirs);
897
	    }
898
	    continue;
899
	}
900
879
	if (access ((char *) dir, X_OK) < 0)
901
	if (access ((char *) dir, X_OK) < 0)
880
	{
902
	{
881
	    switch (errno) {
903
	    switch (errno) {
(-)fonts.dtd-dist (-1 / +8 lines)
Lines 40-46 Link Here
40
<!--
40
<!--
41
    Global library configuration data
41
    Global library configuration data
42
 -->
42
 -->
43
<!ELEMENT config (blank|rescan)*>
43
<!ELEMENT config (blank|rescan|validatecache)*>
44
44
45
<!--
45
<!--
46
    Specify the set of Unicode encoding values which
46
    Specify the set of Unicode encoding values which
Lines 82-87 Link Here
82
<!ELEMENT rescan (int)>
82
<!ELEMENT rescan (int)>
83
83
84
<!--
84
<!--
85
    Validate cache files dynamically
86
    If this is set to false, fontconfig trusts cache files and never
87
    checks the timestamp or changes of contents.
88
 -->
89
<!ELEMENT validatecache (bool)>
90
91
<!--
85
    Edit list of available fonts at startup/reload time
92
    Edit list of available fonts at startup/reload time
86
 -->
93
 -->
87
<!ELEMENT selectfont (rejectfont | acceptfont)* >
94
<!ELEMENT selectfont (rejectfont | acceptfont)* >

Return to bug 148361