+2005-12-20 Patrick Lam <plam@mit.edu>
+ * ChangeLog:
+ * README:
+ * configure.in:
+ * fontconfig/fontconfig.h:
+
+ Bump version to 2.3.93.
+
2005-12-20 Patrick Lam <plam@mit.edu>
+ * src/fcxml.c (FcConfigParseAndLoad):
+
+ Use open instead of fopen (requested by Phil Race for Sun).
+
+2005-12-20 Patrick Lam <plam@mit.edu>
+ * src/fccache.c (FcDirCacheWrite);
+ * fc-cache/Makefile.am:
+
+ Fix GCC4 warning and Makefile brokenness for /var/cache/fontconfig
+ dir.
+
+2005-12-20 Patrick Lam <plam@mit.edu>
* src/fcfreetype.c (FcFreeTypeQuery):
Restore code to skip over PCF fonts that have no encoded
Fontconfig
Font configuration and customization library
- Version 2.3.92
- 2005-11-04
+ Version 2.3.93
+ 2005-12-12
Check INSTALL for compilation and installation instructions.
Report bugs to https://bugs.freedesktop.org in the fontconfig module.
+2.3.93
+
+Create cache files in /var/cache/fontconfig with hashed filenames, if
+possible, for added FHS compliance.
+Make fc-cat read both per-directory and global cache files.
+Add config file for Persian fonts from Sharif FarsiWeb, Inc.
+Major performance improvements by Dirk Mueller, Stephen Kulow, and Michael Matz at SuSE: in particular, speed up FcFontSetMatch, and inline many functions.
+Fix treatment of globs in config files, broken since 2.3.2 and discovered by Mathias Clasen.
+Don't use freetype internal headers (patch by Matthias Clasen).
+Further space improvements: create langsets statically, so that they can live in .rodata.
+Properly align mmapped data structures to make e.g. ia64 happy.
+Bug fixes.
+
2.3.92
Fix corrupted caches bugs from 2.3.91 (reported by Mike Fabian).
FcBool
FcDirCacheUnlink (const FcChar8 *dir)
{
- FcChar8 *cache_file = FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE);
+ char *cache_file = (char *)FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE);
+ char *cache_hashed;
+ int fd, collisions;
struct stat cache_stat;
+ char name_buf[FC_MAX_FILE_LEN];
+ /* First remove normal cache file. */
if (stat ((char *) cache_file, &cache_stat) == 0 &&
unlink ((char *)cache_file) != 0)
+ goto bail;
+
+ /* Next remove any applicable hashed files. */
+ fd = -1; collisions = 0;
+ do
{
- FcStrFree (cache_file);
- return FcFalse;
+ cache_hashed = FcDirCacheHashName (cache_file, collisions++);
+ if (!cache_hashed)
+ goto bail;
+
+ if (fd > 0)
+ close (fd);
+ fd = open(cache_hashed, O_RDONLY);
+ if (fd == -1)
+ {
+ FcStrFree ((FcChar8 *)cache_file);
+ return FcTrue;
+ }
+
+ FcCacheReadString (fd, name_buf, sizeof (name_buf));
+ if (!strlen(name_buf))
+ goto bail;
+ } while (strcmp (name_buf, cache_file) != 0);
+
+ FcStrFree ((FcChar8 *)cache_file);
+ close (fd);
+
+ if (stat ((char *) cache_hashed, &cache_stat) == 0 &&
+ unlink ((char *)cache_hashed) != 0)
+ {
+ FcStrFree ((FcChar8 *)cache_hashed);
+ goto bail;
}
- FcStrFree (cache_file);
+ FcStrFree ((FcChar8 *)cache_hashed);
return FcTrue;
+
+ bail:
+ FcStrFree ((FcChar8 *)cache_file);
+ return FcFalse;
}
static int
if (fd > 0)
close (fd);
fd = open(cache_hashed, O_RDONLY);
+ FcStrFree ((FcChar8 *)cache_hashed);
+
if (fd == -1)
return -1;
FcCacheReadString (fd, name_buf, sizeof (name_buf));
FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
{
char *cache_file;
- char *cache_to_open;
+ char *cache_hashed;
int fd, fd_orig, i, dirs_count;
FcAtomic *atomic;
FcCache metadata;
fd = -1; collisions = 0;
do
{
- cache_to_open = FcDirCacheHashName (cache_file, collisions++);
- if (!cache_to_open)
+ cache_hashed = FcDirCacheHashName (cache_file, collisions++);
+ if (!cache_hashed)
goto bail0;
if (fd > 0)
close (fd);
- fd = open(cache_to_open, O_RDONLY);
+ fd = open(cache_hashed, O_RDONLY);
if (fd == -1)
break;
FcCacheReadString (fd, name_buf, sizeof (name_buf));
if (FcDebug () & FC_DBG_CACHE)
printf ("FcDirCacheWriteDir cache_file \"%s\"\n", cache_file);
- atomic = FcAtomicCreate ((FcChar8 *)cache_to_open);
+ atomic = FcAtomicCreate ((FcChar8 *)cache_hashed);
if (!atomic)
goto bail1;
/* Now try rewriting the original version of the file. */
FcAtomicDestroy (atomic);
- atomic = FcAtomicCreate (cache_file);
+ atomic = FcAtomicCreate ((FcChar8 *)cache_file);
fd_orig = open (cache_file, O_RDONLY);
if (fd_orig == -1)
fd_orig = open((char *)FcAtomicOrigFile (atomic), O_RDONLY);
close(fd);
if (!FcAtomicReplaceOrig(atomic))
goto bail5;
+ FcStrFree ((FcChar8 *)cache_hashed);
FcAtomicUnlock (atomic);
FcAtomicDestroy (atomic);
return FcTrue;
bail2:
FcAtomicDestroy (atomic);
bail1:
- free (cache_to_open);
+ FcStrFree ((FcChar8 *)cache_hashed);
bail0:
unlink ((char *)cache_file);
free (cache_file);
* PERFORMANCE OF THIS SOFTWARE.
*/
+#include <fcntl.h>
#include <stdarg.h>
#include "fcint.h"
#include <dirent.h>
XML_Parser p;
FcChar8 *filename;
- FILE *f;
+ int fd;
int len;
FcConfigParse parse;
FcBool error = FcTrue;
if (FcDebug () & FC_DBG_CONFIG)
printf ("\tLoading config file %s\n", filename);
- f = fopen ((char *) filename, "r");
- if (!f) {
+ fd = open ((char *) filename, O_RDONLY);
+ if (fd == -1) {
FcStrFree (filename);
goto bail0;
}
goto bail3;
}
#endif
- len = fread (buf, 1, BUFSIZ, f);
+ len = read (fd, buf, BUFSIZ);
if (len < 0)
{
FcConfigMessage (&parse, FcSevereError, "failed reading config file");
bail2:
XML_ParserFree (p);
bail1:
- fclose (f);
- f = NULL;
+ close (fd);
+ fd = -1;
bail0:
if (error && complain)
{