NetBSD-Bugs archive

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

Re: lib/47602 (getwc() modifies input instead of returning EILSEQ.)



The following reply was made to PR lib/47602; it has been noted by GNATS.

From: christos%zoulas.com@localhost (Christos Zoulas)
To: yamt%mwd.biglobe.ne.jp@localhost (YAMAMOTO Takashi)
Cc: gnats-bugs%NetBSD.org@localhost, lib-bug-people%netbsd.org@localhost, 
        netbsd-bugs%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, 
yamt%NetBSD.org@localhost
Subject: Re: lib/47602 (getwc() modifies input instead of returning EILSEQ.)
Date: Mon, 20 Jan 2014 23:06:06 -0500

 On Jan 21,  2:07am, yamt%mwd.biglobe.ne.jp@localhost (YAMAMOTO Takashi) wrote:
 -- Subject: Re: lib/47602 (getwc() modifies input instead of returning EILSEQ
 
 | do you mean to expect the "c == obuf[i]" test always true?
 
 If that's not true, many things turn quickly very complicated, because
 you cannot read and write a file using getwc() and write it using putwc()
 and expect it to work. If I know that wchar_t is 2 bytes and I call 2
 getc()'s I can expect to get the next two bytes from the file I think.
 
 | while obuf[] is wchar_t for big5 locale (right?), what getwc returns
 | is wchar_t for another locale.  comparing them with "==" doesn't make
 | much sense.
 
 Right, but I am not sure if this is such a great idea.
 
 | (i'm not sure about the intention of the mixed use of getwc and getc
 | in the program, though.)
 
 I did not write this, but I think the logic is, read with getwc() and
 if that fails, skip the next 2 bytes with getc() and keep going. How
 else do you recover? Bail for the rest of the file, because two bytes
 got corrupted?
 
 christos
 


Home | Main Index | Thread Index | Old Index