Permalink
Browse files

Merge remote-tracking branch 'github/20_win64_compilation' into 21_wi…

…n64_compilation

Conflicts:
	event.c
	http.c
	sample/event-read-fifo.c
	test/regress_bufferevent.c
  • Loading branch information...
2 parents 6810908 + 94866c2 commit 2e6a985003cbe10921eef9036c2a7ba5cee5d683 Nick Mathewson committed Nov 1, 2012
View
@@ -259,9 +259,10 @@ HT_GENERATE(event_debug_map, event_debug_entry, node, hash_debug_entry,
} else { \
event_errx(EVENT_ERR_ABORT_, \
"%s: noting an add on a non-setup event %p" \
- " (events: 0x%x, fd: %d, flags: 0x%x)", \
+ " (events: 0x%x, fd: "EV_SOCK_FMT \
+ ", flags: 0x%x)", \
__func__, (ev), (ev)->ev_events, \
- (ev)->ev_fd, (ev)->ev_flags); \
+ EV_SOCK_ARG((ev)->ev_fd), (ev)->ev_flags); \
} \
EVLOCK_UNLOCK(event_debug_map_lock_, 0); \
} \
@@ -279,9 +280,10 @@ HT_GENERATE(event_debug_map, event_debug_entry, node, hash_debug_entry,
} else { \
event_errx(EVENT_ERR_ABORT_, \
"%s: noting a del on a non-setup event %p" \
- " (events: 0x%x, fd: %d, flags: 0x%x)", \
+ " (events: 0x%x, fd: "EV_SOCK_FMT \
+ ", flags: 0x%x)", \
__func__, (ev), (ev)->ev_events, \
- (ev)->ev_fd, (ev)->ev_flags); \
+ EV_SOCK_ARG((ev)->ev_fd), (ev)->ev_flags); \
} \
EVLOCK_UNLOCK(event_debug_map_lock_, 0); \
} \
@@ -297,9 +299,10 @@ HT_GENERATE(event_debug_map, event_debug_entry, node, hash_debug_entry,
if (!dent) { \
event_errx(EVENT_ERR_ABORT_, \
"%s called on a non-initialized event %p" \
- " (events: 0x%x, fd: %d, flags: 0x%x)", \
+ " (events: 0x%x, fd: "EV_SOCK_FMT\
+ ", flags: 0x%x)", \
__func__, (ev), (ev)->ev_events, \
- (ev)->ev_fd, (ev)->ev_flags); \
+ EV_SOCK_ARG((ev)->ev_fd), (ev)->ev_flags); \
} \
EVLOCK_UNLOCK(event_debug_map_lock_, 0); \
} \
@@ -315,9 +318,10 @@ HT_GENERATE(event_debug_map, event_debug_entry, node, hash_debug_entry,
if (dent && dent->added) { \
event_errx(EVENT_ERR_ABORT_, \
"%s called on an already added event %p" \
- " (events: 0x%x, fd: %d, flags: 0x%x)", \
+ " (events: 0x%x, fd: "EV_SOCK_FMT", " \
+ "flags: 0x%x)", \
__func__, (ev), (ev)->ev_events, \
- (ev)->ev_fd, (ev)->ev_flags); \
+ EV_SOCK_ARG((ev)->ev_fd), (ev)->ev_flags); \
} \
EVLOCK_UNLOCK(event_debug_map_lock_, 0); \
} \
@@ -2189,9 +2193,9 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
event_debug_assert_is_setup_(ev);
event_debug((
- "event_add: event: %p (fd %d), %s%s%scall %p",
+ "event_add: event: %p (fd "EV_SOCK_FMT"), %s%s%scall %p",
ev,
- (int)ev->ev_fd,
+ EV_SOCK_ARG(ev->ev_fd),
ev->ev_events & EV_READ ? "EV_READ " : " ",
ev->ev_events & EV_WRITE ? "EV_WRITE " : " ",
tv ? "EV_TIMEOUT " : " ",
@@ -2363,8 +2367,8 @@ event_del_nolock_(struct event *ev)
struct event_base *base;
int res = 0, notify = 0;
- event_debug(("event_del: %p (fd %d), callback %p",
- ev, (int)ev->ev_fd, ev->ev_callback));
+ event_debug(("event_del: %p (fd "EV_SOCK_FMT"), callback %p",
+ ev, EV_SOCK_ARG(ev->ev_fd), ev->ev_callback));
/* An event without a base has not been added */
if (ev->ev_base == NULL)
@@ -2457,8 +2461,8 @@ event_active_nolock_(struct event *ev, int res, short ncalls)
{
struct event_base *base;
- event_debug(("event_active: %p (fd %d), res %d, callback %p",
- ev, (int)ev->ev_fd, (int)res, ev->ev_callback));
+ event_debug(("event_active: %p (fd "EV_SOCK_FMT"), res %d, callback %p",
+ ev, EV_SOCK_ARG(ev->ev_fd), (int)res, ev->ev_callback));
base = ev->ev_base;
EVENT_BASE_ASSERT_LOCKED(base);
@@ -2786,8 +2790,8 @@ event_queue_remove_timeout(struct event_base *base, struct event *ev)
{
EVENT_BASE_ASSERT_LOCKED(base);
if (EVUTIL_FAILURE_CHECK(!(ev->ev_flags & EVLIST_TIMEOUT))) {
- event_errx(1, "%s: %p(fd %d) not on queue %x", __func__,
- ev, ev->ev_fd, EVLIST_TIMEOUT);
+ event_errx(1, "%s: %p(fd "EV_SOCK_FMT") not on queue %x", __func__,
+ ev, EV_SOCK_ARG(ev->ev_fd), EVLIST_TIMEOUT);
return;
}
DECR_EVENT_COUNT(base, ev->ev_flags);
@@ -2881,8 +2885,8 @@ event_queue_insert_inserted(struct event_base *base, struct event *ev)
EVENT_BASE_ASSERT_LOCKED(base);
if (EVUTIL_FAILURE_CHECK(ev->ev_flags & EVLIST_INSERTED)) {
- event_errx(1, "%s: %p(fd %d) already inserted", __func__,
- ev, ev->ev_fd);
+ event_errx(1, "%s: %p(fd "EV_SOCK_FMT") already inserted", __func__,
+ ev, EV_SOCK_ARG(ev->ev_fd));
return;
}
@@ -2933,8 +2937,8 @@ event_queue_insert_timeout(struct event_base *base, struct event *ev)
EVENT_BASE_ASSERT_LOCKED(base);
if (EVUTIL_FAILURE_CHECK(ev->ev_flags & EVLIST_TIMEOUT)) {
- event_errx(1, "%s: %p(fd %d) already on timeout", __func__,
- ev, ev->ev_fd);
+ event_errx(1, "%s: %p(fd "EV_SOCK_FMT") already on timeout", __func__,
+ ev, EV_SOCK_ARG(ev->ev_fd));
return;
}
@@ -3264,8 +3268,8 @@ dump_inserted_event_fn(const struct event_base *base, const struct event *e, voi
if (! (e->ev_flags & (EVLIST_INSERTED|EVLIST_TIMEOUT)))
return 0;
- fprintf(output, " %p [%s %ld]%s%s%s%s%s",
- (void*)e, gloss, (long)e->ev_fd,
+ fprintf(output, " %p [%s "EV_SOCK_FMT"]%s%s%s%s%s",
+ (void*)e, gloss, EV_SOCK_ARG(e->ev_fd),
(e->ev_events&EV_READ)?" Read":"",
(e->ev_events&EV_WRITE)?" Write":"",
(e->ev_events&EV_SIGNAL)?" Signal":"",
@@ -3296,8 +3300,8 @@ dump_active_event_fn(const struct event_base *base, const struct event *e, void
if (! (e->ev_flags & (EVLIST_ACTIVE|EVLIST_ACTIVE_LATER)))
return 0;
- fprintf(output, " %p [%s %ld, priority=%d]%s%s%s%s active%s%s\n",
- (void*)e, gloss, (long)e->ev_fd, e->ev_pri,
+ fprintf(output, " %p [%s "EV_SOCK_FMT", priority=%d]%s%s%s%s active%s%s\n",
+ (void*)e, gloss, EV_SOCK_ARG(e->ev_fd), e->ev_pri,
(e->ev_res&EV_READ)?" Read":"",
(e->ev_res&EV_WRITE)?" Write":"",
(e->ev_res&EV_SIGNAL)?" Signal":"",
View
@@ -2125,7 +2125,8 @@ evhttp_read_header(struct evhttp_connection *evcon,
break;
default:
- event_warnx("%s: bad header on %d", __func__, fd);
+ event_warnx("%s: bad header on "EV_SOCK_FMT, __func__,
+ EV_SOCK_ARG(fd));
evhttp_connection_fail_(evcon, EVCON_HTTP_INVALID_HEADER);
break;
}
@@ -3913,7 +3914,8 @@ evhttp_get_request(struct evhttp *http, evutil_socket_t fd,
evcon = evhttp_get_request_connection(http, fd, sa, salen);
if (evcon == NULL) {
- event_sock_warn(fd, "%s: cannot get connection on %d", __func__, fd);
+ event_sock_warn(fd, "%s: cannot get connection on "EV_SOCK_FMT,
+ __func__, EV_SOCK_ARG(fd));
evutil_closesocket(fd);
return;
}
@@ -31,7 +31,7 @@
#include <event2/event.h>
static void
-fifo_read(int fd, short event, void *arg)
+fifo_read(evutil_socket_t fd, short event, void *arg)
{
char buf[255];
int len;
@@ -41,7 +41,7 @@ fifo_read(int fd, short event, void *arg)
#endif
fprintf(stderr, "fifo_read called with fd: %d, event: %d, arg: %p\n",
- fd, event, arg);
+ (int)fd, event, arg);
#ifdef _WIN32
len = ReadFile((HANDLE)fd, buf, sizeof(buf) - 1, &dwBytesRead, NULL);
@@ -134,7 +134,7 @@ main(int argc, char **argv)
/* Initalize one event */
#ifdef _WIN32
- evfifo = event_new(base, (int)socket, EV_READ|EV_PERSIST, fifo_read,
+ evfifo = event_new(base, (evutil_socket_t)socket, EV_READ|EV_PERSIST, fifo_read,
event_self_cbarg());
#else
/* catch SIGINT so that event.fifo can be cleaned up */
@@ -53,11 +53,10 @@ main(int argc, char **argv)
#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
- int err;
wVersionRequested = MAKEWORD(2, 2);
- err = WSAStartup(wVersionRequested, &wsaData);
+ (void) WSAStartup(wVersionRequested, &wsaData);
#endif
/* Initalize the event library */
View
@@ -74,11 +74,10 @@ main(int argc, char **argv)
#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
- int err;
wVersionRequested = MAKEWORD(2, 2);
- err = WSAStartup(wVersionRequested, &wsaData);
+ (void)WSAStartup(wVersionRequested, &wsaData);
#endif
if (argc == 2 && !strcmp(argv[1], "-p")) {
View
@@ -61,15 +61,15 @@
#include <evutil.h>
static int count, writes, fired;
-static int *pipes;
+static evutil_socket_t *pipes;
static int num_pipes, num_active, num_writes;
static struct event *events;
static void
read_cb(evutil_socket_t fd, short which, void *arg)
{
- long idx = (long) arg, widx = idx + 1;
+ ev_intptr_t idx = (ev_intptr_t) arg, widx = idx + 1;
u_char ch;
count += recv(fd, (char*)&ch, sizeof(ch), 0);
@@ -85,14 +85,14 @@ read_cb(evutil_socket_t fd, short which, void *arg)
static struct timeval *
run_once(void)
{
- int *cp, space;
+ evutil_socket_t *cp, space;
long i;
static struct timeval ts, te;
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
if (event_initialized(&events[i]))
event_del(&events[i]);
- event_set(&events[i], cp[0], EV_READ | EV_PERSIST, read_cb, (void *) i);
+ event_set(&events[i], cp[0], EV_READ | EV_PERSIST, read_cb, (void *)(ev_intptr_t) i);
event_add(&events[i], NULL);
}
@@ -130,7 +130,7 @@ main(int argc, char **argv)
#endif
int i, c;
struct timeval *tv;
- int *cp;
+ evutil_socket_t *cp;
#ifdef _WIN32
WSADATA WSAData;
@@ -165,7 +165,7 @@ main(int argc, char **argv)
#endif
events = calloc(num_pipes, sizeof(struct event));
- pipes = calloc(num_pipes * 2, sizeof(int));
+ pipes = calloc(num_pipes * 2, sizeof(evutil_socket_t));
if (events == NULL || pipes == NULL) {
perror("malloc");
exit(1);
View
@@ -60,18 +60,18 @@
*/
static int fired;
-static int *pipes;
+static evutil_socket_t *pipes;
static struct event *events;
static void
read_cb(evutil_socket_t fd, short which, void *arg)
{
char ch;
- long idx = (long) arg;
+ evutil_socket_t sock = (evutil_socket_t)(ev_intptr_t)arg;
recv(fd, &ch, sizeof(ch), 0);
- if (idx >= 0) {
- if (send(idx, "e", 1, 0) < 0)
+ if (sock >= 0) {
+ if (send(sock, "e", 1, 0) < 0)
perror("send");
}
fired++;
@@ -80,11 +80,12 @@ read_cb(evutil_socket_t fd, short which, void *arg)
static struct timeval *
run_once(int num_pipes)
{
- int *cp, i;
+ int i;
+ evutil_socket_t *cp;
static struct timeval ts, te, tv_timeout;
events = calloc(num_pipes, sizeof(struct event));
- pipes = calloc(num_pipes * 2, sizeof(int));
+ pipes = calloc(num_pipes * 2, sizeof(evutil_socket_t));
if (events == NULL || pipes == NULL) {
perror("malloc");
@@ -106,8 +107,9 @@ run_once(int num_pipes)
tv_timeout.tv_sec = 60;
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
- long fd = i < num_pipes - 1 ? cp[3] : -1;
- event_set(&events[i], cp[0], EV_READ, read_cb, (void *) fd);
+ evutil_socket_t fd = i < num_pipes - 1 ? cp[3] : -1;
+ event_set(&events[i], cp[0], EV_READ, read_cb,
+ (void *)(ev_intptr_t)fd);
event_add(&events[i], &tv_timeout);
}
@@ -75,6 +75,7 @@
#include "event2/util.h"
#include "bufferevent-internal.h"
+#include "util-internal.h"
#ifdef _WIN32
#include "iocp-internal.h"
#endif
@@ -570,7 +571,8 @@ want_fail_eventcb(struct bufferevent *bev, short what, void *ctx)
if (what & BEV_EVENT_ERROR) {
s = bufferevent_getfd(bev);
err = evutil_socket_error_to_string(evutil_socket_geterror(s));
- TT_BLATHER(("connection failure on %d: %s", s, err));
+ TT_BLATHER(("connection failure on "EV_SOCK_FMT": %s",
+ EV_SOCK_ARG(s), err));
test_ok = 1;
} else {
TT_FAIL(("didn't fail? what %hd", what));
View
@@ -106,7 +106,7 @@ dns_gethostbyname_cb(int result, char type, int count, int ttl,
if (ttl < 0)
goto out;
for (i = 0; i < count; ++i) {
- const char *b = inet_ntop(AF_INET6, &in6_addrs[i], buf,sizeof(buf));
+ const char *b = evutil_inet_ntop(AF_INET6, &in6_addrs[i], buf,sizeof(buf));
if (b)
TT_BLATHER(("%s ", b));
else
@@ -324,7 +324,7 @@ dns_server_gethostbyname_cb(int result, char type, int count, int ttl,
char buf[INET6_ADDRSTRLEN+1];
if (memcmp(&in6_addrs[0].s6_addr, "abcdefghijklmnop", 16)
|| ttl != 123) {
- const char *b = inet_ntop(AF_INET6, &in6_addrs[0],buf,sizeof(buf));
+ const char *b = evutil_inet_ntop(AF_INET6, &in6_addrs[0],buf,sizeof(buf));
printf("Bad IPv6 response \"%s\" %d. ", b, ttl);
dns_ok = 0;
goto out;
@@ -1251,7 +1251,7 @@ test_getaddrinfo_async(void *arg)
memset(&local_outcome, 0, sizeof(local_outcome));
r = evdns_getaddrinfo(dns_base, "www.google.com", "80",
&hints, gai_cb, &local_outcome);
- tt_int_op(r,==,0);
+ tt_ptr_op(r,==,NULL);
tt_int_op(local_outcome.err,==,EVUTIL_EAI_NONAME);
tt_ptr_op(local_outcome.ai,==,NULL);
View
@@ -418,11 +418,10 @@ main(int argc, const char **argv)
#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
- int err;
wVersionRequested = MAKEWORD(2, 2);
- err = WSAStartup(wVersionRequested, &wsaData);
+ (void) WSAStartup(wVersionRequested, &wsaData);
#endif
#ifndef _WIN32
View
@@ -238,7 +238,7 @@ eventcb(struct bufferevent *bev, short what, void *ctx)
static void
open_ssl_bufevs(struct bufferevent **bev1_out, struct bufferevent **bev2_out,
struct event_base *base, int is_open, int flags, SSL *ssl1, SSL *ssl2,
- int *fd_pair, struct bufferevent **underlying_pair)
+ evutil_socket_t *fd_pair, struct bufferevent **underlying_pair)
{
int state1 = is_open ? BUFFEREVENT_SSL_OPEN :BUFFEREVENT_SSL_CONNECTING;
int state2 = is_open ? BUFFEREVENT_SSL_OPEN :BUFFEREVENT_SSL_ACCEPTING;
@@ -273,7 +273,7 @@ regress_bufferevent_openssl(void *arg)
const int filter = strstr((char*)data->setup_data, "filter")!=NULL;
int flags = BEV_OPT_DEFER_CALLBACKS;
struct bufferevent *bev_ll[2] = { NULL, NULL };
- int *fd_pair = NULL;
+ evutil_socket_t *fd_pair = NULL;
tt_assert(cert);
tt_assert(key);
Oops, something went wrong.

0 comments on commit 2e6a985

Please sign in to comment.