gbranden pushed a commit to branch master
in repository groff.
commit c34502070b1374cceec484b0b825f80ab8d812bf
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Jul 29 23:11:11 2024 -0500
[troff]: Fix Savannah #66040 (`hcode` & `\[xxx]`).
* src/roff/troff/input.cpp (set_hyphenation_code): Restore diagnostic
message when attempting to assigning the hyphenation code of a special
character to another character (special or ordinary). Also initialize
local variable much closer to where we test its value, for
readability.
Fixes <https://savannah.gnu.org/bugs/?66040>. Thanks to Dave Kemper for
the report.
---
ChangeLog | 11 +++++++++++
src/roff/troff/input.cpp | 14 ++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 011fe7e77..c456c0b92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-07-29 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (set_hyphenation_code): Restore
+ diagnostic message when attempting to assigning the hyphenation
+ code of a special character to another character (special or
+ ordinary). Also initialize local variable much closer to where
+ we test its value, for readability.
+
+ Fixes <https://savannah.gnu.org/bugs/?66040>. Thanks to Dave
+ Kemper for the report.
+
2024-07-25 G. Branden Robinson <[email protected]>
* src/roff/troff/number.cpp (get_vunits, get_hunits, get_number)
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index d0ef4a0f1..615cd3820 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7291,15 +7291,21 @@ static void set_hyphenation_codes()
break;
tok.next();
tok.skip();
- unsigned char c = tok.ch();
if (tok.is_newline() || tok.is_eof()) {
error("hyphenation codes must be specified in pairs");
break;
}
charinfo *ci2 = tok.get_char(true /* required */);
- // nonsense redux
- if (0 /* nullptr */ == ci2)
- break;
+ unsigned char c = tok.ch();
+ if (0 == c) {
+ if (0 /* nullptr */ == ci2)
+ break;
+ if (0 == ci2->get_hyphenation_code()) {
+ error("second member of hyphenation code pair must be an"
+ " ordinary character");
+ break;
+ }
+ }
// TODO: What if you want to unset a hyphenation code? Accept 0?
if (csdigit(c)) {
error("hyphenation code cannot be digit");
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit