Disable uuid related code on Win32

This commit is contained in:
Akira TAGOH 2017-12-18 21:45:00 +09:00
parent 182186e53a
commit e83f8777d5
3 changed files with 29 additions and 3 deletions

View File

@ -341,8 +341,13 @@ CFLAGS="$fontconfig_save_cflags"
#
# Check for uuid
#
PKG_CHECK_MODULES([UUID], [uuid])
PKGCONFIG_REQUIRES_PRIVATELY="$PKGCONFIG_REQUIRES_PRIVATELY uuid"
if test "$os_win32" != "yes"; then
PKG_CHECK_MODULES([UUID], [uuid])
PKGCONFIG_REQUIRES_PRIVATELY="$PKGCONFIG_REQUIRES_PRIVATELY uuid"
else
UUID_CFLAGS=""
UUID_LIBS=""
fi
AC_SUBST(UUID_CFLAGS)
AC_SUBST(UUID_LIBS)

View File

@ -38,8 +38,9 @@
#endif
#if defined(_WIN32)
#include <sys/locking.h>
#endif
#else
#include <uuid/uuid.h>
#endif
#ifndef O_BINARY
#define O_BINARY 0
@ -51,6 +52,7 @@ FcDirCacheCreateUUID (FcChar8 *dir,
FcConfig *config)
{
FcBool ret = FcTrue;
#ifndef _WIN32
FcChar8 *uuidname;
uuidname = FcStrBuildFilename (dir, ".uuid", NULL);
@ -130,10 +132,12 @@ FcDirCacheCreateUUID (FcChar8 *dir,
}
bail1:
FcStrFree (uuidname);
#endif
return ret;
}
#ifndef _WIN32
static void
FcDirCacheReadUUID (FcChar8 *dir,
FcConfig *config)
@ -173,6 +177,7 @@ FcDirCacheReadUUID (FcChar8 *dir,
else
FcHashUuidFree (u);
}
#endif
struct MD5Context {
FcChar32 buf[4];
@ -249,6 +254,7 @@ FcDirCacheBasenameMD5 (const FcChar8 *dir, FcChar8 cache_base[CACHEBASE_LEN])
return cache_base;
}
#ifndef _WIN32
static FcChar8 *
FcDirCacheBasenameUUID (const FcChar8 *dir, FcChar8 cache_base[CACHEBASE_LEN], FcConfig *config)
{
@ -268,6 +274,7 @@ FcDirCacheBasenameUUID (const FcChar8 *dir, FcChar8 cache_base[CACHEBASE_LEN], F
FcStrFree (alias);
return NULL;
}
#endif
FcBool
FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
@ -278,7 +285,9 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
FcChar8 *cache_dir;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
#ifndef _WIN32
if (!FcDirCacheBasenameUUID (dir, cache_base, config))
#endif
FcDirCacheBasenameMD5 (dir, cache_base);
list = FcStrListCreate (config->cacheDirs);
@ -355,7 +364,9 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
}
FcStrFree (d);
#ifndef _WIN32
if (!FcDirCacheBasenameUUID (dir, cache_base, config))
#endif
FcDirCacheBasenameMD5 (dir, cache_base);
list = FcStrListCreate (config->cacheDirs);
@ -946,7 +957,9 @@ FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file)
FcCache *cache = NULL;
const FcChar8 *d;
#ifndef _WIN32
FcDirCacheReadUUID ((FcChar8 *) dir, config);
#endif
if (!FcDirCacheProcess (config, dir,
FcDirCacheMapHelper,
&cache, cache_file))
@ -1207,7 +1220,9 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
if (!cache_dir)
return FcFalse;
#ifndef _WIN32
if (!FcDirCacheBasenameUUID (dir, cache_base, config))
#endif
FcDirCacheBasenameMD5 (dir, cache_base);
cache_hashed = FcStrBuildFilename (cache_dir, cache_base, NULL);
if (!cache_hashed)
@ -1405,7 +1420,9 @@ FcDirCacheLock (const FcChar8 *dir,
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
int fd = -1;
#ifndef _WIN32
if (!FcDirCacheBasenameUUID (dir, cache_base, config))
#endif
FcDirCacheBasenameMD5 (dir, cache_base);
list = FcStrListCreate (config->cacheDirs);
if (!list)

View File

@ -20,7 +20,9 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "fcint.h"
#ifndef _WIN32
#include <uuid/uuid.h>
#endif
#define FC_HASH_SIZE 227
@ -54,8 +56,10 @@ FcBool
FcHashUuidCopy (const void *src,
void **dest)
{
#ifndef _WIN32
*dest = malloc (sizeof (uuid_t));
uuid_copy (*dest, src);
#endif
return FcTrue;
}