mirror of
https://github.com/facebook/zstd.git
synced 2025-08-07 06:23:00 +03:00
fix previous commit
* struct _stat64 is not defined by (non-w64) MinGW releases, __stat64 should be everywhere * proper detection of _stat64() availability (as in MinGW sys/stat.h)
This commit is contained in:
@@ -141,9 +141,9 @@ UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond)
|
|||||||
/*-****************************************
|
/*-****************************************
|
||||||
* File functions
|
* File functions
|
||||||
******************************************/
|
******************************************/
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
||||||
#define chmod _chmod
|
#define chmod _chmod
|
||||||
typedef struct _stat64 stat_t;
|
typedef struct __stat64 stat_t;
|
||||||
#else
|
#else
|
||||||
typedef struct stat stat_t;
|
typedef struct stat stat_t;
|
||||||
#endif
|
#endif
|
||||||
@@ -172,7 +172,7 @@ UTIL_STATIC int UTIL_setFileStat(const char *filename, stat_t *statbuf)
|
|||||||
UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf)
|
UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
||||||
r = _stat64(infilename, statbuf);
|
r = _stat64(infilename, statbuf);
|
||||||
if (r || !(statbuf->st_mode & S_IFREG)) return 0; /* No good... */
|
if (r || !(statbuf->st_mode & S_IFREG)) return 0; /* No good... */
|
||||||
#else
|
#else
|
||||||
@@ -186,8 +186,8 @@ UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf)
|
|||||||
UTIL_STATIC U64 UTIL_getFileSize(const char* infilename)
|
UTIL_STATIC U64 UTIL_getFileSize(const char* infilename)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
||||||
struct _stat64 statbuf;
|
struct __stat64 statbuf;
|
||||||
r = _stat64(infilename, &statbuf);
|
r = _stat64(infilename, &statbuf);
|
||||||
if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */
|
if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */
|
||||||
#else
|
#else
|
||||||
@@ -212,8 +212,8 @@ UTIL_STATIC U64 UTIL_getTotalFileSize(const char** fileNamesTable, unsigned nbFi
|
|||||||
UTIL_STATIC int UTIL_doesFileExists(const char* infilename)
|
UTIL_STATIC int UTIL_doesFileExists(const char* infilename)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
||||||
struct _stat64 statbuf;
|
struct __stat64 statbuf;
|
||||||
r = _stat64(infilename, &statbuf);
|
r = _stat64(infilename, &statbuf);
|
||||||
if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */
|
if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */
|
||||||
#else
|
#else
|
||||||
@@ -228,8 +228,8 @@ UTIL_STATIC int UTIL_doesFileExists(const char* infilename)
|
|||||||
UTIL_STATIC U32 UTIL_isDirectory(const char* infilename)
|
UTIL_STATIC U32 UTIL_isDirectory(const char* infilename)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K
|
||||||
struct _stat64 statbuf;
|
struct __stat64 statbuf;
|
||||||
r = _stat64(infilename, &statbuf);
|
r = _stat64(infilename, &statbuf);
|
||||||
if (!r && (statbuf.st_mode & _S_IFDIR)) return 1;
|
if (!r && (statbuf.st_mode & _S_IFDIR)) return 1;
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user