Posted to tcl by patthoyts at Tue Mar 10 13:00:19 GMT 2009view pretty

Avoid using the core 8.6 zlib code for vfs::zstream until we can seek it.
(used by mk4vfs)

Index: library/vfslib.tcl
===================================================================
RCS file: /cvsroot/tclvfs/tclvfs/library/vfslib.tcl,v
retrieving revision 1.10
diff -u -r1.10 vfslib.tcl
--- library/vfslib.tcl	22 Jan 2009 15:10:10 -0000	1.10
+++ library/vfslib.tcl	19 Feb 2009 20:05:52 -0000
@@ -34,7 +34,7 @@
 # Also provide an abstract zlib streaming channel transform using the core
 # zlib command (8.6) or the tclkit zlib package.
 #
-if {[package vsatisfies [package provide Tcl] 8.6]} {
+if {[package vsatisfies [package provide Tcl] 8.9]} {
 
     proc vfs::zstream {mode ifd clen ilen} {
         return [zlib push $mode $ifd]
@@ -251,32 +251,24 @@
 
     variable ::vfs::zseq 0	;# used to generate temp zstream cmd names
 
-    # vfs::zstream --
-    #	wrapper to manage a stacked zlib channel. If we have the core
-    #	zlib implementation then make use of that. Otherwise we can use
-    #	rechan and the tclkit zlib package to do the same thing.
+    # vfs::zstream -- 
+    #
+    #  Create a read-only seekable compressed channel using rechan and
+    #  the streaming mode of zlib.
     #
     #	  mode - compress or decompress
     #	  ifd  - input channel (should be binary)
     #	  clen - size of compressed data in bytes
     #	  ilen - size of decompressed data in bytes
-    # Result:
-    #	A stacked channel then handles compression for us.
     #
-    if {[package vsatisfies [package provide Tcl] 8.6]} {
-        proc vfs::zstream {mode ifd clen ilen} {
-            return [zlib push $mode $ifd]
-        }
-    } else {
-        proc vfs::zstream {mode ifd clen ilen} {
-            set cname _zstream_[incr ::vfs::zseq]
-            zlib s$mode $cname
-            fconfigure $ifd -translation binary
-            set cmd [list ::vfs::zstream_handler $cname $ifd $clen $ilen s$mode]
-            set fd [rechan $cmd 2]
-            set ::vfs::_zstream_pos($fd) 0
-            return $fd
-        }
+    proc vfs::zstream {mode ifd clen ilen} {
+        set cname _zstream_[incr ::vfs::zseq]
+        zlib s$mode $cname
+        fconfigure $ifd -translation binary
+        set cmd [list ::vfs::zstream_handler $cname $ifd $clen $ilen s$mode]
+        set fd [rechan $cmd 2]
+        set ::vfs::_zstream_pos($fd) 0
+        return $fd
     }
 }