Branch Coverage

lib/PDF/Data.pm
Criterion Covered Total %
branch 0 406 0.0


line true false branch
37 0 0 if ref $_[0]
38 0 0 if ref $_[0]
39 0 0 if &is_hash
87 0 0 unless ($x and $y and $x > 0 and $y > 0)
89 0 0 unless $sizes{$x}
94 0 0 unless $x and $y and $x > 0 and $y > 0
97 0 0 if $x < 72
98 0 0 if $y < 72
151 0 0 if (($file // '-') eq '-') { }
154 0 0 unless binmode STDIN
156 0 0 unless close STDIN
159 0 0 unless open my $IN, "<", $file
160 0 0 unless binmode $IN
162 0 0 unless close $IN
181 0 0 unless my($pdf_version, $startxref) = $data =~ /\A(?:%PDF-(\d+\.\d+)$n.*$n)startxref$n(\d+)$n%%EOF$n?\z/ds
184 0 0 unless $pdf_version =~ /^1\.[0-7]$/d
198 0 0 if ($objects[$i][0] eq "trailer")
200 0 0 unless $i < $#objects and $objects[$i + 1][1]{'type'} eq "dict"
207 0 0 unless defined $trailer
221 0 0 $self->{'-novalidate'} ? :
235 0 0 if (($file // '-') eq '-') { }
238 0 0 unless binmode STDOUT
239 0 0 unless print STDOUT $pdf_data
242 0 0 unless open my $OUT, ">", $file
243 0 0 unless binmode $OUT
244 0 0 unless print $OUT $pdf_data
245 0 0 unless close $OUT
248 0 0 if $time
263 0 0 if $time
314 0 0 unless open my $OUT, ">$file"
320 0 0 unless printf $OUT "\$pdf = %s;\n", $self->dump_object($self, "\$pdf", $seen, 0, $mode)
323 0 0 unless close $OUT
326 0 0 if ($mode eq 'outline') { }
327 0 0 unless $file eq "-"
329 0 0 unless $file eq "-"
346 0 0 unless &is_array($streams)
350 0 0 unless &is_stream($stream)
367 0 0 if &is_stream($content_stream)
381 0 0 if m[^(?:/Figure <>BDC|/PlacedGraphic /MC\d BDC|EMC|/GS\d gs|BX /Sh\d sh EX Q|[Qqh]|W n|$n $n $n $n $n $n cm)\s*$]d
384 0 0 if (my($x1, $y1, $x2, $y2, $x3, $y3) = /^($n) ($n) (?:[ml]|($n) ($n) (?:[vy]|($n) ($n) c))$/d) { }
0 0 elsif (my($x, $y, $width, $height) = /^($n) ($n) ($n) ($n) re$/d) { }
401 0 0 unless $new
439 0 0 wantarray ? :
464 0 0 if $det == 0
523 0 0 if ($@)
525 0 0 if ($self->{'-validate'}) { }
544 0 0 unless &is_array(my $kids = $page_tree_node->{'Kids'})
546 0 0 unless &is_hash(my $kid = $kids->[$i])
547 0 0 unless $kid->{'Type'}
548 0 0 if ($kid->{'Type'} eq '/Pages') { }
0 0 elsif ($kid->{'Type'} eq '/Page') { }
559 0 0 if &is_hash($page_tree_node->{'Resources'})
562 0 0 if (($page_tree_node->{'Count'} || 0) != $count)
575 0 0 if (my $contents = $page->{'Contents'})
576 0 0 if &is_array($contents)
577 0 0 unless &is_stream($contents)
582 0 0 if &is_hash($page->{'Resources'})
590 0 0 if &is_hash($resources->{'XObject'})
608 0 0 unless &is_stream($xobject)
611 0 0 unless $xobject->{'Subtype'} eq "/Form"
617 0 0 if &is_hash($xobject->{'Resources'})
626 0 0 if $@
629 0 0 if $self->{'-minify'}
648 0 0 if PDF::Data::dump([map({$_->[0];} @{$objects;})]) ne PDF::Data::dump([map({$_->[0];} $self->parse_objects({}, $stream->{'-data'}, 0))])
661 0 0 if ($object->[1]{'type'} eq 'dict') { }
0 0 elsif ($object->[1]{'type'} eq 'array') { }
685 0 0 if ($i % 2) { }
686 0 0 if (&is_hash($pairs[$i])) { }
0 0 elsif (&is_array($pairs[$i])) { }
707 0 0 if (&is_hash($obj)) { }
0 0 elsif (&is_array($obj)) { }
723 0 0 if ($self->{'-minify'})
729 0 0 if length((${$stream;} =~ /(.*)\z/d)[0]) + length($object) >= 255
732 0 0 unless ${$stream;} =~ /(^|[\s)>\[\]{}])$/d or $object =~ m(^[\s()<>\[\]{}/%])d
743 0 0 unless $hash
746 0 0 unless &is_hash($hash)
749 0 0 if (defined $value and !defined($hash->{$key}) || $hash->{$key} ne $value) { }
0 0 elsif (not defined $value and exists $hash->{$key}) { }
750 0 0 if $hash->{$key}
753 0 0 if $hash->{$key}
798 0 0 if (s/\A$ws//d) { }
0 0 elsif (s/\A(<<((?:[^<>]+|<[^<>]+>|(?1))*)$ws?>>)//d) { }
0 0 elsif (s/\A(\[((?:(?>[^\[\]]+)|(?1))*)\])//d) { }
0 0 elsif (s/\A(\((?:(?>[^\\()]+)|\\.|(?1))*\))//d) { }
0 0 elsif (s/\A(<[0-9A-Fa-f\s]*>)//d) { }
0 0 elsif (s(\A(/?[^\s()<>\[\]{}/%]+))[]d) { }
804 0 0 $i % 2 ? :
817 0 0 if ($token eq 'obj' or $token eq 'R') { }
0 0 elsif ($token eq 'stream') { }
0 0 elsif ($token eq 'endobj') { }
0 0 elsif ($token eq 'xref') { }
0 0 elsif ($token =~ /^[+-]?\d+$/d) { }
0 0 elsif ($token =~ /^[+-]?(?:\d+\.\d*|\.\d+)$/d) { }
0 0 elsif ($token =~ m[^/(.*)$]d) { }
0 0 elsif ($token =~ /^(?:true|false)$/d) { }
819 0 0 $token eq 'R' ? :
821 0 0 unless "$id->[1]{'type'} $gen->[1]{'type'}" eq "int int"
826 0 0 $token eq 'R' ? :
829 0 0 unless $stream->[1]{'type'} eq "dict"
830 0 0 unless $id->[1]{'type'} eq "obj"
833 0 0 unless defined(my $length = $stream->{'Length'})
837 0 0 unless (defined $length and substr($_, $length) =~ /\A(\s*endstream$ws)/d)
838 0 0 if (/\A((?>(?:[^e]+|(?!endstream\s)e)*))\s*endstream$ws/d) { }
852 0 0 if $stream->{'Filter'}
855 0 0 unless $id->[1]{'type'} eq "obj"
862 0 0 unless s/\A$ws\d+$ws\d+$n(?>\d{10}\ \d{5}\ [fn](?:\ [\r\n]|\r\n))+//d
899 0 0 wantarray ? :
907 0 0 &is_array($stream->{'Filter'}) ? :
0 0 $stream->{'Filter'} ? :
910 0 0 if ($filters[0] eq "/FlateDecode")
918 0 0 if ($status == Z_OK() or $status == Z_STREAM_END()) { }
929 0 0 if (@filters > 1) { }
0 0 elsif (@filters) { }
944 0 0 &is_array($stream->{'Filter'}) ? :
0 0 $stream->{'Filter'} ? :
950 0 0 unless $zlib->deflate($stream->{'-data'}, $new_stream->{'-data'}) == Z_OK()
951 0 0 unless $zlib->flush($new_stream->{'-data'}, Z_FINISH()) == Z_OK()
953 0 0 @filters ? :
962 0 0 if (ref $object and &reftype($object) eq "SCALAR")
964 0 0 if ($objects->{$id}) { }
966 0 0 if $metadata->{'resolved'}++
975 0 0 if (&is_hash($object)) { }
0 0 elsif (&is_array($object)) { }
977 0 0 unless fc $a cmp fc $b
978 0 0 if ref $object->{$key}
982 0 0 if (&is_stream($object))
983 0 0 if $object->{'Length'} and length $object->{'-data'} > $object->{'Length'}
987 0 0 unless $len == $object->{'Length'}
992 0 0 if ref $object->[$i]
1043 0 0 $self->{'Root'} ? :
0 0 $self->{'Info'} ? :
0 0 $self->{'Root'}{'Dests'} ? :
0 0 $self->{'Root'}{'Metadata'} ? :
0 0 $self->{'Root'}{'Outlines'} ? :
0 0 $self->{'Root'}{'Pages'} ? :
0 0 $self->{'Root'}{'Threads'} ? :
0 0 $self->{'Root'}{'StructTreeRoot'} ? :
1047 0 0 if $self->{'Root'}{'OCProperties'}
1058 0 0 if (&is_hash($object))
1071 0 0 unless fc $a cmp fc $b
1072 0 0 if (($object->{'Type'} // '') eq '/ExtGState' and $key eq 'Font' and &is_array($object->{'Font'}) and &is_hash($object->{'Font'}[0])) { }
0 0 elsif ($key =~ /^(?:Data|First|ID|Last|Next|Obj|Parent|ParentTree|Popup|Prev|Root|StmOwn|Threads|Widths)$/d or $key =~ /^(?:AN|Annotation|B|C|CI|DocMDP|F|FontDescriptor|I|IX|K|Lock|N|P|Pg|RI|SE|SV|V)$/d and ref $object->{$key} and &is_hash($object->{$key}) or &is_hash($object->{$key}) and $object->{$key}{'-data'} || $object->{$key}{'Kids'} || ($object->{$key}{'Type'} // '') =~ m[^/(?:Filespec|Font)$]d or ($object->{'S'} // '') eq '/Thread' and $key eq 'D' or ($object->{'S'} // '') eq '/Hide' and $key eq 'T') { }
0 0 elsif ($key =~ /^(?:Annots|B|C|CO|Fields|K|Kids|O|Pages|TrapRegions)$/d and &is_array($object->{$key})) { }
0 0 elsif (&is_hash($object->{$key})) { }
1090 0 0 if @objects
1100 0 0 if ($seen->{$object}++)
1101 0 0 unless $objects->[0]{$object}
1106 0 0 if $ancestors->{$object}
1112 0 0 if (&is_hash($object)) { }
0 0 elsif (&is_array($object)) { }
1113 0 0 unless fc $a cmp fc $b
1114 0 0 if ref $object->{$key}
1118 0 0 if ref $obj
1133 0 0 if (defined $object and not $objects->[0]{$object})
1148 0 0 if (ref $object and $seen->{$object}++)
1153 0 0 if (&is_hash($object)) { }
0 0 elsif (&is_array($object) and not grep({ref $_;} @{$object;})) { }
0 0 elsif (&is_array($object)) { }
0 0 elsif (&reftype($object) eq 'SCALAR') { }
1155 0 0 if (&is_stream($object))
1156 0 0 if ($self->{'-compress'} || $object->{'-compress'} and not $self->{'-decompress'} || $object->{'-decompress'}) { }
1165 0 0 unless fc $a cmp fc $b
1166 0 0 if $key =~ /^-/d
1168 0 0 if &is_stream($obj)
1170 0 0 if (not ref $obj) { }
0 0 elsif ($objects->[0]{$obj}) { }
1175 0 0 ref $object ? :
1181 0 0 if (&is_stream($object))
1182 0 0 if $indent
1183 0 0 substr($object->{'-data'}, -1) eq "\n" ? :
1189 0 0 if ($self->{'-minify'}) { }
1199 0 0 if &is_stream($obj)
1200 0 0 unless $self->{'-minify'}
1201 0 0 if (not ref $obj) { }
0 0 elsif ($objects->[0]{$obj}) { }
1212 0 0 if $spaces eq " " and not $self->{'-minify'}
1233 0 0 if ($mode eq 'outline') { }
0 0 elsif (ref $object and $seen->{$object}) { }
0 0 elsif (&is_hash($object)) { }
0 0 elsif (&is_array($object) and not grep({ref $_;} @{$object;})) { }
0 0 elsif (&is_array($object)) { }
0 0 elsif (&reftype($object) eq 'SCALAR') { }
1234 0 0 if (ref $object and $seen->{$object}) { }
0 0 elsif (&is_hash($object)) { }
0 0 elsif (&is_array($object) and not grep({ref $_;} @{$object;})) { }
0 0 elsif (&is_array($object)) { }
0 0 elsif (&reftype($object) eq 'SCALAR') { }
1240 0 0 if (&is_stream($object)) { }
1244 0 0 unless fc $a cmp fc $b
1248 0 0 unless ref $obj
1250 0 0 ref $object ? :
1252 0 0 if ($output) { }
1265 0 0 if ref $object->[$i]
1267 0 0 if ($output =~ /\A\s+(.*?),\n\z/d) { }
0 0 elsif ($output =~ /\n/d) { }
1288 0 0 unless fc $a cmp fc $b
1293 0 0 if ($key eq '-data') { }
0 0 elsif (not ref $obj) { }
1295 0 0 $obj =~ /\A(?:<\?xpacket|[\n\t -~]*\z)/d ? :
1299 0 0 ref $object ? :
1306 0 0 /^\d+\.\d+$/d ? :
1313 0 0 if (ref $obj) { }
1321 0 0 if $spaces eq " "