Merge commit 'd509ae5be0a9bac35a4cedbe68b774a74446bb27'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 5 Feb 2014 00:18:48 +0000 (01:18 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 5 Feb 2014 00:18:48 +0000 (01:18 +0100)
* commit 'd509ae5be0a9bac35a4cedbe68b774a74446bb27':
  jvdec: K&R formatting cosmetics

Conflicts:
libavcodec/jvdec.c
libavformat/jvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/jvdec.c
libavformat/jvdec.c

@@@ -134,18 -136,15 +136,17 @@@ static inline void decode8x8(GetBitCont
      }
  }
  
- static int decode_frame(AVCodecContext *avctx,
-                         void *data, int *got_frame,
+ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                          AVPacket *avpkt)
  {
-     JvContext *s           = avctx->priv_data;
-     const uint8_t *buf     = avpkt->data;
+     JvContext *s = avctx->priv_data;
 -    int buf_size = avpkt->size;
+     const uint8_t *buf = avpkt->data;
 -    const uint8_t *buf_end = buf + buf_size;
 +    const uint8_t *buf_end = buf + avpkt->size;
      int video_size, video_type, i, j, ret;
  
 +    if (avpkt->size < 6)
 +        return AVERROR_INVALIDDATA;
 +
      video_size = AV_RL32(buf);
      video_type = buf[4];
      buf += 5;
  
              buf += video_size;
          } else if (video_type == 2) {
 -            if (buf + 1 <= buf_end) {
 -                int v = *buf++;
 -                for (j = 0; j < avctx->height; j++)
 -                    memset(s->frame->data[0] + j * s->frame->linesize[0],
 -                           v, avctx->width);
 -            }
 +            int v = *buf++;
 +            for (j = 0; j < avctx->height; j++)
-                 memset(s->frame->data[0] + j * s->frame->linesize[0], v, avctx->width);
++                memset(s->frame->data[0] + j * s->frame->linesize[0],
++                       v, avctx->width);
          } else {
-             av_log(avctx, AV_LOG_WARNING, "unsupported frame type %i\n", video_type);
+             av_log(avctx, AV_LOG_WARNING,
+                    "unsupported frame type %i\n", video_type);
              return AVERROR_INVALIDDATA;
          }
      }
@@@ -187,10 -189,9 +189,10 @@@ static int read_packet(AVFormatContext 
                      return AVERROR(ENOMEM);
  
                  AV_WL32(pkt->data, jvf->video_size);
-                 pkt->data[4]      = jvf->video_type;
 -                pkt->data[4] = jvf->video_type;
 -                if (avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size) < 0)
++                pkt->data[4]  = jvf->video_type;
 +                if ((size = avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size)) < 0)
                      return AVERROR(EIO);
 +                memset(pkt->data + JV_PREAMBLE_SIZE + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
  
                  pkt->size         = size + JV_PREAMBLE_SIZE;
                  pkt->stream_index = 1;