commit d9506b7d29edd83c707124b1eae62679098fda30 parent d56c41f6f7f72a089b309fb2b310388bb5e33be4 Author: Evgeny Grin (Karlson2k) <k2k@narod.ru> Date: Sun, 21 Apr 2019 14:40:45 +0300 Headers: better compatibility with MSVC compiler Diffstat:
| M | src/include/mhd_options.h | | | 4 | ++++ |
| M | src/include/microhttpd.h | | | 20 | +++++++++++--------- |
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h @@ -83,6 +83,10 @@ #endif #if defined(_WIN32) && ! defined(__CYGWIN__) +/* Declare POSIX-compatible names */ +#define _CRT_DECLARE_NONSTDC_NAMES 1 +/* Do not warn about POSIX name usage */ +#define _CRT_NONSTDC_NO_WARNINGS 1 #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501 #else /* _WIN32_WINNT */ diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -101,20 +101,22 @@ extern "C" on platforms where they do not exist). */ #ifndef MHD_PLATFORM_H -#include <stdarg.h> -#include <stdint.h> -#include <sys/types.h> -#if defined(_WIN32) && !defined(__CYGWIN__) +#if !defined(_WIN32) || defined(__CYGWIN__) +#include <unistd.h> +#include <sys/time.h> +#include <sys/socket.h> +#else /* _WIN32 && ! __CYGWIN__ */ +/* Declare POSIX-compatible names */ +#define _CRT_DECLARE_NONSTDC_NAMES 1 #include <ws2tcpip.h> #if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED) #define _SSIZE_T_DEFINED typedef intptr_t ssize_t; #endif /* !_SSIZE_T_DEFINED */ -#else -#include <unistd.h> -#include <sys/time.h> -#include <sys/socket.h> -#endif +#endif /* _WIN32 && ! __CYGWIN__ */ +#include <stdarg.h> +#include <stdint.h> +#include <sys/types.h> #endif #if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET)