On Fri, 20 Feb 2015, 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..719b0ce 100644
--- 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.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to