[U-Boot] [PATCH v2 10/12] bzlib: Update destLen even on error
Simon Glass
sjg at chromium.org
Tue Dec 2 21:17:38 CET 2014
This allows the caller to easily detect how much of the destination buffer
has been used.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
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
More information about the U-Boot
mailing list