From 1e7b986827f2654de500678ef56dcbaecd5a08d4 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 11 Mar 2010 14:23:02 -0500 Subject: [PATCH] Fix last_with_data compilation on windows --- buffer.c | 2 +- buffer_iocp.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/buffer.c b/buffer.c index 6f56dcb8..20454197 100644 --- a/buffer.c +++ b/buffer.c @@ -1770,7 +1770,7 @@ evbuffer_read(struct evbuffer *buf, evutil_socket_t fd, int howmuch) nvecs = _evbuffer_read_setup_vecs(buf, howmuch, ev_vecs, 2, &chain, 1); - for (i=0; i < n_vecs; ++i) + for (i=0; i < nvecs; ++i) WSABUF_FROM_EVBUFFER_IOV(&vecs[i], &ev_vecs[i]); #endif diff --git a/buffer_iocp.c b/buffer_iocp.c index 40007cd1..cdf2eaa5 100644 --- a/buffer_iocp.c +++ b/buffer_iocp.c @@ -249,12 +249,15 @@ evbuffer_launch_read(struct evbuffer *buf, size_t at_most, buf_o->n_buffers = 0; memset(buf_o->buffers, 0, sizeof(buf_o->buffers)); - if (_evbuffer_expand_fast(buf, at_most) == -1) + if (_evbuffer_expand_fast(buf, at_most, 2) == -1) goto done; evbuffer_freeze(buf, 0); + /* XXX This and evbuffer_read_setup_vecs() should say MAX_WSABUFS, + * not "2". But commit_read() above can't handle more than two + * buffers yet. */ nvecs = _evbuffer_read_setup_vecs(buf, at_most, - vecs, &chain, 1); + vecs, 2, &chain, 1); for (i=0;ibuffers[i], -- 2.40.0