Fix MinGW-w64 build of TinyEXR for old toolchains
MinGW-w64 is at version 2.0.1 on our current Travis CI toolchain, and seems not to like fopen_s.
This commit is contained in:
parent
b93fce1c18
commit
37f5e1dcd9
40
thirdparty/tinyexr/tinyexr.h
vendored
40
thirdparty/tinyexr/tinyexr.h
vendored
@ -85,6 +85,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <stddef.h> // for size_t
|
#include <stddef.h> // for size_t
|
||||||
#include <stdint.h> // guess stdint.h is available(C99)
|
#include <stdint.h> // guess stdint.h is available(C99)
|
||||||
|
|
||||||
|
// -- GODOT change for old MinGW on Travis CI --
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
#include <_mingw.h> // for __MINGW64_VERSION_MAJOR
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -4514,7 +4519,10 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h,
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW64__)
|
// -- GODOT change for old MinGW on Travis CI --
|
||||||
|
//#if defined(_MSC_VER) || defined(__MINGW64__)
|
||||||
|
#if defined(_MSC_VER) || (defined(__MINGW32__) && __MINGW64_VERSION_MAJOR >= 3)
|
||||||
|
// -- GODOT end --
|
||||||
static FILE *mz_fopen(const char *pFilename, const char *pMode) {
|
static FILE *mz_fopen(const char *pFilename, const char *pMode) {
|
||||||
FILE *pFile = NULL;
|
FILE *pFile = NULL;
|
||||||
fopen_s(&pFile, pFilename, pMode);
|
fopen_s(&pFile, pFilename, pMode);
|
||||||
@ -10822,7 +10830,10 @@ int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header,
|
|||||||
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
// -- GODOT change for old MinGW on Travis CI --
|
||||||
|
//#ifdef _WIN32
|
||||||
|
#if defined(_MSC_VER) || (defined(__MINGW32__) && __MINGW64_VERSION_MAJOR >= 3)
|
||||||
|
// -- GODOT end --
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
fopen_s(&fp, filename, "rb");
|
fopen_s(&fp, filename, "rb");
|
||||||
#else
|
#else
|
||||||
@ -11411,7 +11422,10 @@ int SaveEXRImageToFile(const EXRImage *exr_image, const EXRHeader *exr_header,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
// -- GODOT change for old MinGW on Travis CI --
|
||||||
|
//#ifdef _WIN32
|
||||||
|
#if defined(_MSC_VER) || (defined(__MINGW32__) && __MINGW64_VERSION_MAJOR >= 3)
|
||||||
|
// -- GODOT end --
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
fopen_s(&fp, filename, "wb");
|
fopen_s(&fp, filename, "wb");
|
||||||
#else
|
#else
|
||||||
@ -11892,7 +11906,10 @@ int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version,
|
|||||||
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
// -- GODOT change for old MinGW on Travis CI --
|
||||||
|
//#ifdef _WIN32
|
||||||
|
#if defined(_MSC_VER) || (defined(__MINGW32__) && __MINGW64_VERSION_MAJOR >= 3)
|
||||||
|
// -- GODOT end --
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
fopen_s(&fp, filename, "rb");
|
fopen_s(&fp, filename, "rb");
|
||||||
#else
|
#else
|
||||||
@ -12016,7 +12033,10 @@ int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers,
|
|||||||
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
// -- GODOT change for old MinGW on Travis CI --
|
||||||
|
//#ifdef _WIN32
|
||||||
|
#if defined(_MSC_VER) || (defined(__MINGW32__) && __MINGW64_VERSION_MAJOR >= 3)
|
||||||
|
// -- GODOT end --
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
fopen_s(&fp, filename, "rb");
|
fopen_s(&fp, filename, "rb");
|
||||||
#else
|
#else
|
||||||
@ -12116,7 +12136,10 @@ int ParseEXRVersionFromFile(EXRVersion *version, const char *filename) {
|
|||||||
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
// -- GODOT change for old MinGW on Travis CI --
|
||||||
|
//#ifdef _WIN32
|
||||||
|
#if defined(_MSC_VER) || (defined(__MINGW32__) && __MINGW64_VERSION_MAJOR >= 3)
|
||||||
|
// -- GODOT end --
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
fopen_s(&fp, filename, "rb");
|
fopen_s(&fp, filename, "rb");
|
||||||
#else
|
#else
|
||||||
@ -12254,7 +12277,10 @@ int LoadEXRMultipartImageFromFile(EXRImage *exr_images,
|
|||||||
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
return TINYEXR_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
// -- GODOT change for old MinGW on Travis CI --
|
||||||
|
//#ifdef _WIN32
|
||||||
|
#if defined(_MSC_VER) || (defined(__MINGW32__) && __MINGW64_VERSION_MAJOR >= 3)
|
||||||
|
// -- GODOT end --
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
fopen_s(&fp, filename, "rb");
|
fopen_s(&fp, filename, "rb");
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user