From 2c62062e126913657ac52b56c2ec865f5c695f75 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 6 Dec 2016 11:55:44 +0300 Subject: [PATCH] Fix signedness differ for iov_base (solaris) --- buffer.c | 16 ++++++++-------- test/regress_zlib.c | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/buffer.c b/buffer.c index e68ef658..b7e3a69f 100644 --- a/buffer.c +++ b/buffer.c @@ -682,8 +682,8 @@ evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size, if ((chain = evbuffer_expand_singlechain(buf, size)) == NULL) goto done; - vec[0].iov_base = CHAIN_SPACE_PTR(chain); - vec[0].iov_len = (size_t) CHAIN_SPACE_LEN(chain); + vec[0].iov_base = (void *)CHAIN_SPACE_PTR(chain); + vec[0].iov_len = (size_t)CHAIN_SPACE_LEN(chain); EVUTIL_ASSERT(size<0 || (size_t)vec[0].iov_len >= (size_t)size); n = 1; } else { @@ -732,7 +732,7 @@ evbuffer_commit_space(struct evbuffer *buf, result = 0; goto done; } else if (n_vecs == 1 && - (buf->last && vec[0].iov_base == (void*)CHAIN_SPACE_PTR(buf->last))) { + (buf->last && vec[0].iov_base == (void *)CHAIN_SPACE_PTR(buf->last))) { /* The user only got or used one chain; it might not * be the first one with space in it. */ if ((size_t)vec[0].iov_len > (size_t)CHAIN_SPACE_LEN(buf->last)) @@ -758,7 +758,7 @@ evbuffer_commit_space(struct evbuffer *buf, for (i=0; i CHAIN_SPACE_LEN(chain)) goto done; chain = chain->next; @@ -2236,7 +2236,7 @@ evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch, size_t avail = (size_t) CHAIN_SPACE_LEN(chain); if (avail > (howmuch - so_far) && exact) avail = howmuch - so_far; - vecs[i].iov_base = CHAIN_SPACE_PTR(chain); + vecs[i].iov_base = (void *)CHAIN_SPACE_PTR(chain); vecs[i].iov_len = avail; so_far += avail; chain = chain->next; @@ -2789,8 +2789,8 @@ evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len, - start_at->internal_.pos_in_chain; idx = 1; if (n_vec > 0) { - vec[0].iov_base = chain->buffer + chain->misalign - + start_at->internal_.pos_in_chain; + vec[0].iov_base = (void *)(chain->buffer + chain->misalign + + start_at->internal_.pos_in_chain); vec[0].iov_len = len_so_far; } chain = chain->next; @@ -2811,7 +2811,7 @@ evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len, if (len >= 0 && len_so_far >= len) break; if (idxbuffer + chain->misalign; + vec[idx].iov_base = (void *)(chain->buffer + chain->misalign); vec[idx].iov_len = chain->off; } else if (len<0) { break; diff --git a/test/regress_zlib.c b/test/regress_zlib.c index 84066769..5fe77491 100644 --- a/test/regress_zlib.c +++ b/test/regress_zlib.c @@ -143,14 +143,14 @@ zlib_input_filter(struct evbuffer *src, struct evbuffer *dst, n = evbuffer_peek(src, -1, NULL, v_in, 1); if (n) { p->avail_in = v_in[0].iov_len; - p->next_in = v_in[0].iov_base; + p->next_in = (unsigned char *)v_in[0].iov_base; } else { p->avail_in = 0; p->next_in = 0; } evbuffer_reserve_space(dst, 4096, v_out, 1); - p->next_out = v_out[0].iov_base; + p->next_out = (unsigned char *)v_out[0].iov_base; p->avail_out = v_out[0].iov_len; /* we need to flush zlib if we got a flush */ @@ -197,14 +197,14 @@ zlib_output_filter(struct evbuffer *src, struct evbuffer *dst, n = evbuffer_peek(src, -1, NULL, v_in, 1); if (n) { p->avail_in = v_in[0].iov_len; - p->next_in = v_in[0].iov_base; + p->next_in = (unsigned char *)v_in[0].iov_base; } else { p->avail_in = 0; p->next_in = 0; } evbuffer_reserve_space(dst, 4096, v_out, 1); - p->next_out = v_out[0].iov_base; + p->next_out = (unsigned char *)v_out[0].iov_base; p->avail_out = v_out[0].iov_len; /* we need to flush zlib if we got a flush */ -- 2.40.0