diff options
author | James Almer <jamrial@gmail.com> | 2016-03-25 00:04:57 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2016-03-25 00:04:57 -0300 |
commit | 21cd0228beca6ad1d340536c7c90ceea6bc54bb4 (patch) | |
tree | e5462133576ea6866ea0f3456ed037bb45b39b18 /libavcodec | |
parent | 0cd9ff4e3aa23318a855c21d60b1c9035b2b99d2 (diff) | |
download | ffmpeg-21cd0228beca6ad1d340536c7c90ceea6bc54bb4.tar.gz |
avcodec/libopenjpegdec: fix mixed declarations and code
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libopenjpegdec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index cae3d20986..65167e6aee 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -126,10 +126,12 @@ typedef struct BufferReader { static OPJ_SIZE_T stream_read(void *out_buffer, OPJ_SIZE_T nb_bytes, void *user_data) { BufferReader *reader = user_data; + int remaining; + if (reader->pos == reader->size) { return (OPJ_SIZE_T)-1; } - int remaining = reader->size - reader->pos; + remaining = reader->size - reader->pos; if (nb_bytes > remaining) { nb_bytes = remaining; } @@ -149,10 +151,12 @@ static OPJ_OFF_T stream_skip(OPJ_OFF_T nb_bytes, void *user_data) nb_bytes = -reader->pos; } } else { + int remaining; + if (reader->pos == reader->size) { return (OPJ_SIZE_T)-1; } - int remaining = reader->size - reader->pos; + remaining = reader->size - reader->pos; if (nb_bytes > remaining) { nb_bytes = remaining; } |