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: iconv(3) return value


Bruno Haible <haible@ilog.fr> writes:

> The SUSV2 manual page for iconv(3) says: "The iconv() function ...
> returns the number of non-identical conversions performed." From the
> other use of the word "identical" in the same page, this means that
> the return value is the number of characters converted in a
> non-reversible way during the call.

I agree with this point and have changed the implementation appropriately.

> When the conversion stops with *inbytesleft > 0, the second sentence does
> not specify the return value, the third sentence does not apply because
> it talks about "error" not "condition", hence the first sentence must
> determine the return value. Thus, in this case, iconv() should set
> errno _and_ return a value != (size_t)(-1).

I don't think this is what the standard is intended to mean.  Your
conclusion to use the first sentence to determine the correct value is
just a fallback solution since nothing else is set.  I think that
"conditions" are "errors" and the other (Unix certified!) 
implementations agree with that.

So, in case you want to discuss this further I think you should
request clarification from X/Open.

Thanks,

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

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