https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5bb277a54b7437bd72b25b...
commit 5bb277a54b7437bd72b25b42cd8603c200cf358e Author: Thomas Faber thomas.faber@reactos.org AuthorDate: Sat Dec 1 11:57:57 2018 +0100 Commit: Thomas Faber thomas.faber@reactos.org CommitDate: Wed Jan 16 09:27:22 2019 +0100
[LIBXML2] Update to version 2.9.8. CORE-15280 --- sdk/include/reactos/libs/libxml/encoding.h | 5 + sdk/include/reactos/libs/libxml/hash.h | 9 +- sdk/include/reactos/libs/libxml/list.h | 6 +- sdk/include/reactos/libs/libxml/xmlversion.h | 13 +- sdk/include/reactos/libs/libxml/xmlversion.h.in | 3 - sdk/lib/3rdparty/libxml2/HTMLparser.c | 6 +- sdk/lib/3rdparty/libxml2/c14n.c | 38 +++-- sdk/lib/3rdparty/libxml2/catalog.c | 50 +++---- sdk/lib/3rdparty/libxml2/config.h | 47 +------ sdk/lib/3rdparty/libxml2/debugXML.c | 11 +- sdk/lib/3rdparty/libxml2/encoding.c | 47 ++++--- sdk/lib/3rdparty/libxml2/entities.c | 21 +-- sdk/lib/3rdparty/libxml2/globals.c | 22 ++- sdk/lib/3rdparty/libxml2/hash.c | 19 ++- sdk/lib/3rdparty/libxml2/include/win32config.h | 1 - sdk/lib/3rdparty/libxml2/libxml.h | 14 +- sdk/lib/3rdparty/libxml2/list.c | 4 +- sdk/lib/3rdparty/libxml2/nanohttp.c | 16 +-- sdk/lib/3rdparty/libxml2/parser.c | 26 ++-- sdk/lib/3rdparty/libxml2/parserInternals.c | 6 +- sdk/lib/3rdparty/libxml2/relaxng.c | 35 +++-- sdk/lib/3rdparty/libxml2/threads.c | 37 +++-- sdk/lib/3rdparty/libxml2/tree.c | 2 +- sdk/lib/3rdparty/libxml2/valid.c | 124 ++++++++++------- sdk/lib/3rdparty/libxml2/xinclude.c | 10 +- sdk/lib/3rdparty/libxml2/xlink.c | 2 +- sdk/lib/3rdparty/libxml2/xmlIO.c | 69 ++++----- sdk/lib/3rdparty/libxml2/xmllint.c | 28 ++-- sdk/lib/3rdparty/libxml2/xmlmodule.c | 2 + sdk/lib/3rdparty/libxml2/xmlreader.c | 7 +- sdk/lib/3rdparty/libxml2/xmlsave.c | 52 +++---- sdk/lib/3rdparty/libxml2/xmlschemas.c | 79 +++++++---- sdk/lib/3rdparty/libxml2/xmlschemastypes.c | 7 +- sdk/lib/3rdparty/libxml2/xmlwriter.c | 20 +-- sdk/lib/3rdparty/libxml2/xpath.c | 178 +++++++++--------------- sdk/lib/3rdparty/libxml2/xpointer.c | 2 - sdk/lib/3rdparty/libxml2/xzlib.c | 24 ++-- 37 files changed, 547 insertions(+), 495 deletions(-)
diff --git a/sdk/include/reactos/libs/libxml/encoding.h b/sdk/include/reactos/libs/libxml/encoding.h index 7967cc66a9..c875af6fb7 100644 --- a/sdk/include/reactos/libs/libxml/encoding.h +++ b/sdk/include/reactos/libs/libxml/encoding.h @@ -129,9 +129,14 @@ typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, * If iconv is supported, there are two extra fields. */ #ifdef LIBXML_ICU_ENABLED +/* Size of pivot buffer, same as icu/source/common/ucnv.cpp CHUNK_SIZE */ +#define ICU_PIVOT_BUF_SIZE 1024 struct _uconv_t { UConverter *uconv; /* for conversion between an encoding and UTF-16 */ UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */ + UChar pivot_buf[ICU_PIVOT_BUF_SIZE]; + UChar *pivot_source; + UChar *pivot_target; }; typedef struct _uconv_t uconv_t; #endif diff --git a/sdk/include/reactos/libs/libxml/hash.h b/sdk/include/reactos/libs/libxml/hash.h index dc8ab7ec52..6352874ef2 100644 --- a/sdk/include/reactos/libs/libxml/hash.h +++ b/sdk/include/reactos/libs/libxml/hash.h @@ -66,7 +66,7 @@ extern "C" { * * Callback to free data from a hash. */ -typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); +typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name); /** * xmlHashCopier: * @payload: the data in the hash @@ -76,7 +76,7 @@ typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); * * Returns a copy of the data or NULL in case of error. */ -typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); +typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name); /** * xmlHashScanner: * @payload: the data in the hash @@ -85,7 +85,7 @@ typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); * * Callback when scanning data in a hash with the simple scanner. */ -typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); +typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name); /** * xmlHashScannerFull: * @payload: the data in the hash @@ -111,6 +111,9 @@ XMLPUBFUN xmlHashTablePtr XMLCALL XMLPUBFUN void XMLCALL xmlHashFree (xmlHashTablePtr table, xmlHashDeallocator f); +XMLPUBFUN void XMLCALL + xmlHashDefaultDeallocator(void *entry, + const xmlChar *name);
/* * Add a new entry to the hash table. diff --git a/sdk/include/reactos/libs/libxml/list.h b/sdk/include/reactos/libs/libxml/list.h index 0504e0cff4..3211c75524 100644 --- a/sdk/include/reactos/libs/libxml/list.h +++ b/sdk/include/reactos/libs/libxml/list.h @@ -49,7 +49,7 @@ typedef int (*xmlListDataCompare) (const void *data0, const void *data1); * * Returns 0 to stop walking the list, 1 otherwise. */ -typedef int (*xmlListWalker) (const void *data, const void *user); +typedef int (*xmlListWalker) (const void *data, void *user);
/* Creation/Deletion */ XMLPUBFUN xmlListPtr XMLCALL @@ -110,11 +110,11 @@ XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL xmlListWalk (xmlListPtr l, xmlListWalker walker, - const void *user); + void *user); XMLPUBFUN void XMLCALL xmlListReverseWalk (xmlListPtr l, xmlListWalker walker, - const void *user); + void *user); XMLPUBFUN void XMLCALL xmlListMerge (xmlListPtr l1, xmlListPtr l2); diff --git a/sdk/include/reactos/libs/libxml/xmlversion.h b/sdk/include/reactos/libs/libxml/xmlversion.h index 90d61f507a..79802f1401 100644 --- a/sdk/include/reactos/libs/libxml/xmlversion.h +++ b/sdk/include/reactos/libs/libxml/xmlversion.h @@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.9.7" +#define LIBXML_DOTTED_VERSION "2.9.8"
/** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20907 +#define LIBXML_VERSION 20908
/** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20907" +#define LIBXML_VERSION_STRING "20908"
/** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-GITv2.9.7-rc1" +#define LIBXML_VERSION_EXTRA "-GITv2.9.8-rc1-2-gd910e99c3"
/** * LIBXML_TEST_VERSION: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20907); +#define LIBXML_TEST_VERSION xmlCheckVersion(20908);
#ifndef VMS #if 0 @@ -410,9 +410,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif
#ifdef __GNUC__ -#ifdef HAVE_ANSIDECL_H -#include <ansidecl.h> -#endif
/** * ATTRIBUTE_UNUSED: diff --git a/sdk/include/reactos/libs/libxml/xmlversion.h.in b/sdk/include/reactos/libs/libxml/xmlversion.h.in index b173be9e07..d10f9754ea 100644 --- a/sdk/include/reactos/libs/libxml/xmlversion.h.in +++ b/sdk/include/reactos/libs/libxml/xmlversion.h.in @@ -410,9 +410,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif
#ifdef __GNUC__ -#ifdef HAVE_ANSIDECL_H -#include <ansidecl.h> -#endif
/** * ATTRIBUTE_UNUSED: diff --git a/sdk/lib/3rdparty/libxml2/HTMLparser.c b/sdk/lib/3rdparty/libxml2/HTMLparser.c index e4f816e5e7..9adeb1748d 100644 --- a/sdk/lib/3rdparty/libxml2/HTMLparser.c +++ b/sdk/lib/3rdparty/libxml2/HTMLparser.c @@ -26,7 +26,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED #include <zlib.h> #endif
@@ -3635,7 +3635,7 @@ htmlCheckEncodingDirect(htmlParserCtxtPtr ctxt, const xmlChar *encoding) { */ processed = ctxt->input->cur - ctxt->input->base; xmlBufShrink(ctxt->input->buf->buffer, processed); - nbchars = xmlCharEncInput(ctxt->input->buf, 1); + nbchars = xmlCharEncInput(ctxt->input->buf, 0); if (nbchars < 0) { htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, "htmlCheckEncoding: encoder error\n", @@ -6674,7 +6674,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) { - xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); + xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator); ctxt->attsDefault = NULL; } if (ctxt->attsSpecial != NULL) { diff --git a/sdk/lib/3rdparty/libxml2/c14n.c b/sdk/lib/3rdparty/libxml2/c14n.c index be687ea398..c04ce66634 100644 --- a/sdk/lib/3rdparty/libxml2/c14n.c +++ b/sdk/lib/3rdparty/libxml2/c14n.c @@ -89,7 +89,7 @@ static int xmlExcC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NCtxPtr ctx);
-static int xmlC14NIsNodeInNodeset (xmlNodeSetPtr nodes, +static int xmlC14NIsNodeInNodeset (void *user_data, xmlNodePtr node, xmlNodePtr parent);
@@ -252,7 +252,8 @@ xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error, #define XML_NAMESPACES_DEFAULT 16
static int -xmlC14NIsNodeInNodeset(xmlNodeSetPtr nodes, xmlNodePtr node, xmlNodePtr parent) { +xmlC14NIsNodeInNodeset(void *user_data, xmlNodePtr node, xmlNodePtr parent) { + xmlNodeSetPtr nodes = (xmlNodeSetPtr) user_data; if((nodes != NULL) && (node != NULL)) { if(node->type != XML_NAMESPACE_DECL) { return(xmlXPathNodeSetContains(nodes, node)); @@ -513,8 +514,10 @@ xmlC14NIsXmlNs(xmlNsPtr ns) * Returns -1 if ns1 < ns2, 0 if ns1 == ns2 or 1 if ns1 > ns2. */ static int -xmlC14NNsCompare(xmlNsPtr ns1, xmlNsPtr ns2) +xmlC14NNsCompare(const void *data1, const void *data2) { + const xmlNsPtr ns1 = (const xmlNsPtr) data1; + const xmlNsPtr ns2 = (const xmlNsPtr) data2; if (ns1 == ns2) return (0); if (ns1 == NULL) @@ -559,6 +562,11 @@ xmlC14NPrintNamespaces(const xmlNsPtr ns, xmlC14NCtxPtr ctx) return (1); }
+static int +xmlC14NPrintNamespacesWalker(const void *ns, void *ctx) { + return xmlC14NPrintNamespaces((const xmlNsPtr) ns, (xmlC14NCtxPtr) ctx); +} + /** * xmlC14NProcessNamespacesAxis: * @ctx: the C14N context @@ -615,7 +623,7 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) /* * Create a sorted list to store element namespaces */ - list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NNsCompare); + list = xmlListCreate(NULL, xmlC14NNsCompare); if (list == NULL) { xmlC14NErrInternal("creating namespaces list (c14n)"); return (-1); @@ -663,7 +671,7 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) /* * print out all elements from list */ - xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx); + xmlListWalk(list, xmlC14NPrintNamespacesWalker, (void *) ctx);
/* * Cleanup @@ -728,7 +736,7 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) /* * Create a sorted list to store element namespaces */ - list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NNsCompare); + list = xmlListCreate(NULL, xmlC14NNsCompare); if (list == NULL) { xmlC14NErrInternal("creating namespaces list (exc c14n)"); return (-1); @@ -840,7 +848,7 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) /* * print out all elements from list */ - xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx); + xmlListWalk(list, xmlC14NPrintNamespacesWalker, (void *) ctx);
/* * Cleanup @@ -879,8 +887,10 @@ xmlC14NIsXmlAttr(xmlAttrPtr attr) * Returns -1 if attr1 < attr2, 0 if attr1 == attr2 or 1 if attr1 > attr2. */ static int -xmlC14NAttrsCompare(xmlAttrPtr attr1, xmlAttrPtr attr2) +xmlC14NAttrsCompare(const void *data1, const void *data2) { + const xmlAttrPtr attr1 = (const xmlAttrPtr) data1; + const xmlAttrPtr attr2 = (const xmlAttrPtr) data2; int ret = 0;
/* @@ -931,8 +941,10 @@ xmlC14NAttrsCompare(xmlAttrPtr attr1, xmlAttrPtr attr2) * Returns 1 on success or 0 on fail. */ static int -xmlC14NPrintAttrs(const xmlAttrPtr attr, xmlC14NCtxPtr ctx) +xmlC14NPrintAttrs(const void *data, void *user) { + const xmlAttrPtr attr = (const xmlAttrPtr) data; + xmlC14NCtxPtr ctx = (xmlC14NCtxPtr) user; xmlChar *value; xmlChar *buffer;
@@ -1142,7 +1154,7 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible) /* * Create a sorted list to store element attributes */ - list = xmlListCreate(NULL, (xmlListDataCompare) xmlC14NAttrsCompare); + list = xmlListCreate(NULL, xmlC14NAttrsCompare); if (list == NULL) { xmlC14NErrInternal("creating attributes list"); return (-1); @@ -1331,7 +1343,7 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible) /* * print out all elements from list */ - xmlListWalk(list, (xmlListWalker) xmlC14NPrintAttrs, (const void *) ctx); + xmlListWalk(list, xmlC14NPrintAttrs, (void *) ctx);
/* * Cleanup @@ -1964,7 +1976,7 @@ xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes, int mode, xmlChar ** inclusive_ns_prefixes, int with_comments, xmlOutputBufferPtr buf) { return(xmlC14NExecute(doc, - (xmlC14NIsVisibleCallback)xmlC14NIsNodeInNodeset, + xmlC14NIsNodeInNodeset, nodes, mode, inclusive_ns_prefixes, @@ -2077,7 +2089,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, xmlC14NErrParam("saving doc"); return (-1); } -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED if (compression < 0) compression = xmlGetCompressMode(); #endif diff --git a/sdk/lib/3rdparty/libxml2/catalog.c b/sdk/lib/3rdparty/libxml2/catalog.c index f6186a1c84..f814121ce8 100644 --- a/sdk/lib/3rdparty/libxml2/catalog.c +++ b/sdk/lib/3rdparty/libxml2/catalog.c @@ -319,12 +319,13 @@ xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret);
/** * xmlFreeCatalogEntry: - * @ret: a Catalog entry + * @payload: a Catalog entry * * Free the memory allocated to a Catalog entry */ static void -xmlFreeCatalogEntry(xmlCatalogEntryPtr ret) { +xmlFreeCatalogEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlCatalogEntryPtr ret = (xmlCatalogEntryPtr) payload; if (ret == NULL) return; /* @@ -367,20 +368,22 @@ xmlFreeCatalogEntryList(xmlCatalogEntryPtr ret) {
while (ret != NULL) { next = ret->next; - xmlFreeCatalogEntry(ret); + xmlFreeCatalogEntry(ret, NULL); ret = next; } }
/** * xmlFreeCatalogHashEntryList: - * @ret: a Catalog entry list + * @payload: a Catalog entry list * * Free the memory allocated to list of Catalog entries from the * catalog file hash. */ static void -xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) { +xmlFreeCatalogHashEntryList(void *payload, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlCatalogEntryPtr catal = (xmlCatalogEntryPtr) payload; xmlCatalogEntryPtr children, next;
if (catal == NULL) @@ -391,11 +394,11 @@ xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) { next = children->next; children->dealloc = 0; children->children = NULL; - xmlFreeCatalogEntry(children); + xmlFreeCatalogEntry(children, NULL); children = next; } catal->dealloc = 0; - xmlFreeCatalogEntry(catal); + xmlFreeCatalogEntry(catal, NULL); }
/** @@ -440,8 +443,7 @@ xmlFreeCatalog(xmlCatalogPtr catal) { if (catal->xml != NULL) xmlFreeCatalogEntryList(catal->xml); if (catal->sgml != NULL) - xmlHashFree(catal->sgml, - (xmlHashDeallocator) xmlFreeCatalogEntry); + xmlHashFree(catal->sgml, xmlFreeCatalogEntry); xmlFree(catal); }
@@ -460,7 +462,10 @@ xmlFreeCatalog(xmlCatalogPtr catal) { * Serialize an SGML Catalog entry */ static void -xmlCatalogDumpEntry(xmlCatalogEntryPtr entry, FILE *out) { +xmlCatalogDumpEntry(void *payload, void *data, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlCatalogEntryPtr entry = (xmlCatalogEntryPtr) payload; + FILE *out = (FILE *) data; if ((entry == NULL) || (out == NULL)) return; switch (entry->type) { @@ -723,7 +728,10 @@ BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"); * Convert one entry from the catalog */ static void -xmlCatalogConvertEntry(xmlCatalogEntryPtr entry, xmlCatalogPtr catal) { +xmlCatalogConvertEntry(void *payload, void *data, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlCatalogEntryPtr entry = (xmlCatalogEntryPtr) payload; + xmlCatalogPtr catal = (xmlCatalogPtr) data; if ((entry == NULL) || (catal == NULL) || (catal->sgml == NULL) || (catal->xml == NULL)) return; @@ -756,8 +764,7 @@ xmlCatalogConvertEntry(xmlCatalogEntryPtr entry, xmlCatalogPtr catal) { entry->type = XML_CATA_CATALOG; break; default: - xmlHashRemoveEntry(catal->sgml, entry->name, - (xmlHashDeallocator) xmlFreeCatalogEntry); + xmlHashRemoveEntry(catal->sgml, entry->name, xmlFreeCatalogEntry); return; } /* @@ -797,9 +804,7 @@ xmlConvertSGMLCatalog(xmlCatalogPtr catal) { xmlGenericError(xmlGenericErrorContext, "Converting SGML catalog to XML\n"); } - xmlHashScan(catal->sgml, - (xmlHashScanner) xmlCatalogConvertEntry, - &catal); + xmlHashScan(catal->sgml, xmlCatalogConvertEntry, &catal); return(0); }
@@ -2486,7 +2491,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, NULL, XML_CATA_PREFER_NONE, NULL); res = xmlHashAddEntry(catal->sgml, name, entry); if (res < 0) { - xmlFreeCatalogEntry(entry); + xmlFreeCatalogEntry(entry, NULL); } xmlFree(filename); } @@ -2499,7 +2504,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, XML_CATA_PREFER_NONE, NULL); res = xmlHashAddEntry(catal->sgml, sysid, entry); if (res < 0) { - xmlFreeCatalogEntry(entry); + xmlFreeCatalogEntry(entry, NULL); } } else { xmlChar *filename; @@ -2937,8 +2942,7 @@ xmlACatalogDump(xmlCatalogPtr catal, FILE *out) { if (catal->type == XML_XML_CATALOG_TYPE) { xmlDumpXMLCatalog(out, catal->xml); } else { - xmlHashScan(catal->sgml, - (xmlHashScanner) xmlCatalogDumpEntry, out); + xmlHashScan(catal->sgml, xmlCatalogDumpEntry, out); } } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -3002,8 +3006,7 @@ xmlACatalogRemove(xmlCatalogPtr catal, const xmlChar *value) { if (catal->type == XML_XML_CATALOG_TYPE) { res = xmlDelXMLCatalog(catal->xml, value); } else { - res = xmlHashRemoveEntry(catal->sgml, value, - (xmlHashDeallocator) xmlFreeCatalogEntry); + res = xmlHashRemoveEntry(catal->sgml, value, xmlFreeCatalogEntry); if (res == 0) res = 1; } @@ -3284,8 +3287,7 @@ xmlCatalogCleanup(void) { xmlGenericError(xmlGenericErrorContext, "Catalogs cleanup\n"); if (xmlCatalogXMLFiles != NULL) - xmlHashFree(xmlCatalogXMLFiles, - (xmlHashDeallocator)xmlFreeCatalogHashEntryList); + xmlHashFree(xmlCatalogXMLFiles, xmlFreeCatalogHashEntryList); xmlCatalogXMLFiles = NULL; if (xmlDefaultCatalog != NULL) xmlFreeCatalog(xmlDefaultCatalog); diff --git a/sdk/lib/3rdparty/libxml2/config.h b/sdk/lib/3rdparty/libxml2/config.h index 9e23531e20..3dbb37ea0c 100644 --- a/sdk/lib/3rdparty/libxml2/config.h +++ b/sdk/lib/3rdparty/libxml2/config.h @@ -4,9 +4,6 @@ /* Type cast for the gethostbyname() argument */ #define GETHOSTBYNAME_ARG_CAST
-/* Define to 1 if you have the <ansidecl.h> header file. */ -/* #undef HAVE_ANSIDECL_H */ - /* Define to 1 if you have the <arpa/inet.h> header file. */ /* #undef HAVE_ARPA_INET_H */
@@ -16,9 +13,6 @@ /* Whether struct sockaddr::__ss_family exists */ /* #undef HAVE_BROKEN_SS_FAMILY */
-/* Define to 1 if you have the `class' function. */ -/* #undef HAVE_CLASS */ - /* Define to 1 if you have the <ctype.h> header file. */ #define HAVE_CTYPE_H 1
@@ -40,24 +34,12 @@ /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1
-/* Define to 1 if you have the `finite' function. */ -#define HAVE_FINITE 1 - /* Define to 1 if you have the <float.h> header file. */ #define HAVE_FLOAT_H 1
-/* Define to 1 if you have the `fpclass' function. */ -#define HAVE_FPCLASS 1 - /* Define to 1 if you have the `fprintf' function. */ #define HAVE_FPRINTF 1
-/* Define to 1 if you have the `fp_class' function. */ -/* #undef HAVE_FP_CLASS */ - -/* Define to 1 if you have the <fp_class.h> header file. */ -/* #undef HAVE_FP_CLASS_H */ - /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1
@@ -67,9 +49,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ /* #undef HAVE_GETTIMEOFDAY */
-/* Define to 1 if you have the <ieeefp.h> header file. */ -/* #undef HAVE_IEEEFP_H */ - /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1
@@ -82,24 +61,15 @@ /* Define if isnan is there */ #define HAVE_ISNAN /**/
-/* Define to 1 if you have the `isnand' function. */ -/* #undef HAVE_ISNAND */ - /* Define if history library is there (-lhistory) */ /* #undef HAVE_LIBHISTORY */
-/* Have compression library */ -/* #undef HAVE_LIBLZMA */ - /* Define if pthread library is there (-lpthread) */ /* #undef HAVE_LIBPTHREAD */
/* Define if readline library is there (-lreadline) */ /* #undef HAVE_LIBREADLINE */
-/* Have compression library */ -/* #undef HAVE_LIBZ */ - /* Define to 1 if you have the <limits.h> header file. */ #define HAVE_LIMITS_H 1
@@ -129,9 +99,6 @@ # undef /**/ HAVE_MMAP #endif
-/* Define to 1 if you have the <nan.h> header file. */ -/* #undef HAVE_NAN_H */ - /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */
@@ -195,12 +162,6 @@ /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1
-/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - /* Define to 1 if you have the `strftime' function. */ #define HAVE_STRFTIME 1
@@ -210,9 +171,6 @@ /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1
-/* Define to 1 if you have the `strndup' function. */ -/* #undef HAVE_STRNDUP */ - /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ @@ -266,9 +224,6 @@ /* Define to 1 if you have the <zlib.h> header file. */ #define HAVE_ZLIB_H 1
-/* Define to 1 if you have the `_stat' function. */ -#define HAVE__STAT 1 - /* Whether __va_copy() is available */ #define HAVE___VA_COPY 1
@@ -312,7 +267,7 @@ /* #undef VA_LIST_IS_ARRAY */
/* Version number of package */ -#define VERSION "2.9.2" +#define VERSION "2.9.8"
/* Determine what socket length (socklen_t) data type is */ #define XML_SOCKLEN_T int diff --git a/sdk/lib/3rdparty/libxml2/debugXML.c b/sdk/lib/3rdparty/libxml2/debugXML.c index a8ec8a4611..c98db0bcc7 100644 --- a/sdk/lib/3rdparty/libxml2/debugXML.c +++ b/sdk/lib/3rdparty/libxml2/debugXML.c @@ -1229,8 +1229,11 @@ xmlCtxtDumpDocument(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) }
static void -xmlCtxtDumpEntityCallback(xmlEntityPtr cur, xmlDebugCtxtPtr ctxt) +xmlCtxtDumpEntityCallback(void *payload, void *data, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlEntityPtr cur = (xmlEntityPtr) payload; + xmlDebugCtxtPtr ctxt = (xmlDebugCtxtPtr) data; if (cur == NULL) { if (!ctxt->check) fprintf(ctxt->output, "Entity is NULL"); @@ -1289,8 +1292,7 @@ xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
if (!ctxt->check) fprintf(ctxt->output, "Entities in internal subset\n"); - xmlHashScan(table, (xmlHashScanner) xmlCtxtDumpEntityCallback, - ctxt); + xmlHashScan(table, xmlCtxtDumpEntityCallback, ctxt); } else fprintf(ctxt->output, "No entities in internal subset\n"); if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { @@ -1299,8 +1301,7 @@ xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc)
if (!ctxt->check) fprintf(ctxt->output, "Entities in external subset\n"); - xmlHashScan(table, (xmlHashScanner) xmlCtxtDumpEntityCallback, - ctxt); + xmlHashScan(table, xmlCtxtDumpEntityCallback, ctxt); } else if (!ctxt->check) fprintf(ctxt->output, "No entities in external subset\n"); } diff --git a/sdk/lib/3rdparty/libxml2/encoding.c b/sdk/lib/3rdparty/libxml2/encoding.c index cd019c5191..de7b511a29 100644 --- a/sdk/lib/3rdparty/libxml2/encoding.c +++ b/sdk/lib/3rdparty/libxml2/encoding.c @@ -110,6 +110,9 @@ openIcuConverter(const char* name, int toUnicode) if (conv == NULL) return NULL;
+ conv->pivot_source = conv->pivot_buf; + conv->pivot_target = conv->pivot_buf; + conv->uconv = ucnv_open(name, &status); if (U_FAILURE(status)) goto error; @@ -1850,6 +1853,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, * @outlen: the length of @out * @in: a pointer to an array of ISO Latin 1 chars * @inlen: the length of @in + * @flush: if true, indicates end of input * * Returns 0 if success, or * -1 by lack of space, or @@ -1863,7 +1867,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, */ static int xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen, - const unsigned char *in, int *inlen) { + const unsigned char *in, int *inlen, int flush) { const char *ucv_in = (const char *) in; char *ucv_out = (char *) out; UErrorCode err = U_ZERO_ERROR; @@ -1873,33 +1877,31 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen, return(-1); }
- /* - * TODO(jungshik) - * 1. is ucnv_convert(To|From)Algorithmic better? - * 2. had we better use an explicit pivot buffer? - * 3. error returned comes from 'fromUnicode' only even - * when toUnicode is true ! - */ if (toUnicode) { /* encoding => UTF-16 => UTF-8 */ ucnv_convertEx(cd->utf8, cd->uconv, &ucv_out, ucv_out + *outlen, - &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL, - 0, TRUE, &err); + &ucv_in, ucv_in + *inlen, cd->pivot_buf, + &cd->pivot_source, &cd->pivot_target, + cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, flush, &err); } else { /* UTF-8 => UTF-16 => encoding */ ucnv_convertEx(cd->uconv, cd->utf8, &ucv_out, ucv_out + *outlen, - &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL, - 0, TRUE, &err); + &ucv_in, ucv_in + *inlen, cd->pivot_buf, + &cd->pivot_source, &cd->pivot_target, + cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, flush, &err); } *inlen = ucv_in - (const char*) in; *outlen = ucv_out - (char *) out; - if (U_SUCCESS(err)) + if (U_SUCCESS(err)) { + /* reset pivot buf if this is the last call for input (flush==TRUE) */ + if (flush) + cd->pivot_source = cd->pivot_target = cd->pivot_buf; return 0; + } if (err == U_BUFFER_OVERFLOW_ERROR) return -1; if (err == U_INVALID_CHAR_FOUND || err == U_ILLEGAL_CHAR_FOUND) return -2; - /* if (err == U_TRUNCATED_CHAR_FOUND) */ return -3; } #endif /* LIBXML_ICU_ENABLED */ @@ -1912,8 +1914,9 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
static int xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out, - int *outlen, const unsigned char *in, int *inlen) { + int *outlen, const unsigned char *in, int *inlen, int flush) { int ret; + (void)flush;
if (handler->input != NULL) { ret = handler->input(out, outlen, in, inlen); @@ -1925,7 +1928,8 @@ xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out, #endif /* LIBXML_ICONV_ENABLED */ #ifdef LIBXML_ICU_ENABLED else if (handler->uconv_in != NULL) { - ret = xmlUconvWrapper(handler->uconv_in, 1, out, outlen, in, inlen); + ret = xmlUconvWrapper(handler->uconv_in, 1, out, outlen, in, inlen, + flush); } #endif /* LIBXML_ICU_ENABLED */ else { @@ -1953,7 +1957,8 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out, #endif /* LIBXML_ICONV_ENABLED */ #ifdef LIBXML_ICU_ENABLED else if (handler->uconv_out != NULL) { - ret = xmlUconvWrapper(handler->uconv_out, 0, out, outlen, in, inlen); + ret = xmlUconvWrapper(handler->uconv_out, 0, out, outlen, in, inlen, + TRUE); } #endif /* LIBXML_ICU_ENABLED */ else { @@ -2015,7 +2020,7 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, }
ret = xmlEncInputChunk(handler, &out->content[out->use], &written, - in->content, &toconv); + in->content, &toconv, 0); xmlBufferShrink(in, toconv); out->use += written; out->content[out->use] = 0; @@ -2133,7 +2138,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len) c_in = toconv; c_out = written; ret = xmlEncInputChunk(input->encoder, xmlBufEnd(out), &c_out, - xmlBufContent(in), &c_in); + xmlBufContent(in), &c_in, 0); xmlBufShrink(in, c_in); xmlBufAddLen(out, c_out); if (ret == -1) @@ -2231,7 +2236,7 @@ xmlCharEncInput(xmlParserInputBufferPtr input, int flush) c_in = toconv; c_out = written; ret = xmlEncInputChunk(input->encoder, xmlBufEnd(out), &c_out, - xmlBufContent(in), &c_in); + xmlBufContent(in), &c_in, flush); xmlBufShrink(in, c_in); xmlBufAddLen(out, c_out); if (ret == -1) @@ -2317,7 +2322,7 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, written = out->size - out->use - 1; } ret = xmlEncInputChunk(handler, &out->content[out->use], &written, - in->content, &toconv); + in->content, &toconv, 1); xmlBufferShrink(in, toconv); out->use += written; out->content[out->use] = 0; diff --git a/sdk/lib/3rdparty/libxml2/entities.c b/sdk/lib/3rdparty/libxml2/entities.c index c819337638..43549bc5de 100644 --- a/sdk/lib/3rdparty/libxml2/entities.c +++ b/sdk/lib/3rdparty/libxml2/entities.c @@ -885,10 +885,9 @@ xmlCreateEntitiesTable(void) { * Deallocate the memory used by an entities in the hash table. */ static void -xmlFreeEntityWrapper(xmlEntityPtr entity, - const xmlChar *name ATTRIBUTE_UNUSED) { +xmlFreeEntityWrapper(void *entity, const xmlChar *name ATTRIBUTE_UNUSED) { if (entity != NULL) - xmlFreeEntity(entity); + xmlFreeEntity((xmlEntityPtr) entity); }
/** @@ -899,7 +898,7 @@ xmlFreeEntityWrapper(xmlEntityPtr entity, */ void xmlFreeEntitiesTable(xmlEntitiesTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntityWrapper); + xmlHashFree(table, xmlFreeEntityWrapper); }
#ifdef LIBXML_TREE_ENABLED @@ -911,8 +910,9 @@ xmlFreeEntitiesTable(xmlEntitiesTablePtr table) { * * Returns the new xmlEntitiesPtr or NULL in case of error. */ -static xmlEntityPtr -xmlCopyEntity(xmlEntityPtr ent) { +static void * +xmlCopyEntity(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlEntityPtr ent = (xmlEntityPtr) payload; xmlEntityPtr cur;
cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); @@ -949,7 +949,7 @@ xmlCopyEntity(xmlEntityPtr ent) { */ xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table) { - return(xmlHashCopy(table, (xmlHashCopier) xmlCopyEntity)); + return(xmlHashCopy(table, xmlCopyEntity)); } #endif /* LIBXML_TREE_ENABLED */
@@ -1090,8 +1090,9 @@ xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) { * When using the hash table scan function, arguments need to be reversed */ static void -xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) { - xmlDumpEntityDecl(buf, ent); +xmlDumpEntityDeclScan(void *ent, void *buf, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlDumpEntityDecl((xmlBufferPtr) buf, (xmlEntityPtr) ent); }
/** @@ -1103,7 +1104,7 @@ xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) { */ void xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) { - xmlHashScan(table, (xmlHashScanner)xmlDumpEntityDeclScan, buf); + xmlHashScan(table, xmlDumpEntityDeclScan, buf); } #endif /* LIBXML_OUTPUT_ENABLED */ #define bottom_entities diff --git a/sdk/lib/3rdparty/libxml2/globals.c b/sdk/lib/3rdparty/libxml2/globals.c index e351b03ff5..20b430880a 100644 --- a/sdk/lib/3rdparty/libxml2/globals.c +++ b/sdk/lib/3rdparty/libxml2/globals.c @@ -92,7 +92,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup; * * The variable holding the libxml free() implementation */ -xmlFreeFunc xmlFree = (xmlFreeFunc) free; +xmlFreeFunc xmlFree = free; /** * xmlMalloc: * @size: the size requested in bytes @@ -101,7 +101,7 @@ xmlFreeFunc xmlFree = (xmlFreeFunc) free; * * Returns a pointer to the newly allocated block or NULL in case of error */ -xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc; +xmlMallocFunc xmlMalloc = malloc; /** * xmlMallocAtomic: * @size: the size requested in bytes @@ -112,7 +112,7 @@ xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc; * * Returns a pointer to the newly allocated block or NULL in case of error */ -xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc; +xmlMallocFunc xmlMallocAtomic = malloc; /** * xmlRealloc: * @mem: an already allocated block of memory @@ -122,7 +122,19 @@ xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc; * * Returns a pointer to the newly reallocated block or NULL in case of error */ -xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc; +xmlReallocFunc xmlRealloc = realloc; +/** + * xmlPosixStrdup + * @cur: the input char * + * + * a strdup implementation with a type signature matching POSIX + * + * Returns a new xmlChar * or NULL + */ +static char * +xmlPosixStrdup(const char *cur) { + return((char*) xmlCharStrdup(cur)); +} /** * xmlMemStrdup: * @str: a zero terminated string @@ -131,7 +143,7 @@ xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc; * * Returns the copy of the string or NULL in case of error */ -xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; +xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup; #endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
#include <libxml/threads.h> diff --git a/sdk/lib/3rdparty/libxml2/hash.c b/sdk/lib/3rdparty/libxml2/hash.c index 5dcaeb4021..b0b4abc92e 100644 --- a/sdk/lib/3rdparty/libxml2/hash.c +++ b/sdk/lib/3rdparty/libxml2/hash.c @@ -360,6 +360,18 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { xmlFree(table); }
+/** + * xmlHashDefaultDeallocator: + * @entry: the hash table entry + * @name: the entry's name + * + * Free a hash table entry with xmlFree. + */ +void +xmlHashDefaultDeallocator(void *entry, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlFree(entry); +} + /** * xmlHashAddEntry: * @table: the hash table @@ -912,8 +924,11 @@ void xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScanner f, void *data) { - xmlHashScanFull3 (table, name, name2, name3, - (xmlHashScannerFull) f, data); + stubData stubdata; + stubdata.data = data; + stubdata.hashscanner = f; + xmlHashScanFull3(table, name, name2, name3, stubHashScannerFull, + &stubdata); }
/** diff --git a/sdk/lib/3rdparty/libxml2/include/win32config.h b/sdk/lib/3rdparty/libxml2/include/win32config.h index 85967551c8..7fc7403140 100644 --- a/sdk/lib/3rdparty/libxml2/include/win32config.h +++ b/sdk/lib/3rdparty/libxml2/include/win32config.h @@ -13,7 +13,6 @@ #include "wincecompat.h" #else #define HAVE_SYS_STAT_H -#define HAVE__STAT #define HAVE_STAT #define HAVE_STDLIB_H #define HAVE_TIME_H diff --git a/sdk/lib/3rdparty/libxml2/libxml.h b/sdk/lib/3rdparty/libxml2/libxml.h index 4fe56d21eb..64e30f7704 100644 --- a/sdk/lib/3rdparty/libxml2/libxml.h +++ b/sdk/lib/3rdparty/libxml2/libxml.h @@ -60,6 +60,18 @@ int vfprintf(FILE *, const char *, va_list); #include "trio.h" #endif
+#if defined(__clang__) || \ + (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)) +#define XML_IGNORE_PEDANTIC_WARNINGS \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored "-Wpedantic"") +#define XML_POP_WARNINGS \ + _Pragma("GCC diagnostic pop") +#else +#define XML_IGNORE_PEDANTIC_WARNINGS +#define XML_POP_WARNINGS +#endif + /* * Internal variable indicating if a callback has been registered for * node creation/destruction. It avoids spending a lot of time in locking @@ -96,7 +108,7 @@ int __xmlRandom(void); #endif
XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg); -int xmlNop(void); +int xmlInputReadCallbackNop(void *context, char *buffer, int len);
#ifdef IN_LIBXML #ifdef __GNUC__ diff --git a/sdk/lib/3rdparty/libxml2/list.c b/sdk/lib/3rdparty/libxml2/list.c index caa8333138..24da6b1e9b 100644 --- a/sdk/lib/3rdparty/libxml2/list.c +++ b/sdk/lib/3rdparty/libxml2/list.c @@ -673,7 +673,7 @@ xmlListSort(xmlListPtr l) * apply the walker function to it */ void -xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user) { +xmlListWalk(xmlListPtr l, xmlListWalker walker, void *user) { xmlLinkPtr lk;
if ((l == NULL) || (walker == NULL)) @@ -694,7 +694,7 @@ xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user) { * apply the walker function to it */ void -xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, const void *user) { +xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, void *user) { xmlLinkPtr lk;
if ((l == NULL) || (walker == NULL)) diff --git a/sdk/lib/3rdparty/libxml2/nanohttp.c b/sdk/lib/3rdparty/libxml2/nanohttp.c index 9cd2292fdc..2143718a14 100644 --- a/sdk/lib/3rdparty/libxml2/nanohttp.c +++ b/sdk/lib/3rdparty/libxml2/nanohttp.c @@ -63,7 +63,7 @@ #ifdef HAVE_STRINGS_H #include <strings.h> #endif -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED #include <zlib.h> #endif
@@ -145,7 +145,7 @@ typedef struct xmlNanoHTTPCtxt { char *authHeader; /* contents of {WWW,Proxy}-Authenticate header */ char *encoding; /* encoding extracted from the contentType */ char *mimeType; /* Mime-Type extracted from the contentType */ -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED z_stream *strm; /* Zlib stream object */ int usesGzip; /* "Content-Encoding: gzip" was detected */ #endif @@ -434,7 +434,7 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) { if (ctxt->mimeType != NULL) xmlFree(ctxt->mimeType); if (ctxt->location != NULL) xmlFree(ctxt->location); if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader); -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED if (ctxt->strm != NULL) { inflateEnd(ctxt->strm); xmlFree(ctxt->strm); @@ -817,7 +817,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) { if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader); ctxt->authHeader = xmlMemStrdup(cur); -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED } else if ( !xmlStrncasecmp( BAD_CAST line, BAD_CAST"Content-Encoding:", 17) ) { cur += 17; while ((*cur == ' ') || (*cur == '\t')) cur++; @@ -1273,7 +1273,7 @@ xmlNanoHTTPOpenRedir(const char *URL, char **contentType, char **redir) { int xmlNanoHTTPRead(void *ctx, void *dest, int len) { xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx; -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED int bytes_read = 0; int orig_avail_in; int z_ret; @@ -1283,7 +1283,7 @@ xmlNanoHTTPRead(void *ctx, void *dest, int len) { if (dest == NULL) return(-1); if (len <= 0) return(0);
-#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED if (ctxt->usesGzip == 1) { if (ctxt->strm == NULL) return(0);
@@ -1424,7 +1424,7 @@ retry: /* 1 for '?' */ blen += strlen(ctxt->query) + 1; blen += strlen(method) + strlen(ctxt->path) + 24; -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED /* reserve for possible 'Accept-Encoding: gzip' string */ blen += 23; #endif @@ -1468,7 +1468,7 @@ retry: ctxt->hostname, ctxt->port); }
-#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED p += snprintf(p, blen - (p - bp), "Accept-Encoding: gzip\r\n"); #endif
diff --git a/sdk/lib/3rdparty/libxml2/parser.c b/sdk/lib/3rdparty/libxml2/parser.c index 1c5e036ea2..ca9fde2c87 100644 --- a/sdk/lib/3rdparty/libxml2/parser.c +++ b/sdk/lib/3rdparty/libxml2/parser.c @@ -83,12 +83,6 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif -#ifdef HAVE_ZLIB_H -#include <zlib.h> -#endif -#ifdef HAVE_LZMA_H -#include <lzma.h> -#endif
#include "buf.h" #include "enc.h" @@ -155,7 +149,7 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, 0, 0, 0); --ctxt->depth; - if (ctxt->errNo == XML_ERR_ENTITY_LOOP) { + if ((rep == NULL) || (ctxt->errNo == XML_ERR_ENTITY_LOOP)) { ent->content[0] = 0; }
@@ -2086,7 +2080,8 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
if (((curEnd > (unsigned long) XML_MAX_LOOKUP_LIMIT) || (curBase > (unsigned long) XML_MAX_LOOKUP_LIMIT)) && - ((ctxt->input->buf) && (ctxt->input->buf->readcallback != (xmlInputReadCallback) xmlNop)) && + ((ctxt->input->buf) && + (ctxt->input->buf->readcallback != xmlInputReadCallbackNop)) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup"); xmlHaltParser(ctxt); @@ -3375,9 +3370,9 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { */ ctxt->input->cur -= l; GROW; - ctxt->input->cur += l; if (ctxt->instate == XML_PARSER_EOF) return(NULL); + ctxt->input->cur += l; c = CUR_CHAR(l); } } @@ -7194,6 +7189,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { (ret != XML_WAR_UNDECLARED_ENTITY)) { xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, "Entity '%s' failed to parse\n", ent->name); + if (ent->content != NULL) + ent->content[0] = 0; xmlParserEntityCheck(ctxt, 0, ent, 0); } else if (list != NULL) { xmlFreeNodeList(list); @@ -12221,6 +12218,7 @@ xmldecl_done: /* TODO 2.6.0 */ xmlGenericError(xmlGenericErrorContext, "xmlParseChunk: encoder error\n"); + xmlHaltParser(ctxt); return(XML_ERR_INVALID_ENCODING); } xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current); @@ -13369,6 +13367,7 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, ctxt->userData = ctxt; if (ctxt->dict != NULL) xmlDictFree(ctxt->dict); ctxt->dict = oldctxt->dict; + ctxt->input_id = oldctxt->input_id + 1; ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3); ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5); ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); @@ -13622,6 +13621,7 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, xmlDetectSAX2(ctxt); ctxt->myDoc = doc; /* parsing in context, i.e. as within existing content */ + ctxt->input_id = 2; ctxt->instate = XML_PARSER_CONTENT;
fake = xmlNewComment(NULL); @@ -13834,6 +13834,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, newDoc->oldNs = doc->oldNs; } ctxt->instate = XML_PARSER_CONTENT; + ctxt->input_id = 2; ctxt->depth = depth;
/* @@ -13994,6 +13995,11 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID, if (pctx != NULL) { ctxt->options = pctx->options; ctxt->_private = pctx->_private; + /* + * this is a subparser of pctx, so the input_id should be + * incremented to distinguish from main entity + */ + ctxt->input_id = pctx->input_id + 1; }
uri = xmlBuildURI(URL, base); @@ -14875,7 +14881,7 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt) xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) { - xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); + xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator); ctxt->attsDefault = NULL; } if (ctxt->attsSpecial != NULL) { diff --git a/sdk/lib/3rdparty/libxml2/parserInternals.c b/sdk/lib/3rdparty/libxml2/parserInternals.c index efb23872a5..8c0cd57af6 100644 --- a/sdk/lib/3rdparty/libxml2/parserInternals.c +++ b/sdk/lib/3rdparty/libxml2/parserInternals.c @@ -32,7 +32,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED #include <zlib.h> #endif
@@ -1214,7 +1214,7 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, /* * convert as much as possible of the buffer */ - nbchars = xmlCharEncInput(input->buf, 1); + nbchars = xmlCharEncInput(input->buf, 0); } else { /* * convert just enough to get @@ -1795,7 +1795,7 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt) if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab); if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs); if (ctxt->attsDefault != NULL) - xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree); + xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator); if (ctxt->attsSpecial != NULL) xmlHashFree(ctxt->attsSpecial, NULL); if (ctxt->freeElems != NULL) { diff --git a/sdk/lib/3rdparty/libxml2/relaxng.c b/sdk/lib/3rdparty/libxml2/relaxng.c index b12e1ae363..88d351df86 100644 --- a/sdk/lib/3rdparty/libxml2/relaxng.c +++ b/sdk/lib/3rdparty/libxml2/relaxng.c @@ -2729,9 +2729,10 @@ static xmlHashTablePtr xmlRelaxNGRegisteredTypes = NULL; * Free the structure associated to the type library */ static void -xmlRelaxNGFreeTypeLibrary(xmlRelaxNGTypeLibraryPtr lib, +xmlRelaxNGFreeTypeLibrary(void *payload, const xmlChar * namespace ATTRIBUTE_UNUSED) { + xmlRelaxNGTypeLibraryPtr lib = (xmlRelaxNGTypeLibraryPtr) payload; if (lib == NULL) return; if (lib->namespace != NULL) @@ -2842,8 +2843,7 @@ xmlRelaxNGCleanupTypes(void) xmlSchemaCleanupTypes(); if (xmlRelaxNGTypeInitialized == 0) return; - xmlHashFree(xmlRelaxNGRegisteredTypes, (xmlHashDeallocator) - xmlRelaxNGFreeTypeLibrary); + xmlHashFree(xmlRelaxNGRegisteredTypes, xmlRelaxNGFreeTypeLibrary); xmlRelaxNGTypeInitialized = 0; }
@@ -4311,10 +4311,11 @@ xmlRelaxNGCheckGroupAttrs(xmlRelaxNGParserCtxtPtr ctxt, * algorithm */ static void -xmlRelaxNGComputeInterleaves(xmlRelaxNGDefinePtr def, - xmlRelaxNGParserCtxtPtr ctxt, - xmlChar * name ATTRIBUTE_UNUSED) +xmlRelaxNGComputeInterleaves(void *payload, void *data, + const xmlChar * name ATTRIBUTE_UNUSED) { + xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload; + xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data; xmlRelaxNGDefinePtr cur, *tmp;
xmlRelaxNGPartitionPtr partitions = NULL; @@ -4663,7 +4664,7 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) * Import import one references into the current grammar */ static void -xmlRelaxNGParseImportRef(void *payload, void *data, xmlChar *name) { +xmlRelaxNGParseImportRef(void *payload, void *data, const xmlChar *name) { xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data; xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload; int tmp; @@ -5670,10 +5671,10 @@ xmlRelaxNGParseGrammarContent(xmlRelaxNGParserCtxtPtr ctxt, * element of a given grammar using the same name. */ static void -xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref, - xmlRelaxNGParserCtxtPtr ctxt, - const xmlChar * name) +xmlRelaxNGCheckReference(void *payload, void *data, const xmlChar * name) { + xmlRelaxNGDefinePtr ref = (xmlRelaxNGDefinePtr) payload; + xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data; xmlRelaxNGGrammarPtr grammar; xmlRelaxNGDefinePtr def, cur;
@@ -5726,9 +5727,10 @@ xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref, * element of a given grammar using the same name. */ static void -xmlRelaxNGCheckCombine(xmlRelaxNGDefinePtr define, - xmlRelaxNGParserCtxtPtr ctxt, const xmlChar * name) +xmlRelaxNGCheckCombine(void *payload, void *data, const xmlChar * name) { + xmlRelaxNGDefinePtr define = (xmlRelaxNGDefinePtr) payload; + xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data; xmlChar *combine; int choiceOrInterleave = -1; int missing = 0; @@ -6611,16 +6613,14 @@ xmlRelaxNGParseGrammar(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes) */ xmlRelaxNGCombineStart(ctxt, ret); if (ret->defs != NULL) { - xmlHashScan(ret->defs, (xmlHashScanner) xmlRelaxNGCheckCombine, - ctxt); + xmlHashScan(ret->defs, xmlRelaxNGCheckCombine, ctxt); }
/* * link together defines and refs in this grammar */ if (ret->refs != NULL) { - xmlHashScan(ret->refs, (xmlHashScanner) xmlRelaxNGCheckReference, - ctxt); + xmlHashScan(ret->refs, xmlRelaxNGCheckReference, ctxt); }
@@ -7551,8 +7551,7 @@ xmlRelaxNGParse(xmlRelaxNGParserCtxtPtr ctxt) * try to preprocess interleaves */ if (ctxt->interleaves != NULL) { - xmlHashScan(ctxt->interleaves, - (xmlHashScanner) xmlRelaxNGComputeInterleaves, ctxt); + xmlHashScan(ctxt->interleaves, xmlRelaxNGComputeInterleaves, ctxt); }
/* diff --git a/sdk/lib/3rdparty/libxml2/threads.c b/sdk/lib/3rdparty/libxml2/threads.c index 95432d0d04..2d803b803d 100644 --- a/sdk/lib/3rdparty/libxml2/threads.c +++ b/sdk/lib/3rdparty/libxml2/threads.c @@ -47,10 +47,13 @@
#ifdef HAVE_PTHREAD_H
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 303) && \ + defined(__GLIBC__) && defined(__linux__) + static int libxml_is_threaded = -1; -#if defined(__GNUC__) && defined(__GLIBC__) -#ifdef __linux__ -#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) + +#define XML_PTHREAD_WEAK + #pragma weak pthread_once #pragma weak pthread_getspecific #pragma weak pthread_setspecific @@ -68,9 +71,13 @@ static int libxml_is_threaded = -1; #pragma weak pthread_key_create #pragma weak pthread_key_delete #pragma weak pthread_cond_signal -#endif -#endif /* __linux__ */ -#endif /* defined(__GNUC__) && defined(__GLIBC__) */ + +#else /* __GNUC__, __GLIBC__, __linux__ */ + +static int libxml_is_threaded = 1; + +#endif /* __GNUC__, __GLIBC__, __linux__ */ + #endif /* HAVE_PTHREAD_H */
/* @@ -422,8 +429,11 @@ __xmlGlobalInitMutexLock(void) /* Make sure the global init lock is initialized and then lock it. */ #ifdef HAVE_PTHREAD_H /* The mutex is statically initialized, so we just lock it. */ - if (pthread_mutex_lock != NULL) - pthread_mutex_lock(&global_init_lock); +#ifdef XML_PTHREAD_WEAK + if (pthread_mutex_lock == NULL) + return; +#endif /* XML_PTHREAD_WEAK */ + pthread_mutex_lock(&global_init_lock); #elif defined HAVE_WIN32_THREADS LPCRITICAL_SECTION cs;
@@ -492,8 +502,11 @@ void __xmlGlobalInitMutexUnlock(void) { #ifdef HAVE_PTHREAD_H - if (pthread_mutex_unlock != NULL) - pthread_mutex_unlock(&global_init_lock); +#ifdef XML_PTHREAD_WEAK + if (pthread_mutex_unlock == NULL) + return; +#endif /* XML_PTHREAD_WEAK */ + pthread_mutex_unlock(&global_init_lock); #elif defined HAVE_WIN32_THREADS if (global_init_lock != NULL) { LeaveCriticalSection(global_init_lock); @@ -845,6 +858,7 @@ void xmlInitThreads(void) { #ifdef HAVE_PTHREAD_H +#ifdef XML_PTHREAD_WEAK if (libxml_is_threaded == -1) { if ((pthread_once != NULL) && (pthread_getspecific != NULL) && @@ -870,6 +884,7 @@ xmlInitThreads(void) libxml_is_threaded = 0; } } +#endif /* XML_PTHREAD_WEAK */ #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) InitializeCriticalSection(&cleanup_helpers_cs); #endif @@ -896,7 +911,7 @@ xmlCleanupThreads(void) xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n"); #endif #ifdef HAVE_PTHREAD_H - if ((libxml_is_threaded) && (pthread_key_delete != NULL)) + if (libxml_is_threaded != 0) pthread_key_delete(globalkey); once_control = once_control_init; #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) diff --git a/sdk/lib/3rdparty/libxml2/tree.c b/sdk/lib/3rdparty/libxml2/tree.c index 86a8da7982..959421bd65 100644 --- a/sdk/lib/3rdparty/libxml2/tree.c +++ b/sdk/lib/3rdparty/libxml2/tree.c @@ -27,7 +27,7 @@ #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED #include <zlib.h> #endif
diff --git a/sdk/lib/3rdparty/libxml2/valid.c b/sdk/lib/3rdparty/libxml2/valid.c index a64b96be95..b1cfede2db 100644 --- a/sdk/lib/3rdparty/libxml2/valid.c +++ b/sdk/lib/3rdparty/libxml2/valid.c @@ -1597,6 +1597,11 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, return(ret); }
+static void +xmlFreeElementTableEntry(void *elem, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlFreeElement((xmlElementPtr) elem); +} + /** * xmlFreeElementTable: * @table: An element table @@ -1605,7 +1610,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, */ void xmlFreeElementTable(xmlElementTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeElement); + xmlHashFree(table, xmlFreeElementTableEntry); }
#ifdef LIBXML_TREE_ENABLED @@ -1617,8 +1622,9 @@ xmlFreeElementTable(xmlElementTablePtr table) { * * Returns the new xmlElementPtr or NULL in case of error. */ -static xmlElementPtr -xmlCopyElement(xmlElementPtr elem) { +static void * +xmlCopyElement(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlElementPtr elem = (xmlElementPtr) payload; xmlElementPtr cur;
cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement)); @@ -1653,8 +1659,7 @@ xmlCopyElement(xmlElementPtr elem) { */ xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table) { - return((xmlElementTablePtr) xmlHashCopy(table, - (xmlHashCopier) xmlCopyElement)); + return((xmlElementTablePtr) xmlHashCopy(table, xmlCopyElement)); } #endif /* LIBXML_TREE_ENABLED */
@@ -1728,8 +1733,9 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) { * the arguments. */ static void -xmlDumpElementDeclScan(xmlElementPtr elem, xmlBufferPtr buf) { - xmlDumpElementDecl(buf, elem); +xmlDumpElementDeclScan(void *elem, void *buf, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlDumpElementDecl((xmlBufferPtr) buf, (xmlElementPtr) elem); }
/** @@ -1743,7 +1749,7 @@ void xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) { if ((buf == NULL) || (table == NULL)) return; - xmlHashScan(table, (xmlHashScanner) xmlDumpElementDeclScan, buf); + xmlHashScan(table, xmlDumpElementDeclScan, buf); } #endif /* LIBXML_OUTPUT_ENABLED */
@@ -2143,6 +2149,11 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, return(ret); }
+static void +xmlFreeAttributeTableEntry(void *attr, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlFreeAttribute((xmlAttributePtr) attr); +} + /** * xmlFreeAttributeTable: * @table: An attribute table @@ -2151,7 +2162,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, */ void xmlFreeAttributeTable(xmlAttributeTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeAttribute); + xmlHashFree(table, xmlFreeAttributeTableEntry); }
#ifdef LIBXML_TREE_ENABLED @@ -2163,8 +2174,9 @@ xmlFreeAttributeTable(xmlAttributeTablePtr table) { * * Returns the new xmlAttributePtr or NULL in case of error. */ -static xmlAttributePtr -xmlCopyAttribute(xmlAttributePtr attr) { +static void * +xmlCopyAttribute(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlAttributePtr attr = (xmlAttributePtr) payload; xmlAttributePtr cur;
cur = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute)); @@ -2198,8 +2210,7 @@ xmlCopyAttribute(xmlAttributePtr attr) { */ xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table) { - return((xmlAttributeTablePtr) xmlHashCopy(table, - (xmlHashCopier) xmlCopyAttribute)); + return((xmlAttributeTablePtr) xmlHashCopy(table, xmlCopyAttribute)); } #endif /* LIBXML_TREE_ENABLED */
@@ -2294,8 +2305,9 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) { * This is used with the hash scan function - just reverses arguments */ static void -xmlDumpAttributeDeclScan(xmlAttributePtr attr, xmlBufferPtr buf) { - xmlDumpAttributeDecl(buf, attr); +xmlDumpAttributeDeclScan(void *attr, void *buf, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlDumpAttributeDecl((xmlBufferPtr) buf, (xmlAttributePtr) attr); }
/** @@ -2309,7 +2321,7 @@ void xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) { if ((buf == NULL) || (table == NULL)) return; - xmlHashScan(table, (xmlHashScanner) xmlDumpAttributeDeclScan, buf); + xmlHashScan(table, xmlDumpAttributeDeclScan, buf); } #endif /* LIBXML_OUTPUT_ENABLED */
@@ -2415,6 +2427,11 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, return(ret); }
+static void +xmlFreeNotationTableEntry(void *nota, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlFreeNotation((xmlNotationPtr) nota); +} + /** * xmlFreeNotationTable: * @table: An notation table @@ -2423,7 +2440,7 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, */ void xmlFreeNotationTable(xmlNotationTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeNotation); + xmlHashFree(table, xmlFreeNotationTableEntry); }
#ifdef LIBXML_TREE_ENABLED @@ -2435,8 +2452,9 @@ xmlFreeNotationTable(xmlNotationTablePtr table) { * * Returns the new xmlNotationPtr or NULL in case of error. */ -static xmlNotationPtr -xmlCopyNotation(xmlNotationPtr nota) { +static void * +xmlCopyNotation(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlNotationPtr nota = (xmlNotationPtr) payload; xmlNotationPtr cur;
cur = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation)); @@ -2469,8 +2487,7 @@ xmlCopyNotation(xmlNotationPtr nota) { */ xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table) { - return((xmlNotationTablePtr) xmlHashCopy(table, - (xmlHashCopier) xmlCopyNotation)); + return((xmlNotationTablePtr) xmlHashCopy(table, xmlCopyNotation)); } #endif /* LIBXML_TREE_ENABLED */
@@ -2510,8 +2527,9 @@ xmlDumpNotationDecl(xmlBufferPtr buf, xmlNotationPtr nota) { * This is called with the hash scan function, and just reverses args */ static void -xmlDumpNotationDeclScan(xmlNotationPtr nota, xmlBufferPtr buf) { - xmlDumpNotationDecl(buf, nota); +xmlDumpNotationDeclScan(void *nota, void *buf, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlDumpNotationDecl((xmlBufferPtr) buf, (xmlNotationPtr) nota); }
/** @@ -2525,7 +2543,7 @@ void xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) { if ((buf == NULL) || (table == NULL)) return; - xmlHashScan(table, (xmlHashScanner) xmlDumpNotationDeclScan, buf); + xmlHashScan(table, xmlDumpNotationDeclScan, buf); } #endif /* LIBXML_OUTPUT_ENABLED */
@@ -2653,6 +2671,11 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, return(ret); }
+static void +xmlFreeIDTableEntry(void *id, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlFreeID((xmlIDPtr) id); +} + /** * xmlFreeIDTable: * @table: An id table @@ -2661,7 +2684,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, */ void xmlFreeIDTable(xmlIDTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeID); + xmlHashFree(table, xmlFreeIDTableEntry); }
/** @@ -2761,7 +2784,7 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { return(-1); }
- xmlHashRemoveEntry(table, ID, (xmlHashDeallocator) xmlFreeID); + xmlHashRemoveEntry(table, ID, xmlFreeIDTableEntry); xmlFree(ID); attr->atype = 0; return(0); @@ -2845,13 +2868,14 @@ xmlFreeRef(xmlLinkPtr lk) { }
/** - * xmlFreeRefList: + * xmlFreeRefTableEntry: * @list_ref: A list of references. * * Deallocate the memory used by a list of references */ static void -xmlFreeRefList(xmlListPtr list_ref) { +xmlFreeRefTableEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlListPtr list_ref = (xmlListPtr) payload; if (list_ref == NULL) return; xmlListDelete(list_ref); } @@ -2864,7 +2888,7 @@ xmlFreeRefList(xmlListPtr list_ref) { * Returns 0 to abort the walk or 1 to continue */ static int -xmlWalkRemoveRef(const void *data, const void *user) +xmlWalkRemoveRef(const void *data, void *user) { xmlAttrPtr attr0 = ((xmlRefPtr)data)->attr; xmlAttrPtr attr1 = ((xmlRemoveMemoPtr)user)->ap; @@ -3002,7 +3026,7 @@ failed: */ void xmlFreeRefTable(xmlRefTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeRefList); + xmlHashFree(table, xmlFreeRefTableEntry); }
/** @@ -3099,8 +3123,7 @@ xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) {
/*If the list is empty then remove the list entry in the hash */ if (xmlListEmpty(ref_list)) - xmlHashUpdateEntry(table, ID, NULL, (xmlHashDeallocator) - xmlFreeRefList); + xmlHashUpdateEntry(table, ID, NULL, xmlFreeRefTableEntry); xmlFree(ID); return(0); } @@ -4096,8 +4119,10 @@ xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem, }
static void -xmlValidateAttributeIdCallback(xmlAttributePtr attr, int *count, - const xmlChar* name ATTRIBUTE_UNUSED) { +xmlValidateAttributeIdCallback(void *payload, void *data, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlAttributePtr attr = (xmlAttributePtr) payload; + int *count = (int *) data; if (attr->atype == XML_ATTRIBUTE_ID) (*count)++; }
@@ -4169,7 +4194,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, nbId = 0; if (doc->intSubset != NULL) { table = (xmlAttributeTablePtr) doc->intSubset->attributes; - xmlHashScan3(table, NULL, NULL, attr->elem, (xmlHashScanner) + xmlHashScan3(table, NULL, NULL, attr->elem, xmlValidateAttributeIdCallback, &nbId); } } @@ -6530,7 +6555,7 @@ xmlValidateRef(xmlRefPtr ref, xmlValidCtxtPtr ctxt, * Returns 0 to abort the walk or 1 to continue */ static int -xmlWalkValidateList(const void *data, const void *user) +xmlWalkValidateList(const void *data, void *user) { xmlValidateMemoPtr memo = (xmlValidateMemoPtr)user; xmlValidateRef((xmlRefPtr)data, memo->ctxt, memo->name); @@ -6545,8 +6570,9 @@ xmlWalkValidateList(const void *data, const void *user) * */ static void -xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlValidCtxtPtr ctxt, - const xmlChar *name) { +xmlValidateCheckRefCallback(void *payload, void *data, const xmlChar *name) { + xmlListPtr ref_list = (xmlListPtr) payload; + xmlValidCtxtPtr ctxt = (xmlValidCtxtPtr) data; xmlValidateMemo memo;
if (ref_list == NULL) @@ -6602,7 +6628,7 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { table = (xmlRefTablePtr) doc->refs; ctxt->doc = doc; ctxt->valid = 1; - xmlHashScan(table, (xmlHashScanner) xmlValidateCheckRefCallback, ctxt); + xmlHashScan(table, xmlValidateCheckRefCallback, ctxt);
ctxt->finishDtd = save; return(ctxt->valid); @@ -6659,8 +6685,10 @@ xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd) { }
static void -xmlValidateNotationCallback(xmlEntityPtr cur, xmlValidCtxtPtr ctxt, +xmlValidateNotationCallback(void *payload, void *data, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlEntityPtr cur = (xmlEntityPtr) payload; + xmlValidCtxtPtr ctxt = (xmlValidCtxtPtr) data; if (cur == NULL) return; if (cur->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) { @@ -6678,8 +6706,10 @@ xmlValidateNotationCallback(xmlEntityPtr cur, xmlValidCtxtPtr ctxt, }
static void -xmlValidateAttributeCallback(xmlAttributePtr cur, xmlValidCtxtPtr ctxt, - const xmlChar *name ATTRIBUTE_UNUSED) { +xmlValidateAttributeCallback(void *payload, void *data, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlAttributePtr cur = (xmlAttributePtr) payload; + xmlValidCtxtPtr ctxt = (xmlValidCtxtPtr) data; int ret; xmlDocPtr doc; xmlElementPtr elem = NULL; @@ -6778,22 +6808,20 @@ xmlValidateDtdFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { dtd = doc->intSubset; if ((dtd != NULL) && (dtd->attributes != NULL)) { table = (xmlAttributeTablePtr) dtd->attributes; - xmlHashScan(table, (xmlHashScanner) xmlValidateAttributeCallback, ctxt); + xmlHashScan(table, xmlValidateAttributeCallback, ctxt); } if ((dtd != NULL) && (dtd->entities != NULL)) { entities = (xmlEntitiesTablePtr) dtd->entities; - xmlHashScan(entities, (xmlHashScanner) xmlValidateNotationCallback, - ctxt); + xmlHashScan(entities, xmlValidateNotationCallback, ctxt); } dtd = doc->extSubset; if ((dtd != NULL) && (dtd->attributes != NULL)) { table = (xmlAttributeTablePtr) dtd->attributes; - xmlHashScan(table, (xmlHashScanner) xmlValidateAttributeCallback, ctxt); + xmlHashScan(table, xmlValidateAttributeCallback, ctxt); } if ((dtd != NULL) && (dtd->entities != NULL)) { entities = (xmlEntitiesTablePtr) dtd->entities; - xmlHashScan(entities, (xmlHashScanner) xmlValidateNotationCallback, - ctxt); + xmlHashScan(entities, xmlValidateNotationCallback, ctxt); } return(ctxt->valid); } diff --git a/sdk/lib/3rdparty/libxml2/xinclude.c b/sdk/lib/3rdparty/libxml2/xinclude.c index e3bb43ec50..001e992f7c 100644 --- a/sdk/lib/3rdparty/libxml2/xinclude.c +++ b/sdk/lib/3rdparty/libxml2/xinclude.c @@ -1261,8 +1261,10 @@ struct _xmlXIncludeMergeData { * Inplements the merge of one entity */ static void -xmlXIncludeMergeEntity(xmlEntityPtr ent, xmlXIncludeMergeDataPtr data, - xmlChar *name ATTRIBUTE_UNUSED) { +xmlXIncludeMergeEntity(void *payload, void *vdata, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlEntityPtr ent = (xmlEntityPtr) payload; + xmlXIncludeMergeDataPtr data = (xmlXIncludeMergeDataPtr) vdata; xmlEntityPtr ret, prev; xmlDocPtr doc; xmlXIncludeCtxtPtr ctxt; @@ -1367,7 +1369,7 @@ xmlXIncludeMergeEntities(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, data.doc = doc;
xmlHashScan((xmlHashTablePtr) source->entities, - (xmlHashScanner) xmlXIncludeMergeEntity, &data); + xmlXIncludeMergeEntity, &data); } source = from->extSubset; if ((source != NULL) && (source->entities != NULL)) { @@ -1382,7 +1384,7 @@ xmlXIncludeMergeEntities(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, if ((!xmlStrEqual(target->ExternalID, source->ExternalID)) && (!xmlStrEqual(target->SystemID, source->SystemID))) { xmlHashScan((xmlHashTablePtr) source->entities, - (xmlHashScanner) xmlXIncludeMergeEntity, &data); + xmlXIncludeMergeEntity, &data); } } return(0); diff --git a/sdk/lib/3rdparty/libxml2/xlink.c b/sdk/lib/3rdparty/libxml2/xlink.c index c0e4ff3234..ecf9f968a7 100644 --- a/sdk/lib/3rdparty/libxml2/xlink.c +++ b/sdk/lib/3rdparty/libxml2/xlink.c @@ -28,7 +28,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED #include <zlib.h> #endif
diff --git a/sdk/lib/3rdparty/libxml2/xmlIO.c b/sdk/lib/3rdparty/libxml2/xmlIO.c index 3ff958a97c..3b3434cd98 100644 --- a/sdk/lib/3rdparty/libxml2/xmlIO.c +++ b/sdk/lib/3rdparty/libxml2/xmlIO.c @@ -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; diff --git a/sdk/lib/3rdparty/libxml2/xmllint.c b/sdk/lib/3rdparty/libxml2/xmllint.c index a691aa68b0..6512540956 100644 --- a/sdk/lib/3rdparty/libxml2/xmllint.c +++ b/sdk/lib/3rdparty/libxml2/xmllint.c @@ -814,13 +814,14 @@ xmlShellReadline(char *prompt) { * * ************************************************************************/
-static int myRead(FILE *f, char * buf, int len) { - return(fread(buf, 1, len, f)); +static int myRead(void *f, char *buf, int len) { + return(fread(buf, 1, len, (FILE *) f)); } -static void myClose(FILE *f) { - if (f != stdin) { - fclose(f); - } +static int myClose(void *context) { + FILE *f = (FILE *) context; + if (f == stdin) + return(0); + return(fclose(f)); }
/************************************************************************ @@ -2303,14 +2304,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { #endif if (f != NULL) { if (rectxt == NULL) - doc = xmlReadIO((xmlInputReadCallback) myRead, - (xmlInputCloseCallback) myClose, f, - filename, NULL, options); + doc = xmlReadIO(myRead, myClose, f, filename, NULL, + options); else - doc = xmlCtxtReadIO(rectxt, - (xmlInputReadCallback) myRead, - (xmlInputCloseCallback) myClose, f, - filename, NULL, options); + doc = xmlCtxtReadIO(rectxt, myRead, myClose, f, + filename, NULL, options); } else doc = NULL; } @@ -3017,7 +3015,7 @@ static void usage(FILE *f, const char *name) { fprintf(f, "\t--repeat : repeat 100 times, for timing or profiling\n"); fprintf(f, "\t--insert : ad-hoc test for valid insertions\n"); #ifdef LIBXML_OUTPUT_ENABLED -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED fprintf(f, "\t--compress : turn on gzip compression of output\n"); #endif #endif /* LIBXML_OUTPUT_ENABLED */ @@ -3297,7 +3295,7 @@ main(int argc, char **argv) { } #endif #ifdef LIBXML_OUTPUT_ENABLED -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED else if ((!strcmp(argv[i], "-compress")) || (!strcmp(argv[i], "--compress"))) { compress++; diff --git a/sdk/lib/3rdparty/libxml2/xmlmodule.c b/sdk/lib/3rdparty/libxml2/xmlmodule.c index e3a8bd64c9..a95ab66acd 100644 --- a/sdk/lib/3rdparty/libxml2/xmlmodule.c +++ b/sdk/lib/3rdparty/libxml2/xmlmodule.c @@ -340,6 +340,7 @@ xmlModulePlatformClose(void *handle) static int xmlModulePlatformSymbol(void *handle, const char *name, void **symbol) { +XML_IGNORE_PEDANTIC_WARNINGS #ifdef _WIN32_WCE /* * GetProcAddressA seems only available on WinCE @@ -349,6 +350,7 @@ xmlModulePlatformSymbol(void *handle, const char *name, void **symbol) *symbol = GetProcAddress(handle, name); #endif return (NULL == *symbol) ? -1 : 0; +XML_POP_WARNINGS }
#endif /* _WIN32 */ diff --git a/sdk/lib/3rdparty/libxml2/xmlreader.c b/sdk/lib/3rdparty/libxml2/xmlreader.c index 34c4c6bc9b..4053269b4e 100644 --- a/sdk/lib/3rdparty/libxml2/xmlreader.c +++ b/sdk/lib/3rdparty/libxml2/xmlreader.c @@ -491,6 +491,11 @@ xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) { } }
+static void +xmlTextReaderFreeIDTableEntry(void *id, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlFreeID((xmlIDPtr) id); +} + /** * xmlTextReaderFreeIDTable: * @table: An id table @@ -499,7 +504,7 @@ xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) { */ static void xmlTextReaderFreeIDTable(xmlIDTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeID); + xmlHashFree(table, xmlTextReaderFreeIDTableEntry); }
/** diff --git a/sdk/lib/3rdparty/libxml2/xmlsave.c b/sdk/lib/3rdparty/libxml2/xmlsave.c index fea135ffb2..6c7418ec39 100644 --- a/sdk/lib/3rdparty/libxml2/xmlsave.c +++ b/sdk/lib/3rdparty/libxml2/xmlsave.c @@ -1595,31 +1595,31 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { if (cur->properties != NULL) xhtmlAttrListDumpOutput(ctxt, cur->properties);
- if ((cur->type == XML_ELEMENT_NODE) && - (cur->parent != NULL) && - (cur->parent->parent == (xmlNodePtr) cur->doc) && - xmlStrEqual(cur->name, BAD_CAST"head") && - xmlStrEqual(cur->parent->name, BAD_CAST"html")) { - - tmp = cur->children; - while (tmp != NULL) { - if (xmlStrEqual(tmp->name, BAD_CAST"meta")) { - xmlChar *httpequiv; - - httpequiv = xmlGetProp(tmp, BAD_CAST"http-equiv"); - if (httpequiv != NULL) { - if (xmlStrcasecmp(httpequiv, BAD_CAST"Content-Type") == 0) { - xmlFree(httpequiv); - break; - } - xmlFree(httpequiv); - } - } - tmp = tmp->next; - } - if (tmp == NULL) - addmeta = 1; - } + if ((cur->type == XML_ELEMENT_NODE) && + (cur->parent != NULL) && + (cur->parent->parent == (xmlNodePtr) cur->doc) && + xmlStrEqual(cur->name, BAD_CAST"head") && + xmlStrEqual(cur->parent->name, BAD_CAST"html")) { + + tmp = cur->children; + while (tmp != NULL) { + if (xmlStrEqual(tmp->name, BAD_CAST"meta")) { + xmlChar *httpequiv; + + httpequiv = xmlGetProp(tmp, BAD_CAST"http-equiv"); + if (httpequiv != NULL) { + if (xmlStrcasecmp(httpequiv, BAD_CAST"Content-Type") == 0) { + xmlFree(httpequiv); + break; + } + xmlFree(httpequiv); + } + } + tmp = tmp->next; + } + if (tmp == NULL) + addmeta = 1; + }
if ((cur->type == XML_ELEMENT_NODE) && (cur->children == NULL)) { if (((cur->ns == NULL) || (cur->ns->prefix == NULL)) && @@ -2704,7 +2704,7 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur, return(-1); }
-#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED if (cur->compression < 0) cur->compression = xmlGetCompressMode(); #endif /* diff --git a/sdk/lib/3rdparty/libxml2/xmlschemas.c b/sdk/lib/3rdparty/libxml2/xmlschemas.c index 05a12e0b34..405f72ae48 100644 --- a/sdk/lib/3rdparty/libxml2/xmlschemas.c +++ b/sdk/lib/3rdparty/libxml2/xmlschemas.c @@ -2842,7 +2842,7 @@ xmlSchemaPResCompAttrErr(xmlSchemaParserCtxtPtr ctxt, xmlSchemaFormatItemForReport(&des, NULL, ownerItem, ownerElem); if (refTypeStr == NULL) refTypeStr = (const char *) xmlSchemaItemTypeToStr(refType); - xmlSchemaPErrExt(ctxt, ownerElem, error, + xmlSchemaPErrExt(ctxt, ownerElem, error, NULL, NULL, NULL, "%s, attribute '%s': The QName value '%s' does not resolve to a(n) " "%s.\n", BAD_CAST des, BAD_CAST name, @@ -3565,6 +3565,12 @@ xmlSchemaBucketFree(xmlSchemaBucketPtr bucket) xmlFree(bucket); }
+static void +xmlSchemaBucketFreeEntry(void *bucket, const xmlChar *name ATTRIBUTE_UNUSED) +{ + xmlSchemaBucketFree((xmlSchemaBucketPtr) bucket); +} + static xmlSchemaBucketPtr xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, int type, const xmlChar *targetNamespace) @@ -4159,8 +4165,7 @@ xmlSchemaFree(xmlSchemaPtr schema) xmlHashFree(schema->idcDef, NULL);
if (schema->schemasImports != NULL) - xmlHashFree(schema->schemasImports, - (xmlHashDeallocator) xmlSchemaBucketFree); + xmlHashFree(schema->schemasImports, xmlSchemaBucketFreeEntry); if (schema->includes != NULL) { xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) schema->includes; int i; @@ -4196,11 +4201,13 @@ xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output); /* forward */ * Dump the element */ static void -xmlSchemaElementDump(xmlSchemaElementPtr elem, FILE * output, +xmlSchemaElementDump(void *payload, void *data, const xmlChar * name ATTRIBUTE_UNUSED, const xmlChar * namespace ATTRIBUTE_UNUSED, const xmlChar * context ATTRIBUTE_UNUSED) { + xmlSchemaElementPtr elem = (xmlSchemaElementPtr) payload; + FILE *output = (FILE *) data; if (elem == NULL) return;
@@ -4515,6 +4522,13 @@ xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output) #endif }
+static void +xmlSchemaTypeDumpEntry(void *type, void *output, + const xmlChar *name ATTRIBUTE_UNUSED) +{ + xmlSchemaTypeDump((xmlSchemaTypePtr) type, (FILE *) output); +} + /** * xmlSchemaDump: * @output: the file output @@ -4543,10 +4557,8 @@ xmlSchemaDump(FILE * output, xmlSchemaPtr schema) fprintf(output, "\n"); if (schema->annot != NULL) xmlSchemaAnnotDump(output, schema->annot); - xmlHashScan(schema->typeDecl, (xmlHashScanner) xmlSchemaTypeDump, - output); - xmlHashScanFull(schema->elemDecl, - (xmlHashScannerFull) xmlSchemaElementDump, output); + xmlHashScan(schema->typeDecl, xmlSchemaTypeDumpEntry, output); + xmlHashScanFull(schema->elemDecl, xmlSchemaElementDump, output); }
#ifdef DEBUG_IDC_NODE_TABLE @@ -5706,6 +5718,12 @@ xmlSchemaSubstGroupFree(xmlSchemaSubstGroupPtr group) xmlFree(group); }
+static void +xmlSchemaSubstGroupFreeEntry(void *group, const xmlChar *name ATTRIBUTE_UNUSED) +{ + xmlSchemaSubstGroupFree((xmlSchemaSubstGroupPtr) group); +} + static xmlSchemaSubstGroupPtr xmlSchemaSubstGroupAdd(xmlSchemaParserCtxtPtr pctxt, xmlSchemaElementPtr head) @@ -7373,8 +7391,8 @@ attr_next: */ if (defValue != NULL) use->defValue = defValue; - if (defValueType == WXS_ATTR_DEF_VAL_FIXED) - use->flags |= XML_SCHEMA_ATTR_USE_FIXED; + if (defValueType == WXS_ATTR_DEF_VAL_FIXED) + use->flags |= XML_SCHEMA_ATTR_USE_FIXED; }
check_children: @@ -9918,8 +9936,7 @@ xmlSchemaConstructionCtxtFree(xmlSchemaConstructionCtxtPtr con) if (con->pending != NULL) xmlSchemaItemListFree(con->pending); if (con->substGroups != NULL) - xmlHashFree(con->substGroups, - (xmlHashDeallocator) xmlSchemaSubstGroupFree); + xmlHashFree(con->substGroups, xmlSchemaSubstGroupFreeEntry); if (con->redefs != NULL) xmlSchemaRedefListFree(con->redefs); if (con->dict != NULL) @@ -21293,8 +21310,7 @@ exit: con->bucket = oldbucket; con->pending->nbItems = 0; if (con->substGroups != NULL) { - xmlHashFree(con->substGroups, - (xmlHashDeallocator) xmlSchemaSubstGroupFree); + xmlHashFree(con->substGroups, xmlSchemaSubstGroupFreeEntry); con->substGroups = NULL; } if (con->redefs != NULL) { @@ -22002,9 +22018,11 @@ xmlSchemaVAddNodeQName(xmlSchemaValidCtxtPtr vctxt, * Returns the item, or NULL on internal errors. */ static void -xmlSchemaAugmentIDC(xmlSchemaIDCPtr idcDef, - xmlSchemaValidCtxtPtr vctxt) +xmlSchemaAugmentIDC(void *payload, void *data, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlSchemaIDCPtr idcDef = (xmlSchemaIDCPtr) payload; + xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) data; xmlSchemaIDCAugPtr aidc;
aidc = (xmlSchemaIDCAugPtr) xmlMalloc(sizeof(xmlSchemaIDCAug)); @@ -22038,10 +22056,12 @@ xmlSchemaAugmentIDC(xmlSchemaIDCPtr idcDef, * Creates an augmented IDC definition for the imported schema. */ static void -xmlSchemaAugmentImportedIDC(xmlSchemaImportPtr imported, xmlSchemaValidCtxtPtr vctxt, xmlChar *name ATTRIBUTE_UNUSED) { +xmlSchemaAugmentImportedIDC(void *payload, void *data, + const xmlChar *name ATTRIBUTE_UNUSED) { + xmlSchemaImportPtr imported = (xmlSchemaImportPtr) payload; + xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) data; if (imported->schema->idcDef != NULL) { - xmlHashScan(imported->schema->idcDef , - (xmlHashScanner) xmlSchemaAugmentIDC, vctxt); + xmlHashScan(imported->schema->idcDef, xmlSchemaAugmentIDC, vctxt); } }
@@ -25966,11 +25986,12 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, }
static void -xmlSchemaVContentModelCallback(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED, +xmlSchemaVContentModelCallback(xmlRegExecCtxtPtr exec ATTRIBUTE_UNUSED, const xmlChar * name ATTRIBUTE_UNUSED, - xmlSchemaElementPtr item, - xmlSchemaNodeInfoPtr inode) + void *transdata, void *inputdata) { + xmlSchemaElementPtr item = (xmlSchemaElementPtr) transdata; + xmlSchemaNodeInfoPtr inode = (xmlSchemaNodeInfoPtr) inputdata; inode->decl = item; #ifdef DEBUG_CONTENT { @@ -26075,8 +26096,7 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) */ inode->regexCtxt = xmlRegNewExecCtxt(inode->typeDef->contModel, - (xmlRegExecCallbacks) xmlSchemaVContentModelCallback, - vctxt); + xmlSchemaVContentModelCallback, vctxt); if (inode->regexCtxt == NULL) { VERROR_INT("xmlSchemaValidatorPopElem", "failed to create a regex context"); @@ -26624,8 +26644,7 @@ xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt) * Create the regex context. */ regexCtxt = xmlRegNewExecCtxt(ptype->contModel, - (xmlRegExecCallbacks) xmlSchemaVContentModelCallback, - vctxt); + xmlSchemaVContentModelCallback, vctxt); if (regexCtxt == NULL) { VERROR_INT("xmlSchemaValidateChildElem", "failed to create a regex context"); @@ -26885,7 +26904,8 @@ xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt) * Augment the IDC definitions for the main schema and all imported ones * NOTE: main schema is the first in the imported list */ - xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt); + xmlHashScan(vctxt->schema->schemasImports, xmlSchemaAugmentImportedIDC, + vctxt); } if (vctxt->depth > 0) { /* @@ -27817,7 +27837,7 @@ xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, { if (ctxt == NULL) return; - ctxt->serror = serror; + ctxt->serror = serror; ctxt->error = NULL; ctxt->warning = NULL; ctxt->errCtxt = ctx; @@ -28127,7 +28147,8 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { * Augment the IDC definitions for the main schema and all imported ones * NOTE: main schema if the first in the imported list */ - xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt); + xmlHashScan(vctxt->schema->schemasImports, xmlSchemaAugmentImportedIDC, + vctxt);
return(0); } diff --git a/sdk/lib/3rdparty/libxml2/xmlschemastypes.c b/sdk/lib/3rdparty/libxml2/xmlschemastypes.c index c6c9365986..ca381d3806 100644 --- a/sdk/lib/3rdparty/libxml2/xmlschemastypes.c +++ b/sdk/lib/3rdparty/libxml2/xmlschemastypes.c @@ -619,6 +619,11 @@ xmlSchemaInitTypes(void) xmlSchemaTypesInitialized = 1; }
+static void +xmlSchemaFreeTypeEntry(void *type, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlSchemaFreeType((xmlSchemaTypePtr) type); +} + /** * xmlSchemaCleanupTypes: * @@ -646,7 +651,7 @@ xmlSchemaCleanupTypes(void) { xmlFree((xmlSchemaParticlePtr) particle); xmlSchemaTypeAnyTypeDef->subtypes = NULL; } - xmlHashFree(xmlSchemaTypesBank, (xmlHashDeallocator) xmlSchemaFreeType); + xmlHashFree(xmlSchemaTypesBank, xmlSchemaFreeTypeEntry); xmlSchemaTypesInitialized = 0; }
diff --git a/sdk/lib/3rdparty/libxml2/xmlwriter.c b/sdk/lib/3rdparty/libxml2/xmlwriter.c index eb94e6e4a9..b5cd171f5b 100644 --- a/sdk/lib/3rdparty/libxml2/xmlwriter.c +++ b/sdk/lib/3rdparty/libxml2/xmlwriter.c @@ -110,7 +110,7 @@ static void xmlFreeTextWriterNsStackEntry(xmlLinkPtr lk); static int xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1); static int xmlTextWriterWriteDocCallback(void *context, - const xmlChar * str, int len); + const char *str, int len); static int xmlTextWriterCloseDocCallback(void *context);
static xmlChar *xmlTextWriterVSprintf(const char *format, va_list argptr) LIBXML_ATTR_FORMAT(1,0); @@ -190,9 +190,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) } memset(ret, 0, (size_t) sizeof(xmlTextWriter));
- ret->nodes = xmlListCreate((xmlListDeallocator) - xmlFreeTextWriterStackEntry, - (xmlListDataCompare) + ret->nodes = xmlListCreate(xmlFreeTextWriterStackEntry, xmlCmpTextWriterStackEntry); if (ret->nodes == NULL) { xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, @@ -201,9 +199,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) return NULL; }
- ret->nsstack = xmlListCreate((xmlListDeallocator) - xmlFreeTextWriterNsStackEntry, - (xmlListDataCompare) + ret->nsstack = xmlListCreate(xmlFreeTextWriterNsStackEntry, xmlCmpTextWriterNsStackEntry); if (ret->nsstack == NULL) { xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, @@ -329,9 +325,7 @@ xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, return NULL; }
- out = xmlOutputBufferCreateIO((xmlOutputWriteCallback) - xmlTextWriterWriteDocCallback, - (xmlOutputCloseCallback) + out = xmlOutputBufferCreateIO(xmlTextWriterWriteDocCallback, xmlTextWriterCloseDocCallback, (void *) ctxt, NULL); if (out == NULL) { @@ -4422,12 +4416,12 @@ xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1) * Returns -1, 0, 1 */ static int -xmlTextWriterWriteDocCallback(void *context, const xmlChar * str, int len) +xmlTextWriterWriteDocCallback(void *context, const char *str, int len) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) context; int rc;
- if ((rc = xmlParseChunk(ctxt, (const char *) str, len, 0)) != 0) { + if ((rc = xmlParseChunk(ctxt, str, len, 0)) != 0) { xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDocCallback : XML error %d !\n", rc); @@ -4453,7 +4447,7 @@ xmlTextWriterCloseDocCallback(void *context)
if ((rc = xmlParseChunk(ctxt, NULL, 0, 1)) != 0) { xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR, - "xmlTextWriterWriteDocCallback : XML error %d !\n", + "xmlTextWriterCloseDocCallback : XML error %d !\n", rc); return -1; } diff --git a/sdk/lib/3rdparty/libxml2/xpath.c b/sdk/lib/3rdparty/libxml2/xpath.c index 352747313f..f4406967be 100644 --- a/sdk/lib/3rdparty/libxml2/xpath.c +++ b/sdk/lib/3rdparty/libxml2/xpath.c @@ -477,84 +477,66 @@ int wrap_cmp( xmlNodePtr x, xmlNodePtr y ); * * ************************************************************************/
-#ifndef TRIO_REPLACE_STDIO -#define TRIO_PUBLIC static +#ifndef NAN +#define NAN (0.0 / 0.0) #endif -#include "trionan.c"
-/* - * The lack of portability of this section of the libc is annoying ! - */ -double xmlXPathNAN = 0; -double xmlXPathPINF = 1; -double xmlXPathNINF = -1; -static double xmlXPathNZERO = 0; /* not exported from headers */ -static int xmlXPathInitialized = 0; +#ifndef INFINITY +#define INFINITY HUGE_VAL +#endif + +double xmlXPathNAN = NAN; +double xmlXPathPINF = INFINITY; +double xmlXPathNINF = -INFINITY;
/** * xmlXPathInit: * * Initialize the XPath environment + * + * Does nothing but must be kept as public function. */ void xmlXPathInit(void) { - if (xmlXPathInitialized) return; - - xmlXPathPINF = trio_pinf(); - xmlXPathNINF = trio_ninf(); - xmlXPathNAN = trio_nan(); - xmlXPathNZERO = trio_nzero(); - - xmlXPathInitialized = 1; }
/** * xmlXPathIsNaN: * @val: a double value * - * Provides a portable isnan() function to detect whether a double - * is a NotaNumber. Based on trio code - * http://sourceforge.net/projects/ctrio/ - * * Returns 1 if the value is a NaN, 0 otherwise */ int xmlXPathIsNaN(double val) { - return(trio_isnan(val)); +#ifdef isnan + return isnan(val); +#else + return !(val == val); +#endif }
/** * xmlXPathIsInf: * @val: a double value * - * Provides a portable isinf() function to detect whether a double - * is a +Infinite or -Infinite. Based on trio code - * http://sourceforge.net/projects/ctrio/ - * - * Returns 1 vi the value is +Infinite, -1 if -Infinite, 0 otherwise + * Returns 1 if the value is +Infinite, -1 if -Infinite, 0 otherwise */ int xmlXPathIsInf(double val) { - return(trio_isinf(val)); +#ifdef isinf + return isinf(val) ? (val > 0 ? 1 : -1) : 0; +#else + if (val >= HUGE_VAL) + return 1; + if (val <= -HUGE_VAL) + return -1; + return 0; +#endif }
#endif /* SCHEMAS or XPATH */ -#ifdef LIBXML_XPATH_ENABLED -/** - * xmlXPathGetSign: - * @val: a double value - * - * Provides a portable function to detect the sign of a double - * Modified from trio code - * http://sourceforge.net/projects/ctrio/ - * - * Returns 1 if the value is Negative, 0 if positive - */ -static int -xmlXPathGetSign(double val) { - return(trio_signbit(val)); -}
+#ifdef LIBXML_XPATH_ENABLED
/* * TODO: when compatibility allows remove all "fake node libxslt" strings @@ -978,6 +960,8 @@ static int xmlXPathCompOpEvalToBoolean(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op, int isPredicate); +static void +xmlXPathFreeObjectEntry(void *obj, const xmlChar *name);
/************************************************************************ * * @@ -1421,7 +1405,8 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { default: if (xmlXPathIsNaN(cur->floatval)) { fprintf(output, "Object is a number : NaN\n"); - } else if (cur->floatval == 0 && xmlXPathGetSign(cur->floatval) != 0) { + } else if (cur->floatval == 0) { + /* Omit sign for negative zero. */ fprintf(output, "Object is a number : 0\n"); } else { fprintf(output, "Object is a number : %0g\n", cur->floatval); @@ -3117,7 +3102,8 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) if (xmlXPathIsNaN(number)) { if (buffersize > (int)sizeof("NaN")) snprintf(buffer, buffersize, "NaN"); - } else if (number == 0 && xmlXPathGetSign(number) != 0) { + } else if (number == 0) { + /* Omit sign for negative zero. */ snprintf(buffer, buffersize, "0"); } else if ((number > INT_MIN) && (number < INT_MAX) && (number == (int) number)) { @@ -4582,7 +4568,7 @@ xmlXPathDistinctSorted (xmlNodeSetPtr nodes) { xmlFree(strval); } } - xmlHashFree(hash, (xmlHashDeallocator) xmlFree); + xmlHashFree(hash, xmlHashDefaultDeallocator); return(ret); }
@@ -4894,7 +4880,9 @@ xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt, const xmlChar *name, return(-1); if (f == NULL) return(xmlHashRemoveEntry2(ctxt->funcHash, name, ns_uri, NULL)); - return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, XML_CAST_FPTR(f))); +XML_IGNORE_PEDANTIC_WARNINGS + return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, (void *) f)); +XML_POP_WARNINGS }
/** @@ -4975,7 +4963,9 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name, if (ctxt->funcHash == NULL) return(NULL);
- XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->funcHash, name, ns_uri); +XML_IGNORE_PEDANTIC_WARNINGS + ret = (xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri); +XML_POP_WARNINGS return(ret); }
@@ -5044,10 +5034,9 @@ xmlXPathRegisterVariableNS(xmlXPathContextPtr ctxt, const xmlChar *name, return(-1); if (value == NULL) return(xmlHashRemoveEntry2(ctxt->varHash, name, ns_uri, - (xmlHashDeallocator)xmlXPathFreeObject)); + xmlXPathFreeObjectEntry)); return(xmlHashUpdateEntry2(ctxt->varHash, name, ns_uri, - (void *) value, - (xmlHashDeallocator)xmlXPathFreeObject)); + (void *) value, xmlXPathFreeObjectEntry)); }
/** @@ -5137,7 +5126,7 @@ xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt) { if (ctxt == NULL) return;
- xmlHashFree(ctxt->varHash, (xmlHashDeallocator)xmlXPathFreeObject); + xmlHashFree(ctxt->varHash, xmlXPathFreeObjectEntry); ctxt->varHash = NULL; }
@@ -5168,9 +5157,9 @@ xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix, return(-1); if (ns_uri == NULL) return(xmlHashRemoveEntry(ctxt->nsHash, prefix, - (xmlHashDeallocator)xmlFree)); + xmlHashDefaultDeallocator)); return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) xmlStrdup(ns_uri), - (xmlHashDeallocator)xmlFree)); + xmlHashDefaultDeallocator)); }
/** @@ -5219,7 +5208,7 @@ xmlXPathRegisteredNsCleanup(xmlXPathContextPtr ctxt) { if (ctxt == NULL) return;
- xmlHashFree(ctxt->nsHash, (xmlHashDeallocator)xmlFree); + xmlHashFree(ctxt->nsHash, xmlHashDefaultDeallocator); ctxt->nsHash = NULL; }
@@ -5533,6 +5522,11 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) { xmlFree(obj); }
+static void +xmlXPathFreeObjectEntry(void *obj, const xmlChar *name ATTRIBUTE_UNUSED) { + xmlXPathFreeObject((xmlXPathObjectPtr) obj); +} + /** * xmlXPathReleaseObject: * @obj: the xmlXPathObjectPtr to free or to cache @@ -5722,7 +5716,8 @@ xmlXPathCastNumberToString (double val) { default: if (xmlXPathIsNaN(val)) { ret = xmlStrdup((const xmlChar *) "NaN"); - } else if (val == 0 && xmlXPathGetSign(val) != 0) { + } else if (val == 0) { + /* Omit sign for negative zero. */ ret = xmlStrdup((const xmlChar *) "0"); } else { /* could be improved */ @@ -5904,10 +5899,10 @@ xmlXPathCastNodeToNumber (xmlNodePtr node) { double ret;
if (node == NULL) - return(xmlXPathNAN); + return(NAN); strval = xmlXPathCastNodeToString(node); if (strval == NULL) - return(xmlXPathNAN); + return(NAN); ret = xmlXPathCastStringToNumber(strval); xmlFree(strval);
@@ -5928,7 +5923,7 @@ xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns) { double ret;
if (ns == NULL) - return(xmlXPathNAN); + return(NAN); str = xmlXPathCastNodeSetToString(ns); ret = xmlXPathCastStringToNumber(str); xmlFree(str); @@ -5948,13 +5943,13 @@ xmlXPathCastToNumber(xmlXPathObjectPtr val) { double ret = 0.0;
if (val == NULL) - return(xmlXPathNAN); + return(NAN); switch (val->type) { case XPATH_UNDEFINED: #ifdef DEGUB_EXPR xmlGenericError(xmlGenericErrorContext, "NUMBER: undefined\n"); #endif - ret = xmlXPathNAN; + ret = NAN; break; case XPATH_NODESET: case XPATH_XSLT_TREE: @@ -5974,7 +5969,7 @@ xmlXPathCastToNumber(xmlXPathObjectPtr val) { case XPATH_RANGE: case XPATH_LOCATIONSET: TODO; - ret = xmlXPathNAN; + ret = NAN; break; } return(ret); @@ -7478,20 +7473,7 @@ xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) { if ((ctxt == NULL) || (ctxt->context == NULL)) return; CAST_TO_NUMBER; CHECK_TYPE(XPATH_NUMBER); - if (xmlXPathIsNaN(ctxt->value->floatval)) - ctxt->value->floatval=xmlXPathNAN; - else if (xmlXPathIsInf(ctxt->value->floatval) == 1) - ctxt->value->floatval=xmlXPathNINF; - else if (xmlXPathIsInf(ctxt->value->floatval) == -1) - ctxt->value->floatval=xmlXPathPINF; - else if (ctxt->value->floatval == 0) { - if (xmlXPathGetSign(ctxt->value->floatval) == 0) - ctxt->value->floatval = xmlXPathNZERO; - else - ctxt->value->floatval = 0; - } - else - ctxt->value->floatval = - ctxt->value->floatval; + ctxt->value->floatval = -ctxt->value->floatval; }
/** @@ -7583,25 +7565,7 @@ xmlXPathDivValues(xmlXPathParserContextPtr ctxt) { xmlXPathReleaseObject(ctxt->context, arg); CAST_TO_NUMBER; CHECK_TYPE(XPATH_NUMBER); - if (xmlXPathIsNaN(val) || xmlXPathIsNaN(ctxt->value->floatval)) - ctxt->value->floatval = xmlXPathNAN; - else if (val == 0 && xmlXPathGetSign(val) != 0) { - if (ctxt->value->floatval == 0) - ctxt->value->floatval = xmlXPathNAN; - else if (ctxt->value->floatval > 0) - ctxt->value->floatval = xmlXPathNINF; - else if (ctxt->value->floatval < 0) - ctxt->value->floatval = xmlXPathPINF; - } - else if (val == 0) { - if (ctxt->value->floatval == 0) - ctxt->value->floatval = xmlXPathNAN; - else if (ctxt->value->floatval > 0) - ctxt->value->floatval = xmlXPathPINF; - else if (ctxt->value->floatval < 0) - ctxt->value->floatval = xmlXPathNINF; - } else - ctxt->value->floatval /= val; + ctxt->value->floatval /= val; }
/** @@ -7626,7 +7590,7 @@ xmlXPathModValues(xmlXPathParserContextPtr ctxt) { CHECK_TYPE(XPATH_NUMBER); arg1 = ctxt->value->floatval; if (arg2 == 0) - ctxt->value->floatval = xmlXPathNAN; + ctxt->value->floatval = NAN; else { ctxt->value->floatval = fmod(arg1, arg2); } @@ -9745,13 +9709,9 @@ xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) {
f = ctxt->value->floatval;
- /* Test for zero to keep negative zero unchanged. */ - if ((xmlXPathIsNaN(f)) || (f == 0.0)) - return; - - if ((f >= -0.5) && (f < 0.0)) { - /* Negative zero. */ - ctxt->value->floatval = xmlXPathNZERO; + if ((f >= -0.5) && (f < 0.5)) { + /* Handles negative zero. */ + ctxt->value->floatval *= 0.0; } else { double rounded = floor(f); @@ -10098,7 +10058,7 @@ xmlXPathStringEvalNumber(const xmlChar *str) { if (cur == NULL) return(0); while (IS_BLANK_CH(*cur)) cur++; if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) { - return(xmlXPathNAN); + return(NAN); } if (*cur == '-') { isneg = 1; @@ -10134,7 +10094,7 @@ xmlXPathStringEvalNumber(const xmlChar *str) {
cur++; if (((*cur < '0') || (*cur > '9')) && (!ok)) { - return(xmlXPathNAN); + return(NAN); } while (*cur == '0') { frac = frac + 1; @@ -10167,7 +10127,7 @@ xmlXPathStringEvalNumber(const xmlChar *str) { } } while (IS_BLANK_CH(*cur)) cur++; - if (*cur != 0) return(xmlXPathNAN); + if (*cur != 0) return(NAN); if (isneg) ret = -ret; if (is_exponent_negative) exponent = -exponent; ret *= pow(10.0, (double)exponent); @@ -12426,7 +12386,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, default: break; } - } else if (cur->type == type) { + } else if (cur->type == (xmlElementType) type) { if (cur->type == XML_NAMESPACE_DECL) XP_TEST_HIT_NS else diff --git a/sdk/lib/3rdparty/libxml2/xpointer.c b/sdk/lib/3rdparty/libxml2/xpointer.c index c8ebff3c49..6a41f07977 100644 --- a/sdk/lib/3rdparty/libxml2/xpointer.c +++ b/sdk/lib/3rdparty/libxml2/xpointer.c @@ -467,8 +467,6 @@ xmlXPtrNewRangeNodePoint(xmlNodePtr start, xmlXPathObjectPtr end) { return(NULL); if (end == NULL) return(NULL); - if (start->type != XPATH_POINT) - return(NULL); if (end->type != XPATH_POINT) return(NULL);
diff --git a/sdk/lib/3rdparty/libxml2/xzlib.c b/sdk/lib/3rdparty/libxml2/xzlib.c index 8bafbd3ac7..a839169ef2 100644 --- a/sdk/lib/3rdparty/libxml2/xzlib.c +++ b/sdk/lib/3rdparty/libxml2/xzlib.c @@ -31,10 +31,10 @@ #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
@@ -76,7 +76,7 @@ typedef struct { char padding1[32]; /* padding allowing to cope with possible extensions of above structure without too much side effect */ -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED /* zlib inflate or deflate stream */ z_stream zstrm; /* stream structure in-place (not a pointer) */ #endif @@ -130,7 +130,7 @@ xz_reset(xz_statep state) xz_error(state, LZMA_OK, NULL); /* clear error */ state->pos = 0; /* no uncompressed data yet */ state->strm.avail_in = 0; /* no input data yet */ -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED state->zstrm.avail_in = 0; /* no input data yet */ #endif } @@ -272,7 +272,7 @@ xz_avail(xz_statep state) return 0; }
-#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED static int xz_avail_zstrm(xz_statep state) { @@ -349,7 +349,7 @@ is_format_lzma(xz_statep state) return 1; }
-#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED
/* Get next byte from input, or -1 if end or error. */ #define NEXT() ((strm->avail_in == 0 && xz_avail(state) == -1) ? -1 : \ @@ -415,7 +415,7 @@ xz_head(xz_statep state) xz_error(state, LZMA_MEM_ERROR, "out of memory"); return -1; } -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED /* allocate inflate memory */ state->zstrm.zalloc = Z_NULL; state->zstrm.zfree = Z_NULL; @@ -449,7 +449,7 @@ xz_head(xz_statep state) state->direct = 0; return 0; } -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED /* look for the gzip magic header bytes 31 and 139 */ if (strm->next_in[0] == 31) { strm->avail_in--; @@ -550,7 +550,7 @@ xz_decomp(xz_statep state) action = LZMA_FINISH;
/* decompress and handle errors */ -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED if (state->how == GZIP) { state->zstrm.avail_in = (uInt) state->strm.avail_in; state->zstrm.next_in = (Bytef *) state->strm.next_in; @@ -592,13 +592,13 @@ xz_decomp(xz_statep state) /* update available output and crc check value */ state->have = had - strm->avail_out; state->next = strm->next_out - state->have; -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED state->zstrm.adler = crc32(state->zstrm.adler, state->next, state->have); #endif
if (ret == LZMA_STREAM_END) { -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED if (state->how == GZIP) { if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) { xz_error(state, LZMA_DATA_ERROR, "unexpected end of file"); @@ -788,7 +788,7 @@ __libxml2_xzclose(xzFile file) /* free memory and close file */ if (state->size) { lzma_end(&(state->strm)); -#ifdef HAVE_ZLIB_H +#ifdef LIBXML_ZLIB_ENABLED if (state->init == 1) inflateEnd(&(state->zstrm)); state->init = 0;