diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-05-26 14:24:38 +0100 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-05-31 13:05:13 +0200 |
commit | bff0349d9da527084e1433167466d8afc9e25c7f (patch) | |
tree | 444ab4773f9fcca36c6f6403aa7f757dabed75bd /libavformat/aviobuf.c | |
parent | cffb9ea81bd16d2ed8bce187b6bf0279c07b3b9b (diff) | |
download | ffmpeg-bff0349d9da527084e1433167466d8afc9e25c7f.tar.gz |
avio: Add avio_read wrapper to simplify error checking
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 59f807cbd3..d3e3452954 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -496,6 +496,14 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) return size1 - size; } +int ffio_read_size(AVIOContext *s, unsigned char *buf, int size) +{ + int ret = avio_read(s, buf, size); + if (ret != size) + return AVERROR_INVALIDDATA; + return ret; +} + int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data) { if (s->buf_end - s->buf_ptr >= size && !s->write_flag) { |