more patches from Richard Jinks Updated tests though they show a
* trionan.c trionan.h xpath.c: more patches from Richard Jinks
* test/XPath/expr/compare test/XPath/expr/equality
test/XPath/expr/floats test/XPath/expr/functions
test/XPath/expr/strings result/XPath/expr/compare
result/XPath/expr/equality result/XPath/expr/floats
result/XPath/expr/functions result/XPath/expr/strings: Updated
tests though they show a divergence on Linux
Daniel
diff --git a/xpath.c b/xpath.c
index bbb02f6..e3f89ce 100644
--- a/xpath.c
+++ b/xpath.c
@@ -155,9 +155,9 @@
*
* Returns 1 if the value is Negative, 0 if positive
*/
-int
+static int
xmlXPathGetSign(double val) {
- return(trio_get_sign(val));
+ return(trio_signbit(val));
}
@@ -1275,8 +1275,8 @@
* Formats an error message.
*/
void
-xmlXPatherror(xmlXPathParserContextPtr ctxt, const char *file,
- int line, int no) {
+xmlXPatherror(xmlXPathParserContextPtr ctxt, ATTRIBUTE_UNUSED const char *file,
+ ATTRIBUTE_UNUSED int line, int no) {
int n;
const xmlChar *cur;
const xmlChar *base;
@@ -4472,7 +4472,12 @@
arg2 = valuePop(ctxt);
/* no break on purpose */
case XPATH_NUMBER:
- ret = (arg1->floatval == arg2->floatval);
+ /* Hand checking NaNs for VC6++'s benefit... */
+ if (xmlXPathIsNaN(arg1->floatval) || xmlXPathIsNaN(arg2->floatval)) {
+ ret = 0;
+ } else {
+ ret = (arg1->floatval == arg2->floatval);
+ }
break;
case XPATH_USERS:
case XPATH_POINT:
@@ -4508,7 +4513,12 @@
valuePush(ctxt, arg1);
xmlXPathNumberFunction(ctxt, 1);
arg1 = valuePop(ctxt);
- ret = (arg1->floatval == arg2->floatval);
+ /* Hand checking NaNs for VC6++'s benefit... */
+ if (xmlXPathIsNaN(arg1->floatval) || xmlXPathIsNaN(arg2->floatval)) {
+ ret = 0;
+ } else {
+ ret = (arg1->floatval == arg2->floatval);
+ }
break;
case XPATH_USERS:
case XPATH_POINT:
@@ -4610,14 +4620,19 @@
* Add tests for infinity and nan
* => feedback on 3.4 for Inf and NaN
*/
- if (inf && strict)
- ret = (arg1->floatval < arg2->floatval);
- else if (inf && !strict)
- ret = (arg1->floatval <= arg2->floatval);
- else if (!inf && strict)
- ret = (arg1->floatval > arg2->floatval);
- else if (!inf && !strict)
- ret = (arg1->floatval >= arg2->floatval);
+ /* Hand checking NaNs for VC++6's benefit... */
+ if (xmlXPathIsNaN(arg1->floatval) || xmlXPathIsNaN(arg2->floatval)) {
+ ret=0;
+ } else {
+ if (inf && strict)
+ ret = (arg1->floatval < arg2->floatval);
+ else if (inf && !strict)
+ ret = (arg1->floatval <= arg2->floatval);
+ else if (!inf && strict)
+ ret = (arg1->floatval > arg2->floatval);
+ else if (!inf && !strict)
+ ret = (arg1->floatval >= arg2->floatval);
+ }
xmlXPathFreeObject(arg1);
xmlXPathFreeObject(arg2);
return(ret);