[LIBXML2] Update to version 2.9.10. CORE-16952

This commit is contained in:
Thomas Faber 2020-04-22 23:32:51 +02:00
parent b82bf8ce16
commit f22fa382fe
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
65 changed files with 2245 additions and 2056 deletions

View file

@ -125,11 +125,11 @@ typedef enum {
XML_RELAXNG_EXCEPT, /* except present in nameclass defs */
XML_RELAXNG_TEXT, /* textual content */
XML_RELAXNG_ELEMENT, /* an element */
XML_RELAXNG_DATATYPE, /* extenal data type definition */
XML_RELAXNG_PARAM, /* extenal data type parameter */
XML_RELAXNG_VALUE, /* value from an extenal data type definition */
XML_RELAXNG_DATATYPE, /* external data type definition */
XML_RELAXNG_PARAM, /* external data type parameter */
XML_RELAXNG_VALUE, /* value from an external data type definition */
XML_RELAXNG_LIST, /* a list of patterns */
XML_RELAXNG_ATTRIBUTE, /* an attrbute following a pattern */
XML_RELAXNG_ATTRIBUTE, /* an attribute following a pattern */
XML_RELAXNG_DEF, /* a definition */
XML_RELAXNG_REF, /* reference to a definition */
XML_RELAXNG_EXTERNALREF, /* reference to an external def */
@ -228,7 +228,7 @@ struct _xmlRelaxNGParserCtxt {
xmlDocPtr document;
int defNr; /* number of defines used */
int defMax; /* number of defines aloocated */
int defMax; /* number of defines allocated */
xmlRelaxNGDefinePtr *defTab; /* pointer to the allocated definitions */
const char *buffer;
@ -1128,7 +1128,7 @@ xmlRelaxNGAddStates(xmlRelaxNGValidCtxtPtr ctxt,
/**
* xmlRelaxNGFreeStates:
* @ctxt: a Relax-NG validation context
* @states: teh container
* @states: the container
*
* Free a RelaxNG validation state container
*/
@ -1340,7 +1340,7 @@ xmlRelaxNGCopyValidState(xmlRelaxNGValidCtxtPtr ctxt,
*
* Compare the validation states for equality
*
* Returns 1 if equald, 0 otherwise
* Returns 1 if equal, 0 otherwise
*/
static int
xmlRelaxNGEqualValidState(xmlRelaxNGValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
@ -2815,7 +2815,7 @@ xmlRelaxNGRegisterTypeLibrary(const xmlChar * namespace, void *data,
/**
* xmlRelaxNGInitTypes:
*
* Initilize the default type libraries.
* Initialize the default type libraries.
*
* Returns 0 in case of success and -1 in case of error.
*/
@ -2878,7 +2878,7 @@ static int xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGDefinePtr def);
/**
* xmlRelaxNGIsCompileable:
* xmlRelaxNGIsCompilable:
* @define: the definition to check
*
* Check if a definition is nullable.
@ -2886,7 +2886,7 @@ static int xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt,
* Returns 1 if yes, 0 if no and -1 in case of error
*/
static int
xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
xmlRelaxNGIsCompilable(xmlRelaxNGDefinePtr def)
{
int ret = -1;
@ -2901,7 +2901,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
return (0);
switch (def->type) {
case XML_RELAXNG_NOOP:
ret = xmlRelaxNGIsCompileable(def->content);
ret = xmlRelaxNGIsCompilable(def->content);
break;
case XML_RELAXNG_TEXT:
case XML_RELAXNG_EMPTY:
@ -2909,7 +2909,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
break;
case XML_RELAXNG_ELEMENT:
/*
* Check if the element content is compileable
* Check if the element content is compilable
*/
if (((def->dflags & IS_NOT_COMPILABLE) == 0) &&
((def->dflags & IS_COMPILABLE) == 0)) {
@ -2917,7 +2917,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
list = def->content;
while (list != NULL) {
ret = xmlRelaxNGIsCompileable(list);
ret = xmlRelaxNGIsCompilable(list);
if (ret != 1)
break;
list = list->next;
@ -2943,13 +2943,13 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
def->name);
} else {
xmlGenericError(xmlGenericErrorContext,
"Problem in RelaxNGIsCompileable for element %s\n",
"Problem in RelaxNGIsCompilable for element %s\n",
def->name);
}
#endif
}
/*
* All elements return a compileable status unless they
* All elements return a compilable status unless they
* are generic like anyName
*/
if ((def->nameClass != NULL) || (def->name == NULL))
@ -2968,7 +2968,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
def->depth = -20;
list = def->content;
while (list != NULL) {
ret = xmlRelaxNGIsCompileable(list);
ret = xmlRelaxNGIsCompilable(list);
if (ret != 1)
break;
list = list->next;
@ -2986,7 +2986,7 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
list = def->content;
while (list != NULL) {
ret = xmlRelaxNGIsCompileable(list);
ret = xmlRelaxNGIsCompilable(list);
if (ret != 1)
break;
list = list->next;
@ -3011,15 +3011,15 @@ xmlRelaxNGIsCompileable(xmlRelaxNGDefinePtr def)
#ifdef DEBUG_COMPILE
if (ret == 1) {
xmlGenericError(xmlGenericErrorContext,
"RelaxNGIsCompileable %s : true\n",
"RelaxNGIsCompilable %s : true\n",
xmlRelaxNGDefName(def));
} else if (ret == 0) {
xmlGenericError(xmlGenericErrorContext,
"RelaxNGIsCompileable %s : false\n",
"RelaxNGIsCompilable %s : false\n",
xmlRelaxNGDefName(def));
} else {
xmlGenericError(xmlGenericErrorContext,
"Problem in RelaxNGIsCompileable %s\n",
"Problem in RelaxNGIsCompilable %s\n",
xmlRelaxNGDefName(def));
}
#endif
@ -3047,7 +3047,7 @@ xmlRelaxNGCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def)
switch (def->type) {
case XML_RELAXNG_START:
if ((xmlRelaxNGIsCompileable(def) == 1) && (def->depth != -25)) {
if ((xmlRelaxNGIsCompilable(def) == 1) && (def->depth != -25)) {
xmlAutomataPtr oldam = ctxt->am;
xmlAutomataStatePtr oldstate = ctxt->state;
@ -3273,7 +3273,7 @@ xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def)
if ((def->type == XML_RELAXNG_START) ||
(def->type == XML_RELAXNG_ELEMENT)) {
ret = xmlRelaxNGIsCompileable(def);
ret = xmlRelaxNGIsCompilable(def);
if ((def->dflags & IS_COMPILABLE) && (def->depth != -25)) {
ctxt->am = NULL;
ret = xmlRelaxNGCompile(ctxt, def);
@ -3478,7 +3478,7 @@ xmlRelaxNGIsBlank(xmlChar * str)
*
* Applies algorithm from 4.3. datatypeLibrary attribute
*
* Returns the datatypeLibary value or NULL if not found
* Returns the datatypeLibrary value or NULL if not found
*/
static xmlChar *
xmlRelaxNGGetDataTypeLibrary(xmlRelaxNGParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
@ -3788,7 +3788,7 @@ static const xmlChar *invalidName = BAD_CAST "\1";
* that if both lists do not accept the same QNames, it returns 1
* If the 2 lists can accept the same QName the comparison returns 0
*
* Returns 1 disttinct, 0 if equal
* Returns 1 distinct, 0 if equal
*/
static int
xmlRelaxNGCompareNameClasses(xmlRelaxNGDefinePtr def1,
@ -3889,7 +3889,7 @@ xmlRelaxNGCompareNameClasses(xmlRelaxNGDefinePtr def1,
* is that if both lists do not accept the same QNames, it returns 1
* If the 2 lists can accept the same QName the comparison returns 0
*
* Returns 1 disttinct, 0 if equal
* Returns 1 distinct, 0 if equal
*/
static int
xmlRelaxNGCompareElemDefLists(xmlRelaxNGParserCtxtPtr ctxt
@ -4743,9 +4743,9 @@ xmlRelaxNGParseImportRefs(xmlRelaxNGParserCtxtPtr ctxt,
/**
* xmlRelaxNGProcessExternalRef:
* @ctxt: the parser context
* @node: the externlRef node
* @node: the externalRef node
*
* Process and compile an externlRef node
* Process and compile an externalRef node
*
* Returns the xmlRelaxNGDefinePtr or NULL in case of error
*/
@ -5548,12 +5548,16 @@ xmlRelaxNGParsePatterns(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes,
while (nodes != NULL) {
if (IS_RELAXNG(nodes, "element")) {
cur = xmlRelaxNGParseElement(ctxt, nodes);
if (cur == NULL)
return (NULL);
if (def == NULL) {
def = last = cur;
} else {
if ((group == 1) && (def->type == XML_RELAXNG_ELEMENT) &&
(def == last)) {
def = xmlRelaxNGNewDefine(ctxt, nodes);
if (def == NULL)
return (NULL);
def->type = XML_RELAXNG_GROUP;
def->content = last;
}
@ -6012,7 +6016,7 @@ xmlRelaxNGCheckCycles(xmlRelaxNGParserCtxtPtr ctxt,
* @parent: the parent definition
* @prev: the previous sibling definition
*
* Try to unlink a definition. If not possble make it a NOOP
* Try to unlink a definition. If not possible make it a NOOP
*
* Returns the new prev definition
*/
@ -6395,7 +6399,10 @@ xmlRelaxNGCheckRules(xmlRelaxNGParserCtxtPtr ctxt,
NULL, NULL);
}
if ((!(flags & XML_RELAXNG_IN_ONEORMORE))
&& (cur->name == NULL)) {
&& cur->name == NULL
/* following is checking alternative name class readiness
in case it went the "choice" route */
&& cur->nameClass == NULL) {
if (cur->ns == NULL) {
xmlRngPErr(ctxt, cur->node, XML_RNGP_ANYNAME_ATTR_ANCESTOR,
"Found anyName attribute without oneOrMore ancestor\n",
@ -6659,7 +6666,7 @@ xmlRelaxNGParseGrammar(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes)
* @node: the root node of the RelaxNG schema
*
* parse a Relax-NG definition resource and build an internal
* xmlRelaxNG struture which can be used to validate instances.
* xmlRelaxNG structure which can be used to validate instances.
*
* Returns the internal XML RelaxNG structure built or
* NULL in case of error
@ -7490,7 +7497,7 @@ xmlRelaxNGCleanupDoc(xmlRelaxNGParserCtxtPtr ctxt, xmlDocPtr doc)
* @ctxt: a Relax-NG parser context
*
* parse a schema definition resource and build an internal
* XML Shema struture which can be used to validate instances.
* XML Schema structure which can be used to validate instances.
*
* Returns the internal XML RelaxNG structure built from the resource or
* NULL in case of error
@ -8603,7 +8610,7 @@ xmlRelaxNGNormalize(xmlRelaxNGValidCtxtPtr ctxt, const xmlChar * str)
* @type: the datatype definition
* @node: the node
*
* Validate the given value against the dataype
* Validate the given value against the datatype
*
* Returns 0 if the validation succeeded or an error code.
*/
@ -9476,7 +9483,17 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGFreeValidState(ctxt, oldstate);
oldstate = ctxt->state;
ctxt->state = NULL;
if (cur != NULL) {
if (cur != NULL
/* there's a nasty violation of context-free unambiguities,
since in open-name-class context, interleave in the
production shall finish without caring about anything
else that is OK to follow in that case -- it would
otherwise get marked as "extra content" and would
hence fail the validation, hence this perhaps
dirty attempt to rectify such a situation */
&& (define->parent->type != XML_RELAXNG_DEF
|| !xmlStrEqual(define->parent->name,
(const xmlChar *) "open-name-class"))) {
VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, cur->name);
ret = -1;
ctxt->state = oldstate;
@ -9749,7 +9766,7 @@ xmlRelaxNGElementMatch(xmlRelaxNGValidCtxtPtr ctxt,
* Find the "best" state in the ctxt->states list of states to report
* errors about. I.e. a state with no element left in the child list
* or the one with the less attributes left.
* This is called only if a falidation error was detected
* This is called only if a validation error was detected
*
* Returns the index of the "best" state or -1 in case of error
*/
@ -9891,7 +9908,6 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
ctxt->depth++;
switch (define->type) {
case XML_RELAXNG_EMPTY:
xmlRelaxNGSkipIgnored(ctxt, node);
ret = 0;
break;
case XML_RELAXNG_NOT_ALLOWED:
@ -10357,7 +10373,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
/*
* Something we can optimize cleanly there is only one
* possble branch out !
* possible branch out !
*/
if ((node->type == XML_TEXT_NODE) ||
(node->type == XML_CDATA_SECTION_NODE)) {
@ -10610,7 +10626,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
if (define->name != NULL)
xmlGenericError(xmlGenericErrorContext, "%s ", define->name);
if (ret == 0)
xmlGenericError(xmlGenericErrorContext, "suceeded\n");
xmlGenericError(xmlGenericErrorContext, "succeeded\n");
else
xmlGenericError(xmlGenericErrorContext, "failed\n");
#endif