libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 738ba14cc90436fa71d709f27ba8baa9b97897fc
parent b7cfbdeaf07b4d10f0f117d9fdf66b9f054a311c
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Thu,  3 Dec 2015 11:53:12 +0000

Add support for native snprintf() on W32.

Diffstat:
Mconfigure.ac | 2+-
Msrc/include/platform_interface.h | 10+++++++---
Mw32/common/MHD_config.h | 5+++++
3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -450,7 +450,7 @@ if test "x$enable_socketpair" = "xyes"; then AC_DEFINE([[MHD_DONT_USE_PIPES]], [[1]], [Define to use pair of sockets instead of pipes for signaling]) fi -AC_CHECK_FUNCS_ONCE([memmem accept4]) +AC_CHECK_FUNCS_ONCE([accept4 memmem snprintf]) AC_MSG_CHECKING([[for gmtime_s]]) AC_LINK_IFELSE( [AC_LANG_PROGRAM( diff --git a/src/include/platform_interface.h b/src/include/platform_interface.h @@ -73,11 +73,15 @@ #endif /* Platform-independent snprintf name */ -#if !defined(_WIN32) || defined(__CYGWIN__) +#if defined(HAVE_SNPRINTF) #define MHD_snprintf_ snprintf -#else +#else /* ! HAVE_SNPRINTF */ +#if defined(_WIN32) #define MHD_snprintf_ W32_snprintf -#endif +#else /* ! _WIN32*/ +#error Your platform does not support snprintf() and MHD does not know how to emulate it on your platform. +#endif /* ! _WIN32*/ +#endif /* ! HAVE_SNPRINTF */ /** diff --git a/w32/common/MHD_config.h b/w32/common/MHD_config.h @@ -68,6 +68,11 @@ /* Define to 1 if you have the `gmtime_s' function. */ #define HAVE_GMTIME_S 1 +#if _MSC_VER >= 1900 /* snprintf() supported natively since VS2015 */ +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 +#endif + /* *** Headers information *** */ /* Not really important as not used by code currently */