line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Compress::Adapter::Lzma ; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
48
|
use strict; |
|
12
|
|
|
|
|
19
|
|
|
12
|
|
|
|
|
308
|
|
4
|
12
|
|
|
12
|
|
42
|
use warnings; |
|
12
|
|
|
|
|
15
|
|
|
12
|
|
|
|
|
258
|
|
5
|
12
|
|
|
12
|
|
42
|
use bytes; |
|
12
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
56
|
|
6
|
|
|
|
|
|
|
|
7
|
12
|
|
|
12
|
|
273
|
use IO::Compress::Base::Common 2.072 qw(:Status); |
|
12
|
|
|
|
|
184
|
|
|
12
|
|
|
|
|
1645
|
|
8
|
|
|
|
|
|
|
|
9
|
12
|
|
|
12
|
|
9358
|
use Compress::Raw::Lzma 2.072 qw(LZMA_OK LZMA_STREAM_END) ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our ($VERSION); |
12
|
|
|
|
|
|
|
$VERSION = '2.072'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub mkCompObject |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
my $Filter = shift ; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my ($def, $status) = |
19
|
|
|
|
|
|
|
Compress::Raw::Lzma::AloneEncoder->new(AppendOutput => 1, |
20
|
|
|
|
|
|
|
Filter => $Filter); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return (undef, "Could not create AloneEncoder object: $status", $status) |
23
|
|
|
|
|
|
|
if $status != LZMA_OK ; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return bless {'Def' => $def, |
26
|
|
|
|
|
|
|
'Error' => '', |
27
|
|
|
|
|
|
|
'ErrorNo' => 0, |
28
|
|
|
|
|
|
|
} ; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub mkRawZipCompObject |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
my $preset = shift ; |
34
|
|
|
|
|
|
|
my $extreme = shift; |
35
|
|
|
|
|
|
|
my $filter; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
if (defined $preset) { |
39
|
|
|
|
|
|
|
$preset |= Compress::Raw::Lzma::LZMA_PRESET_EXTREME() |
40
|
|
|
|
|
|
|
if $extreme; |
41
|
|
|
|
|
|
|
$filter = Lzma::Filter::Lzma1::Preset($preset) ; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
else |
44
|
|
|
|
|
|
|
{ $filter = Lzma::Filter::Lzma1 } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my ($def, $status) = |
47
|
|
|
|
|
|
|
Compress::Raw::Lzma::RawEncoder->new(AppendOutput => 1, |
48
|
|
|
|
|
|
|
ForZip => 1, |
49
|
|
|
|
|
|
|
Filter => $filter, |
50
|
|
|
|
|
|
|
#Filter => Lzma::Filter::Lzma1m |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return (undef, "Could not create RawEncoder object: $status", $status) |
54
|
|
|
|
|
|
|
if $status != LZMA_OK ; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return bless {'Def' => $def, |
57
|
|
|
|
|
|
|
'Error' => '', |
58
|
|
|
|
|
|
|
'ErrorNo' => 0, |
59
|
|
|
|
|
|
|
} ; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub compr |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
my $self = shift ; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $def = $self->{Def}; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $status = $def->code($_[0], $_[1]) ; |
69
|
|
|
|
|
|
|
$self->{ErrorNo} = $status; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
if ($status != LZMA_OK) |
72
|
|
|
|
|
|
|
{ |
73
|
|
|
|
|
|
|
$self->{Error} = "Deflate Error: $status"; |
74
|
|
|
|
|
|
|
return STATUS_ERROR; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#${ $_[1] } .= $out if defined $out; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
return STATUS_OK; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub flush |
83
|
|
|
|
|
|
|
{ |
84
|
|
|
|
|
|
|
my $self = shift ; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
my $def = $self->{Def}; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $status = $def->flush($_[0]); |
89
|
|
|
|
|
|
|
$self->{ErrorNo} = $status; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
if ($status != LZMA_STREAM_END) |
92
|
|
|
|
|
|
|
{ |
93
|
|
|
|
|
|
|
$self->{Error} = "Deflate Error: $status"; |
94
|
|
|
|
|
|
|
return STATUS_ERROR; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
#${ $_[0] } .= $out if defined $out ; |
98
|
|
|
|
|
|
|
return STATUS_OK; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub close |
103
|
|
|
|
|
|
|
{ |
104
|
|
|
|
|
|
|
my $self = shift ; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $def = $self->{Def}; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
my $status = $def->flush($_[0]); |
109
|
|
|
|
|
|
|
$self->{ErrorNo} = $status; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
if ($status != LZMA_STREAM_END) |
112
|
|
|
|
|
|
|
{ |
113
|
|
|
|
|
|
|
$self->{Error} = "Deflate Error: $status"; |
114
|
|
|
|
|
|
|
return STATUS_ERROR; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#${ $_[0] } .= $out if defined $out ; |
118
|
|
|
|
|
|
|
return STATUS_OK; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub reset |
124
|
|
|
|
|
|
|
{ |
125
|
|
|
|
|
|
|
my $self = shift ; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my $outer = $self->{Outer}; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
my ($def, $status) = |
130
|
|
|
|
|
|
|
Compress::Raw::Lzma::AloneEncoder->new(AppendOutput => 1); |
131
|
|
|
|
|
|
|
$self->{ErrorNo} = ($status == LZMA_OK) ? 0 : $status ; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
if ($status != LZMA_OK) |
134
|
|
|
|
|
|
|
{ |
135
|
|
|
|
|
|
|
$self->{Error} = "Cannot create Deflate object: $status"; |
136
|
|
|
|
|
|
|
return STATUS_ERROR; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
$self->{Def} = $def; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
return STATUS_OK; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub compressedBytes |
145
|
|
|
|
|
|
|
{ |
146
|
|
|
|
|
|
|
my $self = shift ; |
147
|
|
|
|
|
|
|
$self->{Def}->compressedBytes(); |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub uncompressedBytes |
151
|
|
|
|
|
|
|
{ |
152
|
|
|
|
|
|
|
my $self = shift ; |
153
|
|
|
|
|
|
|
$self->{Def}->uncompressedBytes(); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
#sub total_out |
157
|
|
|
|
|
|
|
#{ |
158
|
|
|
|
|
|
|
# my $self = shift ; |
159
|
|
|
|
|
|
|
# 0; |
160
|
|
|
|
|
|
|
#} |
161
|
|
|
|
|
|
|
# |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
#sub total_in |
164
|
|
|
|
|
|
|
#{ |
165
|
|
|
|
|
|
|
# my $self = shift ; |
166
|
|
|
|
|
|
|
# $self->{Def}->total_in(); |
167
|
|
|
|
|
|
|
#} |
168
|
|
|
|
|
|
|
# |
169
|
|
|
|
|
|
|
#sub crc32 |
170
|
|
|
|
|
|
|
#{ |
171
|
|
|
|
|
|
|
# my $self = shift ; |
172
|
|
|
|
|
|
|
# $self->{Def}->crc32(); |
173
|
|
|
|
|
|
|
#} |
174
|
|
|
|
|
|
|
# |
175
|
|
|
|
|
|
|
#sub adler32 |
176
|
|
|
|
|
|
|
#{ |
177
|
|
|
|
|
|
|
# my $self = shift ; |
178
|
|
|
|
|
|
|
# $self->{Def}->adler32(); |
179
|
|
|
|
|
|
|
#} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
1; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
__END__ |