summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Compress/Raw/Zlib.pm
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2022-03-14 10:08:50 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2022-03-14 10:08:50 +0000
commit49b9d8ffc05bf0c271287eb1390cabad28c6a47a (patch)
treee2e1779b1d4795d6b2c3bf92a4e2e4154d82124b /Master/tlpkg/tlperl/lib/Compress/Raw/Zlib.pm
parentf03a75ebd3b935ecde4dde32687fbe86161c30ed (diff)
New tlperl 5.34
git-svn-id: svn://tug.org/texlive/trunk@62701 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Compress/Raw/Zlib.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/Compress/Raw/Zlib.pm173
1 files changed, 86 insertions, 87 deletions
diff --git a/Master/tlpkg/tlperl/lib/Compress/Raw/Zlib.pm b/Master/tlpkg/tlperl/lib/Compress/Raw/Zlib.pm
index cf7126b4238..2cb6f1e48d3 100644
--- a/Master/tlpkg/tlperl/lib/Compress/Raw/Zlib.pm
+++ b/Master/tlpkg/tlperl/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.093';
-$XS_VERSION = $VERSION;
+$VERSION = '2.101';
+$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 ;
@@ -1559,7 +1559,7 @@ of I<Compress::Raw::Zlib>.
=head1 SUPPORT
-General feedback/questions/bug reports should be sent to
+General feedback/questions/bug reports should be sent to
L<https://github.com/pmqs/Compress-Raw-Zlib/issues> (preferred) or
L<https://rt.cpan.org/Public/Dist/Display.html?Name=Compress-Raw-Zlib>.
@@ -1596,8 +1596,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2019 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.
-