From: Wolfgang Stöggl Date: Sat, 19 Jan 2019 22:41:02 +0000 (+0100) Subject: Use _WIN32 instead of WIN32 preprocessor macro X-Git-Tag: v1.7.1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8be9cfd2ebd9bfce5d9fbfee168e82750ade45dc;p=thirdparty%2Frrdtool-1.x.git Use _WIN32 instead of WIN32 preprocessor macro - _WIN32 is the recommended preprocessor macro - Substitute occurrences of WIN32 with _WIN32 using: git grep -lw -e '#ifdef WIN32' -e '#ifndef WIN32' -e 'defined(WIN32)' \ -- '*.c' '*.h' '*.xs' | xargs \ sed -i -e 's/#ifdef WIN32/#ifdef _WIN32/g' \ -e 's/#ifndef WIN32/#ifndef _WIN32/g' \ -e 's/defined(WIN32)/defined(_WIN32)/g' --- diff --git a/bindings/perl-shared/RRDs.xs b/bindings/perl-shared/RRDs.xs index 9c3531b7..e233b583 100644 --- a/bindings/perl-shared/RRDs.xs +++ b/bindings/perl-shared/RRDs.xs @@ -24,7 +24,7 @@ extern "C" { */ #define VERSION_SAVED VERSION #undef VERSION -#ifndef WIN32 +#ifndef _WIN32 #include "rrd_config.h" #endif #include "rrd_tool.h" @@ -105,7 +105,7 @@ extern "C" { /* * should not be needed if libc is linked (see ntmake.pl) -#ifdef WIN32 +#ifdef _WIN32 #define free free #define malloc malloc #define realloc realloc diff --git a/src/mutex.c b/src/mutex.c index c359b6fc..95514129 100644 --- a/src/mutex.c +++ b/src/mutex.c @@ -10,7 +10,7 @@ int mutex_init(mutex_t *mutex) { -#ifdef WIN32 +#ifdef _WIN32 *mutex = CreateMutex(NULL, FALSE, NULL); return (*mutex == NULL); #else @@ -20,7 +20,7 @@ int mutex_init(mutex_t *mutex) int mutex_lock(mutex_t *mutex) { -#ifdef WIN32 +#ifdef _WIN32 if (*mutex == NULL) { /* static initializer? */ HANDLE p = CreateMutex(NULL, FALSE, NULL); if (InterlockedCompareExchangePointer((PVOID*)mutex, (PVOID)p, NULL) != NULL) @@ -34,7 +34,7 @@ int mutex_lock(mutex_t *mutex) int mutex_unlock(mutex_t *mutex) { -#ifdef WIN32 +#ifdef _WIN32 return (ReleaseMutex(*mutex) == 0); #else return pthread_mutex_unlock(mutex); @@ -43,7 +43,7 @@ int mutex_unlock(mutex_t *mutex) int mutex_cleanup(mutex_t *mutex) { -#ifdef WIN32 +#ifdef _WIN32 return (CloseHandle(mutex) == 0); #else return pthread_mutex_destroy(mutex); diff --git a/src/mutex.h b/src/mutex.h index 17664db8..4d7c43ca 100644 --- a/src/mutex.h +++ b/src/mutex.h @@ -5,14 +5,14 @@ #ifndef MUTEX_H_B13C67AB432C4C39AF823A339537CA40 #define MUTEX_H_B13C67AB432C4C39AF823A339537CA40 -#ifdef WIN32 +#ifdef _WIN32 #include #include #else #include #endif -#ifndef WIN32 +#ifndef _WIN32 #define mutex_t pthread_mutex_t #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #else diff --git a/src/plbasename.c b/src/plbasename.c index cd114d26..55d44fb7 100644 --- a/src/plbasename.c +++ b/src/plbasename.c @@ -1,4 +1,4 @@ -#ifdef WIN32 +#ifdef _WIN32 /* * * Cross-platform basename/dirname diff --git a/src/plbasename.h b/src/plbasename.h index 28786a11..31f8879c 100644 --- a/src/plbasename.h +++ b/src/plbasename.h @@ -1,4 +1,4 @@ -#ifdef WIN32 +#ifdef _WIN32 /* * * Cross-platform basename/dirname diff --git a/src/rrd.h b/src/rrd.h index 0fb5f072..1f6199c9 100644 --- a/src/rrd.h +++ b/src/rrd.h @@ -54,7 +54,7 @@ extern "C" { #include /* for off_t */ -#ifndef WIN32 +#ifndef _WIN32 #include /* for off_t */ #else #ifdef _MSC_VER @@ -345,7 +345,7 @@ struct rrd_t; /* returns the current per-thread rrd_context */ rrd_context_t *rrd_get_context(void); -#ifdef WIN32 +#ifdef _WIN32 /* this was added by the win32 porters Christof.Wegmann@exitgames.com */ rrd_context_t *rrd_force_new_context(void); #endif diff --git a/src/rrd_client.c b/src/rrd_client.c index 2b5b6f7b..ed648638 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -25,7 +25,7 @@ * Sebastian tokkee Harl **/ -#ifdef WIN32 +#ifdef _WIN32 #include // contain #include // Need to link with Ws2_32.lib @@ -53,7 +53,7 @@ #include #include #include -#ifndef WIN32 +#ifndef _WIN32 #include #include #include @@ -342,7 +342,7 @@ static int parse_value_array_header (char *line, /* {{{ */ static void close_socket(rrd_client_t *client) { if (client->sd >= 0) { -#ifdef WIN32 +#ifdef _WIN32 closesocket(client->sd); WSACleanup(); #else @@ -743,7 +743,7 @@ int rrdc_ping(void) /* {{{ */ static int connect_unix(rrd_client_t *client, const char *path) /* {{{ */ { -#ifdef WIN32 +#ifdef _WIN32 return (WSAEPROTONOSUPPORT); #else struct sockaddr_un sa; @@ -835,7 +835,7 @@ static int connect_network(rrd_client_t *client, const char *addr_orig) /* {{{ * } } -#ifdef WIN32 +#ifdef _WIN32 WORD wVersionRequested; WSADATA wsaData; diff --git a/src/rrd_create.c b/src/rrd_create.c index 32e9ce2f..d2d372ba 100644 --- a/src/rrd_create.c +++ b/src/rrd_create.c @@ -44,7 +44,7 @@ #include "unused.h" -#ifdef WIN32 +#ifdef _WIN32 # include #endif @@ -1461,7 +1461,7 @@ int write_rrd( WILL NOT take care of any ACLs that may be set. Go figure. */ if (stat(outfilename, &stat_buf) != 0) { -#ifdef WIN32 +#ifdef _WIN32 stat_buf.st_mode = _S_IREAD | _S_IWRITE; // have to test it is #else /* an error occurred (file not found, maybe?). Anyway: @@ -1481,7 +1481,7 @@ int write_rrd( rrd_clear_error(); } -#ifdef WIN32 +#ifdef _WIN32 /* In Windows, renaming to an existing file is not allowed. Even, if the file * is deleted before, using _unlink() here. Furthermore the FILE_SHARE_DELETE * flag is required, which is used in CreateFileA in rrd_open.c diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index 02cd0520..54a4ec04 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -73,7 +73,7 @@ # include #endif -#ifndef WIN32 +#ifndef _WIN32 #include #include #include diff --git a/src/rrd_dump.c b/src/rrd_dump.c index 514328ab..12b24297 100644 --- a/src/rrd_dump.c +++ b/src/rrd_dump.c @@ -47,7 +47,7 @@ #include "rrd_snprintf.h" -#if !(defined(NETWARE) || defined(WIN32)) +#if !(defined(NETWARE) || defined(_WIN32)) extern char *tzname[2]; #endif diff --git a/src/rrd_format.c b/src/rrd_format.c index 32a051a2..678ffc3d 100644 --- a/src/rrd_format.c +++ b/src/rrd_format.c @@ -4,7 +4,7 @@ * rrd_format.c RRD Database Format helper functions *****************************************************************************/ #include "rrd_tool.h" -#ifdef WIN32 +#ifdef _WIN32 #include "stdlib.h" #endif diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 8a6be0d7..bf8ffde8 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -9,7 +9,7 @@ -#if defined(WIN32) && !defined(__MINGW32__) +#if defined(_WIN32) && !defined(__MINGW32__) #include "strftime.h" #endif @@ -37,7 +37,7 @@ #include "plbasename.h" #endif -#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) #include #include #endif diff --git a/src/rrd_modify.c b/src/rrd_modify.c index 674d7db5..f40dd5fa 100644 --- a/src/rrd_modify.c +++ b/src/rrd_modify.c @@ -19,7 +19,7 @@ #include #include "rrd_config.h" -#ifdef WIN32 +#ifdef _WIN32 #include #include #include diff --git a/src/rrd_open.c b/src/rrd_open.c index d02acfe2..9daee757 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -6,7 +6,7 @@ * $Id$ *****************************************************************************/ -#ifdef WIN32 +#ifdef _WIN32 #include #if _WIN32_MAXVER >= 0x0602 /* _WIN32_WINNT_WIN8 */ #include @@ -33,7 +33,7 @@ #define MEMBLK 8192 -#ifdef WIN32 +#ifdef _WIN32 #define _LK_UNLCK 0 /* Unlock */ #define _LK_LOCK 1 /* Lock */ #define _LK_NBLCK 2 /* Non-blocking lock */ diff --git a/src/rrd_restore.c b/src/rrd_restore.c index 1afe753d..b4df93cd 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -23,7 +23,7 @@ #include #include -#ifndef WIN32 +#ifndef _WIN32 # include /* for off_t */ #else #ifndef __MINGW32__ /* MinGW-w64 has ssize_t and off_t */ diff --git a/src/rrd_tool.c b/src/rrd_tool.c index e6831b88..4a01760d 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -6,7 +6,7 @@ #include "rrd_config.h" -#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) #include #include #include @@ -449,7 +449,7 @@ int main( according to localeconv(3) */ setlocale(LC_ALL, ""); -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) setmode(fileno(stdout), O_BINARY); setmode(fileno(stdin), O_BINARY); #endif diff --git a/src/rrd_utils.c b/src/rrd_utils.c index f26be8cc..cd0f80b0 100644 --- a/src/rrd_utils.c +++ b/src/rrd_utils.c @@ -34,7 +34,7 @@ #include #include #endif -#ifdef WIN32 +#ifdef _WIN32 # define random() rand() # define srandom(x) srand(x) # define getpid() 0