mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:53:06 +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
193
sdk/lib/3rdparty/libxml2/valid.c
vendored
193
sdk/lib/3rdparty/libxml2/valid.c
vendored
|
@ -1099,14 +1099,22 @@ xmlCopyElementContent(xmlElementContentPtr cur) {
|
|||
*/
|
||||
void
|
||||
xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
|
||||
xmlElementContentPtr next;
|
||||
xmlDictPtr dict = NULL;
|
||||
size_t depth = 0;
|
||||
|
||||
if (cur == NULL)
|
||||
return;
|
||||
if (doc != NULL)
|
||||
dict = doc->dict;
|
||||
|
||||
while (cur != NULL) {
|
||||
next = cur->c2;
|
||||
while (1) {
|
||||
xmlElementContentPtr parent;
|
||||
|
||||
while ((cur->c1 != NULL) || (cur->c2 != NULL)) {
|
||||
cur = (cur->c1 != NULL) ? cur->c1 : cur->c2;
|
||||
depth += 1;
|
||||
}
|
||||
|
||||
switch (cur->type) {
|
||||
case XML_ELEMENT_CONTENT_PCDATA:
|
||||
case XML_ELEMENT_CONTENT_ELEMENT:
|
||||
|
@ -1119,7 +1127,6 @@ xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
|
|||
NULL);
|
||||
return;
|
||||
}
|
||||
if (cur->c1 != NULL) xmlFreeDocElementContent(doc, cur->c1);
|
||||
if (dict) {
|
||||
if ((cur->name != NULL) && (!xmlDictOwns(dict, cur->name)))
|
||||
xmlFree((xmlChar *) cur->name);
|
||||
|
@ -1129,8 +1136,23 @@ xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
|
|||
if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
|
||||
if (cur->prefix != NULL) xmlFree((xmlChar *) cur->prefix);
|
||||
}
|
||||
parent = cur->parent;
|
||||
if ((depth == 0) || (parent == NULL)) {
|
||||
xmlFree(cur);
|
||||
break;
|
||||
}
|
||||
if (cur == parent->c1)
|
||||
parent->c1 = NULL;
|
||||
else
|
||||
parent->c2 = NULL;
|
||||
xmlFree(cur);
|
||||
cur = next;
|
||||
|
||||
if (parent->c2 != NULL) {
|
||||
cur = parent->c2;
|
||||
} else {
|
||||
depth -= 1;
|
||||
cur = parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1147,82 +1169,103 @@ xmlFreeElementContent(xmlElementContentPtr cur) {
|
|||
}
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
/**
|
||||
* xmlDumpElementOccur:
|
||||
* @buf: An XML buffer
|
||||
* @cur: An element table
|
||||
*
|
||||
* Dump the occurence operator of an element.
|
||||
*/
|
||||
static void
|
||||
xmlDumpElementOccur(xmlBufferPtr buf, xmlElementContentPtr cur) {
|
||||
switch (cur->ocur) {
|
||||
case XML_ELEMENT_CONTENT_ONCE:
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_OPT:
|
||||
xmlBufferWriteChar(buf, "?");
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_MULT:
|
||||
xmlBufferWriteChar(buf, "*");
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_PLUS:
|
||||
xmlBufferWriteChar(buf, "+");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlDumpElementContent:
|
||||
* @buf: An XML buffer
|
||||
* @content: An element table
|
||||
* @glob: 1 if one must print the englobing parenthesis, 0 otherwise
|
||||
*
|
||||
* This will dump the content of the element table as an XML DTD definition
|
||||
*/
|
||||
static void
|
||||
xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) {
|
||||
xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content) {
|
||||
xmlElementContentPtr cur;
|
||||
|
||||
if (content == NULL) return;
|
||||
|
||||
if (glob) xmlBufferWriteChar(buf, "(");
|
||||
switch (content->type) {
|
||||
case XML_ELEMENT_CONTENT_PCDATA:
|
||||
xmlBufferWriteChar(buf, "#PCDATA");
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_ELEMENT:
|
||||
if (content->prefix != NULL) {
|
||||
xmlBufferWriteCHAR(buf, content->prefix);
|
||||
xmlBufferWriteChar(buf, ":");
|
||||
}
|
||||
xmlBufferWriteCHAR(buf, content->name);
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_SEQ:
|
||||
if ((content->c1 != NULL) &&
|
||||
((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
|
||||
(content->c1->type == XML_ELEMENT_CONTENT_SEQ)))
|
||||
xmlDumpElementContent(buf, content->c1, 1);
|
||||
else
|
||||
xmlDumpElementContent(buf, content->c1, 0);
|
||||
xmlBufferWriteChar(buf, " , ");
|
||||
if ((content->c2 != NULL) &&
|
||||
((content->c2->type == XML_ELEMENT_CONTENT_OR) ||
|
||||
((content->c2->type == XML_ELEMENT_CONTENT_SEQ) &&
|
||||
(content->c2->ocur != XML_ELEMENT_CONTENT_ONCE))))
|
||||
xmlDumpElementContent(buf, content->c2, 1);
|
||||
else
|
||||
xmlDumpElementContent(buf, content->c2, 0);
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_OR:
|
||||
if ((content->c1 != NULL) &&
|
||||
((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
|
||||
(content->c1->type == XML_ELEMENT_CONTENT_SEQ)))
|
||||
xmlDumpElementContent(buf, content->c1, 1);
|
||||
else
|
||||
xmlDumpElementContent(buf, content->c1, 0);
|
||||
xmlBufferWriteChar(buf, " | ");
|
||||
if ((content->c2 != NULL) &&
|
||||
((content->c2->type == XML_ELEMENT_CONTENT_SEQ) ||
|
||||
((content->c2->type == XML_ELEMENT_CONTENT_OR) &&
|
||||
(content->c2->ocur != XML_ELEMENT_CONTENT_ONCE))))
|
||||
xmlDumpElementContent(buf, content->c2, 1);
|
||||
else
|
||||
xmlDumpElementContent(buf, content->c2, 0);
|
||||
break;
|
||||
default:
|
||||
xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
|
||||
"Internal: ELEMENT content corrupted invalid type\n",
|
||||
NULL);
|
||||
}
|
||||
if (glob)
|
||||
xmlBufferWriteChar(buf, ")");
|
||||
switch (content->ocur) {
|
||||
case XML_ELEMENT_CONTENT_ONCE:
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_OPT:
|
||||
xmlBufferWriteChar(buf, "?");
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_MULT:
|
||||
xmlBufferWriteChar(buf, "*");
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_PLUS:
|
||||
xmlBufferWriteChar(buf, "+");
|
||||
break;
|
||||
}
|
||||
xmlBufferWriteChar(buf, "(");
|
||||
cur = content;
|
||||
|
||||
do {
|
||||
if (cur == NULL) return;
|
||||
|
||||
switch (cur->type) {
|
||||
case XML_ELEMENT_CONTENT_PCDATA:
|
||||
xmlBufferWriteChar(buf, "#PCDATA");
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_ELEMENT:
|
||||
if (cur->prefix != NULL) {
|
||||
xmlBufferWriteCHAR(buf, cur->prefix);
|
||||
xmlBufferWriteChar(buf, ":");
|
||||
}
|
||||
xmlBufferWriteCHAR(buf, cur->name);
|
||||
break;
|
||||
case XML_ELEMENT_CONTENT_SEQ:
|
||||
case XML_ELEMENT_CONTENT_OR:
|
||||
if ((cur != content) &&
|
||||
(cur->parent != NULL) &&
|
||||
((cur->type != cur->parent->type) ||
|
||||
(cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
|
||||
xmlBufferWriteChar(buf, "(");
|
||||
cur = cur->c1;
|
||||
continue;
|
||||
default:
|
||||
xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
|
||||
"Internal: ELEMENT cur corrupted invalid type\n",
|
||||
NULL);
|
||||
}
|
||||
|
||||
while (cur != content) {
|
||||
xmlElementContentPtr parent = cur->parent;
|
||||
|
||||
if (parent == NULL) return;
|
||||
|
||||
if (((cur->type == XML_ELEMENT_CONTENT_OR) ||
|
||||
(cur->type == XML_ELEMENT_CONTENT_SEQ)) &&
|
||||
((cur->type != parent->type) ||
|
||||
(cur->ocur != XML_ELEMENT_CONTENT_ONCE)))
|
||||
xmlBufferWriteChar(buf, ")");
|
||||
xmlDumpElementOccur(buf, cur);
|
||||
|
||||
if (cur == parent->c1) {
|
||||
if (parent->type == XML_ELEMENT_CONTENT_SEQ)
|
||||
xmlBufferWriteChar(buf, " , ");
|
||||
else if (parent->type == XML_ELEMENT_CONTENT_OR)
|
||||
xmlBufferWriteChar(buf, " | ");
|
||||
|
||||
cur = parent->c2;
|
||||
break;
|
||||
}
|
||||
|
||||
cur = parent;
|
||||
}
|
||||
} while (cur != content);
|
||||
|
||||
xmlBufferWriteChar(buf, ")");
|
||||
xmlDumpElementOccur(buf, content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1703,7 +1746,7 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
|
|||
}
|
||||
xmlBufferWriteCHAR(buf, elem->name);
|
||||
xmlBufferWriteChar(buf, " ");
|
||||
xmlDumpElementContent(buf, elem->content, 1);
|
||||
xmlDumpElementContent(buf, elem->content);
|
||||
xmlBufferWriteChar(buf, ">\n");
|
||||
break;
|
||||
case XML_ELEMENT_TYPE_ELEMENT:
|
||||
|
@ -1714,7 +1757,7 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
|
|||
}
|
||||
xmlBufferWriteCHAR(buf, elem->name);
|
||||
xmlBufferWriteChar(buf, " ");
|
||||
xmlDumpElementContent(buf, elem->content, 1);
|
||||
xmlDumpElementContent(buf, elem->content);
|
||||
xmlBufferWriteChar(buf, ">\n");
|
||||
break;
|
||||
default:
|
||||
|
@ -2640,7 +2683,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
|
|||
ret->doc = doc;
|
||||
if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
|
||||
/*
|
||||
* Operating in streaming mode, attr is gonna disapear
|
||||
* Operating in streaming mode, attr is gonna disappear
|
||||
*/
|
||||
if (doc->dict != NULL)
|
||||
ret->name = xmlDictLookup(doc->dict, attr->name, -1);
|
||||
|
@ -2968,7 +3011,7 @@ xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
|
|||
ret->value = xmlStrdup(value);
|
||||
if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
|
||||
/*
|
||||
* Operating in streaming mode, attr is gonna disapear
|
||||
* Operating in streaming mode, attr is gonna disappear
|
||||
*/
|
||||
ret->name = xmlStrdup(attr->name);
|
||||
ret->attr = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue