summaryrefslogtreecommitdiff
path: root/libavcodec/sgidec.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-11-23 18:56:09 -0500
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-11-24 09:05:01 -0500
commit99cb833fc2d9874c62fffbcd3347fae660de0fe5 (patch)
tree3ba4707143e76ea076fb85eafa1d4b16650d6996 /libavcodec/sgidec.c
parent823fa7004571cb8404ca5785f9fa6e85f0f9f3d3 (diff)
sgi: Correctly propagate meaningful error values
Diffstat (limited to 'libavcodec/sgidec.c')
-rw-r--r--libavcodec/sgidec.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index c827ff5559..6f93a3059e 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -229,13 +229,13 @@ static int decode_frame(AVCodecContext *avctx,
if (s->bytes_per_channel != 1 && s->bytes_per_channel != 2) {
av_log(avctx, AV_LOG_ERROR, "wrong channel number\n");
- return -1;
+ return AVERROR(EINVAL);
}
/* Check for supported image dimensions. */
if (dimension != 2 && dimension != 3) {
av_log(avctx, AV_LOG_ERROR, "wrong dimension number\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (s->depth == SGI_GRAYSCALE) {
@@ -246,16 +246,17 @@ static int decode_frame(AVCodecContext *avctx,
avctx->pix_fmt = s->bytes_per_channel == 2 ? AV_PIX_FMT_RGBA64BE : AV_PIX_FMT_RGBA;
} else {
av_log(avctx, AV_LOG_ERROR, "wrong picture format\n");
- return -1;
+ return AVERROR(EINVAL);
}
ret = ff_set_dimensions(avctx, s->width, s->height);
if (ret < 0)
return ret;
- if (ff_get_buffer(avctx, p, 0) < 0) {
+ ret = ff_get_buffer(avctx, p, 0);
+ if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed.\n");
- return -1;
+ return ret;
}
p->pict_type = AV_PICTURE_TYPE_I;