Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: signed chars without multibyte support



Wayne Davison wrote:
> On Tue, Dec 19, 2006 at 12:55:38PM +0000, Peter Stephenson wrote:
> > +	    *c = x[1] ^ 32;
> [...]
> > +	*c = (char)*x;
> 
> I don't really like this, as it means that the int value returned can be
> a -1 (EOF) when *x is 0xFF.  It would be better to change the code that
> is comparing a char against an int to use STOUC() on the char value in
> the comparison.

Unfortunately all the tokens in zsh.h are defined as ((char) 0x83)
etc. etc., so it's a huge amount of work to make it use unsigned
characters; virtually every use of tokens in the shell requires that
something that began as a char *not* be cast to unsigned.

Historically, the integer value at this point was a simple char; it's
only because of the need to use functions for multibyte characters that
it got changed.  It's probably easy enough to put convchar_t back to
char instead of int when there's no multibyte code, but that doesn't
really gain anything.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author