1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

count() was broken on Result Value Tree fixed file:/// accesses on _WIN32

* xpath.c: count() was broken on Result Value Tree
* xmlIO.c: fixed file:/// accesses on _WIN32
Daniel
This commit is contained in:
Daniel Veillard
2001-08-14 12:18:09 +00:00
parent 70ac0e3e2e
commit fe70332f7f
3 changed files with 49 additions and 9 deletions

21
xpath.c
View File

@ -5193,8 +5193,27 @@ xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) {
if ((cur == NULL) || (cur->nodesetval == NULL))
valuePush(ctxt, xmlXPathNewFloat((double) 0));
else
else if (cur->type == XPATH_NODESET) {
valuePush(ctxt, xmlXPathNewFloat((double) cur->nodesetval->nodeNr));
} else {
if ((cur->nodesetval->nodeNr != 1) ||
(cur->nodesetval->nodeTab == NULL)) {
valuePush(ctxt, xmlXPathNewFloat((double) 0));
} else {
xmlNodePtr tmp;
int i = 0;
tmp = cur->nodesetval->nodeTab[0];
if (tmp != NULL) {
tmp = tmp->children;
while (tmp != NULL) {
tmp = tmp->next;
i++;
}
}
valuePush(ctxt, xmlXPathNewFloat((double) i));
}
}
xmlXPathFreeObject(cur);
}