Always define FcStat as a function

Such that first arg is const char *.  We also need to make more changes
in that function as part of some other bug.
This commit is contained in:
Behdad Esfahbod 2011-03-14 18:49:21 -03:00
parent b5617e636c
commit c21fb9ac27
5 changed files with 15 additions and 10 deletions

View File

@ -142,7 +142,7 @@ FcAtomicLock (FcAtomic *atomic)
* machines sharing the same filesystem will have clocks
* reasonably close to each other.
*/
if (FcStat ((char *) atomic->lck, &lck_stat) >= 0)
if (FcStat (atomic->lck, &lck_stat) >= 0)
{
time_t now = time (0);
if ((long int) (now - lck_stat.st_mtime) > 10 * 60)

View File

@ -132,6 +132,15 @@ FcStat (const char *file, struct stat *statb)
return 0;
}
#else
int
FcStat (const char *file, struct stat *statb)
{
return stat ((char *) file, statb);
}
#endif
static const char bin2hex[] = { '0', '1', '2', '3',
@ -234,7 +243,7 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
struct stat file_stat, dir_stat;
FcBool ret = FcFalse;
if (FcStat ((char *) dir, &dir_stat) < 0)
if (FcStat (dir, &dir_stat) < 0)
return FcFalse;
FcDirCacheBasename (dir, cache_base);
@ -516,7 +525,7 @@ FcCacheTimeValid (FcCache *cache, struct stat *dir_stat)
if (!dir_stat)
{
if (FcStat ((const char *) FcCacheDir (cache), &dir_static) < 0)
if (FcStat (FcCacheDir (cache), &dir_static) < 0)
return FcFalse;
dir_stat = &dir_static;
}

View File

@ -131,7 +131,7 @@ FcConfigNewestFile (FcStrSet *files)
if (list)
{
while ((file = FcStrListNext (list)))
if (FcStat ((char *) file, &statb) == 0)
if (FcStat (file, &statb) == 0)
if (!newest.set || statb.st_mtime - newest.time > 0)
{
newest.set = FcTrue;

View File

@ -30,7 +30,7 @@ FcFileIsDir (const FcChar8 *file)
{
struct stat statb;
if (FcStat ((const char *) file, &statb) != 0)
if (FcStat (file, &statb) != 0)
return FcFalse;
return S_ISDIR(statb.st_mode);
}
@ -243,7 +243,7 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
if (FcDebug () & FC_DBG_FONTSET)
printf ("cache scan dir %s\n", dir);
if (FcStat ((char *) dir, &dir_stat) < 0)
if (FcStat (dir, &dir_stat) < 0)
{
if (errno != ENOENT)
ret = FcFalse;

View File

@ -544,12 +544,8 @@ FcCacheFini (void);
FcPrivate void
FcDirCacheReference (FcCache *cache, int nref);
#ifdef _WIN32
FcPrivate int
FcStat (const char *file, struct stat *statb);
#else
#define FcStat stat
#endif
/* fccfg.c */