mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-25 10:50:08 +03:00
xpath: number('-') should return NaN
Fixes https://gitlab.gnome.org/GNOME/libxslt/-/issues/81
This commit is contained in:
parent
bbb2b8f136
commit
608c65bb8e
@ -19,6 +19,10 @@ Object is a number : NaN
|
||||
Expression: -number('abc')
|
||||
Object is a number : NaN
|
||||
|
||||
========================
|
||||
Expression: number('-')
|
||||
Object is a number : NaN
|
||||
|
||||
========================
|
||||
Expression: floor(0.1)
|
||||
Object is a number : 0
|
||||
|
@ -3,6 +3,7 @@ false()
|
||||
number("1.5")
|
||||
number('abc')
|
||||
-number('abc')
|
||||
number('-')
|
||||
floor(0.1)
|
||||
floor(-0.1)
|
||||
floor(-0)
|
||||
|
6
xpath.c
6
xpath.c
@ -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__
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user