Avoid using |WIN32| and use |OPENSSL_WINDOWS| instead.
MSVC and clang-cl automatically define |_WIN32| but |WIN32| is only
defined if a Windows header file has been included or if -DWIN32 was
passed on the command line. Thus, it is always better to test |_WIN32|
than |WIN32|. The convention in BoringSSL is to test |OPENSSL_WINDOWS|
instead, except for the place where |OPENSSL_WINDOWS| is defined.
Change-Id: Icf3e03958895be32efe800e689d5ed6a2fed215f
Reviewed-on: https://boringssl-review.googlesource.com/5553
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/bio/file.c b/crypto/bio/file.c
index 5d46131..cef33b6 100644
--- a/crypto/bio/file.c
+++ b/crypto/bio/file.c
@@ -88,7 +88,7 @@
#define BIO_FP_APPEND 0x08
static FILE *open_file(const char *filename, const char *mode) {
-#if defined(_WIN32) && defined(CP_UTF8)
+#if defined(OPENSSL_WINDOWS) && defined(CP_UTF8)
int sz, len_0 = (int)strlen(filename) + 1;
DWORD flags;
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 417d322..24824e8 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -633,7 +633,7 @@
}
if (library == ERR_LIB_SYS && reason == 0) {
-#if defined(WIN32)
+#if defined(OPENSSL_WINDOWS)
reason = GetLastError();
#else
reason = errno;
diff --git a/include/openssl/base.h b/include/openssl/base.h
index 4618ed2..de14ff4 100644
--- a/include/openssl/base.h
+++ b/include/openssl/base.h
@@ -98,7 +98,7 @@
#define OPENSSL_APPLE
#endif
-#if defined(WIN32) || defined(_WIN32)
+#if defined(_WIN32)
#define OPENSSL_WINDOWS
#endif