From: Steve Peters Date: Sun, 4 Mar 2007 07:01:34 +0000 (+0000) Subject: Upgrade to IO-Compress-Base-2.004, Compress-Raw-Zlib-2.004, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4e7676c784119f034a642411bdc4cde7d6f0c54a;p=p5sagit%2Fp5-mst-13.2.git Upgrade to IO-Compress-Base-2.004, Compress-Raw-Zlib-2.004, IO-Compress-Zlib-2.004, and Compress-Zlib-2.004. p4raw-id: //depot/perl@30458 --- diff --git a/ext/Compress/Raw/Zlib/Changes b/ext/Compress/Raw/Zlib/Changes index 1295b1e..ef8ddab 100644 --- a/ext/Compress/Raw/Zlib/Changes +++ b/ext/Compress/Raw/Zlib/Changes @@ -1,6 +1,12 @@ CHANGES ------- + 2.004 3 March 2007 + + * Fixed lvalue substr issue + + * Remove redundant code from Zlib.xs + 2.003 2 January 2007 * Added explicit version checking diff --git a/ext/Compress/Raw/Zlib/Makefile.PL b/ext/Compress/Raw/Zlib/Makefile.PL index 294c87f..7629725 100644 --- a/ext/Compress/Raw/Zlib/Makefile.PL +++ b/ext/Compress/Raw/Zlib/Makefile.PL @@ -95,6 +95,9 @@ WriteMakefile( : () ), + ((ExtUtils::MakeMaker->VERSION() gt '6.30') ? + ('LICENSE' => 'perl') : ()), + ) ; my @names = qw( diff --git a/ext/Compress/Raw/Zlib/README b/ext/Compress/Raw/Zlib/README index 4e0e246..35bd1c2 100644 --- a/ext/Compress/Raw/Zlib/README +++ b/ext/Compress/Raw/Zlib/README @@ -1,9 +1,9 @@ Compress::Raw::Zlib - Version 2.003 + Version 2.004 - 2nd January 2007 + 3rd March 2007 Copyright (c) 2005-2007 Paul Marquess. All rights reserved. @@ -391,7 +391,7 @@ To help me help you, I need all of the following information: $VERSION = "1.05" ; - c. The version of zlib you have installed. + c. The version of zlib you have used. If you have successfully installed Compress::Raw::Zlib, this one-liner will tell you: diff --git a/ext/Compress/Raw/Zlib/Zlib.xs b/ext/Compress/Raw/Zlib/Zlib.xs index f638e82..08ffc56 100644 --- a/ext/Compress/Raw/Zlib/Zlib.xs +++ b/ext/Compress/Raw/Zlib/Zlib.xs @@ -3,7 +3,7 @@ * Created : 22nd January 1996 * Version : 2.000 * - * Copyright (c) 1995-2005 Paul Marquess. All rights reserved. + * Copyright (c) 1995-2007 Paul Marquess. All rights reserved. * This program is free software; you can redistribute it and/or * modify it under the same terms as Perl itself. * @@ -150,8 +150,6 @@ typedef di_stream * inflateStream ; typedef di_stream * Compress__Raw__Zlib__inflateStream ; typedef di_stream * Compress__Raw__Zlib__inflateScanStream ; -#define GZERRNO "Compress::Zlib::gzerrno" - #define ZMALLOC(to, typ) ((to = (typ *)safemalloc(sizeof(typ))), \ Zero(to,1,typ)) @@ -283,51 +281,6 @@ int error_no ; return errstr ; } -#if 0 -static void -#ifdef CAN_PROTOTYPE -SetGzErrorNo(int error_no) -#else -SetGzErrorNo(error_no) -int error_no ; -#endif -{ - dTHX; - char * errstr ; - SV * gzerror_sv = perl_get_sv(GZERRNO, FALSE) ; - - if (error_no == Z_ERRNO) { - error_no = errno ; - errstr = Strerror(errno) ; - } - else - /* errstr = gzerror(fil, &error_no) ; */ - errstr = (char*) my_z_errmsg[2 - error_no]; - - if (SvIV(gzerror_sv) != error_no) { - sv_setiv(gzerror_sv, error_no) ; - sv_setpv(gzerror_sv, errstr) ; - SvIOK_on(gzerror_sv) ; - } - -} - - -static void -#ifdef CAN_PROTOTYPE -SetGzError(gzFile file) -#else -SetGzError(file) -gzFile file ; -#endif -{ - int error_no ; - - (void)gzerror(file, &error_no) ; - SetGzErrorNo(error_no) ; -} - -#endif #ifdef MAGIC_APPEND @@ -987,10 +940,10 @@ deflate (s, buf, output) if (RETVAL == Z_OK) { SvPOK_only(output); SvCUR_set(output, cur_length + increment - s->stream.avail_out) ; + SvSETMAGIC(output); } OUTPUT: RETVAL - output void @@ -1091,10 +1044,10 @@ flush(s, output, f=Z_FINISH) if (RETVAL == Z_OK) { SvPOK_only(output); SvCUR_set(output, cur_length + increment - s->stream.avail_out) ; + SvSETMAGIC(output); } OUTPUT: RETVAL - output DualType @@ -1402,6 +1355,7 @@ inflate (s, buf, output, eof=FALSE) if (out_utf8) sv_utf8_upgrade(output); #endif + SvSETMAGIC(output); if (s->flags & FLAG_CRC32 ) s->crc32 = crc32(s->crc32, @@ -1425,8 +1379,6 @@ inflate (s, buf, output, eof=FALSE) } OUTPUT: RETVAL - buf - output uLong inflateCount(s) @@ -1488,7 +1440,6 @@ inflateSync (s, buf) } OUTPUT: RETVAL - buf void DESTROY(s) diff --git a/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm b/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm index 70e46df..3b81b6c 100644 --- a/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm +++ b/ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm @@ -13,7 +13,7 @@ use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.003'; +$VERSION = '2.004'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/ext/Compress/Raw/Zlib/t/02zlib.t b/ext/Compress/Raw/Zlib/t/02zlib.t index ef4aef5..4550f05 100644 --- a/ext/Compress/Raw/Zlib/t/02zlib.t +++ b/ext/Compress/Raw/Zlib/t/02zlib.t @@ -701,8 +701,7 @@ if ($] >= 5.005) ok my $k = new Compress::Raw::Zlib::Inflate ( -AppendOutput => 1, -ConsumeInput => 1 ) ; -# cmp_ok $k->inflate(substr($X, 0, -1), $Z), '==', Z_STREAM_END ; ; - cmp_ok $k->inflate(substr($X, 0), $Z), '==', Z_STREAM_END ; ; + cmp_ok $k->inflate(substr($X, 0, -1), $Z), '==', Z_STREAM_END ; ; ok $hello eq $Z ; is $X, $append; @@ -755,7 +754,10 @@ foreach (1 .. 2) cmp_ok $x->flush(substr($Answer, length($Answer))), '==', Z_OK ; + #cmp_ok length $Answer, ">", 0 ; + my @Answer = split('', $Answer) ; + my $k; ok(($k, $err) = new Compress::Raw::Zlib::Inflate(-AppendOutput => 1) ); diff --git a/ext/Compress/Zlib/Changes b/ext/Compress/Zlib/Changes index 73ebd53..8c02d4b 100644 --- a/ext/Compress/Zlib/Changes +++ b/ext/Compress/Zlib/Changes @@ -1,6 +1,10 @@ CHANGES ------- + 2.004 3 March 2007 + + * rewrote memGzip using IO::Compress::Gzip::gzip + 2.003 2 January 2007 * Added explicit version checking diff --git a/ext/Compress/Zlib/Makefile.PL b/ext/Compress/Zlib/Makefile.PL index d2d2e1a..a7e3a6a 100755 --- a/ext/Compress/Zlib/Makefile.PL +++ b/ext/Compress/Zlib/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.003' ; +$::VERSION = '2.004' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; @@ -42,6 +42,9 @@ WriteMakefile( : () ), + ((ExtUtils::MakeMaker->VERSION() gt '6.30') ? + ('LICENSE' => 'perl') : ()), + ) ; # end of file Makefile.PL diff --git a/ext/Compress/Zlib/README b/ext/Compress/Zlib/README index 263eb7b..7d2f0de 100644 --- a/ext/Compress/Zlib/README +++ b/ext/Compress/Zlib/README @@ -1,9 +1,9 @@ Compress::Zlib - Version 2.003 + Version 2.004 - 2nd January 2007 + 3rd March 2007 Copyright (c) 1995-2007 Paul Marquess. All rights reserved. diff --git a/ext/Compress/Zlib/lib/Compress/Zlib.pm b/ext/Compress/Zlib/lib/Compress/Zlib.pm index e8e9da3..fe18926 100644 --- a/ext/Compress/Zlib/lib/Compress/Zlib.pm +++ b/ext/Compress/Zlib/lib/Compress/Zlib.pm @@ -8,17 +8,17 @@ use Carp ; use IO::Handle ; use Scalar::Util qw(dualvar); -use IO::Compress::Base::Common 2.003 ; -use Compress::Raw::Zlib 2.003 ; -use IO::Compress::Gzip 2.003 ; -use IO::Uncompress::Gunzip 2.003 ; +use IO::Compress::Base::Common 2.004 ; +use Compress::Raw::Zlib 2.004 ; +use IO::Compress::Gzip 2.004 ; +use IO::Uncompress::Gunzip 2.004 ; use strict ; use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD); -$VERSION = '2.003'; +$VERSION = '2.004'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -438,35 +438,19 @@ sub inflate package Compress::Zlib ; -use IO::Compress::Gzip::Constants 2.003 ; +use IO::Compress::Gzip::Constants 2.004 ; sub memGzip($) { - my $x = new Compress::Raw::Zlib::Deflate( - -AppendOutput => 1, - -CRC32 => 1, - -ADLER32 => 0, - -Level => Z_BEST_COMPRESSION(), - -WindowBits => - MAX_WBITS(), - ) - or return undef ; - - # write a minimal gzip header - my $output = GZIP_MINIMUM_HEADER ; - + my $out; + # if the deflation buffer isn't a reference, make it one my $string = (ref $_[0] ? $_[0] : \$_[0]) ; - my $status = $x->deflate($string, \$output) ; - $status == Z_OK() + IO::Compress::Gzip::gzip($string, \$out, Minimal => 1) or return undef ; - - $status = $x->flush(\$output) ; - $status == Z_OK() - or return undef ; - - return $output . pack("V V", $x->crc32(), $x->total_in()) ; - + + return $out; } diff --git a/ext/Compress/Zlib/t/03zlib-v1.t b/ext/Compress/Zlib/t/03zlib-v1.t index 0ad5440..d46c224 100644 --- a/ext/Compress/Zlib/t/03zlib-v1.t +++ b/ext/Compress/Zlib/t/03zlib-v1.t @@ -857,8 +857,8 @@ if ($] >= 5.005) ok $k = inflateInit() ; - #$Z = $k->inflate(substr($Y, 0, -1)) ; - $Z = $k->inflate(substr($Y, 0)) ; + $Z = $k->inflate(substr($Y, 0, -1)) ; + #$Z = $k->inflate(substr($Y, 0)) ; ok $contents eq $Z ; is $Y, $append; diff --git a/ext/IO/Compress/Base/Changes b/ext/IO/Compress/Base/Changes index f7357f1..24e88f0 100644 --- a/ext/IO/Compress/Base/Changes +++ b/ext/IO/Compress/Base/Changes @@ -1,6 +1,10 @@ CHANGES ------- + 2.004 3 March 2007 + + * Made seek less wasteful of memory. + 2.003 2 January 2007 * Added explicit version checking diff --git a/ext/IO/Compress/Base/Makefile.PL b/ext/IO/Compress/Base/Makefile.PL index 3b5518f..751538a 100644 --- a/ext/IO/Compress/Base/Makefile.PL +++ b/ext/IO/Compress/Base/Makefile.PL @@ -35,6 +35,9 @@ WriteMakefile( : () ), + ((ExtUtils::MakeMaker->VERSION() gt '6.30') ? + ('LICENSE' => 'perl') : ()), + ) ; # end of file Makefile.PL diff --git a/ext/IO/Compress/Base/README b/ext/IO/Compress/Base/README index ba41fd0..1e557c9 100644 --- a/ext/IO/Compress/Base/README +++ b/ext/IO/Compress/Base/README @@ -1,9 +1,9 @@ IO::Compress::Base - Version 2.003 + Version 2.004 - 2nd January 2007 + 3rd March 2007 Copyright (c) 2005-2007 Paul Marquess. All rights reserved. diff --git a/ext/IO/Compress/Base/lib/IO/Compress/Base.pm b/ext/IO/Compress/Base/lib/IO/Compress/Base.pm index 47f26ef..8617b56 100644 --- a/ext/IO/Compress/Base/lib/IO/Compress/Base.pm +++ b/ext/IO/Compress/Base/lib/IO/Compress/Base.pm @@ -6,7 +6,7 @@ require 5.004 ; use strict ; use warnings; -use IO::Compress::Base::Common 2.003 ; +use IO::Compress::Base::Common 2.004 ; use IO::File ; use Scalar::Util qw(blessed readonly); @@ -17,22 +17,13 @@ use Carp ; use Symbol; use bytes; -our (@ISA, $VERSION, $got_encode); +our (@ISA, $VERSION); #@ISA = qw(Exporter IO::File); -$VERSION = '2.003'; +$VERSION = '2.004'; #Can't locate object method "SWASHNEW" via package "utf8" (perhaps you forgot to load "utf8"?) at .../ext/Compress-Zlib/Gzip/blib/lib/Compress/Zlib/Common.pm line 16. -#$got_encode = 0; -#eval -#{ -# require Encode; -# Encode->import('encode', 'find_encoding'); -#}; -# -#$got_encode = 1 unless $@; - sub saveStatus { my $self = shift ; @@ -157,7 +148,7 @@ sub checkParams { # Generic Parameters 'AutoClose' => [1, 1, Parse_boolean, 0], - #'Encoding' => [1, 1, Parse_any, undef], + #'Encode' => [1, 1, Parse_any, undef], 'Strict' => [0, 1, Parse_boolean, 1], 'Append' => [1, 1, Parse_boolean, 0], 'BinModeIn' => [1, 1, Parse_boolean, 0], @@ -229,19 +220,10 @@ sub _create -# TODO - encoding -# if ($got->parsed('Encoding')) { -# $obj->croakError("$class: Encode module needed to use -Encoding") -# if ! $got_encode; -# -# my $want_encoding = $got->value('Encoding'); -# my $encoding = find_encoding($want_encoding); -# -# $obj->croakError("$class: Encoding '$want_encoding' is not available") -# if ! $encoding; -# -# *$obj->{Encoding} = $encoding; -# } + if ($got->parsed('Encode')) { + my $want_encoding = $got->value('Encode'); + *$obj->{Encoding} = getEncoding($obj, $class, $want_encoding); + } $obj->ckParams($got) or $obj->croakError("${class}: " . $obj->error()); @@ -616,14 +598,14 @@ sub syswrite return 0 if ! defined $$buffer || length $$buffer == 0 ; - my $buffer_length = defined $$buffer ? length($$buffer) : 0 ; - *$self->{UnCompSize}->add($buffer_length) ; + if (*$self->{Encoding}) { + $$buffer = *$self->{Encoding}->encode($$buffer); + } $self->filterUncompressed($buffer); -# if (*$self->{Encoding}) { -# $$buffer = *$self->{Encoding}->encode($$buffer); -# } + my $buffer_length = defined $$buffer ? length($$buffer) : 0 ; + *$self->{UnCompSize}->add($buffer_length) ; my $outBuffer=''; my $status = *$self->{Compress}->compr($buffer, $outBuffer) ; diff --git a/ext/IO/Compress/Base/lib/IO/Compress/Base/Common.pm b/ext/IO/Compress/Base/lib/IO/Compress/Base/Common.pm index dc772a8..9c0b6fd 100644 --- a/ext/IO/Compress/Base/lib/IO/Compress/Base/Common.pm +++ b/ext/IO/Compress/Base/lib/IO/Compress/Base/Common.pm @@ -9,15 +9,16 @@ use Scalar::Util qw(blessed readonly); use File::GlobMapper; require Exporter; -our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS); +our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE); @ISA = qw(Exporter); -$VERSION = '2.003'; +$VERSION = '2.004'; @EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput isaFileGlobString cleanFileGlobString oneTarget setBinModeInput setBinModeOutput ckInOutParams createSelfTiedObject + getEncoding WANT_CODE WANT_EXT @@ -41,11 +42,39 @@ use constant STATUS_OK => 0; use constant STATUS_ENDSTREAM => 1; use constant STATUS_EOF => 2; use constant STATUS_ERROR => -1; -#use constant STATUS_OK => 0; -#use constant STATUS_ENDSTREAM => 1; -#use constant STATUS_ERROR => 2; -#use constant STATUS_EOF => 3; +sub hasEncode() +{ + if (! defined $HAS_ENCODE) { + eval + { + require Encode; + Encode->import(); + }; + + $HAS_ENCODE = $@ ? 0 : 1 ; + } + + return $HAS_ENCODE; +} + +sub getEncoding($$$) +{ + my $obj = shift; + my $class = shift ; + my $want_encoding = shift ; + + $obj->croakError("$class: Encode module needed to use -Encode") + if ! hasEncode(); + + my $encoding = Encode::find_encoding($want_encoding); + + $obj->croakError("$class: Encoding '$want_encoding' is not available") + if ! $encoding; + + return $encoding; +} + our ($needBinmode); $needBinmode = ($^O eq 'MSWin32' || ($] >= 5.006 && eval ' ${^UNICODE} || ${^UTF8LOCALE} ')) diff --git a/ext/IO/Compress/Base/lib/IO/Uncompress/AnyUncompress.pm b/ext/IO/Compress/Base/lib/IO/Uncompress/AnyUncompress.pm index 8657c18..923aa83 100644 --- a/ext/IO/Compress/Base/lib/IO/Uncompress/AnyUncompress.pm +++ b/ext/IO/Compress/Base/lib/IO/Uncompress/AnyUncompress.pm @@ -4,16 +4,16 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.003 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.004 qw(createSelfTiedObject); -use IO::Uncompress::Base 2.003 ; +use IO::Uncompress::Base 2.004 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError); -$VERSION = '2.003'; +$VERSION = '2.004'; $AnyUncompressError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -27,18 +27,18 @@ Exporter::export_ok_tags('all'); BEGIN { - eval ' use IO::Uncompress::Adapter::Inflate 2.003 ;'; - eval ' use IO::Uncompress::Adapter::Bunzip2 2.003 ;'; - eval ' use IO::Uncompress::Adapter::LZO 2.003 ;'; - eval ' use IO::Uncompress::Adapter::Lzf 2.003 ;'; - - eval ' use IO::Uncompress::Bunzip2 2.003 ;'; - eval ' use IO::Uncompress::UnLzop 2.003 ;'; - eval ' use IO::Uncompress::Gunzip 2.003 ;'; - eval ' use IO::Uncompress::Inflate 2.003 ;'; - eval ' use IO::Uncompress::RawInflate 2.003 ;'; - eval ' use IO::Uncompress::Unzip 2.003 ;'; - eval ' use IO::Uncompress::UnLzf 2.003 ;'; + eval ' use IO::Uncompress::Adapter::Inflate 2.004 ;'; + eval ' use IO::Uncompress::Adapter::Bunzip2 2.004 ;'; + eval ' use IO::Uncompress::Adapter::LZO 2.004 ;'; + eval ' use IO::Uncompress::Adapter::Lzf 2.004 ;'; + + eval ' use IO::Uncompress::Bunzip2 2.004 ;'; + eval ' use IO::Uncompress::UnLzop 2.004 ;'; + eval ' use IO::Uncompress::Gunzip 2.004 ;'; + eval ' use IO::Uncompress::Inflate 2.004 ;'; + eval ' use IO::Uncompress::RawInflate 2.004 ;'; + eval ' use IO::Uncompress::Unzip 2.004 ;'; + eval ' use IO::Uncompress::UnLzf 2.004 ;'; } sub new @@ -56,7 +56,7 @@ sub anyuncompress sub getExtraParams { - use IO::Compress::Base::Common 2.003 qw(:Parse); + use IO::Compress::Base::Common 2.004 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } diff --git a/ext/IO/Compress/Base/lib/IO/Uncompress/Base.pm b/ext/IO/Compress/Base/lib/IO/Uncompress/Base.pm index 709d705..1563dba 100644 --- a/ext/IO/Compress/Base/lib/IO/Uncompress/Base.pm +++ b/ext/IO/Compress/Base/lib/IO/Uncompress/Base.pm @@ -10,12 +10,12 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter ); -$VERSION = '2.003'; +$VERSION = '2.004'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; -use IO::Compress::Base::Common 2.003 ; +use IO::Compress::Base::Common 2.004 ; #use Parse::Parameters ; use IO::File ; @@ -301,6 +301,8 @@ sub checkParams 'Scan' => [1, 1, Parse_boolean, 0], 'InputLength' => [1, 1, Parse_unsigned, undef], 'BinModeOut' => [1, 1, Parse_boolean, 0], + #'Encode' => [1, 1, Parse_any, undef], + #'ConsumeInput' => [1, 1, Parse_boolean, 0], $self->getExtraParams(), @@ -380,6 +382,11 @@ sub _create *$obj->{Buffer} = \$buff ; } + if ($got->parsed('Encode')) { + my $want_encoding = $got->value('Encode'); + *$obj->{Encoding} = getEncoding($obj, $class, $want_encoding); + } + *$obj->{InputLength} = $got->parsed('InputLength') ? $got->value('InputLength') @@ -807,19 +814,19 @@ sub _raw_read $self->postBlockChk($buffer, $before_len) == STATUS_OK or return G_ERR; - $self->filterUncompressed($buffer); - - # TODO uncompress filter goes here - - $buf_len = length($$buffer) - $before_len; - *$self->{CompSize}->add($beforeC_len - length $temp_buf) ; *$self->{InflatedBytesRead} += $buf_len ; *$self->{TotalInflatedBytesRead} += $buf_len ; *$self->{UnCompSize}->add($buf_len) ; + + $self->filterUncompressed($buffer); + + if (*$self->{Encoding}) { + $$buffer = *$self->{Encoding}->decode($$buffer); + } } if ($status == STATUS_ENDSTREAM) { @@ -1271,11 +1278,14 @@ sub seek # Walk the file to the new offset my $offset = $target - $here ; - my $buffer ; - $self->read($buffer, $offset) == $offset - or return 0 ; + my $got; + while (($got = $self->read(my $buffer, min($offset, *$self->{BlockSize})) ) > 0) + { + $offset -= $got; + last if $offset == 0 ; + } - return 1 ; + return $offset == 0 ? 1 : 0 ; } sub fileno diff --git a/ext/IO/Compress/Zlib/Changes b/ext/IO/Compress/Zlib/Changes index 4e616b4..e5c95f8 100644 --- a/ext/IO/Compress/Zlib/Changes +++ b/ext/IO/Compress/Zlib/Changes @@ -1,6 +1,28 @@ CHANGES ------- + 2.004 3 March 2007 + + * IO::Compress::Zip + + - Added Zip64 documentation. + + - Fixed extended timestamp. + Creation time isn't available in Unix so only store the + modification time and the last access time in the extended field. + + - Fixed file mode. + + - Added ExtAttr option to control the value of the "external file + attributes" field in the central directory. + + - Added Unix2 extended attribute ("Ux"). + This stores the UID & GID. + + * IO::Compress::Gzip + + - Fixed 050interop-gzip.t for Windows + 2.003 2 January 2007 * Added explicit version checking diff --git a/ext/IO/Compress/Zlib/Makefile.PL b/ext/IO/Compress/Zlib/Makefile.PL index 0368115..4d38fc7 100644 --- a/ext/IO/Compress/Zlib/Makefile.PL +++ b/ext/IO/Compress/Zlib/Makefile.PL @@ -3,7 +3,7 @@ use strict ; require 5.004 ; -$::VERSION = '2.003' ; +$::VERSION = '2.004' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; @@ -39,6 +39,9 @@ WriteMakefile( : () ), + ((ExtUtils::MakeMaker->VERSION() gt '6.30') ? + ('LICENSE' => 'perl') : ()), + ) ; # end of file Makefile.PL diff --git a/ext/IO/Compress/Zlib/README b/ext/IO/Compress/Zlib/README index 9bdda20..d0e48d4 100644 --- a/ext/IO/Compress/Zlib/README +++ b/ext/IO/Compress/Zlib/README @@ -1,9 +1,9 @@ IO::Compress::Zlib - Version 2.003 + Version 2.004 - 2nd January 2007 + 3rd March 2007 Copyright (c) 2005-2007 Paul Marquess. All rights reserved. diff --git a/ext/IO/Compress/Zlib/lib/IO/Compress/Adapter/Deflate.pm b/ext/IO/Compress/Zlib/lib/IO/Compress/Adapter/Deflate.pm index c8b43bd..1937c7c 100644 --- a/ext/IO/Compress/Zlib/lib/IO/Compress/Adapter/Deflate.pm +++ b/ext/IO/Compress/Zlib/lib/IO/Compress/Adapter/Deflate.pm @@ -4,12 +4,12 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.003 qw(:Status); +use IO::Compress::Base::Common 2.004 qw(:Status); -use Compress::Raw::Zlib 2.003 qw(Z_OK Z_FINISH MAX_WBITS) ; +use Compress::Raw::Zlib 2.004 qw(Z_OK Z_FINISH MAX_WBITS) ; our ($VERSION); -$VERSION = '2.003'; +$VERSION = '2.004'; sub mkCompObject { diff --git a/ext/IO/Compress/Zlib/lib/IO/Compress/Adapter/Identity.pm b/ext/IO/Compress/Zlib/lib/IO/Compress/Adapter/Identity.pm index 15af467..596b670 100644 --- a/ext/IO/Compress/Zlib/lib/IO/Compress/Adapter/Identity.pm +++ b/ext/IO/Compress/Zlib/lib/IO/Compress/Adapter/Identity.pm @@ -4,10 +4,10 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.003 qw(:Status); +use IO::Compress::Base::Common 2.004 qw(:Status); our ($VERSION); -$VERSION = '2.003'; +$VERSION = '2.004'; sub mkCompObject { diff --git a/ext/IO/Compress/Zlib/lib/IO/Compress/Deflate.pm b/ext/IO/Compress/Zlib/lib/IO/Compress/Deflate.pm index ff69332..0015505 100644 --- a/ext/IO/Compress/Zlib/lib/IO/Compress/Deflate.pm +++ b/ext/IO/Compress/Zlib/lib/IO/Compress/Deflate.pm @@ -6,16 +6,16 @@ use bytes; require Exporter ; -use IO::Compress::RawDeflate 2.003 ; +use IO::Compress::RawDeflate 2.004 ; -use Compress::Raw::Zlib 2.003 ; -use IO::Compress::Zlib::Constants 2.003 ; -use IO::Compress::Base::Common 2.003 qw(createSelfTiedObject); +use Compress::Raw::Zlib 2.004 ; +use IO::Compress::Zlib::Constants 2.004 ; +use IO::Compress::Base::Common 2.004 qw(createSelfTiedObject); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); -$VERSION = '2.003'; +$VERSION = '2.004'; $DeflateError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); diff --git a/ext/IO/Compress/Zlib/lib/IO/Compress/Gzip.pm b/ext/IO/Compress/Zlib/lib/IO/Compress/Gzip.pm index c4253b6..5d16564 100644 --- a/ext/IO/Compress/Zlib/lib/IO/Compress/Gzip.pm +++ b/ext/IO/Compress/Zlib/lib/IO/Compress/Gzip.pm @@ -8,12 +8,12 @@ use warnings; use bytes; -use IO::Compress::RawDeflate 2.003 ; +use IO::Compress::RawDeflate 2.004 ; -use Compress::Raw::Zlib 2.003 ; -use IO::Compress::Base::Common 2.003 qw(:Status :Parse createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.003 ; -use IO::Compress::Zlib::Extra 2.003 ; +use Compress::Raw::Zlib 2.004 ; +use IO::Compress::Base::Common 2.004 qw(:Status :Parse createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.004 ; +use IO::Compress::Zlib::Extra 2.004 ; BEGIN { @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); -$VERSION = '2.003'; +$VERSION = '2.004'; $GzipError = '' ; @ISA = qw(Exporter IO::Compress::RawDeflate); 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 4e47f73..3ccb042 100644 --- a/ext/IO/Compress/Zlib/lib/IO/Compress/Gzip/Constants.pm +++ b/ext/IO/Compress/Zlib/lib/IO/Compress/Gzip/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names); our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE); -$VERSION = '2.003'; +$VERSION = '2.004'; @ISA = qw(Exporter); diff --git a/ext/IO/Compress/Zlib/lib/IO/Compress/RawDeflate.pm b/ext/IO/Compress/Zlib/lib/IO/Compress/RawDeflate.pm index 0cd340b..11a2ae3 100644 --- a/ext/IO/Compress/Zlib/lib/IO/Compress/RawDeflate.pm +++ b/ext/IO/Compress/Zlib/lib/IO/Compress/RawDeflate.pm @@ -7,16 +7,16 @@ use warnings; use bytes; -use IO::Compress::Base 2.003 ; -use IO::Compress::Base::Common 2.003 qw(:Status createSelfTiedObject); -use IO::Compress::Adapter::Deflate 2.003 ; +use IO::Compress::Base 2.004 ; +use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject); +use IO::Compress::Adapter::Deflate 2.004 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.003'; +$VERSION = '2.004'; $RawDeflateError = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -141,8 +141,8 @@ sub getZlibParams { my $self = shift ; - use IO::Compress::Base::Common 2.003 qw(:Parse); - use Compress::Raw::Zlib 2.003 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.004 qw(:Parse); + use Compress::Raw::Zlib 2.004 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); return ( diff --git a/ext/IO/Compress/Zlib/lib/IO/Compress/Zip.pm b/ext/IO/Compress/Zlib/lib/IO/Compress/Zip.pm index 899cbbe..143760e 100644 --- a/ext/IO/Compress/Zlib/lib/IO/Compress/Zip.pm +++ b/ext/IO/Compress/Zlib/lib/IO/Compress/Zip.pm @@ -4,21 +4,21 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.003 qw(:Status createSelfTiedObject); -use IO::Compress::RawDeflate 2.003 ; -use IO::Compress::Adapter::Deflate 2.003 ; -use IO::Compress::Adapter::Identity 2.003 ; -use IO::Compress::Zlib::Extra 2.003 ; -use IO::Compress::Zip::Constants 2.003 ; +use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject); +use IO::Compress::RawDeflate 2.004 ; +use IO::Compress::Adapter::Deflate 2.004 ; +use IO::Compress::Adapter::Identity 2.004 ; +use IO::Compress::Zlib::Extra 2.004 ; +use IO::Compress::Zip::Constants 2.004 ; -use Compress::Raw::Zlib 2.003 qw(crc32) ; +use Compress::Raw::Zlib 2.004 qw(crc32) ; BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.003 ; + import IO::Compress::Adapter::Bzip2 2.004 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.003 ; + import IO::Compress::Bzip2 2.004 ; } ; } @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); -$VERSION = '2.003'; +$VERSION = '2.004'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -139,6 +139,8 @@ sub mkHeader my $extra = ''; my $ctlExtra = ''; my $empty = 0; + my $osCode = $param->value('OS_Code') ; + my $extFileAttr = 0 ; if (*$self->{ZipData}{Zip64}) { $empty = 0xFFFF; @@ -164,11 +166,18 @@ sub mkHeader $ctlExtra .= mkExtendedTime($param->value('MTime')); } - # if ( $param->value('UID')) - # { - # $extra .= mkUnixExtra( $param->value('UID'), $param->value('GID')); - # $ctlExtra .= mkUnixExtra(); - # } + if ( $param->value('UID') && $osCode == ZIP_OS_CODE_UNIX) + { + $extra .= mkUnix2Extra( $param->value('UID'), $param->value('GID')); + $ctlExtra .= mkUnix2Extra(); + } + + # TODO - this code assumes Unix. + #$extFileAttr = 0666 << 16 + # if $osCode == ZIP_OS_CODE_UNIX ; + + $extFileAttr = $param->value('ExtAttr') + if defined $param->value('ExtAttr') ; $extra .= $param->value('ExtraFieldLocal') if defined $param->value('ExtraFieldLocal'); @@ -177,12 +186,6 @@ sub mkHeader if defined $param->value('ExtraFieldCentral'); } - - # TODO - this code assumes Unix. - my $extAttr = 0; - $extAttr = $param->value('Mode') << 16 - if defined $param->value('Mode') ; - my $gpFlag = 0 ; $gpFlag |= ZIP_GP_FLAG_STREAMING_MASK if *$self->{ZipData}{Stream} ; @@ -233,7 +236,7 @@ sub mkHeader $ctl .= pack 'v', length $comment ; # file comment length $ctl .= pack 'v', 0 ; # disk number start $ctl .= pack 'v', $ifa ; # internal file attributes - $ctl .= pack 'V', $extAttr ; # external file attributes + $ctl .= pack 'V', $extFileAttr ; # external file attributes if (! *$self->{ZipData}{Zip64}) { $ctl .= pack 'V', *$self->{ZipData}{Offset}->get32bit() ; # offset to local header } @@ -438,8 +441,8 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.003 qw(:Parse); - use Compress::Raw::Zlib 2.003 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.004 qw(:Parse); + use Compress::Raw::Zlib 2.004 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); my @Bzip2 = (); @@ -462,6 +465,7 @@ sub getExtraParams 'Name' => [0, 1, Parse_any, ''], 'Time' => [0, 1, Parse_any, undef], 'exTime' => [0, 1, Parse_any, undef], + 'ExtAttr' => [0, 1, Parse_any, 0], 'OS_Code' => [0, 1, Parse_unsigned, $Compress::Raw::Zlib::gzip_os_code], 'TextFlag' => [0, 1, Parse_boolean, 0], @@ -497,10 +501,11 @@ sub getFileInfo { $params->value('MTime' => $mtime) ; $params->value('ATime' => $atime) ; - $params->value('CTime' => $ctime) ; + $params->value('CTime' => undef) ; # No Creation time } - $params->value('Mode' => $mode) ; + $params->value('ExtAttr' => $mode << 16) + if ! $params->parsed('ExtAttr'); $params->value('UID' => $uid) ; $params->value('GID' => $gid) ; @@ -526,12 +531,11 @@ sub mkExtendedTime $bit <<= 1 ; } - #return "UT" . pack("v C", length($times) + 1, $flags) . $times; return IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_EXT_TIMESTAMP, pack("C", $flags) . $times); } -sub mkUnixExtra +sub mkUnix2Extra { my $ids = ''; for my $id (@_) @@ -539,8 +543,8 @@ sub mkUnixExtra $ids .= pack("v", $id); } - #return "Ux" . pack("v", length $ids) . $ids; - return IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_INFO_ZIP_UNIX, $ids); + return IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_INFO_ZIP_UNIX2, + $ids); } @@ -630,11 +634,16 @@ compressed data to files or buffer. - The primary purpose of this module is to provide streaming write access to zip files and buffers. It is not a general-purpose file archiver. If that is what you want, check out C. +At present three compression methods are supported by IO::Compress::Zip, +namely Store (no compression at all), Deflate and Bzip2. + +Note that to create Bzip2 content, the module C must +be installed. + @@ -719,10 +728,10 @@ If the C<$input> parameter is any other type, C will be returned. In addition, if C<$input> is a simple filename, the default values for -the C, C