From: Patrick Lam Date: Wed, 21 Dec 2005 03:31:19 +0000 (+0000) Subject: Bump version to 2.3.93. X-Git-Tag: fc-2_3_93 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=3bfae75d44db5ceae394194d2e6c7b81201ea685;p=fontconfig.git Bump version to 2.3.93. Use open instead of fopen (requested by Phil Race for Sun). src/fccache.c (FcDirCacheWrite); Fix GCC4 warning and Makefile brokenness for /var/cache/fontconfig dir. --- diff --git a/ChangeLog b/ChangeLog index f296a88..b9bd677 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,24 @@ +2005-12-20 Patrick Lam + * ChangeLog: + * README: + * configure.in: + * fontconfig/fontconfig.h: + + Bump version to 2.3.93. + 2005-12-20 Patrick Lam + * src/fcxml.c (FcConfigParseAndLoad): + + Use open instead of fopen (requested by Phil Race for Sun). + +2005-12-20 Patrick Lam + * src/fccache.c (FcDirCacheWrite); + * fc-cache/Makefile.am: + + Fix GCC4 warning and Makefile brokenness for /var/cache/fontconfig + dir. + +2005-12-20 Patrick Lam * src/fcfreetype.c (FcFreeTypeQuery): Restore code to skip over PCF fonts that have no encoded diff --git a/README b/README index 9008d5e..81b6bc6 100644 --- a/README +++ b/README @@ -1,11 +1,24 @@ 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). diff --git a/configure.in b/configure.in index 797d27f..202e32a 100644 --- a/configure.in +++ b/configure.in @@ -33,7 +33,7 @@ dnl This is the package version number, not the shared library dnl version. This same version number must appear in fontconfig/fontconfig.h dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's dnl not possible to extract the version number here from fontconfig.h -AM_INIT_AUTOMAKE(fontconfig, 2.3.92) +AM_INIT_AUTOMAKE(fontconfig, 2.3.93) AM_MAINTAINER_MODE dnl libtool versioning diff --git a/fc-cache/Makefile.am b/fc-cache/Makefile.am index fb9a8c9..662320d 100644 --- a/fc-cache/Makefile.am +++ b/fc-cache/Makefile.am @@ -31,6 +31,14 @@ AM_CPPFLAGS = -DPKGCACHEDIR='"${pkgcachedir}"' pkgcache_DATA=stamp +uninstall-pkgcacheDATA: + @$(NORMAL_UNINSTALL) + echo " $(RM) -rf '$(DESTDIR)$(pkgcachedir)'"; \ + $(RM) -rf "$(DESTDIR)$(pkgcachedir)" + +clean-generic: + $(RM) stamp + stamp: touch $@ diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 515d867..63434d2 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -46,7 +46,7 @@ typedef int FcBool; #define FC_MAJOR 2 #define FC_MINOR 3 -#define FC_REVISION 92 +#define FC_REVISION 93 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION)) diff --git a/src/fccache.c b/src/fccache.c index 311fb7d..98f6d00 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -669,18 +669,55 @@ FcDirCacheHasCurrentArch (const FcChar8 *dir) 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 @@ -856,6 +893,8 @@ FcDirCacheOpen (char *cache_file) 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)); @@ -999,7 +1038,7 @@ FcBool 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; @@ -1020,13 +1059,13 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) 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)); @@ -1047,7 +1086,7 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) 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; @@ -1056,7 +1095,7 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) /* 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); @@ -1133,6 +1172,7 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) close(fd); if (!FcAtomicReplaceOrig(atomic)) goto bail5; + FcStrFree ((FcChar8 *)cache_hashed); FcAtomicUnlock (atomic); FcAtomicDestroy (atomic); return FcTrue; @@ -1146,7 +1186,7 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir) bail2: FcAtomicDestroy (atomic); bail1: - free (cache_to_open); + FcStrFree ((FcChar8 *)cache_hashed); bail0: unlink ((char *)cache_file); free (cache_file); diff --git a/src/fcxml.c b/src/fcxml.c index ce92f64..0aaec1d 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -22,6 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include #include #include "fcint.h" #include @@ -2355,7 +2356,7 @@ FcConfigParseAndLoad (FcConfig *config, XML_Parser p; FcChar8 *filename; - FILE *f; + int fd; int len; FcConfigParse parse; FcBool error = FcTrue; @@ -2393,8 +2394,8 @@ FcConfigParseAndLoad (FcConfig *config, 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; } @@ -2439,7 +2440,7 @@ FcConfigParseAndLoad (FcConfig *config, goto bail3; } #endif - len = fread (buf, 1, BUFSIZ, f); + len = read (fd, buf, BUFSIZ); if (len < 0) { FcConfigMessage (&parse, FcSevereError, "failed reading config file"); @@ -2463,8 +2464,8 @@ bail3: bail2: XML_ParserFree (p); bail1: - fclose (f); - f = NULL; + close (fd); + fd = -1; bail0: if (error && complain) {