From 0e7cbe6508a296952a05ddc9cb883fef0a13cf1e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 28 Feb 2008 17:38:52 +0000 Subject: [PATCH] r18482@catbus: nickm | 2008-02-28 12:38:40 -0500 Fix GCC 4.2 warnings; fix includes in subdirs. svn:r675 --- buffer.c | 12 +++++++----- sample/Makefile.am | 2 +- test/Makefile.am | 2 +- test/regress.c | 8 +++++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/buffer.c b/buffer.c index 65b7bd3f..7454e840 100644 --- a/buffer.c +++ b/buffer.c @@ -226,9 +226,10 @@ evbuffer_drain(struct evbuffer *buf, size_t len) /* Reads data from an event buffer and drains the bytes read */ int -evbuffer_remove(struct evbuffer *buf, void *data, size_t datlen) +evbuffer_remove(struct evbuffer *buf, void *data_out, size_t datlen) { struct evbuffer_chain *chain = buf->first, *tmp; + char *data = data_out; size_t nread; if (datlen >= buf->total_len) @@ -332,7 +333,7 @@ u_char * evbuffer_pullup(struct evbuffer *buf, int size) { struct evbuffer_chain *chain = buf->first, *next, *tmp; - void *buffer; + u_char *buffer; if (size == -1) size = buf->total_len; @@ -555,9 +556,10 @@ evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out, /* Adds data to an event buffer */ int -evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen) +evbuffer_add(struct evbuffer *buf, const void *data_in, size_t datlen) { struct evbuffer_chain *chain = buf->last; + const u_char *data = data_in; size_t old_len = buf->total_len, remain, to_alloc; if (chain == NULL) { @@ -656,7 +658,7 @@ evbuffer_chain_align(struct evbuffer_chain *chain) int evbuffer_expand(struct evbuffer *buf, size_t datlen) { - struct evbuffer_chain *chain = buf->last; + struct evbuffer_chain *chain = buf->last, *tmp; size_t need, length; if (chain == NULL) { @@ -687,7 +689,7 @@ evbuffer_expand(struct evbuffer *buf, size_t datlen) length = chain->buffer_len << 1; if (length < datlen) length = datlen; - struct evbuffer_chain *tmp = evbuffer_chain_new(length); + tmp = evbuffer_chain_new(length); if (tmp == NULL) return (-1); chain->next = tmp; diff --git a/sample/Makefile.am b/sample/Makefile.am index 2f4e26e2..47254094 100644 --- a/sample/Makefile.am +++ b/sample/Makefile.am @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies LDADD = ../libevent.la -AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat +AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include noinst_PROGRAMS = event-test time-test signal-test diff --git a/test/Makefile.am b/test/Makefile.am index cf83494a..9fa76708 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = foreign no-dependencies -CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat +CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include EXTRA_DIST = regress.rpc regress.gen.h regress.gen.c diff --git a/test/regress.c b/test/regress.c index dac34246..9f4f76b6 100644 --- a/test/regress.c +++ b/test/regress.c @@ -896,6 +896,7 @@ test_evbuffer(void) static char buffer[512], *tmp; struct evbuffer *evb = evbuffer_new(); struct evbuffer *evb_two = evbuffer_new(); + size_t sz_tmp; int i; setup_test("Testing Evbuffer: "); @@ -951,9 +952,10 @@ test_evbuffer(void) goto out; /* test remove buffer */ - evbuffer_remove_buffer(evb, evb_two, sizeof(buffer) * 2.5); - if (EVBUFFER_LENGTH(evb_two) != sizeof(buffer) * 2.5 || - EVBUFFER_LENGTH(evb) != sizeof(buffer) * 0.5) + sz_tmp = sizeof(buffer)*2.5; + evbuffer_remove_buffer(evb, evb_two, sz_tmp); + if (EVBUFFER_LENGTH(evb_two) != sz_tmp || + EVBUFFER_LENGTH(evb) != sizeof(buffer) / 2) goto out; if (memcmp(evbuffer_pullup(