line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Uncompress::Adapter::Identity; |
2
|
|
|
|
|
|
|
|
3
|
83
|
|
|
83
|
|
1385
|
use warnings; |
|
83
|
|
|
|
|
202
|
|
|
83
|
|
|
|
|
2763
|
|
4
|
83
|
|
|
83
|
|
465
|
use strict; |
|
83
|
|
|
|
|
179
|
|
|
83
|
|
|
|
|
1452
|
|
5
|
83
|
|
|
83
|
|
386
|
use bytes; |
|
83
|
|
|
|
|
200
|
|
|
83
|
|
|
|
|
424
|
|
6
|
|
|
|
|
|
|
|
7
|
83
|
|
|
83
|
|
2798
|
use IO::Compress::Base::Common 2.205 qw(:Status); |
|
83
|
|
|
|
|
1426
|
|
|
83
|
|
|
|
|
9018
|
|
8
|
83
|
|
|
83
|
|
35365
|
use IO::Compress::Zip::Constants ; |
|
83
|
|
|
|
|
224
|
|
|
83
|
|
|
|
|
18377
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our ($VERSION); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '2.205'; |
13
|
|
|
|
|
|
|
|
14
|
83
|
|
|
83
|
|
2073
|
use Compress::Raw::Zlib 2.205 (); |
|
83
|
|
|
|
|
1662
|
|
|
83
|
|
|
|
|
73833
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub mkUncompObject |
17
|
|
|
|
|
|
|
{ |
18
|
75
|
|
|
75
|
0
|
138
|
my $streaming = shift; |
19
|
75
|
|
|
|
|
124
|
my $zip64 = shift; |
20
|
|
|
|
|
|
|
|
21
|
75
|
|
|
|
|
120
|
my $crc32 = 1; #shift ; |
22
|
75
|
|
|
|
|
128
|
my $adler32 = shift; |
23
|
|
|
|
|
|
|
|
24
|
75
|
100
|
|
|
|
234
|
bless { 'CompSize' => U64->new(), # 0, |
25
|
|
|
|
|
|
|
'UnCompSize' => 0, |
26
|
|
|
|
|
|
|
'wantCRC32' => $crc32, |
27
|
|
|
|
|
|
|
'CRC32' => Compress::Raw::Zlib::crc32(''), |
28
|
|
|
|
|
|
|
'wantADLER32'=> $adler32, |
29
|
|
|
|
|
|
|
'ADLER32' => Compress::Raw::Zlib::adler32(''), |
30
|
|
|
|
|
|
|
'ConsumesInput' => 1, |
31
|
|
|
|
|
|
|
'Streaming' => $streaming, |
32
|
|
|
|
|
|
|
'Zip64' => $zip64, |
33
|
|
|
|
|
|
|
'DataHdrSize' => $zip64 ? 24 : 16, |
34
|
|
|
|
|
|
|
'Pending' => '', |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} ; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub uncompr |
41
|
|
|
|
|
|
|
{ |
42
|
70
|
|
|
70
|
0
|
138
|
my $self = shift; |
43
|
70
|
|
|
|
|
120
|
my $in = $_[0]; |
44
|
70
|
|
|
|
|
136
|
my $eof = $_[2]; |
45
|
|
|
|
|
|
|
|
46
|
70
|
|
|
|
|
124
|
my $len = length $$in; |
47
|
70
|
|
|
|
|
138
|
my $remainder = ''; |
48
|
|
|
|
|
|
|
|
49
|
70
|
100
|
66
|
|
|
279
|
if (defined $$in && $len) { |
50
|
|
|
|
|
|
|
|
51
|
49
|
100
|
|
|
|
199
|
if ($self->{Streaming}) { |
52
|
|
|
|
|
|
|
|
53
|
25
|
50
|
|
|
|
86
|
if (length $self->{Pending}) { |
54
|
0
|
|
|
|
|
0
|
$$in = $self->{Pending} . $$in ; |
55
|
0
|
|
|
|
|
0
|
$len = length $$in; |
56
|
0
|
|
|
|
|
0
|
$self->{Pending} = ''; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
25
|
|
|
|
|
67
|
my $ind = index($$in, "\x50\x4b\x07\x08"); |
60
|
|
|
|
|
|
|
|
61
|
25
|
50
|
|
|
|
67
|
if ($ind < 0) { |
62
|
0
|
|
|
|
|
0
|
$len = length $$in; |
63
|
0
|
0
|
0
|
|
|
0
|
if ($len >= 3 && substr($$in, -3) eq "\x50\x4b\x07") { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
$ind = $len - 3 ; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
elsif ($len >= 2 && substr($$in, -2) eq "\x50\x4b") { |
67
|
0
|
|
|
|
|
0
|
$ind = $len - 2 ; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
elsif ($len >= 1 && substr($$in, -1) eq "\x50") { |
70
|
0
|
|
|
|
|
0
|
$ind = $len - 1 ; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
25
|
50
|
|
|
|
61
|
if ($ind >= 0) { |
75
|
25
|
|
|
|
|
78
|
$remainder = substr($$in, $ind) ; |
76
|
25
|
|
|
|
|
68
|
substr($$in, $ind) = '' ; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
49
|
50
|
66
|
|
|
234
|
if (length $remainder && length $remainder < $self->{DataHdrSize}) { |
|
|
100
|
|
|
|
|
|
81
|
0
|
|
|
|
|
0
|
$self->{Pending} = $remainder ; |
82
|
0
|
|
|
|
|
0
|
$remainder = ''; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
elsif (length $remainder >= $self->{DataHdrSize}) { |
85
|
25
|
|
|
|
|
91
|
my $crc = unpack "V", substr($remainder, 4); |
86
|
25
|
50
|
|
|
|
123
|
if ($crc == Compress::Raw::Zlib::crc32($$in, $self->{CRC32})) { |
87
|
25
|
|
|
|
|
48
|
my ($l1, $l2) ; |
88
|
|
|
|
|
|
|
|
89
|
25
|
100
|
|
|
|
78
|
if ($self->{Zip64}) { |
90
|
12
|
|
|
|
|
55
|
$l1 = U64::newUnpack_V64(substr($remainder, 8)); |
91
|
12
|
|
|
|
|
46
|
$l2 = U64::newUnpack_V64(substr($remainder, 16)); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
else { |
94
|
13
|
|
|
|
|
58
|
$l1 = U64::newUnpack_V32(substr($remainder, 8)); |
95
|
13
|
|
|
|
|
55
|
$l2 = U64::newUnpack_V32(substr($remainder, 12)); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
25
|
|
|
|
|
85
|
my $newLen = $self->{CompSize}->clone(); |
99
|
25
|
|
|
|
|
89
|
$newLen->add(length $$in); |
100
|
25
|
50
|
33
|
|
|
84
|
if ($l1->equal($l2) && $l1->equal($newLen) ) { |
101
|
25
|
|
|
|
|
88
|
$eof = 1; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
else { |
104
|
0
|
|
|
|
|
0
|
$$in .= substr($remainder, 0, 4) ; |
105
|
0
|
|
|
|
|
0
|
$remainder = substr($remainder, 4); |
106
|
|
|
|
|
|
|
#$self->{Pending} = substr($remainder, 4); |
107
|
|
|
|
|
|
|
#$remainder = ''; |
108
|
0
|
|
|
|
|
0
|
$eof = 0; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
else { |
112
|
0
|
|
|
|
|
0
|
$$in .= substr($remainder, 0, 4) ; |
113
|
0
|
|
|
|
|
0
|
$remainder = substr($remainder, 4); |
114
|
|
|
|
|
|
|
#$self->{Pending} = substr($remainder, 4); |
115
|
|
|
|
|
|
|
#$remainder = ''; |
116
|
0
|
|
|
|
|
0
|
$eof = 0; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
49
|
50
|
|
|
|
128
|
if (length $$in) { |
121
|
49
|
|
|
|
|
201
|
$self->{CompSize}->add(length $$in) ; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$self->{CRC32} = Compress::Raw::Zlib::crc32($$in, $self->{CRC32}) |
124
|
49
|
50
|
|
|
|
303
|
if $self->{wantCRC32}; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
$self->{ADLER32} = Compress::Zlib::adler32($$in, $self->{ADLER32}) |
127
|
49
|
50
|
|
|
|
186
|
if $self->{wantADLER32}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
49
|
|
|
|
|
80
|
${ $_[1] } .= $$in; |
|
49
|
|
|
|
|
160
|
|
131
|
49
|
|
|
|
|
100
|
$$in = $remainder; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
70
|
100
|
|
|
|
193
|
return STATUS_ENDSTREAM if $eof; |
135
|
24
|
|
|
|
|
81
|
return STATUS_OK ; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub reset |
139
|
|
|
|
|
|
|
{ |
140
|
13
|
|
|
13
|
0
|
26
|
my $self = shift; |
141
|
|
|
|
|
|
|
|
142
|
13
|
|
|
|
|
45
|
$self->{CompSize}->reset(); |
143
|
13
|
|
|
|
|
23
|
$self->{UnCompSize} = 0; |
144
|
13
|
|
|
|
|
37
|
$self->{CRC32} = Compress::Raw::Zlib::crc32(''); |
145
|
13
|
|
|
|
|
36
|
$self->{ADLER32} = Compress::Raw::Zlib::adler32(''); |
146
|
|
|
|
|
|
|
|
147
|
13
|
|
|
|
|
39
|
return STATUS_OK ; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
#sub count |
151
|
|
|
|
|
|
|
#{ |
152
|
|
|
|
|
|
|
# my $self = shift ; |
153
|
|
|
|
|
|
|
# return $self->{UnCompSize} ; |
154
|
|
|
|
|
|
|
#} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub compressedBytes |
157
|
|
|
|
|
|
|
{ |
158
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
159
|
0
|
|
|
|
|
|
return $self->{CompSize} ; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub uncompressedBytes |
163
|
|
|
|
|
|
|
{ |
164
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
165
|
0
|
|
|
|
|
|
return $self->{CompSize} ; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub sync |
169
|
|
|
|
|
|
|
{ |
170
|
0
|
|
|
0
|
0
|
|
return STATUS_OK ; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub crc32 |
174
|
|
|
|
|
|
|
{ |
175
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
176
|
0
|
|
|
|
|
|
return $self->{CRC32}; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub adler32 |
180
|
|
|
|
|
|
|
{ |
181
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
182
|
0
|
|
|
|
|
|
return $self->{ADLER32}; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
1; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
__END__ |