/*
- * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.13 2002/06/19 20:08:22 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;
}
high = map->nent - 1;
if (ucs4 < map->ent[low].bmp || map->ent[high].bmp < ucs4)
return ~0;
- while (high - low > 1)
+ while (low <= high)
{
mid = (high + low) >> 1;
bmp = map->ent[mid].bmp;
if (ucs4 == bmp)
return (FT_ULong) map->ent[mid].encode;
if (ucs4 < bmp)
- high = mid;
+ high = mid - 1;
else
- low = mid;
- }
- for (mid = low; mid <= high; mid++)
- {
- if (ucs4 == map->ent[mid].bmp)
- return (FT_ULong) map->ent[mid].encode;
+ low = mid + 1;
}
return ~0;
}
/*
- * $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.10 2002/06/08 17:32:05 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.12 2002/06/19 20:08:22 keithp Exp $
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
if (!FcConfigInit (&parse, name, config, p))
goto bail2;
+ if (!FcConfigAddConfigFile (config, filename))
+ goto bail3;
+
XML_SetUserData (p, &parse);
XML_SetDoctypeDeclHandler (p, FcStartDoctypeDecl, FcEndDoctypeDecl);