summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/IO-Compress/lib/Compress
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2013-03-25 20:06:16 +0000
committersthen <sthen@openbsd.org>2013-03-25 20:06:16 +0000
commit898184e3e61f9129feb5978fad5a8c6865f00b92 (patch)
tree56f32aefc1eed60b534611007c7856f82697a205 /gnu/usr.bin/perl/cpan/IO-Compress/lib/Compress
parentPGSHIFT -> PAGE_SHIFT (diff)
downloadwireguard-openbsd-898184e3e61f9129feb5978fad5a8c6865f00b92.tar.xz
wireguard-openbsd-898184e3e61f9129feb5978fad5a8c6865f00b92.zip
import perl 5.16.3 from CPAN - worked on by Andrew Fresh and myself
Diffstat (limited to 'gnu/usr.bin/perl/cpan/IO-Compress/lib/Compress')
-rw-r--r--gnu/usr.bin/perl/cpan/IO-Compress/lib/Compress/Zlib.pm43
1 files changed, 17 insertions, 26 deletions
diff --git a/gnu/usr.bin/perl/cpan/IO-Compress/lib/Compress/Zlib.pm b/gnu/usr.bin/perl/cpan/IO-Compress/lib/Compress/Zlib.pm
index 9424df63b8b..db13bb03860 100644
--- a/gnu/usr.bin/perl/cpan/IO-Compress/lib/Compress/Zlib.pm
+++ b/gnu/usr.bin/perl/cpan/IO-Compress/lib/Compress/Zlib.pm
@@ -1,24 +1,23 @@
package Compress::Zlib;
-require 5.004 ;
+require 5.006 ;
require Exporter;
-use AutoLoader;
use Carp ;
use IO::Handle ;
use Scalar::Util qw(dualvar);
-use IO::Compress::Base::Common 2.024 ;
-use Compress::Raw::Zlib 2.024 ;
-use IO::Compress::Gzip 2.024 ;
-use IO::Uncompress::Gunzip 2.024 ;
+use IO::Compress::Base::Common 2.048 ;
+use Compress::Raw::Zlib 2.048 ;
+use IO::Compress::Gzip 2.048 ;
+use IO::Uncompress::Gunzip 2.048 ;
use strict ;
use warnings ;
use bytes ;
-our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $AUTOLOAD);
+our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
-$VERSION = '2.024';
+$VERSION = '2.048';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -46,16 +45,6 @@ BEGIN
*zlib_version = \&Compress::Raw::Zlib::zlib_version;
}
-sub AUTOLOAD {
- my($constname);
- ($constname = $AUTOLOAD) =~ s/.*:://;
- my ($error, $val) = Compress::Raw::Zlib::constant($constname);
- Carp::croak $error if $error;
- no strict 'refs';
- *{$AUTOLOAD} = sub { $val };
- goto &{$AUTOLOAD};
-}
-
use constant FLAG_APPEND => 1 ;
use constant FLAG_CRC => 2 ;
use constant FLAG_ADLER => 4 ;
@@ -98,15 +87,16 @@ sub _set_gzerr_undef
_set_gzerr(@_);
return undef;
}
+
sub _save_gzerr
{
my $gz = shift ;
my $test_eof = shift ;
my $value = $gz->errorNo() || 0 ;
+ my $eof = $gz->eof() ;
if ($test_eof) {
- #my $gz = $self->[0] ;
# gzread uses Z_STREAM_END to denote a successful end
$value = Z_STREAM_END() if $gz->eof() && $value == 0 ;
}
@@ -173,13 +163,14 @@ sub Compress::Zlib::gzFile::gzread
my $len = defined $_[1] ? $_[1] : 4096 ;
+ my $gz = $self->[0] ;
if ($self->gzeof() || $len == 0) {
# Zap the output buffer to match ver 1 behaviour.
$_[0] = "" ;
+ _save_gzerr($gz, 1);
return 0 ;
}
- my $gz = $self->[0] ;
my $status = $gz->read($_[0], $len) ;
_save_gzerr($gz, 1);
return $status ;
@@ -462,7 +453,7 @@ sub inflate
package Compress::Zlib ;
-use IO::Compress::Gzip::Constants 2.024 ;
+use IO::Compress::Gzip::Constants 2.048 ;
sub memGzip($)
{
@@ -587,7 +578,7 @@ sub memGunzip($)
substr($$string, 0, 8) = '';
return _set_gzerr_undef(Z_DATA_ERROR())
unless $len == length($output) and
- $crc == crc32($output);
+ $crc == Compress::Raw::Zlib::crc32($output);
}
else
{
@@ -709,7 +700,7 @@ enhancements/changes have been made to the C<gzopen> interface:
=item 1
-If you want to to open either STDIN or STDOUT with C<gzopen>, you can now
+If you want to open either STDIN or STDOUT with C<gzopen>, you can now
optionally use the special filename "C<->" as a synonym for C<\*STDIN> and
C<\*STDOUT>.
@@ -1018,7 +1009,7 @@ carry out in-memory gzip compression.
This function is used to uncompress an in-memory gzip file.
$dest = Compress::Zlib::memGunzip($buffer)
- or die "Cannot uncomprss: $gzerrno\n";
+ or die "Cannot uncompress: $gzerrno\n";
If successful, it returns the uncompressed gzip file. Otherwise it
returns C<undef> and the C<$gzerrno> variable will store the zlib error
@@ -1458,7 +1449,7 @@ of I<Compress::Zlib>.
L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Uncompress::Bunzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
-L<Compress::Zlib::FAQ|Compress::Zlib::FAQ>
+L<IO::Compress::FAQ|IO::Compress::FAQ>
L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
L<Archive::Tar|Archive::Tar>,
@@ -1487,7 +1478,7 @@ See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 1995-2010 Paul Marquess. All rights reserved.
+Copyright (c) 1995-2012 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.