[MPlayer-dev-eng] [PATCH] multiple patches from NetBSD pkgsrc

Uoti Urpala uoti.urpala at pp1.inet.fi
Wed Oct 11 22:23:55 CEST 2006


On Wed, 2006-10-11 at 10:16 +0200, Diego Biurrun wrote:
> >  static void trail_space(char *s) {
> >  	int i = 0;
> > -	while (isspace(s[i])) ++i;
> > +	while (isspace((unsigned char)s[i])) ++i;
> 
> Are these ugly casts really necessary?

isspace() must have either an unsigned char or EOF as input. char can be
signed (and is on x86) so the current function incorrect gives negative
values other than EOF to isspace().

So a fix is needed, but in this case I think changing the argument type
to "unsigned char *s" would be a better solution than the cast.




More information about the MPlayer-dev-eng mailing list