Fix incompatible API on AIX with random_r and initstate_r

https://bugs.freedesktop.org/show_bug.cgi?id=74603
This commit is contained in:
Akira TAGOH 2014-02-06 19:40:01 +09:00
parent 7d75653285
commit e310d2fac2
1 changed files with 24 additions and 11 deletions

View File

@ -170,14 +170,27 @@ FcRandom(void)
static struct random_data fcrandbuf;
static char statebuf[256];
static FcBool initialized = FcFalse;
#ifdef _AIX
static char *retval;
long res;
#endif
if (initialized != FcTrue)
{
#ifdef _AIX
initstate_r (time (NULL), statebuf, 256, &retval, &fcrandbuf);
#else
initstate_r (time (NULL), statebuf, 256, &fcrandbuf);
#endif
initialized = FcTrue;
}
#ifdef _AIX
random_r (&res, &fcrandbuf);
result = (int32_t)res;
#else
random_r (&fcrandbuf, &result);
#endif
#elif HAVE_RANDOM
static char statebuf[256];
char *state;