Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use "_WIN32", not WIN32: it's standard and we don't need to fake it

This patch was automatically generated with perl.

Based on a patch by Peter Rosin.
  • Loading branch information...
commit 9f560bfa114b8216af2dac28966eae53c0c97ed3 1 parent 0e95950
Nick Mathewson authored
Showing with 237 additions and 237 deletions.
  1. +5 −5 arc4random.c
  2. +12 −12 buffer.c
  3. +1 −1  bufferevent-internal.h
  4. +1 −1  bufferevent.c
  5. +1 −1  bufferevent_async.c
  6. +1 −1  bufferevent_filter.c
  7. +1 −1  bufferevent_openssl.c
  8. +1 −1  bufferevent_pair.c
  9. +6 −6 bufferevent_sock.c
  10. +1 −1  compat/sys/queue.h
  11. +4 −4 evbuffer-internal.h
  12. +5 −5 evdns.c
  13. +2 −2 event-internal.h
  14. +12 −12 event.c
  15. +1 −1  event.h
  16. +1 −1  event_iocp.c
  17. +2 −2 event_tagging.c
  18. +3 −3 evmap.c
  19. +3 −3 evrpc.c
  20. +1 −1  evthread-internal.h
  21. +1 −1  evthread_win32.c
  22. +19 −19 evutil.c
  23. +6 −6 http.c
  24. +1 −1  include/event2/dns.h
  25. +1 −1  include/event2/dns_compat.h
  26. +1 −1  include/event2/rpc.h
  27. +1 −1  include/event2/thread.h
  28. +8 −8 include/event2/util.h
  29. +1 −1  iocp-internal.h
  30. +6 −6 listener.c
  31. +1 −1  log.c
  32. +2 −2 sample/dns-example.c
  33. +6 −6 sample/event-test.c
  34. +2 −2 sample/hello-world.c
  35. +8 −8 sample/http-server.c
  36. +1 −1  sample/le-proxy.c
  37. +2 −2 sample/signal-test.c
  38. +3 −3 sample/time-test.c
  39. +5 −5 signal.c
  40. +4 −4 test/bench.c
  41. +3 −3 test/bench_cascade.c
  42. +3 −3 test/bench_http.c
  43. +2 −2 test/bench_httpclient.c
  44. +10 −10 test/regress.c
  45. +2 −2 test/regress_buffer.c
  46. +4 −4 test/regress_bufferevent.c
  47. +2 −2 test/regress_dns.c
  48. +3 −3 test/regress_et.c
  49. +4 −4 test/regress_http.c
  50. +3 −3 test/regress_listener.c
  51. +9 −9 test/regress_main.c
  52. +2 −2 test/regress_rpc.c
  53. +2 −2 test/regress_ssl.c
  54. +2 −2 test/regress_testutils.c
  55. +5 −5 test/regress_thread.c
  56. +7 −7 test/regress_util.c
  57. +2 −2 test/regress_zlib.c
  58. +7 −7 test/test-changelist.c
  59. +2 −2 test/test-eof.c
  60. +2 −2 test/test-init.c
  61. +5 −5 test/test-ratelim.c
  62. +3 −3 test/test-time.c
  63. +3 −3 test/test-weof.c
  64. +4 −4 test/tinytest.c
  65. +1 −1  test/tinytest_local.h
  66. +2 −2 util-internal.h
