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

Anton Khirnov git at videolan.org
Thu Dec 13 12:16:40 CET 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Dec  8 10:11:13 2012 +0100| [c4182d72c9b6614490ba241c6721273ea2d784f4] | committer: Anton Khirnov

svq1: return meaningful error codes.

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

 libavcodec/svq1dec.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index 704cf58..25837f5 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -192,7 +192,7 @@ static int svq1_decode_block_intra(GetBitContext *bitbuf, uint8_t *pixels,
             av_dlog(NULL,
                     "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",
                     stages, level);
-            return -1;  /* invalid vector */
+            return AVERROR_INVALIDDATA;  /* invalid vector */
         }
 
         mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
@@ -254,7 +254,7 @@ static int svq1_decode_block_non_intra(GetBitContext *bitbuf, uint8_t *pixels,
             av_dlog(NULL,
                     "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",
                     stages, level);
-            return -1;  /* invalid vector */
+            return AVERROR_INVALIDDATA;  /* invalid vector */
         }
 
         mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
@@ -287,7 +287,7 @@ static int svq1_decode_motion_vector(GetBitContext *bitbuf, svq1_pmv *mv,
         /* get motion code */
         diff = get_vlc2(bitbuf, svq1_motion_component.table, 7, 2);
         if (diff < 0)
-            return -1;
+            return AVERROR_INVALIDDATA;
         else if (diff) {
             if (get_bits1(bitbuf))
                 diff = -diff;
@@ -576,7 +576,7 @@ static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
             s->height = get_bits(bitbuf, 12);
 
             if (!s->width || !s->height)
-                return -1;
+                return AVERROR_INVALIDDATA;
         } else {
             /* get width, height from table */
             s->width  = ff_svq1_frame_size_table[frame_size_code].width;
@@ -590,7 +590,7 @@ static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
         skip_bits1(bitbuf);    /* component checksums after image data if (1) */
 
         if (get_bits(bitbuf, 2) != 0)
-            return -1;
+            return AVERROR_INVALIDDATA;
     }
 
     if (get_bits1(bitbuf) == 1) {
@@ -627,7 +627,7 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
     s->frame_code = get_bits(&s->gb, 22);
 
     if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60))
-        return -1;
+        return AVERROR_INVALIDDATA;
 
     /* swap some header bytes (why?) */
     if (s->frame_code != 0x20) {
@@ -657,7 +657,7 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
 
     pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv));
     if (!pmv)
-        return -1;
+        return AVERROR(ENOMEM);
 
     /* decode y, u and v components */
     for (i = 0; i < 3; i++) {



More information about the ffmpeg-cvslog mailing list