diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2009-12-17 00:44:59 +0300 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2009-12-17 00:44:59 +0300 |
commit | 5e8674eac1f294d05eb4dae1362675e9ee4f5945 (patch) | |
tree | e5d976d9bd24c0f6ad57cdbd03491d973abbb892 | |
parent | 3b967cdcd7ede960fb4756637ab532d8279d3e96 (diff) |
2009-12-16 Gonzalo Paniagua Javier <gonzalo@novell.com>
* zlib-helper.c: when finishing uncompressing a buffer, we might need
more than one call to deflate with Z_FINISH since the uncompressed
data can take more space than the allocated buffer.
Fixes the IPY+Chiron test case.
svn path=/branches/mono-2-4-3/mono/; revision=148595
-rw-r--r-- | support/ChangeLog | 8 | ||||
-rw-r--r-- | support/zlib-helper.c | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index df1423e6625..c128c0d34e3 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,11 @@ +2009-12-16 Gonzalo Paniagua Javier <gonzalo@novell.com> + + * zlib-helper.c: when finishing uncompressing a buffer, we might need + more than one call to deflate with Z_FINISH since the uncompressed + data can take more space than the allocated buffer. + + Fixes the IPY+Chiron test case. + 2009-10-24 Gonzalo Paniagua Javier <gonzalo@novell.com> * zlib-helper.c: stop trying to decompress when we get Z_STREAM_END. diff --git a/support/zlib-helper.c b/support/zlib-helper.c index 5e11cb341eb..1d61c3d35fb 100644 --- a/support/zlib-helper.c +++ b/support/zlib-helper.c @@ -104,9 +104,11 @@ CloseZStream (ZStream *zstream) status = 0; if (zstream->compress) { if (zstream->stream->total_out) { - status = deflate (zstream->stream, Z_FINISH); - flush_status = Flush (zstream); - if (status == Z_OK || status == Z_STREAM_END) + do { + status = deflate (zstream->stream, Z_FINISH); + flush_status = Flush (zstream); + } while (status == Z_OK); /* We want Z_STREAM_END or error here here */ + if (status == Z_STREAM_END) status = flush_status; } deflateEnd (zstream->stream); |