gbranden pushed a commit to branch master in repository groff. commit da19f50f9188014b8cb3cd9374fd0d88154df37d Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Thu Jul 10 21:52:19 2025 -0500
[grolj4]: Fix code style nits. * src/devices/grolj4/lj4.cpp: Give the anonymous `struct` type used for `paper_table` a name, so that it can be passed to a template function C++98-conformantly. (lookup_paper_size): Use a (signed) `int` as the loop index, which happens to conform with the signedness of the function's return value as which it can be used. Use `array_length()` on `paper_table` instead of `sizeof` and division. --- ChangeLog | 10 ++++++++++ src/devices/grolj4/lj4.cpp | 7 +++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53840379c..8dd9ea280 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2025-07-10 G. Branden Robinson <g.branden.robin...@gmail.com> + + * src/devices/grolj4/lj4.cpp: Fix code style nits. Give the + anonymous `struct` type used for `paper_table` a name, so + that it can be passed to a template function C++98-conformantly. + (lookup_paper_size): Use a (signed) `int` as the loop index, + which happens to conform with the signedness of the function's + return value as which it can be used. Use `array_length()` on + `paper_table` instead of `sizeof` and division. + 2025-07-10 G. Branden Robinson <g.branden.robin...@gmail.com> * src/devices/grolbp/lbp.cpp: Fix code style nits. Give the diff --git a/src/devices/grolj4/lj4.cpp b/src/devices/grolj4/lj4.cpp index ff60965ec..5849e0519 100644 --- a/src/devices/grolj4/lj4.cpp +++ b/src/devices/grolj4/lj4.cpp @@ -53,7 +53,7 @@ X command to include bitmap graphics extern "C" const char *Version_string; -static struct { +static struct lj4_paper_sizes { const char *name; int code; // at 300dpi @@ -612,11 +612,10 @@ printer *make_printer() static int lookup_paper_size(const char *s) { - for (unsigned int i = 0; - i < sizeof(paper_table)/sizeof(paper_table[0]); i++) { + for (int i = 0; i < array_length(paper_table); i++) { // FIXME Perhaps allow unique prefix. if (strcasecmp(s, paper_table[i].name) == 0) - return i; + return int(i); } return -1; } _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit