Commit 2c4e0124 authored by Patrick Lam's avatar Patrick Lam
Browse files

Update fc-cat to handle subdir lists in global cache file.

Another FcCacheReadString return value check.
parent c5411c4c
2006-01-30 Patrick Lam <plam@mit.edu>
* fc-cat/fc-cat.c (FcCacheGlobalFileReadAndPrint):
Update fc-cat to handle subdir lists in global cache file.
* src/fccache.c (FcGlobalCacheLoad):
Another FcCacheReadString return value check.
2006-01-30 Mike Fabian <mfabian@suse.de> 2006-01-30 Mike Fabian <mfabian@suse.de>
reviewed by: plam reviewed by: plam
......
...@@ -174,6 +174,7 @@ FcCacheGlobalFileReadAndPrint (FcFontSet * set, FcStrSet *dirs, char *cache_file ...@@ -174,6 +174,7 @@ FcCacheGlobalFileReadAndPrint (FcFontSet * set, FcStrSet *dirs, char *cache_file
int fd; int fd;
char * current_arch_machine_name; char * current_arch_machine_name;
char candidate_arch_machine_name[9+MACHINE_SIGNATURE_SIZE]; char candidate_arch_machine_name[9+MACHINE_SIGNATURE_SIZE];
char subdirName[FC_MAX_FILE_LEN + 1 + 12 + 1];
off_t current_arch_start = 0; off_t current_arch_start = 0;
if (!cache_file) if (!cache_file)
...@@ -202,6 +203,15 @@ FcCacheGlobalFileReadAndPrint (FcFontSet * set, FcStrSet *dirs, char *cache_file ...@@ -202,6 +203,15 @@ FcCacheGlobalFileReadAndPrint (FcFontSet * set, FcStrSet *dirs, char *cache_file
printf ("fc-cat: printing global cache contents for dir %s\n", printf ("fc-cat: printing global cache contents for dir %s\n",
name_buf); name_buf);
do
{
if (!FcCacheReadString (fd, subdirName,
sizeof (subdirName)) ||
!strlen (subdirName))
break;
/* then don't do anything with subdirName. */
} while (1);
if (!FcDirCacheConsume (fd, name_buf, set, 0)) if (!FcDirCacheConsume (fd, name_buf, set, 0))
goto bail1; goto bail1;
......
...@@ -240,7 +240,8 @@ FcGlobalCacheLoad (FcGlobalCache *cache, ...@@ -240,7 +240,8 @@ FcGlobalCacheLoad (FcGlobalCache *cache,
{ {
off_t targ; off_t targ;
if (!FcCacheReadString (cache->fd, name_buf, sizeof (name_buf)) || !strlen(name_buf)) if (!FcCacheReadString (cache->fd, name_buf, sizeof (name_buf)) ||
!strlen(name_buf))
break; break;
/* Directory must be older than the global cache file; also /* Directory must be older than the global cache file; also
...@@ -269,8 +270,14 @@ FcGlobalCacheLoad (FcGlobalCache *cache, ...@@ -269,8 +270,14 @@ FcGlobalCacheLoad (FcGlobalCache *cache,
d->offset = lseek (cache->fd, 0, SEEK_CUR); d->offset = lseek (cache->fd, 0, SEEK_CUR);
d->subdirs = FcStrSetCreate(); d->subdirs = FcStrSetCreate();
while (strlen(FcCacheReadString (cache->fd, subdirName, sizeof (subdirName))) > 0) do
{
if (!FcCacheReadString (cache->fd, subdirName,
sizeof (subdirName)) ||
!strlen (subdirName))
break;
FcStrSetAdd (d->subdirs, (FcChar8 *)subdirName); FcStrSetAdd (d->subdirs, (FcChar8 *)subdirName);
} while (1);
if (read (cache->fd, &d->metadata, sizeof (FcCache)) != sizeof (FcCache)) if (read (cache->fd, &d->metadata, sizeof (FcCache)) != sizeof (FcCache))
goto bail1; goto bail1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment