},
'Compress::Raw::Zlib' => {
- 'DISTRIBUTION' => 'PMQS/Compress-Raw-Zlib-2.096.tar.gz',
+ 'DISTRIBUTION' => 'PMQS/Compress-Raw-Zlib-2.100.tar.gz',
'FILES' => q[cpan/Compress-Raw-Zlib],
'EXCLUDED' => [
qr{^examples/},
# 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 ;
if ($answer =~ /^yes|y/i)
{
- print "continuing...\n"
+ print "continuing...\n"
}
else
{
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" ,
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',
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 => {
},
resources => {
-
+
bugtracker => {
web => 'https://github.com/pmqs/Compress-Raw-Zlib/issues'
},
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') : ()),
) ;
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(
NAMES => \@names,
C_FILE => 'constants.h',
XS_FILE => 'constants.xs',
-
+
);
-}
+}
else {
foreach my $name (qw( constants.h constants.xs ))
{
# 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') {
}
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 ;
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"
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" ;
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
);
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) ],
-
+
) ;
}
[ '' => 255, 'Unknown OS' ],
);
- %OSnames = map { $$_[1] => $$_[2] }
+ %OSnames = map { $$_[1] => $$_[2] }
@GZIP_OS_Names ;
}
}
# end of file Makefile.PL
-
# 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.
#
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
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;
# 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
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;
sub ParseParameters
{
- my $level = shift || 0 ;
+ my $level = shift || 0 ;
my $sub = (caller($level + 1))[3] ;
#local $Carp::CarpLevel = 1 ;
$self->{Error} = $error ;
return $retval;
}
-
+
#sub getError
#{
# my $self = shift ;
# return $self->{Error} ;
#}
-
+
sub Compress::Raw::Zlib::Parameters::parse
{
my $self = shift ;
@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} ;
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] ;
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;
$key =~ s/^-// ;
my $canonkey = lc $key;
-
+
if ($got->{$canonkey} && ($firstTime ||
! $got->{$canonkey}[OFF_FIRST_ONLY] ))
{
else
{ push (@Bad, $key) }
}
-
+
if (@Bad) {
my ($bad) = join(", ", @Bad) ;
return $self->setError("unknown key value(s) @Bad") ;
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)
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;
# }
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],
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;
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')) ;
}
-our $OPTIONS_inflate =
+our $OPTIONS_inflate =
{
'AppendOutput' => [1, 1, Parse_boolean, 0],
'LimitOutput' => [1, 1, Parse_boolean, 0],
'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, ""],
} ;
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;
$windowBits += MAX_WBITS()
if ($windowBits & MAX_WBITS()) == 0 ;
- _inflateInit($flags, $windowBits, $got->value('Bufsize'),
+ _inflateInit($flags, $windowBits, $got->value('Bufsize'),
$got->value('Dictionary')) ;
}
'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;
$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'),
'') ;
}
'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()],
'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;
$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'),
) ;
if ($status == Z_OK() && $_[2]) {
my $byte = ' ';
-
+
$status = $self->scan(\$byte, $_[1]) ;
}
-
+
return $status ;
}
'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;
$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'));
}
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
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 ;
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:
}
while ($status == Z_OK && length $input);
}
-
+
die "inflation failed\n"
unless $status == Z_STREAM_END ;
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 ;
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:
}
while ($status == Z_OK && length $input);
}
-
+
die "inflation failed\n"
unless $status == Z_STREAM_END ;
=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.
-
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*\)/
foreach (@files) {
#if (-l $_ )
{ doUpDown($our_sub, $warn_sub, $_) }
- #else
+ #else
#{ doUpDownViaCopy($our_sub, $warn_sub, $_) }
}
local ($^I) = ($^O eq 'VMS') ? "_bak" : ".bak";
local (@ARGV) = shift;
-
+
while (<>)
{
print, last if /^__(END|DATA)__/ ;
push @keep, $_;
last ;
}
-
+
&{ $our_sub }() if $our_sub ;
&{ $warn_sub }() if $warn_sub ;
push @keep, $_;
Compress::Zlib
);
-
+
my @broken = ();
foreach my $module ( grep { ! $thisModule{$_} } @modules)
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)
{
no strict 'refs';
$version = ${ $module . "::VERSION" };
- $version = 0
+ $version = 0
}
-
+
return $version;
}
package MakeUtil ;
1;
-
-
use Test::More ;
-BEGIN
-{
+BEGIN
+{
# use Test::NoWarnings, if available
my $extra = 0 ;
$extra = 1
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;
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
}
-
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
plan tests => 288 + $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};
is Compress::Raw::Zlib::zlib_version, ZLIB_VERSION,
"ZLIB_VERSION matches Compress::Raw::Zlib::zlib_version" ;
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" ;
{
$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" ;
{
$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" ;
use Test::More ;
use CompTestUtils;
-BEGIN
-{
+BEGIN
+{
# use Test::NoWarnings, if available
my $extra = 0 ;
$extra = 1
plan tests => 107 + $extra ;
- use_ok('Compress::Raw::Zlib', 2) ;
+ use_ok('Compress::Raw::Zlib', 2) ;
}
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 ;
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)
));
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" ;
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";
{
my $obj = shift ;
my $input = shift;
-
+
my $data ;
1 while $obj->inflate($input, $data) != Z_STREAM_END ;
return \$data ;
{
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" ;
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;
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" ;
}
-
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 ;
use_ok('Compress::Raw::Zlib', 2) ;
}
-
+
my $hello = <<EOM ;
# 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" ;
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;
-
-}
-
+}
use Test::More ;
use CompTestUtils;
-BEGIN
-{
+BEGIN
+{
# use Test::NoWarnings, if available
my $extra = 0 ;
$extra = 1
use_ok('Compress::Raw::Zlib', 2) ;
}
-
+
my $hello = <<EOM ;
# 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" ;
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 ;
# ==============================
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" ;
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" ;
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" ;
cmp_ok $status, "!=", Z_OK,
"inflateSync on *hello returns error (and does not crash)";
}
-
#use lib qw(t t/compress);
use Carp ;
-#use Test::More ;
+#use Test::More ;
sub title
{
- #diag "" ;
+ #diag "" ;
ok(1, $_[0]) ;
#diag "" ;
}
}
BEGIN {
- eval {
+ eval {
require File::Temp;
} ;
our ($index);
$index = '00000';
-
+
sub new
{
my $self = shift ;
$index = '00000';
our ($useTempFile);
our ($useTempDir);
-
+
sub new
{
my $self = shift ;
# 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 ;
}
if (! $useTempFile)
{
my $self = shift ;
- foreach (@$self)
- {
+ foreach (@$self)
+ {
rmtree $_, {verbose => 0, safe => 1}
- if -d $_ ;
+ if -d $_ ;
}
}
}
{
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 ;
}
{
my($filename, @strings) = @_ ;
1 while unlink $filename ;
- open (F, ">$filename")
+ open (F, ">$filename")
or croak "Cannot open $filename: $!\n" ;
binmode F;
foreach (@strings) {
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 ;
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 ;
}
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
}
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
else if (sv_derived_from($arg, \"${ntype}\")) {
IV tmp = SvIV(getInnerObject($arg)) ;
$var = INT2PTR($type, tmp);
-
}
else
croak(\"$var is not of type ${ntype}\")
T_PV
sv_setpv((SV*)$arg, $var);
-
-