diff options
Diffstat (limited to 'cpan')
-rw-r--r-- | cpan/Compress-Raw-Zlib/Makefile.PL | 85 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/config.in | 6 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm | 171 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/private/MakeUtil.pm | 22 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/t/01version.t | 13 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/t/07bufsize.t | 36 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/t/09limitoutput.t | 59 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/t/18lvalue.t | 22 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/t/19nonpv.t | 33 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm | 52 | ||||
-rw-r--r-- | cpan/Compress-Raw-Zlib/typemap | 3 |
11 files changed, 245 insertions, 257 deletions
diff --git a/cpan/Compress-Raw-Zlib/Makefile.PL b/cpan/Compress-Raw-Zlib/Makefile.PL index 67c28d606f..60fc874280 100644 --- a/cpan/Compress-Raw-Zlib/Makefile.PL +++ b/cpan/Compress-Raw-Zlib/Makefile.PL @@ -32,7 +32,7 @@ my $ZLIB_LIBRARY_NAME = $^O eq 'MSWin32' ? 'zlib' : 'z' ; # ExtUtils::Install. # Don't ask if MM_USE_DEFAULT is set -- enables perl core building on cygwin -if ($^O =~ /cygwin/i and $ExtUtils::Install::VERSION < 1.39 +if ($^O =~ /cygwin/i and $ExtUtils::Install::VERSION < 1.39 and not ($ENV{PERL_MM_USE_DEFAULT} or $ENV{PERL_CORE})) { print <<EOM ; @@ -55,7 +55,7 @@ EOM if ($answer =~ /^yes|y/i) { - print "continuing...\n" + print "continuing...\n" } else { @@ -68,10 +68,10 @@ EOM ParseCONFIG() ; -UpDowngrade(getPerlFiles('MANIFEST')) +UpDowngrade(getPerlFiles('MANIFEST')) unless $ENV{PERL_CORE}; -WriteMakefile( +WriteMakefile( NAME => 'Compress::Raw::Zlib', VERSION_FROM => 'lib/Compress/Raw/Zlib.pm', INC => "-I$ZLIB_INCLUDE" , @@ -79,7 +79,7 @@ WriteMakefile( XS => { 'Zlib.xs' => 'Zlib.c'}, 'depend' => { 'Makefile' => 'config.in' }, 'clean' => { FILES => '*.c constants.h constants.xs' }, - 'dist' => { COMPRESS => 'gzip', + 'dist' => { COMPRESS => 'gzip', TARFLAGS => '-chvf', SUFFIX => 'gz', DIST_DEFAULT => 'MyTrebleCheck tardist', @@ -94,9 +94,9 @@ WriteMakefile( INSTALLDIRS => ($] >= 5.009 && $] < 5.011 ? 'perl' : 'site'), - ( eval { ExtUtils::MakeMaker->VERSION(6.46) } + ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? ( META_MERGE => { - + "meta-spec" => { version => 2 }, no_index => { @@ -104,7 +104,7 @@ WriteMakefile( }, resources => { - + bugtracker => { web => 'https://github.com/pmqs/Compress-Raw-Zlib/issues' }, @@ -115,15 +115,15 @@ WriteMakefile( type => 'git', url => 'git://github.com/pmqs/Compress-Raw-Zlib.git', web => 'https://github.com/pmqs/Compress-Raw-Zlib', - }, + }, }, - } - ) + } + ) : () ), ((ExtUtils::MakeMaker->VERSION() gt '6.30') ? - ('LICENSE' => 'perl') : ()), + ('LICENSE' => 'perl') : ()), ) ; @@ -201,13 +201,13 @@ if (eval {require ExtUtils::Constant; 1}) { die "The following names are missing from \@EXPORT in Zlib.pm\n" . "\t$missing\n" ; } - + push @names, { name => 'ZLIB_VERSION', type => 'PV' }; - - push @names, map { { name => $_, - macro => version_Macro $verSpecificNames{$_} - } - } + + push @names, map { { name => $_, + macro => version_Macro $verSpecificNames{$_} + } + } keys %verSpecificNames ; ExtUtils::Constant::WriteConstants( @@ -215,10 +215,10 @@ if (eval {require ExtUtils::Constant; 1}) { NAMES => \@names, C_FILE => 'constants.h', XS_FILE => 'constants.xs', - + ); -} +} else { foreach my $name (qw( constants.h constants.xs )) { @@ -263,14 +263,14 @@ sub ParseCONFIG # check parsed values my @missing = () ; - die "The following keys are missing from $CONFIG [@missing]\n" + die "The following keys are missing from $CONFIG [@missing]\n" if @missing = keys %Parsed ; $ZLIB_INCLUDE = defined $ENV{'ZLIB_INCLUDE'} - ? $ENV{'ZLIB_INCLUDE'} + ? $ENV{'ZLIB_INCLUDE'} : $Info{'INCLUDE'} ; - $ZLIB_LIB = defined $ENV{'ZLIB_LIB'} - ?$ENV{'ZLIB_LIB'} + $ZLIB_LIB = defined $ENV{'ZLIB_LIB'} + ?$ENV{'ZLIB_LIB'} : $Info{'LIB'} ; if ($^O eq 'VMS') { @@ -279,19 +279,19 @@ sub ParseCONFIG } my $y = defined $ENV{'OLD_ZLIB'} - ? $ENV{'OLD_ZLIB'} + ? $ENV{'OLD_ZLIB'} : $Info{'OLD_ZLIB'} ; $OLD_ZLIB = '-DOLD_ZLIB' if $y and $y =~ /^yes|on|true|1$/i; - my $x = defined $ENV{'BUILD_ZLIB'} - ? $ENV{'BUILD_ZLIB'} + my $x = defined $ENV{'BUILD_ZLIB'} + ? $ENV{'BUILD_ZLIB'} : $Info{'BUILD_ZLIB'} ; if ($x and $x =~ /^yes|on|true|1$/i ) { $BUILD_ZLIB = 1 ; - # ZLIB_LIB & ZLIB_INCLUDE must point to the same place when + # ZLIB_LIB & ZLIB_INCLUDE must point to the same place when # BUILD_ZLIB is specified. die "INCLUDE & LIB must be the same when BUILD_ZLIB is True\n" if $ZLIB_LIB ne $ZLIB_INCLUDE ; @@ -309,8 +309,8 @@ sub ParseCONFIG print "Building Zlib enabled\n" ; } - $GZIP_OS_CODE = defined $ENV{'GZIP_OS_CODE'} - ? $ENV{'GZIP_OS_CODE'} + $GZIP_OS_CODE = defined $ENV{'GZIP_OS_CODE'} + ? $ENV{'GZIP_OS_CODE'} : $Info{'GZIP_OS_CODE'} ; die "GZIP_OS_CODE not 'AUTO_DETECT' or a number between 0 and 255\n" @@ -322,7 +322,7 @@ sub ParseCONFIG print "Auto Detect Gzip OS Code..\n" ; $GZIP_OS_CODE = getOSCode() ; } - + my $name = getOSname($GZIP_OS_CODE); print "Setting Gzip OS Code to $GZIP_OS_CODE [$name]\n" ; @@ -347,22 +347,22 @@ sub zlib_files my @h_files = (); my @c_files = (); - + if (-f catfile($dir, "infback.c")) { # zlib 1.2.0 or greater # - @h_files = qw(crc32.h inffast.h inflate.h trees.h zconf.in.h - zutil.h deflate.h inffixed.h inftrees.h zconf.h - zlib.h + @h_files = qw(crc32.h inffast.h inflate.h trees.h zconf.in.h + zutil.h deflate.h inffixed.h inftrees.h zconf.h + zlib.h ); @c_files = qw(adler32 crc32 infback inflate uncompr - compress deflate inffast inftrees - trees zutil + compress deflate inffast inftrees + trees zutil ); } else { # zlib 1.1.x - + @h_files = qw(deflate.h infcodes.h inftrees.h zconf.h zutil.h infblock.h inffast.h infutil.h zlib.h ); @@ -371,20 +371,20 @@ sub zlib_files inftrees infcodes infutil inffast ); } - + @h_files = map { catfile($dir, $_) } @h_files ; my @o_files = map { "$_\$(OBJ_EXT)" } 'Zlib', @c_files; @c_files = map { "$_.c" } 'Zlib', @c_files ; foreach my $file (@c_files) { copy(catfile($dir, $file), '.') } - + return ( #'H' => [ @h_files ], 'C' => [ @c_files ] , #'OBJECT' => qq[ @o_files ], 'OBJECT' => q[ $(O_FILES) ], - + ) ; } @@ -418,7 +418,7 @@ BEGIN [ '' => 255, 'Unknown OS' ], ); - %OSnames = map { $$_[1] => $$_[2] } + %OSnames = map { $$_[1] => $$_[2] } @GZIP_OS_Names ; } @@ -447,4 +447,3 @@ sub getOSname } # end of file Makefile.PL - diff --git a/cpan/Compress-Raw-Zlib/config.in b/cpan/Compress-Raw-Zlib/config.in index d6701ffb0c..fa998b53db 100644 --- a/cpan/Compress-Raw-Zlib/config.in +++ b/cpan/Compress-Raw-Zlib/config.in @@ -3,11 +3,11 @@ # written by Paul Marquess <pmqs@cpan.org> # last modified 28th October 2003 # version 2.000 -# -# +# +# # This file is used to control which zlib library will be used by # Compress::Zlib -# +# # See to the sections below in the README file for details of how to # use this file. # diff --git a/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm b/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm index 59cda238e2..df50ea3142 100644 --- a/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm +++ b/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm @@ -10,12 +10,12 @@ use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD, %DEFLATE_CONSTANTS, @DEFLATE_CONSTANTS); -$VERSION = '2.096'; -$XS_VERSION = $VERSION; +$VERSION = '2.100'; +$XS_VERSION = $VERSION; $VERSION = eval $VERSION; @ISA = qw(Exporter); -%EXPORT_TAGS = ( flush => [qw{ +%EXPORT_TAGS = ( flush => [qw{ Z_NO_FLUSH Z_PARTIAL_FLUSH Z_SYNC_FLUSH @@ -23,30 +23,30 @@ $VERSION = eval $VERSION; Z_FINISH Z_BLOCK }], - level => [qw{ + level => [qw{ Z_NO_COMPRESSION Z_BEST_SPEED Z_BEST_COMPRESSION Z_DEFAULT_COMPRESSION }], - strategy => [qw{ + strategy => [qw{ Z_FILTERED Z_HUFFMAN_ONLY Z_RLE Z_FIXED Z_DEFAULT_STRATEGY }], - status => [qw{ + status => [qw{ Z_OK Z_STREAM_END Z_NEED_DICT Z_ERRNO Z_STREAM_ERROR - Z_DATA_ERROR - Z_MEM_ERROR - Z_BUF_ERROR - Z_VERSION_ERROR - }], + Z_DATA_ERROR + Z_MEM_ERROR + Z_BUF_ERROR + Z_VERSION_ERROR + }], ); %DEFLATE_CONSTANTS = %EXPORT_TAGS; @@ -54,12 +54,12 @@ $VERSION = eval $VERSION; # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. -@DEFLATE_CONSTANTS = +@DEFLATE_CONSTANTS = @EXPORT = qw( ZLIB_VERSION ZLIB_VERNUM - + OS_CODE MAX_MEM_LEVEL @@ -125,13 +125,13 @@ eval { require XSLoader; XSLoader::load('Compress::Raw::Zlib', $XS_VERSION); 1; -} +} or do { require DynaLoader; local @ISA = qw(DynaLoader); - bootstrap Compress::Raw::Zlib $XS_VERSION ; + bootstrap Compress::Raw::Zlib $XS_VERSION ; }; - + use constant Parse_any => 0x01; use constant Parse_unsigned => 0x02; @@ -153,7 +153,7 @@ use constant OFF_STICKY => 5 ; sub ParseParameters { - my $level = shift || 0 ; + my $level = shift || 0 ; my $sub = (caller($level + 1))[3] ; #local $Carp::CarpLevel = 1 ; @@ -186,13 +186,13 @@ sub Compress::Raw::Zlib::Parameters::setError $self->{Error} = $error ; return $retval; } - + #sub getError #{ # my $self = shift ; # return $self->{Error} ; #} - + sub Compress::Raw::Zlib::Parameters::parse { my $self = shift ; @@ -211,10 +211,10 @@ sub Compress::Raw::Zlib::Parameters::parse @entered = () ; } elsif (@_ == 1) { - my $href = $_[0] ; + my $href = $_[0] ; return $self->setError("Expected even number of parameters, got 1") if ! defined $href or ! ref $href or ref $href ne "HASH" ; - + foreach my $key (keys %$href) { push @entered, $key ; push @entered, \$href->{$key} ; @@ -224,7 +224,7 @@ sub Compress::Raw::Zlib::Parameters::parse my $count = @_; return $self->setError("Expected even number of parameters, got $count") if $count % 2 != 0 ; - + for my $i (0.. $count / 2 - 1) { push @entered, $_[2* $i] ; push @entered, \$_[2* $i+1] ; @@ -239,7 +239,7 @@ sub Compress::Raw::Zlib::Parameters::parse my ($first_only, $sticky, $type, $value) = @$v ; my $x ; - $self->_checkType($key, \$value, $type, 0, \$x) + $self->_checkType($key, \$value, $type, 0, \$x) or return undef ; $key = lc $key; @@ -260,7 +260,7 @@ sub Compress::Raw::Zlib::Parameters::parse $key =~ s/^-// ; my $canonkey = lc $key; - + if ($got->{$canonkey} && ($firstTime || ! $got->{$canonkey}[OFF_FIRST_ONLY] )) { @@ -275,7 +275,7 @@ sub Compress::Raw::Zlib::Parameters::parse else { push (@Bad, $key) } } - + if (@Bad) { my ($bad) = join(", ", @Bad) ; return $self->setError("unknown key value(s) @Bad") ; @@ -319,7 +319,7 @@ sub Compress::Raw::Zlib::Parameters::_checkType return $self->setError("Parameter '$key' must be an unsigned int, got '$value'") if $validate && $value !~ /^\d+$/; - $$output = defined $value ? $value : 0 ; + $$output = defined $value ? $value : 0 ; return 1; } elsif ($type & Parse_signed) @@ -329,19 +329,19 @@ sub Compress::Raw::Zlib::Parameters::_checkType return $self->setError("Parameter '$key' must be a signed int, got '$value'") if $validate && $value !~ /^-?\d+$/; - $$output = defined $value ? $value : 0 ; + $$output = defined $value ? $value : 0 ; return 1 ; } elsif ($type & Parse_boolean) { return $self->setError("Parameter '$key' must be an int, got '$value'") if $validate && defined $value && $value !~ /^\d*$/; - $$output = defined $value ? $value != 0 : 0 ; + $$output = defined $value ? $value != 0 : 0 ; return 1; } # elsif ($type & Parse_string) # { -# $$output = defined $value ? $value : "" ; +# $$output = defined $value ? $value : "" ; # return 1; # } @@ -374,7 +374,7 @@ sub Compress::Raw::Zlib::Parameters::value return $self->{Got}{lc $name}[OFF_FIXED] ; } -our $OPTIONS_deflate = +our $OPTIONS_deflate = { 'AppendOutput' => [1, 1, Parse_boolean, 0], 'CRC32' => [1, 1, Parse_boolean, 0], @@ -394,7 +394,7 @@ sub Compress::Raw::Zlib::Deflate::new my $pkg = shift ; my ($got) = ParseParameters(0, $OPTIONS_deflate, @_); - croak "Compress::Raw::Zlib::Deflate::new: Bufsize must be >= 1, you specified " . + croak "Compress::Raw::Zlib::Deflate::new: Bufsize must be >= 1, you specified " . $got->value('Bufsize') unless $got->value('Bufsize') >= 1; @@ -408,11 +408,11 @@ sub Compress::Raw::Zlib::Deflate::new if ($windowBits & MAX_WBITS()) == 0 ; _deflateInit($flags, - $got->value('Level'), - $got->value('Method'), - $windowBits, - $got->value('MemLevel'), - $got->value('Strategy'), + $got->value('Level'), + $got->value('Method'), + $windowBits, + $got->value('MemLevel'), + $got->value('Strategy'), $got->value('Bufsize'), $got->value('Dictionary')) ; @@ -431,7 +431,7 @@ sub Compress::Raw::Zlib::deflateStream::STORABLE_thaw } -our $OPTIONS_inflate = +our $OPTIONS_inflate = { 'AppendOutput' => [1, 1, Parse_boolean, 0], 'LimitOutput' => [1, 1, Parse_boolean, 0], @@ -439,7 +439,7 @@ our $OPTIONS_inflate = 'ADLER32' => [1, 1, Parse_boolean, 0], 'ConsumeInput' => [1, 1, Parse_boolean, 1], 'Bufsize' => [1, 1, Parse_unsigned, 4096], - + 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()], 'Dictionary' => [1, 1, Parse_any, ""], } ; @@ -449,7 +449,7 @@ sub Compress::Raw::Zlib::Inflate::new my $pkg = shift ; my ($got) = ParseParameters(0, $OPTIONS_inflate, @_); - croak "Compress::Raw::Zlib::Inflate::new: Bufsize must be >= 1, you specified " . + croak "Compress::Raw::Zlib::Inflate::new: Bufsize must be >= 1, you specified " . $got->value('Bufsize') unless $got->value('Bufsize') >= 1; @@ -465,7 +465,7 @@ sub Compress::Raw::Zlib::Inflate::new $windowBits += MAX_WBITS() if ($windowBits & MAX_WBITS()) == 0 ; - _inflateInit($flags, $windowBits, $got->value('Bufsize'), + _inflateInit($flags, $windowBits, $got->value('Bufsize'), $got->value('Dictionary')) ; } @@ -489,13 +489,13 @@ sub Compress::Raw::Zlib::InflateScan::new 'CRC32' => [1, 1, Parse_boolean, 0], 'ADLER32' => [1, 1, Parse_boolean, 0], 'Bufsize' => [1, 1, Parse_unsigned, 4096], - + 'WindowBits' => [1, 1, Parse_signed, -MAX_WBITS()], 'Dictionary' => [1, 1, Parse_any, ""], }, @_) ; - croak "Compress::Raw::Zlib::InflateScan::new: Bufsize must be >= 1, you specified " . + croak "Compress::Raw::Zlib::InflateScan::new: Bufsize must be >= 1, you specified " . $got->value('Bufsize') unless $got->value('Bufsize') >= 1; @@ -505,7 +505,7 @@ sub Compress::Raw::Zlib::InflateScan::new $flags |= FLAG_ADLER if $got->value('ADLER32') ; #$flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; - _inflateScanInit($flags, $got->value('WindowBits'), $got->value('Bufsize'), + _inflateScanInit($flags, $got->value('WindowBits'), $got->value('Bufsize'), '') ; } @@ -518,7 +518,7 @@ sub Compress::Raw::Zlib::inflateScanStream::createDeflateStream 'CRC32' => [1, 1, Parse_boolean, 0], 'ADLER32' => [1, 1, Parse_boolean, 0], 'Bufsize' => [1, 1, Parse_unsigned, 4096], - + 'Level' => [1, 1, Parse_signed, Z_DEFAULT_COMPRESSION()], 'Method' => [1, 1, Parse_unsigned, Z_DEFLATED()], 'WindowBits' => [1, 1, Parse_signed, - MAX_WBITS()], @@ -526,7 +526,7 @@ sub Compress::Raw::Zlib::inflateScanStream::createDeflateStream 'Strategy' => [1, 1, Parse_unsigned, Z_DEFAULT_STRATEGY()], }, @_) ; - croak "Compress::Raw::Zlib::InflateScan::createDeflateStream: Bufsize must be >= 1, you specified " . + croak "Compress::Raw::Zlib::InflateScan::createDeflateStream: Bufsize must be >= 1, you specified " . $got->value('Bufsize') unless $got->value('Bufsize') >= 1; @@ -536,11 +536,11 @@ sub Compress::Raw::Zlib::inflateScanStream::createDeflateStream $flags |= FLAG_ADLER if $got->value('ADLER32') ; $pkg->_createDeflateStream($flags, - $got->value('Level'), - $got->value('Method'), - $got->value('WindowBits'), - $got->value('MemLevel'), - $got->value('Strategy'), + $got->value('Level'), + $got->value('Method'), + $got->value('WindowBits'), + $got->value('MemLevel'), + $got->value('Strategy'), $got->value('Bufsize'), ) ; @@ -556,10 +556,10 @@ sub Compress::Raw::Zlib::inflateScanStream::inflate if ($status == Z_OK() && $_[2]) { my $byte = ' '; - + $status = $self->scan(\$byte, $_[1]) ; } - + return $status ; } @@ -570,14 +570,14 @@ sub Compress::Raw::Zlib::deflateStream::deflateParams 'Level' => [1, 1, Parse_signed, undef], 'Strategy' => [1, 1, Parse_unsigned, undef], 'Bufsize' => [1, 1, Parse_unsigned, undef], - }, + }, @_) ; croak "Compress::Raw::Zlib::deflateParams needs Level and/or Strategy" unless $got->parsed('Level') + $got->parsed('Strategy') + $got->parsed('Bufsize'); - croak "Compress::Raw::Zlib::Inflate::deflateParams: Bufsize must be >= 1, you specified " . + croak "Compress::Raw::Zlib::Inflate::deflateParams: Bufsize must be >= 1, you specified " . $got->value('Bufsize') if $got->parsed('Bufsize') && $got->value('Bufsize') <= 1; @@ -586,7 +586,7 @@ sub Compress::Raw::Zlib::deflateStream::deflateParams $flags |= 2 if $got->parsed('Strategy') ; $flags |= 4 if $got->parsed('Bufsize') ; - $self->_deflateParams($flags, $got->value('Level'), + $self->_deflateParams($flags, $got->value('Level'), $got->value('Strategy'), $got->value('Bufsize')); } @@ -931,18 +931,18 @@ input, deflates it and writes it to standard output. while (<>) { $status = $x->deflate($_, $output) ; - + $status == Z_OK or die "deflation failed\n" ; - + print $output ; } - + $status = $x->flush($output) ; - + $status == Z_OK or die "deflation failed\n" ; - + print $output ; =head1 Compress::Raw::Zlib::Inflate @@ -1210,26 +1210,26 @@ Here is an example of using C<inflate>. use strict ; use warnings ; - + use Compress::Raw::Zlib; - + my $x = new Compress::Raw::Zlib::Inflate() or die "Cannot create a inflation stream\n" ; - + my $input = '' ; binmode STDIN; binmode STDOUT; - + my ($output, $status) ; while (read(STDIN, $input, 4096)) { $status = $x->inflate($input, $output) ; - + print $output ; - + last if $status != Z_OK ; } - + die "inflation failed\n" unless $status == Z_STREAM_END ; @@ -1243,16 +1243,16 @@ simpler. use strict ; use warnings ; - + use Compress::Raw::Zlib; - + my $x = new Compress::Raw::Zlib::Inflate(LimitOutput => 1) or die "Cannot create a inflation stream\n" ; - + my $input = '' ; binmode STDIN; binmode STDOUT; - + my ($output, $status) ; OUTER: @@ -1269,7 +1269,7 @@ simpler. } while ($status == Z_OK && length $input); } - + die "inflation failed\n" unless $status == Z_STREAM_END ; @@ -1324,24 +1324,24 @@ source and uncompressing as you go the code will look something like this use strict ; use warnings ; - + use Compress::Raw::Zlib; - + my $x = new Compress::Raw::Zlib::Inflate() or die "Cannot create a inflation stream\n" ; - + my $input = '' ; - + my ($output, $status) ; while (read(STDIN, $input, 4096)) { $status = $x->inflate($input, $output) ; - + print $output ; - + last if $status != Z_OK ; } - + die "inflation failed\n" unless $status == Z_STREAM_END ; @@ -1391,16 +1391,16 @@ Below is typical code that shows how to use C<LimitOutput>. use strict ; use warnings ; - + use Compress::Raw::Zlib; - + my $x = new Compress::Raw::Zlib::Inflate(LimitOutput => 1) or die "Cannot create a inflation stream\n" ; - + my $input = '' ; binmode STDIN; binmode STDOUT; - + my ($output, $status) ; OUTER: @@ -1417,7 +1417,7 @@ Below is typical code that shows how to use C<LimitOutput>. } while ($status == Z_OK && length $input); } - + die "inflation failed\n" unless $status == Z_STREAM_END ; @@ -1596,8 +1596,7 @@ See the Changes file. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2005-2020 Paul Marquess. All rights reserved. +Copyright (c) 2005-2021 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. - diff --git a/cpan/Compress-Raw-Zlib/private/MakeUtil.pm b/cpan/Compress-Raw-Zlib/private/MakeUtil.pm index 12fa26fd05..aa540c68fd 100644 --- a/cpan/Compress-Raw-Zlib/private/MakeUtil.pm +++ b/cpan/Compress-Raw-Zlib/private/MakeUtil.pm @@ -42,14 +42,14 @@ sub MY::libscan return $path; } -sub MY::postamble +sub MY::postamble { return '' if $ENV{PERL_CORE} ; my @files = getPerlFiles('MANIFEST'); - # Note: Once you remove all the layers of shell/makefile escaping + # Note: Once you remove all the layers of shell/makefile escaping # the regular expression below reads # # /^\s*local\s*\(\s*\$^W\s*\)/ @@ -215,7 +215,7 @@ sub UpDowngrade foreach (@files) { #if (-l $_ ) { doUpDown($our_sub, $warn_sub, $_) } - #else + #else #{ doUpDownViaCopy($our_sub, $warn_sub, $_) } } @@ -234,7 +234,7 @@ sub doUpDown local ($^I) = ($^O eq 'VMS') ? "_bak" : ".bak"; local (@ARGV) = shift; - + while (<>) { print, last if /^__(END|DATA)__/ ; @@ -277,7 +277,7 @@ sub doUpDownViaCopy push @keep, $_; last ; } - + &{ $our_sub }() if $our_sub ; &{ $warn_sub }() if $warn_sub ; push @keep, $_; @@ -334,7 +334,7 @@ sub FindBrokenDependencies Compress::Zlib ); - + my @broken = (); foreach my $module ( grep { ! $thisModule{$_} } @modules) @@ -342,12 +342,12 @@ sub FindBrokenDependencies my $hasVersion = getInstalledVersion($module); # No need to upgrade if the module isn't installed at all - next + next if ! defined $hasVersion; # If already have C::Z version 1, then an upgrade to any of the # IO::Compress modules will not break it. - next + next if $module eq 'Compress::Zlib' && $hasVersion < 2; if ($hasVersion < $version) @@ -370,14 +370,12 @@ sub getInstalledVersion { no strict 'refs'; $version = ${ $module . "::VERSION" }; - $version = 0 + $version = 0 } - + return $version; } package MakeUtil ; 1; - - diff --git a/cpan/Compress-Raw-Zlib/t/01version.t b/cpan/Compress-Raw-Zlib/t/01version.t index 46200bc9a9..a38a1e6b3b 100644 --- a/cpan/Compress-Raw-Zlib/t/01version.t +++ b/cpan/Compress-Raw-Zlib/t/01version.t @@ -11,8 +11,8 @@ use warnings ; use Test::More ; -BEGIN -{ +BEGIN +{ # use Test::NoWarnings, if available my $extra = 0 ; $extra = 1 @@ -20,13 +20,13 @@ BEGIN plan tests => 2 + $extra ; - use_ok('Compress::Raw::Zlib', 2) ; + use_ok('Compress::Raw::Zlib', 2) ; } # Check zlib_version and ZLIB_VERSION are the same. SKIP: { - skip "TEST_SKIP_VERSION_CHECK is set", 1 + skip "TEST_SKIP_VERSION_CHECK is set", 1 if $ENV{TEST_SKIP_VERSION_CHECK}; my $zlib_h = ZLIB_VERSION ; my $libz = Compress::Raw::Zlib::zlib_version; @@ -35,12 +35,11 @@ SKIP: { or diag <<EOM; The version of zlib.h does not match the version of libz - + You have zlib.h version $zlib_h and libz version $libz - + You probably have two versions of zlib installed on your system. Try removing the one you don't want to use and rebuild. EOM } - diff --git a/cpan/Compress-Raw-Zlib/t/07bufsize.t b/cpan/Compress-Raw-Zlib/t/07bufsize.t index 9768ffd770..46608eab2c 100644 --- a/cpan/Compress-Raw-Zlib/t/07bufsize.t +++ b/cpan/Compress-Raw-Zlib/t/07bufsize.t @@ -13,13 +13,13 @@ use bytes; use Test::More ; use CompTestUtils; -BEGIN -{ +BEGIN +{ plan skip_all => "Lengthy Tests Disabled\n" . "set COMPRESS_ZLIB_RUN_ALL or COMPRESS_ZLIB_RUN_MOST to run this test suite" unless defined $ENV{COMPRESS_ZLIB_RUN_ALL} or defined $ENV{COMPRESS_ZLIB_RUN_MOST}; - + # use Test::NoWarnings, if available my $extra = 0 ; $extra = 1 @@ -27,7 +27,7 @@ BEGIN plan tests => 288 + $extra ; - use_ok('Compress::Raw::Zlib', 2) ; + use_ok('Compress::Raw::Zlib', 2) ; } @@ -40,7 +40,7 @@ my $len = length $hello ; # Check zlib_version and ZLIB_VERSION are the same. SKIP: { - skip "TEST_SKIP_VERSION_CHECK is set", 1 + skip "TEST_SKIP_VERSION_CHECK is set", 1 if $ENV{TEST_SKIP_VERSION_CHECK}; is Compress::Raw::Zlib::zlib_version, ZLIB_VERSION, "ZLIB_VERSION matches Compress::Raw::Zlib::zlib_version" ; @@ -54,18 +54,18 @@ for my $i (1 .. 13) my $hello = "I am a HAL 9000 computer" x 2001; my $tmp = $hello ; - + my @hello = (); - push @hello, $1 + push @hello, $1 while $tmp =~ s/^(.{$i})//; push @hello, $tmp if length $tmp ; - my ($err, $x, $X, $status); - + my ($err, $x, $X, $status); + ok( ($x, $err) = new Compress::Raw::Zlib::Deflate (-AppendOutput => 1)); ok $x ; cmp_ok $err, '==', Z_OK, " status is Z_OK" ; - + ok ! defined $x->msg(), " no msg" ; is $x->total_in(), 0, " total_in == 0" ; is $x->total_out(), 0, " total_out == 0" ; @@ -75,26 +75,26 @@ for my $i (1 .. 13) { $status = $x->deflate($_, $out) ; last unless $status == Z_OK ; - + } cmp_ok $status, '==', Z_OK, " status is Z_OK" ; - + cmp_ok $x->flush($out), '==', Z_OK, " flush returned Z_OK" ; - + ok ! defined $x->msg(), " no msg" ; is $x->total_in(), length $hello, " length total_in" ; is $x->total_out(), length $out, " length total_out" ; - + my @Answer = (); $tmp = $out; push @Answer, $1 while $tmp =~ s/^(.{$i})//; push @Answer, $tmp if length $tmp ; - + my $k; ok(($k, $err) = new Compress::Raw::Zlib::Inflate( -AppendOutput => 1)); ok $k ; cmp_ok $err, '==', Z_OK, " status is Z_OK" ; - + ok ! defined $k->msg(), " no msg" ; is $k->total_in(), 0, " total_in == 0" ; is $k->total_out(), 0, " total_out == 0" ; @@ -105,9 +105,9 @@ for my $i (1 .. 13) { $status = $k->inflate($_, $GOT) ; last if $status == Z_STREAM_END or $status != Z_OK ; - + } - + cmp_ok $status, '==', Z_STREAM_END, " status is Z_STREAM_END" ; is $GOT, $hello, " got expected output" ; ok ! defined $k->msg(), " no msg" ; diff --git a/cpan/Compress-Raw-Zlib/t/09limitoutput.t b/cpan/Compress-Raw-Zlib/t/09limitoutput.t index 2532f9c692..b77a3b154e 100644 --- a/cpan/Compress-Raw-Zlib/t/09limitoutput.t +++ b/cpan/Compress-Raw-Zlib/t/09limitoutput.t @@ -13,8 +13,8 @@ use bytes; use Test::More ; use CompTestUtils; -BEGIN -{ +BEGIN +{ # use Test::NoWarnings, if available my $extra = 0 ; $extra = 1 @@ -22,7 +22,7 @@ BEGIN plan tests => 107 + $extra ; - use_ok('Compress::Raw::Zlib', 2) ; + use_ok('Compress::Raw::Zlib', 2) ; } @@ -30,7 +30,7 @@ BEGIN my $hello = "I am a HAL 9000 computer" x 2001; my $tmp = $hello ; -my ($err, $x, $X, $status); +my ($err, $x, $X, $status); ok( ($x, $err) = new Compress::Raw::Zlib::Deflate (-AppendOutput => 1)); ok $x ; @@ -41,8 +41,8 @@ $status = $x->deflate($tmp, $out) ; cmp_ok $status, '==', Z_OK, " status is Z_OK" ; cmp_ok $x->flush($out), '==', Z_OK, " flush returned Z_OK" ; - - + + sub getOut { my $x = ''; return \$x } for my $bufsize (1, 2, 3, 13, 4096, 1024*10) @@ -57,7 +57,7 @@ for my $bufsize (1, 2, 3, 13, 4096, 1024*10) )); ok $k ; cmp_ok $err, '==', Z_OK, " status is Z_OK" ; - + ok ! defined $k->msg(), " no msg" ; is $k->total_in(), 0, " total_in == 0" ; is $k->total_out(), 0, " total_out == 0" ; @@ -73,7 +73,7 @@ for my $bufsize (1, 2, 3, 13, 4096, 1024*10) last if $status == Z_STREAM_END || $status == Z_DATA_ERROR || $status == Z_STREAM_ERROR ; $deltaOK = 0 if length($GOT) - $prev > $bufsize; } - + ok $deltaOK, " Output Delta never > $bufsize"; cmp_ok $looped, '>=', 1, " looped $looped"; is length($tmp), 0, " length of input buffer is zero"; @@ -89,7 +89,7 @@ sub getit { my $obj = shift ; my $input = shift; - + my $data ; 1 while $obj->inflate($input, $data) != Z_STREAM_END ; return \$data ; @@ -97,9 +97,9 @@ sub getit { title "regression test"; - - my ($err, $x, $X, $status); - + + my ($err, $x, $X, $status); + ok( ($x, $err) = new Compress::Raw::Zlib::Deflate (-AppendOutput => 1)); ok $x ; cmp_ok $err, '==', Z_OK, " status is Z_OK" ; @@ -108,11 +108,11 @@ sub getit my $line2 = "second line\n" ; my $text = $line1 . $line2 ; my $tmp = $text; - + my $out ; $status = $x->deflate($tmp, $out) ; cmp_ok $status, '==', Z_OK, " status is Z_OK" ; - + cmp_ok $x->flush($out), '==', Z_OK, " flush returned Z_OK" ; my $k; @@ -120,40 +120,39 @@ sub getit LimitOutput => 1 )); - + my $c = getit($k, $out); is $$c, $text; - - + + } { title "regression test for #92521: Z_OK instead of Z_BUF_ERROR"; - - # 1M "aaa..." - my $in = 'a' x 100000; - my ($deflate, $err) = Compress::Raw::Zlib::Deflate->new(WindowBits => -15, - MemLevel => 8); + + # 1M "aaa..." + my $in = 'a' x 100000; + my ($deflate, $err) = Compress::Raw::Zlib::Deflate->new(WindowBits => -15, + MemLevel => 8); ok $deflate ; cmp_ok $err, '==', Z_OK, " status is Z_OK" ; - my $status = $deflate->deflate($in, my $zip); + my $status = $deflate->deflate($in, my $zip); cmp_ok $status, '==', Z_OK, " status is Z_OK" ; - cmp_ok $deflate->flush($zip, Z_SYNC_FLUSH), "==", Z_OK; + cmp_ok $deflate->flush($zip, Z_SYNC_FLUSH), "==", Z_OK; - # Compression should stop after 10K "aaa..." with Z_BUF_ERROR + # Compression should stop after 10K "aaa..." with Z_BUF_ERROR my $inflate; - ($inflate, $err) = Compress::Raw::Zlib::Inflate->new( Bufsize => 10000, - LimitOutput => 1, WindowBits => -15 ); + ($inflate, $err) = Compress::Raw::Zlib::Inflate->new( Bufsize => 10000, + LimitOutput => 1, WindowBits => -15 ); ok $inflate ; cmp_ok $err, '==', Z_OK, " status is Z_OK" ; - $status = $inflate->inflate($zip, my $out); + $status = $inflate->inflate($zip, my $out); cmp_ok length($out), ">=", 10000; - #warn 'RESULT: ', length($out), ' of ', length($in), "\n"; + #warn 'RESULT: ', length($out), ' of ', length($in), "\n"; cmp_ok $status, '==', Z_BUF_ERROR, " status is Z_BUF_ERROR" ; } - diff --git a/cpan/Compress-Raw-Zlib/t/18lvalue.t b/cpan/Compress-Raw-Zlib/t/18lvalue.t index 3b102c799e..98d8423d10 100644 --- a/cpan/Compress-Raw-Zlib/t/18lvalue.t +++ b/cpan/Compress-Raw-Zlib/t/18lvalue.t @@ -13,10 +13,10 @@ use bytes; use Test::More ; use CompTestUtils; -BEGIN -{ +BEGIN +{ plan(skip_all => "lvalue sub tests need Perl ??") - if $] < 5.006 ; + if $] < 5.006 ; # use Test::NoWarnings, if available my $extra = 0 ; @@ -27,7 +27,7 @@ BEGIN use_ok('Compress::Raw::Zlib', 2) ; } - + my $hello = <<EOM ; @@ -39,7 +39,7 @@ my $len = length $hello ; # Check zlib_version and ZLIB_VERSION are the same. SKIP: { - skip "TEST_SKIP_VERSION_CHECK is set", 1 + skip "TEST_SKIP_VERSION_CHECK is set", 1 if $ENV{TEST_SKIP_VERSION_CHECK}; is Compress::Raw::Zlib::zlib_version, ZLIB_VERSION, "ZLIB_VERSION matches Compress::Raw::Zlib::zlib_version" ; @@ -62,17 +62,15 @@ SKIP: { cmp_ok $x->deflate(getData, getX), '==', Z_OK ; cmp_ok $x->flush(getX), '==', Z_OK ; - + my $append = "Appended" ; $X .= $append ; - + ok my $k = new Compress::Raw::Zlib::Inflate ( -AppendOutput => 1 ) ; - + cmp_ok $k->inflate(getX, getZ), '==', Z_STREAM_END ; ; - + ok $hello eq $Z ; is $X, $append; - -} - +} diff --git a/cpan/Compress-Raw-Zlib/t/19nonpv.t b/cpan/Compress-Raw-Zlib/t/19nonpv.t index bbc20c7648..2567ec55b3 100644 --- a/cpan/Compress-Raw-Zlib/t/19nonpv.t +++ b/cpan/Compress-Raw-Zlib/t/19nonpv.t @@ -12,8 +12,8 @@ use warnings; use Test::More ; use CompTestUtils; -BEGIN -{ +BEGIN +{ # use Test::NoWarnings, if available my $extra = 0 ; $extra = 1 @@ -23,7 +23,7 @@ BEGIN use_ok('Compress::Raw::Zlib', 2) ; } - + my $hello = <<EOM ; @@ -35,7 +35,7 @@ my $len = length $hello ; # Check zlib_version and ZLIB_VERSION are the same. SKIP: { - skip "TEST_SKIP_VERSION_CHECK is set", 1 + skip "TEST_SKIP_VERSION_CHECK is set", 1 if $ENV{TEST_SKIP_VERSION_CHECK}; is Compress::Raw::Zlib::zlib_version, ZLIB_VERSION, "ZLIB_VERSION matches Compress::Raw::Zlib::zlib_version" ; @@ -50,16 +50,16 @@ SKIP: { ok my $x = new Compress::Raw::Zlib::Deflate({-Level => Z_BEST_COMPRESSION, -Dictionary => $dictionary}) ; - + my $dictID = $x->dict_adler() ; my ($X, $Y, $Z); cmp_ok $x->deflate($hello, $X), '==', Z_OK; cmp_ok $x->flush($Y), '==', Z_OK; $X .= $Y ; - + ok my $k = new Compress::Raw::Zlib::Inflate(-Dictionary => $dictionary) ; - + cmp_ok $k->inflate($X, $Z), '==', Z_STREAM_END; is $k->dict_adler(), $dictID; is $hello, $Z ; @@ -72,12 +72,12 @@ SKIP: { # ============================== my $hello = *hello ; - my ($err, $x, $X, $status); - + my ($err, $x, $X, $status); + ok( ($x, $err) = new Compress::Raw::Zlib::Deflate, "Create deflate object" ); ok $x, "Compress::Raw::Zlib::Deflate ok" ; cmp_ok $err, '==', Z_OK, "status is Z_OK" ; - + ok ! defined $x->msg() ; is $x->total_in(), 0, "total_in() == 0" ; is $x->total_out(), 0, "total_out() == 0" ; @@ -86,22 +86,22 @@ SKIP: { my $Answer = ''; $status = $x->deflate($hello, $X) ; $Answer .= $X ; - + cmp_ok $status, '==', Z_OK, "deflate returned Z_OK" ; - + $X = *X; cmp_ok $x->flush($X), '==', Z_OK, "flush returned Z_OK" ; $Answer .= $X ; - + ok ! defined $x->msg() ; is $x->total_in(), length $hello, "total_in ok" ; is $x->total_out(), length $Answer, "total_out ok" ; - + my $k; ok(($k, $err) = new Compress::Raw::Zlib::Inflate); ok $k, "Compress::Raw::Zlib::Inflate ok" ; cmp_ok $err, '==', Z_OK, "status is Z_OK" ; - + ok ! defined $k->msg(), "No error messages" ; is $k->total_in(), 0, "total_in() == 0" ; is $k->total_out(), 0, "total_out() == 0" ; @@ -111,7 +111,7 @@ SKIP: { my $Alen = length $Answer; $status = $k->inflate($Answer, $Z) ; $GOT .= $Z ; - + cmp_ok $status, '==', Z_STREAM_END, "Got Z_STREAM_END" ; is $GOT, $hello, "uncompressed data matches ok" ; ok ! defined $k->msg(), "No error messages" ; @@ -132,4 +132,3 @@ SKIP: { cmp_ok $status, "!=", Z_OK, "inflateSync on *hello returns error (and does not crash)"; } - diff --git a/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm b/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm index c506632f90..fd9d963e03 100644 --- a/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm +++ b/cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm @@ -9,13 +9,13 @@ use bytes; #use lib qw(t t/compress); use Carp ; -#use Test::More ; +#use Test::More ; sub title { - #diag "" ; + #diag "" ; ok(1, $_[0]) ; #diag "" ; } @@ -26,7 +26,7 @@ sub like_eval } BEGIN { - eval { + eval { require File::Temp; } ; @@ -38,7 +38,7 @@ BEGIN { our ($index); $index = '00000'; - + sub new { my $self = shift ; @@ -72,7 +72,7 @@ BEGIN { $index = '00000'; our ($useTempFile); our ($useTempDir); - + sub new { my $self = shift ; @@ -115,11 +115,11 @@ BEGIN { # autogenerate the name if none supplied $_ = "tmpdir" . $$ . "X" . $index ++ . ".tmp" ; } - foreach (@_) - { + foreach (@_) + { rmtree $_, {verbose => 0, safe => 1} - if -d $_; - mkdir $_, 0777 + if -d $_; + mkdir $_, 0777 } bless [ @_ ], $self ; } @@ -131,10 +131,10 @@ BEGIN { if (! $useTempFile) { my $self = shift ; - foreach (@$self) - { + foreach (@$self) + { rmtree $_, {verbose => 0, safe => 1} - if -d $_ ; + if -d $_ ; } } } @@ -150,15 +150,15 @@ sub readFile { my $pos = tell($f); seek($f, 0,0); - @strings = <$f> ; + @strings = <$f> ; seek($f, 0, $pos); } else { - open (F, "<$f") + open (F, "<$f") or croak "Cannot open $f: $!\n" ; binmode F; - @strings = <F> ; + @strings = <F> ; close F ; } @@ -175,7 +175,7 @@ sub writeFile { my($filename, @strings) = @_ ; 1 while unlink $filename ; - open (F, ">$filename") + open (F, ">$filename") or croak "Cannot open $filename: $!\n" ; binmode F; foreach (@strings) { @@ -191,10 +191,10 @@ sub GZreadFile my ($uncomp) = "" ; my $line = "" ; - my $fil = gzopen($filename, "rb") + my $fil = gzopen($filename, "rb") or croak "Cannopt open '$filename': $Compress::Zlib::gzerrno" ; - $uncomp .= $line + $uncomp .= $line while $fil->gzread($line) > 0; $fil->gzclose ; @@ -248,7 +248,7 @@ sub readHeaderInfo some text EOM - ok my $x = new IO::Compress::Gzip $name, %opts + ok my $x = new IO::Compress::Gzip $name, %opts or diag "GzipError is $IO::Compress::Gzip::GzipError" ; ok $x->write($string) ; ok $x->close ; @@ -562,9 +562,9 @@ sub anyUncompress } my $out = ''; - my $o = new IO::Uncompress::AnyUncompress \$data, - Append => 1, - Transparent => 0, + my $o = new IO::Uncompress::AnyUncompress \$data, + Append => 1, + Transparent => 0, RawInflate => 1, UnLzma => 1, @opts @@ -622,10 +622,10 @@ sub getHeaders } my $out = ''; - my $o = new IO::Uncompress::AnyUncompress \$data, - MultiStream => 1, - Append => 1, - Transparent => 0, + my $o = new IO::Uncompress::AnyUncompress \$data, + MultiStream => 1, + Append => 1, + Transparent => 0, RawInflate => 1, UnLzma => 1, @opts diff --git a/cpan/Compress-Raw-Zlib/typemap b/cpan/Compress-Raw-Zlib/typemap index 36fce4aa94..cf73c737c1 100644 --- a/cpan/Compress-Raw-Zlib/typemap +++ b/cpan/Compress-Raw-Zlib/typemap @@ -41,7 +41,6 @@ T_PTROBJ_AV else if (sv_derived_from($arg, \"${ntype}\")) { IV tmp = SvIV(getInnerObject($arg)) ; $var = INT2PTR($type, tmp); - } else croak(\"$var is not of type ${ntype}\") @@ -58,5 +57,3 @@ T_DUAL T_PV sv_setpv((SV*)$arg, $var); - - |