From ea4e7b266978e6db5e929fe625db4fb6823d9221 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Mon, 26 Aug 2019 13:19:53 -0600 Subject: [PATCH 1/2] Resolve XSNPRINTF unconditional use in asn.c breaking mingw32 builds --- wolfssl/wolfcrypt/types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 0b4caf6ca..24aa6b4b4 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -440,8 +440,8 @@ #define XSNPRINTF snprintf #endif #else - #ifdef _MSC_VER - #if (_MSC_VER >= 1900) + #if defined(_MSC_VER) || defined(__GNUC__) || defined(__MINGW32__) + #if defined(_MSC_VER) && (_MSC_VER >= 1900) /* Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf is no longer identical to _snprintf. The snprintf function behavior is now @@ -467,7 +467,7 @@ } #define XSNPRINTF xsnprintf #endif /* (_MSC_VER >= 1900) */ - #endif /* _MSC_VER */ + #endif /* _MSC_VER || __GNUC__ || __MINGW32__ */ #endif /* USE_WINDOWS_API */ #if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN) From 6f9210d6afe543a60e8cf9fd5619948ba42e0715 Mon Sep 17 00:00:00 2001 From: Kaleb Himes Date: Mon, 26 Aug 2019 16:53:52 -0600 Subject: [PATCH 2/2] Peer review feedback changes Case ```__GNUC__``` already covered, just check for MINGW or CYGWIN cases now. --- wolfssl/wolfcrypt/types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 24aa6b4b4..33cfd6cc1 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -440,7 +440,7 @@ #define XSNPRINTF snprintf #endif #else - #if defined(_MSC_VER) || defined(__GNUC__) || defined(__MINGW32__) + #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) #if defined(_MSC_VER) && (_MSC_VER >= 1900) /* Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf is no longer identical to @@ -467,7 +467,7 @@ } #define XSNPRINTF xsnprintf #endif /* (_MSC_VER >= 1900) */ - #endif /* _MSC_VER || __GNUC__ || __MINGW32__ */ + #endif /* _MSC_VER || __CYGWIN__ || __MINGW32__ */ #endif /* USE_WINDOWS_API */ #if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN)