codeset problems in wprintf and wcsftime

Ken Werner ken@linux.vnet.ibm.com
Mon May 3 09:01:00 GMT 2010


On Friday, April 30, 2010 04:58:46 pm Corinna Vinschen wrote:
> On Apr 30 16:40, Ken Werner wrote:
> > On Wednesday, April 28, 2010 11:59:47 am Corinna Vinschen wrote:
> > > On Mar  2 21:47, Corinna Vinschen wrote:
> > > > On Feb 25 10:25, Corinna Vinschen wrote:
> > > > > - Add another flag __HAVE_WCHAR_LOCALE_INFO__ or something.  Used
> > > > > in
> > > > > 
> > > > >   vfwprintf and wcsftime it would use different code for targets
> > > > >   which only have the multibyte locale info and targets which have
> > > > >   also the wide char representation.
> > > > 
> > > > Attached is a patch which does that and more.  I do not intend to
> > > > apply this patch before the next Cygwin release 1.7.2 is out (which
> > > > will be RSN), but I wanted to show what I have, so you guys can make
> > > > a sanity check on the new code if you're interested in this stuff.
> > > 
> > > I've applied the patch now with a few minor changes.  This is the
> > > 
> > > (so far missing) ChangeLog entry:
> > >         Extend locale support to maintain wide char values of native
> > > 
> > > strings if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
> > > 
> > >         * libc/include/langinfo.h (enum __nl_item): New type.  Define
> > >         all native values accessible through nl_langinfo.  Define
> > >         previously existing POSIX-compatible values as macros as well.
> > 
> > Hi Corinna,
> > In libc/include/langinfo.h the closing bracket and the semicolon is part
> > of the #ifdef scope ( __HAVE_LOCALE_INFO__ and
> > __HAVE_LOCALE_INFO_EXTENDED__).
> 
> Thanks for the report.  I fixed that in CVS.

Hi, 
I noticed some further issues which I overlooked in the first place.

1)  A missing __HAVE_LOCALE_INFO__ ifdef at libc/locale/nl_langinfo.c:41 
(_NL_CTYPE_MB_CUR_MAX is ifdef'd in libc/include/langinfo.h:175 already)

2) The define ENCODING_LEN may not be visible at lctype.c:50. Should 
"setlocale.h" be included?

3) The memory where the mb_cur_max member of the lc_ctype_T struct points to 
is declared const in libc/locale/lctype.h but libc/locale/lctype.c:85 tries to 
write to *mb_cur_max.

-ken



More information about the Newlib mailing list