| 1 | package IO::Uncompress::Adapter::Identity; | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | 83 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 83 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | 83 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||
| 7 | 83 | ▶ | use IO::Compress::Base::Common 2.225 qw(:Status); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 8 | 83 | ▶ | use IO::Compress::Zip::Constants ; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||
| 10 | 83 | our ($VERSION); | |||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||
| 12 | 83 | $VERSION = '2.225'; | |||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||
| 14 | 83 | ▶ | use Compress::Raw::Zlib 2.225 (); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||
| 16 | sub mkUncompObject | ||||||||||||||||||||||||||||||||||||
| 17 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
mkUncompObject: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 18 | 77 | my $streaming = shift; | |||||||||||||||||||||||||||||||||||
| 19 | 77 | my $zip64 = shift; | |||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||
| 21 | 77 | my $crc32 = 1; #shift ; | |||||||||||||||||||||||||||||||||||
| 22 | 77 | my $adler32 = shift; | |||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||
| 24 | 77 | ▶ | bless { 'CompSize' => U64->new(), # 0, | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 25 | 'UnCompSize' => 0, | ||||||||||||||||||||||||||||||||||||
| 26 | 'wantCRC32' => $crc32, | ||||||||||||||||||||||||||||||||||||
| 27 | 'CRC32' => Compress::Raw::Zlib::crc32(''), | ||||||||||||||||||||||||||||||||||||
| 28 | 'wantADLER32'=> $adler32, | ||||||||||||||||||||||||||||||||||||
| 29 | 'ADLER32' => Compress::Raw::Zlib::adler32(''), | ||||||||||||||||||||||||||||||||||||
| 30 | 'ConsumesInput' => 1, | ||||||||||||||||||||||||||||||||||||
| 31 | 'Streaming' => $streaming, | ||||||||||||||||||||||||||||||||||||
| 32 | 'Zip64' => $zip64, | ||||||||||||||||||||||||||||||||||||
| 33 | 'DataHdrSize' => $zip64 ? 24 : 16, | ||||||||||||||||||||||||||||||||||||
| 34 | 'Pending' => '', | ||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||
| 36 | } ; | ||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||
| 40 | sub uncompr | ||||||||||||||||||||||||||||||||||||
| 41 | 72 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
uncompr: called CC=24 SCAR=42.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 42 | 72 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 43 | 72 | my $in = $_[0]; | |||||||||||||||||||||||||||||||||||
| 44 | 72 | my $eof = $_[2]; | |||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||
| 46 | 72 | my $len = length $$in; | |||||||||||||||||||||||||||||||||||
| 47 | 72 | my $remainder = ''; | |||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||
| 49 | 72 | ▶ | if (defined $$in && $len) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $$in and $len
MC/DC50%1/2
defined $$in and $len
defined $$in
$len
Truth table66%2/3
A and B
A= defined $$inB= $len
| |||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||
| 51 | 51 | ▶ | if ($self->{Streaming}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||
| 53 | 25 | ▶ | if (length $self->{Pending}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 54 | 0 | $$in = $self->{Pending} . $$in ; | |||||||||||||||||||||||||||||||||||
| 55 | 0 | $len = length $$in; | |||||||||||||||||||||||||||||||||||
| 56 | 0 | $self->{Pending} = ''; | |||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||
| 59 | 25 | my $ind = index($$in, "\x50\x4b\x07\x08"); | |||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||
| 61 | 25 | ▶ | if ($ind < 0) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 62 | 0 | $len = length $$in; | |||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | if ($len >= 3 && substr($$in, -3) eq "\x50\x4b\x07") { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$len >= 3 and substr($$in, -3) eq "PK\a"
MC/DC0%0/2
$len >= 3 and substr($$in, -3) eq "PK\a"
$len >= 3
substr($$in, -3) eq "PK\a"
Truth table0%0/3
A and B
A= $len >= 3B= substr($$in, -3) eq "PK\a"
| |||||||||||||||||||||||||||||||||||||
| 64 | 0 | $ind = $len - 3 ; | |||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||
| 66 | ▶ | elsif ($len >= 2 && substr($$in, -2) eq "\x50\x4b") { | |||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$len >= 2 and substr($$in, -2) eq "PK"
MC/DC0%0/2
$len >= 2 and substr($$in, -2) eq "PK"
$len >= 2
substr($$in, -2) eq "PK"
Truth table0%0/3
A and B
A= $len >= 2B= substr($$in, -2) eq "PK"
| |||||||||||||||||||||||||||||||||||||
| 67 | 0 | $ind = $len - 2 ; | |||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||
| 69 | ▶ | elsif ($len >= 1 && substr($$in, -1) eq "\x50") { | |||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$len >= 1 and substr($$in, -1) eq "P"
MC/DC0%0/2
$len >= 1 and substr($$in, -1) eq "P"
$len >= 1
substr($$in, -1) eq "P"
Truth table0%0/3
A and B
A= $len >= 1B= substr($$in, -1) eq "P"
| |||||||||||||||||||||||||||||||||||||
| 70 | 0 | $ind = $len - 1 ; | |||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||
| 74 | 25 | ▶ | if ($ind >= 0) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 75 | 25 | $remainder = substr($$in, $ind) ; | |||||||||||||||||||||||||||||||||||
| 76 | 25 | substr($$in, $ind) = '' ; | |||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||
| 80 | 51 | ▶ | if (length $remainder && length $remainder < $self->{DataHdrSize}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
length $remainder and length $remainder < $self->{"DataHdrSize"}
MC/DC0%0/2
length $remainder and length $remainder < $self->{"DataHdrSize"}
length $remainder
length $remainder < $self->{"DataHdrSize"}
Truth table66%2/3
A and B
A= length $remainderB= length $remainder < $self->{"DataHdrSize"}
| |||||||||||||||||||||||||||||||||||||
| 81 | 0 | $self->{Pending} = $remainder ; | |||||||||||||||||||||||||||||||||||
| 82 | 0 | $remainder = ''; | |||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||
| 84 | elsif (length $remainder >= $self->{DataHdrSize}) { | ||||||||||||||||||||||||||||||||||||
| 85 | 25 | my $crc = unpack "V", substr($remainder, 4); | |||||||||||||||||||||||||||||||||||
| 86 | 25 | ▶ | if ($crc == Compress::Raw::Zlib::crc32($$in, $self->{CRC32})) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 87 | 25 | my ($l1, $l2) ; | |||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||
| 89 | 25 | ▶ | if ($self->{Zip64}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 90 | 12 | $l1 = U64::newUnpack_V64(substr($remainder, 8)); | |||||||||||||||||||||||||||||||||||
| 91 | 12 | $l2 = U64::newUnpack_V64(substr($remainder, 16)); | |||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||
| 93 | else { | ||||||||||||||||||||||||||||||||||||
| 94 | 13 | $l1 = U64::newUnpack_V32(substr($remainder, 8)); | |||||||||||||||||||||||||||||||||||
| 95 | 13 | $l2 = U64::newUnpack_V32(substr($remainder, 12)); | |||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||
| 98 | 25 | my $newLen = $self->{CompSize}->clone(); | |||||||||||||||||||||||||||||||||||
| 99 | 25 | $newLen->add(length $$in); | |||||||||||||||||||||||||||||||||||
| 100 | 25 | ▶ | if ($l1->equal($l2) && $l1->equal($newLen) ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$l1->equal($l2) and $l1->equal($newLen)
MC/DC0%0/2
$l1->equal($l2) and $l1->equal($newLen)
$l1->equal($l2)
$l1->equal($newLen)
Truth table33%1/3
A and B
A= $l1->equal($l2)B= $l1->equal($newLen)
| |||||||||||||||||||||||||||||||||||||
| 101 | 25 | $eof = 1; | |||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||
| 103 | else { | ||||||||||||||||||||||||||||||||||||
| 104 | 0 | $$in .= substr($remainder, 0, 4) ; | |||||||||||||||||||||||||||||||||||
| 105 | 0 | $remainder = substr($remainder, 4); | |||||||||||||||||||||||||||||||||||
| 106 | #$self->{Pending} = substr($remainder, 4); | ||||||||||||||||||||||||||||||||||||
| 107 | #$remainder = ''; | ||||||||||||||||||||||||||||||||||||
| 108 | 0 | $eof = 0; | |||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||
| 111 | else { | ||||||||||||||||||||||||||||||||||||
| 112 | 0 | $$in .= substr($remainder, 0, 4) ; | |||||||||||||||||||||||||||||||||||
| 113 | 0 | $remainder = substr($remainder, 4); | |||||||||||||||||||||||||||||||||||
| 114 | #$self->{Pending} = substr($remainder, 4); | ||||||||||||||||||||||||||||||||||||
| 115 | #$remainder = ''; | ||||||||||||||||||||||||||||||||||||
| 116 | 0 | $eof = 0; | |||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||
| 120 | 51 | ▶ | if (length $$in) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 121 | 51 | $self->{CompSize}->add(length $$in) ; | |||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||
| 123 | $self->{CRC32} = Compress::Raw::Zlib::crc32($$in, $self->{CRC32}) | ||||||||||||||||||||||||||||||||||||
| 124 | 51 | ▶ | if $self->{wantCRC32}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||
| 126 | $self->{ADLER32} = Compress::Zlib::adler32($$in, $self->{ADLER32}) | ||||||||||||||||||||||||||||||||||||
| 127 | 51 | ▶ | if $self->{wantADLER32}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||
| 130 | 51 | ${ $_[1] } .= $$in; | |||||||||||||||||||||||||||||||||||
| 131 | 51 | $$in = $remainder; | |||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||
| 134 | 72 | ▶ | return STATUS_ENDSTREAM if $eof; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 135 | 26 | return STATUS_OK ; | |||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||
| 138 | sub reset | ||||||||||||||||||||||||||||||||||||
| 139 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 140 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||
| 142 | 13 | $self->{CompSize}->reset(); | |||||||||||||||||||||||||||||||||||
| 143 | 13 | $self->{UnCompSize} = 0; | |||||||||||||||||||||||||||||||||||
| 144 | 13 | $self->{CRC32} = Compress::Raw::Zlib::crc32(''); | |||||||||||||||||||||||||||||||||||
| 145 | 13 | $self->{ADLER32} = Compress::Raw::Zlib::adler32(''); | |||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||
| 147 | 13 | return STATUS_OK ; | |||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||
| 150 | #sub count | ||||||||||||||||||||||||||||||||||||
| 151 | #{ | ||||||||||||||||||||||||||||||||||||
| 152 | # my $self = shift ; | ||||||||||||||||||||||||||||||||||||
| 153 | # return $self->{UnCompSize} ; | ||||||||||||||||||||||||||||||||||||
| 154 | #} | ||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||
| 156 | sub compressedBytes | ||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
compressedBytes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $self = shift ; | |||||||||||||||||||||||||||||||||||
| 159 | 0 | return $self->{CompSize} ; | |||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||
| 162 | sub uncompressedBytes | ||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
uncompressedBytes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $self = shift ; | |||||||||||||||||||||||||||||||||||
| 165 | 0 | return $self->{CompSize} ; | |||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||
| 168 | sub sync | ||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
sync: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 170 | 0 | return STATUS_OK ; | |||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||
| 173 | sub crc32 | ||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
crc32: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $self = shift ; | |||||||||||||||||||||||||||||||||||
| 176 | 0 | return $self->{CRC32}; | |||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||
| 179 | sub adler32 | ||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||
|
Subroutine
adler32: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $self = shift ; | |||||||||||||||||||||||||||||||||||
| 182 | 0 | return $self->{ADLER32}; | |||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||
| 186 | 83 | 1; | |||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||
| 188 | __END__ | ||||||||||||||||||||||||||||||||||||