/*
- * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.8 2002/06/02 19:51:36 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.14 2002/06/20 03:43:09 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
return 0;
}
-static time_t
+typedef struct _FcFileTime {
+ time_t time;
+ FcBool set;
+} FcFileTime;
+
+static FcFileTime
FcConfigNewestFile (FcStrSet *files)
{
FcStrList *list = FcStrListCreate (files);
- FcBool set = FcFalse;
- time_t newest = 0;
+ FcFileTime newest = { 0, FcFalse };
FcChar8 *file;
struct stat statb;
if (list)
{
while ((file = FcStrListNext (list)))
- {
if (stat ((char *) file, &statb) == 0)
- {
- if (!set)
- newest = statb.st_mtime;
- else if (statb.st_mtime - newest > 0)
- newest = statb.st_mtime;
- }
- }
+ if (!newest.set || statb.st_mtime - newest.time > 0)
+ newest.time = statb.st_mtime;
FcStrListDone (list);
}
return newest;
FcBool
FcConfigUptoDate (FcConfig *config)
{
- time_t config_time;
- time_t font_time;
- time_t now = time(0);
+ FcFileTime config_time, font_time;
+ time_t now = time(0);
if (!config)
{
config = FcConfigGetCurrent ();
}
config_time = FcConfigNewestFile (config->configFiles);
font_time = FcConfigNewestFile (config->configDirs);
- if (config_time - config->rescanTime > 0 ||
- font_time - config->rescanTime > 0)
+ if ((config_time.set && config_time.time - config->rescanTime > 0) ||
+ (font_time.set && font_time.time - config->rescanTime) > 0)
{
return FcFalse;
}
v.type = FcTypeVoid;
break;
}
+ break;
case FcTypeMatrix:
switch (e->op) {
case FcOpEqual:
static FcValueList *
FcConfigMatchValueList (FcPattern *p,
FcTest *t,
- FcValueList *v)
+ FcValueList *values)
{
FcValueList *ret = 0;
FcExpr *e = t->expr;
FcValue value;
+ FcValueList *v;
while (e)
{
e = 0;
}
- for (; v; v = v->next)
+ for (v = values; v; v = v->next)
{
if (FcConfigCompareValue (v->value, t->op, value))
{
}
}
}
+ FcValueDestroy (value);
}
- FcValueDestroy (value);
return ret;
}
{
if (list)
{
- FcPatternElt *e = FcPatternFind (p, object, FcTrue);
+ FcPatternElt *e = FcPatternInsertElt (p, object);
if (!e)
return;
FcConfigPatternDel (FcPattern *p,
const char *object)
{
- FcPatternElt *e = FcPatternFind (p, object, FcFalse);
+ FcPatternElt *e = FcPatternFindElt (p, object);
if (!e)
return;
while (e->values)
FcConfigPatternCanon (FcPattern *p,
const char *object)
{
- FcPatternElt *e = FcPatternFind (p, object, FcFalse);
+ FcPatternElt *e = FcPatternFindElt (p, object);
if (!e)
return;
if (!e->values)
printf ("FcConfigSubstitute test ");
FcTestPrint (t);
}
- st[i].elt = FcPatternFind (p, t->field, FcFalse);
+ st[i].elt = FcPatternFindElt (p, t->field);
/*
* If there's no such field in the font,
* then FcQualAll matches while FcQualAny does not
st[i].value = FcConfigMatchValueList (p, t, st[i].elt->values);
if (!st[i].value)
break;
+ if (t->qual == FcQualFirst && st[i].value != st[i].elt->values)
+ break;
+ if (t->qual == FcQualNotFirst && st[i].value == st[i].elt->values)
+ break;
}
if (t)
{
* If there was a test, then replace the matched
* value with the new list of values
*/
- if (t && st[i].elt)
+ if (t)
{
FcValueList *thisValue = st[i].value;
FcValueList *nextValue = thisValue ? thisValue->next : 0;