groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 06/15: [gropdf]: Do more "DESC" file validation.


From: G. Branden Robinson
Subject: [groff] 06/15: [gropdf]: Do more "DESC" file validation.
Date: Mon, 6 Jun 2022 22:26:12 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 42ad6e0ebefd719712f46a4971bbbc0622682f6a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Jun 4 14:11:36 2022 -0500

    [gropdf]: Do more "DESC" file validation.
    
    * src/devices/gropdf/gropdf.pl: Do more "DESC" file validation.
    
      (LoadDesc): Bomb out gracefully if any of "unitwidth", "res", or
      "sizescale", missing from "DESC" file.  This prevents Perl warnings
      about use of unintialized values, and undoubtedly mangled output.
---
 ChangeLog                    | 8 ++++++++
 src/devices/gropdf/gropdf.pl | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 3b125d21..c467f5d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-06-04  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/gropdf/gropdf.pl: Do more "DESC" file validation.
+       (LoadDesc): Bomb out gracefully if any of "unitwidth", "res", or
+       "sizescale" missing from "DESC" file.  This prevents Perl
+       warnings about use of unintialized values, and undoubtedly
+       mangled output.
+
 2022-06-04  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/gropdf/gropdf.pl: Revise diagnostic message
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index aef411e0..9002cd6e 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -683,6 +683,12 @@ sub LoadDesc
     }
 
     close($f);
+
+    foreach my $directive ('unitwidth', 'res', 'sizescale')
+    {
+       Die("device description file 'DESC' missing mandatory directive"
+           . " '$directive'") if !exists($desc{$directive});
+    }
 }
 
 sub rad  { $_[0]*3.14159/180 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]