From 0971b67f68eabe84e58ba202abe73d50c878d1ac Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 10 Jul 2018 17:45:52 +0000 Subject: Fix a few, but not all, clang warnings: Use "%s" to print modifiable strings, add a couple of braces, ansify a few functions, add and remove a few extra parens. ok jcs --- gnu/usr.bin/cvs/diff/diff3.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'gnu/usr.bin/cvs/diff/diff3.c') diff --git a/gnu/usr.bin/cvs/diff/diff3.c b/gnu/usr.bin/cvs/diff/diff3.c index 4a6fba618c2..10903fa2e29 100644 --- a/gnu/usr.bin/cvs/diff/diff3.c +++ b/gnu/usr.bin/cvs/diff/diff3.c @@ -1502,7 +1502,7 @@ output_diff3 (diff, mapping, rev_mapping) line = 0; do { - printf_output (line_prefix); + printf_output ("%s", line_prefix); cp = D_RELNUM (ptr, realfile, line); length = D_RELLEN (ptr, realfile, line); write_output (cp, length); @@ -1554,11 +1554,12 @@ undotlines (leading_dot, start, num) int leading_dot, start, num; { write_output (".\n", 2); - if (leading_dot) + if (leading_dot) { if (num == 1) printf_output ("%ds/^\\.//\n", start); else printf_output ("%d,%ds/^\\.//\n", start, start + num - 1); + } } /* @@ -1749,11 +1750,12 @@ output_diff3_merge (infile, diff, mapping, rev_mapping, do { c = getc (infile); - if (c == EOF) + if (c == EOF) { if (ferror (infile)) diff3_perror_with_exit ("input file"); else if (feof (infile)) diff3_fatal ("input file shrank"); + } cc = c; write_output (&cc, 1); } @@ -1803,7 +1805,7 @@ output_diff3_merge (infile, diff, mapping, rev_mapping, linesread += i; while (0 <= --i) while ((c = getc (infile)) != '\n') - if (c == EOF) + if (c == EOF) { if (ferror (infile)) diff3_perror_with_exit ("input file"); else if (feof (infile)) @@ -1812,6 +1814,7 @@ output_diff3_merge (infile, diff, mapping, rev_mapping, diff3_fatal ("input file shrank"); return conflicts_found; } + } } /* Copy rest of common file. */ while ((c = getc (infile)) != EOF || !(ferror (infile) | feof (infile))) -- cgit v1.2.3-59-g8ed1b