Skip to content

Commit

Permalink
Use "_WIN32", not WIN32: it's standard and we don't need to fake it
Browse files Browse the repository at this point in the history
This patch was automatically generated with perl.

Based on a patch by Peter Rosin.
  • Loading branch information
nmathewson committed May 26, 2011
1 parent 0e95950 commit 9f560bf
Show file tree
Hide file tree
Showing 66 changed files with 237 additions and 237 deletions.
10 changes: 5 additions & 5 deletions arc4random.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

#ifndef ARC4RANDOM_NO_INCLUDES
#include "evconfig-private.h"
#ifdef WIN32
#ifdef _WIN32
#include <wincrypt.h>
#include <process.h>
#else
Expand Down Expand Up @@ -79,7 +79,7 @@ struct arc4_stream {
unsigned char s[256];
};

#ifdef WIN32
#ifdef _WIN32
#define getpid _getpid
#define pid_t int
#endif
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
24 changes: 12 additions & 12 deletions buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion bufferevent-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bufferevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <stdarg.h>
#endif

#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#endif
#include <errno.h>
Expand Down
2 changes: 1 addition & 1 deletion bufferevent_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <unistd.h>
#endif

#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion bufferevent_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <stdarg.h>
#endif

#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion bufferevent_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <unistd.h>
#endif

#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion bufferevent_pair.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include <sys/types.h>

#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#endif

Expand Down
12 changes: 6 additions & 6 deletions bufferevent_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include <unistd.h>
#endif

#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
Expand All @@ -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

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion compat/sys/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ \
Expand Down
8 changes: 4 additions & 4 deletions evbuffer-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extern "C" {
* arguments. */
#define EVBUFFER_CB_NODEFER 2

#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#endif
#include <sys/queue.h>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions evdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions event-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 9f560bf

Please sign in to comment.