| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IO::Uncompress::Bunzip2 ; |
|
2
|
|
|
|
|
|
|
|
|
3
|
83
|
|
|
83
|
|
4983
|
use strict ; |
|
|
83
|
|
|
|
|
159
|
|
|
|
83
|
|
|
|
|
2156
|
|
|
4
|
83
|
|
|
83
|
|
381
|
use warnings; |
|
|
83
|
|
|
|
|
172
|
|
|
|
83
|
|
|
|
|
1746
|
|
|
5
|
83
|
|
|
83
|
|
432
|
use bytes; |
|
|
83
|
|
|
|
|
193
|
|
|
|
83
|
|
|
|
|
365
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
83
|
|
|
83
|
|
2765
|
use IO::Compress::Base::Common 2.204 qw(:Status ); |
|
|
83
|
|
|
|
|
1320
|
|
|
|
83
|
|
|
|
|
9047
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
83
|
|
|
83
|
|
4434
|
use IO::Uncompress::Base 2.204 ; |
|
|
83
|
|
|
|
|
1283
|
|
|
|
83
|
|
|
|
|
3778
|
|
|
10
|
83
|
|
|
83
|
|
3682
|
use IO::Uncompress::Adapter::Bunzip2 2.204 ; |
|
|
83
|
|
|
|
|
1197
|
|
|
|
83
|
|
|
|
|
49570
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter ; |
|
13
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = '2.204'; |
|
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
|
|
|
|
|
|
|
push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; |
|
22
|
|
|
|
|
|
|
#Exporter::export_ok_tags('all'); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new |
|
26
|
|
|
|
|
|
|
{ |
|
27
|
508
|
|
|
508
|
1
|
48964
|
my $class = shift ; |
|
28
|
508
|
|
|
|
|
1567
|
my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$Bunzip2Error); |
|
29
|
|
|
|
|
|
|
|
|
30
|
508
|
|
|
|
|
1914
|
$obj->_create(undef, 0, @_); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub bunzip2 |
|
34
|
|
|
|
|
|
|
{ |
|
35
|
66
|
|
|
66
|
1
|
50806
|
my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$Bunzip2Error); |
|
36
|
66
|
|
|
|
|
217
|
return $obj->_inf(@_); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub getExtraParams |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
|
|
|
|
|
|
return ( |
|
42
|
557
|
|
|
557
|
0
|
4382
|
'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
|
563
|
|
|
563
|
0
|
843
|
my $self = shift ; |
|
51
|
563
|
|
|
|
|
790
|
my $got = shift ; |
|
52
|
|
|
|
|
|
|
|
|
53
|
563
|
|
|
|
|
1239
|
return 1; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub mkUncomp |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
562
|
|
|
562
|
0
|
849
|
my $self = shift ; |
|
59
|
562
|
|
|
|
|
718
|
my $got = shift ; |
|
60
|
|
|
|
|
|
|
|
|
61
|
562
|
100
|
|
|
|
1064
|
my $magic = $self->ckMagic() |
|
62
|
|
|
|
|
|
|
or return 0; |
|
63
|
|
|
|
|
|
|
|
|
64
|
510
|
50
|
|
|
|
1154
|
*$self->{Info} = $self->readHeader($magic) |
|
65
|
|
|
|
|
|
|
or return undef ; |
|
66
|
|
|
|
|
|
|
|
|
67
|
510
|
|
|
|
|
1533
|
my $Small = $got->getValue('small'); |
|
68
|
510
|
|
|
|
|
1048
|
my $Verbosity = $got->getValue('verbosity'); |
|
69
|
|
|
|
|
|
|
|
|
70
|
510
|
|
|
|
|
1485
|
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Bunzip2::mkUncompObject( |
|
71
|
|
|
|
|
|
|
$Small, $Verbosity); |
|
72
|
|
|
|
|
|
|
|
|
73
|
510
|
50
|
|
|
|
1204
|
return $self->saveErrorString(undef, $errstr, $errno) |
|
74
|
|
|
|
|
|
|
if ! defined $obj; |
|
75
|
|
|
|
|
|
|
|
|
76
|
510
|
|
|
|
|
997
|
*$self->{Uncomp} = $obj; |
|
77
|
|
|
|
|
|
|
|
|
78
|
510
|
|
|
|
|
1229
|
return 1; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub ckMagic |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
1171
|
|
|
1171
|
0
|
1764
|
my $self = shift; |
|
86
|
|
|
|
|
|
|
|
|
87
|
1171
|
|
|
|
|
1561
|
my $magic ; |
|
88
|
1171
|
|
|
|
|
3541
|
$self->smartReadExact(\$magic, 4); |
|
89
|
|
|
|
|
|
|
|
|
90
|
1171
|
|
|
|
|
2537
|
*$self->{HeaderPending} = $magic ; |
|
91
|
|
|
|
|
|
|
|
|
92
|
1171
|
100
|
|
|
|
2632
|
return $self->HeaderError("Header size is " . |
|
93
|
|
|
|
|
|
|
4 . " bytes") |
|
94
|
|
|
|
|
|
|
if length $magic != 4; |
|
95
|
|
|
|
|
|
|
|
|
96
|
1135
|
100
|
|
|
|
2103
|
return $self->HeaderError("Bad Magic.") |
|
97
|
|
|
|
|
|
|
if ! isBzip2Magic($magic) ; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
1068
|
|
|
|
|
2633
|
*$self->{Type} = 'bzip2'; |
|
101
|
1068
|
|
|
|
|
2851
|
return $magic; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub readHeader |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
1068
|
|
|
1068
|
0
|
1631
|
my $self = shift; |
|
107
|
1068
|
|
|
|
|
1566
|
my $magic = shift ; |
|
108
|
|
|
|
|
|
|
|
|
109
|
1068
|
|
|
|
|
3634
|
$self->pushBack($magic); |
|
110
|
1068
|
|
|
|
|
1854
|
*$self->{HeaderPending} = ''; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
return { |
|
114
|
1068
|
|
|
|
|
5616
|
'Type' => 'bzip2', |
|
115
|
|
|
|
|
|
|
'FingerprintLength' => 4, |
|
116
|
|
|
|
|
|
|
'HeaderLength' => 4, |
|
117
|
|
|
|
|
|
|
'TrailerLength' => 0, |
|
118
|
|
|
|
|
|
|
'Header' => '$magic' |
|
119
|
|
|
|
|
|
|
}; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub chkTrailer |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
1064
|
|
|
1064
|
0
|
3245
|
return STATUS_OK; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub isBzip2Magic |
|
131
|
|
|
|
|
|
|
{ |
|
132
|
1135
|
|
|
1135
|
0
|
1940
|
my $buffer = shift ; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
# ASCII: B Z h 0 9 |
|
135
|
1135
|
|
|
|
|
11311
|
return $buffer =~ qr/^\x42\x5A\x68[\x30-\x39]$/; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1 ; |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
__END__ |