| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/x86_64-linux/Compress/Raw/Zlib.pm |
| Statements | Executed 99 statements in 1.95ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 5 | 1 | 1 | 32µs | 40µs | Compress::Raw::Zlib::AUTOLOAD |
| 1 | 1 | 1 | 7µs | 28µs | Compress::Raw::Zlib::BEGIN@6 |
| 5 | 1 | 1 | 5µs | 5µs | Compress::Raw::Zlib::CORE:subst (opcode) |
| 1 | 1 | 1 | 5µs | 15µs | Compress::Raw::Zlib::BEGIN@113 |
| 1 | 1 | 1 | 5µs | 28µs | Compress::Raw::Zlib::BEGIN@105 |
| 1 | 1 | 1 | 4µs | 19µs | Compress::Raw::Zlib::BEGIN@119 |
| 1 | 1 | 1 | 4µs | 5µs | Compress::Raw::Zlib::BEGIN@10 |
| 1 | 1 | 1 | 4µs | 22µs | Compress::Raw::Zlib::BEGIN@106 |
| 1 | 1 | 1 | 4µs | 24µs | Compress::Raw::Zlib::BEGIN@118 |
| 1 | 1 | 1 | 4µs | 18µs | Compress::Raw::Zlib::BEGIN@145 |
| 1 | 1 | 1 | 4µs | 7µs | Compress::Raw::Zlib::BEGIN@9 |
| 1 | 1 | 1 | 4µs | 19µs | Compress::Raw::Zlib::BEGIN@136 |
| 1 | 1 | 1 | 4µs | 5µs | Compress::Raw::Zlib::BEGIN@8 |
| 8 | 3 | 2 | 4µs | 4µs | Compress::Raw::Zlib::__ANON__[:114] |
| 1 | 1 | 1 | 4µs | 17µs | Compress::Raw::Zlib::BEGIN@150 |
| 1 | 1 | 1 | 3µs | 18µs | Compress::Raw::Zlib::BEGIN@137 |
| 1 | 1 | 1 | 3µs | 18µs | Compress::Raw::Zlib::BEGIN@139 |
| 1 | 1 | 1 | 3µs | 16µs | Compress::Raw::Zlib::BEGIN@148 |
| 1 | 1 | 1 | 3µs | 17µs | Compress::Raw::Zlib::BEGIN@138 |
| 1 | 1 | 1 | 3µs | 16µs | Compress::Raw::Zlib::BEGIN@146 |
| 1 | 1 | 1 | 3µs | 20µs | Compress::Raw::Zlib::BEGIN@120 |
| 1 | 1 | 1 | 3µs | 17µs | Compress::Raw::Zlib::BEGIN@121 |
| 1 | 1 | 1 | 3µs | 17µs | Compress::Raw::Zlib::BEGIN@122 |
| 1 | 1 | 1 | 3µs | 17µs | Compress::Raw::Zlib::BEGIN@147 |
| 1 | 1 | 1 | 3µs | 22µs | Compress::Raw::Zlib::BEGIN@149 |
| 5 | 1 | 1 | 3µs | 3µs | Compress::Raw::Zlib::constant (xsub) |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::Deflate::new |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::Inflate::new |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::InflateScan::new |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::Parameters::_checkType |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::Parameters::new |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::Parameters::parse |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::Parameters::parsed |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::Parameters::setError |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::Parameters::value |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::ParseParameters |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::deflateStream::STORABLE_freeze |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::deflateStream::STORABLE_thaw |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::deflateStream::deflateParams |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::inflateScanStream::createDeflateStream |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::inflateScanStream::inflate |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::inflateStream::STORABLE_freeze |
| 0 | 0 | 0 | 0s | 0s | Compress::Raw::Zlib::inflateStream::STORABLE_thaw |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Compress::Raw::Zlib; | ||||
| 3 | |||||
| 4 | 1 | 6µs | require 5.006 ; | ||
| 5 | 1 | 300ns | require Exporter; | ||
| 6 | 2 | 14µs | 2 | 48µs | # spent 28µs (7+20) within Compress::Raw::Zlib::BEGIN@6 which was called:
# once (7µs+20µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 6 # spent 28µs making 1 call to Compress::Raw::Zlib::BEGIN@6
# spent 20µs making 1 call to Exporter::import |
| 7 | |||||
| 8 | 2 | 11µs | 2 | 6µs | # spent 5µs (4+1) within Compress::Raw::Zlib::BEGIN@8 which was called:
# once (4µs+1µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 8 # spent 5µs making 1 call to Compress::Raw::Zlib::BEGIN@8
# spent 1µs making 1 call to strict::import |
| 9 | 2 | 11µs | 2 | 9µs | # spent 7µs (4+3) within Compress::Raw::Zlib::BEGIN@9 which was called:
# once (4µs+3µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 9 # spent 7µs making 1 call to Compress::Raw::Zlib::BEGIN@9
# spent 3µs making 1 call to warnings::import |
| 10 | 2 | 119µs | 2 | 6µs | # spent 5µs (4+700ns) within Compress::Raw::Zlib::BEGIN@10 which was called:
# once (4µs+700ns) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 10 # spent 5µs making 1 call to Compress::Raw::Zlib::BEGIN@10
# spent 700ns making 1 call to bytes::import |
| 11 | our ($VERSION, $XS_VERSION, @ISA, @EXPORT, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD, %DEFLATE_CONSTANTS, @DEFLATE_CONSTANTS); | ||||
| 12 | |||||
| 13 | 1 | 300ns | $VERSION = '2.068'; | ||
| 14 | 1 | 200ns | $XS_VERSION = $VERSION; | ||
| 15 | 1 | 10µs | $VERSION = eval $VERSION; # spent 2µs executing statements in string eval | ||
| 16 | |||||
| 17 | 1 | 4µs | @ISA = qw(Exporter); | ||
| 18 | 1 | 4µs | %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 | 1 | 2µs | %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 | 1 | 3µs | @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 | WANT_GZIP | ||||
| 100 | WANT_GZIP_OR_ZLIB | ||||
| 101 | ); | ||||
| 102 | |||||
| 103 | 1 | 500ns | push @EXPORT, qw(crc32 adler32 DEF_WBITS); | ||
| 104 | |||||
| 105 | 2 | 25µs | 2 | 52µs | # spent 28µs (5+24) within Compress::Raw::Zlib::BEGIN@105 which was called:
# once (5µs+24µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 105 # spent 28µs making 1 call to Compress::Raw::Zlib::BEGIN@105
# spent 24µs making 1 call to constant::import |
| 106 | 2 | 48µs | 2 | 40µs | # spent 22µs (4+18) within Compress::Raw::Zlib::BEGIN@106 which was called:
# once (4µs+18µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 106 # spent 22µs making 1 call to Compress::Raw::Zlib::BEGIN@106
# spent 18µs making 1 call to constant::import |
| 107 | |||||
| 108 | # spent 40µs (32+8) within Compress::Raw::Zlib::AUTOLOAD which was called 5 times, avg 8µs/call:
# 5 times (32µs+8µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 377, avg 8µs/call | ||||
| 109 | 5 | 300ns | my($constname); | ||
| 110 | 5 | 14µs | 5 | 5µs | ($constname = $AUTOLOAD) =~ s/.*:://; # spent 5µs making 5 calls to Compress::Raw::Zlib::CORE:subst, avg 1µs/call |
| 111 | 5 | 12µs | 5 | 3µs | my ($error, $val) = constant($constname); # spent 3µs making 5 calls to Compress::Raw::Zlib::constant, avg 600ns/call |
| 112 | 5 | 300ns | Carp::croak $error if $error; | ||
| 113 | 2 | 49µs | 2 | 25µs | # spent 15µs (5+10) within Compress::Raw::Zlib::BEGIN@113 which was called:
# once (5µs+10µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 113 # spent 15µs making 1 call to Compress::Raw::Zlib::BEGIN@113
# spent 10µs making 1 call to strict::unimport |
| 114 | 13 | 18µs | # spent 4µs within Compress::Raw::Zlib::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/x86_64-linux/Compress/Raw/Zlib.pm:114] which was called 8 times, avg 462ns/call:
# 5 times (2µs+0s) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 115, avg 480ns/call
# 2 times (900ns+0s) by IO::Compress::Deflate::BEGIN@11 at line 121 of IO/Compress/RawDeflate.pm, avg 450ns/call
# once (400ns+0s) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 434 | ||
| 115 | 5 | 12µs | 5 | 2µs | goto &{$AUTOLOAD}; # spent 2µs making 5 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:114], avg 480ns/call |
| 116 | } | ||||
| 117 | |||||
| 118 | 2 | 16µs | 2 | 44µs | # spent 24µs (4+20) within Compress::Raw::Zlib::BEGIN@118 which was called:
# once (4µs+20µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 118 # spent 24µs making 1 call to Compress::Raw::Zlib::BEGIN@118
# spent 20µs making 1 call to constant::import |
| 119 | 2 | 13µs | 2 | 34µs | # spent 19µs (4+15) within Compress::Raw::Zlib::BEGIN@119 which was called:
# once (4µs+15µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 119 # spent 19µs making 1 call to Compress::Raw::Zlib::BEGIN@119
# spent 15µs making 1 call to constant::import |
| 120 | 2 | 14µs | 2 | 36µs | # spent 20µs (3+16) within Compress::Raw::Zlib::BEGIN@120 which was called:
# once (3µs+16µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 120 # spent 20µs making 1 call to Compress::Raw::Zlib::BEGIN@120
# spent 16µs making 1 call to constant::import |
| 121 | 2 | 15µs | 2 | 31µs | # spent 17µs (3+14) within Compress::Raw::Zlib::BEGIN@121 which was called:
# once (3µs+14µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 121 # spent 17µs making 1 call to Compress::Raw::Zlib::BEGIN@121
# spent 14µs making 1 call to constant::import |
| 122 | 2 | 40µs | 2 | 31µs | # spent 17µs (3+14) within Compress::Raw::Zlib::BEGIN@122 which was called:
# once (3µs+14µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 122 # spent 17µs making 1 call to Compress::Raw::Zlib::BEGIN@122
# spent 14µs making 1 call to constant::import |
| 123 | |||||
| 124 | eval { | ||||
| 125 | 1 | 300ns | require XSLoader; | ||
| 126 | 1 | 198µs | 1 | 193µs | XSLoader::load('Compress::Raw::Zlib', $XS_VERSION); # spent 193µs making 1 call to XSLoader::load |
| 127 | 1 | 500ns | 1; | ||
| 128 | } | ||||
| 129 | 1 | 500ns | or do { | ||
| 130 | require DynaLoader; | ||||
| 131 | local @ISA = qw(DynaLoader); | ||||
| 132 | bootstrap Compress::Raw::Zlib $XS_VERSION ; | ||||
| 133 | }; | ||||
| 134 | |||||
| 135 | |||||
| 136 | 2 | 13µs | 2 | 35µs | # spent 19µs (4+16) within Compress::Raw::Zlib::BEGIN@136 which was called:
# once (4µs+16µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 136 # spent 19µs making 1 call to Compress::Raw::Zlib::BEGIN@136
# spent 16µs making 1 call to constant::import |
| 137 | 2 | 12µs | 2 | 32µs | # spent 18µs (3+14) within Compress::Raw::Zlib::BEGIN@137 which was called:
# once (3µs+14µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 137 # spent 18µs making 1 call to Compress::Raw::Zlib::BEGIN@137
# spent 14µs making 1 call to constant::import |
| 138 | 2 | 14µs | 2 | 30µs | # spent 17µs (3+13) within Compress::Raw::Zlib::BEGIN@138 which was called:
# once (3µs+13µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 138 # spent 17µs making 1 call to Compress::Raw::Zlib::BEGIN@138
# spent 14µs making 1 call to constant::import |
| 139 | 2 | 15µs | 2 | 34µs | # spent 18µs (3+15) within Compress::Raw::Zlib::BEGIN@139 which was called:
# once (3µs+15µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 139 # spent 18µs making 1 call to Compress::Raw::Zlib::BEGIN@139
# spent 15µs making 1 call to constant::import |
| 140 | #use constant Parse_string => 0x10; | ||||
| 141 | #use constant Parse_custom => 0x12; | ||||
| 142 | |||||
| 143 | #use constant Parse_store_ref => 0x100 ; | ||||
| 144 | |||||
| 145 | 2 | 12µs | 2 | 32µs | # spent 18µs (4+14) within Compress::Raw::Zlib::BEGIN@145 which was called:
# once (4µs+14µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 145 # spent 18µs making 1 call to Compress::Raw::Zlib::BEGIN@145
# spent 14µs making 1 call to constant::import |
| 146 | 2 | 12µs | 2 | 29µs | # spent 16µs (3+13) within Compress::Raw::Zlib::BEGIN@146 which was called:
# once (3µs+13µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 146 # spent 16µs making 1 call to Compress::Raw::Zlib::BEGIN@146
# spent 13µs making 1 call to constant::import |
| 147 | 2 | 13µs | 2 | 30µs | # spent 17µs (3+13) within Compress::Raw::Zlib::BEGIN@147 which was called:
# once (3µs+13µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 147 # spent 17µs making 1 call to Compress::Raw::Zlib::BEGIN@147
# spent 13µs making 1 call to constant::import |
| 148 | 2 | 12µs | 2 | 29µs | # spent 16µs (3+13) within Compress::Raw::Zlib::BEGIN@148 which was called:
# once (3µs+13µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 148 # spent 16µs making 1 call to Compress::Raw::Zlib::BEGIN@148
# spent 13µs making 1 call to constant::import |
| 149 | 2 | 12µs | 2 | 42µs | # spent 22µs (3+19) within Compress::Raw::Zlib::BEGIN@149 which was called:
# once (3µs+19µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 149 # spent 22µs making 1 call to Compress::Raw::Zlib::BEGIN@149
# spent 19µs making 1 call to constant::import |
| 150 | 2 | 1.15ms | 2 | 30µs | # spent 17µs (4+13) within Compress::Raw::Zlib::BEGIN@150 which was called:
# once (4µs+13µs) by IO::Compress::Adapter::Deflate::BEGIN@8 at line 150 # spent 17µs making 1 call to Compress::Raw::Zlib::BEGIN@150
# spent 13µs making 1 call to constant::import |
| 151 | |||||
| - - | |||||
| 154 | sub ParseParameters | ||||
| 155 | { | ||||
| 156 | my $level = shift || 0 ; | ||||
| 157 | |||||
| 158 | my $sub = (caller($level + 1))[3] ; | ||||
| 159 | #local $Carp::CarpLevel = 1 ; | ||||
| 160 | my $p = new Compress::Raw::Zlib::Parameters() ; | ||||
| 161 | $p->parse(@_) | ||||
| 162 | or croak "$sub: $p->{Error}" ; | ||||
| 163 | |||||
| 164 | return $p; | ||||
| 165 | } | ||||
| 166 | |||||
| 167 | |||||
| 168 | sub Compress::Raw::Zlib::Parameters::new | ||||
| 169 | { | ||||
| 170 | my $class = shift ; | ||||
| 171 | |||||
| 172 | my $obj = { Error => '', | ||||
| 173 | Got => {}, | ||||
| 174 | } ; | ||||
| 175 | |||||
| 176 | #return bless $obj, ref($class) || $class || __PACKAGE__ ; | ||||
| 177 | return bless $obj, 'Compress::Raw::Zlib::Parameters' ; | ||||
| 178 | } | ||||
| 179 | |||||
| 180 | sub Compress::Raw::Zlib::Parameters::setError | ||||
| 181 | { | ||||
| 182 | my $self = shift ; | ||||
| 183 | my $error = shift ; | ||||
| 184 | my $retval = @_ ? shift : undef ; | ||||
| 185 | |||||
| 186 | $self->{Error} = $error ; | ||||
| 187 | return $retval; | ||||
| 188 | } | ||||
| 189 | |||||
| 190 | #sub getError | ||||
| 191 | #{ | ||||
| 192 | # my $self = shift ; | ||||
| 193 | # return $self->{Error} ; | ||||
| 194 | #} | ||||
| 195 | |||||
| 196 | sub Compress::Raw::Zlib::Parameters::parse | ||||
| 197 | { | ||||
| 198 | my $self = shift ; | ||||
| 199 | |||||
| 200 | my $default = shift ; | ||||
| 201 | |||||
| 202 | my $got = $self->{Got} ; | ||||
| 203 | my $firstTime = keys %{ $got } == 0 ; | ||||
| 204 | |||||
| 205 | my (@Bad) ; | ||||
| 206 | my @entered = () ; | ||||
| 207 | |||||
| 208 | # Allow the options to be passed as a hash reference or | ||||
| 209 | # as the complete hash. | ||||
| 210 | if (@_ == 0) { | ||||
| 211 | @entered = () ; | ||||
| 212 | } | ||||
| 213 | elsif (@_ == 1) { | ||||
| 214 | my $href = $_[0] ; | ||||
| 215 | return $self->setError("Expected even number of parameters, got 1") | ||||
| 216 | if ! defined $href or ! ref $href or ref $href ne "HASH" ; | ||||
| 217 | |||||
| 218 | foreach my $key (keys %$href) { | ||||
| 219 | push @entered, $key ; | ||||
| 220 | push @entered, \$href->{$key} ; | ||||
| 221 | } | ||||
| 222 | } | ||||
| 223 | else { | ||||
| 224 | my $count = @_; | ||||
| 225 | return $self->setError("Expected even number of parameters, got $count") | ||||
| 226 | if $count % 2 != 0 ; | ||||
| 227 | |||||
| 228 | for my $i (0.. $count / 2 - 1) { | ||||
| 229 | push @entered, $_[2* $i] ; | ||||
| 230 | push @entered, \$_[2* $i+1] ; | ||||
| 231 | } | ||||
| 232 | } | ||||
| 233 | |||||
| 234 | |||||
| 235 | while (my ($key, $v) = each %$default) | ||||
| 236 | { | ||||
| 237 | croak "need 4 params [@$v]" | ||||
| 238 | if @$v != 4 ; | ||||
| 239 | |||||
| 240 | my ($first_only, $sticky, $type, $value) = @$v ; | ||||
| 241 | my $x ; | ||||
| 242 | $self->_checkType($key, \$value, $type, 0, \$x) | ||||
| 243 | or return undef ; | ||||
| 244 | |||||
| 245 | $key = lc $key; | ||||
| 246 | |||||
| 247 | if ($firstTime || ! $sticky) { | ||||
| 248 | $got->{$key} = [0, $type, $value, $x, $first_only, $sticky] ; | ||||
| 249 | } | ||||
| 250 | |||||
| 251 | $got->{$key}[OFF_PARSED] = 0 ; | ||||
| 252 | } | ||||
| 253 | |||||
| 254 | for my $i (0.. @entered / 2 - 1) { | ||||
| 255 | my $key = $entered[2* $i] ; | ||||
| 256 | my $value = $entered[2* $i+1] ; | ||||
| 257 | |||||
| 258 | #print "Key [$key] Value [$value]" ; | ||||
| 259 | #print defined $$value ? "[$$value]\n" : "[undef]\n"; | ||||
| 260 | |||||
| 261 | $key =~ s/^-// ; | ||||
| 262 | my $canonkey = lc $key; | ||||
| 263 | |||||
| 264 | if ($got->{$canonkey} && ($firstTime || | ||||
| 265 | ! $got->{$canonkey}[OFF_FIRST_ONLY] )) | ||||
| 266 | { | ||||
| 267 | my $type = $got->{$canonkey}[OFF_TYPE] ; | ||||
| 268 | my $s ; | ||||
| 269 | $self->_checkType($key, $value, $type, 1, \$s) | ||||
| 270 | or return undef ; | ||||
| 271 | #$value = $$value unless $type & Parse_store_ref ; | ||||
| 272 | $value = $$value ; | ||||
| 273 | $got->{$canonkey} = [1, $type, $value, $s] ; | ||||
| 274 | } | ||||
| 275 | else | ||||
| 276 | { push (@Bad, $key) } | ||||
| 277 | } | ||||
| 278 | |||||
| 279 | if (@Bad) { | ||||
| 280 | my ($bad) = join(", ", @Bad) ; | ||||
| 281 | return $self->setError("unknown key value(s) @Bad") ; | ||||
| 282 | } | ||||
| 283 | |||||
| 284 | return 1; | ||||
| 285 | } | ||||
| 286 | |||||
| 287 | sub Compress::Raw::Zlib::Parameters::_checkType | ||||
| 288 | { | ||||
| 289 | my $self = shift ; | ||||
| 290 | |||||
| 291 | my $key = shift ; | ||||
| 292 | my $value = shift ; | ||||
| 293 | my $type = shift ; | ||||
| 294 | my $validate = shift ; | ||||
| 295 | my $output = shift; | ||||
| 296 | |||||
| 297 | #local $Carp::CarpLevel = $level ; | ||||
| 298 | #print "PARSE $type $key $value $validate $sub\n" ; | ||||
| 299 | # if ( $type & Parse_store_ref) | ||||
| 300 | # { | ||||
| 301 | # #$value = $$value | ||||
| 302 | # # if ref ${ $value } ; | ||||
| 303 | # | ||||
| 304 | # $$output = $value ; | ||||
| 305 | # return 1; | ||||
| 306 | # } | ||||
| 307 | |||||
| 308 | $value = $$value ; | ||||
| 309 | |||||
| 310 | if ($type & Parse_any) | ||||
| 311 | { | ||||
| 312 | $$output = $value ; | ||||
| 313 | return 1; | ||||
| 314 | } | ||||
| 315 | elsif ($type & Parse_unsigned) | ||||
| 316 | { | ||||
| 317 | return $self->setError("Parameter '$key' must be an unsigned int, got 'undef'") | ||||
| 318 | if $validate && ! defined $value ; | ||||
| 319 | return $self->setError("Parameter '$key' must be an unsigned int, got '$value'") | ||||
| 320 | if $validate && $value !~ /^\d+$/; | ||||
| 321 | |||||
| 322 | $$output = defined $value ? $value : 0 ; | ||||
| 323 | return 1; | ||||
| 324 | } | ||||
| 325 | elsif ($type & Parse_signed) | ||||
| 326 | { | ||||
| 327 | return $self->setError("Parameter '$key' must be a signed int, got 'undef'") | ||||
| 328 | if $validate && ! defined $value ; | ||||
| 329 | return $self->setError("Parameter '$key' must be a signed int, got '$value'") | ||||
| 330 | if $validate && $value !~ /^-?\d+$/; | ||||
| 331 | |||||
| 332 | $$output = defined $value ? $value : 0 ; | ||||
| 333 | return 1 ; | ||||
| 334 | } | ||||
| 335 | elsif ($type & Parse_boolean) | ||||
| 336 | { | ||||
| 337 | return $self->setError("Parameter '$key' must be an int, got '$value'") | ||||
| 338 | if $validate && defined $value && $value !~ /^\d*$/; | ||||
| 339 | $$output = defined $value ? $value != 0 : 0 ; | ||||
| 340 | return 1; | ||||
| 341 | } | ||||
| 342 | # elsif ($type & Parse_string) | ||||
| 343 | # { | ||||
| 344 | # $$output = defined $value ? $value : "" ; | ||||
| 345 | # return 1; | ||||
| 346 | # } | ||||
| 347 | |||||
| 348 | $$output = $value ; | ||||
| 349 | return 1; | ||||
| 350 | } | ||||
| 351 | |||||
| - - | |||||
| 354 | sub Compress::Raw::Zlib::Parameters::parsed | ||||
| 355 | { | ||||
| 356 | my $self = shift ; | ||||
| 357 | my $name = shift ; | ||||
| 358 | |||||
| 359 | return $self->{Got}{lc $name}[OFF_PARSED] ; | ||||
| 360 | } | ||||
| 361 | |||||
| 362 | sub Compress::Raw::Zlib::Parameters::value | ||||
| 363 | { | ||||
| 364 | my $self = shift ; | ||||
| 365 | my $name = shift ; | ||||
| 366 | |||||
| 367 | if (@_) | ||||
| 368 | { | ||||
| 369 | $self->{Got}{lc $name}[OFF_PARSED] = 1; | ||||
| 370 | $self->{Got}{lc $name}[OFF_DEFAULT] = $_[0] ; | ||||
| 371 | $self->{Got}{lc $name}[OFF_FIXED] = $_[0] ; | ||||
| 372 | } | ||||
| 373 | |||||
| 374 | return $self->{Got}{lc $name}[OFF_FIXED] ; | ||||
| 375 | } | ||||
| 376 | |||||
| 377 | 1 | 12µs | 5 | 40µs | our $OPTIONS_deflate = # spent 40µs making 5 calls to Compress::Raw::Zlib::AUTOLOAD, avg 8µs/call |
| 378 | { | ||||
| 379 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||
| 380 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||
| 381 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||
| 382 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||
| 383 | |||||
| 384 | 'Level' => [1, 1, Parse_signed, Z_DEFAULT_COMPRESSION()], | ||||
| 385 | 'Method' => [1, 1, Parse_unsigned, Z_DEFLATED()], | ||||
| 386 | 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()], | ||||
| 387 | 'MemLevel' => [1, 1, Parse_unsigned, MAX_MEM_LEVEL()], | ||||
| 388 | 'Strategy' => [1, 1, Parse_unsigned, Z_DEFAULT_STRATEGY()], | ||||
| 389 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||
| 390 | }; | ||||
| 391 | |||||
| 392 | sub Compress::Raw::Zlib::Deflate::new | ||||
| 393 | { | ||||
| 394 | my $pkg = shift ; | ||||
| 395 | my ($got) = ParseParameters(0, $OPTIONS_deflate, @_); | ||||
| 396 | |||||
| 397 | croak "Compress::Raw::Zlib::Deflate::new: Bufsize must be >= 1, you specified " . | ||||
| 398 | $got->value('Bufsize') | ||||
| 399 | unless $got->value('Bufsize') >= 1; | ||||
| 400 | |||||
| 401 | my $flags = 0 ; | ||||
| 402 | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||
| 403 | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||
| 404 | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||
| 405 | |||||
| 406 | my $windowBits = $got->value('WindowBits'); | ||||
| 407 | $windowBits += MAX_WBITS() | ||||
| 408 | if ($windowBits & MAX_WBITS()) == 0 ; | ||||
| 409 | |||||
| 410 | _deflateInit($flags, | ||||
| 411 | $got->value('Level'), | ||||
| 412 | $got->value('Method'), | ||||
| 413 | $windowBits, | ||||
| 414 | $got->value('MemLevel'), | ||||
| 415 | $got->value('Strategy'), | ||||
| 416 | $got->value('Bufsize'), | ||||
| 417 | $got->value('Dictionary')) ; | ||||
| 418 | |||||
| 419 | } | ||||
| 420 | |||||
| 421 | sub Compress::Raw::Zlib::deflateStream::STORABLE_freeze | ||||
| 422 | { | ||||
| 423 | my $type = ref shift; | ||||
| 424 | croak "Cannot freeze $type object\n"; | ||||
| 425 | } | ||||
| 426 | |||||
| 427 | sub Compress::Raw::Zlib::deflateStream::STORABLE_thaw | ||||
| 428 | { | ||||
| 429 | my $type = ref shift; | ||||
| 430 | croak "Cannot thaw $type object\n"; | ||||
| 431 | } | ||||
| 432 | |||||
| 433 | |||||
| 434 | 1 | 4µs | 1 | 400ns | our $OPTIONS_inflate = # spent 400ns making 1 call to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:114] |
| 435 | { | ||||
| 436 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||
| 437 | 'LimitOutput' => [1, 1, Parse_boolean, 0], | ||||
| 438 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||
| 439 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||
| 440 | 'ConsumeInput' => [1, 1, Parse_boolean, 1], | ||||
| 441 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||
| 442 | |||||
| 443 | 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()], | ||||
| 444 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||
| 445 | } ; | ||||
| 446 | |||||
| 447 | sub Compress::Raw::Zlib::Inflate::new | ||||
| 448 | { | ||||
| 449 | my $pkg = shift ; | ||||
| 450 | my ($got) = ParseParameters(0, $OPTIONS_inflate, @_); | ||||
| 451 | |||||
| 452 | croak "Compress::Raw::Zlib::Inflate::new: Bufsize must be >= 1, you specified " . | ||||
| 453 | $got->value('Bufsize') | ||||
| 454 | unless $got->value('Bufsize') >= 1; | ||||
| 455 | |||||
| 456 | my $flags = 0 ; | ||||
| 457 | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||
| 458 | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||
| 459 | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||
| 460 | $flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; | ||||
| 461 | $flags |= FLAG_LIMIT_OUTPUT if $got->value('LimitOutput') ; | ||||
| 462 | |||||
| 463 | |||||
| 464 | my $windowBits = $got->value('WindowBits'); | ||||
| 465 | $windowBits += MAX_WBITS() | ||||
| 466 | if ($windowBits & MAX_WBITS()) == 0 ; | ||||
| 467 | |||||
| 468 | _inflateInit($flags, $windowBits, $got->value('Bufsize'), | ||||
| 469 | $got->value('Dictionary')) ; | ||||
| 470 | } | ||||
| 471 | |||||
| 472 | sub Compress::Raw::Zlib::inflateStream::STORABLE_freeze | ||||
| 473 | { | ||||
| 474 | my $type = ref shift; | ||||
| 475 | croak "Cannot freeze $type object\n"; | ||||
| 476 | } | ||||
| 477 | |||||
| 478 | sub Compress::Raw::Zlib::inflateStream::STORABLE_thaw | ||||
| 479 | { | ||||
| 480 | my $type = ref shift; | ||||
| 481 | croak "Cannot thaw $type object\n"; | ||||
| 482 | } | ||||
| 483 | |||||
| 484 | sub Compress::Raw::Zlib::InflateScan::new | ||||
| 485 | { | ||||
| 486 | my $pkg = shift ; | ||||
| 487 | my ($got) = ParseParameters(0, | ||||
| 488 | { | ||||
| 489 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||
| 490 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||
| 491 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||
| 492 | |||||
| 493 | 'WindowBits' => [1, 1, Parse_signed, -MAX_WBITS()], | ||||
| 494 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||
| 495 | }, @_) ; | ||||
| 496 | |||||
| 497 | |||||
| 498 | croak "Compress::Raw::Zlib::InflateScan::new: Bufsize must be >= 1, you specified " . | ||||
| 499 | $got->value('Bufsize') | ||||
| 500 | unless $got->value('Bufsize') >= 1; | ||||
| 501 | |||||
| 502 | my $flags = 0 ; | ||||
| 503 | #$flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||
| 504 | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||
| 505 | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||
| 506 | #$flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; | ||||
| 507 | |||||
| 508 | _inflateScanInit($flags, $got->value('WindowBits'), $got->value('Bufsize'), | ||||
| 509 | '') ; | ||||
| 510 | } | ||||
| 511 | |||||
| 512 | sub Compress::Raw::Zlib::inflateScanStream::createDeflateStream | ||||
| 513 | { | ||||
| 514 | my $pkg = shift ; | ||||
| 515 | my ($got) = ParseParameters(0, | ||||
| 516 | { | ||||
| 517 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||
| 518 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||
| 519 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||
| 520 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||
| 521 | |||||
| 522 | 'Level' => [1, 1, Parse_signed, Z_DEFAULT_COMPRESSION()], | ||||
| 523 | 'Method' => [1, 1, Parse_unsigned, Z_DEFLATED()], | ||||
| 524 | 'WindowBits' => [1, 1, Parse_signed, - MAX_WBITS()], | ||||
| 525 | 'MemLevel' => [1, 1, Parse_unsigned, MAX_MEM_LEVEL()], | ||||
| 526 | 'Strategy' => [1, 1, Parse_unsigned, Z_DEFAULT_STRATEGY()], | ||||
| 527 | }, @_) ; | ||||
| 528 | |||||
| 529 | croak "Compress::Raw::Zlib::InflateScan::createDeflateStream: Bufsize must be >= 1, you specified " . | ||||
| 530 | $got->value('Bufsize') | ||||
| 531 | unless $got->value('Bufsize') >= 1; | ||||
| 532 | |||||
| 533 | my $flags = 0 ; | ||||
| 534 | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||
| 535 | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||
| 536 | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||
| 537 | |||||
| 538 | $pkg->_createDeflateStream($flags, | ||||
| 539 | $got->value('Level'), | ||||
| 540 | $got->value('Method'), | ||||
| 541 | $got->value('WindowBits'), | ||||
| 542 | $got->value('MemLevel'), | ||||
| 543 | $got->value('Strategy'), | ||||
| 544 | $got->value('Bufsize'), | ||||
| 545 | ) ; | ||||
| 546 | |||||
| 547 | } | ||||
| 548 | |||||
| 549 | sub Compress::Raw::Zlib::inflateScanStream::inflate | ||||
| 550 | { | ||||
| 551 | my $self = shift ; | ||||
| 552 | my $buffer = $_[1]; | ||||
| 553 | my $eof = $_[2]; | ||||
| 554 | |||||
| 555 | my $status = $self->scan(@_); | ||||
| 556 | |||||
| 557 | if ($status == Z_OK() && $_[2]) { | ||||
| 558 | my $byte = ' '; | ||||
| 559 | |||||
| 560 | $status = $self->scan(\$byte, $_[1]) ; | ||||
| 561 | } | ||||
| 562 | |||||
| 563 | return $status ; | ||||
| 564 | } | ||||
| 565 | |||||
| 566 | sub Compress::Raw::Zlib::deflateStream::deflateParams | ||||
| 567 | { | ||||
| 568 | my $self = shift ; | ||||
| 569 | my ($got) = ParseParameters(0, { | ||||
| 570 | 'Level' => [1, 1, Parse_signed, undef], | ||||
| 571 | 'Strategy' => [1, 1, Parse_unsigned, undef], | ||||
| 572 | 'Bufsize' => [1, 1, Parse_unsigned, undef], | ||||
| 573 | }, | ||||
| 574 | @_) ; | ||||
| 575 | |||||
| 576 | croak "Compress::Raw::Zlib::deflateParams needs Level and/or Strategy" | ||||
| 577 | unless $got->parsed('Level') + $got->parsed('Strategy') + | ||||
| 578 | $got->parsed('Bufsize'); | ||||
| 579 | |||||
| 580 | croak "Compress::Raw::Zlib::Inflate::deflateParams: Bufsize must be >= 1, you specified " . | ||||
| 581 | $got->value('Bufsize') | ||||
| 582 | if $got->parsed('Bufsize') && $got->value('Bufsize') <= 1; | ||||
| 583 | |||||
| 584 | my $flags = 0; | ||||
| 585 | $flags |= 1 if $got->parsed('Level') ; | ||||
| 586 | $flags |= 2 if $got->parsed('Strategy') ; | ||||
| 587 | $flags |= 4 if $got->parsed('Bufsize') ; | ||||
| 588 | |||||
| 589 | $self->_deflateParams($flags, $got->value('Level'), | ||||
| 590 | $got->value('Strategy'), $got->value('Bufsize')); | ||||
| 591 | |||||
| 592 | } | ||||
| 593 | |||||
| 594 | |||||
| 595 | 1 | 14µs | 1; | ||
| 596 | __END__ | ||||
# spent 5µs within Compress::Raw::Zlib::CORE:subst which was called 5 times, avg 1µs/call:
# 5 times (5µs+0s) by Compress::Raw::Zlib::AUTOLOAD at line 110, avg 1µs/call | |||||
# spent 3µs within Compress::Raw::Zlib::constant which was called 5 times, avg 600ns/call:
# 5 times (3µs+0s) by Compress::Raw::Zlib::AUTOLOAD at line 111, avg 600ns/call |