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

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?
Date: 2000-09-17 13:05:00
Message-ID: Pine.LNX.4.21.0009171248450.576-100000@peter
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://yi.org/peter-e/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-09-17 13:11:17 Re: Where to stick function setuid
Previous Message Karel Zak 2000-09-17 12:27:38 Re: ascii to character conversion in postgres