This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: incorrect wcsrtombs


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]