]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/kmvc.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / kmvc.c
index 59ae9f26726b0d634b1e88d5d1a05856aa44daa8..2046d28f2ee799c12ad45afd86f0db7c83299121 100644 (file)
@@ -266,6 +266,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
     int header;
     int blocksize;
     const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
+    int ret;
 
     bytestream2_init(&ctx->g, avpkt->data, avpkt->size);
     if (ctx->pic.data[0])
@@ -273,9 +274,9 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
 
     ctx->pic.reference = 3;
     ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
-    if (avctx->get_buffer(avctx, &ctx->pic) < 0) {
+    if ((ret = avctx->get_buffer(avctx, &ctx->pic)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
+        return ret;
     }
 
     header = bytestream2_get_byte(&ctx->g);
@@ -323,7 +324,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
 
     if (blocksize != 8 && blocksize != 127) {
         av_log(avctx, AV_LOG_ERROR, "Block size = %i\n", blocksize);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     memset(ctx->cur, 0, 320 * 200);
     switch (header & KMVC_METHOD) {
@@ -339,7 +340,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
         break;
     default:
         av_log(avctx, AV_LOG_ERROR, "Unknown compression method %i\n", header & KMVC_METHOD);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     out = ctx->pic.data[0];
@@ -380,7 +381,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
 
     if (avctx->width > 320 || avctx->height > 200) {
         av_log(avctx, AV_LOG_ERROR, "KMVC supports frames <= 320x200\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     c->frm0 = av_mallocz(320 * 200);
@@ -389,7 +390,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
     c->prev = c->frm1;
 
     for (i = 0; i < 256; i++) {
-        c->pal[i] = 0xFF << 24 | i * 0x10101;
+        c->pal[i] = 0xFFU << 24 | i * 0x10101;
     }
 
     if (avctx->extradata_size < 12) {