static int decode_zbuf(AVBPrint *bp, const uint8_t *data,

                       const uint8_t *data_end)

{

    z_stream zstream;

    unsigned char *buf;

    unsigned buf_size;

    int ret;



    zstream.zalloc = ff_png_zalloc;

    zstream.zfree  = ff_png_zfree;

    zstream.opaque = NULL;

    if (inflateInit(&zstream) != Z_OK)

        return AVERROR_EXTERNAL;

    zstream.next_in  = (unsigned char *)data;

    zstream.avail_in = data_end - data;

    av_bprint_init(bp, 0, -1);



    while (zstream.avail_in > 0) {

        av_bprint_get_buffer(bp, 1, &buf, &buf_size);

        if (!buf_size) {

            ret = AVERROR(ENOMEM);

            goto fail;

        }

        zstream.next_out  = buf;

        zstream.avail_out = buf_size;

        ret = inflate(&zstream, Z_PARTIAL_FLUSH);

        if (ret != Z_OK && ret != Z_STREAM_END) {

            ret = AVERROR_EXTERNAL;

            goto fail;

        }

        bp->len += zstream.next_out - buf;

        if (ret == Z_STREAM_END)

            break;

    }

    inflateEnd(&zstream);

    bp->str[bp->len] = 0;

    return 0;



fail:

    inflateEnd(&zstream);

    av_bprint_finalize(bp, NULL);

    return ret;

}

static int decode_zbuf(AVBPrint *bp, const uint8_t *data,

                       const uint8_t *data_end)

{

    z_stream zstream;

    unsigned char *buf;

    unsigned buf_size;

    int ret;



    zstream.zalloc = ff_png_zalloc;

    zstream.zfree  = ff_png_zfree;

    zstream.opaque = NULL;

    if (inflateInit(&zstream) != Z_OK)

        return AVERROR_EXTERNAL;

    zstream.next_in  = (unsigned char *)data;

    zstream.avail_in = data_end - data;

    av_bprint_init(bp, 0, -1);



    while (zstream.avail_in > 0) {

        av_bprint_get_buffer(bp, 1, &buf, &buf_size);

        if (!buf_size) {

            ret = AVERROR(ENOMEM);

            goto fail;

        }

        zstream.next_out  = buf;

        zstream.avail_out = buf_size;

        ret = inflate(&zstream, Z_PARTIAL_FLUSH);

        if (ret != Z_OK && ret != Z_STREAM_END) {

            ret = AVERROR_EXTERNAL;

            goto fail;

        }

        bp->len += zstream.next_out - buf;

        if (ret == Z_STREAM_END)

            break;

    }

    inflateEnd(&zstream);

    bp->str[bp->len] = 0;

    return 0;



fail:

    inflateEnd(&zstream);

    av_bprint_finalize(bp, NULL);

    return ret;

}

        av_bprint_get_buffer(bp, 1, &buf, &buf_size);         if (!buf_size) {         zstream.avail_out = buf_size;
static int FUNC_0(AVBPrint *VAR_0, const uint8_t *VAR_1,

                       const uint8_t *VAR_2)

{

    z_stream zstream;

    unsigned char *VAR_3;

    unsigned VAR_4;

    int VAR_5;



    zstream.zalloc = ff_png_zalloc;

    zstream.zfree  = ff_png_zfree;

    zstream.opaque = NULL;

    if (inflateInit(&zstream) != Z_OK)

        return AVERROR_EXTERNAL;

    zstream.next_in  = (unsigned char *)VAR_1;

    zstream.avail_in = VAR_2 - VAR_1;

    av_bprint_init(VAR_0, 0, -1);



    while (zstream.avail_in > 0) {

        av_bprint_get_buffer(VAR_0, 1, &VAR_3, &VAR_4);

        if (!VAR_4) {

            VAR_5 = AVERROR(ENOMEM);

            goto fail;

        }

        zstream.next_out  = VAR_3;

        zstream.avail_out = VAR_4;

        VAR_5 = inflate(&zstream, Z_PARTIAL_FLUSH);

        if (VAR_5 != Z_OK && VAR_5 != Z_STREAM_END) {

            VAR_5 = AVERROR_EXTERNAL;

            goto fail;

        }

        VAR_0->len += zstream.next_out - VAR_3;

        if (VAR_5 == Z_STREAM_END)

            break;

    }

    inflateEnd(&zstream);

    VAR_0->str[VAR_0->len] = 0;

    return 0;



fail:

    inflateEnd(&zstream);

    av_bprint_finalize(VAR_0, NULL);

    return VAR_5;

}

static int FUNC_0(AVBPrint *VAR_0, const uint8_t *VAR_1,
const uint8_t *VAR_2)
{ z_stream zstream; unsigned char *VAR_3; unsigned VAR_4; int VAR_5; zstream.zalloc = ff_png_zalloc; zstream.zfree  = ff_png_zfree; zstream.opaque = NULL; if (inflateInit(&zstream) != Z_OK)
return AVERROR_EXTERNAL; zstream.next_in  = (unsigned char *)VAR_1; zstream.avail_in = VAR_2 - VAR_1; av_bprint_init(VAR_0, 0, -1); while (zstream.avail_in > 0) { av_bprint_get_buffer(VAR_0, 1, &VAR_3, &VAR_4); if (!VAR_4) { VAR_5 = AVERROR(ENOMEM); goto fail; } zstream.next_out  = VAR_3; zstream.avail_out = VAR_4; VAR_5 = inflate(&zstream, Z_PARTIAL_FLUSH); if (VAR_5 != Z_OK && VAR_5 != Z_STREAM_END) { VAR_5 = AVERROR_EXTERNAL; goto fail; } VAR_0->len += zstream.next_out - VAR_3; if (VAR_5 == Z_STREAM_END)
break; } inflateEnd(&zstream); VAR_0->str[VAR_0->len] = 0; return 0; fail:
inflateEnd(&zstream); av_bprint_finalize(VAR_0, NULL); return VAR_5; }