summaryrefslogtreecommitdiff
path: root/libavcodec/lcldec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-14 15:04:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-14 15:04:58 +0100
commit8943925d1f68316218a9722c3f275ae1ae29b325 (patch)
tree455f017242d1ab01e0eb2e4ae981b79e986e2015 /libavcodec/lcldec.c
parent329675cfd71fab29e47ea9c64f3560f0305dbf36 (diff)
parent688b132b881d423877e38dc82f17e23a604be676 (diff)
downloadffmpeg-8943925d1f68316218a9722c3f275ae1ae29b325.tar.gz
Merge commit '688b132b881d423877e38dc82f17e23a604be676'
* commit '688b132b881d423877e38dc82f17e23a604be676': qdrw: return meaningful error codes. qtrle: return a meaningful error code. gifdec: return meaningful error codes. interplayvideo: remove a static variable. interplayvideo: return meaningful error codes. lcldec: return meaningful error codes. targa: return meaningful error codes. qpeg: return a meaningful error code. nuv: return meaningful error codes. Conflicts: libavcodec/gifdec.c libavcodec/interplayvideo.c libavcodec/nuv.c libavcodec/qpeg.c libavcodec/targa.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/lcldec.c')
-rw-r--r--libavcodec/lcldec.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 5708a12d3d..159e0a1401 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -138,7 +138,7 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
int zret = inflateReset(&c->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
- return -1;
+ return AVERROR_UNKNOWN;
}
c->zstream.next_in = (uint8_t *)src;
c->zstream.avail_in = src_len;
@@ -147,12 +147,12 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
zret = inflate(&c->zstream, Z_FINISH);
if (zret != Z_OK && zret != Z_STREAM_END) {
av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
- return -1;
+ return AVERROR_UNKNOWN;
}
if (expected != (unsigned int)c->zstream.total_out) {
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
expected, c->zstream.total_out);
- return -1;
+ return AVERROR_UNKNOWN;
}
return c->zstream.total_out;
}
@@ -178,7 +178,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
unsigned int height = avctx->height; // Real image height
unsigned int mszh_dlen;
unsigned char yq, y1q, uq, vq;
- int uqvq;
+ int uqvq, ret;
unsigned int mthread_inlen, mthread_outlen;
unsigned int len = buf_size;
@@ -187,9 +187,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
c->pic.reference = 0;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if(ff_get_buffer(avctx, &c->pic) < 0){
+ if ((ret = ff_get_buffer(avctx, &c->pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
outptr = c->pic.data[0]; // Output image pointer
@@ -210,14 +210,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
if (mthread_outlen != mszh_dlen) {
av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n",
mthread_outlen, mszh_dlen);
- return -1;
+ return AVERROR_INVALIDDATA;
}
mszh_dlen = mszh_decomp(encoded + 8 + mthread_inlen, len - 8 - mthread_inlen,
c->decomp_buf + mthread_outlen, c->decomp_size - mthread_outlen);
if (mthread_outlen != mszh_dlen) {
av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n",
mthread_outlen, mszh_dlen);
- return -1;
+ return AVERROR_INVALIDDATA;
}
encoded = c->decomp_buf;
len = c->decomp_size;
@@ -226,7 +226,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
if (c->decomp_size != mszh_dlen) {
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n",
c->decomp_size, mszh_dlen);
- return -1;
+ return AVERROR_INVALIDDATA;
}
encoded = c->decomp_buf;
len = mszh_dlen;
@@ -257,7 +257,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
}
default:
av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
break;
#if CONFIG_ZLIB_DECODER
@@ -274,7 +274,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
break;
}
} else if (c->flags & FLAG_MULTITHREAD) {
- int ret;
mthread_inlen = AV_RL32(encoded);
mthread_inlen = FFMIN(mthread_inlen, len - 8);
mthread_outlen = AV_RL32(encoded+4);
@@ -294,7 +293,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
#endif
default:
av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in frame decoder compression switch.\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
@@ -378,7 +377,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
break;
default:
av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in pngfilter switch.\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
}
@@ -466,7 +465,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
break;
default:
av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in image decoder.\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
*got_frame = 1;