summaryrefslogtreecommitdiffstats
path: root/generic/tclZlib.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2016-04-04 10:03:40 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2016-04-04 10:03:40 (GMT)
commit082197d5c8f618d1cf78dffd199915806079b7de (patch)
treecb68882ce559d423af7a6ef11394623993dad295 /generic/tclZlib.c
parent514885892ef31d0ce71e8b1740b7ef838f459d99 (diff)
downloadtcl-082197d5c8f618d1cf78dffd199915806079b7de.zip
tcl-082197d5c8f618d1cf78dffd199915806079b7de.tar.gz
tcl-082197d5c8f618d1cf78dffd199915806079b7de.tar.bz2
Was handling the flushing at the end of the stream wrongly.tk_bug_9eb55debc5
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r--generic/tclZlib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 50d9a30..691d57a 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -1194,11 +1194,12 @@ Tcl_ZlibStreamPut(
zshPtr->stream.next_out = (Bytef *) dataTmp;
e = deflate(&zshPtr->stream, flush);
- while (e == Z_BUF_ERROR) {
+ while (e == Z_BUF_ERROR || (flush == Z_FINISH && e == Z_OK)) {
/*
- * Output buffer too small to hold the data being generated; so
- * put a new buffer into place after saving the old generated
- * data to the outData list.
+ * Output buffer too small to hold the data being generated or we
+ * are doing the end-of-stream flush (which can spit out masses of
+ * data). This means we need to put a new buffer into place after
+ * saving the old generated data to the outData list.
*/
obj = Tcl_NewByteArrayObj((unsigned char *) dataTmp, outSize);