CHANGES
-------
+ 2.021 30 August 2009
+
+ * Changed test harness so that it can cope with PERL5OPT=-MCarp=verbose
+ [RT# 47225]
+
2.020 4 June 2009
* No Changes
Compress-Raw-Bzip2
- Version 2.020
+ Version 2.021
- 3rd June 2009
+ 30th August 2009
Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it
If you haven't installed Compress-Raw-Bzip2 then search Compress::Raw::Bzip2.pm
for a line like this:
- $VERSION = "2.020" ;
+ $VERSION = "2.021" ;
c. The version of bzip2 you have used.
If you have successfully installed Compress-Raw-Bzip2, this one-liner
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.020';
+$VERSION = '2.021';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
MyTrebleCheck:
@echo Checking for $$^W in files: '. "@files" . '
- @perl -ne \' \
- exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \
- \' ' . " @files || " . ' \
+ perl -ne \' \
+ exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \' \
+ ' . " @files || " . ' \
(echo found unexpected $$^W ; exit 1)
@echo All is ok.
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- my $VERSION = '2.020';
+ my $VERSION = '2.021';
my @NAMES = qw(
);
return readFile($filename) eq unpack("u", $uue) ;
}
-sub isRawFormat
+#sub isRawFormat
+#{
+# my $class = shift;
+# # TODO -- add Lzma here?
+# my %raw = map { $_ => 1 } qw( RawDeflate );
+#
+# return defined $raw{$class};
+#}
+
+
+
+my %TOP = (
+ 'IO::Uncompress::AnyInflate' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'AnyInflateError',
+ TopLevel => 'anyinflate',
+ Raw => 0,
+ },
+
+ 'IO::Uncompress::AnyUncompress' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'AnyUncompressError',
+ TopLevel => 'anyuncompress',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Gzip' => { Inverse => 'IO::Uncompress::Gunzip',
+ Error => 'GzipError',
+ TopLevel => 'gzip',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Gunzip' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'GunzipError',
+ TopLevel => 'gunzip',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Deflate' => { Inverse => 'IO::Uncompress::Inflate',
+ Error => 'DeflateError',
+ TopLevel => 'deflate',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Inflate' => { Inverse => 'IO::Compress::Deflate',
+ Error => 'InflateError',
+ TopLevel => 'inflate',
+ Raw => 0,
+ },
+
+ 'IO::Compress::RawDeflate' => { Inverse => 'IO::Uncompress::RawInflate',
+ Error => 'RawDeflateError',
+ TopLevel => 'rawdeflate',
+ Raw => 1,
+ },
+ 'IO::Uncompress::RawInflate' => { Inverse => 'IO::Compress::RawDeflate',
+ Error => 'RawInflateError',
+ TopLevel => 'rawinflate',
+ Raw => 1,
+ },
+
+ 'IO::Compress::Zip' => { Inverse => 'IO::Uncompress::Unzip',
+ Error => 'ZipError',
+ TopLevel => 'zip',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Unzip' => { Inverse => 'IO::Compress::Zip',
+ Error => 'UnzipError',
+ TopLevel => 'unzip',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Bzip2' => { Inverse => 'IO::Uncompress::Bunzip2',
+ Error => 'Bzip2Error',
+ TopLevel => 'bzip2',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Bunzip2' => { Inverse => 'IO::Compress::Bzip2',
+ Error => 'Bunzip2Error',
+ TopLevel => 'bunzip2',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzop' => { Inverse => 'IO::Uncompress::UnLzop',
+ Error => 'LzopError',
+ TopLevel => 'lzop',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnLzop' => { Inverse => 'IO::Compress::Lzop',
+ Error => 'UnLzopError',
+ TopLevel => 'unlzop',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzf' => { Inverse => 'IO::Uncompress::UnLzf',
+ Error => 'LzfError',
+ TopLevel => 'lzf',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnLzf' => { Inverse => 'IO::Compress::Lzf',
+ Error => 'UnLzfError',
+ TopLevel => 'unlzf',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzma' => { Inverse => 'IO::Uncompress::UnLzma',
+ Error => 'LzmaError',
+ TopLevel => 'lzma',
+ Raw => 1,
+ },
+ 'IO::Uncompress::UnLzma' => { Inverse => 'IO::Compress::Lzma',
+ Error => 'UnLzmaError',
+ TopLevel => 'unlzma',
+ Raw => 1,
+ },
+
+ 'IO::Compress::Xz' => { Inverse => 'IO::Uncompress::UnXz',
+ Error => 'XzError',
+ TopLevel => 'xz',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnXz' => { Inverse => 'IO::Compress::Xz',
+ Error => 'UnXzError',
+ TopLevel => 'unxz',
+ Raw => 0,
+ },
+
+ 'IO::Compress::PPMd' => { Inverse => 'IO::Uncompress::UnPPMd',
+ Error => 'PPMdError',
+ TopLevel => 'ppmd',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnPPMd' => { Inverse => 'IO::Compress::PPMd',
+ Error => 'UnPPMdError',
+ TopLevel => 'unppmd',
+ Raw => 0,
+ },
+
+ 'IO::Compress::DummyComp' => { Inverse => 'IO::Uncompress::DummyUnComp',
+ Error => 'DummyCompError',
+ TopLevel => 'dummycomp',
+ Raw => 0,
+ },
+ 'IO::Uncompress::DummyUnComp' => { Inverse => 'IO::Compress::DummyComp',
+ Error => 'DummyUnCompError',
+ TopLevel => 'dummyunComp',
+ Raw => 0,
+ },
+);
+
+
+for my $key (keys %TOP)
{
- my $class = shift;
- my %raw = map { $_ => 1 } qw( RawDeflate );
+ no strict;
+ no warnings;
+ $TOP{$key}{Error} = \${ $key . '::' . $TOP{$key}{Error} };
+ $TOP{$key}{TopLevel} = $key . '::' . $TOP{$key}{TopLevel} ;
- return defined $raw{$class};
+ # Silence used once warning in really old perl
+ my $dummy = \${ $key . '::' . $TOP{$key}{Error} };
+
+ #$TOP{$key . "::" . $TOP{$key}{TopLevel} } = $TOP{$key};
}
sub uncompressBuffer
my $compWith = shift ;
my $buffer = shift ;
- my %mapping = ( 'IO::Compress::Gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Gzip::gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::Deflate::deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::RawDeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::RawDeflate::rawdeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::Bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Bzip2::bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Zip::zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzop::lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzf' => 'IO::Uncompress::UnLzf' ,
- 'IO::Compress::Lzf::lzf' => 'IO::Uncompress::UnLzf',
- 'IO::Compress::PPMd' => 'IO::Uncompress::UnPPMd' ,
- 'IO::Compress::PPMd::ppmd' => 'IO::Uncompress::UnPPMd',
- 'IO::Compress::DummyComp' => 'IO::Uncompress::DummyUncomp',
- 'IO::Compress::DummyComp::dummycomp' => 'IO::Uncompress::DummyUncomp',
- );
my $out ;
- my $obj = $mapping{$compWith}->new( \$buffer, -Append => 1);
+ my $obj = $TOP{$compWith}{Inverse}->new( \$buffer, -Append => 1);
1 while $obj->read($out) > 0 ;
return $out ;
}
-my %ErrorMap = ( 'IO::Compress::Gzip' => \$IO::Compress::Gzip::GzipError,
- 'IO::Compress::Gzip::gzip' => \$IO::Compress::Gzip::GzipError,
- 'IO::Uncompress::Gunzip' => \$IO::Uncompress::Gunzip::GunzipError,
- 'IO::Uncompress::Gunzip::gunzip' => \$IO::Uncompress::Gunzip::GunzipError,
- 'IO::Uncompress::Inflate' => \$IO::Uncompress::Inflate::InflateError,
- 'IO::Uncompress::Inflate::inflate' => \$IO::Uncompress::Inflate::InflateError,
- 'IO::Compress::Deflate' => \$IO::Compress::Deflate::DeflateError,
- 'IO::Compress::Deflate::deflate' => \$IO::Compress::Deflate::DeflateError,
- 'IO::Uncompress::RawInflate' => \$IO::Uncompress::RawInflate::RawInflateError,
- 'IO::Uncompress::RawInflate::rawinflate' => \$IO::Uncompress::RawInflate::RawInflateError,
- 'IO::Uncompress::AnyInflate' => \$IO::Uncompress::AnyInflate::AnyInflateError,
- 'IO::Uncompress::AnyInflate::anyinflate' => \$IO::Uncompress::AnyInflate::AnyInflateError,
- 'IO::Uncompress::AnyUncompress' => \$IO::Uncompress::AnyUncompress::AnyUncompressError,
- 'IO::Uncompress::AnyUncompress::anyUncompress' => \$IO::Uncompress::AnyUncompress::AnyUncompressError,
- 'IO::Compress::RawDeflate' => \$IO::Compress::RawDeflate::RawDeflateError,
- 'IO::Compress::RawDeflate::rawdeflate' => \$IO::Compress::RawDeflate::RawDeflateError,
- 'IO::Compress::Bzip2' => \$IO::Compress::Bzip2::Bzip2Error,
- 'IO::Compress::Bzip2::bzip2' => \$IO::Compress::Bzip2::Bzip2Error,
- 'IO::Uncompress::Bunzip2' => \$IO::Uncompress::Bunzip2::Bunzip2Error,
- 'IO::Uncompress::Bunzip2::bunzip2' => \$IO::Uncompress::Bunzip2::Bunzip2Error,
- 'IO::Compress::Zip' => \$IO::Compress::Zip::ZipError,
- 'IO::Compress::Zip::zip' => \$IO::Compress::Zip::ZipError,
- 'IO::Uncompress::Unzip' => \$IO::Uncompress::Unzip::UnzipError,
- 'IO::Uncompress::Unzip::unzip' => \$IO::Uncompress::Unzip::UnzipError,
- 'IO::Compress::Lzop' => \$IO::Compress::Lzop::LzopError,
- 'IO::Compress::Lzop::lzop' => \$IO::Compress::Lzop::LzopError,
- 'IO::Uncompress::UnLzop' => \$IO::Uncompress::UnLzop::UnLzopError,
- 'IO::Uncompress::UnLzop::unlzop' => \$IO::Uncompress::UnLzop::UnLzopError,
- 'IO::Compress::Lzf' => \$IO::Compress::Lzf::LzfError,
- 'IO::Compress::Lzf::lzf' => \$IO::Compress::Lzf::LzfError,
- 'IO::Uncompress::UnLzf' => \$IO::Uncompress::UnLzf::UnLzfError,
- 'IO::Uncompress::UnLzf::unlzf' => \$IO::Uncompress::UnLzf::UnLzfError,
- 'IO::Compress::PPMd' => \$IO::Compress::PPMd::PPMdError,
- 'IO::Compress::PPMd::ppmd' => \$IO::Compress::PPMd::PPMdError,
- 'IO::Uncompress::UnPPMd' => \$IO::Uncompress::UnPPMd::UnPPMdError,
- 'IO::Uncompress::UnPPMd::unppmd' => \$IO::Uncompress::UnPPMd::UnPPMdError,
-
- 'IO::Compress::DummyComp' => \$IO::Compress::DummyComp::DummyCompError,
- 'IO::Compress::DummyComp::dummycomp'=> \$IO::Compress::DummyComp::DummyCompError,
- 'IO::Uncompress::DummyUncomp' => \$IO::Uncompress::DummyUncomp::DummyUncompError,
- 'IO::Uncompress::DummyUncomp::dummyuncomp' => \$IO::Uncompress::DummyUncomp::DummyUncompError,
- );
-
-my %TopFuncMap = ( 'IO::Compress::Gzip' => 'IO::Compress::Gzip::gzip',
- 'IO::Uncompress::Gunzip' => 'IO::Uncompress::Gunzip::gunzip',
-
- 'IO::Compress::Deflate' => 'IO::Compress::Deflate::deflate',
- 'IO::Uncompress::Inflate' => 'IO::Uncompress::Inflate::inflate',
-
- 'IO::Compress::RawDeflate' => 'IO::Compress::RawDeflate::rawdeflate',
- 'IO::Uncompress::RawInflate' => 'IO::Uncompress::RawInflate::rawinflate',
-
- 'IO::Uncompress::AnyInflate' => 'IO::Uncompress::AnyInflate::anyinflate',
- 'IO::Uncompress::AnyUncompress' => 'IO::Uncompress::AnyUncompress::anyuncompress',
-
- 'IO::Compress::Bzip2' => 'IO::Compress::Bzip2::bzip2',
- 'IO::Uncompress::Bunzip2' => 'IO::Uncompress::Bunzip2::bunzip2',
-
- 'IO::Compress::Zip' => 'IO::Compress::Zip::zip',
- 'IO::Uncompress::Unzip' => 'IO::Uncompress::Unzip::unzip',
- 'IO::Compress::Lzop' => 'IO::Compress::Lzop::lzop',
- 'IO::Uncompress::UnLzop' => 'IO::Uncompress::UnLzop::unlzop',
- 'IO::Compress::Lzf' => 'IO::Compress::Lzf::lzf',
- 'IO::Uncompress::UnLzf' => 'IO::Uncompress::UnLzf::unlzf',
- 'IO::Compress::PPMd' => 'IO::Compress::PPMd::ppmd',
- 'IO::Uncompress::UnPPMd' => 'IO::Uncompress::UnPPMd::unppmd',
- 'IO::Compress::DummyComp' => 'IO::Compress::DummyComp::dummyuncomp',
- 'IO::Uncompress::DummyUncomp' => 'IO::Uncompress::DummyUncomp::dummyuncomp',
- );
-
- %TopFuncMap = map { ($_ => $TopFuncMap{$_},
- $TopFuncMap{$_} => $TopFuncMap{$_}) }
- keys %TopFuncMap ;
-
- #%TopFuncMap = map { ($_ => \&{ $TopFuncMap{$_} ) }
- #keys %TopFuncMap ;
-
-
-my %inverse = ( 'IO::Compress::Gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Gzip::gzip' => 'IO::Uncompress::Gunzip::gunzip',
- 'IO::Compress::Deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::Deflate::deflate' => 'IO::Uncompress::Inflate::inflate',
- 'IO::Compress::RawDeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::RawDeflate::rawdeflate' => 'IO::Uncompress::RawInflate::rawinflate',
- 'IO::Compress::Bzip2::bzip2' => 'IO::Uncompress::Bunzip2::bunzip2',
- 'IO::Compress::Bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Zip::zip' => 'IO::Uncompress::Unzip::unzip',
- 'IO::Compress::Zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Lzop::lzop' => 'IO::Uncompress::UnLzop::unlzop',
- 'IO::Compress::Lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzf::lzf' => 'IO::Uncompress::UnLzf::unlzf',
- 'IO::Compress::Lzf' => 'IO::Uncompress::UnLzf',
- 'IO::Compress::PPMd::ppmd' => 'IO::Uncompress::UnPPMd::unppmd',
- 'IO::Compress::PPMd' => 'IO::Uncompress::UnPPMd',
- 'IO::Compress::DummyComp::dummycomp' => 'IO::Uncompress::DummyUncomp::dummyuncomp',
- 'IO::Compress::DummyComp' => 'IO::Uncompress::DummyUncomp',
- );
-
-%inverse = map { ($_ => $inverse{$_}, $inverse{$_} => $_) } keys %inverse;
sub getInverse
{
my $class = shift ;
- return $inverse{$class} ;
+ return $TOP{$class}{Inverse};
}
sub getErrorRef
{
my $class = shift ;
- return $ErrorMap{$class} ;
+ return $TOP{$class}{Error};
}
sub getTopFuncRef
{
my $class = shift ;
- return \&{ $TopFuncMap{$class} } ;
+ die "Cannot find $class"
+ if ! defined $TOP{$class}{TopLevel};
+ return \&{ $TOP{$class}{TopLevel} } ;
}
sub getTopFuncName
{
my $class = shift ;
- return $TopFuncMap{$class} ;
+ return $TOP{$class}{TopLevel} ;
}
sub compressBuffer
my $compWith = shift ;
my $buffer = shift ;
- my %mapping = ( 'IO::Uncompress::Gunzip' => 'IO::Compress::Gzip',
- 'IO::Uncompress::Gunzip::gunzip' => 'IO::Compress::Gzip',
- 'IO::Uncompress::Inflate' => 'IO::Compress::Deflate',
- 'IO::Uncompress::Inflate::inflate' => 'IO::Compress::Deflate',
- 'IO::Uncompress::RawInflate' => 'IO::Compress::RawDeflate',
- 'IO::Uncompress::RawInflate::rawinflate' => 'IO::Compress::RawDeflate',
- 'IO::Uncompress::Bunzip2' => 'IO::Compress::Bzip2',
- 'IO::Uncompress::Bunzip2::bunzip2' => 'IO::Compress::Bzip2',
- 'IO::Uncompress::Unzip' => 'IO::Compress::Zip',
- 'IO::Uncompress::Unzip::unzip' => 'IO::Compress::Zip',
- 'IO::Uncompress::UnLzop' => 'IO::Compress::Lzop',
- 'IO::Uncompress::UnLzop::unlzop' => 'IO::Compress::Lzop',
- 'IO::Uncompress::UnLzp' => 'IO::Compress::Lzf',
- 'IO::Uncompress::UnLzf::unlzf' => 'IO::Compress::Lzf',
- 'IO::Uncompress::UnPPMd' => 'IO::Compress::PPMd',
- 'IO::Uncompress::UnPPMd::unppmd' => 'IO::Compress::PPMd',
- 'IO::Uncompress::AnyInflate' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyInflate::anyinflate' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyUncompress' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyUncompress::anyuncompress' => 'IO::Compress::Gzip',
- 'IO::Uncompress::DummyUncomp' => 'IO::Compress::DummyComp',
- 'IO::Uncompress::DummyUncomp::dummyuncomp'=> 'IO::Compress::DummyComp',
- );
my $out ;
- my $obj = $mapping{$compWith}->new( \$out);
+ die "Cannot find $compWith"
+ if ! defined $TOP{$compWith}{Inverse};
+ my $obj = $TOP{$compWith}{Inverse}->new( \$out);
$obj->write($buffer) ;
$obj->close();
return $out ;
$file = quotemeta($file);
- return "/$string\\s+at $file line $line/" if $] >= 5.006 ;
+ #return "/$string\\s+at $file line $line/" if $] >= 5.006 ;
return "/$string\\s+at /" ;
}
{
my $string = shift ;
- return "/$string\\s+at \\(eval /" if $] > 5.006 ;
+ #return "/$string\\s+at \\(eval /" if $] > 5.006 ;
return "/$string\\s+at /" ;
}
CHANGES
-------
+ 2.021 30 August 2009
+
+ * Changed test harness so that it can cope with PERL5OPT=-MCarp=verbose
+ [RT# 47225]
+
2.020 3 June 2009
* Minor documentation update.
Compress-Raw-Zlib
- Version 2.020
+ Version 2.021
- 3rd June 2009
+ 30th August 2009
Copyright (c) 2005-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it
If you haven't installed Compress-Raw-Zlib then search Compress::Raw::Zlib.pm
for a line like this:
- $VERSION = "2.020" ;
+ $VERSION = "2.021" ;
c. The version of zlib you have used.
If you have successfully installed Compress-Raw-Zlib, this one-liner
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.020';
+$VERSION = '2.021';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
MyTrebleCheck:
@echo Checking for $$^W in files: '. "@files" . '
- @perl -ne \' \
- exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \
- \' ' . " @files || " . ' \
+ perl -ne \' \
+ exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \' \
+ ' . " @files || " . ' \
(echo found unexpected $$^W ; exit 1)
@echo All is ok.
return readFile($filename) eq unpack("u", $uue) ;
}
-sub isRawFormat
+#sub isRawFormat
+#{
+# my $class = shift;
+# # TODO -- add Lzma here?
+# my %raw = map { $_ => 1 } qw( RawDeflate );
+#
+# return defined $raw{$class};
+#}
+
+
+
+my %TOP = (
+ 'IO::Uncompress::AnyInflate' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'AnyInflateError',
+ TopLevel => 'anyinflate',
+ Raw => 0,
+ },
+
+ 'IO::Uncompress::AnyUncompress' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'AnyUncompressError',
+ TopLevel => 'anyuncompress',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Gzip' => { Inverse => 'IO::Uncompress::Gunzip',
+ Error => 'GzipError',
+ TopLevel => 'gzip',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Gunzip' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'GunzipError',
+ TopLevel => 'gunzip',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Deflate' => { Inverse => 'IO::Uncompress::Inflate',
+ Error => 'DeflateError',
+ TopLevel => 'deflate',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Inflate' => { Inverse => 'IO::Compress::Deflate',
+ Error => 'InflateError',
+ TopLevel => 'inflate',
+ Raw => 0,
+ },
+
+ 'IO::Compress::RawDeflate' => { Inverse => 'IO::Uncompress::RawInflate',
+ Error => 'RawDeflateError',
+ TopLevel => 'rawdeflate',
+ Raw => 1,
+ },
+ 'IO::Uncompress::RawInflate' => { Inverse => 'IO::Compress::RawDeflate',
+ Error => 'RawInflateError',
+ TopLevel => 'rawinflate',
+ Raw => 1,
+ },
+
+ 'IO::Compress::Zip' => { Inverse => 'IO::Uncompress::Unzip',
+ Error => 'ZipError',
+ TopLevel => 'zip',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Unzip' => { Inverse => 'IO::Compress::Zip',
+ Error => 'UnzipError',
+ TopLevel => 'unzip',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Bzip2' => { Inverse => 'IO::Uncompress::Bunzip2',
+ Error => 'Bzip2Error',
+ TopLevel => 'bzip2',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Bunzip2' => { Inverse => 'IO::Compress::Bzip2',
+ Error => 'Bunzip2Error',
+ TopLevel => 'bunzip2',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzop' => { Inverse => 'IO::Uncompress::UnLzop',
+ Error => 'LzopError',
+ TopLevel => 'lzop',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnLzop' => { Inverse => 'IO::Compress::Lzop',
+ Error => 'UnLzopError',
+ TopLevel => 'unlzop',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzf' => { Inverse => 'IO::Uncompress::UnLzf',
+ Error => 'LzfError',
+ TopLevel => 'lzf',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnLzf' => { Inverse => 'IO::Compress::Lzf',
+ Error => 'UnLzfError',
+ TopLevel => 'unlzf',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzma' => { Inverse => 'IO::Uncompress::UnLzma',
+ Error => 'LzmaError',
+ TopLevel => 'lzma',
+ Raw => 1,
+ },
+ 'IO::Uncompress::UnLzma' => { Inverse => 'IO::Compress::Lzma',
+ Error => 'UnLzmaError',
+ TopLevel => 'unlzma',
+ Raw => 1,
+ },
+
+ 'IO::Compress::Xz' => { Inverse => 'IO::Uncompress::UnXz',
+ Error => 'XzError',
+ TopLevel => 'xz',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnXz' => { Inverse => 'IO::Compress::Xz',
+ Error => 'UnXzError',
+ TopLevel => 'unxz',
+ Raw => 0,
+ },
+
+ 'IO::Compress::PPMd' => { Inverse => 'IO::Uncompress::UnPPMd',
+ Error => 'PPMdError',
+ TopLevel => 'ppmd',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnPPMd' => { Inverse => 'IO::Compress::PPMd',
+ Error => 'UnPPMdError',
+ TopLevel => 'unppmd',
+ Raw => 0,
+ },
+
+ 'IO::Compress::DummyComp' => { Inverse => 'IO::Uncompress::DummyUnComp',
+ Error => 'DummyCompError',
+ TopLevel => 'dummycomp',
+ Raw => 0,
+ },
+ 'IO::Uncompress::DummyUnComp' => { Inverse => 'IO::Compress::DummyComp',
+ Error => 'DummyUnCompError',
+ TopLevel => 'dummyunComp',
+ Raw => 0,
+ },
+);
+
+
+for my $key (keys %TOP)
{
- my $class = shift;
- my %raw = map { $_ => 1 } qw( RawDeflate );
+ no strict;
+ no warnings;
+ $TOP{$key}{Error} = \${ $key . '::' . $TOP{$key}{Error} };
+ $TOP{$key}{TopLevel} = $key . '::' . $TOP{$key}{TopLevel} ;
- return defined $raw{$class};
+ # Silence used once warning in really old perl
+ my $dummy = \${ $key . '::' . $TOP{$key}{Error} };
+
+ #$TOP{$key . "::" . $TOP{$key}{TopLevel} } = $TOP{$key};
}
sub uncompressBuffer
my $compWith = shift ;
my $buffer = shift ;
- my %mapping = ( 'IO::Compress::Gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Gzip::gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::Deflate::deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::RawDeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::RawDeflate::rawdeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::Bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Bzip2::bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Zip::zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzop::lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzf' => 'IO::Uncompress::UnLzf' ,
- 'IO::Compress::Lzf::lzf' => 'IO::Uncompress::UnLzf',
- 'IO::Compress::PPMd' => 'IO::Uncompress::UnPPMd' ,
- 'IO::Compress::PPMd::ppmd' => 'IO::Uncompress::UnPPMd',
- 'IO::Compress::DummyComp' => 'IO::Uncompress::DummyUncomp',
- 'IO::Compress::DummyComp::dummycomp' => 'IO::Uncompress::DummyUncomp',
- );
my $out ;
- my $obj = $mapping{$compWith}->new( \$buffer, -Append => 1);
+ my $obj = $TOP{$compWith}{Inverse}->new( \$buffer, -Append => 1);
1 while $obj->read($out) > 0 ;
return $out ;
}
-my %ErrorMap = ( 'IO::Compress::Gzip' => \$IO::Compress::Gzip::GzipError,
- 'IO::Compress::Gzip::gzip' => \$IO::Compress::Gzip::GzipError,
- 'IO::Uncompress::Gunzip' => \$IO::Uncompress::Gunzip::GunzipError,
- 'IO::Uncompress::Gunzip::gunzip' => \$IO::Uncompress::Gunzip::GunzipError,
- 'IO::Uncompress::Inflate' => \$IO::Uncompress::Inflate::InflateError,
- 'IO::Uncompress::Inflate::inflate' => \$IO::Uncompress::Inflate::InflateError,
- 'IO::Compress::Deflate' => \$IO::Compress::Deflate::DeflateError,
- 'IO::Compress::Deflate::deflate' => \$IO::Compress::Deflate::DeflateError,
- 'IO::Uncompress::RawInflate' => \$IO::Uncompress::RawInflate::RawInflateError,
- 'IO::Uncompress::RawInflate::rawinflate' => \$IO::Uncompress::RawInflate::RawInflateError,
- 'IO::Uncompress::AnyInflate' => \$IO::Uncompress::AnyInflate::AnyInflateError,
- 'IO::Uncompress::AnyInflate::anyinflate' => \$IO::Uncompress::AnyInflate::AnyInflateError,
- 'IO::Uncompress::AnyUncompress' => \$IO::Uncompress::AnyUncompress::AnyUncompressError,
- 'IO::Uncompress::AnyUncompress::anyUncompress' => \$IO::Uncompress::AnyUncompress::AnyUncompressError,
- 'IO::Compress::RawDeflate' => \$IO::Compress::RawDeflate::RawDeflateError,
- 'IO::Compress::RawDeflate::rawdeflate' => \$IO::Compress::RawDeflate::RawDeflateError,
- 'IO::Compress::Bzip2' => \$IO::Compress::Bzip2::Bzip2Error,
- 'IO::Compress::Bzip2::bzip2' => \$IO::Compress::Bzip2::Bzip2Error,
- 'IO::Uncompress::Bunzip2' => \$IO::Uncompress::Bunzip2::Bunzip2Error,
- 'IO::Uncompress::Bunzip2::bunzip2' => \$IO::Uncompress::Bunzip2::Bunzip2Error,
- 'IO::Compress::Zip' => \$IO::Compress::Zip::ZipError,
- 'IO::Compress::Zip::zip' => \$IO::Compress::Zip::ZipError,
- 'IO::Uncompress::Unzip' => \$IO::Uncompress::Unzip::UnzipError,
- 'IO::Uncompress::Unzip::unzip' => \$IO::Uncompress::Unzip::UnzipError,
- 'IO::Compress::Lzop' => \$IO::Compress::Lzop::LzopError,
- 'IO::Compress::Lzop::lzop' => \$IO::Compress::Lzop::LzopError,
- 'IO::Uncompress::UnLzop' => \$IO::Uncompress::UnLzop::UnLzopError,
- 'IO::Uncompress::UnLzop::unlzop' => \$IO::Uncompress::UnLzop::UnLzopError,
- 'IO::Compress::Lzf' => \$IO::Compress::Lzf::LzfError,
- 'IO::Compress::Lzf::lzf' => \$IO::Compress::Lzf::LzfError,
- 'IO::Uncompress::UnLzf' => \$IO::Uncompress::UnLzf::UnLzfError,
- 'IO::Uncompress::UnLzf::unlzf' => \$IO::Uncompress::UnLzf::UnLzfError,
- 'IO::Compress::PPMd' => \$IO::Compress::PPMd::PPMdError,
- 'IO::Compress::PPMd::ppmd' => \$IO::Compress::PPMd::PPMdError,
- 'IO::Uncompress::UnPPMd' => \$IO::Uncompress::UnPPMd::UnPPMdError,
- 'IO::Uncompress::UnPPMd::unppmd' => \$IO::Uncompress::UnPPMd::UnPPMdError,
-
- 'IO::Compress::DummyComp' => \$IO::Compress::DummyComp::DummyCompError,
- 'IO::Compress::DummyComp::dummycomp'=> \$IO::Compress::DummyComp::DummyCompError,
- 'IO::Uncompress::DummyUncomp' => \$IO::Uncompress::DummyUncomp::DummyUncompError,
- 'IO::Uncompress::DummyUncomp::dummyuncomp' => \$IO::Uncompress::DummyUncomp::DummyUncompError,
- );
-
-my %TopFuncMap = ( 'IO::Compress::Gzip' => 'IO::Compress::Gzip::gzip',
- 'IO::Uncompress::Gunzip' => 'IO::Uncompress::Gunzip::gunzip',
-
- 'IO::Compress::Deflate' => 'IO::Compress::Deflate::deflate',
- 'IO::Uncompress::Inflate' => 'IO::Uncompress::Inflate::inflate',
-
- 'IO::Compress::RawDeflate' => 'IO::Compress::RawDeflate::rawdeflate',
- 'IO::Uncompress::RawInflate' => 'IO::Uncompress::RawInflate::rawinflate',
-
- 'IO::Uncompress::AnyInflate' => 'IO::Uncompress::AnyInflate::anyinflate',
- 'IO::Uncompress::AnyUncompress' => 'IO::Uncompress::AnyUncompress::anyuncompress',
-
- 'IO::Compress::Bzip2' => 'IO::Compress::Bzip2::bzip2',
- 'IO::Uncompress::Bunzip2' => 'IO::Uncompress::Bunzip2::bunzip2',
-
- 'IO::Compress::Zip' => 'IO::Compress::Zip::zip',
- 'IO::Uncompress::Unzip' => 'IO::Uncompress::Unzip::unzip',
- 'IO::Compress::Lzop' => 'IO::Compress::Lzop::lzop',
- 'IO::Uncompress::UnLzop' => 'IO::Uncompress::UnLzop::unlzop',
- 'IO::Compress::Lzf' => 'IO::Compress::Lzf::lzf',
- 'IO::Uncompress::UnLzf' => 'IO::Uncompress::UnLzf::unlzf',
- 'IO::Compress::PPMd' => 'IO::Compress::PPMd::ppmd',
- 'IO::Uncompress::UnPPMd' => 'IO::Uncompress::UnPPMd::unppmd',
- 'IO::Compress::DummyComp' => 'IO::Compress::DummyComp::dummyuncomp',
- 'IO::Uncompress::DummyUncomp' => 'IO::Uncompress::DummyUncomp::dummyuncomp',
- );
-
- %TopFuncMap = map { ($_ => $TopFuncMap{$_},
- $TopFuncMap{$_} => $TopFuncMap{$_}) }
- keys %TopFuncMap ;
-
- #%TopFuncMap = map { ($_ => \&{ $TopFuncMap{$_} ) }
- #keys %TopFuncMap ;
-
-
-my %inverse = ( 'IO::Compress::Gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Gzip::gzip' => 'IO::Uncompress::Gunzip::gunzip',
- 'IO::Compress::Deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::Deflate::deflate' => 'IO::Uncompress::Inflate::inflate',
- 'IO::Compress::RawDeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::RawDeflate::rawdeflate' => 'IO::Uncompress::RawInflate::rawinflate',
- 'IO::Compress::Bzip2::bzip2' => 'IO::Uncompress::Bunzip2::bunzip2',
- 'IO::Compress::Bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Zip::zip' => 'IO::Uncompress::Unzip::unzip',
- 'IO::Compress::Zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Lzop::lzop' => 'IO::Uncompress::UnLzop::unlzop',
- 'IO::Compress::Lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzf::lzf' => 'IO::Uncompress::UnLzf::unlzf',
- 'IO::Compress::Lzf' => 'IO::Uncompress::UnLzf',
- 'IO::Compress::PPMd::ppmd' => 'IO::Uncompress::UnPPMd::unppmd',
- 'IO::Compress::PPMd' => 'IO::Uncompress::UnPPMd',
- 'IO::Compress::DummyComp::dummycomp' => 'IO::Uncompress::DummyUncomp::dummyuncomp',
- 'IO::Compress::DummyComp' => 'IO::Uncompress::DummyUncomp',
- );
-
-%inverse = map { ($_ => $inverse{$_}, $inverse{$_} => $_) } keys %inverse;
sub getInverse
{
my $class = shift ;
- return $inverse{$class} ;
+ return $TOP{$class}{Inverse};
}
sub getErrorRef
{
my $class = shift ;
- return $ErrorMap{$class} ;
+ return $TOP{$class}{Error};
}
sub getTopFuncRef
{
my $class = shift ;
- return \&{ $TopFuncMap{$class} } ;
+ die "Cannot find $class"
+ if ! defined $TOP{$class}{TopLevel};
+ return \&{ $TOP{$class}{TopLevel} } ;
}
sub getTopFuncName
{
my $class = shift ;
- return $TopFuncMap{$class} ;
+ return $TOP{$class}{TopLevel} ;
}
sub compressBuffer
my $compWith = shift ;
my $buffer = shift ;
- my %mapping = ( 'IO::Uncompress::Gunzip' => 'IO::Compress::Gzip',
- 'IO::Uncompress::Gunzip::gunzip' => 'IO::Compress::Gzip',
- 'IO::Uncompress::Inflate' => 'IO::Compress::Deflate',
- 'IO::Uncompress::Inflate::inflate' => 'IO::Compress::Deflate',
- 'IO::Uncompress::RawInflate' => 'IO::Compress::RawDeflate',
- 'IO::Uncompress::RawInflate::rawinflate' => 'IO::Compress::RawDeflate',
- 'IO::Uncompress::Bunzip2' => 'IO::Compress::Bzip2',
- 'IO::Uncompress::Bunzip2::bunzip2' => 'IO::Compress::Bzip2',
- 'IO::Uncompress::Unzip' => 'IO::Compress::Zip',
- 'IO::Uncompress::Unzip::unzip' => 'IO::Compress::Zip',
- 'IO::Uncompress::UnLzop' => 'IO::Compress::Lzop',
- 'IO::Uncompress::UnLzop::unlzop' => 'IO::Compress::Lzop',
- 'IO::Uncompress::UnLzp' => 'IO::Compress::Lzf',
- 'IO::Uncompress::UnLzf::unlzf' => 'IO::Compress::Lzf',
- 'IO::Uncompress::UnPPMd' => 'IO::Compress::PPMd',
- 'IO::Uncompress::UnPPMd::unppmd' => 'IO::Compress::PPMd',
- 'IO::Uncompress::AnyInflate' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyInflate::anyinflate' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyUncompress' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyUncompress::anyuncompress' => 'IO::Compress::Gzip',
- 'IO::Uncompress::DummyUncomp' => 'IO::Compress::DummyComp',
- 'IO::Uncompress::DummyUncomp::dummyuncomp'=> 'IO::Compress::DummyComp',
- );
my $out ;
- my $obj = $mapping{$compWith}->new( \$out);
+ die "Cannot find $compWith"
+ if ! defined $TOP{$compWith}{Inverse};
+ my $obj = $TOP{$compWith}{Inverse}->new( \$out);
$obj->write($buffer) ;
$obj->close();
return $out ;
$file = quotemeta($file);
- return "/$string\\s+at $file line $line/" if $] >= 5.006 ;
+ #return "/$string\\s+at $file line $line/" if $] >= 5.006 ;
return "/$string\\s+at /" ;
}
{
my $string = shift ;
- return "/$string\\s+at \\(eval /" if $] > 5.006 ;
+ #return "/$string\\s+at \\(eval /" if $] > 5.006 ;
return "/$string\\s+at /" ;
}
CHANGES
-------
+ 2.021 30 August 2009
+
+
+ * IO::Compress::Base.pm
+ - Less warnnings when reading from a closed filehandle.
+ [RT# 48350]
+ - Fixed minor typo in an error message.
+ [RT# 39719]
+
+ * Makefile.PL
+ The PREREQ_PM dependency on Scalar::Util got dropped when
+ IO-Compress was created in 2.017.
+ [RT# 47509]
+
+ * IO::Compress::Zip.pm
+ - Removed restriction that zip64 is only supported in streaming
+ mode.
+ - The "version made by" and "extract" fields in the zip64 end
+ central record were swapped.
+ - In the End Central Header record the "offset to the start of the
+ central directory" will now always be set to 0xFFFFFFFF when
+ zip64 is enabled.
+ - In the End Central Header record the "total entries in the
+ central directory" field will be set to 0xFFFF if zip64 is
+ enabled AND there are more than 0xFFFF entries present.
+
+ * IO::Uncompress::Unzip.pm
+ - Don't consume lots of memory when walking a zip file. This makes
+ life more bearable when dealing with zip64.
+
+ * Compress::Zlib.pm
+ - documented that memGunzip cannot cope with concatenated gzip data
+ streams.
+
+ * Changed test harness so that it can cope with PERL5OPT=-MCarp=verbose
+ [RT# 47225]
+
+ * IO::Compress::Gzip::Constants.pm
+ - GZIP_FEXTRA_MAX_SIZE was set to 0xFF. Should be 0xFFFF. This
+ issue came up when attempting to unzip a file created by MS
+ Office 2007.
+
2.020 3 June 2009
* IO::Uncompress::Base.pm
use strict ;
require 5.004 ;
-$::VERSION = '2.020' ;
+$::VERSION = '2.021' ;
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
? ()
: (PREREQ_PM => { 'Compress::Raw::Bzip2' => $::VERSION,
'Compress::Raw::Zlib' => $::VERSION,
+ 'Scalar::Util' => 0,
$] >= 5.005 && $] < 5.006
? ('File::BSDGlob' => 0)
: () }
IO-Compress
- Version 2.020
+ Version 2.021
- 3rd June 2009
+ 30th August 2009
Copyright (c) 1995-2009 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it
If you haven't installed IO-Compress then search IO::Compress::Gzip.pm
for a line like this:
- $VERSION = "2.020" ;
+ $VERSION = "2.021" ;
2. If you are having problems building IO-Compress, send me a
complete log of what happened. Start by unpacking the IO-Compress
use IO::Handle ;
use Scalar::Util qw(dualvar);
-use IO::Compress::Base::Common 2.020 ;
-use Compress::Raw::Zlib 2.020 ;
-use IO::Compress::Gzip 2.020 ;
-use IO::Uncompress::Gunzip 2.020 ;
+use IO::Compress::Base::Common 2.021 ;
+use Compress::Raw::Zlib 2.021 ;
+use IO::Compress::Gzip 2.021 ;
+use IO::Uncompress::Gunzip 2.021 ;
use strict ;
use warnings ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.020';
+$VERSION = '2.021';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
package Compress::Zlib ;
-use IO::Compress::Gzip::Constants 2.020 ;
+use IO::Compress::Gzip::Constants 2.021 ;
sub memGzip($)
{
The C<$buffer> parameter can either be a scalar or a scalar reference. The
contents of the C<$buffer> parameter are destroyed after calling this function.
+If C<$buffer> consists of multiple concatenated gzip data streams only the
+first will be uncompressed. Use C<gunzip> with the C<MultiStream> option in
+the C<IO::Uncompress::Gunzip> module if you need to deal with concatenated
+data streams.
+
See L<IO::Uncompress::Gunzip|IO::Uncompress::Gunzip> for an alternative way
to carry out in-memory gzip uncompression.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status);
+use IO::Compress::Base::Common 2.021 qw(:Status);
#use Compress::Bzip2 ;
-use Compress::Raw::Bzip2 2.020 ;
+use Compress::Raw::Bzip2 2.021 ;
our ($VERSION);
-$VERSION = '2.020';
+$VERSION = '2.021';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status);
+use IO::Compress::Base::Common 2.021 qw(:Status);
-use Compress::Raw::Zlib 2.020 qw(Z_OK Z_FINISH MAX_WBITS) ;
+use Compress::Raw::Zlib 2.021 qw(Z_OK Z_FINISH MAX_WBITS) ;
our ($VERSION);
-$VERSION = '2.020';
+$VERSION = '2.021';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status);
+use IO::Compress::Base::Common 2.021 qw(:Status);
our ($VERSION);
-$VERSION = '2.020';
+$VERSION = '2.021';
sub mkCompObject
{
use strict ;
use warnings;
-use IO::Compress::Base::Common 2.020 ;
+use IO::Compress::Base::Common 2.021 ;
use IO::File ;
use Scalar::Util qw(blessed readonly);
our (@ISA, $VERSION);
@ISA = qw(Exporter IO::File);
-$VERSION = '2.020';
+$VERSION = '2.021';
#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.
my $status ;
my $buff ;
my $count = 0 ;
- while (($status = read($fh, $buff, 16 * 1024)) > 0) {
+ while ($status = read($fh, $buff, 16 * 1024)) {
$count += length $buff;
defined $self->syswrite($buff, @_)
or return undef ;
}
return $self->saveErrorString(undef, $!, $!)
- if $status < 0 ;
+ if ! defined $status ;
if ( (!$isFilehandle || *$self->{AutoClose}) && $input ne '-')
{
require Exporter;
our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE);
@ISA = qw(Exporter);
-$VERSION = '2.020';
+$VERSION = '2.021';
@EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput
isaFileGlobString cleanFileGlobString oneTarget
if (@Bad) {
my ($bad) = join(", ", @Bad) ;
- return $self->setError("unknown key value(s) @Bad") ;
+ return $self->setError("unknown key value(s) $bad") ;
}
return 1;
package U64;
use constant MAX32 => 0xFFFFFFFF ;
+use constant HI_1 => MAX32 + 1 ;
use constant LOW => 0 ;
use constant HIGH => 1;
return $self->[LOW];
}
+sub get64bit
+{
+ my $self = shift;
+ # Not using << here because the result will still be
+ # a 32-bit value on systems where int size is 32-bits
+ return $self->[HIGH] * HI_1 + $self->[LOW];
+}
+
sub add
{
my $self = shift;
else {
$self->[LOW] += $value ;
}
+
}
sub equal
$self->[HIGH] == $other->[HIGH] ;
}
+sub is64bit
+{
+ my $self = shift;
+ return $self->[HIGH] > 0 ;
+}
+
sub getPacked_V64
{
my $self = shift;
use bytes;
require Exporter ;
-use IO::Compress::Base 2.020 ;
+use IO::Compress::Base 2.021 ;
-use IO::Compress::Base::Common 2.020 qw(createSelfTiedObject);
-use IO::Compress::Adapter::Bzip2 2.020 ;
+use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject);
+use IO::Compress::Adapter::Bzip2 2.021 ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error);
-$VERSION = '2.020';
+$VERSION = '2.021';
$Bzip2Error = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.020 qw(:Parse);
+ use IO::Compress::Base::Common 2.021 qw(:Parse);
return (
'BlockSize100K' => [0, 1, Parse_unsigned, 1],
require Exporter ;
-use IO::Compress::RawDeflate 2.020 ;
+use IO::Compress::RawDeflate 2.021 ;
-use Compress::Raw::Zlib 2.020 ;
-use IO::Compress::Zlib::Constants 2.020 ;
-use IO::Compress::Base::Common 2.020 qw(createSelfTiedObject);
+use Compress::Raw::Zlib 2.021 ;
+use IO::Compress::Zlib::Constants 2.021 ;
+use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError);
-$VERSION = '2.020';
+$VERSION = '2.021';
$DeflateError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
use bytes;
-use IO::Compress::RawDeflate 2.020 ;
+use IO::Compress::RawDeflate 2.021 ;
-use Compress::Raw::Zlib 2.020 ;
-use IO::Compress::Base::Common 2.020 qw(:Status :Parse createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.020 ;
-use IO::Compress::Zlib::Extra 2.020 ;
+use Compress::Raw::Zlib 2.021 ;
+use IO::Compress::Base::Common 2.021 qw(:Status :Parse createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.021 ;
+use IO::Compress::Zlib::Extra 2.021 ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
-$VERSION = '2.020';
+$VERSION = '2.021';
$GzipError = '' ;
@ISA = qw(Exporter IO::Compress::RawDeflate);
our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names);
our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE);
-$VERSION = '2.020';
+$VERSION = '2.021';
@ISA = qw(Exporter);
use constant GZIP_MTIME_DEFAULT => 0x00 ;
use constant GZIP_FEXTRA_HEADER_SIZE => 2 ;
-use constant GZIP_FEXTRA_MAX_SIZE => 0xFF ;
+use constant GZIP_FEXTRA_MAX_SIZE => 0xFFFF ;
use constant GZIP_FEXTRA_SUBFIELD_ID_SIZE => 2 ;
use constant GZIP_FEXTRA_SUBFIELD_LEN_SIZE => 2 ;
use constant GZIP_FEXTRA_SUBFIELD_HEADER_SIZE => GZIP_FEXTRA_SUBFIELD_ID_SIZE +
use bytes;
-use IO::Compress::Base 2.020 ;
-use IO::Compress::Base::Common 2.020 qw(:Status createSelfTiedObject);
-use IO::Compress::Adapter::Deflate 2.020 ;
+use IO::Compress::Base 2.021 ;
+use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject);
+use IO::Compress::Adapter::Deflate 2.021 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
-$VERSION = '2.020';
+$VERSION = '2.021';
$RawDeflateError = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.020 qw(:Parse);
- use Compress::Raw::Zlib 2.020 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.021 qw(:Parse);
+ use Compress::Raw::Zlib 2.021 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
return (
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status createSelfTiedObject);
-use IO::Compress::RawDeflate 2.020 ;
-use IO::Compress::Adapter::Deflate 2.020 ;
-use IO::Compress::Adapter::Identity 2.020 ;
-use IO::Compress::Zlib::Extra 2.020 ;
-use IO::Compress::Zip::Constants 2.020 ;
+use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject);
+use IO::Compress::RawDeflate 2.021 ;
+use IO::Compress::Adapter::Deflate 2.021 ;
+use IO::Compress::Adapter::Identity 2.021 ;
+use IO::Compress::Zlib::Extra 2.021 ;
+use IO::Compress::Zip::Constants 2.021 ;
-use Compress::Raw::Zlib 2.020 qw(crc32) ;
+use Compress::Raw::Zlib 2.021 qw(crc32) ;
BEGIN
{
eval { require IO::Compress::Adapter::Bzip2 ;
- import IO::Compress::Adapter::Bzip2 2.020 ;
+ import IO::Compress::Adapter::Bzip2 2.021 ;
require IO::Compress::Bzip2 ;
- import IO::Compress::Bzip2 2.020 ;
+ import IO::Compress::Bzip2 2.021 ;
+ } ;
+ eval { require IO::Compress::Adapter::Lzma ;
+ import IO::Compress::Adapter::Lzma 2.020 ;
+ require IO::Compress::Lzma ;
+ import IO::Compress::Lzma 2.020 ;
} ;
-# eval { require IO::Compress::Adapter::Lzma ;
-# import IO::Compress::Adapter::Lzma 2.018 ;
-# require IO::Compress::Lzma ;
-# import IO::Compress::Lzma 2.018 ;
-# } ;
}
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
-$VERSION = '2.020';
+$VERSION = '2.021';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
%EXPORT_TAGS = %IO::Compress::RawDeflate::DEFLATE_CONSTANTS ;
push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
-$EXPORT_TAGS{zip_method} = [qw( ZIP_CM_STORE ZIP_CM_DEFLATE ZIP_CM_BZIP2 )];
+$EXPORT_TAGS{zip_method} = [qw( ZIP_CM_STORE ZIP_CM_DEFLATE ZIP_CM_BZIP2 ZIP_CM_LZMA)];
push @{ $EXPORT_TAGS{all} }, @{ $EXPORT_TAGS{zip_method} };
Exporter::export_ok_tags('all');
);
*$self->{ZipData}{CRC32} = crc32(undef);
}
-# elsif (*$self->{ZipData}{Method} == ZIP_CM_LZMA) {
-# ($obj, $errstr, $errno) = IO::Compress::Adapter::Lzma::mkCompObject(
-# );
-# *$self->{ZipData}{CRC32} = crc32(undef);
-# }
+ elsif (*$self->{ZipData}{Method} == ZIP_CM_LZMA) {
+ ($obj, $errstr, $errno) = IO::Compress::Adapter::Lzma::mkCompObject();
+ *$self->{ZipData}{CRC32} = crc32(undef);
+ }
return $self->saveErrorString(undef, $errstr, $errno)
if ! defined $obj;
- if (! defined *$self->{ZipData}{StartOffset}) {
- *$self->{ZipData}{StartOffset} = 0;
+ if (! defined *$self->{ZipData}{SizesOffset}) {
+ *$self->{ZipData}{SizesOffset} = 0;
*$self->{ZipData}{Offset} = new U64 ;
}
+ *$self->{ZipData}{AnyZip64} = 0
+ if ! defined *$self->{ZipData}{AnyZip64} ;
+
return $obj;
}
my $self = shift;
my $param = shift ;
- *$self->{ZipData}{StartOffset} = *$self->{ZipData}{Offset}->get32bit() ;
+
+ *$self->{ZipData}{LocalHdrOffset} = U64::clone(*$self->{ZipData}{Offset});
my $filename = '';
$filename = $param->value('Name') || '';
my $x = '';
$x .= pack "V V", 0, 0 ; # uncompressedLength
$x .= pack "V V", 0, 0 ; # compressedLength
- $x .= *$self->{ZipData}{Offset}->getPacked_V64() ; # offset to local hdr
- $x .= pack "V", 0 ; # disk no
-
- $x = IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_ZIP64, $x);
- $extra .= $x;
- $ctlExtra .= $x;
+ $extra .= IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_ZIP64, $x);
}
if (! $param->value('Minimal')) {
$hdr .= pack 'v', length $extra ; # extra length
$hdr .= $filename ;
+
+ # Remember the offset for the compressed & uncompressed lengths in the
+ # local header.
+ if (*$self->{ZipData}{Zip64}) {
+ *$self->{ZipData}{SizesOffset} = *$self->{ZipData}{Offset}->get64bit()
+ + length($hdr) + 4 ;
+ }
+ else {
+ *$self->{ZipData}{SizesOffset} = *$self->{ZipData}{Offset}->get64bit()
+ + 18;
+ }
+
$hdr .= $extra ;
$ctl .= pack 'V', $empty ; # compressed length
$ctl .= pack 'V', $empty ; # uncompressed length
$ctl .= pack 'v', length $filename ; # filename length
+
+ *$self->{ZipData}{ExtraOffset} = length $ctl;
+ *$self->{ZipData}{ExtraSize} = length $ctlExtra ;
+
$ctl .= pack 'v', length $ctlExtra ; # extra length
$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', $extFileAttr ; # external file attributes
- if (! *$self->{ZipData}{Zip64}) {
- $ctl .= pack 'V', *$self->{ZipData}{Offset}->get32bit() ; # offset to local header
+
+ # offset to local hdr
+ if (*$self->{ZipData}{LocalHdrOffset}->is64bit() ) {
+ $ctl .= pack 'V', 0xFFFFFFFF ;
}
else {
- $ctl .= pack 'V', $empty ; # offset to local header
+ $ctl .= *$self->{ZipData}{LocalHdrOffset}->getPacked_V32() ;
}
$ctl .= $filename ;
- *$self->{ZipData}{StartOffset64} = 4 + length $ctl;
$ctl .= $ctlExtra ;
$ctl .= $comment ;
my $data = $crc32 . $sizes ;
+ my $xtrasize = *$self->{UnCompSize}->getPacked_V64() ; # Uncompressed size
+ $xtrasize .= *$self->{CompSize}->getPacked_V64() ; # Compressed size
my $hdr = '';
$hdr .= $data ;
}
else {
- $self->writeAt(*$self->{ZipData}{StartOffset} + 14, $data)
+ $self->writeAt(*$self->{ZipData}{LocalHdrOffset}->get64bit() + 14, $crc32)
+ or return undef;
+ $self->writeAt(*$self->{ZipData}{SizesOffset},
+ *$self->{ZipData}{Zip64} ? $xtrasize : $sizes)
or return undef;
}
- if (! *$self->{ZipData}{Zip64})
- { substr($ctl, 16, length $data) = $data }
- else {
- substr($ctl, 16, length $crc32) = $crc32 ;
- my $s = *$self->{UnCompSize}->getPacked_V64() ; # Uncompressed size
- $s .= *$self->{CompSize}->getPacked_V64() ; # Compressed size
- substr($ctl, *$self->{ZipData}{StartOffset64}, length $s) = $s ;
+ # Central Header Record/Zip64 extended field
+
+ substr($ctl, 16, length $crc32) = $crc32 ;
+
+ my $x = '';
+
+ # uncompressed length
+ if (*$self->{UnCompSize}->is64bit() ) {
+ $x .= *$self->{UnCompSize}->getPacked_V64() ;
+ } else {
+ substr($ctl, 24, 4) = *$self->{UnCompSize}->getPacked_V32() ;
+ }
+
+ # compressed length
+ if (*$self->{CompSize}->is64bit() ) {
+ $x .= *$self->{CompSize}->getPacked_V64() ;
+ } else {
+ substr($ctl, 20, 4) = *$self->{CompSize}->getPacked_V32() ;
+ }
+
+ # Local Header offset
+ $x .= *$self->{ZipData}{LocalHdrOffset}->getPacked_V64()
+ if *$self->{ZipData}{LocalHdrOffset}->is64bit() ;
+
+ # disk no - always zero, so don't need it
+ #$x .= pack "V", 0 ;
+
+ if (length $x) {
+ my $xtra = IO::Compress::Zlib::Extra::mkSubField(ZIP_EXTRA_ID_ZIP64, $x);
+ $ctl .= $xtra ;
+ substr($ctl, *$self->{ZipData}{ExtraOffset}, 2) =
+ pack 'v', *$self->{ZipData}{ExtraSize} + length $xtra;
+
+ *$self->{ZipData}{AnyZip64} = 1;
}
*$self->{ZipData}{Offset}->add(length($hdr));
my $z64e = '';
- if ( *$self->{ZipData}{Zip64} ) {
+ if ( *$self->{ZipData}{AnyZip64} ) {
my $v = *$self->{ZipData}{Version} ;
my $mb = *$self->{ZipData}{MadeBy} ;
- $z64e .= pack 'v', $v ; # Version made by
- $z64e .= pack 'v', $mb ; # Version to extract
+ $z64e .= pack 'v', $mb ; # Version made by
+ $z64e .= pack 'v', $v ; # Version to extract
$z64e .= pack 'V', 0 ; # number of disk
$z64e .= pack 'V', 0 ; # number of disk with central dir
$z64e .= U64::pack_V64 $entries ; # entries in central dir on this disk
$z64e .= *$self->{ZipData}{Offset}->getPacked_V64() ; # offset to end zip64 central dir
$z64e .= pack 'V', 1 ; # Total number of disks
- # TODO - fix these when info-zip 3 is fixed.
- #$cd_len =
- #$cd_offset =
- $entries = 0xFFFF ;
+ $cd_offset = 0xFFFFFFFF ;
+ $cd_len = 0xFFFFFFFF if $cd_len >= 0xFFFFFFFF ;
+ $entries = 0xFFFF if $entries >= 0xFFFF ;
}
my $ecd = '';
$got->value("GID", $timeRef->[1]);
}
+ *$self->{ZipData}{AnyZip64} = 1
+ if $got->value('Zip64');
*$self->{ZipData}{Zip64} = $got->value('Zip64');
*$self->{ZipData}{Stream} = $got->value('Stream');
- return $self->saveErrorString(undef, "Zip64 only supported if Stream enabled")
- if *$self->{ZipData}{Zip64} && ! *$self->{ZipData}{Stream} ;
-
my $method = $got->value('Method');
return $self->saveErrorString(undef, "Unknown Method '$method'")
if ! defined $ZIP_CM_MIN_VERSIONS{$method};
if $method == ZIP_CM_BZIP2 and
! defined $IO::Compress::Adapter::Bzip2::VERSION;
-# return $self->saveErrorString(undef, "Lzma not available")
-# if $method == ZIP_CM_LZMA and
-# ! defined $IO::Compress::Adapter::Lzma::VERSION;
+ return $self->saveErrorString(undef, "Lzma not available")
+ if $method == ZIP_CM_LZMA and
+ ! defined $IO::Compress::Adapter::Lzma::VERSION;
*$self->{ZipData}{Method} = $method;
{
my $self = shift ;
- use IO::Compress::Base::Common 2.020 qw(:Parse);
- use Compress::Raw::Zlib 2.020 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.021 qw(:Parse);
+ use Compress::Raw::Zlib 2.021 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
my @Bzip2 = ();
to store files larger than 4 Gig.
If you intend to manipulate the Zip64 zip files created with this module
-using an external zip/unzip make sure that it supports streaming Zip64.
+using an external zip/unzip make sure that it supports Zip64.
In particular, if you are using Info-Zip you need to have zip version 3.x
or better to update a Zip64 archive and unzip version 6.x to read a zip64
-archive. At the time of writing both are beta status.
-
-When the C<Zip64> option is enabled, the C<Stream> option I<must> be
-enabled as well.
+archive.
The default is 0.
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
-$VERSION = '2.020';
+$VERSION = '2.021';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT);
-$VERSION = '2.020';
+$VERSION = '2.021';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.020';
+$VERSION = '2.021';
-use IO::Compress::Gzip::Constants 2.020 ;
+use IO::Compress::Gzip::Constants 2.021 ;
sub ExtraFieldError
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status);
+use IO::Compress::Base::Common 2.021 qw(:Status);
-use Compress::Raw::Bzip2 2.020 ;
+use Compress::Raw::Bzip2 2.021 ;
our ($VERSION, @ISA);
-$VERSION = '2.020';
+$VERSION = '2.021';
sub mkUncompObject
{
use strict;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status);
+use IO::Compress::Base::Common 2.021 qw(:Status);
our ($VERSION);
-$VERSION = '2.020';
+$VERSION = '2.021';
-use Compress::Raw::Zlib 2.020 ();
+use Compress::Raw::Zlib 2.021 ();
sub mkUncompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status);
-use Compress::Raw::Zlib 2.020 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
+use IO::Compress::Base::Common 2.021 qw(:Status);
+use Compress::Raw::Zlib 2.021 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
our ($VERSION);
-$VERSION = '2.020';
+$VERSION = '2.021';
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.020 ();
+use IO::Uncompress::Adapter::Inflate 2.021 ();
-use IO::Uncompress::Base 2.020 ;
-use IO::Uncompress::Gunzip 2.020 ;
-use IO::Uncompress::Inflate 2.020 ;
-use IO::Uncompress::RawInflate 2.020 ;
-use IO::Uncompress::Unzip 2.020 ;
+use IO::Uncompress::Base 2.021 ;
+use IO::Uncompress::Gunzip 2.021 ;
+use IO::Uncompress::Inflate 2.021 ;
+use IO::Uncompress::RawInflate 2.021 ;
+use IO::Uncompress::Unzip 2.021 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
-$VERSION = '2.020';
+$VERSION = '2.021';
$AnyInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
sub getExtraParams
{
- use IO::Compress::Base::Common 2.020 qw(:Parse);
+ use IO::Compress::Base::Common 2.021 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
=head2 Examples
To read the contents of the file C<file1.txt.Compressed> and write the
-compressed data to the file C<file1.txt>.
+uncompressed data to the file C<file1.txt>.
use strict ;
use warnings ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.021 qw(createSelfTiedObject);
-use IO::Uncompress::Base 2.020 ;
+use IO::Uncompress::Base 2.021 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.020';
+$VERSION = '2.021';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.020 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.020 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.020 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.020 ;';
- #eval ' use IO::Uncompress::Adapter::UnLzma 2.018 ;';
-
- eval ' use IO::Uncompress::Bunzip2 2.020 ;';
- eval ' use IO::Uncompress::UnLzop 2.020 ;';
- eval ' use IO::Uncompress::Gunzip 2.020 ;';
- eval ' use IO::Uncompress::Inflate 2.020 ;';
- eval ' use IO::Uncompress::RawInflate 2.020 ;';
- eval ' use IO::Uncompress::Unzip 2.020 ;';
- eval ' use IO::Uncompress::UnLzf 2.020 ;';
- #eval ' use IO::Uncompress::UnLzma 2.018 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.021 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.021 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.021 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.021 ;';
+ eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;';
+ eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;';
+
+ eval ' use IO::Uncompress::Bunzip2 2.021 ;';
+ eval ' use IO::Uncompress::UnLzop 2.021 ;';
+ eval ' use IO::Uncompress::Gunzip 2.021 ;';
+ eval ' use IO::Uncompress::Inflate 2.021 ;';
+ eval ' use IO::Uncompress::RawInflate 2.021 ;';
+ eval ' use IO::Uncompress::Unzip 2.021 ;';
+ eval ' use IO::Uncompress::UnLzf 2.021 ;';
+ eval ' use IO::Uncompress::UnLzma 2.018 ;';
+ eval ' use IO::Uncompress::UnXz 2.018 ;';
}
sub new
sub getExtraParams
{
- use IO::Compress::Base::Common 2.020 qw(:Parse);
+ use IO::Compress::Base::Common 2.021 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
# }
# }
+ if (defined $IO::Uncompress::UnXz::VERSION and
+ $magic = $self->ckMagic('UnXz')) {
+ *$self->{Info} = $self->readHeader($magic)
+ or return undef ;
+
+ my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnXz::mkUncompObject();
+
+ return $self->saveErrorString(undef, $errstr, $errno)
+ if ! defined $obj;
+
+ *$self->{Uncomp} = $obj;
+
+ return 1;
+ }
+
if (defined $IO::Uncompress::Bunzip2::VERSION and
$magic = $self->ckMagic('Bunzip2')) {
*$self->{Info} = $self->readHeader($magic)
=head2 Examples
To read the contents of the file C<file1.txt.Compressed> and write the
-compressed data to the file C<file1.txt>.
+uncompressed data to the file C<file1.txt>.
use strict ;
use warnings ;
@ISA = qw(Exporter IO::File);
-$VERSION = '2.020';
+$VERSION = '2.021';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.020 ;
+use IO::Compress::Base::Common 2.021 ;
#use Parse::Parameters ;
use IO::File ;
# because the filehandle may not support the offset parameter
# An example is Net::FTP
my $tmp = '';
- *$self->{FH}->read($tmp, $get_size) > 0 &&
+ *$self->{FH}->read($tmp, $get_size) &&
(substr($$out, $offset) = $tmp);
}
else
}
# short circuit if seeking to current offset
- return 1 if $target == $here ;
+ if ($target == $here) {
+ # On ordinary filehandles, seeking to the current
+ # position also clears the EOF condition, so we
+ # emulate this behavior locally while simultaneously
+ # cascading it to the underlying filehandle
+ if (*$self->{Plain}) {
+ *$self->{EndStream} = 0;
+ seek(*$self->{FH},0,1) if *$self->{FH};
+ }
+ return 1;
+ }
# Outlaw any attempt to seek backwards
$self->croakError( *$self->{ClassName} ."::seek: cannot seek backwards")
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status createSelfTiedObject);
+use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.020 ;
-use IO::Uncompress::Adapter::Bunzip2 2.020 ;
+use IO::Uncompress::Base 2.021 ;
+use IO::Uncompress::Adapter::Bunzip2 2.021 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
-$VERSION = '2.020';
+$VERSION = '2.021';
$Bunzip2Error = '';
@ISA = qw( Exporter IO::Uncompress::Base );
{
my $self = shift ;
- use IO::Compress::Base::Common 2.020 qw(:Parse);
+ use IO::Compress::Base::Common 2.021 qw(:Parse);
return (
'Verbosity' => [1, 1, Parse_boolean, 0],
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.020 ;
+use IO::Uncompress::RawInflate 2.021 ;
-use Compress::Raw::Zlib 2.020 qw( crc32 ) ;
-use IO::Compress::Base::Common 2.020 qw(:Status createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.020 ;
-use IO::Compress::Zlib::Extra 2.020 ;
+use Compress::Raw::Zlib 2.021 qw( crc32 ) ;
+use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.021 ;
+use IO::Compress::Zlib::Extra 2.021 ;
require Exporter ;
$GunzipError = '';
-$VERSION = '2.020';
+$VERSION = '2.021';
sub new
{
sub getExtraParams
{
- use IO::Compress::Base::Common 2.020 qw(:Parse);
+ use IO::Compress::Base::Common 2.021 qw(:Parse);
return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
}
=head2 Examples
To read the contents of the file C<file1.txt.gz> and write the
-compressed data to the file C<file1.txt>.
+uncompressed data to the file C<file1.txt>.
use strict ;
use warnings ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.020 qw(:Status createSelfTiedObject);
-use IO::Compress::Zlib::Constants 2.020 ;
+use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject);
+use IO::Compress::Zlib::Constants 2.021 ;
-use IO::Uncompress::RawInflate 2.020 ;
+use IO::Uncompress::RawInflate 2.021 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
-$VERSION = '2.020';
+$VERSION = '2.021';
$InflateError = '';
@ISA = qw( Exporter IO::Uncompress::RawInflate );
=head2 Examples
To read the contents of the file C<file1.txt.1950> and write the
-compressed data to the file C<file1.txt>.
+uncompressed data to the file C<file1.txt>.
use strict ;
use warnings ;
use warnings;
use bytes;
-use Compress::Raw::Zlib 2.020 ;
-use IO::Compress::Base::Common 2.020 qw(:Status createSelfTiedObject);
+use Compress::Raw::Zlib 2.021 ;
+use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.020 ;
-use IO::Uncompress::Adapter::Inflate 2.020 ;
+use IO::Uncompress::Base 2.021 ;
+use IO::Uncompress::Adapter::Inflate 2.021 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
-$VERSION = '2.020';
+$VERSION = '2.021';
$RawInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
=head2 Examples
To read the contents of the file C<file1.txt.1951> and write the
-compressed data to the file C<file1.txt>.
+uncompressed data to the file C<file1.txt>.
use strict ;
use warnings ;
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.020 ;
-use IO::Compress::Base::Common 2.020 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.020 ;
-use IO::Uncompress::Adapter::Identity 2.020 ;
-use IO::Compress::Zlib::Extra 2.020 ;
-use IO::Compress::Zip::Constants 2.020 ;
+use IO::Uncompress::RawInflate 2.021 ;
+use IO::Compress::Base::Common 2.021 qw(:Status createSelfTiedObject);
+use IO::Uncompress::Adapter::Inflate 2.021 ;
+use IO::Uncompress::Adapter::Identity 2.021 ;
+use IO::Compress::Zlib::Extra 2.021 ;
+use IO::Compress::Zip::Constants 2.021 ;
-use Compress::Raw::Zlib 2.020 qw(crc32) ;
+use Compress::Raw::Zlib 2.021 qw(crc32) ;
BEGIN
{
eval { require IO::Uncompress::Adapter::Bunzip2 ;
import IO::Uncompress::Adapter::Bunzip2 } ;
- #eval { require IO::Uncompress::Adapter::UnLzma ;
- # import IO::Uncompress::Adapter::UnLzma } ;
+ eval { require IO::Uncompress::Adapter::UnLzma ;
+ import IO::Uncompress::Adapter::UnLzma } ;
}
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.020';
+$VERSION = '2.021';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
sub getExtraParams
{
- use IO::Compress::Base::Common 2.020 qw(:Parse);
+ use IO::Compress::Base::Common 2.021 qw(:Parse);
return (
# # Zip header fields
- 'Name' => [1, 1, Parse_any, undef],
+ 'Name' => [1, 1, Parse_any, undef],
-# 'Streaming' => [1, 1, Parse_boolean, 1],
+# 'Stream' => [1, 1, Parse_boolean, 1],
+ # This means reading the central directory to get
+ # 1. the local header offsets
+ # 2. The compressed data length
);
}
}
+sub fastForward
+{
+ my $self = shift;
+ my $offset = shift;
+
+ # TODO - if Stream isn't enabled & reading from file, use seek
+
+ my $buffer = '';
+ my $c = 1024 * 16;
+
+ while ($offset > 0)
+ {
+ $c = length $offset
+ if length $offset < $c ;
+
+ $offset -= $c;
+
+ $self->smartReadExact(\$buffer, $c)
+ or return 0;
+ }
+
+ return 1;
+}
+
sub readHeader
{
}
# skip the data
+ # TODO - when Stream is off, use seek
my $buffer;
if (*$self->{ZipData}{Streaming}) {
or return $self->saveErrorString(undef, "Truncated file");
}
else {
- my $c = $hdr->{CompressedLength}->get32bit();
- $self->smartReadExact(\$buffer, $c)
+ my $c = $hdr->{CompressedLength}->get64bit();
+ $self->fastForward($c)
or return $self->saveErrorString(undef, "Truncated file");
$buffer = '';
}
*$self->{ZipData}{UnCompressedLen});
}
+ *$self->{Info}{CRC32} = *$self->{ZipData}{CRC32} ;
+ *$self->{Info}{CompressedLength} = $cSize->get64bit();
+ *$self->{Info}{UncompressedLength} = $uSize->get64bit();
+
if (*$self->{Strict}) {
return $self->TrailerError("CRC mismatch")
if $CRC32 != *$self->{ZipData}{CRC32} ;
my $keep = $magic . $buffer ;
my ($sizeLo, $sizeHi) = unpack ("V V", $buffer);
+ my $size = $sizeHi * 0xFFFFFFFF + $sizeLo;
- # TODO - take SizeHi into account
- $self->smartReadExact(\$buffer, $sizeLo)
+ $self->fastForward($size)
or return $self->TrailerError("Minimum header size is " .
- $sizeLo . " bytes") ;
+ $size . " bytes") ;
- $keep .= $buffer ;
- *$self->{HeaderPending} = $keep ;
+ #$keep .= $buffer ;
+ #*$self->{HeaderPending} = $keep ;
#my $versionMadeBy = unpack ("v", substr($buffer, 0, 2));
#my $extractVersion = unpack ("v", substr($buffer, 2, 2));
my $compressedMethod = unpack ("v", substr($buffer, 8-4, 2));
my $lastModTime = unpack ("V", substr($buffer, 10-4, 4));
my $crc32 = unpack ("V", substr($buffer, 14-4, 4));
- my $compressedLength = new U64 unpack ("V", substr($buffer, 18-4, 4));
- my $uncompressedLength = new U64 unpack ("V", substr($buffer, 22-4, 4));
+ my $compressedLength = U64::newUnpack_V32 substr($buffer, 18-4, 4);
+ my $uncompressedLength = U64::newUnpack_V32 substr($buffer, 22-4, 4);
my $filename_length = unpack ("v", substr($buffer, 26-4, 2));
my $extra_length = unpack ("v", substr($buffer, 28-4, 2));
my $buff = ${ $Extra{ZIP_EXTRA_ID_ZIP64()} };
- # TODO - This code assumes that all the fields in the Zip64
+ # This code assumes that all the fields in the Zip64
# extra field aren't necessarily present. The spec says that
# they only exist if the equivalent local headers are -1.
- # Need to check that info-zip fills out -1 in the local header
- # correctly.
if (! $streamingMode) {
my $offset = 0 ;
- $uncompressedLength = U64::newUnpack_V64 substr($buff, 0, 8)
- if $uncompressedLength == 0xFFFF ;
+ if ($uncompressedLength->get32bit() == 0xFFFFFFFF ) {
+ $uncompressedLength
+ = U64::newUnpack_V64 substr($buff, 0, 8);
- $offset += 8 ;
+ $offset += 8 ;
+ }
- $compressedLength = U64::newUnpack_V64 substr($buff, $offset, 8)
- if $compressedLength == 0xFFFF ;
+ if ($compressedLength->get32bit() == 0xFFFFFFFF) {
- $offset += 8 ;
+ $compressedLength
+ = U64::newUnpack_V64 substr($buff, $offset, 8);
- #my $cheaderOffset = U64::newUnpack_V64 substr($buff, 16, 8);
- #my $diskNumber = unpack ("V", substr($buff, 24, 4));
+ $offset += 8 ;
+ }
}
}
}
*$self->{ZipData}{CompressedLen} = $compressedLength;
*$self->{ZipData}{UnCompressedLen} = $uncompressedLength;
*$self->{CompressedInputLengthRemaining} =
- *$self->{CompressedInputLength} = $compressedLength->get32bit();
+ *$self->{CompressedInputLength} = $compressedLength->get64bit();
}
+ *$self->{ZipData}{CRC32} = crc32(undef);
*$self->{ZipData}{Method} = $compressedMethod;
if ($compressedMethod == ZIP_CM_DEFLATE)
{
my $obj = IO::Uncompress::Adapter::Inflate::mkUncompObject(1,0,0);
*$self->{Uncomp} = $obj;
- *$self->{ZipData}{CRC32} = crc32(undef);
}
elsif ($compressedMethod == ZIP_CM_BZIP2)
{
my $obj = IO::Uncompress::Adapter::Bunzip2::mkUncompObject();
*$self->{Uncomp} = $obj;
- *$self->{ZipData}{CRC32} = crc32(undef);
}
-# elsif ($compressedMethod == ZIP_CM_LZMA)
-# {
-# return $self->HeaderError("Unsupported Compression format $compressedMethod")
-# if ! defined $IO::Uncompress::Adapter::UnLzma::VERSION ;
-#
-# *$self->{Type} = 'zip-lzma';
-#
-# my $obj = IO::Uncompress::Adapter::UnLzma::mkUncompObject();
-#
-# *$self->{Uncomp} = $obj;
-# *$self->{ZipData}{CRC32} = crc32(undef);
-# }
+ elsif ($compressedMethod == ZIP_CM_LZMA)
+ {
+ return $self->HeaderError("Unsupported Compression format $compressedMethod")
+ if ! defined $IO::Uncompress::Adapter::UnLzma::VERSION ;
+
+ *$self->{Type} = 'zip-lzma';
+ my $LzmaHeader;
+ $self->smartReadExact(\$LzmaHeader, 4)
+ or return $self->saveErrorString(undef, "Truncated file");
+ my ($verHi, $verLo) = unpack ("CC", substr($LzmaHeader, 0, 2));
+ my $LzmaPropertiesSize = unpack ("v", substr($LzmaHeader, 2, 2));
+
+
+ my $LzmaPropertyData;
+ $self->smartReadExact(\$LzmaPropertyData, $LzmaPropertiesSize)
+ or return $self->saveErrorString(undef, "Truncated file");
+ #my $LzmaInfo = unpack ("C", substr($LzmaPropertyData, 0, 1));
+ #my $LzmaDictSize = unpack ("V", substr($LzmaPropertyData, 1, 4));
+
+ # Create an LZMA_Alone header
+ $self->pushBack($LzmaPropertyData .
+ $uncompressedLength->getPacked_V64());
+
+ my $obj =
+ IO::Uncompress::Adapter::UnLzma::mkUncompObject();
+
+ *$self->{Uncomp} = $obj;
+ }
elsif ($compressedMethod == ZIP_CM_STORE)
{
# TODO -- add support for reading uncompressed
? "Deflated"
: $compressedMethod == ZIP_CM_BZIP2
? "Bzip2"
- : $compressedMethod == ZIP_CM_STORE
- ? "Stored"
- : "Unknown" ,
+ : $compressedMethod == ZIP_CM_LZMA
+ ? "Lzma"
+ : $compressedMethod == ZIP_CM_STORE
+ ? "Stored"
+ : "Unknown" ,
# 'TextFlag' => $flag & GZIP_FLG_FTEXT ? 1 : 0,
# 'HeaderCRCFlag' => $flag & GZIP_FLG_FHCRC ? 1 : 0,
{
my $self = shift ;
- if (*$self->{ZipData}{Method} == 12) {
- *$self->{ZipData}{CRC32} = crc32(${$_[0]}, *$self->{ZipData}{CRC32});
+ if (*$self->{ZipData}{Method} == ZIP_CM_DEFLATE) {
+ *$self->{ZipData}{CRC32} = *$self->{Uncomp}->crc32() ;
}
else {
- *$self->{ZipData}{CRC32} = *$self->{Uncomp}->crc32() ;
+ *$self->{ZipData}{CRC32} = crc32(${$_[0]}, *$self->{ZipData}{CRC32});
}
}
=head2 Examples
To read the contents of the file C<file1.txt.zip> and write the
-compressed data to the file C<file1.txt>.
+uncompressed data to the file C<file1.txt>.
use strict ;
use warnings ;
MyTrebleCheck:
@echo Checking for $$^W in files: '. "@files" . '
- @perl -ne \' \
- exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \
- \' ' . " @files || " . ' \
+ perl -ne \' \
+ exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \' \
+ ' . " @files || " . ' \
(echo found unexpected $$^W ; exit 1)
@echo All is ok.
use Test::More ;
+sub gotScalarUtilXS
+{
+ eval ' use Scalar::Util "dualvar" ';
+ return $@ ? 0 : 1 ;
+}
+
BEGIN
{
# use Test::NoWarnings, if available
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- my $VERSION = '2.020';
+ my $VERSION = '2.021';
my @NAMES = qw(
Compress::Raw::Bzip2
Compress::Raw::Zlib
+
+ Compress::Zlib
+
+ IO::Compress::Adapter::Bzip2
+ IO::Compress::Adapter::Deflate
+ IO::Compress::Adapter::Identity
+ IO::Compress::Base::Common
+ IO::Compress::Base
+ IO::Compress::Bzip2
+ IO::Compress::Deflate
+ IO::Compress::Gzip::Constants
+ IO::Compress::Gzip
+ IO::Compress::RawDeflate
+ IO::Compress::Zip::Constants
+ IO::Compress::Zip
+ IO::Compress::Zlib::Constants
+ IO::Compress::Zlib::Extra
+ IO::Uncompress::Adapter::Bunzip2
+ IO::Uncompress::Adapter::Identity
+ IO::Uncompress::Adapter::Inflate
+ IO::Uncompress::AnyInflate
+ IO::Uncompress::AnyUncompress
+ IO::Uncompress::Base
+ IO::Uncompress::Bunzip2
+ IO::Uncompress::Gunzip
+ IO::Uncompress::Inflate
+ IO::Uncompress::RawInflate
+ IO::Uncompress::Unzip
+
);
my @OPT = qw(
);
- plan tests => @NAMES + @OPT + $extra ;
+ plan tests => 2 + @NAMES + @OPT + $extra ;
foreach my $name (@NAMES)
{
or diag "$name version is $ver, need $VERSION" ;
}
}
-
+
+ use_ok('Scalar::Util') ;
+
}
+ok gotScalarUtilXS(), "Got XS Version of Scalar::Util"
+ or diag <<EOM;
+You don't have the XS version of Scalar::Util
+EOM
+
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;
+ 1 while ($status = $u->read($buff)) ;
push @content, $buff;
last unless $status == 0;
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 88 + $extra ;
+ plan tests => 118 + $extra ;
use_ok('Scalar::Util');
use_ok('IO::Compress::Base::Common');
my $x = new U64();
is $x->getHigh, 0, " getHigh is 0";
is $x->getLow, 0, " getLow is 0";
+ ok ! $x->is64bit(), " ! is64bit";
$x = new U64(1,2);
- $x = new U64(1,2);
is $x->getHigh, 1, " getHigh is 1";
is $x->getLow, 2, " getLow is 2";
+ ok $x->is64bit(), " is64bit";
$x = new U64(0xFFFFFFFF,2);
is $x->getHigh, 0xFFFFFFFF, " getHigh is 0xFFFFFFFF";
is $x->getLow, 2, " getLow is 2";
+ ok $x->is64bit(), " is64bit";
$x = new U64(7, 0xFFFFFFFF);
is $x->getHigh, 7, " getHigh is 7";
is $x->getLow, 0xFFFFFFFF, " getLow is 0xFFFFFFFF";
+ ok $x->is64bit(), " is64bit";
$x = new U64(666);
is $x->getHigh, 0, " getHigh is 0";
is $x->getLow, 666, " getLow is 666";
+ ok ! $x->is64bit(), " ! is64bit";
title "U64 - add" ;
$x = new U64(0, 1);
is $x->getHigh, 0, " getHigh is 0";
is $x->getLow, 1, " getLow is 1";
+ ok ! $x->is64bit(), " ! is64bit";
$x->add(1);
is $x->getHigh, 0, " getHigh is 0";
is $x->getLow, 2, " getLow is 2";
+ ok ! $x->is64bit(), " ! is64bit";
$x = new U64(0, 0xFFFFFFFE);
is $x->getHigh, 0, " getHigh is 0";
is $x->getLow, 0xFFFFFFFE, " getLow is 0xFFFFFFFE";
+ is $x->get32bit(), 0xFFFFFFFE, " get32bit is 0xFFFFFFFE";
+ is $x->get64bit(), 0xFFFFFFFE, " get64bit is 0xFFFFFFFE";
+ ok ! $x->is64bit(), " ! is64bit";
$x->add(1);
is $x->getHigh, 0, " getHigh is 0";
is $x->getLow, 0xFFFFFFFF, " getLow is 0xFFFFFFFF";
+ is $x->get32bit(), 0xFFFFFFFF, " get32bit is 0xFFFFFFFF";
+ is $x->get64bit(), 0xFFFFFFFF, " get64bit is 0xFFFFFFFF";
+ ok ! $x->is64bit(), " ! is64bit";
$x->add(1);
is $x->getHigh, 1, " getHigh is 1";
is $x->getLow, 0, " getLow is 0";
+ is $x->get32bit(), 0x0, " get32bit is 0x0";
+ is $x->get64bit(), 0xFFFFFFFF+1, " get64bit is 0x100000000";
+ ok $x->is64bit(), " is64bit";
$x->add(1);
is $x->getHigh, 1, " getHigh is 1";
is $x->getLow, 1, " getLow is 1";
+ is $x->get32bit(), 0x1, " get32bit is 0x1";
+ is $x->get64bit(), 0xFFFFFFFF+2, " get64bit is 0x100000001";
+ ok $x->is64bit(), " is64bit";
+
+ $x->add(1);
+ is $x->getHigh, 1, " getHigh is 1";
+ is $x->getLow, 2, " getLow is 1";
+ is $x->get32bit(), 0x2, " get32bit is 0x2";
+ is $x->get64bit(), 0xFFFFFFFF+3, " get64bit is 0x100000002";
+ ok $x->is64bit(), " is64bit";
$x = new U64(1, 0xFFFFFFFE);
my $y = new U64(2, 3);
$x->add($y);
is $x->getHigh, 4, " getHigh is 4";
is $x->getLow, 1, " getLow is 1";
+ ok $x->is64bit(), " is64bit";
title "U64 - equal" ;
$x = new U64(0, 1);
is $x->getHigh, 0, " getHigh is 0";
is $x->getLow, 1, " getLow is 1";
+ ok ! $x->is64bit(), " ! is64bit";
$y = new U64(0, 1);
- is $x->getHigh, 0, " getHigh is 0";
- is $x->getLow, 1, " getLow is 1";
+ is $y->getHigh, 0, " getHigh is 0";
+ is $y->getLow, 1, " getLow is 1";
+ ok ! $y->is64bit(), " ! is64bit";
my $z = new U64(0, 2);
- is $x->getHigh, 0, " getHigh is 0";
- is $x->getLow, 1, " getLow is 1";
+ is $z->getHigh, 0, " getHigh is 0";
+ is $z->getLow, 2, " getLow is 2";
+ ok ! $z->is64bit(), " ! is64bit";
ok $x->equal($y), " equal";
ok !$x->equal($z), " ! equal";
- title "U64 - pack_V" ;
+ title "U64 - clone" ;
+ $x = new U64(21, 77);
+ $z = U64::clone($x);
+ is $z->getHigh, 21, " getHigh is 21";
+ is $z->getLow, 77, " getLow is 77";
}
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 120 + $extra ;
+ plan tests => 144 + $extra ;
#use_ok('IO::Compress::Zip', qw(zip $ZipError :zip_method)) ;
use_ok('IO::Compress::Zip', qw(:all)) ;
{
for my $zip64 (0, 1)
{
- next if $zip64 && ! $stream;
+ #next if $zip64 && ! $stream;
for my $method (ZIP_CM_STORE, ZIP_CM_DEFLATE, ZIP_CM_BZIP2)
{
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 146 + $extra ;
+ plan tests => 162 + $extra ;
#use_ok('IO::Compress::Zip', qw(zip $ZipError :zip_method)) ;
use_ok('IO::Compress::Zip', qw(:all)) ;
{
for my $zip64 (0, 1)
{
- next if $zip64 && ! $stream;
+ #next if $zip64 && ! $stream;
for my $method (ZIP_CM_STORE, ZIP_CM_DEFLATE)
{
return readFile($filename) eq unpack("u", $uue) ;
}
-sub isRawFormat
+#sub isRawFormat
+#{
+# my $class = shift;
+# # TODO -- add Lzma here?
+# my %raw = map { $_ => 1 } qw( RawDeflate );
+#
+# return defined $raw{$class};
+#}
+
+
+
+my %TOP = (
+ 'IO::Uncompress::AnyInflate' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'AnyInflateError',
+ TopLevel => 'anyinflate',
+ Raw => 0,
+ },
+
+ 'IO::Uncompress::AnyUncompress' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'AnyUncompressError',
+ TopLevel => 'anyuncompress',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Gzip' => { Inverse => 'IO::Uncompress::Gunzip',
+ Error => 'GzipError',
+ TopLevel => 'gzip',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Gunzip' => { Inverse => 'IO::Compress::Gzip',
+ Error => 'GunzipError',
+ TopLevel => 'gunzip',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Deflate' => { Inverse => 'IO::Uncompress::Inflate',
+ Error => 'DeflateError',
+ TopLevel => 'deflate',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Inflate' => { Inverse => 'IO::Compress::Deflate',
+ Error => 'InflateError',
+ TopLevel => 'inflate',
+ Raw => 0,
+ },
+
+ 'IO::Compress::RawDeflate' => { Inverse => 'IO::Uncompress::RawInflate',
+ Error => 'RawDeflateError',
+ TopLevel => 'rawdeflate',
+ Raw => 1,
+ },
+ 'IO::Uncompress::RawInflate' => { Inverse => 'IO::Compress::RawDeflate',
+ Error => 'RawInflateError',
+ TopLevel => 'rawinflate',
+ Raw => 1,
+ },
+
+ 'IO::Compress::Zip' => { Inverse => 'IO::Uncompress::Unzip',
+ Error => 'ZipError',
+ TopLevel => 'zip',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Unzip' => { Inverse => 'IO::Compress::Zip',
+ Error => 'UnzipError',
+ TopLevel => 'unzip',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Bzip2' => { Inverse => 'IO::Uncompress::Bunzip2',
+ Error => 'Bzip2Error',
+ TopLevel => 'bzip2',
+ Raw => 0,
+ },
+ 'IO::Uncompress::Bunzip2' => { Inverse => 'IO::Compress::Bzip2',
+ Error => 'Bunzip2Error',
+ TopLevel => 'bunzip2',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzop' => { Inverse => 'IO::Uncompress::UnLzop',
+ Error => 'LzopError',
+ TopLevel => 'lzop',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnLzop' => { Inverse => 'IO::Compress::Lzop',
+ Error => 'UnLzopError',
+ TopLevel => 'unlzop',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzf' => { Inverse => 'IO::Uncompress::UnLzf',
+ Error => 'LzfError',
+ TopLevel => 'lzf',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnLzf' => { Inverse => 'IO::Compress::Lzf',
+ Error => 'UnLzfError',
+ TopLevel => 'unlzf',
+ Raw => 0,
+ },
+
+ 'IO::Compress::Lzma' => { Inverse => 'IO::Uncompress::UnLzma',
+ Error => 'LzmaError',
+ TopLevel => 'lzma',
+ Raw => 1,
+ },
+ 'IO::Uncompress::UnLzma' => { Inverse => 'IO::Compress::Lzma',
+ Error => 'UnLzmaError',
+ TopLevel => 'unlzma',
+ Raw => 1,
+ },
+
+ 'IO::Compress::Xz' => { Inverse => 'IO::Uncompress::UnXz',
+ Error => 'XzError',
+ TopLevel => 'xz',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnXz' => { Inverse => 'IO::Compress::Xz',
+ Error => 'UnXzError',
+ TopLevel => 'unxz',
+ Raw => 0,
+ },
+
+ 'IO::Compress::PPMd' => { Inverse => 'IO::Uncompress::UnPPMd',
+ Error => 'PPMdError',
+ TopLevel => 'ppmd',
+ Raw => 0,
+ },
+ 'IO::Uncompress::UnPPMd' => { Inverse => 'IO::Compress::PPMd',
+ Error => 'UnPPMdError',
+ TopLevel => 'unppmd',
+ Raw => 0,
+ },
+
+ 'IO::Compress::DummyComp' => { Inverse => 'IO::Uncompress::DummyUnComp',
+ Error => 'DummyCompError',
+ TopLevel => 'dummycomp',
+ Raw => 0,
+ },
+ 'IO::Uncompress::DummyUnComp' => { Inverse => 'IO::Compress::DummyComp',
+ Error => 'DummyUnCompError',
+ TopLevel => 'dummyunComp',
+ Raw => 0,
+ },
+);
+
+
+for my $key (keys %TOP)
{
- my $class = shift;
- my %raw = map { $_ => 1 } qw( RawDeflate );
+ no strict;
+ no warnings;
+ $TOP{$key}{Error} = \${ $key . '::' . $TOP{$key}{Error} };
+ $TOP{$key}{TopLevel} = $key . '::' . $TOP{$key}{TopLevel} ;
- return defined $raw{$class};
+ # Silence used once warning in really old perl
+ my $dummy = \${ $key . '::' . $TOP{$key}{Error} };
+
+ #$TOP{$key . "::" . $TOP{$key}{TopLevel} } = $TOP{$key};
}
sub uncompressBuffer
my $compWith = shift ;
my $buffer = shift ;
- my %mapping = ( 'IO::Compress::Gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Gzip::gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::Deflate::deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::RawDeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::RawDeflate::rawdeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::Bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Bzip2::bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Zip::zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzop::lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzf' => 'IO::Uncompress::UnLzf' ,
- 'IO::Compress::Lzf::lzf' => 'IO::Uncompress::UnLzf',
- 'IO::Compress::PPMd' => 'IO::Uncompress::UnPPMd' ,
- 'IO::Compress::PPMd::ppmd' => 'IO::Uncompress::UnPPMd',
- 'IO::Compress::DummyComp' => 'IO::Uncompress::DummyUncomp',
- 'IO::Compress::DummyComp::dummycomp' => 'IO::Uncompress::DummyUncomp',
- );
my $out ;
- my $obj = $mapping{$compWith}->new( \$buffer, -Append => 1);
+ my $obj = $TOP{$compWith}{Inverse}->new( \$buffer, -Append => 1);
1 while $obj->read($out) > 0 ;
return $out ;
}
-my %ErrorMap = ( 'IO::Compress::Gzip' => \$IO::Compress::Gzip::GzipError,
- 'IO::Compress::Gzip::gzip' => \$IO::Compress::Gzip::GzipError,
- 'IO::Uncompress::Gunzip' => \$IO::Uncompress::Gunzip::GunzipError,
- 'IO::Uncompress::Gunzip::gunzip' => \$IO::Uncompress::Gunzip::GunzipError,
- 'IO::Uncompress::Inflate' => \$IO::Uncompress::Inflate::InflateError,
- 'IO::Uncompress::Inflate::inflate' => \$IO::Uncompress::Inflate::InflateError,
- 'IO::Compress::Deflate' => \$IO::Compress::Deflate::DeflateError,
- 'IO::Compress::Deflate::deflate' => \$IO::Compress::Deflate::DeflateError,
- 'IO::Uncompress::RawInflate' => \$IO::Uncompress::RawInflate::RawInflateError,
- 'IO::Uncompress::RawInflate::rawinflate' => \$IO::Uncompress::RawInflate::RawInflateError,
- 'IO::Uncompress::AnyInflate' => \$IO::Uncompress::AnyInflate::AnyInflateError,
- 'IO::Uncompress::AnyInflate::anyinflate' => \$IO::Uncompress::AnyInflate::AnyInflateError,
- 'IO::Uncompress::AnyUncompress' => \$IO::Uncompress::AnyUncompress::AnyUncompressError,
- 'IO::Uncompress::AnyUncompress::anyUncompress' => \$IO::Uncompress::AnyUncompress::AnyUncompressError,
- 'IO::Compress::RawDeflate' => \$IO::Compress::RawDeflate::RawDeflateError,
- 'IO::Compress::RawDeflate::rawdeflate' => \$IO::Compress::RawDeflate::RawDeflateError,
- 'IO::Compress::Bzip2' => \$IO::Compress::Bzip2::Bzip2Error,
- 'IO::Compress::Bzip2::bzip2' => \$IO::Compress::Bzip2::Bzip2Error,
- 'IO::Uncompress::Bunzip2' => \$IO::Uncompress::Bunzip2::Bunzip2Error,
- 'IO::Uncompress::Bunzip2::bunzip2' => \$IO::Uncompress::Bunzip2::Bunzip2Error,
- 'IO::Compress::Zip' => \$IO::Compress::Zip::ZipError,
- 'IO::Compress::Zip::zip' => \$IO::Compress::Zip::ZipError,
- 'IO::Uncompress::Unzip' => \$IO::Uncompress::Unzip::UnzipError,
- 'IO::Uncompress::Unzip::unzip' => \$IO::Uncompress::Unzip::UnzipError,
- 'IO::Compress::Lzop' => \$IO::Compress::Lzop::LzopError,
- 'IO::Compress::Lzop::lzop' => \$IO::Compress::Lzop::LzopError,
- 'IO::Uncompress::UnLzop' => \$IO::Uncompress::UnLzop::UnLzopError,
- 'IO::Uncompress::UnLzop::unlzop' => \$IO::Uncompress::UnLzop::UnLzopError,
- 'IO::Compress::Lzf' => \$IO::Compress::Lzf::LzfError,
- 'IO::Compress::Lzf::lzf' => \$IO::Compress::Lzf::LzfError,
- 'IO::Uncompress::UnLzf' => \$IO::Uncompress::UnLzf::UnLzfError,
- 'IO::Uncompress::UnLzf::unlzf' => \$IO::Uncompress::UnLzf::UnLzfError,
- 'IO::Compress::PPMd' => \$IO::Compress::PPMd::PPMdError,
- 'IO::Compress::PPMd::ppmd' => \$IO::Compress::PPMd::PPMdError,
- 'IO::Uncompress::UnPPMd' => \$IO::Uncompress::UnPPMd::UnPPMdError,
- 'IO::Uncompress::UnPPMd::unppmd' => \$IO::Uncompress::UnPPMd::UnPPMdError,
-
- 'IO::Compress::DummyComp' => \$IO::Compress::DummyComp::DummyCompError,
- 'IO::Compress::DummyComp::dummycomp'=> \$IO::Compress::DummyComp::DummyCompError,
- 'IO::Uncompress::DummyUncomp' => \$IO::Uncompress::DummyUncomp::DummyUncompError,
- 'IO::Uncompress::DummyUncomp::dummyuncomp' => \$IO::Uncompress::DummyUncomp::DummyUncompError,
- );
-
-my %TopFuncMap = ( 'IO::Compress::Gzip' => 'IO::Compress::Gzip::gzip',
- 'IO::Uncompress::Gunzip' => 'IO::Uncompress::Gunzip::gunzip',
-
- 'IO::Compress::Deflate' => 'IO::Compress::Deflate::deflate',
- 'IO::Uncompress::Inflate' => 'IO::Uncompress::Inflate::inflate',
-
- 'IO::Compress::RawDeflate' => 'IO::Compress::RawDeflate::rawdeflate',
- 'IO::Uncompress::RawInflate' => 'IO::Uncompress::RawInflate::rawinflate',
-
- 'IO::Uncompress::AnyInflate' => 'IO::Uncompress::AnyInflate::anyinflate',
- 'IO::Uncompress::AnyUncompress' => 'IO::Uncompress::AnyUncompress::anyuncompress',
-
- 'IO::Compress::Bzip2' => 'IO::Compress::Bzip2::bzip2',
- 'IO::Uncompress::Bunzip2' => 'IO::Uncompress::Bunzip2::bunzip2',
-
- 'IO::Compress::Zip' => 'IO::Compress::Zip::zip',
- 'IO::Uncompress::Unzip' => 'IO::Uncompress::Unzip::unzip',
- 'IO::Compress::Lzop' => 'IO::Compress::Lzop::lzop',
- 'IO::Uncompress::UnLzop' => 'IO::Uncompress::UnLzop::unlzop',
- 'IO::Compress::Lzf' => 'IO::Compress::Lzf::lzf',
- 'IO::Uncompress::UnLzf' => 'IO::Uncompress::UnLzf::unlzf',
- 'IO::Compress::PPMd' => 'IO::Compress::PPMd::ppmd',
- 'IO::Uncompress::UnPPMd' => 'IO::Uncompress::UnPPMd::unppmd',
- 'IO::Compress::DummyComp' => 'IO::Compress::DummyComp::dummyuncomp',
- 'IO::Uncompress::DummyUncomp' => 'IO::Uncompress::DummyUncomp::dummyuncomp',
- );
-
- %TopFuncMap = map { ($_ => $TopFuncMap{$_},
- $TopFuncMap{$_} => $TopFuncMap{$_}) }
- keys %TopFuncMap ;
-
- #%TopFuncMap = map { ($_ => \&{ $TopFuncMap{$_} ) }
- #keys %TopFuncMap ;
-
-
-my %inverse = ( 'IO::Compress::Gzip' => 'IO::Uncompress::Gunzip',
- 'IO::Compress::Gzip::gzip' => 'IO::Uncompress::Gunzip::gunzip',
- 'IO::Compress::Deflate' => 'IO::Uncompress::Inflate',
- 'IO::Compress::Deflate::deflate' => 'IO::Uncompress::Inflate::inflate',
- 'IO::Compress::RawDeflate' => 'IO::Uncompress::RawInflate',
- 'IO::Compress::RawDeflate::rawdeflate' => 'IO::Uncompress::RawInflate::rawinflate',
- 'IO::Compress::Bzip2::bzip2' => 'IO::Uncompress::Bunzip2::bunzip2',
- 'IO::Compress::Bzip2' => 'IO::Uncompress::Bunzip2',
- 'IO::Compress::Zip::zip' => 'IO::Uncompress::Unzip::unzip',
- 'IO::Compress::Zip' => 'IO::Uncompress::Unzip',
- 'IO::Compress::Lzop::lzop' => 'IO::Uncompress::UnLzop::unlzop',
- 'IO::Compress::Lzop' => 'IO::Uncompress::UnLzop',
- 'IO::Compress::Lzf::lzf' => 'IO::Uncompress::UnLzf::unlzf',
- 'IO::Compress::Lzf' => 'IO::Uncompress::UnLzf',
- 'IO::Compress::PPMd::ppmd' => 'IO::Uncompress::UnPPMd::unppmd',
- 'IO::Compress::PPMd' => 'IO::Uncompress::UnPPMd',
- 'IO::Compress::DummyComp::dummycomp' => 'IO::Uncompress::DummyUncomp::dummyuncomp',
- 'IO::Compress::DummyComp' => 'IO::Uncompress::DummyUncomp',
- );
-
-%inverse = map { ($_ => $inverse{$_}, $inverse{$_} => $_) } keys %inverse;
sub getInverse
{
my $class = shift ;
- return $inverse{$class} ;
+ return $TOP{$class}{Inverse};
}
sub getErrorRef
{
my $class = shift ;
- return $ErrorMap{$class} ;
+ return $TOP{$class}{Error};
}
sub getTopFuncRef
{
my $class = shift ;
- return \&{ $TopFuncMap{$class} } ;
+ die "Cannot find $class"
+ if ! defined $TOP{$class}{TopLevel};
+ return \&{ $TOP{$class}{TopLevel} } ;
}
sub getTopFuncName
{
my $class = shift ;
- return $TopFuncMap{$class} ;
+ return $TOP{$class}{TopLevel} ;
}
sub compressBuffer
my $compWith = shift ;
my $buffer = shift ;
- my %mapping = ( 'IO::Uncompress::Gunzip' => 'IO::Compress::Gzip',
- 'IO::Uncompress::Gunzip::gunzip' => 'IO::Compress::Gzip',
- 'IO::Uncompress::Inflate' => 'IO::Compress::Deflate',
- 'IO::Uncompress::Inflate::inflate' => 'IO::Compress::Deflate',
- 'IO::Uncompress::RawInflate' => 'IO::Compress::RawDeflate',
- 'IO::Uncompress::RawInflate::rawinflate' => 'IO::Compress::RawDeflate',
- 'IO::Uncompress::Bunzip2' => 'IO::Compress::Bzip2',
- 'IO::Uncompress::Bunzip2::bunzip2' => 'IO::Compress::Bzip2',
- 'IO::Uncompress::Unzip' => 'IO::Compress::Zip',
- 'IO::Uncompress::Unzip::unzip' => 'IO::Compress::Zip',
- 'IO::Uncompress::UnLzop' => 'IO::Compress::Lzop',
- 'IO::Uncompress::UnLzop::unlzop' => 'IO::Compress::Lzop',
- 'IO::Uncompress::UnLzp' => 'IO::Compress::Lzf',
- 'IO::Uncompress::UnLzf::unlzf' => 'IO::Compress::Lzf',
- 'IO::Uncompress::UnPPMd' => 'IO::Compress::PPMd',
- 'IO::Uncompress::UnPPMd::unppmd' => 'IO::Compress::PPMd',
- 'IO::Uncompress::AnyInflate' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyInflate::anyinflate' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyUncompress' => 'IO::Compress::Gzip',
- 'IO::Uncompress::AnyUncompress::anyuncompress' => 'IO::Compress::Gzip',
- 'IO::Uncompress::DummyUncomp' => 'IO::Compress::DummyComp',
- 'IO::Uncompress::DummyUncomp::dummyuncomp'=> 'IO::Compress::DummyComp',
- );
my $out ;
- my $obj = $mapping{$compWith}->new( \$out);
+ die "Cannot find $compWith"
+ if ! defined $TOP{$compWith}{Inverse};
+ my $obj = $TOP{$compWith}{Inverse}->new( \$out);
$obj->write($buffer) ;
$obj->close();
return $out ;
$file = quotemeta($file);
- return "/$string\\s+at $file line $line/" if $] >= 5.006 ;
+ #return "/$string\\s+at $file line $line/" if $] >= 5.006 ;
return "/$string\\s+at /" ;
}
{
my $string = shift ;
- return "/$string\\s+at \\(eval /" if $] > 5.006 ;
+ #return "/$string\\s+at \\(eval /" if $] > 5.006 ;
return "/$string\\s+at /" ;
}
eval { $a = $Func->(\$in, \$out, TrailingData => \@x) ;} ;
like $@, mkErr("^$TopType: Parameter 'TrailingData' not a scalar reference"),
- ' TrailingData output not scaral reference';
+ ' TrailingData output not scalar reference';
}
}
my $buffer2 = "ABCDE" ;
my $keep_orig = $buffer;
- my $comp = compressBuffer(getTopFuncName($UncompressClass), $buffer) ;
- my $comp2 = compressBuffer(getTopFuncName($UncompressClass), $buffer2) ;
+ my $comp = compressBuffer($UncompressClass, $buffer) ;
+ my $comp2 = compressBuffer($UncompressClass, $buffer2) ;
my $keep_comp = $comp;
my $incumbent = "incumbent data" ;
my $buffer = "abcde" ;
my $keep_orig = $buffer;
- my $null = compressBuffer(getTopFuncName($UncompressClass), "") ;
- my $undef = compressBuffer(getTopFuncName($UncompressClass), undef) ;
- my $comp = compressBuffer(getTopFuncName($UncompressClass), $buffer) ;
+ my $null = compressBuffer($UncompressClass, "") ;
+ my $undef = compressBuffer($UncompressClass, undef) ;
+ my $comp = compressBuffer($UncompressClass, $buffer) ;
my $keep_comp = $comp;
my @opts = ();
my $lex = new LexFile(my $file1, my $file2) ;
- writeFile($file1, compressBuffer(getTopFuncName($UncompressClass),"data1"));
- writeFile($file2, compressBuffer(getTopFuncName($UncompressClass),"data2"));
+ writeFile($file1, compressBuffer($UncompressClass,"data1"));
+ writeFile($file2, compressBuffer($UncompressClass,"data2"));
my $of = new IO::File "<$file1" ;
ok $of, " Created output filehandle" ;
#ok ! -d $tmpDir2, " Temp Directory $tmpDir2 does not exist";
my @files = map { "$tmpDir1/$_.tmp" } qw( a1 a2 a3) ;
- foreach (@files) { writeFile($_, compressBuffer(getTopFuncName($UncompressClass), "abc $_")) }
+ foreach (@files) { writeFile($_, compressBuffer($UncompressClass, "abc $_")) }
my @expected = map { "abc $_" } @files ;
my @outFiles = map { s/$tmpDir1/$tmpDir2/; $_ } @files ;