aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Pakulat <andreas@froglogic.com>2013-10-28 15:18:04 +0100
committerAndy Green <andy.green@linaro.org>2013-11-04 10:04:31 +0800
commit68bd4bd7bf5d3b71ed0004a9eab20fca8e4b1826 (patch)
tree88af7a3dae7feae4ef462e94dcd1f5c6e6f21873 /lib
parent39ceebcfbffc6a44acd5fdfdd323aa88249c7289 (diff)
downloadlibwebsockets-68bd4bd7bf5d3b71ed0004a9eab20fca8e4b1826.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/libwebsockets.c22
-rw-r--r--lib/libwebsockets.h2
-rw-r--r--lib/parsers.c2
-rw-r--r--lib/private-libwebsockets.h4
-rw-r--r--lib/server.c4
-rw-r--r--lib/sha-1.c2
6 files changed, 18 insertions, 18 deletions
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 4378317d..d3eb9c12 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 @@ LWS_VISIBLE int libwebsockets_get_random(struct libwebsocket_context *context,
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 lws_set_socket_options(struct libwebsocket_context *context, int fd)
{
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 @@ int lws_set_socket_options(struct libwebsocket_context *context, int fd)
#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 @@ libwebsocket_context_destroy(struct libwebsocket_context *context)
#endif
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#else
close(context->fd_random);
#endif
@@ -1243,7 +1243,7 @@ libwebsocket_context_destroy(struct libwebsocket_context *context)
free(context);
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
WSACleanup();
#endif
}
@@ -1869,7 +1869,7 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
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 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
#endif
/* ignore SIGPIPE */
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#else
signal(SIGPIPE, sigpipe_handler);
#endif
@@ -2152,7 +2152,7 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
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 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
* 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 @@ static void lwsl_emit_stderr(int level, const char *line)
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);
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index d5fdaebb..5db4b086 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -27,7 +27,7 @@ extern "C" {
#include <cstddef>
#endif
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
diff --git a/lib/parsers.c b/lib/parsers.c
index c1d67303..cae50d88 100644
--- a/lib/parsers.c
+++ b/lib/parsers.c
@@ -21,7 +21,7 @@
#include "private-libwebsockets.h"
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#include <io.h>
#endif
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
index 6b897f0b..5963db58 100644
--- a/lib/private-libwebsockets.h
+++ b/lib/private-libwebsockets.h
@@ -23,7 +23,7 @@
#ifdef CMAKE_BUILD
#include "lws_config.h"
#else
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#define inline __inline
#else
#include "config.h"
@@ -55,7 +55,7 @@
#include <sys/stat.h>
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#define LWS_NO_DAEMONIZE
#ifndef EWOULDBLOCK
#define EWOULDBLOCK EAGAIN
diff --git a/lib/server.c b/lib/server.c
index 8d12a81b..44145cb5 100644
--- a/lib/server.c
+++ b/lib/server.c
@@ -22,7 +22,7 @@
#include "private-libwebsockets.h"
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#include <tchar.h>
#include <io.h>
#else
@@ -55,7 +55,7 @@ int
interface_to_sa(const char *ifname, struct sockaddr_in *addr, size_t addrlen)
{
int rc = -1;
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
/* TODO */
#else
struct ifaddrs *ifr;
diff --git a/lib/sha-1.c b/lib/sha-1.c
index 1491502d..96b4470b 100644
--- a/lib/sha-1.c
+++ b/lib/sha-1.c
@@ -33,7 +33,7 @@
*/
#include <sys/types.h>
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321 /* to show byte order (taken from gcc) */