diff options
author | wm4 <wm4@nowhere> | 2013-07-04 17:58:48 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-04 17:58:48 +0200 |
commit | 50274ca3b0d513a421dd2d5e6bb36daf48169891 (patch) | |
tree | 3e3e98e5276b347900ff04e08b28e660732343d5 /stream | |
parent | d084f72a6cf47b9c232243398fced85c4c620ff6 (diff) | |
download | mpv-50274ca3b0d513a421dd2d5e6bb36daf48169891.tar.bz2 mpv-50274ca3b0d513a421dd2d5e6bb36daf48169891.tar.xz |
stream: make eof flag more consistent
When reading something successfully, the eof flag should never be 1, so
clear it in these situations. The eof flag will be set properly on the
next read call.
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/stream/stream.c b/stream/stream.c index 13afb64f98..5d2ef46f96 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -432,6 +432,8 @@ int stream_read_partial(stream_t *s, char *buf, int buf_size) int len = FFMIN(buf_size, s->buf_len - s->buf_pos); memcpy(buf, &s->buffer[s->buf_pos], len); s->buf_pos += len; + if (len > 0) + s->eof = 0; return len; } @@ -445,7 +447,10 @@ int stream_read(stream_t *s, char *mem, int total) mem += read; len -= read; } - return total - len; + total -= len; + if (total > 0) + s->eof = 0; + return total; } // Read ahead at most len bytes without changing the read position. Return a |