Skip to content
Snippets Groups Projects
Commit 7f7686df authored by Reimar Döffinger's avatar Reimar Döffinger
Browse files

Make get_buffer and get_partial_buffer return url_ferror or AVERROR_EOF as

appropriate if it couldn't read any data at all.
This should make handling of EOF and error simpler or make it work right without
extra code in a few place (e.g. raw demuxer).

Originally committed as revision 20135 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent de27f4d9
No related branches found
No related tags found
No related merge requests found
...@@ -415,6 +415,10 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size) ...@@ -415,6 +415,10 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
size -= len; size -= len;
} }
} }
if (size1 == size) {
if (url_ferror(s)) return url_ferror(s);
if (url_feof(s)) return AVERROR_EOF;
}
return size1 - size; return size1 - size;
} }
...@@ -434,6 +438,10 @@ int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) ...@@ -434,6 +438,10 @@ int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
len = size; len = size;
memcpy(buf, s->buf_ptr, len); memcpy(buf, s->buf_ptr, len);
s->buf_ptr += len; s->buf_ptr += len;
if (!len) {
if (url_ferror(s)) return url_ferror(s);
if (url_feof(s)) return AVERROR_EOF;
}
return len; return len;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment