stream: reset buffer even on EOF/error

This probably didn't matter anywhere, but it's more proper.
This commit is contained in:
wm4 2013-06-06 20:39:50 +02:00
parent 236577af09
commit c5fd3412b6
1 changed files with 2 additions and 4 deletions

View File

@ -428,11 +428,9 @@ void stream_unread_buffer(stream_t *s, void *buffer, size_t buffer_size)
int stream_fill_buffer(stream_t *s)
{
int len = stream_read_unbuffered(s, s->buffer, STREAM_BUFFER_SIZE);
if (len <= 0)
return 0;
s->buf_pos = 0;
s->buf_len = len;
return len;
s->buf_len = len < 0 ? 0 : len;
return s->buf_len;
}
// Read between 1..buf_size bytes of data, return how much data has been read.