line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Uncompress::Adapter::UnXz; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
4904
|
use strict; |
|
9
|
|
|
|
|
49
|
|
|
9
|
|
|
|
|
248
|
|
4
|
9
|
|
|
9
|
|
34
|
use warnings; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
177
|
|
5
|
9
|
|
|
9
|
|
28
|
use bytes; |
|
9
|
|
|
|
|
7
|
|
|
9
|
|
|
|
|
42
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
207
|
use IO::Compress::Base::Common 2.072 qw(:Status); |
|
9
|
|
|
|
|
155
|
|
|
9
|
|
|
|
|
745
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
1316
|
use Compress::Raw::Lzma 2.072 ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our ($VERSION, @ISA); |
12
|
|
|
|
|
|
|
$VERSION = '2.072'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#@ISA = qw( Compress::Raw::UnLzma ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub mkUncompObject |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
my $memlimit = shift || 128 * 1024 * 1024; |
20
|
|
|
|
|
|
|
my $flags = shift || 0; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my ($inflate, $status) = |
23
|
|
|
|
|
|
|
Compress::Raw::Lzma::StreamDecoder->new(AppendOutput => 1, |
24
|
|
|
|
|
|
|
ConsumeInput => 1, |
25
|
|
|
|
|
|
|
LimitOutput => 1, |
26
|
|
|
|
|
|
|
MemLimit => $memlimit, |
27
|
|
|
|
|
|
|
Flags => $flags, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
return (undef, "Could not create StreamDecoder object: $status", $status) |
31
|
|
|
|
|
|
|
if $status != LZMA_OK ; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return bless {'Inf' => $inflate, |
34
|
|
|
|
|
|
|
'CompSize' => 0, |
35
|
|
|
|
|
|
|
'UnCompSize' => 0, |
36
|
|
|
|
|
|
|
'Error' => '', |
37
|
|
|
|
|
|
|
'ConsumesInput' => 1, |
38
|
|
|
|
|
|
|
} ; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub uncompr |
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
my $self = shift ; |
45
|
|
|
|
|
|
|
my $from = shift ; |
46
|
|
|
|
|
|
|
my $to = shift ; |
47
|
|
|
|
|
|
|
my $eof = shift ; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $inf = $self->{Inf}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $status = $inf->code($from, $to); |
52
|
|
|
|
|
|
|
$self->{ErrorNo} = $status; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
if ($status != LZMA_OK && $status != LZMA_STREAM_END ) |
55
|
|
|
|
|
|
|
{ |
56
|
|
|
|
|
|
|
$self->{Error} = "Uncompression Error: $status"; |
57
|
|
|
|
|
|
|
return STATUS_ERROR; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
return STATUS_OK if $status == LZMA_OK ; |
62
|
|
|
|
|
|
|
return STATUS_ENDSTREAM if $status == LZMA_STREAM_END ; |
63
|
|
|
|
|
|
|
return STATUS_ERROR ; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub reset |
68
|
|
|
|
|
|
|
{ |
69
|
|
|
|
|
|
|
my $self = shift ; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my ($inf, $status) = |
72
|
|
|
|
|
|
|
Compress::Raw::Lzma::StreamDecoder->new(AppendOutput => 1, |
73
|
|
|
|
|
|
|
ConsumeInput => 1, |
74
|
|
|
|
|
|
|
LimitOutput => 1); |
75
|
|
|
|
|
|
|
$self->{ErrorNo} = ($status == LZMA_OK) ? 0 : $status ; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
if ($status != LZMA_OK) |
78
|
|
|
|
|
|
|
{ |
79
|
|
|
|
|
|
|
$self->{Error} = "Cannot create UnXz object: $status"; |
80
|
|
|
|
|
|
|
return STATUS_ERROR; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$self->{Inf} = $inf; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
return STATUS_OK ; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
#sub count |
89
|
|
|
|
|
|
|
#{ |
90
|
|
|
|
|
|
|
# my $self = shift ; |
91
|
|
|
|
|
|
|
# $self->{Inf}->inflateCount(); |
92
|
|
|
|
|
|
|
#} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub compressedBytes |
95
|
|
|
|
|
|
|
{ |
96
|
|
|
|
|
|
|
my $self = shift ; |
97
|
|
|
|
|
|
|
$self->{Inf}->compressedBytes(); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub uncompressedBytes |
101
|
|
|
|
|
|
|
{ |
102
|
|
|
|
|
|
|
my $self = shift ; |
103
|
|
|
|
|
|
|
$self->{Inf}->uncompressedBytes(); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub crc32 |
107
|
|
|
|
|
|
|
{ |
108
|
|
|
|
|
|
|
my $self = shift ; |
109
|
|
|
|
|
|
|
#$self->{Inf}->crc32(); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub adler32 |
113
|
|
|
|
|
|
|
{ |
114
|
|
|
|
|
|
|
my $self = shift ; |
115
|
|
|
|
|
|
|
#$self->{Inf}->adler32(); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub sync |
119
|
|
|
|
|
|
|
{ |
120
|
|
|
|
|
|
|
my $self = shift ; |
121
|
|
|
|
|
|
|
#( $self->{Inf}->inflateSync(@_) == LZMA_OK) |
122
|
|
|
|
|
|
|
# ? STATUS_OK |
123
|
|
|
|
|
|
|
# : STATUS_ERROR ; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
__END__ |