aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-10-23 20:28:14 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-10-23 20:28:14 +0000
commit205b310ec0ad7cf9a4aab02430a9a18196c07be3 (patch)
tree2bf46555dbac416ef1fa6887044fa382ce5a76e3
parent40ee796080b8c32e903502c941a2563bac75990d (diff)
parent8abae28b3cf3af8772ed9a345503a180ab536f08 (diff)
downloadandroid_external_libxml2-205b310ec0ad7cf9a4aab02430a9a18196c07be3.tar.gz
android_external_libxml2-205b310ec0ad7cf9a4aab02430a9a18196c07be3.tar.bz2
android_external_libxml2-205b310ec0ad7cf9a4aab02430a9a18196c07be3.zip
Merge "Merge remote-tracking branch \'aosp/upstream-master\' into mymerge"
am: 8abae28b3c * commit '8abae28b3cf3af8772ed9a345503a180ab536f08': (31 commits) Fix a small error in xmllint --format description Another variation of overflow in Conditional sections Add missing Null check in xmlParseExternalEntityPrivate Fix a bug in CData error handling in the push parser Fix a bug on name parsing at the end of current input buffer Fix the spurious ID already defined error Fix previous change to node sort order Avoid XSS on the search of xmlsoft.org Recover unescaped less-than character in HTML recovery parsing Fix a self assignment issue raised by clang Fail parsing early on if encoding conversion failed Do not process encoding values if the declaration if broken Silence clang's -Wunknown-attribute os400: fix various ILE/RPG types definitions. Adjust build scripts. - A typo caused an undefined symbol reference. - A structure field name did not match the corresponding C name due to a typo. - Some structured fields were not properly aligned. - The long/ulong types were wrongly mapped to 64-bit types. - A typo in a /include directive caused a compilation error. - Doc files copy now converts from UTF-8 and split long lines. - Adjust /include file name mapping translation for proper prefix handling. CVE-2015-1819 Enforce the reader to run in constant memory xmlMemUsed is not thread-safe Allow HTML serializer to output HTML5 DOCTYPE Fix support for except in nameclasses Regression test for bug #695699 Add a couple of XPath tests ...
-rw-r--r--HTMLparser.c33
-rw-r--r--HTMLtree.c3
-rw-r--r--buf.c43
-rw-r--r--doc/search.php5
-rw-r--r--include/libxml/tree.h3
-rw-r--r--include/libxml/xmlversion.h.in2
-rw-r--r--libxml.spec.in60
-rw-r--r--libxml2-config.cmake.in2
-rw-r--r--os400/libxmlrpg/HTMLparser.rpgle15
-rw-r--r--os400/libxmlrpg/SAX.rpgle6
-rw-r--r--os400/libxmlrpg/SAX2.rpgle8
-rw-r--r--os400/libxmlrpg/chvalid.rpgle5
-rw-r--r--os400/libxmlrpg/dict.rpgle9
-rw-r--r--os400/libxmlrpg/encoding.rpgle8
-rw-r--r--os400/libxmlrpg/globals.rpgle30
-rw-r--r--os400/libxmlrpg/nanoftp.rpgle2
-rw-r--r--os400/libxmlrpg/parser.rpgle41
-rw-r--r--os400/libxmlrpg/parserInternals.rpgle2
-rw-r--r--os400/libxmlrpg/schematron.rpgle2
-rw-r--r--os400/libxmlrpg/tree.rpgle28
-rw-r--r--os400/libxmlrpg/xmlIO.rpgle6
-rw-r--r--os400/libxmlrpg/xmlTypesC.rpgle24
-rw-r--r--os400/libxmlrpg/xmlmemory.rpgle19
-rw-r--r--os400/libxmlrpg/xmlreader.rpgle4
-rw-r--r--os400/libxmlrpg/xmlsave.rpgle7
-rw-r--r--os400/libxmlrpg/xmlschemastypes.rpgle10
-rw-r--r--os400/libxmlrpg/xmlstdarg.rpgle6
-rw-r--r--os400/libxmlrpg/xmlstring.rpgle4
-rw-r--r--os400/libxmlrpg/xpath.rpgle6
-rw-r--r--os400/make-rpg.sh13
-rw-r--r--os400/make.sh11
-rw-r--r--parser.c66
-rw-r--r--relaxng.c6
-rw-r--r--result/XPath/tests/chaptersbase10
-rw-r--r--result/XPath/tests/simplebase54
-rw-r--r--result/errors/754946.xml0
-rw-r--r--result/errors/754946.xml.err16
-rw-r--r--result/errors/754946.xml.str4
-rw-r--r--result/errors/754947.xml0
-rw-r--r--result/errors/754947.xml.err7
-rw-r--r--result/errors/754947.xml.str5
-rw-r--r--result/errors/cdata.xml.str4
-rw-r--r--result/relaxng/565219_00
-rw-r--r--result/relaxng/565219_0.err2
-rw-r--r--result/relaxng/565219_10
-rw-r--r--result/relaxng/565219_1.err1
-rw-r--r--result/relaxng/565219_20
-rw-r--r--result/relaxng/565219_2.err2
-rw-r--r--result/relaxng/565219_err1
-rw-r--r--result/relaxng/565219_valid0
-rw-r--r--result/valid/737840.xml10
-rw-r--r--result/valid/737840.xml.err0
-rw-r--r--result/valid/737840.xml.err.rdr0
-rw-r--r--test/XPath/tests/chaptersbase1
-rw-r--r--test/XPath/tests/simplebase6
-rw-r--r--test/errors/754946.xml1
-rw-r--r--test/errors/754947.xml1
-rw-r--r--test/relaxng/565219.rng14
-rw-r--r--test/relaxng/565219_0.xml1
-rw-r--r--test/relaxng/565219_1.xml1
-rw-r--r--test/relaxng/565219_2.xml1
-rw-r--r--test/valid/737840.xml10
-rw-r--r--test/valid/dtds/737840.ent1
-rw-r--r--threads.c6
-rw-r--r--timsort.h74
-rw-r--r--tree.c19
-rw-r--r--valid.c6
-rw-r--r--xmllint.c2
-rw-r--r--xmlmemory.c14
-rw-r--r--xmlreader.c20
-rw-r--r--xmlschemas.c6
-rw-r--r--xpath.c22
72 files changed, 615 insertions, 196 deletions
diff --git a/HTMLparser.c b/HTMLparser.c
index d329d3b5..19c10c3f 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -2948,8 +2948,9 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
/**
- * htmlParseCharData:
+ * htmlParseCharDataInternal:
* @ctxt: an HTML parser context
+ * @readahead: optional read ahead character in ascii range
*
* parse a CharData section.
* if we are within a CDATA section ']]>' marks an end of section.
@@ -2958,12 +2959,15 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
*/
static void
-htmlParseCharData(htmlParserCtxtPtr ctxt) {
- xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 5];
+htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) {
+ xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 6];
int nbchar = 0;
int cur, l;
int chunk = 0;
+ if (readahead)
+ buf[nbchar++] = readahead;
+
SHRINK;
cur = CUR_CHAR(l);
while (((cur != '<') || (ctxt->token == '<')) &&
@@ -3043,6 +3047,21 @@ htmlParseCharData(htmlParserCtxtPtr ctxt) {
}
/**
+ * htmlParseCharData:
+ * @ctxt: an HTML parser context
+ *
+ * parse a CharData section.
+ * if we are within a CDATA section ']]>' marks an end of section.
+ *
+ * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
+ */
+
+static void
+htmlParseCharData(htmlParserCtxtPtr ctxt) {
+ htmlParseCharDataInternal(ctxt, 0);
+}
+
+/**
* htmlParseExternalID:
* @ctxt: an HTML parser context
* @publicID: a xmlChar** receiving PubidLiteral
@@ -3690,6 +3709,14 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED,
"htmlParseStartTag: invalid element name\n",
NULL, NULL);
+ /* if recover preserve text on classic misconstructs */
+ if ((ctxt->recovery) && ((IS_BLANK_CH(CUR)) || (CUR == '<') ||
+ (CUR == '=') || (CUR == '>') || (((CUR >= '0') && (CUR <= '9'))))) {
+ htmlParseCharDataInternal(ctxt, '<');
+ return(-1);
+ }
+
+
/* Dump the bogus tag like browsers do */
while ((IS_CHAR_CH(CUR)) && (CUR != '>') &&
(ctxt->instate != XML_PARSER_EOF))
diff --git a/HTMLtree.c b/HTMLtree.c
index 5c57fc57..2fd0c9c5 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -668,7 +668,8 @@ htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
xmlOutputBufferWriteString(buf, " ");
xmlBufWriteQuotedString(buf->buffer, cur->SystemID);
}
- } else if (cur->SystemID != NULL) {
+ } else if (cur->SystemID != NULL &&
+ xmlStrcmp(cur->SystemID, BAD_CAST "about:legacy-compat")) {
xmlOutputBufferWriteString(buf, " SYSTEM ");
xmlBufWriteQuotedString(buf->buffer, cur->SystemID);
}
diff --git a/buf.c b/buf.c
index 6efc7b67..07922ff6 100644
--- a/buf.c
+++ b/buf.c
@@ -27,6 +27,7 @@
#include <libxml/tree.h>
#include <libxml/globals.h>
#include <libxml/tree.h>
+#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
#include "buf.h"
#define WITH_BUFFER_COMPAT
@@ -299,7 +300,8 @@ xmlBufSetAllocationScheme(xmlBufPtr buf,
if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
(scheme == XML_BUFFER_ALLOC_EXACT) ||
(scheme == XML_BUFFER_ALLOC_HYBRID) ||
- (scheme == XML_BUFFER_ALLOC_IMMUTABLE)) {
+ (scheme == XML_BUFFER_ALLOC_IMMUTABLE) ||
+ (scheme == XML_BUFFER_ALLOC_BOUNDED)) {
buf->alloc = scheme;
if (buf->buffer)
buf->buffer->alloc = scheme;
@@ -458,6 +460,18 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
size = buf->use + len + 100;
#endif
+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
+ /*
+ * Used to provide parsing limits
+ */
+ if ((buf->use + len >= XML_MAX_TEXT_LENGTH) ||
+ (buf->size >= XML_MAX_TEXT_LENGTH)) {
+ xmlBufMemoryError(buf, "buffer error: text too long\n");
+ return(0);
+ }
+ if (size >= XML_MAX_TEXT_LENGTH)
+ size = XML_MAX_TEXT_LENGTH;
+ }
if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
size_t start_buf = buf->content - buf->contentIO;
@@ -739,6 +753,15 @@ xmlBufResize(xmlBufPtr buf, size_t size)
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
+ /*
+ * Used to provide parsing limits
+ */
+ if (size >= XML_MAX_TEXT_LENGTH) {
+ xmlBufMemoryError(buf, "buffer error: text too long\n");
+ return(0);
+ }
+ }
/* Don't resize if we don't have to */
if (size < buf->size)
@@ -867,6 +890,15 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
needSize = buf->use + len + 2;
if (needSize > buf->size){
+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
+ /*
+ * Used to provide parsing limits
+ */
+ if (needSize >= XML_MAX_TEXT_LENGTH) {
+ xmlBufMemoryError(buf, "buffer error: text too long\n");
+ return(-1);
+ }
+ }
if (!xmlBufResize(buf, needSize)){
xmlBufMemoryError(buf, "growing buffer");
return XML_ERR_NO_MEMORY;
@@ -938,6 +970,15 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
}
needSize = buf->use + len + 2;
if (needSize > buf->size){
+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
+ /*
+ * Used to provide parsing limits
+ */
+ if (needSize >= XML_MAX_TEXT_LENGTH) {
+ xmlBufMemoryError(buf, "buffer error: text too long\n");
+ return(-1);
+ }
+ }
if (!xmlBufResize(buf, needSize)){
xmlBufMemoryError(buf, "growing buffer");
return XML_ERR_NO_MEMORY;
diff --git a/doc/search.php b/doc/search.php
index ce1a25fb..c94e87ec 100644
--- a/doc/search.php
+++ b/doc/search.php
@@ -102,13 +102,14 @@ A:link, A:visited, A:active { text-decoration: underline }
$scope = ltrim ($scope);
if ($scope == "")
$scope = "any";
+ $querystr = htmlspecialchars($query, ENT_QUOTES, 'UTF-8');
?>
<p> The search service indexes the libxml2 and libxslt APIs and documentation as well as the xml@gnome.org and xslt@gnome.org mailing-list archives. To use it simply provide a set of keywords:
<p>
<form action="<?php echo "$PHP_SELF", "?query=", rawurlencode($query) ?>"
enctype="application/x-www-form-urlencoded" method="GET">
- <input name="query" type="TEXT" size="50" value="<?php echo $query?>">
+ <input name="query" type="TEXT" size="50" value="<?php echo $querystr?>">
<select name="scope">
<option value="any">Search All</option>
<option value="XML" <?php if ($scope == 'XML') print "selected"?>>XML resources</option>
@@ -446,7 +447,7 @@ A:link, A:visited, A:active { text-decoration: underline }
}
mysql_close($link);
$nb = count($results);
- echo "<h3 align='center'>Found $nb results for query $query</h3>\n";
+ echo "<h3 align='center'>Found $nb results for query $querystr</h3>\n";
usort($results, "resSort");
if ($nb > 0) {
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
index 2f90717c..4a9b3bc6 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -76,7 +76,8 @@ typedef enum {
XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */
XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */
- XML_BUFFER_ALLOC_HYBRID /* exact up to a threshold, and doubleit thereafter */
+ XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */
+ XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */
} xmlBufferAllocationScheme;
/**
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index 00a836fb..b173be9e 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -435,7 +435,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*/
#ifndef LIBXML_ATTR_ALLOC_SIZE
-# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
+# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# else
# define LIBXML_ATTR_ALLOC_SIZE(x)
diff --git a/libxml.spec.in b/libxml.spec.in
index 242a4fee..9029a180 100644
--- a/libxml.spec.in
+++ b/libxml.spec.in
@@ -1,3 +1,5 @@
+%global with_python3 1
+
Summary: Library providing XML and HTML support
Name: libxml2
Version: @VERSION@
@@ -6,7 +8,13 @@ License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: python python-devel zlib-devel pkgconfig xz-devel
+BuildRequires: python-devel
+%if 0%{?with_python3}
+BuildRequires: python3-devel
+%endif # with_python3
+BuildRequires: zlib-devel
+BuildRequires: pkgconfig
+BuildRequires: xz-devel
URL: http://xmlsoft.org/
%description
@@ -55,8 +63,8 @@ Group: Development/Libraries
Requires: libxml2 = %{version}-%{release}
%description python
-The libxml2-python package contains a module that permits applications
-written in the Python programming language to use the interface
+The libxml2-python package contains a Python 2 module that permits applications
+written in the Python programming language, version 2, to use the interface
supplied by the libxml2 library to manipulate XML files.
This library allows to manipulate XML files. It includes support
@@ -64,6 +72,23 @@ to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
+%if 0%{?with_python3}
+%package python3
+Summary: Python 3 bindings for the libxml2 library
+Group: Development/Libraries
+Requires: libxml2 = %{version}-%{release}
+
+%description python3
+The libxml2-python3 package contains a Python 3 module that permits
+applications written in the Python programming language, version 3, to use the
+interface supplied by the libxml2 library to manipulate XML files.
+
+This library allows to manipulate XML files. It includes support
+to read, modify and write XML and HTML files. There is DTDs support
+this includes parsing and validation even with complex DTDs, either
+at parse time or later once the document has been modified.
+%endif # with_python3
+
%prep
%setup -q
@@ -76,6 +101,13 @@ rm -fr %{buildroot}
make install DESTDIR=%{buildroot}
+%if 0%{?with_python3}
+make clean
+%configure --with-python=%{__python3}
+make install DESTDIR=%{buildroot}
+%endif # with_python3
+
+
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.la
@@ -136,14 +168,30 @@ rm -fr %{buildroot}
%files python
%defattr(-, root, root)
-%{_libdir}/python*/site-packages/libxml2.py*
-%{_libdir}/python*/site-packages/drv_libxml2.py*
-%{_libdir}/python*/site-packages/libxml2mod*
+%{_libdir}/python2*/site-packages/libxml2.py*
+%{_libdir}/python2*/site-packages/drv_libxml2.py*
+%{_libdir}/python2*/site-packages/libxml2mod*
+%doc python/TODO
+%doc python/libxml2class.txt
+%doc python/tests/*.py
+%doc doc/*.py
+%doc doc/python.html
+
+%if 0%{?with_python3}
+%files python3
+%defattr(-, root, root)
+
+%{_libdir}/python3*/site-packages/libxml2.py*
+%{_libdir}/python3*/site-packages/drv_libxml2.py*
+%{_libdir}/python3*/site-packages/__pycache__/libxml2.cpython-34.py*
+%{_libdir}/python3*/site-packages/__pycache__/drv_libxml2.cpython-34.py*
+%{_libdir}/python3*/site-packages/libxml2mod*
%doc python/TODO
%doc python/libxml2class.txt
%doc python/tests/*.py
%doc doc/*.py
%doc doc/python.html
+%endif # with_python3
%changelog
* @RELDATE@ Daniel Veillard <veillard@redhat.com>
diff --git a/libxml2-config.cmake.in b/libxml2-config.cmake.in
index ac293291..6b16fc2e 100644
--- a/libxml2-config.cmake.in
+++ b/libxml2-config.cmake.in
@@ -21,7 +21,7 @@ set(LIBXML2_VERSION_MINOR @LIBXML_MINOR_VERSION@)
set(LIBXML2_VERSION_MICRO @LIBXML_MICRO_VERSION@)
set(LIBXML2_VERSION_STRING "@VERSION@")
set(LIBXML2_INSTALL_PREFIX ${_libxml2_rootdir})
-set(LIBXML2_INCLUDE_DIRS ${_libxml2_rootdir}/include)
+set(LIBXML2_INCLUDE_DIRS ${_libxml2_rootdir}/include ${_libxml2_rootdir}/include/libxml2)
set(LIBXML2_LIBRARY_DIR ${_libxml2_rootdir}/lib)
set(LIBXML2_LIBRARIES -L${LIBXML2_LIBRARY_DIR} -lxml2)
diff --git a/os400/libxmlrpg/HTMLparser.rpgle b/os400/libxmlrpg/HTMLparser.rpgle
index 7b4a6269..d4c5f8d9 100644
--- a/os400/libxmlrpg/HTMLparser.rpgle
+++ b/os400/libxmlrpg/HTMLparser.rpgle
@@ -12,6 +12,7 @@
/define HTML_PARSER_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/include "libxmlrpg/parser"
/if defined(LIBXML_HTML_ENABLED)
@@ -63,13 +64,13 @@
d htmlElemDesc ds based(htmlElemDescPtr)
d align qualified
d name * const char *
- d startTag 3u 0 Start tag implied ?
- d endTag 3u 0 End tag implied ?
- d saveEndTag 3u 0 Save end tag ?
- d empty 3u 0 Empty element ?
- d depr 3u 0 Deprecated element ?
- d dtd 3u 0 Loose DTD/Frameset
- d isinline 3u 0 Block 0/inline elem?
+ d startTag like(xmlCchar) Start tag implied ?
+ d endTag like(xmlCchar) End tag implied ?
+ d saveEndTag like(xmlCchar) Save end tag ?
+ d empty like(xmlCchar) Empty element ?
+ d depr like(xmlCchar) Deprecated element ?
+ d dtd like(xmlCchar) Loose DTD/Frameset
+ d isinline like(xmlCchar) Block 0/inline elem?
d desc * const char *
*
* New fields encapsulating HTML structure
diff --git a/os400/libxmlrpg/SAX.rpgle b/os400/libxmlrpg/SAX.rpgle
index 18f851dd..85f15ccf 100644
--- a/os400/libxmlrpg/SAX.rpgle
+++ b/os400/libxmlrpg/SAX.rpgle
@@ -186,19 +186,19 @@
/if defined(LIBXML_SAX1_ENABLED)
d initxmlDefaultSAXHandler...
d pr extproc('initxmlDefaultSAXHandler')
- d hdlr like(xmlSAXHandlerV1)
+ d hdlr likeds(xmlSAXHandlerV1)
d warning 10i 0 value
/if defined(LIBXML_HTML_ENABLED)
d inithtmlDefaultSAXHandler...
d pr extproc('inithtmlDefaultSAXHandler')
- d hdlr like(xmlSAXHandlerV1)
+ d hdlr likeds(xmlSAXHandlerV1)
/endif
/if defined(LIBXML_DOCB_ENABLED)
d initdocbDefaultSAXHandler...
d pr extproc('initdocbDefaultSAXHandler')
- d hdlr like(xmlSAXHandlerV1)
+ d hdlr likeds(xmlSAXHandlerV1)
/endif
/endif LIBXML_SAX1_ENABLED
diff --git a/os400/libxmlrpg/SAX2.rpgle b/os400/libxmlrpg/SAX2.rpgle
index c9ab9d10..fb687e99 100644
--- a/os400/libxmlrpg/SAX2.rpgle
+++ b/os400/libxmlrpg/SAX2.rpgle
@@ -213,20 +213,20 @@
/endif LIBXML_SAX1_ENABLED
d xmlSAXVersion pr 10i 0 extproc('xmlSAXVersion')
- d hdlr like(xmlSAXHandler)
+ d hdlr likeds(xmlSAXHandler)
d version 10i 0 value
d xmlSAX2InitDefaultSAXHandler...
d pr extproc(
d 'xmlSAX2InitDefaultSAXHandler')
- d hdlr like(xmlSAXHandler)
+ d hdlr likeds(xmlSAXHandler)
d warning 10i 0 value
/if defined(LIBXML_HTML_ENABLED)
d xmlSAX2InitHtmlDefaultSAXHandler...
d pr extproc(
d 'xmlSAX2InitHtmlDefaultSAXHandler')
- d hdlr like(xmlSAXHandler)
+ d hdlr likeds(xmlSAXHandler)
d htmlDefaultSAXHandlerInit...
d pr extproc('htmlDefaultSAXHandlerInit')
@@ -236,7 +236,7 @@
d xmlSAX2InitDocbDefaultSAXHandler...
d pr extproc(
d 'xmlSAX2InitDocbDefaultSAXHandler')
- d hdlr like(xmlSAXHandler)
+ d hdlr likeds(xmlSAXHandler)
d docbDefaultSAXHandlerInit...
d pr extproc('docbDefaultSAXHandlerInit')
diff --git a/os400/libxmlrpg/chvalid.rpgle b/os400/libxmlrpg/chvalid.rpgle
index 33393f6f..444d1cb2 100644
--- a/os400/libxmlrpg/chvalid.rpgle
+++ b/os400/libxmlrpg/chvalid.rpgle
@@ -10,6 +10,7 @@
/define XML_CHVALID_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/include "libxmlrpg/xmlstring"
* Define our typedefs and structures
@@ -18,8 +19,8 @@
d xmlChSRange ds based(xmlChSRangePtr)
d align qualified
- d low 5u 0
- d high 5u 0
+ d low like(xmlCushort)
+ d high like(xmlCushort)
d xmlChLRangePtr s * based(######typedef######)
diff --git a/os400/libxmlrpg/dict.rpgle b/os400/libxmlrpg/dict.rpgle
index cd36f50f..bcb6576e 100644
--- a/os400/libxmlrpg/dict.rpgle
+++ b/os400/libxmlrpg/dict.rpgle
@@ -10,6 +10,7 @@
/define XML_DICT_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/include "libxmlrpg/tree"
* The dictionary.
@@ -27,12 +28,14 @@
d like(xmlDictPtr)
d xmlDictSetLimit...
- d pr 10u 0 extproc('xmlDictSetLimit') size_t
+ d pr extproc('xmlDictSetLimit')
+ d like(xmlCsize_t)
d dict value like(xmlDictPtr)
- d limit 10u 0 value size_t
+ d limit value like(xmlCsize_t)
d xmlDictGetUsage...
- d pr 10u 0 extproc('xmlDictGetUsage') size_t
+ d pr extproc('xmlDictGetUsage')
+ d like(xmlCsize_t)
d dict value like(xmlDictPtr)
d xmlDictCreateSub...
diff --git a/os400/libxmlrpg/encoding.rpgle b/os400/libxmlrpg/encoding.rpgle
index 80970fb0..c0ed7e65 100644
--- a/os400/libxmlrpg/encoding.rpgle
+++ b/os400/libxmlrpg/encoding.rpgle
@@ -234,25 +234,25 @@
d xmlCharEncOutFunc...
d pr 10i 0 extproc('xmlCharEncOutFunc')
- d handler like(xmlCharEncodingHandler)
+ d handler likeds(xmlCharEncodingHandler)
d out value like(xmlBufferPtr)
d in value like(xmlBufferPtr)
d xmlCharEncInFunc...
d pr 10i 0 extproc('xmlCharEncInFunc')
- d handler like(xmlCharEncodingHandler)
+ d handler likeds(xmlCharEncodingHandler)
d out value like(xmlBufferPtr)
d in value like(xmlBufferPtr)
d xmlCharEncFirstLine...
d pr 10i 0 extproc('xmlCharEncFirstLine')
- d handler like(xmlCharEncodingHandler)
+ d handler likeds(xmlCharEncodingHandler)
d out value like(xmlBufferPtr)
d in value like(xmlBufferPtr)
d xmlCharEncCloseFunc...
d pr 10i 0 extproc('xmlCharEncCloseFunc')
- d handler like(xmlCharEncodingHandler)
+ d handler likeds(xmlCharEncodingHandler)
* Export a few useful functions
diff --git a/os400/libxmlrpg/globals.rpgle b/os400/libxmlrpg/globals.rpgle
index 80dadcac..e51182fb 100644
--- a/os400/libxmlrpg/globals.rpgle
+++ b/os400/libxmlrpg/globals.rpgle
@@ -94,13 +94,13 @@
d xmlParserVersion...
d * const char *
d xmlDefaultSAXLocator...
- d like(xmlSAXLocator)
+ d likeds(xmlSAXLocator)
d xmlDefaultSAXHandler...
- d like(xmlSAXHandlerV1)
+ d likeds(xmlSAXHandlerV1)
d docbDefaultSAXHandler...
- d like(xmlSAXHandlerV1)
+ d likeds(xmlSAXHandlerV1)
d htmlDefaultSAXHandler...
- d like(xmlSAXHandlerV1)
+ d likeds(xmlSAXHandlerV1)
d xmlFree like(xmlFreeFunc)
d xmlMalloc like(xmlMallocFunc)
d xmlMemStrdup like(xmlStrdupFunc)
@@ -145,7 +145,7 @@
d like(xmlDeregisterNodeFunc)
d xmlMallocAtomic...
d like(xmlMallocFunc)
- d xmlLastError like(xmlError)
+ d xmlLastError likeds(xmlError)
d xmlParserInputBufferCreateFilenameValue...
d like(xmlParserInputBuffer...
d CreateFilenameFunc)
@@ -215,33 +215,33 @@
d get_docbDefaultSAXHandler...
d pr extproc(
d '__get_docbDefaultSAXHandler')
- d like(xmlSAXHandlerV1)
+ d likeds(xmlSAXHandlerV1)
d set_docbDefaultSAXHandler...
d pr extproc(
d '__set_docbDefaultSAXHandler')
- d value value like(xmlSAXHandlerV1)
+ d value value likeds(xmlSAXHandlerV1)
/endif
/if defined(LIBXML_HTML_ENABLED)
d get_htmlDefaultSAXHandler...
d pr extproc(
d '__get_htmlDefaultSAXHandler')
- d like(xmlSAXHandlerV1)
+ d likeds(xmlSAXHandlerV1)
d set_htmlDefaultSAXHandler...
d pr extproc(
d '__set_htmlDefaultSAXHandler')
- d value value like(xmlSAXHandlerV1)
+ d value value likeds(xmlSAXHandlerV1)
/endif
d get_xmlLastError...
d pr extproc('__get_xmlLastError')
- d like(xmlError)
+ d likeds(xmlError)
d set_xmlLastError...
d pr extproc('__set_xmlLastError')
- d value value like(xmlError)
+ d value value likeds(xmlError)
d get_oldXMLWDcompatibility...
d pr 10i 0 extproc(
@@ -278,19 +278,19 @@
d get_xmlDefaultSAXHandler...
d pr extproc('__get_xmlDefaultSAXHandler')
- d like(xmlSAXHandlerV1)
+ d likeds(xmlSAXHandlerV1)
d set_xmlDefaultSAXHandler...
d pr extproc('__set_xmlDefaultSAXHandler')
- d value value like(xmlSAXHandlerV1)
+ d value value likeds(xmlSAXHandlerV1)
d get_xmlDefaultSAXLocator...
d pr extproc('__get_xmlDefaultSAXLocator')
- d like(xmlSAXLocator)
+ d likeds(xmlSAXLocator)
d set_xmlDefaultSAXLocator...
d pr extproc('__set_xmlDefaultSAXLocator')
- d value value like(xmlSAXLocator)
+ d value value likeds(xmlSAXLocator)
d get_xmlDoValidityCheckingDefaultValue...
d pr 10i 0 extproc('__get_xmlDoValidity+
diff --git a/os400/libxmlrpg/nanoftp.rpgle b/os400/libxmlrpg/nanoftp.rpgle
index 0637562e..d8d5ef97 100644
--- a/os400/libxmlrpg/nanoftp.rpgle
+++ b/os400/libxmlrpg/nanoftp.rpgle
@@ -9,7 +9,7 @@
/if not defined(NANO_FTP_H__)
/define NANO_FTP_H__
- /include /libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlversion"
/if defined(LIBXML_FTP_ENABLED)
diff --git a/os400/libxmlrpg/parser.rpgle b/os400/libxmlrpg/parser.rpgle
index 7f29e31e..f04aa2eb 100644
--- a/os400/libxmlrpg/parser.rpgle
+++ b/os400/libxmlrpg/parser.rpgle
@@ -9,6 +9,7 @@
/define XML_PARSER_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/include "libxmlrpg/tree"
/include "libxmlrpg/dict"
/include "libxmlrpg/hash"
@@ -60,7 +61,7 @@
* so even if there is an overflow this should not give troubles
* for parsing very large instances.
*
- d consumed 20u 0 # consumed xmlChars
+ d consumed like(xmlCulong) # consumed xmlChars
d free like(xmlParserInputDeallocate) base deallocator
d encoding * const xmlChar *
d version * const xmlChar *
@@ -81,10 +82,10 @@
d align qualified
d node like(xmlNodePtr) const
* Position & line # that text that created the node begins & ends on
- d begin_pos 20u 0
- d begin_line 20u 0
- d end_pos 20u 0
- d end_line 20u 0
+ d begin_pos like(xmlCulong)
+ d begin_line like(xmlCulong)
+ d end_pos like(xmlCulong)
+ d end_line like(xmlCulong)
d xmlParserNodeInfoSeqPtr...
d s * based(######typedef######)
@@ -92,8 +93,8 @@
d xmlParserNodeInfoSeq...
d ds based(xmlParserNodeInfoSeqPtr)
d align qualified
- d maximum 20u 0
- d length 20u 0
+ d maximum like(xmlCulong)
+ d length like(xmlCulong)
d buffer like(xmlParserNodeInfoPtr)
* xmlParserInputState:
@@ -221,18 +222,18 @@
d nodeTab * xmlNodePtr *
*
d record_info 10i 0 Keep node info ?
- d node_seq like(xmlParserNodeInfoSeq) Parsed nodes info
+ d node_seq likeds(xmlParserNodeInfoSeq) Parsed nodes info
*
d errNo 10i 0 Error code
*
d hasExternalSubset...
d 10i 0
- d hashPErefs 10i 0
+ d hasPErefs 10i 0
d external 10i 0 Parsing ext. entity?
*
d valid 10i 0 Valid document ?
d validate 10i 0 Try to validate ?
- d vctxt like(xmlValidCtxt) Validity context
+ d vctxt likeds(xmlValidCtxt) Validity context
*
d instate like(xmlParserInputState) Current input type
d token 10i 0 Next look-ahead char
@@ -246,8 +247,8 @@
d nameMax 10i 0 Max stack depth
d nameTab * const xmlChar * *
*
- d nbChars 20i 0 # xmlChars processed
- d checkIndex 20i 0 4 progressive parse
+ d nbChars like(xmlClong) # xmlChars processed
+ d checkIndex like(xmlClong) 4 progressive parse
d keepBlanks 10i 0 Ugly but ...
d disableSAX 10i 0 Disable SAX cllbacks
d inSubset 10i 0 In int 1/ext 2 sbset
@@ -309,20 +310,20 @@
*
* the complete error informations for the last error.
*
- d lastError like(xmlError)
+ d lastError likeds(xmlError)
d parseMode like(xmlParserMode) The parser mode
- d nbentities 20u 0 # entity references
- d sizeentities 20u 0 Parsed entities size
+ d nbentities like(xmlCulong) # entity references
+ d sizeentities like(xmlCulong) Parsed entities size
*
* for use by HTML non-recursive parser
*
- d nodeInfo like(xmlParserNodeInfo) Current NodeInfo
+ d nodeInfo like(xmlParserNodeInfoPtr) Current NodeInfo
d nodeInfoNr 10i 0 Parsing stack depth
d nodeInfoMax 10i 0 Max stack depth
d nodeInfoTab * xmlParserNodeInfo *
*
d input_id 10i 0 Label inputs ?
- d sizeentcopy 20u 0 Entity copy volume
+ d sizeentcopy like(xmlCulong) Entity copy volume
* xmlSAXLocator:
*
@@ -1151,7 +1152,8 @@
d seq value like(xmlParserNodeInfoSeqPtr)
d xmlParserFindNodeInfoIndex...
- d pr 20u 0 extproc('xmlParserFindNodeInfoIndex')
+ d pr extproc('xmlParserFindNodeInfoIndex')
+ d like(xmlCulong)
d seq value like(xmlParserNodeInfoSeqPtr)
d node value like(xmlNodePtr) const
@@ -1180,7 +1182,8 @@
* Index lookup, actually implemented in the encoding module
d xmlByteConsumed...
- d pr 20i 0 extproc('xmlByteConsumed')
+ d pr extproc('xmlByteConsumed')
+ d like(xmlClong)
d ctxt value like(xmlParserCtxtPtr)
* New set of simpler/more flexible APIs
diff --git a/os400/libxmlrpg/parserInternals.rpgle b/os400/libxmlrpg/parserInternals.rpgle
index 6942b7dd..26913977 100644
--- a/os400/libxmlrpg/parserInternals.rpgle
+++ b/os400/libxmlrpg/parserInternals.rpgle
@@ -89,7 +89,7 @@
d s 9 import('xmlStringTextNoenc') \0 in 10th byte
d xmlStringComment...
- d s 7 import('xmlStringTextComment') \0 in 8th byte
+ d s 7 import('xmlStringComment') \0 in 8th byte
* Function to finish the work of the macros where needed.
diff --git a/os400/libxmlrpg/schematron.rpgle b/os400/libxmlrpg/schematron.rpgle
index ff8ea625..c987cd5e 100644
--- a/os400/libxmlrpg/schematron.rpgle
+++ b/os400/libxmlrpg/schematron.rpgle
@@ -101,7 +101,7 @@
d err value
d like(xmlSchematronValidityErrorFunc)
d warn value like(
- d xmlSchematronValidityWarningFunc)
+ d xmlSchematronValidityWarningFunc)
d ctx * value void *
d xmlSchematronGetParserErrors...
diff --git a/os400/libxmlrpg/tree.rpgle b/os400/libxmlrpg/tree.rpgle
index 8b4981ab..5c67f4fa 100644
--- a/os400/libxmlrpg/tree.rpgle
+++ b/os400/libxmlrpg/tree.rpgle
@@ -11,6 +11,7 @@
/define XML_TREE_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/include "libxmlrpg/xmlstring"
@@ -109,12 +110,14 @@
d xmlBufEnd pr * extproc('xmlBufEnd') xmlChar *
d buf value like(xmlBufPtr) const
- d xmlBufUse pr 10u 0 extproc('xmlBufUse') size_t
+ d xmlBufUse pr extproc('xmlBufUse')
+ d like(xmlCsize_t)
d buf value like(xmlBufPtr) const
- d xmlBufShrink pr 10u 0 extproc('xmlBufShrink') size_t
+ d xmlBufShrink pr extproc('xmlBufShrink')
+ d like(xmlCsize_t)
d buf value like(xmlBufPtr)
- d len 10u 0 value size_t
+ d len value like(xmlCsize_t)
* LIBXML2_NEW_BUFFER:
*
@@ -503,8 +506,8 @@
d properties like(xmlAttrPtr) Properties list
d nsDef like(xmlNsPtr) Node ns definitions
d psvi * Type/PSVI info
- d line 5u 0 Line number
- d extra 5u 0 Data for XPath/XSLT
+ d line like(xmlCushort)
+ d extra like(xmlCushort) Data for XPath/XSLT
* xmlDocProperty
*
@@ -681,18 +684,18 @@
d xmlBufferCreateSize...
d pr extproc('xmlBufferCreateSize')
d like(xmlBufferPtr)
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d xmlBufferCreateStatic...
d pr extproc('xmlBufferCreateStatic')
d like(xmlBufferPtr)
d mem * value
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d xmlBufferResize...
d pr 10i 0 extproc('xmlBufferResize')
d buf value like(xmlBufferPtr)
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d xmlBufferFree pr extproc('xmlBufferFree')
d buf value like(xmlBufferPtr)
@@ -1030,7 +1033,8 @@
* Navigating.
d xmlNewDocFragment...
- d xmlGetLineNo pr 20i 0 extproc('xmlGetLineNo')
+ d xmlGetLineNo pr extproc('xmlGetLineNo')
+ d like(xmlClong)
d node value like(xmlNodePtr)
/if defined(LIBXML_TREE_ENABLED)
@@ -1476,7 +1480,8 @@
d cur value like(xmlDocPtr)
d format 10i 0 value
- d xmlBufNodeDump pr 10u 0 extproc('xmlBufNodeDump') size_t
+ d xmlBufNodeDump pr extproc('xmlBufNodeDump')
+ d like(xmlCsize_t)
d buf value like(xmlBufPtr)
d doc value like(xmlDocPtr)
d cur value like(xmlNodePtr)
@@ -1597,7 +1602,8 @@
* traversal.
d xmlChildElementCount...
- d pr 20u 0 extproc('xmlChildElementCount')
+ d pr extproc('xmlChildElementCount')
+ d like(xmlClong)
d parent value like(xmlNodePtr)
d xmlNextElementSibling...
diff --git a/os400/libxmlrpg/xmlIO.rpgle b/os400/libxmlrpg/xmlIO.rpgle
index 72911bc0..261b0e22 100644
--- a/os400/libxmlrpg/xmlIO.rpgle
+++ b/os400/libxmlrpg/xmlIO.rpgle
@@ -9,6 +9,7 @@
/define XML_IO_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
* Those are the functions and datatypes for the parser input
* I/O structures.
@@ -131,7 +132,7 @@
d raw like(xmlBufPtr) Raw input buffer
d compressed 10i 0
d error 10i 0
- d rawconsumed 20u 0
+ d rawconsumed like(xmlCulong)
/if defined(LIBXML_OUTPUT_ENABLED)
d xmlOutputBuffer...
@@ -307,7 +308,8 @@
d out value like(xmlOutputBufferPtr)
d xmlOutputBufferGetSize...
- d pr 10u 0 extproc('xmlOutputBufferGetSize') size_t
+ d pr extproc('xmlOutputBufferGetSize')
+ d like(xmlCsize_t)
d out value like(xmlOutputBufferPtr)
d xmlOutputBufferWrite...
diff --git a/os400/libxmlrpg/xmlTypesC.rpgle b/os400/libxmlrpg/xmlTypesC.rpgle
new file mode 100644
index 00000000..798d74d3
--- /dev/null
+++ b/os400/libxmlrpg/xmlTypesC.rpgle
@@ -0,0 +1,24 @@
+ * Eqivalent of C data types.
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
+
+ /if not defined(XMLTYPESC_H__)
+ /define XMLTYPESC_H__
+
+ d xmlCchar s 3i 0 based(######typedef######)
+ d xmlCuchar s 3u 0 based(######typedef######)
+ d xmlCshort s 5i 0 based(######typedef######)
+ d xmlCushort s 5u 0 based(######typedef######)
+ d xmlCint s 10i 0 based(######typedef######)
+ d xmlCuInt s 10u 0 based(######typedef######)
+ d xmlClong s 10i 0 based(######typedef######)
+ d xmlCulong s 10u 0 based(######typedef######)
+ d xmlClonglong s 20i 0 based(######typedef######)
+ d xmlCulonglong s 20u 0 based(######typedef######)
+ d xmlCenum s 10i 0 based(######typedef######)
+ d xmlCssize_t s 10i 0 based(######typedef######)
+ d xmlCsize_t s 10u 0 based(######typedef######)
+
+ /endif
diff --git a/os400/libxmlrpg/xmlmemory.rpgle b/os400/libxmlrpg/xmlmemory.rpgle
index 165eacac..3c791038 100644
--- a/os400/libxmlrpg/xmlmemory.rpgle
+++ b/os400/libxmlrpg/xmlmemory.rpgle
@@ -10,6 +10,7 @@
/define DEBUG_MEMORY_ALLOC__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
* DEBUG_MEMORY:
*
@@ -96,7 +97,7 @@
d func value like(xmlMallocFunc)
d xmlMalloc pr * extproc('__call_xmlMalloc') void *
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d get_xmlMallocAtomic...
d pr extproc('__get_xmlMallocAtomic')
@@ -108,7 +109,7 @@
d xmlMallocAtomic...
d pr * extproc('__call_xmlMallocAtomic') void *
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d get_xmlRealloc pr extproc('__get_xmlRealloc')
d like(xmlReallocFunc)
@@ -118,7 +119,7 @@
d xmlRealloc pr * extproc('__call_xmlRealloc') void *
d mem * value void *
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d get_xmlMemStrdup...
d pr extproc('__get_xmlMemStrdup')
@@ -184,7 +185,7 @@
d xmlMmDisplayLast...
d pr extproc('xmlMemDisplayLast')
d fp * value FILE *
- d nbBytes 20i 0 value
+ d nbBytes value like(xmlClong)
d xmlMemShow pr extproc('xmlMemShow')
d fp * value FILE *
@@ -193,11 +194,11 @@
d xmlMemoryDump pr extproc('xmlMemoryDump')
d xmlMemMalloc pr * extproc('xmlMemMalloc') void *
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d xmlMemRealloc pr * extproc('xmlMemRealloc') void *
d ptr * value void *
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d xmlMemFree pr extproc('xmlMemFree')
d ptr * value void *
@@ -207,19 +208,19 @@
d str * value options(*string) const char *
d xmlMallocLoc pr * extproc('xmlMallocLoc') void *
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d file * value options(*string) const char *
d line 10i 0 value
d xmlReallocLoc pr * extproc('xmlReallocLoc') void *
d ptr * value void *
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d file * value options(*string) const char *
d line 10i 0 value
d xmlMallocAtomicLoc...
d pr * extproc('xmlMallocAtomicLoc') void *
- d size 10u 0 value size_t
+ d size value like(xmlCsize_t)
d file * value options(*string) const char *
d line 10i 0 value
diff --git a/os400/libxmlrpg/xmlreader.rpgle b/os400/libxmlrpg/xmlreader.rpgle
index eccd37c4..5084fc86 100644
--- a/os400/libxmlrpg/xmlreader.rpgle
+++ b/os400/libxmlrpg/xmlreader.rpgle
@@ -9,6 +9,7 @@
/define XML_XMLREADER_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/include "libxmlrpg/tree"
/include "libxmlrpg/xmlIO"
@@ -472,7 +473,8 @@
* Index lookup
d xmlTextReaderByteConsumed...
- d pr 20i 0 extproc('xmlTextReaderByteConsumed')
+ d pr extproc('xmlTextReaderByteConsumed')
+ d like(xmlClong)
d reader value like(xmlTextReaderPtr)
* New more complete APIs for simpler creation and reuse of readers
diff --git a/os400/libxmlrpg/xmlsave.rpgle b/os400/libxmlrpg/xmlsave.rpgle
index efcb09fb..764dceb6 100644
--- a/os400/libxmlrpg/xmlsave.rpgle
+++ b/os400/libxmlrpg/xmlsave.rpgle
@@ -9,6 +9,7 @@
/define XML_XMLSAVE_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/include "libxmlrpg/tree"
/include "libxmlrpg/encoding"
/include "libxmlrpg/xmlIO"
@@ -68,11 +69,13 @@
d encoding * value options(*string) const char *
d options 10i 0 value
- d xmlSaveDoc pr 20i 0 extproc('xmlSaveDoc')
+ d xmlSaveDoc pr extproc('xmlSaveDoc')
+ d like(xmlClong)
d ctxt value like(xmlSaveCtxtPtr)
d doc value like(xmlDocPtr)
- d xmlSaveTree pr 20i 0 extproc('xmlSaveTree')
+ d xmlSaveTree pr extproc('xmlSaveTree')
+ d like(xmlClong)
d ctxt value like(xmlSaveCtxtPtr)
d node value like(xmlNodePtr)
diff --git a/os400/libxmlrpg/xmlschemastypes.rpgle b/os400/libxmlrpg/xmlschemastypes.rpgle
index 6433c329..0bf0f709 100644
--- a/os400/libxmlrpg/xmlschemastypes.rpgle
+++ b/os400/libxmlrpg/xmlschemastypes.rpgle
@@ -10,6 +10,7 @@
/define XML_SCHEMA_TYPES_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/if defined(LIBXML_SCHEMAS_ENABLED)
@@ -107,7 +108,7 @@
d TypeFacet')
d facet value like(xmlSchemaFacetPtr)
d value * value options(*string) const xmlChar *
- d actualLen 20u 0 value
+ d actualLen value like(xmlCulong)
d expectedLen * value unsigned long *
d xmlSchemaGetBuiltInType...
@@ -130,8 +131,9 @@
d value * value options(*string) const xmlChar *
d xmlSchemaGetFacetValueAsULong...
- d pr 20u 0 extproc(
+ d pr extproc(
d 'xmlSchemaGetFacetValueAsULong')
+ d like(xmlCulong)
d facet value like(xmlSchemaFacetPtr)
d xmlSchemaValidateLengthFacet...
@@ -141,7 +143,7 @@
d facet value like(xmlSchemaFacetPtr)
d value * value options(*string) const xmlChar *
d val value like(xmlSchemaValPtr)
- d length 20u 0
+ d length like(xmlCulong)
d xmlSchemaValidateLengthFacetWhtsp...
d pr 10i 0 extproc(
@@ -150,7 +152,7 @@
d valType value like(xmlSchemaValType)
d value * value options(*string) const xmlChar *
d val value like(xmlSchemaValPtr)
- d length 20u 0
+ d length like(xmlCulong)
d ws value
d like(xmlSchemaWhitespaceValueType)
diff --git a/os400/libxmlrpg/xmlstdarg.rpgle b/os400/libxmlrpg/xmlstdarg.rpgle
index 4e6f121d..9e45a4c8 100644
--- a/os400/libxmlrpg/xmlstdarg.rpgle
+++ b/os400/libxmlrpg/xmlstdarg.rpgle
@@ -19,16 +19,16 @@
* Procedures.
d xmlVaStart pr extproc('__xmlVaStart')
- d list like(xmlVaList)
+ d list likeds(xmlVaList)
d lastargaddr * value
d lastargsize 10u 0 value
d xmlVaArg pr * extproc('__xmlVaArg')
- d list like(xmlVaList)
+ d list likeds(xmlVaList)
d dest * value
d argsize 10i 0 value
d xmlVaEnd pr extproc('__xmlVaEnd')
- d list like(xmlVaList)
+ d list likeds(xmlVaList)
/endif XML_STDARG_H__
diff --git a/os400/libxmlrpg/xmlstring.rpgle b/os400/libxmlrpg/xmlstring.rpgle
index 41e9eb51..5b863e45 100644
--- a/os400/libxmlrpg/xmlstring.rpgle
+++ b/os400/libxmlrpg/xmlstring.rpgle
@@ -10,6 +10,7 @@
/define XML_STRING_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/include "libxmlrpg/xmlstdarg"
* xmlChar:
@@ -18,7 +19,8 @@
* It's unsigned allowing to pinpoint case where char * are assigned
* to xmlChar * (possibly making serialization back impossible).
- d xmlChar s 3u 0 based(######typedef######)
+ d xmlChar s based(######typedef######)
+ d like(xmlCuchar)
* xmlChar handling
diff --git a/os400/libxmlrpg/xpath.rpgle b/os400/libxmlrpg/xpath.rpgle
index 3f3be326..1784fada 100644
--- a/os400/libxmlrpg/xpath.rpgle
+++ b/os400/libxmlrpg/xpath.rpgle
@@ -18,6 +18,7 @@
/define XML_XPATH_H__
/include "libxmlrpg/xmlversion"
+ /include "libxmlrpg/xmlTypesC"
/if defined(LIBXML_XPATH_ENABLED)
@@ -366,7 +367,7 @@
*
d userData * void *
d error like(xmlStructuredErrorFunc) Error callback
- d lastError like(xmlError) The last error
+ d lastError likeds(xmlError) The last error
d debugNode like(xmlNodePtr) XSLT source node
*
* dictionary
@@ -550,7 +551,8 @@
* Evaluation functions.
d xmlXPathOrderDocElems...
- d pr 20i 0 extproc('xmlXPathOrderDocElems')
+ d pr extproc('xmlXPathOrderDocElems')
+ d like(xmlClong)
d doc value like(xmlDocPtr)
d xmlXPathSetContextNode...
diff --git a/os400/make-rpg.sh b/os400/make-rpg.sh
index 95d3249c..664b47bf 100644
--- a/os400/make-rpg.sh
+++ b/os400/make-rpg.sh
@@ -25,8 +25,6 @@ fi
# Map file names to DB2 name syntax.
-> tmpsubstfile
-
for HFILE in *.rpgle *.rpgle.in
do NAME="`basename \"${HFILE}\" .in`"
VAR="`basename \"${NAME}\" .rpgle`"
@@ -36,9 +34,14 @@ do NAME="`basename \"${HFILE}\" .in`"
then VAL=SCHMTYPES
fi
- echo "s/${VAR}/${VAL}/g" >> tmpsubstfile
eval "VAR_${VAR}=\"${VAL}\""
-done
+ echo "${VAR} s/${VAR}/${VAL}/g"
+done > tmpsubstfile1
+
+# Order substitution commands so that a prefix appears after all
+# file names beginning with the prefix.
+
+sort -r tmpsubstfile1 | sed 's/^[^ ]*[ ]*//' > tmpsubstfile2
change_include()
@@ -47,7 +50,7 @@ change_include()
sed -e '\#^....../include *"libxmlrpg/#{' \
-e 's///' \
-e 's/".*//' \
- -f tmpsubstfile \
+ -f tmpsubstfile2 \
-e 's#.*# /include libxmlrpg,&#' \
-e '}'
}
diff --git a/os400/make.sh b/os400/make.sh
index 864e72b2..95a35a28 100644
--- a/os400/make.sh
+++ b/os400/make.sh
@@ -42,7 +42,16 @@ do if [ -f "${TEXT}" ]
MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${MEMBER}\"`.MBR"
if action_needed "${MEMBER}" "${TEXT}"
- then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}')"
+ then # Sources are in UTF-8.
+ rm -f "${TOPDIR}/tmpfile"[12]
+ CMD="CPY OBJ('${TEXT}') TOOBJ('${TOPDIR}/tmpfile1')"
+ CMD="${CMD} FROMCCSID(1208) TOCCSID(${TGTCCSID})"
+ CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
+ system "${CMD}"
+ # Make sure all lines are < 100 characters.
+ sed -e 's/.\{99\}/&\
+/g' -e 's/\n$//' "${TOPDIR}/tmpfile1" > "${TOPDIR}/tmpfile2"
+ CMD="CPY OBJ('${TOPDIR}/tmpfile2') TOOBJ('${MEMBER}')"
CMD="${CMD} TOCCSID(${TGTCCSID})"
CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
system "${CMD}"
diff --git a/parser.c b/parser.c
index a8d1b673..b9217ff1 100644
--- a/parser.c
+++ b/parser.c
@@ -3491,7 +3491,14 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
c = CUR_CHAR(l);
if (c == 0) {
count = 0;
+ /*
+ * when shrinking to extend the buffer we really need to preserve
+ * the part of the name we already parsed. Hence rolling back
+ * by current lenght.
+ */
+ ctxt->input->cur -= l;
GROW;
+ ctxt->input->cur += l;
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
end = ctxt->input->cur;
@@ -3523,7 +3530,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
static const xmlChar *
xmlParseNCName(xmlParserCtxtPtr ctxt) {
- const xmlChar *in;
+ const xmlChar *in, *e;
const xmlChar *ret;
int count = 0;
@@ -3535,16 +3542,19 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) {
* Accelerator for simple ASCII names
*/
in = ctxt->input->cur;
- if (((*in >= 0x61) && (*in <= 0x7A)) ||
- ((*in >= 0x41) && (*in <= 0x5A)) ||
- (*in == '_')) {
+ e = ctxt->input->end;
+ if ((((*in >= 0x61) && (*in <= 0x7A)) ||
+ ((*in >= 0x41) && (*in <= 0x5A)) ||
+ (*in == '_')) && (in < e)) {
in++;
- while (((*in >= 0x61) && (*in <= 0x7A)) ||
- ((*in >= 0x41) && (*in <= 0x5A)) ||
- ((*in >= 0x30) && (*in <= 0x39)) ||
- (*in == '_') || (*in == '-') ||
- (*in == '.'))
+ while ((((*in >= 0x61) && (*in <= 0x7A)) ||
+ ((*in >= 0x41) && (*in <= 0x5A)) ||
+ ((*in >= 0x30) && (*in <= 0x39)) ||
+ (*in == '_') || (*in == '-') ||
+ (*in == '.')) && (in < e))
in++;
+ if (in >= e)
+ goto complex;
if ((*in > 0) && (*in < 0x80)) {
count = in - ctxt->input->cur;
if ((count > XML_MAX_NAME_LENGTH) &&
@@ -3562,6 +3572,7 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) {
return(ret);
}
}
+complex:
return(xmlParseNCNameComplex(ctxt));
}
@@ -5658,6 +5669,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
if (RAW != '>') {
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
"xmlParseEntityDecl: entity %s not terminated\n", name);
+ xmlStopParser(ctxt);
} else {
if (input != ctxt->input) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
@@ -6769,6 +6781,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
SKIP_BLANKS;
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
+ xmlStopParser(ctxt);
+ return;
} else {
if (ctxt->input->id != id) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
@@ -6829,6 +6843,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
SKIP_BLANKS;
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
+ xmlStopParser(ctxt);
+ return;
} else {
if (ctxt->input->id != id) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
@@ -6884,6 +6900,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
} else {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
+ xmlStopParser(ctxt);
+ return;
}
if (RAW == 0)
@@ -6897,7 +6915,9 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
"All markup of the conditional section is not in the same entity\n",
NULL, NULL);
}
- SKIP(3);
+ if ((ctxt-> instate != XML_PARSER_EOF) &&
+ ((ctxt->input->cur + 3) < ctxt->input->end))
+ SKIP(3);
}
}
@@ -10397,6 +10417,8 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
encoding = xmlParseEncName(ctxt);
if (RAW != '"') {
xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL);
+ xmlFree((xmlChar *) encoding);
+ return(NULL);
} else
NEXT;
} else if (RAW == '\''){
@@ -10404,6 +10426,8 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
encoding = xmlParseEncName(ctxt);
if (RAW != '\'') {
xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL);
+ xmlFree((xmlChar *) encoding);
+ return(NULL);
} else
NEXT;
} else {
@@ -10460,7 +10484,11 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
handler = xmlFindCharEncodingHandler((const char *) encoding);
if (handler != NULL) {
- xmlSwitchToEncoding(ctxt, handler);
+ if (xmlSwitchToEncoding(ctxt, handler) < 0) {
+ /* failed to convert */
+ ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
+ return(NULL);
+ }
} else {
xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
"Unsupported encoding %s\n", encoding);
@@ -11166,7 +11194,7 @@ xmlCheckCdataPush(const xmlChar *utf, int len) {
else
return(-ix);
} else if ((c & 0xe0) == 0xc0) {/* 2-byte code, starts with 110 */
- if (ix + 2 > len) return(ix);
+ if (ix + 2 > len) return(-ix);
if ((utf[ix+1] & 0xc0 ) != 0x80)
return(-ix);
codepoint = (utf[ix] & 0x1f) << 6;
@@ -11175,7 +11203,7 @@ xmlCheckCdataPush(const xmlChar *utf, int len) {
return(-ix);
ix += 2;
} else if ((c & 0xf0) == 0xe0) {/* 3-byte code, starts with 1110 */
- if (ix + 3 > len) return(ix);
+ if (ix + 3 > len) return(-ix);
if (((utf[ix+1] & 0xc0) != 0x80) ||
((utf[ix+2] & 0xc0) != 0x80))
return(-ix);
@@ -11186,7 +11214,7 @@ xmlCheckCdataPush(const xmlChar *utf, int len) {
return(-ix);
ix += 3;
} else if ((c & 0xf8) == 0xf0) {/* 4-byte code, starts with 11110 */
- if (ix + 4 > len) return(ix);
+ if (ix + 4 > len) return(-ix);
if (((utf[ix+1] & 0xc0) != 0x80) ||
((utf[ix+2] & 0xc0) != 0x80) ||
((utf[ix+3] & 0xc0) != 0x80))
@@ -13341,7 +13369,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
/*
* Also record the size of the entity parsed
*/
- if (ctxt->input != NULL) {
+ if (ctxt->input != NULL && oldctxt != NULL) {
oldctxt->sizeentities += ctxt->input->consumed;
oldctxt->sizeentities += (ctxt->input->cur - ctxt->input->base);
}
@@ -13353,9 +13381,11 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
if (sax != NULL)
ctxt->sax = oldsax;
- oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
- oldctxt->node_seq.length = ctxt->node_seq.length;
- oldctxt->node_seq.buffer = ctxt->node_seq.buffer;
+ if (oldctxt != NULL) {
+ oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
+ oldctxt->node_seq.length = ctxt->node_seq.length;
+ oldctxt->node_seq.buffer = ctxt->node_seq.buffer;
+ }
ctxt->node_seq.maximum = 0;
ctxt->node_seq.length = 0;
ctxt->node_seq.buffer = NULL;
diff --git a/relaxng.c b/relaxng.c
index 5357b569..5779e7fc 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -3819,7 +3819,11 @@ xmlRelaxNGCompareNameClasses(xmlRelaxNGDefinePtr def1,
return (0);
return (1);
} else if (def1->type == XML_RELAXNG_EXCEPT) {
- TODO ret = 0;
+ ret = xmlRelaxNGCompareNameClasses(def1->content, def2);
+ if (ret == 0)
+ ret = 1;
+ else if (ret == 1)
+ ret = 0;
} else {
TODO ret = 0;
}
diff --git a/result/XPath/tests/chaptersbase b/result/XPath/tests/chaptersbase
index 03c65670..e023bf01 100644
--- a/result/XPath/tests/chaptersbase
+++ b/result/XPath/tests/chaptersbase
@@ -113,3 +113,13 @@ Set contains 5 nodes:
ATTRIBUTE id
TEXT
content=chapter5
+
+========================
+Expression: //p[1]
+Object is a Node Set :
+Set contains 5 nodes:
+1 ELEMENT p
+2 ELEMENT p
+3 ELEMENT p
+4 ELEMENT p
+5 ELEMENT p
diff --git a/result/XPath/tests/simplebase b/result/XPath/tests/simplebase
index 38fa1449..3c32d17e 100644
--- a/result/XPath/tests/simplebase
+++ b/result/XPath/tests/simplebase
@@ -60,6 +60,60 @@ Set contains 3 nodes:
content=
========================
+Expression: /child::EXAMPLE/attribute::prop1/self::node()
+Object is a Node Set :
+Set contains 1 nodes:
+1 ATTRIBUTE prop1
+ TEXT
+ content=gnome is great
+
+========================
+Expression: /child::EXAMPLE/attribute::prop1/self::*
+Object is a Node Set :
+Set contains 0 nodes:
+
+========================
+Expression: /child::EXAMPLE/attribute::prop1/descendant-or-self::node()
+Object is a Node Set :
+Set contains 1 nodes:
+1 ATTRIBUTE prop1
+ TEXT
+ content=gnome is great
+
+========================
+Expression: /child::EXAMPLE/attribute::prop1/descendant-or-self::*
+Object is a Node Set :
+Set contains 0 nodes:
+
+========================
+Expression: /child::EXAMPLE/attribute::prop1/ancestor-or-self::node()
+Object is a Node Set :
+Set contains 3 nodes:
+1 /
+2 ELEMENT EXAMPLE
+ ATTRIBUTE prop1
+ TEXT
+ content=gnome is great
+ ATTRIBUTE prop2
+ TEXT
+ content=& linux too
+3 ATTRIBUTE prop1
+ TEXT
+ content=gnome is great
+
+========================
+Expression: /child::EXAMPLE/attribute::prop1/ancestor-or-self::*
+Object is a Node Set :
+Set contains 1 nodes:
+1 ELEMENT EXAMPLE
+ ATTRIBUTE prop1
+ TEXT
+ content=gnome is great
+ ATTRIBUTE prop2
+ TEXT
+ content=& linux too
+
+========================
Expression: /descendant::title
Object is a Node Set :
Set contains 2 nodes:
diff --git a/result/errors/754946.xml b/result/errors/754946.xml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/errors/754946.xml
diff --git a/result/errors/754946.xml.err b/result/errors/754946.xml.err
new file mode 100644
index 00000000..423dff56
--- /dev/null
+++ b/result/errors/754946.xml.err
@@ -0,0 +1,16 @@
+Entity: line 1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
+
+ %SYSTEM;
+ ^
+Entity: line 1:
+A<lbbbbbbbbbbbbbbbbbbb_
+^
+Entity: line 1: parser error : DOCTYPE improperly terminated
+ %SYSTEM;
+ ^
+Entity: line 1:
+A<lbbbbbbbbbbbbbbbbbbb_
+^
+./test/errors/754946.xml:1: parser error : Extra content at the end of the document
+<!DOCTYPEA[<!ENTITY %
+ ^
diff --git a/result/errors/754946.xml.str b/result/errors/754946.xml.str
new file mode 100644
index 00000000..3b748cc7
--- /dev/null
+++ b/result/errors/754946.xml.str
@@ -0,0 +1,4 @@
+./test/errors/754946.xml:1: parser error : Extra content at the end of the document
+<!DOCTYPEA[<!ENTITY %
+ ^
+./test/errors/754946.xml : failed to parse
diff --git a/result/errors/754947.xml b/result/errors/754947.xml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/errors/754947.xml
diff --git a/result/errors/754947.xml.err b/result/errors/754947.xml.err
new file mode 100644
index 00000000..f45cb5a2
--- /dev/null
+++ b/result/errors/754947.xml.err
@@ -0,0 +1,7 @@
+./test/errors/754947.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
+Bytes: 0xEE 0x5D 0x5D 0x3E
+<d><![CDATA[0000000000000î]]>
+ ^
+./test/errors/754947.xml:1: parser error : Premature end of data in tag d line 1
+<d><![CDATA[0000000000000î]]>
+ ^
diff --git a/result/errors/754947.xml.str b/result/errors/754947.xml.str
new file mode 100644
index 00000000..4d2f52e3
--- /dev/null
+++ b/result/errors/754947.xml.str
@@ -0,0 +1,5 @@
+./test/errors/754947.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
+Bytes: 0xEE 0x5D 0x5D 0x3E
+<d><![CDATA[0000000000000î]]>
+ ^
+./test/errors/754947.xml : failed to parse
diff --git a/result/errors/cdata.xml.str b/result/errors/cdata.xml.str
index e043441a..cf83d2b3 100644
--- a/result/errors/cdata.xml.str
+++ b/result/errors/cdata.xml.str
@@ -1,5 +1,5 @@
./test/errors/cdata.xml:2: parser error : Input is not proper UTF-8, indicate encoding !
-Bytes: 0x5B 0x43 0xE1 0x72
+Bytes: 0xE1 0x72 0x5D 0x5D
<A><![CDATA[Cár]]></A>
- ^
+ ^
./test/errors/cdata.xml : failed to parse
diff --git a/result/relaxng/565219_0 b/result/relaxng/565219_0
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/relaxng/565219_0
diff --git a/result/relaxng/565219_0.err b/result/relaxng/565219_0.err
new file mode 100644
index 00000000..e3f73fac
--- /dev/null
+++ b/result/relaxng/565219_0.err
@@ -0,0 +1,2 @@
+./test/relaxng/565219_0.xml:1: element foo: Relax-NG validity error : Element foo has wrong namespace: expecting http://bar.com/
+./test/relaxng/565219_0.xml fails to validate
diff --git a/result/relaxng/565219_1 b/result/relaxng/565219_1
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/relaxng/565219_1
diff --git a/result/relaxng/565219_1.err b/result/relaxng/565219_1.err
new file mode 100644
index 00000000..2999bbae
--- /dev/null
+++ b/result/relaxng/565219_1.err
@@ -0,0 +1 @@
+./test/relaxng/565219_1.xml validates
diff --git a/result/relaxng/565219_2 b/result/relaxng/565219_2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/relaxng/565219_2
diff --git a/result/relaxng/565219_2.err b/result/relaxng/565219_2.err
new file mode 100644
index 00000000..7a997d35
--- /dev/null
+++ b/result/relaxng/565219_2.err
@@ -0,0 +1,2 @@
+./test/relaxng/565219_2.xml:1: element foo: Relax-NG validity error : Element foo has wrong namespace: expecting http://bar.com/
+./test/relaxng/565219_2.xml fails to validate
diff --git a/result/relaxng/565219_err b/result/relaxng/565219_err
new file mode 100644
index 00000000..c43e67cf
--- /dev/null
+++ b/result/relaxng/565219_err
@@ -0,0 +1 @@
+./test/relaxng/565219.rng validates
diff --git a/result/relaxng/565219_valid b/result/relaxng/565219_valid
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/relaxng/565219_valid
diff --git a/result/valid/737840.xml b/result/valid/737840.xml
new file mode 100644
index 00000000..433c6d6d
--- /dev/null
+++ b/result/valid/737840.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE root [
+<!ELEMENT root (elem)>
+<!ELEMENT elem (#PCDATA)>
+<!ATTLIST elem id ID #IMPLIED>
+<!ENTITY target SYSTEM "dtds/737840.ent">
+]>
+<root>
+ &target;
+</root>
diff --git a/result/valid/737840.xml.err b/result/valid/737840.xml.err
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/valid/737840.xml.err
diff --git a/result/valid/737840.xml.err.rdr b/result/valid/737840.xml.err.rdr
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/valid/737840.xml.err.rdr
diff --git a/test/XPath/tests/chaptersbase b/test/XPath/tests/chaptersbase
index daa53b75..17638f73 100644
--- a/test/XPath/tests/chaptersbase
+++ b/test/XPath/tests/chaptersbase
@@ -7,3 +7,4 @@
/child::EXAMPLE/child::head/node()
/descendant::title
/descendant::p/ancestor::chapter
+//p[1]
diff --git a/test/XPath/tests/simplebase b/test/XPath/tests/simplebase
index 7e4203af..8b2c7d15 100644
--- a/test/XPath/tests/simplebase
+++ b/test/XPath/tests/simplebase
@@ -5,5 +5,11 @@
/child::EXAMPLE/child::head/child::title
/child::EXAMPLE/child::head/child::title/child::text()
/child::EXAMPLE/child::head/node()
+/child::EXAMPLE/attribute::prop1/self::node()
+/child::EXAMPLE/attribute::prop1/self::*
+/child::EXAMPLE/attribute::prop1/descendant-or-self::node()
+/child::EXAMPLE/attribute::prop1/descendant-or-self::*
+/child::EXAMPLE/attribute::prop1/ancestor-or-self::node()
+/child::EXAMPLE/attribute::prop1/ancestor-or-self::*
/descendant::title
/descendant::p/ancestor::chapter
diff --git a/test/errors/754946.xml b/test/errors/754946.xml
new file mode 100644
index 00000000..6b5f9b06
--- /dev/null
+++ b/test/errors/754946.xml
@@ -0,0 +1 @@
+<!DOCTYPEA[<!ENTITY % SYSTEM "A<lbbbbbbbbbbbbbbbbbbb_" >%SYSTEM;<![ \ No newline at end of file
diff --git a/test/errors/754947.xml b/test/errors/754947.xml
new file mode 100644
index 00000000..bd9997e3
--- /dev/null
+++ b/test/errors/754947.xml
@@ -0,0 +1 @@
+<d><![CDATA[0000000000000î]]> \ No newline at end of file
diff --git a/test/relaxng/565219.rng b/test/relaxng/565219.rng
new file mode 100644
index 00000000..087ed956
--- /dev/null
+++ b/test/relaxng/565219.rng
@@ -0,0 +1,14 @@
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element>
+ <anyName>
+ <except>
+ <nsName ns="http://bar.com/"/>
+ <nsName ns="http://foo.com/"/>
+ </except>
+ </anyName>
+ <empty/>
+ </element>
+ </start>
+</grammar>
+
diff --git a/test/relaxng/565219_0.xml b/test/relaxng/565219_0.xml
new file mode 100644
index 00000000..a964a07b
--- /dev/null
+++ b/test/relaxng/565219_0.xml
@@ -0,0 +1 @@
+<foo xmlns="http://foo.com/"/>
diff --git a/test/relaxng/565219_1.xml b/test/relaxng/565219_1.xml
new file mode 100644
index 00000000..f1999f80
--- /dev/null
+++ b/test/relaxng/565219_1.xml
@@ -0,0 +1 @@
+<foo/>
diff --git a/test/relaxng/565219_2.xml b/test/relaxng/565219_2.xml
new file mode 100644
index 00000000..a964a07b
--- /dev/null
+++ b/test/relaxng/565219_2.xml
@@ -0,0 +1 @@
+<foo xmlns="http://foo.com/"/>
diff --git a/test/valid/737840.xml b/test/valid/737840.xml
new file mode 100644
index 00000000..2d27b731
--- /dev/null
+++ b/test/valid/737840.xml
@@ -0,0 +1,10 @@
+<!DOCTYPE root [
+<!ELEMENT root (elem)>
+<!ELEMENT elem (#PCDATA)>
+<!ATTLIST elem id ID #IMPLIED>
+<!ENTITY target SYSTEM "dtds/737840.ent">
+]>
+
+<root>
+ &target;
+</root>
diff --git a/test/valid/dtds/737840.ent b/test/valid/dtds/737840.ent
new file mode 100644
index 00000000..e9721324
--- /dev/null
+++ b/test/valid/dtds/737840.ent
@@ -0,0 +1 @@
+<elem id="id0"/> \ No newline at end of file
diff --git a/threads.c b/threads.c
index 8921204b..b9d6cae3 100644
--- a/threads.c
+++ b/threads.c
@@ -47,7 +47,7 @@
#ifdef HAVE_PTHREAD_H
static int libxml_is_threaded = -1;
-#ifdef __GNUC__
+#if defined(__GNUC__) && defined(__GLIBC__)
#ifdef linux
#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
extern int pthread_once (pthread_once_t *__once_control,
@@ -89,7 +89,7 @@ extern int pthread_cond_signal ()
__attribute((weak));
#endif
#endif /* linux */
-#endif /* __GNUC__ */
+#endif /* defined(__GNUC__) && defined(__GLIBC__) */
#endif /* HAVE_PTHREAD_H */
/*
@@ -415,8 +415,8 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
if (tok->count > 0) {
- LeaveCriticalSection(&tok->cs);
tok->count--;
+ LeaveCriticalSection(&tok->cs);
}
#elif defined HAVE_BEOS_THREADS
if (tok->lock->tid == find_thread(NULL)) {
diff --git a/timsort.h b/timsort.h
index efa3aab1..795f2721 100644
--- a/timsort.h
+++ b/timsort.h
@@ -392,62 +392,66 @@ static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const in
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;
+ while (1) {
+ int64_t A, B, C, D;
+ int ABC, BCD, BD, CD;
+
/* if the stack only has one thing on it, we are done with the collapse */
- if (stack_curr <= 1) break;
+ if (stack_curr <= 1) {
+ break;
+ }
+
/* if this is the last merge, just do it */
- if ((stack_curr == 2) &&
- (stack[0].length + stack[1].length == (int64_t) size))
- {
+ if ((stack_curr == 2) && (stack[0].length + stack[1].length == size)) {
TIM_SORT_MERGE(dst, stack, stack_curr, store);
stack[0].length += stack[1].length;
stack_curr--;
break;
}
/* check if the invariant is off for a stack of 2 elements */
- else if ((stack_curr == 2) && (stack[0].length <= stack[1].length))
- {
+ else if ((stack_curr == 2) && (stack[0].length <= stack[1].length)) {
TIM_SORT_MERGE(dst, stack, stack_curr, store);
stack[0].length += stack[1].length;
stack_curr--;
break;
- }
- else if (stack_curr == 2)
+ } else if (stack_curr == 2) {
break;
+ }
- A = stack[stack_curr - 3].length;
- B = stack[stack_curr - 2].length;
- C = stack[stack_curr - 1].length;
+ B = stack[stack_curr - 3].length;
+ C = stack[stack_curr - 2].length;
+ D = stack[stack_curr - 1].length;
- /* check first invariant */
- if (A <= B + C)
- {
- if (A < C)
- {
- TIM_SORT_MERGE(dst, stack, stack_curr - 1, store);
- stack[stack_curr - 3].length += stack[stack_curr - 2].length;
- stack[stack_curr - 2] = stack[stack_curr - 1];
- stack_curr--;
- }
- else
- {
- TIM_SORT_MERGE(dst, stack, stack_curr, store);
- stack[stack_curr - 2].length += stack[stack_curr - 1].length;
- stack_curr--;
- }
+ if (stack_curr >= 4) {
+ A = stack[stack_curr - 4].length;
+ ABC = (A <= B + C);
+ } else {
+ ABC = 0;
}
- /* check second invariant */
- else if (B <= C)
- {
+
+ BCD = (B <= C + D) || ABC;
+ CD = (C <= D);
+ BD = (B < D);
+
+ /* Both invariants are good */
+ if (!BCD && !CD) {
+ break;
+ }
+
+ /* left merge */
+ if (BCD && !CD) {
+ TIM_SORT_MERGE(dst, stack, stack_curr - 1, store);
+ stack[stack_curr - 3].length += stack[stack_curr - 2].length;
+ stack[stack_curr - 2] = stack[stack_curr - 1];
+ stack_curr--;
+ } else {
+ /* right merge */
TIM_SORT_MERGE(dst, stack, stack_curr, store);
stack[stack_curr - 2].length += stack[stack_curr - 1].length;
stack_curr--;
}
- else
- break;
}
+
return stack_curr;
}
diff --git a/tree.c b/tree.c
index 6ec92236..6a158cec 100644
--- a/tree.c
+++ b/tree.c
@@ -2799,8 +2799,27 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
if(tree->type == XML_ELEMENT_NODE) {
prop = tree->properties;
while (prop != NULL) {
+ if (prop->atype == XML_ATTRIBUTE_ID) {
+ xmlRemoveID(tree->doc, prop);
+ }
+
prop->doc = doc;
xmlSetListDoc(prop->children, doc);
+
+ /*
+ * TODO: ID attributes should be also added to the new
+ * document, but this breaks things like xmlReplaceNode.
+ * The underlying problem is that xmlRemoveID is only called
+ * if a node is destroyed, not if it's unlinked.
+ */
+#if 0
+ if (xmlIsID(doc, tree, prop)) {
+ xmlChar *idVal = xmlNodeListGetString(doc, prop->children,
+ 1);
+ xmlAddID(NULL, doc, idVal, prop);
+ }
+#endif
+
prop = prop->next;
}
}
diff --git a/valid.c b/valid.c
index 409aa81d..45a3f703 100644
--- a/valid.c
+++ b/valid.c
@@ -2634,8 +2634,10 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
/*
* The id is already defined in this DTD.
*/
- xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
- "ID %s already defined\n", value, NULL, NULL);
+ if (ctxt != NULL) {
+ xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
+ "ID %s already defined\n", value, NULL, NULL);
+ }
#endif /* LIBXML_VALID_ENABLED */
xmlFreeID(ret);
return(NULL);
diff --git a/xmllint.c b/xmllint.c
index b297ded1..1e2eb4ab 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -3046,7 +3046,7 @@ static void usage(const char *name) {
printf("\t--noblanks : drop (ignorable?) blanks spaces\n");
printf("\t--nocdata : replace cdata section with text nodes\n");
#ifdef LIBXML_OUTPUT_ENABLED
- printf("\t--format : reformat/reindent the input\n");
+ printf("\t--format : reformat/reindent the output\n");
printf("\t--encode encoding : output in the given encoding\n");
printf("\t--dropdtd : remove the DOCTYPE of the input docs\n");
printf("\t--pretty STYLE : pretty-print in a particular style\n");
diff --git a/xmlmemory.c b/xmlmemory.c
index a3dc737f..f24fd6d4 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -554,7 +554,12 @@ xmlMemoryStrdup(const char *str) {
int
xmlMemUsed(void) {
- return(debugMemSize);
+ int res;
+
+ xmlMutexLock(xmlMemMutex);
+ res = debugMemSize;
+ xmlMutexUnlock(xmlMemMutex);
+ return(res);
}
/**
@@ -567,7 +572,12 @@ xmlMemUsed(void) {
int
xmlMemBlocks(void) {
- return(debugMemBlocks);
+ int res;
+
+ xmlMutexLock(xmlMemMutex);
+ res = debugMemBlocks;
+ xmlMutexUnlock(xmlMemMutex);
+ return(res);
}
#ifdef MEM_LIST
diff --git a/xmlreader.c b/xmlreader.c
index f19e1233..471e7e2a 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -2091,6 +2091,9 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
"xmlNewTextReader : malloc failed\n");
return(NULL);
}
+ /* no operation on a reader should require a huge buffer */
+ xmlBufSetAllocationScheme(ret->buffer,
+ XML_BUFFER_ALLOC_BOUNDED);
ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
if (ret->sax == NULL) {
xmlBufFree(ret->buffer);
@@ -3616,6 +3619,7 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
return(((xmlNsPtr) node)->href);
case XML_ATTRIBUTE_NODE:{
xmlAttrPtr attr = (xmlAttrPtr) node;
+ const xmlChar *ret;
if ((attr->children != NULL) &&
(attr->children->type == XML_TEXT_NODE) &&
@@ -3629,10 +3633,21 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
"xmlTextReaderSetup : malloc failed\n");
return (NULL);
}
+ xmlBufSetAllocationScheme(reader->buffer,
+ XML_BUFFER_ALLOC_BOUNDED);
} else
xmlBufEmpty(reader->buffer);
xmlBufGetNodeContent(reader->buffer, node);
- return(xmlBufContent(reader->buffer));
+ ret = xmlBufContent(reader->buffer);
+ if (ret == NULL) {
+ /* error on the buffer best to reallocate */
+ xmlBufFree(reader->buffer);
+ reader->buffer = xmlBufCreateSize(100);
+ xmlBufSetAllocationScheme(reader->buffer,
+ XML_BUFFER_ALLOC_BOUNDED);
+ ret = BAD_CAST "";
+ }
+ return(ret);
}
break;
}
@@ -5131,6 +5146,9 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
"xmlTextReaderSetup : malloc failed\n");
return (-1);
}
+ /* no operation on a reader should require a huge buffer */
+ xmlBufSetAllocationScheme(reader->buffer,
+ XML_BUFFER_ALLOC_BOUNDED);
if (reader->sax == NULL)
reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
if (reader->sax == NULL) {
diff --git a/xmlschemas.c b/xmlschemas.c
index 0657b66a..d47512f0 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -24186,6 +24186,7 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt,
else
goto pattern_and_enum;
}
+
/*
* Whitespace handling is only of importance for string-based
* types.
@@ -24196,14 +24197,13 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt,
ws = xmlSchemaGetWhiteSpaceFacetValue(type);
} else
ws = XML_SCHEMA_WHITESPACE_COLLAPSE;
+
/*
* If the value was not computed (for string or
* anySimpleType based types), then use the provided
* type.
*/
- if (val == NULL)
- valType = valType;
- else
+ if (val != NULL)
valType = xmlSchemaGetValType(val);
ret = 0;
diff --git a/xpath.c b/xpath.c
index dc41ce6b..935fcff0 100644
--- a/xpath.c
+++ b/xpath.c
@@ -361,14 +361,14 @@ turtle_comparison:
/*
* compute depth to root
*/
- for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) {
- if (cur == node1)
+ for (depth2 = 0, cur = node2; cur->parent != NULL; cur = cur->parent) {
+ if (cur->parent == node1)
return(1);
depth2++;
}
root = cur;
- for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) {
- if (cur == node2)
+ for (depth1 = 0, cur = node1; cur->parent != NULL; cur = cur->parent) {
+ if (cur->parent == node2)
return(-1);
depth1++;
}
@@ -7933,14 +7933,14 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
xmlNodePtr
xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
- if (cur == NULL) {
- if (ctxt->context->node == NULL)
- return(NULL);
- if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
- (ctxt->context->node->type == XML_NAMESPACE_DECL))
- return(NULL);
+ if (cur == NULL)
return(ctxt->context->node);
- }
+
+ if (ctxt->context->node == NULL)
+ return(NULL);
+ if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
+ (ctxt->context->node->type == XML_NAMESPACE_DECL))
+ return(NULL);
return(xmlXPathNextDescendant(ctxt, cur));
}