Branch Coverage

blib/lib/Image/ExifTool/PNG.pm
Criterion Covered Total %
branch 179 412 43.4


line true false branch
800 17 11 if $lang =~ /^([a-z]{2,3}|[xi])(-[a-z]{2})\b(.*)/i
838 0 0 $yr > 70 ? :
0 0 if $yr < 100
839 0 0 unless $mon = $monthNum{ucfirst lc $mon}
840 0 0 if (not $tz) { }
0 0 elsif ($tzConv{uc $tz}) { }
0 0 elsif ($tz =~ /^([-+]\d+):?(\d{2})/) { }
851 0 0 if ($et->Options("StrictDate") and not $et->{'TAGS_FROM_FILE'} or $et->Options("Validate"))
864 0 0 if ($et->Options("StrictDate"))
866 0 0 if ($val =~ /^(\d{4}):(\d{2}):(\d{2}) (\d{2})(:\d{2})(:\d{2})?(?:\.\d*)?\s*(\S*)/)
868 0 0 unless $sec
870 0 0 unless $mon = $monName{$mon + 0}
871 0 0 if (length $tz)
872 0 0 unless $tz =~ /^(Z|[-+]\d{2}:?\d{2})/
876 0 0 unless $err
878 0 0 if ($err)
895 0 27 if $tagInfo->{'SubDirectory'}
911 0 100 unless defined $val
914 1 99 if ($lang)
923 0 100 if (not $tagInfo and $lang)
926 0 0 if $tagInfo
932 2 98 if ($compressed and $compressed > 1)
933 2 0 if ($compressed == 2) { }
934 2 0 if (eval { do { require Compress::Zlib } }) { }
0 0 elsif (not $noCompressLib) { }
937 2 0 if $inflate
938 2 0 if ($inflate and $stat == Compress::Zlib::Z_STREAM_END()) { }
954 0 0 if ($compressed and $verbose and $tagInfo and $tagInfo->{'SubDirectory'})
958 0 2 if ($deflateErr and not $outBuff)
960 0 0 if $deflateErr =~ /^Install/
964 22 12 if ($enc and not $compressed and not $tagInfo && $tagInfo->{'SubDirectory'})
970 100 0 if ($tagInfo) { }
0 0 elsif ($outBuff) { }
973 64 36 if ($tagInfo->{'SubDirectory'})
974 0 0 if ($et->{'OPTIONS'}{'Validate'} and $tagInfo->{'NonStandard'})
979 64 0 if (not $compressed) { }
0 0 elsif ($outBuff) { }
981 0 64 if ($verbose and $et->{'INDENT'} ne " ")
982 0 0 if ($wasCompressed and $verbose > 2)
984 0 0 if $wasCompressed
994 5 59 if ($outBuff and not $subTable->{'WRITE_PROC'})
995 0 5 if ($et->{'DEL_GROUP'}{$dirName})
1015 1 1 if $wasCompressed and $processProc and $processProc eq \&Image::ExifTool::PNG::ProcessPNG_Compressed
1017 5 54 if ($outBuff and not $processProc and $subTable ne \%Image::ExifTool::PNG::TextualData) { }
1018 2 3 unless $et->{'EDIT_DIRS'}{$dirName}
1020 3 0 if ($tagName eq "XMP" and $$outBuff)
1030 0 0 if ($et->{'DEL_GROUP'}{$dirName} or $dirName eq 'EXIF' and $et->{'DEL_GROUP'}{'IFD0'}) { }
1035 0 0 if ($et->{'EDIT_DIRS'}{$dirName} or $dirName eq "EXIF" and $et->{'EDIT_DIRS'}{'IFD0'})
1043 23 70 if ($outBuff)
1046 5 3 if ($writable or $tagTablePtr->{'WRITABLE'} and not defined $writable and not $tagInfo->{'SubDirectory'})
1051 1 4 if ($et->{'DEL_GROUP'}{'PNG'}) { }
1061 0 4 if (defined $deflateErr) { }
1064 0 0 if ($isOverwriting > 0) { }
0 0 elsif ($isOverwriting) { }
1068 0 0 if $deflateErr
1071 0 4 if ($isOverwriting < 0)
1078 2 3 if ($isOverwriting)
1079 0 2 defined $newVal ? :
1082 0 2 if defined $newVal
1085 6 17 if (defined $$outBuff and length $$outBuff)
1086 3 3 if ($enc) { }
0 3 elsif ($wasCompressed) { }
1092 0 0 if ($deflate) { }
1094 0 0 if defined $$outBuff
1098 0 0 if (not $$outBuff) { }
0 0 elsif (lc $tag eq 'zxif') { }
1107 44 26 if $processed
1109 0 0 if ($et->{'DEL_GROUP'}{'PNG'} and $tagTablePtr eq \%Image::ExifTool::PNG::TextualData)
1120 0 0 if $lang
1122 0 0 if $tag =~ /^Raw profile type /
1123 0 0 if $verbose
1129 0 26 if ($verbose)
1138 0 0 if $subdir
1142 0 26 if ($compressed and not defined $tagInfo->{'ValueConv'})
1147 0 26 if $delRawConv
1166 0 1 unless $$dataPt =~ /^\n(.*?)\n\s*(\d+)\n(.*)/s
1171 0 1 if ($len ne $actualLen)
1176 0 1 if ($verbose)
1177 0 0 if ($verbose > 2)
1199 1 0 if ($tagTablePtr ne $exifTable) { }
0 0 elsif ($buff =~ /^$Image::ExifTool::exifAPP1hdr/) { }
0 0 elsif ($buff =~ /^$Image::ExifTool::xmpAPP1hdr/) { }
0 0 elsif ($buff =~ /^(MM\0\x2a|II\x2a\0)/) { }
1202 0 1 if ($tagName eq "IPTC_Profile" and $buff =~ /^\x1c/)
1206 0 1 if ($outBuff) { }
1209 0 0 unless $dir =~ /^ICC/
1210 0 0 unless $editDirs->{$dir}
1218 0 0 if $outBuff and not $editDirs->{'IFD0'}
1222 0 0 if ($outBuff) { }
1224 0 0 if ($et->{'DEL_GROUP'}{'EXIF'} or $et->{'DEL_GROUP'}{'IFD0'})
1231 0 0 if $$outBuff
1242 0 0 if ($outBuff) { }
1243 0 0 unless $editDirs->{'XMP'}
1245 0 0 if $$outBuff
1252 0 0 if $outBuff and not $editDirs->{'IFD0'}
1253 0 0 if ($outBuff) { }
1255 0 0 if ($et->{'DEL_GROUP'}{'EXIF'} or $et->{'DEL_GROUP'}{'IFD0'})
1271 0 0 if ($outBuff and defined $$outBuff and length $$outBuff)
1272 0 0 if ($et->{'CHANGED'} != $oldChanged) { }
1292 0 2 unless defined $val
1301 1 1 if ($tagInfo and $tagInfo->{'Name'} eq 'ICC_Profile') { }
1304 1 0 if length $tag and not $outBuff
1306 0 1 if ($outBuff and $$outBuff)
1308 0 0 if (defined $profileName)
1330 1 20 if $et->{'OPTIONS'}{'Verbose'}
1343 0 12 unless defined $dat and length $dat >= 4
1347 0 12 if $compressed
1349 1 11 if $et->{'OPTIONS'}{'Verbose'}
1368 0 2 if ($$dataPt =~ /^Exif\0\0/)
1372 0 0 if $dirInfo->{'DirLen'}
1374 2 0 if ($$dataPt =~ /^(\0|II|MM)/) { }
0 0 elsif ($del) { }
1385 0 2 if ($type eq "\000") { }
2 0 elsif (not $outBuff) { }
0 0 elsif ($del and lc $tag eq 'zxif') { }
0 0 elsif ($et->{'EDIT_DIRS'}{'IFD0'}) { }
1424 0 12 unless $raf->Read($sig, 8) == 8 and $pngLookup{$sig}
1426 5 7 if ($outfile) { }
1428 5 0 if $outfile
1437 0 7 if $fastScan
1444 0 12 if ($fileType ne "PNG")
1452 5 7 if ($outfile)
1455 0 30 if $len > 2147483647
1456 15 15 if ($wasDat) { }
5 10 elsif ($isDatChunk{$chunk}) { }
1457 5 10 if $noLeapFrog{$chunk}
1458 10 0 if $isTxtChunk{$chunk}
1462 0 25 unless $raf->Seek($len + 4, 1)
1464 0 5 unless $raf->Seek(8, 0)
1471 15 95 if ($doTxt)
1473 0 15 unless $raf->Seek(shift @txtOffset, 0)
1475 5 10 unless @txtOffset
1479 7 103 if ($wasEnd) { }
0 103 elsif ($n != 8) { }
1480 7 0 unless $n
1483 0 0 if $n < 8
1486 0 0 unless $wasEnd
1490 0 103 if ($len > 2147483647)
1491 0 0 unless $wasEnd
1494 9 94 if ($verbose)
1495 2 7 if $doTxt
1497 1 8 if ($datCount and $chunk ne $datChunk)
1498 0 1 $datCount > 1 ? :
1500 0 1 if $hash
1504 12 91 unless ($wasHdr)
1505 12 0 if ($chunk eq $hdrChunk) { }
0 0 elsif ($hdrChunk eq 'IHDR' and $chunk eq 'CgBI') { }
1513 5 40 if ($outfile and $isDatChunk{$chunk} || $chunk eq $endChunk and @txtOffset)
1519 12 86 if ($isDatChunk{$chunk}) { }
1520 0 12 if ($fastScan and $fastScan >= 2)
1531 40 58 if ($outfile)
1533 10 30 if ($datChunk or $chunk eq $endChunk) { }
0 30 elsif ($chunk eq 'PLTE') { }
1538 0 10 unless &AddChunks($et, $outfile)
1539 0 10 unless &AddChunks($et, $outfile, "IFD0")
1546 12 86 if ($chunk eq $endChunk)
1548 0 12 unless ($raf->Read($cbuf, 4) == 4)
1549 0 0 unless $wasEnd
1552 1 11 if $verbose
1554 5 7 if ($outfile)
1556 0 5 unless &Write($outfile, $hbuf, $cbuf)
1557 0 5 if ($et->{'DEL_GROUP'}{'Trailer'}) { }
1558 0 0 if ($raf->Read($hbuf, 1))
1559 0 0 if $verbose
1566 5 0 unless $n = $raf->Read($hbuf, 65536)
1568 0 0 unless &Write($outfile, $hbuf)
1570 0 5 if $tot and $verbose
1576 12 74 if ($datChunk) { }
15 59 elsif ($wasDat and $isTxtChunk{$chunk}) { }
1578 5 7 if ($outfile) { }
7 0 elsif (not $validate or $len > $chunkSizeLimit) { }
1580 0 5 if ($len > $chunkSizeLimit)
1581 0 0 unless &Write($outfile, $hbuf)
1582 0 0 unless &Image::ExifTool::CopyBlock($raf, $outfile, $len + 4)
1587 0 7 if ($hash) { }
1589 0 0 unless $raf->Read($cbuf, 4) == 4
1591 0 7 unless $raf->Seek($len + 4, 1)
1597 5 10 if (not $outfile) { }
0 10 elsif (defined $doTxt) { }
1607 0 79 unless ($raf->Read($dbuf, $len) == $len and $raf->Read($cbuf, 4) == 4)
1608 0 0 unless $wasEnd
1611 0 79 if $hash and $datChunk
1612 28 44 if ($verbose or $validate or $outfile and not $fastScan)
1616 0 35 unless ($crc == unpack("N", $cbuf))
1618 0 0 $outfile ? :
1620 5 30 if ($datChunk)
1621 5 0 if $outfile
1625 10 20 if ($outfile and $wasDat)
1626 10 0 if ($isTxtChunk{$chunk} and not defined $doTxt)
1627 0 10 if $et->{'FORCE_WRITE'}{'PNG'}
1628 2 8 if $verbose
1632 0 0 if $noLeapFrog{$chunk}
1634 4 16 if ($verbose)
1636 0 4 if $verbose > 2
1640 0 64 if (not $tagTablePtr->{$chunk} and $Image::ExifTool::PNG::stdCase{lc $chunk})
1642 0 0 if ($outfile and $et->{'EDIT_DIRS'}{'IFD0'} || !($stdChunk =~ /^[ez]xif$/i)) { }
1652 20 44 if $outfile
1653 64 0 if ($tagTablePtr->{$chunk}) { }
0 0 elsif ($mngTablePtr and $mngTablePtr->{$chunk}) { }
1658 20 44 if ($outfile)
1659 5 15 if (defined $theBuff)
1660 2 3 unless length $theBuff
1662 3 0 if ($et->{'TextChunkType'})
1672 0 18 unless &Write($outfile, $hbuf, $dbuf, $cbuf)
1677 0 0 if ($wasTrailer and not $outfile and $raf->Seek(-8, 2) and $raf->Read($dbuf, 8) and $dbuf =~ /\0\0(QDIOBS|SEFT)$/)
1683 0 5 if $outfile and $err || !$wasEnd