- Reduce "use of uninitialized value" warnings.
- Remove pseudo-hash usage [1].
Obtained from: b109933fb0
[1]
This commit is contained in:
parent
b19ab5ae01
commit
d332d16c63
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=247376
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= PDFJ
|
||||
PORTVERSION= 0.90
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= japanese perl5
|
||||
MASTER_SITES= http://hp1.jonex.ne.jp/%7Enakajima.yasushi/archives/
|
||||
|
||||
|
49
japanese/p5-PDFJ/files/patch-Matrix.pm
Normal file
49
japanese/p5-PDFJ/files/patch-Matrix.pm
Normal file
@ -0,0 +1,49 @@
|
||||
--- PDFJ/Matrix.pm.orig 2010-01-08 14:10:39.047483295 +0900
|
||||
+++ PDFJ/Matrix.pm 2010-01-08 14:10:56.023648977 +0900
|
||||
@@ -51,7 +51,7 @@
|
||||
$self->{postnobreak} = [];
|
||||
my $matrix = $self->{objects};
|
||||
my $trimed;
|
||||
- my $maxrows;
|
||||
+ my $maxrows = 0;
|
||||
for( my $j = 0; $j < @$matrix; $j++ ) {
|
||||
my $row = $matrix->[$j];
|
||||
my $trow = [];
|
||||
@@ -110,7 +110,7 @@
|
||||
if( @$widths > 1 ) {
|
||||
my $skip = $self->{direction} =~ /V$/ ?
|
||||
$self->{style}{colskip} : $self->{style}{rowskip};
|
||||
- $self->{width} += $skip * (@$widths - 1)
|
||||
+ $self->{width} += ($skip || 0) * (@$widths - 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
if( @$heights > 1 ) {
|
||||
my $skip = $self->{direction} =~ /^V/ ?
|
||||
$self->{style}{colskip} : $self->{style}{rowskip};
|
||||
- $self->{height} += $skip * (@$heights - 1)
|
||||
+ $self->{height} += ($skip || 0) * (@$heights - 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
$self->_heights2height;
|
||||
}
|
||||
if( $adjust ) {
|
||||
- my $skip = $self->{style}{colskip};
|
||||
+ my $skip = $self->{style}{colskip} || 0;
|
||||
for( my $j = 0; $j < @$matrix; $j++ ) {
|
||||
my $row = $matrix->[$j];
|
||||
for( my $k = 0; $k < @$row; $k++ ) {
|
||||
@@ -315,8 +315,8 @@
|
||||
sub _show {
|
||||
my($self, $page, $x, $y) = @_;
|
||||
my $direction = $self->{direction};
|
||||
- my $colskip = $self->{style}{colskip};
|
||||
- my $rowskip = $self->{style}{rowskip};
|
||||
+ my $colskip = $self->{style}{colskip} || 0;
|
||||
+ my $rowskip = $self->{style}{rowskip} || 0;
|
||||
$self->_showbox($page, $x, $y);
|
||||
$x += $self->padding + $self->{xpreshift};
|
||||
$y -= $self->padding + $self->{ypreshift};
|
@ -1,6 +1,31 @@
|
||||
--- PDFJ.pm.orig Sun Oct 22 19:27:42 2006
|
||||
+++ PDFJ.pm Fri Mar 30 15:15:27 2007
|
||||
@@ -1093,7 +1093,7 @@
|
||||
--- PDFJ.pm.orig 2006-10-22 19:27:42.000000000 +0900
|
||||
+++ PDFJ.pm 2010-01-08 14:10:29.259440247 +0900
|
||||
@@ -21,6 +21,24 @@
|
||||
bytes->import unless $@;
|
||||
}
|
||||
|
||||
+# use hash in place of phash for Perl 5.9 or later
|
||||
+BEGIN {
|
||||
+ my $body;
|
||||
+ unless ($] > 5.008) {
|
||||
+ $body = sub { [ @_ ] };
|
||||
+ } else {
|
||||
+ $body = sub {
|
||||
+ my($pos) = @_;
|
||||
+ my $hash;
|
||||
+ foreach my $k (keys(%$pos)) {
|
||||
+ $hash->{$k} = $_[$pos->{$k}];
|
||||
+ }
|
||||
+ return $hash;
|
||||
+ };
|
||||
+ }
|
||||
+ eval { sub _hash { $body->(@_) } };
|
||||
+}
|
||||
+
|
||||
@EXFUNC = qw(
|
||||
PDFJ::Doc::Doc
|
||||
PDFJ::TextStyle::TStyle PDFJ::Text::Text
|
||||
@@ -1093,7 +1111,7 @@
|
||||
return;
|
||||
}
|
||||
push @filters, @addfilters if @addfilters;
|
||||
@ -9,7 +34,7 @@
|
||||
PDFJ::Object::name($filters[0]);
|
||||
($encoded, $filter);
|
||||
}
|
||||
@@ -1537,7 +1537,7 @@
|
||||
@@ -1537,7 +1555,7 @@
|
||||
unless( $self->{outlinetree} ) {
|
||||
$self->{outlinetree} = [];
|
||||
}
|
||||
@ -18,7 +43,44 @@
|
||||
for( my $j = 0; $j < $level; $j++ ) {
|
||||
push @$parent, ['', undef, undef, undef, []] unless @$parent;
|
||||
$parent = $$parent[$#$parent][4];
|
||||
@@ -4036,6 +4036,7 @@
|
||||
@@ -2720,7 +2738,7 @@
|
||||
my $render = $self->{render} || 0;
|
||||
my @shapepdf = $self->{shapestyle} ? $self->{shapestyle}->pdf : ();
|
||||
my $contentmark = $self->{contentmark};
|
||||
- my @pdf = $contentmark ne '' ? ("/$contentmark BMC q") : ("q");
|
||||
+ my @pdf = ($contentmark || "") ne '' ? ("/$contentmark BMC q") : ("q");
|
||||
push @pdf, @shapepdf if @shapepdf;
|
||||
push @pdf, "BT /$fontname", number($fontsize), "Tf", number($rise), "Ts $render Tr";
|
||||
@pdf;
|
||||
@@ -2728,7 +2746,7 @@
|
||||
|
||||
sub endpdf {
|
||||
my($self) = @_;
|
||||
- $self->{contentmark} ne '' ? "] TJ ET Q EMC " : "] TJ ET Q ";
|
||||
+ ($self->{contentmark} || "") ne '' ? "] TJ ET Q EMC " : "] TJ ET Q ";
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
@@ -2874,6 +2892,7 @@
|
||||
my($self, $indent) = @_;
|
||||
my $style = $self->style;
|
||||
return unless $style->{font};
|
||||
+ $indent = '' if (not defined $indent);
|
||||
for my $text(@{$self->texts}) {
|
||||
if( PDFJ::Util::objisa($text, 'PDFJ::Text') ) {
|
||||
$text->style->merge($style);
|
||||
@@ -3201,8 +3220,8 @@
|
||||
$preskip = $lineskip;
|
||||
}
|
||||
push @lines,
|
||||
- [\%TextLineIndex, $start, $count, $shift, $fixedglues, $preaols,
|
||||
- $postaols, $preskip];
|
||||
+ PDFJ::_hash(\%TextLineIndex, $start, $count, $shift, $fixedglues,
|
||||
+ $preaols, $postaols, $preskip);
|
||||
$start = $nextpos;
|
||||
}
|
||||
@lines;
|
||||
@@ -4036,6 +4055,7 @@
|
||||
$font->{subset_unicodes}{$unicode} = 1 if $unicode;
|
||||
}
|
||||
if( @$chunks ) {
|
||||
@ -26,7 +88,7 @@
|
||||
my $lastchunk = $chunks->[$#$chunks];
|
||||
my $lastmode = $lastchunk->{Mode};
|
||||
my $lastclass = $lastchunk->{Class};
|
||||
@@ -4132,7 +4133,7 @@
|
||||
@@ -4132,7 +4152,7 @@
|
||||
my($self, $str, $noshift) = @_;
|
||||
my $style = $self->style;
|
||||
my $result = [];
|
||||
@ -35,3 +97,82 @@
|
||||
for( my $j = 0; $j <= $#c; $j++ ) {
|
||||
my $c = $c[$j];
|
||||
next if $c eq "\x00";
|
||||
@@ -4322,8 +4342,7 @@
|
||||
|
||||
sub new {
|
||||
my($class, @args) = @_;
|
||||
- unshift @args, \%ChunkIndex;
|
||||
- bless \@args, $class;
|
||||
+ bless PDFJ::_hash(\%ChunkIndex, @args), $class;
|
||||
}
|
||||
|
||||
sub clone {
|
||||
@@ -4371,7 +4390,7 @@
|
||||
croak "linefeed specification missing" unless exists $style->{linefeed};
|
||||
croak "align specification missing" unless $style->{align};
|
||||
my $self = bless { text => $text, style => $style }, $class;
|
||||
- $self->typename($style->{typename}) if $style->{typename} ne '';
|
||||
+ $self->typename($style->{typename}) if ($style->{typename});
|
||||
$self->{linefeed} = $style->{linefeed};
|
||||
if( $self->{linefeed} =~ s/s(\d+%?)// ) {
|
||||
$self->{lineskipmin} = $1;
|
||||
@@ -4817,7 +4836,7 @@
|
||||
my $self = bless { direction => $direction, objects => \@objects,
|
||||
xpreshift => 0, xpostshift => 0, ypreshift => 0, ypostshift => 0,
|
||||
style => $style }, $dclass;
|
||||
- $self->typename($style->{typename}) if $style->{typename} ne '';
|
||||
+ $self->typename($style->{typename}) if ($style->{typename});
|
||||
$self->_checkobjects;
|
||||
$self->_calcsize;
|
||||
$self->adjustwidth($style->{width}) if $style->{width};
|
||||
@@ -5136,10 +5155,10 @@
|
||||
carp "break fails";
|
||||
return;
|
||||
}
|
||||
- if( @bobjects && $bobjects[0]->{floatsep} eq 'b' ) {
|
||||
+ if( @bobjects && ($bobjects[0]->{floatsep} || "") eq 'b' ) {
|
||||
shift @bobjects;
|
||||
}
|
||||
- if( @bobjects && $bobjects[$#bobjects]->{floatsep} eq 'e' ) {
|
||||
+ if( @bobjects && ($bobjects[$#bobjects]->{floatsep} || '') eq 'e' ) {
|
||||
pop @bobjects;
|
||||
}
|
||||
if( $repeatheader && (@bobjects >= $repeatheader) && @objects ) {
|
||||
@@ -5188,7 +5207,7 @@
|
||||
} elsif( $float eq '' || $float eq 'h' ) {
|
||||
$inspos = @$objects;
|
||||
while( $inspos > 0 && ($objects->[$inspos - 1]->float =~ /e/ ||
|
||||
- $objects->[$inspos - 1]->{floatsep} =~ /e/)) {
|
||||
+ ($objects->[$inspos - 1]->{floatsep} || "") =~ /e/)) {
|
||||
$inspos--;
|
||||
}
|
||||
} else {
|
||||
@@ -5210,7 +5229,7 @@
|
||||
$height += skipsize($self->{objects}->[$j-1], $obj);
|
||||
}
|
||||
if( PDFJ::Util::objisa($obj, 'PDFJ::Showable') ) {
|
||||
- my $owidth = $obj->width + $obj->blockalign;
|
||||
+ my $owidth = $obj->width + ($obj->blockalign || 0);
|
||||
$width = $width < $owidth ? $owidth : $width;
|
||||
$height += $obj->height;
|
||||
} elsif( PDFJ::Util::objisa($obj, 'PDFJ::BlockElement') ) {
|
||||
@@ -5229,7 +5248,7 @@
|
||||
for( my $j = 0; $j < $objnum; $j++ ) {
|
||||
my $obj = $self->{objects}->[$j];
|
||||
if( PDFJ::Util::objisa($obj, 'PDFJ::Showable') ) {
|
||||
- my $aib = $obj->blockalign;
|
||||
+ my $aib = $obj->blockalign || '';
|
||||
if( $aib eq '' ) {
|
||||
$indents[$j] = ($width - $obj->width) * $indentratio;
|
||||
} elsif( $aib eq 'b' ) {
|
||||
@@ -6635,8 +6654,8 @@
|
||||
if( $lastobjnum ) {
|
||||
for my $objnum(1 .. $lastobjnum) {
|
||||
printf $handle "%010.10d %05.5d n \n",
|
||||
- $self->{objposlist}->[$objnum],
|
||||
- $objtable->get($objnum)->{gennum};
|
||||
+ $self->{objposlist}->[$objnum] || 0,
|
||||
+ $objtable->get($objnum)->{gennum} || 0;
|
||||
}
|
||||
}
|
||||
print $handle "\n";
|
||||
|
13
japanese/p5-PDFJ/files/patch-PNG.pm
Normal file
13
japanese/p5-PDFJ/files/patch-PNG.pm
Normal file
@ -0,0 +1,13 @@
|
||||
--- PDFJ/PNG.pm.orig 2010-01-08 14:10:44.679341560 +0900
|
||||
+++ PDFJ/PNG.pm 2010-01-08 14:11:00.479580442 +0900
|
||||
@@ -177,8 +177,8 @@
|
||||
}, stream => $encoded));
|
||||
} elsif( $colorspace == 6 ) { # RGB+alpha
|
||||
croak "PNG over 8 bit RGB+alpha not supported" if $bpc > 8;
|
||||
- my $mdata;
|
||||
- my $maskdata;
|
||||
+ my $mdata = '';
|
||||
+ my $maskdata = '';
|
||||
my $scanline = ceil($bpc * 4 * $width / 8) + 1;
|
||||
my $bpp = ceil($bpc * 4 / 8);
|
||||
my $clearstream =
|
Loading…
Reference in New Issue
Block a user