line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::API2::Basic::PDF::Filter::ASCII85Decode; |
2
|
|
|
|
|
|
|
|
3
|
43
|
|
|
43
|
|
69146
|
use base 'PDF::API2::Basic::PDF::Filter'; |
|
43
|
|
|
|
|
102
|
|
|
43
|
|
|
|
|
5171
|
|
4
|
|
|
|
|
|
|
|
5
|
43
|
|
|
43
|
|
295
|
use strict; |
|
43
|
|
|
|
|
93
|
|
|
43
|
|
|
|
|
847
|
|
6
|
43
|
|
|
43
|
|
239
|
use warnings; |
|
43
|
|
|
|
|
104
|
|
|
43
|
|
|
|
|
33381
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.044'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub outfilt { |
11
|
3
|
|
|
3
|
1
|
16
|
my ($self, $str, $isend) = @_; |
12
|
3
|
|
|
|
|
6
|
my ($res, $i, $j, $b, @c); |
13
|
|
|
|
|
|
|
|
14
|
3
|
50
|
33
|
|
|
15
|
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
|
|
|
|
|
69
|
$b = unpack("N", substr($str, $i, 4)); |
20
|
32
|
50
|
|
|
|
58
|
if ($b == 0) { |
21
|
0
|
|
|
|
|
0
|
$res .= "z"; |
22
|
0
|
|
|
|
|
0
|
next; |
23
|
|
|
|
|
|
|
} |
24
|
32
|
|
|
|
|
63
|
for ($j = 0; $j < 4; $j++) { |
25
|
128
|
|
|
|
|
219
|
$c[$j] = $b - int($b / 85) * 85 + 33; $b /= 85; |
|
128
|
|
|
|
|
225
|
|
26
|
|
|
|
|
|
|
} |
27
|
32
|
|
|
|
|
87
|
$res .= pack("C5", $b + 33, reverse @c); |
28
|
32
|
50
|
|
|
|
80
|
$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
|
|
|
|
|
8
|
$b = unpack("N", $str . ("\000" x (4 - length($str)))); |
33
|
1
|
|
|
|
|
5
|
for ($j = 0; $j < 4; $j++) { |
34
|
4
|
|
|
|
|
12
|
$c[$j] = $b - int($b / 85) * 85 + 33; $b /= 85; |
|
4
|
|
|
|
|
8
|
|
35
|
|
|
|
|
|
|
} |
36
|
1
|
|
|
|
|
3
|
push @c, $b + 33; |
37
|
1
|
|
|
|
|
6
|
$res .= substr(pack("C5", reverse @c), 0, length($str) + 1) . '~>'; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
elsif ($isend) { |
40
|
2
|
|
|
|
|
3
|
$res .= '~>'; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
elsif ($i + 4 > length($str)) { |
43
|
0
|
|
|
|
|
0
|
$self->{'outcache'} = substr($str, $i); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
3
|
|
|
|
|
13
|
return $res; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub infilt { |
50
|
2
|
|
|
2
|
1
|
5
|
my ($self, $str, $isend) = @_; |
51
|
2
|
|
|
|
|
6
|
my ($res, $i, $j, @c, $b, $num); |
52
|
2
|
|
|
|
|
4
|
$num = 0; |
53
|
2
|
50
|
33
|
|
|
9
|
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
|
|
|
|
|
9
|
for ($i = 0; $i < length($str); $i += 5) { |
59
|
23
|
100
|
66
|
|
|
72
|
last if $isend and substr($str, $i, 6) eq '~>'; |
60
|
22
|
|
|
|
|
45
|
$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
|
|
|
|
|
4
|
$num = 5 - length($1); |
68
|
1
|
|
|
|
|
5
|
@c = unpack("C5", $1 . ("u" x (4 - $num))); # pad with 84 to sort out rounding |
69
|
1
|
|
|
|
|
2
|
$i = length($str); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
21
|
|
|
|
|
50
|
@c = unpack("C5", substr($str, $i, 5)); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
22
|
|
|
|
|
49
|
for ($j = 0; $j < 5; $j++) { |
76
|
110
|
|
|
|
|
135
|
$b *= 85; |
77
|
110
|
|
|
|
|
193
|
$b += $c[$j] - 33; |
78
|
|
|
|
|
|
|
} |
79
|
22
|
|
|
|
|
59
|
$res .= substr(pack("N", $b), 0, 4 - $num); |
80
|
|
|
|
|
|
|
} |
81
|
2
|
50
|
33
|
|
|
8
|
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; |