Fix MinGW stat redefinition and thread-safe localtime
- Guard #define stat _stat with !defined(__MINGW32__) to avoid conflicts with MinGW's own POSIX-compliant stat implementation - Replace _MSC_VER check with defined(_WIN32) for localtime_s to allow all Windows compilers including MinGW to use the secure function Fixes #3038, #3037
This commit is contained in:
@@ -99,7 +99,7 @@ void mju_writeLog(const char* type, const char* msg) {
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(__APPLE__) || defined(__STDC_VERSION_TIME_H__) || defined(__EMSCRIPTEN__)
|
||||
localtime_r(&rawtime, &timeinfo);
|
||||
#elif _MSC_VER
|
||||
#elif defined(_WIN32)
|
||||
localtime_s(&timeinfo, &rawtime);
|
||||
#elif __STDC_LIB_EXT1__
|
||||
localtime_s(&rawtime, &timeinfo);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "user/user_vfs.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
#define stat _stat
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user