[LIBXML2] Update to version 2.10.0. CORE-17766

This commit is contained in:
Thomas Faber 2022-11-20 10:17:45 -05:00
parent 608bbe1136
commit 911153da10
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
80 changed files with 2351 additions and 20735 deletions

View file

@ -12,11 +12,8 @@
#include "libxml.h"
#include <string.h>
#include <stddef.h>
#ifdef HAVE_ERRNO_H
#include <stdlib.h>
#include <errno.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@ -30,9 +27,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
@ -40,17 +34,15 @@
#include <lzma.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
#if defined(_WIN32)
#ifdef __REACTOS__
#include <winnls.h>
#else /* __REACTOS__ */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif /* __REACTOS__ */
#endif
#if defined(_WIN32_WCE)
#include <winnls.h> /* for CP_UTF8 */
#include <io.h>
#include <direct.h>
#endif
#ifndef S_ISDIR
@ -134,7 +126,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
* *
************************************************************************/
static const char *IOerr[] = {
static const char* const IOerr[] = {
"Unknown IO error", /* UNKNOWN */
"Permission denied", /* EACCES */
"Resource temporarily unavailable",/* EAGAIN */
@ -194,7 +186,7 @@ static const char *IOerr[] = {
"unknown address family", /* EAFNOSUPPORT */
};
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
#if defined(_WIN32)
/**
* __xmlIOWin32UTF8ToWChar:
* @u8String: uft-8 string
@ -252,7 +244,6 @@ __xmlIOErr(int domain, int code, const char *extra)
unsigned int idx;
if (code == 0) {
#ifdef HAVE_ERRNO_H
if (errno == 0) code = 0;
#ifdef EACCES
else if (errno == EACCES) code = XML_IO_EACCES;
@ -408,7 +399,6 @@ __xmlIOErr(int domain, int code, const char *extra)
else if (errno == EAFNOSUPPORT) code = XML_IO_EAFNOSUPPORT;
#endif
else code = XML_IO_UNKNOWN;
#endif /* HAVE_ERRNO_H */
}
idx = 0;
if (code >= XML_IO_UNKNOWN) idx = code - XML_IO_UNKNOWN;
@ -599,7 +589,7 @@ xmlPopOutputCallbacks(void)
* *
************************************************************************/
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
#if defined(_WIN32)
/**
* xmlWrapOpenUtf8:
@ -700,7 +690,7 @@ int
xmlCheckFilename (const char *path)
{
#ifdef HAVE_STAT
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
#if defined(_WIN32)
struct _stat stat_buffer;
#else
struct stat stat_buffer;
@ -710,7 +700,7 @@ xmlCheckFilename (const char *path)
return(0);
#ifdef HAVE_STAT
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
#if defined(_WIN32)
/*
* On Windows stat and wstat do not work with long pathname,
* which start with '\\?\'
@ -841,20 +831,20 @@ xmlFileOpen_real (const char *filename) {
}
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) {
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[17];
#else
path = &filename[16];
#endif
} else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[8];
#else
path = &filename[7];
#endif
} else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:/", 6)) {
/* lots of generators seems to lazy to read RFC 1738 */
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[6];
#else
path = &filename[5];
@ -867,10 +857,10 @@ xmlFileOpen_real (const char *filename) {
return(NULL);
#endif
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
#if defined(_WIN32)
fd = xmlWrapOpenUtf8(path, 0);
#else
fd = fopen(path, "r");
fd = fopen(path, "rb");
#endif /* WIN32 */
if (fd == NULL) xmlIOErr(0, path);
return((void *) fd);
@ -923,13 +913,13 @@ xmlFileOpenW (const char *filename) {
}
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[17];
#else
path = &filename[16];
#endif
else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[8];
#else
path = &filename[7];
@ -940,7 +930,7 @@ xmlFileOpenW (const char *filename) {
if (path == NULL)
return(NULL);
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
#if defined(_WIN32)
fd = xmlWrapOpenUtf8(path, 1);
#elif(__MVS__)
fd = fopen(path, "w");
@ -1113,13 +1103,13 @@ xmlGzfileOpen_real (const char *filename) {
}
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[17];
#else
path = &filename[16];
#endif
else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[8];
#else
path = &filename[7];
@ -1132,7 +1122,7 @@ xmlGzfileOpen_real (const char *filename) {
if (!xmlCheckFilename(path))
return(NULL);
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
#if defined(_WIN32)
fd = xmlWrapGzOpenUtf8(path, "rb");
#else
fd = gzopen(path, "rb");
@ -1144,7 +1134,7 @@ xmlGzfileOpen_real (const char *filename) {
* xmlGzfileOpen:
* @filename: the URI for matching
*
* Wrapper around xmlGzfileOpen if the open fais, it will
* Wrapper around xmlGzfileOpen_real if the open fails, it will
* try to unescape @filename
*/
static void *
@ -1192,13 +1182,13 @@ xmlGzfileOpenW (const char *filename, int compression) {
}
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17))
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[17];
#else
path = &filename[16];
#endif
else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &filename[8];
#else
path = &filename[7];
@ -1209,7 +1199,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
if (path == NULL)
return(NULL);
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
#if defined(_WIN32)
fd = xmlWrapGzOpenUtf8(path, mode);
#else
fd = gzopen(path, mode);
@ -2405,10 +2395,7 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
xmlFree(ret);
return(NULL);
}
/* try to avoid a performance problem with Windows realloc() */
if (xmlBufGetAllocationScheme(ret->buffer) == XML_BUFFER_ALLOC_EXACT)
xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_DOUBLEIT);
ret->encoder = encoder;
if (encoder != NULL) {
@ -3564,7 +3551,7 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
* how many bytes to consume and how many bytes to store.
*/
cons = len;
chunk = xmlBufAvail(out->buffer) - 1;
chunk = xmlBufAvail(out->buffer);
/*
* make sure we have enough room to save first, if this is
@ -3769,16 +3756,12 @@ xmlParserGetDirectory(const char *filename) {
char dir[1024];
char *cur;
#ifdef _WIN32_WCE /* easy way by now ... wince does not have dirs! */
return NULL;
#endif
if (xmlInputCallbackInitialized == 0)
xmlRegisterDefaultInputCallbacks();
if (filename == NULL) return(NULL);
#if defined(_WIN32) && !defined(__CYGWIN__)
#if defined(_WIN32)
# define IS_XMLPGD_SEP(ch) ((ch=='/')||(ch=='\\'))
#else
# define IS_XMLPGD_SEP(ch) (ch=='/')
@ -3825,6 +3808,9 @@ xmlParserGetDirectory(const char *filename) {
*/
xmlParserInputPtr
xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) {
/* Avoid unused variable warning if features are disabled. */
(void) ctxt;
#ifdef LIBXML_HTTP_ENABLED
if ((ret != NULL) && (ret->buf != NULL) &&
(ret->buf->readcallback == xmlIOHTTPRead) &&
@ -3892,13 +3878,13 @@ static int xmlNoNetExists(const char *URL) {
return(0);
if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file://localhost/", 17))
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &URL[17];
#else
path = &URL[16];
#endif
else if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__)
#if defined (_WIN32)
path = &URL[8];
#else
path = &URL[7];
@ -4137,5 +4123,3 @@ xmlNoNetExternalEntityLoader(const char *URL, const char *ID,
return(input);
}
#define bottom_xmlIO
#include "elfgcchack.h"