ext/IO_Compress_Zlib/t/109merge-gzip.t IO::Compress::Zlib
ext/IO_Compress_Zlib/t/109merge-rawdeflate.t IO::Compress::Zlib
ext/IO_Compress_Zlib/t/109merge-zip.t IO::Compress::Zlib
+ext/IO_Compress_Zlib/t/110encode-deflate.t IO::Compress::Zlib
+ext/IO_Compress_Zlib/t/110encode-gzip.t IO::Compress::Zlib
+ext/IO_Compress_Zlib/t/110encode-rawdeflate.t IO::Compress::Zlib
+ext/IO_Compress_Zlib/t/110encode-zip.t IO::Compress::Zlib
ext/IO/hints/sco.pl Hint for IO for named architecture
ext/IO/IO.pm Top-level interface to IO::* classes
ext/IO/IO.xs IO extension external subroutines
t/lib/compress/anyunc.pl Compress::Zlib
t/lib/compress/CompTestUtils.pm Compress::Zlib
t/lib/compress/destroy.pl Compress::Zlib
+t/lib/compress/encode.pl Compress::Zlib
t/lib/compress/generic.pl Compress::Zlib
t/lib/compress/merge.pl Compress::Zlib
t/lib/compress/multi.pl Compress::Zlib
CHANGES
-------
+ 2.005 18 June 2007
+
+ * Only include ppport.h when not being built with perl.
+ [core patch #30655]
+
2.004 3 March 2007
* Fixed lvalue substr issue
: ()
),
-
(
$BUILD_ZLIB
? zlib_files($ZLIB_LIB)
Compress::Raw::Zlib
- Version 2.004
+ Version 2.005
- 3rd March 2007
+ 18th June 2007
Copyright (c) 2005-2007 Paul Marquess. All rights reserved.
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.004_01';
+$VERSION = '2.005';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
CHANGES
-------
+ 2.005 18 June 2007
+
+ * Added info about removing Compress::Zlib version 1, before
+ installing version 2.
+
2.004 3 March 2007
* rewrote memGzip using IO::Compress::Gzip::gzip
use strict ;
require 5.004 ;
-$::VERSION = '2.004' ;
+$::VERSION = '2.005' ;
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
+
UpDowngrade(getPerlFiles('MANIFEST'))
unless $ENV{PERL_CORE};
) ;
+# Check for Compress::Zlib version 1.
+eval "require Compress::Zlib; " ;
+if ( ! $ENV{PERL_CORE} && ! $@ && $Compress::Zlib::VERSION < 2)
+{
+ my $ver = $Compress::Zlib::VERSION ;
+ print <<EOM
+
+I see you already have Compress::Zlib version $ver installed.
+Version 1 MUST be removed for version 2 to operate correctly.
+
+The easiest way to do that is to install Compress::Zlib like this
+
+ make install UNINST=1
+
+If you run the CPAN shell run this before installing Compress::Zlib
+
+ o conf make_install_arg UNINST=1
+
+EOM
+}
+
# end of file Makefile.PL
Compress::Zlib
- Version 2.004
+ Version 2.005
- 3rd March 2007
+ 18th June 2007
Copyright (c) 1995-2007 Paul Marquess. All rights reserved.
use IO::Handle ;
use Scalar::Util qw(dualvar);
-use IO::Compress::Base::Common 2.004 ;
-use Compress::Raw::Zlib 2.004 ;
-use IO::Compress::Gzip 2.004 ;
-use IO::Uncompress::Gunzip 2.004 ;
+use IO::Compress::Base::Common 2.005 ;
+use Compress::Raw::Zlib 2.005 ;
+use IO::Compress::Gzip 2.005 ;
+use IO::Uncompress::Gunzip 2.005 ;
use strict ;
use warnings ;
use bytes ;
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
-$VERSION = '2.004';
+$VERSION = '2.005';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
return _set_gzerr(Z_STREAM_ERROR())
if $self->[1] ne 'deflate';
+ $] >= 5.008 and (utf8::downgrade($_[0], 1)
+ or croak "Wide character in gzwrite");
+
my $status = $gz->write($_[0]) ;
_save_gzerr($gz);
return $status ;
$in = \$_[0] ;
}
+ $] >= 5.008 and (utf8::downgrade($$in, 1)
+ or croak "Wide character in compress");
+
my $level = (@_ == 2 ? $_[1] : Z_DEFAULT_COMPRESSION() );
$x = new Compress::Raw::Zlib::Deflate -AppendOutput => 1, -Level => $level
$in = \$_[0] ;
}
+ $] >= 5.008 and (utf8::downgrade($$in, 1)
+ or croak "Wide character in uncompress");
+
$x = new Compress::Raw::Zlib::Inflate -ConsumeInput => 0 or return undef ;
$err = $x->inflate($in, $output) ;
package Compress::Zlib ;
-use IO::Compress::Gzip::Constants 2.004 ;
+use IO::Compress::Gzip::Constants 2.005 ;
sub memGzip($)
{
# if the deflation buffer isn't a reference, make it one
my $string = (ref $_[0] ? $_[0] : \$_[0]) ;
+ $] >= 5.008 and (utf8::downgrade($$string, 1)
+ or croak "Wide character in memGzip");
+
IO::Compress::Gzip::gzip($string, \$out, Minimal => 1)
or return undef ;
# if the buffer isn't a reference, make it one
my $string = (ref $_[0] ? $_[0] : \$_[0]);
+ $] >= 5.008 and (utf8::downgrade($$string, 1)
+ or croak "Wide character in memGunzip");
+
_removeGzipHeader($string) == Z_OK()
or return undef;
+
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 16 + $extra ;
+ plan tests => 29 + $extra ;
use_ok('Compress::Zlib', 2);
}
"ZLIB_VERSION matches Compress::Zlib::zlib_version" ;
-if(0)
{
+ title "memGzip" ;
# length of this string is 2 characters
my $s = "\x{df}\x{100}";
- my $cs = Compress::Zlib::memGzip($s);
+ my $cs = Compress::Zlib::memGzip(Encode::encode_utf8($s));
# length stored at end of gzip file should be 4
my ($crc, $len) = unpack ("VV", substr($cs, -8, 8));
- is $len, 4, "length is 4";
+ is $len, 4, " length is 4";
}
{
- title "memGzip" ;
- # length of this string is 2 characters
- my $s = "\x{df}\x{100}";
+ title "memGunzip when compressed gzip has been encoded" ;
+ my $s = "hello world" ;
- my $cs = Compress::Zlib::memGzip(Encode::encode_utf8($s));
+ my $co = Compress::Zlib::memGzip($s);
+ is Compress::Zlib::memGunzip(my $x = $co), $s, " match uncompressed";
- # length stored at end of gzip file should be 4
- my ($crc, $len) = unpack ("VV", substr($cs, -8, 8));
-
- is $len, 4, " length is 4";
+ utf8::upgrade($co);
+
+ my $un = Compress::Zlib::memGunzip($co);
+ ok $un, " got uncompressed";
+
+ is $un, $s, " uncompressed matched original";
}
{
my $s = "\x{df}\x{100}";
my $s_copy = $s ;
- #my $cs = compress($s);
my $ces = compress(Encode::encode_utf8($s_copy));
ok $ces, " compressed ok" ;
- #is $s, $ces ;
-
- #my $un = uncompress($cs);
- #is $un, $s;
-
my $un = Encode::decode_utf8(uncompress($ces));
- #my $un = uncompress($ces);
is $un, $s, " decode_utf8 ok";
- #$un = Encode::decode_utf8(uncompress($cs));
- #is $un, $s;
-
+ utf8::upgrade($ces);
+ $un = Encode::decode_utf8(uncompress($ces));
+ is $un, $s, " decode_utf8 ok";
+
}
{
is $s, Encode::decode_utf8($uncomp), " decode_utf8 ok" ;
}
-# Add tests that check that the module traps use of wide chars
+{
+ title "Catch wide characters";
+
+ my $a = "a\xFF\x{100}";
+ eval { Compress::Zlib::memGzip($a) };
+ like($@, qr/Wide character in memGzip/, " wide characters in memGzip");
+
+ eval { Compress::Zlib::memGunzip($a) };
+ like($@, qr/Wide character in memGunzip/, " wide characters in memGunzip");
+
+ eval { Compress::Zlib::compress($a) };
+ like($@, qr/Wide character in compress/, " wide characters in compress");
+
+ eval { Compress::Zlib::uncompress($a) };
+ like($@, qr/Wide character in uncompress/, " wide characters in uncompress");
+
+ my $lex = new LexFile my $name ;
+ ok my $fil = gzopen($name, "wb"), " gzopen for write ok" ;
+
+ eval { $fil->gzwrite($a); } ;
+ like($@, qr/Wide character in gzwrite/, " wide characters in gzwrite");
+
+ ok ! $fil->gzclose, " gzclose ok" ;
+}
CHANGES
-------
+ 2.005 18 June 2007
+
+ * Stephen Turner reported a problem when using IO::Uncompress::Gunzip
+ with XML::Parser. Turns out there were two issues.
+
+ Firstly an IO::Uncompress object isn't an IO::Handle. It is now.
+
+ Secondly the implementation of "read" wasn't honouring this
+
+ SCALAR will be grown or shrunk to the length actually read.
+
+ In particular it didn't do the right thing on EOF.
+ This has been fixed.
+
2.004 3 March 2007
* Made seek less wasteful of memory.
IO::Compress::Base
- Version 2.004
+ Version 2.005
- 3rd March 2007
+ 18th June 2007
Copyright (c) 2005-2007 Paul Marquess. All rights reserved.
use strict ;
use warnings;
-use IO::Compress::Base::Common 2.004 ;
+use IO::Compress::Base::Common 2.005 ;
use IO::File ;
use Scalar::Util qw(blessed readonly);
use bytes;
our (@ISA, $VERSION);
-#@ISA = qw(Exporter IO::File);
+@ISA = qw(Exporter IO::File);
-$VERSION = '2.004';
+$VERSION = '2.005';
#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.
$buffer = \$_[0] ;
}
+ $] >= 5.008 and ( utf8::downgrade($$buffer, 1)
+ or croak "Wide character in " . *$self->{ClassName} . "::write:");
+
if (@_ > 1) {
my $slen = defined $$buffer ? length($$buffer) : 0;
modify it under the same terms as Perl itself.
+
require Exporter;
our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE);
@ISA = qw(Exporter);
-$VERSION = '2.004';
+$VERSION = '2.005';
@EXPORT = qw( isaFilehandle isaFilename whatIsInput whatIsOutput
isaFileGlobString cleanFileGlobString oneTarget
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.004 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.005 qw(createSelfTiedObject);
-use IO::Uncompress::Base 2.004 ;
+use IO::Uncompress::Base 2.005 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyUncompressError);
-$VERSION = '2.004';
+$VERSION = '2.005';
$AnyUncompressError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
BEGIN
{
- eval ' use IO::Uncompress::Adapter::Inflate 2.004 ;';
- eval ' use IO::Uncompress::Adapter::Bunzip2 2.004 ;';
- eval ' use IO::Uncompress::Adapter::LZO 2.004 ;';
- eval ' use IO::Uncompress::Adapter::Lzf 2.004 ;';
-
- eval ' use IO::Uncompress::Bunzip2 2.004 ;';
- eval ' use IO::Uncompress::UnLzop 2.004 ;';
- eval ' use IO::Uncompress::Gunzip 2.004 ;';
- eval ' use IO::Uncompress::Inflate 2.004 ;';
- eval ' use IO::Uncompress::RawInflate 2.004 ;';
- eval ' use IO::Uncompress::Unzip 2.004 ;';
- eval ' use IO::Uncompress::UnLzf 2.004 ;';
+ eval ' use IO::Uncompress::Adapter::Inflate 2.005 ;';
+ eval ' use IO::Uncompress::Adapter::Bunzip2 2.005 ;';
+ eval ' use IO::Uncompress::Adapter::LZO 2.005 ;';
+ eval ' use IO::Uncompress::Adapter::Lzf 2.005 ;';
+
+ eval ' use IO::Uncompress::Bunzip2 2.005 ;';
+ eval ' use IO::Uncompress::UnLzop 2.005 ;';
+ eval ' use IO::Uncompress::Gunzip 2.005 ;';
+ eval ' use IO::Uncompress::Inflate 2.005 ;';
+ eval ' use IO::Uncompress::RawInflate 2.005 ;';
+ eval ' use IO::Uncompress::Unzip 2.005 ;';
+ eval ' use IO::Uncompress::UnLzf 2.005 ;';
}
sub new
sub getExtraParams
{
- use IO::Compress::Base::Common 2.004 qw(:Parse);
+ use IO::Compress::Base::Common 2.005 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
use bytes;
our (@ISA, $VERSION, @EXPORT_OK, %EXPORT_TAGS);
-#@ISA = qw(Exporter IO::File);
-@ISA = qw(Exporter );
+@ISA = qw(Exporter IO::File);
-$VERSION = '2.004';
+$VERSION = '2.005';
use constant G_EOF => 0 ;
use constant G_ERR => -1 ;
-use IO::Compress::Base::Common 2.004 ;
+use IO::Compress::Base::Common 2.005 ;
#use Parse::Parameters ;
use IO::File ;
my $self = shift ;
return G_EOF if *$self->{Closed} ;
- return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ;
my $buffer ;
- #$self->croakError(*$self->{ClassName} .
- # "::read: buffer parameter is read-only")
- # if Compress::Raw::Zlib::_readonly_ref($_[0]);
-
if (ref $_[0] ) {
$self->croakError(*$self->{ClassName} . "::read: buffer parameter is read-only")
if readonly(${ $_[0] });
my $length = $_[1] ;
my $offset = $_[2] || 0;
+ if (! *$self->{AppendOutput}) {
+ if (! $offset) {
+ $$buffer = '' ;
+ }
+ else {
+ if ($offset > length($$buffer)) {
+ $$buffer .= "\x00" x ($offset - length($$buffer));
+ }
+ else {
+ substr($$buffer, $offset) = '';
+ }
+ }
+ }
+
+ return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ;
+
# the core read will return 0 if asked for 0 bytes
return 0 if defined $length && $length == 0 ;
$self->croakError(*$self->{ClassName} . "::read: length parameter is negative")
if $length < 0 ;
- $$buffer = '' unless *$self->{AppendOutput} || $offset ;
-
# Short-circuit if this is a simple read, with no length
# or offset specified.
unless ( $length || $offset) {
# or both are specified.
my $out_buffer = *$self->{Pending} ;
+
while (! *$self->{EndStream} && length($out_buffer) < $length)
{
my $buf_len = $self->_raw_read(\$out_buffer);
return 0
if $length == 0 ;
+ $$buffer = ''
+ if ! defined $$buffer;
+
+ $offset = length $$buffer
+ if *$self->{AppendOutput} ;
+
*$self->{Pending} = $out_buffer;
$out_buffer = \*$self->{Pending} ;
- if ($offset) {
- $$buffer .= "\x00" x ($offset - length($$buffer))
- if $offset > length($$buffer) ;
- #substr($$buffer, $offset) = substr($$out_buffer, 0, $length, '') ;
- substr($$buffer, $offset) = substr($$out_buffer, 0, $length) ;
- substr($$out_buffer, 0, $length) = '' ;
- }
- else {
- #$$buffer .= substr($$out_buffer, 0, $length, '') ;
- $$buffer .= substr($$out_buffer, 0, $length) ;
- substr($$out_buffer, 0, $length) = '' ;
- }
+ #substr($$buffer, $offset) = substr($$out_buffer, 0, $length, '') ;
+ substr($$buffer, $offset) = substr($$out_buffer, 0, $length) ;
+ substr($$out_buffer, 0, $length) = '' ;
return $length ;
}
CHANGES
-------
+ 2.005 18 June 2007
+
+ * IO::Compress::Gzip & IO::Uncompress::Gunzip
+
+ - RFC1952 says that the FNAME & FCOMMENT header fields must be ISO
+ 8859-1 (LATIN-1) characters. The code can optionally police this.
+ Added a fix for this logic when running on EBCDIC.
+
+ * Makefile.PL
+
+ - Check if IO::Compress::Bzip2 is already installed. If it is, add
+ to the PREREQ_PM list.
+
2.004 3 March 2007
* IO::Compress::Zip
use strict ;
require 5.004 ;
-$::VERSION = '2.004' ;
+$::VERSION = '2.005' ;
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
UpDowngrade(getPerlFiles('MANIFEST'))
unless $ENV{PERL_CORE};
+my @MainPREREQ = qw(Compress::Raw::Zlib
+ IO::Compress::Base
+ IO::Uncompress::Base
+ );
+
+# Bzip2 is an option prereq.
+push @MainPREREQ, qw(IO::Compress::Bzip2 IO::Uncompress::Bunzip2)
+ if eval { require IO::Compress::Bzip2; };
+
+my %MainPREREQ = map { $_ => $::VERSION } @MainPREREQ;
+
+
WriteMakefile(
NAME => 'IO::Compress::Zlib',
VERSION_FROM => 'lib/IO/Compress/Gzip.pm',
(
$ENV{SKIP_FOR_CORE}
? (MAN3PODS => {})
- : (PREREQ_PM => { 'Compress::Raw::Zlib' => $::VERSION,
- 'IO::Compress::Base' => $::VERSION,
- 'IO::Uncompress::Base' => $::VERSION,
+ : (PREREQ_PM => { %MainPREREQ,
$] >= 5.005 && $] < 5.006
? ('File::BSDGlob' => 0)
: () }
IO::Compress::Zlib
- Version 2.004
+ Version 2.005
- 3rd March 2007
+ 18th June 2007
Copyright (c) 2005-2007 Paul Marquess. All rights reserved.
use strict;
use warnings;
+use File::Path;
+use File::Basename;
use IO::File;
-use IO::Uncompress::RawInflate qw(rawinflate $RawInflateError);
+use IO::Uncompress::RawInflate qw(:all);
-die "Usage: zipcat file"
+
+die "Usage: zipcat file\n"
if @ARGV != 1 ;
my $file = $ARGV[0] ;
warn "Writing file '$filename' $compressedMethod\n";
- mkpath basename $filename;
+ #mkpath dirname $filename;
- rawinflate $fh => $filename,
+ #rawinflate $fh => $filename,
+ rawinflate $fh => '-',
Transparent => 1,
InputLength => $compressedLength
or die "Error uncompressing $file [$filename]: $RawInflateError\n" ;
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.004 qw(:Status);
+use IO::Compress::Base::Common 2.005 qw(:Status);
-use Compress::Raw::Zlib 2.004 qw(Z_OK Z_FINISH MAX_WBITS) ;
+use Compress::Raw::Zlib 2.005 qw(Z_OK Z_FINISH MAX_WBITS) ;
our ($VERSION);
-$VERSION = '2.004';
+$VERSION = '2.005';
sub mkCompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.004 qw(:Status);
+use IO::Compress::Base::Common 2.005 qw(:Status);
our ($VERSION);
-$VERSION = '2.004';
+$VERSION = '2.005';
sub mkCompObject
{
require Exporter ;
-use IO::Compress::RawDeflate 2.004 ;
+use IO::Compress::RawDeflate 2.005 ;
-use Compress::Raw::Zlib 2.004 ;
-use IO::Compress::Zlib::Constants 2.004 ;
-use IO::Compress::Base::Common 2.004 qw(createSelfTiedObject);
+use Compress::Raw::Zlib 2.005 ;
+use IO::Compress::Zlib::Constants 2.005 ;
+use IO::Compress::Base::Common 2.005 qw(createSelfTiedObject);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $DeflateError);
-$VERSION = '2.004';
+$VERSION = '2.005';
$DeflateError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
use bytes;
-use IO::Compress::RawDeflate 2.004 ;
+use IO::Compress::RawDeflate 2.005 ;
-use Compress::Raw::Zlib 2.004 ;
-use IO::Compress::Base::Common 2.004 qw(:Status :Parse createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.004 ;
-use IO::Compress::Zlib::Extra 2.004 ;
+use Compress::Raw::Zlib 2.005 ;
+use IO::Compress::Base::Common 2.005 qw(:Status :Parse createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.005 ;
+use IO::Compress::Zlib::Extra 2.005 ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
-$VERSION = '2.004';
+$VERSION = '2.005';
$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.004';
+$VERSION = '2.005';
@ISA = qw(Exporter);
use bytes;
-use IO::Compress::Base 2.004 ;
-use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
-use IO::Compress::Adapter::Deflate 2.004 ;
+use IO::Compress::Base 2.005 ;
+use IO::Compress::Base::Common 2.005 qw(:Status createSelfTiedObject);
+use IO::Compress::Adapter::Deflate 2.005 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError);
-$VERSION = '2.004';
+$VERSION = '2.005';
$RawDeflateError = '';
@ISA = qw(Exporter IO::Compress::Base);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.004 qw(:Parse);
- use Compress::Raw::Zlib 2.004 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.005 qw(:Parse);
+ use Compress::Raw::Zlib 2.005 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
return (
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
-use IO::Compress::RawDeflate 2.004 ;
-use IO::Compress::Adapter::Deflate 2.004 ;
-use IO::Compress::Adapter::Identity 2.004 ;
-use IO::Compress::Zlib::Extra 2.004 ;
-use IO::Compress::Zip::Constants 2.004 ;
+use IO::Compress::Base::Common 2.005 qw(:Status createSelfTiedObject);
+use IO::Compress::RawDeflate 2.005 ;
+use IO::Compress::Adapter::Deflate 2.005 ;
+use IO::Compress::Adapter::Identity 2.005 ;
+use IO::Compress::Zlib::Extra 2.005 ;
+use IO::Compress::Zip::Constants 2.005 ;
-use Compress::Raw::Zlib 2.004 qw(crc32) ;
+use Compress::Raw::Zlib 2.005 qw(crc32) ;
BEGIN
{
eval { require IO::Compress::Adapter::Bzip2 ;
- import IO::Compress::Adapter::Bzip2 2.004 ;
+ import IO::Compress::Adapter::Bzip2 2.005 ;
require IO::Compress::Bzip2 ;
- import IO::Compress::Bzip2 2.004 ;
+ import IO::Compress::Bzip2 2.005 ;
} ;
}
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $ZipError);
-$VERSION = '2.004';
+$VERSION = '2.005';
$ZipError = '';
@ISA = qw(Exporter IO::Compress::RawDeflate);
{
my $self = shift ;
- use IO::Compress::Base::Common 2.004 qw(:Parse);
- use Compress::Raw::Zlib 2.004 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
+ use IO::Compress::Base::Common 2.005 qw(:Parse);
+ use Compress::Raw::Zlib 2.005 qw(Z_DEFLATED Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY);
my @Bzip2 = ();
our ($VERSION, @ISA, @EXPORT, %ZIP_CM_MIN_VERSIONS);
-$VERSION = '2.004';
+$VERSION = '2.005';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT);
-$VERSION = '2.004';
+$VERSION = '2.005';
@ISA = qw(Exporter);
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.004';
+$VERSION = '2.005';
-use IO::Compress::Gzip::Constants 2.004 ;
+use IO::Compress::Gzip::Constants 2.005 ;
sub ExtraFieldError
{
use strict;
use bytes;
-use IO::Compress::Base::Common 2.004 qw(:Status);
+use IO::Compress::Base::Common 2.005 qw(:Status);
our ($VERSION);
-$VERSION = '2.004';
+$VERSION = '2.005';
-use Compress::Raw::Zlib 2.004 ();
+use Compress::Raw::Zlib 2.005 ();
sub mkUncompObject
{
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.004 qw(:Status);
-use Compress::Raw::Zlib 2.004 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
+use IO::Compress::Base::Common 2.005 qw(:Status);
+use Compress::Raw::Zlib 2.005 qw(Z_OK Z_DATA_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
our ($VERSION);
-$VERSION = '2.004';
+$VERSION = '2.005';
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.004 qw(createSelfTiedObject);
+use IO::Compress::Base::Common 2.005 qw(createSelfTiedObject);
-use IO::Uncompress::Adapter::Inflate 2.004 ();
+use IO::Uncompress::Adapter::Inflate 2.005 ();
-use IO::Uncompress::Base 2.004 ;
-use IO::Uncompress::Gunzip 2.004 ;
-use IO::Uncompress::Inflate 2.004 ;
-use IO::Uncompress::RawInflate 2.004 ;
-use IO::Uncompress::Unzip 2.004 ;
+use IO::Uncompress::Base 2.005 ;
+use IO::Uncompress::Gunzip 2.005 ;
+use IO::Uncompress::Inflate 2.005 ;
+use IO::Uncompress::RawInflate 2.005 ;
+use IO::Uncompress::Unzip 2.005 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $AnyInflateError);
-$VERSION = '2.004';
+$VERSION = '2.005';
$AnyInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
sub getExtraParams
{
- use IO::Compress::Base::Common 2.004 qw(:Parse);
+ use IO::Compress::Base::Common 2.005 qw(:Parse);
return ( 'RawInflate' => [1, 1, Parse_boolean, 0] ) ;
}
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.004 ;
+use IO::Uncompress::RawInflate 2.005 ;
-use Compress::Raw::Zlib 2.004 qw( crc32 ) ;
-use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.004 ;
-use IO::Compress::Zlib::Extra 2.004 ;
+use Compress::Raw::Zlib 2.005 qw( crc32 ) ;
+use IO::Compress::Base::Common 2.005 qw(:Status createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.005 ;
+use IO::Compress::Zlib::Extra 2.005 ;
require Exporter ;
$GunzipError = '';
-$VERSION = '2.004';
+$VERSION = '2.005';
sub new
{
sub getExtraParams
{
- use IO::Compress::Base::Common 2.004 qw(:Parse);
+ use IO::Compress::Base::Common 2.005 qw(:Parse);
return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
}
use warnings;
use bytes;
-use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
-use IO::Compress::Zlib::Constants 2.004 ;
+use IO::Compress::Base::Common 2.005 qw(:Status createSelfTiedObject);
+use IO::Compress::Zlib::Constants 2.005 ;
-use IO::Uncompress::RawInflate 2.004 ;
+use IO::Uncompress::RawInflate 2.005 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
-$VERSION = '2.004';
+$VERSION = '2.005';
$InflateError = '';
@ISA = qw( Exporter IO::Uncompress::RawInflate );
use warnings;
use bytes;
-use Compress::Raw::Zlib 2.004 ;
-use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
+use Compress::Raw::Zlib 2.005 ;
+use IO::Compress::Base::Common 2.005 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Base 2.004 ;
-use IO::Uncompress::Adapter::Inflate 2.004 ;
+use IO::Uncompress::Base 2.005 ;
+use IO::Uncompress::Adapter::Inflate 2.005 ;
require Exporter ;
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
-$VERSION = '2.004';
+$VERSION = '2.005';
$RawInflateError = '';
@ISA = qw( Exporter IO::Uncompress::Base );
use warnings;
use bytes;
-use IO::Uncompress::RawInflate 2.004 ;
-use IO::Compress::Base::Common 2.004 qw(:Status createSelfTiedObject);
-use IO::Uncompress::Adapter::Identity 2.004 ;
-use IO::Compress::Zlib::Extra 2.004 ;
-use IO::Compress::Zip::Constants 2.004 ;
+use IO::Uncompress::RawInflate 2.005 ;
+use IO::Compress::Base::Common 2.005 qw(:Status createSelfTiedObject);
+use IO::Uncompress::Adapter::Identity 2.005 ;
+use IO::Compress::Zlib::Extra 2.005 ;
+use IO::Compress::Zip::Constants 2.005 ;
-use Compress::Raw::Zlib 2.004 qw(crc32) ;
+use Compress::Raw::Zlib 2.005 qw(crc32) ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnzipError, %headerLookup);
-$VERSION = '2.004';
+$VERSION = '2.005';
$UnzipError = '';
@ISA = qw(Exporter IO::Uncompress::RawInflate);
sub getExtraParams
{
- use IO::Compress::Base::Common 2.004 qw(:Parse);
+ use IO::Compress::Base::Common 2.005 qw(:Parse);
return (
ok $hdr->{TextFlag} ;
ok ! defined $hdr->{HeaderCRC} ;
is $hdr->{OsID}, $ThisOS_code ;
-
}
{
writeFile($name, $good) ;
ok my $gunz = new IO::Uncompress::Gunzip $name,
+ -Append => 1,
-Strict => 1;
my $uncomp ;
1 while $gunz->read($uncomp) > 0 ;
ok $def->close ;
#print "ReadHeaderInfo\n"; hexDump(\$buffer);
- ok my $inf = new IO::Uncompress::Inflate \$buffer ;
+ ok my $inf = new IO::Uncompress::Inflate \$buffer, Append => 1 ;
my $uncomp ;
#ok $inf->read($uncomp) ;
my $actual = 0 ;
cmp_ok $def->flush($buffer), '==', Z_OK;
#print "ReadHeaderInfoZlib\n"; hexDump(\$buffer);
- ok my $inf = new IO::Uncompress::Inflate \$buffer ;
+ ok my $inf = new IO::Uncompress::Inflate \$buffer, Append => 1 ;
my $uncomp ;
#ok $inf->read($uncomp) ;
my $actual = 0 ;
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use strict;
+use warnings;
+
+use IO::Compress::Deflate qw($DeflateError) ;
+use IO::Uncompress::Inflate qw($InflateError) ;
+
+sub identify
+{
+ 'IO::Compress::Deflate';
+}
+
+require "encode.pl" ;
+run();
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use strict;
+use warnings;
+
+use IO::Compress::Gzip qw($GzipError) ;
+use IO::Uncompress::Gunzip qw($GunzipError) ;
+
+sub identify
+{
+ 'IO::Compress::Gzip';
+}
+
+require "encode.pl" ;
+run();
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use strict;
+use warnings;
+
+use IO::Compress::RawDeflate qw($RawDeflateError) ;
+use IO::Uncompress::RawInflate qw($RawInflateError) ;
+
+sub identify
+{
+ 'IO::Compress::RawDeflate';
+}
+
+require "encode.pl" ;
+run();
--- /dev/null
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = ("../lib", "lib/compress");
+ }
+}
+
+use lib qw(t t/compress);
+use strict;
+use warnings;
+
+use IO::Compress::Zip qw($ZipError) ;
+use IO::Uncompress::Unzip qw($UnzipError) ;
+
+sub identify
+{
+ 'IO::Compress::Zip';
+}
+
+require "encode.pl" ;
+run();
--- /dev/null
+
+use strict;
+use warnings;
+use bytes;
+
+use Test::More ;
+use CompTestUtils;
+
+BEGIN
+{
+ plan skip_all => "Encode is not available"
+ if $] < 5.006 ;
+
+ eval { require Encode; Encode->import(); };
+
+ plan skip_all => "Encode is not available"
+ if $@ ;
+
+ # use Test::NoWarnings, if available
+ my $extra = 0 ;
+
+ my $st = eval { require Test::NoWarnings ; import Test::NoWarnings; 1; };
+ $extra = 1
+ if $st ;
+
+ plan(tests => 7 + $extra) ;
+}
+
+sub run
+{
+ my $CompressClass = identify();
+ my $UncompressClass = getInverse($CompressClass);
+ my $Error = getErrorRef($CompressClass);
+ my $UnError = getErrorRef($UncompressClass);
+
+
+ my $string = "\x{df}\x{100}";
+ my $encString = Encode::encode_utf8($string);
+ my $buffer = $encString;
+
+ #for my $from ( qw(filename filehandle buffer) )
+ {
+# my $input ;
+# my $lex = new LexFile my $name ;
+#
+#
+# if ($from eq 'buffer')
+# { $input = \$buffer }
+# elsif ($from eq 'filename')
+# {
+# $input = $name ;
+# writeFile($name, $buffer);
+# }
+# elsif ($from eq 'filehandle')
+# {
+# $input = new IO::File "<$name" ;
+# }
+
+ for my $to ( qw(filehandle buffer))
+ {
+ title "OO Mode: To $to, Encode by hand";
+
+ my $lex2 = new LexFile my $name2 ;
+ my $output;
+ my $buffer;
+
+ if ($to eq 'buffer')
+ { $output = \$buffer }
+ elsif ($to eq 'filename')
+ {
+ $output = $name2 ;
+ }
+ elsif ($to eq 'filehandle')
+ {
+ $output = new IO::File ">$name2" ;
+ }
+
+
+ my $out ;
+ my $cs = new $CompressClass($output, AutoClose =>1);
+ $cs->print($encString);
+ $cs->close();
+
+ my $input;
+ if ($to eq 'buffer')
+ { $input = \$buffer }
+ else
+ {
+ $input = $name2 ;
+ }
+
+ my $ucs = new $UncompressClass($input, Append => 1);
+ my $got;
+ 1 while $ucs->read($got) > 0 ;
+ my $decode = Encode::decode_utf8($got);
+
+
+ is $string, $decode, " Expected output";
+
+
+ }
+ }
+
+ {
+ title "Catch wide characters";
+
+ my $out;
+ my $cs = new $CompressClass(\$out);
+ my $a = "a\xFF\x{100}";
+ eval { $cs->syswrite($a) };
+ like($@, qr/Wide character in ${CompressClass}::write/,
+ " wide characters in ${CompressClass}::write");
+ eval { syswrite($cs, $a) };
+ like($@, qr/Wide character in ${CompressClass}::write/,
+ " wide characters in ${CompressClass}::write");
+ }
+
+}
+
+
+
+1;
+
$extra = 1
if $st ;
- plan(tests => 641 + $extra) ;
+ plan(tests => 670 + $extra) ;
}
sub myGZreadFile
eval { $io->read(1) } ;
like $@, mkErr("buffer parameter is read-only");
+ $buf = "abcd";
is $io->read($buf, 0), 0, "Requested 0 bytes" ;
+ is $buf, "", "Buffer empty";
is $io->read($buf, 3), 3 ;
is $buf, "Thi";
or print "# [$buf]\n" ;;
ok ! $io->eof;
+ $buf = "ab" ;
+ is $io->read($buf, 3, 4), 3 ;
+ is $buf, "ab" . "\x00" x 2 . "s a"
+ or print "# [$buf]\n" ;;
+ ok ! $io->eof;
+
+ # read the rest of the file
+ $buf = '';
+ my $remain = length($str) - 9;
+ is $io->read($buf, $remain+1), $remain ;
+ is $buf, substr($str, 9);
+ ok $io->eof;
+
+ $buf = "hello";
+ is $io->read($buf, 10), 0 ;
+ is $buf, "", "Buffer empty";
+ ok $io->eof;
+
+ ok $io->close();
+ $buf = "hello";
+ is $io->read($buf, 10), 0 ;
+ is $buf, "hello", "Buffer not empty";
+ ok $io->eof;
+
# $io->seek(-4, 2);
#
# ok ! $io->eof;
}
- # Test read
+ # Test Read
{
my $io = $UncompressClass->new($name);
+ $buf = "abcd";
+ is $io->read($buf, 0), 0, "Requested 0 bytes" ;
+ is $buf, "", "Buffer empty";
+
ok $io->read($buf, 3) == 3 ;
ok $buf eq "Thi";
ok $buf eq "Ths i";
ok ! $io->eof;
+ $buf = "ab" ;
+ is $io->read($buf, 3, 4), 3 ;
+ is $buf, "ab" . "\x00" x 2 . "s a"
+ or print "# [$buf]\n" ;;
+ ok ! $io->eof;
+
+ # read the rest of the file
+ $buf = '';
+ my $remain = length($str) - 9;
+ is $io->read($buf, $remain), $remain ;
+ is $buf, substr($str, 9);
+ ok $io->eof;
+
+ $buf = "hello";
+ is $io->read($buf, 10), 0 ;
+ is $buf, "", "Buffer empty";
+ ok $io->eof;
+
+ ok $io->close();
+ $buf = "hello";
+ is $io->read($buf, 10), 0 ;
+ is $buf, "hello", "Buffer not empty";
+ ok $io->eof;
+
# $io->seek(-4, 2);
#
# ok ! $io->eof;
like $@, mkErr("^$TopType: unknown key value\\(s\\) Fred"), ' Illegal Parameters';
eval { $a = $Func->() ;} ;
- like $@, mkErr("^$TopType: expected at least 1 parameters"), ' No Parameters';
+ like $@, "/^$TopType: expected at least 1 parameters/", ' No Parameters';
eval { $a = $Func->(\$x, \1) ;} ;
like $$Error, "/^$TopType: output buffer is read-only/", ' Output is read-only' ;
{
my $io = new $UncompressClass $name ;
- ok ! $io->eof;
- is $io->tell(), 0 ;
+ ok ! $io->eof, " Not EOF";
+ is $io->tell(), 0, " Tell is 0" ;
my @lines = <$io>;
- is @lines, 6
+ is @lines, 6, " Line is 6"
or print "# Got " . scalar(@lines) . " lines, expected 6\n" ;
is $lines[1], "of a paragraph\n" ;
is join('', @lines), $str ;