From e8f8d751664bc21aa689cf8a31d1fe29c647645c Mon Sep 17 00:00:00 2001 From: "Kasimier T. Buchcik" Date: Thu, 2 Feb 2006 12:13:07 +0000 Subject: [PATCH] Fixed some bugs xmlDOMWrapReconcileNamespaces() wrt the previous addition * tree.c: Fixed some bugs xmlDOMWrapReconcileNamespaces() wrt the previous addition of the removal of redundant ns-decls. --- ChangeLog | 5 +++++ tree.c | 16 +++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62a6583b..6877ccd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Feb 2 13:11:26 CET 2006 Kasimier Buchcik + + * tree.c: Fixed some bugs xmlDOMWrapReconcileNamespaces() wrt + the previous addition of the removal of redundant ns-decls. + Wed Feb 1 17:32:25 CET 2006 Kasimier Buchcik * tree.c: Enhanced xmlDOMWrapReconcileNamespaces() to remove diff --git a/tree.c b/tree.c index 9b71b7fa..d2c70f50 100644 --- a/tree.c +++ b/tree.c @@ -8123,7 +8123,8 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, */ if (cur->nsDef != NULL) { prevns = NULL; - for (ns = cur->nsDef; ns != NULL; ns = ns->next) { + ns = cur->nsDef; + while (ns != NULL) { if (! parnsdone) { if ((elem->parent) && ((xmlNodePtr) elem->parent->doc != elem->parent)) { @@ -8160,12 +8161,12 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, goto internal_error; /* * Remove the ns-decl from the element-node. - */ + */ if (prevns) prevns->next = ns->next; else - cur->nsDef = ns->next; - goto adopt_ns; + cur->nsDef = ns->next; + goto next_ns_decl; } } } @@ -8195,14 +8196,15 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, */ if (xmlDOMWrapNSNormAddNsMapItem(&nsMap, &topmi, ns, ns, depth) == NULL) - goto internal_error; + goto internal_error; prevns = ns; +next_ns_decl: + ns = ns->next; } } if (! adoptns) goto ns_end; -adopt_ns: /* No break on purpose. */ case XML_ATTRIBUTE_NODE: /* No ns, no fun. */ @@ -8316,7 +8318,7 @@ next_sibling: internal_error: ret = -1; exit: - if (listRedund) { + if (listRedund) { for (i = 0, j = 0; i < nbRedund; i++, j += 2) { xmlFreeNs(listRedund[j]); }