gbranden pushed a commit to branch master
in repository groff.

commit f4ca93a9fc7fd623f6b669c0d0513dfa12a1e4bf
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Nov 25 23:55:20 2025 -0600

    [troff]: Fix code style nits.
    
    * src/roff/troff/input.cpp (read_identifier, do_get_long_name)
      (get_delimited_name): Compare input character values to constant
      literals of appropriate type and signedness--they should be `unsigned
      char`s, since the formatter reads its input as bytes.
---
 ChangeLog                | 8 ++++++++
 src/roff/troff/input.cpp | 8 ++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3d5ba1ab5..8e6f20c97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-11-25  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (read_identifier, do_get_long_name)
+       (get_delimited_name): Fix code style nits.  Compare input
+       character values to constant literals of appropriate type and
+       signedness--they should be `unsigned char`s, since the formatter
+       reads its input as bytes.
+
 2025-11-24  G. Branden Robinson <[email protected]>
 
        [troff]: Trivially refactor.  Rename `token` class's member
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 89fa2354b..3f9ae7640 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3103,9 +3103,9 @@ symbol read_identifier(bool required)
   if (want_att_compat) {
     char buf[3];
     tok.skip_spaces();
-    if ((buf[0] = tok.ch()) != 0) {
+    if ((buf[0] = tok.ch()) != 0U) {
       tok.next();
-      if ((buf[1] = tok.ch()) != 0) {
+      if ((buf[1] = tok.ch()) != 0U) {
        buf[2] = 0;
        tok.make_space();
       }
@@ -3158,7 +3158,7 @@ static symbol do_get_long_name(bool required, char 
end_char)
       buf_size = new_buf_size;
       delete[] old_buf;
     }
-    if ((buf[i] = tok.ch()) == '\0' || (buf[i] == end_char))
+    if ((buf[i] = tok.ch()) == 0U || (buf[i] == end_char))
       break;
     i++;
     tok.next();
@@ -6201,7 +6201,7 @@ static symbol read_delimited_name()
        && (want_att_compat
            || (input_stack::get_level() == start_level)))
       break;
-    if ((buf[i] = tok.ch()) == '\0') {
+    if ((buf[i] = tok.ch()) == 0U) {
       // token::description() writes to static, class-wide storage, so
       // we must allocate a copy of it before issuing the next
       // diagnostic.

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to