summaryrefslogtreecommitdiff
path: root/libavcodec/dxa.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-16 14:02:08 +0100
committerAnton Khirnov <anton@khirnov.net>2013-01-26 13:01:14 +0100
commitedb2426b75a151dacae6cafc09ad65cbd7d55e62 (patch)
treeca1aa2852e230dc8d2fcb132d5042638cd6f477f /libavcodec/dxa.c
parentadf0110d878d829f523a540d6815e2a2cc9f1344 (diff)
dxa: return meaningful error codes.
Diffstat (limited to 'libavcodec/dxa.c')
-rw-r--r--libavcodec/dxa.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c
index 0f590f1ed9..cfc014a77b 100644
--- a/libavcodec/dxa.c
+++ b/libavcodec/dxa.c
@@ -180,7 +180,7 @@ static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown opcode %d\n", type);
- return -1;
+ return AVERROR_INVALIDDATA;
}
}
dst += stride * 4;
@@ -196,7 +196,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
DxaDecContext * const c = avctx->priv_data;
uint8_t *outptr, *srcptr, *tmpptr;
unsigned long dsize;
- int i, j, compr;
+ int i, j, compr, ret;
int stride;
int orig_buf_size = buf_size;
int pc = 0;
@@ -216,9 +216,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
buf_size -= 768+4;
}
- 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;
}
memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE);
c->pic.palette_has_changed = pc;
@@ -236,7 +236,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
dsize = c->dsize;
if((compr != 4 && compr != -1) && uncompress(c->decomp_buf, &dsize, buf + 9, buf_size - 9) != Z_OK){
av_log(avctx, AV_LOG_ERROR, "Uncompress failed!\n");
- return -1;
+ return AVERROR_UNKNOWN;
}
switch(compr){
case -1:
@@ -275,7 +275,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown/unsupported compression type %d\n", buf[4]);
- return -1;
+ return AVERROR_INVALIDDATA;
}
FFSWAP(AVFrame, c->pic, c->prev);
@@ -298,7 +298,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->dsize = avctx->width * avctx->height * 2;
if((c->decomp_buf = av_malloc(c->dsize)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
- return -1;
+ return AVERROR(ENOMEM);
}
return 0;