gbranden pushed a commit to branch master in repository groff. commit adf3ebf0dd488e334ab1955778ad0f983b5eae02 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Mon Jul 14 19:21:35 2025 -0500
squash grolj4 --- ChangeLog | 10 ++++++---- src/devices/grolj4/lj4.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8dd9ea280..8f0609265 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,10 +3,12 @@ * 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. + (lookup_paper_size): Use a `size_t` as the loop index. Use + `array_length()` on `paper_table` instead of `sizeof` and + division. Change return type to `ssize_t` so that we can + continue to return `-1` meaning "not found". + (main): Change type of local variable `n` to match altered + return type of `lookup_paper_size()`. 2025-07-10 G. Branden Robinson <g.branden.robin...@gmail.com> diff --git a/src/devices/grolj4/lj4.cpp b/src/devices/grolj4/lj4.cpp index 5849e0519..bd4afcb9c 100644 --- a/src/devices/grolj4/lj4.cpp +++ b/src/devices/grolj4/lj4.cpp @@ -92,7 +92,7 @@ const int DEFAULT_HPGL_UNITS = 1016; int line_width_factor = DEFAULT_LINE_WIDTH_FACTOR; unsigned ncopies = 0; // 0 means don't send ncopies command -static int lookup_paper_size(const char *); +static ssize_t lookup_paper_size(const char *); class lj4_font : public font { public: @@ -610,9 +610,9 @@ printer *make_printer() } static -int lookup_paper_size(const char *s) +ssize_t lookup_paper_size(const char *s) { - for (int i = 0; i < array_length(paper_table); i++) { + for (size_t i = 0; i < array_length(paper_table); i++) { // FIXME Perhaps allow unique prefix. if (strcasecmp(s, paper_table[i].name) == 0) return int(i); @@ -657,7 +657,7 @@ int main(int argc, char **argv) break; case 'p': { - int n = lookup_paper_size(optarg); + ssize_t n = lookup_paper_size(optarg); if (n < 0) error("ignoring invalid paper format '%1'", font::papersize); else _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit