avcodec/libopenjpegdec: fix mixed declarations and code

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2016-03-25 00:04:57 -03:00
parent 0cd9ff4e3a
commit 21cd0228be

View File

@ -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;
}