Tcl Source Code

Artifact [1c6b14e303]
Login

Artifact 1c6b14e3039c9bdabe34e3058cf7ff112f526ef3:

Attachment "http.tcl.patch-1.67" to ticket [2046486fff] added by matzek 2008-08-11 21:03:49.
Index: http.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/http/http.tcl,v
retrieving revision 1.67
diff -u -r1.67 http.tcl
--- http.tcl	12 Mar 2008 10:01:02 -0000	1.67
+++ http.tcl	11 Aug 2008 14:02:07 -0000
@@ -1407,6 +1407,12 @@
     }
 
     binary scan [string range $data end-7 end] ii crc size
+    # This is needed for systems where int is 64bit wide. From binary scan man
+    # page: Note that the integers returned are signed, but they can be
+    # converted to unsigned 32-bit quantities using an expression like:
+    if {[expr {$crc >> 32}] == -1} {
+	set crc [expr {$crc & 0xffffffff}]
+    }
     set inflated [zlib inflate [string range $data $pos end-8]]
 
     if { $crc != [set chk [zlib crc32 $inflated]] } {