[MPlayer-dev-eng] ctype.h functions on win32

Rich Felker dalias at aerifal.cx
Sun Oct 14 17:28:22 CEST 2007


On Sun, Oct 14, 2007 at 03:28:40PM +0200, Reimar Döffinger wrote:
> On Sun, Oct 14, 2007 at 03:23:08PM +0200, Reimar Döffinger wrote:
> > On Sun, Oct 14, 2007 at 09:11:07AM -0400, Rich Felker wrote:
> > > On Sun, Oct 14, 2007 at 09:15:45AM +0200, Reimar Döffinger wrote:
> > > > > > Check if something like
> > > > > > #define isspace(c) ((c) != EOF && isspace((unsigned char)(c)))
> > > > > > works.
> > > > > 
> > > > > This is unnecessary. The issue is NOT msvc crashing when -1 is passed.
> > > > > The issue is msvc crashing when signed char values in the range -128
> > > > > to -2 are passed. The relevant arrays/pointers simply need to be
> > > > > changed to unsigned char.
> > > > 
> > > > Well, c might be an int returned from fgetc.
> > > 
> > > Any value returned by fgetc is automatically valid as an argument to
> > > isspace or any of the is*() functions. RTFM!!!!!!!!!!!!!!!
> > 
> > Please read again all of it.
> 
> And keep in mind that none of my docs say that EOF couldn't be 0x120.

EOF is -1. This is defined in the C standard. You're the one who needs
to RTFM. Moreover both the valid arguments to isspace and the possible
return values of fgetc are defined as "range of unsigned char or EOF"
so the fact that EOF is defined as -1 is irrelevant.

Rich



More information about the MPlayer-dev-eng mailing list