mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
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.
This commit is contained in:
parent
39ceebcfbf
commit
68bd4bd7bf
6 changed files with 18 additions and 18 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "private-libwebsockets.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) */
|
||||
|
|
Loading…
Add table
Reference in a new issue