line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Uncompress::UnZstd ; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
129358
|
use strict ; |
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
367
|
|
4
|
12
|
|
|
12
|
|
60
|
use warnings; |
|
12
|
|
|
|
|
26
|
|
|
12
|
|
|
|
|
274
|
|
5
|
12
|
|
|
12
|
|
64
|
use bytes; |
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
58
|
|
6
|
|
|
|
|
|
|
|
7
|
12
|
|
|
12
|
|
358
|
use IO::Compress::Base::Common 2.205 qw(:Status createSelfTiedObject); |
|
12
|
|
|
|
|
205
|
|
|
12
|
|
|
|
|
3338
|
|
8
|
|
|
|
|
|
|
|
9
|
12
|
|
|
12
|
|
4949
|
use IO::Uncompress::Base 2.205 ; |
|
12
|
|
|
|
|
71543
|
|
|
12
|
|
|
|
|
638
|
|
10
|
12
|
|
|
12
|
|
3885
|
use IO::Uncompress::Adapter::UnZstd 2.205 ; |
|
12
|
|
|
|
|
247
|
|
|
12
|
|
|
|
|
1374
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require Exporter ; |
14
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnZstdError); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$VERSION = '2.205'; |
17
|
|
|
|
|
|
|
$UnZstdError = ''; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
@ISA = qw( IO::Uncompress::Base Exporter ); |
20
|
|
|
|
|
|
|
@EXPORT_OK = qw( $UnZstdError unzstd ) ; |
21
|
|
|
|
|
|
|
#%EXPORT_TAGS = %IO::Uncompress::Base::EXPORT_TAGS ; |
22
|
|
|
|
|
|
|
push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; |
23
|
|
|
|
|
|
|
#Exporter::export_ok_tags('all'); |
24
|
|
|
|
|
|
|
|
25
|
12
|
|
|
12
|
|
84
|
use constant SIGNATURE => 'ZV'; |
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
4555
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new |
28
|
|
|
|
|
|
|
{ |
29
|
739
|
|
|
739
|
1
|
2107090
|
my $class = shift ; |
30
|
739
|
|
|
|
|
2832
|
my $obj = createSelfTiedObject($class, \$UnZstdError); |
31
|
|
|
|
|
|
|
|
32
|
739
|
|
|
|
|
30451
|
$obj->_create(undef, 0, @_); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub unzstd |
36
|
|
|
|
|
|
|
{ |
37
|
60
|
|
|
60
|
1
|
93232
|
my $obj = createSelfTiedObject(undef, \$UnZstdError); |
38
|
60
|
|
|
|
|
2617
|
return $obj->_inf(@_); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub getExtraParams |
42
|
|
|
|
|
|
|
{ |
43
|
782
|
|
|
782
|
0
|
35300
|
return (); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub ckParams |
47
|
|
|
|
|
|
|
{ |
48
|
790
|
|
|
790
|
0
|
62981
|
my $self = shift ; |
49
|
790
|
|
|
|
|
1207
|
my $got = shift ; |
50
|
|
|
|
|
|
|
|
51
|
790
|
|
|
|
|
1417
|
return 1; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub postCheckParams |
56
|
|
|
|
|
|
|
{ |
57
|
778
|
|
|
778
|
0
|
155478
|
my $self = shift ; |
58
|
778
|
|
|
|
|
1139
|
my $got = shift ; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# return $self->saveErrorString(undef, "MultiStream not supported by Zstd", STATUS_ERROR) |
61
|
|
|
|
|
|
|
# if $got->getValue('multistream') ; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Compress::Stream::Zstd is only multi-stream |
64
|
778
|
|
|
|
|
2274
|
$got->setValue('multistream' => 1); |
65
|
778
|
|
|
|
|
5374
|
return 1; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub mkUncomp |
69
|
|
|
|
|
|
|
{ |
70
|
789
|
|
|
789
|
0
|
112812
|
my $self = shift ; |
71
|
789
|
|
|
|
|
1278
|
my $got = shift ; |
72
|
|
|
|
|
|
|
|
73
|
789
|
100
|
|
|
|
1697
|
my $magic = $self->ckMagic() |
74
|
|
|
|
|
|
|
or return 0; |
75
|
|
|
|
|
|
|
|
76
|
725
|
50
|
|
|
|
1681
|
*$self->{Info} = $self->readHeader($magic) |
77
|
|
|
|
|
|
|
or return undef ; |
78
|
|
|
|
|
|
|
|
79
|
725
|
|
|
|
|
2507
|
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnZstd::mkUncompObject(); |
80
|
|
|
|
|
|
|
|
81
|
725
|
50
|
|
|
|
1813
|
return $self->saveErrorString(undef, $errstr, $errno) |
82
|
|
|
|
|
|
|
if ! defined $obj; |
83
|
|
|
|
|
|
|
|
84
|
725
|
|
|
|
|
1378
|
*$self->{Uncomp} = $obj; |
85
|
|
|
|
|
|
|
|
86
|
725
|
|
|
|
|
1614
|
return 1; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub ckMagic |
91
|
|
|
|
|
|
|
{ |
92
|
971
|
|
|
971
|
0
|
445838
|
my $self = shift; |
93
|
|
|
|
|
|
|
|
94
|
12
|
|
|
12
|
|
91
|
use constant ZSTD_MAGICNUMBER => 0xFD2FB528 ; # >= v0.8.0 |
|
12
|
|
|
|
|
26
|
|
|
12
|
|
|
|
|
2958
|
|
95
|
|
|
|
|
|
|
|
96
|
971
|
|
|
|
|
1371
|
my $magic ; |
97
|
971
|
|
|
|
|
2860
|
$self->smartReadExact(\$magic, 4); |
98
|
|
|
|
|
|
|
|
99
|
971
|
|
|
|
|
44441
|
*$self->{HeaderPending} = $magic ; |
100
|
|
|
|
|
|
|
|
101
|
971
|
100
|
|
|
|
2912
|
return $self->HeaderError("Header size is " . |
102
|
|
|
|
|
|
|
4 . " bytes") |
103
|
|
|
|
|
|
|
if length $magic != 4; |
104
|
|
|
|
|
|
|
|
105
|
958
|
100
|
|
|
|
3667
|
return $self->HeaderError("Bad Magic.") |
106
|
|
|
|
|
|
|
if unpack("V*", $magic) != ZSTD_MAGICNUMBER; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
904
|
|
|
|
|
1957
|
*$self->{Type} = 'zstd'; |
110
|
904
|
|
|
|
|
2756
|
return $magic; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub readHeader |
114
|
|
|
|
|
|
|
{ |
115
|
904
|
|
|
904
|
0
|
2518
|
my $self = shift; |
116
|
904
|
|
|
|
|
1351
|
my $magic = shift ; |
117
|
|
|
|
|
|
|
|
118
|
904
|
|
|
|
|
2596
|
$self->pushBack($magic); |
119
|
904
|
|
|
|
|
10604
|
*$self->{HeaderPending} = $magic; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
return { |
122
|
904
|
|
|
|
|
4953
|
'Type' => 'zstd', |
123
|
|
|
|
|
|
|
'FingerprintLength' => 4, |
124
|
|
|
|
|
|
|
'HeaderLength' => 4, |
125
|
|
|
|
|
|
|
'TrailerLength' => 0, |
126
|
|
|
|
|
|
|
'Header' => $magic |
127
|
|
|
|
|
|
|
}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub chkTrailer |
131
|
|
|
|
|
|
|
{ |
132
|
346
|
|
|
346
|
0
|
18169
|
return STATUS_OK; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1 ; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |