]> granicus.if.org Git - libevent/commitdiff
Compile without warnings on mingw64
authorNick Mathewson <nickm@torproject.org>
Thu, 1 Nov 2012 21:38:34 +0000 (17:38 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 1 Nov 2012 21:56:06 +0000 (17:56 -0400)
This is mostly a matter of catching cases where we were still
assuming that evutil_socket_t could be used as an int.

20 files changed:
event.c
http.c
sample/event-test.c
sample/signal-test.c
sample/time-test.c
test/bench.c
test/bench_cascade.c
test/regress_bufferevent.c
test/regress_dns.c
test/regress_main.c
test/regress_ssl.c
test/regress_util.c
test/regress_zlib.c
test/test-changelist.c
test/test-eof.c
test/test-init.c
test/test-ratelim.c
test/test-time.c
test/test-weof.c
util-internal.h

diff --git a/event.c b/event.c
index 09df46b032d416a2f3d844ae70e83e280dcaff28..91cb0cce37ba2ff276169306a59405fc8fc23c73 100644 (file)
--- a/event.c
+++ b/event.c
@@ -240,9 +240,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);                \
        }                                                               \
@@ -260,9 +261,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);                \
        }                                                               \
@@ -278,9 +280,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);                \
        }                                                               \
@@ -296,9 +299,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);                \
        }                                                               \
@@ -2026,9 +2030,9 @@ event_add_internal(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 " : " ",
@@ -2190,8 +2194,8 @@ event_del_internal(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)
@@ -2281,8 +2285,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));
 
 
        /* We get different kinds of events, add them together */
@@ -2496,8 +2500,8 @@ event_queue_remove(struct event_base *base, struct event *ev, int queue)
        EVENT_BASE_ASSERT_LOCKED(base);
 
        if (!(ev->ev_flags & queue)) {
-               event_errx(1, "%s: %p(fd %d) not on queue %x", __func__,
-                          ev, ev->ev_fd, queue);
+               event_errx(1, "%s: %p(fd "EV_SOCK_FMT") not on queue %x", __func__,
+                   ev, EV_SOCK_ARG(ev->ev_fd), queue);
                return;
        }
 
@@ -2570,8 +2574,8 @@ event_queue_insert(struct event_base *base, struct event *ev, int queue)
                if (queue & EVLIST_ACTIVE)
                        return;
 
-               event_errx(1, "%s: %p(fd %d) already on queue %x", __func__,
-                          ev, ev->ev_fd, queue);
+               event_errx(1, "%s: %p(fd "EV_SOCK_FMT") already on queue %x", __func__,
+                   ev, EV_SOCK_ARG(ev->ev_fd), queue);
                return;
        }
 
@@ -2822,8 +2826,8 @@ event_base_dump_events(struct event_base *base, FILE *output)
        int i;
        fprintf(output, "Inserted events:\n");
        TAILQ_FOREACH(e, &base->eventqueue, ev_next) {
-               fprintf(output, "  %p [fd %ld]%s%s%s%s%s\n",
-                               (void*)e, (long)e->ev_fd,
+               fprintf(output, "  %p [fd "EV_SOCK_FMT"]%s%s%s%s%s\n",
+                               (void*)e, EV_SOCK_ARG(e->ev_fd),
                                (e->ev_events&EV_READ)?" Read":"",
                                (e->ev_events&EV_WRITE)?" Write":"",
                                (e->ev_events&EV_SIGNAL)?" Signal":"",
@@ -2836,8 +2840,8 @@ event_base_dump_events(struct event_base *base, FILE *output)
                        continue;
                fprintf(output, "Active events [priority %d]:\n", i);
                TAILQ_FOREACH(e, &base->eventqueue, ev_next) {
-                       fprintf(output, "  %p [fd %ld]%s%s%s%s\n",
-                                       (void*)e, (long)e->ev_fd,
+                       fprintf(output, "  %p [fd "EV_SOCK_FMT"]%s%s%s%s\n",
+                                       (void*)e, EV_SOCK_ARG(e->ev_fd),
                                        (e->ev_res&EV_READ)?" Read active":"",
                                        (e->ev_res&EV_WRITE)?" Write active":"",
                                        (e->ev_res&EV_SIGNAL)?" Signal active":"",
diff --git a/http.c b/http.c
index 00a3499bc0131d12264f6feabb52b6b6e9f5658d..bd4fd47c42ba5b07a195a50db19432923df3e1f3 100644 (file)
--- a/http.c
+++ b/http.c
@@ -2037,7 +2037,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;
        }
@@ -3742,7 +3743,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;
        }
index e4d7a4238d61aa01aaa3435515b95019cffcf908..a1483e63e54b590af1704761207f38d76541dbef 100644 (file)
@@ -29,7 +29,7 @@
 #include <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;
@@ -42,7 +42,7 @@ fifo_read(int fd, short event, void *arg)
        event_add(ev, NULL);
 
        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);
 
@@ -126,7 +126,7 @@ main(int argc, char **argv)
 
        /* Initalize one event */
 #ifdef WIN32
-       event_set(&evfifo, (int)socket, EV_READ, fifo_read, &evfifo);
+       event_set(&evfifo, (evutil_socket_t)socket, EV_READ, fifo_read, &evfifo);
 #else
        event_set(&evfifo, socket, EV_READ, fifo_read, &evfifo);
 #endif
index 53c025f9cdce8f5fb6d233d72dca74285b6c550b..f969e23493a3f57434915f70c9993493fd739089 100644 (file)
@@ -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 */
index 61b4a6c1d9aa59c36aed65148cb410d2d7cc7c6c..77d4e206a79b397b0f42fa028b9dc3bb2112e415 100644 (file)
@@ -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")) {
index 66b7d71939f7691802cfd96ce1eef9b55f0945ac..9ae02ea8ce4fc8252f56ebca815b90cc0b4c848c 100644 (file)
@@ -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);
index a614156ee9c77c2593bdecfdbb7184f06654b601..c9c45c7ca0ee45db0d48537ade686df33780c54f 100644 (file)
  */
 
 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);
        }
 
