size_t vs ssize_t for evbuffer_copyout
evbuffer_copyout returns a type of
ev_ssize_t, which maps to
ssize_t allowing for signed values. It returns the number of bytes read, or -1 if we can't drain the buffer.
ev_ssize_t evbuffer_copyout (struct evbuffer *buf, void *data_out, size_t datlen)
However, source:gdp/gdp_buf.c#L110 just uses
size_t. A simple fix would be just to correct it to
ssize_t, but that would change the API. What's a good fix?
#1 Updated by Nitesh Mor almost 7 years ago
- Related to Bug #15: Assertion error in Python API added
#2 Updated by Eric Allman almost 7 years ago
- Status changed from New to Closed
Changed it to return 0 instead of -1 on error. The error can only occur if you have called
evbuffer_freeze on it, which we don't use, so this is (probably) a "can't happen" condition.