This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: incorrect wcsrtombs
- To: Bruno Haible <haible at ilog dot fr>
- Subject: Re: incorrect wcsrtombs
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 27 Apr 2000 00:15:01 -0700
- Cc: libc-alpha at sourceware dot cygnus dot com
- References: <200004241155.NAA07854@oberkampf.ilog.fr>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
Bruno Haible <haible@ilog.fr> writes:
> In glibc-2000-04-12, there is a bug in function wcsrtombs (and also
> wcsnrtombs): The test program
I do not agree with this.
> /* Expected output:
>
> wcsrtombs(dst,&src,1,&state) -> 1, src = srcbuf+1, dst = buf+1
> wcsrtombs(dst,&src,1,&state) -> 1, src = srcbuf+2, dst = buf+2
> wcsrtombs(dst,&src,3,&state) -> 3, src = srcbuf+3, dst = buf+5
> wcsrtombs(dst,&src,1,&state) -> 1, src = srcbuf+3, dst = buf+6
I expect
wcsrtombs(dst,&src,1,&state) -> 1, src = srcbuf+1, dst = buf+1
wcsrtombs(dst,&src,1,&state) -> 0, src = srcbuf+1, dst = buf+2
wcsrtombs(dst,&src,3,&state) -> 3, src = srcbuf+2, dst = buf+4
wcsrtombs(dst,&src,1,&state) -> 0, src = srcbuf+2, dst = buf+4
There is no reason to store anything in the state. What would have to
be stored there is an incomplete input character but neither the
standard nor the rationel says so. And I don't think it makes any
sense.
The above result should allow writing programs with sufficient control
and information about the conversion carried out by the conversion
functions.
The implementation in glibc corresponds with my interpretation of the
standard.
I've added a slightly changed version of your test program to the test
suite. Thanks,
--
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------