index cdfed0c7005a9ce58772ec030394bf7955f4bd6f..19ee4e3a9385e8fa7d2d9944e5a17d39b443014e 100644 (file)
@@ -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));
index 9a2e4d764331fc47a277018c2482650b4bb088ae..4d90d671170b0730e0d23a56b4c0a708f1864055 100644 (file)
@@ -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);
 
index e32afff710a4e1cf0fe4ce70b8fbb50fe9b20491..1649e9dfb909bcd0580396bf748b317b9ec22f1c 100644 (file)
@@ -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
index 8e0087aac245793fa2be0ff8cbead5c2098d2b0e..580c2919a0fcace5afc07acc12db898203be3c40 100644 (file)
@@ -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);
index 71830a6f45ef3f032802227705fe69633e0dda0a..9805df4edbc4bb470d45ebf2dda153871c246f18 100644 (file)
@@ -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));
index 887a6853019afa49a8cd54ec16e8513983a47fa5..641fb5cf6dd0c38ba3989f340eb9750908477e4c 100644 (file)
@@ -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
index 48ff9b16811812c8b9e827f27521add6d9ba425f..2d88f3460cfa07ac1a37b2e4070a779ed130653c 100644 (file)
@@ -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);
index 47da694b0325ca4360acd4c16f8b797aca87f305..741a2d812cc7244790000c3b86534f31f3224461 100644 (file)
@@ -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)
index 2dfa865c511d9e5adf949a1ca6ac5ffce9723966..fc18f4d1150b581bb0363e42ab75b3a2158f7753 100644 (file)
@@ -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 */
index d0a9d2fbaf1e379c61ca86ee8201824962c0c480..815657ec715b6ff48766365ffa8adcab2824b9f1 100644 (file)
@@ -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
index 8f0bd6288bc37312066d67ed775c92ef608b7da5..ca47205dcb50aa133fb7e3ccee80c08f11b691fb 100644 (file)
@@ -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 */
index dfdd3f047a4d2531c64904342e7c3e8951535f33..1ac89eda3b5c55ae087050177b49f061acc22fa4 100644 (file)
@@ -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
index 47fe962d9a6fb4c52268852c97d82d8afa79a834..538f1fe3e330a95cebd0c8a5ff545152147edbbb 100644 (file)
@@ -289,6 +289,14 @@ HANDLE evutil_load_windows_system_library(const TCHAR *library_name);
 #endif
 #endif
 
+#ifdef _WIN32
+#define EV_SOCK_FMT EV_I64_FMT
+#define EV_SOCK_ARG(x) EV_I64_ARG((x))
+#else
+#define EV_SOCK_FMT "%d"
+#define EV_SOCK_ARG(x) (x)
+#endif
+
 #if defined(__STDC__) && defined(__STDC_VERSION__)
 #if (__STDC_VERSION__ >= 199901L)
 #define EV_SIZE_FMT "%zu"