static FcCacheSkip *fcCacheChains[FC_CACHE_MAX_LEVEL];
static int fcCacheMaxLevel;
+#if HAVE_RANDOM
+# define FcRandom() random()
+#else
+# if HAVE_LRAND48
+# define FcRandom() lrand48()
+# else
+# if HAVE_RAND
+# define FcRandom() rand()
+# endif
+# endif
+#endif
/*
* Generate a random level number, distributed
* so that each level is 1/4 as likely as the one before
random_level (void)
{
/* tricky bit -- each bit is '1' 75% of the time */
- long int bits = random () | random ();
+ long int bits = FcRandom () | FcRandom ();
int level = 0;
while (++level < FC_CACHE_MAX_LEVEL)
s->cache = cache;
s->size = cache->size;
s->ref = 1;
- s->cache_dev = cache_stat->st_dev;
- s->cache_ino = cache_stat->st_ino;
- s->cache_mtime = cache_stat->st_mtime;
+ if (cache_stat)
+ {
+ s->cache_dev = cache_stat->st_dev;
+ s->cache_ino = cache_stat->st_ino;
+ s->cache_mtime = cache_stat->st_mtime;
+ }
+ else
+ {
+ s->cache_dev = 0;
+ s->cache_ino = 0;
+ s->cache_mtime = 0;
+ }
/*
* Insert into all fcCacheChains
PAGE_READONLY, 0, 0, NULL);
if (hFileMap != NULL)
{
- cache = MapViewOfFile (hFileMap, FILE_MAP_READ, 0, 0, size);
+ cache = MapViewOfFile (hFileMap, FILE_MAP_READ, 0, 0,
+ fd_stat->st_size);
CloseHandle (hFileMap);
}
}
FcSerializeDestroy (serialize);
+ FcCacheInsert (cache, NULL);
+
return cache;
bail2:
return NULL;
}
+
+#ifdef _WIN32
+#define mkdir(path,mode) _mkdir(path)
+#endif
+
static FcBool
FcMakeDirectory (const FcChar8 *dir)
{
* Hokey little macro trick to permit the definitions of C functions
* with the same name as CPP macros
*/
-#define args(x...) (x)
+#define args1(x) (x)
+#define args2(x,y) (x,y)
const FcChar8 *
-FcCacheDir args(const FcCache *c)
+FcCacheDir args1(const FcCache *c)
{
return FcCacheDir (c);
}
FcFontSet *
-FcCacheCopySet args(const FcCache *c)
+FcCacheCopySet args1(const FcCache *c)
{
FcFontSet *old = FcCacheSet (c);
FcFontSet *new = FcFontSetCreate ();
}
const FcChar8 *
-FcCacheSubdir args(const FcCache *c, int i)
+FcCacheSubdir args2(const FcCache *c, int i)
{
return FcCacheSubdir (c, i);
}
int
-FcCacheNumSubdir args(const FcCache *c)
+FcCacheNumSubdir args1(const FcCache *c)
{
return c->dirs_count;
}
int
-FcCacheNumFont args(const FcCache *c)
+FcCacheNumFont args1(const FcCache *c)
{
return FcCacheSet(c)->nfont;
}