Fix automatic file time checking, transcoding table searches. Actually add
config files used to config structure so they can be time checked as well
This commit is contained in:
parent
8c96d1fc10
commit
4645eedfcc
31
src/fccfg.c
31
src/fccfg.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $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.
|
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -79,27 +79,25 @@ bail0:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static time_t
|
typedef struct _FcFileTime {
|
||||||
|
time_t time;
|
||||||
|
FcBool set;
|
||||||
|
} FcFileTime;
|
||||||
|
|
||||||
|
static FcFileTime
|
||||||
FcConfigNewestFile (FcStrSet *files)
|
FcConfigNewestFile (FcStrSet *files)
|
||||||
{
|
{
|
||||||
FcStrList *list = FcStrListCreate (files);
|
FcStrList *list = FcStrListCreate (files);
|
||||||
FcBool set = FcFalse;
|
FcFileTime newest = { 0, FcFalse };
|
||||||
time_t newest = 0;
|
|
||||||
FcChar8 *file;
|
FcChar8 *file;
|
||||||
struct stat statb;
|
struct stat statb;
|
||||||
|
|
||||||
if (list)
|
if (list)
|
||||||
{
|
{
|
||||||
while ((file = FcStrListNext (list)))
|
while ((file = FcStrListNext (list)))
|
||||||
{
|
|
||||||
if (stat ((char *) file, &statb) == 0)
|
if (stat ((char *) file, &statb) == 0)
|
||||||
{
|
if (!newest.set || statb.st_mtime - newest.time > 0)
|
||||||
if (!set)
|
newest.time = statb.st_mtime;
|
||||||
newest = statb.st_mtime;
|
|
||||||
else if (statb.st_mtime - newest > 0)
|
|
||||||
newest = statb.st_mtime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FcStrListDone (list);
|
FcStrListDone (list);
|
||||||
}
|
}
|
||||||
return newest;
|
return newest;
|
||||||
|
@ -108,9 +106,8 @@ FcConfigNewestFile (FcStrSet *files)
|
||||||
FcBool
|
FcBool
|
||||||
FcConfigUptoDate (FcConfig *config)
|
FcConfigUptoDate (FcConfig *config)
|
||||||
{
|
{
|
||||||
time_t config_time;
|
FcFileTime config_time, font_time;
|
||||||
time_t font_time;
|
time_t now = time(0);
|
||||||
time_t now = time(0);
|
|
||||||
if (!config)
|
if (!config)
|
||||||
{
|
{
|
||||||
config = FcConfigGetCurrent ();
|
config = FcConfigGetCurrent ();
|
||||||
|
@ -119,8 +116,8 @@ FcConfigUptoDate (FcConfig *config)
|
||||||
}
|
}
|
||||||
config_time = FcConfigNewestFile (config->configFiles);
|
config_time = FcConfigNewestFile (config->configFiles);
|
||||||
font_time = FcConfigNewestFile (config->configDirs);
|
font_time = FcConfigNewestFile (config->configDirs);
|
||||||
if (config_time - config->rescanTime > 0 ||
|
if ((config_time.set && config_time.time - config->rescanTime > 0) ||
|
||||||
font_time - config->rescanTime > 0)
|
(font_time.set && font_time.time - config->rescanTime) > 0)
|
||||||
{
|
{
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1597,21 +1597,16 @@ FcFreeTypeMapChar (FcChar32 ucs4, const FcCharMap *map)
|
||||||
high = map->nent - 1;
|
high = map->nent - 1;
|
||||||
if (ucs4 < map->ent[low].bmp || map->ent[high].bmp < ucs4)
|
if (ucs4 < map->ent[low].bmp || map->ent[high].bmp < ucs4)
|
||||||
return ~0;
|
return ~0;
|
||||||
while (high - low > 1)
|
while (low <= high)
|
||||||
{
|
{
|
||||||
mid = (high + low) >> 1;
|
mid = (high + low) >> 1;
|
||||||
bmp = map->ent[mid].bmp;
|
bmp = map->ent[mid].bmp;
|
||||||
if (ucs4 == bmp)
|
if (ucs4 == bmp)
|
||||||
return (FT_ULong) map->ent[mid].encode;
|
return (FT_ULong) map->ent[mid].encode;
|
||||||
if (ucs4 < bmp)
|
if (ucs4 < bmp)
|
||||||
high = mid;
|
high = mid - 1;
|
||||||
else
|
else
|
||||||
low = mid;
|
low = mid + 1;
|
||||||
}
|
|
||||||
for (mid = low; mid <= high; mid++)
|
|
||||||
{
|
|
||||||
if (ucs4 == map->ent[mid].bmp)
|
|
||||||
return (FT_ULong) map->ent[mid].encode;
|
|
||||||
}
|
}
|
||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $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.
|
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
|
||||||
*
|
*
|
||||||
|
@ -1667,6 +1667,9 @@ FcConfigParseAndLoad (FcConfig *config,
|
||||||
if (!FcConfigInit (&parse, name, config, p))
|
if (!FcConfigInit (&parse, name, config, p))
|
||||||
goto bail2;
|
goto bail2;
|
||||||
|
|
||||||
|
if (!FcConfigAddConfigFile (config, filename))
|
||||||
|
goto bail3;
|
||||||
|
|
||||||
XML_SetUserData (p, &parse);
|
XML_SetUserData (p, &parse);
|
||||||
|
|
||||||
XML_SetDoctypeDeclHandler (p, FcStartDoctypeDecl, FcEndDoctypeDecl);
|
XML_SetDoctypeDeclHandler (p, FcStartDoctypeDecl, FcEndDoctypeDecl);
|
||||||
|
|
Loading…
Reference in New Issue