line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Uncompress::UnZstd ; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
128832
|
use strict ; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
356
|
|
4
|
12
|
|
|
12
|
|
60
|
use warnings; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
281
|
|
5
|
12
|
|
|
12
|
|
60
|
use bytes; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
54
|
|
6
|
|
|
|
|
|
|
|
7
|
12
|
|
|
12
|
|
342
|
use IO::Compress::Base::Common 2.206 qw(:Status createSelfTiedObject); |
|
12
|
|
|
|
|
201
|
|
|
12
|
|
|
|
|
1723
|
|
8
|
|
|
|
|
|
|
|
9
|
12
|
|
|
12
|
|
4818
|
use IO::Uncompress::Base 2.206 ; |
|
12
|
|
|
|
|
70110
|
|
|
12
|
|
|
|
|
623
|
|
10
|
12
|
|
|
12
|
|
3849
|
use IO::Uncompress::Adapter::UnZstd 2.206 ; |
|
12
|
|
|
|
|
299
|
|
|
12
|
|
|
|
|
1418
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require Exporter ; |
14
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $UnZstdError); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$VERSION = '2.206'; |
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
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
4427
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new |
28
|
|
|
|
|
|
|
{ |
29
|
739
|
|
|
739
|
1
|
2099486
|
my $class = shift ; |
30
|
739
|
|
|
|
|
2621
|
my $obj = createSelfTiedObject($class, \$UnZstdError); |
31
|
|
|
|
|
|
|
|
32
|
739
|
|
|
|
|
30759
|
$obj->_create(undef, 0, @_); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub unzstd |
36
|
|
|
|
|
|
|
{ |
37
|
60
|
|
|
60
|
1
|
93773
|
my $obj = createSelfTiedObject(undef, \$UnZstdError); |
38
|
60
|
|
|
|
|
2666
|
return $obj->_inf(@_); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub getExtraParams |
42
|
|
|
|
|
|
|
{ |
43
|
782
|
|
|
782
|
0
|
35041
|
return (); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub ckParams |
47
|
|
|
|
|
|
|
{ |
48
|
790
|
|
|
790
|
0
|
62250
|
my $self = shift ; |
49
|
790
|
|
|
|
|
1225
|
my $got = shift ; |
50
|
|
|
|
|
|
|
|
51
|
790
|
|
|
|
|
1405
|
return 1; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub postCheckParams |
56
|
|
|
|
|
|
|
{ |
57
|
778
|
|
|
778
|
0
|
153964
|
my $self = shift ; |
58
|
778
|
|
|
|
|
1242
|
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
|
|
|
|
|
2259
|
$got->setValue('multistream' => 1); |
65
|
778
|
|
|
|
|
5322
|
return 1; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub mkUncomp |
69
|
|
|
|
|
|
|
{ |
70
|
789
|
|
|
789
|
0
|
112988
|
my $self = shift ; |
71
|
789
|
|
|
|
|
1212
|
my $got = shift ; |
72
|
|
|
|
|
|
|
|
73
|
789
|
100
|
|
|
|
1618
|
my $magic = $self->ckMagic() |
74
|
|
|
|
|
|
|
or return 0; |
75
|
|
|
|
|
|
|
|
76
|
725
|
50
|
|
|
|
1791
|
*$self->{Info} = $self->readHeader($magic) |
77
|
|
|
|
|
|
|
or return undef ; |
78
|
|
|
|
|
|
|
|
79
|
725
|
|
|
|
|
2038
|
my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::UnZstd::mkUncompObject(); |
80
|
|
|
|
|
|
|
|
81
|
725
|
50
|
|
|
|
1773
|
return $self->saveErrorString(undef, $errstr, $errno) |
82
|
|
|
|
|
|
|
if ! defined $obj; |
83
|
|
|
|
|
|
|
|
84
|
725
|
|
|
|
|
1458
|
*$self->{Uncomp} = $obj; |
85
|
|
|
|
|
|
|
|
86
|
725
|
|
|
|
|
1793
|
return 1; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub ckMagic |
91
|
|
|
|
|
|
|
{ |
92
|
971
|
|
|
971
|
0
|
448171
|
my $self = shift; |
93
|
|
|
|
|
|
|
|
94
|
12
|
|
|
12
|
|
96
|
use constant ZSTD_MAGICNUMBER => 0xFD2FB528 ; # >= v0.8.0 |
|
12
|
|
|
|
|
22
|
|
|
12
|
|
|
|
|
2994
|
|
95
|
|
|
|
|
|
|
|
96
|
971
|
|
|
|
|
1416
|
my $magic ; |
97
|
971
|
|
|
|
|
2855
|
$self->smartReadExact(\$magic, 4); |
98
|
|
|
|
|
|
|
|
99
|
971
|
|
|
|
|
45301
|
*$self->{HeaderPending} = $magic ; |
100
|
|
|
|
|
|
|
|
101
|
971
|
100
|
|
|
|
3225
|
return $self->HeaderError("Header size is " . |
102
|
|
|
|
|
|
|
4 . " bytes") |
103
|
|
|
|
|
|
|
if length $magic != 4; |
104
|
|
|
|
|
|
|
|
105
|
958
|
100
|
|
|
|
3538
|
return $self->HeaderError("Bad Magic.") |
106
|
|
|
|
|
|
|
if unpack("V*", $magic) != ZSTD_MAGICNUMBER; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
904
|
|
|
|
|
1754
|
*$self->{Type} = 'zstd'; |
110
|
904
|
|
|
|
|
2776
|
return $magic; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub readHeader |
114
|
|
|
|
|
|
|
{ |
115
|
904
|
|
|
904
|
0
|
2571
|
my $self = shift; |
116
|
904
|
|
|
|
|
1404
|
my $magic = shift ; |
117
|
|
|
|
|
|
|
|
118
|
904
|
|
|
|
|
2610
|
$self->pushBack($magic); |
119
|
904
|
|
|
|
|
10489
|
*$self->{HeaderPending} = $magic; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
return { |
122
|
904
|
|
|
|
|
4975
|
'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
|
18522
|
return STATUS_OK; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1 ; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |