| 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Compress::Zlib; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 15 | require 5.008 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 15 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use Carp ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use IO::Handle ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use Scalar::Util qw(dualvar); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 15 | ▶ | use IO::Compress::Base::Common 2.225 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 15 | ▶ | use Compress::Raw::Zlib 2.225 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 15 | ▶ | use IO::Compress::Gzip 2.225 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 15 | ▶ | use IO::Uncompress::Gunzip 2.225 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 15 | ▶ | use strict ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 15 | ▶ | use warnings ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 15 | ▶ | use bytes ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 15 | our ($VERSION, $XS_VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 15 | $VERSION = '2.225'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 15 | $XS_VERSION = $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 15 | $VERSION = eval $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 15 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # Items to export into callers namespace by default. Note: do not export | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # Do not simply export all your public functions/methods/constants. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 15 | @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | deflateInit inflateInit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | compress uncompress | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | gzopen $gzerrno | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 15 | push @EXPORT, @Compress::Raw::Zlib::EXPORT ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 15 | @EXPORT_OK = qw(memGunzip memGzip zlib_version); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 15 | %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ALL => \@EXPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 15 | *zlib_version = \&Compress::Raw::Zlib::zlib_version; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 15 | ▶ | use constant FLAG_APPEND => 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 15 | ▶ | use constant FLAG_CRC => 2 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 15 | ▶ | use constant FLAG_ADLER => 4 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 15 | ▶ | use constant FLAG_CONSUME_INPUT => 8 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 15 | our (@my_z_errmsg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 15 | @my_z_errmsg = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | "need dictionary", # Z_NEED_DICT 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | "stream end", # Z_STREAM_END 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | "", # Z_OK 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | "file error", # Z_ERRNO (-1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | "stream error", # Z_STREAM_ERROR (-2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | "data error", # Z_DATA_ERROR (-3) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | "insufficient memory", # Z_MEM_ERROR (-4) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | "buffer error", # Z_BUF_ERROR (-5) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | "incompatible version",# Z_VERSION_ERROR(-6) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | sub _set_gzerr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 455 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_gzerr: called CC=4 SCAR=15.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 455 | my $value = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 455 | ▶ | if ($value == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 368 | $Compress::Zlib::gzerrno = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ▶ | elsif ($value == Z_ERRNO() || $value > 2) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$value == Z_ERRNO() or $value > 2
MC/DC0%0/2
$value == Z_ERRNO() or $value > 2
$value == Z_ERRNO()
$value > 2
Truth table33%1/3
A or B
A= $value == Z_ERRNO()B= $value > 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $Compress::Zlib::gzerrno = $! ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 87 | $Compress::Zlib::gzerrno = dualvar($value+0, $my_z_errmsg[2 - $value]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 455 | return $value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | sub _set_gzerr_undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 30 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_gzerr_undef: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 30 | _set_gzerr(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 30 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | sub _save_gzerr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 285 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_save_gzerr: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 285 | my $gz = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 285 | my $test_eof = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 285 | ▶ | my $value = $gz->errorNo() || 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$gz->errorNo || 0
MC/DC100%1/1
$gz->errorNo || 0
$gz->errorNo
Truth table100%2/2
A
A= $gz->errorNo
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 285 | my $eof = $gz->eof() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 285 | ▶ | if ($test_eof) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # gzread uses Z_STREAM_END to denote a successful end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 78 | ▶ | $value = Z_STREAM_END() if $gz->eof() && $value == 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$gz->eof and $value == 0
MC/DC100%2/2
$gz->eof and $value == 0
$gz->eof
$value == 0
Truth table100%3/3
A and B
A= $gz->eofB= $value == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 285 | _set_gzerr($value) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | sub gzopen($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 78 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzopen: called CC=15 SCAR=27.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 78 | my ($file, $mode) = @_ ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 78 | my $gz ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 78 | my %defOpts = (Level => Z_DEFAULT_COMPRESSION(), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | Strategy => Z_DEFAULT_STRATEGY(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 78 | my $writing ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 78 | $writing = ! ($mode =~ /r/i) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 78 | $writing = ($mode =~ /[wa]/i) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 78 | ▶ | $defOpts{Level} = $1 if $mode =~ /(\d)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 78 | ▶ | $defOpts{Strategy} = Z_FILTERED() if $mode =~ /f/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 78 | ▶ | $defOpts{Strategy} = Z_HUFFMAN_ONLY() if $mode =~ /h/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 78 | ▶ | $defOpts{Append} = 1 if $mode =~ /a/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 78 | ▶ | my $infDef = $writing ? 'deflate' : 'inflate'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 78 | my @params = () ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 78 | ▶ | croak "gzopen: file parameter is not a filehandle or filename" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
&isaFilehandle($file) or &isaFilename($file) or ref $file and ref $file eq "SCALAR"
&isaFilehandle($file) or &isaFilename($file)
ref $file and ref $file eq "SCALAR"
MC/DC50%2/4
&isaFilehandle($file) or &isaFilename($file) or ref $file and ref $file eq "SCALAR"
&isaFilehandle($file)
&isaFilename($file)
ref $file
ref $file eq "SCALAR"
Truth table60%3/5
A or B or C and D
A= &isaFilehandle($file)B= &isaFilename($file)C= ref $fileD= ref $file eq "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | unless isaFilehandle $file || isaFilename $file || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | (ref $file && ref $file eq 'SCALAR'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 77 | ▶ | return undef unless $mode =~ /[rwa]/i ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 76 | _set_gzerr(0) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 76 | ▶ | if ($writing) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 34 | ▶ | $gz = IO::Compress::Gzip->new($file, Minimal => 1, AutoClose => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | %defOpts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | or $Compress::Zlib::gzerrno = $IO::Compress::Gzip::GzipError; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 42 | ▶ | $gz = IO::Uncompress::Gunzip->new($file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | Transparent => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | Append => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | AutoClose => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | MultiStream => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | Strict => 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | or $Compress::Zlib::gzerrno = $IO::Uncompress::Gunzip::GunzipError; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | return undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 76 | ▶ | if ! defined $gz ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 76 | bless [$gz, $infDef], 'Compress::Zlib::gzFile'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | sub Compress::Zlib::gzFile::gzread | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 42 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzread: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 42 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 42 | ▶ | return _set_gzerr(Z_STREAM_ERROR()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | if $self->[1] ne 'inflate'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 41 | ▶ | my $len = defined $_[1] ? $_[1] : 4096 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 41 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 41 | ▶ | if ($self->gzeof() || $len == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->gzeof or $len == 0
MC/DC100%2/2
$self->gzeof or $len == 0
$self->gzeof
$len == 0
Truth table100%3/3
A or B
A= $self->gzeofB= $len == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # Zap the output buffer to match ver 1 behaviour. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 13 | $_[0] = "" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 13 | _save_gzerr($gz, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 13 | return 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 28 | my $status = $gz->read($_[0], $len) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 28 | _save_gzerr($gz, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 28 | return $status ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | sub Compress::Zlib::gzFile::gzreadline | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 37 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzreadline: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 37 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 37 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # Maintain backward compatibility with 1.x behaviour | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | # It didn't support $/, so this can't either. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 37 | local $/ = "\n" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 37 | $_[0] = $gz->getline() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 37 | _save_gzerr($gz, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 37 | ▶ | return defined $_[0] ? length $_[0] : 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | sub Compress::Zlib::gzFile::gzwrite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 38 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzwrite: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 38 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 38 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 38 | ▶ | return _set_gzerr(Z_STREAM_ERROR()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | if $self->[1] ne 'deflate'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 37 | ▶ | $] >= 5.008 and (utf8::downgrade($_[0], 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$] >= 5.008 && (utf8::downgrade($_[0], 1) || croak('Wide character in gzwrite'))
utf8::downgrade($_[0], 1) or croak("Wide character in gzwrite")
MC/DC0%0/2
$] >= 5.008 && (utf8::downgrade($_[0], 1) || croak('Wide character in gzwrite'))
$] >= 5.008
utf8::downgrade($_[0], 1)
Truth table33%1/3
A && B
A= $] >= 5.008B= utf8::downgrade($_[0], 1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | or croak "Wide character in gzwrite"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 36 | my $status = $gz->write($_[0]) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 36 | _save_gzerr($gz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 36 | return $status ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | sub Compress::Zlib::gzFile::gztell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gztell: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 16 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 16 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 16 | my $status = $gz->tell() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 16 | _save_gzerr($gz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 16 | return $status ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | sub Compress::Zlib::gzFile::gzseek | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzseek: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 11 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 11 | my $offset = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 11 | my $whence = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 11 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 11 | my $status ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 11 | eval { local $SIG{__DIE__}; $status = $gz->seek($offset, $whence) ; }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 11 | ▶ | if ($@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 5 | my $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 5 | $error =~ s/^.*: /gzseek: /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 5 | $error =~ s/ at .* line \d+\s*$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 5 | croak $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 6 | _save_gzerr($gz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 6 | return $status ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | sub Compress::Zlib::gzFile::gzflush | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzflush: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 7 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 7 | my $f = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 7 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 7 | my $status = $gz->flush($f) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 7 | my $err = _save_gzerr($gz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 7 | ▶ | return $status ? 0 : $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | sub Compress::Zlib::gzFile::gzclose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 66 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzclose: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 66 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 66 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 66 | my $status = $gz->close() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 66 | my $err = _save_gzerr($gz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 66 | ▶ | return $status ? 0 : $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | sub Compress::Zlib::gzFile::gzeof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzeof: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 76 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 76 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 76 | ▶ | return 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | if $self->[1] ne 'inflate'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 75 | my $status = $gz->eof() ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 75 | _save_gzerr($gz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 75 | return $status ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | sub Compress::Zlib::gzFile::gzsetparams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzsetparams: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 3 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 3 | ▶ | croak "Usage: Compress::Zlib::gzFile::gzsetparams(file, level, strategy)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | unless @_ eq 2 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 2 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 2 | my $level = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | my $strategy = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | ▶ | return _set_gzerr(Z_STREAM_ERROR()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | if $self->[1] ne 'deflate'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 1 | my $status = *$gz->{Compress}->deflateParams(-Level => $level, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | -Strategy => $strategy); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 1 | _save_gzerr($gz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 1 | return $status ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | sub Compress::Zlib::gzFile::gzerror | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gzerror: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 4 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 4 | my $gz = $self->[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 4 | return $Compress::Zlib::gzerrno ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | sub compress($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compress: called CC=9 SCAR=22.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 10 | my ($x, $output, $err, $in) =('', '', '', '') ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 10 | ▶ | if (ref $_[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 3 | $in = $_[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 3 | ▶ | croak "not a scalar reference" unless ref $in eq 'SCALAR' ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 7 | $in = \$_[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 9 | ▶ | $] >= 5.008 and (utf8::downgrade($$in, 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$] >= 5.008 && (utf8::downgrade($$in, 1) || croak('Wide character in compress'))
utf8::downgrade($$in, 1) or croak("Wide character in compress")
MC/DC0%0/2
$] >= 5.008 && (utf8::downgrade($$in, 1) || croak('Wide character in compress'))
$] >= 5.008
utf8::downgrade($$in, 1)
Truth table33%1/3
A && B
A= $] >= 5.008B= utf8::downgrade($$in, 1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | or croak "Wide character in compress"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 8 | ▶ | my $level = (@_ == 2 ? $_[1] : Z_DEFAULT_COMPRESSION() ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 8 | ▶ | $x = Compress::Raw::Zlib::_deflateInit(FLAG_APPEND, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | $level, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | Z_DEFLATED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | MAX_WBITS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | MAX_MEM_LEVEL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | Z_DEFAULT_STRATEGY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 4096, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 7 | $err = $x->deflate($in, $output) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 7 | ▶ | return undef unless $err == Z_OK() ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 7 | $err = $x->flush($output) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 7 | ▶ | return undef unless $err == Z_OK() ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 7 | return $output ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | sub uncompress($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uncompress: called CC=7 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 10 | my ($output, $in) =('', '') ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 10 | ▶ | if (ref $_[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 4 | $in = $_[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 4 | ▶ | croak "not a scalar reference" unless ref $in eq 'SCALAR' ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 6 | $in = \$_[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 9 | ▶ | $] >= 5.008 and (utf8::downgrade($$in, 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$] >= 5.008 && (utf8::downgrade($$in, 1) || croak('Wide character in uncompress'))
utf8::downgrade($$in, 1) or croak("Wide character in uncompress")
MC/DC0%0/2
$] >= 5.008 && (utf8::downgrade($$in, 1) || croak('Wide character in uncompress'))
$] >= 5.008
utf8::downgrade($$in, 1)
Truth table33%1/3
A && B
A= $] >= 5.008B= utf8::downgrade($$in, 1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | or croak "Wide character in uncompress"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 8 | my ($obj, $status) = Compress::Raw::Zlib::_inflateInit(0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | MAX_WBITS, 4096, "") ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 8 | ▶ | $status == Z_OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 8 | ▶ | $obj->inflate($in, $output) == Z_STREAM_END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 7 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | sub deflateInit(@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 19 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deflateInit: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 19 | my ($got) = ParseParameters(0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 'bufsize' => [IO::Compress::Base::Common::Parse_unsigned, 4096], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 'level' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_COMPRESSION()], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 'method' => [IO::Compress::Base::Common::Parse_unsigned, Z_DEFLATED()], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 'windowbits' => [IO::Compress::Base::Common::Parse_signed, MAX_WBITS()], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 'memlevel' => [IO::Compress::Base::Common::Parse_unsigned, MAX_MEM_LEVEL()], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 'strategy' => [IO::Compress::Base::Common::Parse_unsigned, Z_DEFAULT_STRATEGY()], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 'dictionary' => [IO::Compress::Base::Common::Parse_any, ""], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | }, @_ ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 15 | ▶ | croak "Compress::Zlib::deflateInit: Bufsize must be >= 1, you specified " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | $got->getValue('bufsize') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | unless $got->getValue('bufsize') >= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 14 | my $obj ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 14 | my $status = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 14 | ($obj, $status) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | Compress::Raw::Zlib::_deflateInit(0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | $got->getValue('level'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | $got->getValue('method'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | $got->getValue('windowbits'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | $got->getValue('memlevel'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | $got->getValue('strategy'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | $got->getValue('bufsize'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | $got->getValue('dictionary')) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 14 | ▶ | my $x = ($status == Z_OK() ? bless $obj, "Zlib::OldDeflate" : undef) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 14 | ▶ | return wantarray ? ($x, $status) : $x ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | sub inflateInit(@) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inflateInit: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 17 | my ($got) = ParseParameters(0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 'bufsize' => [IO::Compress::Base::Common::Parse_unsigned, 4096], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 'windowbits' => [IO::Compress::Base::Common::Parse_signed, MAX_WBITS()], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 'dictionary' => [IO::Compress::Base::Common::Parse_any, ""], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | }, @_) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 13 | ▶ | croak "Compress::Zlib::inflateInit: Bufsize must be >= 1, you specified " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | $got->getValue('bufsize') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | unless $got->getValue('bufsize') >= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 12 | my $status = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 12 | my $obj ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 12 | ($obj, $status) = Compress::Raw::Zlib::_inflateInit(FLAG_CONSUME_INPUT, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | $got->getValue('windowbits'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | $got->getValue('bufsize'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | $got->getValue('dictionary')) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 12 | ▶ | my $x = ($status == Z_OK() ? bless $obj, "Zlib::OldInflate" : undef) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 12 | ▶ | wantarray ? ($x, $status) : $x ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | package Zlib::OldDeflate ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 15 | our (@ISA); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 15 | @ISA = qw(Compress::Raw::Zlib::deflateStream); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | sub deflate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 91 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deflate: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 91 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 91 | my $output ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 91 | my $status = $self->SUPER::deflate($_[0], $output) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 91 | ▶ | wantarray ? ($output, $status) : $output ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | sub flush | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flush: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 17 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 17 | my $output ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 17 | ▶ | my $flag = shift || Compress::Zlib::Z_FINISH(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
shift() || Compress::Zlib::Z_FINISH()
MC/DC0%0/2
shift() || Compress::Zlib::Z_FINISH()
shift()
Compress::Zlib::Z_FINISH()
Truth table66%2/3
A || B
A= shift()B= Compress::Zlib::Z_FINISH()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 17 | my $status = $self->SUPER::flush($output, $flag) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 17 | ▶ | wantarray ? ($output, $status) : $output ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | package Zlib::OldInflate ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 15 | our (@ISA); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 15 | @ISA = qw(Compress::Raw::Zlib::inflateStream); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | sub inflate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 151 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inflate: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 151 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 151 | my $output ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 151 | my $status = $self->SUPER::inflate($_[0], $output) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 151 | ▶ | wantarray ? ($output, $status) : $output ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | package Compress::Zlib ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 15 | ▶ | use IO::Compress::Gzip::Constants 2.225 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | sub memGzip($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
memGzip: called CC=7 SCAR=20.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 6 | _set_gzerr(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 6 | ▶ | my $x = Compress::Raw::Zlib::_deflateInit(FLAG_APPEND|FLAG_CRC, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | Z_BEST_COMPRESSION, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | Z_DEFLATED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | -MAX_WBITS(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | MAX_MEM_LEVEL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | Z_DEFAULT_STRATEGY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 4096, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # if the deflation buffer isn't a reference, make it one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 6 | ▶ | my $string = (ref $_[0] ? $_[0] : \$_[0]) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 6 | ▶ | $] >= 5.008 and (utf8::downgrade($$string, 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$] >= 5.008 && (utf8::downgrade($$string, 1) || croak('Wide character in memGzip'))
utf8::downgrade($$string, 1) or croak("Wide character in memGzip")
MC/DC0%0/2
$] >= 5.008 && (utf8::downgrade($$string, 1) || croak('Wide character in memGzip'))
$] >= 5.008
utf8::downgrade($$string, 1)
Truth table33%1/3
A && B
A= $] >= 5.008B= utf8::downgrade($$string, 1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | or croak "Wide character in memGzip"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 5 | my $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | my $status ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 5 | ▶ | $x->deflate($string, $out) == Z_OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 5 | ▶ | $x->flush($out) == Z_OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 5 | return IO::Compress::Gzip::Constants::GZIP_MINIMUM_HEADER . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | $out . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | pack("V V", $x->crc32(), $x->total_in()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | sub _removeGzipHeader($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 54 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_removeGzipHeader: called CC=15 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 54 | my $string = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 54 | ▶ | return Z_DATA_ERROR() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | if length($$string) < GZIP_MIN_HEADER_SIZE ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 53 | my ($magic1, $magic2, $method, $flags, $time, $xflags, $oscode) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | unpack ('CCCCVCC', $$string); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 53 | ▶ | return Z_DATA_ERROR() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$magic1 == 31 and $magic2 == 139 and $method == Z_DEFLATED() and not $flags & 224
$magic1 == 31 and $magic2 == 139 and $method == Z_DEFLATED()
$magic1 == 31 and $magic2 == 139
MC/DC100%4/4
$magic1 == 31 and $magic2 == 139 and $method == Z_DEFLATED() and not $flags & 224
$magic1 == 31
$magic2 == 139
$method == Z_DEFLATED()
not $flags & 224
Truth table100%5/5
A and B and C and not(D)
A= $magic1 == 31B= $magic2 == 139C= $method == Z_DEFLATED()D= not $flags & 224
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | unless $magic1 == GZIP_ID1 and $magic2 == GZIP_ID2 and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | $method == Z_DEFLATED() and !($flags & GZIP_FLG_RESERVED) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 44 | substr($$string, 0, GZIP_MIN_HEADER_SIZE) = '' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # skip extra field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 44 | ▶ | if ($flags & GZIP_FLG_FEXTRA) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 4 | ▶ | return Z_DATA_ERROR() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | if length($$string) < GZIP_FEXTRA_HEADER_SIZE ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 3 | my ($extra_len) = unpack ('v', $$string); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 3 | $extra_len += GZIP_FEXTRA_HEADER_SIZE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 3 | ▶ | return Z_DATA_ERROR() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | if length($$string) < $extra_len ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | substr($$string, 0, $extra_len) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # skip orig name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 41 | ▶ | if ($flags & GZIP_FLG_FNAME) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 5 | my $name_end = index ($$string, GZIP_NULL_BYTE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 5 | ▶ | return Z_DATA_ERROR() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | if $name_end == -1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 1 | substr($$string, 0, $name_end + 1) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # skip comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 37 | ▶ | if ($flags & GZIP_FLG_FCOMMENT) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 8 | my $comment_end = index ($$string, GZIP_NULL_BYTE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 8 | ▶ | return Z_DATA_ERROR() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | if $comment_end == -1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 1 | substr($$string, 0, $comment_end + 1) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # skip header crc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 30 | ▶ | if ($flags & GZIP_FLG_FHCRC) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 3 | ▶ | return Z_DATA_ERROR() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | if length ($$string) < GZIP_FHCRC_SIZE ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 1 | substr($$string, 0, GZIP_FHCRC_SIZE) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 28 | return Z_OK(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | sub _ret_gun_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ret_gun_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $Compress::Zlib::gzerrno = $IO::Uncompress::Gunzip::GunzipError; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | sub memGunzip($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 55 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
memGunzip: called CC=12 SCAR=25.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | # if the buffer isn't a reference, make it one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 55 | ▶ | my $string = (ref $_[0] ? $_[0] : \$_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 55 | ▶ | $] >= 5.008 and (utf8::downgrade($$string, 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$] >= 5.008 && (utf8::downgrade($$string, 1) || croak('Wide character in memGunzip'))
utf8::downgrade($$string, 1) or croak("Wide character in memGunzip")
MC/DC0%0/2
$] >= 5.008 && (utf8::downgrade($$string, 1) || croak('Wide character in memGunzip'))
$] >= 5.008
utf8::downgrade($$string, 1)
Truth table33%1/3
A && B
A= $] >= 5.008B= utf8::downgrade($$string, 1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | or croak "Wide character in memGunzip"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 54 | _set_gzerr(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 54 | my $status = _removeGzipHeader($string) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 54 | ▶ | $status == Z_OK() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | or return _set_gzerr_undef($status); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 28 | ▶ | my $bufsize = length $$string > 4096 ? length $$string : 4096 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 28 | ▶ | my $x = Compress::Raw::Zlib::_inflateInit(FLAG_CRC | FLAG_CONSUME_INPUT, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | -MAX_WBITS(), $bufsize, '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | or return _ret_gun_error(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 28 | my $output = '' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 28 | $status = $x->inflate($string, $output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 28 | ▶ | if ( $status == Z_OK() ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 1 | _set_gzerr(Z_DATA_ERROR()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 27 | ▶ | return _ret_gun_error() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | if ($status != Z_STREAM_END()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 27 | ▶ | if (length $$string >= 8) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 11 | my ($crc, $len) = unpack ("VV", substr($$string, 0, 8)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 11 | substr($$string, 0, 8) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 11 | ▶ | return _set_gzerr_undef(Z_DATA_ERROR()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$len == length $output and $crc == Compress::Raw::Zlib::crc32($output)
MC/DC100%2/2
$len == length $output and $crc == Compress::Raw::Zlib::crc32($output)
$len == length $output
$crc == Compress::Raw::Zlib::crc32($output)
Truth table100%3/3
A and B
A= $len == length $outputB= $crc == Compress::Raw::Zlib::crc32($output)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | unless $len == length($output) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | $crc == Compress::Raw::Zlib::crc32($output); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 16 | $$string = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 23 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | # Autoload methods go after __END__, and are processed by the autosplit program. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||