gbranden pushed a commit to branch master
in repository groff.
commit 72aa936974db24d8a5e2c505c44e09156a400095
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Apr 8 18:00:20 2026 -0500
[troff]: Work on Savannah #67735.
Improve type discipline with respect to internal character
representation.
* src/roff/troff/env.cpp (point_size): Improve type discipline with
respect to groff's internal character representation. Call
`read_measurement()` with explicitly constructed literal argument of
type `unsigned char` for conceptual clarity. "groff characters" are,
for now, unsigned bytes.
* src/roff/troff/number.cpp (is_valid_term): Demote local variable `si`
from `int` to `unsigned char`.
Continues the long process of fixing Savannah #67735.
---
ChangeLog | 14 ++++++++++++++
src/roff/troff/env.cpp | 3 ++-
src/roff/troff/number.cpp | 2 +-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 80fae0a9c..3b245876d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2026-04-08 G. Branden Robinson <[email protected]>
+
+ [troff]: Improve type discipline with respect to internal
+ character representation.
+
+ * src/roff/troff/env.cpp (point_size): Call `read_measurement()`
+ with explicitly constructed literal argument of type `unsigned
+ char` for conceptual clarity. "groff characters" are, for now,
+ unsigned bytes.
+ * src/roff/troff/number.cpp (is_valid_term): Demote local
+ variable `si` from `int` to `unsigned char`.
+
+ Continues the long process of fixing Savannah #67735.
+
2026-04-08 G. Branden Robinson <[email protected]>
* src/roff/troff/env.cpp (environment_copy, environment_switch):
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 7d80fd7bf..ab265032c 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1389,7 +1389,8 @@ static void point_size() // .ps
}
int n;
if (has_arg()
- && read_measurement(&n, 'z', curenv->get_requested_point_size()))
+ && read_measurement(&n, (unsigned char)('z'), // TODO: grochar
+ curenv->get_requested_point_size()))
{
if (n <= 0)
n = 1;
diff --git a/src/roff/troff/number.cpp b/src/roff/troff/number.cpp
index 688da0bf8..41f991a13 100644
--- a/src/roff/troff/number.cpp
+++ b/src/roff/troff/number.cpp
@@ -538,7 +538,7 @@ static bool is_valid_term(units *u, int scaling_unit,
tok.next();
}
}
- int si = scaling_unit;
+ unsigned char si = scaling_unit; // TODO: grochar
bool do_next = false;
if (((c = tok.ch()) != 0)
&& (strchr(valid_scaling_units, c) != 0 /* nullptr */)) {
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit