coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: factor vs printf failure


From: Jim Meyering
Subject: Re: factor vs printf failure
Date: Thu, 25 Jun 2015 09:10:40 -0700

On Thu, Jun 25, 2015 at 8:31 AM, Pádraig Brady <address@hidden> wrote:
...
> Yes I had discounted that as an issue, but you're right
> that it's better to be explicit with the tricky issue
> of integer conversion/overflow.  How about this comment,
> and an explicit cast to placate any future warnings?
>
> cheers,
> Pádraig
>
> diff --git a/src/factor.c b/src/factor.c
> index 5b7ae22..902ada8 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 in inconsequential on error.  */
> +      n_out += (size_t) printf ("%"PRIuMAX, t0);
...

Thanks. That works for me, modulo: s/ in/ is/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]