From: Paul Marquess Date: Sun, 17 Jun 2007 01:43:11 +0000 (+0100) Subject: EBCDIC fixes for gzip X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3006a4e1991c29fe722177d0ddb5a525c7ce8822;p=p5sagit%2Fp5-mst-13.2.git EBCDIC fixes for gzip From: "Paul Marquess" Message-ID: <004001c7b078$7cc2e520$6701a8c0@myopwv.com> p4raw-id: //depot/perl@31402 --- diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm index 3ccb042..c1e4e57 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Gzip/Constants.pm @@ -92,8 +92,19 @@ use constant GZIP_FEXTRA_SUBFIELD_HEADER_SIZE => GZIP_FEXTRA_SUBFIELD_ID_SIZE + use constant GZIP_FEXTRA_SUBFIELD_MAX_SIZE => GZIP_FEXTRA_MAX_SIZE - GZIP_FEXTRA_SUBFIELD_HEADER_SIZE ; - $GZIP_FNAME_INVALID_CHAR_RE = '[\x00-\x1F\x7F-\x9F]'; - $GZIP_FCOMMENT_INVALID_CHAR_RE = '[\x00-\x09\x11-\x1F\x7F-\x9F]'; + +if (ord('A') == 193) +{ + # EBCDIC + $GZIP_FNAME_INVALID_CHAR_RE = '[\x00-\x03\x37\x2d-\x2f\x16\x05\x15\x0b-\x13\x3c\x3d\x32\x26\x18\x19\x3f\x27\x1c-\x1f\x07\x20-\x25\x06\x17\x28-\x2c\x09\x0a\x1b\x30\x31\x1a\x33-\x36\x08\x38-\x3b\x04\x14\x3e\xff]'; + $GZIP_FCOMMENT_INVALID_CHAR_RE = '[\x00-\x03\x37\x2d-\x2f\x16\x05\x15\x0b-\x0f\x11-\x13\x3c\x3d\x32\x26\x18\x19\x3f\x27\x1c-\x1f\x07\x20-\x25\x06\x17\x28-\x2c\x09\x0a\x1b\x30\x31\x1a\x33-\x36\x08\x38-\x3b\x04\x14\x3e\xff]'; + +} +else +{ + $GZIP_FNAME_INVALID_CHAR_RE = '[\x00-\x1F\x7F-\x9F]'; + $GZIP_FCOMMENT_INVALID_CHAR_RE = '[\x00-\x09\x11-\x1F\x7F-\x9F]'; +} use constant GZIP_FHCRC_SIZE => 2 ; # aka CONTINUATION in gzip diff --git a/ext/IO_Compress_Zlib/t/004gziphdr.t b/ext/IO_Compress_Zlib/t/004gziphdr.t index c09fc32..4b78b3a 100644 --- a/ext/IO_Compress_Zlib/t/004gziphdr.t +++ b/ext/IO_Compress_Zlib/t/004gziphdr.t @@ -165,7 +165,7 @@ for my $value ( "0D", "0A", "0A0D", "0D0A", "0A0A", "0D0D") { title "Comment with $value" ; - my $v = pack "H*", $value; + my $v = pack "h*", $value; my $comment = "my${v}comment$v"; my $hdr = readHeaderInfo $name, Time => 0,