Support _WIN32 in addition to WIN32 define
MSVC8 and MSVC9 set only _WIN32, so support that define as well to be able
to compile libwebsockets with those compilers.
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 4378317..d3eb9c1 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -21,7 +21,7 @@
#include "private-libwebsockets.h"
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#include <tchar.h>
#include <io.h>
#include <mstcpip.h>
@@ -548,7 +548,7 @@
int n;
char *p = (char *)buf;
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
for (n = 0; n < len; n++)
p[n] = (unsigned char)rand();
#else
@@ -562,7 +562,7 @@
{
int optval = 1;
socklen_t optlen = sizeof(optval);
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
unsigned long optl = 0;
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
@@ -623,7 +623,7 @@
#endif
/* We are nonblocking... */
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
ioctlsocket(fd, FIONBIO, &optl);
#else
fcntl(fd, F_SETFL, O_NONBLOCK);
@@ -1219,7 +1219,7 @@
#endif
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#else
close(context->fd_random);
#endif
@@ -1243,7 +1243,7 @@
free(context);
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
WSACleanup();
#endif
}
@@ -1869,7 +1869,7 @@
context->last_timeout_check_s = 0;
context->user_space = info->user;
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
context->fd_random = 0;
#else
context->fd_random = open(SYSTEM_RANDOM_FILEPATH, O_RDONLY);
@@ -1955,7 +1955,7 @@
#endif
/* ignore SIGPIPE */
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#else
signal(SIGPIPE, sigpipe_handler);
#endif
@@ -2152,7 +2152,7 @@
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY,
(const void *)&opt, sizeof(opt));
- #ifdef WIN32
+ #if defined(WIN32) || defined(_WIN32)
opt = 0;
ioctlsocket(sockfd, FIONBIO, (unsigned long *)&opt);
#else
@@ -2207,7 +2207,7 @@
* to listen on port < 1023 we would have needed root, but now we are
* listening, we don't want the power for anything else
*/
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#else
if (info->gid != -1)
if (setgid(info->gid))
@@ -2381,7 +2381,7 @@
fprintf(stderr, "%s%s", buf, line);
}
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
LWS_VISIBLE void lwsl_emit_syslog(int level, const char *line)
{
lwsl_emit_stderr(level, line);