diff options
-rw-r--r-- | result/XPath/expr/functions | 4 | ||||
-rw-r--r-- | test/XPath/expr/functions | 1 | ||||
-rw-r--r-- | xpath.c | 6 |
3 files changed, 8 insertions, 3 deletions
diff --git a/result/XPath/expr/functions b/result/XPath/expr/functions index e09eb4a4..4ff9c586 100644 --- a/result/XPath/expr/functions +++ b/result/XPath/expr/functions @@ -20,6 +20,10 @@ Expression: -number('abc') Object is a number : NaN ======================== +Expression: number('-') +Object is a number : NaN + +======================== Expression: floor(0.1) Object is a number : 0 diff --git a/test/XPath/expr/functions b/test/XPath/expr/functions index 00b9461f..6008a07f 100644 --- a/test/XPath/expr/functions +++ b/test/XPath/expr/functions @@ -3,6 +3,7 @@ false() number("1.5") number('abc') -number('abc') +number('-') floor(0.1) floor(-0.1) floor(-0) @@ -10001,13 +10001,13 @@ xmlXPathStringEvalNumber(const xmlChar *str) { #endif if (cur == NULL) return(0); while (IS_BLANK_CH(*cur)) cur++; - if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) { - return(xmlXPathNAN); - } if (*cur == '-') { isneg = 1; cur++; } + if ((*cur != '.') && ((*cur < '0') || (*cur > '9'))) { + return(xmlXPathNAN); + } #ifdef __GNUC__ /* |