Skip to content
Browse files

Put the required patches into the source tree.

--HG--
extra : convert_revision : svn%3Aeb92df5b-a40c-0410-b02c-bf52feaaa166/CellML_DOM_API/trunk%40106
  • Loading branch information...
1 parent 8dc6afc commit c8bf84c33d4ed279659992c606bcec202e319d27 amil082 committed Mar 20, 2006
Showing with 339 additions and 0 deletions.
  1. +148 −0 patches/cellml-gdome2-0.8.1.patch
  2. +191 −0 patches/cellml-libxml2-2.6.23.patch
View
148 patches/cellml-gdome2-0.8.1.patch
@@ -0,0 +1,148 @@
+diff -udr gdome2-0.8.1/libgdome/events/gdome-evt-util.h gdome2-0.8.1-myfixes-eventfix/libgdome/events/gdome-evt-util.h
+--- gdome2-0.8.1/libgdome/events/gdome-evt-util.h 2006-03-16 10:18:12.454941751 +1300
++++ gdome2-0.8.1-myfixes-eventfix/libgdome/events/gdome-evt-util.h 2006-03-16 16:32:45.960405167 +1300
+@@ -32,8 +32,8 @@
+ #define GDOME_XML_IS_EVNTL(evntl) 1
+
+ #define GDOME_XML_IS_EVNT(evnt) \
+-((Gdome_evt_Event *) evnt)->etype == GDOME_BASE_EVENT || \
+-((Gdome_evt_Event *) evnt)->etype == GDOME_MUTATION_EVENT
++(((Gdome_evt_Event *) evnt)->etype == GDOME_BASE_EVENT || \
++ ((Gdome_evt_Event *) evnt)->etype == GDOME_MUTATION_EVENT)
+
+ #define GDOME_XML_IS_MEVNT(mevnt) \
+ ((Gdome_evt_Event *) mevnt)->etype == GDOME_MUTATION_EVENT
+diff -udr gdome2-0.8.1/libgdome/gdomecore/gdome-xml-element.c gdome2-0.8.1-myfixes-eventfix/libgdome/gdomecore/gdome-xml-element.c
+--- gdome2-0.8.1/libgdome/gdomecore/gdome-xml-element.c 2003-10-04 03:53:33.000000000 +1200
++++ gdome2-0.8.1-myfixes-eventfix/libgdome/gdomecore/gdome-xml-element.c 2006-03-16 16:32:46.038393561 +1300
+@@ -502,7 +502,6 @@
+
+ g_return_val_if_fail (priv != NULL, NULL);
+ g_return_val_if_fail (GDOME_XML_IS_EL (priv), NULL);
+- g_return_val_if_fail (namespaceURI != NULL, NULL);
+ g_return_val_if_fail (localName != NULL, NULL);
+ g_return_val_if_fail (exc != NULL, NULL);
+
+@@ -529,15 +528,16 @@
+
+ g_return_val_if_fail (priv != NULL, NULL);
+ g_return_val_if_fail (GDOME_XML_IS_EL (priv), NULL);
+- g_return_val_if_fail (namespaceURI != NULL, NULL);
+ g_return_val_if_fail (localName != NULL, NULL);
+ g_return_val_if_fail (exc != NULL, NULL);
+
+- value = xmlGetNsProp (priv->n, localName->str, namespaceURI->str);
++ value = xmlGetNsProp (priv->n, localName->str,
++ namespaceURI ? namespaceURI->str : NULL);
+
+ if (value != NULL)
+ return gdome_xml_str_mkref_own (value);
+- else if (xmlStrEqual(namespaceURI->str, GDOME_XMLNS_NAMESPACE)) {
++ else if (namespaceURI &&
++ xmlStrEqual(namespaceURI->str, GDOME_XMLNS_NAMESPACE)) {
+ ns = gdome_xmlGetNsDecl(priv->n, localName->str);
+ if (ns != NULL)
+ return gdome_xml_str_mkref_dup ((gchar *)ns->href);
+@@ -578,7 +578,6 @@
+
+ g_return_if_fail (priv != NULL);
+ g_return_if_fail (GDOME_XML_IS_EL (priv));
+- g_return_if_fail (namespaceURI != NULL);
+ g_return_if_fail (qualifiedName != NULL);
+ g_return_if_fail (value != NULL);
+ g_return_if_fail (exc != NULL);
+@@ -596,15 +595,15 @@
+ } else {
+ prefix = g_strdup(strs[0]);
+ localName = g_strdup(strs[1]);
+- if ((!strcmp (prefix, "xml") && strcmp(namespaceURI->str, "http://www.w3.org/XML/1998/namespace"))) {
++ if ((!strcmp (prefix, "xml") &&
++ (!namespaceURI ||
++ strcmp(namespaceURI->str, "http://www.w3.org/XML/1998/namespace")))) {
+ *exc = GDOME_NAMESPACE_ERR;
+ }
+ }
+ } else if (!strs[1] && namespaceURI != NULL) { /* there's no ':' */
+ prefix = g_strdup("");
+ localName = g_strdup(strs[0]);
+- if (strcmp (localName, "xmlns"))
+- *exc = GDOME_NAMESPACE_ERR;
+ } else if (strs[0] && strs[1] && strs[2]) { /* there are more than one ':' */
+ *exc = GDOME_NAMESPACE_ERR;
+ }
+@@ -623,13 +622,20 @@
+ (xmlChar *)value->str);
+ } else {
+ xmlDoc * doc = gdome_xmlGetOwner(priv->n);
+- ns = xmlSearchNsByHref (doc, priv->n, (xmlChar *)namespaceURI->str);
+- if(ns == NULL || !xmlStrEqual((xmlChar *)prefix, ns->prefix)) {
+- ns = gdome_xmlNewNs (doc, namespaceURI->str, prefix);
++ if (namespaceURI != NULL)
++ {
++ ns = xmlSearchNsByHref (doc, priv->n, (xmlChar *)namespaceURI->str);
++ if(ns == NULL || !xmlStrEqual((xmlChar *)prefix, ns->prefix)) {
++ ns = gdome_xmlNewNs (doc, namespaceURI->str, prefix);
++ }
++ prevValue = gdome_xml_str_mkref_own (xmlGetNsProp (priv->n,
++ (xmlChar *)localName,
++ namespaceURI ? (xmlChar *)namespaceURI->str : NULL));
++ }
++ else
++ {
++ ns = NULL;
+ }
+- prevValue = gdome_xml_str_mkref_own (xmlGetNsProp (priv->n,
+- (xmlChar *)localName,
+- (xmlChar *)namespaceURI->str));
+ attr = gdome_xml_n_mkref ((xmlNode *)xmlSetNsProp(priv->n, ns,
+ (xmlChar *)localName,
+ (xmlChar *)value->str));
+@@ -708,7 +714,6 @@
+
+ g_return_if_fail (priv != NULL);
+ g_return_if_fail (GDOME_XML_IS_EL (priv));
+- g_return_if_fail (namespaceURI != NULL);
+ g_return_if_fail (localName != NULL);
+ g_return_if_fail (exc != NULL);
+
+@@ -746,7 +751,6 @@
+
+ g_return_val_if_fail (priv != NULL, NULL);
+ g_return_val_if_fail (GDOME_XML_IS_EL (priv), NULL);
+- g_return_val_if_fail (namespaceURI != NULL, NULL);
+ g_return_val_if_fail (localName != NULL, NULL);
+ g_return_val_if_fail (exc != NULL, NULL);
+
+@@ -863,16 +867,15 @@
+
+ g_return_val_if_fail (priv != NULL, 0);
+ g_return_val_if_fail (GDOME_XML_IS_EL (priv), 0);
+- g_return_val_if_fail (namespaceURI != NULL, 0);
+ g_return_val_if_fail (localName != NULL, 0);
+ g_return_val_if_fail (exc != NULL, 0);
+
+- val = xmlGetNsProp (priv->n, localName->str, namespaceURI->str);
++ val = xmlGetNsProp (priv->n, localName->str, namespaceURI ? namespaceURI->str : NULL);
+
+ if (val != NULL) {
+ xmlFree(val);
+ return 1;
+- } else if (xmlStrEqual(namespaceURI->str, GDOME_XMLNS_NAMESPACE)) {
++ } else if (namespaceURI && xmlStrEqual(namespaceURI->str, GDOME_XMLNS_NAMESPACE)) {
+ ns = gdome_xmlGetNsDecl(priv->n, localName->str);
+ if (ns != NULL)
+ return 1;
+diff -udr gdome2-0.8.1/libgdome/gdomecore/gdome-xml-xmlutil.c gdome2-0.8.1-myfixes-eventfix/libgdome/gdomecore/gdome-xml-xmlutil.c
+--- gdome2-0.8.1/libgdome/gdomecore/gdome-xml-xmlutil.c 2003-10-04 03:53:33.000000000 +1200
++++ gdome2-0.8.1-myfixes-eventfix/libgdome/gdomecore/gdome-xml-xmlutil.c 2006-03-16 16:32:46.042392966 +1300
+@@ -1090,8 +1090,8 @@
+ while (cur != NULL &&
+ ((cur->prefix == NULL && prefix != NULL) ||
+ (cur->prefix != NULL && prefix == NULL) ||
+- !xmlStrEqual (cur->prefix, prefix)) &&
+- !xmlStrEqual (cur->href, href))
++ (!xmlStrEqual (cur->prefix, prefix) ||
++ !xmlStrEqual (cur->href, href))))
+ cur = cur->next;
+
+ if (cur == NULL) {
View
191 patches/cellml-libxml2-2.6.23.patch
@@ -0,0 +1,191 @@
+diff -udr libxml2-2.6.23-pristine/include/libxml/tree.h libxml2-2.6.23/include/libxml/tree.h
+--- libxml2-2.6.23-pristine/include/libxml/tree.h 2005-08-22 21:14:24.000000000 +1200
++++ libxml2-2.6.23/include/libxml/tree.h 2006-02-22 10:55:43.363837631 +1300
+@@ -871,6 +871,12 @@
+ xmlSearchNsByHref (xmlDocPtr doc,
+ xmlNodePtr node,
+ const xmlChar *href);
++XMLPUBFUN xmlNsPtr XMLCALL
++ xmlSearchNsByHrefAndPrefix (xmlDocPtr doc,
++ xmlNodePtr node,
++ const xmlChar *prefix,
++ const xmlChar *href);
++
+ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED)
+ XMLPUBFUN xmlNsPtr * XMLCALL
+ xmlGetNsList (xmlDocPtr doc,
+diff -udr libxml2-2.6.23-pristine/include/libxml/xmlversion.h libxml2-2.6.23/include/libxml/xmlversion.h
+--- libxml2-2.6.23-pristine/include/libxml/xmlversion.h 2006-01-06 04:39:31.000000000 +1300
++++ libxml2-2.6.23/include/libxml/xmlversion.h 2006-02-20 13:29:20.272765076 +1300
+@@ -50,7 +50,7 @@
+ *
+ * extra version information, used to show a CVS compilation
+ */
+-#define LIBXML_VERSION_EXTRA "-CVS2717"
++#define LIBXML_VERSION_EXTRA ""
+
+ /**
+ * LIBXML_TEST_VERSION:
+@@ -290,7 +290,7 @@
+ *
+ * Whether the memory debugging is configured in
+ */
+-#if 1
++#if 0
+ #define DEBUG_MEMORY_LOCATION
+ #endif
+
+@@ -299,7 +299,7 @@
+ *
+ * Whether the runtime debugging is configured in
+ */
+-#if 1
++#if 0
+ #define LIBXML_DEBUG_RUNTIME
+ #endif
+
+diff -udr libxml2-2.6.23-pristine/tree.c libxml2-2.6.23/tree.c
+--- libxml2-2.6.23-pristine/tree.c 2005-12-23 03:57:41.000000000 +1300
++++ libxml2-2.6.23/tree.c 2006-02-22 10:58:39.479674117 +1300
+@@ -3872,20 +3872,33 @@
+ if (node->ns != NULL) {
+ xmlNsPtr ns;
+
+- ns = xmlSearchNs(doc, ret, node->ns->prefix);
++ if (node->ns->prefix == NULL)
++ ns = NULL;
++ else
++ {
++ ns = xmlSearchNsByHrefAndPrefix(doc, ret, node->ns->prefix,
++ node->ns->href);
++ }
+ if (ns == NULL) {
+ /*
+ * Humm, we are copying an element whose namespace is defined
+ * out of the new tree scope. Search it in the original tree
+ * and add it at the top of the new tree
+ */
+- ns = xmlSearchNs(node->doc, node, node->ns->prefix);
++ ns = xmlSearchNsByHrefAndPrefix(node->doc, node, node->ns->prefix,
++ node->ns->href);
+ if (ns != NULL) {
+ xmlNodePtr root = ret;
+
+- while (root->parent != NULL) root = root->parent;
++ while (root->parent != NULL &&
++ root->parent->type == XML_ELEMENT_NODE)
++ root = root->parent;
+ ret->ns = xmlNewNs(root, ns->href, ns->prefix);
+ }
++ else
++ {
++ ret->ns = xmlNewNs(ret, node->ns->href, node->ns->prefix);
++ }
+ } else {
+ /*
+ * reference the existing namespace definition in our own tree.
+@@ -5474,6 +5487,104 @@
+ * Returns the namespace pointer or NULL.
+ */
+ xmlNsPtr
++xmlSearchNsByHrefAndPrefix(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace, const xmlChar *href) {
++
++ xmlNsPtr cur;
++ xmlNodePtr orig = node;
++
++ if (node == NULL) return(NULL);
++ if ((nameSpace != NULL) &&
++ (xmlStrEqual(nameSpace, (const xmlChar *)"xml"))) {
++ if ((doc == NULL) && (node->type == XML_ELEMENT_NODE)) {
++ /*
++ * The XML-1.0 namespace is normally held on the root
++ * element. In this case exceptionally create it on the
++ * node element.
++ */
++ cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
++ if (cur == NULL) {
++ xmlTreeErrMemory("searching namespace");
++ return(NULL);
++ }
++ memset(cur, 0, sizeof(xmlNs));
++ cur->type = XML_LOCAL_NAMESPACE;
++ cur->href = xmlStrdup(XML_XML_NAMESPACE);
++ cur->prefix = xmlStrdup((const xmlChar *)"xml");
++ cur->next = node->nsDef;
++ node->nsDef = cur;
++ return(cur);
++ }
++ if (doc->oldNs == NULL) {
++ /*
++ * Allocate a new Namespace and fill the fields.
++ */
++ doc->oldNs = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
++ if (doc->oldNs == NULL) {
++ xmlTreeErrMemory("searching namespace");
++ return(NULL);
++ }
++ memset(doc->oldNs, 0, sizeof(xmlNs));
++ doc->oldNs->type = XML_LOCAL_NAMESPACE;
++
++ doc->oldNs->href = xmlStrdup(XML_XML_NAMESPACE);
++ doc->oldNs->prefix = xmlStrdup((const xmlChar *)"xml");
++ }
++ return(doc->oldNs);
++ }
++ while (node != NULL) {
++ if ((node->type == XML_ENTITY_REF_NODE) ||
++ (node->type == XML_ENTITY_NODE) ||
++ (node->type == XML_ENTITY_DECL))
++ return(NULL);
++ if (node->type == XML_ELEMENT_NODE) {
++ cur = node->nsDef;
++ while (cur != NULL) {
++ if ((cur->prefix == NULL) && (nameSpace == NULL) &&
++ (cur->href != NULL) && xmlStrEqual(cur->href, href))
++ return(cur);
++ if ((cur->prefix != NULL) && (nameSpace != NULL) &&
++ (cur->href != NULL) && (href != NULL) &&
++ (xmlStrEqual(cur->prefix, nameSpace)) &&
++ (xmlStrEqual(cur->href, href)))
++ return(cur);
++ cur = cur->next;
++ }
++ if (orig != node) {
++ cur = node->ns;
++ if (cur != NULL) {
++ if ((cur->prefix == NULL) && (nameSpace == NULL) &&
++ (cur->href != NULL) && xmlStrEqual(cur->href, href))
++ return(cur);
++ if ((cur->prefix != NULL) && (nameSpace != NULL) &&
++ (cur->href != NULL) &&
++ (xmlStrEqual(cur->prefix, nameSpace) &&
++ (xmlStrEqual(cur->href, href))))
++ return(cur);
++ }
++ }
++ }
++ node = node->parent;
++ }
++ return(NULL);
++}
++
++/**
++ * xmlSearchNs:
++ * @doc: the document
++ * @node: the current node
++ * @nameSpace: the namespace prefix
++ *
++ * Search a Ns registered under a given name space for a document.
++ * recurse on the parents until it finds the defined namespace
++ * or return NULL otherwise.
++ * @nameSpace can be NULL, this is a search for the default namespace.
++ * We don't allow to cross entities boundaries. If you don't declare
++ * the namespace within those you will be in troubles !!! A warning
++ * is generated to cover this case.
++ *
++ * Returns the namespace pointer or NULL.
++ */
++xmlNsPtr
+ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
+
+ xmlNsPtr cur;

0 comments on commit c8bf84c

Please sign in to comment.
Something went wrong with that request. Please try again.