From 9cde3f8b2e7a9382b69f4a8362812405273e7cec Mon Sep 17 00:00:00 2001 From: ds77 Date: Thu, 9 Feb 2017 18:12:00 +0100 Subject: [PATCH 01/12] use _stat64() on MinGW On MinGW, use _stat64() and struct _stat64 instead of stat() and struct stat_t. This fixes reporting incorrect sizes for large files. --- programs/util.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/programs/util.h b/programs/util.h index 651027ba..f5bd4230 100644 --- a/programs/util.h +++ b/programs/util.h @@ -141,7 +141,7 @@ UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond) /*-**************************************** * File functions ******************************************/ -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) #define chmod _chmod typedef struct _stat64 stat_t; #else @@ -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) { int r; -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) r = _stat64(infilename, statbuf); if (r || !(statbuf->st_mode & S_IFREG)) return 0; /* No good... */ #else @@ -186,7 +186,7 @@ UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf) UTIL_STATIC U64 UTIL_getFileSize(const char* infilename) { int r; -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) struct _stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ @@ -212,7 +212,7 @@ UTIL_STATIC U64 UTIL_getTotalFileSize(const char** fileNamesTable, unsigned nbFi UTIL_STATIC int UTIL_doesFileExists(const char* infilename) { int r; -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) struct _stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ @@ -228,7 +228,7 @@ UTIL_STATIC int UTIL_doesFileExists(const char* infilename) UTIL_STATIC U32 UTIL_isDirectory(const char* infilename) { int r; -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) struct _stat64 statbuf; r = _stat64(infilename, &statbuf); if (!r && (statbuf.st_mode & _S_IFDIR)) return 1; From 429e13099a81db842cd27c523f0e086a49827958 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 10 Feb 2017 10:36:44 +0100 Subject: [PATCH 02/12] fix 64-bit file support for MinGW --- programs/platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/platform.h b/programs/platform.h index f30528aa..5801f6ec 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -51,7 +51,7 @@ extern "C" { /* ********************************************************* * Turn on Large Files support (>4GB) for 32-bit Linux/Unix ***********************************************************/ -#if !defined(__64BIT__) /* No point defining Large file for 64 bit */ +#if !defined(__64BIT__) || defined(__MINGW32__) /* No point defining Large file for 64 bit but MinGW requires it */ # if !defined(_FILE_OFFSET_BITS) # define _FILE_OFFSET_BITS 64 /* turn off_t into a 64-bit type for ftello, fseeko */ # endif From 19f61b534e67e911ce888048aff3516dbdc3f7bd Mon Sep 17 00:00:00 2001 From: - <-> Date: Fri, 10 Feb 2017 10:56:45 +0100 Subject: [PATCH 03/12] use _stat64 only when targetting Win2k or later --- programs/util.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/programs/util.h b/programs/util.h index f5bd4230..b0f12363 100644 --- a/programs/util.h +++ b/programs/util.h @@ -141,7 +141,7 @@ UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond) /*-**************************************** * File functions ******************************************/ -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K #define chmod _chmod typedef struct _stat64 stat_t; #else @@ -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) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K r = _stat64(infilename, statbuf); if (r || !(statbuf->st_mode & S_IFREG)) return 0; /* No good... */ #else @@ -186,7 +186,7 @@ UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf) UTIL_STATIC U64 UTIL_getFileSize(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K struct _stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ @@ -212,7 +212,7 @@ UTIL_STATIC U64 UTIL_getTotalFileSize(const char** fileNamesTable, unsigned nbFi UTIL_STATIC int UTIL_doesFileExists(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K struct _stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ @@ -228,7 +228,7 @@ UTIL_STATIC int UTIL_doesFileExists(const char* infilename) UTIL_STATIC U32 UTIL_isDirectory(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K struct _stat64 statbuf; r = _stat64(infilename, &statbuf); if (!r && (statbuf.st_mode & _S_IFDIR)) return 1; From bdadb82d5d0f189992171b400f612ae484cee1ea Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 10 Feb 2017 11:01:52 +0100 Subject: [PATCH 04/12] fixed "mingw32" AppVeyor target --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index bfdbfe6c..950a2983 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ environment: MAKE_PARAMS: '"make test && make lib && make -C tests test-symbols fullbench-dll fullbench-lib"' PLATFORM: "mingw64" - COMPILER: "gcc" - MAKE_PARAMS: "make test" + MAKE_PARAMS: '"make test"' PLATFORM: "mingw32" - COMPILER: "visual" CONFIGURATION: "Debug" From cb8d2d9d963d054895c7411f573b6b94727685a9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 10 Feb 2017 12:01:14 +0100 Subject: [PATCH 05/12] appveyor.yml: add clang target --- appveyor.yml | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 950a2983..225515c0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,9 @@ version: 1.0.{build} environment: matrix: + - COMPILER: "gcc" + MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion"' + PLATFORM: "clang" - COMPILER: "gcc" MAKE_PARAMS: '"make test && make lib && make -C tests test-symbols fullbench-dll fullbench-lib"' PLATFORM: "mingw64" @@ -25,7 +28,6 @@ install: - MKDIR bin - if [%COMPILER%]==[gcc] SET PATH_ORIGINAL=%PATH% - if [%COMPILER%]==[gcc] ( - SET "CLANG_PARAMS=-C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion"" && SET "PATH_MINGW32=c:\MinGW\bin;c:\MinGW\usr\bin" && SET "PATH_MINGW64=c:\msys64\mingw64\bin;c:\msys64\usr\bin" && COPY C:\msys64\usr\bin\make.exe C:\MinGW\bin\make.exe && @@ -38,31 +40,7 @@ build_script: - ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION% - if [%PLATFORM%]==[mingw32] SET PATH=%PATH_MINGW32%;%PATH_ORIGINAL% - if [%PLATFORM%]==[mingw64] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL% - - if [%PLATFORM%]==[mingw64] ( - make clean && - ECHO *** && - ECHO *** Building clang && - ECHO *** && - ECHO make %CLANG_PARAMS% && - make %CLANG_PARAMS% && - COPY tests\fuzzer.exe tests\fuzzer_clang.exe && - ECHO *** && - ECHO *** Building cmake for %PLATFORM% && - ECHO *** && - mkdir build\cmake\build && - cd build\cmake\build && - cmake -G "Visual Studio 14 2015 Win64" .. && - cd ..\..\.. && - make clean && - ECHO *** && - ECHO *** Building pzstd for %PLATFORM% && - ECHO *** && - make -C contrib\pzstd googletest-mingw64 && - make -C contrib\pzstd pzstd.exe && - make -C contrib\pzstd tests && - make -C contrib\pzstd check && - make -C contrib\pzstd clean - ) + - if [%PLATFORM%]==[clang] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL% - if [%COMPILER%]==[gcc] ( ECHO *** && ECHO *** Building %PLATFORM% && @@ -72,6 +50,7 @@ build_script: ECHO %MAKE_PARAMS% && sh -c %MAKE_PARAMS% ) + - if [%PLATFORM%]==[clang] COPY tests\fuzzer.exe tests\fuzzer_clang.exe - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] ( COPY programs\zstd.exe bin\zstd.exe && appveyor PushArtifact bin\zstd.exe @@ -135,8 +114,24 @@ build_script: test_script: - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% - SET FUZZERTEST=-T1mn - - if [%COMPILER%]==[gcc] ( - if [%PLATFORM%]==[mingw64] tests\fuzzer_clang.exe %FUZZERTEST% + - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[clang] ( + tests\fuzzer_clang.exe %FUZZERTEST% && + ECHO *** && + ECHO *** Building cmake for %PLATFORM% && + ECHO *** && + mkdir build\cmake\build && + cd build\cmake\build && + cmake -G "Visual Studio 14 2015 Win64" .. && + cd ..\..\.. && + make clean && + ECHO *** && + ECHO *** Building pzstd for %PLATFORM% && + ECHO *** && + make -C contrib\pzstd googletest-mingw64 && + make -C contrib\pzstd pzstd.exe && + make -C contrib\pzstd tests && + make -C contrib\pzstd check && + make -C contrib\pzstd clean ) - if [%COMPILER%]==[visual] if [%CONFIGURATION%]==[Release] ( CD tests && From bc2bfa4c9ae2b78dbdeac6232cef4e1213a568b5 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 10 Feb 2017 12:32:30 +0100 Subject: [PATCH 06/12] fix missing " --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 225515c0..fecc5fed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,7 @@ version: 1.0.{build} environment: matrix: - COMPILER: "gcc" - MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion"' + MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion""' PLATFORM: "clang" - COMPILER: "gcc" MAKE_PARAMS: '"make test && make lib && make -C tests test-symbols fullbench-dll fullbench-lib"' From 70597841925a90f09827760ac8c5310cd0d43b8b Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 10 Feb 2017 12:41:31 +0100 Subject: [PATCH 07/12] appveyor.yml: reordering of tests --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index fecc5fed..d603e921 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,14 +2,14 @@ version: 1.0.{build} environment: matrix: - COMPILER: "gcc" - MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion""' PLATFORM: "clang" + MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion""' - COMPILER: "gcc" - MAKE_PARAMS: '"make test && make lib && make -C tests test-symbols fullbench-dll fullbench-lib"' PLATFORM: "mingw64" + MAKE_PARAMS: '"make test && make lib && make -C tests test-symbols fullbench-dll fullbench-lib"' - COMPILER: "gcc" - MAKE_PARAMS: '"make test"' PLATFORM: "mingw32" + MAKE_PARAMS: '"make -C test-zstd test-fullbench test-fuzzer test-invalidDictionaries"' - COMPILER: "visual" CONFIGURATION: "Debug" PLATFORM: "x64" From 192e20338f0da5e8f4224c78191256a37e9aa3f1 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 10 Feb 2017 13:10:25 +0100 Subject: [PATCH 08/12] appveyor.yml: fixed clang test --- appveyor.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d603e921..51ff488a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,15 +1,15 @@ version: 1.0.{build} environment: matrix: - - COMPILER: "gcc" - PLATFORM: "clang" - MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion""' - COMPILER: "gcc" PLATFORM: "mingw64" MAKE_PARAMS: '"make test && make lib && make -C tests test-symbols fullbench-dll fullbench-lib"' - COMPILER: "gcc" PLATFORM: "mingw32" - MAKE_PARAMS: '"make -C test-zstd test-fullbench test-fuzzer test-invalidDictionaries"' + MAKE_PARAMS: '"make -C tests test-zstd test-fullbench test-fuzzer test-invalidDictionaries"' + - COMPILER: "gcc" + PLATFORM: "clang" + MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion""' - COMPILER: "visual" CONFIGURATION: "Debug" PLATFORM: "x64" From 7ec315df0dd4bef8921bceb089bdbea2b88a9382 Mon Sep 17 00:00:00 2001 From: - <-> Date: Fri, 10 Feb 2017 13:27:43 +0100 Subject: [PATCH 09/12] 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) --- programs/util.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/programs/util.h b/programs/util.h index b0f12363..fe3d8448 100644 --- a/programs/util.h +++ b/programs/util.h @@ -141,9 +141,9 @@ UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond) /*-**************************************** * 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 - typedef struct _stat64 stat_t; + typedef struct __stat64 stat_t; #else typedef struct stat stat_t; #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) { 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); if (r || !(statbuf->st_mode & S_IFREG)) return 0; /* No good... */ #else @@ -186,8 +186,8 @@ UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf) UTIL_STATIC U64 UTIL_getFileSize(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K - struct _stat64 statbuf; +#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K + struct __stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ #else @@ -212,8 +212,8 @@ UTIL_STATIC U64 UTIL_getTotalFileSize(const char** fileNamesTable, unsigned nbFi UTIL_STATIC int UTIL_doesFileExists(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K - struct _stat64 statbuf; +#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K + struct __stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ #else @@ -228,8 +228,8 @@ UTIL_STATIC int UTIL_doesFileExists(const char* infilename) UTIL_STATIC U32 UTIL_isDirectory(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K - struct _stat64 statbuf; +#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K + struct __stat64 statbuf; r = _stat64(infilename, &statbuf); if (!r && (statbuf.st_mode & _S_IFDIR)) return 1; #else From 45f0c207ab8e3955a6068cc845eceb175623fd63 Mon Sep 17 00:00:00 2001 From: ds77 Date: Fri, 10 Feb 2017 18:37:57 +0100 Subject: [PATCH 10/12] use _stati64() in UTIL_getFileSize() when compiling with mingw, get rid of introduces previously preprocessor checks. --- programs/util.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/programs/util.h b/programs/util.h index fe3d8448..b1217910 100644 --- a/programs/util.h +++ b/programs/util.h @@ -141,7 +141,7 @@ UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond) /*-**************************************** * File functions ******************************************/ -#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K +#if defined(_MSC_VER) #define chmod _chmod typedef struct __stat64 stat_t; #else @@ -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) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K +#if defined(_MSC_VER) r = _stat64(infilename, statbuf); if (r || !(statbuf->st_mode & S_IFREG)) return 0; /* No good... */ #else @@ -186,10 +186,14 @@ UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf) UTIL_STATIC U64 UTIL_getFileSize(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K - struct __stat64 statbuf; +#if defined(_MSC_VER) + 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); @@ -212,7 +216,7 @@ UTIL_STATIC U64 UTIL_getTotalFileSize(const char** fileNamesTable, unsigned nbFi UTIL_STATIC int UTIL_doesFileExists(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K +#if defined(_MSC_VER) struct __stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ @@ -228,7 +232,7 @@ UTIL_STATIC int UTIL_doesFileExists(const char* infilename) UTIL_STATIC U32 UTIL_isDirectory(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) && defined(__MSVCRT__) && _WIN32_WINNT >= _WIN32_WINNT_WIN2K +#if defined(_MSC_VER) struct __stat64 statbuf; r = _stat64(infilename, &statbuf); if (!r && (statbuf.st_mode & _S_IFDIR)) return 1; From 645f5b98563d584e7a12aa7179c05252688acdd4 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 10 Feb 2017 20:09:28 +0100 Subject: [PATCH 11/12] fix for original MinGW --- programs/platform.h | 2 +- programs/util.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/programs/platform.h b/programs/platform.h index 5aeee332..1b53e1f8 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -51,7 +51,7 @@ extern "C" { /* ********************************************************* * Turn on Large Files support (>4GB) for 32-bit Linux/Unix ***********************************************************/ -#if !defined(__64BIT__) || defined(__MINGW32__) /* No point defining Large file for 64 bit but MinGW requires it */ +#if !defined(__64BIT__) /* No point defining Large file for 64 bit */ # if !defined(_FILE_OFFSET_BITS) # define _FILE_OFFSET_BITS 64 /* turn off_t into a 64-bit type for ftello, fseeko */ # endif diff --git a/programs/util.h b/programs/util.h index 656b3a96..58077ccc 100644 --- a/programs/util.h +++ b/programs/util.h @@ -141,9 +141,9 @@ UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond) /*-**************************************** * File functions ******************************************/ -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) #define chmod _chmod - typedef struct _stat64 stat_t; + typedef struct __stat64 stat_t; #else typedef struct stat stat_t; #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) { int r; -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__MINGW32__) r = _stat64(infilename, statbuf); if (r || !(statbuf->st_mode & S_IFREG)) return 0; /* No good... */ #else @@ -186,8 +186,8 @@ UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf) UTIL_STATIC U64 UTIL_getFileSize(const char* infilename) { int r; -#if defined(_MSC_VER) - struct _stat64 statbuf; +#if defined(_MSC_VER) || defined(__MINGW32__) + struct __stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ #else From eb132530cd13031a9d48adfada2b166b1aa488dc Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 10 Feb 2017 21:15:49 +0100 Subject: [PATCH 12/12] revert last commit --- programs/util.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/programs/util.h b/programs/util.h index 58077ccc..656b3a96 100644 --- a/programs/util.h +++ b/programs/util.h @@ -141,9 +141,9 @@ UTIL_STATIC void UTIL_waitForNextTick(UTIL_time_t ticksPerSecond) /*-**************************************** * File functions ******************************************/ -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) #define chmod _chmod - typedef struct __stat64 stat_t; + typedef struct _stat64 stat_t; #else typedef struct stat stat_t; #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) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) r = _stat64(infilename, statbuf); if (r || !(statbuf->st_mode & S_IFREG)) return 0; /* No good... */ #else @@ -186,8 +186,8 @@ UTIL_STATIC int UTIL_getFileStat(const char* infilename, stat_t *statbuf) UTIL_STATIC U64 UTIL_getFileSize(const char* infilename) { int r; -#if defined(_MSC_VER) || defined(__MINGW32__) - struct __stat64 statbuf; +#if defined(_MSC_VER) + struct _stat64 statbuf; r = _stat64(infilename, &statbuf); if (r || !(statbuf.st_mode & S_IFREG)) return 0; /* No good... */ #else