[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

@ -189,9 +189,9 @@ static const char *IOerr[] = {
"already connected", /* EISCONN */
"connection refused", /* ECONNREFUSED */
"unreachable network", /* ENETUNREACH */
"adddress in use", /* EADDRINUSE */
"address in use", /* EADDRINUSE */
"already in use", /* EALREADY */
"unknown address familly", /* EAFNOSUPPORT */
"unknown address family", /* EAFNOSUPPORT */
};
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
@ -2387,6 +2387,7 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
if (encoder != NULL) {
ret->conv = xmlBufCreateSize(4000);
if (ret->conv == NULL) {
xmlBufFree(ret->buffer);
xmlFree(ret);
return(NULL);
}
@ -2439,6 +2440,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) {
if (encoder != NULL) {
ret->conv = xmlBufCreateSize(4000);
if (ret->conv == NULL) {
xmlBufFree(ret->buffer);
xmlFree(ret);
return(NULL);
}
@ -3339,7 +3341,7 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
int nbchars = 0; /* number of chars to output to I/O */
int ret; /* return from function call */
int written = 0; /* number of char written to I/O so far */
int chunk; /* number of byte curreent processed from buf */
int chunk; /* number of byte current processed from buf */
if ((out == NULL) || (out->error)) return(-1);
if (len < 0) return(0);
@ -3376,20 +3378,26 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
out->error = XML_IO_ENCODER;
return(-1);
}
nbchars = xmlBufUse(out->conv);
if (out->writecallback)
nbchars = xmlBufUse(out->conv);
else
nbchars = ret;
} else {
ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk);
if (ret != 0)
return(-1);
nbchars = xmlBufUse(out->buffer);
if (out->writecallback)
nbchars = xmlBufUse(out->buffer);
else
nbchars = chunk;
}
buf += chunk;
len -= chunk;
if ((nbchars < MINLEN) && (len <= 0))
goto done;
if (out->writecallback) {
if ((nbchars < MINLEN) && (len <= 0))
goto done;
/*
* second write the stuff to the I/O channel
*/
@ -3409,7 +3417,10 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
out->error = XML_IO_WRITE;
return(ret);
}
out->written += ret;
if (out->written > INT_MAX - ret)
out->written = INT_MAX;
else
out->written += ret;
}
written += nbchars;
} while (len > 0);
@ -3489,7 +3500,7 @@ xmlEscapeContent(unsigned char* out, int *outlen,
* @escaping: an optional escaping function (or NULL)
*
* Write the content of the string in the output I/O buffer
* This routine escapes the caracters and then handle the I18N
* This routine escapes the characters and then handle the I18N
* transcoding from internal UTF-8
* The buffer is lossless, i.e. will store in case of partial
* or delayed writes.
@ -3565,21 +3576,27 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
out->error = XML_IO_ENCODER;
return(-1);
}
nbchars = xmlBufUse(out->conv);
if (out->writecallback)
nbchars = xmlBufUse(out->conv);
else
nbchars = ret;
} else {
ret = escaping(xmlBufEnd(out->buffer), &chunk, str, &cons);
if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */
return(-1);
xmlBufAddLen(out->buffer, chunk);
nbchars = xmlBufUse(out->buffer);
if (out->writecallback)
nbchars = xmlBufUse(out->buffer);
else
nbchars = chunk;
}
str += cons;
len -= cons;
if ((nbchars < MINLEN) && (len <= 0))
goto done;
if (out->writecallback) {
if ((nbchars < MINLEN) && (len <= 0))
goto done;
/*
* second write the stuff to the I/O channel
*/
@ -3599,7 +3616,10 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
out->error = XML_IO_WRITE;
return(ret);
}
out->written += ret;
if (out->written > INT_MAX - ret)
out->written = INT_MAX;
else
out->written += ret;
} else if (xmlBufAvail(out->buffer) < MINLEN) {
xmlBufGrow(out->buffer, MINLEN);
}
@ -3693,7 +3713,10 @@ xmlOutputBufferFlush(xmlOutputBufferPtr out) {
out->error = XML_IO_FLUSH;
return(ret);
}
out->written += ret;
if (out->written > INT_MAX - ret)
out->written = INT_MAX;
else
out->written += ret;
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext,
@ -3941,7 +3964,7 @@ xmlResolveResourceFromCatalog(const char *URL, const char *ID,
* @ID: the System ID for the entity to load
* @ctxt: the context in which the entity is called or NULL
*
* By default we don't load external entitites, yet.
* By default we don't load external entities, yet.
*
* Returns a new allocated xmlParserInputPtr, or NULL.
*/