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:
@ -1,3 +1,8 @@
|
|||||||
|
Tue Aug 14 14:16:24 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xpath.c: count() was broken on Result Value Tree
|
||||||
|
* xmlIO.c: fixed file:/// accesses on _WIN32
|
||||||
|
|
||||||
Mon Aug 13 13:22:53 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
Mon Aug 13 13:22:53 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* libxml.m4: s/LIBXML_VERSION_NUMBER/LIBXML_VERSION/ seems the
|
* libxml.m4: s/LIBXML_VERSION_NUMBER/LIBXML_VERSION/ seems the
|
||||||
|
32
xmlIO.c
32
xmlIO.c
@ -244,9 +244,13 @@ xmlFileOpen (const char *filename) {
|
|||||||
|
|
||||||
if (!strncmp(filename, "file://localhost", 16))
|
if (!strncmp(filename, "file://localhost", 16))
|
||||||
path = &filename[16];
|
path = &filename[16];
|
||||||
else if (!strncmp(filename, "file:///", 8))
|
else if (!strncmp(filename, "file:///", 8)) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
path = &filename[8];
|
||||||
|
#else
|
||||||
path = &filename[7];
|
path = &filename[7];
|
||||||
else
|
#endif
|
||||||
|
} else
|
||||||
path = filename;
|
path = filename;
|
||||||
|
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
@ -283,9 +287,13 @@ xmlFileOpenW (const char *filename) {
|
|||||||
|
|
||||||
if (!strncmp(filename, "file://localhost", 16))
|
if (!strncmp(filename, "file://localhost", 16))
|
||||||
path = &filename[16];
|
path = &filename[16];
|
||||||
else if (!strncmp(filename, "file:///", 8))
|
else if (!strncmp(filename, "file:///", 8)) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
path = &filename[8];
|
||||||
|
#else
|
||||||
path = &filename[7];
|
path = &filename[7];
|
||||||
else
|
#endif
|
||||||
|
} else
|
||||||
path = filename;
|
path = filename;
|
||||||
|
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
@ -387,9 +395,13 @@ xmlGzfileOpen (const char *filename) {
|
|||||||
|
|
||||||
if (!strncmp(filename, "file://localhost", 16))
|
if (!strncmp(filename, "file://localhost", 16))
|
||||||
path = &filename[16];
|
path = &filename[16];
|
||||||
else if (!strncmp(filename, "file:///", 8))
|
else if (!strncmp(filename, "file:///", 8)) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
path = &filename[8];
|
||||||
|
#else
|
||||||
path = &filename[7];
|
path = &filename[7];
|
||||||
else
|
#endif
|
||||||
|
} else
|
||||||
path = filename;
|
path = filename;
|
||||||
|
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
@ -425,9 +437,13 @@ xmlGzfileOpenW (const char *filename, int compression) {
|
|||||||
|
|
||||||
if (!strncmp(filename, "file://localhost", 16))
|
if (!strncmp(filename, "file://localhost", 16))
|
||||||
path = &filename[16];
|
path = &filename[16];
|
||||||
else if (!strncmp(filename, "file:///", 8))
|
else if (!strncmp(filename, "file:///", 8)) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
path = &filename[8];
|
||||||
|
#else
|
||||||
path = &filename[7];
|
path = &filename[7];
|
||||||
else
|
#endif
|
||||||
|
} else
|
||||||
path = filename;
|
path = filename;
|
||||||
|
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
|
21
xpath.c
21
xpath.c
@ -5193,8 +5193,27 @@ xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
|||||||
|
|
||||||
if ((cur == NULL) || (cur->nodesetval == NULL))
|
if ((cur == NULL) || (cur->nodesetval == NULL))
|
||||||
valuePush(ctxt, xmlXPathNewFloat((double) 0));
|
valuePush(ctxt, xmlXPathNewFloat((double) 0));
|
||||||
else
|
else if (cur->type == XPATH_NODESET) {
|
||||||
valuePush(ctxt, xmlXPathNewFloat((double) cur->nodesetval->nodeNr));
|
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);
|
xmlXPathFreeObject(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user