summaryrefslogtreecommitdiffstats
path: root/third_party/libevent/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libevent/buffer.c')
-rw-r--r--third_party/libevent/buffer.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/third_party/libevent/buffer.c b/third_party/libevent/buffer.c
index e66080f..dfaca5d 100644
--- a/third_party/libevent/buffer.c
+++ b/third_party/libevent/buffer.c
@@ -161,7 +161,7 @@ evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
if (sz < 0)
return (-1);
- if (sz < space) {
+ if ((size_t)sz < space) {
buf->off += sz;
if (buf->cb != NULL)
(*buf->cb)(buf, oldoff, buf->off, buf->cbarg);
@@ -225,7 +225,6 @@ evbuffer_readline(struct evbuffer *buffer)
if ((line = malloc(i + 1)) == NULL) {
fprintf(stderr, "%s: out of memory\n", __func__);
- evbuffer_drain(buffer, i);
return (NULL);
}
@@ -357,9 +356,9 @@ evbuffer_read(struct evbuffer *buf, int fd, int howmuch)
#if defined(FIONREAD)
#ifdef WIN32
long lng = n;
- if (ioctlsocket(fd, FIONREAD, &lng) == -1 || (n=lng) == 0) {
+ if (ioctlsocket(fd, FIONREAD, &lng) == -1 || (n=lng) <= 0) {
#else
- if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) {
+ if (ioctl(fd, FIONREAD, &n) == -1 || n <= 0) {
#endif
n = EVBUFFER_MAX_READ;
} else if (n > EVBUFFER_MAX_READ && n > howmuch) {
@@ -370,7 +369,7 @@ evbuffer_read(struct evbuffer *buf, int fd, int howmuch)
* about it. If the reader does not tell us how much
* data we should read, we artifically limit it.
*/
- if (n > buf->totallen << 2)
+ if ((size_t)n > buf->totallen << 2)
n = buf->totallen << 2;
if (n < EVBUFFER_MAX_READ)
n = EVBUFFER_MAX_READ;