This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Invalid tm_zone from localtime() when TZ is not set
- From: KOBAYASHI Shinji <koba at jp dot fujitsu dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 20 May 2016 19:16:37 +0900
- Subject: Re: Invalid tm_zone from localtime() when TZ is not set
- Authentication-results: sourceware.org; auth=none
- References: <o8xeg8x7e2r dot wl-koba at jp dot fujitsu dot com> <932D033F-9DA4-4901-9158-328AA929FEC8 at etr-usa dot com> <o8x8tz573zs dot wl-koba at jp dot fujitsu dot com> <CAEhDDbA-ATpAtVggR7cfqn58AHw0sPK_Y3mNSJ8UO29sg2ZpuA at mail dot gmail dot com>
Hi,
>>>>> Csaba Raduly wrote:
> If the type of those members is WCHAR[] then using isascii() /
> isupper() on them is just plain wrong.
> The correct function to use would be iswupper().
I agree that isw*() functions should be used for wchar_t. But I think
just changing isupper() to iswupper() is not enough as I explain
below. If iswascii() was available, using both iswascii() and
iswupper() might be a candidate.
> The line
> if (isupper(*src)) *dst++ = *src;
> (where src is wchar_t* and dst is char*) assumes that the upper 8 bits
> of *src are zero (or *src is -1).
> If not, the behavior is at best implementation-defined (maybe even undefined).
With Japanese Windows, the upper 8 bits of *src are not zero. So I
would like to correct the behavior. I think adding isascii() can be a
compromise.
>> 1. Using iswupper() instead of isupper().
>> - Although this method is effective for Japanese environments, it
>> is not assured that the character iswupper() returns true fits in
>> the range of ASCII.
> It is highly likely that if the argument of iswupper() does not fit
> into ASCII then its result won't fit either.
I'm not sure if I understand what you are saying, but for example
iswupper(L'\uff21') returns 1 in Japanese locale.
Regards,
KOBAYASHI Shinji.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple