mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:43:04 +00:00
[LIBXML2] Update to version 2.9.10. CORE-16952
This commit is contained in:
parent
b82bf8ce16
commit
f22fa382fe
65 changed files with 2245 additions and 2056 deletions
90
sdk/lib/3rdparty/libxml2/tree.c
vendored
90
sdk/lib/3rdparty/libxml2/tree.c
vendored
|
@ -59,7 +59,7 @@ int __xmlRegisterCallbacks = 0;
|
|||
************************************************************************/
|
||||
|
||||
static xmlNsPtr
|
||||
xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
|
||||
xmlNewReconciledNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
|
||||
|
||||
static xmlChar* xmlGetPropNodeValueInternal(const xmlAttr *prop);
|
||||
|
||||
|
@ -181,7 +181,7 @@ xmlGetEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) {
|
|||
* @dtd: A pointer to the DTD to search
|
||||
* @name: The entity name
|
||||
*
|
||||
* Do an entity lookup in the DTD pararmeter entity hash table and
|
||||
* Do an entity lookup in the DTD parameter entity hash table and
|
||||
* return the corresponding entity, if found.
|
||||
*
|
||||
* Returns A pointer to the entity structure or NULL if not found.
|
||||
|
@ -2950,7 +2950,7 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
|
|||
* Add a new attribute after @prev using @cur as base attribute.
|
||||
* When inserting before @cur, @prev is passed as @cur->prev.
|
||||
* When inserting after @cur, @prev is passed as @cur.
|
||||
* If an existing attribute is found it is detroyed prior to adding @prop.
|
||||
* If an existing attribute is found it is destroyed prior to adding @prop.
|
||||
*
|
||||
* Returns the attribute being inserted or NULL in case of error.
|
||||
*/
|
||||
|
@ -3664,7 +3664,9 @@ xmlNextElementSibling(xmlNodePtr node) {
|
|||
void
|
||||
xmlFreeNodeList(xmlNodePtr cur) {
|
||||
xmlNodePtr next;
|
||||
xmlNodePtr parent;
|
||||
xmlDictPtr dict = NULL;
|
||||
size_t depth = 0;
|
||||
|
||||
if (cur == NULL) return;
|
||||
if (cur->type == XML_NAMESPACE_DECL) {
|
||||
|
@ -3680,16 +3682,21 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
|||
return;
|
||||
}
|
||||
if (cur->doc != NULL) dict = cur->doc->dict;
|
||||
while (cur != NULL) {
|
||||
while (1) {
|
||||
while ((cur->children != NULL) &&
|
||||
(cur->type != XML_DTD_NODE) &&
|
||||
(cur->type != XML_ENTITY_REF_NODE)) {
|
||||
cur = cur->children;
|
||||
depth += 1;
|
||||
}
|
||||
|
||||
next = cur->next;
|
||||
parent = cur->parent;
|
||||
if (cur->type != XML_DTD_NODE) {
|
||||
|
||||
if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
|
||||
xmlDeregisterNodeDefaultValue(cur);
|
||||
|
||||
if ((cur->children != NULL) &&
|
||||
(cur->type != XML_ENTITY_REF_NODE))
|
||||
xmlFreeNodeList(cur->children);
|
||||
if (((cur->type == XML_ELEMENT_NODE) ||
|
||||
(cur->type == XML_XINCLUDE_START) ||
|
||||
(cur->type == XML_XINCLUDE_END)) &&
|
||||
|
@ -3720,7 +3727,16 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
|||
DICT_FREE(cur->name)
|
||||
xmlFree(cur);
|
||||
}
|
||||
cur = next;
|
||||
|
||||
if (next != NULL) {
|
||||
cur = next;
|
||||
} else {
|
||||
if ((depth == 0) || (parent == NULL))
|
||||
break;
|
||||
depth -= 1;
|
||||
cur = parent;
|
||||
cur->children = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4050,7 +4066,7 @@ xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) {
|
|||
} else {
|
||||
/*
|
||||
* we have to find something appropriate here since
|
||||
* we cant be sure, that the namespce we found is identified
|
||||
* we cant be sure, that the namespace we found is identified
|
||||
* by the prefix
|
||||
*/
|
||||
if (xmlStrEqual(ns->href, cur->ns->href)) {
|
||||
|
@ -4058,10 +4074,10 @@ xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) {
|
|||
ret->ns = ns;
|
||||
} else {
|
||||
/*
|
||||
* we are in trouble: we need a new reconcilied namespace.
|
||||
* we are in trouble: we need a new reconciled namespace.
|
||||
* This is expensive
|
||||
*/
|
||||
ret->ns = xmlNewReconciliedNs(target->doc, target, cur->ns);
|
||||
ret->ns = xmlNewReconciledNs(target->doc, target, cur->ns);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4154,8 +4170,8 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
|
|||
* say RPM:Copyright without changing the namespace pointer to
|
||||
* something else can produce stale links. One way to do it is
|
||||
* to keep a reference counter but this doesn't work as soon
|
||||
* as one move the element or the subtree out of the scope of
|
||||
* the existing namespace. The actual solution seems to add
|
||||
* as one moves the element or the subtree out of the scope of
|
||||
* the existing namespace. The actual solution seems to be to add
|
||||
* a copy of the namespace at the top of the copied tree if
|
||||
* not available in the subtree.
|
||||
* Hence two functions, the public front-end call the inner ones
|
||||
|
@ -4280,7 +4296,7 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
|
|||
while (root->parent != NULL) root = root->parent;
|
||||
ret->ns = xmlNewNs(root, ns->href, ns->prefix);
|
||||
} else {
|
||||
ret->ns = xmlNewReconciliedNs(doc, ret, node->ns);
|
||||
ret->ns = xmlNewReconciledNs(doc, ret, node->ns);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
@ -4719,7 +4735,7 @@ xmlGetNodePath(const xmlNode *node)
|
|||
|
||||
/*
|
||||
* Thumbler index computation
|
||||
* TODO: the ocurence test seems bogus for namespaced names
|
||||
* TODO: the occurrence test seems bogus for namespaced names
|
||||
*/
|
||||
tmp = cur->prev;
|
||||
while (tmp != NULL) {
|
||||
|
@ -6214,7 +6230,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
|
|||
}
|
||||
|
||||
/**
|
||||
* xmlNewReconciliedNs:
|
||||
* xmlNewReconciledNs:
|
||||
* @doc: the document
|
||||
* @tree: a node expected to hold the new namespace
|
||||
* @ns: the original namespace
|
||||
|
@ -6227,7 +6243,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
|
|||
* Returns the (new) namespace definition or NULL in case of error
|
||||
*/
|
||||
static xmlNsPtr
|
||||
xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
|
||||
xmlNewReconciledNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
|
||||
xmlNsPtr def;
|
||||
xmlChar prefix[50];
|
||||
int counter = 1;
|
||||
|
@ -6235,14 +6251,14 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
|
|||
if ((tree == NULL) || (tree->type != XML_ELEMENT_NODE)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewReconciliedNs : tree == NULL\n");
|
||||
"xmlNewReconciledNs : tree == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewReconciliedNs : ns == NULL\n");
|
||||
"xmlNewReconciledNs : ns == NULL\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
@ -6344,7 +6360,7 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
|
|||
/*
|
||||
* OK we need to recreate a new namespace definition
|
||||
*/
|
||||
n = xmlNewReconciliedNs(doc, tree, node->ns);
|
||||
n = xmlNewReconciledNs(doc, tree, node->ns);
|
||||
if (n != NULL) { /* :-( what if else ??? */
|
||||
/*
|
||||
* check if we need to grow the cache buffers.
|
||||
|
@ -6373,7 +6389,7 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
|
|||
}
|
||||
}
|
||||
/*
|
||||
* now check for namespace hold by attributes on the node.
|
||||
* now check for namespace held by attributes on the node.
|
||||
*/
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
attr = node->properties;
|
||||
|
@ -6408,7 +6424,7 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
|
|||
/*
|
||||
* OK we need to recreate a new namespace definition
|
||||
*/
|
||||
n = xmlNewReconciliedNs(doc, tree, attr->ns);
|
||||
n = xmlNewReconciledNs(doc, tree, attr->ns);
|
||||
if (n != NULL) { /* :-( what if else ??? */
|
||||
/*
|
||||
* check if we need to grow the cache buffers.
|
||||
|
@ -7961,7 +7977,7 @@ xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position,
|
|||
* Creates or reuses an xmlNs struct on doc->oldNs with
|
||||
* the given prefix and namespace name.
|
||||
*
|
||||
* Returns the aquired ns struct or NULL in case of an API
|
||||
* Returns the acquired ns struct or NULL in case of an API
|
||||
* or internal error.
|
||||
*/
|
||||
static xmlNsPtr
|
||||
|
@ -8575,7 +8591,7 @@ ns_next_prefix:
|
|||
}
|
||||
|
||||
/*
|
||||
* xmlDOMWrapNSNormAquireNormalizedNs:
|
||||
* xmlDOMWrapNSNormAcquireNormalizedNs:
|
||||
* @doc: the doc
|
||||
* @elem: the element-node to declare namespaces on
|
||||
* @ns: the ns-struct to use for the search
|
||||
|
@ -8594,7 +8610,7 @@ ns_next_prefix:
|
|||
* Returns 0 if succeeded, -1 otherwise and on API/internal errors.
|
||||
*/
|
||||
static int
|
||||
xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc,
|
||||
xmlDOMWrapNSNormAcquireNormalizedNs(xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
xmlNsPtr ns,
|
||||
xmlNsPtr *retNs,
|
||||
|
@ -8893,9 +8909,9 @@ next_ns_decl:
|
|||
}
|
||||
}
|
||||
/*
|
||||
* Aquire a normalized ns-decl and add it to the map.
|
||||
* Acquire a normalized ns-decl and add it to the map.
|
||||
*/
|
||||
if (xmlDOMWrapNSNormAquireNormalizedNs(doc, curElem,
|
||||
if (xmlDOMWrapNSNormAcquireNormalizedNs(doc, curElem,
|
||||
cur->ns, &ns,
|
||||
&nsMap, depth,
|
||||
ancestorsOnly,
|
||||
|
@ -9033,7 +9049,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt,
|
|||
nsMap = (xmlNsMapPtr) ctxt->namespaceMap;
|
||||
/*
|
||||
* Disable search for ns-decls in the parent-axis of the
|
||||
* desination element, if:
|
||||
* destination element, if:
|
||||
* 1) there's no destination parent
|
||||
* 2) custom ns-reference handling is used
|
||||
*/
|
||||
|
@ -9178,9 +9194,9 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt,
|
|||
cur->ns = ns;
|
||||
} else {
|
||||
/*
|
||||
* Aquire a normalized ns-decl and add it to the map.
|
||||
* Acquire a normalized ns-decl and add it to the map.
|
||||
*/
|
||||
if (xmlDOMWrapNSNormAquireNormalizedNs(destDoc,
|
||||
if (xmlDOMWrapNSNormAcquireNormalizedNs(destDoc,
|
||||
/* ns-decls on curElem or on destDoc->oldNs */
|
||||
destParent ? curElem : NULL,
|
||||
cur->ns, &ns,
|
||||
|
@ -9234,7 +9250,7 @@ ns_end:
|
|||
goto leave_node;
|
||||
case XML_ENTITY_REF_NODE:
|
||||
/*
|
||||
* Remove reference to the entitity-node.
|
||||
* Remove reference to the entity-node.
|
||||
*/
|
||||
cur->content = NULL;
|
||||
cur->children = NULL;
|
||||
|
@ -9468,7 +9484,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
|
|||
}
|
||||
memset(clone, 0, sizeof(xmlNode));
|
||||
/*
|
||||
* Set hierachical links.
|
||||
* Set hierarchical links.
|
||||
*/
|
||||
if (resultClone != NULL) {
|
||||
clone->parent = parentClone;
|
||||
|
@ -9492,7 +9508,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
|
|||
}
|
||||
memset(clone, 0, sizeof(xmlAttr));
|
||||
/*
|
||||
* Set hierachical links.
|
||||
* Set hierarchical links.
|
||||
* TODO: Change this to add to the end of attributes.
|
||||
*/
|
||||
if (resultClone != NULL) {
|
||||
|
@ -9720,9 +9736,9 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
|
|||
clone->ns = ns;
|
||||
} else {
|
||||
/*
|
||||
* Aquire a normalized ns-decl and add it to the map.
|
||||
* Acquire a normalized ns-decl and add it to the map.
|
||||
*/
|
||||
if (xmlDOMWrapNSNormAquireNormalizedNs(destDoc,
|
||||
if (xmlDOMWrapNSNormAcquireNormalizedNs(destDoc,
|
||||
/* ns-decls on curElem or on destDoc->oldNs */
|
||||
destParent ? curElem : NULL,
|
||||
cur->ns, &ns,
|
||||
|
@ -9959,7 +9975,7 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt,
|
|||
break;
|
||||
case XML_ENTITY_REF_NODE:
|
||||
/*
|
||||
* Remove reference to the entitity-node.
|
||||
* Remove reference to the entity-node.
|
||||
*/
|
||||
cur->content = NULL;
|
||||
cur->children = NULL;
|
||||
|
@ -10097,7 +10113,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt,
|
|||
break;
|
||||
case XML_ENTITY_REF_NODE:
|
||||
/*
|
||||
* Remove reference to the entitity-node.
|
||||
* Remove reference to the entity-node.
|
||||
*/
|
||||
node->content = NULL;
|
||||
node->children = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue