1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00

trying to avoid troubles when a subtree is copied and coalesced in part

* tree.c: trying to avoid troubles when a subtree is copied
  and coalesced in part with the target tree. Should fix
  bug #67407
Daniel
This commit is contained in:
Daniel Veillard 2002-01-13 16:15:43 +00:00
parent d8224e0f7e
commit acb2bdace3
2 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,9 @@
Sun Jan 13 17:14:06 CET 2002 Daniel Veillard <daniel@veillard.com>
* tree.c: trying to avoid troubles when a subtree is copied
and coalesced in part with the target tree. Should fix
bug #67407
Sun Jan 13 16:37:15 CET 2002 Daniel Veillard <daniel@veillard.com>
* valid.c: fixed validation of attributes content of type

19
tree.c
View File

@ -2794,8 +2794,14 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
if (node->type == XML_ELEMENT_NODE)
ret->content = (void*)(long) node->content;
}
if (parent != NULL)
xmlAddChild(parent, ret);
if (parent != NULL) {
xmlNodePtr tmp;
tmp = xmlAddChild(parent, ret);
/* node could have coalesced */
if (tmp != ret)
return(tmp);
}
if (!recursive) return(ret);
if (node->nsDef != NULL)
@ -2871,7 +2877,8 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
if (ret == NULL) {
q->prev = NULL;
ret = p = q;
} else {
} else if (p != q) {
/* the test is required if xmlStaticCopyNode coalesced 2 text nodes */
p->next = q;
q->prev = p;
p = q;
@ -3856,12 +3863,14 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
switch (cur->type) {
case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE: {
xmlNodePtr last, newNode;
xmlNodePtr last, newNode, tmp;
last = cur->last;
newNode = xmlNewTextLen(content, len);
if (newNode != NULL) {
xmlAddChild(cur, newNode);
tmp = xmlAddChild(cur, newNode);
if (tmp != newNode)
return;
if ((last != NULL) && (last->next == newNode)) {
xmlTextMerge(last, newNode);
}