blib/lib/IO/Uncompress/Adapter/Inflate.pm

filter: Statementstmt 92.0% 58 / 63 Branchbran 85.7% 12 / 14 Conditioncond 100% 12 / 12 MC/DCmcdc 100% 6 / 6 Subroutinesub 88.2% 15 / 17 Podpod 0.0% 0 / 12 totaltotal 83.0% 103 / 124 CC 13 SCAR 12.9
CC
13
Cov
92%
uncompr
7.0
mkUncompObject
6.0
compressedBytes
2.0
CRAP 3.6
« blib/lib/IO/Compress/RawDeflate.pm ↑ Summary blib/lib/IO/Compress/Bzip2.pm »
1 package IO::Uncompress::Adapter::Inflate;
2  
3 96 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 96 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 96 ▶use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 96 ▶use IO::Compress::Base::Common 2.225 qw(:Status);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 96 ▶use Compress::Raw::Zlib 2.225 qw(Z_OK Z_BUF_ERROR Z_STREAM_END Z_FINISH MAX_WBITS);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 96 our ($VERSION);
11 96 $VERSION = '2.225';
12  
13  
14  
15 sub mkUncompObject
16 3546 ▶{
Subroutine mkUncompObject: called CC=6 SCAR=17.9
Pod undocumented
17 3546 ▶ my $crc32 = shift || 1;
Condition100%2/2
shift() || 1
l!l
14302116
MC/DC100%1/1
shift() || 1
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
18 3546 ▶ my $adler32 = shift || 1;
Condition100%2/2
shift() || 1
l!l
3463200
MC/DC100%1/1
shift() || 1
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
19 3546 ▶ my $scan = shift || 0;
Condition100%2/2
shift() || 0
l!l
723474
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
20  
21 3546 my $inflate ;
22 my $status ;
23  
24 3546 ▶ if ($scan)
Branch: 1 branch
BranchTrueFalseTotal
if ($scan) { } 72 3474 3546
25 {
26 72 ($inflate, $status) = Compress::Raw::Zlib::InflateScan->new(
27 #LimitOutput => 1,
28 CRC32 => $crc32,
29 ADLER32 => $adler32,
30 WindowBits => - MAX_WBITS );
31 }
32 else
33 {
34 3474 ($inflate, $status) = Compress::Raw::Zlib::Inflate->new(
35 AppendOutput => 1,
36 LimitOutput => 1,
37 CRC32 => $crc32,
38 ADLER32 => $adler32,
39 WindowBits => - MAX_WBITS );
40 }
41  
42 3546 ▶ return (undef, "Could not create Inflation object: $status", $status)
Branch: 1 branch
BranchTrueFalseTotal
if $status != Z_OK() 0 3546 3546
43 if $status != Z_OK ;
44  
45 3546 return bless {'Inf' => $inflate,
46 'CompSize' => 0,
47 'UnCompSize' => 0,
48 'Error' => '',
49 'ConsumesInput' => 1,
50 } ;
51  
52 }
53  
54 sub uncompr
55 5771 ▶{
Subroutine uncompr: called CC=7 SCAR=19.5
Pod undocumented
56 5771 my $self = shift ;
57 5771 my $from = shift ;
58 5771 my $to = shift ;
59 5771 my $eof = shift ;
60  
61 5771 my $inf = $self->{Inf};
62  
63 5771 my $status = $inf->inflate($from, $to, $eof);
64 5771 $self->{ErrorNo} = $status;
65 5771 ▶ if ($status != Z_OK && $status != Z_STREAM_END && $status != Z_BUF_ERROR)
Branch: 1 branch
BranchTrueFalseTotal
if ($status != Z_OK() and $status != Z_STREAM_END() and $status != Z_BUF_ERROR()) 1176 4595 5771
Condition100%6/6
$status != Z_OK() and $status != Z_STREAM_END() and $status != Z_BUF_ERROR()
!ll&&!rl&&r
43282671176
$status != Z_OK() and $status != Z_STREAM_END()
!ll&&!rl&&r
59737311443
MC/DC100%3/3
$status != Z_OK() and $status != Z_STREAM_END() and $status != Z_BUF_ERROR()
$status != Z_OK() $status != Z_STREAM_END() $status != Z_BUF_ERROR()
Truth table100%4/4
A and B and C
A= $status != Z_OK()B= $status != Z_STREAM_END()C= $status != Z_BUF_ERROR()
ABCresult
0XX0
10X0
1100
1111
66 {
67 1176 $self->{Error} = "Inflation Error: $status";
68 1176 return STATUS_ERROR;
69 }
70  
71 4595 ▶ return STATUS_OK if $status == Z_BUF_ERROR ; # ???
Branch: 1 branch
BranchTrueFalseTotal
if $status == Z_BUF_ERROR() 267 4328 4595
72 4328 ▶ return STATUS_OK if $status == Z_OK ;
Branch: 1 branch
BranchTrueFalseTotal
if $status == Z_OK() 597 3731 4328
73 3731 ▶ return STATUS_ENDSTREAM if $status == Z_STREAM_END ;
Branch: 1 branch
BranchTrueFalseTotal
if $status == Z_STREAM_END() 3731 0 3731
74 0 return STATUS_ERROR ;
75 }
76  
77 sub reset
78 2632 ▶{
Subroutine reset: called CC=1 SCAR=0.0
Pod undocumented
79 2632 my $self = shift ;
80 2632 $self->{Inf}->inflateReset();
81  
82 2632 return STATUS_OK ;
83 }
84  
85 #sub count
86 #{
87 # my $self = shift ;
88 # $self->{Inf}->inflateCount();
89 #}
90  
91 sub crc32
92 1618 ▶{
Subroutine crc32: called CC=1 SCAR=0.0
Pod undocumented
93 1618 my $self = shift ;
94 1618 $self->{Inf}->crc32();
95 }
96  
97 sub compressedBytes
98 0 ▶{
Subroutine compressedBytes: not called CC=1 SCAR=6.9
Pod undocumented
99 0 my $self = shift ;
100 0 $self->{Inf}->compressedBytes();
101 }
102  
103 sub uncompressedBytes
104 0 ▶{
Subroutine uncompressedBytes: not called CC=1 SCAR=6.9
Pod undocumented
105 0 my $self = shift ;
106 0 $self->{Inf}->uncompressedBytes();
107 }
108  
109 sub adler32
110 490 ▶{
Subroutine adler32: called CC=1 SCAR=0.0
Pod undocumented
111 490 my $self = shift ;
112 490 $self->{Inf}->adler32();
113 }
114  
115 sub sync
116 1184 ▶{
Subroutine sync: called CC=2 SCAR=6.9
Pod undocumented
117 1184 my $self = shift ;
118 1184 ▶ ( $self->{Inf}->inflateSync(@_) == Z_OK)
Branch: 1 branch
BranchTrueFalseTotal
$self->{'Inf'}->inflateSync(@_) == Z_OK() ? : 4 1180 1184
119 ? STATUS_OK
120 : STATUS_ERROR ;
121 }
122  
123  
124 sub getLastBlockOffset
125 60 ▶{
Subroutine getLastBlockOffset: called CC=1 SCAR=0.0
Pod undocumented
126 60 my $self = shift ;
127 60 $self->{Inf}->getLastBlockOffset();
128 }
129  
130 sub getEndOffset
131 60 ▶{
Subroutine getEndOffset: called CC=1 SCAR=0.0
Pod undocumented
132 60 my $self = shift ;
133 60 $self->{Inf}->getEndOffset();
134 }
135  
136 sub resetLastBlockByte
137 60 ▶{
Subroutine resetLastBlockByte: called CC=1 SCAR=0.0
Pod undocumented
138 60 my $self = shift ;
139 60 $self->{Inf}->resetLastBlockByte(@_);
140 }
141  
142 sub createDeflateStream
143 60 ▶{
Subroutine createDeflateStream: called CC=1 SCAR=0.0
Pod undocumented
144 60 my $self = shift ;
145 60 my $deflate = $self->{Inf}->createDeflateStream(@_);
146 60 return bless {'Def' => $deflate,
147 'CompSize' => 0,
148 'UnCompSize' => 0,
149 'Error' => '',
150 }, 'IO::Compress::Adapter::Deflate';
151 }
152  
153 96 1;
154  
155  
156 __END__
« blib/lib/IO/Compress/RawDeflate.pm ↑ Summary blib/lib/IO/Compress/Bzip2.pm »