[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

@ -449,6 +449,10 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) {
xmlCtxtUseOptions(pctxt, ctxt->parseFlags | XML_PARSE_DTDLOAD);
/* Don't read from stdin. */
if ((URL != NULL) && (strcmp(URL, "-") == 0))
URL = "./-";
inputStream = xmlLoadExternalEntity(URL, NULL, pctxt);
if (inputStream == NULL) {
xmlFreeParserCtxt(pctxt);
@ -667,7 +671,7 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
int i;
/*
* Avoid recursion in already substitued resources
* Avoid recursion in already substituted resources
for (i = 0;i < ctxt->urlNr;i++) {
if (xmlStrEqual(doc->URL, ctxt->urlTab[i]))
return;
@ -752,7 +756,7 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
* @txt: the new text node
* @url: the associated URL
*
* Add a new txtument to the list
* Add a new text node to the list
*/
static void
xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) {
@ -1258,7 +1262,7 @@ struct _xmlXIncludeMergeData {
* @doc: the including doc
* @nr: the entity name
*
* Inplements the merge of one entity
* Implements the merge of one entity
*/
static void
xmlXIncludeMergeEntity(void *payload, void *vdata,
@ -1335,7 +1339,7 @@ error:
* @doc: the including doc
* @from: the included doc
*
* Inplements the entity merge
* Implements the entity merge
*
* Returns 0 if merge succeeded, -1 if some processing failed
*/
@ -1806,6 +1810,10 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlParserInputPtr inputStream;
int xinclude_multibyte_fallback_used = 0;
/* Don't read from stdin. */
if (xmlStrcmp(url, BAD_CAST "-") == 0)
url = BAD_CAST "./-";
/*
* Check the URL and remove any fragment identifier
*/
@ -1914,7 +1922,7 @@ xinclude_multibyte_fallback:
cur = xmlStringCurrentChar(NULL, &content[i], &l);
if (!IS_CHAR(cur)) {
/* Handle splitted multibyte char at buffer boundary */
/* Handle split multibyte char at buffer boundary */
if (((len - i) < 4) && (!xinclude_multibyte_fallback_used)) {
xinclude_multibyte_fallback_used = 1;
xmlBufShrink(buf->buffer, i);
@ -1923,6 +1931,7 @@ xinclude_multibyte_fallback:
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
XML_XINCLUDE_INVALID_CHAR,
"%s contains invalid char\n", URL);
xmlFreeParserCtxt(pctxt);
xmlFreeParserInputBuffer(buf);
xmlFree(URL);
return(-1);
@ -1963,6 +1972,7 @@ static int
xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
xmlXIncludeCtxtPtr newctxt;
int ret = 0;
int oldNbErrors = ctxt->nbErrors;
if ((fallback == NULL) || (fallback->type == XML_NAMESPACE_DECL) ||
(ctxt == NULL))
@ -1979,7 +1989,7 @@ xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
newctxt->base = xmlStrdup(ctxt->base); /* Inherit the base from the existing context */
xmlXIncludeSetFlags(newctxt, ctxt->parseFlags);
ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children);
if (ctxt->nbErrors > 0)
if (ctxt->nbErrors > oldNbErrors)
ret = -1;
else if (ret > 0)
ret = 0; /* xmlXIncludeDoProcess can return +ve number */
@ -2133,7 +2143,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
xmlNodePtr children;
/*
* Time to try a fallback if availble
* Time to try a fallback if available
*/
#ifdef DEBUG_XINCLUDE
xmlGenericError(xmlGenericErrorContext, "error looking for fallback\n");
@ -2178,7 +2188,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
* @ctxt: an XInclude context
* @nr: the node number
*
* Inplement the infoset replacement for the given node
* Implement the infoset replacement for the given node
*
* Returns 0 if substitution succeeded, -1 if some processing failed
*/