diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-12-19 09:53:37 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-12-19 11:22:28 +0000 |
commit | e4675dd77b6081051acaf60814d766244c6444f7 (patch) | |
tree | 2a555a040522488981e02442338d686d518a8cb2 /cpan/IO-Compress | |
parent | 24e75b45b6cb0613493c8f70cdb8e911e656b275 (diff) | |
download | perl-e4675dd77b6081051acaf60814d766244c6444f7.tar.gz |
Update IO-Compress to CPAN version 2.046
[DELTA]
2.046 18 December 2011
* Minor update to bin/zipdetails
* Typo in name of IO::Compress::FAQ.pod
* IO::Uncompress::Unzip
- Example for walking a zip file used eof to control the outer
loop. This is wrong.
* IO::Compress::Zip
- Change default for CanonicalName to false.
[RT# 72974]
Diffstat (limited to 'cpan/IO-Compress')
-rw-r--r-- | cpan/IO-Compress/Changes | 14 | ||||
-rw-r--r-- | cpan/IO-Compress/README | 4 | ||||
-rw-r--r-- | cpan/IO-Compress/bin/zipdetails | 61 | ||||
-rw-r--r-- | cpan/IO-Compress/lib/IO/Compress/Base.pm | 2 | ||||
-rw-r--r-- | cpan/IO-Compress/lib/IO/Compress/Base/Common.pm | 22 | ||||
-rw-r--r-- | cpan/IO-Compress/lib/IO/Compress/FAQ.pod | 2 | ||||
-rw-r--r-- | cpan/IO-Compress/lib/IO/Compress/Zip.pm | 10 | ||||
-rw-r--r-- | cpan/IO-Compress/lib/IO/Uncompress/Base.pm | 5 | ||||
-rw-r--r-- | cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm | 4 | ||||
-rw-r--r-- | cpan/IO-Compress/t/006zip.t | 23 | ||||
-rw-r--r-- | cpan/IO-Compress/t/01misc.t | 10 | ||||
-rw-r--r-- | cpan/IO-Compress/t/105oneshot-zip-only.t | 1 |
12 files changed, 124 insertions, 34 deletions
diff --git a/cpan/IO-Compress/Changes b/cpan/IO-Compress/Changes index 9243733b31..0d00b000c7 100644 --- a/cpan/IO-Compress/Changes +++ b/cpan/IO-Compress/Changes @@ -1,6 +1,20 @@ CHANGES ------- + 2.046 18 December 2011 + + * Minor update to bin/zipdetails + + * Typo in name of IO::Compress::FAQ.pod + + * IO::Uncompress::Unzip + - Example for walking a zip file used eof to control the outer + loop. This is wrong. + + * IO::Compress::Zip + - Change default for CanonicalName to false. + [RT# 72974] + 2.045 3 December 2011 * Restructured IO::Compress::FAQ.pod diff --git a/cpan/IO-Compress/README b/cpan/IO-Compress/README index 8ad08ddf44..e13ea76a7b 100644 --- a/cpan/IO-Compress/README +++ b/cpan/IO-Compress/README @@ -1,9 +1,9 @@ IO-Compress - Version 2.045 + Version 2.046 - 3rd December 2011 + 18th December 2011 Copyright (c) 1995-2011 Paul Marquess. All rights reserved. This program is free software; you can redistribute it diff --git a/cpan/IO-Compress/bin/zipdetails b/cpan/IO-Compress/bin/zipdetails index 5cb3a96ad6..6e405f3c8e 100644 --- a/cpan/IO-Compress/bin/zipdetails +++ b/cpan/IO-Compress/bin/zipdetails @@ -177,7 +177,7 @@ my %Extras = ( ); -my $VERSION = "1.04" ; +my $VERSION = "1.05" ; my $FH; @@ -189,6 +189,8 @@ my $CentralHeaderCount = 0; my $START; my $OFFSET = new U64 0; my $TRAILING = 0 ; +my $PAYLOADLIMIT = new U64 256; +my $ZERO = new U64 0 ; sub prOff { @@ -472,14 +474,12 @@ sub outSomeData my $size = shift; my $message = shift; - my $size32 = $size; - if (ref $size eq 'U64') { - $size32 = $size->getLow(); - } + my $size64 = U64::mkU64($size); - if ($size > 0) { - if ($size > 64) { - out0 $size, $message; + if ($size64->gt($ZERO)) { + my $size32 = $size64->getLow(); + if ($size64->gt($PAYLOADLIMIT) ) { + out0 $size32, $message; } else { myRead(my $buffer, $size32 ); out $buffer, $message, xDump $buffer ; @@ -1771,6 +1771,16 @@ sub _dosToUnixTime bless [ @$self ], ref $self ; } + sub mkU64 + { + my $value = shift; + + return $value + if ref $value eq 'U64'; + + bless [ $value, 0 ], "U64" ; + } + sub getHigh { my $self = shift; @@ -1860,15 +1870,6 @@ sub _dosToUnixTime } } - sub equal - { - my $self = shift; - my $other = shift; - - return $self->[LOW] == $other->[LOW] && - $self->[HIGH] == $other->[HIGH] ; - } - sub is64bit { my $self = shift; @@ -1901,13 +1902,37 @@ sub _dosToUnixTime my $self = shift; return $self->[HIGH] == 0 && $self->[LOW] == MAX32; } + + sub stringify + { + my $self = shift; + + return "High [$self->[HIGH]], Low [$self->[LOW]]"; + } + sub equal + { + my $self = shift; + my $other = shift; + + return $self->[LOW] == $other->[LOW] && + $self->[HIGH] == $other->[HIGH] ; + } + + sub gt + { + my $self = shift; + my $other = shift; + + return $self->cmp($other) > 0 ; + } + sub cmp { my $self = shift; my $other = shift ; - if ($self->[HIGH] == $other->[LOW]) { + if ($self->[LOW] == $other->[LOW]) { return $self->[HIGH] - $other->[HIGH] ; } else { diff --git a/cpan/IO-Compress/lib/IO/Compress/Base.pm b/cpan/IO-Compress/lib/IO/Compress/Base.pm index c1502b2593..adcfeccd55 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base.pm @@ -20,7 +20,7 @@ use bytes; our (@ISA, $VERSION); @ISA = qw(Exporter IO::File); -$VERSION = '2.045'; +$VERSION = '2.046'; #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. diff --git a/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm index f1acf31e6a..0f1c63a234 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Base/Common.pm @@ -980,6 +980,28 @@ sub equal $self->[HIGH] == $other->[HIGH] ; } +sub gt +{ + my $self = shift; + my $other = shift; + + return $self->cmp($other) > 0 ; +} + +sub cmp +{ + my $self = shift; + my $other = shift ; + + if ($self->[LOW] == $other->[LOW]) { + return $self->[HIGH] - $other->[HIGH] ; + } + else { + return $self->[LOW] - $other->[LOW] ; + } +} + + sub is64bit { my $self = shift; diff --git a/cpan/IO-Compress/lib/IO/Compress/FAQ.pod b/cpan/IO-Compress/lib/IO/Compress/FAQ.pod index c1059101c1..92be8563b8 100644 --- a/cpan/IO-Compress/lib/IO/Compress/FAQ.pod +++ b/cpan/IO-Compress/lib/IO/Compress/FAQ.pod @@ -1,7 +1,7 @@ =head1 NAME -IO::Conmpress::FAQ -- Frequently Asked Questions about IO::Compress +IO::Compress::FAQ -- Frequently Asked Questions about IO::Compress =head1 DESCRIPTION diff --git a/cpan/IO-Compress/lib/IO/Compress/Zip.pm b/cpan/IO-Compress/lib/IO/Compress/Zip.pm index 75d37c551b..0e4c957c39 100644 --- a/cpan/IO-Compress/lib/IO/Compress/Zip.pm +++ b/cpan/IO-Compress/lib/IO/Compress/Zip.pm @@ -36,7 +36,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError); -$VERSION = '2.045'; +$VERSION = '2.046'; $ZipError = ''; @ISA = qw(Exporter IO::Compress::RawDeflate); @@ -666,7 +666,7 @@ sub getExtraParams 'ZipComment'=> [0, 1, Parse_any, ''], 'Name' => [0, 1, Parse_any, ''], 'FilterName'=> [0, 1, Parse_code, undef], - 'CanonicalName'=> [0, 1, Parse_boolean, 1], + 'CanonicalName'=> [0, 1, Parse_boolean, 0], #'UTF8' => [0, 1, Parse_boolean, 0], 'Time' => [0, 1, Parse_any, undef], 'exTime' => [0, 1, Parse_any, undef], @@ -1254,7 +1254,7 @@ can modify the value used for the zip filename header field. This option controls whether the filename field in the zip header is I<normalized> into Unix format before being written to the zip file. -It is recommended that you leave this option enabled unless you really need +It is recommended that you enable this option unless you really need to create a non-standard Zip file. This is what APPNOTE.TXT has to say on what should be stored in the zip @@ -1267,7 +1267,7 @@ filename header field. backwards slashes '\' for compatibility with Amiga and UNIX file systems etc. -This option defaults to B<true>. +This option defaults to B<false>. =item C<< FilterName => sub { ... } >> @@ -1281,7 +1281,7 @@ filename is available C<$_> will contain an empty string. The value of C<$_> when the sub returns will be stored in the filename header field. -Note that if C<CanonicalName> is enabled (and it is by default), a +Note that if C<CanonicalName> is enabled, a normalized filename will be passed to the sub. If you use C<FilterName> to modify the filename, it is your responsibility diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Base.pm b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm index b4c7454bdf..973d41b19e 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Base.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Base.pm @@ -9,7 +9,7 @@ our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS); @ISA = qw(Exporter IO::File); -$VERSION = '2.045'; +$VERSION = '2.046'; use constant G_EOF => 0 ; use constant G_ERR => -1 ; @@ -210,7 +210,8 @@ sub smartEof # # here, but this can cause trouble if # the filehandle is itself a tied handle, but it uses sysread. - # Then we get into mixing buffered & non-buffered IO, which will cause trouble + # Then we get into mixing buffered & non-buffered IO, + # which will cause trouble my $info = $self->getErrInfo(); diff --git a/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm index a1088f040e..de6eca5a3a 100644 --- a/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm +++ b/cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm @@ -31,7 +31,7 @@ require Exporter ; our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup); -$VERSION = '2.045'; +$VERSION = '2.046'; $UnzipError = ''; @ISA = qw(Exporter IO::Uncompress::RawInflate); @@ -1783,7 +1783,7 @@ stream at a time. or die "Cannot open $zipfile: $UnzipError"; my $status; - for ($status = 1; ! $u->eof(); $status = $u->nextStream()) + for ($status = 1; $stream > 0; $status = $u->nextStream()) { my $name = $u->getHeaderInfo()->{Name}; diff --git a/cpan/IO-Compress/t/006zip.t b/cpan/IO-Compress/t/006zip.t index b2868025f5..c79db5b580 100644 --- a/cpan/IO-Compress/t/006zip.t +++ b/cpan/IO-Compress/t/006zip.t @@ -19,7 +19,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 85 + $extra ; + plan tests => 91 + $extra ; use_ok('IO::Compress::Zip', qw(:all)) ; use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ; @@ -46,7 +46,7 @@ sub getContent my @content; my $status ; - for ($status = 1; ! $u->eof(); $status = $u->nextStream()) + for ($status = 1; $status > 0 ; $status = $u->nextStream()) { my $name = $u->getHeaderInfo()->{Name}; #warn "Processing member $name\n" ; @@ -276,6 +276,25 @@ SKIP: is $got[1], $content[1], "Got 2nd entry"; } +{ + title "Zip file with a single zero-length file"; + + my $lex = new LexFile my $file1; + + + my $zip = new IO::Compress::Zip $file1, + Name => "one", Method => ZIP_CM_STORE, Stream => 0; + isa_ok $zip, "IO::Compress::Zip"; + + $zip->newStream(Name=> "two", Method => ZIP_CM_STORE); + ok $zip->close(), "closed"; + + my @got = getContent($file1); + + is $got[0], "", "no content"; + is $got[1], "", "no content"; +} + SKIP: for my $method (ZIP_CM_DEFLATE, ZIP_CM_STORE, ZIP_CM_BZIP2) { diff --git a/cpan/IO-Compress/t/01misc.t b/cpan/IO-Compress/t/01misc.t index 76d6a7bdc2..528b71f034 100644 --- a/cpan/IO-Compress/t/01misc.t +++ b/cpan/IO-Compress/t/01misc.t @@ -19,7 +19,7 @@ BEGIN { $extra = 1 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; - plan tests => 136 + $extra ; + plan tests => 140 + $extra ; use_ok('Scalar::Util'); use_ok('IO::Compress::Base::Common'); @@ -361,4 +361,12 @@ My::testParseParameters(); $z = U64::clone($x); is $z->getHigh, 21, " getHigh is 21"; is $z->getLow, 77, " getLow is 77"; + + title "U64 - cmp.gt" ; + $x = new U64 1; + $y = new U64 0; + cmp_ok $x->cmp($y), '>', 0, " cmp > 0"; + is $x->gt($y), 1, " gt"; + cmp_ok $y->cmp($x), '<', 0, " cmp < 0"; + } diff --git a/cpan/IO-Compress/t/105oneshot-zip-only.t b/cpan/IO-Compress/t/105oneshot-zip-only.t index 1f43c2c261..4fea3d1a46 100644 --- a/cpan/IO-Compress/t/105oneshot-zip-only.t +++ b/cpan/IO-Compress/t/105oneshot-zip-only.t @@ -152,6 +152,7 @@ sub zipGetHeader is $hdr->{Name}, "abcde", " Name is 'abcde'" ; $hdr = zipGetHeader($file1, $content, Name => $abs, + CanonicalName => 1, FilterName => sub { s/joe/jim/ }); is $hdr->{Name}, "fred/jim", " Name is 'fred/jim'" ; |