| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PDF::API2::Basic::PDF::Filter::ASCII85Decode; |
|
2
|
|
|
|
|
|
|
|
|
3
|
44
|
|
|
44
|
|
70416
|
use base 'PDF::API2::Basic::PDF::Filter'; |
|
|
44
|
|
|
|
|
96
|
|
|
|
44
|
|
|
|
|
5195
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
44
|
|
|
44
|
|
278
|
use strict; |
|
|
44
|
|
|
|
|
85
|
|
|
|
44
|
|
|
|
|
869
|
|
|
6
|
44
|
|
|
44
|
|
261
|
use warnings; |
|
|
44
|
|
|
|
|
125
|
|
|
|
44
|
|
|
|
|
32222
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.045'; # VERSION |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub outfilt { |
|
11
|
3
|
|
|
3
|
1
|
16
|
my ($self, $str, $isend) = @_; |
|
12
|
3
|
|
|
|
|
7
|
my ($res, $i, $j, $b, @c); |
|
13
|
|
|
|
|
|
|
|
|
14
|
3
|
50
|
33
|
|
|
13
|
if (exists $self->{'outcache'} and $self->{'outcache'} ne "") { |
|
15
|
0
|
|
|
|
|
0
|
$str = $self->{'outcache'} . $str; |
|
16
|
0
|
|
|
|
|
0
|
$self->{'outcache'} = ""; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
3
|
|
|
|
|
12
|
for ($i = 0; $i + 4 <= length($str); $i += 4) { |
|
19
|
32
|
|
|
|
|
70
|
$b = unpack("N", substr($str, $i, 4)); |
|
20
|
32
|
50
|
|
|
|
61
|
if ($b == 0) { |
|
21
|
0
|
|
|
|
|
0
|
$res .= "z"; |
|
22
|
0
|
|
|
|
|
0
|
next; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
32
|
|
|
|
|
55
|
for ($j = 0; $j < 4; $j++) { |
|
25
|
128
|
|
|
|
|
230
|
$c[$j] = $b - int($b / 85) * 85 + 33; $b /= 85; |
|
|
128
|
|
|
|
|
268
|
|
|
26
|
|
|
|
|
|
|
} |
|
27
|
32
|
|
|
|
|
79
|
$res .= pack("C5", $b + 33, reverse @c); |
|
28
|
32
|
50
|
|
|
|
79
|
$res .= "\n" if ($i % 60 == 56); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
3
|
100
|
66
|
|
|
20
|
if ($isend && $i < length($str)) { |
|
|
|
50
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
4
|
$str = substr($str, $i); |
|
32
|
1
|
|
|
|
|
6
|
$b = unpack("N", $str . ("\000" x (4 - length($str)))); |
|
33
|
1
|
|
|
|
|
5
|
for ($j = 0; $j < 4; $j++) { |
|
34
|
4
|
|
|
|
|
9
|
$c[$j] = $b - int($b / 85) * 85 + 33; $b /= 85; |
|
|
4
|
|
|
|
|
9
|
|
|
35
|
|
|
|
|
|
|
} |
|
36
|
1
|
|
|
|
|
4
|
push @c, $b + 33; |
|
37
|
1
|
|
|
|
|
11
|
$res .= substr(pack("C5", reverse @c), 0, length($str) + 1) . '~>'; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
elsif ($isend) { |
|
40
|
2
|
|
|
|
|
4
|
$res .= '~>'; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
elsif ($i + 4 > length($str)) { |
|
43
|
0
|
|
|
|
|
0
|
$self->{'outcache'} = substr($str, $i); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
3
|
|
|
|
|
16
|
return $res; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub infilt { |
|
50
|
2
|
|
|
2
|
1
|
6
|
my ($self, $str, $isend) = @_; |
|
51
|
2
|
|
|
|
|
4
|
my ($res, $i, $j, @c, $b, $num); |
|
52
|
2
|
|
|
|
|
5
|
$num = 0; |
|
53
|
2
|
50
|
33
|
|
|
8
|
if (exists($self->{'incache'}) && $self->{'incache'} ne "") { |
|
54
|
0
|
|
|
|
|
0
|
$str = $self->{'incache'} . $str; |
|
55
|
0
|
|
|
|
|
0
|
$self->{'incache'} = ""; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
2
|
|
|
|
|
10
|
$str =~ s/(\r|\n)\n?//og; |
|
58
|
2
|
|
|
|
|
6
|
for ($i = 0; $i < length($str); $i += 5) { |
|
59
|
23
|
100
|
66
|
|
|
68
|
last if $isend and substr($str, $i, 6) eq '~>'; |
|
60
|
22
|
|
|
|
|
36
|
$b = 0; |
|
61
|
22
|
50
|
66
|
|
|
81
|
if (substr($str, $i, 1) eq "z") { |
|
|
|
100
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
$i -= 4; |
|
63
|
0
|
|
|
|
|
0
|
$res .= pack("N", 0); |
|
64
|
0
|
|
|
|
|
0
|
next; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
elsif ($isend && substr($str, $i, 6) =~ m/^(.{2,4})\~\>$/o) { |
|
67
|
1
|
|
|
|
|
3
|
$num = 5 - length($1); |
|
68
|
1
|
|
|
|
|
6
|
@c = unpack("C5", $1 . ("u" x (4 - $num))); # pad with 84 to sort out rounding |
|
69
|
1
|
|
|
|
|
3
|
$i = length($str); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
else { |
|
72
|
21
|
|
|
|
|
50
|
@c = unpack("C5", substr($str, $i, 5)); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
22
|
|
|
|
|
46
|
for ($j = 0; $j < 5; $j++) { |
|
76
|
110
|
|
|
|
|
126
|
$b *= 85; |
|
77
|
110
|
|
|
|
|
210
|
$b += $c[$j] - 33; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
22
|
|
|
|
|
65
|
$res .= substr(pack("N", $b), 0, 4 - $num); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
2
|
50
|
33
|
|
|
6
|
if (!$isend && $i > length($str)) { |
|
82
|
0
|
|
|
|
|
0
|
$self->{'incache'} = substr($str, $i - 5); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
2
|
|
|
|
|
10
|
return $res; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |