After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 153937 - Inconsistency between documentation and code
Inconsistency between documentation and code
Status: RESOLVED FIXED
Product: libxml
Classification: Deprecated
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2004-09-28 12:02 UTC by Stuart Dootson
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stuart Dootson 2004-09-28 12:02:26 UTC
The specification for xmlCharEncodingOutputFunc (module encoding) says that the
function will return 'the number of bytes written, -1 if lack of space, or -2 if
the transcoding failed'. UTF8ToUTF16LE (which is the implementation of that
interface for the UTF16LE encoding) appears to return 0 on success (appears to
be confirmed by an examination of the 2.6.13 source code).

Having said that, several (I didn't check them all) of the converter
functions look like they return 0 on success - is it the documentation
that's incorrect?
Comment 1 Daniel Veillard 2004-10-31 15:36:54 UTC
Okay, I fixed this in CVS by making all the conversion functions return
the number of bytes converted. I'm not 100% sure this won't introduce
errors in existing code though, so I may revert this in case of problems.

Daniel
Comment 2 Felix Janssen 2004-11-21 16:30:11 UTC
The documentation of (some of the) implementations of xmlCharEncodingOutputFunc
is no longer consistent as of 2.6.16, since it says that the implementations
will return 0 on success.

Furthermore this fix is not backwards compatible with older versions, so
software that worked with < 2.6.16 could not work anymore..
Comment 3 Daniel Veillard 2004-11-21 23:11:08 UTC
Well I knew it could be a problem. Tell me the function for which the 
comment was not appropriate, I really tried to check that they said the
right thing. Seems to me if the implementation was not consistent with
the documentation this should be reported as a bug and fixed, especially
when all functions are supposed to work the same because they all follow
the same pattern.

Daniel
Comment 4 Stuart Dootson 2004-11-26 07:07:04 UTC
FYI - isolat1ToUTF8 and UTF8Toisolat1 (the only documented encoding functions)
say they return 0 on success. xmlCharEncodingOutputFunc says it returns the
number of bytes on success. isolat1ToUTF8 and UTF8Toisolat1 are implementations
of xmlCharEncodingOutputFunc. The three should be self-consistent somehow. Don't
really care how.