line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Compress::Raw::Zlib; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
require 5.006 ; |
5
|
|
|
|
|
|
|
require Exporter; |
6
|
6
|
|
|
6
|
|
72735
|
use Carp ; |
|
6
|
|
|
|
|
45
|
|
|
6
|
|
|
|
|
569
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
36
|
use strict ; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
100
|
|
9
|
6
|
|
|
6
|
|
30
|
use warnings ; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
146
|
|
10
|
6
|
|
|
6
|
|
1526
|
use bytes ; |
|
6
|
|
|
|
|
42
|
|
|
6
|
|
|
|
|
27
|
|
11
|
|
|
|
|
|
|
our ($VERSION, $XS_VERSION, @ISA, @EXPORT, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD, %DEFLATE_CONSTANTS, @DEFLATE_CONSTANTS); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = '2.206'; |
14
|
|
|
|
|
|
|
$XS_VERSION = $VERSION; |
15
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
18
|
|
|
|
|
|
|
%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
|
|
|
|
|
|
|
%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
|
|
|
|
|
|
|
@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
|
|
|
|
|
|
|
push @EXPORT, qw(crc32 adler32 DEF_WBITS); |
112
|
|
|
|
|
|
|
|
113
|
6
|
|
|
6
|
|
1281
|
use constant WANT_GZIP => 16; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
524
|
|
114
|
6
|
|
|
6
|
|
34
|
use constant WANT_GZIP_OR_ZLIB => 32; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
669
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub AUTOLOAD { |
117
|
57
|
|
|
57
|
|
4871
|
my($constname); |
118
|
57
|
|
|
|
|
268
|
($constname = $AUTOLOAD) =~ s/.*:://; |
119
|
57
|
|
|
|
|
305
|
my ($error, $val) = constant($constname); |
120
|
57
|
50
|
|
|
|
141
|
Carp::croak $error if $error; |
121
|
6
|
|
|
6
|
|
40
|
no strict 'refs'; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
514
|
|
122
|
57
|
|
|
1854
|
|
193
|
*{$AUTOLOAD} = sub { $val }; |
|
57
|
|
|
|
|
210
|
|
|
1854
|
|
|
|
|
19239
|
|
123
|
57
|
|
|
|
|
74
|
goto &{$AUTOLOAD}; |
|
57
|
|
|
|
|
159
|
|
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
6
|
|
|
6
|
|
39
|
use constant FLAG_APPEND => 1 ; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
300
|
|
127
|
6
|
|
|
6
|
|
32
|
use constant FLAG_CRC => 2 ; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
264
|
|
128
|
6
|
|
|
6
|
|
36
|
use constant FLAG_ADLER => 4 ; |
|
6
|
|
|
|
|
31
|
|
|
6
|
|
|
|
|
240
|
|
129
|
6
|
|
|
6
|
|
29
|
use constant FLAG_CONSUME_INPUT => 8 ; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
252
|
|
130
|
6
|
|
|
6
|
|
32
|
use constant FLAG_LIMIT_OUTPUT => 16 ; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
652
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
eval { |
133
|
|
|
|
|
|
|
require XSLoader; |
134
|
|
|
|
|
|
|
XSLoader::load('Compress::Raw::Zlib', $XS_VERSION); |
135
|
|
|
|
|
|
|
1; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
or do { |
138
|
|
|
|
|
|
|
require DynaLoader; |
139
|
|
|
|
|
|
|
local @ISA = qw(DynaLoader); |
140
|
|
|
|
|
|
|
bootstrap Compress::Raw::Zlib $XS_VERSION ; |
141
|
|
|
|
|
|
|
}; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
6
|
|
|
6
|
|
34
|
use constant Parse_any => 0x01; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
292
|
|
145
|
6
|
|
|
6
|
|
31
|
use constant Parse_unsigned => 0x02; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
327
|
|
146
|
6
|
|
|
6
|
|
32
|
use constant Parse_signed => 0x04; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
277
|
|
147
|
6
|
|
|
6
|
|
29
|
use constant Parse_boolean => 0x08; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
256
|
|
148
|
|
|
|
|
|
|
#use constant Parse_string => 0x10; |
149
|
|
|
|
|
|
|
#use constant Parse_custom => 0x12; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
#use constant Parse_store_ref => 0x100 ; |
152
|
|
|
|
|
|
|
|
153
|
6
|
|
|
6
|
|
29
|
use constant OFF_PARSED => 0 ; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
237
|
|
154
|
6
|
|
|
6
|
|
31
|
use constant OFF_TYPE => 1 ; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
233
|
|
155
|
6
|
|
|
6
|
|
43
|
use constant OFF_DEFAULT => 2 ; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
237
|
|
156
|
6
|
|
|
6
|
|
30
|
use constant OFF_FIXED => 3 ; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
256
|
|
157
|
6
|
|
|
6
|
|
30
|
use constant OFF_FIRST_ONLY => 4 ; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
227
|
|
158
|
6
|
|
|
6
|
|
35
|
use constant OFF_STICKY => 5 ; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
13803
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub ParseParameters |
163
|
|
|
|
|
|
|
{ |
164
|
97
|
|
50
|
97
|
0
|
352
|
my $level = shift || 0 ; |
165
|
|
|
|
|
|
|
|
166
|
97
|
|
|
|
|
537
|
my $sub = (caller($level + 1))[3] ; |
167
|
|
|
|
|
|
|
#local $Carp::CarpLevel = 1 ; |
168
|
97
|
|
|
|
|
270
|
my $p = new Compress::Raw::Zlib::Parameters() ; |
169
|
97
|
100
|
|
|
|
216
|
$p->parse(@_) |
170
|
|
|
|
|
|
|
or croak "$sub: $p->{Error}" ; |
171
|
|
|
|
|
|
|
|
172
|
86
|
|
|
|
|
144
|
return $p; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::Parameters::new |
177
|
|
|
|
|
|
|
{ |
178
|
97
|
|
|
97
|
|
138
|
my $class = shift ; |
179
|
|
|
|
|
|
|
|
180
|
97
|
|
|
|
|
284
|
my $obj = { Error => '', |
181
|
|
|
|
|
|
|
Got => {}, |
182
|
|
|
|
|
|
|
} ; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
#return bless $obj, ref($class) || $class || __PACKAGE__ ; |
185
|
97
|
|
|
|
|
205
|
return bless $obj, 'Compress::Raw::Zlib::Parameters' ; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::Parameters::setError |
189
|
|
|
|
|
|
|
{ |
190
|
11
|
|
|
11
|
|
16
|
my $self = shift ; |
191
|
11
|
|
|
|
|
14
|
my $error = shift ; |
192
|
11
|
50
|
|
|
|
21
|
my $retval = @_ ? shift : undef ; |
193
|
|
|
|
|
|
|
|
194
|
11
|
|
|
|
|
14
|
$self->{Error} = $error ; |
195
|
11
|
|
|
|
|
1063
|
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
|
|
|
|
|
|
|
{ |
206
|
97
|
|
|
97
|
|
124
|
my $self = shift ; |
207
|
|
|
|
|
|
|
|
208
|
97
|
|
|
|
|
123
|
my $default = shift ; |
209
|
|
|
|
|
|
|
|
210
|
97
|
|
|
|
|
159
|
my $got = $self->{Got} ; |
211
|
97
|
|
|
|
|
123
|
my $firstTime = keys %{ $got } == 0 ; |
|
97
|
|
|
|
|
227
|
|
212
|
|
|
|
|
|
|
|
213
|
97
|
|
|
|
|
137
|
my (@Bad) ; |
214
|
97
|
|
|
|
|
132
|
my @entered = () ; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
# Allow the options to be passed as a hash reference or |
217
|
|
|
|
|
|
|
# as the complete hash. |
218
|
97
|
100
|
|
|
|
239
|
if (@_ == 0) { |
|
|
100
|
|
|
|
|
|
219
|
11
|
|
|
|
|
16
|
@entered = () ; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
elsif (@_ == 1) { |
222
|
9
|
|
|
|
|
13
|
my $href = $_[0] ; |
223
|
9
|
100
|
66
|
|
|
55
|
return $self->setError("Expected even number of parameters, got 1") |
|
|
|
66
|
|
|
|
|
224
|
|
|
|
|
|
|
if ! defined $href or ! ref $href or ref $href ne "HASH" ; |
225
|
|
|
|
|
|
|
|
226
|
7
|
|
|
|
|
20
|
foreach my $key (keys %$href) { |
227
|
14
|
|
|
|
|
20
|
push @entered, $key ; |
228
|
14
|
|
|
|
|
25
|
push @entered, \$href->{$key} ; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
else { |
232
|
77
|
|
|
|
|
103
|
my $count = @_; |
233
|
77
|
100
|
|
|
|
182
|
return $self->setError("Expected even number of parameters, got $count") |
234
|
|
|
|
|
|
|
if $count % 2 != 0 ; |
235
|
|
|
|
|
|
|
|
236
|
75
|
|
|
|
|
210
|
for my $i (0.. $count / 2 - 1) { |
237
|
120
|
|
|
|
|
195
|
push @entered, $_[2* $i] ; |
238
|
120
|
|
|
|
|
223
|
push @entered, \$_[2* $i+1] ; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
93
|
|
|
|
|
307
|
while (my ($key, $v) = each %$default) |
244
|
|
|
|
|
|
|
{ |
245
|
780
|
50
|
|
|
|
1166
|
croak "need 4 params [@$v]" |
246
|
|
|
|
|
|
|
if @$v != 4 ; |
247
|
|
|
|
|
|
|
|
248
|
780
|
|
|
|
|
1147
|
my ($first_only, $sticky, $type, $value) = @$v ; |
249
|
780
|
|
|
|
|
782
|
my $x ; |
250
|
780
|
50
|
|
|
|
1237
|
$self->_checkType($key, \$value, $type, 0, \$x) |
251
|
|
|
|
|
|
|
or return undef ; |
252
|
|
|
|
|
|
|
|
253
|
780
|
|
|
|
|
1220
|
$key = lc $key; |
254
|
|
|
|
|
|
|
|
255
|
780
|
50
|
33
|
|
|
1205
|
if ($firstTime || ! $sticky) { |
256
|
780
|
|
|
|
|
1710
|
$got->{$key} = [0, $type, $value, $x, $first_only, $sticky] ; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
780
|
|
|
|
|
2207
|
$got->{$key}[OFF_PARSED] = 0 ; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
93
|
|
|
|
|
250
|
for my $i (0.. @entered / 2 - 1) { |
263
|
134
|
|
|
|
|
207
|
my $key = $entered[2* $i] ; |
264
|
134
|
|
|
|
|
197
|
my $value = $entered[2* $i+1] ; |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
#print "Key [$key] Value [$value]" ; |
267
|
|
|
|
|
|
|
#print defined $$value ? "[$$value]\n" : "[undef]\n"; |
268
|
|
|
|
|
|
|
|
269
|
134
|
|
|
|
|
377
|
$key =~ s/^-// ; |
270
|
134
|
|
|
|
|
205
|
my $canonkey = lc $key; |
271
|
|
|
|
|
|
|
|
272
|
134
|
100
|
33
|
|
|
465
|
if ($got->{$canonkey} && ($firstTime || |
|
|
|
66
|
|
|
|
|
273
|
|
|
|
|
|
|
! $got->{$canonkey}[OFF_FIRST_ONLY] )) |
274
|
|
|
|
|
|
|
{ |
275
|
131
|
|
|
|
|
213
|
my $type = $got->{$canonkey}[OFF_TYPE] ; |
276
|
131
|
|
|
|
|
165
|
my $s ; |
277
|
131
|
100
|
|
|
|
229
|
$self->_checkType($key, $value, $type, 1, \$s) |
278
|
|
|
|
|
|
|
or return undef ; |
279
|
|
|
|
|
|
|
#$value = $$value unless $type & Parse_store_ref ; |
280
|
127
|
|
|
|
|
172
|
$value = $$value ; |
281
|
127
|
|
|
|
|
370
|
$got->{$canonkey} = [1, $type, $value, $s] ; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
else |
284
|
3
|
|
|
|
|
7
|
{ push (@Bad, $key) } |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
89
|
100
|
|
|
|
170
|
if (@Bad) { |
288
|
3
|
|
|
|
|
7
|
my ($bad) = join(", ", @Bad) ; |
289
|
3
|
|
|
|
|
9
|
return $self->setError("unknown key value(s) @Bad") ; |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
86
|
|
|
|
|
212
|
return 1; |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::Parameters::_checkType |
296
|
|
|
|
|
|
|
{ |
297
|
911
|
|
|
911
|
|
1031
|
my $self = shift ; |
298
|
|
|
|
|
|
|
|
299
|
911
|
|
|
|
|
972
|
my $key = shift ; |
300
|
911
|
|
|
|
|
979
|
my $value = shift ; |
301
|
911
|
|
|
|
|
942
|
my $type = shift ; |
302
|
911
|
|
|
|
|
940
|
my $validate = shift ; |
303
|
911
|
|
|
|
|
953
|
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
|
|
|
|
|
1021
|
$value = $$value ; |
317
|
|
|
|
|
|
|
|
318
|
911
|
100
|
|
|
|
1853
|
if ($type & Parse_any) |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
319
|
|
|
|
|
|
|
{ |
320
|
90
|
|
|
|
|
115
|
$$output = $value ; |
321
|
90
|
|
|
|
|
168
|
return 1; |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
elsif ($type & Parse_unsigned) |
324
|
|
|
|
|
|
|
{ |
325
|
246
|
50
|
66
|
|
|
439
|
return $self->setError("Parameter '$key' must be an unsigned int, got 'undef'") |
326
|
|
|
|
|
|
|
if $validate && ! defined $value ; |
327
|
246
|
100
|
100
|
|
|
514
|
return $self->setError("Parameter '$key' must be an unsigned int, got '$value'") |
328
|
|
|
|
|
|
|
if $validate && $value !~ /^\d+$/; |
329
|
|
|
|
|
|
|
|
330
|
242
|
100
|
|
|
|
350
|
$$output = defined $value ? $value : 0 ; |
331
|
242
|
|
|
|
|
450
|
return 1; |
332
|
|
|
|
|
|
|
} |
333
|
|
|
|
|
|
|
elsif ($type & Parse_signed) |
334
|
|
|
|
|
|
|
{ |
335
|
150
|
50
|
66
|
|
|
283
|
return $self->setError("Parameter '$key' must be a signed int, got 'undef'") |
336
|
|
|
|
|
|
|
if $validate && ! defined $value ; |
337
|
150
|
50
|
66
|
|
|
318
|
return $self->setError("Parameter '$key' must be a signed int, got '$value'") |
338
|
|
|
|
|
|
|
if $validate && $value !~ /^-?\d+$/; |
339
|
|
|
|
|
|
|
|
340
|
150
|
100
|
|
|
|
230
|
$$output = defined $value ? $value : 0 ; |
341
|
150
|
|
|
|
|
313
|
return 1 ; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
elsif ($type & Parse_boolean) |
344
|
|
|
|
|
|
|
{ |
345
|
425
|
50
|
66
|
|
|
991
|
return $self->setError("Parameter '$key' must be an int, got '$value'") |
|
|
|
66
|
|
|
|
|
346
|
|
|
|
|
|
|
if $validate && defined $value && $value !~ /^\d*$/; |
347
|
425
|
50
|
|
|
|
631
|
$$output = defined $value ? $value != 0 : 0 ; |
348
|
425
|
|
|
|
|
833
|
return 1; |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
# elsif ($type & Parse_string) |
351
|
|
|
|
|
|
|
# { |
352
|
|
|
|
|
|
|
# $$output = defined $value ? $value : "" ; |
353
|
|
|
|
|
|
|
# return 1; |
354
|
|
|
|
|
|
|
# } |
355
|
|
|
|
|
|
|
|
356
|
0
|
|
|
|
|
0
|
$$output = $value ; |
357
|
0
|
|
|
|
|
0
|
return 1; |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::Parameters::parsed |
363
|
|
|
|
|
|
|
{ |
364
|
35
|
|
|
35
|
|
40
|
my $self = shift ; |
365
|
35
|
|
|
|
|
38
|
my $name = shift ; |
366
|
|
|
|
|
|
|
|
367
|
35
|
|
|
|
|
257
|
return $self->{Got}{lc $name}[OFF_PARSED] ; |
368
|
|
|
|
|
|
|
} |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::Parameters::value |
371
|
|
|
|
|
|
|
{ |
372
|
784
|
|
|
784
|
|
826
|
my $self = shift ; |
373
|
784
|
|
|
|
|
828
|
my $name = shift ; |
374
|
|
|
|
|
|
|
|
375
|
784
|
50
|
|
|
|
1102
|
if (@_) |
376
|
|
|
|
|
|
|
{ |
377
|
0
|
|
|
|
|
0
|
$self->{Got}{lc $name}[OFF_PARSED] = 1; |
378
|
0
|
|
|
|
|
0
|
$self->{Got}{lc $name}[OFF_DEFAULT] = $_[0] ; |
379
|
0
|
|
|
|
|
0
|
$self->{Got}{lc $name}[OFF_FIXED] = $_[0] ; |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
|
382
|
784
|
|
|
|
|
15566
|
return $self->{Got}{lc $name}[OFF_FIXED] ; |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
{ |
402
|
39
|
|
|
39
|
|
61402
|
my $pkg = shift ; |
403
|
39
|
|
|
|
|
104
|
my ($got) = ParseParameters(0, $OPTIONS_deflate, @_); |
404
|
|
|
|
|
|
|
|
405
|
34
|
100
|
|
|
|
79
|
croak "Compress::Raw::Zlib::Deflate::new: Bufsize must be >= 1, you specified " . |
406
|
|
|
|
|
|
|
$got->value('Bufsize') |
407
|
|
|
|
|
|
|
unless $got->value('Bufsize') >= 1; |
408
|
|
|
|
|
|
|
|
409
|
33
|
|
|
|
|
146
|
my $flags = 0 ; |
410
|
33
|
100
|
|
|
|
74
|
$flags |= FLAG_APPEND if $got->value('AppendOutput') ; |
411
|
33
|
50
|
|
|
|
67
|
$flags |= FLAG_CRC if $got->value('CRC32') ; |
412
|
33
|
50
|
|
|
|
61
|
$flags |= FLAG_ADLER if $got->value('ADLER32') ; |
413
|
|
|
|
|
|
|
|
414
|
33
|
|
|
|
|
56
|
my $windowBits = $got->value('WindowBits'); |
415
|
33
|
100
|
|
|
|
62
|
$windowBits += MAX_WBITS() |
416
|
|
|
|
|
|
|
if ($windowBits & MAX_WBITS()) == 0 ; |
417
|
|
|
|
|
|
|
|
418
|
33
|
|
|
|
|
60
|
_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
|
|
|
|
|
|
|
{ |
431
|
0
|
|
|
0
|
|
0
|
my $type = ref shift; |
432
|
0
|
|
|
|
|
0
|
croak "Cannot freeze $type object\n"; |
433
|
|
|
|
|
|
|
} |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::deflateStream::STORABLE_thaw |
436
|
|
|
|
|
|
|
{ |
437
|
0
|
|
|
0
|
|
0
|
my $type = ref shift; |
438
|
0
|
|
|
|
|
0
|
croak "Cannot thaw $type object\n"; |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
{ |
457
|
50
|
|
|
50
|
|
3449
|
my $pkg = shift ; |
458
|
50
|
|
|
|
|
115
|
my ($got) = ParseParameters(0, $OPTIONS_inflate, @_); |
459
|
|
|
|
|
|
|
|
460
|
45
|
100
|
|
|
|
103
|
croak "Compress::Raw::Zlib::Inflate::new: Bufsize must be >= 1, you specified " . |
461
|
|
|
|
|
|
|
$got->value('Bufsize') |
462
|
|
|
|
|
|
|
unless $got->value('Bufsize') >= 1; |
463
|
|
|
|
|
|
|
|
464
|
44
|
|
|
|
|
70
|
my $flags = 0 ; |
465
|
44
|
100
|
|
|
|
80
|
$flags |= FLAG_APPEND if $got->value('AppendOutput') ; |
466
|
44
|
50
|
|
|
|
85
|
$flags |= FLAG_CRC if $got->value('CRC32') ; |
467
|
44
|
50
|
|
|
|
74
|
$flags |= FLAG_ADLER if $got->value('ADLER32') ; |
468
|
44
|
100
|
|
|
|
70
|
$flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; |
469
|
44
|
100
|
|
|
|
70
|
$flags |= FLAG_LIMIT_OUTPUT if $got->value('LimitOutput') ; |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
|
472
|
44
|
|
|
|
|
108
|
my $windowBits = $got->value('WindowBits'); |
473
|
44
|
100
|
|
|
|
106
|
$windowBits += MAX_WBITS() |
474
|
|
|
|
|
|
|
if ($windowBits & MAX_WBITS()) == 0 ; |
475
|
|
|
|
|
|
|
|
476
|
44
|
|
|
|
|
72
|
_inflateInit($flags, $windowBits, $got->value('Bufsize'), |
477
|
|
|
|
|
|
|
$got->value('Dictionary')) ; |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::inflateStream::STORABLE_freeze |
481
|
|
|
|
|
|
|
{ |
482
|
0
|
|
|
0
|
|
0
|
my $type = ref shift; |
483
|
0
|
|
|
|
|
0
|
croak "Cannot freeze $type object\n"; |
484
|
|
|
|
|
|
|
} |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::inflateStream::STORABLE_thaw |
487
|
|
|
|
|
|
|
{ |
488
|
0
|
|
|
0
|
|
0
|
my $type = ref shift; |
489
|
0
|
|
|
|
|
0
|
croak "Cannot thaw $type object\n"; |
490
|
|
|
|
|
|
|
} |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::InflateScan::new |
493
|
|
|
|
|
|
|
{ |
494
|
1
|
|
|
1
|
|
209
|
my $pkg = shift ; |
495
|
1
|
|
|
|
|
8
|
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
|
50
|
|
|
|
6
|
croak "Compress::Raw::Zlib::InflateScan::new: Bufsize must be >= 1, you specified " . |
507
|
|
|
|
|
|
|
$got->value('Bufsize') |
508
|
|
|
|
|
|
|
unless $got->value('Bufsize') >= 1; |
509
|
|
|
|
|
|
|
|
510
|
1
|
|
|
|
|
2
|
my $flags = 0 ; |
511
|
|
|
|
|
|
|
#$flags |= FLAG_APPEND if $got->value('AppendOutput') ; |
512
|
1
|
50
|
|
|
|
3
|
$flags |= FLAG_CRC if $got->value('CRC32') ; |
513
|
1
|
50
|
|
|
|
3
|
$flags |= FLAG_ADLER if $got->value('ADLER32') ; |
514
|
|
|
|
|
|
|
#$flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; |
515
|
|
|
|
|
|
|
|
516
|
1
|
|
|
|
|
5
|
_inflateScanInit($flags, $got->value('WindowBits'), $got->value('Bufsize'), |
517
|
|
|
|
|
|
|
'') ; |
518
|
|
|
|
|
|
|
} |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::inflateScanStream::createDeflateStream |
521
|
|
|
|
|
|
|
{ |
522
|
0
|
|
|
0
|
|
0
|
my $pkg = shift ; |
523
|
0
|
|
|
|
|
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
|
0
|
|
|
|
0
|
croak "Compress::Raw::Zlib::InflateScan::createDeflateStream: Bufsize must be >= 1, you specified " . |
538
|
|
|
|
|
|
|
$got->value('Bufsize') |
539
|
|
|
|
|
|
|
unless $got->value('Bufsize') >= 1; |
540
|
|
|
|
|
|
|
|
541
|
0
|
|
|
|
|
0
|
my $flags = 0 ; |
542
|
0
|
0
|
|
|
|
0
|
$flags |= FLAG_APPEND if $got->value('AppendOutput') ; |
543
|
0
|
0
|
|
|
|
0
|
$flags |= FLAG_CRC if $got->value('CRC32') ; |
544
|
0
|
0
|
|
|
|
0
|
$flags |= FLAG_ADLER if $got->value('ADLER32') ; |
545
|
|
|
|
|
|
|
|
546
|
0
|
|
|
|
|
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
|
|
|
|
|
|
|
{ |
559
|
0
|
|
|
0
|
|
0
|
my $self = shift ; |
560
|
0
|
|
|
|
|
0
|
my $buffer = $_[1]; |
561
|
0
|
|
|
|
|
0
|
my $eof = $_[2]; |
562
|
|
|
|
|
|
|
|
563
|
0
|
|
|
|
|
0
|
my $status = $self->scan(@_); |
564
|
|
|
|
|
|
|
|
565
|
0
|
0
|
0
|
|
|
0
|
if ($status == Z_OK() && $_[2]) { |
566
|
0
|
|
|
|
|
0
|
my $byte = ' '; |
567
|
|
|
|
|
|
|
|
568
|
0
|
|
|
|
|
0
|
$status = $self->scan(\$byte, $_[1]) ; |
569
|
|
|
|
|
|
|
} |
570
|
|
|
|
|
|
|
|
571
|
0
|
|
|
|
|
0
|
return $status ; |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
sub Compress::Raw::Zlib::deflateStream::deflateParams |
575
|
|
|
|
|
|
|
{ |
576
|
7
|
|
|
7
|
|
540
|
my $self = shift ; |
577
|
7
|
|
|
|
|
34
|
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
|
100
|
|
|
|
20
|
croak "Compress::Raw::Zlib::deflateParams needs Level and/or Strategy" |
585
|
|
|
|
|
|
|
unless $got->parsed('Level') + $got->parsed('Strategy') + |
586
|
|
|
|
|
|
|
$got->parsed('Bufsize'); |
587
|
|
|
|
|
|
|
|
588
|
5
|
100
|
100
|
|
|
9
|
croak "Compress::Raw::Zlib::Inflate::deflateParams: Bufsize must be >= 1, you specified " . |
589
|
|
|
|
|
|
|
$got->value('Bufsize') |
590
|
|
|
|
|
|
|
if $got->parsed('Bufsize') && $got->value('Bufsize') <= 1; |
591
|
|
|
|
|
|
|
|
592
|
4
|
|
|
|
|
6
|
my $flags = 0; |
593
|
4
|
100
|
|
|
|
6
|
$flags |= 1 if $got->parsed('Level') ; |
594
|
4
|
100
|
|
|
|
9
|
$flags |= 2 if $got->parsed('Strategy') ; |
595
|
4
|
100
|
|
|
|
6
|
$flags |= 4 if $got->parsed('Bufsize') ; |
596
|
|
|
|
|
|
|
|
597
|
4
|
|
|
|
|
10
|
$self->_deflateParams($flags, $got->value('Level'), |
598
|
|
|
|
|
|
|
$got->value('Strategy'), $got->value('Bufsize')); |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
} |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
1; |
604
|
|
|
|
|
|
|
__END__ |