From 30d54fb7f03e0a3367e0b4473812cb7a101e6e5a Mon Sep 17 00:00:00 2001
From: Wojciech Kocjan <zoro2@users.sourceforge.net>
Date: Thu, 12 Jul 2012 13:36:18 +0000
Subject: [PATCH] 2012-07-12  Wojciech Kocjan <zoro2@users.sourceforge.net>

	* zipvfs.tcl: Fix for Tcl 8.6 not properly streaming large files with
	very big compression ratio, bug 3542959
---
 ChangeLog          | 5 +++++
 library/zipvfs.tcl | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 1075db4..16a9473 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-12  Wojciech Kocjan <zoro2@users.sourceforge.net>
+
+	* zipvfs.tcl: Fix for Tcl 8.6 not properly streaming large files with
+	very big compression ratio, bug 3542959
+
 2012-07-04  Wojciech Kocjan <zoro2@users.sourceforge.net>
 
 	* zipvfs.tcl: Fix for streaming not working properly in certain zip
diff --git a/library/zipvfs.tcl b/library/zipvfs.tcl
index 0c5cc6e..bdb9653 100644
--- a/library/zipvfs.tcl
+++ b/library/zipvfs.tcl
@@ -852,7 +852,9 @@ proc ::zip::zstream_handler {istart ifd clen ilen cmd fd {a1 ""} {a2 ""}} {
 		    set data [read $ifd $c]
 		    set tell [tell $ifd]
 		    zstream_put $fd $data
-		    append buf [zstream_get $fd]
+		    while {[string length [set bufdata [zstream_get $fd]]] > 0} {
+			append buf $bufdata
+		    }
 		}
 	    }
 	    return $r
-- 
2.23.0