On Thu, Feb 19, 2015 at 10:44:52PM +0200, Martin Storsjö wrote:
> On Fri, 20 Feb 2015, Himangi Saraogi wrote:
> >--- a/libavcodec/tiffenc.c
> >+++ b/libavcodec/tiffenc.c
> >@@ -164,16 +164,17 @@ static int encode_strip(TiffEncoderContext *s, const 
> >int8_t *src,
> >    case TIFF_ADOBE_DEFLATE:
> >    {
> >        unsigned long zlen = s->buf_size - (*s->buf - s->buf_start);
> >-        if (compress(dst, &zlen, src, n) != Z_OK) {
> >+        int ret = compress(dst, &zlen, src, n);
> >+        if (ret != Z_OK) {
> >            av_log(s->avctx, AV_LOG_ERROR, "Compressing failed\n");
> >-            return -1;
> >+            return ret;
> >        }
> 
> No, Diego's comment was wrong (as I pointed out in a reply). You can't
> expect that compress return codes are in the same range as AVERROR codes.
> 
> If they happen to be errno codes (which they aren't), you could do
> AVERROR(ret).
> 
> But in this case, you either would have to do a large overkill function
> trying to map compress return codes into corresponding AVERROR ones, or just
> have it return AVERROR_INVALIDDATA or AVERROR_UNKNOWN.

Maybe such a function could be useful in general?  We have many files that
use zlib in one form or another ...

Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to