[FFmpeg-cvslog] bfi: return meaningful error codes.

Anton Khirnov git at videolan.org
Mon Jan 7 00:03:26 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Nov 14 16:09:39 2012 +0100| [86e09b9e605e89855aa44724439b6e5b7fd93e4c] | committer: Anton Khirnov

bfi: return meaningful error codes.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86e09b9e605e89855aa44724439b6e5b7fd93e4c
---

 libavcodec/bfi.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c
index 50b20ba..1971c0c 100644
--- a/libavcodec/bfi.c
+++ b/libavcodec/bfi.c
@@ -55,16 +55,16 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
     uint8_t *src, *dst_offset, colour1, colour2;
     uint8_t *frame_end = bfi->dst + avctx->width * avctx->height;
     uint32_t *pal;
-    int i, j, height = avctx->height;
+    int i, j, ret, height = avctx->height;
 
     if (bfi->frame.data[0])
         avctx->release_buffer(avctx, &bfi->frame);
 
     bfi->frame.reference = 1;
 
-    if (ff_get_buffer(avctx, &bfi->frame) < 0) {
+    if ((ret = ff_get_buffer(avctx, &bfi->frame)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
+        return ret;
     }
 
     bytestream2_init(&g, avpkt->data, buf_size);
@@ -76,7 +76,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
         /* Setting the palette */
         if (avctx->extradata_size > 768) {
             av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n");
-            return -1;
+            return AVERROR_INVALIDDATA;
         }
         pal = (uint32_t *)bfi->frame.data[1];
         for (i = 0; i < avctx->extradata_size / 3; i++) {
@@ -104,7 +104,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
         if (!bytestream2_get_bytes_left(&g)) {
             av_log(avctx, AV_LOG_ERROR,
                    "Input resolution larger than actual frame.\n");
-            return -1;
+            return AVERROR_INVALIDDATA;
         }
 
         /* Get length and offset (if required) */
@@ -130,7 +130,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
         case 0:                // normal chain
             if (length >= bytestream2_get_bytes_left(&g)) {
                 av_log(avctx, AV_LOG_ERROR, "Frame larger than buffer.\n");
-                return -1;
+                return AVERROR_INVALIDDATA;
             }
             bytestream2_get_buffer(&g, dst, length);
             dst += length;



More information about the ffmpeg-cvslog mailing list