Imported Upstream version 2.9.7 42/161342/1 upstream/2.9.7
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 23 Nov 2017 02:22:54 +0000 (11:22 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 23 Nov 2017 02:23:16 +0000 (11:23 +0900)
Change-Id: I9ae5434978bd98bb49d072dc066e149cbac06842
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
53 files changed:
SAX2.c
catalog.c
config.h.in
configure
configure.ac
dict.c
doc/Makefile.am
doc/Makefile.in
doc/elfgcchack.xsl
doc/libxml2.xsa
doc/news.html
doc/xml.html
doc/xmlcatalog.1
doc/xmlcatalog_man.html
doc/xmlcatalog_man.xml
doc/xmllint.html
include/libxml/nanoftp.h
include/libxml/threads.h
include/libxml/xmlversion.h
include/win32config.h
include/wsockcompat.h
libxml.h
libxml2.spec
nanoftp.c
nanohttp.c
os400/os400config.h.in
parser.c
parserInternals.c
python/setup.py
relaxng.c
result/XPath/tests/strbase [new file with mode: 0644]
runtest.c
test/XPath/docs/str
test/XPath/tests/strbase [new file with mode: 0644]
testrecurse.c
threads.c
timsort.h
tree.c
uri.c
valid.c
win32/Makefile.mingw
win32/Makefile.msvc
win32/VC10/config.h
xmlIO.c
xmlcatalog.c
xmllint.c
xmlmemory.c
xmlmodule.c
xmlregexp.c
xmlschemas.c
xmlschemastypes.c
xmlwriter.c
xpath.c

diff --git a/SAX2.c b/SAX2.c
index 1508c77..0f261b7 100644 (file)
--- a/SAX2.c
+++ b/SAX2.c
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
+#include <stddef.h>
 #include <libxml/xmlmemory.h>
 #include <libxml/tree.h>
 #include <libxml/parser.h>
@@ -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;
            }
        }
     }
index 6dfdfbb..f6186a1 100644 (file)
--- 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:
index 749b1d6..0b4aad6 100644 (file)
    #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
 
index 6c4d6fb..9f5a5fa 100755 (executable)
--- 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 .)"
index ff190a5..8dbc56c 100644 (file)
@@ -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 (file)
--- a/dict.c
+++ b/dict.c
@@ -48,7 +48,7 @@
 #else
 #ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
-#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);
index 0cc0a50..6bda566 100644 (file)
@@ -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
index 1514a76..eadbf2f 100644 (file)
@@ -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
index 9b1a9bc..8dd5c6a 100644 (file)
@@ -18,7 +18,7 @@
 #ifdef IN_LIBXML
 #ifdef __GNUC__
 #ifdef PIC
-#ifdef linux
+#ifdef __linux__
 #if (__GNUC__ == 3 &amp;&amp; __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
 
 #include "libxml/c14n.h"
index 25ff51d..f575ff0 100644 (file)
   </vendor>
   <product id="libxml2">
     <name>libxml2</name>
-    <version>v2.9.5</version>
-    <last-release> Sep 04 2017</last-release>
+    <version>v2.9.6</version>
+    <last-release> Oct 06 2017</last-release>
     <info-url>http://xmlsoft.org/</info-url>
-    <changes>   - 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)
+    <changes>   - 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)
   
 
 </changes>
index 9a1d3e3..5346d32 100644 (file)
@@ -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 }
 </style><title>Releases</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XML C parser and toolkit of Gnome</h1><h2>Releases</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html">Home</a></li><li><a href="html/index.html">Reference Manual</a></li><li><a href="intro.html">Introduction</a></li><li><a href="FAQ.html">FAQ</a></li><li><a href="docs.html" style="font-weight:bold">Developer Menu</a></li><li><a href="bugs.html">Reporting bugs and getting help</a></li><li><a href="help.html">How to help</a></li><li><a href="downloads.html">Downloads</a></li><li><a href="news.html">Releases</a></li><li><a href="XMLinfo.html">XML</a></li><li><a href="XSLT.html">XSLT</a></li><li><a href="xmldtd.html">Validation &amp; DTDs</a></li><li><a href="encoding.html">Encodings support</a></li><li><a href="catalog.html">Catalog support</a></li><li><a href="namespaces.html">Namespaces</a></li><li><a href="contribs.html">Contributions</a></li><li><a href="examples/index.html" style="font-weight:bold">Code Examples</a></li><li><a href="html/index.html" style="font-weight:bold">API Menu</a></li><li><a href="guidelines.html">XML Guidelines</a></li><li><a href="ChangeLog.html">Recent Changes</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://opencsw.org/packages/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://lxml.de/">lxml Python bindings</a></li><li><a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl bindings</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://libxml.rubyforge.org/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>The <a href="ChangeLog.html">change log</a> describes the recents commits
-to the <a href="http://git.gnome.org/browse/libxml2/">GIT</a> code base.</p><p>Here is the list of public releases:</p><h3>v2.9.6: Oct 06 2017</h3><ul>
+to the <a href="http://git.gnome.org/browse/libxml2/">GIT</a> code base.</p><p>Here is the list of public releases:</p><h3>2.9.7: Nov 02 2017</h3><ul>
+  <li>Documentation:<br />
+  xmlcatalog: refresh man page wrt. quering system catalog easily (Jan Pokorný)<br />
+  </li>
+
+  <li>Portability:<br />
+  Fix deprecated Travis compiler flag (Nick Wellnhofer),<br />
+  Add declaration for DllMain (J. Peter Mugaas),<br />
+  Fix preprocessor conditional in threads.h (J. Peter Mugaas),<br />
+  Fix pointer comparison warnings on 64-bit Windows (J. Peter Mugaas),<br />
+  Fix macro redefinition warning (J. Peter Mugaas),<br />
+  Default to native threads on MinGW-w64 (Nick Wellnhofer),<br />
+  Simplify Windows IO functions (Nick Wellnhofer),<br />
+  Fix runtest on Windows (Nick Wellnhofer),<br />
+  socklen_t is always int on Windows (Nick Wellnhofer),<br />
+  Don't redefine socket error codes on Windows (Nick Wellnhofer),<br />
+  Fix pointer/int cast warnings on 64-bit Windows (Nick Wellnhofer),<br />
+  Fix Windows compiler warnings in xmlCanonicPath (Nick Wellnhofer)<br />
+  </li>
+
+  <li>Bug Fixes:<br />
+  xmlcatalog: restore ability to query system catalog easily (Jan Pokorný),<br />
+  Fix comparison of nodesets to strings (Nick Wellnhofer)<br />
+  </li>
+
+  <li>Improvements:<br />
+  Add Makefile rules to rebuild HTML man pages (Nick Wellnhofer),<br />
+  Fix mixed decls and code in timsort.h (Nick Wellnhofer),<br />
+  Rework handling of return values in thread tests (Nick Wellnhofer),<br />
+  Fix unused variable warnings in testrecurse (Nick Wellnhofer),<br />
+  Fix -Wimplicit-fallthrough warnings (J. Peter Mugaas),<br />
+  Upgrade timsort.h to latest revision (Nick Wellnhofer),<br />
+  Increase warning level to /W3 under MSVC (Nick Wellnhofer),<br />
+  Fix a couple of warnings in dict.c and threads.c (Nick Wellnhofer),<br />
+  Update .gitignore for Windows (Nick Wellnhofer),<br />
+  Fix unused variable warnings in nanohttp.c (Nick Wellnhofer),<br />
+  Fix the Windows header mess (Nick Wellnhofer),<br />
+  Don't include winsock2.h in xmllint.c (Nick Wellnhofer),<br />
+  Remove generated file python/setup.py from version control (Nick Wellnhofer),<br />
+  Use __linux__ macro in generated code (Nick Wellnhofer)<br />
+  </li>
+
+</ul><h3>v2.9.6: Oct 06 2017</h3><ul>
   <li>Portability:<br />
   Change preprocessor OS tests to __linux__ (Nick Wellnhofer)<br />
   </li>
index 019b5be..b902869 100644 (file)
@@ -709,6 +709,50 @@ to the <a href="http://git.gnome.org/browse/libxml2/">GIT</a> code base.</p>
 
 <p>Here is the list of public releases:</p>
 
+<h3>2.9.7: Nov 02 2017</h3>
+<ul>
+  <li>Documentation:<br/>
+  xmlcatalog: refresh man page wrt. quering system catalog easily (Jan Pokorný)<br/>
+  </li>
+
+  <li>Portability:<br/>
+  Fix deprecated Travis compiler flag (Nick Wellnhofer),<br/>
+  Add declaration for DllMain (J. Peter Mugaas),<br/>
+  Fix preprocessor conditional in threads.h (J. Peter Mugaas),<br/>
+  Fix pointer comparison warnings on 64-bit Windows (J. Peter Mugaas),<br/>
+  Fix macro redefinition warning (J. Peter Mugaas),<br/>
+  Default to native threads on MinGW-w64 (Nick Wellnhofer),<br/>
+  Simplify Windows IO functions (Nick Wellnhofer),<br/>
+  Fix runtest on Windows (Nick Wellnhofer),<br/>
+  socklen_t is always int on Windows (Nick Wellnhofer),<br/>
+  Don't redefine socket error codes on Windows (Nick Wellnhofer),<br/>
+  Fix pointer/int cast warnings on 64-bit Windows (Nick Wellnhofer),<br/>
+  Fix Windows compiler warnings in xmlCanonicPath (Nick Wellnhofer)<br/>
+  </li>
+
+  <li>Bug Fixes:<br/>
+  xmlcatalog: restore ability to query system catalog easily (Jan Pokorný),<br/>
+  Fix comparison of nodesets to strings (Nick Wellnhofer)<br/>
+  </li>
+
+  <li>Improvements:<br/>
+  Add Makefile rules to rebuild HTML man pages (Nick Wellnhofer),<br/>
+  Fix mixed decls and code in timsort.h (Nick Wellnhofer),<br/>
+  Rework handling of return values in thread tests (Nick Wellnhofer),<br/>
+  Fix unused variable warnings in testrecurse (Nick Wellnhofer),<br/>
+  Fix -Wimplicit-fallthrough warnings (J. Peter Mugaas),<br/>
+  Upgrade timsort.h to latest revision (Nick Wellnhofer),<br/>
+  Increase warning level to /W3 under MSVC (Nick Wellnhofer),<br/>
+  Fix a couple of warnings in dict.c and threads.c (Nick Wellnhofer),<br/>
+  Update .gitignore for Windows (Nick Wellnhofer),<br/>
+  Fix unused variable warnings in nanohttp.c (Nick Wellnhofer),<br/>
+  Fix the Windows header mess (Nick Wellnhofer),<br/>
+  Don't include winsock2.h in xmllint.c (Nick Wellnhofer),<br/>
+  Remove generated file python/setup.py from version control (Nick Wellnhofer),<br/>
+  Use __linux__ macro in generated code (Nick Wellnhofer)<br/>
+  </li>
+
+</ul>
 <h3>v2.9.6: Oct 06 2017</h3>
 <ul>
   <li>Portability:<br/>
index b4a6b22..2fbfaf2 100644 (file)
@@ -1,7 +1,7 @@
 '\" t
 .\"     Title: xmlcatalog
 .\"    Author: John Fleck <jfleck@inkstain.net>
-.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
 .\"      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
index d7b02ba..f72cd47 100644 (file)
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmlcatalog</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="id2431614"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>xmlcatalog &#8212; Command line tool to parse and manipulate <span class="acronym">XML</span> or
-      <span class="acronym">SGML</span> catalog files.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><tt class="command">xmlcatalog</tt>  [[--shell] |  [--create] |  [--add <i class="replaceable"><tt>type</tt></i>
-         <i class="replaceable"><tt>orig</tt></i> <i class="replaceable"><tt>replace</tt></i>] |  [--del <i class="replaceable"><tt>values</tt></i>] |  [--noout] |  [--verbose]] [<tt class="option"><i class="replaceable"><tt>catalogfile</tt></i></tt>] [<tt class="option"><i class="replaceable"><tt>entities</tt></i></tt>]</p></div></div><div class="refsect1" lang="en"><a name="introduction"></a><h2>Introduction</h2><p>
-      <span class="application">xmlcatalog</span> is a command line application
-      allowing users to monitor and manipulate <span class="acronym">XML</span> and
-      <span class="acronym">SGML</span> catalogs. It is included in
-      <span class="application">libxml2</span>.
-    </p><p>
-      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 <span class="acronym">XML</span> and <span class="acronym">SGML</span> files.
-    </p></div><div class="refsect1" lang="en"><a name="cloptions"></a><h2>Command Line Options</h2><div class="variablelist"><dl><dt><span class="term"><tt class="option">--shell</tt> <i class="replaceable"><tt>filename</tt></i></span></dt><dd>
-           Run a shell
-           allowing interactive queries on catalog file
-           <i class="replaceable"><tt>filename</tt></i>.
-         </dd><dt><span class="term"><tt class="option">--create</tt> <i class="replaceable"><tt>filename</tt></i></span></dt><dd>
-           Create a new
-           <span class="acronym">XML</span> catalog. Outputs to stdout, ignoring
-           <i class="replaceable"><tt>filename</tt></i> unless <tt class="option">--noout</tt> is
-           used, in which case it creates a new catalog file
-           <i class="replaceable"><tt>filename</tt></i>.
-         </dd><dt><span class="term"><tt class="option">--add</tt> <i class="replaceable"><tt>'type'</tt></i> <i class="replaceable"><tt>'orig'</tt></i> <i class="replaceable"><tt>'replace'</tt></i> <i class="replaceable"><tt>filename</tt></i></span></dt><dd><p>
-           Add an entry to catalog file
-           <tt class="filename">filename</tt>. <i class="replaceable"><tt>type</tt></i>
-           indicates the type of entry. Possible types are 'public', 'system', 'uri',
-           'rewriteSystem', 'rewriteURI', 'delegatePublic', 'delegateSystem',
-           'delegateURI' and 'nextCatalog'. <i class="replaceable"><tt>'orig'</tt></i> is the original
-           reference to be replaced, and <i class="replaceable"><tt>'replace'</tt></i>
-           is the <span class="acronym">URI</span> of the replacement entity to be
-           used. The <tt class="option">--add</tt> option will not overwrite
-           <i class="replaceable"><tt>filename</tt></i>, outputing to stdout, unless
-           <tt class="option">--noout</tt> is used. The <tt class="option">--add</tt> will
-           always take three parameters even if some of the
-           <span class="acronym">XML</span> catalog constructs will have only a single
-           argument.
-
-         </p><p>
-           If the <tt class="option">--add</tt> option is used following the
-           <tt class="option">--sgml</tt> option, only a single argument, a
-           <i class="replaceable"><tt>filename</tt></i>, is used. This is used to add
-           the name of a catalog file to an <span class="acronym">SGML</span>
-           supercatalog, a file that contains references to other included
-           <span class="acronym">SGML</span> catalog files.
-         </p></dd><dt><span class="term"><tt class="option">--del</tt> <i class="replaceable"><tt>'values'</tt></i> <i class="replaceable"><tt>filename</tt></i></span></dt><dd>
-           Remove entries from the catalog file
-           <i class="replaceable"><tt>filename</tt></i> matching
-           <i class="replaceable"><tt>'values'</tt></i>. The <tt class="option">--del</tt> option
-           will not overwrite <i class="replaceable"><tt>filename</tt></i>, outputing to
-           stdout, unless <tt class="option">--noout</tt> is used.
-         </dd><dt><span class="term"><tt class="option">--noout</tt></span></dt><dd>
-           Save output to the named file rather than
-           outputing to stdout.
-         </dd><dt><span class="term"><tt class="option">--sgml</tt></span></dt><dd>
-           Uses SGML Super catalogs for --add and --del options
-         </dd><dt><span class="term"><tt class="option">-v</tt> or <tt class="option">--verbose</tt></span></dt><dd>
-           output debugging
-           information.
-         </dd></dl></div></div><div class="refsect1" lang="en"><a name="shell"></a><h2>Shell Commands</h2><p>Invoking <span class="application">xmlcatalog</span> with the
-      <tt class="option">--shell</tt> <i class="replaceable"><tt>filename</tt></i> option opens
-    a command line shell allowing interactive access to the catalog file
-      identified by <i class="replaceable"><tt>filename</tt></i>. Invoking the shell
-    provides a command line prompt after which commands can be entered.
-    </p><div class="variablelist"><dl><dt><span class="term"><tt class="option">public</tt> <i class="replaceable"><tt>'PublicID'</tt></i></span></dt><dd>
-           Execute a
-           public identifier lookup of the catalog entry for
-           <i class="replaceable"><tt>'PublicID'</tt></i>. The corresponding entry will be
-           output to the command line.
-         </dd><dt><span class="term"><tt class="option">system</tt> <i class="replaceable"><tt>'SystemID'</tt></i></span></dt><dd>
-           Execute a
-           public identifier lookup of the catalog entry for
-           <i class="replaceable"><tt>'SystemID'</tt></i>. The corresponding entry will be
-           output to the command line.
-         </dd><dt><span class="term"><tt class="option">add </tt> <i class="replaceable"><tt>'type'</tt></i> <i class="replaceable"><tt>'orig'</tt></i> <i class="replaceable"><tt>'replace'</tt></i></span></dt><dd>
-           Add an entry to the catalog
-           file. <i class="replaceable"><tt>type</tt></i> indicates the type of
-           entry. Possible types are 'public', 'system', 'uri', 'rewriteSystem', 'rewriteURI',
-           'delegatePublic', 'delegateSystem', 'delegateURI' and 'nextCatalog'. <i class="replaceable"><tt>'orig'</tt></i>
-           is the original reference to  be replaced, and
-           <i class="replaceable"><tt>'replace'</tt></i> is the <span class="acronym">URI</span> of the
-           replacement entity to be used.
-         </dd><dt><span class="term"><tt class="option">del</tt> <i class="replaceable"><tt>'values'</tt></i></span></dt><dd>
-           Remove the
-           catalog entry corresponding to <i class="replaceable"><tt>'values'</tt></i>.
-         </dd><dt><span class="term"><tt class="option">dump</tt></span></dt><dd>
-           Print the current catalog.
-         </dd><dt><span class="term"><tt class="option">debug</tt></span></dt><dd>
-           Print debugging statements showing the steps
-           <span class="application">xmlcatalog</span> is executing.
-         </dd><dt><span class="term"><tt class="option">quiet</tt></span></dt><dd>
-           Stop printing debugging statements.
-         </dd><dt><span class="term"><tt class="option">exit</tt></span></dt><dd>
-           Quit the shell.
-         </dd></dl></div></div><div class="refsect1" lang="en"><a name="return"></a><h2>Return values</h2><p><span class="application">xmlcatalog</span>'s return codes provide
-    information that can be used when calling it from scripts.</p><p>0: normal</p><p>1: Failed to remove an entry from the catalog</p><p>2: Failed to save to the catalog, check file permissions</p><p>3: Failed to add an entry to the catalog</p><p>4: Failed to lookup and entry in the catalog</p></div><div class="refsect1" lang="en"><h2>Catalogs</h2><p>Catalog behavior can be changed by redirecting
-     queries to the user's own set of catalogs. This can be done by setting the
-     <tt class="varname">XML_CATALOG_FILES</tt> environment variable to a list of
-     catalogs. An empty one should deactivate loading the default
-      <tt class="filename">/etc/xml/catalog</tt> default catalog.</p></div><div class="refsect1" lang="en"><h2>References</h2><p><a href="http://www.xmlsoft.org/" target="_top">libxml web page</a></p><p><a href="http://www.xmlsoft.org/catalog.html" target="_top"><span class="application">libxml</span>
-    catalog support web page:</a></p><p><a href="http://www.jclark.com/sp/catalog.htm" target="_top">James Clark's
-    <span class="acronym">SGML</span> catalog page:</a></p><p><a href="http://www.oasis-open.org/committees/entity/spec.html" target="_top"><span class="acronym">OASIS</span>
-    <span class="acronym">XML</span> catalog specification: </a></p></div></div></body></html>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmlcatalog</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm45940765506544"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmlcatalog &#8212; 
+               Command line tool to parse and manipulate <acronym class="acronym">XML</acronym>
+               or <acronym class="acronym">SGML</acronym> catalog files.
+       </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmlcatalog</code>  [ <code class="option">--sgml</code>  |   <code class="option">--shell</code>  |   <code class="option">--create</code>  |   <code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code>  |   
+                       [ 
+                                       <code class="option">--add
+                                        <em class="replaceable"><code>TYPE</code></em>
+                                        <em class="replaceable"><code>ORIG</code></em>
+                                        <em class="replaceable"><code>REPLACE</code></em>
+                                       </code>
+                                 |   <code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code> ]            
+                 |   <code class="option">--noout</code>  |   <code class="option">--no-super-update</code>  |   
+                       [ <code class="option">-v</code>  |   <code class="option">--verbose</code> ]
+                ] {<em class="replaceable"><code>CATALOGFILE</code></em>} {<em class="replaceable"><code>ENTITIES</code></em>...}</p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
+               <span class="command"><strong>xmlcatalog</strong></span> is a command line application allowing users to monitor and
+               manipulate <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> catalogs. It
+               is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.
+       </p><p>
+               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 <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> files.
+       </p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
+               <span class="command"><strong>xmlcatalog</strong></span> accepts the following options (in alphabetical order):
+       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
+               <code class="option">--add
+                <em class="replaceable"><code>TYPE</code></em>
+                <em class="replaceable"><code>ORIG</code></em>
+                <em class="replaceable"><code>REPLACE</code></em>
+               </code>
+       </span></dt><dd><p>
+                       Add an entry to <code class="filename">CATALOGFILE</code>. <em class="replaceable"><code>TYPE</code></em>
+                       indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
+                       reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
+                       is the <acronym class="acronym">URI</acronym> of the replacement entity to be
+                       used. The <code class="option">--add</code> option will not overwrite
+                       <code class="filename">CATALOGFILE</code>, outputting
+                       to <code class="filename">stdout</code>, unless
+                       <code class="option">--noout</code> is used. The <code class="option">--add</code> will
+                       always take three parameters even if some of the <acronym class="acronym">XML</acronym>
+                       catalog constructs will have only a single argument.
+               </p></dd><dt><span class="term"><code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code></span></dt><dd><p>
+                       If the <code class="option">--add</code> option is used following
+                       the <code class="option">--sgml</code> option, only a single argument,
+                       a <em class="replaceable"><code>FILENAME</code></em>, is used. This is used to add
+                       the name of a catalog file to an <acronym class="acronym">SGML</acronym> supercatalog,
+                       a file that contains references to other included <acronym class="acronym">SGML</acronym>
+                       catalog files.
+               </p></dd><dt><span class="term"><code class="option">--create</code></span></dt><dd><p>
+                       Create a new <acronym class="acronym">XML</acronym> catalog. Outputs
+                       to <code class="filename">stdout</code>,
+                       ignoring <em class="replaceable"><code>filename</code></em> unless <code class="option">--noout</code> is
+                       used, in which case it creates a new catalog
+                       file <em class="replaceable"><code>filename</code></em>.
+               </p></dd><dt><span class="term"><code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
+                       Remove entries from <em class="replaceable"><code>CATALOGFILE</code></em>
+                       matching <em class="replaceable"><code>VALUE(S)</code></em>. The <code class="option">--del</code>
+                       option will not overwrite <em class="replaceable"><code>CATALOGFILE</code></em>,
+                       outputting to <code class="filename">stdout</code>,
+                       unless <code class="option">--noout</code> is used.
+               </p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
+                       Save output to the named file rather than outputting
+                       to <code class="filename">stdout</code>.
+               </p></dd><dt><span class="term"><code class="option">--no-super-update</code></span></dt><dd><p>
+                       Do not update the <acronym class="acronym">SGML</acronym> super catalog.
+               </p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
+                       Run a shell allowing interactive queries on catalog
+                       file <em class="replaceable"><code>CATALOGFILE</code></em>. For the set of available
+                       commands see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called &#8220;SHELL COMMANDS&#8221;</a>.
+               </p></dd><dt><span class="term"><code class="option">--sgml</code></span></dt><dd><p>
+                       Uses <acronym class="acronym">SGML</acronym> super catalogs for <code class="option">--add</code>
+                       and <code class="option">--del</code> options.
+               </p></dd><dt><span class="term"><code class="option">-v</code>, </span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>Output debugging information.</p></dd></dl></div><p>
+               Invoking <span class="command"><strong>xmlcatalog</strong></span> non-interactively without a designated action
+               (imposed with options like <code class="option">--add</code>) will result in a lookup
+               of the catalog entry for <em class="replaceable"><code>ENTITIES</code></em> in the
+               catalog denoted with <em class="replaceable"><code>CATALOGFILE</code></em>. The
+               corresponding entries will be output to the command line. This mode of
+               operation, together with <code class="option">--shell</code> mode and non-modifying
+               (i.e. without <code class="option">--noout</code>) direct actions, allows for
+               a special shortcut of the void <em class="replaceable"><code>CATALOGFILE</code></em>
+               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.
+       </p></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
+               Invoking <span class="command"><strong>xmlcatalog</strong></span> with
+               the <code class="option">--shell <em class="replaceable"><code>CATALOGFILE</code></em></code> option opens
+               a command line shell allowing interactive access to the catalog file
+               identified by <em class="replaceable"><code>CATALOGFILE</code></em>. Invoking the shell
+               provides a command line prompt after which the following commands (described in
+               alphabetical order) can be entered.
+       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
+               <code class="option">add
+                <em class="replaceable"><code>TYPE</code></em>
+                <em class="replaceable"><code>ORIG</code></em>
+                <em class="replaceable"><code>REPLACE</code></em>
+               </code>
+       </span></dt><dd><p>
+                       Add an entry to the catalog file. <em class="replaceable"><code>TYPE</code></em>
+                       indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
+                       reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
+                       is the <acronym class="acronym">URI</acronym> of the replacement entity to be
+                       used. The <code class="option">--add</code> option will not overwrite
+                       <code class="filename">CATALOGFILE</code>, outputting
+                       to <code class="filename">stdout</code>, unless
+                       <code class="option">--noout</code> is used. The <code class="option">--add</code> will
+                       always take three parameters even if some of the <acronym class="acronym">XML</acronym>
+                       catalog constructs will have only a single argument.
+               </p></dd><dt><span class="term"><code class="option">debug</code></span></dt><dd><p>
+                       Print debugging statements showing the steps <span class="command"><strong>xmlcatalog</strong></span> is executing.
+               </p></dd><dt><span class="term"><code class="option">del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
+                       Remove the catalog entry corresponding to <em class="replaceable"><code>VALUE(S)</code></em>.
+               </p></dd><dt><span class="term"><code class="option">dump</code></span></dt><dd><p>Print the current catalog.</p></dd><dt><span class="term"><code class="option">exit</code></span></dt><dd><p>Quit the shell.</p></dd><dt><span class="term"><code class="option">public <em class="replaceable"><code>PUBLIC-ID</code></em></code></span></dt><dd><p>
+                       Execute a Formal Public Identifier lookup of the catalog entry
+                       for <em class="replaceable"><code>PUBLIC-ID</code></em>. The corresponding entry will be
+                       output to the command line.
+               </p></dd><dt><span class="term"><code class="option">quiet</code></span></dt><dd><p>Stop printing debugging statements.</p></dd><dt><span class="term"><code class="option">system <em class="replaceable"><code>SYSTEM-ID</code></em></code></span></dt><dd><p>
+                       Execute a Formal Public Identifier lookup of the catalog entry
+                       for <em class="replaceable"><code>SYSTEM-ID</code></em>. The corresponding entry will be
+                       output to the command line.
+               </p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
+                       queries to the user's own set of catalogs. This can be done by setting
+                       the <code class="envar">XML_CATALOG_FILES</code> environment variable to a list
+                       of catalogs. An empty one should deactivate loading the
+                       default <code class="filename">/etc/xml/catalog</code> catalog.
+               </p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
+               <span class="command"><strong>xmlcatalog</strong></span> return codes provide information that can be used when
+               calling it from scripts.
+       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Failed to remove an entry from the catalog</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Failed to save to the catalog, check file permissions</p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Failed to add an entry to the catalog</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Failed to look up an entry in the catalog</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
+       </p><p>
+               More information can be found at
+               </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="http://www.xmlsoft.org/" target="_top">http://www.xmlsoft.org/</a>
+                               </p></li><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> catalog support web page
+                                       at <a class="ulink" href="http://www.xmlsoft.org/catalog.html" target="_top">http://www.xmlsoft.org/catalog.html</a>
+                               </p></li><li class="listitem"><p>James Clark's <acronym class="acronym">SGML</acronym> catalog
+                                       page <a class="ulink" href="http://www.jclark.com/sp/catalog.htm" target="_top">http://www.jclark.com/sp/catalog.htm</a>
+                               </p></li><li class="listitem"><p><acronym class="acronym">OASIS</acronym> <acronym class="acronym">XML</acronym> catalog specification
+                                       <a class="ulink" href="http://www.oasis-open.org/committees/entity/spec.html" target="_top">http://www.oasis-open.org/committees/entity/spec.html</a>
+                               </p></li></ul></div><p>
+       </p></div></div></body></html>
index 049ed8f..b3ce8b2 100644 (file)
                </varlistentry>
        
        </variablelist>
+
+       <para>
+               Invoking &xmlcatalog; non-interactively without a designated action
+               (imposed with options like <option>--add</option>) will result in a lookup
+               of the catalog entry for <replaceable>ENTITIES</replaceable> in the
+               catalog denoted with <replaceable>CATALOGFILE</replaceable>. The
+               corresponding entries will be output to the command line. This mode of
+               operation, together with <option>--shell</option> mode and non-modifying
+               (i.e. without <option>--noout</option>) direct actions, allows for
+               a special shortcut of the void <replaceable>CATALOGFILE</replaceable>
+               specification (possibly expressed as &quot;&quot; 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.
+       </para>
 </refsect1>
 
 <refsect1 id="shell">
        <term><option>public <replaceable>PUBLIC-ID</replaceable></option></term>
        <listitem>
                <para>
-                       Execute a Formal Public Identifier look-up of the catalog entry
+                       Execute a Formal Public Identifier lookup of the catalog entry
                        for <replaceable>PUBLIC-ID</replaceable>. The corresponding entry will be
                        output to the command line.
                </para>
        <term><option>system <replaceable>SYSTEM-ID</replaceable></option></term>
        <listitem>
                <para>
-                       Execute a Formal Public Identifier look-up of the catalog entry
+                       Execute a Formal Public Identifier lookup of the catalog entry
                        for <replaceable>SYSTEM-ID</replaceable>. The corresponding entry will be
                        output to the command line.
                </para>
index 0a55877..5fc52c5 100644 (file)
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmllint</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="id2876302"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>xmllint &#8212; command line <span class="acronym">XML</span> tool</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><tt class="command">xmllint</tt>  [[--version] |  [--debug] |  [--shell] |  [--debugent] |  [--copy] |  [--recover] |  [--noent] |  [--noout] |  [--nonet] |  [--htmlout] |  [--nowrap] |  [--valid] |  [--postvalid] |  [--dtdvalid <i class="replaceable"><tt>URL</tt></i>] |  [--dtdvalidfpi <i class="replaceable"><tt>FPI</tt></i>] |  [--timing] |  [--output <i class="replaceable"><tt>file</tt></i>] |  [--repeat] |  [--insert] |  [--compress] |  [--html] |  [--xmlout] |  [--push] |  [--memory] |  [--maxmem <i class="replaceable"><tt>nbbytes</tt></i>] |  [--nowarning] |  [--noblanks] |  [--nocdata] |  [--format] |  [--encode <i class="replaceable"><tt>encoding</tt></i>] |  [--dropdtd] |  [--nsclean] |  [--testIO] |  [--catalogs] |  [--nocatalogs] |  [--auto] |  [--xinclude] |  [--noxincludenode] |  [--loaddtd] |  [--dtdattr] |  [--stream] |  [--walker] |  [--pattern <i class="replaceable"><tt>patternvalue</tt></i>] |  [--chkregister] |  [--relaxng] |  [--schema] |  [--c14n]] [<tt class="option"><i class="replaceable"><tt>xmlfile</tt></i></tt>]</p></div></div><div class="refsect1" lang="en"><a name="introduction"></a><h2>Introduction</h2><p>
-      The xmllint program parses one or more XML files, specified on the
-      command line as <i class="replaceable"><tt>xmlfile</tt></i>. It prints various
-      types of output, depending upon the options selected. It is useful for
-      detecting errors both in <span class="acronym">XML</span> code and in the
-      <span class="acronym">XML</span> parser itself.
-    </p><p>
-      It is included in <span class="application">libxml2</span>.
-    </p></div><div class="refsect1" lang="en"><a name="options"></a><h2>Options</h2><div class="variablelist"><dl><dt><span class="term"><tt class="option">--version</tt></span></dt><dd>
-           Display the version of
-           <span class="application">libxml2</span> used.
-         </dd><dt><span class="term"><tt class="option">--debug</tt></span></dt><dd>
-           Parse a file and output an annotated tree of the
-           in-memory version of the document.
-         </dd><dt><span class="term"><tt class="option">--shell</tt></span></dt><dd>
-           Run a navigating shell. Details on available commands in shell mode
-           are below.
-         </dd><dt><span class="term"><tt class="option">--debugent</tt></span></dt><dd>
-           Debug the entities defined in the document.
-         </dd><dt><span class="term"><tt class="option">--copy</tt> </span></dt><dd>
-           Test the internal copy implementation.
-         </dd><dt><span class="term"><tt class="option">--recover</tt></span></dt><dd>
-           Output any parsable portions of an invalid
-           document.
-         </dd><dt><span class="term"><tt class="option">--noent</tt></span></dt><dd>
-           Substitute entity values for entity
-           references. By default, <span class="application">xmllint</span> leaves entity
-           references in place.
-         </dd><dt><span class="term"><tt class="option">--nocdata</tt></span></dt><dd>
-           Substitute CDATA section by equivalent text nodes.
-         </dd><dt><span class="term"><tt class="option">--nsclean</tt></span></dt><dd>
-           Remove redundant namespace declarations.
-         </dd><dt><span class="term"><tt class="option">--noout</tt></span></dt><dd>
-           Suppress output. By default,
-           <span class="application">xmllint</span> outputs the result tree.
-         </dd><dt><span class="term"><tt class="option">--htmlout</tt></span></dt><dd>
-           Output results as an <span class="acronym">HTML</span>
-           file. This causes <span class="application">xmllint</span> to output
-           the necessary <span class="acronym">HTML</span> tags surrounding the result tree
-           output so the results can be displayed in a browser. 
-         </dd><dt><span class="term"><tt class="option">--nowrap </tt></span></dt><dd>
-           Do not output HTML doc wrapper.
-         </dd><dt><span class="term"><tt class="option">--valid </tt></span></dt><dd>
-           Determine if the document is a valid instance
-           of the included Document Type Definition (<span class="acronym">DTD</span>). A
-           <span class="acronym">DTD</span> to be validated against also can be specified at
-           the command line using the <tt class="option">--dtdvalid</tt> option. By default,
-           <span class="application">xmllint</span> also checks to determine if the
-           document is well-formed.
-         </dd><dt><span class="term"><tt class="option">--postvalid</tt></span></dt><dd>
-           Validate after parsing is completed.
-         </dd><dt><span class="term"> <tt class="option">--dtdvalid</tt> <i class="replaceable"><tt>URL</tt></i></span></dt><dd>
-           Use the
-      <span class="acronym">DTD</span> specified by <i class="replaceable"><tt>URL</tt></i> for
-      validation.
-         </dd><dt><span class="term"> <tt class="option">--dtdvalidfpi</tt> <i class="replaceable"><tt>FPI</tt></i></span></dt><dd>
-           Use the
-      <span class="acronym">DTD</span> specified by the Public Identifier
-      <i class="replaceable"><tt>FPI</tt></i> for validation, note that this
-      will require a Catalog exporting that Public Identifier to work.
-         </dd><dt><span class="term"><tt class="option">--timing</tt></span></dt><dd>
-           Output information about the time it takes
-           <span class="application">xmllint</span> to perform the various steps.
-         </dd><dt><span class="term"><tt class="option">--output</tt> <i class="replaceable"><tt>file</tt></i></span></dt><dd>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.</dd><dt><span class="term"><tt class="option">--repeat</tt></span></dt><dd>
-           Repeat 100 times, for timing or profiling.
-         </dd><dt><span class="term"><tt class="option">--insert</tt></span></dt><dd>
-           Test for valid insertions.
-         </dd><dt><span class="term"><tt class="option">--compress</tt></span></dt><dd>
-           Turn on gzip compression of output.
-         </dd><dt><span class="term"><tt class="option">--html</tt></span></dt><dd>
-           Use the <span class="acronym">HTML</span> parser.
-         </dd><dt><span class="term"><tt class="option">--xmlout</tt></span></dt><dd>Used in conjunction with <tt class="option">--html</tt>. 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.</dd><dt><span class="term"><tt class="option">--push</tt></span></dt><dd>
-           Use the push mode of the parser.
-         </dd><dt><span class="term"><tt class="option">--memory</tt></span></dt><dd>
-          Parse from memory.
-         </dd><dt><span class="term"><tt class="option">--maxmem</tt> <i class="replaceable"><tt>nnbytes</tt></i></span></dt><dd>Test the parser memory
-  support. <i class="replaceable"><tt>nnbytes</tt></i> 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.</dd><dt><span class="term"><tt class="option">--nowarning</tt></span></dt><dd>
-          Do not emit warnings from the parser and/or validator.
-         </dd><dt><span class="term"><tt class="option">--noblanks</tt></span></dt><dd>
-          Drop ignorable blank spaces.
-         </dd><dt><span class="term"><tt class="option">--format</tt></span></dt><dd>
-          Reformat and reindent the output. The $XMLLINT_INDENT
-          environment variable controls the indentation (default 
-          value is two spaces "  ").
-         </dd><dt><span class="term"><tt class="option">--testIO</tt></span></dt><dd>
-          Test user input/output support.
-         </dd><dt><span class="term"><tt class="option">--encode</tt> <i class="replaceable"><tt>encoding</tt></i></span></dt><dd>
-          Output in the given encoding.
-         </dd><dt><span class="term"><tt class="option">--catalogs</tt></span></dt><dd>
-          Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog
-          is used by default.
-         </dd><dt><span class="term"><tt class="option">--nocatalogs</tt></span></dt><dd>
-          Do not use any catalogs.
-         </dd><dt><span class="term"><tt class="option">--auto</tt></span></dt><dd>
-          Generate a small document for testing purposes.
-         </dd><dt><span class="term"><tt class="option">--xinclude</tt></span></dt><dd>
-          Do XInclude processing.
-         </dd><dt><span class="term"><tt class="option">--noxincludenode</tt></span></dt><dd>
-          Do XInclude processing but do not generate XInclude start and end
-          nodes.
-         </dd><dt><span class="term"><tt class="option">--loaddtd</tt></span></dt><dd>
-          Fetch external DTD.
-         </dd><dt><span class="term"><tt class="option">--dtdattr</tt></span></dt><dd>
-          Fetch external DTD and populate the tree with inherited attributes.
-         </dd><dt><span class="term"><tt class="option">--dropdtd</tt></span></dt><dd>
-           Remove <span class="acronym">DTD</span> from output.
-         </dd><dt><span class="term"><tt class="option">--stream</tt></span></dt><dd>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.</dd><dt><span class="term"><tt class="option">--walker</tt></span></dt><dd>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.</dd><dt><span class="term"><tt class="option">--chkregister</tt></span></dt><dd>Turn on node registration. Useful for developers testing
-         libxml2 node tracking code.</dd><dt><span class="term"><tt class="option">--pattern</tt> <i class="replaceable"><tt>patternvalue</tt></i></span></dt><dd>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.</dd><dt><span class="term"><tt class="option">--relaxng</tt> <i class="replaceable"><tt>schema</tt></i></span></dt><dd>Use RelaxNG file named <i class="replaceable"><tt>schema</tt></i> for
-         validation.</dd><dt><span class="term"><tt class="option">--schema</tt> <i class="replaceable"><tt>schema</tt></i></span></dt><dd>Use a W3C XML Schema file named <i class="replaceable"><tt>schema</tt></i> for validation.</dd><dt><span class="term">
-      <tt class="option">--c14n</tt></span></dt><dd>Use the W3C XML Canonicalisation (C14N) to
-serialize the result of parsing to stdout. It keeps comments in
-the result.</dd></dl></div></div><div class="refsect1" lang="en"><a name="shell"></a><h2>Shell</h2><p>
-      <span class="application">xmllint</span> offers an interactive shell mode
-      invoked with the <tt class="option">--shell</tt> command. Available commands in
-      shell mode include:
-    </p><div class="variablelist"><dl><dt><span class="term"><tt class="option">base</tt></span></dt><dd>
-           display XML base of the node
-         </dd><dt><span class="term"><tt class="option">bye</tt></span></dt><dd>
-           leave shell
-         </dd><dt><span class="term"><tt class="option">cat <i class="replaceable"><tt>node</tt></i></tt></span></dt><dd>
-           Display node if given or current node.
-         </dd><dt><span class="term"><tt class="option">cd <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
-           Change the current node to <i class="replaceable"><tt>path</tt></i> (if given
-           and unique) or root if no argument given.
-         </dd><dt><span class="term"><tt class="option">dir <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
-           Dumps information about the node (namespace, attributes, content).
-         </dd><dt><span class="term"><tt class="option">du <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
-           Show the structure of the subtree under path or the current node.
-         </dd><dt><span class="term"><tt class="option">exit</tt></span></dt><dd>
-           Leave the shell.
-         </dd><dt><span class="term"><tt class="option">help</tt></span></dt><dd>
-           Show this help.
-         </dd><dt><span class="term"><tt class="option">free</tt></span></dt><dd>
-           Display memory usage.
-         </dd><dt><span class="term"><tt class="option">load <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
-           Load a new document with the given name.
-         </dd><dt><span class="term"><tt class="option">ls <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
-           List contents of <i class="replaceable"><tt>path</tt></i> (if given) or the
-           current directory.
-         </dd><dt><span class="term"><tt class="option">pwd</tt></span></dt><dd>
-           Display the path to the current node.
-         </dd><dt><span class="term"><tt class="option">quit</tt></span></dt><dd>
-           Leave the shell.
-         </dd><dt><span class="term"><tt class="option">save <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
-           Saves the current document to <i class="replaceable"><tt>name</tt></i> if
-           given or to the original name.
-         </dd><dt><span class="term"><tt class="option">validate</tt></span></dt><dd>
-           Check the document for error.
-         </dd><dt><span class="term"><tt class="option">write <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
-           Write the current node to the given filename.
-         </dd></dl></div></div><div class="refsect1" lang="en"><h2>Catalogs</h2><p>Catalog behavior can be changed by redirecting
-     queries to the user's own set of catalogs. This can be done by setting the
-     <tt class="varname">XML_CATALOG_FILES</tt> environment variable to a list of
-     catalogs. An empty one should deactivate loading the default
-      <tt class="filename">/etc/xml/catalog</tt> default catalog.</p></div><div class="refsect1" lang="en"><h2>Debugging Catalogs</h2><p>Setting the environment variable <tt class="varname">XML_DEBUG_CATALOG</tt>
-    using the command <b class="command">"export XML_DEBUG_CATALOG="</b>
-    outputs debugging information related to catalog operations.</p></div><div class="refsect1" lang="en"><h2>Error Return Codes</h2><p>On the completion of execution, <span class="application">Xmllint</span>
-    returns the following error codes:</p><div class="variablelist"><dl><dt><span class="term">0</span></dt><dd>No error</dd><dt><span class="term">1</span></dt><dd>Unclassified</dd><dt><span class="term">2</span></dt><dd>Error in DTD</dd><dt><span class="term">3</span></dt><dd>Validation error</dd><dt><span class="term">4</span></dt><dd>Validation error</dd><dt><span class="term">5</span></dt><dd>Error in schema compilation</dd><dt><span class="term">6</span></dt><dd>Error writing output</dd><dt><span class="term">7</span></dt><dd>Error in pattern (generated when
-         [<span class="optional">--pattern</span>] option is used)</dd><dt><span class="term">8</span></dt><dd>Error in Reader registration (generated when
-         [<span class="optional">--chkregister</span>] option is used)</dd><dt><span class="term">9</span></dt><dd>Out of memory error</dd></dl></div></div></div></body></html>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmllint</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmllint &#8212; command line <acronym class="acronym">XML</acronym> tool</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmllint</code>  [ <code class="option">--version</code>  |   <code class="option">--debug</code>  |   <code class="option">--shell</code>  |   <code class="option">--xpath "<em class="replaceable"><code>XPath_expression</code></em>"</code>  |   <code class="option">--debugent</code>  |   <code class="option">--copy</code>  |   <code class="option">--recover</code>  |   <code class="option">--noent</code>  |   <code class="option">--noout</code>  |   <code class="option">--nonet</code>  |   <code class="option">--path "<em class="replaceable"><code>PATH(S)</code></em>"</code>  |   <code class="option">--load-trace</code>  |   <code class="option">--htmlout</code>  |   <code class="option">--nowrap</code>  |   <code class="option">--valid</code>  |   <code class="option">--postvalid</code>  |   <code class="option">--dtdvalid <em class="replaceable"><code>URL</code></em></code>  |   <code class="option">--dtdvalidfpi <em class="replaceable"><code>FPI</code></em></code>  |   <code class="option">--timing</code>  |   <code class="option">--output <em class="replaceable"><code>FILE</code></em></code>  |   <code class="option">--repeat</code>  |   <code class="option">--insert</code>  |   <code class="option">--compress</code>  |   <code class="option">--html</code>  |   <code class="option">--xmlout</code>  |   <code class="option">--push</code>  |   <code class="option">--memory</code>  |   <code class="option">--maxmem <em class="replaceable"><code>NBBYTES</code></em></code>  |   <code class="option">--nowarning</code>  |   <code class="option">--noblanks</code>  |   <code class="option">--nocdata</code>  |   <code class="option">--format</code>  |   <code class="option">--encode <em class="replaceable"><code>ENCODING</code></em></code>  |   <code class="option">--dropdtd</code>  |   <code class="option">--nsclean</code>  |   <code class="option">--testIO</code>  |   <code class="option">--catalogs</code>  |   <code class="option">--nocatalogs</code>  |   <code class="option">--auto</code>  |   <code class="option">--xinclude</code>  |   <code class="option">--noxincludenode</code>  |   <code class="option">--loaddtd</code>  |   <code class="option">--dtdattr</code>  |   <code class="option">--stream</code>  |   <code class="option">--walker</code>  |   <code class="option">--pattern <em class="replaceable"><code>PATTERNVALUE</code></em></code>  |   <code class="option">--chkregister</code>  |   <code class="option">--relaxng <em class="replaceable"><code>SCHEMA</code></em></code>  |   <code class="option">--schema <em class="replaceable"><code>SCHEMA</code></em></code>  |   <code class="option">--c14n</code> ] { <em class="replaceable"><code>XML-FILE(S)</code></em>...  |   - }</p></div><div class="cmdsynopsis"><p><code class="command">xmllint</code>   <code class="option">--help</code> </p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
+               The <span class="command"><strong>xmllint</strong></span> program parses one or more <acronym class="acronym">XML</acronym> files,
+               specified on the command line as <em class="replaceable"><code>XML-FILE</code></em>
+               (or the standard input if the filename provided
+               is <span class="bold"><strong>-</strong></span> ). It prints various types of
+               output, depending upon the options selected. It is useful for detecting
+               errors both in <acronym class="acronym">XML</acronym> code and in
+               the <acronym class="acronym">XML</acronym> parser itself.
+       </p><p><span class="command"><strong>xmllint</strong></span> is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.</p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
+               <span class="command"><strong>xmllint</strong></span> accepts the following options (in alphabetical order):
+       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--auto</code></span></dt><dd><p>Generate a small document for testing purposes.</p></dd><dt><span class="term"><code class="option">--catalogs</code></span></dt><dd><p>
+                       Use the <acronym class="acronym">SGML</acronym> catalog(s) from <code class="envar">SGML_CATALOG_FILES</code>.
+                       Otherwise <acronym class="acronym">XML</acronym> catalogs starting
+                       from <code class="filename">/etc/xml/catalog</code> are used by default.
+               </p></dd><dt><span class="term"><code class="option">--chkregister</code></span></dt><dd><p>
+                       Turn on node registration. Useful for developers testing <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> node tracking code.
+               </p></dd><dt><span class="term"><code class="option">--compress</code></span></dt><dd><p>
+                       Turn on <span class="citerefentry"><span class="refentrytitle">gzip</span>(1)</span> compression of output.
+               </p></dd><dt><span class="term"><code class="option">--copy</code></span></dt><dd><p>Test the internal copy implementation.</p></dd><dt><span class="term"><code class="option">--c14n</code></span></dt><dd><p>
+                       Use the W3C <acronym class="acronym">XML</acronym> Canonicalisation (<acronym class="acronym">C14N</acronym>) to
+                       serialize the result of parsing to <code class="filename">stdout</code>.
+                       It keeps comments in the result.
+               </p></dd><dt><span class="term"><code class="option">--dtdvalid <em class="replaceable"><code>URL</code></em></code></span></dt><dd><p>
+                       Use the <acronym class="acronym">DTD</acronym> specified by
+                       an <em class="replaceable"><code>URL</code></em> for validation.
+               </p></dd><dt><span class="term"><code class="option">--dtdvalidfpi <em class="replaceable"><code>FPI</code></em></code></span></dt><dd><p>
+                       Use the <acronym class="acronym">DTD</acronym> specified by a Formal Public
+                       Identifier <em class="replaceable"><code>FPI</code></em> for validation, note that this
+                       will require a catalog exporting that Formal Public Identifier to work.
+               </p></dd><dt><span class="term"><code class="option">--debug</code></span></dt><dd><p>
+                       Parse a file and output an annotated tree of the
+                       in-memory version of the document.
+               </p></dd><dt><span class="term"><code class="option">--debugent</code></span></dt><dd><p>Debug the entities defined in the document.</p></dd><dt><span class="term"><code class="option">--dropdtd</code></span></dt><dd><p>Remove <acronym class="acronym">DTD</acronym> from output.</p></dd><dt><span class="term"><code class="option">--dtdattr</code></span></dt><dd><p>
+                       Fetch external <acronym class="acronym">DTD</acronym> and populate the tree with
+                       inherited attributes.
+               </p></dd><dt><span class="term"><code class="option">--encode <em class="replaceable"><code>ENCODING</code></em></code></span></dt><dd><p>Output in the given encoding. Note that this works for full document not fragments or result from XPath queries.</p></dd><dt><span class="term"><code class="option">--format</code></span></dt><dd><p>
+                       Reformat and reindent the output. The <code class="envar">XMLLINT_INDENT</code>
+                       environment variable controls the indentation. The default value is two
+                       spaces "  ").
+               </p></dd><dt><span class="term"><code class="option">--help</code></span></dt><dd><p>Print out a short usage summary for <span class="command"><strong>xmllint</strong></span>.</p></dd><dt><span class="term"><code class="option">--html</code></span></dt><dd><p>Use the <acronym class="acronym">HTML</acronym> parser.</p></dd><dt><span class="term"><code class="option">--htmlout</code></span></dt><dd><p>
+                       Output results as an <acronym class="acronym">HTML</acronym> file. This
+                       causes <span class="command"><strong>xmllint</strong></span> to output the necessary <acronym class="acronym">HTML</acronym>
+                       tags surrounding the result tree output so the results can be
+                       displayed/viewed in a browser.
+               </p></dd><dt><span class="term"><code class="option">--insert</code></span></dt><dd><p>Test for valid insertions.</p></dd><dt><span class="term"><code class="option">--loaddtd</code></span></dt><dd><p>Fetch an external <acronym class="acronym">DTD</acronym>.</p></dd><dt><span class="term"><code class="option">--load-trace</code></span></dt><dd><p>
+                       Display all the documents loaded during the processing
+                       to <code class="filename">stderr</code>.
+               </p></dd><dt><span class="term"><code class="option">--maxmem <em class="replaceable"><code>NNBYTES</code></em></code></span></dt><dd><p>
+                       Test the parser memory support. <em class="replaceable"><code>NNBYTES</code></em>
+                       is the maximum number of bytes the library is allowed to allocate.
+                       This can also be used to make sure batch processing
+                       of <acronym class="acronym">XML</acronym> files will not exhaust the virtual memory
+                       of the server running them.
+               </p></dd><dt><span class="term"><code class="option">--memory</code></span></dt><dd><p>Parse from memory.</p></dd><dt><span class="term"><code class="option">--noblanks</code></span></dt><dd><p>Drop ignorable blank spaces.</p></dd><dt><span class="term"><code class="option">--nocatalogs</code></span></dt><dd><p>Do not use any catalogs.</p></dd><dt><span class="term"><code class="option">--nocdata</code></span></dt><dd><p>Substitute CDATA section by equivalent text nodes.</p></dd><dt><span class="term"><code class="option">--noent</code></span></dt><dd><p>
+                       Substitute entity values for entity references. By default, <span class="command"><strong>xmllint</strong></span>
+                       leaves entity references in place.
+               </p></dd><dt><span class="term"><code class="option">--nonet</code></span></dt><dd><p>
+                       Do not use the Internet to fetch <acronym class="acronym">DTD</acronym>s or entities.
+               </p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
+                       Suppress output. By default, <span class="command"><strong>xmllint</strong></span> outputs the result tree.
+               </p></dd><dt><span class="term"><code class="option">--nowarning</code></span></dt><dd><p>Do not emit warnings from the parser and/or validator.</p></dd><dt><span class="term"><code class="option">--nowrap</code></span></dt><dd><p>Do not output <acronym class="acronym">HTML</acronym> doc wrapper.</p></dd><dt><span class="term"><code class="option">--noxincludenode</code></span></dt><dd><p>
+                       Do XInclude processing but do not generate XInclude start and end nodes.
+               </p></dd><dt><span class="term"><code class="option">--nsclean</code></span></dt><dd><p>Remove redundant namespace declarations.</p></dd><dt><span class="term"><code class="option">--output <em class="replaceable"><code>FILE</code></em></code></span></dt><dd><p>
+                       Define a file path where <span class="command"><strong>xmllint</strong></span> will save the result of parsing.
+                       Usually the programs build a tree and save it
+                       on <code class="filename">stdout</code>, with this option
+                       the result <acronym class="acronym">XML</acronym> instance will be saved onto a file.
+               </p></dd><dt><span class="term"><code class="option">--path "<em class="replaceable"><code>PATH(S)</code></em>"</code></span></dt><dd><p>
+                       Use the (space- or colon-separated) list of filesystem paths specified
+                       by <em class="replaceable"><code>PATHS</code></em> to load <acronym class="acronym">DTD</acronym>s or
+                       entities. Enclose space-separated lists by quotation marks.
+               </p></dd><dt><span class="term"><code class="option">--pattern <em class="replaceable"><code>PATTERNVALUE</code></em></code></span></dt><dd><p>
+                       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.
+               </p></dd><dt><span class="term"><code class="option">--postvalid</code></span></dt><dd><p>Validate after parsing has completed.</p></dd><dt><span class="term"><code class="option">--push</code></span></dt><dd><p>Use the push mode of the parser.</p></dd><dt><span class="term"><code class="option">--recover</code></span></dt><dd><p>Output any parsable portions of an invalid document.</p></dd><dt><span class="term"><code class="option">--relaxng <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
+                       Use RelaxNG file named <em class="replaceable"><code>SCHEMA</code></em>
+                       for validation.
+               </p></dd><dt><span class="term"><code class="option">--repeat</code></span></dt><dd><p>Repeat 100 times, for timing or profiling.</p></dd><dt><span class="term"><code class="option">--schema <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
+                       Use a W3C <acronym class="acronym">XML</acronym> Schema file
+                       named <em class="replaceable"><code>SCHEMA</code></em> for validation.
+               </p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
+                       Run a navigating shell. Details on available commands in shell mode
+                       are below (see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called &#8220;SHELL COMMANDS&#8221;</a>).
+               </p></dd><dt><span class="term"><code class="option">--xpath "<em class="replaceable"><code>XPath_expression</code></em>"</code></span></dt><dd><p>
+                       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.
+               </p></dd><dt><span class="term"><code class="option">--stream</code></span></dt><dd><p>
+                       Use streaming <acronym class="acronym">API</acronym> - useful when used in combination
+                       with <code class="option">--relaxng</code> or <code class="option">--valid</code> options
+                       for validation of files that are too large to be held in memory.
+               </p></dd><dt><span class="term"><code class="option">--testIO</code></span></dt><dd><p>Test user input/output support.</p></dd><dt><span class="term"><code class="option">--timing</code></span></dt><dd><p>
+                       Output information about the time it takes <span class="command"><strong>xmllint</strong></span> to perform the
+                       various steps.
+               </p></dd><dt><span class="term"><code class="option">--valid</code></span></dt><dd><p>
+                       Determine if the document is a valid instance of the included
+                       Document Type Definition (<acronym class="acronym">DTD</acronym>).
+                       A <acronym class="acronym">DTD</acronym> to be validated against also can be
+                       specified at the command line using the <code class="option">--dtdvalid</code>
+                       option. By default, <span class="command"><strong>xmllint</strong></span> also checks to determine if the
+                       document is well-formed.
+               </p></dd><dt><span class="term"><code class="option">--version</code></span></dt><dd><p>
+                       Display the version of <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> used.
+               </p></dd><dt><span class="term"><code class="option">--walker</code></span></dt><dd><p>
+                       Test the walker module, which is a reader interface but for a
+                       document tree, instead of using the reader <acronym class="acronym">API</acronym> on
+                       an unparsed document it works on an existing in-memory tree. Used for
+                       debugging.
+               </p></dd><dt><span class="term"><code class="option">--xinclude</code></span></dt><dd><p>Do XInclude processing.</p></dd><dt><span class="term"><code class="option">--xmlout</code></span></dt><dd><p>
+                       Used in conjunction with <code class="option">--html</code>. Usually
+                       when <acronym class="acronym">HTML</acronym> is parsed the document is saved with
+                       the <acronym class="acronym">HTML</acronym> serializer. But with this option the
+                       resulting document is saved with the <acronym class="acronym">XML</acronym>
+                       serializer. This is primarily used to
+                       generate <acronym class="acronym">XHTML</acronym> from <acronym class="acronym">HTML</acronym> input.
+               </p></dd></dl></div></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
+               <span class="command"><strong>xmllint</strong></span> offers an interactive shell mode invoked with
+               the <code class="option">--shell</code> command. Available commands in shell mode
+               include (in alphabetical order):
+       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="command"><strong>base</strong></span></span></dt><dd><p>Display <acronym class="acronym">XML</acronym> base of the node.</p></dd><dt><span class="term"><span class="command"><strong>bye</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>cat <em class="replaceable"><code>NODE</code></em></strong></span></span></dt><dd><p>Display the given node or the current one.</p></dd><dt><span class="term"><span class="command"><strong>cd <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
+                       Change the current node to the given path (if unique) or root if no
+                       argument is given.
+               </p></dd><dt><span class="term"><span class="command"><strong>dir <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
+                       Dumps information about the node (namespace, attributes, content).
+               </p></dd><dt><span class="term"><span class="command"><strong>du <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
+                       Show the structure of the subtree under the given path or the current node.
+               </p></dd><dt><span class="term"><span class="command"><strong>exit</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>help</strong></span></span></dt><dd><p>Show this help.</p></dd><dt><span class="term"><span class="command"><strong>free</strong></span></span></dt><dd><p>Display memory usage.</p></dd><dt><span class="term"><span class="command"><strong>load <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>Load a new document with the given filename.</p></dd><dt><span class="term"><span class="command"><strong>ls <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>List contents of the given path or the current directory.</p></dd><dt><span class="term"><span class="command"><strong>pwd</strong></span></span></dt><dd><p>Display the path to the current node.</p></dd><dt><span class="term"><span class="command"><strong>quit</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>save <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>
+                       Save the current document to the given filename or to the original name.
+               </p></dd><dt><span class="term"><code class="option">validate</code></span></dt><dd><p>Check the document for errors.</p></dd><dt><span class="term"><span class="command"><strong>write <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>Write the current node to the given filename.</p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">SGML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">SGML</acronym> catalog behavior can be changed by redirecting
+                       queries to the user's own set of catalogs. This can be done by setting
+                       the <code class="envar">SGML_CATALOG_FILES</code> environment variable to a list
+                       of catalogs. An empty one should deactivate loading the
+                       default <code class="filename">/etc/sgml/catalog</code> catalog.
+               </p></dd><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
+                       queries to the user's own set of catalogs. This can be done by setting
+                       the <code class="envar">XML_CATALOG_FILES</code> environment variable to a list
+                       of catalogs. An empty one should deactivate loading the
+                       default <code class="filename">/etc/xml/catalog</code> catalog.
+               </p></dd><dt><span class="term"><code class="envar">XML_DEBUG_CATALOG</code></span></dt><dd><p>Setting the environment variable <code class="envar">XML_DEBUG_CATALOG</code>
+                       to <em class="parameter"><code>non-zero</code></em> using the <span class="command"><strong>export</strong></span>
+                       command outputs debugging information related to catalog operations.
+               </p></dd><dt><span class="term"><code class="envar">XMLLINT_INDENT</code></span></dt><dd><p>Setting the environment variable <code class="envar">XMLLINT_INDENT</code>
+                       controls the indentation. The default value is two spaces "  ".
+               </p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
+               <span class="command"><strong>xmllint</strong></span> return codes provide information that can be used when
+               calling it from scripts.
+       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Unclassified</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Error in <acronym class="acronym">DTD</acronym></p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Validation error</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Validation error</p></dd><dt><span class="term"><span class="errorcode">5</span></span></dt><dd><p>Error in schema compilation</p></dd><dt><span class="term"><span class="errorcode">6</span></span></dt><dd><p>Error writing output</p></dd><dt><span class="term"><span class="errorcode">7</span></span></dt><dd><p>
+                       Error in pattern (generated when <code class="option">--pattern</code> option is used)
+               </p></dd><dt><span class="term"><span class="errorcode">8</span></span></dt><dd><p>
+                       Error in Reader registration (generated
+                       when <code class="option">--chkregister</code> option is used)
+               </p></dd><dt><span class="term"><span class="errorcode">9</span></span></dt><dd><p>Out of memory error</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
+       </p><p>
+               More information can be found at
+               </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="http://www.xmlsoft.org/" target="_top">http://www.xmlsoft.org/</a>
+                               </p></li><li class="listitem"><p>W3C <acronym class="acronym">XSLT</acronym> page <a class="ulink" href="http://www.w3.org/TR/xslt" target="_top">http://www.w3.org/TR/xslt</a>
+                               </p></li></ul></div><p>
+       </p></div></div></body></html>
index abb4bf7..7335faf 100644 (file)
@@ -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 <winsock2.h>
 #else
 /**
index d31f16a..9969ae7 100644 (file)
@@ -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
index 390a236..cfd873a 100644 (file)
@@ -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
index 40cf7df..8596755 100644 (file)
@@ -10,7 +10,6 @@
 
 #if defined(_WIN32_WCE)
 #undef HAVE_ERRNO_H
-#include <windows.h>
 #include "wincecompat.h"
 #else
 #define HAVE_SYS_STAT_H
 #define ICONV_CONST const
 #endif
 
-#ifdef NEED_SOCKETS
-#include <wsockcompat.h>
-#endif
-
 /*
  * Windows platforms may define except 
  */
index e6a1a99..0484ee3 100644 (file)
@@ -8,7 +8,7 @@
 #ifdef _WIN32_WCE
 #include <winsock.h>
 #else
-#undef HAVE_ERRNO_H
+#include <errno.h>
 #include <winsock2.h>
 
 /* the following is a workaround a problem for 'inline' keyword in said
 #endif
 #endif
 
-#if defined( __MINGW32__ ) || defined( _MSC_VER )
-/* Include <errno.h> here to ensure that it doesn't get included later
- * (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */
-#include <errno.h>
-#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__ */
index f13e9de..4fe56d2 100644 (file)
--- 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__ */
index 4eb20ca..46278ea 100644 (file)
@@ -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 <veillard@redhat.com>
-- upstream release 2.9.6 see http://xmlsoft.org/news.html
+* Thu Nov  2 2017 Daniel Veillard <veillard@redhat.com>
+- upstream release 2.9.7 see http://xmlsoft.org/news.html
 
index 5bc6555..54fa026 100644 (file)
--- 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
 #endif
 
 
-#if defined(__MINGW32__) || defined(_WIN32_WCE)
-#ifndef _WINSOCKAPI_
-#define _WINSOCKAPI_
-#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <wsockcompat.h>
-#include <winsock2.h>
-#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:
index 0533102..9cd2292 100644 (file)
@@ -11,7 +11,6 @@
  * daniel@veillard.com
  */
 
-#define NEED_SOCKETS
 #define IN_LIBXML
 #include "libxml.h"
 
 #define XML_SOCKLEN_T unsigned int
 #endif
 
-#if defined(__MINGW32__) || defined(_WIN32_WCE)
-#ifndef _WINSOCKAPI_
-#define _WINSOCKAPI_
-#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <wsockcompat.h>
-#include <winsock2.h>
-#undef XML_SOCKLEN_T
-#define XML_SOCKLEN_T unsigned int
 #endif
 
 #include <libxml/globals.h>
@@ -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) {
 
index 3966ac8..ad5abb7 100644 (file)
    #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
 
index 28d0cd2..1c5e036 100644 (file)
--- 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
index 43a0f5a..efb2387 100644 (file)
@@ -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 '/'
index 8ff56c2..f9583a5 100755 (executable)
@@ -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",
index 3d3e69c..b12e1ae 100644 (file)
--- a/relaxng.c
+++ b/relaxng.c
@@ -20,6 +20,7 @@
 
 #include <string.h>
 #include <stdio.h>
+#include <stddef.h>
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
@@ -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 (file)
index 0000000..e6035ca
--- /dev/null
@@ -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
index 714de27..6201a66 100644 (file)
--- 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 <windows.h>
 #include <string.h>
 
@@ -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++) {
index 547e54d..449de01 100644 (file)
@@ -6,4 +6,6 @@
   <p><p>a span</p>n<p>ing one</p></p>
   <p><p>and an unbal</p><empty/>anced test</p>
   <p>for empty string <seq>123</seq></p>
+  <p id="1">a<b>b</b>c</p>
+  <p id="2"><!--X-->abc</p>
 </chapter>
diff --git a/test/XPath/tests/strbase b/test/XPath/tests/strbase
new file mode 100644 (file)
index 0000000..b818325
--- /dev/null
@@ -0,0 +1 @@
+//p[.='abc']
index e5d5d1b..f95ae1c 100644 (file)
@@ -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;
index e52f263..bca4954 100644 (file)
--- a/threads.c
+++ b/threads.c
@@ -27,6 +27,7 @@
 #ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #elif defined HAVE_WIN32_THREADS
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #ifndef HAVE_COMPILER_TLS
 #include <process.h>
@@ -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) {
index 19aebf2..0c6346b 100644 (file)
--- a/timsort.h
+++ b/timsort.h
 /*
- * 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 <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
-#else
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#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 (file)
--- a/tree.c
+++ b/tree.c
@@ -19,6 +19,7 @@
 #include "libxml.h"
 
 #include <string.h> /* for memset() only ! */
+#include <stddef.h>
 #include <limits.h>
 #ifdef HAVE_CTYPE_H
 #include <ctype.h>
@@ -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 (file)
--- 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 (file)
--- 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");
index 1889376..f579923 100644 (file)
@@ -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)
index d16c1a2..115a451 100644 (file)
@@ -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"
index 891b57e..4e184a3 100644 (file)
@@ -9,7 +9,6 @@
 
 #if defined(_WIN32_WCE)
 #undef HAVE_ERRNO_H
-#include <windows.h>
 #include "wincecompat.h"
 #else
 #define HAVE_SYS_STAT_H
 #define ICONV_CONST const
 #endif
 
-#ifdef NEED_SOCKETS
-#include <wsockcompat.h>
-#endif
-
 /*
  * Windows platforms may define except 
  */
diff --git a/xmlIO.c b/xmlIO.c
index 6891ff9..0fd8c49 100644 (file)
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -12,6 +12,7 @@
 #include "libxml.h"
 
 #include <string.h>
+#include <stddef.h>
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
@@ -39,7 +40,8 @@
 #include <lzma.h>
 #endif
 
-#if defined(WIN32) || defined(_WIN32)
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif
 
 #include <winnls.h> /* 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=='/')
index 006f0cc..c02b97f 100644 (file)
@@ -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;
     }
 
index c175730..a691aa6 100644 (file)
--- a/xmllint.c
+++ b/xmllint.c
 #include <stdarg.h>
 #include <assert.h>
 
-#if defined (_WIN32) && !defined(__CYGWIN__)
-#if defined (_MSC_VER) || defined(__BORLANDC__)
-#include <winsock2.h>
-#pragma comment(lib, "ws2_32.lib")
-#define gettimeofday(p1,p2)
-#endif /* _MSC_VER */
-#endif /* _WIN32 */
-
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
 #include <time.h>
 #endif
 
-#ifdef __MINGW32__
-#define _WINSOCKAPI_
-#include <wsockcompat.h>
-#include <winsock2.h>
-#undef XML_SOCKLEN_T
-#define XML_SOCKLEN_T unsigned int
-#endif
-
 #ifdef HAVE_SYS_TIMEB_H
 #include <sys/timeb.h>
 #endif
index 6400395..6f16c4b 100644 (file)
@@ -487,7 +487,7 @@ xmlMemFree(void *ptr)
 
 error:
     xmlGenericError(xmlGenericErrorContext,
-           "xmlMemFree(%lX) error\n", (unsigned long) ptr);
+           "xmlMemFree(%p) error\n", ptr);
     xmlMallocBreakpoint();
     return;
 }
index 7f70f9c..e3a8bd6 100644 (file)
@@ -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 <windows.h>
 
 /*
index b640264..d255fbf 100644 (file)
@@ -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)
index 1938d7e..05a12e0 100644 (file)
@@ -1742,6 +1742,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf,
                *buf = xmlStrcat(*buf, BAD_CAST "'");
                FREE_AND_NULL(str);
            }
+            /* Falls through. */
        default:
            named = 0;
        }
index c9674ba..c6c9365 100644 (file)
@@ -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;
index 69541b8..eb94e6e 100644 (file)
@@ -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 (file)
--- a/xpath.c
+++ b/xpath.c
@@ -24,6 +24,7 @@
 
 #include <limits.h>
 #include <string.h>
+#include <stddef.h>
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -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) ||