diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-11-11 09:44:36 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-11-11 09:44:36 +0000 |
commit | 2a374f06c441c0feb5c576b65049f5fbb342f6cd (patch) | |
tree | 299884745e0142caa008a380ad01a2d62ca3f96a /libavcodec/targa.c | |
parent | 7dab48bb73abafbb00dbb4cb84db838292388790 (diff) | |
download | ffmpeg-2a374f06c441c0feb5c576b65049f5fbb342f6cd.tar.gz |
targa: return more meaningful error codes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/targa.c')
-rw-r--r-- | libavcodec/targa.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/targa.c b/libavcodec/targa.c index e1d83b9b12..67ed0d5b33 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -115,7 +115,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame * const p = &s->picture; uint8_t *dst; int stride; - int idlen, pal, compr, y, w, h, bpp, flags; + int idlen, pal, compr, y, w, h, bpp, flags, ret; int first_clr, colors, csize; int interleave; @@ -166,19 +166,19 @@ static int decode_frame(AVCodecContext *avctx, break; default: av_log(avctx, AV_LOG_ERROR, "Bit depth %i is not supported\n", bpp); - return -1; + return AVERROR_INVALIDDATA; } if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); - if (av_image_check_size(w, h, 0, avctx)) - return -1; + if ((ret = av_image_check_size(w, h, 0, avctx))) + return ret; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); - if (avctx->get_buffer(avctx, p) < 0) { + if ((ret = avctx->get_buffer(avctx, p)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; + return ret; } if (flags & TGA_TOPTOBOTTOM) { @@ -196,7 +196,7 @@ static int decode_frame(AVCodecContext *avctx, int pal_size, pal_sample_size; if ((colors + first_clr) > 256) { av_log(avctx, AV_LOG_ERROR, "Incorrect palette: %i colors with offset %i\n", colors, first_clr); - return -1; + return AVERROR_INVALIDDATA; } switch (csize) { case 32: pal_sample_size = 4; break; @@ -205,7 +205,7 @@ static int decode_frame(AVCodecContext *avctx, case 15: pal_sample_size = 2; break; default: av_log(avctx, AV_LOG_ERROR, "Palette entry size %i bits is not supported\n", csize); - return -1; + return AVERROR_INVALIDDATA; } pal_size = colors * pal_sample_size; if (avctx->pix_fmt != AV_PIX_FMT_PAL8) //should not occur but skip palette anyway |