Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-26 Thread Hans-Bernhard Bröker
Am 26.05.2016 um 08:54 schrieb KOBAYASHI Shinji: On Wed, 25 May 2016 22:02:50 +0200, Hans-Bernhard Bröker wrote: On May 25 11:28, KOBAYASHI Shinji wrote: - isupper is a macro which classifies ASCII integer values by table lookup. - It is defined only when isascii(c) is true or c is EOF. T

Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-26 Thread KOBAYASHI Shinji
On Thu, 26 May 2016 12:23:03 +0200, Corinna Vinschen wrote: > > > A proper solution may have to be more like this: > > > int mapped = wctob(*src); > > > /* this call is safe now because of how wctob() works: */ > > > if (isupper(mapped)) { > > >*dst++ = (unsigned char)mapped; >

Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-26 Thread Corinna Vinschen
On May 26 15:54, KOBAYASHI Shinji wrote: > On Wed, 25 May 2016 22:02:50 +0200, Hans-Bernhard Bröker wrote: > > On May 25 11:28, KOBAYASHI Shinji wrote: > >> The intention of the following code in tzsetwall() should be to pick > >> up UPPERCASE letters "in ASCII range": > > Are you sure you're not m

Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-25 Thread KOBAYASHI Shinji
On Wed, 25 May 2016 22:02:50 +0200, Hans-Bernhard Bröker wrote: > On May 25 11:28, KOBAYASHI Shinji wrote: >> The intention of the following code in tzsetwall() should be to pick >> up UPPERCASE letters "in ASCII range": > Are you sure you're not mixing ASCII with '8-bit character' range there? I'

Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-25 Thread Hans-Bernhard Bröker
Am 25.05.2016 um 10:44 schrieb Corinna Vinschen: On May 25 11:28, KOBAYASHI Shinji wrote: Any other comments on this topic? Let me explain my proposal again. The intention of the following code in tzsetwall() should be to pick up UPPERCASE letters "in ASCII range": Are you sure you're not mi

Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-25 Thread Corinna Vinschen
On May 25 11:28, KOBAYASHI Shinji wrote: > > Any other comments on this topic? Let me explain my proposal again. > > The intention of the following code in tzsetwall() should be to pick > up UPPERCASE letters "in ASCII range": > > if (isupper(*src)) *dst++ = *src; > > NOTE: src is wchar_t *, ds

Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-24 Thread KOBAYASHI Shinji
Any other comments on this topic? Let me explain my proposal again. The intention of the following code in tzsetwall() should be to pick up UPPERCASE letters "in ASCII range": if (isupper(*src)) *dst++ = *src; NOTE: src is wchar_t *, dst is char *. As Csaba Raduly pointed out, isw*() functions

Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-20 Thread KOBAYASHI Shinji
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()

Re: Invalid tm_zone from localtime() when TZ is not set

2016-05-20 Thread Csaba Raduly
On Fri, May 20, 2016 at 6:22 AM, KOBAYASHI Shinji wrote: (snip) > > localtime() calls tzsetwall() when TZ is not set. In tzsetwall(), > the StandardName and DaylightName member values retrieved by > GetTimeZoneInformation() are checked with isupper() and copied to the > char[] buffer used as the t

Invalid tm_zone from localtime() when TZ is not set

2016-05-19 Thread KOBAYASHI Shinji
> Warren Young wrote: > How about you just give the line of code and explain what’s wrong with it? > Then someone with checkin rights can reimplement your change from your prose > description. Thank you for your suggestion. So I try to describe the problem: Current localtime() can retur