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, 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.

>> > 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.

>> Your version broke the case of stateful encodings.

> In that case, mbsrtowcs would be just as broken?

If mbsrtowcs() resets the state in the case of stateful encodings,
yes, it's broken.  Although I don't think current mbsrtowcs() is doing so.
What part of the code are you mentioning?

>> I think using nozaki-san's version is better, because he knows
>> more detail of encodings (I guess you don't know stateful encodings
>> at all), and the detail of citrus implementation.

> I am not really attached to my patch, but I do want to remind you that
> mbsrtowcs and mbsnrtowcs (just like wcsrtombs/wcsnrtombs) should be
> equivalent as long as the input is completely processed.

That's right.

> I don't think nozaki-san's version provides that.

Nozaki-san's version is correct.
If it's different from what mbsrtowcs() does currently,
current mbsrtowcs() has a bug.
-- 
soda


Home | Main Index | Thread Index | Old Index