[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 06/07: [afmtodit, gropdf]: Sort Perl hash keys.
From: |
G. Branden Robinson |
Subject: |
[groff] 06/07: [afmtodit, gropdf]: Sort Perl hash keys. |
Date: |
Sun, 20 Dec 2020 03:38:55 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit fcf3dc68839d83bfba206d1febffd9514a71ee82
Author: Colin Watson <cjwatson@debian.org>
AuthorDate: Fri Nov 6 11:53:02 2015 +0000
[afmtodit, gropdf]: Sort Perl hash keys.
Hash iteration order may differ between runs, which makes builds harder
to reproduce. Sort hash keys in gropdf and afmtodit output to avoid
this.
---
src/devices/gropdf/gropdf.pl | 8 ++++----
src/utils/afmtodit/afmtodit.pl | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 468e170..ec045a9 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -378,7 +378,7 @@ my $info=BuildObj(++$objct,\%info);
PutObj($objct);
-foreach my $fontno (keys %fontlst)
+foreach my $fontno (sort keys %fontlst)
{
my $o=$fontlst{$fontno}->{FNT};
@@ -847,7 +847,7 @@ sub do_x
my @xwds=split(' ',"<< $1 >>");
my $docinfo=ParsePDFValue(\@xwds);
- foreach my $k (keys %{$docinfo})
+ foreach my $k (sort keys %{$docinfo})
{
$info{$k}=$docinfo->{$k} if $k ne 'Producer';
}
@@ -857,7 +857,7 @@ sub do_x
my @xwds=split(' ',"<< $1 >>");
my $docview=ParsePDFValue(\@xwds);
- foreach my $k (keys %{$docview})
+ foreach my $k (sort keys %{$docview})
{
$cat->{$k}=$docview->{$k} if !exists($cat->{$k});
}
@@ -1708,7 +1708,7 @@ sub MapInsHash
my $val=shift;
- foreach my $k (keys(%{$val}))
+ foreach my $k (sort keys(%{$val}))
{
MapInsValue($pdf,$o,$k,$insmap,$parent,$val->{$k}) if $k ne 'Contents';
}
diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index 8a1b56d..78ba66c 100644
--- a/src/utils/afmtodit/afmtodit.pl
+++ b/src/utils/afmtodit/afmtodit.pl
@@ -166,8 +166,8 @@ while (<AFM>) {
$depth{$n} = -$lly;
$left_side_bearing{$n} = -$llx;
$right_side_bearing{$n} = $urx - $w;
-# while ((my $lig, my $glyph2) = each %ligs) {
-# $ligatures{$lig} = $n . " " . $glyph2;
+# foreach my $lig (sort keys %ligs) {
+# $ligatures{$lig} = $n . " " . $ligs{$lig};
# }
}
}
@@ -269,7 +269,7 @@ $italic_angle = $opt_a if $opt_a;
if (!$opt_x) {
my %mapped;
my $i = ($#encoding > 256) ? ($#encoding + 1) : 256;
- while (my $ch = each %width) {
+ foreach my $ch (sort keys %width) {
# add unencoded characters
if (!$in_encoding{$ch}) {
$encoding[$i] = $ch;
@@ -409,9 +409,9 @@ my %default_ligatures = (
"ffl", "ff l",
);
-while (my ($lig, $components) = each %default_ligatures) {
+foreach my $lig (sort keys %default_ligatures) {
if (defined $width{$lig} && !defined $ligatures{$lig}) {
- $ligatures{$lig} = $components;
+ $ligatures{$lig} = $default_ligatures{$lig};
}
}
@@ -458,7 +458,7 @@ if ($opt_e) {
if (!$opt_n && %ligatures) {
print("ligatures");
- while (my $lig = each %ligatures) {
+ foreach my $lig (sort keys %ligatures) {
print(" $lig");
}
print(" 0\n");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 06/07: [afmtodit, gropdf]: Sort Perl hash keys.,
G. Branden Robinson <=