[FFmpeg-cvslog] sgi: Correctly propagate meaningful error values
Vittorio Giovara
git at videolan.org
Sun Nov 29 16:04:52 CET 2015
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Mon Nov 23 18:56:09 2015 -0500| [99cb833fc2d9874c62fffbcd3347fae660de0fe5] | committer: Vittorio Giovara
sgi: Correctly propagate meaningful error values
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99cb833fc2d9874c62fffbcd3347fae660de0fe5
---
libavcodec/sgidec.c | 11 ++++++-----
libavcodec/sgienc.c | 4 ++--
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index c827ff5..6f93a30 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;
diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c
index c5e66cd..2da4f51 100644
--- a/libavcodec/sgienc.c
+++ b/libavcodec/sgienc.c
@@ -193,7 +193,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
/* Make an intermediate consecutive buffer. */
if (!(encode_buf = av_malloc(width * bytes_per_channel)))
- return -1;
+ return AVERROR(ENOMEM);
for (z = 0; z < depth; z++) {
in_buf = p->data[0] + p->linesize[0] * (height - 1) + z * bytes_per_channel;
@@ -208,7 +208,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
bytes_per_channel);
if (length < 1) {
av_free(encode_buf);
- return -1;
+ return AVERROR_INVALIDDATA;
}
bytestream2_put_be32(&tablen_pcb, length);
More information about the ffmpeg-cvslog
mailing list