]> granicus.if.org Git - libevent/commitdiff
Fix some irix compilation warnings spotted by Kevin Bowling
authorNick Mathewson <nickm@torproject.org>
Tue, 23 Nov 2010 02:02:34 +0000 (21:02 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 23 Nov 2010 02:02:34 +0000 (21:02 -0500)
12 files changed:
buffer.c
bufferevent_filter.c
bufferevent_sock.c
evdns.c
include/event2/http_struct.h
sample/le-proxy.c
test/regress.c
test/regress_dns.c
test/regress_et.c
test/regress_zlib.c
test/test-changelist.c
test/tinytest.c

index 52ab6357cae10a7d7a6aca045ccd53711f29ee70..513f4f844407c52fd8e365b5cc302f20ea6fcaa4 100644 (file)
--- 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;
index 0287803c6f3558ed58af4b35f01af5b85acbd63a..6886aca0fa666c9d08381142b35d4bdca8baabbb 100644 (file)
@@ -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
index b12121c21ba453d1fa5c88a46464b4bf01b6871c..1d76ea14b0b6bf0a936bdd303f379b75e50e3c74 100644 (file)
@@ -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 b357606d28f67e935e8a05d2bcbac2d5586780af..30ea59bff55eb276a863a6807597a1dc1432b3f1 100644 (file)
--- 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++;
index a3664e0448b762e886629a4e22e0d0440de40c62..21a8c188fecddb674aa6b33af0aa2e42a42ef16d 100644 (file)
@@ -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 */
index 59b85b23774f08d0763b62be6ddc435b2912764e..446bfb562783895bbe985f253adc069a0a04b4ef 100644 (file)
@@ -271,5 +271,8 @@ main(int argc, char **argv)
 
        event_base_dispatch(base);
 
+       evconnlistener_free(listener);
+       event_base_free(base);
+
        return 0;
 }
index 698cb506c4278c5a5e7d1c3820c034cff8459d86..64659334a0b2e62e932fa0a340a0080199258c84 100644 (file)
@@ -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;
index c69370efbf2c9c4d1d3caad389a4fdc697f8c92a..885471604f4341a51626df69797ecbe6d8ccd1d2 100644 (file)
@@ -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;
index 736446c1df516febdfe052862bbd2e4a972b091c..561f883fe478d333aad2ea68d0295d8c2c9bd792 100644 (file)
@@ -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:
index 58fc01fe59e0a188f74efd8eeac4d3bedef30b81..158d0d611425ee4de230e8657b110a2376c120c9 100644 (file)
@@ -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);
index f854a2d3ffc1df0b2c6c16c6c658c9c49fc066d6..0242a10b30d2513fd63404eb3f47e5daf2100e01 100644 (file)
@@ -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);
 
index fff6692c31c8258820934000f45065b4c837e657..d0b77f74255f5b54624d4725ed59606bddf5c8b0 100644 (file)
@@ -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;
        }