View
10 arc4random.c
@@ -50,7 +50,7 @@
#ifndef ARC4RANDOM_NO_INCLUDES
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <wincrypt.h>
#include <process.h>
#else
@@ -79,7 +79,7 @@ struct arc4_stream {
unsigned char s[256];
};
-#ifdef WIN32
+#ifdef _WIN32
#define getpid _getpid
#define pid_t int
#endif
@@ -120,7 +120,7 @@ arc4_addrandom(const unsigned char *dat, int datlen)
rs.j = rs.i;
}
-#ifndef WIN32
+#ifndef _WIN32
static ssize_t
read_all(int fd, unsigned char *buf, size_t count)
{
@@ -140,7 +140,7 @@ read_all(int fd, unsigned char *buf, size_t count)
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define TRY_SEED_WIN32
static int
arc4_seed_win32(void)
@@ -290,7 +290,7 @@ arc4_seed_proc_sys_kernel_random_uuid(void)
}
#endif
-#ifndef WIN32
+#ifndef _WIN32
#define TRY_SEED_URANDOM
static int
arc4_seed_urandom(void)
View
24 buffer.c
@@ -28,7 +28,7 @@
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <io.h>
@@ -194,7 +194,7 @@ evbuffer_chain_free(struct evbuffer_chain *chain)
struct evbuffer_chain_file_segment,
chain);
if (info->segment) {
-#ifdef WIN32
+#ifdef _WIN32
if (info->segment->type == EVBUF_FS_MMAP)
UnmapViewOfFile(chain->buffer);
#endif
@@ -1873,7 +1873,7 @@ evbuffer_expand(struct evbuffer *buf, size_t datlen)
* Reads data from a file descriptor into a buffer.
*/
-#if defined(_EVENT_HAVE_SYS_UIO_H) || defined(WIN32)
+#if defined(_EVENT_HAVE_SYS_UIO_H) || defined(_WIN32)
#define USE_IOVEC_IMPL
#endif
@@ -1961,7 +1961,7 @@ _evbuffer_read_setup_vecs(struct evbuffer *buf, ev_ssize_t howmuch,
static int
get_n_bytes_readable_on_socket(evutil_socket_t fd)
{
-#if defined(FIONREAD) && defined(WIN32)
+#if defined(FIONREAD) && defined(_WIN32)
unsigned long lng = EVBUFFER_MAX_READ;
if (ioctlsocket(fd, FIONREAD, &lng) < 0)
return -1;
@@ -2027,7 +2027,7 @@ evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
WSABUF_FROM_EVBUFFER_IOV(&vecs[i], &ev_vecs[i]);
#endif
-#ifdef WIN32
+#ifdef _WIN32
{
DWORD bytesRead;
DWORD flags=0;
@@ -2058,7 +2058,7 @@ evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
/* We can append new data at this point */
p = chain->buffer + chain->misalign + chain->off;
-#ifndef WIN32
+#ifndef _WIN32
n = read(fd, p, howmuch);
#else
n = recv(fd, p, howmuch, 0);
@@ -2137,7 +2137,7 @@ evbuffer_write_iovec(struct evbuffer *buffer, evutil_socket_t fd,
}
chain = chain->next;
}
-#ifdef WIN32
+#ifdef _WIN32
{
DWORD bytesSent;
if (WSASend(fd, iov, i, &bytesSent, 0, NULL, NULL))
@@ -2227,7 +2227,7 @@ evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
#endif
#ifdef USE_IOVEC_IMPL
n = evbuffer_write_iovec(buffer, fd, howmuch);
-#elif defined(WIN32)
+#elif defined(_WIN32)
/* XXX(nickm) Don't disable this code until we know if
* the WSARecv code above works. */
void *p = evbuffer_pullup(buffer, howmuch);
@@ -2600,7 +2600,7 @@ evbuffer_file_segment_new(
seg->fd = fd;
seg->flags = flags;
-#ifdef WIN32
+#ifdef _WIN32
#define lseek _lseeki64
#define fstat _fstat
#define stat _stat
@@ -2661,7 +2661,7 @@ evbuffer_file_segment_new(
}
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
if (!(flags & EVBUF_FS_DISABLE_MMAP)) {
long h = (long)_get_osfhandle(fd);
HANDLE m;
@@ -2742,7 +2742,7 @@ evbuffer_file_segment_free(struct evbuffer_file_segment *seg)
if (seg->type == EVBUF_FS_SENDFILE) {
;
} else if (seg->type == EVBUF_FS_MMAP) {
-#ifdef WIN32
+#ifdef _WIN32
CloseHandle(seg->mapping_handle);
#elif defined (_EVENT_HAVE_MMAP)
if (munmap(seg->mapping, seg->length) == -1)
@@ -2799,7 +2799,7 @@ evbuffer_add_file_segment(struct evbuffer *buf,
chain->off = length;
chain->buffer_len = chain->misalign + length;
} else if (seg->type == EVBUF_FS_MMAP) {
-#ifdef WIN32
+#ifdef _WIN32
ev_uint64_t total_offset = seg->offset+offset;
ev_uint64_t offset_rounded=0, offset_remaining=0;
LPVOID data;
View
2  bufferevent-internal.h
@@ -260,7 +260,7 @@ extern const struct bufferevent_ops bufferevent_ops_pair;
#define BEV_IS_FILTER(bevp) ((bevp)->be_ops == &bufferevent_ops_filter)
#define BEV_IS_PAIR(bevp) ((bevp)->be_ops == &bufferevent_ops_pair)
-#ifdef WIN32
+#ifdef _WIN32
extern const struct bufferevent_ops bufferevent_ops_async;
#define BEV_IS_ASYNC(bevp) ((bevp)->be_ops == &bufferevent_ops_async)
#else
View
2  bufferevent.c
@@ -42,7 +42,7 @@
#include <stdarg.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <errno.h>
View
2  bufferevent_async.c
@@ -44,7 +44,7 @@
#include <unistd.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
View
2  bufferevent_filter.c
@@ -44,7 +44,7 @@
#include <stdarg.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
View
2  bufferevent_openssl.c
@@ -44,7 +44,7 @@
#include <unistd.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
View
2  bufferevent_pair.c
@@ -28,7 +28,7 @@
#include <sys/types.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
View
12 bufferevent_sock.c
@@ -46,7 +46,7 @@
#include <unistd.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
@@ -71,7 +71,7 @@
#include "mm-internal.h"
#include "bufferevent-internal.h"
#include "util-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "iocp-internal.h"
#endif
@@ -232,7 +232,7 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
goto done;
} else {
connected = 1;
-#ifdef WIN32
+#ifdef _WIN32
if (BEV_IS_ASYNC(bufev)) {
event_del(&bufev->ev_write);
bufferevent_async_set_connected(bufev);
@@ -314,7 +314,7 @@ bufferevent_socket_new(struct event_base *base, evutil_socket_t fd,
struct bufferevent_private *bufev_p;
struct bufferevent *bufev;
-#ifdef WIN32
+#ifdef _WIN32
if (base && event_base_get_iocp(base))
return bufferevent_async_new(base, fd, options);
#endif
@@ -371,7 +371,7 @@ bufferevent_socket_connect(struct bufferevent *bev,
ownfd = 1;
}
if (sa) {
-#ifdef WIN32
+#ifdef _WIN32
if (bufferevent_async_can_connect(bev)) {
bufferevent_setfd(bev, fd);
r = bufferevent_async_connect(bev, fd, sa, socklen);
@@ -386,7 +386,7 @@ bufferevent_socket_connect(struct bufferevent *bev,
if (r < 0)
goto freesock;
}
-#ifdef WIN32
+#ifdef _WIN32
/* ConnectEx() isn't always around, even when IOCP is enabled.
* Here, we borrow the socket object's write handler to fall back
* on a non-blocking connect() when ConnectEx() is unavailable. */
View
2  compat/sys/queue.h
@@ -93,7 +93,7 @@ struct name { \
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
-#ifndef WIN32
+#ifndef _WIN32
#define SLIST_ENTRY(type) \
struct { \
struct type *sle_next; /* next element */ \
View
8 evbuffer-internal.h
@@ -42,7 +42,7 @@ extern "C" {
* arguments. */
#define EVBUFFER_CB_NODEFER 2
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <sys/queue.h>
@@ -126,7 +126,7 @@ struct evbuffer {
* overflows when we have mutually recursive callbacks, and for
* serializing callbacks in a single thread. */
unsigned deferred_cbs : 1;
-#ifdef WIN32
+#ifdef _WIN32
/** True iff this buffer is set up for overlapped IO. */
unsigned is_overlapped : 1;
#endif
@@ -205,7 +205,7 @@ struct evbuffer_chain_reference {
* evbuffer_chain with the EVBUFFER_FILESEGMENT flag set. */
struct evbuffer_chain_file_segment {
struct evbuffer_file_segment *segment;
-#ifdef WIN32
+#ifdef _WIN32
/** If we're using CreateFileMapping, this is the handle to the view. */
HANDLE view_handle;
#endif
@@ -224,7 +224,7 @@ struct evbuffer_file_segment {
int fd;
/** If we're using mmap, this is the raw mapped memory. */
void *mapping;
-#ifdef WIN32
+#ifdef _WIN32
/** If we're using CreateFileMapping, this is the mapping */
HANDLE mapping_handle;
#endif
View
10 evdns.c
@@ -61,7 +61,7 @@
#include <sys/stat.h>
#include <stdio.h>
#include <stdarg.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#ifndef _WIN32_IE
@@ -89,7 +89,7 @@
#include "ipv6-internal.h"
#include "util-internal.h"
#include "evthread-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <ctype.h>
#include <winsock2.h>
#include <windows.h>
@@ -3437,7 +3437,7 @@ evdns_base_resolv_conf_parse(struct evdns_base *base, int flags, const char *con
static char *
evdns_get_default_hosts_filename(void)
{
-#ifdef WIN32
+#ifdef _WIN32
/* Windows is a little coy about where it puts its configuration
* files. Sure, they're _usually_ in C:\windows\system32, but
* there's no reason in principle they couldn't be in
@@ -3519,7 +3519,7 @@ evdns_resolv_conf_parse(int flags, const char *const filename) {
}
-#ifdef WIN32
+#ifdef _WIN32
/* Add multiple nameservers from a space-or-comma-separated list. */
static int
evdns_nameserver_ip_add_line(struct evdns_base *base, const char *ips) {
@@ -3799,7 +3799,7 @@ evdns_base_new(struct event_base *event_base, int initialize_nameservers)
if (initialize_nameservers) {
int r;
-#ifdef WIN32
+#ifdef _WIN32
r = evdns_base_config_windows_nameservers(base);
#else
r = evdns_base_resolv_conf_parse(base, DNS_OPTIONS_ALL, "/etc/resolv.conf");
View
4 event-internal.h
@@ -101,7 +101,7 @@ struct eventop {
size_t fdinfo_len;
};
-#ifdef WIN32
+#ifdef _WIN32
/* If we're on win32, then file descriptors are not nice low densely packed
integers. Instead, they are pointer-like windows handles, and we want to
use a hashtable instead of an array to map fds to events.
@@ -265,7 +265,7 @@ struct event_base {
int current_event_waiters;
#endif
-#ifdef WIN32
+#ifdef _WIN32
/** IOCP support structure, if IOCP is enabled. */
struct event_iocp_port *iocp;
#endif
View
24 event.c
@@ -27,14 +27,14 @@
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <sys/types.h>
-#if !defined(WIN32) && defined(_EVENT_HAVE_SYS_TIME_H)
+#if !defined(_WIN32) && defined(_EVENT_HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/queue.h>
@@ -88,7 +88,7 @@ extern const struct eventop kqops;
#ifdef _EVENT_HAVE_DEVPOLL
extern const struct eventop devpollops;
#endif
-#ifdef WIN32
+#ifdef _WIN32
extern const struct eventop win32ops;
#endif
@@ -112,7 +112,7 @@ static const struct eventop *eventops[] = {
#ifdef _EVENT_HAVE_SELECT
&selectops,
#endif
-#ifdef WIN32
+#ifdef _WIN32
&win32ops,
#endif
NULL
@@ -634,7 +634,7 @@ event_base_new_with_config(const struct event_config *cfg)
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
if (cfg && (cfg->flags & EVENT_BASE_FLAG_STARTUP_IOCP))
event_base_start_iocp(base, cfg->n_cpus_hint);
#endif
@@ -645,7 +645,7 @@ event_base_new_with_config(const struct event_config *cfg)
int
event_base_start_iocp(struct event_base *base, int n_cpus)
{
-#ifdef WIN32
+#ifdef _WIN32
if (base->iocp)
return 0;
base->iocp = event_iocp_port_launch(n_cpus);
@@ -662,7 +662,7 @@ event_base_start_iocp(struct event_base *base, int n_cpus)
void
event_base_stop_iocp(struct event_base *base)
{
-#ifdef WIN32
+#ifdef _WIN32
int rv;
if (!base->iocp)
@@ -689,7 +689,7 @@ event_base_free(struct event_base *base)
/* XXX(niels) - check for internal events first */
EVUTIL_ASSERT(base);
-#ifdef WIN32
+#ifdef _WIN32
event_base_stop_iocp(base);
#endif
@@ -1924,7 +1924,7 @@ evthread_notify_base_default(struct event_base *base)
char buf[1];
int r;
buf[0] = (char) 0;
-#ifdef WIN32
+#ifdef _WIN32
r = send(base->th_notify_fd[1], buf, 1, 0);
#else
r = write(base->th_notify_fd[1], buf, 1);
@@ -2614,7 +2614,7 @@ event_mm_strdup_(const char *str)
memcpy(p, str, ln+1);
return p;
} else
-#ifdef WIN32
+#ifdef _WIN32
return _strdup(str);
#else
return strdup(str);
@@ -2673,7 +2673,7 @@ evthread_notify_drain_default(evutil_socket_t fd, short what, void *arg)
{
unsigned char buf[1024];
struct event_base *base = arg;
-#ifdef WIN32
+#ifdef _WIN32
while (recv(fd, (char*)buf, sizeof(buf), 0) > 0)
;
#else
@@ -2723,7 +2723,7 @@ evthread_make_base_notifiable(struct event_base *base)
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define LOCAL_SOCKETPAIR_AF AF_INET
#else
#define LOCAL_SOCKETPAIR_AF AF_UNIX
View
2  event.h
@@ -177,7 +177,7 @@ extern "C" {
/* For int types. */
#include <evutil.h>
-#ifdef WIN32
+#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
View
2  event_iocp.c
@@ -279,7 +279,7 @@ event_iocp_activate_overlapped(
struct event_iocp_port *
event_base_get_iocp(struct event_base *base)
{
-#ifdef WIN32
+#ifdef _WIN32
return base->iocp;
#else
return NULL;
View
4 event_tagging.c
@@ -35,7 +35,7 @@
#include <sys/param.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
@@ -53,7 +53,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <syslog.h>
#endif
#ifdef _EVENT_HAVE_UNISTD_H
View
6 evmap.c
@@ -26,20 +26,20 @@
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
#include <sys/types.h>
-#if !defined(WIN32) && defined(_EVENT_HAVE_SYS_TIME_H)
+#if !defined(_WIN32) && defined(_EVENT_HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <errno.h>
View
6 evrpc.c
@@ -27,7 +27,7 @@
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
@@ -35,7 +35,7 @@
#endif
#include <sys/types.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#endif
#ifdef _EVENT_HAVE_SYS_TIME_H
@@ -44,7 +44,7 @@
#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <unistd.h>
#endif
#include <errno.h>
View
2  evthread-internal.h
@@ -38,7 +38,7 @@ extern "C" {
struct event_base;
-#ifndef WIN32
+#ifndef _WIN32
/* On Windows, the way we currently make DLLs, it's not allowed for us to
* have shared global structures. Thus, we only do the direct-call-to-function
* code path if we know that the local shared library system supports it.
View
2  evthread_win32.c
@@ -26,7 +26,7 @@
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
View
38 evutil.c
@@ -27,7 +27,7 @@
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#define WIN32_LEAN_AND_MEAN
@@ -78,7 +78,7 @@
#include "strlcpy-internal.h"
#include "ipv6-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#define open _open
#define read _read
#define close _close
@@ -130,7 +130,7 @@ evutil_read_file(const char *filename, char **content_out, size_t *len_out,
return -2;
}
read_so_far = 0;
-#ifdef WIN32
+#ifdef _WIN32
#define N_TO_READ(x) ((x) > INT_MAX) ? INT_MAX : ((int)(x))
#else
#define N_TO_READ(x) (x)
@@ -156,7 +156,7 @@ evutil_read_file(const char *filename, char **content_out, size_t *len_out,
int
evutil_socketpair(int family, int type, int protocol, evutil_socket_t fd[2])
{
-#ifndef WIN32
+#ifndef _WIN32
return socketpair(family, type, protocol, fd);
#else
return evutil_ersatz_socketpair(family, type, protocol, fd);
@@ -174,7 +174,7 @@ evutil_ersatz_socketpair(int family, int type, int protocol,
* for now, and really, when localhost is down sometimes, we
* have other problems too.
*/
-#ifdef WIN32
+#ifdef _WIN32
#define ERR(e) WSA##e
#else
#define ERR(e) e
@@ -268,7 +268,7 @@ evutil_ersatz_socketpair(int family, int type, int protocol,
int
evutil_make_socket_nonblocking(evutil_socket_t fd)
{
-#ifdef WIN32
+#ifdef _WIN32
{
u_long nonblocking = 1;
if (ioctlsocket(fd, FIONBIO, &nonblocking) == SOCKET_ERROR) {
@@ -295,7 +295,7 @@ evutil_make_socket_nonblocking(evutil_socket_t fd)
int
evutil_make_listen_socket_reuseable(evutil_socket_t sock)
{
-#ifndef WIN32
+#ifndef _WIN32
int one = 1;
/* REUSEADDR on Unix means, "don't hang on to this address after the
* listener is closed." On Windows, though, it means "don't keep other
@@ -310,7 +310,7 @@ evutil_make_listen_socket_reuseable(evutil_socket_t sock)
int
evutil_make_socket_closeonexec(evutil_socket_t fd)
{
-#if !defined(WIN32) && defined(_EVENT_HAVE_SETFD)
+#if !defined(_WIN32) && defined(_EVENT_HAVE_SETFD)
int flags;
if ((flags = fcntl(fd, F_GETFD, NULL)) < 0) {
event_warn("fcntl(%d, F_GETFD)", fd);
@@ -327,7 +327,7 @@ evutil_make_socket_closeonexec(evutil_socket_t fd)
int
evutil_closesocket(evutil_socket_t sock)
{
-#ifndef WIN32
+#ifndef _WIN32
return close(sock);
#else
return closesocket(sock);
@@ -341,7 +341,7 @@ evutil_strtoll(const char *s, char **endptr, int base)
return (ev_int64_t)strtoll(s, endptr, base);
#elif _EVENT_SIZEOF_LONG == 8
return (ev_int64_t)strtol(s, endptr, base);
-#elif defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
+#elif defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
/* XXXX on old versions of MS APIs, we only support base
* 10. */
ev_int64_t r;
@@ -357,7 +357,7 @@ evutil_strtoll(const char *s, char **endptr, int base)
if (endptr)
*endptr = (char*) s;
return r;
-#elif defined(WIN32)
+#elif defined(_WIN32)
return (ev_int64_t) _strtoi64(s, endptr, base);
#elif defined(_EVENT_SIZEOF_LONG_LONG) && _EVENT_SIZEOF_LONG_LONG == 8
long long r;
@@ -434,7 +434,7 @@ evutil_gettimeofday(struct timeval *tv, struct timezone *tz)
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
int
evutil_socket_geterror(evutil_socket_t sock)
{
@@ -714,7 +714,7 @@ evutil_parse_servname(const char *servname, const char *protocol,
int n = parse_numeric_servname(servname);
if (n>=0)
return n;
-#if defined(_EVENT_HAVE_GETSERVBYNAME) || defined(WIN32)
+#if defined(_EVENT_HAVE_GETSERVBYNAME) || defined(_WIN32)
if (!(hints->ai_flags & EVUTIL_AI_NUMERICSERV)) {
struct servent *ent = getservbyname(servname, protocol);
if (ent) {
@@ -1214,7 +1214,7 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
* ever resolving even a literal IPv6 address when
* ai_addrtype is PF_UNSPEC.
*/
-#ifdef WIN32
+#ifdef _WIN32
{
int tmp_port;
err = evutil_getaddrinfo_common(nodename,servname,&hints,
@@ -1311,7 +1311,7 @@ evutil_getaddrinfo(const char *nodename, const char *servname,
/* fall back to gethostbyname. */
/* XXXX This needs a lock everywhere but Windows. */
ent = gethostbyname(nodename);
-#ifdef WIN32
+#ifdef _WIN32
err = WSAGetLastError();
#else
err = h_errno;
@@ -1447,7 +1447,7 @@ evutil_gai_strerror(int err)
case EVUTIL_EAI_SYSTEM:
return "system error";
default:
-#if defined(USE_NATIVE_GETADDRINFO) && defined(WIN32)
+#if defined(USE_NATIVE_GETADDRINFO) && defined(_WIN32)
return gai_strerrorA(err);
#elif defined(USE_NATIVE_GETADDRINFO)
return gai_strerror(err);
@@ -1457,7 +1457,7 @@ evutil_gai_strerror(int err)
}
}
-#ifdef WIN32
+#ifdef _WIN32
#define E(code, s) { code, (s " [" #code " ]") }
static struct { int code; const char *msg; } windows_socket_errors[] = {
E(WSAEINTR, "Interrupted function call"),
@@ -2091,7 +2091,7 @@ evutil_getenv(const char *varname)
long
_evutil_weakrand(void)
{
-#ifdef WIN32
+#ifdef _WIN32
return rand();
#else
return random();
@@ -2150,7 +2150,7 @@ evutil_hex_char_to_int(char c)
return -1;
}
-#ifdef WIN32
+#ifdef _WIN32
HANDLE
evutil_load_windows_system_library(const TCHAR *library_name)
{
View
12 http.c
@@ -42,7 +42,7 @@
#include <sys/ioccom.h>
#endif
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -64,7 +64,7 @@
#include <netdb.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -72,7 +72,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <syslog.h>
#endif
#include <signal.h>
@@ -497,12 +497,12 @@ evhttp_maybe_add_date_header(struct evkeyvalq *headers)
{
if (evhttp_find_header(headers, "Date") == NULL) {
char date[50];
-#ifndef WIN32
+#ifndef _WIN32
struct tm cur;
#endif
struct tm *cur_p;
time_t t = time(NULL);
-#ifdef WIN32
+#ifdef _WIN32
cur_p = gmtime(&t);
#else
gmtime_r(&t, &cur);
@@ -1360,7 +1360,7 @@ evhttp_connection_cb(struct bufferevent *bufev, short what, void *arg)
* when connecting to a local address. the cleanup is going
* to reschedule this function call.
*/
-#ifndef WIN32
+#ifndef _WIN32
if (errno == ECONNREFUSED)
goto cleanup;
#endif
View
2  include/event2/dns.h
@@ -446,7 +446,7 @@ int evdns_base_load_hosts(struct evdns_base *base, const char *hosts_fname);
@return 0 if successful, or -1 if an error occurred
@see evdns_resolv_conf_parse()
*/
-#ifdef WIN32
+#ifdef _WIN32
int evdns_base_config_windows_nameservers(struct evdns_base *);
#define EVDNS_BASE_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
#endif
View
2  include/event2/dns_compat.h
@@ -323,7 +323,7 @@ void evdns_search_ndots_set(const int ndots);
*/
struct evdns_server_port *evdns_add_server_port(evutil_socket_t socket, int flags, evdns_request_callback_fn_type callback, void *user_data);
-#ifdef WIN32
+#ifdef _WIN32
int evdns_config_windows_nameservers(void);
#define EVDNS_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
#endif
View
2  include/event2/rpc.h
@@ -454,7 +454,7 @@ enum EVRPC_HOOK_TYPE {
EVRPC_OUTPUT /**< apply the function to an output hook */
};
-#ifndef WIN32
+#ifndef _WIN32
/** Deprecated alias for EVRPC_INPUT. Not available on windows, where it
* conflicts with platform headers. */
#define INPUT EVRPC_INPUT
View
2  include/event2/thread.h
@@ -183,7 +183,7 @@ int evthread_set_condition_callbacks(
void evthread_set_id_callback(
unsigned long (*id_fn)(void));
-#if defined(WIN32) && !defined(_EVENT_DISABLE_THREAD_SUPPORT)
+#if defined(_WIN32) && !defined(_EVENT_DISABLE_THREAD_SUPPORT)
/** Sets up Libevent for use with Windows builtin locking and thread ID
functions. Unavailable if Libevent is not built for Windows.
View
16 include/event2/util.h
@@ -63,7 +63,7 @@ extern "C" {
#include <netdb.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
@@ -86,7 +86,7 @@ extern "C" {
#ifdef _EVENT_HAVE_UINT64_T
#define ev_uint64_t uint64_t
#define ev_int64_t int64_t
-#elif defined(WIN32)
+#elif defined(_WIN32)
#define ev_uint64_t unsigned __int64
#define ev_int64_t signed __int64
#elif _EVENT_SIZEOF_LONG_LONG == 8
@@ -102,7 +102,7 @@ extern "C" {
#ifdef _EVENT_HAVE_UINT32_T
#define ev_uint32_t uint32_t
#define ev_int32_t int32_t
-#elif defined(WIN32)
+#elif defined(_WIN32)
#define ev_uint32_t unsigned int
#define ev_int32_t signed int
#elif _EVENT_SIZEOF_LONG == 4
@@ -118,7 +118,7 @@ extern "C" {
#ifdef _EVENT_HAVE_UINT16_T
#define ev_uint16_t uint16_t
#define ev_int16_t int16_t
-#elif defined(WIN32)
+#elif defined(_WIN32)
#define ev_uint16_t unsigned short
#define ev_int16_t signed short
#elif _EVENT_SIZEOF_INT == 2
@@ -163,7 +163,7 @@ extern "C" {
#define ev_ssize_t ssize_t
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define ev_off_t ev_int64_t
#else
#define ev_off_t off_t
@@ -201,7 +201,7 @@ extern "C" {
#define EV_SSIZE_MIN ((-EV_SSIZE_MAX) - 1)
-#ifdef WIN32
+#ifdef _WIN32
#define ev_socklen_t int
#elif defined(_EVENT_socklen_t)
#define ev_socklen_t _EVENT_socklen_t
@@ -216,7 +216,7 @@ extern "C" {
#endif
#endif
-#ifdef WIN32
+#ifdef _WIN32
/** A type wide enough to hold the output of "socket()" or "accept()". On
* Windows, this is an intptr_t; elsewhere, it is an int. */
#define evutil_socket_t intptr_t
@@ -273,7 +273,7 @@ int evutil_closesocket(evutil_socket_t sock);
* function, and don't let you use strerror for the error codes. And handling
* EWOULDBLOCK is ... different. */
-#ifdef WIN32
+#ifdef _WIN32
/** Return the most recent socket error. Not idempotent on all platforms. */
#define EVUTIL_SOCKET_ERROR() WSAGetLastError()
/** Replace the most recent socket error with errcode */
View
2  iocp-internal.h
@@ -39,7 +39,7 @@ typedef void (*iocp_callback)(struct event_overlapped *, ev_uintptr_t, ev_ssize_
/* This whole file is actually win32 only. We wrap the structures in a win32
* ifdef so that we can test-compile code that uses these interfaces on
* non-win32 platforms. */
-#ifdef WIN32
+#ifdef _WIN32
/**
Internal use only. Wraps an OVERLAPPED that we're using for libevent
View
12 listener.c
@@ -29,7 +29,7 @@
#include <sys/types.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <mswsock.h>
@@ -53,7 +53,7 @@
#include "util-internal.h"
#include "log-internal.h"
#include "evthread-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "iocp-internal.h"
#include "defer-internal.h"
#include "event-internal.h"
@@ -84,7 +84,7 @@ struct evconnlistener_event {
struct event listener;
};
-#ifdef WIN32
+#ifdef _WIN32
struct evconnlistener_iocp {
struct evconnlistener base;
evutil_socket_t fd;
@@ -154,7 +154,7 @@ evconnlistener_new(struct event_base *base,
{
struct evconnlistener_event *lev;
-#ifdef WIN32
+#ifdef _WIN32
if (base && event_base_get_iocp(base)) {
const struct win32_extension_fns *ext =
event_get_win32_extension_fns();
@@ -379,7 +379,7 @@ listener_read_cb(evutil_socket_t fd, short what, void *p)
LOCK(lev);
while (1) {
struct sockaddr_storage ss;
-#ifdef WIN32
+#ifdef _WIN32
int socklen = sizeof(ss);
#else
socklen_t socklen = sizeof(ss);
@@ -427,7 +427,7 @@ listener_read_cb(evutil_socket_t fd, short what, void *p)
}
}
-#ifdef WIN32
+#ifdef _WIN32
struct accepting_socket {
CRITICAL_SECTION lock;
struct event_overlapped overlapped;
View
2  log.c
@@ -40,7 +40,7 @@
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
View
4 sample/dns-example.c
@@ -12,7 +12,7 @@
#include <sys/types.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
@@ -184,7 +184,7 @@ main(int c, char **v) {
evdns_add_server_port_with_base(event_base, sock, 0, evdns_server_callback, NULL);
}
if (idx < c) {
-#ifdef WIN32
+#ifdef _WIN32
evdns_base_config_windows_nameservers(evdns_base);
#else
evdns_base_resolv_conf_parse(evdns_base, DNS_OPTION_NAMESERVERS,
View
12 sample/event-test.c
@@ -12,7 +12,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/queue.h>
#include <unistd.h>
#include <sys/time.h>
@@ -34,7 +34,7 @@ fifo_read(int fd, short event, void *arg)
char buf[255];
int len;
struct event *ev = arg;
-#ifdef WIN32
+#ifdef _WIN32
DWORD dwBytesRead;
#endif
@@ -43,7 +43,7 @@ fifo_read(int fd, short event, void *arg)
fprintf(stderr, "fifo_read called with fd: %d, event: %d, arg: %p\n",
fd, event, arg);
-#ifdef WIN32
+#ifdef _WIN32
len = ReadFile((HANDLE)fd, buf, sizeof(buf) - 1, &dwBytesRead, NULL);
/* Check for end of file. */
@@ -74,7 +74,7 @@ int
main(int argc, char **argv)
{
struct event evfifo;
-#ifdef WIN32
+#ifdef _WIN32
HANDLE socket;
/* Open a file. */
socket = CreateFileA("test.txt", /* open File */
@@ -125,7 +125,7 @@ main(int argc, char **argv)
event_init();
/* Initalize one event */
-#ifdef WIN32
+#ifdef _WIN32
event_set(&evfifo, (int)socket, EV_READ, fifo_read, &evfifo);
#else
event_set(&evfifo, socket, EV_READ, fifo_read, &evfifo);
@@ -135,7 +135,7 @@ main(int argc, char **argv)
event_add(&evfifo, NULL);
event_dispatch();
-#ifdef WIN32
+#ifdef _WIN32
CloseHandle(socket);
#endif
return (0);
View
4 sample/hello-world.c
@@ -11,7 +11,7 @@
#include <errno.h>
#include <stdio.h>
#include <signal.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <netinet/in.h>
# ifdef _XOPEN_SOURCE_EXTENDED
# include <arpa/inet.h>
@@ -43,7 +43,7 @@ main(int argc, char **argv)
struct event *signal_event;
struct sockaddr_in sin;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA wsa_data;
WSAStartup(0x0201, &wsa_data);
#endif
View
16 sample/http-server.c
@@ -13,7 +13,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
@@ -47,7 +47,7 @@
/* Compatibility for possible missing IPv6 declarations */
#include "../util-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#define stat _stat
#define fstat _fstat
#define open _open
@@ -203,7 +203,7 @@ send_document_cb(struct evhttp_request *req, void *arg)
if (S_ISDIR(st.st_mode)) {
/* If it's a directory, read the comments and make a little
* index page */
-#ifdef WIN32
+#ifdef _WIN32
HANDLE d;
WIN32_FIND_DATAA ent;
char *pattern;
@@ -217,7 +217,7 @@ send_document_cb(struct evhttp_request *req, void *arg)
if (!strlen(path) || path[strlen(path)-1] != '/')
trailing_slash = "/";
-#ifdef WIN32
+#ifdef _WIN32
dirlen = strlen(whole_path);
pattern = malloc(dirlen+3);
memcpy(pattern, whole_path, dirlen);
@@ -244,7 +244,7 @@ send_document_cb(struct evhttp_request *req, void *arg)
uri_root, path, /* XXX html-escape this? */
trailing_slash,
decoded_path /* XXX html-escape this */);
-#ifdef WIN32
+#ifdef _WIN32
do {
const char *name = ent.cFileName;
#else
@@ -254,13 +254,13 @@ send_document_cb(struct evhttp_request *req, void *arg)
evbuffer_add_printf(evb,
" <li><a href=\"%s\">%s</a>\n",
name, name);/* XXX escape this */
-#ifdef WIN32
+#ifdef _WIN32
} while (FindNextFileA(d, &ent));
#else
}
#endif
evbuffer_add_printf(evb, "</ul></body></html>\n");
-#ifdef WIN32
+#ifdef _WIN32
CloseHandle(d);
#else
closedir(d);
@@ -318,7 +318,7 @@ main(int argc, char **argv)
struct evhttp_bound_socket *handle;
unsigned short port = 0;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA WSAData;
WSAStartup(0x101, &WSAData);
#else
View
2  sample/le-proxy.c
@@ -11,7 +11,7 @@
#include <string.h>
#include <errno.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
View
4 sample/signal-test.c
@@ -9,7 +9,7 @@
#include <event2/event-config.h>
#include <sys/stat.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/queue.h>
#include <unistd.h>
#include <sys/time.h>
@@ -50,7 +50,7 @@ main(int argc, char **argv)
{
struct event signal_int;
struct event_base* base;
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
View
6 sample/time-test.c
@@ -13,7 +13,7 @@
#include <event2/event-config.h>
#include <sys/stat.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/queue.h>
#include <unistd.h>
#endif
@@ -31,7 +31,7 @@
#include <event2/event_struct.h>
#include <event2/util.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
@@ -71,7 +71,7 @@ main(int argc, char **argv)
struct event_base *base;
int flags;
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
View
10 signal.c
@@ -29,7 +29,7 @@
#include "event2/event-config.h"
#include "evconfig-private.h"
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
@@ -82,7 +82,7 @@
on Linux do a reasonable thing using signalfd.
*/
-#ifndef WIN32
+#ifndef _WIN32
/* Windows wants us to call our signal handlers as __cdecl. Nobody else
* expects you to do anything crazy like this. */
#define __cdecl
@@ -181,7 +181,7 @@ evsig_init(struct event_base *base)
*/
if (evutil_socketpair(
AF_UNIX, SOCK_STREAM, 0, base->sig.ev_signal_pair) == -1) {
-#ifdef WIN32
+#ifdef _WIN32
/* Make this nonfatal on win32, where sometimes people
have localhost firewalled. */
event_sock_warn(-1, "%s: socketpair", __func__);
@@ -374,7 +374,7 @@ static void __cdecl
evsig_handler(int sig)
{
int save_errno = errno;
-#ifdef WIN32
+#ifdef _WIN32
int socket_errno = EVUTIL_SOCKET_ERROR();
#endif
ev_uint8_t msg;
@@ -394,7 +394,7 @@ evsig_handler(int sig)
msg = sig;
send(evsig_base_fd, (char*)&msg, 1, 0);
errno = save_errno;
-#ifdef WIN32
+#ifdef _WIN32
EVUTIL_SET_SOCKET_ERROR(socket_errno);
#endif
}
View
8 test/bench.c
@@ -40,7 +40,7 @@
#ifdef _EVENT_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
@@ -125,14 +125,14 @@ run_once(void)
int
main(int argc, char **argv)
{
-#ifndef WIN32
+#ifndef _WIN32
struct rlimit rl;
#endif
int i, c;
struct timeval *tv;
int *cp;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA WSAData;
WSAStartup(0x101, &WSAData);
#endif
@@ -156,7 +156,7 @@ main(int argc, char **argv)
}
}
-#ifndef WIN32
+#ifndef _WIN32
rl.rlim_cur = rl.rlim_max = num_pipes * 2 + 50;
if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
perror("setrlimit");
View
6 test/bench_cascade.c
@@ -32,7 +32,7 @@
#ifdef _EVENT_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
@@ -134,7 +134,7 @@ run_once(int num_pipes)
int
main(int argc, char **argv)
{
-#ifndef WIN32
+#ifndef _WIN32
struct rlimit rl;
#endif
int i, c;
@@ -152,7 +152,7 @@ main(int argc, char **argv)
}
}
-#ifndef WIN32
+#ifndef _WIN32
rl.rlim_cur = rl.rlim_max = num_pipes * 2 + 50;
if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
perror("setrlimit");
View
6 test/bench_http.c
@@ -27,7 +27,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
@@ -92,7 +92,7 @@ main(int argc, char **argv)
int use_iocp = 0;
unsigned short port = 8080;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA WSAData;
WSAStartup(0x101, &WSAData);
#else
@@ -122,7 +122,7 @@ main(int argc, char **argv)
exit(1);
}
break;
-#ifdef WIN32
+#ifdef _WIN32
case 'i':
use_iocp = 1;
evthread_use_windows_threads();
View
4 test/bench_httpclient.c
@@ -26,7 +26,7 @@
*/
#include <sys/types.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
@@ -201,7 +201,7 @@ main(int argc, char **argv)
throughput = total_n_handled /
(total.tv_sec+ ((double)total.tv_usec)/1000000.0);
-#ifdef WIN32
+#ifdef _WIN32
#define I64_FMT "%I64d"
#define I64_TYP __int64
#else
View
20 test/regress.c
@@ -25,7 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
@@ -38,7 +38,7 @@
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
@@ -68,7 +68,7 @@
#include "regress.h"
-#ifndef WIN32
+#ifndef _WIN32
#include "regress.gen.h"
#endif
@@ -93,7 +93,7 @@ static struct timeval tcalled;
#define SHUT_WR 1
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define write(fd,buf,len) send((fd),(buf),(int)(len),0)
#define read(fd,buf,len) recv((fd),(buf),(int)(len),0)
#endif
@@ -408,7 +408,7 @@ test_simpleclose(void *ptr)
short got_read_on_close = 0, got_write_on_close = 0;
char buf[1024];
memset(buf, 99, sizeof(buf));
-#ifdef WIN32
+#ifdef _WIN32
#define LOCAL_SOCKETPAIR_AF AF_INET
#else
#define LOCAL_SOCKETPAIR_AF AF_UNIX
@@ -776,7 +776,7 @@ test_common_timeout(void *ptr)
data->base = NULL;
}
-#ifndef WIN32
+#ifndef _WIN32
static void signal_cb(evutil_socket_t fd, short event, void *arg);
#define current_base event_global_current_base_
@@ -2061,7 +2061,7 @@ test_event_pending(void *ptr)
}
}
-#ifndef WIN32
+#ifndef _WIN32
/* You can't do this test on windows, since dup2 doesn't work on sockets */
static void
@@ -2310,7 +2310,7 @@ struct testcase_t main_testcases[] = {
{ "event_once", test_event_once, TT_ISOLATED, &basic_setup, NULL },
{ "event_pending", test_event_pending, TT_ISOLATED, &basic_setup,
NULL },
-#ifndef WIN32
+#ifndef _WIN32
{ "dup_fd", test_dup_fd, TT_ISOLATED, &basic_setup, NULL },
#endif
{ "mm_functions", test_mm_functions, TT_FORK, NULL, NULL },
@@ -2319,7 +2319,7 @@ struct testcase_t main_testcases[] = {
{ "struct_event_size", test_struct_event_size, 0, NULL, NULL },
-#ifndef WIN32
+#ifndef _WIN32
LEGACY(fork, TT_ISOLATED),
#endif
END_OF_TESTCASES
@@ -2335,7 +2335,7 @@ struct testcase_t evtag_testcases[] = {
};
struct testcase_t signal_testcases[] = {
-#ifndef WIN32
+#ifndef _WIN32
LEGACY(simplesignal, TT_ISOLATED),
LEGACY(multiplesignal, TT_ISOLATED),
LEGACY(immediatesignal, TT_ISOLATED),
View
4 test/regress_buffer.c
@@ -25,7 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
@@ -38,7 +38,7 @@
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
View
8 test/regress_bufferevent.c
@@ -28,7 +28,7 @@
/* The old tests here need assertions to work. */
#undef NDEBUG
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
@@ -41,7 +41,7 @@
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
@@ -74,7 +74,7 @@
#include "event2/util.h"
#include "bufferevent-internal.h"
-#ifdef WIN32
+#ifdef _WIN32
#include "iocp-internal.h"
#endif
@@ -486,7 +486,7 @@ test_bufferevent_connect(void *arg)
be_flags |= BEV_OPT_THREADSAFE;
}
bufferevent_connect_test_flags = be_flags;
-#ifdef WIN32
+#ifdef _WIN32
if (!strcmp((char*)data->setup_data, "unset_connectex")) {
struct win32_extension_fns *ext =
(struct win32_extension_fns *)
View
4 test/regress_dns.c
@@ -25,7 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
@@ -39,7 +39,7 @@
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <signal.h>
#include <netinet/in.h>
View
6 test/regress_et.c
@@ -26,7 +26,7 @@
#include "event2/event-config.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#endif
#include <sys/types.h>
@@ -38,7 +38,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/time.h>
#include <unistd.h>
#endif
@@ -75,7 +75,7 @@ read_cb(evutil_socket_t fd, short event, void *arg)
#define SHUT_WR 1
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define LOCAL_SOCKETPAIR_AF AF_INET
#else
#define LOCAL_SOCKETPAIR_AF AF_UNIX
View
8 test/regress_http.c
@@ -25,7 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
@@ -39,7 +39,7 @@
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <signal.h>
#include <unistd.h>
@@ -154,7 +154,7 @@ http_connect(const char *address, u_short port)
evutil_make_socket_nonblocking(fd);
if (connect(fd, sa, slen) == -1) {
-#ifdef WIN32
+#ifdef _WIN32
int tmp_err = WSAGetLastError();
if (tmp_err != WSAEINPROGRESS && tmp_err != WSAEINVAL &&
tmp_err != WSAEWOULDBLOCK)
@@ -487,7 +487,7 @@ http_badreq_errorcb(struct bufferevent *bev, short what, void *arg)
}
#ifndef SHUT_WR
-#ifdef WIN32
+#ifdef _WIN32
#define SHUT_WR SD_SEND
#else
#define SHUT_WR 1
View
6 test/regress_listener.c
@@ -24,14 +24,14 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
#include <sys/types.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
# ifdef _XOPEN_SOURCE_EXTENDED
@@ -119,7 +119,7 @@ regress_pick_a_port(void *arg)
evutil_socket_connect(&fd2, (struct sockaddr*)&ss1, slen1);
evutil_socket_connect(&fd3, (struct sockaddr*)&ss2, slen2);
-#ifdef WIN32
+#ifdef _WIN32
Sleep(100); /* XXXX this is a stupid stopgap. */
#endif
event_base_dispatch(base);
View
18 test/regress_main.c
@@ -25,7 +25,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <io.h>
@@ -51,7 +51,7 @@
#include <sys/types.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/wait.h>
#include <signal.h>
@@ -111,7 +111,7 @@ static void dnslogcb(int w, const char *m)
int
regress_make_tmpfile(const void *data, size_t datalen, char **filename_out)
{
-#ifndef WIN32
+#ifndef _WIN32
char tmpfilename[32];
int fd;
*filename_out = NULL;
@@ -168,7 +168,7 @@ basic_test_setup(const struct testcase_t *testcase)
evutil_socket_t spair[2] = { -1, -1 };
struct basic_test_data *data = NULL;
-#ifndef WIN32
+#ifndef _WIN32
if (testcase->flags & TT_ENABLE_IOCP_FLAG)
return (void*)TT_SKIP;
#endif
@@ -328,7 +328,7 @@ const struct testcase_setup_t legacy_setup = {
/* ============================================================ */
-#if (!defined(_EVENT_HAVE_PTHREADS) && !defined(WIN32)) || defined(_EVENT_DISABLE_THREAD_SUPPORT)
+#if (!defined(_EVENT_HAVE_PTHREADS) && !defined(_WIN32)) || defined(_EVENT_DISABLE_THREAD_SUPPORT)
struct testcase_t thread_testcases[] = {
{ "basic", NULL, TT_SKIP, NULL, NULL },
END_OF_TESTCASES
@@ -349,7 +349,7 @@ struct testgroup_t testgroups[] = {
{ "rpc/", rpc_testcases },
{ "thread/", thread_testcases },
{ "listener/", listener_testcases },
-#ifdef WIN32
+#ifdef _WIN32
{ "iocp/", iocp_testcases },
{ "iocp/bufferevent/", bufferevent_iocp_testcases },
{ "iocp/listener/", listener_iocp_testcases },
@@ -363,7 +363,7 @@ struct testgroup_t testgroups[] = {
int
main(int argc, const char **argv)
{
-#ifdef WIN32
+#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
@@ -373,12 +373,12 @@ main(int argc, const char **argv)
err = WSAStartup(wVersionRequested, &wsaData);
#endif
-#ifndef WIN32
+#ifndef _WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
return 1;
#endif
-#ifdef WIN32
+#ifdef _WIN32
tinytest_skip(testgroups, "http/connection_retry");
#endif
View
4 test/regress_rpc.c
@@ -28,7 +28,7 @@
/* The old tests here need assertions to work. */
#undef NDEBUG
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
@@ -41,7 +41,7 @@
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <signal.h>
#include <unistd.h>
View
4 test/regress_ssl.c
@@ -24,12 +24,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#endif
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#endif
View
4 test/regress_testutils.c
@@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef WIN32
+#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
@@ -38,7 +38,7 @@
#include <sys/time.h>
#endif
#include <sys/queue.h>
-#ifndef WIN32