diff options
author | marha <marha@users.sourceforge.net> | 2012-04-23 14:49:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-04-23 14:49:28 +0200 |
commit | b68922d51f52ca6ab9daa0105ef5c57f35bfbdcf (patch) | |
tree | 4e1760d8c7a1499cad49248b640dcc7ec21d4647 /fontconfig/fc-cache/fc-cache.c | |
parent | 0e3699334faf92f508b6c187a261548b656b0dd3 (diff) | |
download | vcxsrv-b68922d51f52ca6ab9daa0105ef5c57f35bfbdcf.tar.gz vcxsrv-b68922d51f52ca6ab9daa0105ef5c57f35bfbdcf.tar.bz2 vcxsrv-b68922d51f52ca6ab9daa0105ef5c57f35bfbdcf.zip |
fontconfig libXau libXext libxcb pixman mesa git update 23 April 2012
Diffstat (limited to 'fontconfig/fc-cache/fc-cache.c')
-rw-r--r-- | fontconfig/fc-cache/fc-cache.c | 73 |
1 files changed, 1 insertions, 72 deletions
diff --git a/fontconfig/fc-cache/fc-cache.c b/fontconfig/fc-cache/fc-cache.c index b42fd3545..9fb383be0 100644 --- a/fontconfig/fc-cache/fc-cache.c +++ b/fontconfig/fc-cache/fc-cache.c @@ -42,14 +42,6 @@ #include <dirent.h> #include <string.h> -#ifndef FC_DIR_SEPARATOR_S -# ifdef _WIN32 -# define FC_DIR_SEPARATOR_S "\\" -# else -# define FC_DIR_SEPARATOR_S "/" -# endif -#endif - #if defined (_WIN32) #define STRICT #include <windows.h> @@ -122,69 +114,6 @@ usage (char *program, int error) static FcStrSet *processed_dirs; -/* Create CACHEDIR.TAG */ -static FcBool -create_tag_file (FcConfig *config, FcBool verbose) -{ - FcChar8 *cache_tag; - FcChar8 *cache_dir = NULL; - FcStrList *list; - int fd; - FILE *fp; - FcAtomic *atomic; - static const FcChar8 cache_tag_contents[] = - "Signature: 8a477f597d28d172789f06886806bc55\n" - "# This file is a cache directory tag created by fontconfig.\n" - "# For information about cache directory tags, see:\n" - "# http://www.brynosaurus.com/cachedir/\n"; - static size_t cache_tag_contents_size = sizeof (cache_tag_contents) - 1; - FcBool ret = FcTrue; - - list = FcConfigGetCacheDirs(config); - if (!list) - return FcFalse; - - while ((cache_dir = FcStrListNext (list))) - { - if (access ((char *) cache_dir, W_OK|X_OK) == 0) - { - if (verbose) - printf ("Create CACHEDIR.TAG at %s\n", cache_dir); - /* Create CACHEDIR.TAG */ - cache_tag = FcStrPlus (cache_dir, (const FcChar8 *) FC_DIR_SEPARATOR_S "CACHEDIR.TAG"); - if (!cache_tag) - return FcFalse; - atomic = FcAtomicCreate ((FcChar8 *)cache_tag); - if (!atomic) - goto bail1; - if (!FcAtomicLock (atomic)) - goto bail2; - fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT, 0644); - if (fd == -1) - goto bail3; - fp = fdopen(fd, "wb"); - if (fp == NULL) - goto bail3; - - fwrite(cache_tag_contents, cache_tag_contents_size, sizeof (FcChar8), fp); - fclose(fp); - - if (!FcAtomicReplaceOrig(atomic)) - goto bail3; - - bail3: - FcAtomicUnlock (atomic); - bail2: - FcAtomicDestroy (atomic); - bail1: - FcStrFree (cache_tag); - } - } - FcStrListDone (list); - - return ret; -} - static int scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, FcBool verbose, int *changed) { @@ -435,7 +364,7 @@ main (int argc, char **argv) * This expects the fontconfig cache directory already exists. * If it doesn't, it won't be simply created. */ - create_tag_file (config, verbose); + FcCacheCreateTagFile (config); FcStrSetDestroy (processed_dirs); |