[FFmpeg-devel] [PATCH] tiff: Return more meaningful error codes
Himangi Saraogi
himangi774 at gmail.com
Sat Mar 28 18:41:16 CET 2015
---
libavcodec/tiffenc.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 44cd956..fc9b78e 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_INVALIDDATA;
}
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,7 @@ static int encode_strip(TiffEncoderContext *s, const int8_t *src,
case TIFF_LZW:
return ff_lzw_encode(s->lzws, src, n);
default:
- return -1;
+ return AVERROR_UNKNOWN;
}
}
@@ -304,7 +305,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_INVALIDDATA;
}
for (i = 0; i < s->bpp_tab_size; i++)
--
1.9.1
More information about the ffmpeg-devel
mailing list