Uncompress/Adapter/UnZstd.pm

filter: Statementstmt 84.4% 38 / 45 Branchbran 100% 4 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 64.2% 9 / 14 Podpod 0.0% 0 / 8 totaltotal 71.0% 54 / 76 CC 4 SCAR 6.9
CC
4
Cov
85%
uncompr
4.0
compressedBytes
2.0
uncompressedBytes
2.0
CRAP 2.0
« Compress/Adapter/Zstd.pm ↑ Summary Uncompress/UnZstd.pm »
1 package IO::Uncompress::Adapter::UnZstd;
2  
3 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 12 ▶use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 12 ▶use IO::Compress::Base::Common 2.225 qw(:Status);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use Compress::Stream::Zstd ;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 12 ▶use Compress::Stream::Zstd::Decompressor qw(ZSTD_DSTREAM_IN_SIZE);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 12 our ($VERSION, @ISA);
11 12 $VERSION = '2.225';
12  
13  
14 sub mkUncompObject
15 920 ▶{
Subroutine mkUncompObject: called CC=1 SCAR=0.0
Pod undocumented
16  
17 920 my $decompressor = Compress::Stream::Zstd::Decompressor->new;
18  
19 920 return bless {
20 'Inf' => $decompressor,
21  
22 'CompBytes' => 0,
23 'UnCompBytes' => 0,
24 'Error' => '',
25 'ErrorNo' => 0,
26 'ConsumesInput' => 0,
27 } ;
28 }
29  
30 sub uncompr
31 2618 ▶{
Subroutine uncompr: called CC=4 SCAR=13.9
Pod undocumented
32 2618 my $self = shift ;
33 2618 my $from = shift ;
34 2618 my $to = shift ;
35 # my $eof = shift ;
36  
37 2618 my $inf = $self->{Inf};
38  
39 2618 eval { $$to .= $inf->decompress($$from); } ;
40  
41 2618 ▶ if ($@ || $inf->isError())
Branch: 1 branch
BranchTrueFalseTotal
if ($@ or $inf->isError) 22 2596 2618
Condition66%2/3
$@ or $inf->isError
l!l&&r!l&&!r
2202596
MC/DC50%1/2
$@ or $inf->isError
$@ $inf->isError
Truth table66%2/3
A or B
A= $@B= $inf->isError
ABresult
1X1
011
000
42 {
43 22 $self->{Error} = $inf->getErrorName();
44 22 $self->{ErrorNo} = $inf->status() ;
45 22 return STATUS_ERROR ;
46 }
47  
48 2596 $self->{Error} = "" ;
49 2596 $self->{ErrorNo} = 0;
50  
51 2596 ▶ return STATUS_ENDSTREAM if $inf->isEndFrame() ;
Branch: 1 branch
BranchTrueFalseTotal
if $inf->isEndFrame 360 2236 2596
52  
53 2236 return STATUS_OK ;
54 }
55  
56 sub reset
57 1 ▶{
Subroutine reset: called CC=1 SCAR=0.0
Pod undocumented
58 1 return STATUS_OK ;
59 }
60  
61 #sub count
62 #{
63 # my $self = shift ;
64 # $self->{UnCompBytes};
65 #}
66  
67 sub compressedBytes
68 0 ▶{
Subroutine compressedBytes: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my $self = shift ;
70 0 $self->{CompBytes};
71 }
72  
73 sub uncompressedBytes
74 0 ▶{
Subroutine uncompressedBytes: not called CC=1 SCAR=6.9
Pod undocumented
75 0 my $self = shift ;
76 0 $self->{UnCompBytes};
77 }
78  
79 sub crc32
80 0 ▶{
Subroutine crc32: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my $self = shift ;
82 #$self->{Inf}->crc32();
83 }
84  
85 sub adler32
86 0 ▶{
Subroutine adler32: not called CC=1 SCAR=6.9
Pod undocumented
87 0 my $self = shift ;
88 #$self->{Inf}->adler32();
89 }
90  
91 sub sync
92 0 ▶{
Subroutine sync: not called CC=1 SCAR=6.9
Pod undocumented
93 0 my $self = shift ;
94 }
95  
96 12 1;
97  
98 __END__
« Compress/Adapter/Zstd.pm ↑ Summary Uncompress/UnZstd.pm »