| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IO::Uncompress::Bunzip2 ; |
|
2
|
|
|
|
|
|
|
|
|
3
|
87
|
|
|
87
|
|
6256
|
use strict ; |
|
|
87
|
|
|
|
|
218
|
|
|
|
87
|
|
|
|
|
3432
|
|
|
4
|
87
|
|
|
87
|
|
420
|
use warnings; |
|
|
87
|
|
|
|
|
205
|
|
|
|
87
|
|
|
|
|
4067
|
|
|
5
|
87
|
|
|
87
|
|
2515
|
use bytes; |
|
|
87
|
|
|
|
|
2423
|
|
|
|
87
|
|
|
|
|
531
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
87
|
|
|
87
|
|
6003
|
use IO::Compress::Base::Common 2.220 qw(:Status ); |
|
|
87
|
|
|
|
|
1772
|
|
|
|
87
|
|
|
|
|
12206
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
87
|
|
|
87
|
|
7984
|
use IO::Uncompress::Base 2.220 ; |
|
|
87
|
|
|
|
|
1770
|
|
|
|
87
|
|
|
|
|
4654
|
|
|
10
|
87
|
|
|
87
|
|
7001
|
use IO::Uncompress::Adapter::Bunzip2 2.220 ; |
|
|
87
|
|
|
|
|
1640
|
|
|
|
87
|
|
|
|
|
67211
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter ; |
|
13
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = '2.220'; |
|
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
|
78635
|
my $class = shift ; |
|
28
|
514
|
|
|
|
|
2206
|
my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$Bunzip2Error); |
|
29
|
|
|
|
|
|
|
|
|
30
|
514
|
|
|
|
|
2255
|
$obj->_create(undef, 0, @_); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub bunzip2 |
|
34
|
|
|
|
|
|
|
{ |
|
35
|
66
|
|
|
66
|
1
|
51494
|
my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$Bunzip2Error); |
|
36
|
66
|
|
|
|
|
197
|
return $obj->_inf(@_); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub getExtraParams |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
|
|
|
|
|
|
return ( |
|
42
|
563
|
|
|
563
|
0
|
5976
|
'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
|
1037
|
my $self = shift ; |
|
51
|
569
|
|
|
|
|
874
|
my $got = shift ; |
|
52
|
|
|
|
|
|
|
|
|
53
|
569
|
|
|
|
|
1585
|
return 1; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub mkUncomp |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
568
|
|
|
568
|
0
|
1133
|
my $self = shift ; |
|
59
|
568
|
|
|
|
|
866
|
my $got = shift ; |
|
60
|
|
|
|
|
|
|
|
|
61
|
568
|
100
|
|
|
|
1651
|
my $magic = $self->ckMagic() |
|
62
|
|
|
|
|
|
|
or return 0; |
|
63
|
|
|
|
|
|
|
|
|
64
|
516
|
50
|
|
|
|
1524
|
*$self->{Info} = $self->readHeader($magic) |
|
65
|
|
|
|
|
|
|
or return undef ; |
|
66
|
|
|
|
|
|
|
|
|
67
|
516
|
|
|
|
|
1984
|
my $Small = $got->getValue('small'); |
|
68
|
516
|
|
|
|
|
1159
|
my $Verbosity = $got->getValue('verbosity'); |
|
69
|
|
|
|
|
|
|
|
|
70
|
516
|
|
|
|
|
2285
|
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Bunzip2::mkUncompObject( |
|
71
|
|
|
|
|
|
|
$Small, $Verbosity); |
|
72
|
|
|
|
|
|
|
|
|
73
|
516
|
50
|
|
|
|
1464
|
return $self->saveErrorString(undef, $errstr, $errno) |
|
74
|
|
|
|
|
|
|
if ! defined $obj; |
|
75
|
|
|
|
|
|
|
|
|
76
|
516
|
|
|
|
|
1234
|
*$self->{Uncomp} = $obj; |
|
77
|
|
|
|
|
|
|
|
|
78
|
516
|
|
|
|
|
1336
|
return 1; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub ckMagic |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
1177
|
|
|
1177
|
0
|
1871
|
my $self = shift; |
|
86
|
|
|
|
|
|
|
|
|
87
|
1177
|
|
|
|
|
1764
|
my $magic ; |
|
88
|
1177
|
|
|
|
|
4164
|
$self->smartReadExact(\$magic, 4); |
|
89
|
|
|
|
|
|
|
|
|
90
|
1177
|
|
|
|
|
2938
|
*$self->{HeaderPending} = $magic ; |
|
91
|
|
|
|
|
|
|
|
|
92
|
1177
|
100
|
|
|
|
2676
|
return $self->HeaderError("Header size is " . |
|
93
|
|
|
|
|
|
|
4 . " bytes") |
|
94
|
|
|
|
|
|
|
if length $magic != 4; |
|
95
|
|
|
|
|
|
|
|
|
96
|
1141
|
100
|
|
|
|
2477
|
return $self->HeaderError("Bad Magic.") |
|
97
|
|
|
|
|
|
|
if ! isBzip2Magic($magic) ; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
1074
|
|
|
|
|
3624
|
*$self->{Type} = 'bzip2'; |
|
101
|
1074
|
|
|
|
|
3160
|
return $magic; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub readHeader |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
1074
|
|
|
1074
|
0
|
1616
|
my $self = shift; |
|
107
|
1074
|
|
|
|
|
1814
|
my $magic = shift ; |
|
108
|
|
|
|
|
|
|
|
|
109
|
1074
|
|
|
|
|
3330
|
$self->pushBack($magic); |
|
110
|
1074
|
|
|
|
|
1978
|
*$self->{HeaderPending} = ''; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
return { |
|
114
|
1074
|
|
|
|
|
7882
|
'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
|
2798
|
return STATUS_OK; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub isBzip2Magic |
|
131
|
|
|
|
|
|
|
{ |
|
132
|
1141
|
|
|
1141
|
0
|
2192
|
my $buffer = shift ; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
# ASCII: B Z h 0 9 |
|
135
|
1141
|
|
|
|
|
16227
|
return $buffer =~ qr/^\x42\x5A\x68[\x30-\x39]$/; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1 ; |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
__END__ |