Merge pull request #540 from ds77/dev-stat64-fix

zstdcli: Fix reporting incorrect sizes of large flies on MinGW
dev
Yann Collet 2017-02-11 21:08:08 -08:00 committed by GitHub
commit acfa151622
1 changed files with 7 additions and 3 deletions

View File

@ -143,7 +143,7 @@ UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond)
******************************************/
#if defined(_MSC_VER)
#define chmod _chmod
typedef struct _stat64 stat_t;
typedef struct __stat64 stat_t;
#else
typedef struct stat stat_t;
#endif
@ -190,6 +190,10 @@ UTIL_STATIC U64 UTIL_getFileSize(const char* infilename)
struct _stat64 statbuf;
r = _stat64(infilename, &statbuf);
if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */
#elif defined(__MINGW32__) && defined (__MSVCRT__)
struct _stati64 statbuf;
r = _stati64(infilename, &statbuf);
if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */
#else
struct stat statbuf;
r = stat(infilename, &statbuf);
@ -213,7 +217,7 @@ UTIL_STATIC int UTIL_doesFileExists(const char* infilename)
{
int r;
#if defined(_MSC_VER)
struct _stat64 statbuf;
struct __stat64 statbuf;
r = _stat64(infilename, &statbuf);
if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */
#else
@ -229,7 +233,7 @@ UTIL_STATIC U32 UTIL_isDirectory(const char* infilename)
{
int r;
#if defined(_MSC_VER)
struct _stat64 statbuf;
struct __stat64 statbuf;
r = _stat64(infilename, &statbuf);
if (!r && (statbuf.st_mode & _S_IFDIR)) return 1;
#else