]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: clarify integer operations in recent commit
authorPádraig Brady <P@draigBrady.com>
Thu, 25 Jun 2015 15:39:36 +0000 (16:39 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 25 Jun 2015 17:59:39 +0000 (18:59 +0100)
* 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

src/factor.c

index 5b7ae22ab3c7b0b2a9cf86b46d401440454a663a..60cf898aaa33810875c726e73643af8c09a2f295 100644 (file)
@@ -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);
     }
 }