On 28 March 2015 at 23:22, Justin Ruggles <[email protected]> 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.
>
> }
>> }
>>
>> @@ -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.
>
>
Since this is never to be reached, can we have an assert instead of return?
-Himangi
> }
>>
>> if (s->compr == TIFF_DEFLATE ||
>>
>>
>
> Thanks,
> Justin
>
> _______________________________________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-devel
>
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel