From: DongHun Kwak Date: Thu, 23 Nov 2017 02:22:54 +0000 (+0900) Subject: Imported Upstream version 2.9.7 X-Git-Tag: upstream/2.9.7^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Flibxml2.git;a=commitdiff_plain;h=8685bcc0d10e727b8daf282102cbd634cc9b3cd4 Imported Upstream version 2.9.7 Change-Id: I9ae5434978bd98bb49d072dc066e149cbac06842 Signed-off-by: DongHun Kwak --- diff --git a/SAX2.c b/SAX2.c index 1508c77..0f261b7 100644 --- a/SAX2.c +++ b/SAX2.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -1914,7 +1915,7 @@ skip: else { ret->line = 65535; if (ctxt->options & XML_PARSE_BIG_LINES) - ret->psvi = (void *) (long) ctxt->input->line; + ret->psvi = (void *) (ptrdiff_t) ctxt->input->line; } } } diff --git a/catalog.c b/catalog.c index 6dfdfbb..f6186a1 100644 --- a/catalog.c +++ b/catalog.c @@ -2396,6 +2396,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, case SGML_CATA_ENTITY: if (*cur == '%') type = SGML_CATA_PENTITY; + /* Falls through. */ case SGML_CATA_PENTITY: case SGML_CATA_DOCTYPE: case SGML_CATA_LINKTYPE: diff --git a/config.h.in b/config.h.in index 749b1d6..0b4aad6 100644 --- a/config.h.in +++ b/config.h.in @@ -321,9 +321,6 @@ #define below would cause a syntax error. */ #undef _UINT32_T -/* Using the Win32 Socket implementation */ -#undef _WINSOCKAPI_ - /* ss_family is not defined here, use __ss_family instead */ #undef ss_family diff --git a/configure b/configure index 6c4d6fb..9f5a5fa 100755 --- a/configure +++ b/configure @@ -2629,7 +2629,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=9 -LIBXML_MICRO_VERSION=6 +LIBXML_MICRO_VERSION=7 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -15545,7 +15545,7 @@ else echo Enabling multithreaded support case $host_os in - *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then + *mingw*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then WITH_THREADS="1" THREADS_W32="1" THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS" @@ -16493,9 +16493,6 @@ case "$host" in CPPFLAGS="$CPPFLAGS -DWIN32" WIN32_EXTRA_LIBADD="-lws2_32" WIN32_EXTRA_LDFLAGS="-no-undefined" - -$as_echo "#define _WINSOCKAPI_ 1" >>confdefs.h - if test "${PYTHON}" != "" then WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)" diff --git a/configure.ac b/configure.ac index ff190a5..8dbc56c 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=9 -LIBXML_MICRO_VERSION=6 +LIBXML_MICRO_VERSION=7 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -1053,9 +1053,9 @@ if test "$with_threads" = "no" ; then else echo Enabling multithreaded support - dnl Default to native threads on Win32 + dnl Default to native threads on Windows case $host_os in - *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then + *mingw*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then WITH_THREADS="1" THREADS_W32="1" THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS" @@ -1640,7 +1640,6 @@ case "$host" in CPPFLAGS="$CPPFLAGS -DWIN32" WIN32_EXTRA_LIBADD="-lws2_32" WIN32_EXTRA_LDFLAGS="-no-undefined" - AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation]) if test "${PYTHON}" != "" then WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)" diff --git a/dict.c b/dict.c index 7b005eb..0ef3718 100644 --- a/dict.c +++ b/dict.c @@ -48,7 +48,7 @@ #else #ifdef HAVE_INTTYPES_H #include -#elif defined(WIN32) +#elif defined(_WIN32) typedef unsigned __int32 uint32_t; #endif #endif @@ -249,7 +249,7 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, unsigned int namelen) { #endif pool = dict->strings; while (pool != NULL) { - if (pool->end - pool->free > namelen) + if ((size_t)(pool->end - pool->free) > namelen) goto found_pool; if (pool->size > size) size = pool->size; limit += pool->size; @@ -317,7 +317,7 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, unsigned int plen, #endif pool = dict->strings; while (pool != NULL) { - if (pool->end - pool->free > namelen + plen + 1) + if ((size_t)(pool->end - pool->free) > namelen + plen + 1) goto found_pool; if (pool->size > size) size = pool->size; limit += pool->size; @@ -453,14 +453,23 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) { } switch (namelen) { case 10: value += name[9]; + /* Falls through. */ case 9: value += name[8]; + /* Falls through. */ case 8: value += name[7]; + /* Falls through. */ case 7: value += name[6]; + /* Falls through. */ case 6: value += name[5]; + /* Falls through. */ case 5: value += name[4]; + /* Falls through. */ case 4: value += name[3]; + /* Falls through. */ case 3: value += name[2]; + /* Falls through. */ case 2: value += name[1]; + /* Falls through. */ default: break; } return(value); @@ -496,15 +505,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen, } switch (plen) { case 10: value += prefix[9]; + /* Falls through. */ case 9: value += prefix[8]; + /* Falls through. */ case 8: value += prefix[7]; + /* Falls through. */ case 7: value += prefix[6]; + /* Falls through. */ case 6: value += prefix[5]; + /* Falls through. */ case 5: value += prefix[4]; + /* Falls through. */ case 4: value += prefix[3]; + /* Falls through. */ case 3: value += prefix[2]; + /* Falls through. */ case 2: value += prefix[1]; + /* Falls through. */ case 1: value += prefix[0]; + /* Falls through. */ default: break; } len -= plen; @@ -514,15 +533,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen, } switch (len) { case 10: value += name[9]; + /* Falls through. */ case 9: value += name[8]; + /* Falls through. */ case 8: value += name[7]; + /* Falls through. */ case 7: value += name[6]; + /* Falls through. */ case 6: value += name[5]; + /* Falls through. */ case 5: value += name[4]; + /* Falls through. */ case 4: value += name[3]; + /* Falls through. */ case 3: value += name[2]; + /* Falls through. */ case 2: value += name[1]; + /* Falls through. */ case 1: value += name[0]; + /* Falls through. */ default: break; } return(value); diff --git a/doc/Makefile.am b/doc/Makefile.am index 0cc0a50..6bda566 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -243,7 +243,7 @@ docs: web $(top_builddir)/NEWS libxml2.xsa $(man_MANS) api: libxml2-api.xml libxml2-refs.xml $(APIPAGES) $(srcdir)/html/index.html $(WIN32_DIR)/libxml2.def.src ../elfgcchack.h $(srcdir)/site.xsl -web: $(PAGES) +web: $(PAGES) xmllint.html xmlcatalog_man.html ../elfgcchack.h: $(srcdir)/elfgcchack.xsl $(srcdir)/libxml2-api.xml -@(if [ -x $(XSLTPROC) ] ; then \ @@ -314,9 +314,15 @@ libxml2-api.xml libxml2-refs.xml ../libxml2.syms: apibuild.py symbols.xml syms.x xmllint.1: xmllint.xml -@($(XSLTPROC) --nonet xmllint.xml) +xmllint.html: xmllint.xml + -@($(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl xmllint.xml) + xmlcatalog.1: xmlcatalog_man.xml -@($(XSLTPROC) --nonet xmlcatalog_man.xml) +xmlcatalog_man.html: xmlcatalog_man.xml + -@($(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl xmlcatalog_man.xml) + check-extra-dist: for f in $(EXTRA_DIST_wc) ; do echo $$f; done | sort -u >tmp.EXTRA_DIST_wc for f in $(EXTRA_DIST) ; do echo $$f; done | sort >tmp.EXTRA_DIST diff --git a/doc/Makefile.in b/doc/Makefile.in index 1514a76..eadbf2f 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1054,7 +1054,7 @@ uninstall-man: uninstall-man1 @REBUILD_DOCS_TRUE@api: libxml2-api.xml libxml2-refs.xml $(APIPAGES) $(srcdir)/html/index.html $(WIN32_DIR)/libxml2.def.src ../elfgcchack.h $(srcdir)/site.xsl -@REBUILD_DOCS_TRUE@web: $(PAGES) +@REBUILD_DOCS_TRUE@web: $(PAGES) xmllint.html xmlcatalog_man.html @REBUILD_DOCS_TRUE@../elfgcchack.h: $(srcdir)/elfgcchack.xsl $(srcdir)/libxml2-api.xml @REBUILD_DOCS_TRUE@ -@(if [ -x $(XSLTPROC) ] ; then \ @@ -1119,9 +1119,15 @@ uninstall-man: uninstall-man1 @REBUILD_DOCS_TRUE@xmllint.1: xmllint.xml @REBUILD_DOCS_TRUE@ -@($(XSLTPROC) --nonet xmllint.xml) +@REBUILD_DOCS_TRUE@xmllint.html: xmllint.xml +@REBUILD_DOCS_TRUE@ -@($(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl xmllint.xml) + @REBUILD_DOCS_TRUE@xmlcatalog.1: xmlcatalog_man.xml @REBUILD_DOCS_TRUE@ -@($(XSLTPROC) --nonet xmlcatalog_man.xml) +@REBUILD_DOCS_TRUE@xmlcatalog_man.html: xmlcatalog_man.xml +@REBUILD_DOCS_TRUE@ -@($(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl xmlcatalog_man.xml) + @REBUILD_DOCS_TRUE@check-extra-dist: @REBUILD_DOCS_TRUE@ for f in $(EXTRA_DIST_wc) ; do echo $$f; done | sort -u >tmp.EXTRA_DIST_wc @REBUILD_DOCS_TRUE@ for f in $(EXTRA_DIST) ; do echo $$f; done | sort >tmp.EXTRA_DIST diff --git a/doc/elfgcchack.xsl b/doc/elfgcchack.xsl index 9b1a9bc..8dd5c6a 100644 --- a/doc/elfgcchack.xsl +++ b/doc/elfgcchack.xsl @@ -18,7 +18,7 @@ #ifdef IN_LIBXML #ifdef __GNUC__ #ifdef PIC -#ifdef linux +#ifdef __linux__ #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) #include "libxml/c14n.h" diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index 25ff51d..f575ff0 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,125 +8,24 @@ libxml2 - v2.9.5 - Sep 04 2017 + v2.9.6 + Oct 06 2017 http://xmlsoft.org/ - - Security: - Detect infinite recursion in parameter entities (Nick Wellnhofer), - Fix handling of parameter-entity references (Nick Wellnhofer), - Disallow namespace nodes in XPointer ranges (Nick Wellnhofer), - Fix XPointer paths beginning with range-to (Nick Wellnhofer) - - - Documentation: - Documentation fixes (Nick Wellnhofer), - Spelling and grammar fixes (Nick Wellnhofer) - - - Portability: - Adding README.zOS to list of extra files for the release (Daniel Veillard), - Description of work needed to compile on zOS (Stéphane Michaut), - Porting libxml2 on zOS encoding of code (Stéphane Michaut), - small changes for OS/400 (Patrick Monnerat), - relaxng.c, xmlschemas.c: Fix build on pre-C99 compilers (Chun-wei Fan) + - Portability: + Change preprocessor OS tests to __linux__ (Nick Wellnhofer) - Bug Fixes: - Problem resolving relative URIs (Daniel Veillard), - Fix unwanted warnings when switching encodings (Nick Wellnhofer), - Fix signature of xmlSchemaAugmentImportedIDC (Daniel Veillard), - Heap-buffer-overflow read of size 1 in xmlFAParsePosCharGroup (David Kilzer), - Fix NULL pointer deref in xmlFAParseCharClassEsc (Nick Wellnhofer), - Fix infinite loops with push parser in recovery mode (Nick Wellnhofer), - Send xmllint usage error to stderr (Nick Wellnhofer), - Fix NULL deref in xmlParseExternalEntityPrivate (Nick Wellnhofer), - Make sure not to call IS_BLANK_CH when parsing the DTD (Nick Wellnhofer), - Fix xmlHaltParser (Nick Wellnhofer), - Fix pathological performance when outputting charrefs (Nick Wellnhofer), - Fix invalid-source-encoding warnings in testWriter.c (Nick Wellnhofer), - Fix duplicate SAX callbacks for entity content (David Kilzer), - Treat URIs with scheme as absolute in C14N (Nick Wellnhofer), - Fix copy-paste errors in error messages (Nick Wellnhofer), - Fix sanity check in htmlParseNameComplex (Nick Wellnhofer), - Fix potential infinite loop in xmlStringLenDecodeEntities (Nick Wellnhofer), - Reset parser input pointers on encoding failure (Nick Wellnhofer), - Fix memory leak in xmlParseEntityDecl error path (Nick Wellnhofer), - Fix xmlBuildRelativeURI for URIs starting with './' (Nick Wellnhofer), - Fix type confusion in xmlValidateOneNamespace (Nick Wellnhofer), - Fix memory leak in xmlStringLenGetNodeList (Nick Wellnhofer), - Fix NULL pointer deref in xmlDumpElementContent (Daniel Veillard), - Fix memory leak in xmlBufAttrSerializeTxtContent (Nick Wellnhofer), - Stop parser on unsupported encodings (Nick Wellnhofer), - Check for integer overflow in memory debug code (Nick Wellnhofer), - Fix buffer size checks in xmlSnprintfElementContent (Nick Wellnhofer), - Avoid reparsing in xmlParseStartTag2 (Nick Wellnhofer), - Fix undefined behavior in xmlRegExecPushStringInternal (Nick Wellnhofer), - Check XPath exponents for overflow (Nick Wellnhofer), - Check for overflow in xmlXPathIsPositionalPredicate (Nick Wellnhofer), - Fix spurious error message (Nick Wellnhofer), - Fix memory leak in xmlCanonicPath (Nick Wellnhofer), - Fix memory leak in xmlXPathCompareNodeSetValue (Nick Wellnhofer), - Fix memory leak in pattern error path (Nick Wellnhofer), - Fix memory leak in parser error path (Nick Wellnhofer), - Fix memory leaks in XPointer error paths (Nick Wellnhofer), - Fix memory leak in xmlXPathNodeSetMergeAndClear (Nick Wellnhofer), - Fix memory leak in XPath filter optimizations (Nick Wellnhofer), - Fix memory leaks in XPath error paths (Nick Wellnhofer), - Do not leak the new CData node if adding fails (David Tardon), - Prevent unwanted external entity reference (Neel Mehta), - Increase buffer space for port in HTTP redirect support (Daniel Veillard), - Fix more NULL pointer derefs in xpointer.c (Nick Wellnhofer), - Avoid function/data pointer conversion in xpath.c (Nick Wellnhofer), - Fix format string warnings (Nick Wellnhofer), - Disallow namespace nodes in XPointer points (Nick Wellnhofer), - Fix comparison with root node in xmlXPathCmpNodes (Nick Wellnhofer), - Fix attribute decoding during XML schema validation (Alex Henrie), - Fix NULL pointer deref in XPointer range-to (Nick Wellnhofer) - - - Improvements: - Updating the spec file to reflect Fedora 24 (Daniel Veillard), - Add const in five places to move 1 KiB to .rdata (Bruce Dawson), - Fix missing part of comment for function xmlXPathEvalExpression() (Daniel Veillard), - Get rid of "blanks wrapper" for parameter entities (Nick Wellnhofer), - Simplify handling of parameter entity references (Nick Wellnhofer), - Deduplicate code in encoding.c (Nick Wellnhofer), - Make HTML parser functions take const pointers (Nick Wellnhofer), - Build test programs only when needed (Nick Wellnhofer), - Fix doc/examples/index.py (Nick Wellnhofer), - Fix compiler warnings in threads.c (Nick Wellnhofer), - Fix empty-body warning in nanohttp.c (Nick Wellnhofer), - Fix cast-align warnings (Nick Wellnhofer), - Fix unused-parameter warnings (Nick Wellnhofer), - Rework entity boundary checks (Nick Wellnhofer), - Don't switch encoding for internal parameter entities (Nick Wellnhofer), - Merge duplicate code paths handling PE references (Nick Wellnhofer), - Test SAX2 callbacks with entity substitution (Nick Wellnhofer), - Support catalog and threads tests under --without-sax1 (Nick Wellnhofer), - Misc fixes for 'make tests' (Nick Wellnhofer), - Initialize keepBlanks in HTML parser (Nick Wellnhofer), - Add test cases for bug 758518 (David Kilzer), - Fix compiler warning in htmlParseElementInternal (Nick Wellnhofer), - Remove useless check in xmlParseAttributeListDecl (Nick Wellnhofer), - Allow zero sized memory input buffers (Nick Wellnhofer), - Add TODO comment in xmlSwitchEncoding (Nick Wellnhofer), - Check for integer overflow in xmlXPathFormatNumber (Nick Wellnhofer), - Make Travis print UBSan stacktraces (Nick Wellnhofer), - Add .travis.yml (Nick Wellnhofer), - Fix expected error output in Python tests (Nick Wellnhofer), - Simplify control flow in xmlParseStartTag2 (Nick Wellnhofer), - Disable LeakSanitizer when running API tests (Nick Wellnhofer), - Avoid out-of-bound array access in API tests (Nick Wellnhofer), - Avoid spurious UBSan errors in parser.c (Nick Wellnhofer), - Parse small XPath numbers more accurately (Nick Wellnhofer), - Rework XPath rounding functions (Nick Wellnhofer), - Fix white space in test output (Nick Wellnhofer), - Fix axis traversal from attribute and namespace nodes (Nick Wellnhofer), - Check for trailing characters in XPath expressions earlier (Nick Wellnhofer), - Rework final handling of XPath results (Nick Wellnhofer), - Make xmlXPathEvalExpression call xmlXPathEval (Nick Wellnhofer), - Remove unused variables (Nick Wellnhofer), - Don't print generic error messages in XPath tests (Nick Wellnhofer) - - - Cleanups: - Fix a couple of misleading indentation errors (Daniel Veillard), - Remove unnecessary calls to xmlPopInput (Nick Wellnhofer) + Fix XPath stack frame logic (Nick Wellnhofer), + Report undefined XPath variable error message (Nick Wellnhofer), + Fix regression with librsvg (Nick Wellnhofer), + Handle more invalid entity values in recovery mode (Nick Wellnhofer), + Fix structured validation errors (Nick Wellnhofer), + Fix memory leak in LZMA decompressor (Nick Wellnhofer), + Set memory limit for LZMA decompression (Nick Wellnhofer), + Handle illegal entity values in recovery mode (Nick Wellnhofer), + Fix debug dump of streaming XPath expressions (Nick Wellnhofer), + Fix memory leak in nanoftp (Nick Wellnhofer), + Fix memory leaks in SAX1 parser (Nick Wellnhofer) diff --git a/doc/news.html b/doc/news.html index 9a1d3e3..5346d32 100644 --- a/doc/news.html +++ b/doc/news.html @@ -8,7 +8,49 @@ H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } Releases
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

