gbranden pushed a commit to branch master
in repository groff.

commit bd07cc4dfdc11922f4359f12cca5a6f883c87a49
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Aug 28 16:23:20 2024 -0500

    src/roff/troff/node.cpp: Fix code style nits.
    
    * src/roff/troff/node.cpp: Fix code style nits.
    
      (troff_output_file::put_char_width): Parenthesize complex expressions.
      Memorization of the ~15-17-level C and C++ operator precedence tables
      should be a matter of shame, not pride.
    
      (special_node::is_same_as): Use `static_cast` instead of C-style cast.
---
 ChangeLog               | 10 ++++++++++
 src/roff/troff/node.cpp | 16 ++++++++--------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b35d4de6e..7a46b938d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-08-28  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/node.cpp: Fix code style nits.
+       (troff_output_file::put_char_width): Parenthesize complex
+       expressions.  Memorization of the ~15-17-level C and C++
+       operator precedence tables should be a matter of shame, not
+       pride.
+       (special_node::is_same_as): Use `static_cast` instead of C-style
+       cast.
+
 2024-08-28  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/node.cpp (class troff_output_file): Boolify
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 90ab9742b..9bdee0af4 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -1129,9 +1129,9 @@ void troff_output_file::put_char_width(charinfo *ci, 
tfont *tf,
     if (vpos == output_vpos
        && (!gcol || gcol == current_glyph_color)
        && (!fcol || fcol == current_fill_color)
-       && n > 0 && n < 100 && !must_update_drawing_position) {
-      put(char(n/10 + '0'));
-      put(char(n%10 + '0'));
+       && (n > 0) && (n < 100) && !must_update_drawing_position) {
+      put(char(n / 10 + '0'));
+      put(char(n % 10 + '0'));
       put(c);
       output_hpos = hpos;
     }
@@ -3913,12 +3913,12 @@ special_node::special_node(const macro &m, tfont *t,
 
 bool special_node::is_same_as(node *n)
 {
-  return ((mac == ((special_node *)n)->mac)
-         && (tf == ((special_node *)n)->tf)
-         && (gcol == ((special_node *)n)->gcol)
-         && (fcol == ((special_node *)n)->fcol)
+  return ((mac == static_cast<special_node *>(n)->mac)
+         && (tf == static_cast<special_node *>(n)->tf)
+         && (gcol == static_cast<special_node *>(n)->gcol)
+         && (fcol == static_cast<special_node *>(n)->fcol)
          && (lacks_command_prefix
-             == ((special_node *)n)->lacks_command_prefix));
+             == static_cast<special_node *>(n)->lacks_command_prefix));
 }
 
 const char *special_node::type()

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

Reply via email to