On Mon, 14 Dec 2015 12:49:04 -0500
Random832 <[email protected]> wrote:

> I was going through sbase checking with -Wall -Wextra
> -pedantic -Werror, and among a bunch of noise errors
> relating to signed/unsigned comparisons, I found one with
> actual substance: the result of getline is being
> converted to size_t before comparing to -1 to check for
> error.
> 
> diff --git a/join.c b/join.c
> index 1a08927..6828cf4 100644
> --- a/join.c
> +++ b/join.c
> @@ -261,7 +261,8 @@ static int
>  addtospan(struct span *sp, FILE *fp, int reset)
>  {
>         char *newl = NULL;
> -       size_t len, size = 0;
> +       ssize_t len;
> +       size_t size = 0;
>  
>         if ((len = getline(&newl, &size, fp)) == -1) {
>                 if (ferror(fp))
> 
> 
> I also couldn't quite figure out if this line of tail.c is
> correct or not.
> 
> n = MIN(llabs(estrtonum(numstr, LLONG_MIN + 1,
> MIN(LLONG_MAX, SIZE_MAX))), SIZE_MAX);
> 
> 

I think this patch should be included. But I don't see
how it is of substance. It will never occur with two's
complement or ones' complement. Only, signed magnitude
representatiion. Any sensible C compiler for POSIX
systems will only use two's complement; otherwise
int[0-9]*_t cannot be implemented.

Attachment: pgpDqa0Ph986H.pgp
Description: OpenPGP digital signature

Reply via email to