| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IO::Uncompress::Bunzip2 ; |
|
2
|
|
|
|
|
|
|
|
|
3
|
87
|
|
|
87
|
|
5048
|
use strict ; |
|
|
87
|
|
|
|
|
125
|
|
|
|
87
|
|
|
|
|
2637
|
|
|
4
|
87
|
|
|
87
|
|
309
|
use warnings; |
|
|
87
|
|
|
|
|
129
|
|
|
|
87
|
|
|
|
|
3246
|
|
|
5
|
87
|
|
|
87
|
|
1826
|
use bytes; |
|
|
87
|
|
|
|
|
1752
|
|
|
|
87
|
|
|
|
|
447
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
87
|
|
|
87
|
|
4542
|
use IO::Compress::Base::Common 2.221 qw(:Status ); |
|
|
87
|
|
|
|
|
3194
|
|
|
|
87
|
|
|
|
|
12085
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
87
|
|
|
87
|
|
7972
|
use IO::Uncompress::Base 2.221 ; |
|
|
87
|
|
|
|
|
3022
|
|
|
|
87
|
|
|
|
|
3462
|
|
|
10
|
87
|
|
|
87
|
|
5075
|
use IO::Uncompress::Adapter::Bunzip2 2.221 ; |
|
|
87
|
|
|
|
|
1106
|
|
|
|
87
|
|
|
|
|
49245
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter ; |
|
13
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = '2.221'; |
|
16
|
|
|
|
|
|
|
$Bunzip2Error = ''; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
@ISA = qw(IO::Uncompress::Base Exporter); |
|
19
|
|
|
|
|
|
|
@EXPORT_OK = qw( $Bunzip2Error bunzip2 ) ; |
|
20
|
|
|
|
|
|
|
#%EXPORT_TAGS = %IO::Uncompress::Base::EXPORT_TAGS ; |
|
21
|
|
|
|
|
|
|
$EXPORT_TAGS{all} = [ defined $EXPORT_TAGS{all} ? @{ $EXPORT_TAGS{all} } : (), @EXPORT_OK ] ; |
|
22
|
|
|
|
|
|
|
#Exporter::export_ok_tags('all'); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new |
|
26
|
|
|
|
|
|
|
{ |
|
27
|
514
|
|
|
514
|
1
|
48288
|
my $class = shift ; |
|
28
|
514
|
|
|
|
|
1600
|
my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$Bunzip2Error); |
|
29
|
|
|
|
|
|
|
|
|
30
|
514
|
|
|
|
|
1659
|
$obj->_create(undef, 0, @_); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub bunzip2 |
|
34
|
|
|
|
|
|
|
{ |
|
35
|
66
|
|
|
66
|
1
|
48153
|
my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$Bunzip2Error); |
|
36
|
66
|
|
|
|
|
202
|
return $obj->_inf(@_); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub getExtraParams |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
|
|
|
|
|
|
return ( |
|
42
|
563
|
|
|
563
|
0
|
4029
|
'verbosity' => [IO::Compress::Base::Common::Parse_boolean, 0], |
|
43
|
|
|
|
|
|
|
'small' => [IO::Compress::Base::Common::Parse_boolean, 0], |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub ckParams |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
569
|
|
|
569
|
0
|
657
|
my $self = shift ; |
|
51
|
569
|
|
|
|
|
558
|
my $got = shift ; |
|
52
|
|
|
|
|
|
|
|
|
53
|
569
|
|
|
|
|
1089
|
return 1; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub mkUncomp |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
568
|
|
|
568
|
0
|
649
|
my $self = shift ; |
|
59
|
568
|
|
|
|
|
567
|
my $got = shift ; |
|
60
|
|
|
|
|
|
|
|
|
61
|
568
|
100
|
|
|
|
979
|
my $magic = $self->ckMagic() |
|
62
|
|
|
|
|
|
|
or return 0; |
|
63
|
|
|
|
|
|
|
|
|
64
|
516
|
50
|
|
|
|
992
|
*$self->{Info} = $self->readHeader($magic) |
|
65
|
|
|
|
|
|
|
or return undef ; |
|
66
|
|
|
|
|
|
|
|
|
67
|
516
|
|
|
|
|
1103
|
my $Small = $got->getValue('small'); |
|
68
|
516
|
|
|
|
|
733
|
my $Verbosity = $got->getValue('verbosity'); |
|
69
|
|
|
|
|
|
|
|
|
70
|
516
|
|
|
|
|
1314
|
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Bunzip2::mkUncompObject( |
|
71
|
|
|
|
|
|
|
$Small, $Verbosity); |
|
72
|
|
|
|
|
|
|
|
|
73
|
516
|
50
|
|
|
|
917
|
return $self->saveErrorString(undef, $errstr, $errno) |
|
74
|
|
|
|
|
|
|
if ! defined $obj; |
|
75
|
|
|
|
|
|
|
|
|
76
|
516
|
|
|
|
|
907
|
*$self->{Uncomp} = $obj; |
|
77
|
|
|
|
|
|
|
|
|
78
|
516
|
|
|
|
|
966
|
return 1; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub ckMagic |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
1177
|
|
|
1177
|
0
|
1319
|
my $self = shift; |
|
86
|
|
|
|
|
|
|
|
|
87
|
1177
|
|
|
|
|
1206
|
my $magic ; |
|
88
|
1177
|
|
|
|
|
2884
|
$self->smartReadExact(\$magic, 4); |
|
89
|
|
|
|
|
|
|
|
|
90
|
1177
|
|
|
|
|
2085
|
*$self->{HeaderPending} = $magic ; |
|
91
|
|
|
|
|
|
|
|
|
92
|
1177
|
100
|
|
|
|
1984
|
return $self->HeaderError("Header size is " . |
|
93
|
|
|
|
|
|
|
4 . " bytes") |
|
94
|
|
|
|
|
|
|
if length $magic != 4; |
|
95
|
|
|
|
|
|
|
|
|
96
|
1141
|
100
|
|
|
|
1772
|
return $self->HeaderError("Bad Magic.") |
|
97
|
|
|
|
|
|
|
if ! isBzip2Magic($magic) ; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
1074
|
|
|
|
|
1878
|
*$self->{Type} = 'bzip2'; |
|
101
|
1074
|
|
|
|
|
2198
|
return $magic; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub readHeader |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
1074
|
|
|
1074
|
0
|
1176
|
my $self = shift; |
|
107
|
1074
|
|
|
|
|
1102
|
my $magic = shift ; |
|
108
|
|
|
|
|
|
|
|
|
109
|
1074
|
|
|
|
|
2150
|
$self->pushBack($magic); |
|
110
|
1074
|
|
|
|
|
1301
|
*$self->{HeaderPending} = ''; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
return { |
|
114
|
1074
|
|
|
|
|
5200
|
'Type' => 'bzip2', |
|
115
|
|
|
|
|
|
|
'FingerprintLength' => 4, |
|
116
|
|
|
|
|
|
|
'HeaderLength' => 4, |
|
117
|
|
|
|
|
|
|
'TrailerLength' => 0, |
|
118
|
|
|
|
|
|
|
'Header' => '$magic' |
|
119
|
|
|
|
|
|
|
}; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub chkTrailer |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
1070
|
|
|
1070
|
0
|
1760
|
return STATUS_OK; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub isBzip2Magic |
|
131
|
|
|
|
|
|
|
{ |
|
132
|
1141
|
|
|
1141
|
0
|
1464
|
my $buffer = shift ; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
# ASCII: B Z h 0 9 |
|
135
|
1141
|
|
|
|
|
11259
|
return $buffer =~ qr/^\x42\x5A\x68[\x30-\x39]$/; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1 ; |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
__END__ |