From: Rosen Penev Date: Thu, 14 Sep 2023 03:51:49 +0000 (-0700) Subject: rename WIN32 to _WIN32 X-Git-Tag: json-c-0.18-20240915~16^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F831%2Fhead;p=thirdparty%2Fjson-c.git rename WIN32 to _WIN32 The latter is the proper macro defined by Windows headers. Fixes compilation under at least clang-cl which mandates function declarations. Signed-off-by: Rosen Penev --- diff --git a/json_util.c b/json_util.c index 0f570f23..4da3efb4 100644 --- a/json_util.c +++ b/json_util.c @@ -37,13 +37,13 @@ #include #endif /* HAVE_UNISTD_H */ -#ifdef WIN32 +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include #include -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ -#if !defined(HAVE_OPEN) && defined(WIN32) +#if !defined(HAVE_OPEN) && defined(_WIN32) #define open _open #endif diff --git a/random_seed.c b/random_seed.c index a033fac2..a93c8b97 100644 --- a/random_seed.c +++ b/random_seed.c @@ -254,7 +254,7 @@ static int get_dev_random_seed(int *seed) /* get_cryptgenrandom_seed */ -#ifdef WIN32 +#ifdef _WIN32 #define HAVE_CRYPTGENRANDOM 1 diff --git a/snprintf_compat.h b/snprintf_compat.h index 51fcb24a..64091e67 100644 --- a/snprintf_compat.h +++ b/snprintf_compat.h @@ -36,6 +36,6 @@ static int json_c_snprintf(char *str, size_t size, const char *format, ...) #elif !defined(HAVE_SNPRINTF) /* !HAVE_SNPRINTF */ #error snprintf is required but was not found -#endif /* !HAVE_SNPRINTF && defined(WIN32) */ +#endif /* !HAVE_SNPRINTF */ #endif /* __snprintf_compat_h */ diff --git a/tests/test_util_file.c b/tests/test_util_file.c index 036dcbc6..2a4ceef4 100644 --- a/tests/test_util_file.c +++ b/tests/test_util_file.c @@ -2,11 +2,11 @@ #undef NDEBUG #endif #include "strerror_override.h" -#ifdef WIN32 +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include #include -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ #include #include #include diff --git a/vasprintf_compat.h b/vasprintf_compat.h index 59b2e960..550b6049 100644 --- a/vasprintf_compat.h +++ b/vasprintf_compat.h @@ -8,9 +8,9 @@ #include "snprintf_compat.h" -#ifndef WIN32 +#ifndef _WIN32 #include -#endif /* !defined(WIN32) */ +#endif /* !defined(_WIN32) */ #include #include @@ -18,10 +18,10 @@ /* CAW: compliant version of vasprintf */ static int vasprintf(char **buf, const char *fmt, va_list ap) { -#ifndef WIN32 +#ifndef _WIN32 static char _T_emptybuffer = '\0'; va_list ap2; -#endif /* !defined(WIN32) */ +#endif /* !defined(_WIN32) */ int chars; char *b; @@ -30,16 +30,16 @@ static int vasprintf(char **buf, const char *fmt, va_list ap) return -1; } -#ifdef WIN32 +#ifdef _WIN32 chars = _vscprintf(fmt, ap); -#else /* !defined(WIN32) */ +#else /* !defined(_WIN32) */ /* CAW: RAWR! We have to hope to god here that vsnprintf doesn't overwrite * our buffer like on some 64bit sun systems... but hey, it's time to move on */ va_copy(ap2, ap); chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap2); va_end(ap2); -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ if (chars < 0 || (size_t)chars + 1 > SIZE_MAX / sizeof(char)) { return -1;