mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-05 19:35:54 +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:
@@ -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>
|
Sun Jan 13 16:37:15 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* valid.c: fixed validation of attributes content of type
|
* valid.c: fixed validation of attributes content of type
|
||||||
|
19
tree.c
19
tree.c
@@ -2794,8 +2794,14 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
|
|||||||
if (node->type == XML_ELEMENT_NODE)
|
if (node->type == XML_ELEMENT_NODE)
|
||||||
ret->content = (void*)(long) node->content;
|
ret->content = (void*)(long) node->content;
|
||||||
}
|
}
|
||||||
if (parent != NULL)
|
if (parent != NULL) {
|
||||||
xmlAddChild(parent, ret);
|
xmlNodePtr tmp;
|
||||||
|
|
||||||
|
tmp = xmlAddChild(parent, ret);
|
||||||
|
/* node could have coalesced */
|
||||||
|
if (tmp != ret)
|
||||||
|
return(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
if (!recursive) return(ret);
|
if (!recursive) return(ret);
|
||||||
if (node->nsDef != NULL)
|
if (node->nsDef != NULL)
|
||||||
@@ -2871,7 +2877,8 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
|
|||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
q->prev = NULL;
|
q->prev = NULL;
|
||||||
ret = p = q;
|
ret = p = q;
|
||||||
} else {
|
} else if (p != q) {
|
||||||
|
/* the test is required if xmlStaticCopyNode coalesced 2 text nodes */
|
||||||
p->next = q;
|
p->next = q;
|
||||||
q->prev = p;
|
q->prev = p;
|
||||||
p = q;
|
p = q;
|
||||||
@@ -3856,12 +3863,14 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
|
|||||||
switch (cur->type) {
|
switch (cur->type) {
|
||||||
case XML_DOCUMENT_FRAG_NODE:
|
case XML_DOCUMENT_FRAG_NODE:
|
||||||
case XML_ELEMENT_NODE: {
|
case XML_ELEMENT_NODE: {
|
||||||
xmlNodePtr last, newNode;
|
xmlNodePtr last, newNode, tmp;
|
||||||
|
|
||||||
last = cur->last;
|
last = cur->last;
|
||||||
newNode = xmlNewTextLen(content, len);
|
newNode = xmlNewTextLen(content, len);
|
||||||
if (newNode != NULL) {
|
if (newNode != NULL) {
|
||||||
xmlAddChild(cur, newNode);
|
tmp = xmlAddChild(cur, newNode);
|
||||||
|
if (tmp != newNode)
|
||||||
|
return;
|
||||||
if ((last != NULL) && (last->next == newNode)) {
|
if ((last != NULL) && (last->next == newNode)) {
|
||||||
xmlTextMerge(last, newNode);
|
xmlTextMerge(last, newNode);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user