From ee2c9a3970dfa880d392fda06bbc3c8ae534b16a Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 11 Oct 2021 13:58:46 +0200 Subject: [PATCH] Fix stb compilation on Windows for TextureTool --- Source/ThirdParty/detex/detex.h | 3 ++- Source/ThirdParty/stb/stb_dxt.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/ThirdParty/detex/detex.h b/Source/ThirdParty/detex/detex.h index adbeac512..c52566679 100644 --- a/Source/ThirdParty/detex/detex.h +++ b/Source/ThirdParty/detex/detex.h @@ -34,6 +34,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define DETEX_HELPER_SHARED_IMPORT __declspec(dllimport) #define DETEX_HELPER_SHARED_EXPORT __declspec(dllexport) #define DETEX_HELPER_SHARED_LOCAL + #define DETEX_INLINE_ONLY __forceinline #else #if __GNUC__ >= 4 #define DETEX_HELPER_SHARED_IMPORT __attribute__ ((visibility ("default"))) @@ -44,6 +45,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define DETEX_HELPER_SHARED_EXPORT #define DETEX_HELPER_SHARED_LOCAL #endif + #define DETEX_INLINE_ONLY __attribute__((always_inline)) inline #endif /* Now we use the generic helper definitions above to define DETEX_API and DETEX_LOCAL. */ @@ -72,7 +74,6 @@ __BEGIN_DECLS #include #include -#define DETEX_INLINE_ONLY __attribute__((always_inline)) inline #define DETEX_RESTRICT __restrict /* Maximum uncompressed block size in bytes. */ diff --git a/Source/ThirdParty/stb/stb_dxt.h b/Source/ThirdParty/stb/stb_dxt.h index 04666de99..6a8a07704 100644 --- a/Source/ThirdParty/stb/stb_dxt.h +++ b/Source/ThirdParty/stb/stb_dxt.h @@ -317,7 +317,7 @@ static unsigned int stb__MatchColorsBlock(unsigned char *block, unsigned char *c static void stb__OptimizeColorsBlock(unsigned char *block, unsigned short *pmax16, unsigned short *pmin16) { int mind = 0x7fffffff,maxd = -0x7fffffff; - unsigned char *minp, *maxp; + unsigned char *minp = nullptr, *maxp = nullptr; double magn; int v_r,v_g,v_b; static const int nIterPower = 4;