From ddd6157459b90ffcde73242acf985607abef2a9c Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 5 Oct 2006 01:54:36 +0000 Subject: [PATCH] fix for PR8331 svn: r4487 original commit: 4f7cc1e56b37485e565f5b0e3ed2d93ac51f49b8 --- collects/mzlib/deflate.ss | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/collects/mzlib/deflate.ss b/collects/mzlib/deflate.ss index 3cf85b0..5a24fae 100644 --- a/collects/mzlib/deflate.ss +++ b/collects/mzlib/deflate.ss @@ -2050,11 +2050,10 @@ ;; * Write out any remaining bits in an incomplete byte. ;; */ (define (bi_windup) - (cond - [(> bi_valid 8) - (put_short bi_buf)] - [(> bi_valid 0) - (put_byte bi_buf)]) + (cond [(> bi_valid 8) + (put_short bi_buf)] + [(> bi_valid 0) + (put_byte bi_buf)]) (set! bi_buf 0) (set! bi_valid 0) (set! bits_sent (bitwise-and (+ bits_sent 7) (bitwise-not 7)))) @@ -2253,9 +2252,15 @@ (values bytes_in bytes_out (bitwise-xor crc #xffffffff))) (define (gzip-through-ports in out origname time_stamp) - + (define flags (if origname #x8 0)) ;; /* general purpose bit flags */ + ;; make origname be a byte string + (set! origname (cond [(not origname) #f] + [(string? origname) (string->bytes/utf-8 origname)] + [(path? origname) (path->bytes origname)] + [else origname])) + (set! bytes_in 0) (set! ifd in) @@ -2275,14 +2280,14 @@ (bi_init) (ct_init) - + (put_byte (lm_init LEVEL));; /* extra flags */ (put_byte 3) ;; /* OS identifier */ - + (when origname - (for-each put_byte (map char->integer (string->list origname))) + (for-each put_byte (bytes->list origname)) (put_byte 0)) - + (do-deflate) ;; /* Write the crc and uncompressed size */