diff options
author | Paul Marquess <paul.marquess@btinternet.com> | 2008-05-17 13:16:13 +0100 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2008-05-18 03:25:54 +0000 |
commit | a1787f2408f7a147f42c53fb9c4380c9d71502ea (patch) | |
tree | 69272a86c30322eb9204e6d29cd0893c6db437d8 /ext/IO_Compress_Zlib | |
parent | a33f2d9ff72e8b22b6fbbee1f295dee14d2436b5 (diff) | |
download | perl-a1787f2408f7a147f42c53fb9c4380c9d71502ea.tar.gz |
IO::Compress::* 2.011
From: "Paul Marquess" <Paul.Marquess@ntlworld.com>
Message-ID: <CF9B8F335CB2417FBA78E0F08EAB1F7D@myopwv.com>
p4raw-id: //depot/perl@33846
Diffstat (limited to 'ext/IO_Compress_Zlib')
21 files changed, 372 insertions, 96 deletions
diff --git a/ext/IO_Compress_Zlib/Changes b/ext/IO_Compress_Zlib/Changes index ba79b78140..45cd027908 100644 --- a/ext/IO_Compress_Zlib/Changes +++ b/ext/IO_Compress_Zlib/Changes @@ -1,6 +1,16 @@ CHANGES ------- + 2.011 17 May 2008 + + * IO::Uncompress::Unzip + - Print an error message if the zip file contains a + member compressed with bzip2 and IO::Uncompress::Bunzip2 is + not available. + - Could not cope with mixed compression zip files. For example a + zip file that contains both STORED and DEFLATED content. + [RT #35573] + 2.010 5 May 2008 * Fixed problem that meant Perl 5.10 could not upgrade this module. diff --git a/ext/IO_Compress_Zlib/Makefile.PL b/ext/IO_Compress_Zlib/Makefile.PL index a2130aab11..deb323ebdc 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.010' ; +$::VERSION = '2.011' ; use private::MakeUtil; use ExtUtils::MakeMaker 5.16 ; diff --git a/ext/IO_Compress_Zlib/README b/ext/IO_Compress_Zlib/README index 9c403e6234..176bcff1b4 100644 --- a/ext/IO_Compress_Zlib/README +++ b/ext/IO_Compress_Zlib/README @@ -1,9 +1,9 @@ IO-Compress-Zlib - Version 2.010 + Version 2.011 - 5th May 2008 + 17th May 2008 Copyright (c) 2005-2008 Paul Marquess. All rights reserved. This program is free software; you can redistribute it @@ -93,7 +93,7 @@ To help me help you, I need all of the following information: If you haven't installed IO-Compress-Zlib then search IO::Compress::Gzip.pm for a line like this: - $VERSION = "2.010" ; + $VERSION = "2.011" ; 2. If you are having problems building IO-Compress-Zlib, send me a complete log of what happened. Start by unpacking the IO-Compress-Zlib 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 c269d4fc3c..d8f5a5f69d 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.010 qw(:Status); +use IO::Compress::Base::Common 2.011 qw(:Status); -use Compress::Raw::Zlib 2.010 qw(Z_OK Z_FINISH MAX_WBITS) ; +use Compress::Raw::Zlib 2.011 qw(Z_OK Z_FINISH MAX_WBITS) ; our ($VERSION); -$VERSION = '2.010'; +$VERSION = '2.011'; 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 2eef317e96..ad7347c28d 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.010 qw(:Status); +use IO::Compress::Base::Common 2.011 qw(:Status); our ($VERSION); -$VERSION = '2.010'; +$VERSION = '2.011'; 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 c5d1d0228b..e702e43a32 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.010 ; +use IO::Compress::RawDeflate 2.011 ; -use Compress::Raw::Zlib 2.010 ; -use IO::Compress::Zlib::Constants 2.010 ; -use IO::Compress::Base::Common 2.010 qw(createSelfTiedObject); +use Compress::Raw::Zlib 2.011 ; +use IO::Compress::Zlib::Constants 2.011 ; +use IO::Compress::Base::Common 2.011 qw(createSelfTiedObject); our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $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 4bea560a96..86561c5229 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.010 ; +use IO::Compress::RawDeflate 2.011 ; -use Compress::Raw::Zlib 2.010 ; -use IO::Compress::Base::Common 2.010 qw(:Status :Parse createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.010 ; -use IO::Compress::Zlib::Extra 2.010 ; +use Compress::Raw::Zlib 2.011 ; +use IO::Compress::Base::Common 2.011 qw(:Status :Parse createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.011 ; +use IO::Compress::Zlib::Extra 2.011 ; BEGIN { @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError); -$VERSION = '2.010'; +$VERSION = '2.011'; $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 0c0b168180..2f59d229a5 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.010'; +$VERSION = '2.011'; @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 e728d538f6..81245f224d 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.010 ; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Compress::Adapter::Deflate 2.010 ; +use IO::Compress::Base 2.011 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Compress::Adapter::Deflate 2.011 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $RawDeflateError = ''; @ISA = qw(Exporter IO::Compress::Base); @@ -92,7 +92,6 @@ sub ckParams sub mkComp { my $self = shift ; - my $class = shift ; my $got = shift ; my ($obj, $errstr, $errno) = IO::Compress::Adapter::Deflate::mkCompObject( @@ -143,8 +142,8 @@ sub getZlibParams { my $self = shift ; - use IO::Compress::Base::Common 2.010 qw(:Parse); - use Compress::Raw::Zlib 2.010 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.011 qw(:Parse); + use Compress::Raw::Zlib 2.011 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 752763dbcd..f2ff60e9ea 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.010 qw(:Status createSelfTiedObject); -use IO::Compress::RawDeflate 2.010 ; -use IO::Compress::Adapter::Deflate 2.010 ; -use IO::Compress::Adapter::Identity 2.010 ; -use IO::Compress::Zlib::Extra 2.010 ; -use IO::Compress::Zip::Constants 2.010 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Compress::RawDeflate 2.011 ; +use IO::Compress::Adapter::Deflate 2.011 ; +use IO::Compress::Adapter::Identity 2.011 ; +use IO::Compress::Zlib::Extra 2.011 ; +use IO::Compress::Zip::Constants 2.011 ; -use Compress::Raw::Zlib 2.010 qw(crc32) ; +use Compress::Raw::Zlib 2.011 qw(crc32) ; BEGIN { eval { require IO::Compress::Adapter::Bzip2 ; - import IO::Compress::Adapter::Bzip2 2.010 ; + import IO::Compress::Adapter::Bzip2 2.011 ; require IO::Compress::Bzip2 ; - import IO::Compress::Bzip2 2.010 ; + import IO::Compress::Bzip2 2.011 ; } ; } @@ -27,7 +27,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); -$VERSION = '2.010'; +$VERSION = '2.011'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -57,7 +57,6 @@ sub zip sub mkComp { my $self = shift ; - my $class = shift ; my $got = shift ; my ($obj, $errstr, $errno) ; @@ -453,8 +452,8 @@ sub getExtraParams { my $self = shift ; - use IO::Compress::Base::Common 2.010 qw(:Parse); - use Compress::Raw::Zlib 2.010 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); + use IO::Compress::Base::Common 2.011 qw(:Parse); + use Compress::Raw::Zlib 2.011 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY); my @Bzip2 = (); diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm index b49f6d7c90..85e976726a 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Zip/Constants.pm @@ -7,7 +7,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS); -$VERSION = '2.010'; +$VERSION = '2.011'; @ISA = qw(Exporter); @@ -33,6 +33,7 @@ $VERSION = '2.010'; ZIP_GP_FLAG_PATCHED_MASK ZIP_GP_FLAG_STRONG_ENCRYPTED_MASK ZIP_GP_FLAG_LZMA_EOS_PRESENT + ZIP_GP_FLAG_LANGUAGE_ENCODING ZIP_EXTRA_ID_ZIP64 ZIP_EXTRA_ID_EXT_TIMESTAMP @@ -83,6 +84,7 @@ use constant ZIP_OS_CODE_DEFAULT => 3; use constant ZIP_EXTRA_ID_ZIP64 => pack "v", 1; use constant ZIP_EXTRA_ID_EXT_TIMESTAMP => "UT"; use constant ZIP_EXTRA_ID_INFO_ZIP_UNIX2 => "Ux"; +use constant ZIP_EXTRA_ID_JAVA_EXE => pack "v", 0xCAFE; use constant ZIP64_MIN_VERSION => 45; diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm index 6535fe11f2..f57f6a2c19 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Constants.pm @@ -9,7 +9,7 @@ require Exporter; our ($VERSION, @ISA, @EXPORT); -$VERSION = '2.010'; +$VERSION = '2.011'; @ISA = qw(Exporter); diff --git a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm b/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm index 0ab3bf5614..92109faddf 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Compress/Zlib/Extra.pm @@ -8,9 +8,9 @@ use bytes; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = '2.010'; +$VERSION = '2.011'; -use IO::Compress::Gzip::Constants 2.010 ; +use IO::Compress::Gzip::Constants 2.011 ; sub ExtraFieldError { diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm index 04358250e5..91e9be2c22 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Identity.pm @@ -4,13 +4,13 @@ use warnings; use strict; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status); +use IO::Compress::Base::Common 2.011 qw(:Status); our ($VERSION); -$VERSION = '2.010'; +$VERSION = '2.011'; -use Compress::Raw::Zlib 2.010 (); +use Compress::Raw::Zlib 2.011 (); sub mkUncompObject { diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm index e3c6e7175b..b93b1d80be 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Adapter/Inflate.pm @@ -4,11 +4,11 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status); -use Compress::Raw::Zlib 2.010 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); +use IO::Compress::Base::Common 2.011 qw(:Status); +use Compress::Raw::Zlib 2.011 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS); our ($VERSION); -$VERSION = '2.010'; +$VERSION = '2.011'; diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm index d1a247734c..f604acbda4 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/AnyInflate.pm @@ -6,22 +6,22 @@ use strict; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(createSelfTiedObject); +use IO::Compress::Base::Common 2.011 qw(createSelfTiedObject); -use IO::Uncompress::Adapter::Inflate 2.010 (); +use IO::Uncompress::Adapter::Inflate 2.011 (); -use IO::Uncompress::Base 2.010 ; -use IO::Uncompress::Gunzip 2.010 ; -use IO::Uncompress::Inflate 2.010 ; -use IO::Uncompress::RawInflate 2.010 ; -use IO::Uncompress::Unzip 2.010 ; +use IO::Uncompress::Base 2.011 ; +use IO::Uncompress::Gunzip 2.011 ; +use IO::Uncompress::Inflate 2.011 ; +use IO::Uncompress::RawInflate 2.011 ; +use IO::Uncompress::Unzip 2.011 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $AnyInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -48,7 +48,7 @@ sub anyinflate sub getExtraParams { - use IO::Compress::Base::Common 2.010 qw(:Parse); + use IO::Compress::Base::Common 2.011 qw(:Parse); return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ; } @@ -67,7 +67,6 @@ sub ckParams sub mkUncomp { my $self = shift ; - my $class = shift ; my $got = shift ; my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject(); diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm index e6cce8e48c..494cc386ff 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Gunzip.pm @@ -9,12 +9,12 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.010 ; +use IO::Uncompress::RawInflate 2.011 ; -use Compress::Raw::Zlib 2.010 qw( crc32 ) ; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Compress::Gzip::Constants 2.010 ; -use IO::Compress::Zlib::Extra 2.010 ; +use Compress::Raw::Zlib 2.011 qw( crc32 ) ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Compress::Gzip::Constants 2.011 ; +use IO::Compress::Zlib::Extra 2.011 ; require Exporter ; @@ -28,7 +28,7 @@ Exporter::export_ok_tags('all'); $GunzipError = ''; -$VERSION = '2.010'; +$VERSION = '2.011'; sub new { @@ -47,7 +47,7 @@ sub gunzip sub getExtraParams { - use IO::Compress::Base::Common 2.010 qw(:Parse); + use IO::Compress::Base::Common 2.011 qw(:Parse); return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ; } diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm index 52b3deda1b..1a74bf432b 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Inflate.pm @@ -5,15 +5,15 @@ use strict ; use warnings; use bytes; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Compress::Zlib::Constants 2.010 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Compress::Zlib::Constants 2.011 ; -use IO::Uncompress::RawInflate 2.010 ; +use IO::Uncompress::RawInflate 2.011 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $InflateError = ''; @ISA = qw( Exporter IO::Uncompress::RawInflate ); diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm index c251edc741..64f85bf71f 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/RawInflate.pm @@ -5,11 +5,11 @@ use strict ; use warnings; use bytes; -use Compress::Raw::Zlib 2.010 ; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); +use Compress::Raw::Zlib 2.011 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); -use IO::Uncompress::Base 2.010 ; -use IO::Uncompress::Adapter::Inflate 2.010 ; +use IO::Uncompress::Base 2.011 ; +use IO::Uncompress::Adapter::Inflate 2.011 ; @@ -17,7 +17,7 @@ use IO::Uncompress::Adapter::Inflate 2.010 ; require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError); -$VERSION = '2.010'; +$VERSION = '2.011'; $RawInflateError = ''; @ISA = qw( Exporter IO::Uncompress::Base ); @@ -58,7 +58,6 @@ sub ckParams sub mkUncomp { my $self = shift ; - my $class = shift ; my $got = shift ; my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject( diff --git a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm index 2a31f73f8c..c50259f34c 100644 --- a/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm +++ b/ext/IO_Compress_Zlib/lib/IO/Uncompress/Unzip.pm @@ -8,13 +8,14 @@ use strict ; use warnings; use bytes; -use IO::Uncompress::RawInflate 2.010 ; -use IO::Compress::Base::Common 2.010 qw(:Status createSelfTiedObject); -use IO::Uncompress::Adapter::Identity 2.010 ; -use IO::Compress::Zlib::Extra 2.010 ; -use IO::Compress::Zip::Constants 2.010 ; +use IO::Uncompress::RawInflate 2.011 ; +use IO::Compress::Base::Common 2.011 qw(:Status createSelfTiedObject); +use IO::Uncompress::Adapter::Inflate 2.011 ; +use IO::Uncompress::Adapter::Identity 2.011 ; +use IO::Compress::Zlib::Extra 2.011 ; +use IO::Compress::Zip::Constants 2.011 ; -use Compress::Raw::Zlib 2.010 qw(crc32) ; +use Compress::Raw::Zlib 2.011 qw(crc32) ; BEGIN { @@ -27,7 +28,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.010'; +$VERSION = '2.011'; $UnzipError = ''; @ISA = qw(Exporter IO::Uncompress::RawInflate); @@ -60,7 +61,7 @@ sub unzip sub getExtraParams { - use IO::Compress::Base::Common 2.010 qw(:Parse); + use IO::Compress::Base::Common 2.011 qw(:Parse); return ( @@ -84,6 +85,20 @@ sub ckParams return 1; } +sub mkUncomp +{ + my $self = shift ; + my $got = shift ; + + my $magic = $self->ckMagic() + or return 0; + + *$self->{Info} = $self->readHeader($magic) + or return undef ; + + return 1; + +} sub ckMagic { @@ -585,19 +600,22 @@ sub _readZipHeader($) if ($compressedMethod == ZIP_CM_DEFLATE) { *$self->{Type} = 'zip-deflate'; + my $obj = IO::Uncompress::Adapter::Inflate::mkUncompObject(1,0,0); + + *$self->{Uncomp} = $obj; + *$self->{ZipData}{CRC32} = crc32(undef); } elsif ($compressedMethod == ZIP_CM_BZIP2) { - #if (! defined $IO::Uncompress::Adapter::Bunzip2::VERSION) + return $self->HeaderError("Unsupported Compression format $compressedMethod") + if ! defined $IO::Uncompress::Adapter::Bunzip2::VERSION ; *$self->{Type} = 'zip-bzip2'; - my $obj = IO::Uncompress::Adapter::Bunzip2::mkUncompObject( - ); + my $obj = IO::Uncompress::Adapter::Bunzip2::mkUncompObject(); *$self->{Uncomp} = $obj; *$self->{ZipData}{CRC32} = crc32(undef); - } elsif ($compressedMethod == ZIP_CM_STORE) { @@ -605,12 +623,9 @@ sub _readZipHeader($) *$self->{Type} = 'zip-stored'; - my $obj = IO::Uncompress::Adapter::Identity::mkUncompObject(# $got->value('CRC32'), - # $got->value('ADLER32'), - ); + my $obj = IO::Uncompress::Adapter::Identity::mkUncompObject(); *$self->{Uncomp} = $obj; - } else { @@ -1402,9 +1417,11 @@ stream at a time. my $zipfile = "somefile.zip"; my $u = new IO::Uncompress::Unzip $zipfile - or die "Cannot open $filefile: $UnzipError"; + or die "Cannot open $zipfile: $UnzipError"; - for (my $status = 1; ! $u->eof(); $status = $u->nextStream()) + my $status; + for ($status = 1; ! $u->eof(); $status = $u->nextStream()) + { my $name = $u->getHeaderInfo()->{Name}; warn "Processing member $name\n" ; diff --git a/ext/IO_Compress_Zlib/t/006zip.t b/ext/IO_Compress_Zlib/t/006zip.t new file mode 100644 index 0000000000..83dabca0ff --- /dev/null +++ b/ext/IO_Compress_Zlib/t/006zip.t @@ -0,0 +1,251 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + @INC = ("../lib", "lib/compress"); + } +} + +use lib qw(t t/compress); +use strict; +use warnings; +use bytes; + +use Test::More ; +use CompTestUtils; + +BEGIN { + # use Test::NoWarnings, if available + my $extra = 0 ; + $extra = 1 + if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; + + plan tests => 62 + $extra ; + + use_ok('IO::Compress::Zip', qw(:all)) ; + use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ; + + eval { + require IO::Compress::Bzip2 ; + import IO::Compress::Bzip2 2.010 ; + require IO::Uncompress::Bunzip2 ; + import IO::Uncompress::Bunzip2 2.010 ; + } ; + +} + + +sub getContent +{ + my $filename = shift; + + my $u = new IO::Uncompress::Unzip $filename, Append => 1 + or die "Cannot open $filename: $UnzipError"; + + isa_ok $u, "IO::Uncompress::Unzip"; + + my @content; + my $status ; + + for ($status = 1; ! $u->eof(); $status = $u->nextStream()) + { + + my $name = $u->getHeaderInfo()->{Name}; + #warn "Processing member $name\n" ; + + my $buff = ''; + 1 while ($status = $u->read($buff)) > 0; + + push @content, $buff; + last unless $status == 0; + } + + die "Error processing $filename: $status $!\n" + if $status < 0 ; + + return @content; +} + + +{ + title "Create a simple zip - All Deflate"; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello', + '', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_DEFLATE); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +SKIP: +{ + title "Create a simple zip - All Bzip2"; + + skip "IO::Compress::Bzip2 not available", 9 + unless defined $IO::Compress::Bzip2::VERSION; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello', + '', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_BZIP2, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_BZIP2); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_BZIP2); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +SKIP: +{ + title "Create a simple zip - Deflate + Bzip2"; + + skip "IO::Compress::Bzip2 not available", 9 + unless $IO::Compress::Bzip2::VERSION; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello', + 'and', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_BZIP2); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +{ + title "Create a simple zip - All STORE"; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello', + '', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_STORE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_STORE); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_STORE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +{ + title "Create a simple zip - Deflate + STORE"; + + #my $lex = new LexFile my $file1; + my $file1 = "tryout.zip"; + + my @content = qw( + hello + and + goodbye + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_STORE); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + is $got[1], $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + +{ + title "Create a simple zip - Deflate + zero length STORE"; + + my $lex = new LexFile my $file1; + + my @content = ( + 'hello ', + '', + 'goodbye ', + ); + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_DEFLATE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + is $zip->write($content[0]), length($content[0]), "write"; + $zip->newStream(Name=> "two", Method => ZIP_CM_STORE); + is $zip->write($content[1]), length($content[1]), "write"; + $zip->newStream(Name=> "three", Method => ZIP_CM_DEFLATE); + is $zip->write($content[2]), length($content[2]), "write"; + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], $content[0], "Got 1st entry"; + ok $got[1] eq $content[1], "Got 2nd entry"; + is $got[2], $content[2], "Got 3nd entry"; +} + |