[vlc-devel] [PATCH] prefetch: don't do anything when reading 0 bytes
Steve Lhomme
robux4 at videolabs.io
Mon Feb 8 16:48:22 CET 2016
From: Steve Lhomme <robUx4 at gmail.com>
---
modules/stream_filter/prefetch.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/modules/stream_filter/prefetch.c b/modules/stream_filter/prefetch.c
index 89f2f99..72e7fd4 100644
--- a/modules/stream_filter/prefetch.c
+++ b/modules/stream_filter/prefetch.c
@@ -307,6 +307,8 @@ static ssize_t Read(stream_t *stream, void *buf, size_t buflen)
size_t copy;
bool eof;
+ if ( buflen == 0 )
+ return buflen;
if (buf == NULL)
{
Seek(stream, sys->stream_offset + buflen);
@@ -339,12 +341,9 @@ static ssize_t Read(stream_t *stream, void *buf, size_t buflen)
char *p = sys->buffer + (sys->stream_offset % sys->buffer_size);
if (copy > buflen)
copy = buflen;
- if (copy > 0)
- {
- memcpy(buf, p, copy);
- sys->stream_offset += copy;
- vlc_cond_signal(&sys->wait_space);
- }
+ memcpy(buf, p, copy);
+ sys->stream_offset += copy;
+ vlc_cond_signal(&sys->wait_space);
vlc_mutex_unlock(&sys->lock);
return copy;
}
--
2.7.0.windows.1
More information about the vlc-devel
mailing list