Doodle wrote: > The code uses fopen() at some places, and uses open() at some other. > Shouldn't this be unified? Anyway, the open flag O_BINARY is missing > from the open() of the cache file handling routines, which caused > problems with the font-cache on OS/2 GCC (where the default is text file). Um, O_BINARY doesn't exist for me under Linux. I better not commit that. Someone (not me) is going to have to be a bit more clever than that. rsync defines its own O_BINARY to 0 if the platform doesn't provide it. You might want to start with the binary.patch I've attached. pat
Index: src/fccache.c =================================================================== RCS file: /cvs/fontconfig/fontconfig/src/fccache.c,v retrieving revision 1.23.4.68 diff -u -p -r1.23.4.68 fccache.c --- src/fccache.c 8 Feb 2006 03:34:17 -0000 1.23.4.68 +++ src/fccache.c 9 Feb 2006 15:49:29 -0000 @@ -187,7 +187,7 @@ FcGlobalCacheLoad (FcGlobalCache *cac if (stat ((char *) cache_file, &cache_stat) < 0) return; - cache->fd = open ((char *) cache_file, O_RDONLY); + cache->fd = open ((char *) cache_file, O_RDONLY | O_BINARY); if (cache->fd == -1) return; @@ -427,13 +427,13 @@ FcGlobalCacheSave (FcGlobalCache *cac if (!FcAtomicLock (atomic)) goto bail1; - fd = open ((char *) FcAtomicNewFile(atomic), O_RDWR | O_CREAT, + fd = open ((char *) FcAtomicNewFile(atomic), O_RDWR | O_CREAT | O_BINARY, S_IRUSR | S_IWUSR); if (fd == -1) goto bail2; FcCacheWriteString (fd, FC_GLOBAL_MAGIC_COOKIE); - fd_orig = open ((char *) FcAtomicOrigFile(atomic), O_RDONLY); + fd_orig = open ((char *) FcAtomicOrigFile(atomic), O_RDONLY | O_BINARY); current_arch_machine_name = FcCacheMachineSignature (); if (fd_orig == -1) @@ -804,7 +804,7 @@ FcDirCacheUnlink (const FcChar8 *dir, Fc if (fd > 0) close (fd); - fd = open(cache_hashed, O_RDONLY); + fd = open(cache_hashed, O_RDONLY | O_BINARY); if (fd == -1) { FcStrFree ((FcChar8 *)cache_file); @@ -1019,7 +1019,7 @@ FcDirCacheOpen (const FcChar8 *dir) if (!cache_file) return -1; - fd = open(cache_file, O_RDONLY); + fd = open(cache_file, O_RDONLY | O_BINARY); if (fd != -1) return fd; @@ -1041,7 +1041,7 @@ FcDirCacheOpen (const FcChar8 *dir) if (fd > 0) close (fd); - fd = open(cache_hashed, O_RDONLY); + fd = open(cache_hashed, O_RDONLY | O_BINARY); FcStrFree ((FcChar8 *)cache_hashed); if (fd == -1) @@ -1233,7 +1233,7 @@ FcDirCacheWrite (FcFontSet *set, FcStrSe if (fd > 0) close (fd); - fd = open(cache_hashed, O_RDONLY); + fd = open(cache_hashed, O_RDONLY | O_BINARY); if (fd == -1) break; if(!FcCacheReadString (fd, name_buf, sizeof (name_buf)) || !strlen(name_buf)) @@ -1265,22 +1265,22 @@ FcDirCacheWrite (FcFontSet *set, FcStrSe FcAtomicDestroy (atomic); atomic = FcAtomicCreate ((FcChar8 *)cache_file); - fd_orig = open (cache_file, O_RDONLY); + fd_orig = open (cache_file, O_RDONLY | O_BINARY); if (fd_orig == -1) - fd_orig = open((char *)FcAtomicOrigFile (atomic), O_RDONLY); + fd_orig = open((char *)FcAtomicOrigFile (atomic), O_RDONLY | O_BINARY); - fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT, 0666); + fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT | O_BINARY, 0666); if (fd == -1) goto bail2; } /* In all cases, try opening the real location of the cache file first. */ /* (even if that's not atomic.) */ - fd_orig = open (cache_file, O_RDONLY); + fd_orig = open (cache_file, O_RDONLY | O_BINARY); if (fd_orig == -1) - fd_orig = open((char *)FcAtomicOrigFile (atomic), O_RDONLY); + fd_orig = open((char *)FcAtomicOrigFile (atomic), O_RDONLY | O_BINARY); - fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT, 0666); + fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT | O_BINARY, 0666); if (fd == -1) goto bail3;
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig