summaryrefslogtreecommitdiff
path: root/libavcodec/tiffenc.c
diff options
context:
space:
mode:
authorHimangi Saraogi <himangi774@gmail.com>2015-03-30 22:24:06 +0530
committerMichael Niedermayer <michaelni@gmx.at>2015-03-30 19:34:26 +0200
commit0187c2ccda3b00d22797170bf5675318dd0f675a (patch)
treefa0faf30358a5ce05dbc469091e661e825e512b4 /libavcodec/tiffenc.c
parentac9919b9662f28816cf79c1d5c36719160009588 (diff)
tiff: Return more meaningful error codes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiffenc.c')
-rw-r--r--libavcodec/tiffenc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 44cd9566f7..2cdac0b213 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -164,7 +164,8 @@ static int add_entry1(TiffEncoderContext *s,
* @param dst output buffer
* @param n size of input buffer
* @param compr compression method
- * @return number of output bytes. If an output error is encountered, -1 is returned
+ * @return number of output bytes. If an output error is encountered, a negative
+ * value corresponding to an AVERROR error code is returned.
*/
static int encode_strip(TiffEncoderContext *s, const int8_t *src,
uint8_t *dst, int n, int compr)
@@ -177,14 +178,14 @@ static int encode_strip(TiffEncoderContext *s, const int8_t *src,
unsigned long zlen = s->buf_size - (*s->buf - s->buf_start);
if (compress(dst, &zlen, src, n) != Z_OK) {
av_log(s->avctx, AV_LOG_ERROR, "Compressing failed\n");
- return -1;
+ return AVERROR_EXTERNAL;
}
return zlen;
}
#endif
case TIFF_RAW:
if (check_size(s, n))
- return -1;
+ return AVERROR(EINVAL);
memcpy(dst, src, n);
return n;
case TIFF_PACKBITS:
@@ -193,7 +194,9 @@ static int encode_strip(TiffEncoderContext *s, const int8_t *src,
case TIFF_LZW:
return ff_lzw_encode(s->lzws, src, n);
default:
- return -1;
+ av_log(s->avctx, AV_LOG_ERROR, "Unsupported compression method: %d\n",
+ compr);
+ return AVERROR(EINVAL);
}
}
@@ -304,7 +307,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
default:
av_log(s->avctx, AV_LOG_ERROR,
"This colors format is not supported\n");
- return -1;
+ return AVERROR(EINVAL);
}
for (i = 0; i < s->bpp_tab_size; i++)