diff options
author | Joey Arhar <jarhar@chromium.org> | 2022-12-20 12:14:19 +0000 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@qt.io> | 2022-12-22 08:24:20 +0000 |
commit | ec6267e38ff2473901df0739a9f2b6bf8179e05e (patch) | |
tree | 6dfe7077d937c4a893857fc12a0f1aa130f6b177 | |
parent | 96c49c0ac8bcd2e7623142322a2180d39d22292c (diff) | |
download | qtwebengine-chromium-ec6267e38ff2473901df0739a9f2b6bf8179e05e.tar.gz |
[Backport] Security bug 1394382 (1/4)
Cherry-pick of patch originally reviewed on
https://chromium-review.googlesource.com/c/chromium/src/+/4090606:
Roll libxml from f2987a29 to e08d8c37
This roll also includes a patch I made to fix the windows configure
script which I am planning on merging upstream.
2022-05-06 jarhar@chromium.org Add xptr_locs flag to win32/configure.js
2022-05-06 kmehltretter@pcs.de fix typo in comment
2022-05-06 kmehltretter@pcs.de fix Schematron spelling
2022-03-08 wellnhofer@aevum.de [CVE-2022-29824] Fix integer overflows in xmlBuf and xmlBuffer
2022-04-27 wellnhofer@aevum.de Define LFS macros before including system headers
2022-04-23 wellnhofer@aevum.de Fix parsing of subtracted regex character classes
2022-04-23 wellnhofer@aevum.de Redirect examples test output to /dev/null
2022-04-23 wellnhofer@aevum.de Don't try to copy children of entity references
2022-04-21 wellnhofer@aevum.de Port genUnicode.py to Python 3
2022-04-22 floppym@gentoo.org testapi: remove leading slash from "/missing.xml"
2022-04-21 wellnhofer@aevum.de Build Autotools CI tests out of source tree (VPATH)
2022-04-21 wellnhofer@aevum.de Add --with-minimum build to CI tests
2022-04-21 wellnhofer@aevum.de Fix warnings when testing --with-minimum build
2022-04-21 wellnhofer@aevum.de Implement xpath1() XPointer scheme
2022-04-20 wellnhofer@aevum.de Add configuration flag for XPointer locations support
2022-04-21 wellnhofer@aevum.de Regenerate api.xml and testapi.c
2022-04-21 wellnhofer@aevum.de Port gentest.py to Python 3
2022-04-20 wellnhofer@aevum.de Remove remaining definitions of STDC_HEADERS
2022-04-20 wellnhofer@aevum.de cmake: Run all tests when threads are disabled
2022-04-20 wellnhofer@aevum.de cmake: Fix build with thread support
2022-04-13 wellnhofer@aevum.de Also build CI tests with -Werror
2022-04-13 wellnhofer@aevum.de Don't mix declarations and code in runtest.c
2022-04-13 wellnhofer@aevum.de cmake: Disable FTP and legacy modules by default
2022-04-13 wellnhofer@aevum.de Run CI tests with FTP and legacy modules
2022-04-13 wellnhofer@aevum.de Fix compiler warnings in Python code
2022-04-13 wellnhofer@aevum.de cmake: Fix build without thread support
2022-04-08 ddkilzer@webkit.org Prevent integer-overflow in htmlSkipBlankChars() and xmlSkipBlankChars()
2022-04-08 ddkilzer@webkit.org Use UPDATE_COMPAT() consistently in buf.c
2022-04-10 wellnhofer@aevum.de Fix short-lived regression in xmlStaticCopyNode
2022-04-08 wellnhofer@aevum.de cmake: Install documentation in CMAKE_INSTALL_DOCDIR
2022-04-08 daniel.engberg.lists@pyret.net cmake: Remove more unnecessary files installed in docs dir
2016-05-20 ddkilzer@webkit.org Mark more static data as `const`
2022-04-06 ddkilzer@apple.com Fix leak of xmlElementContent
2022-04-07 wellnhofer@aevum.de CMakeLists.txt: Fix LIBXML_VERSION_NUMBER
2022-04-06 soap@gentoo.org Use portable python shebangs
(cherry picked from commit c6ab8819d4555971fb37b0d030ed51826024ab0b)
Bug: 1395186, 1394382
Change-Id: I2fca594e77c81f989f60abea7599c3677851ef21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3632592
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1001300}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4090606
Owners-Override: Jana Grill <janagrill@google.com>
Reviewed-by: Jana Grill <janagrill@google.com>
Commit-Queue: Roger Felipe Zanoni da Silva <rzanoni@google.com>
Cr-Commit-Position: refs/branch-heads/5005@{#1413}
Cr-Branched-From: 5b4d9450fee01f821b6400e947b3839727643a71-refs/heads/main@{#992738}
Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/449914
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
37 files changed, 792 insertions, 1708 deletions
diff --git a/chromium/third_party/libxml/README.chromium b/chromium/third_party/libxml/README.chromium index 43e1b544017..e5aaeafadf5 100644 --- a/chromium/third_party/libxml/README.chromium +++ b/chromium/third_party/libxml/README.chromium @@ -1,6 +1,6 @@ Name: libxml URL: http://xmlsoft.org -Version: f2987a295ff847ecb2a6a3eae1a271c9a64255b6 +Version: e08d8c37f596fd254520361d65306e17c9e4b053 CPEPrefix: cpe:/a:xmlsoft:libxml2:2.9.13 License: MIT License File: src/Copyright diff --git a/chromium/third_party/libxml/chromium/roll.py b/chromium/third_party/libxml/chromium/roll.py index 32a62a77ba3..9a0deeabe06 100755 --- a/chromium/third_party/libxml/chromium/roll.py +++ b/chromium/third_party/libxml/chromium/roll.py @@ -113,6 +113,7 @@ SHARED_XML_CONFIGURE_OPTIONS = [ ('--without-valid', 'valid=no'), ('--without-xinclude', 'xinclude=no'), ('--without-xptr', 'xptr=no'), + ('--without-xptr-locs', 'xptr_locs=no'), ('--without-zlib', 'zlib=no'), ] diff --git a/chromium/third_party/libxml/linux/include/libxml/xmlversion.h b/chromium/third_party/libxml/linux/include/libxml/xmlversion.h index ffd14944821..67f746cd7e9 100644 --- a/chromium/third_party/libxml/linux/include/libxml/xmlversion.h +++ b/chromium/third_party/libxml/linux/include/libxml/xmlversion.h @@ -248,6 +248,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif /** + * LIBXML_XPTR_LOCS_ENABLED: + * + * Whether support for XPointer locations is configured in + */ +#if 0 +#define LIBXML_XPTR_LOCS_ENABLED +#endif + +/** * LIBXML_XINCLUDE_ENABLED: * * Whether XInclude is configured in diff --git a/chromium/third_party/libxml/mac/include/libxml/xmlversion.h b/chromium/third_party/libxml/mac/include/libxml/xmlversion.h index ffd14944821..67f746cd7e9 100644 --- a/chromium/third_party/libxml/mac/include/libxml/xmlversion.h +++ b/chromium/third_party/libxml/mac/include/libxml/xmlversion.h @@ -248,6 +248,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif /** + * LIBXML_XPTR_LOCS_ENABLED: + * + * Whether support for XPointer locations is configured in + */ +#if 0 +#define LIBXML_XPTR_LOCS_ENABLED +#endif + +/** * LIBXML_XINCLUDE_ENABLED: * * Whether XInclude is configured in diff --git a/chromium/third_party/libxml/src/CMakeLists.txt b/chromium/third_party/libxml/src/CMakeLists.txt index 68419a09044..2b5425e1840 100644 --- a/chromium/third_party/libxml/src/CMakeLists.txt +++ b/chromium/third_party/libxml/src/CMakeLists.txt @@ -27,13 +27,13 @@ option(LIBXML2_WITH_C14N "Add the Canonicalization support" ON) option(LIBXML2_WITH_CATALOG "Add the Catalog support" ON) option(LIBXML2_WITH_DEBUG "Add the debugging module" ON) set(LIBXML2_WITH_EXPR ON) -option(LIBXML2_WITH_FTP "Add the FTP support" ON) +option(LIBXML2_WITH_FTP "Add the FTP support" OFF) option(LIBXML2_WITH_HTML "Add the HTML support" ON) option(LIBXML2_WITH_HTTP "Add the HTTP support" ON) option(LIBXML2_WITH_ICONV "Add ICONV support" ON) option(LIBXML2_WITH_ICU "Add ICU support" OFF) option(LIBXML2_WITH_ISO8859X "Add ISO8859X support if no iconv" ON) -option(LIBXML2_WITH_LEGACY "Add deprecated APIs for compatibility" ON) +option(LIBXML2_WITH_LEGACY "Add deprecated APIs for compatibility" OFF) option(LIBXML2_WITH_LZMA "Use liblzma" ON) option(LIBXML2_WITH_MEM_DEBUG "Add the memory debugging module" OFF) option(LIBXML2_WITH_MODULES "Add the dynamic modules support" ON) @@ -59,6 +59,7 @@ option(LIBXML2_WITH_WRITER "Add the xmlWriter saving interface" ON) option(LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON) option(LIBXML2_WITH_XPATH "Add the XPATH support" ON) option(LIBXML2_WITH_XPTR "Add the XPointer support" ON) +option(LIBXML2_WITH_XPTR_LOCS "Add support for XPointer locations" OFF) option(LIBXML2_WITH_ZLIB "Use libz" ON) set(LIBXML2_XMLCONF_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Working directory for XML Conformance Test Suite") @@ -96,7 +97,7 @@ if(LIBXML2_WITH_ZLIB) find_package(ZLIB REQUIRED) endif() -foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_RUN_DEBUG WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB) +foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_RUN_DEBUG WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_XPTR_LOCS WITH_ZLIB) if(LIBXML2_${VARIABLE}) set(${VARIABLE} 1) else() @@ -104,10 +105,13 @@ foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_E endif() endforeach() -set(LIBXML_VERSION ${LIBXML_MAJOR_VERSION}0${LIBXML_MINOR_VERSION}0${LIBXML_MICRO_VERSION}) -set(LIBXML_VERSION_STRING "${LIBXML_VERSION}") +set(LIBXML_VERSION ${VERSION}) set(LIBXML_VERSION_EXTRA "") -set(LIBXML_VERSION_NUMBER ${LIBXML_VERSION}) +math(EXPR LIBXML_VERSION_NUMBER " + ${LIBXML_MAJOR_VERSION} * 10000 + + ${LIBXML_MINOR_VERSION} * 100 + + ${LIBXML_MICRO_VERSION} +") set(MODULE_EXTENSION "${CMAKE_SHARED_LIBRARY_SUFFIX}") @@ -131,9 +135,7 @@ if(ZLIB_FOUND) list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB) endif() -if(MSVC) - configure_file(include/win32config.h config.h COPYONLY) -else() +if (NOT MSVC) check_c_source_compiles(" void __attribute__((destructor)) f(void) {} @@ -176,7 +178,6 @@ else() check_include_files(netdb.h HAVE_NETDB_H) check_include_files(netinet/in.h HAVE_NETINET_IN_H) check_include_files(poll.h HAVE_POLL_H) - check_include_files(pthread.h HAVE_PTHREAD_H) check_function_exists(putenv HAVE_PUTENV) check_function_exists(rand_r HAVE_RAND_R) check_include_files(resolv.h HAVE_RESOLV_H) @@ -204,7 +205,6 @@ else() else() set(SEND_ARG2_CAST "/**/") endif() - check_include_files("float.h;stdarg.h;stdlib.h;string.h" STDC_HEADERS) check_c_source_compiles(" #include <stdarg.h> void a(va_list* ap) {}; @@ -242,7 +242,6 @@ else() set(XML_SOCKLEN_T int) endif() endif() - configure_file(config.h.cmake.in config.h) endif() set( @@ -372,6 +371,8 @@ if(LIBXML2_WITH_THREADS) target_compile_definitions(LibXml2 PRIVATE _REENTRANT) if(WIN32) target_compile_definitions(LibXml2 PRIVATE HAVE_WIN32_THREADS) + else() + check_include_files(pthread.h HAVE_PTHREAD_H) endif() endif() @@ -502,6 +503,7 @@ if(LIBXML2_WITH_TESTS) enable_testing() set( TESTS + runtest runxmlconf runsuite testapi @@ -511,11 +513,22 @@ if(LIBXML2_WITH_TESTS) testModule testlimits testrecurse + testThreads ) foreach(TEST ${TESTS}) add_executable(${TEST} ${TEST}.c) + target_compile_definitions(${TEST} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") target_link_libraries(${TEST} LibXml2) endforeach() + if(Threads_FOUND) + foreach(TEST runtest testThreads) + if(WIN32) + target_compile_definitions(${TEST} PRIVATE HAVE_WIN32_THREADS) + endif() + target_link_libraries(${TEST} Threads::Threads) + endforeach() + endif() + add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) if(EXISTS ${LIBXML2_XMLCONF_WORKING_DIR}/xmlconf/xmlconf.xml) add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${LIBXML2_XMLCONF_WORKING_DIR}) endif() @@ -525,23 +538,7 @@ if(LIBXML2_WITH_TESTS) add_test(NAME testchar COMMAND testchar) add_test(NAME testdict COMMAND testdict) add_test(NAME testrecurse COMMAND testrecurse WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - if(Threads_FOUND) - set( - TESTS_THREADS - runtest - testThreads - ) - foreach(TEST ${TESTS_THREADS}) - add_executable(${TEST} ${TEST}.c) - target_compile_definitions(${TEST} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") - if(WIN32) - target_compile_definitions(${TEST} PRIVATE HAVE_WIN32_THREADS) - endif() - target_link_libraries(${TEST} LibXml2 Threads::Threads) - endforeach() - add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - add_test(NAME testThreads COMMAND testThreads WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - endif() + add_test(NAME testThreads COMMAND testThreads WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif() if(LIBXML2_WITH_PYTHON) @@ -597,13 +594,13 @@ endif() install(FILES doc/xml2-config.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) install(FILES doc/xmlcatalog.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) install(FILES doc/xmllint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) -install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/libxml2 COMPONENT documentation +install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT documentation PATTERN "Makefile.*" EXCLUDE - PATTERN "*.xsl" EXCLUDE + PATTERN "*.1" EXCLUDE PATTERN "*.py" EXCLUDE + PATTERN "*.res" EXCLUDE PATTERN "*.xml" EXCLUDE - PATTERN "examples/*" EXCLUDE) -install(DIRECTORY doc/examples/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/libxml2/examples COMPONENT documentation PATTERN "Makefile.*" EXCLUDE) + PATTERN "*.xsl" EXCLUDE) configure_package_config_file( libxml2-config.cmake.cmake.in libxml2-config.cmake @@ -636,6 +633,11 @@ install( COMPONENT development ) +if(MSVC) + configure_file(include/win32config.h config.h COPYONLY) +else() + configure_file(config.h.cmake.in config.h) +endif() configure_file(include/libxml/xmlversion.h.in libxml/xmlversion.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml/xmlversion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development) diff --git a/chromium/third_party/libxml/src/HTMLparser.c b/chromium/third_party/libxml/src/HTMLparser.c index 9bd0fb34c5f..9079fa8aa52 100644 --- a/chromium/third_party/libxml/src/HTMLparser.c +++ b/chromium/third_party/libxml/src/HTMLparser.c @@ -598,7 +598,8 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { if (*ctxt->input->cur == 0) xmlParserInputGrow(ctxt->input, INPUT_CHUNK); } - res++; + if (res < INT_MAX) + res++; } return(res); } diff --git a/chromium/third_party/libxml/src/HTMLtree.c b/chromium/third_party/libxml/src/HTMLtree.c index c6ca8358a26..91f4b9b5aa6 100644 --- a/chromium/third_party/libxml/src/HTMLtree.c +++ b/chromium/third_party/libxml/src/HTMLtree.c @@ -299,7 +299,7 @@ create: * output as <option selected>, as per XSLT 1.0 16.2 "HTML Output Method" * */ -static const char* htmlBooleanAttrs[] = { +static const char* const htmlBooleanAttrs[] = { "checked", "compact", "declare", "defer", "disabled", "ismap", "multiple", "nohref", "noresize", "noshade", "nowrap", "readonly", "selected", NULL diff --git a/chromium/third_party/libxml/src/buf.c b/chromium/third_party/libxml/src/buf.c index f43565405f9..2b1fd7935e0 100644 --- a/chromium/third_party/libxml/src/buf.c +++ b/chromium/third_party/libxml/src/buf.c @@ -26,6 +26,10 @@ #include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */ #include "buf.h" +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t) -1) +#endif + #define WITH_BUFFER_COMPAT /** @@ -123,12 +127,11 @@ xmlBufCreate(void) { xmlBufMemoryError(NULL, "creating buffer"); return(NULL); } - ret->compat_use = 0; ret->use = 0; ret->error = 0; ret->buffer = NULL; ret->size = xmlDefaultBufferSize; - ret->compat_size = xmlDefaultBufferSize; + UPDATE_COMPAT(ret); ret->alloc = xmlBufferAllocScheme; ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); if (ret->content == NULL) { @@ -152,18 +155,19 @@ xmlBufPtr xmlBufCreateSize(size_t size) { xmlBufPtr ret; + if (size == SIZE_MAX) + return(NULL); ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf)); if (ret == NULL) { xmlBufMemoryError(NULL, "creating buffer"); return(NULL); } - ret->compat_use = 0; ret->use = 0; ret->error = 0; ret->buffer = NULL; ret->alloc = xmlBufferAllocScheme; - ret->size = (size ? size+2 : 0); /* +1 for ending null */ - ret->compat_size = (int) ret->size; + ret->size = (size ? size + 1 : 0); /* +1 for ending null */ + UPDATE_COMPAT(ret); if (ret->size){ ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); if (ret->content == NULL) { @@ -205,8 +209,7 @@ xmlBufDetach(xmlBufPtr buf) { buf->content = NULL; buf->size = 0; buf->use = 0; - buf->compat_use = 0; - buf->compat_size = 0; + UPDATE_COMPAT(buf); return ret; } @@ -235,15 +238,9 @@ xmlBufCreateStatic(void *mem, size_t size) { xmlBufMemoryError(NULL, "creating buffer"); return(NULL); } - if (size < INT_MAX) { - ret->compat_use = size; - ret->compat_size = size; - } else { - ret->compat_use = INT_MAX; - ret->compat_size = INT_MAX; - } ret->use = size; ret->size = size; + UPDATE_COMPAT(ret); ret->alloc = XML_BUFFER_ALLOC_IMMUTABLE; ret->content = (xmlChar *) mem; ret->error = 0; @@ -438,23 +435,17 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) { CHECK_COMPAT(buf) if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0); - if (buf->use + len < buf->size) + if (len < buf->size - buf->use) return(buf->size - buf->use); + if (len > SIZE_MAX - buf->use) + return(0); - /* - * Windows has a BIG problem on realloc timing, so we try to double - * the buffer size (if that's enough) (bug 146697) - * Apparently BSD too, and it's probably best for linux too - * On an embedded system this may be something to change - */ -#if 1 - if (buf->size > (size_t) len) - size = buf->size * 2; - else - size = buf->use + len + 100; -#else - size = buf->use + len + 100; -#endif + if (buf->size > (size_t) len) { + size = buf->size > SIZE_MAX / 2 ? SIZE_MAX : buf->size * 2; + } else { + size = buf->use + len; + size = size > SIZE_MAX - 100 ? SIZE_MAX : size + 100; + } if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) { /* @@ -740,7 +731,7 @@ xmlBufIsEmpty(const xmlBufPtr buf) int xmlBufResize(xmlBufPtr buf, size_t size) { - unsigned int newSize; + size_t newSize; xmlChar* rebuf = NULL; size_t start_buf; @@ -768,9 +759,13 @@ xmlBufResize(xmlBufPtr buf, size_t size) case XML_BUFFER_ALLOC_IO: case XML_BUFFER_ALLOC_DOUBLEIT: /*take care of empty case*/ - newSize = (buf->size ? buf->size*2 : size + 10); + if (buf->size == 0) { + newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10); + } else { + newSize = buf->size; + } while (size > newSize) { - if (newSize > UINT_MAX / 2) { + if (newSize > SIZE_MAX / 2) { xmlBufMemoryError(buf, "growing buffer"); return 0; } @@ -778,15 +773,15 @@ xmlBufResize(xmlBufPtr buf, size_t size) } break; case XML_BUFFER_ALLOC_EXACT: - newSize = size+10; + newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10); break; case XML_BUFFER_ALLOC_HYBRID: if (buf->use < BASE_BUFFER_SIZE) newSize = size; else { - newSize = buf->size * 2; + newSize = buf->size; while (size > newSize) { - if (newSize > UINT_MAX / 2) { + if (newSize > SIZE_MAX / 2) { xmlBufMemoryError(buf, "growing buffer"); return 0; } @@ -796,7 +791,7 @@ xmlBufResize(xmlBufPtr buf, size_t size) break; default: - newSize = size+10; + newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10); break; } @@ -862,7 +857,7 @@ xmlBufResize(xmlBufPtr buf, size_t size) */ int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) { - unsigned int needSize; + size_t needSize; if ((str == NULL) || (buf == NULL) || (buf->error)) return -1; @@ -884,8 +879,10 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) { if (len < 0) return -1; if (len == 0) return 0; - needSize = buf->use + len + 2; - if (needSize > buf->size){ + if ((size_t) len >= buf->size - buf->use) { + if ((size_t) len >= SIZE_MAX - buf->use) + return(-1); + needSize = buf->use + len + 1; if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) { /* * Used to provide parsing limits @@ -1021,31 +1018,7 @@ xmlBufCat(xmlBufPtr buf, const xmlChar *str) { */ int xmlBufCCat(xmlBufPtr buf, const char *str) { - const char *cur; - - if ((buf == NULL) || (buf->error)) - return(-1); - CHECK_COMPAT(buf) - if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; - if (str == NULL) { -#ifdef DEBUG_BUFFER - xmlGenericError(xmlGenericErrorContext, - "xmlBufCCat: str == NULL\n"); -#endif - return -1; - } - for (cur = str;*cur != 0;cur++) { - if (buf->use + 10 >= buf->size) { - if (!xmlBufResize(buf, buf->use+10)){ - xmlBufMemoryError(buf, "growing buffer"); - return XML_ERR_NO_MEMORY; - } - } - buf->content[buf->use++] = *cur; - } - buf->content[buf->use] = 0; - UPDATE_COMPAT(buf) - return 0; + return xmlBufCat(buf, (const xmlChar *) str); } /** @@ -1173,8 +1146,7 @@ xmlBufFromBuffer(xmlBufferPtr buffer) { } ret->use = buffer->use; ret->size = buffer->size; - ret->compat_use = buffer->use; - ret->compat_size = buffer->size; + UPDATE_COMPAT(ret); ret->error = 0; ret->buffer = buffer; ret->alloc = buffer->alloc; diff --git a/chromium/third_party/libxml/src/check-relaxng-test-suite.py b/chromium/third_party/libxml/src/check-relaxng-test-suite.py index aa89cdedcd0..87ec05005cd 100755 --- a/chromium/third_party/libxml/src/check-relaxng-test-suite.py +++ b/chromium/third_party/libxml/src/check-relaxng-test-suite.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import time import os diff --git a/chromium/third_party/libxml/src/check-relaxng-test-suite2.py b/chromium/third_party/libxml/src/check-relaxng-test-suite2.py index 5bba5a40bed..559503a1297 100755 --- a/chromium/third_party/libxml/src/check-relaxng-test-suite2.py +++ b/chromium/third_party/libxml/src/check-relaxng-test-suite2.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import time import os diff --git a/chromium/third_party/libxml/src/check-xinclude-test-suite.py b/chromium/third_party/libxml/src/check-xinclude-test-suite.py index e8034405198..926ceb3c957 100755 --- a/chromium/third_party/libxml/src/check-xinclude-test-suite.py +++ b/chromium/third_party/libxml/src/check-xinclude-test-suite.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import time import os diff --git a/chromium/third_party/libxml/src/check-xml-test-suite.py b/chromium/third_party/libxml/src/check-xml-test-suite.py index 953a76cb85e..cecb59b77f2 100755 --- a/chromium/third_party/libxml/src/check-xml-test-suite.py +++ b/chromium/third_party/libxml/src/check-xml-test-suite.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import time import os diff --git a/chromium/third_party/libxml/src/check-xsddata-test-suite.py b/chromium/third_party/libxml/src/check-xsddata-test-suite.py index 9ed72aa21f5..c34560ea900 100755 --- a/chromium/third_party/libxml/src/check-xsddata-test-suite.py +++ b/chromium/third_party/libxml/src/check-xsddata-test-suite.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import sys import time import os diff --git a/chromium/third_party/libxml/src/config.h.cmake.in b/chromium/third_party/libxml/src/config.h.cmake.in index 5af19f9a624..1f8be710f53 100644 --- a/chromium/third_party/libxml/src/config.h.cmake.in +++ b/chromium/third_party/libxml/src/config.h.cmake.in @@ -150,9 +150,6 @@ /* Type cast for the send() function 2nd arg */ #cmakedefine SEND_ARG2_CAST @SEND_ARG2_CAST@ -/* Define to 1 if you have the ANSI C header files. */ -#cmakedefine STDC_HEADERS 1 - /* Support for IPv6 */ #cmakedefine SUPPORT_IP6 1 diff --git a/chromium/third_party/libxml/src/configure.ac b/chromium/third_party/libxml/src/configure.ac index 3d36ea55191..b4564d718ea 100644 --- a/chromium/third_party/libxml/src/configure.ac +++ b/chromium/third_party/libxml/src/configure.ac @@ -160,6 +160,8 @@ AC_ARG_WITH(xpath, [ --with-xpath add the XPATH support (on)]) AC_ARG_WITH(xptr, [ --with-xptr add the XPointer support (on)]) +AC_ARG_WITH(xptr-locs, +[ --with-xptr-locs add support for XPointer locations (off)]) AC_ARG_WITH(modules, [ --with-modules add the dynamic modules support (on)]) AC_ARG_WITH(zlib, @@ -199,6 +201,10 @@ if test "$with_reader" = "yes" then with_push=yes fi +if test "$with_xptr_locs" = "yes" +then + with_xptr=yes +fi if test "$with_xptr" = "yes" then with_xpath=yes @@ -1071,6 +1077,7 @@ AC_SUBST(TEST_CATALOG) if test "$with_xptr" = "no" ; then echo Disabling XPointer support WITH_XPTR=0 + WITH_XPTR_LOCS=0 XPTR_OBJ= else WITH_XPTR=1 @@ -1079,8 +1086,14 @@ else echo XPointer requires XPath support - enabling it with_xpath=yes fi + if test "$with_xptr_locs" = "yes" ; then + WITH_XPTR_LOCS=1 + else + WITH_XPTR_LOCS=0 + fi fi AC_SUBST(WITH_XPTR) +AC_SUBST(WITH_XPTR_LOCS) AC_SUBST(XPTR_OBJ) if test "$with_c14n" = "no" ; then diff --git a/chromium/third_party/libxml/src/encoding.c b/chromium/third_party/libxml/src/encoding.c index 2e527c0b24d..0a820498bd2 100644 --- a/chromium/third_party/libxml/src/encoding.c +++ b/chromium/third_party/libxml/src/encoding.c @@ -2950,7 +2950,7 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) { static int UTF8ToISO8859x(unsigned char* out, int *outlen, const unsigned char* in, int *inlen, - unsigned char const *xlattable) { + const unsigned char* const xlattable) { const unsigned char* outstart = out; const unsigned char* inend; const unsigned char* instart = in; @@ -3140,7 +3140,7 @@ static unsigned short const xmlunicodetable_ISO8859_2 [128] = { 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, }; -static unsigned char const xmltranscodetable_ISO8859_2 [48 + 6 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_2 [48 + 6 * 64] = { "\x00\x00\x01\x05\x02\x04\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3189,7 +3189,7 @@ static unsigned short const xmlunicodetable_ISO8859_3 [128] = { 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, }; -static unsigned char const xmltranscodetable_ISO8859_3 [48 + 7 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_3 [48 + 7 * 64] = { "\x04\x00\x01\x06\x02\x05\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3242,7 +3242,7 @@ static unsigned short const xmlunicodetable_ISO8859_4 [128] = { 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, }; -static unsigned char const xmltranscodetable_ISO8859_4 [48 + 6 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_4 [48 + 6 * 64] = { "\x00\x00\x01\x05\x02\x03\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3291,7 +3291,7 @@ static unsigned short const xmlunicodetable_ISO8859_5 [128] = { 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, }; -static unsigned char const xmltranscodetable_ISO8859_5 [48 + 6 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_5 [48 + 6 * 64] = { "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3340,7 +3340,7 @@ static unsigned short const xmlunicodetable_ISO8859_6 [128] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; -static unsigned char const xmltranscodetable_ISO8859_6 [48 + 5 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_6 [48 + 5 * 64] = { "\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x04\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3385,7 +3385,7 @@ static unsigned short const xmlunicodetable_ISO8859_7 [128] = { 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000, }; -static unsigned char const xmltranscodetable_ISO8859_7 [48 + 7 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_7 [48 + 7 * 64] = { "\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x06" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3438,7 +3438,7 @@ static unsigned short const xmlunicodetable_ISO8859_8 [128] = { 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000, }; -static unsigned char const xmltranscodetable_ISO8859_8 [48 + 7 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_8 [48 + 7 * 64] = { "\x02\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3491,7 +3491,7 @@ static unsigned short const xmlunicodetable_ISO8859_9 [128] = { 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, }; -static unsigned char const xmltranscodetable_ISO8859_9 [48 + 5 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_9 [48 + 5 * 64] = { "\x00\x00\x01\x02\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3536,7 +3536,7 @@ static unsigned short const xmlunicodetable_ISO8859_10 [128] = { 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, }; -static unsigned char const xmltranscodetable_ISO8859_10 [48 + 7 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_10 [48 + 7 * 64] = { "\x00\x00\x01\x06\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3589,7 +3589,7 @@ static unsigned short const xmlunicodetable_ISO8859_11 [128] = { 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000, }; -static unsigned char const xmltranscodetable_ISO8859_11 [48 + 6 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_11 [48 + 6 * 64] = { "\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3638,7 +3638,7 @@ static unsigned short const xmlunicodetable_ISO8859_13 [128] = { 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019, }; -static unsigned char const xmltranscodetable_ISO8859_13 [48 + 7 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_13 [48 + 7 * 64] = { "\x00\x00\x01\x04\x06\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3691,7 +3691,7 @@ static unsigned short const xmlunicodetable_ISO8859_14 [128] = { 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff, }; -static unsigned char const xmltranscodetable_ISO8859_14 [48 + 10 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_14 [48 + 10 * 64] = { "\x00\x00\x01\x09\x04\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3756,7 +3756,7 @@ static unsigned short const xmlunicodetable_ISO8859_15 [128] = { 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, }; -static unsigned char const xmltranscodetable_ISO8859_15 [48 + 6 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_15 [48 + 6 * 64] = { "\x00\x00\x01\x05\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -3805,7 +3805,7 @@ static unsigned short const xmlunicodetable_ISO8859_16 [128] = { 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff, }; -static unsigned char const xmltranscodetable_ISO8859_16 [48 + 9 * 64] = { +static const unsigned char xmltranscodetable_ISO8859_16 [48 + 9 * 64] = { "\x00\x00\x01\x08\x02\x03\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" diff --git a/chromium/third_party/libxml/src/genUnicode.py b/chromium/third_party/libxml/src/genUnicode.py index f431201fcd6..ebf48e6e325 100755 --- a/chromium/third_party/libxml/src/genUnicode.py +++ b/chromium/third_party/libxml/src/genUnicode.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -u +#!/usr/bin/env python # # Original script modified in November 2003 to take advantage of # the character-validation range routines, and updated to the @@ -31,7 +31,7 @@ blockAliases.append("PrivateUse:PrivateUseArea,SupplementaryPrivateUseArea-A," + # number, inline comparisons are generated minTableSize = 8 -(blockfile, catfile) = string.split(sources) +(blockfile, catfile) = sources.split() # @@ -43,23 +43,23 @@ BlockNames = {} try: blocks = open(blockfile, "r") except: - print "Missing %s, aborting ..." % blockfile + print("Missing %s, aborting ..." % blockfile) sys.exit(1) for line in blocks.readlines(): if line[0] == '#': continue - line = string.strip(line) + line = line.strip() if line == '': continue try: - fields = string.split(line, ';') - range = string.strip(fields[0]) - (start, end) = string.split(range, "..") - name = string.strip(fields[1]) - name = string.replace(name, ' ', '') + fields = line.split(';') + range = fields[0].strip() + (start, end) = range.split("..") + name = fields[1].strip() + name = name.replace(' ', '') except: - print "Failed to process line: %s" % (line) + print("Failed to process line: %s" % (line)) continue start = "0x" + start end = "0x" + end @@ -68,19 +68,19 @@ for line in blocks.readlines(): except: BlockNames[name] = [(start, end)] blocks.close() -print "Parsed %d blocks descriptions" % (len(BlockNames.keys())) +print("Parsed %d blocks descriptions" % (len(BlockNames.keys()))) for block in blockAliases: - alias = string.split(block,':') - alist = string.split(alias[1],',') + alias = block.split(':') + alist = alias[1].split(',') for comp in alist: - if BlockNames.has_key(comp): + if comp in BlockNames: if alias[0] not in BlockNames: BlockNames[alias[0]] = [] for r in BlockNames[comp]: BlockNames[alias[0]].append(r) else: - print "Alias %s: %s not in Blocks" % (alias[0], comp) + print("Alias %s: %s not in Blocks" % (alias[0], comp)) continue # @@ -96,7 +96,7 @@ for block in blockAliases: try: data = open(catfile, "r") except: - print "Missing %s, aborting ..." % catfile + print("Missing %s, aborting ..." % catfile) sys.exit(1) nbchar = 0; @@ -104,12 +104,12 @@ Categories = {} for line in data.readlines(): if line[0] == '#': continue - line = string.strip(line) + line = line.strip() if line == '': continue try: - fields = string.split(line, ';') - point = string.strip(fields[0]) + fields = line.split(';') + point = fields[0].strip() value = 0 while point != '': value = value * 16 @@ -122,7 +122,7 @@ for line in data.readlines(): point = point[1:] name = fields[2] except: - print "Failed to process line: %s" % (line) + print("Failed to process line: %s" % (line)) continue nbchar = nbchar + 1 @@ -133,7 +133,7 @@ for line in data.readlines(): try: Categories[name] = [value] except: - print "Failed to process line: %s" % (line) + print("Failed to process line: %s" % (line)) # update "general category" name try: Categories[name[0]].append(value) @@ -141,10 +141,10 @@ for line in data.readlines(): try: Categories[name[0]] = [value] except: - print "Failed to process line: %s" % (line) + print("Failed to process line: %s" % (line)) blocks.close() -print "Parsed %d char generating %d categories" % (nbchar, len(Categories.keys())) +print("Parsed %d char generating %d categories" % (nbchar, len(Categories.keys()))) # # The data is now all read. Time to process it into a more useful form. @@ -184,11 +184,9 @@ for cat in Categories.keys(): # Assure all data is in alphabetic order, since we will be doing binary # searches on the tables. # -bkeys = BlockNames.keys() -bkeys.sort() +bkeys = sorted(BlockNames.keys()) -ckeys = Categories.keys() -ckeys.sort() +ckeys = sorted(Categories.keys()) # # Generate the resulting files @@ -196,13 +194,13 @@ ckeys.sort() try: header = open("include/libxml/xmlunicode.h", "w") except: - print "Failed to open include/libxml/xmlunicode.h" + print("Failed to open include/libxml/xmlunicode.h") sys.exit(1) try: output = open("xmlunicode.c", "w") except: - print "Failed to open xmlunicode.c" + print("Failed to open xmlunicode.c") sys.exit(1) date = time.asctime(time.localtime(time.time())) @@ -272,14 +270,14 @@ typedef struct { } xmlUnicodeNameTable; -static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname); +static xmlIntFunc *xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname); static const xmlUnicodeRange xmlUnicodeBlocks[] = { """ % (webpage, date, sources)); flag = 0 for block in bkeys: - name = string.replace(block, '-', '') + name = block.replace('-', '') if flag: output.write(',\n') else: @@ -287,7 +285,7 @@ for block in bkeys: output.write(' {"%s", xmlUCSIs%s}' % (block, name)) output.write('};\n\n') -output.write('static xmlUnicodeRange xmlUnicodeCats[] = {\n') +output.write('static const xmlUnicodeRange xmlUnicodeCats[] = {\n') flag = 0; for name in ckeys: if flag: @@ -315,7 +313,7 @@ for name in ckeys: pline = "static const xmlChSRange xml%sS[] = {" % name sptr = "xml%sS" % name else: - pline += ", " + pline += "," numshort += 1 else: if numlong == 0: @@ -324,19 +322,21 @@ for name in ckeys: pline = "static const xmlChLRange xml%sL[] = {" % name lptr = "xml%sL" % name else: - pline += ", " + pline += "," numlong += 1 if len(pline) > 60: output.write(pline + "\n") pline = " " + elif pline[-1:] == ",": + pline += " " pline += "{%s, %s}" % (hex(low), hex(high)) - output.write(pline + " };\nstatic xmlChRangeGroup xml%sG = {%s,%s,%s,%s};\n\n" + output.write(pline + " };\nstatic const xmlChRangeGroup xml%sG = {%s,%s,%s,%s};\n\n" % (name, numshort, numlong, sptr, lptr)) output.write( -"""static xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s}; -static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s}; +"""static const xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s}; +static const xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s}; /** * xmlUnicodeLookup: @@ -348,9 +348,9 @@ static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s}; * Returns pointer to range function if found, otherwise NULL */ static xmlIntFunc -*xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname) { +*xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname) { int low, high, mid, cmp; - xmlUnicodeRange *sptr; + const xmlUnicodeRange *sptr; if ((tptr == NULL) || (tname == NULL)) return(NULL); @@ -366,13 +366,13 @@ static xmlIntFunc else low = mid + 1; } - return (NULL); + return (NULL); } """ % (len(BlockNames), len(Categories)) ) for block in bkeys: - name = string.replace(block, '-', '') + name = block.replace('-', '') header.write("XMLPUBFUN int XMLCALL xmlUCSIs%s\t(int code);\n" % name) output.write("/**\n * xmlUCSIs%s:\n * @code: UCS code point\n" % (name)) output.write(" *\n * Check whether the character is part of %s UCS Block\n"% diff --git a/chromium/third_party/libxml/src/gentest.py b/chromium/third_party/libxml/src/gentest.py index 6fa044a3826..71da5dc8029 100755 --- a/chromium/third_party/libxml/src/gentest.py +++ b/chromium/third_party/libxml/src/gentest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -u +#!/usr/bin/env python # # generate a tester program for the API # @@ -8,7 +8,7 @@ import string try: import libxml2 except: - print "libxml2 python bindings not available, skipping testapi.c generation" + print("libxml2 python bindings not available, skipping testapi.c generation") sys.exit(0) if len(sys.argv) > 1: @@ -155,6 +155,13 @@ skipped_functions = [ # Legacy "xmlCleanupPredefinedEntities", "xmlInitializePredefinedEntities", "xmlSetFeature", "xmlGetFeature", "xmlGetFeaturesList", +# location sets +"xmlXPtrLocationSetAdd", +"xmlXPtrLocationSetCreate", +"xmlXPtrLocationSetDel", +"xmlXPtrLocationSetMerge", +"xmlXPtrLocationSetRemove", +"xmlXPtrWrapLocationSet", ] # @@ -221,7 +228,7 @@ extra_post_call = { if (old != NULL) { xmlUnlinkNode(old); xmlFreeNode(old) ; old = NULL ; } - ret_val = NULL;""", +\t ret_val = NULL;""", "xmlTextMerge": """if ((first != NULL) && (first->type != XML_TEXT_NODE)) { xmlUnlinkNode(second); @@ -230,7 +237,7 @@ extra_post_call = { """if ((ret_val != NULL) && (ret_val != ncname) && (ret_val != prefix) && (ret_val != memory)) xmlFree(ret_val); - ret_val = NULL;""", +\t ret_val = NULL;""", "xmlNewDocElementContent": """xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""", "xmlDictReference": "xmlDictFree(dict);", @@ -262,29 +269,29 @@ modules = [] def is_skipped_module(name): for mod in skipped_modules: if mod == name: - return 1 + return 1 return 0 def is_skipped_function(name): for fun in skipped_functions: if fun == name: - return 1 + return 1 # Do not test destructors - if string.find(name, 'Free') != -1: + if name.find('Free') != -1: return 1 return 0 def is_skipped_memcheck(name): for fun in skipped_memcheck: if fun == name: - return 1 + return 1 return 0 missing_types = {} def add_missing_type(name, func): try: list = missing_types[name] - list.append(func) + list.append(func) except: missing_types[name] = [func] @@ -304,7 +311,7 @@ def add_missing_functions(name, module): missing_functions_nr = missing_functions_nr + 1 try: list = missing_functions[module] - list.append(name) + list.append(name) except: missing_functions[module] = [name] @@ -313,45 +320,45 @@ def add_missing_functions(name, module): # def type_convert(str, name, info, module, function, pos): -# res = string.replace(str, " ", " ") -# res = string.replace(str, " ", " ") -# res = string.replace(str, " ", " ") - res = string.replace(str, " *", "_ptr") -# res = string.replace(str, "*", "_ptr") - res = string.replace(res, " ", "_") +# res = str.replace(" ", " ") +# res = str.replace(" ", " ") +# res = str.replace(" ", " ") + res = str.replace(" *", "_ptr") +# res = str.replace("*", "_ptr") + res = res.replace(" ", "_") if res == 'const_char_ptr': - if string.find(name, "file") != -1 or \ - string.find(name, "uri") != -1 or \ - string.find(name, "URI") != -1 or \ - string.find(info, "filename") != -1 or \ - string.find(info, "URI") != -1 or \ - string.find(info, "URL") != -1: - if string.find(function, "Save") != -1 or \ - string.find(function, "Create") != -1 or \ - string.find(function, "Write") != -1 or \ - string.find(function, "Fetch") != -1: - return('fileoutput') - return('filepath') + if name.find("file") != -1 or \ + name.find("uri") != -1 or \ + name.find("URI") != -1 or \ + info.find("filename") != -1 or \ + info.find("URI") != -1 or \ + info.find("URL") != -1: + if function.find("Save") != -1 or \ + function.find("Create") != -1 or \ + function.find("Write") != -1 or \ + function.find("Fetch") != -1: + return('fileoutput') + return('filepath') if res == 'void_ptr': if module == 'nanoftp' and name == 'ctx': - return('xmlNanoFTPCtxtPtr') + return('xmlNanoFTPCtxtPtr') if function == 'xmlNanoFTPNewCtxt' or \ - function == 'xmlNanoFTPConnectTo' or \ - function == 'xmlNanoFTPOpen': - return('xmlNanoFTPCtxtPtr') + function == 'xmlNanoFTPConnectTo' or \ + function == 'xmlNanoFTPOpen': + return('xmlNanoFTPCtxtPtr') if module == 'nanohttp' and name == 'ctx': - return('xmlNanoHTTPCtxtPtr') - if function == 'xmlNanoHTTPMethod' or \ - function == 'xmlNanoHTTPMethodRedir' or \ - function == 'xmlNanoHTTPOpen' or \ - function == 'xmlNanoHTTPOpenRedir': - return('xmlNanoHTTPCtxtPtr'); + return('xmlNanoHTTPCtxtPtr') + if function == 'xmlNanoHTTPMethod' or \ + function == 'xmlNanoHTTPMethodRedir' or \ + function == 'xmlNanoHTTPOpen' or \ + function == 'xmlNanoHTTPOpenRedir': + return('xmlNanoHTTPCtxtPtr'); if function == 'xmlIOHTTPOpen': - return('xmlNanoHTTPCtxtPtr') - if string.find(name, "data") != -1: - return('userdata') - if string.find(name, "user") != -1: - return('userdata') + return('xmlNanoHTTPCtxtPtr') + if name.find("data") != -1: + return('userdata') + if name.find("user") != -1: + return('userdata') if res == 'xmlDoc_ptr': res = 'xmlDocPtr' if res == 'xmlNode_ptr': @@ -360,18 +367,18 @@ def type_convert(str, name, info, module, function, pos): res = 'xmlDictPtr' if res == 'xmlNodePtr' and pos != 0: if (function == 'xmlAddChild' and pos == 2) or \ - (function == 'xmlAddChildList' and pos == 2) or \ + (function == 'xmlAddChildList' and pos == 2) or \ (function == 'xmlAddNextSibling' and pos == 2) or \ (function == 'xmlAddSibling' and pos == 2) or \ (function == 'xmlDocSetRootElement' and pos == 2) or \ (function == 'xmlReplaceNode' and pos == 2) or \ (function == 'xmlTextMerge') or \ - (function == 'xmlAddPrevSibling' and pos == 2): - return('xmlNodePtr_in'); + (function == 'xmlAddPrevSibling' and pos == 2): + return('xmlNodePtr_in'); if res == 'const xmlBufferPtr': res = 'xmlBufferPtr' if res == 'xmlChar_ptr' and name == 'name' and \ - string.find(function, "EatName") != -1: + function.find("EatName") != -1: return('eaten_name') if res == 'void_ptr*': res = 'void_ptr_ptr' @@ -387,7 +394,7 @@ def type_convert(str, name, info, module, function, pos): res = 'debug_FILE_ptr'; if res == 'int' and name == 'options': if module == 'parser' or module == 'xmlreader': - res = 'parseroptions' + res = 'parseroptions' return res @@ -396,38 +403,35 @@ known_param_types = [] def is_known_param_type(name): for type in known_param_types: if type == name: - return 1 + return 1 return name[-3:] == 'Ptr' or name[-4:] == '_ptr' def generate_param_type(name, rtype): global test for type in known_param_types: if type == name: - return + return for type in generated_param_types: if type == name: - return + return if name[-3:] == 'Ptr' or name[-4:] == '_ptr': if rtype[0:6] == 'const ': - crtype = rtype[6:] - else: - crtype = rtype + crtype = rtype[6:] + else: + crtype = rtype define = 0 - if modules_defines.has_key(module): - test.write("#ifdef %s\n" % (modules_defines[module])) - define = 1 + if module in modules_defines: + test.write("#ifdef %s\n" % (modules_defines[module])) + define = 1 test.write(""" #define gen_nb_%s 1 -static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -""" % (name, crtype, name, name, rtype)) +#define gen_%s(no, nr) NULL +#define des_%s(no, val, nr) +""" % (name, name, name)) if define == 1: - test.write("#endif\n\n") + test.write("#endif\n\n") add_generated_param_type(name) # @@ -439,7 +443,7 @@ known_return_types = [] def is_known_return_type(name): for type in known_return_types: if type == name: - return 1 + return 1 return 0 # @@ -465,7 +469,7 @@ def compare_and_save(): try: os.system("rm testapi.c; mv testapi.c.new testapi.c") except: - os.system("mv testapi.c.new testapi.c") + os.system("mv testapi.c.new testapi.c") print("Updated testapi.c") else: print("Generated testapi.c is identical") @@ -475,17 +479,17 @@ while line != "": if line == "/* CUT HERE: everything below that line is generated */\n": break; if line[0:15] == "#define gen_nb_": - type = string.split(line[15:])[0] - known_param_types.append(type) + type = line[15:].split()[0] + known_param_types.append(type) if line[0:19] == "static void desret_": - type = string.split(line[19:], '(')[0] - known_return_types.append(type) + type = line[19:].split('(')[0] + known_return_types.append(type) test.write(line) line = input.readline() input.close() if line == "": - print "Could not find the CUT marker in testapi.c skipping generation" + print("Could not find the CUT marker in testapi.c skipping generation") test.close() sys.exit(0) @@ -499,7 +503,7 @@ test.write("/* CUT HERE: everything below that line is generated */\n") # doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0) if doc == None: - print "Failed to load doc/libxml2-api.xml" + print("Failed to load doc/libxml2-api.xml") sys.exit(1) ctxt = doc.xpathNewContext() @@ -513,9 +517,9 @@ for arg in args: mod = arg.xpathEval('string(../@file)') func = arg.xpathEval('string(../@name)') if (mod not in skipped_modules) and (func not in skipped_functions): - type = arg.xpathEval('string(@type)') - if not argtypes.has_key(type): - argtypes[type] = func + type = arg.xpathEval('string(@type)') + if type not in argtypes: + argtypes[type] = func # similarly for return types rettypes = {} @@ -525,8 +529,8 @@ for ret in rets: func = ret.xpathEval('string(../@name)') if (mod not in skipped_modules) and (func not in skipped_functions): type = ret.xpathEval('string(@type)') - if not rettypes.has_key(type): - rettypes[type] = func + if type not in rettypes: + rettypes[type] = func # # Generate constructors and return type handling for all enums @@ -543,49 +547,49 @@ for enum in enums: continue; define = 0 - if argtypes.has_key(name) and is_known_param_type(name) == 0: - values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name) - i = 0 - vals = [] - for value in values: - vname = value.xpathEval('string(@name)') - if vname == None: - continue; - i = i + 1 - if i >= 5: - break; - vals.append(vname) - if vals == []: - print "Didn't find any value for enum %s" % (name) - continue - if modules_defines.has_key(module): - test.write("#ifdef %s\n" % (modules_defines[module])) - define = 1 - test.write("#define gen_nb_%s %d\n" % (name, len(vals))) - test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" % - (name, name)) - i = 1 - for value in vals: - test.write(" if (no == %d) return(%s);\n" % (i, value)) - i = i + 1 - test.write(""" return(0); + if (name in argtypes) and is_known_param_type(name) == 0: + values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name) + i = 0 + vals = [] + for value in values: + vname = value.xpathEval('string(@name)') + if vname == None: + continue; + i = i + 1 + if i >= 5: + break; + vals.append(vname) + if vals == []: + print("Didn't find any value for enum %s" % (name)) + continue + if module in modules_defines: + test.write("#ifdef %s\n" % (modules_defines[module])) + define = 1 + test.write("#define gen_nb_%s %d\n" % (name, len(vals))) + test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" % + (name, name)) + i = 1 + for value in vals: + test.write(" if (no == %d) return(%s);\n" % (i, value)) + i = i + 1 + test.write(""" return(0); } static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } """ % (name, name)); - known_param_types.append(name) + known_param_types.append(name) if (is_known_return_type(name) == 0) and (name in rettypes): - if define == 0 and modules_defines.has_key(module): - test.write("#ifdef %s\n" % (modules_defines[module])) - define = 1 + if define == 0 and (module in modules_defines): + test.write("#ifdef %s\n" % (modules_defines[module])) + define = 1 test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) { } """ % (name, name)) - known_return_types.append(name) + known_return_types.append(name) if define == 1: test.write("#endif\n\n") @@ -609,9 +613,9 @@ for file in headers: # do not test deprecated APIs # desc = file.xpathEval('string(description)') - if string.find(desc, 'DEPRECATED') != -1: - print "Skipping deprecated interface %s" % name - continue; + if desc.find('DEPRECATED') != -1: + print("Skipping deprecated interface %s" % name) + continue; test.write("#include <libxml/%s.h>\n" % name) modules.append(name) @@ -673,7 +677,7 @@ def generate_test(module, node): # and store the information for the generation # try: - args = node.xpathEval("arg") + args = node.xpathEval("arg") except: args = [] t_args = [] @@ -681,37 +685,37 @@ def generate_test(module, node): for arg in args: n = n + 1 rtype = arg.xpathEval("string(@type)") - if rtype == 'void': - break; - info = arg.xpathEval("string(@info)") - nam = arg.xpathEval("string(@name)") + if rtype == 'void': + break; + info = arg.xpathEval("string(@info)") + nam = arg.xpathEval("string(@name)") type = type_convert(rtype, nam, info, module, name, n) - if is_known_param_type(type) == 0: - add_missing_type(type, name); - no_gen = 1 + if is_known_param_type(type) == 0: + add_missing_type(type, name); + no_gen = 1 if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \ - rtype[0:6] == 'const ': - crtype = rtype[6:] - else: - crtype = rtype - t_args.append((nam, type, rtype, crtype, info)) + rtype[0:6] == 'const ': + crtype = rtype[6:] + else: + crtype = rtype + t_args.append((nam, type, rtype, crtype, info)) try: - rets = node.xpathEval("return") + rets = node.xpathEval("return") except: rets = [] t_ret = None for ret in rets: rtype = ret.xpathEval("string(@type)") - info = ret.xpathEval("string(@info)") + info = ret.xpathEval("string(@info)") type = type_convert(rtype, 'return', info, module, name, 0) - if rtype == 'void': - break - if is_known_return_type(type) == 0: - add_missing_type(type, name); - no_gen = 1 - t_ret = (type, rtype, info) - break + if rtype == 'void': + break + if is_known_return_type(type) == 0: + add_missing_type(type, name); + no_gen = 1 + t_ret = (type, rtype, info) + break if no_gen == 0: for t_arg in t_args: @@ -727,7 +731,7 @@ test_%s(void) { if no_gen == 1: add_missing_functions(name, module) - test.write(""" + test.write(""" /* missing type support */ return(test_ret); } @@ -736,22 +740,22 @@ test_%s(void) { return try: - conds = node.xpathEval("cond") - for cond in conds: - test.write("#if %s\n" % (cond.get_content())) - nb_cond = nb_cond + 1 + conds = node.xpathEval("cond") + for cond in conds: + test.write("#if %s\n" % (cond.get_content())) + nb_cond = nb_cond + 1 except: pass define = 0 - if function_defines.has_key(name): + if name in function_defines: test.write("#ifdef %s\n" % (function_defines[name])) - define = 1 + define = 1 # Declare the memory usage counter no_mem = is_skipped_memcheck(name) if no_mem == 0: - test.write(" int mem_base;\n"); + test.write(" int mem_base;\n"); # Declare the return value if t_ret != None: @@ -760,29 +764,29 @@ test_%s(void) { # Declare the arguments for arg in t_args: (nam, type, rtype, crtype, info) = arg; - # add declaration - test.write(" %s %s; /* %s */\n" % (crtype, nam, info)) - test.write(" int n_%s;\n" % (nam)) + # add declaration + test.write(" %s %s; /* %s */\n" % (crtype, nam, info)) + test.write(" int n_%s;\n" % (nam)) test.write("\n") # Cascade loop on of each argument list of values for arg in t_args: (nam, type, rtype, crtype, info) = arg; - # - test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % ( - nam, nam, type, nam)) + # + test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % ( + nam, nam, type, nam)) # log the memory usage if no_mem == 0: - test.write(" mem_base = xmlMemBlocks();\n"); + test.write(" mem_base = xmlMemBlocks();\n"); # prepare the call i = 0; for arg in t_args: (nam, type, rtype, crtype, info) = arg; - # - test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i)) - i = i + 1; + # + test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i)) + i = i + 1; # add checks to avoid out-of-bounds array access i = 0; @@ -791,7 +795,7 @@ test_%s(void) { # assume that "size", "len", and "start" parameters apply to either # the nearest preceding or following char pointer if type == "int" and (nam == "size" or nam == "len" or nam == "start"): - for j in range(i - 1, -1, -1) + range(i + 1, len(t_args)): + for j in (*range(i - 1, -1, -1), *range(i + 1, len(t_args))): (bnam, btype) = t_args[j][:2] if btype == "const_char_ptr" or btype == "const_xmlChar_ptr": test.write( @@ -800,42 +804,42 @@ test_%s(void) { " continue;\n" % (bnam, nam, bnam)) break - i = i + 1; + i = i + 1; # do the call, and clanup the result - if extra_pre_call.has_key(name): - test.write(" %s\n"% (extra_pre_call[name])) + if name in extra_pre_call: + test.write(" %s\n"% (extra_pre_call[name])) if t_ret != None: - test.write("\n ret_val = %s(" % (name)) - need = 0 - for arg in t_args: - (nam, type, rtype, crtype, info) = arg - if need: - test.write(", ") - else: - need = 1 - if rtype != crtype: - test.write("(%s)" % rtype) - test.write("%s" % nam); - test.write(");\n") - if extra_post_call.has_key(name): - test.write(" %s\n"% (extra_post_call[name])) - test.write(" desret_%s(ret_val);\n" % t_ret[0]) + test.write("\n ret_val = %s(" % (name)) + need = 0 + for arg in t_args: + (nam, type, rtype, crtype, info) = arg + if need: + test.write(", ") + else: + need = 1 + if rtype != crtype: + test.write("(%s)" % rtype) + test.write("%s" % nam); + test.write(");\n") + if name in extra_post_call: + test.write(" %s\n"% (extra_post_call[name])) + test.write(" desret_%s(ret_val);\n" % t_ret[0]) else: - test.write("\n %s(" % (name)); - need = 0; - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; - if need: - test.write(", ") - else: - need = 1 - if rtype != crtype: - test.write("(%s)" % rtype) - test.write("%s" % nam) - test.write(");\n") - if extra_post_call.has_key(name): - test.write(" %s\n"% (extra_post_call[name])) + test.write("\n %s(" % (name)); + need = 0; + for arg in t_args: + (nam, type, rtype, crtype, info) = arg; + if need: + test.write(", ") + else: + need = 1 + if rtype != crtype: + test.write("(%s)" % rtype) + test.write("%s" % nam) + test.write(");\n") + if name in extra_post_call: + test.write(" %s\n"% (extra_post_call[name])) test.write(" call_tests++;\n"); @@ -843,32 +847,32 @@ test_%s(void) { i = 0; for arg in t_args: (nam, type, rtype, crtype, info) = arg; - # This is a hack to prevent generating a destructor for the - # 'input' argument in xmlTextReaderSetup. There should be - # a better, more generic way to do this! - if string.find(info, 'destroy') == -1: - test.write(" des_%s(n_%s, " % (type, nam)) - if rtype != crtype: - test.write("(%s)" % rtype) - test.write("%s, %d);\n" % (nam, i)) - i = i + 1; + # This is a hack to prevent generating a destructor for the + # 'input' argument in xmlTextReaderSetup. There should be + # a better, more generic way to do this! + if info.find('destroy') == -1: + test.write(" des_%s(n_%s, " % (type, nam)) + if rtype != crtype: + test.write("(%s)" % rtype) + test.write("%s, %d);\n" % (nam, i)) + i = i + 1; test.write(" xmlResetLastError();\n"); # Check the memory usage if no_mem == 0: - test.write(""" if (mem_base != xmlMemBlocks()) { + test.write(""" if (mem_base != xmlMemBlocks()) { printf("Leak of %%d blocks found in %s", - xmlMemBlocks() - mem_base); - test_ret++; +\t xmlMemBlocks() - mem_base); +\t test_ret++; """ % (name)); - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; - test.write(""" printf(" %%d", n_%s);\n""" % (nam)) - test.write(""" printf("\\n");\n""") - test.write(" }\n") + for arg in t_args: + (nam, type, rtype, crtype, info) = arg; + test.write(""" printf(" %%d", n_%s);\n""" % (nam)) + test.write(""" printf("\\n");\n""") + test.write(" }\n") for arg in t_args: - test.write(" }\n") + test.write(" }\n") test.write(" function_tests++;\n") # @@ -876,7 +880,7 @@ test_%s(void) { # while nb_cond > 0: test.write("#endif\n") - nb_cond = nb_cond -1 + nb_cond = nb_cond -1 if define == 1: test.write("#endif\n") @@ -894,10 +898,10 @@ test_%s(void) { for module in modules: # gather all the functions exported by that module try: - functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module)) + functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module)) except: - print "Failed to gather functions from module %s" % (module) - continue; + print("Failed to gather functions from module %s" % (module)) + continue; # iterate over all functions in the module generating the test i = 0 @@ -917,14 +921,14 @@ test_%s(void) { # iterate over all functions in the module generating the call for function in functions: name = function.xpathEval('string(@name)') - if is_skipped_function(name): - continue - test.write(" test_ret += test_%s();\n" % (name)) + if is_skipped_function(name): + continue + test.write(" test_ret += test_%s();\n" % (name)) # footer test.write(""" if (test_ret != 0) - printf("Module %s: %%d errors\\n", test_ret); +\tprintf("Module %s: %%d errors\\n", test_ret); return(test_ret); } """ % (module)) @@ -942,7 +946,7 @@ test.write(""" return(0); } """); -print "Generated test for %d modules and %d functions" %(len(modules), nb_tests) +print("Generated test for %d modules and %d functions" %(len(modules), nb_tests)) compare_and_save() @@ -954,11 +958,8 @@ for missing in missing_types.keys(): n = len(missing_types[missing]) missing_list.append((n, missing)) -def compare_missing(a, b): - return b[0] - a[0] - -missing_list.sort(compare_missing) -print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list)) +missing_list.sort(key=lambda a: a[0]) +print("Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list))) lst = open("missing.lst", "w") lst.write("Missing support for %d types" % (len(missing_list))) lst.write("\n") @@ -968,9 +969,9 @@ for miss in missing_list: for n in missing_types[miss[1]]: i = i + 1 if i > 5: - lst.write(" ...") - break - lst.write(" %s" % (n)) + lst.write(" ...") + break + lst.write(" %s" % (n)) lst.write("\n") lst.write("\n") lst.write("\n") diff --git a/chromium/third_party/libxml/src/include/libxml/schematron.h b/chromium/third_party/libxml/src/include/libxml/schematron.h index 364eaecde6b..c61e61b3cf5 100644 --- a/chromium/third_party/libxml/src/include/libxml/schematron.h +++ b/chromium/third_party/libxml/src/include/libxml/schematron.h @@ -1,5 +1,5 @@ /* - * Summary: XML Schemastron implementation + * Summary: XML Schematron implementation * Description: interface to the XML Schematron validity checking. * * Copy: See Copyright for the status of this software. diff --git a/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in b/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in index 944920b225f..bdebfe3b0c9 100644 --- a/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in +++ b/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in @@ -248,6 +248,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif /** + * LIBXML_XPTR_LOCS_ENABLED: + * + * Whether support for XPointer locations is configured in + */ +#if @WITH_XPTR_LOCS@ +#define LIBXML_XPTR_LOCS_ENABLED +#endif + +/** * LIBXML_XINCLUDE_ENABLED: * * Whether XInclude is configured in diff --git a/chromium/third_party/libxml/src/include/libxml/xpath.h b/chromium/third_party/libxml/src/include/libxml/xpath.h index a6e3644855c..bfbc5d6d995 100644 --- a/chromium/third_party/libxml/src/include/libxml/xpath.h +++ b/chromium/third_party/libxml/src/include/libxml/xpath.h @@ -104,13 +104,23 @@ typedef enum { XPATH_BOOLEAN = 2, XPATH_NUMBER = 3, XPATH_STRING = 4, +#ifdef LIBXML_XPTR_LOCS_ENABLED XPATH_POINT = 5, XPATH_RANGE = 6, XPATH_LOCATIONSET = 7, +#endif XPATH_USERS = 8, XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ } xmlXPathObjectType; +#ifndef LIBXML_XPTR_LOCS_ENABLED +/** DOC_DISABLE */ +#define XPATH_POINT 5 +#define XPATH_RANGE 6 +#define XPATH_LOCATIONSET 7 +/** DOC_ENABLE */ +#endif + typedef struct _xmlXPathObject xmlXPathObject; typedef xmlXPathObject *xmlXPathObjectPtr; struct _xmlXPathObject { diff --git a/chromium/third_party/libxml/src/include/libxml/xpointer.h b/chromium/third_party/libxml/src/include/libxml/xpointer.h index b99112b87a1..ca7bdbe085f 100644 --- a/chromium/third_party/libxml/src/include/libxml/xpointer.h +++ b/chromium/third_party/libxml/src/include/libxml/xpointer.h @@ -28,6 +28,7 @@ extern "C" { #endif +#ifdef LIBXML_XPTR_LOCS_ENABLED /* * A Location Set */ @@ -43,51 +44,68 @@ struct _xmlLocationSet { * Handling of location sets. */ +XML_DEPRECATED XMLPUBFUN xmlLocationSetPtr XMLCALL xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); +XML_DEPRECATED XMLPUBFUN xmlLocationSetPtr XMLCALL xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, xmlLocationSetPtr val2); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRange (xmlNodePtr start, int startindex, xmlNodePtr end, int endindex); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangePoints (xmlXPathObjectPtr start, xmlXPathObjectPtr end); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodePoint (xmlNodePtr start, xmlXPathObjectPtr end); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, xmlNodePtr end); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodes (xmlNodePtr start, xmlNodePtr end); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewLocationSetNodes (xmlNodePtr start, xmlNodePtr end); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodeObject (xmlNodePtr start, xmlXPathObjectPtr end); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewCollapsedRange (xmlNodePtr start); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, xmlXPathObjectPtr val); +XML_DEPRECATED XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrWrapLocationSet (xmlLocationSetPtr val); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlXPtrLocationSetDel (xmlLocationSetPtr cur, xmlXPathObjectPtr val); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, int val); +#endif /* LIBXML_XPTR_LOCS_ENABLED */ /* * Functions. @@ -99,13 +117,18 @@ XMLPUBFUN xmlXPathContextPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrEval (const xmlChar *str, xmlXPathContextPtr ctx); +#ifdef LIBXML_XPTR_LOCS_ENABLED +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, int nargs); +XML_DEPRECATED XMLPUBFUN xmlNodePtr XMLCALL xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); +#endif /* LIBXML_XPTR_LOCS_ENABLED */ #ifdef __cplusplus } #endif diff --git a/chromium/third_party/libxml/src/libxml.h b/chromium/third_party/libxml/src/libxml.h index 910ca49be6a..66f164d544b 100644 --- a/chromium/third_party/libxml/src/libxml.h +++ b/chromium/third_party/libxml/src/libxml.h @@ -9,8 +9,10 @@ #ifndef __XML_LIBXML_H__ #define __XML_LIBXML_H__ -#include <libxml/xmlstring.h> - +/* + * These macros must be defined before including system headers. + * Do not add any #include directives above this block. + */ #ifndef NO_LARGEFILE_SOURCE #ifndef _LARGEFILE_SOURCE #define _LARGEFILE_SOURCE @@ -27,6 +29,7 @@ */ #include "config.h" #include <libxml/xmlversion.h> +#include <libxml/xmlstring.h> #ifndef SYSCONFDIR #define SYSCONFDIR "/etc" diff --git a/chromium/third_party/libxml/src/libxml.spec.in b/chromium/third_party/libxml/src/libxml.spec.in index ea593d0e355..45083de79a1 100644 --- a/chromium/third_party/libxml/src/libxml.spec.in +++ b/chromium/third_party/libxml/src/libxml.spec.in @@ -99,7 +99,7 @@ at parse time or later once the document has been modified. mkdir py3doc cp doc/*.py py3doc -sed -i 's|#!/usr/bin/python |#!%{__python3} |' py3doc/*.py +sed -i 's|#!/usr/bin/env python|#!/usr/bin/env %{__python3}|' py3doc/*.py %build %configure diff --git a/chromium/third_party/libxml/src/libxml2.spec b/chromium/third_party/libxml/src/libxml2.spec index 4de040b1afa..fbcc0324a93 100644 --- a/chromium/third_party/libxml/src/libxml2.spec +++ b/chromium/third_party/libxml/src/libxml2.spec @@ -99,7 +99,7 @@ at parse time or later once the document has been modified. mkdir py3doc cp doc/*.py py3doc -sed -i 's|#!/usr/bin/python |#!%{__python3} |' py3doc/*.py +sed -i 's|#!/usr/bin/env python|#!/usr/bin/env %{__python3}|' py3doc/*.py %build %configure @@ -203,6 +203,6 @@ rm -fr %{buildroot} %endif # with_python3 %changelog -* Mon Apr 4 2022 Daniel Veillard <veillard@redhat.com> +* Fri May 6 2022 Daniel Veillard <veillard@redhat.com> - upstream release 2.9.13 diff --git a/chromium/third_party/libxml/src/parser.c b/chromium/third_party/libxml/src/parser.c index d207a02b1b7..5391c90322f 100644 --- a/chromium/third_party/libxml/src/parser.c +++ b/chromium/third_party/libxml/src/parser.c @@ -296,7 +296,7 @@ unsigned int xmlParserMaxDepth = 256; * List of XML prefixed PI allowed by W3C specs */ -static const char *xmlW3CPIs[] = { +static const char* const xmlW3CPIs[] = { "xml-stylesheet", "xml-model", NULL @@ -2209,7 +2209,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { ctxt->input->col++; } cur++; - res++; + if (res < INT_MAX) + res++; if (*cur == 0) { ctxt->input->cur = cur; xmlParserInputGrow(ctxt->input, INPUT_CHUNK); @@ -2245,7 +2246,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { * by the attachment of one leading and one following space (#x20) * character." */ - res++; + if (res < INT_MAX) + res++; } } return(res); diff --git a/chromium/third_party/libxml/src/runtest.c b/chromium/third_party/libxml/src/runtest.c index 31bb5c6ca6f..8626b91f42b 100644 --- a/chromium/third_party/libxml/src/runtest.c +++ b/chromium/third_party/libxml/src/runtest.c @@ -2153,10 +2153,10 @@ fdParseTest(const char *filename, const char *result, const char *err, int options) { xmlDocPtr doc; const char *base = NULL; - int size, res = 0; + int size, res = 0, fd; nb_tests++; - int fd = open(filename, RD_FLAGS); + fd = open(filename, RD_FLAGS); #ifdef LIBXML_HTML_ENABLED if (options & XML_PARSE_HTML) { doc = htmlReadFd(fd, filename, NULL, options); @@ -2619,23 +2619,24 @@ xptrDocTest(const char *filename, glob_t globbuf; size_t i; int ret = 0, res; + const char *subdir = options == -1 ? "xptr-xp1" : "xptr"; xpathDocument = xmlReadFile(filename, NULL, - options | XML_PARSE_DTDATTR | XML_PARSE_NOENT); + XML_PARSE_DTDATTR | XML_PARSE_NOENT); if (xpathDocument == NULL) { fprintf(stderr, "Failed to load %s\n", filename); return(-1); } - res = snprintf(pattern, 499, "./test/XPath/xptr/%s*", - baseFilename(filename)); + res = snprintf(pattern, 499, "./test/XPath/%s/%s*", + subdir, baseFilename(filename)); if (res >= 499) pattern[499] = 0; globbuf.gl_offs = 0; glob(pattern, GLOB_DOOFFS, NULL, &globbuf); for (i = 0;i < globbuf.gl_pathc;i++) { - res = snprintf(result, 499, "result/XPath/xptr/%s", - baseFilename(globbuf.gl_pathv[i])); + res = snprintf(result, 499, "result/XPath/%s/%s", + subdir, baseFilename(globbuf.gl_pathv[i])); if (res >= 499) result[499] = 0; res = xpathCommonTest(globbuf.gl_pathv[i], &result[0], 1, 0); @@ -4530,6 +4531,11 @@ testDesc testDescriptions[] = { #ifdef LIBXML_XPTR_ENABLED { "XPointer document queries regression tests" , xptrDocTest, "./test/XPath/docs/*", NULL, NULL, NULL, + -1 }, +#endif +#ifdef LIBXML_XPTR_LOCS_ENABLED + { "XPointer xpointer() queries regression tests" , + xptrDocTest, "./test/XPath/docs/*", NULL, NULL, NULL, 0 }, #endif #ifdef LIBXML_VALID_ENABLED @@ -4782,6 +4788,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { fprintf(stderr, "runtest requires output to be enabled in libxml2\n"); - return(1); + return(0); } #endif diff --git a/chromium/third_party/libxml/src/runxmlconf.c b/chromium/third_party/libxml/src/runxmlconf.c index 7196c28a99c..5e88f80d289 100644 --- a/chromium/third_party/libxml/src/runxmlconf.c +++ b/chromium/third_party/libxml/src/runxmlconf.c @@ -601,7 +601,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { #else /* ! LIBXML_XPATH_ENABLED */ #include <stdio.h> int -main(int argc, char **argv) { +main(int argc ATTRIBUTE_UNUSED, char **argv) { fprintf(stderr, "%s need XPath support\n", argv[0]); } #endif diff --git a/chromium/third_party/libxml/src/testapi.c b/chromium/third_party/libxml/src/testapi.c index 54a8092bb60..c7a5b163bea 100644 --- a/chromium/third_party/libxml/src/testapi.c +++ b/chromium/third_party/libxml/src/testapi.c @@ -309,6 +309,8 @@ static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } +#ifdef LIBXML_SCHEMAS_ENABLED + #define gen_nb_unsigned_long 4 static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { @@ -321,6 +323,20 @@ static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } +#define gen_nb_unsigned_long_ptr 2 + +static unsigned long *gen_unsigned_long_ptr(int no, int nr) { + if (no == 0) return(&longtab[nr]); + return(NULL); +} + +static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#endif /* LIBXML_SCHEMAS_ENABLED */ + +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) + #define gen_nb_double 4 static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { @@ -335,15 +351,7 @@ static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } -#define gen_nb_unsigned_long_ptr 2 - -static unsigned long *gen_unsigned_long_ptr(int no, int nr) { - if (no == 0) return(&longtab[nr]); - return(NULL); -} - -static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#endif /* defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ #define gen_nb_int_ptr 2 @@ -434,7 +442,7 @@ static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSE #define gen_nb_fileoutput 6 static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return("/missing.xml"); + if (no == 0) return("missing.xml"); if (no == 1) return("<foo/>"); if (no == 2) return(REMOTE2GOOD); if (no == 3) return(REMOTE1GOOD); @@ -455,24 +463,26 @@ static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, xmlFreeParserCtxt(val); } +#ifdef LIBXML_SAX1_ENABLED #define gen_nb_xmlSAXHandlerPtr 2 static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) { -#ifdef LIBXML_SAX1_ENABLED if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler); -#endif return(NULL); } static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } +#endif #define gen_nb_xmlValidCtxtPtr 2 static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { + (void) no; #ifdef LIBXML_VALID_ENABLED if (no == 0) return(xmlNewValidCtxt()); #endif return(NULL); } static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) { + (void) val; #ifdef LIBXML_VALID_ENABLED if (val != NULL) xmlFreeValidCtxt(val); @@ -665,21 +675,6 @@ static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr v } #endif -#ifdef LIBXML_FTP_ENABLED -#define gen_nb_xmlNanoFTPCtxtPtr 4 -static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD)); - if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD)); - if (no == 2) return(xmlNanoFTPNewCtxt("foo")); - return(NULL); -} -static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) { - xmlNanoFTPFreeCtxt(val); - } -} -#endif - #ifdef LIBXML_HTTP_ENABLED #define gen_nb_xmlNanoHTTPCtxtPtr 1 static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { @@ -762,8 +757,10 @@ static void desret_long(long val ATTRIBUTE_UNUSED) { } static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) { } +#if defined(LIBXML_XPATH_ENABLED) static void desret_double(double val ATTRIBUTE_UNUSED) { } +#endif static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) { } #if 0 @@ -874,11 +871,6 @@ static void desret_xmlNanoHTTPCtxtPtr(void *val) { xmlNanoHTTPClose(val); } #endif -#ifdef LIBXML_FTP_ENABLED -static void desret_xmlNanoFTPCtxtPtr(void *val) { - xmlNanoFTPClose(val); -} -#endif /* cut and pasted from autogenerated to avoid troubles */ #define gen_nb_const_xmlChar_ptr_ptr 1 static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { @@ -993,12 +985,15 @@ static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeIn static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) { } +#if defined(LIBXML_MODULES_ENABLED) || defined(LIBXML_READER_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) #define gen_nb_void_ptr_ptr 1 static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { return(NULL); } static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } +#endif /************************************************************************ * * @@ -1172,7 +1167,6 @@ static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaW #include <libxml/entities.h> #include <libxml/hash.h> #include <libxml/list.h> -#include <libxml/nanoftp.h> #include <libxml/nanohttp.h> #include <libxml/parser.h> #include <libxml/parserInternals.h> @@ -1211,7 +1205,6 @@ static int test_encoding(void); static int test_entities(void); static int test_hash(void); static int test_list(void); -static int test_nanoftp(void); static int test_nanohttp(void); static int test_parser(void); static int test_parserInternals(void); @@ -1264,7 +1257,6 @@ testlibxml2(void) test_ret += test_entities(); test_ret += test_hash(); test_ret += test_list(); - test_ret += test_nanoftp(); test_ret += test_nanohttp(); test_ret += test_parser(); test_ret += test_parserInternals(); @@ -1355,11 +1347,8 @@ test_UTF8ToHtml(void) { #ifdef LIBXML_HTML_ENABLED #define gen_nb_const_htmlElemDesc_ptr 1 -static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_htmlElemDesc_ptr(no, nr) NULL +#define des_const_htmlElemDesc_ptr(no, val, nr) #endif @@ -1413,11 +1402,8 @@ test_htmlAttrAllowed(void) { #ifdef LIBXML_HTML_ENABLED #define gen_nb_htmlNodePtr 1 -static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_htmlNodePtr(no, nr) NULL +#define des_htmlNodePtr(no, val, nr) #endif @@ -1515,11 +1501,8 @@ test_htmlCreateMemoryParserCtxt(void) { #ifdef LIBXML_HTML_ENABLED #define gen_nb_htmlSAXHandlerPtr 1 -static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_htmlSAXHandlerPtr(no, nr) NULL +#define des_htmlSAXHandlerPtr(no, val, nr) #endif @@ -2979,11 +2962,8 @@ test_htmlDocDump(void) { #define gen_nb_xmlChar_ptr_ptr 1 -static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlChar_ptr_ptr(no, nr) NULL +#define des_xmlChar_ptr_ptr(no, val, nr) static int test_htmlDocDumpMemory(void) { @@ -3717,33 +3697,6 @@ test_HTMLtree(void) { } static int -test_docbDefaultSAXHandlerInit(void) { - int test_ret = 0; - -#if defined(LIBXML_DOCB_ENABLED) -#ifdef LIBXML_DOCB_ENABLED - int mem_base; - - mem_base = xmlMemBlocks(); - - docbDefaultSAXHandlerInit(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in docbDefaultSAXHandlerInit", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int test_htmlDefaultSAXHandlerInit(void) { int test_ret = 0; @@ -3794,11 +3747,8 @@ test_xmlDefaultSAXHandlerInit(void) { #define gen_nb_xmlEnumerationPtr 1 -static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlEnumerationPtr(no, nr) NULL +#define des_xmlEnumerationPtr(no, val, nr) static int test_xmlSAX2AttributeDecl(void) { @@ -4088,7 +4038,7 @@ static int test_xmlSAX2EndElement(void) { int test_ret = 0; -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED) #ifdef LIBXML_SAX1_ENABLED int mem_base; void * ctx; /* the user data (XML parser context) */ @@ -4610,11 +4560,8 @@ test_xmlSAX2IgnorableWhitespace(void) { #define gen_nb_xmlSAXHandler_ptr 1 -static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSAXHandler_ptr(no, nr) NULL +#define des_xmlSAXHandler_ptr(no, val, nr) static int test_xmlSAX2InitDefaultSAXHandler(void) { @@ -4654,38 +4601,6 @@ test_xmlSAX2InitDefaultSAXHandler(void) { static int -test_xmlSAX2InitDocbDefaultSAXHandler(void) { - int test_ret = 0; - -#if defined(LIBXML_DOCB_ENABLED) - int mem_base; - xmlSAXHandler * hdlr; /* the SAX handler */ - int n_hdlr; - - for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { - mem_base = xmlMemBlocks(); - hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); - - xmlSAX2InitDocbDefaultSAXHandler(hdlr); - call_tests++; - des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_hdlr); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int test_xmlSAX2InitHtmlDefaultSAXHandler(void) { int test_ret = 0; @@ -4979,11 +4894,8 @@ test_xmlSAX2ResolveEntity(void) { #define gen_nb_xmlSAXLocatorPtr 1 -static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSAXLocatorPtr(no, nr) NULL +#define des_xmlSAXLocatorPtr(no, val, nr) static int test_xmlSAX2SetDocumentLocator(void) { @@ -5056,7 +4968,7 @@ static int test_xmlSAX2StartElement(void) { int test_ret = 0; -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED) #ifdef LIBXML_SAX1_ENABLED int mem_base; void * ctx; /* the user data (XML parser context) */ @@ -5322,8 +5234,7 @@ static int test_SAX2(void) { int test_ret = 0; - if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n"); - test_ret += test_docbDefaultSAXHandlerInit(); + if (quiet == 0) printf("Testing SAX2 : 36 of 36 functions ...\n"); test_ret += test_htmlDefaultSAXHandlerInit(); test_ret += test_xmlDefaultSAXHandlerInit(); test_ret += test_xmlSAX2AttributeDecl(); @@ -5346,7 +5257,6 @@ test_SAX2(void) { test_ret += test_xmlSAX2HasInternalSubset(); test_ret += test_xmlSAX2IgnorableWhitespace(); test_ret += test_xmlSAX2InitDefaultSAXHandler(); - test_ret += test_xmlSAX2InitDocbDefaultSAXHandler(); test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler(); test_ret += test_xmlSAX2InternalSubset(); test_ret += test_xmlSAX2IsStandalone(); @@ -5607,11 +5517,8 @@ test_c14n(void) { #ifdef LIBXML_CATALOG_ENABLED #define gen_nb_xmlCatalogPtr 1 -static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlCatalogPtr(no, nr) NULL +#define des_xmlCatalogPtr(no, val, nr) #endif @@ -6623,11 +6530,8 @@ test_catalog(void) { } #define gen_nb_const_xmlChRangeGroup_ptr 1 -static xmlChRangeGroup * gen_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroup * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlChRangeGroup_ptr(no, nr) NULL +#define des_const_xmlChRangeGroup_ptr(no, val, nr) static int test_xmlCharInRange(void) { @@ -7527,11 +7431,8 @@ test_xmlShell(void) { #define gen_nb_char_ptr 1 -static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_char_ptr(no, nr) NULL +#define des_char_ptr(no, val, nr) static int test_xmlShellBase(void) { @@ -8686,11 +8587,8 @@ test_xmlAddEncodingAlias(void) { #define gen_nb_xmlCharEncodingHandler_ptr 1 -static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlCharEncodingHandler_ptr(no, nr) NULL +#define des_xmlCharEncodingHandler_ptr(no, val, nr) static int test_xmlCharEncCloseFunc(void) { @@ -9113,11 +9011,8 @@ test_xmlParseCharEncoding(void) { #define gen_nb_xmlCharEncodingHandlerPtr 1 -static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlCharEncodingHandlerPtr(no, nr) NULL +#define des_xmlCharEncodingHandlerPtr(no, val, nr) static int test_xmlRegisterCharEncodingHandler(void) { @@ -9333,11 +9228,8 @@ test_xmlCreateEntitiesTable(void) { #define gen_nb_xmlEntitiesTablePtr 1 -static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlEntitiesTablePtr(no, nr) NULL +#define des_xmlEntitiesTablePtr(no, val, nr) static int test_xmlDumpEntitiesTable(void) { @@ -9379,11 +9271,8 @@ test_xmlDumpEntitiesTable(void) { #define gen_nb_xmlEntityPtr 1 -static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlEntityPtr(no, nr) NULL +#define des_xmlEntityPtr(no, val, nr) static int test_xmlDumpEntityDecl(void) { @@ -9464,11 +9353,8 @@ test_xmlEncodeEntitiesReentrant(void) { #define gen_nb_const_xmlDoc_ptr 1 -static xmlDoc * gen_const_xmlDoc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlDoc_ptr(int no ATTRIBUTE_UNUSED, const xmlDoc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlDoc_ptr(no, nr) NULL +#define des_const_xmlDoc_ptr(no, val, nr) static int test_xmlEncodeSpecialChars(void) { @@ -10738,11 +10624,8 @@ test_hash(void) { } #define gen_nb_xmlLinkPtr 1 -static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlLinkPtr(no, nr) NULL +#define des_xmlLinkPtr(no, val, nr) static int test_xmlLinkGetData(void) { @@ -10846,11 +10729,8 @@ test_xmlListClear(void) { #define gen_nb_const_xmlListPtr 1 -static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlListPtr(no, nr) NULL +#define des_const_xmlListPtr(no, val, nr) static int test_xmlListCopy(void) { @@ -11520,569 +11400,6 @@ test_list(void) { } static int -test_xmlNanoFTPCheckResponse(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoFTPCheckResponse(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCheckResponse", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPCleanup(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlNanoFTPCleanup(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCleanup", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPCloseConnection(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoFTPCloseConnection(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCloseConnection", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPCwd(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - char * directory; /* a directory on the server */ - int n_directory; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - directory = gen_const_char_ptr(n_directory, 1); - - ret_val = xmlNanoFTPCwd(ctx, (const char *)directory); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - des_const_char_ptr(n_directory, (const char *)directory, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCwd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_directory); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPDele(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - const char * file; /* a file or directory on the server */ - int n_file; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - for (n_file = 0;n_file < gen_nb_filepath;n_file++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - file = gen_filepath(n_file, 1); - - ret_val = xmlNanoFTPDele(ctx, file); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - des_filepath(n_file, file, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPDele", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_file); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPGet(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoFTPGetConnection(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoFTPGetResponse(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoFTPGetResponse(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPGetResponse", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPGetSocket(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoFTPInit(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlNanoFTPInit(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPInit", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPList(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoFTPNewCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - void * ret_val; - const char * URL; /* The URL used to initialize the context */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - - ret_val = xmlNanoFTPNewCtxt(URL); - desret_xmlNanoFTPCtxtPtr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPNewCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPOpen(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - void * ret_val; - const char * URL; /* the URL to the resource */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - - ret_val = xmlNanoFTPOpen(URL); - desret_xmlNanoFTPCtxtPtr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPOpen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPProxy(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - char * host; /* the proxy host name */ - int n_host; - int port; /* the proxy port */ - int n_port; - char * user; /* the proxy user name */ - int n_user; - char * passwd; /* the proxy password */ - int n_passwd; - int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */ - int n_type; - - for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) { - for (n_port = 0;n_port < gen_nb_int;n_port++) { - for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) { - for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) { - for (n_type = 0;n_type < gen_nb_int;n_type++) { - host = gen_const_char_ptr(n_host, 0); - port = gen_int(n_port, 1); - user = gen_const_char_ptr(n_user, 2); - passwd = gen_const_char_ptr(n_passwd, 3); - type = gen_int(n_type, 4); - - xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type); - call_tests++; - des_const_char_ptr(n_host, (const char *)host, 0); - des_int(n_port, port, 1); - des_const_char_ptr(n_user, (const char *)user, 2); - des_const_char_ptr(n_passwd, (const char *)passwd, 3); - des_int(n_type, type, 4); - xmlResetLastError(); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPQuit(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoFTPQuit(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPQuit", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPRead(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* the FTP context */ - int n_ctx; - void * dest; /* a buffer */ - int n_dest; - int len; /* the buffer length */ - int n_len; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - dest = gen_void_ptr(n_dest, 1); - len = gen_int(n_len, 2); - - ret_val = xmlNanoFTPRead(ctx, dest, len); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - des_void_ptr(n_dest, dest, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_dest); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPScanProxy(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - const char * URL; /* The proxy URL used to initialize the proxy context */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - URL = gen_filepath(n_URL, 0); - - xmlNanoFTPScanProxy(URL); - call_tests++; - des_filepath(n_URL, URL, 0); - xmlResetLastError(); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPUpdateURL(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - const char * URL; /* The URL used to update the context */ - int n_URL; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - URL = gen_filepath(n_URL, 1); - - ret_val = xmlNanoFTPUpdateURL(ctx, URL); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - des_filepath(n_URL, URL, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPUpdateURL", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_URL); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_nanoftp(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing nanoftp : 14 of 22 functions ...\n"); - test_ret += test_xmlNanoFTPCheckResponse(); - test_ret += test_xmlNanoFTPCleanup(); - test_ret += test_xmlNanoFTPCloseConnection(); - test_ret += test_xmlNanoFTPCwd(); - test_ret += test_xmlNanoFTPDele(); - test_ret += test_xmlNanoFTPGet(); - test_ret += test_xmlNanoFTPGetConnection(); - test_ret += test_xmlNanoFTPGetResponse(); - test_ret += test_xmlNanoFTPGetSocket(); - test_ret += test_xmlNanoFTPInit(); - test_ret += test_xmlNanoFTPList(); - test_ret += test_xmlNanoFTPNewCtxt(); - test_ret += test_xmlNanoFTPOpen(); - test_ret += test_xmlNanoFTPProxy(); - test_ret += test_xmlNanoFTPQuit(); - test_ret += test_xmlNanoFTPRead(); - test_ret += test_xmlNanoFTPScanProxy(); - test_ret += test_xmlNanoFTPUpdateURL(); - - if (test_ret != 0) - printf("Module nanoftp: %d errors\n", test_ret); - return(test_ret); -} - -static int test_xmlNanoHTTPAuthHeader(void) { int test_ret = 0; @@ -12210,11 +11527,8 @@ test_xmlNanoHTTPEncoding(void) { #define gen_nb_char_ptr_ptr 1 -static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_char_ptr_ptr(no, nr) NULL +#define des_char_ptr_ptr(no, val, nr) static int test_xmlNanoHTTPFetch(void) { @@ -13446,11 +12760,8 @@ test_xmlNewParserCtxt(void) { #define gen_nb_xmlNodePtr_ptr 1 -static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlNodePtr_ptr(no, nr) NULL +#define des_xmlNodePtr_ptr(no, val, nr) static int test_xmlParseBalancedChunkMemory(void) { @@ -14125,11 +13436,8 @@ test_xmlParseMemory(void) { #define gen_nb_const_xmlParserNodeInfoPtr 1 -static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlParserNodeInfoPtr(no, nr) NULL +#define des_const_xmlParserNodeInfoPtr(no, val, nr) static int test_xmlParserAddNodeInfo(void) { @@ -14169,18 +13477,12 @@ test_xmlParserAddNodeInfo(void) { #define gen_nb_const_xmlParserCtxtPtr 1 -static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlParserCtxtPtr(no, nr) NULL +#define des_const_xmlParserCtxtPtr(no, val, nr) #define gen_nb_const_xmlNodePtr 1 -static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlNodePtr(no, nr) NULL +#define des_const_xmlNodePtr(no, val, nr) static int test_xmlParserFindNodeInfo(void) { @@ -14222,11 +13524,8 @@ test_xmlParserFindNodeInfo(void) { #define gen_nb_const_xmlParserNodeInfoSeqPtr 1 -static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlParserNodeInfoSeqPtr(no, nr) NULL +#define des_const_xmlParserNodeInfoSeqPtr(no, val, nr) static int test_xmlParserFindNodeInfoIndex(void) { @@ -14268,11 +13567,8 @@ test_xmlParserFindNodeInfoIndex(void) { #define gen_nb_xmlParserInputPtr 1 -static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlParserInputPtr(no, nr) NULL +#define des_xmlParserInputPtr(no, val, nr) static int test_xmlParserInputGrow(void) { @@ -16909,11 +16205,8 @@ test_xmlPatterncompile(void) { #ifdef LIBXML_PATTERN_ENABLED #define gen_nb_xmlStreamCtxtPtr 1 -static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlStreamCtxtPtr(no, nr) NULL +#define des_xmlStreamCtxtPtr(no, val, nr) #endif @@ -17160,11 +16453,8 @@ test_pattern(void) { #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlRelaxNGPtr 1 -static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlRelaxNGPtr(no, nr) NULL +#define des_xmlRelaxNGPtr(no, val, nr) #endif @@ -17248,31 +16538,22 @@ test_xmlRelaxNGDumpTree(void) { #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlRelaxNGParserCtxtPtr 1 -static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlRelaxNGParserCtxtPtr(no, nr) NULL +#define des_xmlRelaxNGParserCtxtPtr(no, val, nr) #endif #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1 -static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlRelaxNGValidityErrorFunc_ptr(no, nr) NULL +#define des_xmlRelaxNGValidityErrorFunc_ptr(no, val, nr) #endif #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1 -static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlRelaxNGValidityWarningFunc_ptr(no, nr) NULL +#define des_xmlRelaxNGValidityWarningFunc_ptr(no, val, nr) #endif @@ -17333,11 +16614,8 @@ test_xmlRelaxNGGetParserErrors(void) { #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlRelaxNGValidCtxtPtr 1 -static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlRelaxNGValidCtxtPtr(no, nr) NULL +#define des_xmlRelaxNGValidCtxtPtr(no, val, nr) #endif @@ -17974,11 +17252,8 @@ test_xmlSchematronSetValidStructuredErrors(void) { #ifdef LIBXML_SCHEMATRON_ENABLED #define gen_nb_xmlSchematronValidCtxtPtr 1 -static xmlSchematronValidCtxtPtr gen_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchematronValidCtxtPtr(no, nr) NULL +#define des_xmlSchematronValidCtxtPtr(no, val, nr) #endif @@ -18298,11 +17573,8 @@ test_xmlAttrSerializeTxtContent(void) { #define gen_nb_const_xmlBuf_ptr 1 -static xmlBuf * gen_const_xmlBuf_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlBuf_ptr(int no ATTRIBUTE_UNUSED, const xmlBuf * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlBuf_ptr(no, nr) NULL +#define des_const_xmlBuf_ptr(no, val, nr) static int test_xmlBufContent(void) { @@ -18337,11 +17609,8 @@ test_xmlBufContent(void) { #define gen_nb_xmlBufPtr 1 -static xmlBufPtr gen_xmlBufPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlBufPtr(int no ATTRIBUTE_UNUSED, xmlBufPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlBufPtr(no, nr) NULL +#define des_xmlBufPtr(no, val, nr) static int test_xmlBufEnd(void) { @@ -18376,11 +17645,8 @@ test_xmlBufEnd(void) { #define gen_nb_const_xmlNode_ptr 1 -static xmlNode * gen_const_xmlNode_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlNode_ptr(int no ATTRIBUTE_UNUSED, const xmlNode * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlNode_ptr(no, nr) NULL +#define des_const_xmlNode_ptr(no, val, nr) static int test_xmlBufGetNodeContent(void) { @@ -18628,11 +17894,8 @@ test_xmlBufferCat(void) { #define gen_nb_const_xmlBuffer_ptr 1 -static xmlBuffer * gen_const_xmlBuffer_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlBuffer_ptr(int no ATTRIBUTE_UNUSED, const xmlBuffer * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_const_xmlBuffer_ptr(no, nr) NULL +#define des_const_xmlBuffer_ptr(no, val, nr) static int test_xmlBufferContent(void) { @@ -19509,11 +18772,8 @@ test_xmlCreateIntSubset(void) { #define gen_nb_xmlDOMWrapCtxtPtr 1 -static xmlDOMWrapCtxtPtr gen_xmlDOMWrapCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlDOMWrapCtxtPtr(int no ATTRIBUTE_UNUSED, xmlDOMWrapCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlDOMWrapCtxtPtr(no, nr) NULL +#define des_xmlDOMWrapCtxtPtr(no, val, nr) static int test_xmlDOMWrapAdoptNode(void) { @@ -23940,7 +23200,7 @@ static int test_xmlValidateNCName(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED) #ifdef LIBXML_TREE_ENABLED int mem_base; int ret_val; @@ -24440,11 +23700,8 @@ test_xmlParseURIRaw(void) { #define gen_nb_xmlURIPtr 1 -static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlURIPtr(no, nr) NULL +#define des_xmlURIPtr(no, val, nr) static int test_xmlParseURIReference(void) { @@ -24991,11 +24248,8 @@ test_xmlCreateEnumeration(void) { #define gen_nb_xmlAttributePtr 1 -static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlAttributePtr(no, nr) NULL +#define des_xmlAttributePtr(no, val, nr) static int test_xmlDumpAttributeDecl(void) { @@ -25037,11 +24291,8 @@ test_xmlDumpAttributeDecl(void) { #define gen_nb_xmlAttributeTablePtr 1 -static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlAttributeTablePtr(no, nr) NULL +#define des_xmlAttributeTablePtr(no, val, nr) static int test_xmlDumpAttributeTable(void) { @@ -25083,11 +24334,8 @@ test_xmlDumpAttributeTable(void) { #define gen_nb_xmlElementPtr 1 -static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlElementPtr(no, nr) NULL +#define des_xmlElementPtr(no, val, nr) static int test_xmlDumpElementDecl(void) { @@ -25129,11 +24377,8 @@ test_xmlDumpElementDecl(void) { #define gen_nb_xmlElementTablePtr 1 -static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlElementTablePtr(no, nr) NULL +#define des_xmlElementTablePtr(no, val, nr) static int test_xmlDumpElementTable(void) { @@ -25175,11 +24420,8 @@ test_xmlDumpElementTable(void) { #define gen_nb_xmlNotationPtr 1 -static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlNotationPtr(no, nr) NULL +#define des_xmlNotationPtr(no, val, nr) static int test_xmlDumpNotationDecl(void) { @@ -25221,11 +24463,8 @@ test_xmlDumpNotationDecl(void) { #define gen_nb_xmlNotationTablePtr 1 -static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlNotationTablePtr(no, nr) NULL +#define des_xmlNotationTablePtr(no, val, nr) static int test_xmlDumpNotationTable(void) { @@ -26017,11 +25256,8 @@ test_xmlValidCtxtNormalizeAttributeValue(void) { #define gen_nb_xmlElementContent_ptr 1 -static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlElementContent_ptr(no, nr) NULL +#define des_xmlElementContent_ptr(no, val, nr) static int test_xmlValidGetPotentialChildren(void) { @@ -27367,11 +26603,8 @@ test_xmlXIncludeProcessFlagsData(void) { #ifdef LIBXML_XINCLUDE_ENABLED #define gen_nb_xmlXIncludeCtxtPtr 1 -static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlXIncludeCtxtPtr(no, nr) NULL +#define des_xmlXIncludeCtxtPtr(no, val, nr) #endif @@ -29209,11 +28442,8 @@ test_xmlAutomataGetInitState(void) { #ifdef LIBXML_AUTOMATA_ENABLED #define gen_nb_xmlAutomataPtr 1 -static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlAutomataPtr(no, nr) NULL +#define des_xmlAutomataPtr(no, val, nr) #endif @@ -29421,11 +28651,8 @@ test_xmlAutomataNewTransition2(void) { #ifdef LIBXML_AUTOMATA_ENABLED #define gen_nb_xmlAutomataStatePtr 1 -static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlAutomataStatePtr(no, nr) NULL +#define des_xmlAutomataStatePtr(no, val, nr) #endif @@ -29509,11 +28736,8 @@ test_xmlautomata(void) { } #define gen_nb_xmlGenericErrorFunc_ptr 1 -static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlGenericErrorFunc_ptr(no, nr) NULL +#define des_xmlGenericErrorFunc_ptr(no, val, nr) static int test_initGenericErrorDefaultFunc(void) { @@ -29546,11 +28770,8 @@ test_initGenericErrorDefaultFunc(void) { #define gen_nb_xmlErrorPtr 1 -static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlErrorPtr(no, nr) NULL +#define des_xmlErrorPtr(no, val, nr) static int test_xmlCopyError(void) { @@ -29833,11 +29054,8 @@ test_xmlerror(void) { #ifdef LIBXML_MODULES_ENABLED #define gen_nb_xmlModulePtr 1 -static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlModulePtr(no, nr) NULL +#define des_xmlModulePtr(no, val, nr) #endif @@ -31204,11 +30422,8 @@ test_xmlTextReaderGetAttributeNs(void) { #ifdef LIBXML_READER_ENABLED #define gen_nb_xmlTextReaderErrorFunc_ptr 1 -static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlTextReaderErrorFunc_ptr(no, nr) NULL +#define des_xmlTextReaderErrorFunc_ptr(no, val, nr) #endif @@ -31641,11 +30856,8 @@ test_xmlTextReaderLocalName(void) { #ifdef LIBXML_READER_ENABLED #define gen_nb_xmlTextReaderLocatorPtr 1 -static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlTextReaderLocatorPtr(no, nr) NULL +#define des_xmlTextReaderLocatorPtr(no, val, nr) #endif @@ -33464,11 +32676,8 @@ test_xmlExpSubsume(void) { #ifdef LIBXML_REGEXP_ENABLED #define gen_nb_xmlRegExecCtxtPtr 1 -static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlRegExecCtxtPtr(no, nr) NULL +#define des_xmlRegExecCtxtPtr(no, val, nr) #endif @@ -33728,11 +32937,8 @@ test_xmlRegexpCompile(void) { #ifdef LIBXML_REGEXP_ENABLED #define gen_nb_xmlRegexpPtr 1 -static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlRegexpPtr(no, nr) NULL +#define des_xmlRegexpPtr(no, val, nr) #endif @@ -33888,11 +33094,8 @@ test_xmlregexp(void) { #ifdef LIBXML_OUTPUT_ENABLED #define gen_nb_xmlSaveCtxtPtr 1 -static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSaveCtxtPtr(no, nr) NULL +#define des_xmlSaveCtxtPtr(no, val, nr) #endif @@ -34156,31 +33359,22 @@ test_xmlSchemaDump(void) { #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaParserCtxtPtr 1 -static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchemaParserCtxtPtr(no, nr) NULL +#define des_xmlSchemaParserCtxtPtr(no, val, nr) #endif #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaValidityErrorFunc_ptr 1 -static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchemaValidityErrorFunc_ptr(no, nr) NULL +#define des_xmlSchemaValidityErrorFunc_ptr(no, val, nr) #endif #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaValidityWarningFunc_ptr 1 -static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchemaValidityWarningFunc_ptr(no, nr) NULL +#define des_xmlSchemaValidityWarningFunc_ptr(no, val, nr) #endif @@ -34472,11 +33666,8 @@ test_xmlSchemaSAXPlug(void) { #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaSAXPlugPtr 1 -static xmlSchemaSAXPlugPtr gen_xmlSchemaSAXPlugPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaSAXPlugPtr(int no ATTRIBUTE_UNUSED, xmlSchemaSAXPlugPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchemaSAXPlugPtr(no, nr) NULL +#define des_xmlSchemaSAXPlugPtr(no, val, nr) #endif @@ -34940,21 +34131,15 @@ test_xmlschemas(void) { #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaFacetPtr 1 -static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchemaFacetPtr(no, nr) NULL +#define des_xmlSchemaFacetPtr(no, val, nr) #endif #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaTypePtr 1 -static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchemaTypePtr(no, nr) NULL +#define des_xmlSchemaTypePtr(no, val, nr) #endif @@ -35066,11 +34251,8 @@ test_xmlSchemaCollapseString(void) { #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaValPtr 1 -static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchemaValPtr(no, nr) NULL +#define des_xmlSchemaValPtr(no, val, nr) #endif @@ -35537,11 +34719,8 @@ test_xmlSchemaNewStringValue(void) { #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaValPtr_ptr 1 -static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlSchemaValPtr_ptr(no, nr) NULL +#define des_xmlSchemaValPtr_ptr(no, val, nr) #endif @@ -46376,21 +45555,15 @@ test_xmlXPathCompile(void) { #ifdef LIBXML_XPATH_ENABLED #define gen_nb_xmlXPathCompExprPtr 1 -static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlXPathCompExprPtr(no, nr) NULL +#define des_xmlXPathCompExprPtr(no, val, nr) #endif #ifdef LIBXML_XPATH_ENABLED #define gen_nb_xmlXPathContextPtr 1 -static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlXPathContextPtr(no, nr) NULL +#define des_xmlXPathContextPtr(no, val, nr) #endif @@ -47110,11 +46283,8 @@ test_xpath(void) { #ifdef LIBXML_XPATH_ENABLED #define gen_nb_xmlXPathParserContextPtr 1 -static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} +#define gen_xmlXPathParserContextPtr(no, nr) NULL +#define des_xmlXPathParserContextPtr(no, val, nr) #endif @@ -51396,7 +50566,7 @@ static int test_xmlXPtrBuildNodeList(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlNodePtr ret_val; xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */ @@ -51471,7 +50641,7 @@ static int test_xmlXPtrEvalRangePredicate(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */ int n_ctxt; @@ -51498,159 +50668,12 @@ test_xmlXPtrEvalRangePredicate(void) { return(test_ret); } -#ifdef LIBXML_XPTR_ENABLED - -#define gen_nb_xmlLocationSetPtr 1 -static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlXPtrLocationSetAdd(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlLocationSetPtr cur; /* the initial range set */ - int n_cur; - xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlLocationSetPtr(n_cur, 0); - val = gen_xmlXPathObjectPtr(n_val, 1); - - xmlXPtrLocationSetAdd(cur, val); - call_tests++; - des_xmlLocationSetPtr(n_cur, cur, 0); - des_xmlXPathObjectPtr(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrLocationSetAdd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrLocationSetCreate(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPtrLocationSetDel(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlLocationSetPtr cur; /* the initial range set */ - int n_cur; - xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlLocationSetPtr(n_cur, 0); - val = gen_xmlXPathObjectPtr(n_val, 1); - - xmlXPtrLocationSetDel(cur, val); - call_tests++; - des_xmlLocationSetPtr(n_cur, cur, 0); - des_xmlXPathObjectPtr(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrLocationSetDel", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrLocationSetMerge(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPtrLocationSetRemove(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlLocationSetPtr cur; /* the initial range set */ - int n_cur; - int val; /* the index to remove */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlLocationSetPtr(n_cur, 0); - val = gen_int(n_val, 1); - - xmlXPtrLocationSetRemove(cur, val); - call_tests++; - des_xmlLocationSetPtr(n_cur, cur, 0); - des_int(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrLocationSetRemove", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - static int test_xmlXPtrNewCollapsedRange(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlNodePtr start; /* the starting and ending node */ @@ -51694,7 +50717,7 @@ static int test_xmlXPtrNewLocationSetNodeSet(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlNodeSetPtr set; /* a node set */ @@ -51728,7 +50751,7 @@ static int test_xmlXPtrNewLocationSetNodes(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlNodePtr start; /* the start NodePtr value */ @@ -51769,7 +50792,7 @@ static int test_xmlXPtrNewRange(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlNodePtr start; /* the starting node */ @@ -51824,7 +50847,7 @@ static int test_xmlXPtrNewRangeNodeObject(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlNodePtr start; /* the starting node */ @@ -51865,7 +50888,7 @@ static int test_xmlXPtrNewRangeNodePoint(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlNodePtr start; /* the starting node */ @@ -51906,7 +50929,7 @@ static int test_xmlXPtrNewRangeNodes(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlNodePtr start; /* the starting node */ @@ -51947,7 +50970,7 @@ static int test_xmlXPtrNewRangePointNode(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlXPathObjectPtr start; /* the starting point */ @@ -51988,7 +51011,7 @@ static int test_xmlXPtrNewRangePoints(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathObjectPtr ret_val; xmlXPathObjectPtr start; /* the starting point */ @@ -52029,7 +51052,7 @@ static int test_xmlXPtrRangeToFunction(void) { int test_ret = 0; -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED) int mem_base; xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */ int n_ctxt; @@ -52063,53 +51086,14 @@ test_xmlXPtrRangeToFunction(void) { return(test_ret); } - -static int -test_xmlXPtrWrapLocationSet(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlLocationSetPtr val; /* the LocationSet value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlLocationSetPtr(n_val, 0); - - ret_val = xmlXPtrWrapLocationSet(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlLocationSetPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrWrapLocationSet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - static int test_xpointer(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n"); + if (quiet == 0) printf("Testing xpointer : 13 of 21 functions ...\n"); test_ret += test_xmlXPtrBuildNodeList(); test_ret += test_xmlXPtrEval(); test_ret += test_xmlXPtrEvalRangePredicate(); - test_ret += test_xmlXPtrLocationSetAdd(); - test_ret += test_xmlXPtrLocationSetCreate(); - test_ret += test_xmlXPtrLocationSetDel(); - test_ret += test_xmlXPtrLocationSetMerge(); - test_ret += test_xmlXPtrLocationSetRemove(); test_ret += test_xmlXPtrNewCollapsedRange(); test_ret += test_xmlXPtrNewContext(); test_ret += test_xmlXPtrNewLocationSetNodeSet(); @@ -52121,7 +51105,6 @@ test_xpointer(void) { test_ret += test_xmlXPtrNewRangePointNode(); test_ret += test_xmlXPtrNewRangePoints(); test_ret += test_xmlXPtrRangeToFunction(); - test_ret += test_xmlXPtrWrapLocationSet(); if (test_ret != 0) printf("Module xpointer: %d errors\n", test_ret); @@ -52141,7 +51124,6 @@ test_module(const char *module) { if (!strcmp(module, "entities")) return(test_entities()); if (!strcmp(module, "hash")) return(test_hash()); if (!strcmp(module, "list")) return(test_list()); - if (!strcmp(module, "nanoftp")) return(test_nanoftp()); if (!strcmp(module, "nanohttp")) return(test_nanohttp()); if (!strcmp(module, "parser")) return(test_parser()); if (!strcmp(module, "parserInternals")) return(test_parserInternals()); diff --git a/chromium/third_party/libxml/src/tree.c b/chromium/third_party/libxml/src/tree.c index 8077348a980..689a6b66c6a 100644 --- a/chromium/third_party/libxml/src/tree.c +++ b/chromium/third_party/libxml/src/tree.c @@ -4287,6 +4287,14 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent, if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) xmlRegisterNodeDefaultValue((xmlNodePtr)ret); + /* + * Note that since ret->parent is already set, xmlAddChild will + * return early and not actually insert the node. It will only + * coalesce text nodes and unnecessarily call xmlSetTreeDoc. + * Assuming that the subtree to be copied always has its text + * nodes coalesced, the somewhat confusing call to xmlAddChild + * could be removed. + */ tmp = xmlAddChild(parent, ret); /* node could have coalesced */ if (tmp != ret) @@ -4353,15 +4361,19 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent, return(NULL); } - if (insert->last == NULL) { - insert->children = copy; - } else { - copy->prev = insert->last; - insert->last->next = copy; + /* Check for coalesced text nodes */ + if (insert->last != copy) { + if (insert->last == NULL) { + insert->children = copy; + } else { + copy->prev = insert->last; + insert->last->next = copy; + } + insert->last = copy; } - insert->last = copy; - if (cur->children != NULL) { + if ((cur->type != XML_ENTITY_REF_NODE) && + (cur->children != NULL)) { cur = cur->children; insert = copy; continue; @@ -7108,6 +7120,8 @@ xmlBufferPtr xmlBufferCreateSize(size_t size) { xmlBufferPtr ret; + if (size >= UINT_MAX) + return(NULL); ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer)); if (ret == NULL) { xmlTreeErrMemory("creating buffer"); @@ -7115,7 +7129,7 @@ xmlBufferCreateSize(size_t size) { } ret->use = 0; ret->alloc = xmlBufferAllocScheme; - ret->size = (size ? size+2 : 0); /* +1 for ending null */ + ret->size = (size ? size + 1 : 0); /* +1 for ending null */ if (ret->size){ ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); if (ret->content == NULL) { @@ -7175,6 +7189,8 @@ xmlBufferCreateStatic(void *mem, size_t size) { if ((mem == NULL) || (size == 0)) return(NULL); + if (size > UINT_MAX) + return(NULL); ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer)); if (ret == NULL) { @@ -7322,28 +7338,23 @@ xmlBufferShrink(xmlBufferPtr buf, unsigned int len) { */ int xmlBufferGrow(xmlBufferPtr buf, unsigned int len) { - int size; + unsigned int size; xmlChar *newbuf; if (buf == NULL) return(-1); if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0); - if (len + buf->use < buf->size) return(0); + if (len < buf->size - buf->use) + return(0); + if (len > UINT_MAX - buf->use) + return(-1); - /* - * Windows has a BIG problem on realloc timing, so we try to double - * the buffer size (if that's enough) (bug 146697) - * Apparently BSD too, and it's probably best for linux too - * On an embedded system this may be something to change - */ -#if 1 - if (buf->size > len) - size = buf->size * 2; - else - size = buf->use + len + 100; -#else - size = buf->use + len + 100; -#endif + if (buf->size > (size_t) len) { + size = buf->size > UINT_MAX / 2 ? UINT_MAX : buf->size * 2; + } else { + size = buf->use + len; + size = size > UINT_MAX - 100 ? UINT_MAX : size + 100; + } if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) { size_t start_buf = buf->content - buf->contentIO; @@ -7470,7 +7481,10 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size) case XML_BUFFER_ALLOC_IO: case XML_BUFFER_ALLOC_DOUBLEIT: /*take care of empty case*/ - newSize = (buf->size ? buf->size : size + 10); + if (buf->size == 0) + newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10); + else + newSize = buf->size; while (size > newSize) { if (newSize > UINT_MAX / 2) { xmlTreeErrMemory("growing buffer"); @@ -7480,7 +7494,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size) } break; case XML_BUFFER_ALLOC_EXACT: - newSize = size+10; + newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10);; break; case XML_BUFFER_ALLOC_HYBRID: if (buf->use < BASE_BUFFER_SIZE) @@ -7498,7 +7512,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size) break; default: - newSize = size+10; + newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10);; break; } @@ -7584,8 +7598,10 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) { if (len < 0) return -1; if (len == 0) return 0; - needSize = buf->use + len + 2; - if (needSize > buf->size){ + if ((unsigned) len >= buf->size - buf->use) { + if ((unsigned) len >= UINT_MAX - buf->use) + return XML_ERR_NO_MEMORY; + needSize = buf->use + len + 1; if (!xmlBufferResize(buf, needSize)){ xmlTreeErrMemory("growing buffer"); return XML_ERR_NO_MEMORY; @@ -7698,29 +7714,7 @@ xmlBufferCat(xmlBufferPtr buf, const xmlChar *str) { */ int xmlBufferCCat(xmlBufferPtr buf, const char *str) { - const char *cur; - - if (buf == NULL) - return(-1); - if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; - if (str == NULL) { -#ifdef DEBUG_BUFFER - xmlGenericError(xmlGenericErrorContext, - "xmlBufferCCat: str == NULL\n"); -#endif - return -1; - } - for (cur = str;*cur != 0;cur++) { - if (buf->use + 10 >= buf->size) { - if (!xmlBufferResize(buf, buf->use+10)){ - xmlTreeErrMemory("growing buffer"); - return XML_ERR_NO_MEMORY; - } - } - buf->content[buf->use++] = *cur; - } - buf->content[buf->use] = 0; - return 0; + return xmlBufferCat(buf, (const xmlChar *) str); } /** diff --git a/chromium/third_party/libxml/src/valid.c b/chromium/third_party/libxml/src/valid.c index 825a3cfc8e9..1da812ea8c3 100644 --- a/chromium/third_party/libxml/src/valid.c +++ b/chromium/third_party/libxml/src/valid.c @@ -1039,6 +1039,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { tmp->type = cur->type; tmp->ocur = cur->ocur; prev->c2 = tmp; + tmp->parent = prev; if (cur->name != NULL) { if (dict) tmp->name = xmlDictLookup(dict, cur->name, -1); diff --git a/chromium/third_party/libxml/src/win32/configure.js b/chromium/third_party/libxml/src/win32/configure.js index e98df081b8a..84994284110 100644 --- a/chromium/third_party/libxml/src/win32/configure.js +++ b/chromium/third_party/libxml/src/win32/configure.js @@ -37,6 +37,7 @@ var withC14n = true; var withCatalog = true; var withXpath = true; var withXptr = true; +var withXptrLocs = false; var withXinclude = true; var withIconv = true; var withIcu = false; @@ -122,6 +123,7 @@ function usage() txt += " catalog: Enable catalog support (" + (withCatalog? "yes" : "no") + ")\n"; txt += " xpath: Enable XPath support (" + (withXpath? "yes" : "no") + ")\n"; txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n"; + txt += " xptr_locs: Enable XPointer locs support (" + (withXptrLocs? "yes" : "no") + ")\n"; txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n"; txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n"; txt += " icu: Enable icu support (" + (withIcu? "yes" : "no") + ")\n"; @@ -218,6 +220,7 @@ function discoverVersion() vf.WriteLine("WITH_CATALOG=" + (withCatalog? "1" : "0")); vf.WriteLine("WITH_XPATH=" + (withXpath? "1" : "0")); vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0")); + vf.WriteLine("WITH_XPTR_LOCS=" + (withXptrLocs? "1" : "0")); vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0")); vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0")); vf.WriteLine("WITH_ICU=" + (withIcu? "1" : "0")); @@ -316,6 +319,8 @@ function configureLibxml() of.WriteLine(s.replace(/\@WITH_XPATH\@/, withXpath? "1" : "0")); } else if (s.search(/\@WITH_XPTR\@/) != -1) { of.WriteLine(s.replace(/\@WITH_XPTR\@/, withXptr? "1" : "0")); + } else if (s.search(/\@WITH_XPTR_LOCS\@/) != -1) { + of.WriteLine(s.replace(/\@WITH_XPTR_LOCS\@/, withXptrLocs? "1" : "0")); } else if (s.search(/\@WITH_XINCLUDE\@/) != -1) { of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0")); } else if (s.search(/\@WITH_ICONV\@/) != -1) { @@ -469,6 +474,8 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { withXpath = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "xptr") withXptr = strToBool(arg.substring(opt.length + 1, arg.length)); + else if (opt == "xptr_locs") + withXptrLocs = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "xinclude") withXinclude = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "iconv") @@ -656,6 +663,7 @@ txtOut += " C14N support: " + boolToStr(withC14n) + "\n"; txtOut += " Catalog support: " + boolToStr(withCatalog) + "\n"; txtOut += " XPath support: " + boolToStr(withXpath) + "\n"; txtOut += " XPointer support: " + boolToStr(withXptr) + "\n"; +txtOut += " XPointer locs: " + boolToStr(withXptrLocs) + "\n"; txtOut += " XInclude support: " + boolToStr(withXinclude) + "\n"; txtOut += " iconv support: " + boolToStr(withIconv) + "\n"; txtOut += " icu support: " + boolToStr(withIcu) + "\n"; diff --git a/chromium/third_party/libxml/src/xmlIO.c b/chromium/third_party/libxml/src/xmlIO.c index 4d75473597e..823a0dda564 100644 --- a/chromium/third_party/libxml/src/xmlIO.c +++ b/chromium/third_party/libxml/src/xmlIO.c @@ -122,7 +122,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder); * * ************************************************************************/ -static const char *IOerr[] = { +static const char* const IOerr[] = { "Unknown IO error", /* UNKNOWN */ "Permission denied", /* EACCES */ "Resource temporarily unavailable",/* EAGAIN */ @@ -1130,7 +1130,7 @@ xmlGzfileOpen_real (const char *filename) { * xmlGzfileOpen: * @filename: the URI for matching * - * Wrapper around xmlGzfileOpen if the open fais, it will + * Wrapper around xmlGzfileOpen_real if the open fails, it will * try to unescape @filename */ static void * diff --git a/chromium/third_party/libxml/src/xmlunicode.c b/chromium/third_party/libxml/src/xmlunicode.c index d34ba8f31a5..677f25e8712 100644 --- a/chromium/third_party/libxml/src/xmlunicode.c +++ b/chromium/third_party/libxml/src/xmlunicode.c @@ -34,7 +34,7 @@ typedef struct { } xmlUnicodeNameTable; -static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname); +static xmlIntFunc *xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname); static const xmlUnicodeRange xmlUnicodeBlocks[] = { {"AegeanNumbers", xmlUCSIsAegeanNumbers}, @@ -166,7 +166,7 @@ static const xmlUnicodeRange xmlUnicodeBlocks[] = { {"YiSyllables", xmlUCSIsYiSyllables}, {"YijingHexagramSymbols", xmlUCSIsYijingHexagramSymbols}}; -static xmlUnicodeRange xmlUnicodeCats[] = { +static const xmlUnicodeRange xmlUnicodeCats[] = { {"C", xmlUCSIsCatC}, {"Cc", xmlUCSIsCatCc}, {"Cf", xmlUCSIsCatCf}, @@ -212,7 +212,7 @@ static const xmlChSRange xmlCS[] = {{0x0, 0x1f}, {0x7f, 0x9f}, static const xmlChLRange xmlCL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001}, {0xe0020, 0xe007f}, {0xf0000, 0xf0000}, {0xffffd, 0xffffd}, {0x100000, 0x100000}, {0x10fffd, 0x10fffd} }; -static xmlChRangeGroup xmlCG = {18,7,xmlCS,xmlCL}; +static const xmlChRangeGroup xmlCG = {18,7,xmlCS,xmlCL}; static const xmlChSRange xmlCfS[] = {{0xad, 0xad}, {0x600, 0x603}, {0x6dd, 0x6dd}, {0x70f, 0x70f}, {0x17b4, 0x17b5}, {0x200b, 0x200f}, @@ -220,7 +220,7 @@ static const xmlChSRange xmlCfS[] = {{0xad, 0xad}, {0x600, 0x603}, {0xfff9, 0xfffb} }; static const xmlChLRange xmlCfL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001}, {0xe0020, 0xe007f} }; -static xmlChRangeGroup xmlCfG = {11,3,xmlCfS,xmlCfL}; +static const xmlChRangeGroup xmlCfG = {11,3,xmlCfS,xmlCfL}; static const xmlChSRange xmlLS[] = {{0x41, 0x5a}, {0x61, 0x7a}, {0xaa, 0xaa}, {0xb5, 0xb5}, {0xba, 0xba}, {0xc0, 0xd6}, {0xd8, 0xf6}, @@ -309,7 +309,7 @@ static const xmlChLRange xmlLL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, {0x20000, 0x20000}, {0x2a6d6, 0x2a6d6}, {0x2f800, 0x2fa1d} }; -static xmlChRangeGroup xmlLG = {279,50,xmlLS,xmlLL}; +static const xmlChRangeGroup xmlLG = {279,50,xmlLS,xmlLL}; static const xmlChSRange xmlLlS[] = {{0x61, 0x7a}, {0xaa, 0xaa}, {0xb5, 0xb5}, {0xba, 0xba}, {0xdf, 0xf6}, {0xf8, 0xff}, {0x101, 0x101}, @@ -421,7 +421,7 @@ static const xmlChLRange xmlLlL[] = {{0x10428, 0x1044f}, {0x1d41a, 0x1d433}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e}, {0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9} }; -static xmlChRangeGroup xmlLlG = {396,28,xmlLlS,xmlLlL}; +static const xmlChRangeGroup xmlLlG = {396,28,xmlLlS,xmlLlL}; static const xmlChSRange xmlLmS[] = {{0x2b0, 0x2c1}, {0x2c6, 0x2d1}, {0x2e0, 0x2e4}, {0x2ee, 0x2ee}, {0x37a, 0x37a}, {0x559, 0x559}, @@ -429,7 +429,7 @@ static const xmlChSRange xmlLmS[] = {{0x2b0, 0x2c1}, {0x2c6, 0x2d1}, {0x17d7, 0x17d7}, {0x1843, 0x1843}, {0x1d2c, 0x1d61}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x303b, 0x303b}, {0x309d, 0x309e}, {0x30fc, 0x30fe}, {0xff70, 0xff70}, {0xff9e, 0xff9f} }; -static xmlChRangeGroup xmlLmG = {20,0,xmlLmS,NULL}; +static const xmlChRangeGroup xmlLmG = {20,0,xmlLmS,NULL}; static const xmlChSRange xmlLoS[] = {{0x1bb, 0x1bb}, {0x1c0, 0x1c3}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, {0x641, 0x64a}, @@ -492,12 +492,12 @@ static const xmlChLRange xmlLoL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835}, {0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x1083f}, {0x20000, 0x20000}, {0x2a6d6, 0x2a6d6}, {0x2f800, 0x2fa1d} }; -static xmlChRangeGroup xmlLoG = {211,20,xmlLoS,xmlLoL}; +static const xmlChRangeGroup xmlLoG = {211,20,xmlLoS,xmlLoL}; static const xmlChSRange xmlLtS[] = {{0x1c5, 0x1c5}, {0x1c8, 0x1c8}, {0x1cb, 0x1cb}, {0x1f2, 0x1f2}, {0x1f88, 0x1f8f}, {0x1f98, 0x1f9f}, {0x1fa8, 0x1faf}, {0x1fbc, 0x1fbc}, {0x1fcc, 0x1fcc}, {0x1ffc, 0x1ffc} }; -static xmlChRangeGroup xmlLtG = {10,0,xmlLtS,NULL}; +static const xmlChRangeGroup xmlLtG = {10,0,xmlLtS,NULL}; static const xmlChSRange xmlLuS[] = {{0x41, 0x5a}, {0xc0, 0xd6}, {0xd8, 0xde}, {0x100, 0x100}, {0x102, 0x102}, {0x104, 0x104}, @@ -608,7 +608,7 @@ static const xmlChLRange xmlLuL[] = {{0x10400, 0x10427}, {0x1d400, 0x1d419}, {0x1d608, 0x1d621}, {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8} }; -static xmlChRangeGroup xmlLuG = {390,31,xmlLuS,xmlLuL}; +static const xmlChRangeGroup xmlLuG = {390,31,xmlLuS,xmlLuL}; static const xmlChSRange xmlMS[] = {{0x300, 0x357}, {0x35d, 0x36f}, {0x483, 0x486}, {0x488, 0x489}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, @@ -642,7 +642,7 @@ static const xmlChSRange xmlMS[] = {{0x300, 0x357}, {0x35d, 0x36f}, static const xmlChLRange xmlML[] = {{0x1d165, 0x1d169}, {0x1d16d, 0x1d172}, {0x1d17b, 0x1d182}, {0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad}, {0xe0100, 0xe01ef} }; -static xmlChRangeGroup xmlMG = {113,6,xmlMS,xmlML}; +static const xmlChRangeGroup xmlMG = {113,6,xmlMS,xmlML}; static const xmlChSRange xmlMcS[] = {{0x903, 0x903}, {0x93e, 0x940}, {0x949, 0x94c}, {0x982, 0x983}, {0x9be, 0x9c0}, {0x9c7, 0x9c8}, @@ -660,7 +660,7 @@ static const xmlChSRange xmlMcS[] = {{0x903, 0x903}, {0x93e, 0x940}, {0x17c7, 0x17c8}, {0x1923, 0x1926}, {0x1929, 0x192b}, {0x1930, 0x1931}, {0x1933, 0x1938} }; static const xmlChLRange xmlMcL[] = {{0x1d165, 0x1d166}, {0x1d16d, 0x1d172} }; -static xmlChRangeGroup xmlMcG = {55,2,xmlMcS,xmlMcL}; +static const xmlChRangeGroup xmlMcG = {55,2,xmlMcS,xmlMcL}; static const xmlChSRange xmlMnS[] = {{0x300, 0x357}, {0x35d, 0x36f}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, {0x5bb, 0x5bd}, @@ -692,7 +692,7 @@ static const xmlChSRange xmlMnS[] = {{0x300, 0x357}, {0x35d, 0x36f}, {0xfe00, 0xfe0f}, {0xfe20, 0xfe23} }; static const xmlChLRange xmlMnL[] = {{0x1d167, 0x1d169}, {0x1d17b, 0x1d182}, {0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad}, {0xe0100, 0xe01ef} }; -static xmlChRangeGroup xmlMnG = {108,5,xmlMnS,xmlMnL}; +static const xmlChRangeGroup xmlMnG = {108,5,xmlMnS,xmlMnL}; static const xmlChSRange xmlNS[] = {{0x30, 0x39}, {0xb2, 0xb3}, {0xb9, 0xb9}, {0xbc, 0xbe}, {0x660, 0x669}, {0x6f0, 0x6f9}, @@ -707,7 +707,7 @@ static const xmlChSRange xmlNS[] = {{0x30, 0x39}, {0xb2, 0xb3}, {0x3251, 0x325f}, {0x3280, 0x3289}, {0x32b1, 0x32bf}, {0xff10, 0xff19} }; static const xmlChLRange xmlNL[] = {{0x10107, 0x10133}, {0x10320, 0x10323}, {0x1034a, 0x1034a}, {0x104a0, 0x104a9}, {0x1d7ce, 0x1d7ff} }; -static xmlChRangeGroup xmlNG = {42,5,xmlNS,xmlNL}; +static const xmlChRangeGroup xmlNG = {42,5,xmlNS,xmlNL}; static const xmlChSRange xmlNdS[] = {{0x30, 0x39}, {0x660, 0x669}, {0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f}, @@ -716,7 +716,7 @@ static const xmlChSRange xmlNdS[] = {{0x30, 0x39}, {0x660, 0x669}, {0xf20, 0xf29}, {0x1040, 0x1049}, {0x1369, 0x1371}, {0x17e0, 0x17e9}, {0x1810, 0x1819}, {0x1946, 0x194f}, {0xff10, 0xff19} }; static const xmlChLRange xmlNdL[] = {{0x104a0, 0x104a9}, {0x1d7ce, 0x1d7ff} }; -static xmlChRangeGroup xmlNdG = {21,2,xmlNdS,xmlNdL}; +static const xmlChRangeGroup xmlNdG = {21,2,xmlNdS,xmlNdL}; static const xmlChSRange xmlNoS[] = {{0xb2, 0xb3}, {0xb9, 0xb9}, {0xbc, 0xbe}, {0x9f4, 0x9f9}, {0xbf0, 0xbf2}, {0xf2a, 0xf33}, @@ -725,7 +725,7 @@ static const xmlChSRange xmlNoS[] = {{0xb2, 0xb3}, {0xb9, 0xb9}, {0x2776, 0x2793}, {0x3192, 0x3195}, {0x3220, 0x3229}, {0x3251, 0x325f}, {0x3280, 0x3289}, {0x32b1, 0x32bf} }; static const xmlChLRange xmlNoL[] = {{0x10107, 0x10133}, {0x10320, 0x10323} }; -static xmlChRangeGroup xmlNoG = {20,2,xmlNoS,xmlNoL}; +static const xmlChRangeGroup xmlNoG = {20,2,xmlNoS,xmlNoL}; static const xmlChSRange xmlPS[] = {{0x21, 0x23}, {0x25, 0x2a}, {0x2c, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40}, {0x5b, 0x5d}, {0x5f, 0x5f}, @@ -749,13 +749,13 @@ static const xmlChSRange xmlPS[] = {{0x21, 0x23}, {0x25, 0x2a}, {0xff0c, 0xff0f}, {0xff1a, 0xff1b}, {0xff1f, 0xff20}, {0xff3b, 0xff3d}, {0xff3f, 0xff3f}, {0xff5b, 0xff5b}, {0xff5d, 0xff5d}, {0xff5f, 0xff65} }; static const xmlChLRange xmlPL[] = {{0x10100, 0x10101}, {0x1039f, 0x1039f} }; -static xmlChRangeGroup xmlPG = {84,2,xmlPS,xmlPL}; +static const xmlChRangeGroup xmlPG = {84,2,xmlPS,xmlPL}; static const xmlChSRange xmlPdS[] = {{0x2d, 0x2d}, {0x58a, 0x58a}, {0x1806, 0x1806}, {0x2010, 0x2015}, {0x301c, 0x301c}, {0x3030, 0x3030}, {0x30a0, 0x30a0}, {0xfe31, 0xfe32}, {0xfe58, 0xfe58}, {0xfe63, 0xfe63}, {0xff0d, 0xff0d} }; -static xmlChRangeGroup xmlPdG = {11,0,xmlPdS,NULL}; +static const xmlChRangeGroup xmlPdG = {11,0,xmlPdS,NULL}; static const xmlChSRange xmlPeS[] = {{0x29, 0x29}, {0x5d, 0x5d}, {0x7d, 0x7d}, {0xf3b, 0xf3b}, {0xf3d, 0xf3d}, {0x169c, 0x169c}, @@ -774,7 +774,7 @@ static const xmlChSRange xmlPeS[] = {{0x29, 0x29}, {0x5d, 0x5d}, {0xfe48, 0xfe48}, {0xfe5a, 0xfe5a}, {0xfe5c, 0xfe5c}, {0xfe5e, 0xfe5e}, {0xff09, 0xff09}, {0xff3d, 0xff3d}, {0xff5d, 0xff5d}, {0xff60, 0xff60}, {0xff63, 0xff63} }; -static xmlChRangeGroup xmlPeG = {63,0,xmlPeS,NULL}; +static const xmlChRangeGroup xmlPeG = {63,0,xmlPeS,NULL}; static const xmlChSRange xmlPoS[] = {{0x21, 0x23}, {0x25, 0x27}, {0x2a, 0x2a}, {0x2c, 0x2c}, {0x2e, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40}, @@ -795,7 +795,7 @@ static const xmlChSRange xmlPoS[] = {{0x21, 0x23}, {0x25, 0x27}, {0xff0a, 0xff0a}, {0xff0c, 0xff0c}, {0xff0e, 0xff0f}, {0xff1a, 0xff1b}, {0xff1f, 0xff20}, {0xff3c, 0xff3c}, {0xff61, 0xff61}, {0xff64, 0xff64} }; static const xmlChLRange xmlPoL[] = {{0x10100, 0x10101}, {0x1039f, 0x1039f} }; -static xmlChRangeGroup xmlPoG = {72,2,xmlPoS,xmlPoL}; +static const xmlChRangeGroup xmlPoG = {72,2,xmlPoS,xmlPoL}; static const xmlChSRange xmlPsS[] = {{0x28, 0x28}, {0x5b, 0x5b}, {0x7b, 0x7b}, {0xf3a, 0xf3a}, {0xf3c, 0xf3c}, {0x169b, 0x169b}, @@ -814,7 +814,7 @@ static const xmlChSRange xmlPsS[] = {{0x28, 0x28}, {0x5b, 0x5b}, {0xfe41, 0xfe41}, {0xfe43, 0xfe43}, {0xfe47, 0xfe47}, {0xfe59, 0xfe59}, {0xfe5b, 0xfe5b}, {0xfe5d, 0xfe5d}, {0xff08, 0xff08}, {0xff3b, 0xff3b}, {0xff5b, 0xff5b}, {0xff5f, 0xff5f}, {0xff62, 0xff62} }; -static xmlChRangeGroup xmlPsG = {65,0,xmlPsS,NULL}; +static const xmlChRangeGroup xmlPsG = {65,0,xmlPsS,NULL}; static const xmlChSRange xmlSS[] = {{0x24, 0x24}, {0x2b, 0x2b}, {0x3c, 0x3e}, {0x5e, 0x5e}, {0x60, 0x60}, {0x7c, 0x7c}, {0x7e, 0x7e}, @@ -857,13 +857,13 @@ static const xmlChLRange xmlSL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f}, {0x1d6db, 0x1d6db}, {0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715}, {0x1d735, 0x1d735}, {0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f}, {0x1d789, 0x1d789}, {0x1d7a9, 0x1d7a9}, {0x1d7c3, 0x1d7c3} }; -static xmlChRangeGroup xmlSG = {133,20,xmlSS,xmlSL}; +static const xmlChRangeGroup xmlSG = {133,20,xmlSS,xmlSL}; static const xmlChSRange xmlScS[] = {{0x24, 0x24}, {0xa2, 0xa5}, {0x9f2, 0x9f3}, {0xaf1, 0xaf1}, {0xbf9, 0xbf9}, {0xe3f, 0xe3f}, {0x17db, 0x17db}, {0x20a0, 0x20b1}, {0xfdfc, 0xfdfc}, {0xfe69, 0xfe69}, {0xff04, 0xff04}, {0xffe0, 0xffe1}, {0xffe5, 0xffe6} }; -static xmlChRangeGroup xmlScG = {13,0,xmlScS,NULL}; +static const xmlChRangeGroup xmlScG = {13,0,xmlScS,NULL}; static const xmlChSRange xmlSkS[] = {{0x5e, 0x5e}, {0x60, 0x60}, {0xa8, 0xa8}, {0xaf, 0xaf}, {0xb4, 0xb4}, {0xb8, 0xb8}, {0x2c2, 0x2c5}, @@ -871,7 +871,7 @@ static const xmlChSRange xmlSkS[] = {{0x5e, 0x5e}, {0x60, 0x60}, {0x384, 0x385}, {0x1fbd, 0x1fbd}, {0x1fbf, 0x1fc1}, {0x1fcd, 0x1fcf}, {0x1fdd, 0x1fdf}, {0x1fed, 0x1fef}, {0x1ffd, 0x1ffe}, {0x309b, 0x309c}, {0xff3e, 0xff3e}, {0xff40, 0xff40}, {0xffe3, 0xffe3} }; -static xmlChRangeGroup xmlSkG = {22,0,xmlSkS,NULL}; +static const xmlChRangeGroup xmlSkG = {22,0,xmlSkS,NULL}; static const xmlChSRange xmlSmS[] = {{0x2b, 0x2b}, {0x3c, 0x3e}, {0x7c, 0x7c}, {0x7e, 0x7e}, {0xac, 0xac}, {0xb1, 0xb1}, {0xd7, 0xd7}, @@ -890,7 +890,7 @@ static const xmlChLRange xmlSmL[] = {{0x1d6c1, 0x1d6c1}, {0x1d6db, 0x1d6db}, {0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715}, {0x1d735, 0x1d735}, {0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f}, {0x1d789, 0x1d789}, {0x1d7a9, 0x1d7a9}, {0x1d7c3, 0x1d7c3} }; -static xmlChRangeGroup xmlSmG = {48,10,xmlSmS,xmlSmL}; +static const xmlChRangeGroup xmlSmG = {48,10,xmlSmS,xmlSmL}; static const xmlChSRange xmlSoS[] = {{0xa6, 0xa7}, {0xa9, 0xa9}, {0xae, 0xae}, {0xb0, 0xb0}, {0xb6, 0xb6}, {0x482, 0x482}, @@ -923,15 +923,15 @@ static const xmlChLRange xmlSoL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f}, {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d12a, 0x1d164}, {0x1d16a, 0x1d16c}, {0x1d183, 0x1d184}, {0x1d18c, 0x1d1a9}, {0x1d1ae, 0x1d1dd}, {0x1d300, 0x1d356} }; -static xmlChRangeGroup xmlSoG = {103,10,xmlSoS,xmlSoL}; +static const xmlChRangeGroup xmlSoG = {103,10,xmlSoS,xmlSoL}; static const xmlChSRange xmlZS[] = {{0x20, 0x20}, {0xa0, 0xa0}, {0x1680, 0x1680}, {0x180e, 0x180e}, {0x2000, 0x200a}, {0x2028, 0x2029}, {0x202f, 0x202f}, {0x205f, 0x205f}, {0x3000, 0x3000} }; -static xmlChRangeGroup xmlZG = {9,0,xmlZS,NULL}; +static const xmlChRangeGroup xmlZG = {9,0,xmlZS,NULL}; -static xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, 128}; -static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36}; +static const xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, 128}; +static const xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36}; /** * xmlUnicodeLookup: @@ -943,7 +943,7 @@ static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36}; * Returns pointer to range function if found, otherwise NULL */ static xmlIntFunc -*xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname) { +*xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname) { int low, high, mid, cmp; const xmlUnicodeRange *sptr; diff --git a/chromium/third_party/libxml/src/xmlwriter.c b/chromium/third_party/libxml/src/xmlwriter.c index 2ca2056e234..85c19558d9d 100644 --- a/chromium/third_party/libxml/src/xmlwriter.c +++ b/chromium/third_party/libxml/src/xmlwriter.c @@ -1541,7 +1541,7 @@ static int xmlOutputBufferWriteBase64(xmlOutputBufferPtr out, int len, const unsigned char *data) { - static unsigned char dtable[64] = + static const unsigned char dtable[64] = {'A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z', 'a','b','c','d','e','f','g','h','i','j','k','l','m', @@ -1674,7 +1674,7 @@ xmlOutputBufferWriteBinHex(xmlOutputBufferPtr out, { int count; int sum; - static char hex[16] = + static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; int i; diff --git a/chromium/third_party/libxml/src/xpath.c b/chromium/third_party/libxml/src/xpath.c index 78606b71618..49abd96decf 100644 --- a/chromium/third_party/libxml/src/xpath.c +++ b/chromium/third_party/libxml/src/xpath.c @@ -36,7 +36,7 @@ #include <libxml/xpathInternals.h> #include <libxml/parserInternals.h> #include <libxml/hash.h> -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED #include <libxml/xpointer.h> #endif #ifdef LIBXML_DEBUG_ENABLED @@ -580,7 +580,7 @@ static int xmlXPathDisableOptimizer = 0; /* * The array xmlXPathErrorMessages corresponds to the enum xmlXPathError */ -static const char *xmlXPathErrorMessages[] = { +static const char* const xmlXPathErrorMessages[] = { "Ok\n", "Number encoding\n", "Unfinished literal\n", @@ -901,7 +901,7 @@ typedef enum { XPATH_OP_PREDICATE, XPATH_OP_FILTER, /* 16 */ XPATH_OP_SORT /* 17 */ -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED ,XPATH_OP_RANGETO #endif } xmlXPathOp; @@ -1352,7 +1352,7 @@ xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) { fprintf(output, "%d", i + 1); xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1); } -#if defined(LIBXML_XPTR_ENABLED) +#if defined(LIBXML_XPTR_LOCS_ENABLED) static void xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) { int i; @@ -1375,7 +1375,7 @@ xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) { xmlXPathDebugDumpObject(output, cur->locTab[i], depth + 1); } } -#endif /* LIBXML_XPTR_ENABLED */ +#endif /* LIBXML_XPTR_LOCS_ENABLED */ /** * xmlXPathDebugDumpObject: @@ -1444,6 +1444,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { xmlDebugDumpString(output, cur->stringval); fprintf(output, "\n"); break; +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: fprintf(output, "Object is a point : index %d in node", cur->index); xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user, depth + 1); @@ -1479,12 +1480,11 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { } break; case XPATH_LOCATIONSET: -#if defined(LIBXML_XPTR_ENABLED) fprintf(output, "Object is a Location Set:\n"); xmlXPathDebugDumpLocationSet(output, (xmlLocationSetPtr) cur->user, depth); -#endif break; +#endif /* LIBXML_XPTR_LOCS_ENABLED */ case XPATH_USERS: fprintf(output, "Object is user defined\n"); break; @@ -1652,7 +1652,7 @@ xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp, case XPATH_OP_ARG: fprintf(output, "ARG"); break; case XPATH_OP_PREDICATE: fprintf(output, "PREDICATE"); break; case XPATH_OP_FILTER: fprintf(output, "FILTER"); break; -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_OP_RANGETO: fprintf(output, "RANGETO"); break; #endif default: @@ -1844,6 +1844,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_STRING: cache->dbgReusedString++; break; +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: cache->dbgReusedPoint++; break; @@ -1853,6 +1854,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_LOCATIONSET: cache->dbgReusedLocset++; break; +#endif /* LIBXML_XPTR_LOCS_ENABLED */ case XPATH_USERS: cache->dbgReusedUsers++; break; @@ -1911,6 +1913,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, xmlXPathDebugObjMaxString = xmlXPathDebugObjCounterString; break; +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: if (! isCached) xmlXPathDebugObjTotalPoint++; @@ -1938,6 +1941,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, xmlXPathDebugObjMaxLocset = xmlXPathDebugObjCounterLocset; break; +#endif /* LIBXML_XPTR_LOCS_ENABLED */ case XPATH_USERS: if (! isCached) xmlXPathDebugObjTotalUsers++; @@ -1998,6 +2002,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, case XPATH_STRING: cache->dbgCachedString++; break; +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: cache->dbgCachedPoint++; break; @@ -2007,6 +2012,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, case XPATH_LOCATIONSET: cache->dbgCachedLocset++; break; +#endif /* LIBXML_XPTR_LOCS_ENABLED */ case XPATH_USERS: cache->dbgCachedUsers++; break; @@ -2035,6 +2041,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, case XPATH_STRING: xmlXPathDebugObjCounterString--; break; +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: xmlXPathDebugObjCounterPoint--; break; @@ -2044,6 +2051,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, case XPATH_LOCATIONSET: xmlXPathDebugObjCounterLocset--; break; +#endif /* LIBXML_XPTR_LOCS_ENABLED */ case XPATH_USERS: xmlXPathDebugObjCounterUsers--; break; @@ -2696,9 +2704,11 @@ xmlXPathCacheConvertString(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { res = xmlXPathCastNumberToString(val->floatval); break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO; break; } @@ -5377,8 +5387,10 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) { switch (val->type) { case XPATH_BOOLEAN: case XPATH_NUMBER: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ break; case XPATH_STRING: ret->stringval = xmlStrdup(val->stringval); @@ -5422,8 +5434,8 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) { /* Do not deallocate the copied tree value */ ret->boolval = 0; break; +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_LOCATIONSET: -#ifdef LIBXML_XPTR_ENABLED { xmlLocationSetPtr loc = val->user; ret->user = (void *) xmlXPtrLocationSetMerge(NULL, loc); @@ -5466,7 +5478,7 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) { if (obj->nodesetval != NULL) xmlXPathFreeNodeSet(obj->nodesetval); } -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED } else if (obj->type == XPATH_LOCATIONSET) { if (obj->user != NULL) xmlXPtrFreeLocationSet(obj->user); @@ -5556,7 +5568,7 @@ xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj) goto obj_cached; } break; -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_LOCATIONSET: if (obj->user != NULL) { xmlXPtrFreeLocationSet(obj->user); @@ -5759,9 +5771,11 @@ xmlXPathCastToString(xmlXPathObjectPtr val) { break; } case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO ret = xmlStrdup((const xmlChar *) ""); break; @@ -5804,9 +5818,11 @@ xmlXPathConvertString(xmlXPathObjectPtr val) { res = xmlXPathCastNumberToString(val->floatval); break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO; break; } @@ -5924,9 +5940,11 @@ xmlXPathCastToNumber(xmlXPathObjectPtr val) { ret = xmlXPathCastBooleanToNumber(val->boolval); break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO; ret = xmlXPathNAN; break; @@ -6036,9 +6054,11 @@ xmlXPathCastToBoolean (xmlXPathObjectPtr val) { ret = val->boolval; break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO; ret = 0; break; @@ -6975,9 +6995,11 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, ret = (arg1->boolval == ret); break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO break; case XPATH_NODESET: @@ -7032,9 +7054,11 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, } break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO break; case XPATH_NODESET: @@ -7093,9 +7117,11 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, } break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO break; case XPATH_NODESET: @@ -7104,9 +7130,11 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, } break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO break; case XPATH_NODESET: @@ -7189,9 +7217,11 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) { ret = xmlXPathEqualNodeSetString(arg1, arg2->stringval, 0); break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO break; } @@ -7274,9 +7304,11 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { ret = xmlXPathEqualNodeSetString(arg1, arg2->stringval,1); break; case XPATH_USERS: +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: +#endif /* LIBXML_XPTR_LOCS_ENABLED */ TODO break; } @@ -10587,7 +10619,7 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { "PathExpr: Type search\n"); #endif lc = 1; -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED } else if (ctxt->xptr && xmlStrEqual(name, BAD_CAST "range-to")) { lc = 1; @@ -11238,7 +11270,7 @@ xmlXPathIsAxisName(const xmlChar *name) { */ static void xmlXPathCompStep(xmlXPathParserContextPtr ctxt) { -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED int rangeto = 0; int op2 = -1; #endif @@ -11263,7 +11295,7 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) { /* * The modification needed for XPointer change to the production */ -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED if (ctxt->xptr) { name = xmlXPathParseNCName(ctxt); if ((name != NULL) && (xmlStrEqual(name, BAD_CAST "range-to"))) { @@ -11348,7 +11380,7 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) { xmlGenericErrorContextNodeSet(stdout, ctxt->value->nodesetval); #endif -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED eval_predicates: #endif op1 = ctxt->comp->last; @@ -11359,7 +11391,7 @@ eval_predicates: xmlXPathCompPredicate(ctxt, 0); } -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED if (rangeto) { PUSH_BINARY_EXPR(XPATH_OP_RANGETO, op2, op1, 0, 0); } else @@ -11702,7 +11734,7 @@ xmlXPathNodeSetFilter(xmlXPathParserContextPtr ctxt, xpctxt->proximityPosition = oldpp; } -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED /** * xmlXPathLocationSetFilter: * @ctxt: the XPath Parser context @@ -11819,7 +11851,7 @@ xmlXPathLocationSetFilter(xmlXPathParserContextPtr ctxt, xpctxt->contextSize = oldcs; xpctxt->proximityPosition = oldpp; } -#endif /* LIBXML_XPTR_ENABLED */ +#endif /* LIBXML_XPTR_LOCS_ENABLED */ /** * xmlXPathCompOpEvalPredicate: @@ -12875,7 +12907,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, if (ctxt->value == NULL) return (total); -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED /* * Hum are we filtering the result of an XPointer expression */ @@ -12890,7 +12922,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); } -#endif /* LIBXML_XPTR_ENABLED */ +#endif /* LIBXML_XPTR_LOCS_ENABLED */ CHECK_TYPE0(XPATH_NODESET); set = ctxt->value->nodesetval; @@ -13298,7 +13330,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) if (ctxt->value == NULL) break; -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED /* * Hum are we filtering the result of an XPointer expression */ @@ -13308,7 +13340,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) 1, locset->locNr); break; } -#endif /* LIBXML_XPTR_ENABLED */ +#endif /* LIBXML_XPTR_LOCS_ENABLED */ CHECK_TYPE0(XPATH_NODESET); set = ctxt->value->nodesetval; @@ -13329,7 +13361,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) xmlXPathNodeSetSort(ctxt->value->nodesetval); } break; -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_OP_RANGETO:{ xmlXPathObjectPtr range; xmlXPathObjectPtr res, obj; @@ -13487,7 +13519,7 @@ rangeto_error: ctxt->context->proximityPosition = oldpp; break; } -#endif /* LIBXML_XPTR_ENABLED */ +#endif /* LIBXML_XPTR_LOCS_ENABLED */ default: xmlGenericError(xmlGenericErrorContext, "XPath: unknown precompiled operation %d\n", op->op); @@ -13995,7 +14027,7 @@ xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, return(res->nodesetval->nodeNr != 0); case XPATH_STRING: return((res->stringval != NULL) && (res->stringval[0] != 0)); -#ifdef LIBXML_XPTR_ENABLED +#ifdef LIBXML_XPTR_LOCS_ENABLED case XPATH_LOCATIONSET:{ xmlLocationSetPtr ptr = res->user; if (ptr == NULL) diff --git a/chromium/third_party/libxml/win32/include/libxml/xmlversion.h b/chromium/third_party/libxml/win32/include/libxml/xmlversion.h index 5eef779925a..4bb6295119f 100644 --- a/chromium/third_party/libxml/win32/include/libxml/xmlversion.h +++ b/chromium/third_party/libxml/win32/include/libxml/xmlversion.h @@ -248,6 +248,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif /** + * LIBXML_XPTR_LOCS_ENABLED: + * + * Whether support for XPointer locations is configured in + */ +#if 0 +#define LIBXML_XPTR_LOCS_ENABLED +#endif + +/** * LIBXML_XINCLUDE_ENABLED: * * Whether XInclude is configured in |