{
struct evbuffer_chain *chain;
int idx = 0;
- size_t len_so_far = 0;
+ ev_ssize_t len_so_far = 0;
EVBUFFER_LOCK(buffer, EVTHREAD_READ);
int n_vec;
// XXXX use ok
+ EVUTIL_ASSERT(nBytes >= 0); // XXXX Can this be false?
EVBUFFER_LOCK(evbuf, EVTHREAD_WRITE);
buf->read_in_progress = 0;
evbuffer_unfreeze(evbuf, 0);
iov[0].iov_base = buf_o->buffers[0].buf;
- if (nBytes <= buf_o->buffers[0].len) {
+ if ((size_t)nBytes <= buf_o->buffers[0].len) {
iov[0].iov_len = nBytes;
n_vec = 1;
} else {
/* could not get chunk size */
return (DATA_CORRUPTED);
}
- if (req->body_size + ntoread > req->evcon->max_body_size) {
+ if (req->body_size + (size_t)ntoread > req->evcon->max_body_size) {
/* failed body length test */
event_debug(("Request body is too long"));
return (DATA_TOO_LONG);
}
- req->body_size += ntoread;
+ req->body_size += (size_t)ntoread;
req->ntoread = ntoread;
if (req->ntoread == 0) {
/* Last chunk */
if (evcon == NULL)
return (NULL);
- evhttp_connection_set_max_headers_size(evcon, http->default_max_headers_size);
- evhttp_connection_set_max_body_size(evcon, http->default_max_body_size);
+ evcon->max_headers_size = http->default_max_headers_size;
+ evcon->max_body_size = http->default_max_body_size;
evcon->flags |= EVHTTP_CON_INCOMING;
evcon->state = EVCON_READING_FIRSTLINE;
tt_assert(evbuffer_get_length(evb) == i * sizeof(buffer));
/* test remove buffer */
- sz_tmp = sizeof(buffer)*2.5;
+ sz_tmp = (size_t)(sizeof(buffer)*2.5);
evbuffer_remove_buffer(evb, evb_two, sz_tmp);
tt_assert(evbuffer_get_length(evb_two) == sz_tmp);
tt_assert(evbuffer_get_length(evb) == sizeof(buffer) / 2);
{
struct evbuffer *buf = evbuffer_new();
const char *abc = "abcdefghijklmnopqrstvuwxyzabcdefghijklmnopqrstvuwxyzabcdefghijklmnopqrstvuwxyzabcdefghijklmnopqrstvuwxyz";
- int i, j, sum;
+ unsigned i, j, sum;
sum = 0;
for (i = 0; i < 1000; ++i) {
for (j = 1; j < strlen(abc); ++j) {
char format[32];
- evutil_snprintf(format, sizeof(format), "%%%d.%ds", j, j);
+ evutil_snprintf(format, sizeof(format), "%%%u.%us", j, j);
evbuffer_add_printf(buf, format, abc);
evbuffer_validate(buf);
ev_ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
{
const unsigned char *buffer;
- int i;
+ unsigned i;
buffer = evbuffer_pullup(src, evbuffer_get_length(src));
for (i = 0; i < evbuffer_get_length(src); i += 2) {
ev_ssize_t lim, enum bufferevent_flush_mode state, void *ctx)
{
const unsigned char *buffer;
- int i;
+ unsigned i;
buffer = evbuffer_pullup(src, evbuffer_get_length(src));
for (i = 0; i < evbuffer_get_length(src); ++i) {
static struct evdns_server_port *
get_generic_server(struct event_base *base,
- ev_uint64_t portnum,
+ ev_uint16_t portnum,
evdns_request_callback_fn_type cb,
void *arg)
{