From: Simon Glass Date: Tue, 2 Dec 2014 13:17:38 -0700 Subject: [U-Boot] [PATCH v2 10/12] bzlib: Update destLen even on error In-Reply-To: <1417551460-10000-1-git-send-email-sjg@chromium.org> References: <1417551460-10000-1-git-send-email-sjg@chromium.org> Message-ID: <1417551460-10000-11-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This allows the caller to easily detect how much of the destination buffer has been used. Signed-off-by: Simon Glass --- Changes in v2: None lib/bzlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bzlib.c b/lib/bzlib.c index 5844e18..9262e40 100644 --- a/lib/bzlib.c +++ b/lib/bzlib.c @@ -1350,11 +1350,11 @@ int BZ_API(BZ2_bzBuffToBuffDecompress) strm.avail_out = *destLen; ret = BZ2_bzDecompress ( &strm ); + *destLen -= strm.avail_out; if (ret == BZ_OK) goto output_overflow_or_eof; if (ret != BZ_STREAM_END) goto errhandler; /* normal termination */ - *destLen -= strm.avail_out; BZ2_bzDecompressEnd ( &strm ); return BZ_OK; -- 2.2.0.rc0.207.ga3a616c