diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-11-01 17:38:34 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-11-01 17:56:06 -0400 |
commit | 94866c2763c51d11354437b48d05c19306e220a9 (patch) | |
tree | 50daf90be198f4f5f8c98c7042cb771d5a745f50 /test | |
parent | 2479d964054c3743b9ed292dc1cd2ee70aadf6fb (diff) | |
download | libevent-94866c2763c51d11354437b48d05c19306e220a9.tar.gz |
Compile without warnings on mingw64
This is mostly a matter of catching cases where we were still
assuming that evutil_socket_t could be used as an int.
Diffstat (limited to 'test')
-rw-r--r-- | test/bench.c | 12 | ||||
-rw-r--r-- | test/bench_cascade.c | 18 | ||||
-rw-r--r-- | test/regress_bufferevent.c | 4 | ||||
-rw-r--r-- | test/regress_dns.c | 6 | ||||
-rw-r--r-- | test/regress_main.c | 3 | ||||
-rw-r--r-- | test/regress_ssl.c | 4 | ||||
-rw-r--r-- | test/regress_util.c | 2 | ||||
-rw-r--r-- | test/regress_zlib.c | 3 | ||||
-rw-r--r-- | test/test-changelist.c | 3 | ||||
-rw-r--r-- | test/test-eof.c | 3 | ||||
-rw-r--r-- | test/test-init.c | 3 | ||||
-rw-r--r-- | test/test-ratelim.c | 3 | ||||
-rw-r--r-- | test/test-time.c | 3 | ||||
-rw-r--r-- | test/test-weof.c | 3 |
14 files changed, 34 insertions, 36 deletions
diff --git a/test/bench.c b/test/bench.c index 66b7d719..9ae02ea8 100644 --- a/test/bench.c +++ b/test/bench.c @@ -61,7 +61,7 @@ #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; @@ -69,7 +69,7 @@ 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); diff --git a/test/bench_cascade.c b/test/bench_cascade.c index a614156e..c9c45c7c 100644 --- a/test/bench_cascade.c +++ b/test/bench_cascade.c @@ -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); } diff --git a/test/regress_bufferevent.c b/test/regress_bufferevent.c index cdfed0c7..19ee4e3a 100644 --- a/test/regress_bufferevent.c +++ b/test/regress_bufferevent.c @@ -74,6 +74,7 @@ #include "event2/util.h" #include "bufferevent-internal.h" +#include "util-internal.h" #ifdef WIN32 #include "iocp-internal.h" #endif @@ -557,7 +558,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)); diff --git a/test/regress_dns.c b/test/regress_dns.c index 9a2e4d76..4d90d671 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -107,7 +107,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 @@ -325,7 +325,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; @@ -1244,7 +1244,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); diff --git a/test/regress_main.c b/test/regress_main.c index e32afff7..1649e9df 100644 --- a/test/regress_main.c +++ b/test/regress_main.c @@ -392,11 +392,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 diff --git a/test/regress_ssl.c b/test/regress_ssl.c index 8e0087aa..580c2919 100644 --- a/test/regress_ssl.c +++ b/test/regress_ssl.c @@ -238,7 +238,7 @@ end: 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); diff --git a/test/regress_util.c b/test/regress_util.c index 71830a6f..9805df4e 100644 --- a/test/regress_util.c +++ b/test/regress_util.c @@ -983,7 +983,7 @@ test_evutil_getaddrinfo(void *arg) hints.ai_flags = EVUTIL_AI_NUMERICHOST; r = evutil_getaddrinfo("www.google.com", "80", &hints, &ai); tt_int_op(r, ==, EVUTIL_EAI_NONAME); - tt_int_op(ai, ==, NULL); + tt_ptr_op(ai, ==, NULL); /* Try symbolic service names wit AI_NUMERICSERV */ memset(&hints, 0, sizeof(hints)); diff --git a/test/regress_zlib.c b/test/regress_zlib.c index 887a6853..641fb5cf 100644 --- a/test/regress_zlib.c +++ b/test/regress_zlib.c @@ -276,7 +276,8 @@ test_bufferevent_zlib(void *arg) struct bufferevent *bev1=NULL, *bev2=NULL; char buffer[8333]; z_stream z_input, z_output; - int i, pair[2]={-1,-1}, r; + int i, r; + evutil_socket_t pair[2] = {-1, -1}; (void)arg; infilter_calls = outfilter_calls = readcb_finished = writecb_finished diff --git a/test/test-changelist.c b/test/test-changelist.c index 48ff9b16..2d88f346 100644 --- a/test/test-changelist.c +++ b/test/test-changelist.c @@ -174,11 +174,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 (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) return (1); diff --git a/test/test-eof.c b/test/test-eof.c index 47da694b..741a2d81 100644 --- a/test/test-eof.c +++ b/test/test-eof.c @@ -95,11 +95,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 (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) diff --git a/test/test-init.c b/test/test-init.c index 2dfa865c..fc18f4d1 100644 --- a/test/test-init.c +++ b/test/test-init.c @@ -51,11 +51,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 */ diff --git a/test/test-ratelim.c b/test/test-ratelim.c index d0a9d2fb..815657ec 100644 --- a/test/test-ratelim.c +++ b/test/test-ratelim.c @@ -425,9 +425,8 @@ main(int argc, char **argv) #ifdef WIN32 WORD wVersionRequested = MAKEWORD(2,2); WSADATA wsaData; - int err; - err = WSAStartup(wVersionRequested, &wsaData); + (void) WSAStartup(wVersionRequested, &wsaData); #endif #ifndef WIN32 diff --git a/test/test-time.c b/test/test-time.c index 8f0bd628..ca47205d 100644 --- a/test/test-time.c +++ b/test/test-time.c @@ -87,11 +87,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 */ diff --git a/test/test-weof.c b/test/test-weof.c index dfdd3f04..1ac89eda 100644 --- a/test/test-weof.c +++ b/test/test-weof.c @@ -88,11 +88,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 #ifndef WIN32 |