tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] Support for mbsnrtowcs and wcsnrtomb



On Fri, Apr 26, 2013 at 06:26:43PM +0900, SODA Noriyuki wrote:
> >>>>> On Fri, 26 Apr 2013 09:10:52 +0200,
>       Joerg Sonnenberger <joerg%britannica.bec.de@localhost> said:
> 
> > On Fri, Apr 26, 2013 at 10:40:24AM +0900, SODA Noriyuki wrote:
> >> We should wait for the nozaki-san's recovery about other problems,
> >> at very least.
> 
> > I don't mind.
> 
> You mean you will wait for the recovery?
> That's great.

It would be nice to get a review for the newlocale() patch as a bunch of
broken high-profile applications can't deal with the existance of *_l
without newlocale(), but mbsnrtowcs is not that critical.

> >> > I'm also not sure if it is really correct, e.g. the (not) resetting
> >> > of mbstate at the end of input.
> >> 
> >> Nozaki-san's implementation is corrent.
> 
> > I don't think it is. mbsnrtowcs is supposed to reset the the state (just
> > like mbsrtowcs does) when it reaches the end of input.
> 
> It seems you are misunderstanding the existing code.
> As you said, mbsnrtowcs() should behave just like mbsrtowcs() does.
> And mbsrtowcs() DOES NOT RESET the state.
> See lib/libc/citrus/modules/citrus_iso2022.c for example.

Check the code in citrus_ctype_template.h for mbsrtowcs, specifically,
the call to _FUNCNAME(init_state). That is required:

"If conversion stopped due to reaching a terminating null character, and
if dst is not a null pointer, the resulting state described shall be the
initial conversion state"

and this part is missing from Nozaki-san's implementation?

Joerg


Home | Main Index | Thread Index | Old Index