'IO-Compress' => {
'MAINTAINER' => 'pmqs',
- 'DISTRIBUTION' => 'PMQS/IO-Compress-2.045.tar.gz',
+ 'DISTRIBUTION' => 'PMQS/IO-Compress-2.046.tar.gz',
'FILES' => q[cpan/IO-Compress],
'EXCLUDED' => [qr{t/Test/}],
'UPSTREAM' => 'cpan',
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
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
);
-my $VERSION = "1.04" ;
+my $VERSION = "1.05" ;
my $FH;
my $START;
my $OFFSET = new U64 0;
my $TRAILING = 0 ;
+my $PAYLOADLIMIT = new U64 256;
+my $ZERO = new U64 0 ;
sub prOff
{
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 ;
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;
}
}
- sub equal
- {
- my $self = shift;
- my $other = shift;
-
- return $self->[LOW] == $other->[LOW] &&
- $self->[HIGH] == $other->[HIGH] ;
- }
-
sub is64bit
{
my $self = shift;
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 {
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.
$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;
=head1 NAME
-IO::Conmpress::FAQ -- Frequently Asked Questions about IO::Compress
+IO::Compress::FAQ -- Frequently Asked Questions about IO::Compress
=head1 DESCRIPTION
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
-$VERSION = '2.045';
+$VERSION = '2.046';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
'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],
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
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 { ... } >>
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
@ISA = qw(Exporter IO::File);
-$VERSION = '2.045';
+$VERSION = '2.046';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
#
# 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();
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.045';
+$VERSION = '2.046';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
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};
$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)) ;
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" ;
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)
{
$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');
$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";
+
}
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'" ;
=item *
-L<IO::Compress::Base> has been upgraded from version 2.042 to version 2.045.
+L<IO::Compress::Base> has been upgraded from version 2.042 to version 2.046.
Added zipdetails utility.