Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2010-04-22 08:59:39 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2010-04-22 08:59:39 +0400
commite74a474b01887eab204a7b5dd09f2310089db463 (patch)
treed16e5416e8cff12bb308887f61c01ccf9a8ace69
parent5218269b31fecf3e2e78535331cce0d755117717 (diff)
2010-04-19 Gonzalo Paniagua Javier <gonzalo@novell.com>
* zlib-helper.c: don't call Z_FINISH if nothing has been written. svn path=/branches/mono-2-6-4/mono/; revision=155928
-rw-r--r--support/ChangeLog4
-rw-r--r--support/zlib-helper.c14
2 files changed, 12 insertions, 6 deletions
diff --git a/support/ChangeLog b/support/ChangeLog
index 73d71676a16..4465714868b 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-19 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+ * zlib-helper.c: don't call Z_FINISH if nothing has been written.
+
2010-04-07 Gonzalo Paniagua Javier <gonzalo@novell.com>
* zlib-helper.c: now that we don't use Z_SYNC_FLUSH, there might be
diff --git a/support/zlib-helper.c b/support/zlib-helper.c
index 23c662bf74d..66b58663a5e 100644
--- a/support/zlib-helper.c
+++ b/support/zlib-helper.c
@@ -103,12 +103,14 @@ CloseZStream (ZStream *zstream)
status = 0;
if (zstream->compress) {
- 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;
+ if (zstream->stream->total_in > 0) {
+ 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);
} else {
inflateEnd (zstream->stream);