From b3ff8db736b04013f17c7012bc2c1b505446d586 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Tue, 25 Jun 2024 15:42:00 +0200 Subject: [PATCH] crnlib: use native fopen/fseek/ftell on MinGW --- crnlib/crn_platform.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crnlib/crn_platform.h b/crnlib/crn_platform.h index caccb595..a120f321 100644 --- a/crnlib/crn_platform.h +++ b/crnlib/crn_platform.h @@ -18,7 +18,11 @@ const bool c_crnlib_little_endian_platform = false; const bool c_crnlib_big_endian_platform = !c_crnlib_little_endian_platform; -#if defined(__linux__) +#if defined(_WIN32) +#define crn_fopen(pDstFile, f, m) fopen_s(pDstFile, f, m) +#define crn_fseek _fseeki64 +#define crn_ftell _ftelli64 +#elif defined(__linux__) #define crn_fopen(pDstFile, f, m) *(pDstFile) = fopen64(f, m) #define crn_fseek fseeko64 #define crn_ftell ftello64 @@ -28,10 +32,6 @@ const bool c_crnlib_big_endian_platform = !c_crnlib_little_endian_platform; #define crn_fopen(pDstFile, f, m) *(pDstFile) = fopen(f, m) #define crn_fseek fseeko #define crn_ftell ftello -#elif defined(_MSC_VER) -#define crn_fopen(pDstFile, f, m) fopen_s(pDstFile, f, m) -#define crn_fseek _fseeki64 -#define crn_ftell _ftelli64 #else #define crn_fopen(pDstFile, f, m) *(pDstFile) = fopen(f, m) #define crn_fseek(s, o, w) fseek(s, static_cast(o), w)