From 7bcace2d549f5afc65665a9be6cbb4daf7360273 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Nov 2010 21:02:34 -0500 Subject: [PATCH] Fix some irix compilation warnings spotted by Kevin Bowling --- buffer.c | 5 ++--- bufferevent_filter.c | 1 + bufferevent_sock.c | 1 + evdns.c | 11 +++++------ include/event2/http_struct.h | 2 +- sample/le-proxy.c | 3 +++ test/regress.c | 14 ++++---------- test/regress_dns.c | 14 +++++++------- test/regress_et.c | 3 --- test/regress_zlib.c | 6 +++--- test/test-changelist.c | 3 +-- test/tinytest.c | 2 ++ 12 files changed, 30 insertions(+), 35 deletions(-) diff --git a/buffer.c b/buffer.c index 52ab6357..513f4f84 100644 --- a/buffer.c +++ b/buffer.c @@ -1996,20 +1996,19 @@ get_n_bytes_readable_on_socket(evutil_socket_t fd) int evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch) { - struct evbuffer_chain *chain, **chainp; + struct evbuffer_chain **chainp; int n; int result; #ifdef USE_IOVEC_IMPL int nvecs, i, remaining; #else + struct evbuffer_chain *chain; unsigned char *p; #endif EVBUFFER_LOCK(buf); - chain = buf->last; - if (buf->freeze_end) { result = -1; goto done; diff --git a/bufferevent_filter.c b/bufferevent_filter.c index 0287803c..6886aca0 100644 --- a/bufferevent_filter.c +++ b/bufferevent_filter.c @@ -426,6 +426,7 @@ be_filter_readcb(struct bufferevent *underlying, void *_me) else state = BEV_NORMAL; + /* XXXX use return value */ res = be_filter_process_input(bevf, state, &processed_any); /* XXX This should be in process_input, not here. There are diff --git a/bufferevent_sock.c b/bufferevent_sock.c index b12121c2..1d76ea14 100644 --- a/bufferevent_sock.c +++ b/bufferevent_sock.c @@ -449,6 +449,7 @@ bufferevent_connect_getaddrinfo_cb(int result, struct evutil_addrinfo *ai, } /* XXX use the other addrinfos? */ + /* XXX use this return value */ r = bufferevent_socket_connect(bev, ai->ai_addr, (int)ai->ai_addrlen); _bufferevent_decref_and_unlock(bev); evutil_freeaddrinfo(ai); diff --git a/evdns.c b/evdns.c index b357606d..30ea59bf 100644 --- a/evdns.c +++ b/evdns.c @@ -638,8 +638,7 @@ request_finished(struct request *const req, struct request **head, int free_hand if (head) evdns_request_remove(req, head); - log(EVDNS_LOG_DEBUG, "Removing timeout for request %lx", - (unsigned long) req); + log(EVDNS_LOG_DEBUG, "Removing timeout for request %p", req); if (was_inflight) { evtimer_del(&req->timeout_event); base->global_requests_inflight--; @@ -2076,7 +2075,7 @@ evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) { (void) fd; (void) events; - log(EVDNS_LOG_DEBUG, "Request %lx timed out", (unsigned long) arg); + log(EVDNS_LOG_DEBUG, "Request %p timed out", arg); EVDNS_LOCK(base); req->ns->timedout++; @@ -2161,11 +2160,11 @@ evdns_request_transmit(struct request *req) { default: /* all ok */ log(EVDNS_LOG_DEBUG, - "Setting timeout for request %lx", (unsigned long) req); + "Setting timeout for request %p", req); if (evtimer_add(&req->timeout_event, &req->base->global_timeout) < 0) { log(EVDNS_LOG_WARN, - "Error from libevent when adding timer for request %lx", - (unsigned long) req); + "Error from libevent when adding timer for request %p", + req); /* ???? Do more? */ } req->tx_count++; diff --git a/include/event2/http_struct.h b/include/event2/http_struct.h index a3664e04..21a8c188 100644 --- a/include/event2/http_struct.h +++ b/include/event2/http_struct.h @@ -101,7 +101,7 @@ struct { struct evbuffer *input_buffer; /* read data */ ev_int64_t ntoread; - int chunked:1, /* a chunked request */ + unsigned chunked:1, /* a chunked request */ userdone:1; /* the user has sent all data */ struct evbuffer *output_buffer; /* outgoing post or data */ diff --git a/sample/le-proxy.c b/sample/le-proxy.c index 59b85b23..446bfb56 100644 --- a/sample/le-proxy.c +++ b/sample/le-proxy.c @@ -271,5 +271,8 @@ main(int argc, char **argv) event_base_dispatch(base); + evconnlistener_free(listener); + event_base_free(base); + return 0; } diff --git a/test/regress.c b/test/regress.c index 698cb506..64659334 100644 --- a/test/regress.c +++ b/test/regress.c @@ -686,8 +686,6 @@ end: event_del(&ev); } -static int total_common_counts; - struct common_timeout_info { struct event ev; struct timeval called_at; @@ -731,8 +729,6 @@ test_common_timeout(void *ptr) tt_int_op(ms_100->tv_usec, ==, 100000|0x50000000); tt_int_op(ms_200->tv_usec, ==, 200000|0x50100000); - total_common_counts = 0; - memset(info, 0, sizeof(info)); for (i=0; i<100; ++i) { @@ -1415,10 +1411,9 @@ static void re_add_read_cb(evutil_socket_t fd, short event, void *arg) { char buf[256]; - int len; struct event *ev_other = arg; readd_test_event_last_added = ev_other; - len = read(fd, buf, sizeof(buf)); + (void) read(fd, buf, sizeof(buf)); event_add(ev_other, NULL); ++test_ok; } @@ -1427,13 +1422,12 @@ static void test_nonpersist_readd(void) { struct event ev1, ev2; - int n, m; - + setup_test("Re-add nonpersistent events: "); event_set(&ev1, pair[0], EV_READ, re_add_read_cb, &ev2); event_set(&ev2, pair[1], EV_READ, re_add_read_cb, &ev1); - n = write(pair[0], "Hello", 5); - m = write(pair[1], "Hello", 5); + (void) write(pair[0], "Hello", 5); + (void) write(pair[1], "Hello", 5); if (event_add(&ev1, NULL) == -1 || event_add(&ev2, NULL) == -1) { test_ok = 0; diff --git a/test/regress_dns.c b/test/regress_dns.c index c69370ef..88547160 100644 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@ -1205,7 +1205,7 @@ test_getaddrinfo_async(void *arg) memset(&local_outcome, 0, sizeof(local_outcome)); r = evdns_getaddrinfo(dns_base, "1.2.3.4", "http", &hints, gai_cb, &local_outcome); - tt_int_op(r,==,0); + tt_assert(! r); if (!local_outcome.err) { tt_ptr_op(local_outcome.ai,!=,NULL); test_ai_eq(local_outcome.ai, "1.2.3.4:80", SOCK_STREAM, IPPROTO_TCP); @@ -1233,7 +1233,7 @@ test_getaddrinfo_async(void *arg) hints.ai_protocol = IPPROTO_TCP; r = evdns_getaddrinfo(dns_base, "f::f", "8008", &hints, gai_cb, &local_outcome); - tt_int_op(r,==,0); + tt_assert(!r); tt_int_op(local_outcome.err,==,0); tt_assert(local_outcome.ai); tt_ptr_op(local_outcome.ai->ai_next,==,NULL); @@ -1247,7 +1247,7 @@ test_getaddrinfo_async(void *arg) hints.ai_family = PF_UNSPEC; r = evdns_getaddrinfo(dns_base, "5.6.7.8", NULL, &hints, gai_cb, &local_outcome); - tt_int_op(r,==,0); + tt_assert(!r); tt_int_op(local_outcome.err,==,0); tt_assert(local_outcome.ai); a = ai_find_by_protocol(local_outcome.ai, IPPROTO_TCP); @@ -1267,7 +1267,7 @@ test_getaddrinfo_async(void *arg) hints.ai_flags = EVUTIL_AI_PASSIVE; r = evdns_getaddrinfo(dns_base, NULL, "9090", &hints, gai_cb, &local_outcome); - tt_int_op(r,==,0); + tt_assert(!r); tt_int_op(local_outcome.err,==,0); tt_assert(local_outcome.ai); /* we should get a v4 address of 0.0.0.0... */ @@ -1288,7 +1288,7 @@ test_getaddrinfo_async(void *arg) hints.ai_socktype = SOCK_STREAM; r = evdns_getaddrinfo(dns_base, NULL, "2", &hints, gai_cb, &local_outcome); - tt_int_op(r,==,0); + tt_assert(!r); tt_int_op(local_outcome.err,==,0); tt_assert(local_outcome.ai); /* we should get a v4 address of 127.0.0.1 .... */ @@ -1309,7 +1309,7 @@ test_getaddrinfo_async(void *arg) hints.ai_socktype = SOCK_STREAM; r = evdns_getaddrinfo(dns_base, "LOCALHOST", "80", &hints, gai_cb, &local_outcome); - tt_int_op(r,==,0); + tt_assert(!r); tt_int_op(local_outcome.err,==,0); tt_assert(local_outcome.ai); /* we should get a v4 address of 127.0.0.1 .... */ @@ -1330,7 +1330,7 @@ test_getaddrinfo_async(void *arg) hints.ai_socktype = SOCK_STREAM; r = evdns_getaddrinfo(dns_base, "LOCALHOST", "9999", &hints, gai_cb, &local_outcome); - tt_int_op(r,==,0); + tt_assert(! r); tt_int_op(local_outcome.err,==,0); tt_assert(local_outcome.ai); a = local_outcome.ai; diff --git a/test/regress_et.c b/test/regress_et.c index 736446c1..561f883f 100644 --- a/test/regress_et.c +++ b/test/regress_et.c @@ -89,7 +89,6 @@ test_edgetriggered(void *et) const char *test = "test string"; evutil_socket_t pair[2] = {-1,-1}; int supports_et; - int success; if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0, pair) == -1) { tt_abort_perror("socketpair"); @@ -135,8 +134,6 @@ test_edgetriggered(void *et) } else { tt_int_op(called, ==, 2); tt_assert(!was_et); - success = (called == 2) && !was_et; - } end: diff --git a/test/regress_zlib.c b/test/regress_zlib.c index 58fc01fe..158d0d61 100644 --- a/test/regress_zlib.c +++ b/test/regress_zlib.c @@ -252,7 +252,7 @@ errorcb(struct bufferevent *bev, short what, void *arg) void test_bufferevent_zlib(void *arg) { - struct bufferevent *bev1=NULL, *bev2=NULL, *bev1_orig, *bev2_orig; + struct bufferevent *bev1=NULL, *bev2=NULL; char buffer[8333]; z_stream z_input, z_output; int i, pair[2]={-1,-1}, r; @@ -268,8 +268,8 @@ test_bufferevent_zlib(void *arg) evutil_make_socket_nonblocking(pair[0]); evutil_make_socket_nonblocking(pair[1]); - bev1_orig = bev1 = bufferevent_socket_new(NULL, pair[0], 0); - bev2_orig = bev2 = bufferevent_socket_new(NULL, pair[1], 0); + bev1 = bufferevent_socket_new(NULL, pair[0], 0); + bev2 = bufferevent_socket_new(NULL, pair[1], 0); memset(&z_output, 0, sizeof(z_output)); r = deflateInit(&z_output, Z_DEFAULT_COMPRESSION); diff --git a/test/test-changelist.c b/test/test-changelist.c index f854a2d3..0242a10b 100644 --- a/test/test-changelist.c +++ b/test/test-changelist.c @@ -144,7 +144,6 @@ main(int argc, char **argv) struct event_base* base; evutil_socket_t pair[2]; - int res; struct timeval tv; struct cpu_usage_timer timer; @@ -179,7 +178,7 @@ main(int argc, char **argv) start_cpu_usage_timer(&timer); - res = event_base_dispatch(base); + event_base_dispatch(base); get_cpu_usage(&timer, &secPassed, &secUsed, &usage); diff --git a/test/tinytest.c b/test/tinytest.c index fff6692c..d0b77f74 100644 --- a/test/tinytest.c +++ b/test/tinytest.c @@ -175,6 +175,7 @@ _testcase_run_forked(const struct testgroup_t *group, exit(1); } exit(0); + return FAIL; /* unreachable */ } else { /* parent */ int status, r; @@ -240,6 +241,7 @@ testcase_run_one(const struct testgroup_t *group, if (opt_forked) { exit(outcome==OK ? 0 : (outcome==SKIP?MAGIC_EXITCODE : 1)); + return 1; /* unreachable */ } else { return (int)outcome; }