+2006-01-29 Patrick Lam <plam@mit.edu>
+ * doc/fcconfig.fncs:
+ Add documentation for FcConfigNormalizeFontDir.
+
+ * src/fccache.c (FcGlobalCacheDirDestroy, FcGlobalCacheLoad,
+ FcGlobalCacheUpdate, FcGlobalCacheSave):
+ * src/fcdir.c (FcDirScanConfig):
+ * src/fcint.h:
+
+ Write directory information to global caches to fix make check
+ (reported by Ronny V. Vindenes). This changes the global cache
+ format again.
+
2006-01-27 Patrick Lam <plam@mit.edu>
* fc-cache/fc-cache.c (scanDirs):
* fontconfig/fontconfig.h:
static void
FcGlobalCacheDirDestroy (FcGlobalCacheDir *d)
{
+ FcStrSetDestroy (d->subdirs);
FcMemFree (FC_MEM_STRING, strlen (d->name)+1);
free (d->name);
FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheDir));
off_t current_arch_start;
struct stat cache_stat, dir_stat;
+ char subdirName[FC_MAX_FILE_LEN + 1 + 12 + 1];
if (stat ((char *) cache_file, &cache_stat) < 0)
return;
d->name = (char *)FcStrCopy ((FcChar8 *)name_buf);
d->ent = 0;
d->offset = lseek (cache->fd, 0, SEEK_CUR);
+
+ d->subdirs = FcStrSetCreate();
+ while (strlen(FcCacheReadString (cache->fd, subdirName, sizeof (subdirName))) > 0)
+ FcStrSetAdd (d->subdirs, (FcChar8 *)subdirName);
+
if (read (cache->fd, &d->metadata, sizeof (FcCache)) != sizeof (FcCache))
goto bail1;
targ = FcCacheNextOffset (lseek(cache->fd, 0, SEEK_CUR)) + d->metadata.count;
FcBool
FcGlobalCacheUpdate (FcGlobalCache *cache,
+ FcStrSet *dirs,
const char *name,
FcFontSet *set,
FcConfig *config)
{
- FcGlobalCacheDir * d;
+ FcGlobalCacheDir *d;
+ int i;
name = (char *)FcConfigNormalizeFontDir (config, (FcChar8 *)name);
for (d = cache->dirs; d; d = d->next)
d->name = (char *)FcStrCopy ((FcChar8 *)name);
d->ent = FcDirCacheProduce (set, &d->metadata);
d->offset = 0;
+ d->subdirs = FcStrSetCreate();
+ for (i = 0; i < dirs->num; i++)
+ FcStrSetAdd (d->subdirs, dirs->strs[i]);
return FcTrue;
}
const FcChar8 *cache_file,
FcConfig *config)
{
- int fd, fd_orig;
+ int fd, fd_orig, i;
FcGlobalCacheDir *dir;
FcAtomic *atomic;
off_t current_arch_start = 0, truncate_to;
truncate_to += sizeof (FcCache);
truncate_to = FcCacheNextOffset (truncate_to);
truncate_to += dir->metadata.count;
+
+ for (i = 0; i < dir->subdirs->size; i++)
+ truncate_to += strlen((char *)dir->subdirs->strs[i]) + 1;
+ truncate_to ++;
}
truncate_to -= current_arch_start;
const char * d = (const char *)FcConfigNormalizeFontDir (config, (const FcChar8 *)dir->name);
FcCacheWriteString (fd, d);
+
+ for (i = 0; i < dir->subdirs->size; i++)
+ FcCacheWriteString (fd, (char *)dir->subdirs->strs[i]);
+ FcCacheWriteString (fd, "");
+
write (fd, &dir->metadata, sizeof(FcCache));
lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_CUR)), SEEK_SET);
write (fd, dir->ent, dir->metadata.count);