gbranden pushed a commit to branch master
in repository groff.

commit 8c92fc3a73b32ae9925dfcfbc835b48d5e0332ca
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Oct 17 09:19:13 2026 -0500

    [troff]: Fix code style nits.
    
    * src/roff/troff/input.cpp (read_color_channel_value): Return correctly
      typed zero literals.  Parenthesize formally complex expressions.  Put
      space around dyadic operators.  Favor C++ `static_cast<>` operator
      over omnipotent C-style cast.
---
 ChangeLog                | 9 +++++++++
 src/roff/troff/input.cpp | 8 ++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7955607f6..1a6db698a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-10-17  G. Branden Robinson <[email protected]>
+
+       [troff]: Fix code style nits.
+
+       * src/roff/troff/input.cpp (read_color_channel_value): Return
+       correctly typed zero literals.  Parenthesize formally complex
+       expressions.  Put space around dyadic operators.  Favor C++
+       `static_cast<>` operator over omnipotent C-style cast.
+
 2026-10-17  G. Branden Robinson <[email protected]>
 
        [troff]: Improve `lf` request input validation.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 206c2804b..190d2cfca 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1522,18 +1522,18 @@ static unsigned int read_color_channel_value(const char 
*scheme,
   if (!read_measurement(&val, (unsigned char)('f'))) { // TODO: grochar
     warning(WARN_COLOR, "%1 in %2 definition set to 0", col, scheme);
     tok.next();
-    return 0;
+    return 0U;
   }
   if (val < 0) {
     warning(WARN_RANGE, "%1 cannot be negative: set to 0", col);
-    return 0;
+    return 0U;
   }
-  if (val > color::MAX_COLOR_VAL+1) {
+  if (val > (color::MAX_COLOR_VAL + 1)) {
     warning(WARN_RANGE, "%1 cannot be greater than 1", col);
     // we change 0x10000 to 0xffff
     return color::MAX_COLOR_VAL;
   }
-  return (unsigned int)(val);
+  return static_cast<unsigned int>(val);
 }
 
 static color *read_rgb(unsigned char end = 0U)

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

Reply via email to