| 1 | |||||||||||||||||||||||||||||||||||||||||||
| 2 | package Compress::Raw::Zlib; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | require 5.008 ; | |||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use Carp ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use strict ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use warnings ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use bytes ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | our ($VERSION, $XS_VERSION, @ISA, @EXPORT, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD, %DEFLATE_CONSTANTS, @DEFLATE_CONSTANTS); | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | $VERSION = '2.226'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | 6 | $XS_VERSION = $VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | $VERSION = eval $VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 18 | 6 | %EXPORT_TAGS = ( flush => [qw{ | |||||||||||||||||||||||||||||||||||||||||
| 19 | Z_NO_FLUSH | ||||||||||||||||||||||||||||||||||||||||||
| 20 | Z_PARTIAL_FLUSH | ||||||||||||||||||||||||||||||||||||||||||
| 21 | Z_SYNC_FLUSH | ||||||||||||||||||||||||||||||||||||||||||
| 22 | Z_FULL_FLUSH | ||||||||||||||||||||||||||||||||||||||||||
| 23 | Z_FINISH | ||||||||||||||||||||||||||||||||||||||||||
| 24 | Z_BLOCK | ||||||||||||||||||||||||||||||||||||||||||
| 25 | }], | ||||||||||||||||||||||||||||||||||||||||||
| 26 | level => [qw{ | ||||||||||||||||||||||||||||||||||||||||||
| 27 | Z_NO_COMPRESSION | ||||||||||||||||||||||||||||||||||||||||||
| 28 | Z_BEST_SPEED | ||||||||||||||||||||||||||||||||||||||||||
| 29 | Z_BEST_COMPRESSION | ||||||||||||||||||||||||||||||||||||||||||
| 30 | Z_DEFAULT_COMPRESSION | ||||||||||||||||||||||||||||||||||||||||||
| 31 | }], | ||||||||||||||||||||||||||||||||||||||||||
| 32 | strategy => [qw{ | ||||||||||||||||||||||||||||||||||||||||||
| 33 | Z_FILTERED | ||||||||||||||||||||||||||||||||||||||||||
| 34 | Z_HUFFMAN_ONLY | ||||||||||||||||||||||||||||||||||||||||||
| 35 | Z_RLE | ||||||||||||||||||||||||||||||||||||||||||
| 36 | Z_FIXED | ||||||||||||||||||||||||||||||||||||||||||
| 37 | Z_DEFAULT_STRATEGY | ||||||||||||||||||||||||||||||||||||||||||
| 38 | }], | ||||||||||||||||||||||||||||||||||||||||||
| 39 | status => [qw{ | ||||||||||||||||||||||||||||||||||||||||||
| 40 | Z_OK | ||||||||||||||||||||||||||||||||||||||||||
| 41 | Z_STREAM_END | ||||||||||||||||||||||||||||||||||||||||||
| 42 | Z_NEED_DICT | ||||||||||||||||||||||||||||||||||||||||||
| 43 | Z_ERRNO | ||||||||||||||||||||||||||||||||||||||||||
| 44 | Z_STREAM_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 45 | Z_DATA_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 46 | Z_MEM_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 47 | Z_BUF_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 48 | Z_VERSION_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 49 | }], | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 6 | %DEFLATE_CONSTANTS = %EXPORT_TAGS; | |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | # Items to export into callers namespace by default. Note: do not export | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||||||||||||||||||||||||||||||||||||||||
| 56 | # Do not simply export all your public functions/methods/constants. | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 6 | @DEFLATE_CONSTANTS = | |||||||||||||||||||||||||||||||||||||||||
| 58 | @EXPORT = qw( | ||||||||||||||||||||||||||||||||||||||||||
| 59 | ZLIB_VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 60 | ZLIB_VERNUM | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | OS_CODE | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | MAX_MEM_LEVEL | ||||||||||||||||||||||||||||||||||||||||||
| 66 | MAX_WBITS | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | Z_ASCII | ||||||||||||||||||||||||||||||||||||||||||
| 69 | Z_BEST_COMPRESSION | ||||||||||||||||||||||||||||||||||||||||||
| 70 | Z_BEST_SPEED | ||||||||||||||||||||||||||||||||||||||||||
| 71 | Z_BINARY | ||||||||||||||||||||||||||||||||||||||||||
| 72 | Z_BLOCK | ||||||||||||||||||||||||||||||||||||||||||
| 73 | Z_BUF_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 74 | Z_DATA_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 75 | Z_DEFAULT_COMPRESSION | ||||||||||||||||||||||||||||||||||||||||||
| 76 | Z_DEFAULT_STRATEGY | ||||||||||||||||||||||||||||||||||||||||||
| 77 | Z_DEFLATED | ||||||||||||||||||||||||||||||||||||||||||
| 78 | Z_ERRNO | ||||||||||||||||||||||||||||||||||||||||||
| 79 | Z_FILTERED | ||||||||||||||||||||||||||||||||||||||||||
| 80 | Z_FIXED | ||||||||||||||||||||||||||||||||||||||||||
| 81 | Z_FINISH | ||||||||||||||||||||||||||||||||||||||||||
| 82 | Z_FULL_FLUSH | ||||||||||||||||||||||||||||||||||||||||||
| 83 | Z_HUFFMAN_ONLY | ||||||||||||||||||||||||||||||||||||||||||
| 84 | Z_MEM_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 85 | Z_NEED_DICT | ||||||||||||||||||||||||||||||||||||||||||
| 86 | Z_NO_COMPRESSION | ||||||||||||||||||||||||||||||||||||||||||
| 87 | Z_NO_FLUSH | ||||||||||||||||||||||||||||||||||||||||||
| 88 | Z_NULL | ||||||||||||||||||||||||||||||||||||||||||
| 89 | Z_OK | ||||||||||||||||||||||||||||||||||||||||||
| 90 | Z_PARTIAL_FLUSH | ||||||||||||||||||||||||||||||||||||||||||
| 91 | Z_RLE | ||||||||||||||||||||||||||||||||||||||||||
| 92 | Z_STREAM_END | ||||||||||||||||||||||||||||||||||||||||||
| 93 | Z_STREAM_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 94 | Z_SYNC_FLUSH | ||||||||||||||||||||||||||||||||||||||||||
| 95 | Z_TREES | ||||||||||||||||||||||||||||||||||||||||||
| 96 | Z_UNKNOWN | ||||||||||||||||||||||||||||||||||||||||||
| 97 | Z_VERSION_ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | ZLIBNG_VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 100 | ZLIBNG_VERNUM | ||||||||||||||||||||||||||||||||||||||||||
| 101 | ZLIBNG_VER_MAJOR | ||||||||||||||||||||||||||||||||||||||||||
| 102 | ZLIBNG_VER_MINOR | ||||||||||||||||||||||||||||||||||||||||||
| 103 | ZLIBNG_VER_REVISION | ||||||||||||||||||||||||||||||||||||||||||
| 104 | ZLIBNG_VER_STATUS | ||||||||||||||||||||||||||||||||||||||||||
| 105 | ZLIBNG_VER_MODIFIED | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | WANT_GZIP | ||||||||||||||||||||||||||||||||||||||||||
| 108 | WANT_GZIP_OR_ZLIB | ||||||||||||||||||||||||||||||||||||||||||
| 109 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 6 | push @EXPORT, qw(crc32 adler32 DEF_WBITS); | |||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 6 | ▶ | use constant WANT_GZIP => 16; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 6 | ▶ | use constant WANT_GZIP_OR_ZLIB => 32; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 57 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 57 | my($constname); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 57 | ($constname = $AUTOLOAD) =~ s/.*:://; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 57 | my ($error, $val) = constant($constname); | |||||||||||||||||||||||||||||||||||||||||
| 120 | 57 | ▶ | Carp::croak $error if $error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 6 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 57 | ▶ | *{$AUTOLOAD} = sub { $val }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 57 | goto &{$AUTOLOAD}; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 6 | ▶ | use constant FLAG_APPEND => 1 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 6 | ▶ | use constant FLAG_CRC => 2 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 6 | ▶ | use constant FLAG_ADLER => 4 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 6 | ▶ | use constant FLAG_CONSUME_INPUT => 8 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 6 | ▶ | use constant FLAG_LIMIT_OUTPUT => 16 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | eval { | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 6 | require XSLoader; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 6 | XSLoader::load('Compress::Raw::Zlib', $XS_VERSION); | |||||||||||||||||||||||||||||||||||||||||
| 135 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 6 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | require DynaLoader; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | local @ISA = qw(DynaLoader); | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | bootstrap Compress::Raw::Zlib $XS_VERSION ; | |||||||||||||||||||||||||||||||||||||||||
| 141 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 6 | ▶ | use constant Parse_any => 0x01; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 6 | ▶ | use constant Parse_unsigned => 0x02; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 6 | ▶ | use constant Parse_signed => 0x04; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 6 | ▶ | use constant Parse_boolean => 0x08; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | #use constant Parse_string => 0x10; | ||||||||||||||||||||||||||||||||||||||||||
| 149 | #use constant Parse_custom => 0x12; | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | #use constant Parse_store_ref => 0x100 ; | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 6 | ▶ | use constant OFF_PARSED => 0 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 6 | ▶ | use constant OFF_TYPE => 1 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 6 | ▶ | use constant OFF_DEFAULT => 2 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 6 | ▶ | use constant OFF_FIXED => 3 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 6 | ▶ | use constant OFF_FIRST_ONLY => 4 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 6 | ▶ | use constant OFF_STICKY => 5 ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | sub ParseParameters | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 97 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ParseParameters: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 97 | ▶ | my $level = shift || 0 ; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 97 | my $sub = (caller($level + 1))[3] ; | |||||||||||||||||||||||||||||||||||||||||
| 167 | #local $Carp::CarpLevel = 1 ; | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 97 | my $p = new Compress::Raw::Zlib::Parameters() ; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 97 | ▶ | $p->parse(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | or croak "$sub: $p->{Error}" ; | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 86 | return $p; | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | sub Compress::Raw::Zlib::Parameters::new | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 97 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 97 | my $class = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 97 | my $obj = { Error => '', | |||||||||||||||||||||||||||||||||||||||||
| 181 | Got => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } ; | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | #return bless $obj, ref($class) || $class || __PACKAGE__ ; | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 97 | return bless $obj, 'Compress::Raw::Zlib::Parameters' ; | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | sub Compress::Raw::Zlib::Parameters::setError | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setError: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 11 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 11 | my $error = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 11 | ▶ | my $retval = @_ ? shift : undef ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 11 | $self->{Error} = $error ; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 11 | return $retval; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | #sub getError | ||||||||||||||||||||||||||||||||||||||||||
| 199 | #{ | ||||||||||||||||||||||||||||||||||||||||||
| 200 | # my $self = shift ; | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # return $self->{Error} ; | ||||||||||||||||||||||||||||||||||||||||||
| 202 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | sub Compress::Raw::Zlib::Parameters::parse | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 97 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=20 SCAR=30.3
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 97 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 97 | my $default = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 97 | my $got = $self->{Got} ; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 97 | my $firstTime = keys %{ $got } == 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 97 | my (@Bad) ; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 97 | my @entered = () ; | |||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | # Allow the options to be passed as a hash reference or | ||||||||||||||||||||||||||||||||||||||||||
| 217 | # as the complete hash. | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 97 | ▶ | if (@_ == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 11 | @entered = () ; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | elsif (@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 9 | my $href = $_[0] ; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 9 | ▶ | return $self->setError("Expected even number of parameters, got 1") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not defined $href && ref $href or ref $href ne "HASH"
defined $href && ref $href
MC/DC33%1/3
not defined $href && ref $href or ref $href ne "HASH"
defined $href
ref $href
ref $href ne "HASH"
Truth table50%2/4
not(A && B) or C
A= defined $hrefB= ref $hrefC= ref $href ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | if ! defined $href or ! ref $href or ref $href ne "HASH" ; | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 7 | foreach my $key (keys %$href) { | |||||||||||||||||||||||||||||||||||||||||
| 227 | 14 | push @entered, $key ; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 14 | push @entered, \$href->{$key} ; | |||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 77 | my $count = @_; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 77 | ▶ | return $self->setError("Expected even number of parameters, got $count") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | if $count % 2 != 0 ; | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 75 | for my $i (0.. $count / 2 - 1) { | |||||||||||||||||||||||||||||||||||||||||
| 237 | 120 | push @entered, $_[2* $i] ; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 120 | push @entered, \$_[2* $i+1] ; | |||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 93 | ▶ | while (my ($key, $v) = each %$default) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | { | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 780 | ▶ | croak "need 4 params [@$v]" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | if @$v != 4 ; | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 780 | my ($first_only, $sticky, $type, $value) = @$v ; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 780 | my $x ; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 780 | ▶ | $self->_checkType($key, \$value, $type, 0, \$x) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 780 | $key = lc $key; | |||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 780 | ▶ | if ($firstTime || ! $sticky) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$firstTime or not $sticky
MC/DC0%0/2
$firstTime or not $sticky
$firstTime
not $sticky
Truth table33%1/3
A or not(B)
A= $firstTimeB= not $sticky
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 780 | $got->{$key} = [0, $type, $value, $x, $first_only, $sticky] ; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 780 | $got->{$key}[OFF_PARSED] = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 93 | for my $i (0.. @entered / 2 - 1) { | |||||||||||||||||||||||||||||||||||||||||
| 263 | 134 | my $key = $entered[2* $i] ; | |||||||||||||||||||||||||||||||||||||||||
| 264 | 134 | my $value = $entered[2* $i+1] ; | |||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | #print "Key [$key] Value [$value]" ; | ||||||||||||||||||||||||||||||||||||||||||
| 267 | #print defined $$value ? "[$$value]\n" : "[undef]\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 134 | $key =~ s/^-// ; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 134 | my $canonkey = lc $key; | |||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 134 | ▶ | if ($got->{$canonkey} && ($firstTime || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$got->{$canonkey} and $firstTime || !$got->{$canonkey}[4]
$firstTime or not $got->{$canonkey}[4]
MC/DC33%1/3
$got->{$canonkey} and $firstTime || !$got->{$canonkey}[4]
$got->{$canonkey}
$firstTime
not $got->{$canonkey}[4]
Truth table50%2/4
A and B or not(C)
A= $got->{$canonkey}B= $firstTimeC= not $got->{$canonkey}[4]
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | ! $got->{$canonkey}[OFF_FIRST_ONLY] )) | ||||||||||||||||||||||||||||||||||||||||||
| 274 | { | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 131 | my $type = $got->{$canonkey}[OFF_TYPE] ; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 131 | my $s ; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 131 | ▶ | $self->_checkType($key, $value, $type, 1, \$s) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||
| 279 | #$value = $$value unless $type & Parse_store_ref ; | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 127 | $value = $$value ; | |||||||||||||||||||||||||||||||||||||||||
| 281 | 127 | $got->{$canonkey} = [1, $type, $value, $s] ; | |||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | else | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 3 | { push (@Bad, $key) } | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 89 | ▶ | if (@Bad) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 3 | my ($bad) = join(", ", @Bad) ; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 3 | return $self->setError("unknown key value(s) @Bad") ; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 86 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | sub Compress::Raw::Zlib::Parameters::_checkType | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 911 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checkType: called CC=19 SCAR=30.9
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 911 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 911 | my $key = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 911 | my $value = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 911 | my $type = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 302 | 911 | my $validate = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 303 | 911 | my $output = shift; | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | #local $Carp::CarpLevel = $level ; | ||||||||||||||||||||||||||||||||||||||||||
| 306 | #print "PARSE $type $key $value $validate $sub\n" ; | ||||||||||||||||||||||||||||||||||||||||||
| 307 | # if ( $type & Parse_store_ref) | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 309 | # #$value = $$value | ||||||||||||||||||||||||||||||||||||||||||
| 310 | # # if ref ${ $value } ; | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # | ||||||||||||||||||||||||||||||||||||||||||
| 312 | # $$output = $value ; | ||||||||||||||||||||||||||||||||||||||||||
| 313 | # return 1; | ||||||||||||||||||||||||||||||||||||||||||
| 314 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 911 | $value = $$value ; | |||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 911 | ▶ | if ($type & Parse_any) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | { | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 90 | $$output = $value ; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 90 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | elsif ($type & Parse_unsigned) | ||||||||||||||||||||||||||||||||||||||||||
| 324 | { | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 246 | ▶ | return $self->setError("Parameter '$key' must be an unsigned int, got 'undef'") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$validate and not defined $value
MC/DC0%0/2
$validate and not defined $value
$validate
not defined $value
Truth table66%2/3
A and not(B)
A= $validateB= not defined $value
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | if $validate && ! defined $value ; | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 246 | ▶ | return $self->setError("Parameter '$key' must be an unsigned int, got '$value'") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$validate and not $value =~ /^\d+$/
MC/DC100%2/2
$validate and not $value =~ /^\d+$/
$validate
not $value =~ /^\d+$/
Truth table100%3/3
A and not(B)
A= $validateB= not $value =~ /^\d+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | if $validate && $value !~ /^\d+$/; | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 242 | ▶ | $$output = defined $value ? $value : 0 ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 242 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||
| 333 | elsif ($type & Parse_signed) | ||||||||||||||||||||||||||||||||||||||||||
| 334 | { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 150 | ▶ | return $self->setError("Parameter '$key' must be a signed int, got 'undef'") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$validate and not defined $value
MC/DC0%0/2
$validate and not defined $value
$validate
not defined $value
Truth table66%2/3
A and not(B)
A= $validateB= not defined $value
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | if $validate && ! defined $value ; | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 150 | ▶ | return $self->setError("Parameter '$key' must be a signed int, got '$value'") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$validate and not $value =~ /^-?\d+$/
MC/DC0%0/2
$validate and not $value =~ /^-?\d+$/
$validate
not $value =~ /^-?\d+$/
Truth table66%2/3
A and not(B)
A= $validateB= not $value =~ /^-?\d+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | if $validate && $value !~ /^-?\d+$/; | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 150 | ▶ | $$output = defined $value ? $value : 0 ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 150 | return 1 ; | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | elsif ($type & Parse_boolean) | ||||||||||||||||||||||||||||||||||||||||||
| 344 | { | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 425 | ▶ | return $self->setError("Parameter '$key' must be an int, got '$value'") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$validate and defined $value and not $value =~ /^\d*$/
$validate and defined $value
MC/DC0%0/3
$validate and defined $value and not $value =~ /^\d*$/
$validate
defined $value
not $value =~ /^\d*$/
Truth table50%2/4
A and B and not(C)
A= $validateB= defined $valueC= not $value =~ /^\d*$/
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | if $validate && defined $value && $value !~ /^\d*$/; | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 425 | ▶ | $$output = defined $value ? $value != 0 : 0 ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 425 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | # elsif ($type & Parse_string) | ||||||||||||||||||||||||||||||||||||||||||
| 351 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 352 | # $$output = defined $value ? $value : "" ; | ||||||||||||||||||||||||||||||||||||||||||
| 353 | # return 1; | ||||||||||||||||||||||||||||||||||||||||||
| 354 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $$output = $value ; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | sub Compress::Raw::Zlib::Parameters::parsed | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 35 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parsed: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 35 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 365 | 35 | my $name = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | 35 | return $self->{Got}{lc $name}[OFF_PARSED] ; | |||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | sub Compress::Raw::Zlib::Parameters::value | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 784 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: called CC=2 SCAR=8.5
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 784 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 373 | 784 | my $name = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 784 | ▶ | if (@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | { | ||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $self->{Got}{lc $name}[OFF_PARSED] = 1; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | $self->{Got}{lc $name}[OFF_DEFAULT] = $_[0] ; | |||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | $self->{Got}{lc $name}[OFF_FIXED] = $_[0] ; | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | 784 | return $self->{Got}{lc $name}[OFF_FIXED] ; | |||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 6 | our $OPTIONS_deflate = | |||||||||||||||||||||||||||||||||||||||||
| 386 | { | ||||||||||||||||||||||||||||||||||||||||||
| 387 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 'Level' => [1, 1, Parse_signed, Z_DEFAULT_COMPRESSION()], | ||||||||||||||||||||||||||||||||||||||||||
| 393 | 'Method' => [1, 1, Parse_unsigned, Z_DEFLATED()], | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()], | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 'MemLevel' => [1, 1, Parse_unsigned, MAX_MEM_LEVEL()], | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 'Strategy' => [1, 1, Parse_unsigned, Z_DEFAULT_STRATEGY()], | ||||||||||||||||||||||||||||||||||||||||||
| 397 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||||||||||||||||||||||||||||||||||||||||
| 398 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | sub Compress::Raw::Zlib::Deflate::new | ||||||||||||||||||||||||||||||||||||||||||
| 401 | 39 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 39 | my $pkg = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 403 | 39 | my ($got) = ParseParameters(0, $OPTIONS_deflate, @_); | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 34 | ▶ | croak "Compress::Raw::Zlib::Deflate::new: Bufsize must be >= 1, you specified " . | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | $got->value('Bufsize') | ||||||||||||||||||||||||||||||||||||||||||
| 407 | unless $got->value('Bufsize') >= 1; | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 33 | my $flags = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 410 | 33 | ▶ | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 33 | ▶ | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 33 | ▶ | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 33 | my $windowBits = $got->value('WindowBits'); | |||||||||||||||||||||||||||||||||||||||||
| 415 | 33 | ▶ | $windowBits += MAX_WBITS() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | if ($windowBits & MAX_WBITS()) == 0 ; | ||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 33 | _deflateInit($flags, | |||||||||||||||||||||||||||||||||||||||||
| 419 | $got->value('Level'), | ||||||||||||||||||||||||||||||||||||||||||
| 420 | $got->value('Method'), | ||||||||||||||||||||||||||||||||||||||||||
| 421 | $windowBits, | ||||||||||||||||||||||||||||||||||||||||||
| 422 | $got->value('MemLevel'), | ||||||||||||||||||||||||||||||||||||||||||
| 423 | $got->value('Strategy'), | ||||||||||||||||||||||||||||||||||||||||||
| 424 | $got->value('Bufsize'), | ||||||||||||||||||||||||||||||||||||||||||
| 425 | $got->value('Dictionary')) ; | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | sub Compress::Raw::Zlib::deflateStream::STORABLE_freeze | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORABLE_freeze: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $type = ref shift; | |||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | croak "Cannot freeze $type object\n"; | |||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | sub Compress::Raw::Zlib::deflateStream::STORABLE_thaw | ||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORABLE_thaw: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | my $type = ref shift; | |||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | croak "Cannot thaw $type object\n"; | |||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 6 | our $OPTIONS_inflate = | |||||||||||||||||||||||||||||||||||||||||
| 443 | { | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 445 | 'LimitOutput' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 446 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 447 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 448 | 'ConsumeInput' => [1, 1, Parse_boolean, 1], | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()], | ||||||||||||||||||||||||||||||||||||||||||
| 452 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||||||||||||||||||||||||||||||||||||||||
| 453 | } ; | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | sub Compress::Raw::Zlib::Inflate::new | ||||||||||||||||||||||||||||||||||||||||||
| 456 | 50 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 457 | 50 | my $pkg = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 458 | 50 | my ($got) = ParseParameters(0, $OPTIONS_inflate, @_); | |||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | 45 | ▶ | croak "Compress::Raw::Zlib::Inflate::new: Bufsize must be >= 1, you specified " . | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 461 | $got->value('Bufsize') | ||||||||||||||||||||||||||||||||||||||||||
| 462 | unless $got->value('Bufsize') >= 1; | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 44 | my $flags = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 44 | ▶ | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 466 | 44 | ▶ | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | 44 | ▶ | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 44 | ▶ | $flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 44 | ▶ | $flags |= FLAG_LIMIT_OUTPUT if $got->value('LimitOutput') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 44 | my $windowBits = $got->value('WindowBits'); | |||||||||||||||||||||||||||||||||||||||||
| 473 | 44 | ▶ | $windowBits += MAX_WBITS() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | if ($windowBits & MAX_WBITS()) == 0 ; | ||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||
| 476 | 44 | _inflateInit($flags, $windowBits, $got->value('Bufsize'), | |||||||||||||||||||||||||||||||||||||||||
| 477 | $got->value('Dictionary')) ; | ||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | sub Compress::Raw::Zlib::inflateStream::STORABLE_freeze | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORABLE_freeze: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | my $type = ref shift; | |||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | croak "Cannot freeze $type object\n"; | |||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | sub Compress::Raw::Zlib::inflateStream::STORABLE_thaw | ||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORABLE_thaw: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | my $type = ref shift; | |||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | croak "Cannot thaw $type object\n"; | |||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | sub Compress::Raw::Zlib::InflateScan::new | ||||||||||||||||||||||||||||||||||||||||||
| 493 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.3
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | 1 | my $pkg = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 495 | 1 | my ($got) = ParseParameters(0, | |||||||||||||||||||||||||||||||||||||||||
| 496 | { | ||||||||||||||||||||||||||||||||||||||||||
| 497 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 498 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 499 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 'WindowBits' => [1, 1, Parse_signed, -MAX_WBITS()], | ||||||||||||||||||||||||||||||||||||||||||
| 502 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||||||||||||||||||||||||||||||||||||||||
| 503 | }, @_) ; | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | ▶ | croak "Compress::Raw::Zlib::InflateScan::new: Bufsize must be >= 1, you specified " . | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 507 | $got->value('Bufsize') | ||||||||||||||||||||||||||||||||||||||||||
| 508 | unless $got->value('Bufsize') >= 1; | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | 1 | my $flags = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 511 | #$flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||||||||||||||||||||||||||||||||||||||||
| 512 | 1 | ▶ | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 1 | ▶ | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | #$flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; | ||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | 1 | _inflateScanInit($flags, $got->value('WindowBits'), $got->value('Bufsize'), | |||||||||||||||||||||||||||||||||||||||||
| 517 | '') ; | ||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | sub Compress::Raw::Zlib::inflateScanStream::createDeflateStream | ||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createDeflateStream: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | my $pkg = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my ($got) = ParseParameters(0, | |||||||||||||||||||||||||||||||||||||||||
| 524 | { | ||||||||||||||||||||||||||||||||||||||||||
| 525 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 526 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 'Level' => [1, 1, Parse_signed, Z_DEFAULT_COMPRESSION()], | ||||||||||||||||||||||||||||||||||||||||||
| 531 | 'Method' => [1, 1, Parse_unsigned, Z_DEFLATED()], | ||||||||||||||||||||||||||||||||||||||||||
| 532 | 'WindowBits' => [1, 1, Parse_signed, - MAX_WBITS()], | ||||||||||||||||||||||||||||||||||||||||||
| 533 | 'MemLevel' => [1, 1, Parse_unsigned, MAX_MEM_LEVEL()], | ||||||||||||||||||||||||||||||||||||||||||
| 534 | 'Strategy' => [1, 1, Parse_unsigned, Z_DEFAULT_STRATEGY()], | ||||||||||||||||||||||||||||||||||||||||||
| 535 | }, @_) ; | ||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | croak "Compress::Raw::Zlib::InflateScan::createDeflateStream: Bufsize must be >= 1, you specified " . | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | $got->value('Bufsize') | ||||||||||||||||||||||||||||||||||||||||||
| 539 | unless $got->value('Bufsize') >= 1; | ||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my $flags = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $pkg->_createDeflateStream($flags, | |||||||||||||||||||||||||||||||||||||||||
| 547 | $got->value('Level'), | ||||||||||||||||||||||||||||||||||||||||||
| 548 | $got->value('Method'), | ||||||||||||||||||||||||||||||||||||||||||
| 549 | $got->value('WindowBits'), | ||||||||||||||||||||||||||||||||||||||||||
| 550 | $got->value('MemLevel'), | ||||||||||||||||||||||||||||||||||||||||||
| 551 | $got->value('Strategy'), | ||||||||||||||||||||||||||||||||||||||||||
| 552 | $got->value('Bufsize'), | ||||||||||||||||||||||||||||||||||||||||||
| 553 | ) ; | ||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | sub Compress::Raw::Zlib::inflateScanStream::inflate | ||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inflate: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | my $buffer = $_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | my $eof = $_[2]; | |||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | my $status = $self->scan(@_); | |||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | if ($status == Z_OK() && $_[2]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$status == Z_OK() and $_[2]
MC/DC0%0/2
$status == Z_OK() and $_[2]
$status == Z_OK()
$_[2]
Truth table0%0/3
A and B
A= $status == Z_OK()B= $_[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | my $byte = ' '; | |||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | $status = $self->scan(\$byte, $_[1]) ; | |||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | return $status ; | |||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||
| 574 | sub Compress::Raw::Zlib::deflateStream::deflateParams | ||||||||||||||||||||||||||||||||||||||||||
| 575 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deflateParams: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||
| 576 | 7 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 577 | 7 | my ($got) = ParseParameters(0, { | |||||||||||||||||||||||||||||||||||||||||
| 578 | 'Level' => [1, 1, Parse_signed, undef], | ||||||||||||||||||||||||||||||||||||||||||
| 579 | 'Strategy' => [1, 1, Parse_unsigned, undef], | ||||||||||||||||||||||||||||||||||||||||||
| 580 | 'Bufsize' => [1, 1, Parse_unsigned, undef], | ||||||||||||||||||||||||||||||||||||||||||
| 581 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 582 | @_) ; | ||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | 6 | ▶ | croak "Compress::Raw::Zlib::deflateParams needs Level and/or Strategy" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 585 | unless $got->parsed('Level') + $got->parsed('Strategy') + | ||||||||||||||||||||||||||||||||||||||||||
| 586 | $got->parsed('Bufsize'); | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | 5 | ▶ | croak "Compress::Raw::Zlib::Inflate::deflateParams: Bufsize must be >= 1, you specified " . | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$got->parsed("Bufsize") and $got->value("Bufsize") <= 1
MC/DC100%2/2
$got->parsed("Bufsize") and $got->value("Bufsize") <= 1
$got->parsed("Bufsize")
$got->value("Bufsize") <= 1
Truth table100%3/3
A and B
A= $got->parsed("Bufsize")B= $got->value("Bufsize") <= 1
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | $got->value('Bufsize') | ||||||||||||||||||||||||||||||||||||||||||
| 590 | if $got->parsed('Bufsize') && $got->value('Bufsize') <= 1; | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 4 | my $flags = 0; | |||||||||||||||||||||||||||||||||||||||||
| 593 | 4 | ▶ | $flags |= 1 if $got->parsed('Level') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 594 | 4 | ▶ | $flags |= 2 if $got->parsed('Strategy') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 595 | 4 | ▶ | $flags |= 4 if $got->parsed('Bufsize') ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | 4 | $self->_deflateParams($flags, $got->value('Level'), | |||||||||||||||||||||||||||||||||||||||||
| 598 | $got->value('Strategy'), $got->value('Bufsize')); | ||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||
| 603 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 604 | __END__ | ||||||||||||||||||||||||||||||||||||||||||