From: Behdad Esfahbod Date: Mon, 14 Mar 2011 21:49:21 +0000 (-0300) Subject: Always define FcStat as a function X-Git-Tag: root-2~22 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=c21fb9ac27ca89f3b581c58b1a08372f8273a262;p=fontconfig.git 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. --- diff --git a/src/fcatomic.c b/src/fcatomic.c index 81b5f6a..33c1cc6 100644 --- a/src/fcatomic.c +++ b/src/fcatomic.c @@ -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) diff --git a/src/fccache.c b/src/fccache.c index 1bbd799..d865266 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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; } diff --git a/src/fccfg.c b/src/fccfg.c index 6812781..4beb7d2 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -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; diff --git a/src/fcdir.c b/src/fcdir.c index e6b66ce..359446c 100644 --- a/src/fcdir.c +++ b/src/fcdir.c @@ -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; diff --git a/src/fcint.h b/src/fcint.h index a2313df..83a7a43 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -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 */