summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-06-25 16:39:36 +0100
committerPádraig Brady <P@draigBrady.com>2015-06-25 18:59:39 +0100
commitf3a0e9ebb26d92368238f6700fa973198c563968 (patch)
tree43c1859f72ea14fce243cf41c93c99211685ff5b
parentcacd9bf9c265e6dda21d3105ade83ae1401867ce (diff)
downloadcoreutils-f3a0e9ebb26d92368238f6700fa973198c563968.tar.xz
maint: clarify integer operations in recent commit
* src/factor.c (print_uintmaxes): Comment that the value of n_out doesn't matter on error, and add an explicit cast to avoid any future warnings. Suggested by Jim Meyering RE commit v8.23-229-g4d2d6c5
-rw-r--r--src/factor.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/factor.c b/src/factor.c
index 5b7ae22ab..60cf898aa 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -2331,7 +2331,10 @@ print_uintmaxes (uintmax_t t1, uintmax_t t0)
uintmax_t q, r;
if (t1 == 0)
- n_out += printf ("%"PRIuMAX, t0);
+ {
+ /* n_out's value is inconsequential on error. */
+ n_out += (size_t) printf ("%"PRIuMAX, t0);
+ }
else
{
/* Use very plain code here since it seems hard to write fast code
@@ -2340,7 +2343,7 @@ print_uintmaxes (uintmax_t t1, uintmax_t t0)
r = t1 % 1000000000;
udiv_qrnnd (t0, r, r, t0, 1000000000);
print_uintmaxes (q, t0);
- n_out += printf ("%09u", (unsigned int) r);
+ n_out += (size_t) printf ("%09u", (unsigned int) r);
}
}