On 28/03/15 2:52 PM, Justin Ruggles wrote: > On 03/28/2015 01:42 PM, Himangi Saraogi wrote: >> --- >> libavcodec/tiffenc.c | 11 ++++++----- >> 1 file changed, 6 insertions(+), 5 deletions(-) >> >> diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c >> index 169360f..46e4207 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_INVALIDDATA; > > This is an unknown error from an external library, so AVERROR_UNKNOWN should > be returned. > >> } >> 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_UNKNOWN; > > Should be AVERROR_BUG since compression type is an AVOption that has defined > bounds.
No, this should be AVERROR(EINVAL) because even inside the bounds there are several values for compressions that are not currently supported. i can do avconv -i INPUT -compression_algo 2 OUTPUT and it wouldn't be a bug, it would be an invalid argument. > >> } >> } >> >> @@ -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_INVALIDDATA; > > This really never should happen in practice, but at any rate the correct > error value is AVERROR(EINVAL) because it is an unsupported/invalid field set > by the user. > >> } >> >> if (s->compr == TIFF_DEFLATE || >> > > > Thanks, > Justin > > _______________________________________________ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel