Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ? - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?
Date
Msg-id Pine.LNX.4.21.0009171248450.576-100000@peter
Whole thread Raw
In response to Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?
List pgsql-hackers
Tom Lane writes:

> -           if (isascii((unsigned char)lower_text[i]) && isupper(lower_text[i]))
> +           if (isascii((int)lower_text[i]) && isupper((int) lower_text[i]))

> Peter, I suppose what you were trying to clean up is a "char used as
> array subscript" kind of warning?

Yep.

> I would like to think that your compiler will not complain about
>           if (isascii((unsigned char)lower_text[i]) ...
> If it does we'd have to write something as ugly as
>           if (isascii((int)(unsigned char)lower_text[i]) ...
> which I can see no value in from a portability standpoint.

I think that the problem might rather be that lower_text (and various
other arrays) are not declared as unsigned char in the first place. That
would also explain why -funsigned-chars fixes it. Because calling
toupper() etc. with a signed char argument is in violation of the spec.

(Hmm, template/aix contains this: CFLAGS='-qchars=signed ...'. That can't
be good.)


-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-hackers by date:

Previous
From: Karel Zak
Date:
Subject: Re: ascii to character conversion in postgres
Next
From: Peter Eisentraut
Date:
Subject: Re: Where to stick function setuid