avcodec/libopenjpegdec: fix mixed declarations and code
authorJames Almer <jamrial@gmail.com>
Fri, 25 Mar 2016 03:04:57 +0000 (00:04 -0300)
committerJames Almer <jamrial@gmail.com>
Fri, 25 Mar 2016 03:04:57 +0000 (00:04 -0300)
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/libopenjpegdec.c

index cae3d20..65167e6 100644 (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;
         }