mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-31 02:43:06 +03:00
patch from Rob Richards for VS 2008 fix a problem with namespace nodes
* libxslt/win32config.h: patch from Rob Richards for VS 2008 * python/types.c: fix a problem with namespace nodes coming from XPath nodesets. Daniel svn path=/trunk/; revision=1458
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Thu Mar 13 09:33:21 CET 2008 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* libxslt/win32config.h: patch from Rob Richards for VS 2008
|
||||||
|
* python/types.c: fix a problem with namespace nodes coming from
|
||||||
|
XPath nodesets.
|
||||||
|
|
||||||
Mon Mar 3 09:39:31 CET 2008 Daniel Veillard <daniel@veillard.com>
|
Mon Mar 3 09:39:31 CET 2008 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* doc/xsltproc.xml doc/xsltproc.1: fix maxdepth default value
|
* doc/xsltproc.xml doc/xsltproc.1: fix maxdepth default value
|
||||||
|
@ -80,8 +80,10 @@ static int isnan (double d) {
|
|||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
#define mkdir(p,m) _mkdir(p)
|
#define mkdir(p,m) _mkdir(p)
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
|
#if _MSC_VER < 1500
|
||||||
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
|
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define HAVE_SYS_STAT_H
|
#define HAVE_SYS_STAT_H
|
||||||
#define HAVE__STAT
|
#define HAVE__STAT
|
||||||
|
@ -11,6 +11,7 @@ xmlParserInputPtr xmlNoNetExternalEntityLoader(const char *URL,
|
|||||||
* daniel@veillard.com
|
* daniel@veillard.com
|
||||||
*/
|
*/
|
||||||
#include "libxml_wrap.h"
|
#include "libxml_wrap.h"
|
||||||
|
#include <libxml/xpathInternals.h>
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libxml_intWrap(int val)
|
libxml_intWrap(int val)
|
||||||
@ -333,6 +334,24 @@ libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* libxml_xmlXPathDestructNsNode:
|
||||||
|
* cobj: xmlNsPtr namespace node
|
||||||
|
* desc: ignored string
|
||||||
|
*
|
||||||
|
* This function is called if and when a namespace node returned in
|
||||||
|
* an XPath node set is to be destroyed. That's the only kind of
|
||||||
|
* object returned in node set not directly linked to the original
|
||||||
|
* xmlDoc document, see xmlXPathNodeSetDupNs.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
libxml_xmlXPathDestructNsNode(void *cobj, void *desc ATTRIBUTE_UNUSED) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "libxml_xmlXPathDestructNsNode called %p\n", cobj);
|
||||||
|
#endif
|
||||||
|
xmlXPathNodeSetFreeNs((xmlNsPtr) cobj);
|
||||||
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
|
libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
|
||||||
{
|
{
|
||||||
@ -383,8 +402,17 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
|
|||||||
ret = PyList_New(obj->nodesetval->nodeNr);
|
ret = PyList_New(obj->nodesetval->nodeNr);
|
||||||
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
|
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
|
||||||
node = obj->nodesetval->nodeTab[i];
|
node = obj->nodesetval->nodeTab[i];
|
||||||
/* TODO: try to cast directly to the proper node type */
|
if (node->type == XML_NAMESPACE_DECL) {
|
||||||
PyList_SetItem(ret, i, libxml_xmlNodePtrWrap(node));
|
PyObject *ns =
|
||||||
|
PyCObject_FromVoidPtrAndDesc((void *) node,
|
||||||
|
(char *) "xmlNsPtr",
|
||||||
|
libxml_xmlXPathDestructNsNode);
|
||||||
|
PyList_SetItem(ret, i, ns);
|
||||||
|
/* make sure the xmlNsPtr is not destroyed now */
|
||||||
|
obj->nodesetval->nodeTab[i] = NULL;
|
||||||
|
} else {
|
||||||
|
PyList_SetItem(ret, i, libxml_xmlNodePtrWrap(node));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user