Fix some irix compilation warnings spotted by Kevin Bowling

This commit is contained in:
Nick Mathewson 2010-11-22 21:02:34 -05:00
parent 150d7d0a49
commit 7bcace2d54
12 changed files with 30 additions and 35 deletions

View File

@ -1996,20 +1996,19 @@ get_n_bytes_readable_on_socket(evutil_socket_t fd)
int int
evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch) evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch)
{ {
struct evbuffer_chain *chain, **chainp; struct evbuffer_chain **chainp;
int n; int n;
int result; int result;
#ifdef USE_IOVEC_IMPL #ifdef USE_IOVEC_IMPL
int nvecs, i, remaining; int nvecs, i, remaining;
#else #else
struct evbuffer_chain *chain;
unsigned char *p; unsigned char *p;
#endif #endif
EVBUFFER_LOCK(buf); EVBUFFER_LOCK(buf);
chain = buf->last;
if (buf->freeze_end) { if (buf->freeze_end) {
result = -1; result = -1;
goto done; goto done;

View File

@ -426,6 +426,7 @@ be_filter_readcb(struct bufferevent *underlying, void *_me)
else else
state = BEV_NORMAL; state = BEV_NORMAL;
/* XXXX use return value */
res = be_filter_process_input(bevf, state, &processed_any); res = be_filter_process_input(bevf, state, &processed_any);
/* XXX This should be in process_input, not here. There are /* XXX This should be in process_input, not here. There are

View File

@ -449,6 +449,7 @@ bufferevent_connect_getaddrinfo_cb(int result, struct evutil_addrinfo *ai,
} }
/* XXX use the other addrinfos? */ /* XXX use the other addrinfos? */
/* XXX use this return value */
r = bufferevent_socket_connect(bev, ai->ai_addr, (int)ai->ai_addrlen); r = bufferevent_socket_connect(bev, ai->ai_addr, (int)ai->ai_addrlen);
_bufferevent_decref_and_unlock(bev); _bufferevent_decref_and_unlock(bev);
evutil_freeaddrinfo(ai); evutil_freeaddrinfo(ai);

11
evdns.c
View File

@ -638,8 +638,7 @@ request_finished(struct request *const req, struct request **head, int free_hand
if (head) if (head)
evdns_request_remove(req, head); evdns_request_remove(req, head);
log(EVDNS_LOG_DEBUG, "Removing timeout for request %lx", log(EVDNS_LOG_DEBUG, "Removing timeout for request %p", req);
(unsigned long) req);
if (was_inflight) { if (was_inflight) {
evtimer_del(&req->timeout_event); evtimer_del(&req->timeout_event);
base->global_requests_inflight--; base->global_requests_inflight--;
@ -2076,7 +2075,7 @@ evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) {
(void) fd; (void) fd;
(void) events; (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); EVDNS_LOCK(base);
req->ns->timedout++; req->ns->timedout++;
@ -2161,11 +2160,11 @@ evdns_request_transmit(struct request *req) {
default: default:
/* all ok */ /* all ok */
log(EVDNS_LOG_DEBUG, 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) { if (evtimer_add(&req->timeout_event, &req->base->global_timeout) < 0) {
log(EVDNS_LOG_WARN, log(EVDNS_LOG_WARN,
"Error from libevent when adding timer for request %lx", "Error from libevent when adding timer for request %p",
(unsigned long) req); req);
/* ???? Do more? */ /* ???? Do more? */
} }
req->tx_count++; req->tx_count++;

View File

@ -101,7 +101,7 @@ struct {
struct evbuffer *input_buffer; /* read data */ struct evbuffer *input_buffer; /* read data */
ev_int64_t ntoread; ev_int64_t ntoread;
int chunked:1, /* a chunked request */ unsigned chunked:1, /* a chunked request */
userdone:1; /* the user has sent all data */ userdone:1; /* the user has sent all data */
struct evbuffer *output_buffer; /* outgoing post or data */ struct evbuffer *output_buffer; /* outgoing post or data */

View File

@ -271,5 +271,8 @@ main(int argc, char **argv)
event_base_dispatch(base); event_base_dispatch(base);
evconnlistener_free(listener);
event_base_free(base);
return 0; return 0;
} }

View File

@ -686,8 +686,6 @@ end:
event_del(&ev); event_del(&ev);
} }
static int total_common_counts;
struct common_timeout_info { struct common_timeout_info {
struct event ev; struct event ev;
struct timeval called_at; 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_100->tv_usec, ==, 100000|0x50000000);
tt_int_op(ms_200->tv_usec, ==, 200000|0x50100000); tt_int_op(ms_200->tv_usec, ==, 200000|0x50100000);
total_common_counts = 0;
memset(info, 0, sizeof(info)); memset(info, 0, sizeof(info));
for (i=0; i<100; ++i) { for (i=0; i<100; ++i) {
@ -1415,10 +1411,9 @@ static void
re_add_read_cb(evutil_socket_t fd, short event, void *arg) re_add_read_cb(evutil_socket_t fd, short event, void *arg)
{ {
char buf[256]; char buf[256];
int len;
struct event *ev_other = arg; struct event *ev_other = arg;
readd_test_event_last_added = ev_other; readd_test_event_last_added = ev_other;
len = read(fd, buf, sizeof(buf)); (void) read(fd, buf, sizeof(buf));
event_add(ev_other, NULL); event_add(ev_other, NULL);
++test_ok; ++test_ok;
} }
@ -1427,13 +1422,12 @@ static void
test_nonpersist_readd(void) test_nonpersist_readd(void)
{ {
struct event ev1, ev2; struct event ev1, ev2;
int n, m;
setup_test("Re-add nonpersistent events: "); setup_test("Re-add nonpersistent events: ");
event_set(&ev1, pair[0], EV_READ, re_add_read_cb, &ev2); event_set(&ev1, pair[0], EV_READ, re_add_read_cb, &ev2);
event_set(&ev2, pair[1], EV_READ, re_add_read_cb, &ev1); event_set(&ev2, pair[1], EV_READ, re_add_read_cb, &ev1);
n = write(pair[0], "Hello", 5); (void) write(pair[0], "Hello", 5);
m = write(pair[1], "Hello", 5); (void) write(pair[1], "Hello", 5);
if (event_add(&ev1, NULL) == -1 || if (event_add(&ev1, NULL) == -1 ||
event_add(&ev2, NULL) == -1) { event_add(&ev2, NULL) == -1) {
test_ok = 0; test_ok = 0;

View File

@ -1205,7 +1205,7 @@ test_getaddrinfo_async(void *arg)
memset(&local_outcome, 0, sizeof(local_outcome)); memset(&local_outcome, 0, sizeof(local_outcome));
r = evdns_getaddrinfo(dns_base, "1.2.3.4", "http", r = evdns_getaddrinfo(dns_base, "1.2.3.4", "http",
&hints, gai_cb, &local_outcome); &hints, gai_cb, &local_outcome);
tt_int_op(r,==,0); tt_assert(! r);
if (!local_outcome.err) { if (!local_outcome.err) {
tt_ptr_op(local_outcome.ai,!=,NULL); tt_ptr_op(local_outcome.ai,!=,NULL);
test_ai_eq(local_outcome.ai, "1.2.3.4:80", SOCK_STREAM, IPPROTO_TCP); 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; hints.ai_protocol = IPPROTO_TCP;
r = evdns_getaddrinfo(dns_base, "f::f", "8008", r = evdns_getaddrinfo(dns_base, "f::f", "8008",
&hints, gai_cb, &local_outcome); &hints, gai_cb, &local_outcome);
tt_int_op(r,==,0); tt_assert(!r);
tt_int_op(local_outcome.err,==,0); tt_int_op(local_outcome.err,==,0);
tt_assert(local_outcome.ai); tt_assert(local_outcome.ai);
tt_ptr_op(local_outcome.ai->ai_next,==,NULL); tt_ptr_op(local_outcome.ai->ai_next,==,NULL);
@ -1247,7 +1247,7 @@ test_getaddrinfo_async(void *arg)
hints.ai_family = PF_UNSPEC; hints.ai_family = PF_UNSPEC;
r = evdns_getaddrinfo(dns_base, "5.6.7.8", NULL, r = evdns_getaddrinfo(dns_base, "5.6.7.8", NULL,
&hints, gai_cb, &local_outcome); &hints, gai_cb, &local_outcome);
tt_int_op(r,==,0); tt_assert(!r);
tt_int_op(local_outcome.err,==,0); tt_int_op(local_outcome.err,==,0);
tt_assert(local_outcome.ai); tt_assert(local_outcome.ai);
a = ai_find_by_protocol(local_outcome.ai, IPPROTO_TCP); 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; hints.ai_flags = EVUTIL_AI_PASSIVE;
r = evdns_getaddrinfo(dns_base, NULL, "9090", r = evdns_getaddrinfo(dns_base, NULL, "9090",
&hints, gai_cb, &local_outcome); &hints, gai_cb, &local_outcome);
tt_int_op(r,==,0); tt_assert(!r);
tt_int_op(local_outcome.err,==,0); tt_int_op(local_outcome.err,==,0);
tt_assert(local_outcome.ai); tt_assert(local_outcome.ai);
/* we should get a v4 address of 0.0.0.0... */ /* 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; hints.ai_socktype = SOCK_STREAM;
r = evdns_getaddrinfo(dns_base, NULL, "2", r = evdns_getaddrinfo(dns_base, NULL, "2",
&hints, gai_cb, &local_outcome); &hints, gai_cb, &local_outcome);
tt_int_op(r,==,0); tt_assert(!r);
tt_int_op(local_outcome.err,==,0); tt_int_op(local_outcome.err,==,0);
tt_assert(local_outcome.ai); tt_assert(local_outcome.ai);
/* we should get a v4 address of 127.0.0.1 .... */ /* 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; hints.ai_socktype = SOCK_STREAM;
r = evdns_getaddrinfo(dns_base, "LOCALHOST", "80", r = evdns_getaddrinfo(dns_base, "LOCALHOST", "80",
&hints, gai_cb, &local_outcome); &hints, gai_cb, &local_outcome);
tt_int_op(r,==,0); tt_assert(!r);
tt_int_op(local_outcome.err,==,0); tt_int_op(local_outcome.err,==,0);
tt_assert(local_outcome.ai); tt_assert(local_outcome.ai);
/* we should get a v4 address of 127.0.0.1 .... */ /* 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; hints.ai_socktype = SOCK_STREAM;
r = evdns_getaddrinfo(dns_base, "LOCALHOST", "9999", r = evdns_getaddrinfo(dns_base, "LOCALHOST", "9999",
&hints, gai_cb, &local_outcome); &hints, gai_cb, &local_outcome);
tt_int_op(r,==,0); tt_assert(! r);
tt_int_op(local_outcome.err,==,0); tt_int_op(local_outcome.err,==,0);
tt_assert(local_outcome.ai); tt_assert(local_outcome.ai);
a = local_outcome.ai; a = local_outcome.ai;

View File

@ -89,7 +89,6 @@ test_edgetriggered(void *et)
const char *test = "test string"; const char *test = "test string";
evutil_socket_t pair[2] = {-1,-1}; evutil_socket_t pair[2] = {-1,-1};
int supports_et; int supports_et;
int success;
if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0, pair) == -1) { if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0, pair) == -1) {
tt_abort_perror("socketpair"); tt_abort_perror("socketpair");
@ -135,8 +134,6 @@ test_edgetriggered(void *et)
} else { } else {
tt_int_op(called, ==, 2); tt_int_op(called, ==, 2);
tt_assert(!was_et); tt_assert(!was_et);
success = (called == 2) && !was_et;
} }
end: end:

View File

@ -252,7 +252,7 @@ errorcb(struct bufferevent *bev, short what, void *arg)
void void
test_bufferevent_zlib(void *arg) test_bufferevent_zlib(void *arg)
{ {
struct bufferevent *bev1=NULL, *bev2=NULL, *bev1_orig, *bev2_orig; struct bufferevent *bev1=NULL, *bev2=NULL;
char buffer[8333]; char buffer[8333];
z_stream z_input, z_output; z_stream z_input, z_output;
int i, pair[2]={-1,-1}, r; 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[0]);
evutil_make_socket_nonblocking(pair[1]); evutil_make_socket_nonblocking(pair[1]);
bev1_orig = bev1 = bufferevent_socket_new(NULL, pair[0], 0); bev1 = bufferevent_socket_new(NULL, pair[0], 0);
bev2_orig = bev2 = bufferevent_socket_new(NULL, pair[1], 0); bev2 = bufferevent_socket_new(NULL, pair[1], 0);
memset(&z_output, 0, sizeof(z_output)); memset(&z_output, 0, sizeof(z_output));
r = deflateInit(&z_output, Z_DEFAULT_COMPRESSION); r = deflateInit(&z_output, Z_DEFAULT_COMPRESSION);

View File

@ -144,7 +144,6 @@ main(int argc, char **argv)
struct event_base* base; struct event_base* base;
evutil_socket_t pair[2]; evutil_socket_t pair[2];
int res;
struct timeval tv; struct timeval tv;
struct cpu_usage_timer timer; struct cpu_usage_timer timer;
@ -179,7 +178,7 @@ main(int argc, char **argv)
start_cpu_usage_timer(&timer); start_cpu_usage_timer(&timer);
res = event_base_dispatch(base); event_base_dispatch(base);
get_cpu_usage(&timer, &secPassed, &secUsed, &usage); get_cpu_usage(&timer, &secPassed, &secUsed, &usage);

View File

@ -175,6 +175,7 @@ _testcase_run_forked(const struct testgroup_t *group,
exit(1); exit(1);
} }
exit(0); exit(0);
return FAIL; /* unreachable */
} else { } else {
/* parent */ /* parent */
int status, r; int status, r;
@ -240,6 +241,7 @@ testcase_run_one(const struct testgroup_t *group,
if (opt_forked) { if (opt_forked) {
exit(outcome==OK ? 0 : (outcome==SKIP?MAGIC_EXITCODE : 1)); exit(outcome==OK ? 0 : (outcome==SKIP?MAGIC_EXITCODE : 1));
return 1; /* unreachable */
} else { } else {
return (int)outcome; return (int)outcome;
} }