commit 42c501a9c40dca7df9752fa4d4ac4a7a1ce5e4a9
parent d460042ef6dd4b77fcba7d2a6ae421b6a8399ea4
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 15 Oct 2012 23:34:56 +0000
-fix #if WINDOWS problems reported by Luis Garcia on the mailinglist
Diffstat:
9 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Oct 16 01:33:55 CEST 2012
+ Consistently use "#ifdef" and "#ifndef" WINDOWS, and not
+ sometimes "#if". -CG
+
Sat Sep 1 20:51:21 CEST 2012
Releasing libmicrohttpd 0.9.22. -CG
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
@@ -1147,7 +1147,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
if (MHD_YES == need_fcntl)
{
/* make socket non-inheritable */
-#if WINDOWS
+#ifdef WINDOWS
DWORD dwFlags;
if (!GetHandleInformation ((HANDLE) s, &dwFlags) ||
((dwFlags != dwFlags & ~HANDLE_FLAG_INHERIT) &&
@@ -1998,7 +1998,7 @@ create_socket (int domain, int type, int protocol)
int ctype = SOCK_STREAM | sock_cloexec;
int fd;
int flags;
-#if WINDOWS
+#ifdef WINDOWS
DWORD dwFlags;
#endif
@@ -2015,19 +2015,19 @@ create_socket (int domain, int type, int protocol)
if (0 != sock_cloexec)
return fd; /* this is it */
/* flag was not set during 'socket' call, let's try setting it manually */
-#if !WINDOWS
+#ifndef WINDOWS
flags = fcntl (fd, F_GETFD);
if (flags < 0)
#else
if (!GetHandleInformation ((HANDLE) fd, &dwFlags))
#endif
{
-#if WINDOWS
+#ifdef WINDOWS
SetErrnoFromWinError (GetLastError ());
#endif
return fd; /* good luck */
}
-#if !WINDOWS
+#ifndef WINDOWS
if (flags == (flags | FD_CLOEXEC))
return fd; /* already set */
flags |= FD_CLOEXEC;
@@ -2038,7 +2038,7 @@ create_socket (int domain, int type, int protocol)
if (!SetHandleInformation ((HANDLE) fd, HANDLE_FLAG_INHERIT, 0))
#endif
{
-#if WINDOWS
+#ifdef WINDOWS
SetErrnoFromWinError (GetLastError ());
#endif
return fd; /* good luck */
diff --git a/src/testcurl/daemontest_digestauth.c b/src/testcurl/daemontest_digestauth.c
@@ -137,7 +137,7 @@ testDigestAuth ()
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
-#if !WINDOWS
+#ifndef WINDOWS
fd = open("/dev/urandom", O_RDONLY);
if (-1 == fd)
{
diff --git a/src/testcurl/daemontest_digestauth_with_arguments.c b/src/testcurl/daemontest_digestauth_with_arguments.c
@@ -137,7 +137,7 @@ testDigestAuth ()
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
-#if !WINDOWS
+#ifndef WINDOWS
fd = open("/dev/urandom", O_RDONLY);
if (-1 == fd)
{
diff --git a/src/testcurl/daemontest_get.c b/src/testcurl/daemontest_get.c
@@ -499,7 +499,7 @@ main (int argc, char *const *argv)
errorCount += testUnknownPortGet (0);
errorCount += testStopRace (0);
errorCount += testExternalGet ();
-#if !WINDOWS
+#ifndef WINDOWS
errorCount += testInternalGet (MHD_USE_POLL);
errorCount += testMultithreadedGet (MHD_USE_POLL);
errorCount += testMultithreadedPoolGet (MHD_USE_POLL);
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
@@ -276,7 +276,7 @@ gen_test_file_url (char *url, int port)
strerror (errno));
ret = -1;
}
-#if WINDOWS
+#ifdef WINDOWS
{
int i;
for (i = 0; i < doc_path_len; i++)
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
@@ -493,7 +493,7 @@ main (int argc, char *const *argv)
errorCount += testMultithreadedGet (port++, 0);
errorCount += testMultithreadedPoolGet (port++, 0);
errorCount += testExternalGet (port++);
-#if !WINDOWS
+#ifndef WINDOWS
errorCount += testInternalGet (port++, MHD_USE_POLL);
errorCount += testMultithreadedGet (port++, MHD_USE_POLL);
errorCount += testMultithreadedPoolGet (port++, MHD_USE_POLL);
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c
@@ -331,7 +331,7 @@ main (int argc, char *const *argv)
errorCount += testMultithreadedGet (port++, 0);
errorCount += testMultithreadedPoolGet (port++, 0);
errorCount += testExternalGet (port++);
-#if !WINDOWS
+#ifndef WINDOWS
errorCount += testInternalGet (port++, MHD_USE_POLL);
errorCount += testMultithreadedGet (port++, MHD_USE_POLL);
errorCount += testMultithreadedPoolGet (port++, MHD_USE_POLL);
diff --git a/src/testcurl/test_start_stop.c b/src/testcurl/test_start_stop.c
@@ -105,7 +105,7 @@ main (int argc, char *const *argv)
errorCount += testMultithreadedGet (0);
errorCount += testMultithreadedPoolGet (0);
errorCount += testExternalGet ();
-#if !WINDOWS
+#ifndef WINDOWS
errorCount += testInternalGet (MHD_USE_POLL);
errorCount += testMultithreadedGet (MHD_USE_POLL);
errorCount += testMultithreadedPoolGet (MHD_USE_POLL);