line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Uncompress::Adapter::Lzf; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
195750
|
use strict; |
|
11
|
|
|
|
|
54
|
|
|
11
|
|
|
|
|
329
|
|
4
|
11
|
|
|
11
|
|
57
|
use warnings; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
252
|
|
5
|
11
|
|
|
11
|
|
49
|
use bytes; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
50
|
|
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
323
|
use IO::Compress::Base::Common 2.205 qw(:Status); |
|
11
|
|
|
|
|
191
|
|
|
11
|
|
|
|
|
1274
|
|
8
|
11
|
|
|
11
|
|
1730
|
use Compress::LZF ; |
|
11
|
|
|
|
|
1376
|
|
|
11
|
|
|
|
|
8389
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our ($VERSION, @ISA); |
11
|
|
|
|
|
|
|
$VERSION = '2.205'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub mkUncompObject |
15
|
|
|
|
|
|
|
{ |
16
|
956
|
|
|
956
|
0
|
5237
|
return bless { |
17
|
|
|
|
|
|
|
'CompBytes' => 0, |
18
|
|
|
|
|
|
|
'UnCompBytes' => 0, |
19
|
|
|
|
|
|
|
'Error' => '', |
20
|
|
|
|
|
|
|
'ErrorNo' => 0, |
21
|
|
|
|
|
|
|
'Identity' => 0, |
22
|
|
|
|
|
|
|
'USize' => 0, |
23
|
|
|
|
|
|
|
'ConsumesInput' => 0, |
24
|
|
|
|
|
|
|
} ; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub setIdentity |
28
|
|
|
|
|
|
|
{ |
29
|
774
|
|
|
774
|
0
|
1253
|
my $self = shift ; |
30
|
774
|
|
|
|
|
1597
|
$self->{Identity} = 1 ; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub setUSize |
34
|
|
|
|
|
|
|
{ |
35
|
166
|
|
|
166
|
0
|
297
|
my $self = shift ; |
36
|
166
|
|
|
|
|
229
|
my $size = shift ; |
37
|
166
|
|
|
|
|
388
|
$self->{USize} = $size ; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub mk_c_lzf_header_length |
41
|
|
|
|
|
|
|
{ |
42
|
166
|
|
|
166
|
0
|
247
|
my $usize = shift ; |
43
|
166
|
|
|
|
|
268
|
my @dst; |
44
|
|
|
|
|
|
|
|
45
|
166
|
100
|
|
|
|
432
|
if ($usize <= 0x7f) |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
46
|
|
|
|
|
|
|
{ |
47
|
22
|
|
|
|
|
45
|
push @dst, $usize; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
elsif ($usize <= 0x7ff) |
50
|
|
|
|
|
|
|
{ |
51
|
116
|
|
|
|
|
254
|
push @dst, (( $usize >> 6) | 0xc0); |
52
|
116
|
|
|
|
|
205
|
push @dst, (( $usize & 0x3f) | 0x80); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
elsif ($usize <= 0xffff) |
55
|
|
|
|
|
|
|
{ |
56
|
28
|
|
|
|
|
70
|
push @dst, (( $usize >> 12) | 0xe0); |
57
|
28
|
|
|
|
|
65
|
push @dst, ((($usize >> 6) & 0x3f) | 0x80); |
58
|
28
|
|
|
|
|
58
|
push @dst, (( $usize & 0x3f) | 0x80); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
elsif ($usize <= 0x1fffff) |
61
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
|
|
0
|
push @dst, (( $usize >> 18) | 0xf0); |
63
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 12) & 0x3f) | 0x80); |
64
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 6) & 0x3f) | 0x80); |
65
|
0
|
|
|
|
|
0
|
push @dst, (( $usize & 0x3f) | 0x80); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
elsif ($usize <= 0x3ffffff) |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
|
|
0
|
push @dst, (( $usize >> 24) | 0xf8); |
70
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 18) & 0x3f) | 0x80); |
71
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 12) & 0x3f) | 0x80); |
72
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 6) & 0x3f) | 0x80); |
73
|
0
|
|
|
|
|
0
|
push @dst, (( $usize & 0x3f) | 0x80); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
elsif ($usize <= 0x7fffffff) |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
|
|
0
|
push @dst, (( $usize >> 30) | 0xfc); |
78
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 24) & 0x3f) | 0x80); |
79
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 18) & 0x3f) | 0x80); |
80
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 12) & 0x3f) | 0x80); |
81
|
0
|
|
|
|
|
0
|
push @dst, ((($usize >> 6) & 0x3f) | 0x80); |
82
|
0
|
|
|
|
|
0
|
push @dst, (( $usize & 0x3f) | 0x80); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
else |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
|
|
0
|
die("compress can only compress up to 0x7fffffffL bytes"); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
166
|
|
|
|
|
661
|
return pack ("C*", @dst); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub uncompr |
94
|
|
|
|
|
|
|
{ |
95
|
352
|
|
|
352
|
0
|
17620
|
my $self = shift ; |
96
|
352
|
|
|
|
|
541
|
my $from = shift ; |
97
|
352
|
|
|
|
|
541
|
my $to = shift ; |
98
|
352
|
|
|
|
|
546
|
my $eof = shift ; |
99
|
352
|
|
|
|
|
547
|
my $outSize = shift ; |
100
|
|
|
|
|
|
|
|
101
|
352
|
100
|
|
|
|
850
|
return STATUS_OK |
102
|
|
|
|
|
|
|
unless length $$from; |
103
|
|
|
|
|
|
|
|
104
|
279
|
|
|
|
|
493
|
$self->{CompBytes} += length $$from; |
105
|
|
|
|
|
|
|
|
106
|
279
|
50
|
|
|
|
1016
|
if (length $$from == $outSize) { |
107
|
0
|
|
|
|
|
0
|
$self->{UnCompBytes} += length $$from; |
108
|
0
|
|
|
|
|
0
|
$$to .= $$from; |
109
|
0
|
|
|
|
|
0
|
return STATUS_OK; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#$$to .= Compress::Lzf::my_decompress($from, $outSize); |
114
|
279
|
|
|
|
|
539
|
$@ = ''; |
115
|
279
|
100
|
|
|
|
640
|
if ($self->{Identity} ) |
116
|
113
|
|
|
|
|
230
|
{ $$to .= $$from } |
117
|
|
|
|
|
|
|
else { |
118
|
|
|
|
|
|
|
|
119
|
166
|
|
|
|
|
355
|
my $hdr = mk_c_lzf_header_length($self->{USize}); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# Compress::LZF::decompress croaks if the compressed data is |
122
|
|
|
|
|
|
|
# corrupt. |
123
|
166
|
|
|
|
|
323
|
eval { $$to .= Compress::LZF::decompress($hdr . $$from) } ; |
|
166
|
|
|
|
|
1011
|
|
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
279
|
|
|
|
|
700
|
$self->{Identity} = 0 ; |
127
|
279
|
|
|
|
|
446
|
$self->{ErrorNo} = 0; |
128
|
|
|
|
|
|
|
|
129
|
279
|
100
|
66
|
|
|
1150
|
if ($@ || ! defined $to) { |
130
|
2
|
|
|
|
|
5
|
$self->{Error} = "error uncompressing"; |
131
|
2
|
50
|
|
|
|
9
|
$self->{Error} .= " - " . $@ |
132
|
|
|
|
|
|
|
if $@; |
133
|
2
|
|
|
|
|
4
|
$self->{ErrorNo} = 1; |
134
|
2
|
|
|
|
|
7
|
return STATUS_ERROR; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
277
|
|
|
|
|
490
|
$self->{UnCompBytes} += length $$to; |
138
|
|
|
|
|
|
|
|
139
|
277
|
|
|
|
|
633
|
return STATUS_OK ; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub reset |
143
|
|
|
|
|
|
|
{ |
144
|
0
|
|
|
0
|
0
|
|
return STATUS_OK ; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
#sub count |
148
|
|
|
|
|
|
|
#{ |
149
|
|
|
|
|
|
|
# my $self = shift ; |
150
|
|
|
|
|
|
|
# $self->{UnCompBytes}; |
151
|
|
|
|
|
|
|
#} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub compressedBytes |
154
|
|
|
|
|
|
|
{ |
155
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
156
|
0
|
|
|
|
|
|
$self->{CompBytes}; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub uncompressedBytes |
160
|
|
|
|
|
|
|
{ |
161
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
162
|
0
|
|
|
|
|
|
$self->{UnCompBytes}; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub crc32 |
166
|
|
|
|
|
|
|
{ |
167
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
168
|
|
|
|
|
|
|
#$self->{Inf}->crc32(); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub adler32 |
172
|
|
|
|
|
|
|
{ |
173
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
174
|
|
|
|
|
|
|
#$self->{Inf}->adler32(); |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub sync |
178
|
|
|
|
|
|
|
{ |
179
|
0
|
|
|
0
|
0
|
|
my $self = shift ; |
180
|
|
|
|
|
|
|
#( $self->{Inf}->inflateSync(@_) == BZ_OK) |
181
|
|
|
|
|
|
|
# ? STATUS_OK |
182
|
|
|
|
|
|
|
# : STATUS_ERROR ; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
1; |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
__END__ |