]> git.wh0rd.org - fontconfig.git/commitdiff
Global cache time checking was using wrong file name and computing wrong
authorKeith Packard <keithp@keithp.com>
Wed, 12 Mar 2003 22:15:39 +0000 (22:15 +0000)
committerKeith Packard <keithp@keithp.com>
Wed, 12 Mar 2003 22:15:39 +0000 (22:15 +0000)
    count of fonts per file

src/fccache.c
src/fcdir.c
src/fcint.h

index 3a7cb6ced0495d57bb050c59936443d1a6c1d83f..ab32629e2847bba392308c06aacb8461633734d2 100644 (file)
@@ -309,14 +309,14 @@ FcCacheHash (const FcChar8 *string, int len)
  * Verify the saved timestamp for a file
  */
 FcBool
-FcGlobalCacheCheckTime (FcGlobalCacheInfo *info)
+FcGlobalCacheCheckTime (const FcChar8 *file, FcGlobalCacheInfo *info)
 {
     struct stat            statb;
 
-    if (stat ((char *) info->file, &statb) < 0)
+    if (stat ((char *) file, &statb) < 0)
     {
        if (FcDebug () & FC_DBG_CACHE)
-           printf (" file missing\n");
+           printf (" file %s missing\n", file);
        return FcFalse;
     }
     if (statb.st_mtime != info->time)
@@ -549,7 +549,7 @@ FcGlobalCacheScanDir (FcFontSet             *set,
      * See if the timestamp recorded in the global cache
      * matches the directory time, if not, return False
      */
-    if (!FcGlobalCacheCheckTime (&d->info))
+    if (!FcGlobalCacheCheckTime (d->info.file, &d->info))
     {
        if (FcDebug () & FC_DBG_CACHE)
            printf ("\tdir cache entry time mismatch\n");
@@ -633,7 +633,7 @@ FcGlobalCacheFileGet (FcGlobalCache *cache,
        }
     }
     if (count)
-       *count = max;
+       *count = max + 1;
     return match;
 }
     
index 264c5b4ceaba1a2fd2d9fef751331182f999ed5e..995a9086b4cdd789ff8f642acc99863df5fa3f6b 100644 (file)
@@ -70,7 +70,7 @@ FcFileScan (FcFontSet     *set,
                /*
                 * Found a cache entry for the file
                 */
-               if (FcGlobalCacheCheckTime (&cache_file->info))
+               if (FcGlobalCacheCheckTime (file, &cache_file->info))
                {
                    name = cache_file->name;
                    need_scan = FcFalse;
@@ -89,7 +89,8 @@ FcFileScan (FcFontSet     *set,
                                                       strlen ((const char *) file),
                                                       FcFalse)))
            {
-               if (FcGlobalCacheCheckTime (&cache_dir->info))
+               if (FcGlobalCacheCheckTime (cache_dir->info.file, 
+                                           &cache_dir->info))
                {
                    font = 0;
                    need_scan = FcFalse;
@@ -199,6 +200,9 @@ FcDirScan (FcFontSet            *set,
     strcat ((char *) file, "/");
     base = file + strlen ((char *) file);
     
+    if (FcDebug () & FC_DBG_SCAN)
+       printf ("\tScanning dir %s\n", dir);
+       
     d = opendir ((char *) dir);
     
     if (!d)
index ba5d9a4053bb93b9a5f8916f5d64c30316a49fa6..9873a66e8af91548244d78a7616bbf4694804cf2 100644 (file)
@@ -338,7 +338,7 @@ void
 FcGlobalCacheDestroy (FcGlobalCache *cache);
 
 FcBool
-FcGlobalCacheCheckTime (FcGlobalCacheInfo *info);
+FcGlobalCacheCheckTime (const FcChar8*file, FcGlobalCacheInfo *info);
 
 void
 FcGlobalCacheReferenced (FcGlobalCache     *cache,