[FFmpeg-cvslog] pcx: return meaningful error codes.
Anton Khirnov
git at videolan.org
Mon Jan 14 14:49:06 CET 2013
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Nov 17 17:57:06 2012 +0100| [a1c525f7eb0783d31ba7a653865b6cbd3dc880de] | committer: Anton Khirnov
pcx: return meaningful error codes.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1c525f7eb0783d31ba7a653865b6cbd3dc880de
---
libavcodec/pcx.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
index 1bd8612..04770a9 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -94,7 +94,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (buf[0] != 0x0a || buf[1] > 5) {
av_log(avctx, AV_LOG_ERROR, "this is not PCX encoded data\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
compressed = buf[2];
@@ -105,7 +105,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (xmax < xmin || ymax < ymin) {
av_log(avctx, AV_LOG_ERROR, "invalid image dimensions\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
w = xmax - xmin + 1;
@@ -118,7 +118,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (bytes_per_scanline < w * bits_per_pixel * nplanes / 8) {
av_log(avctx, AV_LOG_ERROR, "PCX data is corrupted\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
switch ((nplanes<<8) + bits_per_pixel) {
@@ -136,7 +136,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid PCX file\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
buf += 128;
@@ -144,13 +144,13 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (p->data[0])
avctx->release_buffer(avctx, p);
- if (av_image_check_size(w, h, 0, avctx))
- return -1;
+ if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
+ return ret;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if (ff_get_buffer(avctx, p) < 0) {
+ if ((ret = ff_get_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
p->pict_type = AV_PICTURE_TYPE_I;
More information about the ffmpeg-cvslog
mailing list