vcpkg/ports/assimp/4542.patch

82 lines
3.4 KiB
Diff
Raw Normal View History

From affa85a36bbd329c8792b553f64188c1d3a58188 Mon Sep 17 00:00:00 2001
From: hgdagon <hgdagon@gmail.com>
Date: Wed, 25 May 2022 07:59:01 -0700
Subject: [PATCH 1/2] Fix GNUC check on Windows
---
code/Common/DefaultIOStream.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/Common/DefaultIOStream.cpp b/code/Common/DefaultIOStream.cpp
index 17fc44f9a2..bbc3b2080f 100644
--- a/code/Common/DefaultIOStream.cpp
+++ b/code/Common/DefaultIOStream.cpp
@@ -63,7 +63,7 @@ inline int select_fseek(FILE *file, int64_t offset, int origin) {
-#if defined _WIN64 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
+#if defined _WIN32 && !defined __GNUC__ && __MSVCRT_VERSION__ >= 0x0601
template <>
inline size_t select_ftell<8>(FILE *file) {
return (size_t)::_ftelli64(file);
@@ -74,7 +74,7 @@ inline int select_fseek<8>(FILE *file, int64_t offset, int origin) {
return ::_fseeki64(file, offset, origin);
}
-#endif // #if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
+#endif // #if defined _WIN32 && !defined __GNUC__ && __MSVCRT_VERSION__ >= 0x0601
} // namespace
@@ -149,7 +149,7 @@ size_t DefaultIOStream::FileSize() const {
//
// See here for details:
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
-#if defined _WIN64 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
+#if defined _WIN32 && !defined __GNUC__ && __MSVCRT_VERSION__ >= 0x0601
struct __stat64 fileStat;
//using fileno + fstat avoids having to handle the filename
int err = _fstat64(_fileno(mFile), &fileStat);
From efbcdccac99a66d513731a2f5af65211c734cfe7 Mon Sep 17 00:00:00 2001
From: hgdagon <hgdagon@gmail.com>
Date: Wed, 25 May 2022 09:18:42 -0700
Subject: [PATCH 2/2] Fix GNUC check on Windows (2nd attempt)
---
code/Common/DefaultIOStream.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/Common/DefaultIOStream.cpp b/code/Common/DefaultIOStream.cpp
index bbc3b2080f..d5d5846897 100644
--- a/code/Common/DefaultIOStream.cpp
+++ b/code/Common/DefaultIOStream.cpp
@@ -63,7 +63,7 @@ inline int select_fseek(FILE *file, int64_t offset, int origin) {
-#if defined _WIN32 && !defined __GNUC__ && __MSVCRT_VERSION__ >= 0x0601
+#if defined _WIN32 && (!defined __GNUC__ || !defined __CLANG__ && __MSVCRT_VERSION__ >= 0x0601)
template <>
inline size_t select_ftell<8>(FILE *file) {
return (size_t)::_ftelli64(file);
@@ -74,7 +74,7 @@ inline int select_fseek<8>(FILE *file, int64_t offset, int origin) {
return ::_fseeki64(file, offset, origin);
}
-#endif // #if defined _WIN32 && !defined __GNUC__ && __MSVCRT_VERSION__ >= 0x0601
+#endif
} // namespace
@@ -149,7 +149,7 @@ size_t DefaultIOStream::FileSize() const {
//
// See here for details:
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
-#if defined _WIN32 && !defined __GNUC__ && __MSVCRT_VERSION__ >= 0x0601
+#if defined _WIN32 && (!defined __GNUC__ || !defined __CLANG__ && __MSVCRT_VERSION__ >= 0x0601)
struct __stat64 fileStat;
//using fileno + fstat avoids having to handle the filename
int err = _fstat64(_fileno(mFile), &fileStat);