summaryrefslogtreecommitdiffstats
path: root/generic/tclZlib.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-05-10 16:03:13 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-05-10 16:03:13 (GMT)
commitf705798ed75055121f844ffb6495de356773306f (patch)
tree620e18d988e661349d957eb09da1777d21f4b2f9 /generic/tclZlib.c
parentf816bb2a60b95431aff01e3f048b3da7353323f9 (diff)
parent54a8b027741ac316b067f829233dc6e55ed3acdb (diff)
downloadtcl-f705798ed75055121f844ffb6495de356773306f.zip
tcl-f705798ed75055121f844ffb6495de356773306f.tar.gz
tcl-f705798ed75055121f844ffb6495de356773306f.tar.bz2
merge trunk
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);