[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] readtokens bug
From: |
Jim Meyering |
Subject: |
Re: [Bug-gnulib] readtokens bug |
Date: |
Tue, 14 Jan 2003 14:51:51 +0100 |
Bruno Haible <address@hidden> wrote:
> Hi Jim,
>
> I made this patch. It avoids a crash on 64-bit platforms, when one of the
> delimiters is a non-ASCII byte. ( remember (unsigned char) -5 = 0xFB but
> (unsigned int) -5 = 0x00000000FFFFFFFB) )
>
>
> 2003-01-11 Bruno Haible <address@hidden>
>
> * readtokens.c (readtoken): Cast character to 'unsigned char', not
> 'unsigned int'.
Thanks for fixing that!
How about removing the cast altogether and making it be of type
`unsigned char const *' instead? That doesn't evoke a warning
with -Wall and a recent snapshot of gcc.
> diff -r -c3 --exclude=MODULES.html gnulib-cvs/lib/readtokens.c
> gnulib/lib/readtokens.c
> *** gnulib-cvs/lib/readtokens.c 2001-12-09 23:39:02.000000000 +0100
> --- gnulib/lib/readtokens.c 2003-01-11 16:56:13.000000000 +0100
> [...]
> ***************
> *** 113,119 ****
> for (j = 0; j < sizeof (isdelim); j++)
> isdelim[j] = 0;
> for (t = delim; *t; t++)
> ! isdelim[(unsigned int) *t] = 1;
> }
>
> p = tokenbuffer->buffer;
> --- 113,119 ----
> for (j = 0; j < sizeof (isdelim); j++)
> isdelim[j] = 0;
> for (t = delim; *t; t++)
> ! isdelim[(unsigned char) *t] = 1;
> }
>
> p = tokenbuffer->buffer;