]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
rename WIN32 to _WIN32 831/head
authorRosen Penev <rosenp@gmail.com>
Thu, 14 Sep 2023 03:51:49 +0000 (20:51 -0700)
committerRosen Penev <rosenp@gmail.com>
Thu, 8 Feb 2024 02:06:55 +0000 (18:06 -0800)
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 <rosenp@gmail.com>
json_util.c
random_seed.c
snprintf_compat.h
tests/test_util_file.c
vasprintf_compat.h

index 0f570f237da2f2e29f038037bf97ebb545710b9b..4da3efb4f5e757815d30ac69848a1e7b48b7a922 100644 (file)
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
-#ifdef WIN32
+#ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN
 #include <io.h>
 #include <windows.h>
-#endif /* defined(WIN32) */
+#endif /* defined(_WIN32) */
 
-#if !defined(HAVE_OPEN) && defined(WIN32)
+#if !defined(HAVE_OPEN) && defined(_WIN32)
 #define open _open
 #endif
 
index a033fac29095a10aa6a236170b3159238bfa408b..a93c8b979a1f1bca2ff4f8b9dbcde3734bbd7882 100644 (file)
@@ -254,7 +254,7 @@ static int get_dev_random_seed(int *seed)
 
 /* get_cryptgenrandom_seed */
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #define HAVE_CRYPTGENRANDOM 1
 
index 51fcb24af93f923f911948ff8358cf9bba1552fc..64091e67687eff9d9f9ab7ce92d158b091560c5b 100644 (file)
@@ -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 */
index 036dcbc6518aaf6067887b1aaf7a55db1b6eedac..2a4ceef44050160fa0b015c6c5c21d0f4b595277 100644 (file)
@@ -2,11 +2,11 @@
 #undef NDEBUG
 #endif
 #include "strerror_override.h"
-#ifdef WIN32
+#ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN
 #include <io.h>
 #include <windows.h>
-#endif /* defined(WIN32) */
+#endif /* defined(_WIN32) */
 #include <fcntl.h>
 #include <limits.h>
 #include <stddef.h>
index 59b2e960744e3a5dba9d7acc56de3c76654b6e3a..550b6049cd9574b04882f87faba4dd0b5bc30995 100644 (file)
@@ -8,9 +8,9 @@
 
 #include "snprintf_compat.h"
 
-#ifndef WIN32
+#ifndef _WIN32
 #include <stdarg.h>
-#endif /* !defined(WIN32) */
+#endif /* !defined(_WIN32) */
 #include <stdint.h>
 #include <stdlib.h>
 
 /* 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;