From 302bf865f9c5873500d1302a43b9bdb95920c265 Mon Sep 17 00:00:00 2001 From: cpq Date: Tue, 13 Jul 2021 07:13:06 +0100 Subject: [PATCH] Fix #1310 - wrap _CRT_SECURE_NO_WARNINGS into #ifndef --- mongoose.h | 16 ++++++++++++---- src/arch.h | 4 ---- src/arch_win32.h | 12 ++++++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/mongoose.h b/mongoose.h index 54fd3fdb..3f6cb64e 100644 --- a/mongoose.h +++ b/mongoose.h @@ -48,10 +48,6 @@ extern "C" { #endif #endif // !defined(MG_ARCH) -#define WIN32_LEAN_AND_MEAN -#define _CRT_SECURE_NO_WARNINGS -#define _WINSOCK_DEPRECATED_NO_WARNINGS - #if !defined(PRINTF_LIKE) #if defined(__GNUC__) || defined(__clang__) || defined(__TI_COMPILER_VERSION__) #define PRINTF_LIKE(f, a) __attribute__((format(printf, f, a))) @@ -296,6 +292,18 @@ struct timeval { #if MG_ARCH == MG_ARCH_WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + +#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif + #include #include #include diff --git a/src/arch.h b/src/arch.h index da10088a..21339519 100644 --- a/src/arch.h +++ b/src/arch.h @@ -26,10 +26,6 @@ #endif #endif // !defined(MG_ARCH) -#define WIN32_LEAN_AND_MEAN -#define _CRT_SECURE_NO_WARNINGS -#define _WINSOCK_DEPRECATED_NO_WARNINGS - #if !defined(PRINTF_LIKE) #if defined(__GNUC__) || defined(__clang__) || defined(__TI_COMPILER_VERSION__) #define PRINTF_LIKE(f, a) __attribute__((format(printf, f, a))) diff --git a/src/arch_win32.h b/src/arch_win32.h index b0e6166d..a95c1119 100644 --- a/src/arch_win32.h +++ b/src/arch_win32.h @@ -2,6 +2,18 @@ #if MG_ARCH == MG_ARCH_WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + +#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif + #include #include #include