gbranden pushed a commit to branch master in repository groff. commit 92e5d430c9f99f6df07483767d3210ea41a49230 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Fri Jul 11 06:47:48 2025 -0500
[preconv]: Fix code style nits (6/6). * src/preproc/preconv/preconv.cpp (conversion_iconv, main): Parenthesize (formally) complex pexpressions. (do_file): Assign character rather than integer literal to element of `char` array. --- ChangeLog | 4 ++++ src/preproc/preconv/preconv.cpp | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7944d51e1..9f9fd75cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,10 @@ pointer literals instead of letting them pun down to Booleans. (conversion_iconv, do_file): Favor C++ `static_cast<>` and `const_cast<>` operators over omnipotent C-style casts. + (conversion_iconv, main): Parenthesize (formally) complex + pexpressions. + (do_file): Assign character rather than integer literal to + element of `char` array. 2025-07-11 G. Branden Robinson <g.branden.robin...@gmail.com> diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp index c43690db5..49ccd5d94 100644 --- a/src/preproc/preconv/preconv.cpp +++ b/src/preproc/preconv/preconv.cpp @@ -729,8 +729,9 @@ conversion_iconv(FILE *fp, const string &data, char *enc) // Handle 'fp' and switch to 'inbuf'. size_t read_bytes; char *read_start = inbuf + inbytes_left; - while ((read_bytes = fread(read_start, 1, BUFSIZ - inbytes_left, fp)) - > 0) { + while ((read_bytes = fread(read_start, 1, (BUFSIZ - inbytes_left), + fp)) + > 0) { inptr = inbuf; inbytes_left += read_bytes; while (inbytes_left > 0) { @@ -1185,7 +1186,7 @@ do_file(const char *filename) encoding = file_encoding; } strncpy(encoding_string, encoding, MAX_VAR_LEN - 1); - encoding_string[MAX_VAR_LEN - 1] = 0; + encoding_string[MAX_VAR_LEN - 1] = '\0'; if (must_free_encoding) free(encoding); encoding = encoding_string; @@ -1346,7 +1347,7 @@ main(int argc, char **argv) fatal("error status on standard output stream"); if (fflush(stdout) < 0) fatal("cannot flush standard output stream: %1", strerror(errno)); - return nbad != 0; + return (nbad != 0); } // Local Variables: _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit