diff options
author | Himangi Saraogi <himangi774@gmail.com> | 2015-03-04 21:14:04 +0530 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2015-03-04 23:44:01 +0100 |
commit | f3b74d944bdef9bbe81f7690f8d837d843ec13a6 (patch) | |
tree | b380813f47b8975c2cb852be4b254974921b8569 /libavcodec | |
parent | b72b212a4c43563f1b9fc3ce9a5ff91f89b857ac (diff) | |
download | ffmpeg-f3b74d944bdef9bbe81f7690f8d837d843ec13a6.tar.gz |
pcxenc: Return more meaningful error codes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pcxenc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/pcxenc.c b/libavcodec/pcxenc.c index 4bf7377f19..8553fe166e 100644 --- a/libavcodec/pcxenc.c +++ b/libavcodec/pcxenc.c @@ -68,7 +68,7 @@ static int pcx_rle_encode( uint8_t *dst, int dst_size, // check worst-case upper bound on dst_size if (dst_size < 2LL * src_plane_size * nplanes || src_plane_size <= 0) - return -1; + return AVERROR(EINVAL); for (p = 0; p < nplanes; p++) { int count = 1; @@ -112,7 +112,7 @@ static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (avctx->width > 65535 || avctx->height > 65535) { av_log(avctx, AV_LOG_ERROR, "image dimensions do not fit in 16 bits\n"); - return -1; + return AVERROR(EINVAL); } switch (avctx->pix_fmt) { @@ -137,7 +137,7 @@ static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt, break; default: av_log(avctx, AV_LOG_ERROR, "unsupported pixfmt\n"); - return -1; + return AVERROR(EINVAL); } line_bytes = (avctx->width * bpp + 7) >> 3; @@ -176,7 +176,7 @@ static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if ((written = pcx_rle_encode(buf, buf_end - buf, src, line_bytes, nplanes)) < 0) { av_log(avctx, AV_LOG_ERROR, "buffer too small\n"); - return -1; + return AVERROR_BUG; } buf += written; src += frame->linesize[0]; @@ -185,7 +185,7 @@ static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (nplanes == 1 && bpp == 8) { if (buf_end - buf < 257) { av_log(avctx, AV_LOG_ERROR, "buffer too small\n"); - return -1; + return AVERROR_BUG; } bytestream_put_byte(&buf, 12); for (i = 0; i < 256; i++) { |