The XML C parser and toolkit of Gnome

Releases

Main Menu
Related links

The change log describes the recents commits -to the GIT code base.

Here is the list of public releases:

v2.9.6: Oct 06 2017

    +to the GIT code base.

    Here is the list of public releases:

    2.9.7: Nov 02 2017

      +
    • Documentation:
      + xmlcatalog: refresh man page wrt. quering system catalog easily (Jan Pokorný)
      +
    • + +
    • Portability:
      + Fix deprecated Travis compiler flag (Nick Wellnhofer),
      + Add declaration for DllMain (J. Peter Mugaas),
      + Fix preprocessor conditional in threads.h (J. Peter Mugaas),
      + Fix pointer comparison warnings on 64-bit Windows (J. Peter Mugaas),
      + Fix macro redefinition warning (J. Peter Mugaas),
      + Default to native threads on MinGW-w64 (Nick Wellnhofer),
      + Simplify Windows IO functions (Nick Wellnhofer),
      + Fix runtest on Windows (Nick Wellnhofer),
      + socklen_t is always int on Windows (Nick Wellnhofer),
      + Don't redefine socket error codes on Windows (Nick Wellnhofer),
      + Fix pointer/int cast warnings on 64-bit Windows (Nick Wellnhofer),
      + Fix Windows compiler warnings in xmlCanonicPath (Nick Wellnhofer)
      +
    • + +
    • Bug Fixes:
      + xmlcatalog: restore ability to query system catalog easily (Jan Pokorný),
      + Fix comparison of nodesets to strings (Nick Wellnhofer)
      +
    • + +
    • Improvements:
      + Add Makefile rules to rebuild HTML man pages (Nick Wellnhofer),
      + Fix mixed decls and code in timsort.h (Nick Wellnhofer),
      + Rework handling of return values in thread tests (Nick Wellnhofer),
      + Fix unused variable warnings in testrecurse (Nick Wellnhofer),
      + Fix -Wimplicit-fallthrough warnings (J. Peter Mugaas),
      + Upgrade timsort.h to latest revision (Nick Wellnhofer),
      + Increase warning level to /W3 under MSVC (Nick Wellnhofer),
      + Fix a couple of warnings in dict.c and threads.c (Nick Wellnhofer),
      + Update .gitignore for Windows (Nick Wellnhofer),
      + Fix unused variable warnings in nanohttp.c (Nick Wellnhofer),
      + Fix the Windows header mess (Nick Wellnhofer),
      + Don't include winsock2.h in xmllint.c (Nick Wellnhofer),
      + Remove generated file python/setup.py from version control (Nick Wellnhofer),
      + Use __linux__ macro in generated code (Nick Wellnhofer)
      +
    • + +

    v2.9.6: Oct 06 2017

    • Portability:
      Change preprocessor OS tests to __linux__ (Nick Wellnhofer)
    • diff --git a/doc/xml.html b/doc/xml.html index 019b5be..b902869 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -709,6 +709,50 @@ to the GIT code base.

      Here is the list of public releases:

      +

      2.9.7: Nov 02 2017

      +
        +
      • Documentation:
        + xmlcatalog: refresh man page wrt. quering system catalog easily (Jan Pokorný)
        +
      • + +
      • Portability:
        + Fix deprecated Travis compiler flag (Nick Wellnhofer),
        + Add declaration for DllMain (J. Peter Mugaas),
        + Fix preprocessor conditional in threads.h (J. Peter Mugaas),
        + Fix pointer comparison warnings on 64-bit Windows (J. Peter Mugaas),
        + Fix macro redefinition warning (J. Peter Mugaas),
        + Default to native threads on MinGW-w64 (Nick Wellnhofer),
        + Simplify Windows IO functions (Nick Wellnhofer),
        + Fix runtest on Windows (Nick Wellnhofer),
        + socklen_t is always int on Windows (Nick Wellnhofer),
        + Don't redefine socket error codes on Windows (Nick Wellnhofer),
        + Fix pointer/int cast warnings on 64-bit Windows (Nick Wellnhofer),
        + Fix Windows compiler warnings in xmlCanonicPath (Nick Wellnhofer)
        +
      • + +
      • Bug Fixes:
        + xmlcatalog: restore ability to query system catalog easily (Jan Pokorný),
        + Fix comparison of nodesets to strings (Nick Wellnhofer)
        +
      • + +
      • Improvements:
        + Add Makefile rules to rebuild HTML man pages (Nick Wellnhofer),
        + Fix mixed decls and code in timsort.h (Nick Wellnhofer),
        + Rework handling of return values in thread tests (Nick Wellnhofer),
        + Fix unused variable warnings in testrecurse (Nick Wellnhofer),
        + Fix -Wimplicit-fallthrough warnings (J. Peter Mugaas),
        + Upgrade timsort.h to latest revision (Nick Wellnhofer),
        + Increase warning level to /W3 under MSVC (Nick Wellnhofer),
        + Fix a couple of warnings in dict.c and threads.c (Nick Wellnhofer),
        + Update .gitignore for Windows (Nick Wellnhofer),
        + Fix unused variable warnings in nanohttp.c (Nick Wellnhofer),
        + Fix the Windows header mess (Nick Wellnhofer),
        + Don't include winsock2.h in xmllint.c (Nick Wellnhofer),
        + Remove generated file python/setup.py from version control (Nick Wellnhofer),
        + Use __linux__ macro in generated code (Nick Wellnhofer)
        +
      • + +

      v2.9.6: Oct 06 2017

      • Portability:
        diff --git a/doc/xmlcatalog.1 b/doc/xmlcatalog.1 index b4a6b22..2fbfaf2 100644 --- a/doc/xmlcatalog.1 +++ b/doc/xmlcatalog.1 @@ -1,7 +1,7 @@ '\" t .\" Title: xmlcatalog .\" Author: John Fleck -.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: $Date$ .\" Manual: xmlcatalog Manual .\" Source: libxml2 @@ -34,7 +34,6 @@ xmlcatalog \- Command line tool to parse and manipulate XML or SGML catalog file \fBxmlcatalog\fR [\fB\-\-sgml\fR | \fB\-\-shell\fR | \fB\-\-create\fR | \fB\-\-del\ \fR\fB\fIVALUE(S)\fR\fR | [\ \fB\-\-add\ \fR\fB\fITYPE\fR\fR\fB\ \fR\fB\fIORIG\fR\fR\fB\ \fR\fB\fIREPLACE\fR\fR\fB\ \fR\ |\ \fB\-\-add\ \fR\fB\fIFILENAME\fR\fR] | \fB\-\-noout\fR | \fB\-\-no\-super\-update\fR | [\fB\-v\fR\ |\ \fB\-\-verbose\fR]] {\fICATALOGFILE\fR} {\fIENTITIES\fR...} .SH "DESCRIPTION" .PP - \fBxmlcatalog\fR is a command line application allowing users to monitor and manipulate XML @@ -50,7 +49,6 @@ SGML files\&. .SH "OPTIONS" .PP - \fBxmlcatalog\fR accepts the following options (in alphabetical order): .PP @@ -155,6 +153,19 @@ options\&. .RS 4 Output debugging information\&. .RE +.PP +Invoking +\fBxmlcatalog\fR +non\-interactively without a designated action (imposed with options like +\fB\-\-add\fR) will result in a lookup of the catalog entry for +\fIENTITIES\fR +in the catalog denoted with +\fICATALOGFILE\fR\&. The corresponding entries will be output to the command line\&. This mode of operation, together with +\fB\-\-shell\fR +mode and non\-modifying (i\&.e\&. without +\fB\-\-noout\fR) direct actions, allows for a special shortcut of the void +\fICATALOGFILE\fR +specification (possibly expressed as "" in the shell environment) appointing the default system catalog\&. That simplifies the handling when its exact location is irrelevant but the respective built\-in still needs to be consulted\&. .SH "SHELL COMMANDS" .PP Invoking @@ -213,7 +224,7 @@ Quit the shell\&. .PP \fBpublic \fR\fB\fIPUBLIC\-ID\fR\fR .RS 4 -Execute a Formal Public Identifier look\-up of the catalog entry for +Execute a Formal Public Identifier lookup of the catalog entry for \fIPUBLIC\-ID\fR\&. The corresponding entry will be output to the command line\&. .RE .PP @@ -224,7 +235,7 @@ Stop printing debugging statements\&. .PP \fBsystem \fR\fB\fISYSTEM\-ID\fR\fR .RS 4 -Execute a Formal Public Identifier look\-up of the catalog entry for +Execute a Formal Public Identifier lookup of the catalog entry for \fISYSTEM\-ID\fR\&. The corresponding entry will be output to the command line\&. .RE .SH "ENVIRONMENT" @@ -240,7 +251,6 @@ catalog\&. .RE .SH "DIAGNOSTICS" .PP - \fBxmlcatalog\fR return codes provide information that can be used when calling it from scripts\&. .PP diff --git a/doc/xmlcatalog_man.html b/doc/xmlcatalog_man.html index d7b02ba..f72cd47 100644 --- a/doc/xmlcatalog_man.html +++ b/doc/xmlcatalog_man.html @@ -1,101 +1,140 @@ -xmlcatalog

        Name

        xmlcatalog — Command line tool to parse and manipulate XML or - SGML catalog files.

        Synopsis

        xmlcatalog [[--shell] | [--create] | [--add type - orig replace] | [--del values] | [--noout] | [--verbose]] [catalogfile] [entities]

        Introduction

        - xmlcatalog is a command line application - allowing users to monitor and manipulate XML and - SGML catalogs. It is included in - libxml2. -

        - Its functions can be invoked from a single command from the command line, - or it can perform multiple functions in interactive mode. It can operate - on both XML and SGML files. -

        Command Line Options

        --shell filename
        - Run a shell - allowing interactive queries on catalog file - filename. -
        --create filename
        - Create a new - XML catalog. Outputs to stdout, ignoring - filename unless --noout is - used, in which case it creates a new catalog file - filename. -
        --add 'type' 'orig' 'replace' filename

        - Add an entry to catalog file - filename. type - indicates the type of entry. Possible types are 'public', 'system', 'uri', - 'rewriteSystem', 'rewriteURI', 'delegatePublic', 'delegateSystem', - 'delegateURI' and 'nextCatalog'. 'orig' is the original - reference to be replaced, and 'replace' - is the URI of the replacement entity to be - used. The --add option will not overwrite - filename, outputing to stdout, unless - --noout is used. The --add will - always take three parameters even if some of the - XML catalog constructs will have only a single - argument. - -

        - If the --add option is used following the - --sgml option, only a single argument, a - filename, is used. This is used to add - the name of a catalog file to an SGML - supercatalog, a file that contains references to other included - SGML catalog files. -

        --del 'values' filename
        - Remove entries from the catalog file - filename matching - 'values'. The --del option - will not overwrite filename, outputing to - stdout, unless --noout is used. -
        --noout
        - Save output to the named file rather than - outputing to stdout. -
        --sgml
        - Uses SGML Super catalogs for --add and --del options -
        -v or --verbose
        - output debugging - information. -

        Shell Commands

        Invoking xmlcatalog with the - --shell filename option opens - a command line shell allowing interactive access to the catalog file - identified by filename. Invoking the shell - provides a command line prompt after which commands can be entered. -

        public 'PublicID'
        - Execute a - public identifier lookup of the catalog entry for - 'PublicID'. The corresponding entry will be - output to the command line. -
        system 'SystemID'
        - Execute a - public identifier lookup of the catalog entry for - 'SystemID'. The corresponding entry will be - output to the command line. -
        add 'type' 'orig' 'replace'
        - Add an entry to the catalog - file. type indicates the type of - entry. Possible types are 'public', 'system', 'uri', 'rewriteSystem', 'rewriteURI', - 'delegatePublic', 'delegateSystem', 'delegateURI' and 'nextCatalog'. 'orig' - is the original reference to be replaced, and - 'replace' is the URI of the - replacement entity to be used. -
        del 'values'
        - Remove the - catalog entry corresponding to 'values'. -
        dump
        - Print the current catalog. -
        debug
        - Print debugging statements showing the steps - xmlcatalog is executing. -
        quiet
        - Stop printing debugging statements. -
        exit
        - Quit the shell. -

        Return values

        xmlcatalog's return codes provide - information that can be used when calling it from scripts.

        0: normal

        1: Failed to remove an entry from the catalog

        2: Failed to save to the catalog, check file permissions

        3: Failed to add an entry to the catalog

        4: Failed to lookup and entry in the catalog

        Catalogs

        Catalog behavior can be changed by redirecting - queries to the user's own set of catalogs. This can be done by setting the - XML_CATALOG_FILES environment variable to a list of - catalogs. An empty one should deactivate loading the default - /etc/xml/catalog default catalog.

        +xmlcatalog

        Name

        xmlcatalog — + Command line tool to parse and manipulate XML + or SGML catalog files. +

        Synopsis

        xmlcatalog [ --sgml | --shell | --create | --del VALUE(S) | + [ + --add + TYPE + ORIG + REPLACE + + | --add FILENAME ] + | --noout | --no-super-update | + [ -v | --verbose ] + ] {CATALOGFILE} {ENTITIES...}

        DESCRIPTION

        + xmlcatalog is a command line application allowing users to monitor and + manipulate XML and SGML catalogs. It + is included in libxml(3). +

        + Its functions can be invoked from a single command from the command line, + or it can perform multiple functions in interactive mode. It can operate + on both XML and SGML files. +

        OPTIONS

        + xmlcatalog accepts the following options (in alphabetical order): +

        + --add + TYPE + ORIG + REPLACE + +

        + Add an entry to CATALOGFILE. TYPE + indicates the type of entry. Possible types are: public, system, uri, rewriteSystem, rewriteURI, delegatePublic, delegateSystem, delegateURI, nextCatalog. ORIG is the original + reference to be replaced, and REPLACE + is the URI of the replacement entity to be + used. The --add option will not overwrite + CATALOGFILE, outputting + to stdout, unless + --noout is used. The --add will + always take three parameters even if some of the XML + catalog constructs will have only a single argument. +

        --add FILENAME

        + If the --add option is used following + the --sgml option, only a single argument, + a FILENAME, is used. This is used to add + the name of a catalog file to an SGML supercatalog, + a file that contains references to other included SGML + catalog files. +

        --create

        + Create a new XML catalog. Outputs + to stdout, + ignoring filename unless --noout is + used, in which case it creates a new catalog + file filename. +

        --del VALUE(S)

        + Remove entries from CATALOGFILE + matching VALUE(S). The --del + option will not overwrite CATALOGFILE, + outputting to stdout, + unless --noout is used. +

        --noout

        + Save output to the named file rather than outputting + to stdout. +

        --no-super-update

        + Do not update the SGML super catalog. +

        --shell

        + Run a shell allowing interactive queries on catalog + file CATALOGFILE. For the set of available + commands see the section called “SHELL COMMANDS”. +

        --sgml

        + Uses SGML super catalogs for --add + and --del options. +

        -v, --verbose

        Output debugging information.

        + Invoking xmlcatalog non-interactively without a designated action + (imposed with options like --add) will result in a lookup + of the catalog entry for ENTITIES in the + catalog denoted with CATALOGFILE. The + corresponding entries will be output to the command line. This mode of + operation, together with --shell mode and non-modifying + (i.e. without --noout) direct actions, allows for + a special shortcut of the void CATALOGFILE + specification (possibly expressed as "" in the shell + environment) appointing the default system catalog. That simplifies the + handling when its exact location is irrelevant but the respective built-in + still needs to be consulted. +

        SHELL COMMANDS

        + Invoking xmlcatalog with + the --shell CATALOGFILE option opens + a command line shell allowing interactive access to the catalog file + identified by CATALOGFILE. Invoking the shell + provides a command line prompt after which the following commands (described in + alphabetical order) can be entered. +

        + add + TYPE + ORIG + REPLACE + +

        + Add an entry to the catalog file. TYPE + indicates the type of entry. Possible types are: public, system, uri, rewriteSystem, rewriteURI, delegatePublic, delegateSystem, delegateURI, nextCatalog. ORIG is the original + reference to be replaced, and REPLACE + is the URI of the replacement entity to be + used. The --add option will not overwrite + CATALOGFILE, outputting + to stdout, unless + --noout is used. The --add will + always take three parameters even if some of the XML + catalog constructs will have only a single argument. +

        debug

        + Print debugging statements showing the steps xmlcatalog is executing. +

        del VALUE(S)

        + Remove the catalog entry corresponding to VALUE(S). +

        dump

        Print the current catalog.

        exit

        Quit the shell.

        public PUBLIC-ID

        + Execute a Formal Public Identifier lookup of the catalog entry + for PUBLIC-ID. The corresponding entry will be + output to the command line. +

        quiet

        Stop printing debugging statements.

        system SYSTEM-ID

        + Execute a Formal Public Identifier lookup of the catalog entry + for SYSTEM-ID. The corresponding entry will be + output to the command line. +

        ENVIRONMENT

        XML_CATALOG_FILES

        XML catalog behavior can be changed by redirecting + queries to the user's own set of catalogs. This can be done by setting + the XML_CATALOG_FILES environment variable to a list + of catalogs. An empty one should deactivate loading the + default /etc/xml/catalog catalog. +

        DIAGNOSTICS

        + xmlcatalog return codes provide information that can be used when + calling it from scripts. +

        0

        No error

        1

        Failed to remove an entry from the catalog

        2

        Failed to save to the catalog, check file permissions

        3

        Failed to add an entry to the catalog

        4

        Failed to look up an entry in the catalog

        SEE ALSO

        libxml(3) +

        + More information can be found at +

        +

        diff --git a/doc/xmlcatalog_man.xml b/doc/xmlcatalog_man.xml index 049ed8f..b3ce8b2 100644 --- a/doc/xmlcatalog_man.xml +++ b/doc/xmlcatalog_man.xml @@ -230,6 +230,21 @@ + + + Invoking &xmlcatalog; non-interactively without a designated action + (imposed with options like ) will result in a lookup + of the catalog entry for ENTITIES in the + catalog denoted with CATALOGFILE. The + corresponding entries will be output to the command line. This mode of + operation, together with mode and non-modifying + (i.e. without ) direct actions, allows for + a special shortcut of the void CATALOGFILE + specification (possibly expressed as "" in the shell + environment) appointing the default system catalog. That simplifies the + handling when its exact location is irrelevant but the respective built-in + still needs to be consulted. + @@ -315,7 +330,7 @@ - Execute a Formal Public Identifier look-up of the catalog entry + Execute a Formal Public Identifier lookup of the catalog entry for PUBLIC-ID. The corresponding entry will be output to the command line. @@ -333,7 +348,7 @@ - Execute a Formal Public Identifier look-up of the catalog entry + Execute a Formal Public Identifier lookup of the catalog entry for SYSTEM-ID. The corresponding entry will be output to the command line. diff --git a/doc/xmllint.html b/doc/xmllint.html index 0a55877..5fc52c5 100644 --- a/doc/xmllint.html +++ b/doc/xmllint.html @@ -1,175 +1,162 @@ -xmllint

        Name

        xmllint — command line XML tool

        Synopsis

        xmllint [[--version] | [--debug] | [--shell] | [--debugent] | [--copy] | [--recover] | [--noent] | [--noout] | [--nonet] | [--htmlout] | [--nowrap] | [--valid] | [--postvalid] | [--dtdvalid URL] | [--dtdvalidfpi FPI] | [--timing] | [--output file] | [--repeat] | [--insert] | [--compress] | [--html] | [--xmlout] | [--push] | [--memory] | [--maxmem nbbytes] | [--nowarning] | [--noblanks] | [--nocdata] | [--format] | [--encode encoding] | [--dropdtd] | [--nsclean] | [--testIO] | [--catalogs] | [--nocatalogs] | [--auto] | [--xinclude] | [--noxincludenode] | [--loaddtd] | [--dtdattr] | [--stream] | [--walker] | [--pattern patternvalue] | [--chkregister] | [--relaxng] | [--schema] | [--c14n]] [xmlfile]

        Introduction

        - The xmllint program parses one or more XML files, specified on the - command line as xmlfile. It prints various - types of output, depending upon the options selected. It is useful for - detecting errors both in XML code and in the - XML parser itself. -

        - It is included in libxml2. -

        Options

        --version
        - Display the version of - libxml2 used. -
        --debug
        - Parse a file and output an annotated tree of the - in-memory version of the document. -
        --shell
        - Run a navigating shell. Details on available commands in shell mode - are below. -
        --debugent
        - Debug the entities defined in the document. -
        --copy
        - Test the internal copy implementation. -
        --recover
        - Output any parsable portions of an invalid - document. -
        --noent
        - Substitute entity values for entity - references. By default, xmllint leaves entity - references in place. -
        --nocdata
        - Substitute CDATA section by equivalent text nodes. -
        --nsclean
        - Remove redundant namespace declarations. -
        --noout
        - Suppress output. By default, - xmllint outputs the result tree. -
        --htmlout
        - Output results as an HTML - file. This causes xmllint to output - the necessary HTML tags surrounding the result tree - output so the results can be displayed in a browser. -
        --nowrap
        - Do not output HTML doc wrapper. -
        --valid
        - Determine if the document is a valid instance - of the included Document Type Definition (DTD). A - DTD to be validated against also can be specified at - the command line using the --dtdvalid option. By default, - xmllint also checks to determine if the - document is well-formed. -
        --postvalid
        - Validate after parsing is completed. -
        --dtdvalid URL
        - Use the - DTD specified by URL for - validation. -
        --dtdvalidfpi FPI
        - Use the - DTD specified by the Public Identifier - FPI for validation, note that this - will require a Catalog exporting that Public Identifier to work. -
        --timing
        - Output information about the time it takes - xmllint to perform the various steps. -
        --output file
        Define a file path where xmllint will save the result of - parsing. Usually the programs build a tree and save it on stdout, with - this option the result XML instance will be saved onto a file.
        --repeat
        - Repeat 100 times, for timing or profiling. -
        --insert
        - Test for valid insertions. -
        --compress
        - Turn on gzip compression of output. -
        --html
        - Use the HTML parser. -
        --xmlout
        Used in conjunction with --html. Usually - when HTML is parsed the document is saved with the HTML serializer, but with - this option the resulting document is saved with the XML serializer. This is - primarily used to generate XHTML from HTML input.
        --push
        - Use the push mode of the parser. -
        --memory
        - Parse from memory. -
        --maxmem nnbytes
        Test the parser memory - support. nnbytes is the maximum number of bytes the - library is allowed to allocate. This can also be used to make sure batch - processing of XML files will not exhaust the virtual memory of the server - running them.
        --nowarning
        - Do not emit warnings from the parser and/or validator. -
        --noblanks
        - Drop ignorable blank spaces. -
        --format
        - Reformat and reindent the output. The $XMLLINT_INDENT - environment variable controls the indentation (default - value is two spaces " "). -
        --testIO
        - Test user input/output support. -
        --encode encoding
        - Output in the given encoding. -
        --catalogs
        - Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog - is used by default. -
        --nocatalogs
        - Do not use any catalogs. -
        --auto
        - Generate a small document for testing purposes. -
        --xinclude
        - Do XInclude processing. -
        --noxincludenode
        - Do XInclude processing but do not generate XInclude start and end - nodes. -
        --loaddtd
        - Fetch external DTD. -
        --dtdattr
        - Fetch external DTD and populate the tree with inherited attributes. -
        --dropdtd
        - Remove DTD from output. -
        --stream
        Use streaming API - useful when used in combination with - --relaxng or --valid options for validation of files that are - too large to be held in memory.
        --walker
        Test the walker module, which is a reader interface but for a - document tree, instead of using the reader API on an unparsed document it - works on a existing in-memory tree. Used in debugging.
        --chkregister
        Turn on node registration. Useful for developers testing - libxml2 node tracking code.
        --pattern patternvalue
        Used to exercise the pattern recognition engine, which can be - used with the reader interface to the parser. It allows to select some - nodes in the document based on an XPath (subset) expression. Used for - debugging.
        --relaxng schema
        Use RelaxNG file named schema for - validation.
        --schema schema
        Use a W3C XML Schema file named schema for validation.
        - --c14n
        Use the W3C XML Canonicalisation (C14N) to -serialize the result of parsing to stdout. It keeps comments in -the result.

        Shell

        - xmllint offers an interactive shell mode - invoked with the --shell command. Available commands in - shell mode include: -

        base
        - display XML base of the node -
        bye
        - leave shell -
        cat node
        - Display node if given or current node. -
        cd path
        - Change the current node to path (if given - and unique) or root if no argument given. -
        dir path
        - Dumps information about the node (namespace, attributes, content). -
        du path
        - Show the structure of the subtree under path or the current node. -
        exit
        - Leave the shell. -
        help
        - Show this help. -
        free
        - Display memory usage. -
        load name
        - Load a new document with the given name. -
        ls path
        - List contents of path (if given) or the - current directory. -
        pwd
        - Display the path to the current node. -
        quit
        - Leave the shell. -
        save name
        - Saves the current document to name if - given or to the original name. -
        validate
        - Check the document for error. -
        write name
        - Write the current node to the given filename. -

        Catalogs

        Catalog behavior can be changed by redirecting - queries to the user's own set of catalogs. This can be done by setting the - XML_CATALOG_FILES environment variable to a list of - catalogs. An empty one should deactivate loading the default - /etc/xml/catalog default catalog.

        Debugging Catalogs

        Setting the environment variable XML_DEBUG_CATALOG - using the command "export XML_DEBUG_CATALOG=" - outputs debugging information related to catalog operations.

        Error Return Codes

        On the completion of execution, Xmllint - returns the following error codes:

        0
        No error
        1
        Unclassified
        2
        Error in DTD
        3
        Validation error
        4
        Validation error
        5
        Error in schema compilation
        6
        Error writing output
        7
        Error in pattern (generated when - [--pattern] option is used)
        8
        Error in Reader registration (generated when - [--chkregister] option is used)
        9
        Out of memory error
        +xmllint

        Name

        xmllint — command line XML tool

        Synopsis

        xmllint [ --version | --debug | --shell | --xpath "XPath_expression" | --debugent | --copy | --recover | --noent | --noout | --nonet | --path "PATH(S)" | --load-trace | --htmlout | --nowrap | --valid | --postvalid | --dtdvalid URL | --dtdvalidfpi FPI | --timing | --output FILE | --repeat | --insert | --compress | --html | --xmlout | --push | --memory | --maxmem NBBYTES | --nowarning | --noblanks | --nocdata | --format | --encode ENCODING | --dropdtd | --nsclean | --testIO | --catalogs | --nocatalogs | --auto | --xinclude | --noxincludenode | --loaddtd | --dtdattr | --stream | --walker | --pattern PATTERNVALUE | --chkregister | --relaxng SCHEMA | --schema SCHEMA | --c14n ] { XML-FILE(S)... | - }

        xmllint --help

        DESCRIPTION

        + The xmllint program parses one or more XML files, + specified on the command line as XML-FILE + (or the standard input if the filename provided + is - ). It prints various types of + output, depending upon the options selected. It is useful for detecting + errors both in XML code and in + the XML parser itself. +

        xmllint is included in libxml(3).

        OPTIONS

        + xmllint accepts the following options (in alphabetical order): +

        --auto

        Generate a small document for testing purposes.

        --catalogs

        + Use the SGML catalog(s) from SGML_CATALOG_FILES. + Otherwise XML catalogs starting + from /etc/xml/catalog are used by default. +

        --chkregister

        + Turn on node registration. Useful for developers testing libxml(3) node tracking code. +

        --compress

        + Turn on gzip(1) compression of output. +

        --copy

        Test the internal copy implementation.

        --c14n

        + Use the W3C XML Canonicalisation (C14N) to + serialize the result of parsing to stdout. + It keeps comments in the result. +

        --dtdvalid URL

        + Use the DTD specified by + an URL for validation. +

        --dtdvalidfpi FPI

        + Use the DTD specified by a Formal Public + Identifier FPI for validation, note that this + will require a catalog exporting that Formal Public Identifier to work. +

        --debug

        + Parse a file and output an annotated tree of the + in-memory version of the document. +

        --debugent

        Debug the entities defined in the document.

        --dropdtd

        Remove DTD from output.

        --dtdattr

        + Fetch external DTD and populate the tree with + inherited attributes. +

        --encode ENCODING

        Output in the given encoding. Note that this works for full document not fragments or result from XPath queries.

        --format

        + Reformat and reindent the output. The XMLLINT_INDENT + environment variable controls the indentation. The default value is two + spaces " "). +

        --help

        Print out a short usage summary for xmllint.

        --html

        Use the HTML parser.

        --htmlout

        + Output results as an HTML file. This + causes xmllint to output the necessary HTML + tags surrounding the result tree output so the results can be + displayed/viewed in a browser. +

        --insert

        Test for valid insertions.

        --loaddtd

        Fetch an external DTD.

        --load-trace

        + Display all the documents loaded during the processing + to stderr. +

        --maxmem NNBYTES

        + Test the parser memory support. NNBYTES + is the maximum number of bytes the library is allowed to allocate. + This can also be used to make sure batch processing + of XML files will not exhaust the virtual memory + of the server running them. +

        --memory

        Parse from memory.

        --noblanks

        Drop ignorable blank spaces.

        --nocatalogs

        Do not use any catalogs.

        --nocdata

        Substitute CDATA section by equivalent text nodes.

        --noent

        + Substitute entity values for entity references. By default, xmllint + leaves entity references in place. +

        --nonet

        + Do not use the Internet to fetch DTDs or entities. +

        --noout

        + Suppress output. By default, xmllint outputs the result tree. +

        --nowarning

        Do not emit warnings from the parser and/or validator.

        --nowrap

        Do not output HTML doc wrapper.

        --noxincludenode

        + Do XInclude processing but do not generate XInclude start and end nodes. +

        --nsclean

        Remove redundant namespace declarations.

        --output FILE

        + Define a file path where xmllint will save the result of parsing. + Usually the programs build a tree and save it + on stdout, with this option + the result XML instance will be saved onto a file. +

        --path "PATH(S)"

        + Use the (space- or colon-separated) list of filesystem paths specified + by PATHS to load DTDs or + entities. Enclose space-separated lists by quotation marks. +

        --pattern PATTERNVALUE

        + Used to exercise the pattern recognition engine, which can be used + with the reader interface to the parser. It allows to select some + nodes in the document based on an XPath (subset) expression. Used + for debugging. +

        --postvalid

        Validate after parsing has completed.

        --push

        Use the push mode of the parser.

        --recover

        Output any parsable portions of an invalid document.

        --relaxng SCHEMA

        + Use RelaxNG file named SCHEMA + for validation. +

        --repeat

        Repeat 100 times, for timing or profiling.

        --schema SCHEMA

        + Use a W3C XML Schema file + named SCHEMA for validation. +

        --shell

        + Run a navigating shell. Details on available commands in shell mode + are below (see the section called “SHELL COMMANDS”). +

        --xpath "XPath_expression"

        + Run an XPath expression given as argument and print the + result. In case of a nodeset result, each node in the + node set is serialized in full in the output. In case + of an empty node set the "XPath set is empty" result + will be shown and an error exit code will be returned. +

        --stream

        + Use streaming API - useful when used in combination + with --relaxng or --valid options + for validation of files that are too large to be held in memory. +

        --testIO

        Test user input/output support.

        --timing

        + Output information about the time it takes xmllint to perform the + various steps. +

        --valid

        + Determine if the document is a valid instance of the included + Document Type Definition (DTD). + A DTD to be validated against also can be + specified at the command line using the --dtdvalid + option. By default, xmllint also checks to determine if the + document is well-formed. +

        --version

        + Display the version of libxml(3) used. +

        --walker

        + Test the walker module, which is a reader interface but for a + document tree, instead of using the reader API on + an unparsed document it works on an existing in-memory tree. Used for + debugging. +

        --xinclude

        Do XInclude processing.

        --xmlout

        + Used in conjunction with --html. Usually + when HTML is parsed the document is saved with + the HTML serializer. But with this option the + resulting document is saved with the XML + serializer. This is primarily used to + generate XHTML from HTML input. +

        SHELL COMMANDS

        + xmllint offers an interactive shell mode invoked with + the --shell command. Available commands in shell mode + include (in alphabetical order): +

        base

        Display XML base of the node.

        bye

        Leave the shell.

        cat NODE

        Display the given node or the current one.

        cd PATH

        + Change the current node to the given path (if unique) or root if no + argument is given. +

        dir PATH

        + Dumps information about the node (namespace, attributes, content). +

        du PATH

        + Show the structure of the subtree under the given path or the current node. +

        exit

        Leave the shell.

        help

        Show this help.

        free

        Display memory usage.

        load FILENAME

        Load a new document with the given filename.

        ls PATH

        List contents of the given path or the current directory.

        pwd

        Display the path to the current node.

        quit

        Leave the shell.

        save FILENAME

        + Save the current document to the given filename or to the original name. +

        validate

        Check the document for errors.

        write FILENAME

        Write the current node to the given filename.

        ENVIRONMENT

        SGML_CATALOG_FILES

        SGML catalog behavior can be changed by redirecting + queries to the user's own set of catalogs. This can be done by setting + the SGML_CATALOG_FILES environment variable to a list + of catalogs. An empty one should deactivate loading the + default /etc/sgml/catalog catalog. +

        XML_CATALOG_FILES

        XML catalog behavior can be changed by redirecting + queries to the user's own set of catalogs. This can be done by setting + the XML_CATALOG_FILES environment variable to a list + of catalogs. An empty one should deactivate loading the + default /etc/xml/catalog catalog. +

        XML_DEBUG_CATALOG

        Setting the environment variable XML_DEBUG_CATALOG + to non-zero using the export + command outputs debugging information related to catalog operations. +

        XMLLINT_INDENT

        Setting the environment variable XMLLINT_INDENT + controls the indentation. The default value is two spaces " ". +

        DIAGNOSTICS

        + xmllint return codes provide information that can be used when + calling it from scripts. +

        0

        No error

        1

        Unclassified

        2

        Error in DTD

        3

        Validation error

        4

        Validation error

        5

        Error in schema compilation

        6

        Error writing output

        7

        + Error in pattern (generated when --pattern option is used) +

        8

        + Error in Reader registration (generated + when --chkregister option is used) +

        9

        Out of memory error

        SEE ALSO

        libxml(3) +

        + More information can be found at +

        +

        diff --git a/include/libxml/nanoftp.h b/include/libxml/nanoftp.h index abb4bf7..7335faf 100644 --- a/include/libxml/nanoftp.h +++ b/include/libxml/nanoftp.h @@ -16,7 +16,7 @@ #ifdef LIBXML_FTP_ENABLED /* Needed for portability to Windows 64 bits */ -#if defined(__MINGW32__) || defined(_WIN32_WCE) +#if defined(_WIN32) && !defined(__CYGWIN__) #include #else /** diff --git a/include/libxml/threads.h b/include/libxml/threads.h index d31f16a..9969ae7 100644 --- a/include/libxml/threads.h +++ b/include/libxml/threads.h @@ -72,8 +72,13 @@ XMLPUBFUN void XMLCALL XMLPUBFUN xmlGlobalStatePtr XMLCALL xmlGetGlobalState(void); -#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL) -int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved); +#ifdef HAVE_PTHREAD_H +#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) +#if defined(LIBXML_STATIC_FOR_DLL) +int XMLCALL +xmlDllMain(void *hinstDLL, unsigned long fdwReason, + void *lpvReserved); +#endif #endif #ifdef __cplusplus diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h index 390a236..cfd873a 100644 --- a/include/libxml/xmlversion.h +++ b/include/libxml/xmlversion.h @@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.9.6" +#define LIBXML_DOTTED_VERSION "2.9.7" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20906 +#define LIBXML_VERSION 20907 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20906" +#define LIBXML_VERSION_STRING "20907" /** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-GITv2.9.6-rc1" +#define LIBXML_VERSION_EXTRA "-GITv2.9.7-rc1" /** * LIBXML_TEST_VERSION: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20906); +#define LIBXML_TEST_VERSION xmlCheckVersion(20907); #ifndef VMS #if 0 diff --git a/include/win32config.h b/include/win32config.h index 40cf7df..8596755 100644 --- a/include/win32config.h +++ b/include/win32config.h @@ -10,7 +10,6 @@ #if defined(_WIN32_WCE) #undef HAVE_ERRNO_H -#include #include "wincecompat.h" #else #define HAVE_SYS_STAT_H @@ -29,10 +28,6 @@ #define ICONV_CONST const #endif -#ifdef NEED_SOCKETS -#include -#endif - /* * Windows platforms may define except */ diff --git a/include/wsockcompat.h b/include/wsockcompat.h index e6a1a99..0484ee3 100644 --- a/include/wsockcompat.h +++ b/include/wsockcompat.h @@ -8,7 +8,7 @@ #ifdef _WIN32_WCE #include #else -#undef HAVE_ERRNO_H +#include #include /* the following is a workaround a problem for 'inline' keyword in said @@ -27,60 +27,23 @@ #endif #endif -#if defined( __MINGW32__ ) || defined( _MSC_VER ) -/* Include here to ensure that it doesn't get included later - * (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */ -#include -#undef EWOULDBLOCK -#endif +#undef XML_SOCKLEN_T +#define XML_SOCKLEN_T int -#if !defined SOCKLEN_T -#define SOCKLEN_T int +#ifndef ECONNRESET +#define ECONNRESET WSAECONNRESET +#endif +#ifndef EINPROGRESS +#define EINPROGRESS WSAEINPROGRESS +#endif +#ifndef EINTR +#define EINTR WSAEINTR +#endif +#ifndef ESHUTDOWN +#define ESHUTDOWN WSAESHUTDOWN +#endif +#ifndef EWOULDBLOCK +#define EWOULDBLOCK WSAEWOULDBLOCK #endif - -#define EWOULDBLOCK WSAEWOULDBLOCK -#define ESHUTDOWN WSAESHUTDOWN - -#if (!defined(_MSC_VER) || (_MSC_VER < 1600)) -#define EINPROGRESS WSAEINPROGRESS -#define EALREADY WSAEALREADY -#define ENOTSOCK WSAENOTSOCK -#define EDESTADDRREQ WSAEDESTADDRREQ -#define EMSGSIZE WSAEMSGSIZE -#define EPROTOTYPE WSAEPROTOTYPE -#define ENOPROTOOPT WSAENOPROTOOPT -#define EPROTONOSUPPORT WSAEPROTONOSUPPORT -#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT -#define EOPNOTSUPP WSAEOPNOTSUPP -#define EPFNOSUPPORT WSAEPFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define EADDRINUSE WSAEADDRINUSE -#define EADDRNOTAVAIL WSAEADDRNOTAVAIL -#define ENETDOWN WSAENETDOWN -#define ENETUNREACH WSAENETUNREACH -#define ENETRESET WSAENETRESET -#define ECONNABORTED WSAECONNABORTED -#define ECONNRESET WSAECONNRESET -#define ENOBUFS WSAENOBUFS -#define EISCONN WSAEISCONN -#define ENOTCONN WSAENOTCONN -#define ETOOMANYREFS WSAETOOMANYREFS -#define ETIMEDOUT WSAETIMEDOUT -#define ECONNREFUSED WSAECONNREFUSED -#define ELOOP WSAELOOP -#define EHOSTDOWN WSAEHOSTDOWN -#define EHOSTUNREACH WSAEHOSTUNREACH -#define EPROCLIM WSAEPROCLIM -#define EUSERS WSAEUSERS -#define EDQUOT WSAEDQUOT -#define ESTALE WSAESTALE -#define EREMOTE WSAEREMOTE -/* These cause conflicts with the codes from errno.h. Since they are - not used in the relevant code (nanoftp, nanohttp), we can leave - them disabled. -#define ENAMETOOLONG WSAENAMETOOLONG -#define ENOTEMPTY WSAENOTEMPTY -*/ -#endif /* _MSC_VER */ #endif /* __XML_WSOCKCOMPAT_H__ */ diff --git a/libxml.h b/libxml.h index f13e9de..4fe56d2 100644 --- a/libxml.h +++ b/libxml.h @@ -109,7 +109,7 @@ int xmlNop(void); #endif #endif #endif -#if !defined(PIC) && !defined(NOLIBTOOL) +#if !defined(PIC) && !defined(NOLIBTOOL) && !defined(LIBXML_STATIC) # define LIBXML_STATIC #endif #endif /* ! __XML_LIBXML_H__ */ diff --git a/libxml2.spec b/libxml2.spec index 4eb20ca..46278ea 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -2,7 +2,7 @@ Summary: Library providing XML and HTML support Name: libxml2 -Version: 2.9.6 +Version: 2.9.7 Release: 1%{?dist}%{?extra_release} License: MIT Group: Development/Libraries @@ -203,6 +203,6 @@ rm -fr %{buildroot} %endif # with_python3 %changelog -* Fri Oct 6 2017 Daniel Veillard -- upstream release 2.9.6 see http://xmlsoft.org/news.html +* Thu Nov 2 2017 Daniel Veillard +- upstream release 2.9.7 see http://xmlsoft.org/news.html diff --git a/nanoftp.c b/nanoftp.c index 5bc6555..54fa026 100644 --- a/nanoftp.c +++ b/nanoftp.c @@ -12,8 +12,6 @@ #define HAVE_NETINET_IN_H #define HAVE_NETDB_H #define HAVE_SYS_TIME_H -#else /* TESTING */ -#define NEED_SOCKETS #endif /* TESTING */ #define IN_LIBXML @@ -77,14 +75,8 @@ #endif -#if defined(__MINGW32__) || defined(_WIN32_WCE) -#ifndef _WINSOCKAPI_ -#define _WINSOCKAPI_ -#endif +#if defined(_WIN32) && !defined(__CYGWIN__) #include -#include -#undef XML_SOCKLEN_T -#define XML_SOCKLEN_T unsigned int #endif /** @@ -909,7 +901,7 @@ xmlNanoFTPConnect(void *ctx) { __xmlIOErr(XML_FROM_FTP, 0, "getaddrinfo failed"); return (-1); } - if (tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) { + if ((size_t)tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) { if (result) freeaddrinfo (result); __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch"); @@ -1044,6 +1036,7 @@ xmlNanoFTPConnect(void *ctx) { case 2: if (proxyPasswd == NULL) break; + /* Falls through. */ case 3: if (proxyPasswd != NULL) snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd); @@ -1113,6 +1106,7 @@ xmlNanoFTPConnect(void *ctx) { ctxt->controlFd = INVALID_SOCKET; return(-1); } + /* Falls through. */ case 2: /* USER user@host command */ if (ctxt->user == NULL) @@ -1166,6 +1160,7 @@ xmlNanoFTPConnect(void *ctx) { ctxt->controlFd = INVALID_SOCKET; return(-1); } + /* Falls through. */ case 3: /* * If you need support for other Proxy authentication scheme @@ -1214,6 +1209,7 @@ xmlNanoFTPConnect(void *ctx) { case 3: __xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT, "FTP server asking for ACCNT on anonymous\n"); + /* Falls through. */ case 1: case 4: case 5: diff --git a/nanohttp.c b/nanohttp.c index 0533102..9cd2292 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -11,7 +11,6 @@ * daniel@veillard.com */ -#define NEED_SOCKETS #define IN_LIBXML #include "libxml.h" @@ -74,14 +73,8 @@ #define XML_SOCKLEN_T unsigned int #endif -#if defined(__MINGW32__) || defined(_WIN32_WCE) -#ifndef _WINSOCKAPI_ -#define _WINSOCKAPI_ -#endif +#if defined(_WIN32) && !defined(__CYGWIN__) #include -#include -#undef XML_SOCKLEN_T -#define XML_SOCKLEN_T unsigned int #endif #include @@ -182,7 +175,21 @@ xmlHTTPErrMemory(const char *extra) */ static int socket_errno(void) { #ifdef _WINSOCKAPI_ - return(WSAGetLastError()); + int err = WSAGetLastError(); + switch(err) { + case WSAECONNRESET: + return(ECONNRESET); + case WSAEINPROGRESS: + return(EINPROGRESS); + case WSAEINTR: + return(EINTR); + case WSAESHUTDOWN: + return(ESHUTDOWN); + case WSAEWOULDBLOCK: + return(EWOULDBLOCK); + default: + return(err); + } #else return(errno); #endif @@ -629,7 +636,7 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) if ((select(ctxt->fd + 1, &rfd, NULL, NULL, &tv) < 1) #if defined(EINTR) - && (errno != EINTR) + && (socket_errno() != EINTR) #endif ) return (0); @@ -1038,16 +1045,13 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr) static SOCKET xmlNanoHTTPConnectHost(const char *host, int port) { - struct hostent *h; struct sockaddr *addr = NULL; - struct in_addr ia; struct sockaddr_in sockin; #ifdef SUPPORT_IP6 struct in6_addr ia6; struct sockaddr_in6 sockin6; #endif - int i; SOCKET s; memset (&sockin, 0, sizeof(sockin)); @@ -1084,7 +1088,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) for (res = result; res; res = res->ai_next) { if (res->ai_family == AF_INET) { - if (res->ai_addrlen > sizeof(sockin)) { + if ((size_t)res->ai_addrlen > sizeof(sockin)) { __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); freeaddrinfo (result); return INVALID_SOCKET; @@ -1094,7 +1098,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) addr = (struct sockaddr *)&sockin; #ifdef SUPPORT_IP6 } else if (have_ipv6 () && (res->ai_family == AF_INET6)) { - if (res->ai_addrlen > sizeof(sockin6)) { + if ((size_t)res->ai_addrlen > sizeof(sockin6)) { __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); freeaddrinfo (result); return INVALID_SOCKET; @@ -1122,6 +1126,10 @@ xmlNanoHTTPConnectHost(const char *host, int port) #endif #if !defined(HAVE_GETADDRINFO) || !defined(_WIN32) { + struct hostent *h; + struct in_addr ia; + int i; + h = gethostbyname (GETHOSTBYNAME_ARG_CAST host); if (h == NULL) { diff --git a/os400/os400config.h.in b/os400/os400config.h.in index 3966ac8..ad5abb7 100644 --- a/os400/os400config.h.in +++ b/os400/os400config.h.in @@ -333,9 +333,6 @@ #define below would cause a syntax error. */ #undef _UINT32_T -/* Using the Win32 Socket implementation */ -#undef _WINSOCKAPI_ - /* ss_family is not defined here, use __ss_family instead */ #undef ss_family diff --git a/parser.c b/parser.c index 28d0cd2..1c5e036 100644 --- a/parser.c +++ b/parser.c @@ -38,7 +38,7 @@ #define IN_LIBXML #include "libxml.h" -#if defined(WIN32) && !defined (__CYGWIN__) +#if defined(_WIN32) && !defined (__CYGWIN__) #define XML_DIR_SEP '\\' #else #define XML_DIR_SEP '/' @@ -1335,7 +1335,7 @@ xmlAddSpecialAttr(xmlParserCtxtPtr ctxt, return; xmlHashAddEntry2(ctxt->attsSpecial, fullname, fullattr, - (void *) (long) type); + (void *) (ptrdiff_t) type); return; mem_error: @@ -1354,7 +1354,7 @@ xmlCleanSpecialAttrCallback(void *payload, void *data, const xmlChar *unused ATTRIBUTE_UNUSED) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) data; - if (((long) payload) == XML_ATTRIBUTE_CDATA) { + if (((ptrdiff_t) payload) == XML_ATTRIBUTE_CDATA) { xmlHashRemoveEntry2(ctxt->attsSpecial, fullname, fullattr, NULL); } } @@ -1866,7 +1866,7 @@ nameNsPush(xmlParserCtxtPtr ctxt, const xmlChar * value, ctxt->name = value; ctxt->pushTab[ctxt->nameNr * 3] = (void *) prefix; ctxt->pushTab[ctxt->nameNr * 3 + 1] = (void *) URI; - ctxt->pushTab[ctxt->nameNr * 3 + 2] = (void *) (long) nsNr; + ctxt->pushTab[ctxt->nameNr * 3 + 2] = (void *) (ptrdiff_t) nsNr; return (ctxt->nameNr++); mem_error: xmlErrMemory(ctxt, NULL); @@ -9070,8 +9070,8 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt, if (ctxt->attsSpecial != NULL) { int type; - type = (int) (long) xmlHashQLookup2(ctxt->attsSpecial, - pref, elem, *prefix, name); + type = (int) (ptrdiff_t) xmlHashQLookup2(ctxt->attsSpecial, + pref, elem, *prefix, name); if (type != 0) normalize = 1; } @@ -11532,9 +11532,10 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { } if (ctxt->sax2) { xmlParseEndTag2(ctxt, - (void *) ctxt->pushTab[ctxt->nameNr * 3 - 3], - (void *) ctxt->pushTab[ctxt->nameNr * 3 - 2], 0, - (int) (long) ctxt->pushTab[ctxt->nameNr * 3 - 1], 0); + (void *) ctxt->pushTab[ctxt->nameNr * 3 - 3], + (void *) ctxt->pushTab[ctxt->nameNr * 3 - 2], 0, + (int) (ptrdiff_t) + ctxt->pushTab[ctxt->nameNr * 3 - 1], 0); nameNsPop(ctxt); } #ifdef LIBXML_SAX1_ENABLED diff --git a/parserInternals.c b/parserInternals.c index 43a0f5a..efb2387 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -10,7 +10,7 @@ #define IN_LIBXML #include "libxml.h" -#if defined(WIN32) && !defined (__CYGWIN__) +#if defined(_WIN32) && !defined (__CYGWIN__) #define XML_DIR_SEP '\\' #else #define XML_DIR_SEP '/' diff --git a/python/setup.py b/python/setup.py index 8ff56c2..f9583a5 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.9.6", + version = "2.9.7", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/relaxng.c b/relaxng.c index 3d3e69c..b12e1ae 100644 --- a/relaxng.c +++ b/relaxng.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -4404,7 +4405,7 @@ xmlRelaxNGComputeInterleaves(xmlRelaxNGDefinePtr def, if ((*tmp)->type == XML_RELAXNG_TEXT) { res = xmlHashAddEntry2(partitions->triage, BAD_CAST "#text", NULL, - (void *) (long) (i + 1)); + (void *) (ptrdiff_t) (i + 1)); if (res != 0) is_determinist = -1; } else if (((*tmp)->type == XML_RELAXNG_ELEMENT) && @@ -4412,22 +4413,22 @@ xmlRelaxNGComputeInterleaves(xmlRelaxNGDefinePtr def, if (((*tmp)->ns == NULL) || ((*tmp)->ns[0] == 0)) res = xmlHashAddEntry2(partitions->triage, (*tmp)->name, NULL, - (void *) (long) (i + 1)); + (void *) (ptrdiff_t) (i + 1)); else res = xmlHashAddEntry2(partitions->triage, (*tmp)->name, (*tmp)->ns, - (void *) (long) (i + 1)); + (void *) (ptrdiff_t) (i + 1)); if (res != 0) is_determinist = -1; } else if ((*tmp)->type == XML_RELAXNG_ELEMENT) { if (((*tmp)->ns == NULL) || ((*tmp)->ns[0] == 0)) res = xmlHashAddEntry2(partitions->triage, BAD_CAST "#any", NULL, - (void *) (long) (i + 1)); + (void *) (ptrdiff_t) (i + 1)); else res = xmlHashAddEntry2(partitions->triage, BAD_CAST "#any", (*tmp)->ns, - (void *) (long) (i + 1)); + (void *) (ptrdiff_t) (i + 1)); if ((*tmp)->nameClass != NULL) is_determinist = 2; if (res != 0) @@ -8890,7 +8891,7 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt, if (ret != 0) { break; } - /* no break on purpose */ + /* Falls through. */ case XML_RELAXNG_ZEROORMORE:{ xmlChar *cur, *temp; @@ -9387,7 +9388,7 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt, if (tmp == NULL) { i = nbgroups; } else { - i = ((long) tmp) - 1; + i = ((ptrdiff_t) tmp) - 1; if (partitions->flags & IS_NEEDCHECK) { group = partitions->groups[i]; if (!xmlRelaxNGNodeMatchesList(cur, group->defs)) @@ -10167,7 +10168,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt, } if (ctxt->errNr > errNr) xmlRelaxNGPopErrors(ctxt, errNr); - /* no break on purpose */ + /* Falls through. */ case XML_RELAXNG_ZEROORMORE:{ int progress; xmlRelaxNGStatesPtr states = NULL, res = NULL; diff --git a/result/XPath/tests/strbase b/result/XPath/tests/strbase new file mode 100644 index 0000000..e6035ca --- /dev/null +++ b/result/XPath/tests/strbase @@ -0,0 +1,13 @@ + +======================== +Expression: //p[.='abc'] +Object is a Node Set : +Set contains 2 nodes: +1 ELEMENT p + ATTRIBUTE id + TEXT + content=1 +2 ELEMENT p + ATTRIBUTE id + TEXT + content=2 diff --git a/runtest.c b/runtest.c index 714de27..6201a66 100644 --- a/runtest.c +++ b/runtest.c @@ -119,8 +119,8 @@ typedef struct } glob_t; #define GLOB_DOOFFS 0 -static int glob(const char *pattern, int flags, - int errfunc(const char *epath, int eerrno), +static int glob(const char *pattern, ATTRIBUTE_UNUSED int flags, + ATTRIBUTE_UNUSED int errfunc(const char *epath, int eerrno), glob_t *pglob) { glob_t *ret; WIN32_FIND_DATA FindFileData; @@ -3951,19 +3951,23 @@ c14n11WithoutCommentTest(const char *filename, */ #define MAX_ARGC 20 +typedef struct { + const char *filename; + int okay; +} xmlThreadParams; + static const char *catalog = "test/threads/complex.xml"; -static const char *testfiles[] = { - "test/threads/abc.xml", - "test/threads/acb.xml", - "test/threads/bac.xml", - "test/threads/bca.xml", - "test/threads/cab.xml", - "test/threads/cba.xml", - "test/threads/invalid.xml", +static xmlThreadParams threadParams[] = { + { "test/threads/abc.xml", 0 }, + { "test/threads/acb.xml", 0 }, + { "test/threads/bac.xml", 0 }, + { "test/threads/bca.xml", 0 }, + { "test/threads/cab.xml", 0 }, + { "test/threads/cba.xml", 0 }, + { "test/threads/invalid.xml", 0 } }; - -static const char *Okay = "OK"; -static const char *Failed = "Failed"; +static const unsigned int num_threads = sizeof(threadParams) / + sizeof(threadParams[0]); #ifndef xmlDoValidityCheckingDefaultValue #error xmlDoValidityCheckingDefaultValue is not a macro @@ -3976,7 +3980,8 @@ static void * thread_specific_data(void *private_data) { xmlDocPtr myDoc; - const char *filename = (const char *) private_data; + xmlThreadParams *params = (xmlThreadParams *) private_data; + const char *filename = params->filename; int okay = 1; if (!strcmp(filename, "test/threads/invalid.xml")) { @@ -4016,12 +4021,11 @@ thread_specific_data(void *private_data) okay = 0; } } - if (okay == 0) - return ((void *) Failed); - return ((void *) Okay); + params->okay = okay; + return(NULL); } -#if defined WIN32 +#if defined(_WIN32) && !defined(__CYGWIN__) #include #include @@ -4032,15 +4036,14 @@ static HANDLE tid[MAX_ARGC]; static DWORD WINAPI win32_thread_specific_data(void *private_data) { - return((DWORD) thread_specific_data(private_data)); + thread_specific_data(private_data); + return(0); } static int testThread(void) { unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - DWORD results[MAX_ARGC]; BOOL ret; int res = 0; @@ -4050,7 +4053,6 @@ testThread(void) nb_tests++; for (i = 0; i < num_threads; i++) { - results[i] = 0; tid[i] = (HANDLE) - 1; } @@ -4059,7 +4061,7 @@ testThread(void) tid[i] = CreateThread(NULL, 0, win32_thread_specific_data, - (void *) testfiles[i], 0, + (void *) &threadParams[i], 0, &useless); if (tid[i] == NULL) { fprintf(stderr, "CreateThread failed\n"); @@ -4074,7 +4076,8 @@ testThread(void) } for (i = 0; i < num_threads; i++) { - ret = GetExitCodeThread(tid[i], &results[i]); + DWORD exitCode; + ret = GetExitCodeThread(tid[i], &exitCode); if (ret == 0) { fprintf(stderr, "GetExitCodeThread failed\n"); return(1); @@ -4084,9 +4087,9 @@ testThread(void) xmlCatalogCleanup(); for (i = 0; i < num_threads; i++) { - if (results[i] != (DWORD) Okay) { + if (threadParams[i].okay == 0) { fprintf(stderr, "Thread %d handling %s failed\n", - i, testfiles[i]); + i, threadParams[i].filename); res = 1; } } @@ -4104,8 +4107,6 @@ static int testThread(void) { unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - void *results[MAX_ARGC]; status_t ret; int res = 0; @@ -4113,13 +4114,12 @@ testThread(void) for (repeat = 0; repeat < 500; repeat++) { xmlLoadCatalog(catalog); for (i = 0; i < num_threads; i++) { - results[i] = NULL; tid[i] = (thread_id) - 1; } for (i = 0; i < num_threads; i++) { tid[i] = spawn_thread(thread_specific_data, "xmlTestThread", - B_NORMAL_PRIORITY, (void *) testfiles[i]); + B_NORMAL_PRIORITY, (void *) &threadParams[i]); if (tid[i] < B_OK) { fprintf(stderr, "beos_thread_create failed\n"); return (1); @@ -4127,7 +4127,8 @@ testThread(void) printf("beos_thread_create %d -> %d\n", i, tid[i]); } for (i = 0; i < num_threads; i++) { - ret = wait_for_thread(tid[i], &results[i]); + void *result; + ret = wait_for_thread(tid[i], &result); printf("beos_thread_wait %d -> %d\n", i, ret); if (ret != B_OK) { fprintf(stderr, "beos_thread_wait failed\n"); @@ -4138,8 +4139,9 @@ testThread(void) xmlCatalogCleanup(); ret = B_OK; for (i = 0; i < num_threads; i++) - if (results[i] != (void *) Okay) { - printf("Thread %d handling %s failed\n", i, testfiles[i]); + if (threadParams[i].okay == 0) { + printf("Thread %d handling %s failed\n", i, + threadParams[i].filename); ret = B_ERROR; } } @@ -4157,8 +4159,6 @@ static int testThread(void) { unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - void *results[MAX_ARGC]; int ret; int res = 0; @@ -4169,20 +4169,20 @@ testThread(void) nb_tests++; for (i = 0; i < num_threads; i++) { - results[i] = NULL; tid[i] = (pthread_t) - 1; } for (i = 0; i < num_threads; i++) { ret = pthread_create(&tid[i], 0, thread_specific_data, - (void *) testfiles[i]); + (void *) &threadParams[i]); if (ret != 0) { fprintf(stderr, "pthread_create failed\n"); return (1); } } for (i = 0; i < num_threads; i++) { - ret = pthread_join(tid[i], &results[i]); + void *result; + ret = pthread_join(tid[i], &result); if (ret != 0) { fprintf(stderr, "pthread_join failed\n"); return (1); @@ -4191,9 +4191,9 @@ testThread(void) xmlCatalogCleanup(); for (i = 0; i < num_threads; i++) - if (results[i] != (void *) Okay) { + if (threadParams[i].okay == 0) { fprintf(stderr, "Thread %d handling %s failed\n", - i, testfiles[i]); + i, threadParams[i].filename); res = 1; } } @@ -4523,6 +4523,11 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { int i, a, ret = 0; int subset = 0; +#if defined(_WIN32) && !defined(__CYGWIN__) + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); +#endif + initializeLibxml2(); for (a = 1; a < argc;a++) { diff --git a/test/XPath/docs/str b/test/XPath/docs/str index 547e54d..449de01 100644 --- a/test/XPath/docs/str +++ b/test/XPath/docs/str @@ -6,4 +6,6 @@

        a span

        n

        ing one

        and an unbal

        anced test

        for empty string 123

        +

        abc

        +

        abc

        diff --git a/test/XPath/tests/strbase b/test/XPath/tests/strbase new file mode 100644 index 0000000..b818325 --- /dev/null +++ b/test/XPath/tests/strbase @@ -0,0 +1 @@ +//p[.='abc'] diff --git a/testrecurse.c b/testrecurse.c index e5d5d1b..f95ae1c 100644 --- a/testrecurse.c +++ b/testrecurse.c @@ -69,8 +69,8 @@ typedef struct } glob_t; #define GLOB_DOOFFS 0 -static int glob(const char *pattern, int flags, - int errfunc(const char *epath, int eerrno), +static int glob(const char *pattern, ATTRIBUTE_UNUSED int flags, + ATTRIBUTE_UNUSED int errfunc(const char *epath, int eerrno), glob_t *pglob) { glob_t *ret; WIN32_FIND_DATA FindFileData; diff --git a/threads.c b/threads.c index e52f263..bca4954 100644 --- a/threads.c +++ b/threads.c @@ -27,6 +27,7 @@ #ifdef HAVE_PTHREAD_H #include #elif defined HAVE_WIN32_THREADS +#define WIN32_LEAN_AND_MEAN #include #ifndef HAVE_COMPILER_TLS #include @@ -138,7 +139,7 @@ static DWORD globalkey = TLS_OUT_OF_INDEXES; static DWORD mainthread; static struct { DWORD done; - DWORD control; + LONG control; } run_once = { 0, 0}; static volatile LPCRITICAL_SECTION global_init_lock = NULL; @@ -438,7 +439,8 @@ __xmlGlobalInitMutexLock(void) /* Swap it into the global_init_lock */ #ifdef InterlockedCompareExchangePointer - InterlockedCompareExchangePointer(&global_init_lock, cs, NULL); + InterlockedCompareExchangePointer((void **) &global_init_lock, + cs, NULL); #else /* Use older void* version */ InterlockedCompareExchange((void **) &global_init_lock, (void *) cs, NULL); @@ -979,11 +981,23 @@ xmlOnceInit(void) #ifdef HAVE_PTHREAD_H #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) #if defined(LIBXML_STATIC_FOR_DLL) -BOOL XMLCALL -xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +int XMLCALL +xmlDllMain(ATTRIBUTE_UNUSED void *hinstDLL, unsigned long fdwReason, + ATTRIBUTE_UNUSED void *lpvReserved) #else +/* declare to avoid "no previous prototype for 'DllMain'" warning */ +/* Note that we do NOT want to include this function declaration in + a public header because it's meant to be called by Windows itself, + not a program that uses this library. This also has to be exported. */ + +XMLPUBFUN BOOL WINAPI +DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved); + BOOL WINAPI -DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +DllMain(ATTRIBUTE_UNUSED HINSTANCE hinstDLL, DWORD fdwReason, + ATTRIBUTE_UNUSED LPVOID lpvReserved) #endif { switch (fdwReason) { diff --git a/timsort.h b/timsort.h index 19aebf2..0c6346b 100644 --- a/timsort.h +++ b/timsort.h @@ -1,312 +1,350 @@ /* - * taken from https://github.com/swenson/sort - * Kept as is for the moment to be able to apply upstream patches for that - * code, currently used only to speed up XPath node sorting, see xpath.c + * Taken from https://github.com/swenson/sort + * Revision: 05fd77bfec049ce8b7c408c4d3dd2d51ee061a15 + * Removed all code unrelated to Timsort and made minor adjustments for + * cross-platform compatibility. */ /* - * All code in this header, unless otherwise specified, is hereby licensed under the MIT Public License: - -Copyright (c) 2010 Christopher Swenson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + * The MIT License (MIT) + * + * Copyright (c) 2010-2017 Christopher Swenson. + * Copyright (c) 2012 Vojtech Fried. + * Copyright (c) 2012 Google Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ #include #include #include #ifdef HAVE_STDINT_H #include -#else -#ifdef HAVE_INTTYPES_H -#include -#elif defined(WIN32) -typedef __int64 int64_t; +#elif defined(_WIN32) typedef unsigned __int64 uint64_t; #endif + +#ifndef SORT_NAME +#error "Must declare SORT_NAME" #endif -#ifndef MK_UINT64 -#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300 -#define MK_UINT64(x) ((uint64_t)(x)) -#else -#define MK_UINT64(x) x##ULL +#ifndef SORT_TYPE +#error "Must declare SORT_TYPE" #endif + +#ifndef SORT_CMP +#define SORT_CMP(x, y) ((x) < (y) ? -1 : ((x) == (y) ? 0 : 1)) #endif +#ifndef TIM_SORT_STACK_SIZE +#define TIM_SORT_STACK_SIZE 128 +#endif + +#define SORT_SWAP(x,y) {SORT_TYPE __SORT_SWAP_t = (x); (x) = (y); (y) = __SORT_SWAP_t;} + + +/* Common, type-agnosting functions and constants that we don't want to declare twice. */ +#ifndef SORT_COMMON_H +#define SORT_COMMON_H + #ifndef MAX #define MAX(x,y) (((x) > (y) ? (x) : (y))) #endif + #ifndef MIN #define MIN(x,y) (((x) < (y) ? (x) : (y))) #endif -int compute_minrun(uint64_t); +static int compute_minrun(const uint64_t); #ifndef CLZ -#if defined(__GNUC__) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3)) +#ifdef __GNUC__ #define CLZ __builtin_clzll #else -int clzll(uint64_t); +static int clzll(uint64_t); /* adapted from Hacker's Delight */ -int clzll(uint64_t x) /* {{{ */ -{ +static int clzll(uint64_t x) { int n; - if (x == 0) return(64); + if (x == 0) { + return 64; + } + n = 0; - if (x <= MK_UINT64(0x00000000FFFFFFFF)) {n = n + 32; x = x << 32;} - if (x <= MK_UINT64(0x0000FFFFFFFFFFFF)) {n = n + 16; x = x << 16;} - if (x <= MK_UINT64(0x00FFFFFFFFFFFFFF)) {n = n + 8; x = x << 8;} - if (x <= MK_UINT64(0x0FFFFFFFFFFFFFFF)) {n = n + 4; x = x << 4;} - if (x <= MK_UINT64(0x3FFFFFFFFFFFFFFF)) {n = n + 2; x = x << 2;} - if (x <= MK_UINT64(0x7FFFFFFFFFFFFFFF)) {n = n + 1;} + + if (x <= 0x00000000FFFFFFFFL) { + n = n + 32; + x = x << 32; + } + + if (x <= 0x0000FFFFFFFFFFFFL) { + n = n + 16; + x = x << 16; + } + + if (x <= 0x00FFFFFFFFFFFFFFL) { + n = n + 8; + x = x << 8; + } + + if (x <= 0x0FFFFFFFFFFFFFFFL) { + n = n + 4; + x = x << 4; + } + + if (x <= 0x3FFFFFFFFFFFFFFFL) { + n = n + 2; + x = x << 2; + } + + if (x <= 0x7FFFFFFFFFFFFFFFL) { + n = n + 1; + } + return n; } -/* }}} */ #define CLZ clzll #endif #endif -int compute_minrun(uint64_t size) /* {{{ */ -{ +static __inline int compute_minrun(const uint64_t size) { const int top_bit = 64 - CLZ(size); const int shift = MAX(top_bit, 6) - 6; const int minrun = size >> shift; - const uint64_t mask = (MK_UINT64(1) << shift) - 1; - if (mask & size) return minrun + 1; - return minrun; -} -/* }}} */ - -#ifndef SORT_NAME -#error "Must declare SORT_NAME" -#endif + const uint64_t mask = (1ULL << shift) - 1; -#ifndef SORT_TYPE -#error "Must declare SORT_TYPE" -#endif - -#ifndef SORT_CMP -#define SORT_CMP(x, y) ((x) < (y) ? -1 : ((x) == (y) ? 0 : 1)) -#endif + if (mask & size) { + return minrun + 1; + } + return minrun; +} -#define SORT_SWAP(x,y) {SORT_TYPE __SORT_SWAP_t = (x); (x) = (y); (y) = __SORT_SWAP_t;} +#endif /* SORT_COMMON_H */ #define SORT_CONCAT(x, y) x ## _ ## y #define SORT_MAKE_STR1(x, y) SORT_CONCAT(x,y) #define SORT_MAKE_STR(x) SORT_MAKE_STR1(SORT_NAME,x) -#define BINARY_INSERTION_FIND SORT_MAKE_STR(binary_insertion_find) -#define BINARY_INSERTION_SORT_START SORT_MAKE_STR(binary_insertion_sort_start) -#define BINARY_INSERTION_SORT SORT_MAKE_STR(binary_insertion_sort) -#define REVERSE_ELEMENTS SORT_MAKE_STR(reverse_elements) -#define COUNT_RUN SORT_MAKE_STR(count_run) -#define CHECK_INVARIANT SORT_MAKE_STR(check_invariant) -#define TIM_SORT SORT_MAKE_STR(tim_sort) -#define TIM_SORT_RESIZE SORT_MAKE_STR(tim_sort_resize) -#define TIM_SORT_MERGE SORT_MAKE_STR(tim_sort_merge) -#define TIM_SORT_COLLAPSE SORT_MAKE_STR(tim_sort_collapse) +#define BINARY_INSERTION_FIND SORT_MAKE_STR(binary_insertion_find) +#define BINARY_INSERTION_SORT_START SORT_MAKE_STR(binary_insertion_sort_start) +#define BINARY_INSERTION_SORT SORT_MAKE_STR(binary_insertion_sort) +#define REVERSE_ELEMENTS SORT_MAKE_STR(reverse_elements) +#define COUNT_RUN SORT_MAKE_STR(count_run) +#define CHECK_INVARIANT SORT_MAKE_STR(check_invariant) +#define TIM_SORT SORT_MAKE_STR(tim_sort) +#define TIM_SORT_RESIZE SORT_MAKE_STR(tim_sort_resize) +#define TIM_SORT_MERGE SORT_MAKE_STR(tim_sort_merge) +#define TIM_SORT_COLLAPSE SORT_MAKE_STR(tim_sort_collapse) -#define TIM_SORT_RUN_T SORT_MAKE_STR(tim_sort_run_t) -#define TEMP_STORAGE_T SORT_MAKE_STR(temp_storage_t) +#ifndef MAX +#define MAX(x,y) (((x) > (y) ? (x) : (y))) +#endif +#ifndef MIN +#define MIN(x,y) (((x) < (y) ? (x) : (y))) +#endif typedef struct { - int64_t start; - int64_t length; + size_t start; + size_t length; } TIM_SORT_RUN_T; + void BINARY_INSERTION_SORT(SORT_TYPE *dst, const size_t size); void TIM_SORT(SORT_TYPE *dst, const size_t size); + /* Function used to do a binary search for binary insertion sort */ -static int64_t BINARY_INSERTION_FIND(SORT_TYPE *dst, const SORT_TYPE x, const size_t size) -{ - int64_t l, c, r; - SORT_TYPE lx; +static __inline size_t BINARY_INSERTION_FIND(SORT_TYPE *dst, const SORT_TYPE x, + const size_t size) { + size_t l, c, r; SORT_TYPE cx; l = 0; r = size - 1; c = r >> 1; - lx = dst[l]; - /* check for beginning conditions */ - if (SORT_CMP(x, lx) < 0) + /* check for out of bounds at the beginning. */ + if (SORT_CMP(x, dst[0]) < 0) { return 0; - else if (SORT_CMP(x, lx) == 0) - { - int64_t i = 1; - while (SORT_CMP(x, dst[i]) == 0) i++; - return i; + } else if (SORT_CMP(x, dst[r]) > 0) { + return r; } cx = dst[c]; - while (1) - { + + while (1) { const int val = SORT_CMP(x, cx); - if (val < 0) - { - if (c - l <= 1) return c; + + if (val < 0) { + if (c - l <= 1) { + return c; + } + r = c; - } - else if (val > 0) - { - if (r - c <= 1) return c + 1; + } else { /* allow = for stability. The binary search favors the right. */ + if (r - c <= 1) { + return c + 1; + } + l = c; - lx = cx; - } - else - { - do - { - cx = dst[++c]; - } while (SORT_CMP(x, cx) == 0); - return c; } + c = l + ((r - l) >> 1); cx = dst[c]; } } /* Binary insertion sort, but knowing that the first "start" entries are sorted. Used in timsort. */ -static void BINARY_INSERTION_SORT_START(SORT_TYPE *dst, const size_t start, const size_t size) -{ - int64_t i; - for (i = start; i < (int64_t) size; i++) - { - int64_t j; +static void BINARY_INSERTION_SORT_START(SORT_TYPE *dst, const size_t start, const size_t size) { + size_t i; + + for (i = start; i < size; i++) { + size_t j; SORT_TYPE x; - int64_t location; + size_t location; + /* If this entry is already correct, just move along */ - if (SORT_CMP(dst[i - 1], dst[i]) <= 0) continue; + if (SORT_CMP(dst[i - 1], dst[i]) <= 0) { + continue; + } /* Else we need to find the right place, shift everything over, and squeeze in */ x = dst[i]; location = BINARY_INSERTION_FIND(dst, x, i); - for (j = i - 1; j >= location; j--) - { + + for (j = i - 1; j >= location; j--) { dst[j + 1] = dst[j]; + + if (j == 0) { /* check edge case because j is unsigned */ + break; + } } + dst[location] = x; } } /* Binary insertion sort */ -void BINARY_INSERTION_SORT(SORT_TYPE *dst, const size_t size) -{ +void BINARY_INSERTION_SORT(SORT_TYPE *dst, const size_t size) { + /* don't bother sorting an array of size <= 1 */ + if (size <= 1) { + return; + } + BINARY_INSERTION_SORT_START(dst, 1, size); } /* timsort implementation, based on timsort.txt */ -static void REVERSE_ELEMENTS(SORT_TYPE *dst, int64_t start, int64_t end) -{ - while (1) - { - if (start >= end) return; +static __inline void REVERSE_ELEMENTS(SORT_TYPE *dst, size_t start, size_t end) { + while (1) { + if (start >= end) { + return; + } + SORT_SWAP(dst[start], dst[end]); start++; end--; } } -static int64_t COUNT_RUN(SORT_TYPE *dst, const int64_t start, const size_t size) -{ - int64_t curr; - if (size - start == 1) return 1; - if (start >= (int64_t) size - 2) - { - if (SORT_CMP(dst[size - 2], dst[size - 1]) > 0) +static size_t COUNT_RUN(SORT_TYPE *dst, const size_t start, const size_t size) { + size_t curr; + + if (size - start == 1) { + return 1; + } + + if (start >= size - 2) { + if (SORT_CMP(dst[size - 2], dst[size - 1]) > 0) { SORT_SWAP(dst[size - 2], dst[size - 1]); + } + return 2; } curr = start + 2; - if (SORT_CMP(dst[start], dst[start + 1]) <= 0) - { + if (SORT_CMP(dst[start], dst[start + 1]) <= 0) { /* increasing run */ - while (1) - { - if (curr == (int64_t) size - 1) break; - if (SORT_CMP(dst[curr - 1], dst[curr]) > 0) break; + while (1) { + if (curr == size - 1) { + break; + } + + if (SORT_CMP(dst[curr - 1], dst[curr]) > 0) { + break; + } + curr++; } + return curr - start; - } - else - { + } else { /* decreasing run */ - while (1) - { - if (curr == (int64_t) size - 1) break; - if (SORT_CMP(dst[curr - 1], dst[curr]) <= 0) break; + while (1) { + if (curr == size - 1) { + break; + } + + if (SORT_CMP(dst[curr - 1], dst[curr]) <= 0) { + break; + } + curr++; } + /* reverse in-place */ REVERSE_ELEMENTS(dst, start, curr - 1); return curr - start; } } -#define PUSH_NEXT() do {\ -len = COUNT_RUN(dst, curr, size);\ -run = minrun;\ -if (run < minrun) run = minrun;\ -if (run > (int64_t) size - curr) run = size - curr;\ -if (run > len)\ -{\ - BINARY_INSERTION_SORT_START(&dst[curr], len, run);\ - len = run;\ -}\ -{\ -run_stack[stack_curr].start = curr;\ -run_stack[stack_curr].length = len;\ -stack_curr++;\ -}\ -curr += len;\ -if (curr == (int64_t) size)\ -{\ - /* finish up */ \ - while (stack_curr > 1) \ - { \ - TIM_SORT_MERGE(dst, run_stack, stack_curr, store); \ - run_stack[stack_curr - 2].length += run_stack[stack_curr - 1].length; \ - stack_curr--; \ - } \ - if (store->storage != NULL)\ - {\ - free(store->storage);\ - store->storage = NULL;\ - }\ - return;\ -}\ -}\ -while (0) - -static int CHECK_INVARIANT(TIM_SORT_RUN_T *stack, const int stack_curr) -{ - int64_t A, B, C; - if (stack_curr < 2) return 1; - if (stack_curr == 2) - { - const int64_t A1 = stack[stack_curr - 2].length; - const int64_t B1 = stack[stack_curr - 1].length; - if (A1 <= B1) return 0; +static int CHECK_INVARIANT(TIM_SORT_RUN_T *stack, const int stack_curr) { + size_t A, B, C; + + if (stack_curr < 2) { return 1; } + + if (stack_curr == 2) { + const size_t A1 = stack[stack_curr - 2].length; + const size_t B1 = stack[stack_curr - 1].length; + + if (A1 <= B1) { + return 0; + } + + return 1; + } + A = stack[stack_curr - 3].length; B = stack[stack_curr - 2].length; C = stack[stack_curr - 1].length; - if ((A <= B + C) || (B <= C)) return 0; + + if ((A <= B + C) || (B <= C)) { + return 0; + } + return 1; } @@ -315,85 +353,77 @@ typedef struct { SORT_TYPE *storage; } TEMP_STORAGE_T; - -static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size) -{ - if (store->alloc < new_size) - { +static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size) { + if (store->alloc < new_size) { SORT_TYPE *tempstore = (SORT_TYPE *)realloc(store->storage, new_size * sizeof(SORT_TYPE)); - if (tempstore == NULL) - { - fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes", (unsigned long) (sizeof(SORT_TYPE) * new_size)); + + if (tempstore == NULL) { + fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes", + (unsigned long)(sizeof(SORT_TYPE) * new_size)); exit(1); } + store->storage = tempstore; store->alloc = new_size; } } -static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr, TEMP_STORAGE_T *store) -{ - const int64_t A = stack[stack_curr - 2].length; - const int64_t B = stack[stack_curr - 1].length; - const int64_t curr = stack[stack_curr - 2].start; +static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr, + TEMP_STORAGE_T *store) { + const size_t A = stack[stack_curr - 2].length; + const size_t B = stack[stack_curr - 1].length; + const size_t curr = stack[stack_curr - 2].start; SORT_TYPE *storage; - int64_t i, j, k; - + size_t i, j, k; TIM_SORT_RESIZE(store, MIN(A, B)); storage = store->storage; /* left merge */ - if (A < B) - { + if (A < B) { memcpy(storage, &dst[curr], A * sizeof(SORT_TYPE)); i = 0; j = curr + A; - for (k = curr; k < curr + A + B; k++) - { - if ((i < A) && (j < curr + A + B)) - { - if (SORT_CMP(storage[i], dst[j]) <= 0) + for (k = curr; k < curr + A + B; k++) { + if ((i < A) && (j < curr + A + B)) { + if (SORT_CMP(storage[i], dst[j]) <= 0) { dst[k] = storage[i++]; - else + } else { dst[k] = dst[j++]; - } - else if (i < A) - { + } + } else if (i < A) { dst[k] = storage[i++]; + } else { + break; } - else - dst[k] = dst[j++]; } - } - /* right merge */ - else - { + } else { + /* right merge */ memcpy(storage, &dst[curr + A], B * sizeof(SORT_TYPE)); - i = B - 1; - j = curr + A - 1; - - for (k = curr + A + B - 1; k >= curr; k--) - { - if ((i >= 0) && (j >= curr)) - { - if (SORT_CMP(dst[j], storage[i]) > 0) - dst[k] = dst[j--]; - else - dst[k] = storage[i--]; + i = B; + j = curr + A; + k = curr + A + B; + + while (k-- > curr) { + if ((i > 0) && (j > curr)) { + if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) { + dst[k] = dst[--j]; + } else { + dst[k] = storage[--i]; + } + } else if (i > 0) { + dst[k] = storage[--i]; + } else { + break; } - else if (i >= 0) - dst[k] = storage[i--]; - else - dst[k] = dst[j--]; } } } -static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_curr, TEMP_STORAGE_T *store, const size_t size) -{ +static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_curr, + TEMP_STORAGE_T *store, const size_t size) { while (1) { - int64_t A, B, C, D; + size_t A, B, C, D; int ABC, BCD, CD; /* if the stack only has one thing on it, we are done with the collapse */ @@ -454,41 +484,94 @@ static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_cu return stack_curr; } -void TIM_SORT(SORT_TYPE *dst, const size_t size) -{ - int minrun; +static __inline int PUSH_NEXT(SORT_TYPE *dst, + const size_t size, + TEMP_STORAGE_T *store, + const size_t minrun, + TIM_SORT_RUN_T *run_stack, + size_t *stack_curr, + size_t *curr) { + size_t len = COUNT_RUN(dst, *curr, size); + size_t run = minrun; + + if (run > size - *curr) { + run = size - *curr; + } + + if (run > len) { + BINARY_INSERTION_SORT_START(&dst[*curr], len, run); + len = run; + } + + run_stack[*stack_curr].start = *curr; + run_stack[*stack_curr].length = len; + (*stack_curr)++; + *curr += len; + + if (*curr == size) { + /* finish up */ + while (*stack_curr > 1) { + TIM_SORT_MERGE(dst, run_stack, *stack_curr, store); + run_stack[*stack_curr - 2].length += run_stack[*stack_curr - 1].length; + (*stack_curr)--; + } + + if (store->storage != NULL) { + free(store->storage); + store->storage = NULL; + } + + return 0; + } + + return 1; +} + +void TIM_SORT(SORT_TYPE *dst, const size_t size) { + size_t minrun; TEMP_STORAGE_T _store, *store; - TIM_SORT_RUN_T run_stack[128]; - int stack_curr = 0; - int64_t len, run; - int64_t curr = 0; + TIM_SORT_RUN_T run_stack[TIM_SORT_STACK_SIZE]; + size_t stack_curr = 0; + size_t curr = 0; - if (size < 64) - { + /* don't bother sorting an array of size 1 */ + if (size <= 1) { + return; + } + + if (size < 64) { BINARY_INSERTION_SORT(dst, size); return; } /* compute the minimum run length */ minrun = compute_minrun(size); - /* temporary storage for merges */ store = &_store; store->alloc = 0; store->storage = NULL; - PUSH_NEXT(); - PUSH_NEXT(); - PUSH_NEXT(); + if (!PUSH_NEXT(dst, size, store, minrun, run_stack, &stack_curr, &curr)) { + return; + } + + if (!PUSH_NEXT(dst, size, store, minrun, run_stack, &stack_curr, &curr)) { + return; + } - while (1) - { - if (!CHECK_INVARIANT(run_stack, stack_curr)) - { + if (!PUSH_NEXT(dst, size, store, minrun, run_stack, &stack_curr, &curr)) { + return; + } + + while (1) { + if (!CHECK_INVARIANT(run_stack, stack_curr)) { stack_curr = TIM_SORT_COLLAPSE(dst, run_stack, stack_curr, store, size); continue; } - PUSH_NEXT(); + + if (!PUSH_NEXT(dst, size, store, minrun, run_stack, &stack_curr, &curr)) { + return; + } } } diff --git a/tree.c b/tree.c index 2536442..86a8da7 100644 --- a/tree.c +++ b/tree.c @@ -19,6 +19,7 @@ #include "libxml.h" #include /* for memset() only ! */ +#include #include #ifdef HAVE_CTYPE_H #include @@ -4605,7 +4606,7 @@ xmlGetLineNoInternal(const xmlNode *node, int depth) (node->type == XML_PI_NODE)) { if (node->line == 65535) { if ((node->type == XML_TEXT_NODE) && (node->psvi != NULL)) - result = (long) node->psvi; + result = (long) (ptrdiff_t) node->psvi; else if ((node->type == XML_ELEMENT_NODE) && (node->children != NULL)) result = xmlGetLineNoInternal(node->children, depth + 1); @@ -8258,7 +8259,7 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc, ns = ns->next; } while (ns != NULL); } - /* No break on purpose. */ + /* Falls through. */ case XML_ATTRIBUTE_NODE: if (node->ns != NULL) { /* @@ -8849,7 +8850,7 @@ next_ns_decl: } if (! adoptns) goto ns_end; - /* No break on purpose. */ + /* Falls through. */ case XML_ATTRIBUTE_NODE: /* No ns, no fun. */ if (cur->ns == NULL) @@ -9130,7 +9131,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, goto internal_error; } } - /* No break on purpose. */ + /* Falls through. */ case XML_ATTRIBUTE_NODE: /* No namespace, no fun. */ if (cur->ns == NULL) diff --git a/uri.c b/uri.c index 62bedd1..84e420a 100644 --- a/uri.c +++ b/uri.c @@ -2394,8 +2394,7 @@ xmlCanonicPath(const xmlChar *path) */ #if defined(_WIN32) && !defined(__CYGWIN__) int len = 0; - int i = 0; - xmlChar *p = NULL; + char *p = NULL; #endif xmlURIPtr uri; xmlChar *ret; @@ -2477,7 +2476,7 @@ path_processing: len = xmlStrlen(path); if ((len > 2) && IS_WINDOWS_PATH(path)) { /* make the scheme 'file' */ - uri->scheme = xmlStrdup(BAD_CAST "file"); + uri->scheme = (char *) xmlStrdup(BAD_CAST "file"); /* allocate space for leading '/' + path + string terminator */ uri->path = xmlMallocAtomic(len + 2); if (uri->path == NULL) { @@ -2487,9 +2486,9 @@ path_processing: /* Put in leading '/' plus path */ uri->path[0] = '/'; p = uri->path + 1; - strncpy(p, path, len + 1); + strncpy(p, (char *) path, len + 1); } else { - uri->path = xmlStrdup(path); + uri->path = (char *) xmlStrdup(path); if (uri->path == NULL) { xmlFreeURI(uri); return(NULL); diff --git a/valid.c b/valid.c index 59a17c6..a64b96b 100644 --- a/valid.c +++ b/valid.c @@ -5190,6 +5190,7 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) { case XML_TEXT_NODE: if (xmlIsBlankNode(cur)) break; + /* Falls through. */ case XML_CDATA_SECTION_NODE: case XML_ENTITY_REF_NODE: strcat(buf, "CDATA"); diff --git a/win32/Makefile.mingw b/win32/Makefile.mingw index 1889376..f579923 100644 --- a/win32/Makefile.mingw +++ b/win32/Makefile.mingw @@ -71,11 +71,9 @@ LDFLAGS += -Wl,--minor-image-version,$(LIBXML_MINOR_VERSION) LDFLAGS += -Wl,-L,$(BINDIR) -Wl,-L,$(LIBPREFIX) LIBS = ifeq ($(WITH_FTP),1) -CFLAGS += -D_WINSOCKAPI_ LIBS += -lwsock32 -lws2_32 endif ifeq ($(WITH_HTTP),1) -CFLAGS += -D_WINSOCKAPI_ LIBS += -lwsock32 -lws2_32 endif ifeq ($(WITH_ICONV),1) diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc index d16c1a2..115a451 100644 --- a/win32/Makefile.msvc +++ b/win32/Makefile.msvc @@ -43,7 +43,7 @@ CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT" # The compiler and its options. CC = cl.exe -CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W1 $(CRUNTIME) +CFLAGS = /nologo /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W3 /wd4244 /wd4267 $(CRUNTIME) CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX) !if "$(WITH_THREADS)" != "no" CFLAGS = $(CFLAGS) /D "_REENTRANT" diff --git a/win32/VC10/config.h b/win32/VC10/config.h index 891b57e..4e184a3 100644 --- a/win32/VC10/config.h +++ b/win32/VC10/config.h @@ -9,7 +9,6 @@ #if defined(_WIN32_WCE) #undef HAVE_ERRNO_H -#include #include "wincecompat.h" #else #define HAVE_SYS_STAT_H @@ -28,10 +27,6 @@ #define ICONV_CONST const #endif -#ifdef NEED_SOCKETS -#include -#endif - /* * Windows platforms may define except */ diff --git a/xmlIO.c b/xmlIO.c index 6891ff9..0fd8c49 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -12,6 +12,7 @@ #include "libxml.h" #include +#include #ifdef HAVE_ERRNO_H #include #endif @@ -39,7 +40,8 @@ #include #endif -#if defined(WIN32) || defined(_WIN32) +#if defined(_WIN32) && !defined(__CYGWIN__) +#define WIN32_LEAN_AND_MEAN #include #endif @@ -47,38 +49,14 @@ #include /* for CP_UTF8 */ #endif -/* Figure a portable way to know if a file is a directory. */ -#ifndef HAVE_STAT -# ifdef HAVE__STAT - /* MS C library seems to define stat and _stat. The definition - is identical. Still, mapping them to each other causes a warning. */ -# ifndef _MSC_VER -# define stat(x,y) _stat(x,y) -# endif -# define HAVE_STAT -# endif -#else -# ifdef HAVE__STAT -# if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) -# define stat _stat -# endif -# endif -#endif -#ifdef HAVE_STAT -# ifndef S_ISDIR -# ifdef _S_ISDIR -# define S_ISDIR(x) _S_ISDIR(x) -# else -# ifdef S_IFDIR -# ifndef S_IFMT -# ifdef _S_IFMT -# define S_IFMT _S_IFMT -# endif -# endif -# ifdef S_IFMT -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# endif -# endif +#ifndef S_ISDIR +# ifdef _S_ISDIR +# define S_ISDIR(x) _S_ISDIR(x) +# elif defined(S_IFDIR) +# ifdef S_IFMT +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# elif defined(_S_IFMT) +# define S_ISDIR(m) (((m) & _S_IFMT) == S_IFDIR) # endif # endif #endif @@ -656,99 +634,19 @@ xmlWrapGzOpenUtf8(const char *path, const char *mode) * */ static int -xmlWrapStatUtf8(const char *path,struct stat *info) -{ -#ifdef HAVE_STAT +xmlWrapStatUtf8(const char *path, struct _stat *info) { int retval = -1; wchar_t *wPath; wPath = __xmlIOWin32UTF8ToWChar(path); - if (wPath) - { - retval = _wstat(wPath,info); + if (wPath) { + retval = _wstat(wPath, info); xmlFree(wPath); } /* maybe path in native encoding */ if(retval < 0) - retval = stat(path,info); + retval = _stat(path, info); return retval; -#else - return -1; -#endif -} - -/** - * xmlWrapOpenNative: - * @path: the path - * @mode: type of access (0 - read, 1 - write) - * - * function opens the file specified by @path - * - */ -static FILE* -xmlWrapOpenNative(const char *path,int mode) -{ - return fopen(path,mode ? "wb" : "rb"); -} - -/** - * xmlWrapStatNative: - * @path: the path - * @info: structure that stores results - * - * function obtains information about the file or directory - * - */ -static int -xmlWrapStatNative(const char *path,struct stat *info) -{ -#ifdef HAVE_STAT - return stat(path,info); -#else - return -1; -#endif -} - -typedef int (* xmlWrapStatFunc) (const char *f, struct stat *s); -static xmlWrapStatFunc xmlWrapStat = xmlWrapStatNative; -typedef FILE* (* xmlWrapOpenFunc)(const char *f,int mode); -static xmlWrapOpenFunc xmlWrapOpen = xmlWrapOpenNative; -#ifdef HAVE_ZLIB_H -typedef gzFile (* xmlWrapGzOpenFunc) (const char *f, const char *mode); -static xmlWrapGzOpenFunc xmlWrapGzOpen = gzopen; -#endif -/** - * xmlInitPlatformSpecificIo: - * - * Initialize platform specific features. - */ -static void -xmlInitPlatformSpecificIo(void) -{ - static int xmlPlatformIoInitialized = 0; - OSVERSIONINFO osvi; - - if(xmlPlatformIoInitialized) - return; - - osvi.dwOSVersionInfoSize = sizeof(osvi); - - if(GetVersionEx(&osvi) && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) { - xmlWrapStat = xmlWrapStatUtf8; - xmlWrapOpen = xmlWrapOpenUtf8; -#ifdef HAVE_ZLIB_H - xmlWrapGzOpen = xmlWrapGzOpenUtf8; -#endif - } else { - xmlWrapStat = xmlWrapStatNative; - xmlWrapOpen = xmlWrapOpenNative; -#ifdef HAVE_ZLIB_H - xmlWrapGzOpen = gzopen; -#endif - } - - xmlPlatformIoInitialized = 1; - return; } #endif @@ -771,8 +669,12 @@ int xmlCheckFilename (const char *path) { #ifdef HAVE_STAT +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + struct _stat stat_buffer; +#else struct stat stat_buffer; #endif +#endif if (path == NULL) return(0); @@ -786,7 +688,7 @@ xmlCheckFilename (const char *path) (path[3] == '\\') ) return 1; - if (xmlWrapStat(path, &stat_buffer) == -1) + if (xmlWrapStatUtf8(path, &stat_buffer) == -1) return 0; #else if (stat(path, &stat_buffer) == -1) @@ -826,7 +728,7 @@ static int xmlFdRead (void * context, char * buffer, int len) { int ret; - ret = read((int) (long) context, &buffer[0], len); + ret = read((int) (ptrdiff_t) context, &buffer[0], len); if (ret < 0) xmlIOErr(0, "read()"); return(ret); } @@ -847,7 +749,7 @@ xmlFdWrite (void * context, const char * buffer, int len) { int ret = 0; if (len > 0) { - ret = write((int) (long) context, &buffer[0], len); + ret = write((int) (ptrdiff_t) context, &buffer[0], len); if (ret < 0) xmlIOErr(0, "write()"); } return(ret); @@ -865,7 +767,7 @@ xmlFdWrite (void * context, const char * buffer, int len) { static int xmlFdClose (void * context) { int ret; - ret = close((int) (long) context); + ret = close((int) (ptrdiff_t) context); if (ret < 0) xmlIOErr(0, "close()"); return(ret); } @@ -933,7 +835,7 @@ xmlFileOpen_real (const char *filename) { #endif #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapOpen(path, 0); + fd = xmlWrapOpenUtf8(path, 0); #else fd = fopen(path, "r"); #endif /* WIN32 */ @@ -1006,7 +908,7 @@ xmlFileOpenW (const char *filename) { return(NULL); #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapOpen(path, 1); + fd = xmlWrapOpenUtf8(path, 1); #elif(__MVS__) fd = fopen(path, "w"); #else @@ -1198,7 +1100,7 @@ xmlGzfileOpen_real (const char *filename) { return(NULL); #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapGzOpen(path, "rb"); + fd = xmlWrapGzOpenUtf8(path, "rb"); #else fd = gzopen(path, "rb"); #endif @@ -1275,7 +1177,7 @@ xmlGzfileOpenW (const char *filename, int compression) { return(NULL); #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapGzOpen(path, mode); + fd = xmlWrapGzOpenUtf8(path, mode); #else fd = gzopen(path, mode); #endif @@ -2323,10 +2225,6 @@ xmlRegisterDefaultInputCallbacks(void) { if (xmlInputCallbackInitialized) return; -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - xmlInitPlatformSpecificIo(); -#endif - xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen, xmlFileRead, xmlFileClose); #ifdef HAVE_ZLIB_H @@ -2361,10 +2259,6 @@ xmlRegisterDefaultOutputCallbacks (void) { if (xmlOutputCallbackInitialized) return; -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - xmlInitPlatformSpecificIo(); -#endif - xmlRegisterOutputCallbacks(xmlFileMatch, xmlFileOpenW, xmlFileWrite, xmlFileClose); @@ -3008,7 +2902,7 @@ xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc) { ret = xmlAllocParserInputBuffer(enc); if (ret != NULL) { - ret->context = (void *) (long) fd; + ret->context = (void *) (ptrdiff_t) fd; ret->readcallback = xmlFdRead; ret->closecallback = xmlFdClose; } @@ -3114,7 +3008,7 @@ xmlOutputBufferCreateFd(int fd, xmlCharEncodingHandlerPtr encoder) { ret = xmlAllocOutputBufferInternal(encoder); if (ret != NULL) { - ret->context = (void *) (long) fd; + ret->context = (void *) (ptrdiff_t) fd; ret->writecallback = xmlFdWrite; ret->closecallback = NULL; } @@ -3828,7 +3722,7 @@ xmlParserGetDirectory(const char *filename) { if (filename == NULL) return(NULL); -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) # define IS_XMLPGD_SEP(ch) ((ch=='/')||(ch=='\\')) #else # define IS_XMLPGD_SEP(ch) (ch=='/') diff --git a/xmlcatalog.c b/xmlcatalog.c index 006f0cc..c02b97f 100644 --- a/xmlcatalog.c +++ b/xmlcatalog.c @@ -312,7 +312,8 @@ static void usage(const char *name) { /* split into 2 printf's to avoid overly long string (gcc warning) */ printf("\ Usage : %s [options] catalogfile entities...\n\ -\tParse the catalog file and query it for the entities\n\ +\tParse the catalog file (void specification possibly expressed as \"\"\n\ +\tappoints the default system one) and query it for the entities\n\ \t--sgml : handle SGML Super catalogs for --add and --del\n\ \t--shell : run a shell allowing interactive queries\n\ \t--create : create a new catalog\n\ @@ -408,11 +409,18 @@ int main(int argc, char **argv) { continue; } else if (argv[i][0] == '-') continue; - filename = argv[i]; + + if (filename == NULL && argv[i][0] == '\0') { + /* Interpret empty-string catalog specification as + a shortcut for a default system catalog. */ + xmlInitializeCatalog(); + } else { + filename = argv[i]; ret = xmlLoadCatalog(argv[i]); if ((ret < 0) && (create)) { xmlCatalogAdd(BAD_CAST "catalog", BAD_CAST argv[i], NULL); } + } break; } diff --git a/xmllint.c b/xmllint.c index c175730..a691aa6 100644 --- a/xmllint.c +++ b/xmllint.c @@ -12,14 +12,6 @@ #include #include -#if defined (_WIN32) && !defined(__CYGWIN__) -#if defined (_MSC_VER) || defined(__BORLANDC__) -#include -#pragma comment(lib, "ws2_32.lib") -#define gettimeofday(p1,p2) -#endif /* _MSC_VER */ -#endif /* _WIN32 */ - #ifdef HAVE_SYS_TIME_H #include #endif @@ -27,14 +19,6 @@ #include #endif -#ifdef __MINGW32__ -#define _WINSOCKAPI_ -#include -#include -#undef XML_SOCKLEN_T -#define XML_SOCKLEN_T unsigned int -#endif - #ifdef HAVE_SYS_TIMEB_H #include #endif diff --git a/xmlmemory.c b/xmlmemory.c index 6400395..6f16c4b 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -487,7 +487,7 @@ xmlMemFree(void *ptr) error: xmlGenericError(xmlGenericErrorContext, - "xmlMemFree(%lX) error\n", (unsigned long) ptr); + "xmlMemFree(%p) error\n", ptr); xmlMallocBreakpoint(); return; } diff --git a/xmlmodule.c b/xmlmodule.c index 7f70f9c..e3a8bd6 100644 --- a/xmlmodule.c +++ b/xmlmodule.c @@ -301,8 +301,9 @@ xmlModulePlatformSymbol(void *handle, const char *name, void **symbol) #endif /* HAVE_SHLLOAD */ #endif /* ! HAVE_DLOPEN */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__CYGWIN__) +#define WIN32_LEAN_AND_MEAN #include /* diff --git a/xmlregexp.c b/xmlregexp.c index b640264..d255fbf 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -2810,18 +2810,21 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg, break; case XML_REGEXP_NOTSPACE: neg = !neg; + /* Falls through. */ case XML_REGEXP_ANYSPACE: ret = ((codepoint == '\n') || (codepoint == '\r') || (codepoint == '\t') || (codepoint == ' ')); break; case XML_REGEXP_NOTINITNAME: neg = !neg; + /* Falls through. */ case XML_REGEXP_INITNAME: ret = (IS_LETTER(codepoint) || (codepoint == '_') || (codepoint == ':')); break; case XML_REGEXP_NOTNAMECHAR: neg = !neg; + /* Falls through. */ case XML_REGEXP_NAMECHAR: ret = (IS_LETTER(codepoint) || IS_DIGIT(codepoint) || (codepoint == '.') || (codepoint == '-') || @@ -2830,11 +2833,13 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg, break; case XML_REGEXP_NOTDECIMAL: neg = !neg; + /* Falls through. */ case XML_REGEXP_DECIMAL: ret = xmlUCSIsCatNd(codepoint); break; case XML_REGEXP_REALCHAR: neg = !neg; + /* Falls through. */ case XML_REGEXP_NOTREALCHAR: ret = xmlUCSIsCatP(codepoint); if (ret == 0) diff --git a/xmlschemas.c b/xmlschemas.c index 1938d7e..05a12e0 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -1742,6 +1742,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, *buf = xmlStrcat(*buf, BAD_CAST "'"); FREE_AND_NULL(str); } + /* Falls through. */ default: named = 0; } diff --git a/xmlschemastypes.c b/xmlschemastypes.c index c9674ba..c6c9365 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -5403,7 +5403,7 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet, if ((valType == XML_SCHEMAS_QNAME) || (valType == XML_SCHEMAS_NOTATION)) return (0); - /* No break on purpose. */ + /* Falls through. */ case XML_SCHEMA_FACET_MAXLENGTH: case XML_SCHEMA_FACET_MINLENGTH: { unsigned int len = 0; diff --git a/xmlwriter.c b/xmlwriter.c index 69541b8..eb94e6e 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -3754,6 +3754,7 @@ xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer) if (count < 0) return -1; sum += count; + /* Falls through. */ case XML_TEXTWRITER_DTD_ENTY: case XML_TEXTWRITER_DTD_PENT: count = xmlOutputBufferWriteString(writer->out, ">"); diff --git a/xpath.c b/xpath.c index b816bd3..3527473 100644 --- a/xpath.c +++ b/xpath.c @@ -24,6 +24,7 @@ #include #include +#include #ifdef HAVE_SYS_TYPES_H #include @@ -159,7 +160,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { int misc = 0, precedence1 = 0, precedence2 = 0; xmlNodePtr miscNode1 = NULL, miscNode2 = NULL; xmlNodePtr cur, root; - long l1, l2; + ptrdiff_t l1, l2; if ((node1 == NULL) || (node2 == NULL)) return(-2); @@ -173,12 +174,12 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { switch (node1->type) { case XML_ELEMENT_NODE: if (node2->type == XML_ELEMENT_NODE) { - if ((0 > (long) node1->content) && /* TODO: Would a != 0 suffice here? */ - (0 > (long) node2->content) && + if ((0 > (ptrdiff_t) node1->content) && + (0 > (ptrdiff_t) node2->content) && (node1->doc == node2->doc)) { - l1 = -((long) node1->content); - l2 = -((long) node2->content); + l1 = -((ptrdiff_t) node1->content); + l2 = -((ptrdiff_t) node2->content); if (l1 < l2) return(1); if (l1 > l2) @@ -223,7 +224,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { node1 = node1->parent; } if ((node1 == NULL) || (node1->type != XML_ELEMENT_NODE) || - (0 <= (long) node1->content)) { + (0 <= (ptrdiff_t) node1->content)) { /* * Fallback for whatever case. */ @@ -273,7 +274,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { node2 = node2->parent; } if ((node2 == NULL) || (node2->type != XML_ELEMENT_NODE) || - (0 <= (long) node2->content)) + (0 <= (ptrdiff_t) node2->content)) { node2 = miscNode2; precedence2 = 0; @@ -346,12 +347,12 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { */ if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && - (0 > (long) node1->content) && - (0 > (long) node2->content) && + (0 > (ptrdiff_t) node1->content) && + (0 > (ptrdiff_t) node2->content) && (node1->doc == node2->doc)) { - l1 = -((long) node1->content); - l2 = -((long) node2->content); + l1 = -((ptrdiff_t) node1->content); + l2 = -((ptrdiff_t) node2->content); if (l1 < l2) return(1); if (l1 > l2) @@ -414,12 +415,12 @@ turtle_comparison: */ if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && - (0 > (long) node1->content) && - (0 > (long) node2->content) && + (0 > (ptrdiff_t) node1->content) && + (0 > (ptrdiff_t) node2->content) && (node1->doc == node2->doc)) { - l1 = -((long) node1->content); - l2 = -((long) node2->content); + l1 = -((ptrdiff_t) node1->content); + l2 = -((ptrdiff_t) node2->content); if (l1 < l2) return(1); if (l1 > l2) @@ -3239,7 +3240,7 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) */ long xmlXPathOrderDocElems(xmlDocPtr doc) { - long count = 0; + ptrdiff_t count = 0; xmlNodePtr cur; if (doc == NULL) @@ -3271,7 +3272,7 @@ xmlXPathOrderDocElems(xmlDocPtr doc) { } } while (cur != NULL); } - return(count); + return((long) count); } /** @@ -3339,13 +3340,13 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) { */ if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && - (0 > (long) node1->content) && - (0 > (long) node2->content) && + (0 > (ptrdiff_t) node1->content) && + (0 > (ptrdiff_t) node2->content) && (node1->doc == node2->doc)) { - long l1, l2; + ptrdiff_t l1, l2; - l1 = -((long) node1->content); - l2 = -((long) node2->content); + l1 = -((ptrdiff_t) node1->content); + l2 = -((ptrdiff_t) node2->content); if (l1 < l2) return(1); if (l1 > l2) @@ -3402,13 +3403,13 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) { */ if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && - (0 > (long) node1->content) && - (0 > (long) node2->content) && + (0 > (ptrdiff_t) node1->content) && + (0 > (ptrdiff_t) node2->content) && (node1->doc == node2->doc)) { - long l1, l2; + ptrdiff_t l1, l2; - l1 = -((long) node1->content); - l2 = -((long) node2->content); + l1 = -((ptrdiff_t) node1->content); + l2 = -((ptrdiff_t) node2->content); if (l1 < l2) return(1); if (l1 > l2) @@ -6400,16 +6401,12 @@ xmlXPathNodeValHash(xmlNodePtr node) { } while (tmp != NULL) { switch (tmp->type) { - case XML_COMMENT_NODE: - case XML_PI_NODE: case XML_CDATA_SECTION_NODE: case XML_TEXT_NODE: string = tmp->content; break; - case XML_NAMESPACE_DECL: - string = ((xmlNsPtr)tmp)->href; - break; default: + string = NULL; break; } if ((string != NULL) && (string[0] != 0)) { @@ -7045,7 +7042,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, valuePush(ctxt, arg2); xmlXPathNumberFunction(ctxt, 1); arg2 = valuePop(ctxt); - /* no break on purpose */ + /* Falls through. */ case XPATH_NUMBER: /* Hand check NaN and Infinity equalities */ if (xmlXPathIsNaN(arg1->floatval) ||