mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 20:34:59 +00:00
[LIBXML2] Update to version 2.9.8. CORE-15280
This commit is contained in:
parent
61fed54064
commit
5bb277a54b
37 changed files with 545 additions and 493 deletions
69
sdk/lib/3rdparty/libxml2/xmlIO.c
vendored
69
sdk/lib/3rdparty/libxml2/xmlIO.c
vendored
|
@ -33,17 +33,20 @@
|
|||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_LZMA_H
|
||||
#ifdef LIBXML_LZMA_ENABLED
|
||||
#include <lzma.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
//#define WIN32_LEAN_AND_MEAN
|
||||
//#include <windows.h>
|
||||
#ifdef __REACTOS__
|
||||
#include <winnls.h>
|
||||
#else /* __REACTOS__ */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif /* __REACTOS__ */
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
|
@ -598,7 +601,7 @@ xmlWrapOpenUtf8(const char *path,int mode)
|
|||
return fd;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
static gzFile
|
||||
xmlWrapGzOpenUtf8(const char *path, const char *mode)
|
||||
{
|
||||
|
@ -704,14 +707,16 @@ xmlCheckFilename (const char *path)
|
|||
}
|
||||
|
||||
/**
|
||||
* xmlNop:
|
||||
* xmlInputReadCallbackNop:
|
||||
*
|
||||
* No Operation function, does nothing, no input
|
||||
* No Operation xmlInputReadCallback function, does nothing.
|
||||
*
|
||||
* Returns zero
|
||||
*/
|
||||
int
|
||||
xmlNop(void) {
|
||||
xmlInputReadCallbackNop(void *context ATTRIBUTE_UNUSED,
|
||||
char *buffer ATTRIBUTE_UNUSED,
|
||||
int len ATTRIBUTE_UNUSED) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -1037,7 +1042,7 @@ xmlBufferWrite (void * context, const char * buffer, int len) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
/************************************************************************
|
||||
* *
|
||||
* I/O for compressed file accesses *
|
||||
|
@ -1240,7 +1245,7 @@ xmlGzfileClose (void * context) {
|
|||
if (ret < 0) xmlIOErr(0, "gzclose()");
|
||||
return(ret);
|
||||
}
|
||||
#endif /* HAVE_ZLIB_H */
|
||||
#endif /* LIBXML_ZLIB_ENABLED */
|
||||
|
||||
#ifdef LIBXML_LZMA_ENABLED
|
||||
/************************************************************************
|
||||
|
@ -1379,7 +1384,7 @@ typedef struct xmlIOHTTPWriteCtxt_
|
|||
|
||||
} xmlIOHTTPWriteCtxt, *xmlIOHTTPWriteCtxtPtr;
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
|
||||
#define DFLT_WBITS ( -15 )
|
||||
#define DFLT_MEM_LVL ( 8 )
|
||||
|
@ -1707,7 +1712,7 @@ xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) {
|
|||
return ( zlgth );
|
||||
}
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
#endif /* HAVE_ZLIB_H */
|
||||
#endif /* LIBXML_ZLIB_ENABLED */
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
/**
|
||||
|
@ -1726,7 +1731,7 @@ xmlFreeHTTPWriteCtxt( xmlIOHTTPWriteCtxtPtr ctxt )
|
|||
|
||||
if ( ctxt->doc_buff != NULL ) {
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
if ( ctxt->compression > 0 ) {
|
||||
xmlFreeZMemBuff( ctxt->doc_buff );
|
||||
}
|
||||
|
@ -1813,7 +1818,7 @@ xmlIOHTTPOpenW(const char *post_uri, int compression ATTRIBUTE_UNUSED)
|
|||
* ** is being used to avoid pushing the data to disk and back.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
if ((compression > 0) && (compression <= 9)) {
|
||||
|
||||
ctxt->compression = compression;
|
||||
|
@ -1893,7 +1898,7 @@ xmlIOHTTPWrite( void * context, const char * buffer, int len ) {
|
|||
|
||||
/* Use gzwrite or fwrite as previously setup in the open call */
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
if ( ctxt->compression > 0 )
|
||||
len = xmlZMemBuffAppend( ctxt->doc_buff, buffer, len );
|
||||
|
||||
|
@ -1957,7 +1962,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
|
|||
|
||||
/* Retrieve the content from the appropriate buffer */
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
|
||||
if ( ctxt->compression > 0 ) {
|
||||
content_lgth = xmlZMemBuffGetContent( ctxt->doc_buff, &http_content );
|
||||
|
@ -2228,10 +2233,10 @@ xmlRegisterDefaultInputCallbacks(void) {
|
|||
|
||||
xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen,
|
||||
xmlFileRead, xmlFileClose);
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
|
||||
xmlGzfileRead, xmlGzfileClose);
|
||||
#endif /* HAVE_ZLIB_H */
|
||||
#endif /* LIBXML_ZLIB_ENABLED */
|
||||
#ifdef LIBXML_LZMA_ENABLED
|
||||
xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen,
|
||||
xmlXzfileRead, xmlXzfileClose);
|
||||
|
@ -2273,7 +2278,7 @@ xmlRegisterDefaultOutputCallbacks (void) {
|
|||
uncompressed ones except opening if existing then closing
|
||||
and saving with same compression ratio ... a pain.
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
xmlRegisterOutputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
|
||||
xmlGzfileWrite, xmlGzfileClose);
|
||||
#endif
|
||||
|
@ -2563,7 +2568,7 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
|
|||
ret->context = context;
|
||||
ret->readcallback = xmlInputCallbackTable[i].readcallback;
|
||||
ret->closecallback = xmlInputCallbackTable[i].closecallback;
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
if ((xmlInputCallbackTable[i].opencallback == xmlGzfileOpen) &&
|
||||
(strcmp(URI, "-") != 0)) {
|
||||
#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1230
|
||||
|
@ -2627,7 +2632,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
|
|||
int i = 0;
|
||||
void *context = NULL;
|
||||
char *unescaped = NULL;
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
int is_file_uri = 1;
|
||||
#endif
|
||||
|
||||
|
@ -2638,7 +2643,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
|
|||
|
||||
puri = xmlParseURI(URI);
|
||||
if (puri != NULL) {
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
if ((puri->scheme != NULL) &&
|
||||
(!xmlStrEqual(BAD_CAST puri->scheme, BAD_CAST "file")))
|
||||
is_file_uri = 0;
|
||||
|
@ -2658,7 +2663,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
|
|||
* try with an unescaped version of the URI
|
||||
*/
|
||||
if (unescaped != NULL) {
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) {
|
||||
context = xmlGzfileOpenW(unescaped, compression);
|
||||
if (context != NULL) {
|
||||
|
@ -2676,7 +2681,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
|
|||
for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
|
||||
if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
|
||||
(xmlOutputCallbackTable[i].matchcallback(unescaped) != 0)) {
|
||||
#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
|
||||
#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED)
|
||||
/* Need to pass compression parameter into HTTP open calls */
|
||||
if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
|
||||
context = xmlIOHTTPOpenW(unescaped, compression);
|
||||
|
@ -2695,7 +2700,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
|
|||
* filename
|
||||
*/
|
||||
if (context == NULL) {
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#ifdef LIBXML_ZLIB_ENABLED
|
||||
if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) {
|
||||
context = xmlGzfileOpenW(URI, compression);
|
||||
if (context != NULL) {
|
||||
|
@ -2712,7 +2717,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
|
|||
for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
|
||||
if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
|
||||
(xmlOutputCallbackTable[i].matchcallback(URI) != 0)) {
|
||||
#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
|
||||
#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED)
|
||||
/* Need to pass compression parameter into HTTP open calls */
|
||||
if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
|
||||
context = xmlIOHTTPOpenW(URI, compression);
|
||||
|
@ -2842,10 +2847,8 @@ xmlOutputBufferCreateBuffer(xmlBufferPtr buffer,
|
|||
|
||||
if (buffer == NULL) return(NULL);
|
||||
|
||||
ret = xmlOutputBufferCreateIO((xmlOutputWriteCallback)
|
||||
xmlBufferWrite,
|
||||
(xmlOutputCloseCallback)
|
||||
NULL, (void *) buffer, encoder);
|
||||
ret = xmlOutputBufferCreateIO(xmlBufferWrite, NULL, (void *) buffer,
|
||||
encoder);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
@ -2933,7 +2936,7 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
|
|||
ret = xmlAllocParserInputBuffer(enc);
|
||||
if (ret != NULL) {
|
||||
ret->context = (void *) mem;
|
||||
ret->readcallback = (xmlInputReadCallback) xmlNop;
|
||||
ret->readcallback = xmlInputReadCallbackNop;
|
||||
ret->closecallback = NULL;
|
||||
errcode = xmlBufAdd(ret->buffer, (const xmlChar *) mem, size);
|
||||
if (errcode != 0) {
|
||||
|
@ -3158,7 +3161,7 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
|
|||
* convert as much as possible to the parser reading buffer.
|
||||
*/
|
||||
use = xmlBufUse(in->raw);
|
||||
nbchars = xmlCharEncInput(in, 1);
|
||||
nbchars = xmlCharEncInput(in, 0);
|
||||
if (nbchars < 0) {
|
||||
xmlIOErr(XML_IO_ENCODER, NULL);
|
||||
in->error = XML_IO_ENCODER;
|
||||
|
@ -3274,7 +3277,7 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
|
|||
* convert as much as possible to the parser reading buffer.
|
||||
*/
|
||||
use = xmlBufUse(in->raw);
|
||||
nbchars = xmlCharEncInput(in, 1);
|
||||
nbchars = xmlCharEncInput(in, 0);
|
||||
if (nbchars < 0) {
|
||||
xmlIOErr(XML_IO_ENCODER, NULL);
|
||||
in->error = XML_IO_ENCODER;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue