]> git.wh0rd.org - fontconfig.git/commitdiff
Fix automatic file time checking, transcoding table searches. Actually add
authorKeith Packard <keithp@keithp.com>
Fri, 21 Jun 2002 06:14:45 +0000 (06:14 +0000)
committerKeith Packard <keithp@keithp.com>
Fri, 21 Jun 2002 06:14:45 +0000 (06:14 +0000)
    config files used to config structure so they can be time checked as
    well

src/fccfg.c
src/fccharset.c
src/fcxml.c

index 8c0ae99152c4b3ddc15c2c01ed505a9f95cf1321..6191324bf2f8721011b32353fc7aca5e0d69d807 100644 (file)
@@ -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.
  *
@@ -79,27 +79,25 @@ bail0:
     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;
@@ -108,9 +106,8 @@ FcConfigNewestFile (FcStrSet *files)
 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 ();
@@ -119,8 +116,8 @@ FcConfigUptoDate (FcConfig *config)
     }
     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;
     }
index c5ff183d62c0a4d9d65e4dcd71ba421fc3441292..86c59adfff65c3fe3b22a19afa812abffd3dfb55 100644 (file)
@@ -1597,21 +1597,16 @@ FcFreeTypeMapChar (FcChar32 ucs4, const FcCharMap *map)
     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;
 }
index 0c1304ec2c951df336f5228cdbd01bdf697ebd49..91d8d3fb91f9db1a6ee20b6e18e3762b6494fb44 100644 (file)
@@ -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.
  *
@@ -1667,6 +1667,9 @@ FcConfigParseAndLoad (FcConfig        *config,
     if (!FcConfigInit (&parse, name, config, p))
        goto bail2;
 
+    if (!FcConfigAddConfigFile (config, filename))
+       goto bail3;
+
     XML_SetUserData (p, &parse);
     
     XML_SetDoctypeDeclHandler (p, FcStartDoctypeDecl, FcEndDoctypeDecl);