GNOME Bugzilla – Bug 325647
Conflict in declaration/return value of xmlParserFindNodeInfoIndex
Last modified: 2017-06-14 11:17:28 UTC
Please describe the problem: In module parserInternals.c, function xmlParserFindNodeInfoIndex is defined to return an unsigned long value. A null pointer check in the beginning of the code returns -1 if a null pointer is received. My recommendation is that we redefine the function to return type int or long. Steps to reproduce: Here is the source code: unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, const xmlNodePtr node) { unsigned long upper, lower, middle; int found = 0; if ((seq == NULL) || (node == NULL)) return (-1); Actual results: The Microtec C compiler I am using throws a warning "integer conversion resulted in a change of sign". Expected results: Does this happen every time? Other information:
Compiler warnings should have been fixed in 2005 with the following commit: https://git.gnome.org/browse/libxml2/commit/?id=6a0baa0cd89b402cdfbb63e9c40f291ebd191f1d -1 will be cast to ULONG_MAX. This seems dangerous, but the callers handle this correctly.