line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################
|
2
|
|
|
|
|
|
|
# SIMPLE COMPRESS:ZLIB #
|
3
|
|
|
|
|
|
|
########################
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
##package Compress'Zlib;
|
6
|
|
|
|
|
|
|
package LibZip::MyZlib ;
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
no warnings ;
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
120
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
50
|
|
2
|
|
2026
|
BEGIN { $INC{'LibZip/MyZlib.pm'} = 1 if !$INC{'LibZip/MyZlib.pm'} ;}
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#require DynaLoader;
|
13
|
|
|
|
|
|
|
@ISA = qw(DynaLoader);
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = "1.33" ;
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
## NO BOOT: Zlib will be inside executable (LibZipBin binary).
|
18
|
|
|
|
|
|
|
#DynaLoader::bootstrap LibZip::MyZlib $VERSION if !$NO_BOOT ;
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
0
|
0
|
sub ZLIB_VERSION { 1.1.4 }
|
22
|
0
|
|
|
0
|
0
|
0
|
sub DEF_WBITS { '' }
|
23
|
0
|
|
|
0
|
0
|
0
|
sub OS_CODE { '' }
|
24
|
2
|
|
|
2
|
0
|
6
|
sub MAX_MEM_LEVEL { 9 }
|
25
|
4
|
|
|
4
|
0
|
15
|
sub MAX_WBITS { 15 }
|
26
|
0
|
|
|
0
|
0
|
0
|
sub Z_ASCII { 1 }
|
27
|
0
|
|
|
0
|
0
|
0
|
sub Z_BEST_COMPRESSION { 9 }
|
28
|
0
|
|
|
0
|
0
|
0
|
sub Z_BEST_SPEED { 1 }
|
29
|
0
|
|
|
0
|
0
|
0
|
sub Z_BINARY { 0 }
|
30
|
0
|
|
|
0
|
0
|
0
|
sub Z_BUF_ERROR { -5 }
|
31
|
0
|
|
|
0
|
0
|
0
|
sub Z_DATA_ERROR { -3 }
|
32
|
4
|
|
|
4
|
0
|
13
|
sub Z_DEFAULT_COMPRESSION { -1 }
|
33
|
4
|
|
|
4
|
0
|
24
|
sub Z_DEFAULT_STRATEGY { 0 }
|
34
|
2
|
|
|
2
|
0
|
8
|
sub Z_DEFLATED { 8 }
|
35
|
0
|
|
|
0
|
0
|
|
sub Z_ERRNO { -1 }
|
36
|
0
|
|
|
0
|
0
|
|
sub Z_FILTERED { 1 }
|
37
|
0
|
|
|
0
|
0
|
|
sub Z_FINISH { 4 }
|
38
|
0
|
|
|
0
|
0
|
|
sub Z_FULL_FLUSH { 3 }
|
39
|
0
|
|
|
0
|
0
|
|
sub Z_HUFFMAN_ONLY { 2 }
|
40
|
0
|
|
|
0
|
0
|
|
sub Z_MEM_ERROR { -4 }
|
41
|
0
|
|
|
0
|
0
|
|
sub Z_NEED_DICT { 2 }
|
42
|
0
|
|
|
0
|
0
|
|
sub Z_NO_COMPRESSION { 0 }
|
43
|
0
|
|
|
0
|
0
|
|
sub Z_NO_FLUSH { 0 }
|
44
|
0
|
|
|
0
|
0
|
|
sub Z_NULL { 0 }
|
45
|
0
|
|
|
0
|
0
|
|
sub Z_OK { 0 }
|
46
|
0
|
|
|
0
|
0
|
|
sub Z_PARTIAL_FLUSH { 1 }
|
47
|
0
|
|
|
0
|
0
|
|
sub Z_STREAM_END { 1 }
|
48
|
0
|
|
|
0
|
0
|
|
sub Z_STREAM_ERROR { -2 }
|
49
|
0
|
|
|
0
|
0
|
|
sub Z_SYNC_FLUSH { 2 }
|
50
|
0
|
|
|
0
|
0
|
|
sub Z_UNKNOWN { 2 }
|
51
|
0
|
|
|
0
|
0
|
|
sub Z_VERSION_ERROR { -6 }
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub ParseParameters($@) {
|
55
|
0
|
|
|
0
|
0
|
|
my ($default, @rest) = @_ ;
|
56
|
0
|
|
|
|
|
|
my (%got) = %$default ;
|
57
|
0
|
|
|
|
|
|
my (@Bad) ;
|
58
|
0
|
|
|
|
|
|
my ($key, $value) ;
|
59
|
0
|
|
|
|
|
|
my $sub = (caller(1))[3] ;
|
60
|
0
|
|
|
|
|
|
my %options = () ;
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# allow the options to be passed as a hash reference or
|
63
|
|
|
|
|
|
|
# as the complete hash.
|
64
|
0
|
0
|
|
|
|
|
if (@rest == 1) {
|
|
|
0
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
%options = %{ $rest[0] } ;
|
|
0
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
elsif (@rest >= 2) {
|
68
|
0
|
|
|
|
|
|
%options = @rest ;
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
while (($key, $value) = each %options)
|
72
|
|
|
|
|
|
|
{
|
73
|
0
|
|
|
|
|
|
$key =~ s/^-// ;
|
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
if (exists $default->{$key})
|
76
|
0
|
|
|
|
|
|
{ $got{$key} = $value }
|
77
|
|
|
|
|
|
|
else
|
78
|
0
|
|
|
|
|
|
{ push (@Bad, $key) }
|
79
|
|
|
|
|
|
|
}
|
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
if (@Bad) {
|
82
|
0
|
|
|
|
|
|
my ($bad) = join(", ", @Bad) ;
|
83
|
|
|
|
|
|
|
}
|
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return \%got ;
|
86
|
|
|
|
|
|
|
}
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
$deflateDefault = {
|
89
|
|
|
|
|
|
|
'Level' => Z_DEFAULT_COMPRESSION(),
|
90
|
|
|
|
|
|
|
'Method' => Z_DEFLATED(),
|
91
|
|
|
|
|
|
|
'WindowBits' => MAX_WBITS(),
|
92
|
|
|
|
|
|
|
'MemLevel' => MAX_MEM_LEVEL(),
|
93
|
|
|
|
|
|
|
'Strategy' => Z_DEFAULT_STRATEGY(),
|
94
|
|
|
|
|
|
|
'Bufsize' => 4096,
|
95
|
|
|
|
|
|
|
'Dictionary' => "",
|
96
|
|
|
|
|
|
|
} ;
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$deflateParamsDefault = {
|
99
|
|
|
|
|
|
|
'Level' => Z_DEFAULT_COMPRESSION(),
|
100
|
|
|
|
|
|
|
'Strategy' => Z_DEFAULT_STRATEGY(),
|
101
|
|
|
|
|
|
|
} ;
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
$inflateDefault = {
|
104
|
|
|
|
|
|
|
'WindowBits' => MAX_WBITS(),
|
105
|
|
|
|
|
|
|
'Bufsize' => 4096,
|
106
|
|
|
|
|
|
|
'Dictionary' => "",
|
107
|
|
|
|
|
|
|
} ;
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub inflateInit {
|
110
|
0
|
|
|
0
|
0
|
|
my ($got) = ParseParameters($inflateDefault, @_) ;
|
111
|
0
|
|
|
|
|
|
_inflateInit($got->{WindowBits}, $got->{Bufsize}, $got->{Dictionary}) ;
|
112
|
|
|
|
|
|
|
}
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#############################
|
115
|
|
|
|
|
|
|
# LIBZIP::MYZLIB::TOOLS #
|
116
|
|
|
|
|
|
|
#############################
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
package LibZip::MyZlib::tools ;
|
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
2
|
|
15
|
use LibZip::CORE ;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
############
|
123
|
|
|
|
|
|
|
# MY_UNTAR #
|
124
|
|
|
|
|
|
|
############
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub my_untar {
|
127
|
0
|
|
|
0
|
|
|
my ( $tar_file ) = @_ ;
|
128
|
|
|
|
|
|
|
|
129
|
0
|
0
|
0
|
|
|
|
my $tar = (length($tar_file) < 1000 && -e $tar_file) ? cat($tar_file) : $tar_file ;
|
130
|
0
|
|
|
|
|
|
my $lng = length($tar) ;
|
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
my %files ;
|
133
|
0
|
|
|
|
|
|
my ( $sz , $name ) ;
|
134
|
0
|
|
|
|
|
|
for(my $i = 0 ; $i < $lng ;) {
|
135
|
0
|
|
|
|
|
|
$sz = unpack("V", substr($tar , $i , 4) ) ; $i += 4 ;
|
|
0
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$name = substr($tar , $i , $sz) ; $i += $sz ;
|
|
0
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
$sz = unpack("V", substr($tar , $i , 4) ) ; $i += 4 ;
|
|
0
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
$files{$name} = my_uncompress( split_bloks( substr($tar , $i , $sz) ) ) ; $i += $sz ;
|
|
0
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
}
|
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
return \%files ;
|
142
|
|
|
|
|
|
|
}
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
################
|
145
|
|
|
|
|
|
|
# MY_SAVE_TREE #
|
146
|
|
|
|
|
|
|
################
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub my_save_tree {
|
149
|
0
|
|
|
0
|
|
|
my $dir = shift ;
|
150
|
0
|
|
|
|
|
|
my $tree = shift ;
|
151
|
|
|
|
|
|
|
|
152
|
0
|
0
|
|
|
|
|
mkpath($dir) if ( !-d $dir );
|
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
foreach my $Key (sort keys %$tree ) {
|
155
|
0
|
|
|
|
|
|
my $name = "$dir/$Key" ;
|
156
|
0
|
|
|
|
|
|
my ($dirName) = ( $name =~ /^(.*?)[\\\/]*[^\\\/]+$/s );
|
157
|
0
|
0
|
|
|
|
|
mkpath($dirName) if ( !-d $dirName ) ;
|
158
|
0
|
|
|
|
|
|
save($name , $$tree{$Key}) ;
|
159
|
|
|
|
|
|
|
}
|
160
|
|
|
|
|
|
|
}
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
##########
|
163
|
|
|
|
|
|
|
# MKPATH #
|
164
|
|
|
|
|
|
|
##########
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub mkpath {
|
167
|
0
|
|
|
0
|
|
|
my($paths) = @_;
|
168
|
0
|
0
|
|
|
|
|
$paths = [$paths] unless ref $paths ;
|
169
|
0
|
|
|
|
|
|
my $mode = 0775 ;
|
170
|
|
|
|
|
|
|
|
171
|
0
|
0
|
|
|
|
|
local($")=$Is_MacOS ? ":" : "/";
|
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my(@created,$path);
|
174
|
0
|
|
|
|
|
|
foreach $path (@$paths) {
|
175
|
0
|
0
|
0
|
|
|
|
$path .= '/' if $^O eq 'os2' and $path =~ /^\w:\z/s ;
|
176
|
0
|
0
|
|
|
|
|
next if -d $path ;
|
177
|
0
|
|
|
|
|
|
my ($parent) = ( $path =~ /^(.*?)[\\\/]*[^\\\/]+$/s );
|
178
|
0
|
0
|
0
|
|
|
|
unless (-d $parent or $path eq $parent) { push(@created,mkpath($parent)) ;}
|
|
0
|
|
|
|
|
|
|
179
|
0
|
0
|
|
|
|
|
unless (mkdir($path,$mode)) { my $e = $! ;}
|
|
0
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
push(@created, $path) ;
|
181
|
|
|
|
|
|
|
}
|
182
|
0
|
|
|
|
|
|
@created ;
|
183
|
|
|
|
|
|
|
}
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
###############
|
186
|
|
|
|
|
|
|
# SPLIT_BLOKS #
|
187
|
|
|
|
|
|
|
###############
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub split_bloks {
|
190
|
0
|
|
|
0
|
|
|
my $sz_blk_size = unpack("V", substr($_[0] , 0 , 4) ) ;
|
191
|
0
|
|
|
|
|
|
my $blk_size = substr($_[0] , 4 , $sz_blk_size) ;
|
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
my $total = 4 + $sz_blk_size ;
|
194
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
$blk_size = my_uncompress($blk_size) ;
|
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
my (@sizes) = ( $blk_size =~ /(....)/gs );
|
198
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
my $i = $sz_blk_size + 4 ;
|
200
|
|
|
|
|
|
|
|
201
|
0
|
|
|
|
|
|
my @blks ;
|
202
|
0
|
|
|
|
|
|
foreach my $sizes_i ( @sizes ) {
|
203
|
0
|
|
|
|
|
|
$sizes_i = unpack("V", $sizes_i ) ;
|
204
|
0
|
|
|
|
|
|
push(@blks , substr($_[0] , $i , $sizes_i) ) ;
|
205
|
0
|
|
|
|
|
|
$i += $sizes_i ;
|
206
|
|
|
|
|
|
|
}
|
207
|
|
|
|
|
|
|
|
208
|
0
|
|
|
|
|
|
return @blks ;
|
209
|
|
|
|
|
|
|
}
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
###################
|
213
|
|
|
|
|
|
|
# PURE_UNCOMPRESS #
|
214
|
|
|
|
|
|
|
###################
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub my_uncompress {
|
217
|
0
|
|
|
0
|
|
|
my ( @blks ) = @_ ;
|
218
|
|
|
|
|
|
|
package LibZip::MyZlib ;
|
219
|
|
|
|
|
|
|
|
220
|
0
|
|
|
|
|
|
my $uncompressed ;
|
221
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
|
foreach my $blks_i ( @blks ) {
|
223
|
0
|
|
|
|
|
|
my ($d, $status) = inflateInit( -WindowBits => - MAX_WBITS ) ;
|
224
|
0
|
|
|
|
|
|
my ($out, $status) = $d->inflate( $blks_i ) ;
|
225
|
0
|
|
|
|
|
|
$uncompressed .= $out ;
|
226
|
|
|
|
|
|
|
}
|
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
|
|
|
return $uncompressed ;
|
229
|
|
|
|
|
|
|
}
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
##########
|
232
|
|
|
|
|
|
|
# BASE64 #
|
233
|
|
|
|
|
|
|
##########
|
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
0
|
|
|
sub my_uncompress_base64 { return my_uncompress( split_bloks( _decode_base64_pure_perl($_[0]) ) ) ;}
|
236
|
|
|
|
|
|
|
|
237
|
0
|
|
|
0
|
|
|
sub my_untar_base64 { return my_untar( _decode_base64_pure_perl($_[0]) ) ;}
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
############################
|
240
|
|
|
|
|
|
|
# _DECODE_BASE64_PURE_PERL #
|
241
|
|
|
|
|
|
|
############################
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub _decode_base64_pure_perl {
|
244
|
0
|
|
|
0
|
|
|
local($^W) = 0 ;
|
245
|
0
|
|
|
|
|
|
my $str = shift ;
|
246
|
0
|
|
|
|
|
|
my $res = "";
|
247
|
0
|
|
|
|
|
|
$str =~ tr|A-Za-z0-9+=/||cd ;
|
248
|
0
|
0
|
|
|
|
|
if (length($str) % 4) {
|
249
|
|
|
|
|
|
|
#require Carp;
|
250
|
|
|
|
|
|
|
#Carp::carp("Length of base64 data not a multiple of 4")
|
251
|
|
|
|
|
|
|
}
|
252
|
0
|
|
|
|
|
|
$str =~ s/=+$//;
|
253
|
0
|
|
|
|
|
|
$str =~ tr|A-Za-z0-9+/| -_|;
|
254
|
0
|
|
|
|
|
|
while ($str =~ /(.{1,60})/gs) {
|
255
|
0
|
|
|
|
|
|
my $len = chr(32 + length($1)*3/4);
|
256
|
0
|
|
|
|
|
|
$res .= unpack("u", $len . $1 );
|
257
|
|
|
|
|
|
|
}
|
258
|
0
|
|
|
|
|
|
$res;
|
259
|
|
|
|
|
|
|
}
|
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
#######
|
262
|
|
|
|
|
|
|
# END #
|
263
|
|
|
|
|
|
|
#######
|
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
1;
|
266
|
|
|
|
|
|
|
|