'IO-Compress' =>
{
'MAINTAINER' => 'pmqs',
- 'DISTRIBUTION' => 'PMQS/IO-Compress-2.030.tar.gz',
+ 'DISTRIBUTION' => 'PMQS/IO-Compress-2.033.tar.gz',
'FILES' => q[cpan/IO-Compress],
'EXCLUDED' => [ qr{t/Test/} ],
'UPSTREAM' => 'cpan',
CHANGES
-------
+ 2.033 11 Jan 2011
+ * Fixed typos & spelling errors.
+ [perl# 81816]
+
+ 2.032 4 Jan 2011
+
+ * IO::Uncompress::Base
+ - An input file that had a valid header, and so would allow
+ creation of the uncompression object, but was then followed by
+ corrupt data would trigger an infinite loop when using the
+ input line oprator.
+ [RT #61915]
+
+ * IO::Compress::Gzip
+ - XFL default settings for max compression & fastest algorithm were
+ the wrong way around. Thanks to Andrey Zholos for spotting this.
+
+ * IO::Compress::Base::Common
+ - Fixed precedence problem in parameter parsing code.
+
2.030 22 July 2010
* IO::Compress::Zip
Reworked the "Name" option and examples in the pod.
* IO::Uncompress::Base
- Fixed problem with nextStream not returning 0 when there is no
+ Fixed problem with nextStream not returning 0 when there is no
next stream and Transparent is false.
2.027 24 April 2010
2.018 3 May 2009
- * IO::Unompress::Bunzip2
+ * IO::Uncompress::Bunzip2
- The interface to Compress-Raw-Bzip2 now uses the new LimitOutput
feature. This will make all of the bzip2-related IO-Compress modules
less greedy in their memory consumption.
FNAME & FCOMMENT fields for EBCDIC.
* Compress::Zlib
- lib/Compress/Zlib.pm -- 1.x Backward Compatability issues
+ lib/Compress/Zlib.pm -- 1.x Backward Compatibility issues
gzclose - documented return value was wrong, should be 0 for ok.
gzflush - return value didn't match 1.x, should return 0 if ok.
[rt.cpan.org #29215] and Debian bug #440943 http://bugs.debian.org/440943
* Add an explicit use_ok test for Scalar::Util in the test harness.
The error message reported by 01misc implied the problem was
somewhere else.
- Also explictly check that 'dualvar' is available.
+ Also explicitly check that 'dualvar' is available.
* Compress::Zlib
- Fix append mode with gzopen.
Thanks to Andreas J. Koenig for spotting the problem.
* IO::Uncompress::AnyUncompress
- Added IO::Uncompress::Lzf to the list of supported uncompresors.
+ Added IO::Uncompress::Lzf to the list of supported uncompressors.
* IO::Uncompress::Base
Added TrailingData to one-shot interface.
* IO::Uncompress::UnZip
Tighten up the zip64 extra field processing to cope with the case
- wheere only some of the local header fields are superceeded.
+ wheere only some of the local header fields are superseded.
* IO::Uncompress::AnyInflate
Remove raw-deflate (RFC 1951) from the default list of compressors
Changed gzread so that its behaviour matches C::Z::gzread 1.x if it
is called after eof. In this case it will write an empty string
into the output parameter. This change is solely for backward
- compatability reasons.
+ compatibility reasons.
2.000_09 3 March 2006
1.31 - 29 October 2003
* Reinstated the creation of .bak files - $^I seems to need a
- backup file on Windows. For OpenVMS, the extenstion _bak is used.
+ backup file on Windows. For OpenVMS, the extension _bak is used.
1.30 - 28 October 2003
1.13 - 31st June 2001
- * Make sure config.in is consistant when released.
+ * Make sure config.in is consistent when released.
1.12 - 28th April 2001
use strict ;
require 5.004 ;
-$::VERSION = '2.030' ;
+$::VERSION = '2.033' ;
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
IO-Compress
- Version 2.030
+ Version 2.033
- 22nd July 2010
+ 11th January 2011
- Copyright (c) 1995-2010 Paul Marquess. All rights reserved.
+ Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
If you haven't installed IO-Compress then search IO::Compress::Gzip.pm
for a line like this:
- $VERSION = "2.030" ;
+ $VERSION = "2.033" ;
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.030 ;
-use Compress::Raw::Zlib 2.030 ;
-use IO::Compress::Gzip 2.030 ;
-use IO::Uncompress::Gunzip 2.030 ;
+use IO::Compress::Base::Common 2.033 ;
+use Compress::Raw::Zlib 2.033 ;
+use IO::Compress::Gzip 2.033 ;
+use IO::Uncompress::Gunzip 2.033 ;
use strict ;
use warnings ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.030';
+$VERSION = '2.033';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
package Compress::Zlib ;
-use IO::Compress::Gzip::Constants 2.030 ;
+use IO::Compress::Gzip::Constants 2.033 ;
sub memGzip($)
{
This function is used to uncompress an in-memory gzip file.
$dest = Compress::Zlib::memGunzip($buffer)
- or die "Cannot uncomprss: $gzerrno\n";
+ or die "Cannot uncompress: $gzerrno\n";
If successful, it returns the uncompressed gzip file. Otherwise it
returns C<undef> and the C<$gzerrno> variable will store the zlib error
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 1995-2010 Paul Marquess. All rights reserved.
+Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
our ($noPreBS, $metachars, $matchMetaRE, %mapping, %wildCount);
-$noPreBS = '(?<!\\\)' ; # no preceeding backslash
+$noPreBS = '(?<!\\\)' ; # no preceding backslash
$metachars = '.*?[](){}';
$matchMetaRE = '[' . quotemeta($metachars) . ']';
if $1 > $maxwild ;
}
- my $noPreBS = '(?<!\\\)' ; # no preceeding backslash
+ my $noPreBS = '(?<!\\\)' ; # no preceding backslash
#warn "noPreBS = '$noPreBS'\n";
#$string =~ s/${noPreBS}\$(\d)/\${$1}/g;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status);
+use IO::Compress::Base::Common 2.033 qw(:Status);
#use Compress::Bzip2 ;
-use Compress::Raw::Bzip2 2.030 ;
+use Compress::Raw::Bzip2 2.033 ;
our ($VERSION);
-$VERSION = '2.030';
+$VERSION = '2.033';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status);
+use IO::Compress::Base::Common 2.033 qw(:Status);
-use Compress::Raw::Zlib 2.030 qw(Z_OK Z_FINISH MAX_WBITS) ;
+use Compress::Raw::Zlib 2.033 qw(Z_OK Z_FINISH MAX_WBITS) ;
our ($VERSION);
-$VERSION = '2.030';
+$VERSION = '2.033';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status);
+use IO::Compress::Base::Common 2.033 qw(:Status);
our ($VERSION);
-$VERSION = '2.030';
+$VERSION = '2.033';
sub mkCompObject
{
use strict ;
use warnings;
-use IO::Compress::Base::Common 2.030 ;
+use IO::Compress::Base::Common 2.033 ;
use IO::File ;
use Scalar::Util qw(blessed readonly);
our (@ISA, $VERSION);
@ISA = qw(Exporter IO::File);
-$VERSION = '2.030';
+$VERSION = '2.033';
#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.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
require Exporter;
our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE);
@ISA = qw(Exporter);
-$VERSION = '2.030';
+$VERSION = '2.033';
@EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput
isaFileGlobString cleanFileGlobString oneTarget
++ $parsed{$canonkey};
return $self->setError("Muliple instances of '$key' found")
- if $parsed && $type & Parse_multiple == 0 ;
+ if $parsed && ($type & Parse_multiple) == 0 ;
my $s ;
$self->_checkType($key, $value, $type, 1, \$s)
use bytes;
require Exporter ;
-use IO::Compress::Base 2.030 ;
+use IO::Compress::Base 2.033 ;
-use IO::Compress::Base::Common 2.030 qw(createSelfTiedObject);
-use IO::Compress::Adapter::Bzip2 2.030 ;
+use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject);
+use IO::Compress::Adapter::Bzip2 2.033 ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bzip2Error);
-$VERSION = '2.030';
+$VERSION = '2.033';
$Bzip2Error = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.030 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return (
'BlockSize100K' => [0, 1, Parse_unsigned, 1],
require Exporter ;
-use IO::Compress::RawDeflate 2.030 ;
+use IO::Compress::RawDeflate 2.033 ;
-use Compress::Raw::Zlib 2.030 ;
-use IO::Compress::Zlib::Constants 2.030 ;
-use IO::Compress::Base::Common 2.030 qw(createSelfTiedObject);
+use Compress::Raw::Zlib 2.033 ;
+use IO::Compress::Zlib::Constants 2.033 ;
+use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError);
-$VERSION = '2.030';
+$VERSION = '2.033';
$DeflateError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
So when the output is a filehandle it will carry out a seek to the eof
before writing any compressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all compressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all compressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use bytes;
-use IO::Compress::RawDeflate 2.030 ;
+use IO::Compress::RawDeflate 2.033 ;
-use Compress::Raw::Zlib 2.030 ;
-use IO::Compress::Base::Common 2.030 qw(:Status :Parse createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.030 ;
-use IO::Compress::Zlib::Extra 2.030 ;
+use Compress::Raw::Zlib 2.033 ;
+use IO::Compress::Base::Common 2.033 qw(:Status :Parse createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.033 ;
+use IO::Compress::Zlib::Extra 2.033 ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
-$VERSION = '2.030';
+$VERSION = '2.033';
$GzipError = '' ;
@ISA = qw(Exporter IO::Compress::RawDeflate);
if ( ! $got->parsed('ExtraFlags')) {
$got->value('ExtraFlags' => 2)
- if $got->value('Level') == Z_BEST_SPEED ;
- $got->value('ExtraFlags' => 4)
if $got->value('Level') == Z_BEST_COMPRESSION ;
+ $got->value('ExtraFlags' => 4)
+ if $got->value('Level') == Z_BEST_SPEED ;
}
my $data = $got->value('ExtraField') ;
So when the output is a filehandle it will carry out a seek to the eof
before writing any compressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all compressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all compressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names);
our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE);
-$VERSION = '2.030';
+$VERSION = '2.033';
@ISA = qw(Exporter);
use bytes;
-use IO::Compress::Base 2.030 ;
-use IO::Compress::Base::Common 2.030 qw(:Status createSelfTiedObject);
-use IO::Compress::Adapter::Deflate 2.030 ;
+use IO::Compress::Base 2.033 ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
+use IO::Compress::Adapter::Deflate 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
-$VERSION = '2.030';
+$VERSION = '2.033';
$RawDeflateError = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.030 qw(:Parse);
- use Compress::Raw::Zlib 2.030 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
+ use Compress::Raw::Zlib 2.033 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
return (
So when the output is a filehandle it will carry out a seek to the eof
before writing any compressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all compressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all compressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status createSelfTiedObject);
-use IO::Compress::RawDeflate 2.030 ;
-use IO::Compress::Adapter::Deflate 2.030 ;
-use IO::Compress::Adapter::Identity 2.030 ;
-use IO::Compress::Zlib::Extra 2.030 ;
-use IO::Compress::Zip::Constants 2.030 ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
+use IO::Compress::RawDeflate 2.033 ;
+use IO::Compress::Adapter::Deflate 2.033 ;
+use IO::Compress::Adapter::Identity 2.033 ;
+use IO::Compress::Zlib::Extra 2.033 ;
+use IO::Compress::Zip::Constants 2.033 ;
-use Compress::Raw::Zlib 2.030 qw(crc32) ;
+use Compress::Raw::Zlib 2.033 qw(crc32) ;
BEGIN
{
eval { require IO::Compress::Adapter::Bzip2 ;
- import IO::Compress::Adapter::Bzip2 2.030 ;
+ import IO::Compress::Adapter::Bzip2 2.033 ;
require IO::Compress::Bzip2 ;
- import IO::Compress::Bzip2 2.030 ;
+ import IO::Compress::Bzip2 2.033 ;
} ;
# eval { require IO::Compress::Adapter::Lzma ;
# import IO::Compress::Adapter::Lzma 2.020 ;
# require IO::Compress::Lzma ;
-# import IO::Compress::Lzma 2.030 ;
+# import IO::Compress::Lzma 2.033 ;
# } ;
}
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
-$VERSION = '2.030';
+$VERSION = '2.033';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
my $extFileAttr = 0 ;
# This code assumes Unix.
- $extFileAttr = 0100644 << 16
+ $extFileAttr = 0100644 << 16
if $osCode == ZIP_OS_CODE_UNIX ;
if (*$self->{ZipData}{Zip64}) {
{
my $self = shift ;
- use IO::Compress::Base::Common 2.030 qw(:Parse);
- use Compress::Raw::Zlib 2.030 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
+ use Compress::Raw::Zlib 2.033 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
my @Bzip2 = ();
'exUnix2' => [0, 1, Parse_any, undef],
'ExtAttr' => [0, 1, Parse_any,
$Compress::Raw::Zlib::gzip_os_code == 3
- ? 0100644 << 16
+ ? 0100644 << 16
: 0],
'OS_Code' => [0, 1, Parse_unsigned, $Compress::Raw::Zlib::gzip_os_code],
So when the output is a filehandle it will carry out a seek to the eof
before writing any compressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all compressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all compressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
or die "zip failed: $ZipError\n";
Alternatively, rather than having to explicitly name each of the files that
-you want to comnpress, you could use a fileglob to select all the C<txt>
+you want to compress, you could use a fileglob to select all the C<txt>
files in the current directory, as follows
use strict ;
=item C<< Name => $string >>
-Stores the contents of C<$string> in the zip filename header field.
+Stores the contents of C<$string> in the zip filename header field.
If C<Name> is not specified and the C<$input> parameter is a filename that
will be used for the zip filename header field.
0100644 << 16
This should allow read/write access to any files that are extracted from
-the zip file/buffer.
+the zip file/buffer`.
For all other systems it defaults to 0.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
-$VERSION = '2.030';
+$VERSION = '2.033';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT);
-$VERSION = '2.030';
+$VERSION = '2.033';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.030';
+$VERSION = '2.033';
-use IO::Compress::Gzip::Constants 2.030 ;
+use IO::Compress::Gzip::Constants 2.033 ;
sub ExtraFieldError
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status);
+use IO::Compress::Base::Common 2.033 qw(:Status);
-use Compress::Raw::Bzip2 2.030 ;
+use Compress::Raw::Bzip2 2.033 ;
our ($VERSION, @ISA);
-$VERSION = '2.030';
+$VERSION = '2.033';
sub mkUncompObject
{
use strict;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status);
+use IO::Compress::Base::Common 2.033 qw(:Status);
our ($VERSION);
-$VERSION = '2.030';
+$VERSION = '2.033';
-use Compress::Raw::Zlib 2.030 ();
+use Compress::Raw::Zlib 2.033 ();
sub mkUncompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status);
-use Compress::Raw::Zlib 2.030 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
+use IO::Compress::Base::Common 2.033 qw(:Status);
+use Compress::Raw::Zlib 2.033 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
our ($VERSION);
-$VERSION = '2.030';
+$VERSION = '2.033';
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.030 ();
+use IO::Uncompress::Adapter::Inflate 2.033 ();
-use IO::Uncompress::Base 2.030 ;
-use IO::Uncompress::Gunzip 2.030 ;
-use IO::Uncompress::Inflate 2.030 ;
-use IO::Uncompress::RawInflate 2.030 ;
-use IO::Uncompress::Unzip 2.030 ;
+use IO::Uncompress::Base 2.033 ;
+use IO::Uncompress::Gunzip 2.033 ;
+use IO::Uncompress::Inflate 2.033 ;
+use IO::Uncompress::RawInflate 2.033 ;
+use IO::Uncompress::Unzip 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
-$VERSION = '2.030';
+$VERSION = '2.033';
$AnyInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
sub getExtraParams
{
- use IO::Compress::Base::Common 2.030 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.033 qw(createSelfTiedObject);
-use IO::Uncompress::Base 2.030 ;
+use IO::Uncompress::Base 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.030';
+$VERSION = '2.033';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.030 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.030 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.030 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.030 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.033 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.033 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.033 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.033 ;';
eval ' use IO::Uncompress::Adapter::UnLzma 2.020 ;';
eval ' use IO::Uncompress::Adapter::UnXz 2.020 ;';
- eval ' use IO::Uncompress::Bunzip2 2.030 ;';
- eval ' use IO::Uncompress::UnLzop 2.030 ;';
- eval ' use IO::Uncompress::Gunzip 2.030 ;';
- eval ' use IO::Uncompress::Inflate 2.030 ;';
- eval ' use IO::Uncompress::RawInflate 2.030 ;';
- eval ' use IO::Uncompress::Unzip 2.030 ;';
- eval ' use IO::Uncompress::UnLzf 2.030 ;';
- eval ' use IO::Uncompress::UnLzma 2.030 ;';
- eval ' use IO::Uncompress::UnXz 2.030 ;';
+ eval ' use IO::Uncompress::Bunzip2 2.033 ;';
+ eval ' use IO::Uncompress::UnLzop 2.033 ;';
+ eval ' use IO::Uncompress::Gunzip 2.033 ;';
+ eval ' use IO::Uncompress::Inflate 2.033 ;';
+ eval ' use IO::Uncompress::RawInflate 2.033 ;';
+ eval ' use IO::Uncompress::Unzip 2.033 ;';
+ eval ' use IO::Uncompress::UnLzf 2.033 ;';
+ eval ' use IO::Uncompress::UnLzma 2.033 ;';
+ eval ' use IO::Uncompress::UnXz 2.033 ;';
}
sub new
sub getExtraParams
{
- use IO::Compress::Base::Common 2.030 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ,
'UnLzma' => [1, 1, Parse_boolean, 0] ) ;
}
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
@ISA = qw(Exporter IO::File);
-$VERSION = '2.030';
+$VERSION = '2.033';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.030 ;
+use IO::Compress::Base::Common 2.033 ;
#use Parse::Parameters ;
use IO::File ;
my $self = $_[0];
my $out = $_[1];
my $size = $_[2];
+ #$$out = "" ;
$$out = "" ;
my $offset = 0 ;
+ my $status = 1;
if (defined *$self->{InputLength}) {
# because the filehandle may not support the offset parameter
# An example is Net::FTP
my $tmp = '';
- *$self->{FH}->read($tmp, $get_size) &&
- (substr($$out, $offset) = $tmp);
+ $status = *$self->{FH}->read($tmp, $get_size) ;
+ substr($$out, $offset) = $tmp
+ if defined $status && $status > 0 ;
}
else
- { *$self->{FH}->read($$out, $get_size) }
+ { $status = *$self->{FH}->read($$out, $get_size) }
}
elsif (defined *$self->{InputEvent}) {
my $got = 1 ;
*$self->{InputLengthRemaining} -= length($$out) #- $offset
if defined *$self->{InputLength};
+ if (! defined $status) {
+ $self->saveStatus($!) ;
+ return STATUS_ERROR;
+ }
+
$self->saveStatus(length $$out < 0 ? STATUS_ERROR : STATUS_OK) ;
return length $$out;
}
my $status = $self->smartRead($buff, $size) ;
- return $self->saveErrorString(STATUS_ERROR, "Error Reading Data")
- if $status < 0 ;
+ return $self->saveErrorString(STATUS_ERROR, "Error Reading Data: $!")
+ if $status == STATUS_ERROR ;
if ($status == 0 ) {
*$self->{Closed} = 1 ;
my $len = $self->smartRead(\$tmp_buff, *$self->{BlockSize}) ;
return $self->saveErrorString(G_ERR, "Error reading data: $!", $!)
- if $len < 0 ;
+ if $len == STATUS_ERROR ;
if ($len == 0 ) {
*$self->{EndStream} = 1 ;
sub _getline
{
my $self = shift ;
+ my $status = 0 ;
# Slurp Mode
if ( ! defined $/ ) {
my $data ;
- 1 while $self->read($data) > 0 ;
- return \$data ;
+ 1 while ($status = $self->read($data)) > 0 ;
+ return $status < 0 ? \undef : \$data ;
}
# Record Mode
if ( ref $/ eq 'SCALAR' && ${$/} =~ /^\d+$/ && ${$/} > 0) {
my $reclen = ${$/} ;
my $data ;
- $self->read($data, $reclen) ;
- return \$data ;
+ $status = $self->read($data, $reclen) ;
+ return $status < 0 ? \undef : \$data ;
}
# Paragraph Mode
if ( ! length $/ ) {
my $paragraph ;
- while ($self->read($paragraph) > 0 ) {
+ while (($status = $self->read($paragraph)) > 0 ) {
if ($paragraph =~ s/^(.*?\n\n+)//s) {
*$self->{Pending} = $paragraph ;
my $par = $1 ;
return \$par ;
}
}
- return \$paragraph;
+ return $status < 0 ? \undef : \$paragraph;
}
# $/ isn't empty, or a reference, so it's Line Mode.
return \$l;
}
- while ($self->read($line) > 0 ) {
+ while (($status = $self->read($line)) > 0 ) {
my $offset = index($line, $/);
if ($offset >= 0) {
my $l = substr($line, 0, $offset + length $/ );
}
}
- return \$line;
+ return $status < 0 ? \undef : \$line;
}
}
=head1 DESCRIPTION
This module is not intended for direct use in application code. Its sole
-purpose if to to be sub-classed by IO::Unompress modules.
+purpose if to to be sub-classed by IO::Uncompress modules.
=head1 SEE ALSO
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status createSelfTiedObject);
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.030 ;
-use IO::Uncompress::Adapter::Bunzip2 2.030 ;
+use IO::Uncompress::Base 2.033 ;
+use IO::Uncompress::Adapter::Bunzip2 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
-$VERSION = '2.030';
+$VERSION = '2.033';
$Bunzip2Error = '';
@ISA = qw( Exporter IO::Uncompress::Base );
{
my $self = shift ;
- use IO::Compress::Base::Common 2.030 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return (
'Verbosity' => [1, 1, Parse_boolean, 0],
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.030 ;
+use IO::Uncompress::RawInflate 2.033 ;
-use Compress::Raw::Zlib 2.030 qw( crc32 ) ;
-use IO::Compress::Base::Common 2.030 qw(:Status createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.030 ;
-use IO::Compress::Zlib::Extra 2.030 ;
+use Compress::Raw::Zlib 2.033 qw( crc32 ) ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.033 ;
+use IO::Compress::Zlib::Extra 2.033 ;
require Exporter ;
$GunzipError = '';
-$VERSION = '2.030';
+$VERSION = '2.033';
sub new
{
sub getExtraParams
{
- use IO::Compress::Base::Common 2.030 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
}
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.030 qw(:Status createSelfTiedObject);
-use IO::Compress::Zlib::Constants 2.030 ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
+use IO::Compress::Zlib::Constants 2.033 ;
-use IO::Uncompress::RawInflate 2.030 ;
+use IO::Uncompress::RawInflate 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
-$VERSION = '2.030';
+$VERSION = '2.033';
$InflateError = '';
@ISA = qw( Exporter IO::Uncompress::RawInflate );
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use Compress::Raw::Zlib 2.030 ;
-use IO::Compress::Base::Common 2.030 qw(:Status createSelfTiedObject);
+use Compress::Raw::Zlib 2.033 ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.030 ;
-use IO::Uncompress::Adapter::Inflate 2.030 ;
+use IO::Uncompress::Base 2.033 ;
+use IO::Uncompress::Adapter::Inflate 2.033 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
-$VERSION = '2.030';
+$VERSION = '2.033';
$RawInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.030 ;
-use IO::Compress::Base::Common 2.030 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.030 ;
-use IO::Uncompress::Adapter::Identity 2.030 ;
-use IO::Compress::Zlib::Extra 2.030 ;
-use IO::Compress::Zip::Constants 2.030 ;
+use IO::Uncompress::RawInflate 2.033 ;
+use IO::Compress::Base::Common 2.033 qw(:Status createSelfTiedObject);
+use IO::Uncompress::Adapter::Inflate 2.033 ;
+use IO::Uncompress::Adapter::Identity 2.033 ;
+use IO::Compress::Zlib::Extra 2.033 ;
+use IO::Compress::Zip::Constants 2.033 ;
-use Compress::Raw::Zlib 2.030 qw(crc32) ;
+use Compress::Raw::Zlib 2.033 qw(crc32) ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.030';
+$VERSION = '2.033';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
sub getExtraParams
{
- use IO::Compress::Base::Common 2.030 qw(:Parse);
+ use IO::Compress::Base::Common 2.033 qw(:Parse);
return (
So when the output is a filehandle it will carry out a seek to the eof
before writing any uncompressed data. If the output is a filename, it will be opened for
-appending. If the output is a buffer, all uncompressed data will be appened to
-the existing buffer.
+appending. If the output is a buffer, all uncompressed data will be
+appended to the existing buffer.
Conversely when C<Append> is not specified, or it is present and is set to
false, it will operate as follows.
or die "unzip failed: $UnzipError\n";
If you have a zip file that contains multiple members and want to read a
-specific member from the file, say C<"data1">, use the C<Name> option
+specific member from the file, say C<"data1">, use the C<Name> option
use strict ;
use warnings ;
my $input = new IO::File "<file1.zip"
or die "Cannot open 'file1.zip': $!\n" ;
my $buffer ;
- unzip $input => \$buffer
+ unzip $input => \$buffer
or die "unzip failed: $UnzipError\n";
=head1 OO Interface
=item C<< Name => "membername" >>
-Open "membername" from the zip file for reading.
+Open "membername" from the zip file for reading.
=item C<< AutoClose => 0|1 >>
In addition, if the input file/buffer does contain compressed data and
there is non-compressed data immediately following it, setting this option
-will make this module treat the whole file/bufffer as a single data stream.
+will make this module treat the whole file/buffer as a single data stream.
This option defaults to 1.
my $status;
for ($status = 1; ! $u->eof(); $status = $u->nextStream())
{
-
+
my $name = $u->getHeaderInfo()->{Name};
warn "Processing member $name\n" ;
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
file and prints out how many lines are in each compressed file (if you
intend write code to walking through a zip file for real see
L<IO::Uncompress::Unzip/"Walking through a zip file"> ). Also, although
-this example uses the zlib-based comnpresion, the technique can be used by
+this example uses the zlib-based compression, the technique can be used by
the other C<IO::Uncompress::*> modules.
use strict;
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2010 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2011 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- my $VERSION = '2.030';
+ my $VERSION = '2.033';
my @NAMES = qw(
Compress::Raw::Bzip2
Compress::Raw::Zlib
my $hdr = readHeaderInfo $name, -Level => Z_BEST_SPEED;
ok ! defined $hdr->{Name};
- is $hdr->{ExtraFlags}, 2;
+ is $hdr->{ExtraFlags}, 4;
ok ! defined $hdr->{ExtraFieldRaw} ;
ok ! defined $hdr->{Comment} ;
ok ! $hdr->{isMinimalHeader} ;
$hdr = readHeaderInfo $name, -Level => Z_BEST_COMPRESSION;
ok ! defined $hdr->{Name};
- is $hdr->{ExtraFlags}, 4;
+ is $hdr->{ExtraFlags}, 2;
ok ! defined $hdr->{ExtraFieldRaw} ;
ok ! defined $hdr->{Comment} ;
ok ! $hdr->{isMinimalHeader} ;
}
{
- # Check Minimal + no comressed data
+ # Check Minimal + no compressed data
# This is the smallest possible gzip file (20 bytes)
ok my $x = new IO::Compress::Gzip $name, -Minimal => 1;
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 118 + $extra ;
+ plan tests => 112 + $extra ;
use_ok('Scalar::Util');
use_ok('IO::Compress::Base::Common');
like $@, mkErr("Parameter 'Fred' not a scalar"),
"wanted scalar";
-# eval { ParseParameters(1, {'Fred' => [1, 1, Parse_any, 0]}, Fred => 1, Fred => 2) ; };
-# like $@, mkErr("Muliple instances of 'Fred' found"),
-# "wanted scalar";
+ eval { ParseParameters(1, {'Fred' => [1, 1, Parse_any, 0]}, Fred => 1, Fred => 2) ; };
+ like $@, mkErr("Muliple instances of 'Fred' found"),
+ "multiple instances";
my $g = ParseParameters(1, {'Fred' => [1, 1, Parse_unsigned|Parse_multiple, 7]}, Fred => 1, Fred => 2) ;
is_deeply $g->value('Fred'), [ 1, 2 ] ;
is $xx, 777;
}
- my $got2 = ParseParameters(1, {'Fred' => [1, 1, Parse_writable_scalar, undef]}, '__xxx__' => $got) ;
- isnt $got2, $got, "not the Same object";
-
- ok $got2->parsed('Fred'), "parsed" ;
- $xx_ref = $got2->value('Fred');
- $$xx_ref = 888 ;
- is $xx, 888;
-
- my $other;
- my $got3 = ParseParameters(1, {'Fred' => [1, 1, Parse_writable_scalar, undef]}, '__xxx__' => $got, Fred => \$other) ;
- isnt $got3, $got, "not the Same object";
-
- ok $got3->parsed('Fred'), "parsed" ;
- $xx_ref = $got3->value('Fred');
- $$xx_ref = 999 ;
- is $other, 999;
- is $xx, 888;
+## my $got2 = ParseParameters(1, {'Fred' => [1, 1, Parse_writable_scalar, undef]}, '__xxx__' => $got) ;
+## isnt $got2, $got, "not the Same object";
+##
+## ok $got2->parsed('Fred'), "parsed" ;
+## $xx_ref = $got2->value('Fred');
+## $$xx_ref = 888 ;
+## is $xx, 888;
+##
+## my $other;
+## my $got3 = ParseParameters(1, {'Fred' => [1, 1, Parse_writable_scalar, undef]}, '__xxx__' => $got, Fred => \$other) ;
+## isnt $got3, $got, "not the Same object";
+##
+## exit;
+## ok $got3->parsed('Fred'), "parsed" ;
+## $xx_ref = $got3->value('Fred');
+## $$xx_ref = 999 ;
+## is $other, 999;
+## is $xx, 888;
}
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 912 + $extra;
+ plan tests => 3308 + $extra;
};
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 734 + $extra;
+ plan tests => 2552 + $extra;
};
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 978 + $extra;
+ plan tests => 3040 + $extra;
};
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 2404 + $extra;
+ plan tests => 7732 + $extra;
};
my $x ;
my $uncomp ;
my $stdinFileno = fileno(STDIN);
- # open below doesn't return 1 sometines on XP
+ # open below doesn't return 1 sometimes on XP
open(SAVEIN, "<&STDIN");
ok open(STDIN, "<$name"), " redirect STDIN";
my $dummy = fileno SAVEIN;
is $io->input_line_number, 2;
ok $io->eof;
ok @lines == 2
- or print "# exected 2 lines, got " . scalar(@lines) . "\n";
+ or print "# expected 2 lines, got " . scalar(@lines) . "\n";
ok $lines[0] eq "This is an example\nof a paragraph\n\n\n"
or print "# [$lines[0]]\n" ;
ok $lines[1] eq "and a single line.\n\n";
my @lines = <$io>;
ok $io->eof;
ok @lines == 2
- or print "# exected 2 lines, got " . scalar(@lines) . "\n";
+ or print "# expected 2 lines, got " . scalar(@lines) . "\n";
ok $lines[0] eq "This is an example\nof a paragraph\n\n\n"
or print "# [$lines[0]]\n" ;
ok $lines[1] eq "and a single line.\n\n";
ok 1, "Header size is $header_size" ;
ok 1, "Trailer size is $trailer_size" ;
- for my $trans ( 0 .. 1)
+ foreach my $fb ( qw( filehandle buffer ) )
{
- title "Truncating $CompressClass, Transparent $trans";
-
-
- foreach my $i (1 .. $fingerprint_size-1)
+ for my $trans ( 0 .. 1)
{
- my $lex = new LexFile my $name ;
-
- title "Fingerprint Truncation - length $i, Transparent $trans";
-
- my $part = substr($compressed, 0, $i);
- writeFile($name, $part);
-
- my $gz = new $UncompressClass $name,
- -BlockSize => $blocksize,
- -Transparent => $trans;
- if ($trans) {
- ok $gz;
- ok ! $gz->error() ;
- my $buff ;
- is $gz->read($buff, 5000), length($part) ;
- ok $buff eq $part ;
- ok $gz->eof() ;
- $gz->close();
- }
- else {
- ok !$gz;
- }
+ title "Truncating $CompressClass, Source $fb, Transparent $trans";
- }
- #
- # Any header corruption past the fingerprint is considered catastrophic
- # so even if Transparent is set, it should still fail
- #
- foreach my $i ($fingerprint_size .. $header_size -1)
- {
- my $lex = new LexFile my $name ;
-
- title "Header Truncation - length $i, Transparent $trans";
+ foreach my $i (1 .. $fingerprint_size-1)
+ {
+ my $lex = new LexFile my $name ;
+ my $input;
+
+ title "Fingerprint Truncation - length $i, Transparent $trans";
+
+ my $part = substr($compressed, 0, $i);
+ if ($fb eq 'filehandle')
+ {
+ writeFile($name, $part);
+ $input = $name ;
+ }
+ else
+ {
+ $input = \$part;
+ }
- my $part = substr($compressed, 0, $i);
- writeFile($name, $part);
- ok ! defined new $UncompressClass $name,
+ my $gz = new $UncompressClass $input,
-BlockSize => $blocksize,
-Transparent => $trans;
- #ok $gz->eof() ;
- }
+ if ($trans) {
+ ok $gz;
+ ok ! $gz->error() ;
+ my $buff ;
+ is $gz->read($buff, 5000), length($part) ;
+ ok $buff eq $part ;
+ ok $gz->eof() ;
+ $gz->close();
+ }
+ else {
+ ok !$gz;
+ }
-
- foreach my $i ($header_size .. length($compressed) - 1 - $trailer_size)
- {
- next if $i == 0 ;
-
- my $lex = new LexFile my $name ;
-
- title "Compressed Data Truncation - length $i, Transparent $trans";
-
- my $part = substr($compressed, 0, $i);
- writeFile($name, $part);
- ok my $gz = new $UncompressClass $name,
- -Strict => 1,
- -BlockSize => $blocksize,
- -Transparent => $trans
- or diag $$UnError;
-
- my $un ;
- my $status = 1 ;
- $status = $gz->read($un) while $status > 0 ;
- cmp_ok $status, "<", 0 ;
- ok $gz->error() ;
- ok $gz->eof() ;
- $gz->close();
- }
-
- # RawDeflate does not have a trailer
- next if $CompressClass eq 'IO::Compress::RawDeflate' ;
+ }
- title "Compressed Trailer Truncation";
- foreach my $i (length($compressed) - $trailer_size .. length($compressed) -1 )
- {
- foreach my $lax (0, 1)
+ #
+ # Any header corruption past the fingerprint is considered catastrophic
+ # so even if Transparent is set, it should still fail
+ #
+ foreach my $i ($fingerprint_size .. $header_size -1)
{
my $lex = new LexFile my $name ;
+ my $input;
- ok 1, "Compressed Trailer Truncation - Length $i, Lax $lax, Transparent $trans" ;
+ title "Header Truncation - length $i, Source $fb, Transparent $trans";
+
my $part = substr($compressed, 0, $i);
- writeFile($name, $part);
- ok my $gz = new $UncompressClass $name,
- -BlockSize => $blocksize,
- -Strict => !$lax,
- -Append => 1,
- -Transparent => $trans;
- my $un = '';
- my $status = 1 ;
- $status = $gz->read($un) while $status > 0 ;
-
- if ($lax)
+ if ($fb eq 'filehandle')
{
- is $un, $hello;
- is $status, 0
- or diag "Status $status Error is " . $gz->error() ;
- ok $gz->eof()
- or diag "Status $status Error is " . $gz->error() ;
- ok ! $gz->error() ;
+ writeFile($name, $part);
+ $input = $name ;
}
else
{
- cmp_ok $status, "<", 0
- or diag "Status $status Error is " . $gz->error() ;
- ok $gz->eof()
- or diag "Status $status Error is " . $gz->error() ;
+ $input = \$part;
+ }
+
+ ok ! defined new $UncompressClass $input,
+ -BlockSize => $blocksize,
+ -Transparent => $trans;
+ #ok $gz->eof() ;
+ }
+
+ # Test curruption directly after the header
+ # In this case the uncompression object will have been created,
+ # so need to check that subsequent reads from the object fail
+ if ($header_size > 0)
+ {
+ my $lex = new LexFile my $name ;
+ my $input;
+
+ for my $mode (qw(block line para record slurp))
+ {
+
+ title "Corruption after header - Mode $mode, Source $fb, Transparent $trans";
+
+ my $part = substr($compressed, 0, $header_size);
+ # Append corrupt data
+ $part .= "\xFF" x 100 ;
+ if ($fb eq 'filehandle')
+ {
+ writeFile($name, $part);
+ $input = $name ;
+ }
+ else
+ {
+ $input = \$part;
+ }
+
+ ok my $gz = new $UncompressClass $input,
+ -Strict => 1,
+ -BlockSize => $blocksize,
+ -Transparent => $trans
+ or diag $$UnError;
+
+ my $un ;
+ my $status = 1;
+ if ($mode eq 'block')
+ {
+ $status = $gz->read($un) ;
+ is $status, -1, "got -1";
+ }
+ else
+ {
+ if ($mode eq 'line')
+ {
+ $status = <$gz>;
+ }
+ elsif ($mode eq 'para')
+ {
+ local $/ = "\n\n";
+ $status = <$gz>;
+ }
+ elsif ($mode eq 'record')
+ {
+ local $/ = \ 4;
+ $status = <$gz>;
+ }
+ elsif ($mode eq 'slurp')
+ {
+ local $/ ;
+ $status = <$gz>;
+ }
+
+ is $status, undef, "got undef";
+ }
+
ok $gz->error() ;
+ $gz->close();
}
+ }
+
+ # Back to truncation tests
+
+ foreach my $i ($header_size .. length($compressed) - 1 - $trailer_size)
+ {
+ next if $i == 0 ;
+
+ my $lex = new LexFile my $name ;
+ my $input;
+
+ for my $mode (qw(block line))
+ {
+
+ title "Compressed Data Truncation - length $i, MOde $mode, Source $fb, Transparent $trans";
+
+ my $part = substr($compressed, 0, $i);
+ if ($fb eq 'filehandle')
+ {
+ writeFile($name, $part);
+ $input = $name ;
+ }
+ else
+ {
+ $input = \$part;
+ }
+
+ ok my $gz = new $UncompressClass $input,
+ -Strict => 1,
+ -BlockSize => $blocksize,
+ -Transparent => $trans
+ or diag $$UnError;
+
+ my $un ;
+ if ($mode eq 'block')
+ {
+ my $status = 1 ;
+ $status = $gz->read($un) while $status > 0 ;
+ cmp_ok $status, "<", 0 ;
+ }
+ else
+ {
+ 1 while <$gz> ;
+ }
+ ok $gz->error() ;
+ ok $gz->eof() ;
+ $gz->close();
+ }
+ }
+
+ # RawDeflate does not have a trailer
+ next if $CompressClass eq 'IO::Compress::RawDeflate' ;
+
+ title "Compressed Trailer Truncation";
+ foreach my $i (length($compressed) - $trailer_size .. length($compressed) -1 )
+ {
+ foreach my $lax (0, 1)
+ {
+ my $lex = new LexFile my $name ;
+ my $input;
- $gz->close();
+ ok 1, "Compressed Trailer Truncation - Length $i, Lax $lax, Transparent $trans" ;
+ my $part = substr($compressed, 0, $i);
+ if ($fb eq 'filehandle')
+ {
+ writeFile($name, $part);
+ $input = $name ;
+ }
+ else
+ {
+ $input = \$part;
+ }
+
+ ok my $gz = new $UncompressClass $input,
+ -BlockSize => $blocksize,
+ -Strict => !$lax,
+ -Append => 1,
+ -Transparent => $trans;
+ my $un = '';
+ my $status = 1 ;
+ $status = $gz->read($un) while $status > 0 ;
+
+ if ($lax)
+ {
+ is $un, $hello;
+ is $status, 0
+ or diag "Status $status Error is " . $gz->error() ;
+ ok $gz->eof()
+ or diag "Status $status Error is " . $gz->error() ;
+ ok ! $gz->error() ;
+ }
+ else
+ {
+ cmp_ok $status, "<", 0
+ or diag "Status $status Error is " . $gz->error() ;
+ ok $gz->eof()
+ or diag "Status $status Error is " . $gz->error() ;
+ ok $gz->error() ;
+ }
+
+ $gz->close();
+ }
}
}
}
ok ! defined $ungzip ;
cmp_ok $gzerrno, "==", Z_DATA_ERROR ;
- # corrupt header - reserverd bits used
+ # corrupt header - reserved bits used
$bad = $keep ;
substr($bad, 3, 1) = "\xFF" ;
$ungzip = memGunzip(\$bad) ;
}
{
- title "a text file which is not termined by an EOL";
+ title "a text file which is not terminated by an EOL";
my $lex = new LexFile my $name ;
=item *
+C<IO::Compress> has been upgraded from version 2.030 to 2.033
+
+=item *
+
C<IPC::Cmd> has been upgraded from version 0.66 to 0.68
=item *