aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorHimangi Saraogi <himangi774@gmail.com>2015-03-30 00:27:56 +0530
committerDiego Biurrun <diego@biurrun.de>2015-03-30 17:51:20 +0200
commit6ed38b1f65b424a4fa92042e0069f350b95e0098 (patch)
treee02ed1b6781a2b94efd057c0ca73fcf9cd76b202 /libavcodec
parent23944d29a22a2cd602753b3705f73011c3bf0b18 (diff)
downloadffmpeg-6ed38b1f65b424a4fa92042e0069f350b95e0098.tar.gz
tiff: Return more meaningful error codes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/tiffenc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 169360fdff..a020f5f61a 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -153,7 +153,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 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)
@@ -166,14 +167,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_UNKNOWN;
}
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:
@@ -182,7 +183,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(EINVAL);
}
}
@@ -291,7 +292,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);
}
if (s->compr == TIFF_DEFLATE ||