summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2022-12-21 13:43:40 +0100
committerMichael BrĂ¼ning <michael.bruning@qt.io>2023-01-12 12:02:43 +0000
commit97a1254923022e66fa75245c3ace64f58112cba6 (patch)
tree9197c3b414e24ca77d34abc1b7794776dc9df742
parent28a1b2eb95e06bc4dd8c93bb61106e35eaf715c7 (diff)
downloadqtwebengine-chromium-97a1254923022e66fa75245c3ace64f58112cba6.tar.gz
[Backport] Security bug 1394382
Manually update libxml to the version 2.9.13 and the sha1 used on 102-based. Change-Id: I699696b395258a6ba3a1a9b2f48d10036f2b638f Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/450083 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--chromium/third_party/libxml/BUILD.gn10
-rw-r--r--chromium/third_party/libxml/DIR_METADATA3
-rw-r--r--chromium/third_party/libxml/OWNERS4
-rw-r--r--chromium/third_party/libxml/README.chromium13
-rw-r--r--chromium/third_party/libxml/chromium/libxml2-2.9.4-security-xpath-nodetab-uaf.patch4
-rwxr-xr-xchromium/third_party/libxml/chromium/roll.py11
-rw-r--r--chromium/third_party/libxml/chromium/undo-sax-deprecation.patch15
-rw-r--r--chromium/third_party/libxml/chromium/xml_reader.cc22
-rw-r--r--chromium/third_party/libxml/chromium/xml_reader.h13
-rw-r--r--chromium/third_party/libxml/linux/config.h37
-rw-r--r--chromium/third_party/libxml/linux/include/libxml/xmlversion.h72
-rwxr-xr-xchromium/third_party/libxml/linux/xml2-config6
-rw-r--r--chromium/third_party/libxml/mac/config.h37
-rw-r--r--chromium/third_party/libxml/mac/include/libxml/xmlversion.h72
-rw-r--r--chromium/third_party/libxml/src/CMakeLists.txt188
-rw-r--r--chromium/third_party/libxml/src/HTMLparser.c587
-rw-r--r--chromium/third_party/libxml/src/HTMLtree.c23
-rw-r--r--chromium/third_party/libxml/src/Makefile.am1148
-rw-r--r--chromium/third_party/libxml/src/NEWS224
-rw-r--r--chromium/third_party/libxml/src/README.md126
-rw-r--r--chromium/third_party/libxml/src/SAX2.c123
-rw-r--r--chromium/third_party/libxml/src/aclocal.m4346
-rw-r--r--chromium/third_party/libxml/src/buf.c313
-rwxr-xr-xchromium/third_party/libxml/src/check-relaxng-test-suite.py218
-rwxr-xr-xchromium/third_party/libxml/src/check-relaxng-test-suite2.py242
-rwxr-xr-xchromium/third_party/libxml/src/check-xinclude-test-suite.py203
-rwxr-xr-xchromium/third_party/libxml/src/check-xml-test-suite.py271
-rwxr-xr-xchromium/third_party/libxml/src/check-xsddata-test-suite.py250
-rw-r--r--chromium/third_party/libxml/src/config.h.cmake.in30
-rw-r--r--chromium/third_party/libxml/src/config.h.in29
-rw-r--r--chromium/third_party/libxml/src/configure.ac1857
-rw-r--r--chromium/third_party/libxml/src/dict.c41
-rw-r--r--chromium/third_party/libxml/src/encoding.c126
-rw-r--r--chromium/third_party/libxml/src/entities.c62
-rw-r--r--chromium/third_party/libxml/src/error.c6
-rwxr-xr-xchromium/third_party/libxml/src/genUnicode.py82
-rwxr-xr-xchromium/third_party/libxml/src/gentest.py443
-rw-r--r--chromium/third_party/libxml/src/globals.c165
-rw-r--r--chromium/third_party/libxml/src/hash.c8
-rw-r--r--chromium/third_party/libxml/src/include/Makefile.am2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/HTMLparser.h14
-rw-r--r--chromium/third_party/libxml/src/include/libxml/Makefile.am4
-rw-r--r--chromium/third_party/libxml/src/include/libxml/SAX.h6
-rw-r--r--chromium/third_party/libxml/src/include/libxml/SAX2.h13
-rw-r--r--chromium/third_party/libxml/src/include/libxml/dict.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/encoding.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/globals.h47
-rw-r--r--chromium/third_party/libxml/src/include/libxml/parser.h24
-rw-r--r--chromium/third_party/libxml/src/include/libxml/parserInternals.h99
-rw-r--r--chromium/third_party/libxml/src/include/libxml/relaxng.h1
-rw-r--r--chromium/third_party/libxml/src/include/libxml/schematron.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/threads.h8
-rw-r--r--chromium/third_party/libxml/src/include/libxml/tree.h10
-rw-r--r--chromium/third_party/libxml/src/include/libxml/valid.h15
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlautomata.h6
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlerror.h31
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlexports.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlmemory.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlschemastypes.h1
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlversion.h.in66
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xpath.h11
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xpointer.h23
-rw-r--r--chromium/third_party/libxml/src/include/private/Makefile.am15
-rw-r--r--chromium/third_party/libxml/src/include/private/Makefile.in541
-rw-r--r--chromium/third_party/libxml/src/include/private/buf.h48
-rw-r--r--chromium/third_party/libxml/src/include/private/dict.h7
-rw-r--r--chromium/third_party/libxml/src/include/private/enc.h11
-rw-r--r--chromium/third_party/libxml/src/include/private/entities.h9
-rw-r--r--chromium/third_party/libxml/src/include/private/error.h21
-rw-r--r--chromium/third_party/libxml/src/include/private/html.h13
-rw-r--r--chromium/third_party/libxml/src/include/private/io.h18
-rw-r--r--chromium/third_party/libxml/src/include/private/parser.h25
-rw-r--r--chromium/third_party/libxml/src/include/private/regexp.h8
-rw-r--r--chromium/third_party/libxml/src/include/private/save.h16
-rw-r--r--chromium/third_party/libxml/src/include/private/string.h8
-rw-r--r--chromium/third_party/libxml/src/include/private/threads.h8
-rw-r--r--chromium/third_party/libxml/src/include/private/tree.h11
-rw-r--r--chromium/third_party/libxml/src/include/private/xzlib.h27
-rw-r--r--chromium/third_party/libxml/src/include/win32config.h93
-rw-r--r--chromium/third_party/libxml/src/include/wsockcompat.h7
-rw-r--r--chromium/third_party/libxml/src/libxml-2.0-uninstalled.pc.in7
-rw-r--r--chromium/third_party/libxml/src/libxml-2.0.pc.in4
-rw-r--r--chromium/third_party/libxml/src/libxml.h58
-rw-r--r--chromium/third_party/libxml/src/libxml.spec.in3
-rw-r--r--chromium/third_party/libxml/src/libxml2.syms44
-rw-r--r--chromium/third_party/libxml/src/nanoftp.c23
-rw-r--r--chromium/third_party/libxml/src/nanohttp.c92
-rw-r--r--chromium/third_party/libxml/src/parser.c655
-rw-r--r--chromium/third_party/libxml/src/parserInternals.c347
-rw-r--r--chromium/third_party/libxml/src/pattern.c16
-rwxr-xr-xchromium/third_party/libxml/src/py-compile189
-rw-r--r--chromium/third_party/libxml/src/runsuite.c4
-rw-r--r--chromium/third_party/libxml/src/runtest.c608
-rw-r--r--chromium/third_party/libxml/src/runxmlconf.c3
-rw-r--r--chromium/third_party/libxml/src/testThreads.c66
-rw-r--r--chromium/third_party/libxml/src/testapi.c1638
-rw-r--r--chromium/third_party/libxml/src/testchar.c160
-rw-r--r--chromium/third_party/libxml/src/testlimits.c8
-rw-r--r--chromium/third_party/libxml/src/testrecurse.c1
-rw-r--r--chromium/third_party/libxml/src/threads.c260
-rw-r--r--chromium/third_party/libxml/src/tree.c366
-rw-r--r--chromium/third_party/libxml/src/uri.c5
-rw-r--r--chromium/third_party/libxml/src/valid.c32
-rw-r--r--chromium/third_party/libxml/src/win32/Makefile.bcb21
-rw-r--r--chromium/third_party/libxml/src/win32/Makefile.mingw22
-rw-r--r--chromium/third_party/libxml/src/win32/Makefile.msvc78
-rw-r--r--chromium/third_party/libxml/src/win32/configure.js24
-rw-r--r--chromium/third_party/libxml/src/win32/defgen.xsl29
-rw-r--r--chromium/third_party/libxml/src/win32/libxml2.def.src55
-rw-r--r--chromium/third_party/libxml/src/xmlIO.c45
-rw-r--r--chromium/third_party/libxml/src/xmlmemory.c12
-rw-r--r--chromium/third_party/libxml/src/xmlreader.c70
-rw-r--r--chromium/third_party/libxml/src/xmlsave.c69
-rw-r--r--chromium/third_party/libxml/src/xmlstring.c40
-rw-r--r--chromium/third_party/libxml/src/xmlunicode.c60
-rw-r--r--chromium/third_party/libxml/src/xmlwriter.c13
-rw-r--r--chromium/third_party/libxml/src/xpath.c308
-rw-r--r--chromium/third_party/libxml/win32/config.h93
-rw-r--r--chromium/third_party/libxml/win32/include/libxml/xmlversion.h72
119 files changed, 6547 insertions, 7760 deletions
diff --git a/chromium/third_party/libxml/BUILD.gn b/chromium/third_party/libxml/BUILD.gn
index da49ade0967..560e44975a0 100644
--- a/chromium/third_party/libxml/BUILD.gn
+++ b/chromium/third_party/libxml/BUILD.gn
@@ -123,7 +123,8 @@ static_library("libxml_utils") {
":xml_reader",
":xml_writer",
"//base/test:test_support",
- "//services/data_decoder:xml_parser_fuzzer",
+ "//services/data_decoder:lib",
+ "//services/data_decoder:xml_parser_fuzzer_deps",
]
sources = [
"chromium/libxml_utils.cc",
@@ -146,14 +147,12 @@ static_library("bundled_libxml") {
# Commented out sources are libxml2 files we do not want to include. They are
# here to make it easy to identify files which are new.
sources = [
- #"src/DOCBparser.c",
"src/HTMLparser.c",
"src/HTMLtree.c",
#"src/SAX.c",
"src/SAX2.c",
"src/buf.c",
- "src/buf.h",
#"src/c14n.c",
#"src/catalog.c",
@@ -161,13 +160,11 @@ static_library("bundled_libxml") {
#"src/debugXML.c",
"src/dict.c",
- "src/enc.h",
"src/encoding.c",
"src/entities.c",
"src/error.c",
"src/globals.c",
"src/hash.c",
- "src/include/libxml/DOCBparser.h",
"src/include/libxml/HTMLparser.h",
"src/include/libxml/HTMLtree.h",
"src/include/libxml/SAX.h",
@@ -222,7 +219,6 @@ static_library("bundled_libxml") {
"src/pattern.c",
#"src/relaxng.c",
- "src/save.h",
#"src/schematron.c",
"src/threads.c",
@@ -262,7 +258,6 @@ static_library("bundled_libxml") {
#"src/xpointer.c",
#"src/xzlib.c",
- "src/xzlib.h",
]
configs -= [ "//build/config/compiler:chromium_code" ]
@@ -358,6 +353,7 @@ if (use_system_libxml) {
"//third_party/blink/renderer/*",
"//third_party/fontconfig",
"//third_party/libxslt/*",
+ "//third_party/maldoca/*",
]
if (is_ios) {
foreach(tgt, ios_libxml_visibility_additions) {
diff --git a/chromium/third_party/libxml/DIR_METADATA b/chromium/third_party/libxml/DIR_METADATA
new file mode 100644
index 00000000000..a0e30b3eb06
--- /dev/null
+++ b/chromium/third_party/libxml/DIR_METADATA
@@ -0,0 +1,3 @@
+monorail: {
+ component: "Blink>XML"
+}
diff --git a/chromium/third_party/libxml/OWNERS b/chromium/third_party/libxml/OWNERS
index 494e9ef8a11..536598c5928 100644
--- a/chromium/third_party/libxml/OWNERS
+++ b/chromium/third_party/libxml/OWNERS
@@ -2,6 +2,4 @@
# a CL to add yourself here.
dcheng@chromium.org
schenney@chromium.org
-palmer@chromium.org
-
-# COMPONENT: Blink>XML
+jarhar@chromium.org
diff --git a/chromium/third_party/libxml/README.chromium b/chromium/third_party/libxml/README.chromium
index e1b7e1d8065..9813d7cd51b 100644
--- a/chromium/third_party/libxml/README.chromium
+++ b/chromium/third_party/libxml/README.chromium
@@ -1,7 +1,7 @@
Name: libxml
URL: http://xmlsoft.org
-Version: 37ebf8a8b2789037792cfc0264b814d742cda2d9
-CPEPrefix: cpe:/a:xmlsoft:libxml2:2.9.12
+Version: e85f9b98a5389c69167176ae6600091e719ec38f
+CPEPrefix: cpe:/a:xmlsoft:libxml2:2.9.13
License: MIT
License File: src/Copyright
Security Critical: yes
@@ -12,7 +12,6 @@ libxml2 from libxml.org.
Modifications:
-- chromium-issue-599427.patch: workaround for VS 2015 Update 2 code-gen bug
- chromium-issue-628581.patch: See https://crbug.com/628581#c18
- chromium-issue-894933.patch: Use ptrdiff_t instead of unsigned long for
pointer differences in parser.c
@@ -20,10 +19,10 @@ Modifications:
See https://crbug.com/708433
- libxml2-2.9.4-security-xpath-nodetab-uaf.patch: See https://crbug.com/705445
- chromium-issue-708434.patch: Guard against input counter overflow.
-- revert-non-recursive-xml-parsing.patch: Making parts of the XML parser
- non-recursive broke a few web platform tests.
-- add-fuzz-target.patch: Prevents autoreconf from failing on mac due to a
- missing makefile for fuzz.
+- chromium-issue-1138555.patch: Change TRUE to 1 for ICU68 which remove the
+ #define of TRUE.
+- undo-sax-deprecation.patch: Un-deprecate xmlSAXParseMemory because it is used
+ in chromium's copy of maldoca. See https://github.com/google/maldoca/issues/87
- Add helper classes in the chromium/ subdirectory.
- Delete various unused files, see chromium/roll.py
diff --git a/chromium/third_party/libxml/chromium/libxml2-2.9.4-security-xpath-nodetab-uaf.patch b/chromium/third_party/libxml/chromium/libxml2-2.9.4-security-xpath-nodetab-uaf.patch
index ecf93074a68..92151ad11f1 100644
--- a/chromium/third_party/libxml/chromium/libxml2-2.9.4-security-xpath-nodetab-uaf.patch
+++ b/chromium/third_party/libxml/chromium/libxml2-2.9.4-security-xpath-nodetab-uaf.patch
@@ -4,9 +4,9 @@ and https://bugs.chromium.org/p/chromium/issues/detail?id=705445
--- src/xpath.c 2016-12-25 17:26:52.000000000 -0800
+++ src/xpath.c 2017-03-30 11:15:41.000000000 -0700
-@@ -4368,7 +4368,7 @@
+@@ -4344,7 +4344,7 @@ xmlXPathNewValueTree(xmlNodePtr val) {
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_XSLT_TREE;
- ret->boolval = 1;
+ ret->boolval = 0;
diff --git a/chromium/third_party/libxml/chromium/roll.py b/chromium/third_party/libxml/chromium/roll.py
index 17ddb1dda9a..273dd24590b 100755
--- a/chromium/third_party/libxml/chromium/roll.py
+++ b/chromium/third_party/libxml/chromium/roll.py
@@ -66,12 +66,10 @@ import tempfile
# e. Complete the review as usual
PATCHES = [
- 'chromium-issue-599427.patch',
'chromium-issue-628581.patch',
'libxml2-2.9.4-security-xpath-nodetab-uaf.patch',
'chromium-issue-708434.patch',
- # TODO(jarhar): Merge this back upstream.
- 'add-fuzz-target.patch',
+ 'undo-sax-deprecation.patch',
]
@@ -99,7 +97,6 @@ SHARED_XML_CONFIGURE_OPTIONS = [
('--without-c14n', 'c14n=no'),
('--without-catalog', 'catalog=no'),
('--without-debug', 'xml_debug=no'),
- ('--without-docbook', 'docb=no'),
('--without-ftp', 'ftp=no'),
('--without-http', 'http=no'),
('--without-iconv', 'iconv=no'),
@@ -110,13 +107,13 @@ SHARED_XML_CONFIGURE_OPTIONS = [
('--without-modules', 'modules=no'),
('--without-pattern', 'pattern=no'),
('--without-regexps', 'regexps=no'),
- ('--without-run-debug', 'run_debug=no'),
('--without-schemas', 'schemas=no'),
('--without-schematron', 'schematron=no'),
('--without-threads', 'threads=no'),
('--without-valid', 'valid=no'),
('--without-xinclude', 'xinclude=no'),
('--without-xptr', 'xptr=no'),
+ ('--without-xptr-locs', 'xptr_locs=no'),
('--without-zlib', 'zlib=no'),
]
@@ -344,7 +341,7 @@ def prepare_libxml_distribution(src_path, libxml2_repo_path, temp_dir):
# Work out what it is called
tar_file = subprocess.check_output(
'''awk '/PACKAGE =/ {p=$3} /VERSION =/ {v=$3} '''
- '''END {printf("%s-%s.tar.gz", p, v)}' Makefile''',
+ '''END {printf("%s-%s.tar.xz", p, v)}' Makefile''',
shell=True).decode('ascii')
return commit, os.path.abspath(tar_file)
@@ -366,7 +363,7 @@ def roll_libxml_linux(src_path, libxml2_repo_path):
# Update the libxml repo and export it to the Chromium tree
with WorkingDir(THIRD_PARTY_LIBXML_SRC):
subprocess.check_call(
- 'tar xzf %s --strip-components=1' % tar_file,
+ 'tar xJf %s --strip-components=1' % tar_file,
shell=True)
finally:
shutil.rmtree(temp_dir)
diff --git a/chromium/third_party/libxml/chromium/undo-sax-deprecation.patch b/chromium/third_party/libxml/chromium/undo-sax-deprecation.patch
new file mode 100644
index 00000000000..51f68b94ab7
--- /dev/null
+++ b/chromium/third_party/libxml/chromium/undo-sax-deprecation.patch
@@ -0,0 +1,15 @@
+diff --git a/include/libxml/parser.h b/include/libxml/parser.h
+index f96148b5..1587b9d0 100644
+--- a/include/libxml/parser.h
++++ b/include/libxml/parser.h
+@@ -897,7 +897,9 @@ XMLPUBFUN xmlDocPtr XMLCALL
+ xmlSAXParseDoc (xmlSAXHandlerPtr sax,
+ const xmlChar *cur,
+ int recovery);
+-XML_DEPRECATED
++// TODO(https://github.com/google/maldoca/issues/87): Re-Deprecate this when
++// maldoca stops using xmlSAXParseMemory.
++//XML_DEPRECATED
+ XMLPUBFUN xmlDocPtr XMLCALL
+ xmlSAXParseMemory (xmlSAXHandlerPtr sax,
+ const char *buffer,
diff --git a/chromium/third_party/libxml/chromium/xml_reader.cc b/chromium/third_party/libxml/chromium/xml_reader.cc
index 899ccefb7c8..65b1b2c8dee 100644
--- a/chromium/third_party/libxml/chromium/xml_reader.cc
+++ b/chromium/third_party/libxml/chromium/xml_reader.cc
@@ -149,19 +149,15 @@ bool XmlReader::GetAllDeclaredNamespaces(
}
bool XmlReader::GetTextIfTextElement(std::string* content) {
- if (NodeType() != XML_READER_TYPE_TEXT)
- return false;
-
- *content = XmlStringToStdString(xmlTextReaderConstValue(reader_));
- return true;
+ return GetTextFromNodeIfType(XML_READER_TYPE_TEXT, content);
}
bool XmlReader::GetTextIfCDataElement(std::string* content) {
- if (NodeType() != XML_READER_TYPE_CDATA)
- return false;
+ return GetTextFromNodeIfType(XML_READER_TYPE_CDATA, content);
+}
- *content = XmlStringToStdString(xmlTextReaderConstValue(reader_));
- return true;
+bool XmlReader::GetTextIfSignificantWhitespaceElement(std::string* content) {
+ return GetTextFromNodeIfType(XML_READER_TYPE_SIGNIFICANT_WHITESPACE, content);
}
bool XmlReader::IsElement() {
@@ -226,3 +222,11 @@ bool XmlReader::SkipToElement() {
int XmlReader::NodeType() {
return xmlTextReaderNodeType(reader_);
}
+
+bool XmlReader::GetTextFromNodeIfType(int node_type, std::string* content) {
+ if (NodeType() != node_type)
+ return false;
+
+ *content = XmlStringToStdString(xmlTextReaderConstValue(reader_));
+ return true;
+}
diff --git a/chromium/third_party/libxml/chromium/xml_reader.h b/chromium/third_party/libxml/chromium/xml_reader.h
index eb1ae63807f..d9acd782ff4 100644
--- a/chromium/third_party/libxml/chromium/xml_reader.h
+++ b/chromium/third_party/libxml/chromium/xml_reader.h
@@ -64,11 +64,13 @@ class XmlReader {
// Returns false if there are no namespaces declared in the current tag.
bool GetAllDeclaredNamespaces(std::map<std::string, std::string>* namespaces);
- // Sets |content| to the content of the current node if it is a #text/#cdata
- // node.
- // Returns true if the current node is a #text/#cdata node, false otherwise.
+ // Sets |content| to the content of the current node if it is a
+ // text, cdata, or significant-whitespace node, respectively.
+ // Returns true if the current node is a node of the corresponding, false
+ // otherwise.
bool GetTextIfTextElement(std::string* content);
bool GetTextIfCDataElement(std::string* content);
+ bool GetTextIfSignificantWhitespaceElement(std::string* content);
// Returns true if the node is an element (e.g. <foo>). Note this returns
// false for self-closing elements (e.g. <foo/>). Use IsEmptyElement() to
@@ -101,6 +103,11 @@ class XmlReader {
// Returns the libxml node type of the current node.
int NodeType();
+ // A helper function for GetTextIf*Element() functions above.
+ // Checks if the node is the specified `node_type`, and, if so, populates
+ // `content` and returns true.
+ bool GetTextFromNodeIfType(int node_type, std::string* content);
+
// The underlying libxml xmlTextReader.
_xmlTextReader* reader_;
};
diff --git a/chromium/third_party/libxml/linux/config.h b/chromium/third_party/libxml/linux/config.h
index c702e7980cf..62bfa6b69e6 100644
--- a/chromium/third_party/libxml/linux/config.h
+++ b/chromium/third_party/libxml/linux/config.h
@@ -4,21 +4,12 @@
/* A form that will not confuse apibuild.py */
#define ATTRIBUTE_DESTRUCTOR __attribute__((destructor))
-/* Type cast for the gethostbyname() argument */
-#define GETHOSTBYNAME_ARG_CAST /**/
-
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
-/* Define to 1 if you have the <arpa/nameser.h> header file. */
-#define HAVE_ARPA_NAMESER_H 1
-
/* Define if __attribute__((destructor)) is accepted */
#define HAVE_ATTRIBUTE_DESTRUCTOR 1
-/* Whether struct sockaddr::__ss_family exists */
-/* #undef HAVE_BROKEN_SS_FAMILY */
-
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
@@ -34,12 +25,12 @@
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
-/* Define if getaddrinfo is there */
-#define HAVE_GETADDRINFO /**/
-
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
+/* Define to 1 if you have the <glob.h> header file. */
+#define HAVE_GLOB_H 1
+
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@@ -84,9 +75,6 @@
/* Define to 1 if you have the `rand_r' function. */
-/* Define to 1 if you have the <resolv.h> header file. */
-#define HAVE_RESOLV_H 1
-
/* Have shl_load based dso */
/* #undef HAVE_SHLLOAD */
@@ -147,9 +135,6 @@
/* Whether __va_copy() is available */
/* #undef HAVE___VA_COPY */
-/* Define as const if the declaration of iconv() needs const. */
-/* #undef ICONV_CONST */
-
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
@@ -163,7 +148,7 @@
#define PACKAGE_NAME "libxml2"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libxml2 2.9.13"
+#define PACKAGE_STRING "libxml2 2.11.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libxml2"
@@ -172,10 +157,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "2.9.13"
-
-/* Type cast for the send() function 2nd arg */
-#define SEND_ARG2_CAST /**/
+#define PACKAGE_VERSION "2.11.0"
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
@@ -183,25 +165,22 @@
#define STDC_HEADERS 1
/* Support for IPv6 */
-#define SUPPORT_IP6 /**/
+/* #undef SUPPORT_IP6 */
/* Define if va_list is an array type */
#define VA_LIST_IS_ARRAY 1
/* Version number of package */
-#define VERSION "2.9.13"
+#define VERSION "2.11.0"
/* Determine what socket length (socklen_t) data type is */
-#define XML_SOCKLEN_T socklen_t
+/* #undef XML_SOCKLEN_T */
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT32_T */
-/* ss_family is not defined here, use __ss_family instead */
-/* #undef ss_family */
-
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint32_t */
diff --git a/chromium/third_party/libxml/linux/include/libxml/xmlversion.h b/chromium/third_party/libxml/linux/include/libxml/xmlversion.h
index fae4bf09503..ce0d40b2d5f 100644
--- a/chromium/third_party/libxml/linux/include/libxml/xmlversion.h
+++ b/chromium/third_party/libxml/linux/include/libxml/xmlversion.h
@@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
-#define LIBXML_DOTTED_VERSION "2.9.13"
+#define LIBXML_DOTTED_VERSION "2.11.0"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
-#define LIBXML_VERSION 20913
+#define LIBXML_VERSION 21100
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
-#define LIBXML_VERSION_STRING "20913"
+#define LIBXML_VERSION_STRING "21100"
/**
* LIBXML_VERSION_EXTRA:
@@ -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(20913);
+#define LIBXML_TEST_VERSION xmlCheckVersion(21100);
#ifndef VMS
#if 0
@@ -230,15 +230,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
- * LIBXML_DOCB_ENABLED:
- *
- * Whether the SGML Docbook support is configured in
- */
-#if 0
-#define LIBXML_DOCB_ENABLED
-#endif
-
-/**
* LIBXML_XPATH_ENABLED:
*
* Whether XPath is configured in
@@ -257,6 +248,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_XPTR_LOCS_ENABLED:
+ *
+ * Whether support for XPointer locations is configured in
+ */
+#if 0
+#define LIBXML_XPTR_LOCS_ENABLED
+#endif
+
+/**
* LIBXML_XINCLUDE_ENABLED:
*
* Whether XInclude is configured in
@@ -313,7 +313,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
/**
* LIBXML_DEBUG_RUNTIME:
*
- * Whether the runtime debugging is configured in
+ * Removed
*/
#if 0
#define LIBXML_DEBUG_RUNTIME
@@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
-
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
+/** DOC_DISABLE */
#ifndef ATTRIBUTE_UNUSED
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
@@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
-/**
- * LIBXML_ATTR_ALLOC_SIZE:
- *
- * Macro used to indicate to GCC this is an allocator function
- */
-
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
@@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
-/**
- * LIBXML_ATTR_FORMAT:
- *
- * Macro used to indicate to GCC the parameter are printf like
- */
-
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
@@ -465,6 +448,19 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
+#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#define XML_IGNORE_FPTR_CAST_WARNINGS \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
+ _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
+#define XML_POP_WARNINGS \
+ _Pragma("GCC diagnostic pop")
+#else
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+#define XML_POP_WARNINGS
+#endif
+
+/** DOC_ENABLE */
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
@@ -493,6 +489,18 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#ifndef XML_DEPRECATED
#define XML_DEPRECATED
#endif
+/**
+ * LIBXML_IGNORE_FPTR_CAST_WARNINGS:
+ *
+ * Macro used to ignore pointer cast warnings that can't be worked around.
+ */
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+/**
+ * LIBXML_POP_WARNINGS:
+ *
+ * Macro used to restore warnings state.
+ */
+#define XML_POP_WARNINGS
#endif /* __GNUC__ */
#ifdef __cplusplus
diff --git a/chromium/third_party/libxml/linux/xml2-config b/chromium/third_party/libxml/linux/xml2-config
index 28e7f230274..0adcac9aa6f 100755
--- a/chromium/third_party/libxml/linux/xml2-config
+++ b/chromium/third_party/libxml/linux/xml2-config
@@ -58,7 +58,7 @@ while test $# -gt 0; do
;;
--version)
- echo 2.9.13
+ echo 2.11.0
exit 0
;;
@@ -86,14 +86,12 @@ while test $# -gt 0; do
shift
libs="-lxml2"
else
- libs="-lxml2 -licui18n -licuuc -licudata -lm "
+ libs="-lxml2 -licui18n -licuuc -licudata -lm "
fi
if [ "-L${libdir}" != "-L/usr/lib" -a "-L${libdir}" != "-L/usr/lib64" ]; then
libs="-L${libdir} $libs"
fi
-
- libs="$libs "
;;
*)
diff --git a/chromium/third_party/libxml/mac/config.h b/chromium/third_party/libxml/mac/config.h
index c702e7980cf..62bfa6b69e6 100644
--- a/chromium/third_party/libxml/mac/config.h
+++ b/chromium/third_party/libxml/mac/config.h
@@ -4,21 +4,12 @@
/* A form that will not confuse apibuild.py */
#define ATTRIBUTE_DESTRUCTOR __attribute__((destructor))
-/* Type cast for the gethostbyname() argument */
-#define GETHOSTBYNAME_ARG_CAST /**/
-
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
-/* Define to 1 if you have the <arpa/nameser.h> header file. */
-#define HAVE_ARPA_NAMESER_H 1
-
/* Define if __attribute__((destructor)) is accepted */
#define HAVE_ATTRIBUTE_DESTRUCTOR 1
-/* Whether struct sockaddr::__ss_family exists */
-/* #undef HAVE_BROKEN_SS_FAMILY */
-
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
@@ -34,12 +25,12 @@
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
-/* Define if getaddrinfo is there */
-#define HAVE_GETADDRINFO /**/
-
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
+/* Define to 1 if you have the <glob.h> header file. */
+#define HAVE_GLOB_H 1
+
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@@ -84,9 +75,6 @@
/* Define to 1 if you have the `rand_r' function. */
-/* Define to 1 if you have the <resolv.h> header file. */
-#define HAVE_RESOLV_H 1
-
/* Have shl_load based dso */
/* #undef HAVE_SHLLOAD */
@@ -147,9 +135,6 @@
/* Whether __va_copy() is available */
/* #undef HAVE___VA_COPY */
-/* Define as const if the declaration of iconv() needs const. */
-/* #undef ICONV_CONST */
-
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
@@ -163,7 +148,7 @@
#define PACKAGE_NAME "libxml2"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libxml2 2.9.13"
+#define PACKAGE_STRING "libxml2 2.11.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libxml2"
@@ -172,10 +157,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "2.9.13"
-
-/* Type cast for the send() function 2nd arg */
-#define SEND_ARG2_CAST /**/
+#define PACKAGE_VERSION "2.11.0"
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
@@ -183,25 +165,22 @@
#define STDC_HEADERS 1
/* Support for IPv6 */
-#define SUPPORT_IP6 /**/
+/* #undef SUPPORT_IP6 */
/* Define if va_list is an array type */
#define VA_LIST_IS_ARRAY 1
/* Version number of package */
-#define VERSION "2.9.13"
+#define VERSION "2.11.0"
/* Determine what socket length (socklen_t) data type is */
-#define XML_SOCKLEN_T socklen_t
+/* #undef XML_SOCKLEN_T */
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT32_T */
-/* ss_family is not defined here, use __ss_family instead */
-/* #undef ss_family */
-
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint32_t */
diff --git a/chromium/third_party/libxml/mac/include/libxml/xmlversion.h b/chromium/third_party/libxml/mac/include/libxml/xmlversion.h
index fae4bf09503..ce0d40b2d5f 100644
--- a/chromium/third_party/libxml/mac/include/libxml/xmlversion.h
+++ b/chromium/third_party/libxml/mac/include/libxml/xmlversion.h
@@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
-#define LIBXML_DOTTED_VERSION "2.9.13"
+#define LIBXML_DOTTED_VERSION "2.11.0"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
-#define LIBXML_VERSION 20913
+#define LIBXML_VERSION 21100
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
-#define LIBXML_VERSION_STRING "20913"
+#define LIBXML_VERSION_STRING "21100"
/**
* LIBXML_VERSION_EXTRA:
@@ -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(20913);
+#define LIBXML_TEST_VERSION xmlCheckVersion(21100);
#ifndef VMS
#if 0
@@ -230,15 +230,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
- * LIBXML_DOCB_ENABLED:
- *
- * Whether the SGML Docbook support is configured in
- */
-#if 0
-#define LIBXML_DOCB_ENABLED
-#endif
-
-/**
* LIBXML_XPATH_ENABLED:
*
* Whether XPath is configured in
@@ -257,6 +248,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_XPTR_LOCS_ENABLED:
+ *
+ * Whether support for XPointer locations is configured in
+ */
+#if 0
+#define LIBXML_XPTR_LOCS_ENABLED
+#endif
+
+/**
* LIBXML_XINCLUDE_ENABLED:
*
* Whether XInclude is configured in
@@ -313,7 +313,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
/**
* LIBXML_DEBUG_RUNTIME:
*
- * Whether the runtime debugging is configured in
+ * Removed
*/
#if 0
#define LIBXML_DEBUG_RUNTIME
@@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
-
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
+/** DOC_DISABLE */
#ifndef ATTRIBUTE_UNUSED
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
@@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
-/**
- * LIBXML_ATTR_ALLOC_SIZE:
- *
- * Macro used to indicate to GCC this is an allocator function
- */
-
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
@@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
-/**
- * LIBXML_ATTR_FORMAT:
- *
- * Macro used to indicate to GCC the parameter are printf like
- */
-
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
@@ -465,6 +448,19 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
+#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#define XML_IGNORE_FPTR_CAST_WARNINGS \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
+ _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
+#define XML_POP_WARNINGS \
+ _Pragma("GCC diagnostic pop")
+#else
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+#define XML_POP_WARNINGS
+#endif
+
+/** DOC_ENABLE */
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
@@ -493,6 +489,18 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#ifndef XML_DEPRECATED
#define XML_DEPRECATED
#endif
+/**
+ * LIBXML_IGNORE_FPTR_CAST_WARNINGS:
+ *
+ * Macro used to ignore pointer cast warnings that can't be worked around.
+ */
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+/**
+ * LIBXML_POP_WARNINGS:
+ *
+ * Macro used to restore warnings state.
+ */
+#define XML_POP_WARNINGS
#endif /* __GNUC__ */
#ifdef __cplusplus
diff --git a/chromium/third_party/libxml/src/CMakeLists.txt b/chromium/third_party/libxml/src/CMakeLists.txt
index d679414886e..ccb225407b6 100644
--- a/chromium/third_party/libxml/src/CMakeLists.txt
+++ b/chromium/third_party/libxml/src/CMakeLists.txt
@@ -26,15 +26,14 @@ set(LIBXML2_WITH_AUTOMATA ON)
option(LIBXML2_WITH_C14N "Add the Canonicalization support" ON)
option(LIBXML2_WITH_CATALOG "Add the Catalog support" ON)
option(LIBXML2_WITH_DEBUG "Add the debugging module" ON)
-option(LIBXML2_WITH_DOCB "Add Docbook SGML support" ON)
set(LIBXML2_WITH_EXPR ON)
-option(LIBXML2_WITH_FTP "Add the FTP support" ON)
+option(LIBXML2_WITH_FTP "Add the FTP support" OFF)
option(LIBXML2_WITH_HTML "Add the HTML support" ON)
option(LIBXML2_WITH_HTTP "Add the HTTP support" ON)
option(LIBXML2_WITH_ICONV "Add ICONV support" ON)
option(LIBXML2_WITH_ICU "Add ICU support" OFF)
option(LIBXML2_WITH_ISO8859X "Add ISO8859X support if no iconv" ON)
-option(LIBXML2_WITH_LEGACY "Add deprecated APIs for compatibility" ON)
+option(LIBXML2_WITH_LEGACY "Add deprecated APIs for compatibility" OFF)
option(LIBXML2_WITH_LZMA "Use liblzma" ON)
option(LIBXML2_WITH_MEM_DEBUG "Add the memory debugging module" OFF)
option(LIBXML2_WITH_MODULES "Add the dynamic modules support" ON)
@@ -45,7 +44,6 @@ option(LIBXML2_WITH_PUSH "Add the PUSH parser interfaces" ON)
option(LIBXML2_WITH_PYTHON "Build Python bindings" ON)
option(LIBXML2_WITH_READER "Add the xmlReader parsing interface" ON)
option(LIBXML2_WITH_REGEXPS "Add Regular Expressions support" ON)
-option(LIBXML2_WITH_RUN_DEBUG "Add the runtime debugging module" OFF)
option(LIBXML2_WITH_SAX1 "Add the older SAX1 interface" ON)
option(LIBXML2_WITH_SCHEMAS "Add Relax-NG and Schemas support" ON)
option(LIBXML2_WITH_SCHEMATRON "Add Schematron support" ON)
@@ -60,6 +58,7 @@ option(LIBXML2_WITH_WRITER "Add the xmlWriter saving interface" ON)
option(LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON)
option(LIBXML2_WITH_XPATH "Add the XPATH support" ON)
option(LIBXML2_WITH_XPTR "Add the XPointer support" ON)
+option(LIBXML2_WITH_XPTR_LOCS "Add support for XPointer locations" OFF)
option(LIBXML2_WITH_ZLIB "Use libz" ON)
set(LIBXML2_XMLCONF_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Working directory for XML Conformance Test Suite")
@@ -78,15 +77,10 @@ endif()
if(LIBXML2_WITH_PYTHON)
check_include_files(unistd.h HAVE_UNISTD_H)
check_symbol_exists(F_GETFL fcntl.h HAVE_F_GETFL)
- if(HAVE_UNISTD_H AND HAVE_F_GETFL)
- find_package(Python COMPONENTS Interpreter Development REQUIRED)
- else()
- find_package(Python2 COMPONENTS Interpreter Development REQUIRED)
- add_library(Python::Python ALIAS Python2::Python)
- set(Python_EXECUTABLE ${Python2_EXECUTABLE})
- set(Python_SITEARCH ${Python2_SITEARCH})
- endif()
- set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory")
+ find_package(Python COMPONENTS Interpreter Development REQUIRED)
+ #set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory")
+ set(LIBXML2_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/python"
+ CACHE PATH "Python bindings install directory")
endif()
if(LIBXML2_WITH_THREADS)
@@ -97,7 +91,7 @@ if(LIBXML2_WITH_ZLIB)
find_package(ZLIB REQUIRED)
endif()
-foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_DOCB WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_RUN_DEBUG WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB)
+foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_XPTR_LOCS WITH_ZLIB)
if(LIBXML2_${VARIABLE})
set(${VARIABLE} 1)
else()
@@ -105,10 +99,13 @@ foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_D
endif()
endforeach()
-set(LIBXML_VERSION ${LIBXML_MAJOR_VERSION}0${LIBXML_MINOR_VERSION}0${LIBXML_MICRO_VERSION})
-set(LIBXML_VERSION_STRING "${LIBXML_VERSION}")
+set(LIBXML_VERSION ${VERSION})
set(LIBXML_VERSION_EXTRA "")
-set(LIBXML_VERSION_NUMBER ${LIBXML_VERSION})
+math(EXPR LIBXML_VERSION_NUMBER "
+ ${LIBXML_MAJOR_VERSION} * 10000 +
+ ${LIBXML_MINOR_VERSION} * 100 +
+ ${LIBXML_MICRO_VERSION}
+")
set(MODULE_EXTENSION "${CMAKE_SHARED_LIBRARY_SUFFIX}")
@@ -132,9 +129,7 @@ if(ZLIB_FOUND)
list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB)
endif()
-if(MSVC)
- configure_file(include/win32config.h config.h COPYONLY)
-else()
+if (NOT MSVC)
check_c_source_compiles("
void __attribute__((destructor))
f(void) {}
@@ -143,22 +138,7 @@ else()
if(HAVE_ATTRIBUTE_DESTRUCTOR)
set(ATTRIBUTE_DESTRUCTOR "__attribute__((destructor))")
endif()
- check_c_source_compiles("
- #include <netdb.h>
- int main() { (void) gethostbyname((const char*) \"\"); return 0; }
- " GETHOSTBYNAME_ARG_CAST_CONST)
- if(NOT GETHOSTBYNAME_ARG_CAST_CONST)
- set(GETHOSTBYNAME_ARG_CAST "(char *)")
- else()
- set(GETHOSTBYNAME_ARG_CAST "/**/")
- endif()
check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
- check_include_files(arpa/nameser.h HAVE_ARPA_NAMESER_H)
- check_struct_has_member("struct sockaddr_storage" ss_family "sys/socket.h;sys/types.h" HAVE_SS_FAMILY)
- check_struct_has_member("struct sockaddr_storage" __ss_family "sys/socket.h;sys/types.h" HAVE_BROKEN_SS_FAMILY)
- if(HAVE_BROKEN_SS_FAMILY)
- set(ss_family __ss_family)
- endif()
check_function_exists(class HAVE_CLASS)
check_include_files(dlfcn.h HAVE_DLFCN_H)
check_library_exists(dl dlopen "" HAVE_DLOPEN)
@@ -166,7 +146,6 @@ else()
check_include_files(fcntl.h HAVE_FCNTL_H)
check_function_exists(fpclass HAVE_FPCLASS)
check_function_exists(ftime HAVE_FTIME)
- check_function_exists(getaddrinfo HAVE_GETADDRINFO)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_function_exists(isascii HAVE_ISASCII)
@@ -177,10 +156,8 @@ else()
check_include_files(netdb.h HAVE_NETDB_H)
check_include_files(netinet/in.h HAVE_NETINET_IN_H)
check_include_files(poll.h HAVE_POLL_H)
- check_include_files(pthread.h HAVE_PTHREAD_H)
check_function_exists(putenv HAVE_PUTENV)
check_function_exists(rand_r HAVE_RAND_R)
- check_include_files(resolv.h HAVE_RESOLV_H)
check_library_exists(dld shl_load "" HAVE_SHLLOAD)
check_function_exists(stat HAVE_STAT)
check_include_files(stdint.h HAVE_STDINT_H)
@@ -190,40 +167,11 @@ else()
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
check_include_files(sys/timeb.h HAVE_SYS_TIMEB_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
- check_include_files(sys/types.h HAVE_SYS_TYPES_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_function_exists(va_copy HAVE_VA_COPY)
check_function_exists(__va_copy HAVE___VA_COPY)
- check_c_source_compiles("
- #include <stdlib.h>
- #include <iconv.h>
- extern
- #ifdef __cplusplus
- \"C\"
- #endif
- #if defined(__STDC__) || defined(__cplusplus)
- size_t iconv(iconv_t cd, char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft);
- #else
- size_t iconv();
- #endif
- int main() { return 0; }
- " ICONV_CONST_TEST)
- if(NOT ICONV_CONST_TEST)
- set(ICONV_CONST "const")
- endif()
set(LT_OBJDIR ".libs/")
check_c_source_compiles("
- #include <sys/socket.h>
- #include <sys/types.h>
- int main() { (void) send(1, (const char*) \"\", 1, 1); return 0; }
- " SEND_ARG2_CAST_CONST)
- if(NOT SEND_ARG2_CAST_CONST)
- set(SEND_ARG2_CAST "(char *)")
- else()
- set(SEND_ARG2_CAST "/**/")
- endif()
- check_include_files("float.h;stdarg.h;stdlib.h;string.h" STDC_HEADERS)
- check_c_source_compiles("
#include <stdarg.h>
void a(va_list* ap) {};
int main() { va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1; return 0; }
@@ -236,7 +184,6 @@ else()
check_c_source_compiles("
#include <stddef.h>
#include <sys/socket.h>
- #include <sys/types.h>
int main() { (void) getsockopt(1, 1, 1, NULL, (socklen_t*) NULL); return 0; }
" XML_SOCKLEN_T_SOCKLEN_T)
if(XML_SOCKLEN_T_SOCKLEN_T)
@@ -245,7 +192,6 @@ else()
check_c_source_compiles("
#include <stddef.h>
#include <sys/socket.h>
- #include <sys/types.h>
int main() { (void) getsockopt(1, 1, 1, NULL, (size_t*) NULL); return 0; }
" XML_SOCKLEN_T_SIZE_T)
if(XML_SOCKLEN_T_SIZE_T)
@@ -254,13 +200,11 @@ else()
check_c_source_compiles("
#include <stddef.h>
#include <sys/socket.h>
- #include <sys/types.h>
int main() { (void) getsockopt (1, 1, 1, NULL, (int*) NULL); return 0; }
" XML_SOCKLEN_T_INT)
set(XML_SOCKLEN_T int)
endif()
endif()
- configure_file(config.h.cmake.in config.h)
endif()
set(
@@ -270,7 +214,6 @@ set(
include/libxml/chvalid.h
include/libxml/debugXML.h
include/libxml/dict.h
- include/libxml/DOCBparser.h
include/libxml/encoding.h
include/libxml/entities.h
include/libxml/globals.h
@@ -373,10 +316,6 @@ if(WIN32)
)
endif()
-if(LIBXML2_WITH_SAX1)
- list(APPEND LIBXML2_SRCS DOCBparser.c)
-endif()
-
if(LIBXML2_WITH_TRIO)
list(APPEND LIBXML2_SRCS trio.c triostr.c)
endif()
@@ -384,15 +323,28 @@ endif()
add_library(LibXml2 ${LIBXML2_HDRS} ${LIBXML2_SRCS})
add_library(LibXml2::LibXml2 ALIAS LibXml2)
+target_compile_definitions(LibXml2 PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
+
if(NOT BUILD_SHARED_LIBS)
- target_compile_definitions(LibXml2 INTERFACE LIBXML_STATIC)
+ target_compile_definitions(LibXml2 PUBLIC LIBXML_STATIC)
set(XML_CFLAGS "-DLIBXML_STATIC")
endif()
+if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wshadow \
+-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return \
+-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
+-Wredundant-decls -Wno-long-long -Wno-format-extra-args")
+
+ if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
+ target_link_options(LibXml2 PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms")
+ endif()
+endif()
+
if(LIBXML2_WITH_THREADS)
target_compile_definitions(LibXml2 PRIVATE _REENTRANT)
- if(WIN32)
- target_compile_definitions(LibXml2 PRIVATE HAVE_WIN32_THREADS)
+ if(NOT WIN32)
+ check_include_files(pthread.h HAVE_PTHREAD_H)
endif()
endif()
@@ -416,12 +368,12 @@ endif()
if(UNIX)
target_link_libraries(LibXml2 PRIVATE m)
- set(M_LIBS "-lm")
+ set(LIBM "-lm")
endif()
if(WIN32)
target_link_libraries(LibXml2 PRIVATE ws2_32)
- set(WIN32_EXTRA_LIBADD "-lws2_32")
+ set(WINSOCK_LIBS "-lws2_32")
endif()
if(LIBXML2_WITH_ICONV)
@@ -463,6 +415,7 @@ set_target_properties(
POSITION_INDEPENDENT_CODE ON
PREFIX lib
VERSION ${PROJECT_VERSION}
+ SOVERSION ${LIBXML_MAJOR_VERSION}
)
if(MSVC)
@@ -507,6 +460,7 @@ if(LIBXML2_WITH_PROGRAMS)
foreach(PROGRAM ${PROGRAMS})
add_executable(${PROGRAM} ${PROGRAM}.c)
add_executable(LibXml2::${PROGRAM} ALIAS ${PROGRAM})
+ target_compile_definitions(${PROGRAM} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
target_link_libraries(${PROGRAM} LibXml2)
if(HAVE_LIBHISTORY)
target_link_libraries(${PROGRAM} history)
@@ -522,29 +476,28 @@ if(LIBXML2_WITH_TESTS)
enable_testing()
set(
TESTS
+ runtest
runxmlconf
runsuite
testapi
- testAutomata
- testC14N
testchar
testdict
- testHTML
testModule
testlimits
- testReader
testrecurse
- testRegexp
- testRelax
- testSAX
- testSchemas
- testURI
- testXPath
+ testThreads
)
foreach(TEST ${TESTS})
add_executable(${TEST} ${TEST}.c)
+ target_compile_definitions(${TEST} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
target_link_libraries(${TEST} LibXml2)
endforeach()
+ if(Threads_FOUND)
+ foreach(TEST runtest testThreads)
+ target_link_libraries(${TEST} Threads::Threads)
+ endforeach()
+ endif()
+ add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
if(EXISTS ${LIBXML2_XMLCONF_WORKING_DIR}/xmlconf/xmlconf.xml)
add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${LIBXML2_XMLCONF_WORKING_DIR})
endif()
@@ -554,22 +507,7 @@ if(LIBXML2_WITH_TESTS)
add_test(NAME testchar COMMAND testchar)
add_test(NAME testdict COMMAND testdict)
add_test(NAME testrecurse COMMAND testrecurse WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
- if(Threads_FOUND)
- set(
- TESTS_THREADS
- runtest
- testThreads
- )
- foreach(TEST ${TESTS_THREADS})
- add_executable(${TEST} ${TEST}.c)
- if(WIN32)
- target_compile_definitions(${TEST} PRIVATE HAVE_WIN32_THREADS)
- endif()
- target_link_libraries(${TEST} LibXml2 Threads::Threads)
- endforeach()
- add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
- add_test(NAME testThreads COMMAND testThreads WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
- endif()
+ add_test(NAME testThreads COMMAND testThreads WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(LIBXML2_WITH_PYTHON)
@@ -609,6 +547,9 @@ if(LIBXML2_WITH_PYTHON)
PREFIX lib
VERSION ${PROJECT_VERSION}
)
+ if (WIN32)
+ set_target_properties(LibXml2Mod PROPERTIES SUFFIX ".pyd")
+ endif()
install(
TARGETS LibXml2Mod
ARCHIVE DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT development
@@ -622,10 +563,16 @@ if(LIBXML2_WITH_PYTHON)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime)
endif()
-install(FILES libxml.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 COMPONENT documentation)
+install(FILES doc/xml2-config.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation)
install(FILES doc/xmlcatalog.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation)
install(FILES doc/xmllint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation)
-install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/libxml2 COMPONENT documentation PATTERN Makefile.* EXCLUDE)
+install(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT documentation
+ PATTERN "Makefile.*" EXCLUDE
+ PATTERN "*.1" EXCLUDE
+ PATTERN "*.py" EXCLUDE
+ PATTERN "*.res" EXCLUDE
+ PATTERN "*.xml" EXCLUDE
+ PATTERN "*.xsl" EXCLUDE)
configure_package_config_file(
libxml2-config.cmake.cmake.in libxml2-config.cmake
@@ -658,6 +605,11 @@ install(
COMPONENT development
)
+if(MSVC)
+ configure_file(include/win32config.h config.h COPYONLY)
+else()
+ configure_file(config.h.cmake.in config.h)
+endif()
configure_file(include/libxml/xmlversion.h.in libxml/xmlversion.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml/xmlversion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development)
@@ -669,26 +621,34 @@ endif()
set(XML_INCLUDEDIR "-I\${includedir}/libxml2")
set(XML_LIBDIR "-L\${libdir}")
set(XML_LIBS "-lxml2")
-set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${M_LIBS}")
+set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${LIBM} ${WINSOCK_LIBS}")
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}")
string(REGEX REPLACE "/$" "" PACKAGE_RELATIVE_PATH "${PACKAGE_RELATIVE_PATH}")
-set(prefix "\${pcfiledir}/${PACKAGE_RELATIVE_PATH}")
+if(WIN32)
+ set(prefix "\${pcfiledir}/${PACKAGE_RELATIVE_PATH}")
+else()
+ set(prefix "${CMAKE_INSTALL_PREFIX}")
+endif()
set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
configure_file(libxml-2.0.pc.in libxml-2.0.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml-2.0.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT development)
-set(prefix "\$(cd \"\$(dirname \"\$0\")\"; pwd -P)/..")
+if(WIN32)
+ set(prefix "\$(cd \"\$(dirname \"\$0\")\"; pwd -P)/..")
+endif()
configure_file(xml2-config.in xml2-config @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/xml2-config DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT development)
+if(UNIX)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libxml.m4 DESTINATION ${CMAKE_INSTALL_DATADIR}/aclocal)
+endif()
+
set(XML_INCLUDEDIR "-I${CMAKE_INSTALL_FULL_INCLUDEDIR}/libxml2")
set(XML_LIBDIR "-L${CMAKE_INSTALL_FULL_LIBDIR}")
-configure_file(xml2Conf.sh.in xml2Conf.sh @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xml2Conf.sh DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development)
set(CPACK_COMPONENT_DEVELOPMENT_DEPENDS runtime)
set(CPACK_COMPONENT_PROGRAMS_DEPENDS runtime)
diff --git a/chromium/third_party/libxml/src/HTMLparser.c b/chromium/third_party/libxml/src/HTMLparser.c
index 4b9b4e4fab0..93b6661ba93 100644
--- a/chromium/third_party/libxml/src/HTMLparser.c
+++ b/chromium/third_party/libxml/src/HTMLparser.c
@@ -14,19 +14,6 @@
#include <ctype.h>
#include <stdlib.h>
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef LIBXML_ZLIB_ENABLED
-#include <zlib.h>
-#endif
-
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -41,8 +28,12 @@
#include <libxml/globals.h>
#include <libxml/uri.h>
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/html.h"
+#include "private/parser.h"
+#include "private/tree.h"
#define HTML_MAX_NAMELEN 1000
#define HTML_PARSER_BIG_BUFFER_SIZE 1000
@@ -283,8 +274,6 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
*
* Clean macros, not dependent of an ASCII context, expect UTF-8 encoding
*
- * CURRENT Returns the current char value, with the full decoding of
- * UTF-8 if we are using this mode. It returns an int.
* NEXT Skip to the next character, this does the proper decoding
* in UTF-8 mode. It also pop-up unfinished entities on the fly.
* NEXTL(l) Skip the current unicode character of l xmlChars long.
@@ -310,14 +299,11 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
(ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \
xmlParserInputGrow(ctxt->input, INPUT_CHUNK)
-#define CURRENT ((int) (*ctxt->input->cur))
-
#define SKIP_BLANKS htmlSkipBlankChars(ctxt)
/* Imported from XML */
-/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */
-#define CUR ((int) (*ctxt->input->cur))
+#define CUR (*ctxt->input->cur)
#define NEXT xmlNextChar(ctxt)
#define RAW (ctxt->token ? -1 : (*ctxt->input->cur))
@@ -340,7 +326,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
#define COPY_BUF(l,b,i,v) \
- if (l == 1) b[i++] = (xmlChar) v; \
+ if (l == 1) b[i++] = v; \
else i += xmlCopyChar(l,&b[i],v)
/**
@@ -431,7 +417,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
* a compatible encoding for the ASCII set, since
* HTML constructs only use < 128 chars
*/
- if ((int) *ctxt->input->cur < 0x80) {
+ if (*ctxt->input->cur < 0x80) {
*len = 1;
if ((*ctxt->input->cur == 0) &&
(ctxt->input->cur < ctxt->input->end)) {
@@ -439,7 +425,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
"Char 0x%X out of allowed range\n", 0);
return(' ');
}
- return((int) *ctxt->input->cur);
+ return(*ctxt->input->cur);
}
/*
@@ -546,7 +532,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
}
/* 1-byte code */
*len = 1;
- return((int) *ctxt->input->cur);
+ return(*ctxt->input->cur);
}
encoding_error:
@@ -583,7 +569,7 @@ encoding_error:
(ctxt->input->buf->encoder == NULL))
xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1);
*len = 1;
- return((int) *ctxt->input->cur);
+ return(*ctxt->input->cur);
}
/**
@@ -611,7 +597,8 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
if (*ctxt->input->cur == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
}
- res++;
+ if (res < INT_MAX)
+ res++;
}
return(res);
}
@@ -1407,6 +1394,9 @@ static const elementPriority htmlEndPriority[] = {
/**
* htmlInitAutoClose:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* This is a no-op now.
*/
void
@@ -2084,8 +2074,8 @@ static const htmlEntityDesc html40EntitiesTable[] = {
#define growBuffer(buffer) { \
xmlChar *tmp; \
buffer##_size *= 2; \
- tmp = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
- if (tmp == NULL) { \
+ tmp = (xmlChar *) xmlRealloc(buffer, buffer##_size); \
+ if (tmp == NULL) { \
htmlErrMemory(ctxt, "growing buffer\n"); \
xmlFree(buffer); \
return(NULL); \
@@ -2554,6 +2544,21 @@ htmlNewDoc(const xmlChar *URI, const xmlChar *ExternalID) {
static const xmlChar * htmlParseNameComplex(xmlParserCtxtPtr ctxt);
+static void
+htmlSkipBogusComment(htmlParserCtxtPtr ctxt) {
+ int c;
+
+ htmlParseErr(ctxt, XML_HTML_INCORRECTLY_OPENED_COMMENT,
+ "Incorrectly opened comment\n", NULL, NULL);
+
+ do {
+ c = CUR;
+ if (c == 0)
+ break;
+ NEXT;
+ } while (c != '>');
+}
+
/**
* htmlParseHTMLName:
* @ctxt: an HTML parser context
@@ -2739,7 +2744,7 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
* allocate a translation buffer.
*/
buffer_size = HTML_PARSER_BUFFER_SIZE;
- buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMallocAtomic(buffer_size);
if (buffer == NULL) {
htmlErrMemory(ctxt, "buffer allocation failed\n");
return(NULL);
@@ -2859,6 +2864,8 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
* @ctxt: an HTML parser context
* @str: location to store the entity name
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an HTML ENTITY references
*
* [68] EntityRef ::= '&' Name ';'
@@ -3373,7 +3380,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) {
ctxt->instate = state;
return;
}
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
htmlErrMemory(ctxt, NULL);
ctxt->instate = state;
@@ -3391,7 +3398,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) {
xmlChar *tmp;
size *= 2;
- tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buf, size);
if (tmp == NULL) {
htmlErrMemory(ctxt, NULL);
xmlFree(buf);
@@ -3473,7 +3480,7 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
ctxt->instate = XML_PARSER_COMMENT;
SHRINK;
SKIP(4);
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
htmlErrMemory(ctxt, "buffer allocation failed\n");
ctxt->instate = state;
@@ -3522,7 +3529,7 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
xmlChar *tmp;
size *= 2;
- tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buf, size);
if (tmp == NULL) {
xmlFree(buf);
htmlErrMemory(ctxt, "growing buffer failed\n");
@@ -3567,6 +3574,8 @@ unfinished:
* htmlParseCharRef:
* @ctxt: an HTML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse Reference declarations
*
* [66] CharRef ::= '&#' [0-9]+ ';' |
@@ -4387,72 +4396,74 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
* Handle SCRIPT/STYLE separately
*/
htmlParseScript(ctxt);
- } else {
- /*
- * Sometimes DOCTYPE arrives in the middle of the document
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR,
- "Misplaced DOCTYPE declaration\n",
- BAD_CAST "DOCTYPE" , NULL);
- htmlParseDocTypeDecl(ctxt);
- }
+ }
- /*
- * First case : a comment
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) {
- htmlParseComment(ctxt);
- }
+ else if ((CUR == '<') && (NXT(1) == '!')) {
+ /*
+ * Sometimes DOCTYPE arrives in the middle of the document
+ */
+ if ((UPP(2) == 'D') && (UPP(3) == 'O') &&
+ (UPP(4) == 'C') && (UPP(5) == 'T') &&
+ (UPP(6) == 'Y') && (UPP(7) == 'P') &&
+ (UPP(8) == 'E')) {
+ htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR,
+ "Misplaced DOCTYPE declaration\n",
+ BAD_CAST "DOCTYPE" , NULL);
+ htmlParseDocTypeDecl(ctxt);
+ }
+ /*
+ * First case : a comment
+ */
+ else if ((NXT(2) == '-') && (NXT(3) == '-')) {
+ htmlParseComment(ctxt);
+ }
+ else {
+ htmlSkipBogusComment(ctxt);
+ }
+ }
- /*
- * Second case : a Processing Instruction.
- */
- else if ((CUR == '<') && (NXT(1) == '?')) {
- htmlParsePI(ctxt);
- }
+ /*
+ * Second case : a Processing Instruction.
+ */
+ else if ((CUR == '<') && (NXT(1) == '?')) {
+ htmlParsePI(ctxt);
+ }
- /*
- * Third case : a sub-element.
- */
- else if ((CUR == '<') && IS_ASCII_LETTER(NXT(1))) {
- htmlParseElement(ctxt);
- }
- else if (CUR == '<') {
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, BAD_CAST "<", 1);
- NEXT;
- }
+ /*
+ * Third case : a sub-element.
+ */
+ else if ((CUR == '<') && IS_ASCII_LETTER(NXT(1))) {
+ htmlParseElement(ctxt);
+ }
+ else if (CUR == '<') {
+ if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
+ (ctxt->sax->characters != NULL))
+ ctxt->sax->characters(ctxt->userData, BAD_CAST "<", 1);
+ NEXT;
+ }
- /*
- * Fourth case : a reference. If if has not been resolved,
- * parsing returns it's Name, create the node
- */
- else if (CUR == '&') {
- htmlParseReference(ctxt);
- }
+ /*
+ * Fourth case : a reference. If if has not been resolved,
+ * parsing returns it's Name, create the node
+ */
+ else if (CUR == '&') {
+ htmlParseReference(ctxt);
+ }
- /*
- * Fifth case : end of the resource
- */
- else if (CUR == 0) {
- htmlAutoCloseOnEnd(ctxt);
- break;
- }
+ /*
+ * Fifth case : end of the resource
+ */
+ else if (CUR == 0) {
+ htmlAutoCloseOnEnd(ctxt);
+ break;
+ }
- /*
- * Last case, text. Note that References are handled directly.
- */
- else {
- htmlParseCharData(ctxt);
- }
- }
+ /*
+ * Last case, text. Note that References are handled directly.
+ */
+ else {
+ htmlParseCharData(ctxt);
+ }
GROW;
}
if (currentNode != NULL) xmlFree(currentNode);
@@ -4462,6 +4473,8 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
* htmlParseElement:
* @ctxt: an HTML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an HTML element, this is highly recursive
* this is kept for compatibility with previous code versions
*
@@ -4792,76 +4805,78 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
* Handle SCRIPT/STYLE separately
*/
htmlParseScript(ctxt);
- } else {
- /*
- * Sometimes DOCTYPE arrives in the middle of the document
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR,
- "Misplaced DOCTYPE declaration\n",
- BAD_CAST "DOCTYPE" , NULL);
- htmlParseDocTypeDecl(ctxt);
- }
+ }
- /*
- * First case : a comment
- */
- if ((CUR == '<') && (NXT(1) == '!') &&
- (NXT(2) == '-') && (NXT(3) == '-')) {
- htmlParseComment(ctxt);
- }
+ else if ((CUR == '<') && (NXT(1) == '!')) {
+ /*
+ * Sometimes DOCTYPE arrives in the middle of the document
+ */
+ if ((UPP(2) == 'D') && (UPP(3) == 'O') &&
+ (UPP(4) == 'C') && (UPP(5) == 'T') &&
+ (UPP(6) == 'Y') && (UPP(7) == 'P') &&
+ (UPP(8) == 'E')) {
+ htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR,
+ "Misplaced DOCTYPE declaration\n",
+ BAD_CAST "DOCTYPE" , NULL);
+ htmlParseDocTypeDecl(ctxt);
+ }
+ /*
+ * First case : a comment
+ */
+ else if ((NXT(2) == '-') && (NXT(3) == '-')) {
+ htmlParseComment(ctxt);
+ }
+ else {
+ htmlSkipBogusComment(ctxt);
+ }
+ }
- /*
- * Second case : a Processing Instruction.
- */
- else if ((CUR == '<') && (NXT(1) == '?')) {
- htmlParsePI(ctxt);
- }
+ /*
+ * Second case : a Processing Instruction.
+ */
+ else if ((CUR == '<') && (NXT(1) == '?')) {
+ htmlParsePI(ctxt);
+ }
- /*
- * Third case : a sub-element.
- */
- else if ((CUR == '<') && IS_ASCII_LETTER(NXT(1))) {
- htmlParseElementInternal(ctxt);
- if (currentNode != NULL) xmlFree(currentNode);
+ /*
+ * Third case : a sub-element.
+ */
+ else if ((CUR == '<') && IS_ASCII_LETTER(NXT(1))) {
+ htmlParseElementInternal(ctxt);
+ if (currentNode != NULL) xmlFree(currentNode);
- currentNode = xmlStrdup(ctxt->name);
- depth = ctxt->nameNr;
- }
- else if (CUR == '<') {
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, BAD_CAST "<", 1);
- NEXT;
- }
+ currentNode = xmlStrdup(ctxt->name);
+ depth = ctxt->nameNr;
+ }
+ else if (CUR == '<') {
+ if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
+ (ctxt->sax->characters != NULL))
+ ctxt->sax->characters(ctxt->userData, BAD_CAST "<", 1);
+ NEXT;
+ }
- /*
- * Fourth case : a reference. If if has not been resolved,
- * parsing returns it's Name, create the node
- */
- else if (CUR == '&') {
- htmlParseReference(ctxt);
- }
+ /*
+ * Fourth case : a reference. If if has not been resolved,
+ * parsing returns it's Name, create the node
+ */
+ else if (CUR == '&') {
+ htmlParseReference(ctxt);
+ }
- /*
- * Fifth case : end of the resource
- */
- else if (CUR == 0) {
- htmlAutoCloseOnEnd(ctxt);
- break;
- }
+ /*
+ * Fifth case : end of the resource
+ */
+ else if (CUR == 0) {
+ htmlAutoCloseOnEnd(ctxt);
+ break;
+ }
- /*
- * Last case, text. Note that References are handled directly.
- */
- else {
- htmlParseCharData(ctxt);
- }
- }
+ /*
+ * Last case, text. Note that References are handled directly.
+ */
+ else {
+ htmlParseCharData(ctxt);
+ }
GROW;
}
if (currentNode != NULL) xmlFree(currentNode);
@@ -4900,15 +4915,11 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
xmlInitParser();
- htmlDefaultSAXHandlerInit();
-
if ((ctxt == NULL) || (ctxt->input == NULL)) {
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
"htmlParseDocument: context error\n", NULL, NULL);
return(XML_ERR_INTERNAL_ERROR);
}
- ctxt->html = 1;
- ctxt->linenumbers = 1;
GROW;
/*
* SAX: beginning of the document processing.
@@ -5022,6 +5033,8 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
/**
* htmlInitParserCtxt:
* @ctxt: an HTML parser context
+ * @sax: SAX handler
+ * @userData: user data
*
* Initialize a parser context
*
@@ -5029,10 +5042,9 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
*/
static int
-htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
+htmlInitParserCtxt(htmlParserCtxtPtr ctxt, const htmlSAXHandler *sax,
+ void *userData)
{
- htmlSAXHandler *sax;
-
if (ctxt == NULL) return(-1);
memset(ctxt, 0, sizeof(htmlParserCtxt));
@@ -5041,13 +5053,21 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n");
return(-1);
}
- sax = (htmlSAXHandler *) xmlMalloc(sizeof(htmlSAXHandler));
- if (sax == NULL) {
+
+ if (ctxt->sax == NULL)
+ ctxt->sax = (htmlSAXHandler *) xmlMalloc(sizeof(htmlSAXHandler));
+ if (ctxt->sax == NULL) {
htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n");
return(-1);
}
- else
- memset(sax, 0, sizeof(htmlSAXHandler));
+ if (sax == NULL) {
+ memset(ctxt->sax, 0, sizeof(htmlSAXHandler));
+ xmlSAX2InitHtmlDefaultSAXHandler(ctxt->sax);
+ ctxt->userData = ctxt;
+ } else {
+ memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler));
+ ctxt->userData = userData ? userData : ctxt;
+ }
/* Allocate the Input stack */
ctxt->inputTab = (htmlParserInputPtr *)
@@ -5106,12 +5126,6 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
ctxt->nodeInfoNr = 0;
ctxt->nodeInfoMax = 0;
- if (sax == NULL) ctxt->sax = (xmlSAXHandlerPtr) &htmlDefaultSAXHandler;
- else {
- ctxt->sax = sax;
- memcpy(sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1));
- }
- ctxt->userData = ctxt;
ctxt->myDoc = NULL;
ctxt->wellFormed = 1;
ctxt->replaceEntities = 0;
@@ -5155,6 +5169,23 @@ htmlFreeParserCtxt(htmlParserCtxtPtr ctxt)
htmlParserCtxtPtr
htmlNewParserCtxt(void)
{
+ return(htmlNewSAXParserCtxt(NULL, NULL));
+}
+
+/**
+ * htmlNewSAXParserCtxt:
+ * @sax: SAX handler
+ * @userData: user data
+ *
+ * Allocate and initialize a new SAX parser context. If userData is NULL,
+ * the parser context will be passed as user data.
+ *
+ * Returns the htmlParserCtxtPtr or NULL in case of allocation error
+ */
+
+htmlParserCtxtPtr
+htmlNewSAXParserCtxt(const htmlSAXHandler *sax, void *userData)
+{
xmlParserCtxtPtr ctxt;
ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
@@ -5163,7 +5194,7 @@ htmlNewParserCtxt(void)
return(NULL);
}
memset(ctxt, 0, sizeof(xmlParserCtxt));
- if (htmlInitParserCtxt(ctxt) < 0) {
+ if (htmlInitParserCtxt(ctxt, sax, userData) < 0) {
htmlFreeParserCtxt(ctxt);
return(NULL);
}
@@ -5893,7 +5924,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
* Handle preparsed entities and charRef
*/
if (ctxt->token != 0) {
- chr[0] = (xmlChar) ctxt->token;
+ chr[0] = ctxt->token;
htmlCheckParagraph(ctxt);
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
ctxt->sax->characters(ctxt->userData, chr, 1);
@@ -5958,93 +5989,97 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
#endif
break;
}
- } else {
- /*
- * Sometimes DOCTYPE arrives in the middle of the document
- */
- if ((cur == '<') && (next == '!') &&
- (UPP(2) == 'D') && (UPP(3) == 'O') &&
- (UPP(4) == 'C') && (UPP(5) == 'T') &&
- (UPP(6) == 'Y') && (UPP(7) == 'P') &&
- (UPP(8) == 'E')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0))
- goto done;
- htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR,
- "Misplaced DOCTYPE declaration\n",
- BAD_CAST "DOCTYPE" , NULL);
- htmlParseDocTypeDecl(ctxt);
- } else if ((cur == '<') && (next == '!') &&
- (in->cur[2] == '-') && (in->cur[3] == '-')) {
- if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0))
- goto done;
+ } else if ((cur == '<') && (next == '!')) {
+ /*
+ * Sometimes DOCTYPE arrives in the middle of the document
+ */
+ if ((UPP(2) == 'D') && (UPP(3) == 'O') &&
+ (UPP(4) == 'C') && (UPP(5) == 'T') &&
+ (UPP(6) == 'Y') && (UPP(7) == 'P') &&
+ (UPP(8) == 'E')) {
+ if ((!terminate) &&
+ (htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0))
+ goto done;
+ htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR,
+ "Misplaced DOCTYPE declaration\n",
+ BAD_CAST "DOCTYPE" , NULL);
+ htmlParseDocTypeDecl(ctxt);
+ } else if ((in->cur[2] == '-') && (in->cur[3] == '-')) {
+ if ((!terminate) &&
+ (htmlParseLookupCommentEnd(ctxt) < 0))
+ goto done;
#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing Comment\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "HPP: Parsing Comment\n");
#endif
- htmlParseComment(ctxt);
- ctxt->instate = XML_PARSER_CONTENT;
- } else if ((cur == '<') && (next == '?')) {
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
- goto done;
+ htmlParseComment(ctxt);
+ ctxt->instate = XML_PARSER_CONTENT;
+ } else {
+ if ((!terminate) &&
+ (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
+ goto done;
+ htmlSkipBogusComment(ctxt);
+ }
+ } else if ((cur == '<') && (next == '?')) {
+ if ((!terminate) &&
+ (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
+ goto done;
#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing PI\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "HPP: Parsing PI\n");
#endif
- htmlParsePI(ctxt);
- ctxt->instate = XML_PARSER_CONTENT;
- } else if ((cur == '<') && (next == '!') && (avail < 4)) {
- goto done;
- } else if ((cur == '<') && (next == '/')) {
- ctxt->instate = XML_PARSER_END_TAG;
- ctxt->checkIndex = 0;
+ htmlParsePI(ctxt);
+ ctxt->instate = XML_PARSER_CONTENT;
+ } else if ((cur == '<') && (next == '!') && (avail < 4)) {
+ goto done;
+ } else if ((cur == '<') && (next == '/')) {
+ ctxt->instate = XML_PARSER_END_TAG;
+ ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering END_TAG\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "HPP: entering END_TAG\n");
#endif
- break;
- } else if ((cur == '<') && IS_ASCII_LETTER(next)) {
- if ((!terminate) && (next == 0))
- goto done;
- ctxt->instate = XML_PARSER_START_TAG;
- ctxt->checkIndex = 0;
+ break;
+ } else if ((cur == '<') && IS_ASCII_LETTER(next)) {
+ if ((!terminate) && (next == 0))
+ goto done;
+ ctxt->instate = XML_PARSER_START_TAG;
+ ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: entering START_TAG\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "HPP: entering START_TAG\n");
#endif
- break;
- } else if (cur == '<') {
- if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
- (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData,
- BAD_CAST "<", 1);
- NEXT;
- } else {
- /*
- * check that the text sequence is complete
- * before handing out the data to the parser
- * to avoid problems with erroneous end of
- * data detection.
- */
- if ((!terminate) &&
- (htmlParseLookupSequence(ctxt, '<', 0, 0, 0) < 0))
- goto done;
- ctxt->checkIndex = 0;
+ break;
+ } else if (cur == '<') {
+ if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
+ (ctxt->sax->characters != NULL))
+ ctxt->sax->characters(ctxt->userData,
+ BAD_CAST "<", 1);
+ NEXT;
+ } else {
+ /*
+ * check that the text sequence is complete
+ * before handing out the data to the parser
+ * to avoid problems with erroneous end of
+ * data detection.
+ */
+ if ((!terminate) &&
+ (htmlParseLookupSequence(ctxt, '<', 0, 0, 0) < 0))
+ goto done;
+ ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
- xmlGenericError(xmlGenericErrorContext,
- "HPP: Parsing char data\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "HPP: Parsing char data\n");
#endif
- while ((ctxt->instate != XML_PARSER_EOF) &&
- (cur != '<') && (in->cur < in->end)) {
- if (cur == '&') {
- htmlParseReference(ctxt);
- } else {
- htmlParseCharData(ctxt);
- }
- cur = in->cur[0];
+ while ((ctxt->instate != XML_PARSER_EOF) &&
+ (cur != '<') && (in->cur < in->end)) {
+ if (cur == '&') {
+ htmlParseReference(ctxt);
+ } else {
+ htmlParseCharData(ctxt);
}
- }
+ cur = in->cur[0];
+ }
}
break;
@@ -6319,26 +6354,13 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
buf = xmlAllocParserInputBuffer(enc);
if (buf == NULL) return(NULL);
- ctxt = htmlNewParserCtxt();
+ ctxt = htmlNewSAXParserCtxt(sax, user_data);
if (ctxt == NULL) {
xmlFreeParserInputBuffer(buf);
return(NULL);
}
if(enc==XML_CHAR_ENCODING_UTF8 || buf->encoder)
ctxt->charset=XML_CHAR_ENCODING_UTF8;
- if (sax != NULL) {
- if (ctxt->sax != (xmlSAXHandlerPtr) &htmlDefaultSAXHandler)
- xmlFree(ctxt->sax);
- ctxt->sax = (htmlSAXHandlerPtr) xmlMalloc(sizeof(htmlSAXHandler));
- if (ctxt->sax == NULL) {
- xmlFree(buf);
- xmlFree(ctxt);
- return(NULL);
- }
- memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler));
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
if (filename == NULL) {
ctxt->directory = NULL;
} else {
@@ -6387,6 +6409,8 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
* @sax: the SAX handler block
* @userData: if using SAX, this pointer will be provided on callbacks.
*
+ * DEPRECATED: Use htmlNewSAXParserCtxt and htmlCtxtReadDoc.
+ *
* Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks
* to handle parse events. If sax is NULL, fallback to the default DOM
* behavior and return a tree.
@@ -6470,11 +6494,6 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
}
canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename);
if (canonicFilename == NULL) {
-#ifdef LIBXML_SAX1_ENABLED
- if (xmlDefaultSAXHandler.error != NULL) {
- xmlDefaultSAXHandler.error(NULL, "out of memory\n");
- }
-#endif
xmlFreeParserCtxt(ctxt);
return(NULL);
}
@@ -6513,6 +6532,8 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
* @sax: the SAX handler block
* @userData: if using SAX, this pointer will be provided on callbacks.
*
+ * DEPRECATED: Use htmlNewSAXParserCtxt and htmlCtxtReadFile.
+ *
* parse an HTML file and build a tree. Automatic support for ZLIB/Compress
* compressed document is provided by default if found at compile-time.
* It use the given SAX function block to handle the parsing callback.
@@ -6752,6 +6773,8 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
ctxt->nameNr = 0;
ctxt->name = NULL;
+ ctxt->nsNr = 0;
+
DICT_FREE(ctxt->version);
ctxt->version = NULL;
DICT_FREE(ctxt->encoding);
@@ -6868,6 +6891,7 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options)
options -= HTML_PARSE_NOIMPLIED;
}
ctxt->dictNames = 0;
+ ctxt->linenumbers = 1;
return (options);
}
@@ -6984,12 +7008,9 @@ htmlReadMemory(const char *buffer, int size, const char *URL, const char *encodi
htmlParserCtxtPtr ctxt;
xmlInitParser();
- ctxt = xmlCreateMemoryParserCtxt(buffer, size);
+ ctxt = htmlCreateMemoryParserCtxt(buffer, size);
if (ctxt == NULL)
return (NULL);
- htmlDefaultSAXHandlerInit();
- if (ctxt->sax != NULL)
- memcpy(ctxt->sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1));
return (htmlDoRead(ctxt, URL, encoding, options, 0));
}
@@ -7100,22 +7121,10 @@ htmlDocPtr
htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur,
const char *URL, const char *encoding, int options)
{
- xmlParserInputPtr stream;
-
if (cur == NULL)
return (NULL);
- if (ctxt == NULL)
- return (NULL);
- xmlInitParser();
-
- htmlCtxtReset(ctxt);
-
- stream = xmlNewStringInputStream(ctxt, cur);
- if (stream == NULL) {
- return (NULL);
- }
- inputPush(ctxt, stream);
- return (htmlDoRead(ctxt, URL, encoding, options, 1));
+ return (htmlCtxtReadMemory(ctxt, (const char *) cur, xmlStrlen(cur), URL,
+ encoding, options));
}
/**
diff --git a/chromium/third_party/libxml/src/HTMLtree.c b/chromium/third_party/libxml/src/HTMLtree.c
index c6ca8358a26..b442dd01958 100644
--- a/chromium/third_party/libxml/src/HTMLtree.c
+++ b/chromium/third_party/libxml/src/HTMLtree.c
@@ -25,7 +25,10 @@
#include <libxml/globals.h>
#include <libxml/uri.h>
-#include "buf.h"
+#include "private/buf.h"
+#include "private/error.h"
+#include "private/io.h"
+#include "private/save.h"
/************************************************************************
* *
@@ -299,7 +302,7 @@ create:
* output as <option selected>, as per XSLT 1.0 16.2 "HTML Output Method"
*
*/
-static const char* htmlBooleanAttrs[] = {
+static const char* const htmlBooleanAttrs[] = {
"checked", "compact", "declare", "defer", "disabled", "ismap",
"multiple", "nohref", "noresize", "noshade", "nowrap", "readonly",
"selected", NULL
@@ -328,11 +331,6 @@ htmlIsBooleanAttr(const xmlChar *name)
}
#ifdef LIBXML_OUTPUT_ENABLED
-/*
- * private routine exported from xmlIO.c
- */
-xmlOutputBufferPtr
-xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
/************************************************************************
* *
* Output error handlers *
@@ -417,7 +415,7 @@ htmlBufNodeDumpFormat(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur,
htmlSaveErrMemory("allocating HTML output buffer");
return (-1);
}
- memset(outbuf, 0, (size_t) sizeof(xmlOutputBuffer));
+ memset(outbuf, 0, sizeof(xmlOutputBuffer));
outbuf->buffer = buf;
outbuf->encoder = NULL;
outbuf->writecallback = NULL;
@@ -622,8 +620,6 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
* *
************************************************************************/
-void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
-
/**
* htmlDtdDumpOutput:
* @buf: the HTML buffer output
@@ -987,7 +983,14 @@ void
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
const char *encoding ATTRIBUTE_UNUSED,
int format) {
+ int type = 0;
+ if (cur) {
+ type = cur->type;
+ cur->type = XML_HTML_DOCUMENT_NODE;
+ }
htmlNodeDumpFormatOutput(buf, cur, (xmlNodePtr) cur, NULL, format);
+ if (cur)
+ cur->type = (xmlElementType) type;
}
/**
diff --git a/chromium/third_party/libxml/src/Makefile.am b/chromium/third_party/libxml/src/Makefile.am
index fdbbc4036de..d567c07cc6b 100644
--- a/chromium/third_party/libxml/src/Makefile.am
+++ b/chromium/third_party/libxml/src/Makefile.am
@@ -2,647 +2,234 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = include . doc example fuzz xstc $(PYTHON_SUBDIR)
+SUBDIRS = include . doc example xstc
+if WITH_PYTHON
+SUBDIRS += python
+endif
+if WITH_GLOB
+SUBDIRS += fuzz
+endif
DIST_SUBDIRS = include . doc example fuzz python xstc
-AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include
-
-AM_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)
+AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include -DSYSCONFDIR='"$(sysconfdir)"'
-check_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
- testThreads testC14N testAutomata testRegexp \
- testReader testapi testModule runtest runsuite testchar \
- testdict runxmlconf testrecurse testlimits
+check_PROGRAMS = \
+ runsuite \
+ runtest \
+ runxmlconf \
+ testModule \
+ testThreads \
+ testapi \
+ testchar \
+ testdict \
+ testlimits \
+ testrecurse
bin_PROGRAMS = xmllint xmlcatalog
-bin_SCRIPTS=xml2-config
+bin_SCRIPTS = xml2-config
lib_LTLIBRARIES = libxml2.la
-libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
-
-if USE_VERSION_SCRIPT
-LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
-else
-LIBXML2_VERSION_SCRIPT =
-endif
+libxml2_la_CFLAGS = $(AM_CFLAGS) $(XML_PRIVATE_CFLAGS)
+libxml2_la_LIBADD = $(XML_PRIVATE_LIBS)
-libxml2_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) \
- $(LIBXML2_VERSION_SCRIPT) \
+libxml2_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \
-version-info $(LIBXML_VERSION_INFO) \
$(MODULE_PLATFORM_LIBS)
+if USE_VERSION_SCRIPT
+libxml2_la_LDFLAGS += $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
+endif
+libxml2_la_SOURCES = buf.c chvalid.c dict.c entities.c encoding.c error.c \
+ globals.c hash.c list.c parser.c parserInternals.c \
+ SAX2.c threads.c tree.c uri.c valid.c xmlIO.c \
+ xmlmemory.c xmlstring.c
+if WITH_C14N_SOURCES
+libxml2_la_SOURCES += c14n.c
+endif
+if WITH_CATALOG_SOURCES
+libxml2_la_SOURCES += catalog.c
+endif
+if WITH_DEBUG_SOURCES
+libxml2_la_SOURCES += debugXML.c
+endif
+if WITH_FTP_SOURCES
+libxml2_la_SOURCES += nanoftp.c
+endif
+if WITH_HTML_SOURCES
+libxml2_la_SOURCES += HTMLparser.c HTMLtree.c
+endif
+if WITH_HTTP_SOURCES
+libxml2_la_SOURCES += nanohttp.c
+endif
+if WITH_LEGACY_SOURCES
+libxml2_la_SOURCES += legacy.c
if WITH_SAX1_SOURCES
-docb_sources = DOCBparser.c
-else
-docb_sources =
+libxml2_la_SOURCES += SAX.c
+endif
+endif
+if WITH_LZMA_SOURCES
+libxml2_la_SOURCES += xzlib.c
+endif
+if WITH_MODULES_SOURCES
+libxml2_la_SOURCES += xmlmodule.c
+endif
+if WITH_OUTPUT_SOURCES
+libxml2_la_SOURCES += xmlsave.c
+endif
+if WITH_PATTERN_SOURCES
+libxml2_la_SOURCES += pattern.c
+endif
+if WITH_READER_SOURCES
+libxml2_la_SOURCES += xmlreader.c
+endif
+if WITH_REGEXPS_SOURCES
+libxml2_la_SOURCES += xmlregexp.c xmlunicode.c
+endif
+if WITH_SCHEMAS_SOURCES
+libxml2_la_SOURCES += relaxng.c xmlschemas.c xmlschemastypes.c
+if !WITH_XPATH_SOURCES
+libxml2_la_SOURCES += xpath.c
+endif
+endif
+if WITH_SCHEMATRON_SOURCES
+libxml2_la_SOURCES += schematron.c
endif
-
if WITH_TRIO_SOURCES
-trio_sources = triostr.c trio.c
-else
-trio_sources =
+libxml2_la_SOURCES += triostr.c trio.c
+endif
+if WITH_WRITER_SOURCES
+libxml2_la_SOURCES += xmlwriter.c
+endif
+if WITH_XINCLUDE_SOURCES
+libxml2_la_SOURCES += xinclude.c
+endif
+if WITH_XPATH_SOURCES
+libxml2_la_SOURCES += xpath.c
+endif
+if WITH_XPTR_SOURCES
+libxml2_la_SOURCES += xlink.c xpointer.c
endif
-
-libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
- parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \
- valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \
- xpointer.c xinclude.c nanohttp.c nanoftp.c \
- $(docb_sources) \
- catalog.c globals.c threads.c c14n.c xmlstring.c buf.c \
- xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
- $(trio_sources) \
- xmlreader.c relaxng.c dict.c SAX2.c \
- xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \
- xmlmodule.c schematron.c xzlib.c
DEPS = $(top_builddir)/libxml2.la
-LDADDS = $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
-
+LDADDS = $(top_builddir)/libxml2.la
-man_MANS = xml2-config.1 libxml.3
m4datadir = $(datadir)/aclocal
-m4data_DATA = libxml.m4
+dist_m4data_DATA = libxml.m4
runtest_SOURCES=runtest.c
-runtest_LDFLAGS =
+runtest_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
runtest_DEPENDENCIES = $(DEPS)
-runtest_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
+runtest_LDADD= $(BASE_THREAD_LIBS) $(THREAD_LIBS) $(LDADDS)
testrecurse_SOURCES=testrecurse.c
-testrecurse_LDFLAGS =
testrecurse_DEPENDENCIES = $(DEPS)
-testrecurse_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
+testrecurse_LDADD= $(LDADDS)
testlimits_SOURCES=testlimits.c
-testlimits_LDFLAGS =
testlimits_DEPENDENCIES = $(DEPS)
-testlimits_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
+testlimits_LDADD= $(LDADDS)
testchar_SOURCES=testchar.c
-testchar_LDFLAGS =
testchar_DEPENDENCIES = $(DEPS)
-testchar_LDADD= $(RDL_LIBS) $(LDADDS)
+testchar_LDADD= $(LDADDS)
testdict_SOURCES=testdict.c
-testdict_LDFLAGS =
testdict_DEPENDENCIES = $(DEPS)
-testdict_LDADD= $(RDL_LIBS) $(LDADDS)
+testdict_LDADD= $(LDADDS)
runsuite_SOURCES=runsuite.c
-runsuite_LDFLAGS =
runsuite_DEPENDENCIES = $(DEPS)
-runsuite_LDADD= $(RDL_LIBS) $(LDADDS)
+runsuite_LDADD= $(LDADDS)
xmllint_SOURCES=xmllint.c
-xmllint_LDFLAGS =
+xmllint_CFLAGS = $(AM_CFLAGS) $(RDL_CFLAGS)
xmllint_DEPENDENCIES = $(DEPS)
xmllint_LDADD= $(RDL_LIBS) $(LDADDS)
-testSAX_SOURCES=testSAX.c
-testSAX_LDFLAGS =
-testSAX_DEPENDENCIES = $(DEPS)
-testSAX_LDADD= $(LDADDS)
-
-testHTML_SOURCES=testHTML.c
-testHTML_LDFLAGS =
-testHTML_DEPENDENCIES = $(DEPS)
-testHTML_LDADD= $(LDADDS)
-
xmlcatalog_SOURCES=xmlcatalog.c
-xmlcatalog_LDFLAGS =
xmlcatalog_DEPENDENCIES = $(DEPS)
xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS)
-testXPath_SOURCES=testXPath.c
-testXPath_LDFLAGS =
-testXPath_DEPENDENCIES = $(DEPS)
-testXPath_LDADD= $(LDADDS)
-
-testC14N_SOURCES=testC14N.c
-testC14N_LDFLAGS =
-testC14N_DEPENDENCIES = $(DEPS)
-testC14N_LDADD= $(LDADDS)
-
testThreads_SOURCES = testThreads.c
-testThreads_LDFLAGS =
+testThreads_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
testThreads_DEPENDENCIES = $(DEPS)
-testThreads_LDADD= $(BASE_THREAD_LIBS) $(LDADDS)
-
-testURI_SOURCES=testURI.c
-testURI_LDFLAGS =
-testURI_DEPENDENCIES = $(DEPS)
-testURI_LDADD= $(LDADDS)
-
-testRegexp_SOURCES=testRegexp.c
-testRegexp_LDFLAGS =
-testRegexp_DEPENDENCIES = $(DEPS)
-testRegexp_LDADD= $(LDADDS)
-
-testAutomata_SOURCES=testAutomata.c
-testAutomata_LDFLAGS =
-testAutomata_DEPENDENCIES = $(DEPS)
-testAutomata_LDADD= $(LDADDS)
-
-testSchemas_SOURCES=testSchemas.c
-testSchemas_LDFLAGS =
-testSchemas_DEPENDENCIES = $(DEPS)
-testSchemas_LDADD= $(LDADDS)
-
-testRelax_SOURCES=testRelax.c
-testRelax_LDFLAGS =
-testRelax_DEPENDENCIES = $(DEPS)
-testRelax_LDADD= $(LDADDS)
-
-testReader_SOURCES=testReader.c
-testReader_LDFLAGS =
-testReader_DEPENDENCIES = $(DEPS)
-testReader_LDADD= $(LDADDS)
+testThreads_LDADD= $(BASE_THREAD_LIBS) $(THREAD_LIBS) $(LDADDS)
testModule_SOURCES=testModule.c
-testModule_LDFLAGS =
testModule_DEPENDENCIES = $(DEPS)
testModule_LDADD= $(LDADDS)
noinst_LTLIBRARIES = testdso.la
testdso_la_SOURCES = testdso.c
-testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
+testdso_la_LDFLAGS = $(AM_LDFLAGS) \
+ -module -no-undefined -avoid-version -rpath $(libdir)
# that one forces the rebuild when "make rebuild" is run on doc/
rebuild_testapi:
-@(if [ "$(PYTHON)" != "" ] ; then \
$(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
-# that one is just to make sure it is rebuilt if missing
-# but adding the dependances generate mess
-testapi.c: $(srcdir)/gentest.py
- -@(if [ "$(PYTHON)" != "" ] ; then \
- $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
-
-BUILT_SOURCES = testapi.c
-
testapi_SOURCES=testapi.c
-testapi_LDFLAGS =
testapi_DEPENDENCIES = $(DEPS)
testapi_LDADD= $(LDADDS)
runxmlconf_SOURCES=runxmlconf.c
-runxmlconf_LDFLAGS =
runxmlconf_DEPENDENCIES = $(DEPS)
runxmlconf_LDADD= $(LDADDS)
#testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c
-#testOOM_LDFLAGS =
#testOOM_DEPENDENCIES = $(DEPS)
#testOOM_LDADD= $(LDADDS)
-runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
- testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
+check-local:
[ -d test ] || $(LN_S) $(srcdir)/test .
[ -d result ] || $(LN_S) $(srcdir)/result .
- $(CHECKER) ./runtest$(EXEEXT) && \
- $(CHECKER) ./testrecurse$(EXEEXT) && \
- ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) ./testapi$(EXEEXT) && \
- $(CHECKER) ./testchar$(EXEEXT) && \
- $(CHECKER) ./testdict$(EXEEXT) && \
- $(CHECKER) ./runxmlconf$(EXEEXT)
- @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
- $(MAKE) tests ; fi)
- @cd fuzz; $(MAKE) tests
-
-check: all runtests
-
-check-valgrind valgrind: all
+ $(CHECKER) ./runtest$(EXEEXT)
+ $(CHECKER) ./testrecurse$(EXEEXT)
+ ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) ./testapi$(EXEEXT)
+ $(CHECKER) ./testchar$(EXEEXT)
+ $(CHECKER) ./testdict$(EXEEXT)
+ $(CHECKER) ./testModule$(EXEEXT)
+ $(CHECKER) ./testThreads$(EXEEXT)
+ $(CHECKER) ./runxmlconf$(EXEEXT)
+
+# Compatibility name of the check target
+runtests: check
+
+check-valgrind valgrind:
@echo '## Running the regression tests under Valgrind'
@echo '## Go get a cup of coffee it is gonna take a while ...'
- $(MAKE) CHECKER='valgrind -q' runtests
+ $(MAKE) CHECKER='valgrind -q' check
asan:
@echo '## rebuilding for ASAN'
./configure CFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" CXXFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" LDFLAGS="-fsanitize=address,undefined" CC="clang" CXX="clang++" --disable-shared ; OptimOff ; $(MAKE) clean ; $(MAKE)
-testall : tests SVGtests SAXtests
-
-tests: XMLtests XMLenttests NStests IDtests Errtests APItests $(READER_TEST) $(TEST_SAX) $(TEST_PUSH) $(TEST_HTML) $(TEST_PHTML) $(TEST_VALID) URItests $(TEST_PATTERN) $(TEST_XPATH) $(TEST_XPTR) $(TEST_XINCLUDE) $(TEST_C14N) $(TEST_DEBUG) $(TEST_CATALOG) $(TEST_REGEXPS) $(TEST_SCHEMAS) $(TEST_SCHEMATRON) $(TEST_THREADS) Timingtests $(TEST_VTIME) $(PYTHON_TESTS) $(TEST_MODULES)
- @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
- $(MAKE) -s tests ; fi)
- @(cd doc/examples ; $(MAKE) -s tests)
-
-APItests: testapi$(EXEEXT)
- @echo "## Running the API regression tests this may take a little while"
- -@(ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) $(top_builddir)/testapi -q)
-
-HTMLtests : testHTML$(EXEEXT)
- @(echo > .memdump)
- @echo "## HTML regression tests"
- -@(for i in $(srcdir)/test/HTML/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
- else \
- log=`$(CHECKER) $(top_builddir)/testHTML $$i > result.$$name 2> error.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/HTML/$$name result.$$name ; \
- diff -b $(srcdir)/result/HTML/$$name.err error.$$name ; \
- $(CHECKER) $(top_builddir)/testHTML result.$$name > result2.$$name 2>error.$$name ; \
- diff result.$$name result2.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name result2.$$name error.$$name ; \
- fi ; fi ; done)
-
-HTMLPushtests : testHTML$(EXEEXT)
- @echo "## Push HTML regression tests"
- -@(for i in $(srcdir)/test/HTML/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testHTML --push $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
- else \
- log=`$(CHECKER) $(top_builddir)/testHTML --push $$i > result.$$name 2> error.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/HTML/$$name result.$$name ; \
- cut -b 1-15 $(srcdir)/result/HTML/$$name.err > errorcut.$$name; \
- cut -b 1-15 error.$$name > errorcut2.$$name; \
- diff -b errorcut.$$name errorcut2.$$name ; \
- $(CHECKER) $(top_builddir)/testHTML --push result.$$name > result2.$$name 2>error.$$name ; \
- diff result.$$name result2.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name result2.$$name error.$$name errorcut.$$name errorcut2.$$name ; \
- fi ; fi ; done)
- @echo "## HTML SAX regression tests"
- -@(for i in $(srcdir)/test/HTML/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/HTML/$$name.sax ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
- else \
- log=`$(CHECKER) $(top_builddir)/testHTML --sax $$i > result.$$name.sax ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name.sax ; \
- fi ; fi ; done)
- @echo "## Push HTML SAX regression tests"
- -@(for i in $(srcdir)/test/HTML/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testHTML --push --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
- else \
- log=`$(CHECKER) $(top_builddir)/testHTML --push --sax $$i 2>&1 > result.$$name.sax ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name.sax ; \
- fi ; fi ; done)
-
-XMLtests : xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## XML regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint $$i 2>&1 > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff $(srcdir)/result/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff result.$$name result2.$$name` ;\
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name result2.$$name ; \
- fi ; fi ; done)
- @echo "## XML regression tests on memory"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --memory $$i > $(srcdir)/result/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --memory $$i 2>&1 > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint --memory result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"`; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- diff result.$$name result2.$$name ; \
- rm result.$$name result2.$$name ; \
- fi ; fi ; done)
+# Old test suite. This should be ported to C.
-XMLPushtests: xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## XML push regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --push $$i > $(srcdir)/result/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --push $$i 2>&1 > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff $(srcdir)/result/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint --push result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff result.$$name result2.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name result2.$$name ; \
- fi ; fi ; done)
-
-NStests : xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## XML Namespaces regression tests"
- -@(for i in $(srcdir)/test/namespaces/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/namespaces/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint $$i \
- 2> $(srcdir)/result/namespaces/$$name.err \
- > $(srcdir)/result/namespaces/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff $(srcdir)/result/namespaces/$$name result.$$name ; \
- diff $(srcdir)/result/namespaces/$$name.err error.$$name`; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
-
-IDtests : xmllint$(EXEEXT) testXPath$(EXEEXT)
- @(echo > .memdump)
- @echo "## xml:id regression tests"
- -@(for i in $(srcdir)/test/xmlid/id_*.xml ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/xmlid/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" \
- 2> $(srcdir)/result/xmlid/$$name.err \
- > $(srcdir)/result/xmlid/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" 2> error.$$name > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff $(srcdir)/result/xmlid/$$name result.$$name ; \
- diff $(srcdir)/result/xmlid/$$name.err error.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
-
-Errtests : xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## Error cases regression tests"
- -@(for i in $(srcdir)/test/errors/*.xml ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/errors/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint $$i \
- 2> $(srcdir)/result/errors/$$name.err \
- > $(srcdir)/result/errors/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff $(srcdir)/result/errors/$$name result.$$name ; \
- diff $(srcdir)/result/errors/$$name.err error.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
- @echo "## Error cases regression tests (old 1.0)"
- -@(for i in $(srcdir)/test/errors10/*.xml ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/errors10/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --oldxml10 $$i \
- 2> $(srcdir)/result/errors10/$$name.err \
- > $(srcdir)/result/errors10/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --oldxml10 $$i 2> error.$$name > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff $(srcdir)/result/errors10/$$name result.$$name ; \
- diff $(srcdir)/result/errors10/$$name.err error.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
- @echo "## Error cases stream regression tests"
- -@(for i in $(srcdir)/test/errors/*.xml ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/errors/$$name.str ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --stream $$i \
- 2> $(srcdir)/result/errors/$$name.str \
- > /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --stream $$i 2> error.$$name > /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff $(srcdir)/result/errors/$$name.str error.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm error.$$name ; \
- fi ; fi ; done)
-
-Docbtests : xmllint$(EXEEXT)
-
-XMLenttests : xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## XML entity subst regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/noent/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --noent $$i > $(srcdir)/result/noent/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --noent $$i 2>&1 > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff $(srcdir)/result/noent/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint --noent result.$$name 2>&1 > result2.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff result.$$name result2.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name result2.$$name ; \
- fi ; fi ; done)
-
-URItests : testURI$(EXEEXT)
- @(echo > .memdump)
- @echo "## URI module regression tests"
- -@(for i in $(srcdir)/test/URI/*.data ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/URI/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i > $(srcdir)/result/URI/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i 2>&1 > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/URI/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
- -@(for i in $(srcdir)/test/URI/*.uri ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/URI/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testURI < $$i > $(srcdir)/result/URI/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/testURI < $$i 2>&1 > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/URI/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
-
-XPathtests : testXPath$(EXEEXT)
- @(echo > .memdump)
- @echo "## XPath regression tests"
- -@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \
- then echo Skipping debug not compiled in ; exit 0 ; fi ; \
- for i in $(srcdir)/test/XPath/expr/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/XPath/expr/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testXPath -f --expr $$i > $(srcdir)/result/XPath/expr/$$name 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testXPath -f --expr $$i > result.$$name 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XPath/expr/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done ; \
- for i in $(srcdir)/test/XPath/docs/* ; do \
- if [ ! -d $$i ] ; then \
- doc=`basename $$i`; \
- for j in $(srcdir)/test/XPath/tests/$$doc* ; do \
- if [ ! -f $$j ] ; then continue ; fi ; \
- name=`basename $$j`; \
- if [ ! -d $$j ] ; then \
- if [ ! -f $(srcdir)/result/XPath/tests/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > $(srcdir)/result/XPath/tests/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XPath/tests/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done ; fi ; done)
+OLD_TESTS = Timingtests
+if WITH_CATALOG_SOURCES
+OLD_TESTS += Catatests
+endif
+if WITH_DEBUG_SOURCES
+OLD_TESTS += Scripttests
+endif
+if WITH_SCHEMAS_SOURCES
+if WITH_PYTHON
+OLD_TESTS += RelaxNGPythonTests SchemasPythonTests
+endif
+endif
+if WITH_SCHEMATRON_SOURCES
+OLD_TESTS += Schematrontests
+endif
+if WITH_VALID_SOURCES
+OLD_TESTS += VTimingtests
+endif
-XPtrtests : testXPath$(EXEEXT)
- @(echo > .memdump)
- @echo "## XPointer regression tests"
- -@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \
- then echo Skipping debug not compiled in ; exit 0 ; fi ; \
- for i in $(srcdir)/test/XPath/docs/* ; do \
- if [ ! -d $$i ] ; then \
- doc=`basename $$i`; \
- for j in $(srcdir)/test/XPath/xptr/$$doc* ; do \
- if [ ! -f $$j ] ; then continue ; fi ; \
- name=`basename $$j`; \
- if [ ! -d $$j ] ; then \
- if [ ! -f $(srcdir)/result/XPath/xptr/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > $(srcdir)/result/XPath/xptr/$$name 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- else \
- log=`$(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > result.$$name 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XPath/xptr/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done ; fi ; done)
-
-XIncludetests : xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## XInclude regression tests"
- -@(for i in $(srcdir)/test/XInclude/docs/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > result.$$name 2>error.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XInclude/$$name result.$$name ; \
- diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
- -@(for i in $(srcdir)/test/XInclude/docs/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > result.$$name 2>error.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XInclude/$$name result.$$name ; \
- diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
- @(echo > .memdump)
- @echo "## XInclude xmlReader regression tests"
- -@(for i in $(srcdir)/test/XInclude/docs/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \
- diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
- -@(for i in $(srcdir)/test/XInclude/docs/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \
- diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
+tests: $(OLD_TESTS)
Scripttests : xmllint$(EXEEXT)
@(echo > .memdump)
@@ -719,242 +306,6 @@ Catatests : xmlcatalog$(EXEEXT)
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
rm -f $(srcdir)/result/catalogs/mycatalog)
-SVGtests : xmllint$(EXEEXT)
- @echo "## SVG parsing regression tests"
- -@(for i in $(srcdir)/test/SVG/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/SVG/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/SVG/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint $$i > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/SVG/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint result.$$name > result2.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff result.$$name result2.$$name ; \
- rm result.$$name result2.$$name ; \
- fi ; fi ; done)
-
-Threadtests : testThreads$(EXEEXT)
- @echo "## Threaded regression tests"
- -@($(CHECKER) $(top_builddir)/testThreads ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- exit 0)
-
-Readertests : xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## Reader regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.rdr result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
- @echo "## Reader on memory regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.rdr result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
- @(echo > .memdump)
- @echo "## Walker regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > result.$$name 2>/dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.rdr result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
- @echo "## Reader entities substitution regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name.rde ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > $(srcdir)/result/$$name.rde 2>/dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.rde result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
-
-SAXtests : testSAX$(EXEEXT)
- @(echo > .memdump)
- @echo "## SAX1 callbacks regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name.sax ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testSAX $$i > $(srcdir)/result/$$name.sax 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testSAX $$i > result.$$name 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.sax result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
- @echo "## SAX2 callbacks regression tests"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/$$name.sax2 ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testSAX --sax2 $$i > $(srcdir)/result/$$name.sax2 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testSAX --sax2 $$i > result.$$name 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.sax2 result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
- @echo "## SAX2 callbacks regression tests with entity substitution"
- -@(for i in $(srcdir)/test/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/noent/$$name.sax2 ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testSAX --sax2 --noent $$i > $(srcdir)/result/noent/$$name.sax2 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testSAX --sax2 --noent $$i > result.$$name 2> /dev/null ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/noent/$$name.sax2 result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
-
-Validtests : xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## Valid documents regression tests"
- -@(for i in $(srcdir)/test/VCM/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- log=`$(CHECKER) $(top_builddir)/xmllint --valid --noout --nowarning $$i ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"`;\
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- fi ; done ; exit 0)
- @echo "## Validity checking regression tests"
- -@(for i in $(srcdir)/test/VC/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/VC/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> $(srcdir)/result/VC/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/VC/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
- @echo "## General documents valid regression tests"
- -@(for i in $(srcdir)/test/valid/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/valid/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --valid $$i > $(srcdir)/result/valid/$$name 2>$(srcdir)/result/valid/$$name.err ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint --valid $$i > result.$$name 2>error.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/valid/$$name result.$$name ; \
- diff $(srcdir)/result/valid/$$name.err error.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
-
-Regexptests: testRegexp$(EXEEXT)
- @(echo > .memdump)
- @echo "## Regexp regression tests"
- -@(for i in $(srcdir)/test/regexp/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/regexp/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testRegexp -i $$i > $(srcdir)/result/regexp/$$name 2> $(srcdir)/result/regexp/$$name.err ; \
- if [ ! -s "$(srcdir)/result/regexp/$$name.err" ] ; then rm $(srcdir)/result/regexp/$$name.err; fi ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testRegexp -i $$i > result.$$name 2> error.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/regexp/$$name result.$$name ; \
- if [ -s "$(srcdir)/result/regexp/$$name.err" -o -s "error.$$name" ] ; then diff $(srcdir)/result/regexp/$$name.err error.$$name ; fi` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
- rm result.$$name error.$$name ; \
- fi ; fi ; done)
-
-# Disabled for now
-Exptests: testRegexp$(EXEEXT)
- @echo "## Formal expressions regression tests"
- -@(for i in $(srcdir)/test/expr/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/expr/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testRegexp --expr -i $$i > $(srcdir)/result/expr/$$name; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testRegexp --expr -i $$i 2>&1 > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/expr/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
-
-Automatatests: testAutomata$(EXEEXT)
- @(echo > .memdump)
- @echo "## Automata regression tests"
- -@(for i in $(srcdir)/test/automata/* ; do \
- name=`basename $$i`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/automata/$$name ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/testAutomata $$i > $(srcdir)/result/automata/$$name; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testAutomata $$i 2>&1 > result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/automata/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done)
-
dba100000.xml: dbgenattr.pl
@echo "## generating dba100000.xml"
@($(PERL) $(top_srcdir)/dbgenattr.pl 100000 > dba100000.xml)
@@ -989,138 +340,6 @@ VTimingtests: xmllint$(EXEEXT)
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
exit 0)
-C14Ntests : testC14N$(EXEEXT)
- @echo "## C14N and XPath regression tests"
- -@(for m in with-comments without-comments 1-1-without-comments exc-without-comments ; do \
- for i in $(srcdir)/test/c14n/$$m/*.xml ; do \
- if [ ! -d $$i ] ; then \
- name=`basename $$i .xml`; \
- cmdline="$(CHECKER) $(top_builddir)/testC14N --$$m $$i"; \
- if [ -f $(srcdir)/test/c14n/$$m/$$name.xpath ] ; then \
- cmdline="$$cmdline $(srcdir)/test/c14n/$$m/$$name.xpath"; \
- if [ -f $(srcdir)/test/c14n/$$m/$$name.ns ] ; then \
- cmdline="$$cmdline '`cat $(srcdir)/test/c14n/$$m/$$name.ns`'"; \
- fi; \
- fi; \
- $$cmdline > $(srcdir)/test/c14n/test.tmp 2> /dev/null; \
- if [ $$? -eq 0 ]; then \
- diff $(srcdir)/result/c14n/$$m/$$name $(srcdir)/test/c14n/test.tmp; \
- if [ $$? -ne 0 ]; then \
- echo "Test $$m/$$name failed"; \
- cat $(srcdir)/test/c14n/test.tmp; \
- fi; \
- else \
- echo "C14N failed"; \
- fi; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- fi; \
- rm -f $(srcdir)/test/c14n/test.tmp; \
- done; \
- done)
-
-Schemastests: testSchemas$(EXEEXT)
- @(echo > .memdump)
- @echo "## Schemas regression tests"
- -@(for i in $(srcdir)/test/schemas/*_*.xsd ; do \
- name=`basename $$i | sed 's+_.*++'`; \
- sno=`basename $$i | sed 's+.*_\(.*\).xsd+\1+'`; \
- for j in $(srcdir)/test/schemas/"$$name"_*.xml ; do \
- if [ -f $$j ] ; then \
- xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
- if [ ! -f $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" ]; \
- then \
- echo New test file "$$name"_"$$sno"_"$$xno" ; \
- $(CHECKER) $(top_builddir)/testSchemas $$i $$j \
- > $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
- 2> $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/testSchemas $$i $$j \
- > res.$$name 2> err.$$name;\
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
- res.$$name;\
- diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err \
- err.$$name;\
- grep Unimplemented err.$$name`; \
- if [ -n "$$log" ] ; then echo "$$name"_"$$sno"_"$$xno" result ; echo "$$log" ; fi ; \
- rm res.$$name err.$$name ; \
- fi ; fi ;\
- done; done)
-
-Relaxtests: xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## Relax-NG regression tests"
- -@(for i in $(srcdir)/test/relaxng/*.rng ; do \
- name=`basename $$i | sed 's+\.rng++'`; \
- if [ ! -f $(srcdir)/result/relaxng/"$$name"_valid ] ; then \
- echo New schemas $$name ; \
- $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \
- > $(srcdir)/result/relaxng/"$$name"_valid \
- 2> $(srcdir)/result/relaxng/"$$name"_err; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \
- > res.$$name 2> err.$$name;\
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/relaxng/"$$name"_valid \
- res.$$name;\
- diff $(srcdir)/result/relaxng/"$$name"_err \
- err.$$name | grep -v "error detected at";\
- grep Unimplemented err.$$name`; \
- if [ -n "$$log" ] ; then echo schemas $$name result ; echo "$$log" ; fi ; \
- rm res.$$name err.$$name ; \
- fi; \
- for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
- if [ -f $$j ] ; then \
- xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
- if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \
- then \
- echo New test file "$$name"_"$$xno" ; \
- $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
- > $(srcdir)/result/relaxng/"$$name"_"$$xno" \
- 2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
- > res.$$name 2> err.$$name;\
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/relaxng/"$$name"_"$$xno" \
- res.$$name;\
- diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
- err.$$name | grep -v "error detected at";\
- grep Unimplemented err.$$name`; \
- if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo "$$log" ; fi ; \
- rm res.$$name err.$$name ; \
- fi ; fi ; \
- done; done)
- @echo "## Relax-NG streaming regression tests"
- -@(for i in $(srcdir)/test/relaxng/*.rng ; do \
- name=`basename $$i | sed 's+\.rng++'`; \
- for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
- if [ -f $$j ] ; then \
- xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
- if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \
- then \
- echo New test file "$$name"_"$$xno" ; \
- $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
- > $(srcdir)/result/relaxng/"$$name"_"$$xno" \
- 2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- else \
- log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --stream --relaxng $$i $$j \
- > res.$$name 2> err.$$name;\
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/relaxng/"$$name"_"$$xno" res.$$name;\
- if [ "$$name" != "tutor10_1" -a "$$name" != "tutor10_2" -a "$$name" != "tutor3_2" -a "$$name" != "307377" -a "$$name" != "tutor8_2" ] ; then \
- diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
- err.$$name | grep -v "error detected at";\
- fi ; grep Unimplemented err.$$name`; \
- if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo "$$log" ; fi ; \
- rm res.$$name err.$$name ; \
- fi ; fi ; \
- done; done)
-
Schematrontests: xmllint$(EXEEXT)
@(echo > .memdump)
@echo "## Schematron regression tests"
@@ -1174,41 +393,12 @@ SchemasPythonTests:
fi)
@(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" pytests ; fi)
-Patterntests: xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "## Pattern regression tests"
- -@(for i in $(srcdir)/test/pattern/*.pat ; do \
- name=`basename $$i .pat`; \
- if [ -f $(srcdir)/test/pattern/$$name.xml ] ; then \
- if [ ! -f $(srcdir)/result/pattern/$$name ] ; then \
- rm -f result.$$name ; \
- echo New test file $$name ; \
- for pat in `cat $$i` ; do \
- $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml >> $(srcdir)/result/pattern/$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- done ;\
- else \
- rm -f result.$$name ; \
- lst=`cat $$i` ; \
- log=`for pat in $$lst ; do $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml 2>&1 >> result.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- done ;\
- diff $(srcdir)/result/pattern/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
- rm result.$$name ; \
- fi ; fi ; done ;)
-
-ModuleTests: testModule$(EXEEXT) testdso.la
- @echo "## Module tests"
- @(./testModule$(EXEEXT))
-
cleanup:
-@(find . -name .\#\* -exec rm {} \;)
-@(find . -name \*.gcda -o -name \*.gcno -exec rm -f {} \;)
-@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm -f {} \;)
-dist-hook: cleanup libxml2.spec
- -cp libxml2.spec $(distdir)
+dist-hook: cleanup
(cd $(srcdir) ; tar -cf - --exclude .git win32 os400 vms test result) | (cd $(distdir); tar xf -)
dist-source: distdir
@@ -1226,37 +416,18 @@ cleantar:
rpm: cleanup cleantar
@(unset CDPATH ; $(MAKE) dist-source dist && rpmbuild -ta $(distdir).tar.gz)
-## We create xml2Conf.sh here and not from configure because we want
-## to get the paths expanded correctly. Macros like srcdir are given
-## the value NONE in configure if the user doesn't specify them (this
-## is an autoconf feature, not a bug).
-
-xml2Conf.sh: xml2Conf.sh.in Makefile
-## Use sed and then mv to avoid problems if the user interrupts.
- sed -e 's?\@XML_LIBDIR\@?$(XML_LIBDIR)?g' \
- -e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \
- -e 's?\@VERSION\@?$(VERSION)?g' \
- -e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \
- -e 's?\@XML_PRIVATE_LIBS\@?$(XML_PRIVATE_LIBS)?g' \
- < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \
- && mv xml2Conf.tmp xml2Conf.sh
-
-CLEANFILES = runxmlconf.log test.out xml2Conf.sh *.gcda *.gcno *.res
+CLEANFILES = runxmlconf.log test.out *.gcda *.gcno *.res
DISTCLEANFILES = COPYING missing.lst
-confexecdir=$(libdir)
-confexec_DATA = xml2Conf.sh
-EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \
- libxml.m4 Copyright check-xml-test-suite.py gentest.py \
+EXTRA_DIST = Copyright check-xml-test-suite.py gentest.py \
check-relaxng-test-suite.py check-relaxng-test-suite2.py \
check-xsddata-test-suite.py check-xinclude-test-suite.py \
example/Makefile.am example/gjobread.c example/gjobs.xml \
- $(man_MANS) libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \
libxml2-config.cmake.in autogen.sh \
trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
- triop.h triodef.h libxml.h xzlib.h buf.h \
- enc.h save.h genUnicode.py TODO_SCHEMAS \
- dbgen.pl dbgenattr.pl regressions.py regressions.xml \
+ triop.h triodef.h libxml.h \
+ genUnicode.py TODO_SCHEMAS \
+ dbgen.pl dbgenattr.pl \
README.tests Makefile.tests libxml2.syms timsort.h \
README.zOS README.md \
CMakeLists.txt config.h.cmake.in libxml2-config.cmake.cmake.in
@@ -1271,27 +442,8 @@ cmake_DATA = libxml2-config.cmake
#
# Install the tests program sources as examples
#
-EXAMPLES_DIR=$(docdir)/examples
-
-install-data-local:
- $(MKDIR_P) $(DESTDIR)$(docdir)
- -$(INSTALL) -m 0644 $(srcdir)/Copyright $(DESTDIR)$(docdir)
- $(MKDIR_P) $(DESTDIR)$(EXAMPLES_DIR)
- -$(INSTALL) -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR)
- -$(INSTALL) -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR)
- -$(INSTALL) -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR)
- -$(INSTALL) -m 0644 $(srcdir)/testXPath.c $(DESTDIR)$(EXAMPLES_DIR)
- @echo "If the documentation is installed, please also look at html/examples for more." > $(DESTDIR)$(EXAMPLES_DIR)/README
-
-uninstall-local:
- rm -f $(DESTDIR)$(EXAMPLES_DIR)/README
- rm -f $(DESTDIR)$(EXAMPLES_DIR)/testXPath.c
- rm -f $(DESTDIR)$(EXAMPLES_DIR)/testHTML.c
- rm -f $(DESTDIR)$(EXAMPLES_DIR)/testSAX.c
- rm -f $(DESTDIR)$(EXAMPLES_DIR)/xmllint.c
- rm -rf $(DESTDIR)$(EXAMPLES_DIR)
- rm -f $(DESTDIR)$(docdir)/Copyright
- rm -rf $(DESTDIR)$(docdir)
+examplesdir = $(docdir)/examples
+examples_DATA = xmllint.c
tst: tst.c
$(CC) $(CFLAGS) -Iinclude -o tst tst.c .libs/libxml2.a -lpthread -lm -lz -llzma
@@ -1307,7 +459,7 @@ LCOV = /usr/bin/lcov
GENHTML = /usr/bin/genhtml
cov: clean-cov
- if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \
+ if [ "`echo $(AM_LDFLAGS) | grep coverage`" = "" ] ; then \
echo not configured with coverage; exit 1 ; fi
if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \
echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi
diff --git a/chromium/third_party/libxml/src/NEWS b/chromium/third_party/libxml/src/NEWS
index 2ccdc10a9d2..0a3dd6b03bf 100644
--- a/chromium/third_party/libxml/src/NEWS
+++ b/chromium/third_party/libxml/src/NEWS
@@ -1,12 +1,222 @@
+NEWS file for libxml2
+
+v2.10.0: Aug 17 2022
+
+### Security
+
+- [CVE-2022-2309] Reset nsNr in xmlCtxtReset
+- Reserve byte for NUL terminator and report errors consistently in xmlBuf and
+ xmlBuffer (David Kilzer)
+- Fix missing NUL terminators in xmlBuf and xmlBuffer functions (David Kilzer)
+- Fix integer overflow in xmlBufferDump() (David Kilzer)
+- xmlBufAvail() should return length without including a byte for NUL
+ terminator (David Kilzer)
+- Fix ownership of xmlNodePtr & xmlAttrPtr fields in xmlSetTreeDoc() (David
+ Kilzer)
+- Use xmlNewDocText in xmlXIncludeCopyRange
+- Fix use-after-free bugs when calling xmlTextReaderClose() before
+ xmlFreeTextReader() on post-validating parser (David Kilzer)
+- Use UPDATE_COMPAT() consistently in buf.c (David Kilzer)
+- fix: xmlXPathParserContext could be double-delete in OOM case. (jinsub ahn)
+
+### Removals and deprecations
+
+- Disable XPointer location support by default
+- Remove outdated xml2Conf.sh
+- Deprecate module init and cleanup functions
+- Remove obsolete XML Software Autoupdate (XSA) file
+- Remove DOCBparser
+- Remove obsolete Python test framework
+- Remove broken VxWorks support
+- Remove broken Mac OS 9 support
+- Remove broken bakefile support
+- Remove broken Visual Studio 2010 support
+- Remove broken Windows CE support
+- Deprecate IDREF-related functions in valid.h
+- Deprecate legacy functions
+- Disable legacy support by default
+- Deprecate all functions in nanoftp.h
+- Disable FTP support by default
+- Add XML_DEPRECATED macro
+- Remove elfgcchack.h
+
+### Regressions
+
+- Skip incorrectly opened HTML comments
+- Restore behavior of htmlDocContentDumpFormatOutput() (David Kilzer)
+
+### Bug fixes
+
+- Fix memory leak with invalid XSD
+- Make XPath depth check work with recursive invocations
+- Fix memory leak in xmlLoadEntityContent error path
+- Avoid double-free if malloc fails in inputPush
+- Properly fold whitespace around the QName value when validating an XSD
+ schema. (Damjan Jovanovic)
+- Add whitespace folding for some atomic data types that it's missing on.
+ (Damjan Jovanovic)
+- Don't add IDs containing unexpanded entity references
+
+### Improvements
+
+- Avoid calling xmlSetTreeDoc
+- Simplify xmlFreeNode
+- Don't reset nsDef when changing node content
+- Fix unintended fall-through in xmlNodeAddContentLen
+- Remove unused xmlBuf functions (David Kilzer)
+- Implement xpath1() XPointer scheme
+- Add configuration flag for XPointer locations support
+- Fix compiler warnings in Python code
+- Mark more static data as `const` (David Kilzer)
+- Make xmlStaticCopyNode non-recursive
+- Clean up encoding switching code
+- Simplify recursive pthread mutex
+- Use non-recursive mutex in dict.c
+- Fix parser progress checks
+- Avoid arithmetic on freed pointers
+- Improve buffer allocation scheme
+- Remove unneeded #includes
+- Add support for some non-standard escapes in regular expressions. (Damjan
+ Jovanovic)
+- htmlParseComment: handle abruptly-closed comments (Mike Dalessio)
+- Add let variable tag support (Oliver Diehl)
+- Add value-of tag support (Oliver Diehl)
+- Remove useless call to xmlRelaxNGCleanupTypes
+- Don't include ICU headers in public headers
+- Update `xmlStrlen()` to use POSIX / ISO C `strlen()` (Mike Dalessio)
+- Fix unused variable warnings with disabled features
+- Only warn on invalid redeclarations of predefined entities
+- Remove unneeded code in xmlreader.c
+- Rework validation context flags
+
+### Portability
+
+- Use NAN/INFINITY if available to init XPath NaN/Inf (Sergey Kosukhin)
+- Fix Python tests on macOS
+- Fix xmlCleanupThreads on Windows
+- Fix reinitialization of library on Windows
+- Don't mix declarations and code in runtest.c
+- Use portable python shebangs (David Seifert)
+- Use critical sections as mutex on Windows
+- Don't set HAVE_WIN32_THREADS in win32config.h
+- Use stdint.h with newer MSVC
+- Remove cruft from win32config.h
+- Remove isinf/isnan emulation in win32config.h
+- Always fopen files with "rb"
+- Remove __DJGPP__ checks
+- Remove useless __CYGWIN__ checks
+
+### Build system
+
+- Don't autogenerate doc/examples/Makefile.am
+- cmake: Install libxml.m4 on UNIX-like platforms (Daniel E)
+- cmake: Use symbol versioning on UNIX-like platforms (Daniel E)
+- Port genUnicode.py to Python 3
+- Port gentest.py to Python 3
+- cmake: Fix build without thread support
+- cmake: Install documentation in CMAKE_INSTALL_DOCDIR
+- cmake: Remove non needed files in docs dir (Daniel E)
+- configure: move XML_PRIVATE_LIBS after WIN32_EXTRA_LIBADD is set
+ (Christopher Degawa)
+- Move local Autoconf macros into m4 directory
+- Use XML_PRIVATE_LIBS in libxml2_la_LIBADD
+- Update libxml-2.0-uninstalled.pc.in
+- Remove LIBS from XML_PRIVATE_LIBS
+- Add WIN32_EXTRA_LIBADD to XML_PRIVATE_LIBS
+- Don't overlink executables
+- cmake: Adjust paths for UNIX or UNIX-like target systems (Daniel Engberg)
+- build: Make use of variables in libxml's pkg-config file (Daniel Engberg)
+- Avoid obsolescent `test -a` constructs (David Seifert)
+- Move AM_MAINTAINER_MODE to AM section
+- configure.ac: make AM_SILENT_RULES([yes]) unconditional (David Seifert)
+- Streamline documentation installation
+- Don't try to recreate COPYING symlink
+- Detect libm using libtool's macros (David Seifert)
+- configure.ac: disable static libraries by default (David Seifert)
+- python/Makefile.am: nest python docs in $(docdir) (David Seifert)
+- python/Makefile.am: rely on global AM_INIT_AUTOMAKE (David Seifert)
+- Makefile.am: install examples more idiomatically (David Seifert)
+- configure.ac: remove useless AC_SUBST (David Seifert)
+- Respect `--sysconfdir` in source files (David Seifert)
+- Ignore configure backup file created by recent autoreconf too (Vadim Zeitlin)
+- Only install *.html and *.c example files
+- Remove --with-html-dir option
+- Rework documentation build system
+- Remove old website
+- Use AM_PATH_PYTHON/PKG_CHECK_MODULES for python bindings (David Seifert)
+- Update genChRanges.py
+- Update build_glob.py
+- Remove ICONV_CONST test
+- Remove obsolete AC_HEADER checks
+- Don't check for standard C89 library functions
+- Don't check for standard C89 headers
+- Remove special configuration for certain maintainers
+
+### Test suite, CI
+
+- Disable network in API tests
+- testapi: remove leading slash from "/missing.xml" (Mike Gilbert)
+- Build Autotools CI tests out of source tree (VPATH)
+- Add --with-minimum build to CI tests
+- Fix warnings when testing --with-minimum build
+- cmake: Run all tests when threads are disabled
+- Also build CI tests with -Werror
+- Move doc/examples tests to new test suite
+- Simplify 'make check' targets
+- Fix schemas and relaxng tests
+- Remove unused result files
+- Allow missing result files in runtest
+- Move regexp tests to runtest
+- Move SVG tests to runtest.c
+- Move testModule to new test suite
+- Move testThreads to new test suite
+- Remove major parts of old test suite
+- Make testchar return an error on failure (Tony Tascioglu)
+- Add CI job for static build
+- python/tests: open() relative to test scripts (David Seifert)
+- Port some test scripts to Python 3
+
+### Documentation
+
+- Improve documentation of tree manipulation API
+- Update xml2-config man page
+- Consolidate man pages
+- Rename xmlcatalog_man.xml
+- Make examples a standalone HTML page
+- Fix documentation in entities.c
+- Add note about optimization flags
+
+
+v2.9.14: May 02 2022:
+ - Security:
+ [CVE-2022-29824] Integer overflow in xmlBuf and xmlBuffer
+ Fix potential double-free in xmlXPtrStringRangeFunction
+ Fix memory leak in xmlFindCharEncodingHandler
+ Normalize XPath strings in-place
+ Prevent integer-overflow in htmlSkipBlankChars() and xmlSkipBlankChars()
+ (David Kilzer)
+ Fix leak of xmlElementContent (David Kilzer)
+
+ - Bug fixes:
+ Fix parsing of subtracted regex character classes
+ Fix recursion check in xinclude.c
+ Reset last error in xmlCleanupGlobals
+ Fix certain combinations of regex range quantifiers
+ Fix range quantifier on subregex
+
+ - Improvements:
+ Fix recovery from invalid HTML start tags
+
+ - Build system, portability:
+ Define LFS macros before including system headers
+ Initialize XPath floating-point globals
+ configure: check for icu DEFS (James Hilliard)
+ configure.ac: produce tar.xz only (GNOME policy) (David Seifert)
+ CMakeLists.txt: Fix LIBXML_VERSION_NUMBER
+ Fix build with older Python versions
+ Fix --without-valid build
- NEWS file for libxml2
-The change log at
-ChangeLog.html
- describes the recents commits
-to the GIT at
-https://gitlab.gnome.org/GNOME/libxml2
- code base.Here is the list of public releases:
v2.9.13: Feb 19 2022:
- Security:
[CVE-2022-23308] Use-after-free of ID and IDREF attributes
diff --git a/chromium/third_party/libxml/src/README.md b/chromium/third_party/libxml/src/README.md
new file mode 100644
index 00000000000..ad423e686f9
--- /dev/null
+++ b/chromium/third_party/libxml/src/README.md
@@ -0,0 +1,126 @@
+# libxml2
+
+libxml2 is an XML toolkit implemented in C, originally developed for
+the GNOME Project.
+
+Full documentation is available at
+<https://gitlab.gnome.org/GNOME/libxml2/-/wikis>.
+
+Bugs should be reported at
+<https://gitlab.gnome.org/GNOME/libxml2/-/issues>.
+
+A mailing list xml@gnome.org is available. You can subscribe at
+<https://mail.gnome.org/mailman/listinfo/xml>. The list archive is at
+<https://mail.gnome.org/archives/xml/>.
+
+## License
+
+This code is released under the MIT License, see the Copyright file.
+
+## Build instructions
+
+libxml2 can be built with GNU Autotools, CMake, or several other build
+systems in platform-specific subdirectories.
+
+### Autotools (for POSIX systems like Linux, BSD, macOS)
+
+If you build from a Git tree, you have to install Autotools and start
+by generating the configuration files with:
+
+ ./autogen.sh
+
+If you build from a source tarball, extract the archive with:
+
+ tar xf libxml2-xxx.tar.gz
+ cd libxml2-xxx
+
+To see a list of build options:
+
+ ./configure --help
+
+Also see the INSTALL file for additional instructions. Then you can
+configure and build the library:
+
+ ./configure [possible options]
+ make
+
+Note that by default, no optimization options are used. You have to
+enable them manually, for example with:
+
+ CFLAGS='-O2 -fno-semantic-interposition' ./configure
+
+Now you can run the test suite with:
+
+ make check
+
+Please report test failures to the mailing list or bug tracker.
+
+Then you can install the library:
+
+ make install
+
+At that point you may have to rerun ldconfig or a similar utility to
+update your list of installed shared libs.
+
+### CMake (mainly for Windows)
+
+Another option for compiling libxml is using CMake:
+
+ cmake -E tar xf libxml2-xxx.tar.gz
+ cmake -S libxml2-xxx -B libxml2-xxx-build [possible options]
+ cmake --build libxml2-xxx-build
+ cmake --install libxml2-xxx-build
+
+Common CMake options include:
+
+ -D BUILD_SHARED_LIBS=OFF # build static libraries
+ -D CMAKE_BUILD_TYPE=Release # specify build type
+ -D CMAKE_INSTALL_PREFIX=/usr/local # specify the install path
+ -D LIBXML2_WITH_ICONV=OFF # disable iconv
+ -D LIBXML2_WITH_LZMA=OFF # disable liblzma
+ -D LIBXML2_WITH_PYTHON=OFF # disable Python
+ -D LIBXML2_WITH_ZLIB=OFF # disable libz
+
+You can also open the libxml source directory with its CMakeLists.txt
+directly in various IDEs such as CLion, QtCreator, or Visual Studio.
+
+## Dependencies
+
+Libxml does not require any other libraries. A platform with somewhat
+recent POSIX support should be sufficient (please report any violation
+to this rule you may find).
+
+However, if found at configuration time, libxml will detect and use
+the following libraries:
+
+- [libz](https://zlib.net/), a highly portable and widely available
+ compression library.
+- [liblzma](https://tukaani.org/xz/), another compression library.
+- [libiconv](https://www.gnu.org/software/libiconv/), a character encoding
+ conversion library. The iconv function is part of POSIX.1-2001, so
+ libiconv isn't required on modern UNIX-like systems like Linux, BSD or
+ macOS.
+- [ICU](https://icu.unicode.org/), a Unicode library. Mainly useful as an
+ alternative to iconv on Windows. Unnecessary on most other systems.
+
+## Contributing
+
+The current version of the code can be found in GNOME's GitLab at
+at <https://gitlab.gnome.org/GNOME/libxml2>. The best way to get involved
+is by creating issues and merge requests on GitLab. Alternatively, you can
+start discussions and send patches to the mailing list. If you want to
+work with patches, please format them with git-format-patch and use plain
+text attachments.
+
+All code must conform to C89 and pass the GitLab CI tests. Add regression
+tests if possible.
+
+## Authors
+
+- Daniel Veillard
+- Bjorn Reese
+- William Brack
+- Igor Zlatkovic for the Windows port
+- Aleksey Sanin
+- Nick Wellnhofer
+
diff --git a/chromium/third_party/libxml/src/SAX2.c b/chromium/third_party/libxml/src/SAX2.c
index 9a093bcd88c..3d75751e4be 100644
--- a/chromium/third_party/libxml/src/SAX2.c
+++ b/chromium/third_party/libxml/src/SAX2.c
@@ -28,10 +28,9 @@
#include <libxml/HTMLtree.h>
#include <libxml/globals.h>
-/* Define SIZE_T_MAX unless defined through <limits.h>. */
-#ifndef SIZE_T_MAX
-# define SIZE_T_MAX ((size_t)-1)
-#endif /* !SIZE_T_MAX */
+#include "private/error.h"
+#include "private/parser.h"
+#include "private/tree.h"
/* #define DEBUG_SAX2 */
/* #define DEBUG_SAX2_TREE */
@@ -1034,7 +1033,7 @@ xmlSAX2EndDocument(void *ctx)
}
}
-#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
+#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
/**
* xmlNsErrMsg:
* @ctxt: an XML parser context
@@ -1643,8 +1642,8 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
ctxt->nodemem = -1;
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
- if (ctxt->input->line < USHRT_MAX)
- ret->line = (unsigned short) ctxt->input->line;
+ if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+ ret->line = ctxt->input->line;
else
ret->line = USHRT_MAX;
}
@@ -1908,8 +1907,8 @@ skip:
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
- if (ctxt->input->line < USHRT_MAX)
- ret->line = (unsigned short) ctxt->input->line;
+ if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+ ret->line = ctxt->input->line;
else {
ret->line = USHRT_MAX;
if (ctxt->options & XML_PARSE_BIG_LINES)
@@ -2159,7 +2158,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
*
* Open issue: normalization of the value.
*/
-#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
+#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_VALID_ENABLED
if (xmlValidateNCName(content, 1) != 0) {
xmlErrValid(ctxt, XML_DTD_XMLID_VALUE,
@@ -2286,8 +2285,8 @@ xmlSAX2StartElementNs(void *ctx,
}
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
- if (ctxt->input->line < USHRT_MAX)
- ret->line = (unsigned short) ctxt->input->line;
+ if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+ ret->line = ctxt->input->line;
else
ret->line = USHRT_MAX;
}
@@ -2596,22 +2595,23 @@ xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len,
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: xmlStrdup returned NULL");
return;
}
- if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) &&
+ if (ctxt->nodelen > INT_MAX - len) {
+ xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
+ return;
+ }
+ if ((ctxt->nodelen + len > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node");
return;
}
- if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len ||
- (size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) {
- xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
- return;
- }
if (ctxt->nodelen + len >= ctxt->nodemem) {
xmlChar *newbuf;
- size_t size;
+ int size;
- size = ctxt->nodemem + len;
- size *= 2;
+ size = ctxt->nodemem > INT_MAX - len ?
+ INT_MAX :
+ ctxt->nodemem + len;
+ size = size > INT_MAX / 2 ? INT_MAX : size * 2;
newbuf = (xmlChar *) xmlRealloc(lastChild->content,size);
if (newbuf == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters");
@@ -2633,9 +2633,10 @@ xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len,
}
} else {
/* Mixed content, first time */
- if (type == XML_TEXT_NODE)
+ if (type == XML_TEXT_NODE) {
lastChild = xmlSAX2TextNode(ctxt, ch, len);
- else
+ lastChild->doc = ctxt->myDoc;
+ } else
lastChild = xmlNewCDataBlock(ctxt->myDoc, ch, len);
if (lastChild != NULL) {
xmlAddChild(ctxt->node, lastChild);
@@ -2709,8 +2710,8 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
- if (ctxt->input->line < USHRT_MAX)
- ret->line = (unsigned short) ctxt->input->line;
+ if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+ ret->line = ctxt->input->line;
else
ret->line = USHRT_MAX;
}
@@ -2769,8 +2770,8 @@ xmlSAX2Comment(void *ctx, const xmlChar *value)
if (ret == NULL) return;
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
- if (ctxt->input->line < USHRT_MAX)
- ret->line = (unsigned short) ctxt->input->line;
+ if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+ ret->line = ctxt->input->line;
else
ret->line = USHRT_MAX;
}
@@ -2828,6 +2829,8 @@ static int xmlSAX2DefaultVersionValue = 2;
* xmlSAXDefaultVersion:
* @version: the version, 1 or 2
*
+ * DEPRECATED: Use parser option XML_PARSE_SAX1.
+ *
* Set the default version of SAX used globally by the library.
* By default, during initialization the default is set to 2.
* Note that it is generally a better coding style to use
@@ -2928,6 +2931,9 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
/**
* xmlDefaultSAXHandlerInit:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* Initialize the default SAX2 handler
*/
void
@@ -2986,70 +2992,17 @@ xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
/**
* htmlDefaultSAXHandlerInit:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* Initialize the default SAX handler
*/
void
htmlDefaultSAXHandlerInit(void)
{
+#ifdef LIBXML_SAX1_ENABLED
xmlSAX2InitHtmlDefaultSAXHandler((xmlSAXHandlerPtr) &htmlDefaultSAXHandler);
+#endif
}
#endif /* LIBXML_HTML_ENABLED */
-
-#ifdef LIBXML_DOCB_ENABLED
-
-/**
- * xmlSAX2InitDocbDefaultSAXHandler:
- * @hdlr: the SAX handler
- *
- * Initialize the default DocBook SAX2 handler
- */
-void
-xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr)
-{
- if ((hdlr == NULL) || (hdlr->initialized != 0))
- return;
-
- hdlr->internalSubset = xmlSAX2InternalSubset;
- hdlr->externalSubset = NULL;
- hdlr->isStandalone = xmlSAX2IsStandalone;
- hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
- hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
- hdlr->resolveEntity = xmlSAX2ResolveEntity;
- hdlr->getEntity = xmlSAX2GetEntity;
- hdlr->getParameterEntity = NULL;
- hdlr->entityDecl = xmlSAX2EntityDecl;
- hdlr->attributeDecl = NULL;
- hdlr->elementDecl = NULL;
- hdlr->notationDecl = NULL;
- hdlr->unparsedEntityDecl = NULL;
- hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
- hdlr->startDocument = xmlSAX2StartDocument;
- hdlr->endDocument = xmlSAX2EndDocument;
- hdlr->startElement = xmlSAX2StartElement;
- hdlr->endElement = xmlSAX2EndElement;
- hdlr->reference = xmlSAX2Reference;
- hdlr->characters = xmlSAX2Characters;
- hdlr->cdataBlock = NULL;
- hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
- hdlr->processingInstruction = NULL;
- hdlr->comment = xmlSAX2Comment;
- hdlr->warning = xmlParserWarning;
- hdlr->error = xmlParserError;
- hdlr->fatalError = xmlParserError;
-
- hdlr->initialized = 1;
-}
-
-/**
- * docbDefaultSAXHandlerInit:
- *
- * Initialize the default SAX handler
- */
-void
-docbDefaultSAXHandlerInit(void)
-{
- xmlSAX2InitDocbDefaultSAXHandler((xmlSAXHandlerPtr) &docbDefaultSAXHandler);
-}
-
-#endif /* LIBXML_DOCB_ENABLED */
diff --git a/chromium/third_party/libxml/src/aclocal.m4 b/chromium/third_party/libxml/src/aclocal.m4
index d6ebff56ff2..c4525a68b5d 100644
--- a/chromium/third_party/libxml/src/aclocal.m4
+++ b/chromium/third_party/libxml/src/aclocal.m4
@@ -1122,6 +1122,350 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# ---------------------------------------------------------------------------
+# Adds support for distributing Python modules and packages. To
+# install modules, copy them to $(pythondir), using the python_PYTHON
+# automake variable. To install a package with the same name as the
+# automake package, install to $(pkgpythondir), or use the
+# pkgpython_PYTHON automake variable.
+#
+# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
+# locations to install python extension modules (shared libraries).
+# Another macro is required to find the appropriate flags to compile
+# extension modules.
+#
+# If your package is configured with a different prefix to python,
+# users will have to add the install directory to the PYTHONPATH
+# environment variable, or create a .pth file (see the python
+# documentation for details).
+#
+# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
+# cause an error if the version of python installed on the system
+# doesn't meet the requirement. MINIMUM-VERSION should consist of
+# numbers and dots only.
+AC_DEFUN([AM_PATH_PYTHON],
+ [
+ dnl Find a Python interpreter. Python versions prior to 2.0 are not
+ dnl supported. (2.0 was released on October 16, 2000).
+ m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
+[python python2 python3 dnl
+ python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl
+ python3.2 python3.1 python3.0 dnl
+ python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl
+ python2.0])
+
+ AC_ARG_VAR([PYTHON], [the Python interpreter])
+
+ m4_if([$1],[],[
+ dnl No version check is needed.
+ # Find any Python interpreter.
+ if test -z "$PYTHON"; then
+ AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
+ fi
+ am_display_PYTHON=python
+ ], [
+ dnl A version check is needed.
+ if test -n "$PYTHON"; then
+ # If the user set $PYTHON, use it and don't search something else.
+ AC_MSG_CHECKING([whether $PYTHON version is >= $1])
+ AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Python interpreter is too old])])
+ am_display_PYTHON=$PYTHON
+ else
+ # Otherwise, try each interpreter until we find one that satisfies
+ # VERSION.
+ AC_CACHE_CHECK([for a Python interpreter with version >= $1],
+ [am_cv_pathless_PYTHON],[
+ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
+ test "$am_cv_pathless_PYTHON" = none && break
+ AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
+ done])
+ # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
+ if test "$am_cv_pathless_PYTHON" = none; then
+ PYTHON=:
+ else
+ AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
+ fi
+ am_display_PYTHON=$am_cv_pathless_PYTHON
+ fi
+ ])
+
+ if test "$PYTHON" = :; then
+ dnl Run any user-specified action, or abort.
+ m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
+ else
+
+ dnl Query Python for its version number. Although site.py simply uses
+ dnl sys.version[:3], printing that failed with Python 3.10, since the
+ dnl trailing zero was eliminated. So now we output just the major
+ dnl and minor version numbers, as numbers. Apparently the tertiary
+ dnl version is not of interest.
+ dnl
+ AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
+ [am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`])
+ AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
+
+ dnl At times, e.g., when building shared libraries, you may want
+ dnl to know which OS platform Python thinks this is.
+ dnl
+ AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
+ [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
+ AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
+
+ dnl emacs-page
+ dnl If --with-python-sys-prefix is given, use the values of sys.prefix
+ dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX
+ dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and
+ dnl ${exec_prefix} variables.
+ dnl
+ dnl The two are made distinct variables so they can be overridden if
+ dnl need be, although general consensus is that you shouldn't need
+ dnl this separation.
+ dnl
+ dnl Also allow directly setting the prefixes via configure options,
+ dnl overriding any default.
+ dnl
+ if test "x$prefix" = xNONE; then
+ am__usable_prefix=$ac_default_prefix
+ else
+ am__usable_prefix=$prefix
+ fi
+
+ # Allow user to request using sys.* values from Python,
+ # instead of the GNU $prefix values.
+ AC_ARG_WITH([python-sys-prefix],
+ [AS_HELP_STRING([--with-python-sys-prefix],
+ [use Python's sys.prefix and sys.exec_prefix values])],
+ [am_use_python_sys=:],
+ [am_use_python_sys=false])
+
+ # Allow user to override whatever the default Python prefix is.
+ AC_ARG_WITH([python_prefix],
+ [AS_HELP_STRING([--with-python_prefix],
+ [override the default PYTHON_PREFIX])],
+ [am_python_prefix_subst=$withval
+ am_cv_python_prefix=$withval
+ AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix])
+ AC_MSG_RESULT([$am_cv_python_prefix])],
+ [
+ if $am_use_python_sys; then
+ # using python sys.prefix value, not GNU
+ AC_CACHE_CHECK([for python default $am_display_PYTHON prefix],
+ [am_cv_python_prefix],
+ [am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`])
+
+ dnl If sys.prefix is a subdir of $prefix, replace the literal value of
+ dnl $prefix with a variable reference so it can be overridden.
+ case $am_cv_python_prefix in
+ $am__usable_prefix*)
+ am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'`
+ am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"`
+ ;;
+ *)
+ am_python_prefix_subst=$am_cv_python_prefix
+ ;;
+ esac
+ else # using GNU prefix value, not python sys.prefix
+ am_python_prefix_subst='${prefix}'
+ am_python_prefix=$am_python_prefix_subst
+ AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix])
+ AC_MSG_RESULT([$am_python_prefix])
+ fi])
+ # Substituting python_prefix_subst value.
+ AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst])
+
+ # emacs-page Now do it all over again for Python exec_prefix, but with yet
+ # another conditional: fall back to regular prefix if that was specified.
+ AC_ARG_WITH([python_exec_prefix],
+ [AS_HELP_STRING([--with-python_exec_prefix],
+ [override the default PYTHON_EXEC_PREFIX])],
+ [am_python_exec_prefix_subst=$withval
+ am_cv_python_exec_prefix=$withval
+ AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix])
+ AC_MSG_RESULT([$am_cv_python_exec_prefix])],
+ [
+ # no explicit --with-python_exec_prefix, but if
+ # --with-python_prefix was given, use its value for python_exec_prefix too.
+ AS_IF([test -n "$with_python_prefix"],
+ [am_python_exec_prefix_subst=$with_python_prefix
+ am_cv_python_exec_prefix=$with_python_prefix
+ AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix])
+ AC_MSG_RESULT([$am_cv_python_exec_prefix])],
+ [
+ # Set am__usable_exec_prefix whether using GNU or Python values,
+ # since we use that variable for pyexecdir.
+ if test "x$exec_prefix" = xNONE; then
+ am__usable_exec_prefix=$am__usable_prefix
+ else
+ am__usable_exec_prefix=$exec_prefix
+ fi
+ #
+ if $am_use_python_sys; then # using python sys.exec_prefix, not GNU
+ AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix],
+ [am_cv_python_exec_prefix],
+ [am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`])
+ dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the
+ dnl literal value of $exec_prefix with a variable reference so it can
+ dnl be overridden.
+ case $am_cv_python_exec_prefix in
+ $am__usable_exec_prefix*)
+ am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'`
+ am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"`
+ ;;
+ *)
+ am_python_exec_prefix_subst=$am_cv_python_exec_prefix
+ ;;
+ esac
+ else # using GNU $exec_prefix, not python sys.exec_prefix
+ am_python_exec_prefix_subst='${exec_prefix}'
+ am_python_exec_prefix=$am_python_exec_prefix_subst
+ AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix])
+ AC_MSG_RESULT([$am_python_exec_prefix])
+ fi])])
+ # Substituting python_exec_prefix_subst.
+ AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst])
+
+ # Factor out some code duplication into this shell variable.
+ am_python_setup_sysconfig="\
+import sys
+# Prefer sysconfig over distutils.sysconfig, for better compatibility
+# with python 3.x. See automake bug#10227.
+try:
+ import sysconfig
+except ImportError:
+ can_use_sysconfig = 0
+else:
+ can_use_sysconfig = 1
+# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
+# <https://github.com/pypa/virtualenv/issues/118>
+try:
+ from platform import python_implementation
+ if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
+ can_use_sysconfig = 0
+except ImportError:
+ pass"
+
+ dnl emacs-page Set up 4 directories:
+
+ dnl 1. pythondir: where to install python scripts. This is the
+ dnl site-packages directory, not the python standard library
+ dnl directory like in previous automake betas. This behavior
+ dnl is more consistent with lispdir.m4 for example.
+ dnl Query distutils for this directory.
+ dnl
+ AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)],
+ [am_cv_python_pythondir],
+ [if test "x$am_cv_python_prefix" = x; then
+ am_py_prefix=$am__usable_prefix
+ else
+ am_py_prefix=$am_cv_python_prefix
+ fi
+ am_cv_python_pythondir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+ sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+else:
+ from distutils import sysconfig
+ sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
+ #
+ case $am_cv_python_pythondir in
+ $am_py_prefix*)
+ am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
+ am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"`
+ ;;
+ *)
+ case $am_py_prefix in
+ /usr|/System*) ;;
+ *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
+ ;;
+ esac
+ ;;
+ esac
+ ])
+ AC_SUBST([pythondir], [$am_cv_python_pythondir])
+
+ dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was
+ dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
+ dnl more consistent with the rest of automake.
+ dnl
+ AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
+
+ dnl 3. pyexecdir: directory for installing python extension modules
+ dnl (shared libraries).
+ dnl Query distutils for this directory.
+ dnl
+ AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)],
+ [am_cv_python_pyexecdir],
+ [if test "x$am_cv_python_exec_prefix" = x; then
+ am_py_exec_prefix=$am__usable_exec_prefix
+ else
+ am_py_exec_prefix=$am_cv_python_exec_prefix
+ fi
+ am_cv_python_pyexecdir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+ sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'})
+else:
+ from distutils import sysconfig
+ sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')
+sys.stdout.write(sitedir)"`
+ #
+ case $am_cv_python_pyexecdir in
+ $am_py_exec_prefix*)
+ am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
+ am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"`
+ ;;
+ *)
+ case $am_py_exec_prefix in
+ /usr|/System*) ;;
+ *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
+ ;;
+ esac
+ ;;
+ esac
+ ])
+ AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
+
+ dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE)
+ dnl
+ AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
+
+ dnl Run any user-specified action.
+ $2
+ fi
+])
+
+
+# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# ---------------------------------------------------------------------------
+# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
+# Run ACTION-IF-FALSE otherwise.
+# This test uses sys.hexversion instead of the string equivalent (first
+# word of sys.version), in order to cope with versions such as 2.2c1.
+# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
+AC_DEFUN([AM_PYTHON_CHECK_VERSION],
+ [prog="import sys
+# split strings by '.' and convert to numeric. Append some zeros
+# because we need at least 4 digits for the hex conversion.
+# map returns an iterator in Python 3.0 and a list in 2.x
+minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
+minverhex = 0
+# xrange is not present in Python 3.0 and range returns an iterator
+for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(sys.hexversion < minverhex)"
+ AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
+
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@@ -1460,9 +1804,9 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
+m4_include([m4/ac_try_compile2.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
-m4_include([acinclude.m4])
diff --git a/chromium/third_party/libxml/src/buf.c b/chromium/third_party/libxml/src/buf.c
index f43565405f9..9b2a7d198ff 100644
--- a/chromium/third_party/libxml/src/buf.c
+++ b/chromium/third_party/libxml/src/buf.c
@@ -24,7 +24,13 @@
#include <libxml/globals.h>
#include <libxml/tree.h>
#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
-#include "buf.h"
+
+#include "private/buf.h"
+#include "private/error.h"
+
+#ifndef SIZE_MAX
+#define SIZE_MAX ((size_t) -1)
+#endif
#define WITH_BUFFER_COMPAT
@@ -123,14 +129,13 @@ xmlBufCreate(void) {
xmlBufMemoryError(NULL, "creating buffer");
return(NULL);
}
- ret->compat_use = 0;
ret->use = 0;
ret->error = 0;
ret->buffer = NULL;
ret->size = xmlDefaultBufferSize;
- ret->compat_size = xmlDefaultBufferSize;
+ UPDATE_COMPAT(ret);
ret->alloc = xmlBufferAllocScheme;
- ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
+ ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
if (ret->content == NULL) {
xmlBufMemoryError(ret, "creating buffer");
xmlFree(ret);
@@ -152,20 +157,21 @@ xmlBufPtr
xmlBufCreateSize(size_t size) {
xmlBufPtr ret;
+ if (size == SIZE_MAX)
+ return(NULL);
ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf));
if (ret == NULL) {
xmlBufMemoryError(NULL, "creating buffer");
return(NULL);
}
- ret->compat_use = 0;
ret->use = 0;
ret->error = 0;
ret->buffer = NULL;
ret->alloc = xmlBufferAllocScheme;
- ret->size = (size ? size+2 : 0); /* +1 for ending null */
- ret->compat_size = (int) ret->size;
+ ret->size = (size ? size + 1 : 0); /* +1 for ending null */
+ UPDATE_COMPAT(ret);
if (ret->size){
- ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
+ ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
if (ret->content == NULL) {
xmlBufMemoryError(ret, "creating buffer");
xmlFree(ret);
@@ -205,8 +211,7 @@ xmlBufDetach(xmlBufPtr buf) {
buf->content = NULL;
buf->size = 0;
buf->use = 0;
- buf->compat_use = 0;
- buf->compat_size = 0;
+ UPDATE_COMPAT(buf);
return ret;
}
@@ -235,15 +240,9 @@ xmlBufCreateStatic(void *mem, size_t size) {
xmlBufMemoryError(NULL, "creating buffer");
return(NULL);
}
- if (size < INT_MAX) {
- ret->compat_use = size;
- ret->compat_size = size;
- } else {
- ret->compat_use = INT_MAX;
- ret->compat_size = INT_MAX;
- }
ret->use = size;
ret->size = size;
+ UPDATE_COMPAT(ret);
ret->alloc = XML_BUFFER_ALLOC_IMMUTABLE;
ret->content = (xmlChar *) mem;
ret->error = 0;
@@ -438,29 +437,25 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
- if (buf->use + len < buf->size)
- return(buf->size - buf->use);
+ if (len < buf->size - buf->use)
+ return(buf->size - buf->use - 1);
+ if (len >= SIZE_MAX - buf->use) {
+ xmlBufMemoryError(buf, "growing buffer past SIZE_MAX");
+ return(0);
+ }
- /*
- * Windows has a BIG problem on realloc timing, so we try to double
- * the buffer size (if that's enough) (bug 146697)
- * Apparently BSD too, and it's probably best for linux too
- * On an embedded system this may be something to change
- */
-#if 1
- if (buf->size > (size_t) len)
- size = buf->size * 2;
- else
- size = buf->use + len + 100;
-#else
- size = buf->use + len + 100;
-#endif
+ if (buf->size > (size_t) len) {
+ size = buf->size > SIZE_MAX / 2 ? SIZE_MAX : buf->size * 2;
+ } else {
+ size = buf->use + len;
+ size = size > SIZE_MAX - 100 ? SIZE_MAX : size + 100;
+ }
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
/*
* Used to provide parsing limits
*/
- if ((buf->use + len >= XML_MAX_TEXT_LENGTH) ||
+ if ((buf->use + len + 1 >= XML_MAX_TEXT_LENGTH) ||
(buf->size >= XML_MAX_TEXT_LENGTH)) {
xmlBufMemoryError(buf, "buffer error: text too long\n");
return(0);
@@ -488,7 +483,7 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
}
buf->size = size;
UPDATE_COMPAT(buf)
- return(buf->size - buf->use);
+ return(buf->size - buf->use - 1);
}
/**
@@ -511,25 +506,7 @@ xmlBufGrow(xmlBufPtr buf, int len) {
ret = xmlBufGrowInternal(buf, len);
if (buf->error != 0)
return(-1);
- return((int) ret);
-}
-
-/**
- * xmlBufInflate:
- * @buf: the buffer
- * @len: the minimum extra free size to allocate
- *
- * Grow the available space of an XML buffer, adding at least @len bytes
- *
- * Returns 0 if successful or -1 in case of error
- */
-int
-xmlBufInflate(xmlBufPtr buf, size_t len) {
- if (buf == NULL) return(-1);
- xmlBufGrowInternal(buf, len + buf->size);
- if (buf->error)
- return(-1);
- return(0);
+ return(ret > INT_MAX ? INT_MAX : ret);
}
/**
@@ -561,7 +538,7 @@ xmlBufDump(FILE *file, xmlBufPtr buf) {
CHECK_COMPAT(buf)
if (file == NULL)
file = stdout;
- ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file);
+ ret = fwrite(buf->content, 1, buf->use, file);
return(ret);
}
@@ -618,34 +595,9 @@ xmlBufAddLen(xmlBufPtr buf, size_t len) {
if ((buf == NULL) || (buf->error))
return(-1);
CHECK_COMPAT(buf)
- if (len > (buf->size - buf->use))
+ if (len >= (buf->size - buf->use))
return(-1);
buf->use += len;
- UPDATE_COMPAT(buf)
- if (buf->size > buf->use)
- buf->content[buf->use] = 0;
- else
- return(-1);
- return(0);
-}
-
-/**
- * xmlBufErase:
- * @buf: the buffer
- * @len: the size to erase at the end
- *
- * Sometime data need to be erased at the end of the buffer
- *
- * Returns -1 in case of error and 0 otherwise
- */
-int
-xmlBufErase(xmlBufPtr buf, size_t len) {
- if ((buf == NULL) || (buf->error))
- return(-1);
- CHECK_COMPAT(buf)
- if (len > buf->use)
- return(-1);
- buf->use -= len;
buf->content[buf->use] = 0;
UPDATE_COMPAT(buf)
return(0);
@@ -694,10 +646,11 @@ xmlBufUse(const xmlBufPtr buf)
* @buf: the buffer
*
* Function to find how much free space is allocated but not
- * used in the buffer. It does not account for the terminating zero
- * usually needed
+ * used in the buffer. It reserves one byte for the NUL
+ * terminator character that is usually needed, so there is
+ * no need to subtract 1 from the result anymore.
*
- * Returns the amount or 0 if none or an error occurred
+ * Returns the amount, or 0 if none or if an error occurred.
*/
size_t
@@ -707,7 +660,7 @@ xmlBufAvail(const xmlBufPtr buf)
return 0;
CHECK_COMPAT(buf)
- return(buf->size - buf->use);
+ return((buf->size > buf->use) ? (buf->size - buf->use - 1) : 0);
}
/**
@@ -740,7 +693,7 @@ xmlBufIsEmpty(const xmlBufPtr buf)
int
xmlBufResize(xmlBufPtr buf, size_t size)
{
- unsigned int newSize;
+ size_t newSize;
xmlChar* rebuf = NULL;
size_t start_buf;
@@ -768,9 +721,13 @@ xmlBufResize(xmlBufPtr buf, size_t size)
case XML_BUFFER_ALLOC_IO:
case XML_BUFFER_ALLOC_DOUBLEIT:
/*take care of empty case*/
- newSize = (buf->size ? buf->size*2 : size + 10);
+ if (buf->size == 0) {
+ newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10);
+ } else {
+ newSize = buf->size;
+ }
while (size > newSize) {
- if (newSize > UINT_MAX / 2) {
+ if (newSize > SIZE_MAX / 2) {
xmlBufMemoryError(buf, "growing buffer");
return 0;
}
@@ -778,15 +735,15 @@ xmlBufResize(xmlBufPtr buf, size_t size)
}
break;
case XML_BUFFER_ALLOC_EXACT:
- newSize = size+10;
+ newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10);
break;
case XML_BUFFER_ALLOC_HYBRID:
if (buf->use < BASE_BUFFER_SIZE)
newSize = size;
else {
- newSize = buf->size * 2;
+ newSize = buf->size;
while (size > newSize) {
- if (newSize > UINT_MAX / 2) {
+ if (newSize > SIZE_MAX / 2) {
xmlBufMemoryError(buf, "growing buffer");
return 0;
}
@@ -796,7 +753,7 @@ xmlBufResize(xmlBufPtr buf, size_t size)
break;
default:
- newSize = size+10;
+ newSize = (size > SIZE_MAX - 10 ? SIZE_MAX : size + 10);
break;
}
@@ -821,6 +778,8 @@ xmlBufResize(xmlBufPtr buf, size_t size)
} else {
if (buf->content == NULL) {
rebuf = (xmlChar *) xmlMallocAtomic(newSize);
+ buf->use = 0;
+ rebuf[buf->use] = 0;
} else if (buf->size - buf->use < 100) {
rebuf = (xmlChar *) xmlRealloc(buf->content, newSize);
} else {
@@ -862,7 +821,7 @@ xmlBufResize(xmlBufPtr buf, size_t size)
*/
int
xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
- unsigned int needSize;
+ size_t needSize;
if ((str == NULL) || (buf == NULL) || (buf->error))
return -1;
@@ -884,88 +843,13 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
if (len < 0) return -1;
if (len == 0) return 0;
- needSize = buf->use + len + 2;
- if (needSize > buf->size){
- if (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;
+ /* Note that both buf->size and buf->use can be zero here. */
+ if ((size_t) len >= buf->size - buf->use) {
+ if ((size_t) len >= SIZE_MAX - buf->use) {
+ xmlBufMemoryError(buf, "growing buffer past SIZE_MAX");
+ return(-1);
}
- }
-
- memmove(&buf->content[buf->use], str, len*sizeof(xmlChar));
- buf->use += len;
- buf->content[buf->use] = 0;
- UPDATE_COMPAT(buf)
- return 0;
-}
-
-/**
- * xmlBufAddHead:
- * @buf: the buffer
- * @str: the #xmlChar string
- * @len: the number of #xmlChar to add
- *
- * Add a string range to the beginning of an XML buffer.
- * if len == -1, the length of @str is recomputed.
- *
- * Returns 0 successful, a positive error code number otherwise
- * and -1 in case of internal or API error.
- */
-int
-xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
- unsigned int needSize;
-
- if ((buf == NULL) || (buf->error))
- return(-1);
- CHECK_COMPAT(buf)
- if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
- if (str == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufAddHead: str == NULL\n");
-#endif
- return -1;
- }
- if (len < -1) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufAddHead: len < 0\n");
-#endif
- return -1;
- }
- if (len == 0) return 0;
-
- if (len < 0)
- len = xmlStrlen(str);
-
- if (len <= 0) return -1;
-
- if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
- size_t start_buf = buf->content - buf->contentIO;
-
- if (start_buf > (unsigned int) len) {
- /*
- * We can add it in the space previously shrunk
- */
- buf->content -= len;
- memmove(&buf->content[0], str, len);
- buf->use += len;
- buf->size += len;
- UPDATE_COMPAT(buf)
- return(0);
- }
- }
- needSize = buf->use + len + 2;
- if (needSize > buf->size){
+ needSize = buf->use + len + 1;
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
/*
* Used to provide parsing limits
@@ -981,8 +865,7 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
}
}
- memmove(&buf->content[len], &buf->content[0], buf->use);
- memmove(&buf->content[0], str, len);
+ memmove(&buf->content[buf->use], str, len);
buf->use += len;
buf->content[buf->use] = 0;
UPDATE_COMPAT(buf)
@@ -1021,77 +904,10 @@ xmlBufCat(xmlBufPtr buf, const xmlChar *str) {
*/
int
xmlBufCCat(xmlBufPtr buf, const char *str) {
- const char *cur;
-
- if ((buf == NULL) || (buf->error))
- return(-1);
- CHECK_COMPAT(buf)
- if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
- if (str == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufCCat: str == NULL\n");
-#endif
- return -1;
- }
- for (cur = str;*cur != 0;cur++) {
- if (buf->use + 10 >= buf->size) {
- if (!xmlBufResize(buf, buf->use+10)){
- xmlBufMemoryError(buf, "growing buffer");
- return XML_ERR_NO_MEMORY;
- }
- }
- buf->content[buf->use++] = *cur;
- }
- buf->content[buf->use] = 0;
- UPDATE_COMPAT(buf)
- return 0;
+ return xmlBufCat(buf, (const xmlChar *) str);
}
/**
- * xmlBufWriteCHAR:
- * @buf: the XML buffer
- * @string: the string to add
- *
- * routine which manages and grows an output buffer. This one adds
- * xmlChars at the end of the buffer.
- *
- * Returns 0 if successful, a positive error code number otherwise
- * and -1 in case of internal or API error.
- */
-int
-xmlBufWriteCHAR(xmlBufPtr buf, const xmlChar *string) {
- if ((buf == NULL) || (buf->error))
- return(-1);
- CHECK_COMPAT(buf)
- if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
- return(-1);
- return(xmlBufCat(buf, string));
-}
-
-/**
- * xmlBufWriteChar:
- * @buf: the XML buffer output
- * @string: the string to add
- *
- * routine which manage and grows an output buffer. This one add
- * C chars at the end of the array.
- *
- * Returns 0 if successful, a positive error code number otherwise
- * and -1 in case of internal or API error.
- */
-int
-xmlBufWriteChar(xmlBufPtr buf, const char *string) {
- if ((buf == NULL) || (buf->error))
- return(-1);
- CHECK_COMPAT(buf)
- if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
- return(-1);
- return(xmlBufCCat(buf, string));
-}
-
-
-/**
* xmlBufWriteQuotedString:
* @buf: the XML buffer output
* @string: the string to add
@@ -1173,8 +989,7 @@ xmlBufFromBuffer(xmlBufferPtr buffer) {
}
ret->use = buffer->use;
ret->size = buffer->size;
- ret->compat_use = buffer->use;
- ret->compat_size = buffer->size;
+ UPDATE_COMPAT(ret);
ret->error = 0;
ret->buffer = buffer;
ret->alloc = buffer->alloc;
@@ -1229,11 +1044,11 @@ xmlBufBackToBuffer(xmlBufPtr buf) {
* Keep the buffer but provide a truncated size value.
*/
xmlBufOverflowError(buf, "Allocated size too big for xmlBuffer");
- ret->use = (int) buf->use;
+ ret->use = buf->use;
ret->size = INT_MAX;
} else {
- ret->use = (int) buf->use;
- ret->size = (int) buf->size;
+ ret->use = buf->use;
+ ret->size = buf->size;
}
ret->alloc = buf->alloc;
ret->content = buf->content;
diff --git a/chromium/third_party/libxml/src/check-relaxng-test-suite.py b/chromium/third_party/libxml/src/check-relaxng-test-suite.py
index f4a5a69a46e..87ec05005cd 100755
--- a/chromium/third_party/libxml/src/check-relaxng-test-suite.py
+++ b/chromium/third_party/libxml/src/check-relaxng-test-suite.py
@@ -1,9 +1,13 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import sys
import time
import os
-import string
-import StringIO
+try:
+ # Python 2
+ from StringIO import StringIO
+except ImportError:
+ # Python 3
+ from io import StringIO
sys.path.insert(0, "python")
import libxml2
@@ -45,10 +49,10 @@ resources = {}
def resolver(URL, ID, ctxt):
global resources
- if string.find(URL, '#') != -1:
- URL = URL[0:string.find(URL, '#')]
- if resources.has_key(URL):
- return(StringIO.StringIO(resources[URL]))
+ if URL.find('#') != -1:
+ URL = URL[0:URL.find('#')]
+ if URL in resources:
+ return(StringIO(resources[URL]))
log.write("Resolver failure: asked %s\n" % (URL))
log.write("resources: %s\n" % (resources))
return None
@@ -63,7 +67,7 @@ def resolver(URL, ID, ctxt):
# res = libxml2.parseFile(RES)
#except:
# log.write("Could not parse %s" % (RES))
-
+
#
# handle a valid instance
#
@@ -76,33 +80,33 @@ def handle_valid(node, schema):
child = node.children
while child != None:
if child.type != 'text':
- instance = instance + child.serialize()
- child = child.next
+ instance = instance + child.serialize()
+ child = child.next
try:
- doc = libxml2.parseDoc(instance)
+ doc = libxml2.parseDoc(instance)
except:
doc = None
- if doc == None:
+ if doc is None:
log.write("\nFailed to parse correct instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
- return
+ nb_instances_failed = nb_instances_failed + 1
+ return
try:
ctxt = schema.relaxNGNewValidCtxt()
- ret = doc.relaxNGValidateDoc(ctxt)
+ ret = doc.relaxNGValidateDoc(ctxt)
except:
ret = -1
if ret != 0:
log.write("\nFailed to validate correct instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
+ nb_instances_failed = nb_instances_failed + 1
else:
- nb_instances_success = nb_instances_success + 1
+ nb_instances_success = nb_instances_success + 1
doc.freeDoc()
#
@@ -117,32 +121,32 @@ def handle_invalid(node, schema):
child = node.children
while child != None:
if child.type != 'text':
- instance = instance + child.serialize()
- child = child.next
+ instance = instance + child.serialize()
+ child = child.next
try:
- doc = libxml2.parseDoc(instance)
+ doc = libxml2.parseDoc(instance)
except:
doc = None
- if doc == None:
+ if doc is None:
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- return
+ return
try:
ctxt = schema.relaxNGNewValidCtxt()
- ret = doc.relaxNGValidateDoc(ctxt)
+ ret = doc.relaxNGValidateDoc(ctxt)
except:
ret = -1
if ret == 0:
log.write("\nFailed to detect validation problem in instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
+ nb_instances_failed = nb_instances_failed + 1
else:
- nb_instances_success = nb_instances_success + 1
+ nb_instances_success = nb_instances_success + 1
doc.freeDoc()
#
@@ -157,23 +161,23 @@ def handle_correct(node):
child = node.children
while child != None:
if child.type != 'text':
- schema = schema + child.serialize()
- child = child.next
+ schema = schema + child.serialize()
+ child = child.next
try:
- rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
- rngs = rngp.relaxNGParse()
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
except:
rngs = None
- if rngs == None:
+ if rngs is None:
log.write("\nFailed to compile correct schema:\n-----\n")
- log.write(schema)
+ log.write(schema)
log.write("\n-----\n")
- nb_schemas_failed = nb_schemas_failed + 1
+ nb_schemas_failed = nb_schemas_failed + 1
else:
- nb_schemas_success = nb_schemas_success + 1
+ nb_schemas_success = nb_schemas_success + 1
return rngs
-
+
def handle_incorrect(node):
global log
global nb_schemas_success
@@ -183,24 +187,24 @@ def handle_incorrect(node):
child = node.children
while child != None:
if child.type != 'text':
- schema = schema + child.serialize()
- child = child.next
+ schema = schema + child.serialize()
+ child = child.next
try:
- rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
- rngs = rngp.relaxNGParse()
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs != None:
log.write("\nFailed to detect schema error in:\n-----\n")
- log.write(schema)
+ log.write(schema)
log.write("\n-----\n")
- nb_schemas_failed = nb_schemas_failed + 1
+ nb_schemas_failed = nb_schemas_failed + 1
else:
-# log.write("\nSuccess detecting schema error in:\n-----\n")
-# log.write(schema)
-# log.write("\n-----\n")
- nb_schemas_success = nb_schemas_success + 1
+# log.write("\nSuccess detecting schema error in:\n-----\n")
+# log.write(schema)
+# log.write("\n-----\n")
+ nb_schemas_success = nb_schemas_success + 1
return None
#
@@ -210,14 +214,14 @@ def handle_resource(node, dir):
global resources
try:
- name = node.prop('name')
+ name = node.prop('name')
except:
name = None
- if name == None or name == '':
+ if name is None or name == '':
log.write("resource has no name")
- return;
-
+ return;
+
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
@@ -226,8 +230,8 @@ def handle_resource(node, dir):
child = node.children
while child != None:
if child.type != 'text':
- res = res + child.serialize()
- child = child.next
+ res = res + child.serialize()
+ child = child.next
resources[name] = res
#
@@ -235,14 +239,14 @@ def handle_resource(node, dir):
#
def handle_dir(node, dir):
try:
- name = node.prop('name')
+ name = node.prop('name')
except:
name = None
- if name == None or name == '':
+ if name is None or name == '':
log.write("resource has no name")
- return;
-
+ return;
+
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
@@ -268,7 +272,7 @@ def handle_testCase(node):
nb_schemas_tests, node.lineNo(), sections))
resources = {}
if debug:
- print "test %d line %d" % (nb_schemas_tests, node.lineNo())
+ print("test %d line %d" % (nb_schemas_tests, node.lineNo()))
dirs = node.xpathEval('dir')
for dir in dirs:
@@ -280,27 +284,27 @@ def handle_testCase(node):
tsts = node.xpathEval('incorrect')
if tsts != []:
if len(tsts) != 1:
- print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
- schema = handle_incorrect(tsts[0])
+ print("warning test line %d has more than one <incorrect> example" %(node.lineNo()))
+ schema = handle_incorrect(tsts[0])
else:
tsts = node.xpathEval('correct')
- if tsts != []:
- if len(tsts) != 1:
- print "warning test line %d has more than one <correct> example"% (node.lineNo())
- schema = handle_correct(tsts[0])
- else:
- print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
+ if tsts != []:
+ if len(tsts) != 1:
+ print("warning test line %d has more than one <correct> example"% (node.lineNo()))
+ schema = handle_correct(tsts[0])
+ else:
+ print("warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo()))
nb_schemas_tests = nb_schemas_tests + 1;
-
+
valids = node.xpathEval('valid')
invalids = node.xpathEval('invalid')
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
if schema != None:
for valid in valids:
- handle_valid(valid, schema)
+ handle_valid(valid, schema)
for invalid in invalids:
- handle_invalid(invalid, schema)
+ handle_invalid(invalid, schema)
#
@@ -311,53 +315,53 @@ def handle_testSuite(node, level = 0):
global nb_instances_tests, nb_instances_success, nb_instances_failed
global quiet
if level >= 1:
- old_schemas_tests = nb_schemas_tests
- old_schemas_success = nb_schemas_success
- old_schemas_failed = nb_schemas_failed
- old_instances_tests = nb_instances_tests
- old_instances_success = nb_instances_success
- old_instances_failed = nb_instances_failed
+ old_schemas_tests = nb_schemas_tests
+ old_schemas_success = nb_schemas_success
+ old_schemas_failed = nb_schemas_failed
+ old_instances_tests = nb_instances_tests
+ old_instances_success = nb_instances_success
+ old_instances_failed = nb_instances_failed
docs = node.xpathEval('documentation')
authors = node.xpathEval('author')
if docs != []:
msg = ""
for doc in docs:
- msg = msg + doc.content + " "
- if authors != []:
- msg = msg + "written by "
- for author in authors:
- msg = msg + author.content + " "
- if quiet == 0:
- print msg
+ msg = msg + doc.content + " "
+ if authors != []:
+ msg = msg + "written by "
+ for author in authors:
+ msg = msg + author.content + " "
+ if quiet == 0:
+ print(msg)
sections = node.xpathEval('section')
if sections != [] and level <= 0:
msg = ""
for section in sections:
- msg = msg + section.content + " "
- if quiet == 0:
- print "Tests for section %s" % (msg)
+ msg = msg + section.content + " "
+ if quiet == 0:
+ print("Tests for section %s" % (msg))
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
handle_testSuite(test, level + 1)
-
+
if verbose and level >= 1 and sections != []:
msg = ""
for section in sections:
- msg = msg + section.content + " "
- print "Result of tests for section %s" % (msg)
+ msg = msg + section.content + " "
+ print("Result of tests for section %s" % (msg))
if nb_schemas_tests != old_schemas_tests:
- print "found %d test schemas: %d success %d failures" % (
- nb_schemas_tests - old_schemas_tests,
- nb_schemas_success - old_schemas_success,
- nb_schemas_failed - old_schemas_failed)
- if nb_instances_tests != old_instances_tests:
- print "found %d test instances: %d success %d failures" % (
- nb_instances_tests - old_instances_tests,
- nb_instances_success - old_instances_success,
- nb_instances_failed - old_instances_failed)
+ print("found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests - old_schemas_tests,
+ nb_schemas_success - old_schemas_success,
+ nb_schemas_failed - old_schemas_failed))
+ if nb_instances_tests != old_instances_tests:
+ print("found %d test instances: %d success %d failures" % (
+ nb_instances_tests - old_instances_tests,
+ nb_instances_success - old_instances_success,
+ nb_instances_failed - old_instances_failed))
#
# Parse the conf file
#
@@ -366,20 +370,20 @@ testsuite = libxml2.parseFile(CONF)
libxml2.setEntityLoader(resolver)
root = testsuite.getRootElement()
if root.name != 'testSuite':
- print "%s doesn't start with a testSuite element, aborting" % (CONF)
+ print("%s doesn't start with a testSuite element, aborting" % (CONF))
sys.exit(1)
if quiet == 0:
- print "Running Relax NG testsuite"
+ print("Running Relax NG testsuite")
handle_testSuite(root)
if quiet == 0:
- print "\nTOTAL:\n"
+ print("\nTOTAL:\n")
if quiet == 0 or nb_schemas_failed != 0:
- print "found %d test schemas: %d success %d failures" % (
- nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
+ print("found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests, nb_schemas_success, nb_schemas_failed))
if quiet == 0 or nb_instances_failed != 0:
- print "found %d test instances: %d success %d failures" % (
- nb_instances_tests, nb_instances_success, nb_instances_failed)
+ print("found %d test instances: %d success %d failures" % (
+ nb_instances_tests, nb_instances_success, nb_instances_failed))
testsuite.freeDoc()
@@ -388,7 +392,7 @@ libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
if quiet == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/chromium/third_party/libxml/src/check-relaxng-test-suite2.py b/chromium/third_party/libxml/src/check-relaxng-test-suite2.py
index 8618db7695d..559503a1297 100755
--- a/chromium/third_party/libxml/src/check-relaxng-test-suite2.py
+++ b/chromium/third_party/libxml/src/check-relaxng-test-suite2.py
@@ -1,9 +1,13 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import sys
import time
import os
-import string
-import StringIO
+try:
+ # Python 2
+ from StringIO import StringIO
+except ImportError:
+ # Python 3
+ from io import StringIO
sys.path.insert(0, "python")
import libxml2
@@ -34,8 +38,8 @@ resources = {}
def resolver(URL, ID, ctxt):
global resources
- if resources.has_key(URL):
- return(StringIO.StringIO(resources[URL]))
+ if URL in resources:
+ return(StringIO(resources[URL]))
log.write("Resolver failure: asked %s\n" % (URL))
log.write("resources: %s\n" % (resources))
return None
@@ -50,7 +54,7 @@ def resolver(URL, ID, ctxt):
# res = libxml2.parseFile(RES)
#except:
# log.write("Could not parse %s" % (RES))
-
+
#
# handle a valid instance
#
@@ -60,49 +64,49 @@ def handle_valid(node, schema):
global nb_instances_failed
instance = node.prop("dtd")
- if instance == None:
+ if instance is None:
instance = ""
child = node.children
while child != None:
if child.type != 'text':
- instance = instance + child.serialize()
- child = child.next
+ instance = instance + child.serialize()
+ child = child.next
# mem = libxml2.debugMemory(1);
try:
- doc = libxml2.parseDoc(instance)
+ doc = libxml2.parseDoc(instance)
except:
doc = None
- if doc == None:
+ if doc is None:
log.write("\nFailed to parse correct instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
- return
+ nb_instances_failed = nb_instances_failed + 1
+ return
if debug:
- print "instance line %d" % (node.lineNo())
-
+ print("instance line %d" % (node.lineNo()))
+
try:
ctxt = schema.relaxNGNewValidCtxt()
- ret = doc.relaxNGValidateDoc(ctxt)
- del ctxt
+ ret = doc.relaxNGValidateDoc(ctxt)
+ del ctxt
except:
ret = -1
doc.freeDoc()
# if mem != libxml2.debugMemory(1):
-# print "validating instance %d line %d leaks" % (
-# nb_instances_tests, node.lineNo())
+# print("validating instance %d line %d leaks" % (
+# nb_instances_tests, node.lineNo()))
if ret != 0:
log.write("\nFailed to validate correct instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
+ nb_instances_failed = nb_instances_failed + 1
else:
- nb_instances_success = nb_instances_success + 1
+ nb_instances_success = nb_instances_success + 1
#
# handle an invalid instance
@@ -113,34 +117,34 @@ def handle_invalid(node, schema):
global nb_instances_failed
instance = node.prop("dtd")
- if instance == None:
+ if instance is None:
instance = ""
child = node.children
while child != None:
if child.type != 'text':
- instance = instance + child.serialize()
- child = child.next
+ instance = instance + child.serialize()
+ child = child.next
# mem = libxml2.debugMemory(1);
try:
- doc = libxml2.parseDoc(instance)
+ doc = libxml2.parseDoc(instance)
except:
doc = None
- if doc == None:
+ if doc is None:
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- return
+ return
if debug:
- print "instance line %d" % (node.lineNo())
-
+ print("instance line %d" % (node.lineNo()))
+
try:
ctxt = schema.relaxNGNewValidCtxt()
- ret = doc.relaxNGValidateDoc(ctxt)
- del ctxt
+ ret = doc.relaxNGValidateDoc(ctxt)
+ del ctxt
except:
ret = -1
@@ -148,16 +152,16 @@ def handle_invalid(node, schema):
doc.freeDoc()
# mem2 = libxml2.debugMemory(1)
# if mem != mem2:
-# print "validating instance %d line %d leaks %d bytes" % (
-# nb_instances_tests, node.lineNo(), mem2 - mem)
-
+# print("validating instance %d line %d leaks %d bytes" % (
+# nb_instances_tests, node.lineNo(), mem2 - mem))
+
if ret == 0:
log.write("\nFailed to detect validation problem in instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
+ nb_instances_failed = nb_instances_failed + 1
else:
- nb_instances_success = nb_instances_success + 1
+ nb_instances_success = nb_instances_success + 1
#
# handle an incorrect test
@@ -171,23 +175,23 @@ def handle_correct(node):
child = node.children
while child != None:
if child.type != 'text':
- schema = schema + child.serialize()
- child = child.next
+ schema = schema + child.serialize()
+ child = child.next
try:
- rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
- rngs = rngp.relaxNGParse()
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
except:
rngs = None
- if rngs == None:
+ if rngs is None:
log.write("\nFailed to compile correct schema:\n-----\n")
- log.write(schema)
+ log.write(schema)
log.write("\n-----\n")
- nb_schemas_failed = nb_schemas_failed + 1
+ nb_schemas_failed = nb_schemas_failed + 1
else:
- nb_schemas_success = nb_schemas_success + 1
+ nb_schemas_success = nb_schemas_success + 1
return rngs
-
+
def handle_incorrect(node):
global log
global nb_schemas_success
@@ -197,24 +201,24 @@ def handle_incorrect(node):
child = node.children
while child != None:
if child.type != 'text':
- schema = schema + child.serialize()
- child = child.next
+ schema = schema + child.serialize()
+ child = child.next
try:
- rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
- rngs = rngp.relaxNGParse()
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs != None:
log.write("\nFailed to detect schema error in:\n-----\n")
- log.write(schema)
+ log.write(schema)
log.write("\n-----\n")
- nb_schemas_failed = nb_schemas_failed + 1
+ nb_schemas_failed = nb_schemas_failed + 1
else:
-# log.write("\nSuccess detecting schema error in:\n-----\n")
-# log.write(schema)
-# log.write("\n-----\n")
- nb_schemas_success = nb_schemas_success + 1
+# log.write("\nSuccess detecting schema error in:\n-----\n")
+# log.write(schema)
+# log.write("\n-----\n")
+ nb_schemas_success = nb_schemas_success + 1
return None
#
@@ -224,14 +228,14 @@ def handle_resource(node, dir):
global resources
try:
- name = node.prop('name')
+ name = node.prop('name')
except:
name = None
- if name == None or name == '':
+ if name is None or name == '':
log.write("resource has no name")
- return;
-
+ return;
+
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
@@ -240,8 +244,8 @@ def handle_resource(node, dir):
child = node.children
while child != None:
if child.type != 'text':
- res = res + child.serialize()
- child = child.next
+ res = res + child.serialize()
+ child = child.next
resources[name] = res
#
@@ -249,14 +253,14 @@ def handle_resource(node, dir):
#
def handle_dir(node, dir):
try:
- name = node.prop('name')
+ name = node.prop('name')
except:
name = None
- if name == None or name == '':
+ if name is None or name == '':
log.write("resource has no name")
- return;
-
+ return;
+
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
@@ -282,7 +286,7 @@ def handle_testCase(node):
nb_schemas_tests, node.lineNo(), sections))
resources = {}
if debug:
- print "test %d line %d" % (nb_schemas_tests, node.lineNo())
+ print("test %d line %d" % (nb_schemas_tests, node.lineNo()))
dirs = node.xpathEval('dir')
for dir in dirs:
@@ -294,27 +298,27 @@ def handle_testCase(node):
tsts = node.xpathEval('incorrect')
if tsts != []:
if len(tsts) != 1:
- print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
- schema = handle_incorrect(tsts[0])
+ print("warning test line %d has more than one <incorrect> example" %(node.lineNo()))
+ schema = handle_incorrect(tsts[0])
else:
tsts = node.xpathEval('correct')
- if tsts != []:
- if len(tsts) != 1:
- print "warning test line %d has more than one <correct> example"% (node.lineNo())
- schema = handle_correct(tsts[0])
- else:
- print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
+ if tsts != []:
+ if len(tsts) != 1:
+ print("warning test line %d has more than one <correct> example"% (node.lineNo()))
+ schema = handle_correct(tsts[0])
+ else:
+ print("warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo()))
nb_schemas_tests = nb_schemas_tests + 1;
-
+
valids = node.xpathEval('valid')
invalids = node.xpathEval('invalid')
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
if schema != None:
for valid in valids:
- handle_valid(valid, schema)
+ handle_valid(valid, schema)
for invalid in invalids:
- handle_invalid(invalid, schema)
+ handle_invalid(invalid, schema)
#
@@ -324,53 +328,53 @@ def handle_testSuite(node, level = 0):
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
global nb_instances_tests, nb_instances_success, nb_instances_failed
if level >= 1:
- old_schemas_tests = nb_schemas_tests
- old_schemas_success = nb_schemas_success
- old_schemas_failed = nb_schemas_failed
- old_instances_tests = nb_instances_tests
- old_instances_success = nb_instances_success
- old_instances_failed = nb_instances_failed
+ old_schemas_tests = nb_schemas_tests
+ old_schemas_success = nb_schemas_success
+ old_schemas_failed = nb_schemas_failed
+ old_instances_tests = nb_instances_tests
+ old_instances_success = nb_instances_success
+ old_instances_failed = nb_instances_failed
docs = node.xpathEval('documentation')
authors = node.xpathEval('author')
if docs != []:
msg = ""
for doc in docs:
- msg = msg + doc.content + " "
- if authors != []:
- msg = msg + "written by "
- for author in authors:
- msg = msg + author.content + " "
- if quiet == 0:
- print msg
+ msg = msg + doc.content + " "
+ if authors != []:
+ msg = msg + "written by "
+ for author in authors:
+ msg = msg + author.content + " "
+ if quiet == 0:
+ print(msg)
sections = node.xpathEval('section')
if sections != [] and level <= 0:
msg = ""
for section in sections:
- msg = msg + section.content + " "
- if quiet == 0:
- print "Tests for section %s" % (msg)
+ msg = msg + section.content + " "
+ if quiet == 0:
+ print("Tests for section %s" % (msg))
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
handle_testSuite(test, level + 1)
-
+
if level >= 1 and sections != []:
msg = ""
for section in sections:
- msg = msg + section.content + " "
- print "Result of tests for section %s" % (msg)
+ msg = msg + section.content + " "
+ print("Result of tests for section %s" % (msg))
if nb_schemas_tests != old_schemas_tests:
- print "found %d test schemas: %d success %d failures" % (
- nb_schemas_tests - old_schemas_tests,
- nb_schemas_success - old_schemas_success,
- nb_schemas_failed - old_schemas_failed)
- if nb_instances_tests != old_instances_tests:
- print "found %d test instances: %d success %d failures" % (
- nb_instances_tests - old_instances_tests,
- nb_instances_success - old_instances_success,
- nb_instances_failed - old_instances_failed)
+ print("found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests - old_schemas_tests,
+ nb_schemas_success - old_schemas_success,
+ nb_schemas_failed - old_schemas_failed))
+ if nb_instances_tests != old_instances_tests:
+ print("found %d test instances: %d success %d failures" % (
+ nb_instances_tests - old_instances_tests,
+ nb_instances_success - old_instances_success,
+ nb_instances_failed - old_instances_failed))
#
# Parse the conf file
#
@@ -389,22 +393,22 @@ libxml2.registerErrorHandler(callback, "")
libxml2.setEntityLoader(resolver)
root = testsuite.getRootElement()
if root.name != 'testSuite':
- print "%s doesn't start with a testSuite element, aborting" % (CONF)
+ print("%s doesn't start with a testSuite element, aborting" % (CONF))
sys.exit(1)
if quiet == 0:
- print "Running Relax NG testsuite"
+ print("Running Relax NG testsuite")
handle_testSuite(root)
if quiet == 0:
- print "\nTOTAL:\n"
+ print("\nTOTAL:\n")
if quiet == 0 or nb_schemas_failed != 0:
- print "found %d test schemas: %d success %d failures" % (
- nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
+ print("found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests, nb_schemas_success, nb_schemas_failed))
if quiet == 0 or nb_instances_failed != 0:
- print "found %d test instances: %d success %d failures" % (
- nb_instances_tests, nb_instances_success, nb_instances_failed)
-
+ print("found %d test instances: %d success %d failures" % (
+ nb_instances_tests, nb_instances_success, nb_instances_failed))
+log.close()
testsuite.freeDoc()
# Memory debug specific
@@ -412,7 +416,7 @@ libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
if quiet == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/chromium/third_party/libxml/src/check-xinclude-test-suite.py b/chromium/third_party/libxml/src/check-xinclude-test-suite.py
index 416ea2184b7..926ceb3c957 100755
--- a/chromium/third_party/libxml/src/check-xinclude-test-suite.py
+++ b/chromium/third_party/libxml/src/check-xinclude-test-suite.py
@@ -1,8 +1,7 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import sys
import time
import os
-import string
sys.path.insert(0, "python")
import libxml2
@@ -31,13 +30,13 @@ def errorHandler(ctx, str):
global error_nr
global error_msg
- if string.find(str, "error:") >= 0:
- error_nr = error_nr + 1
+ if str.find("error:") >= 0:
+ error_nr = error_nr + 1
if len(error_msg) < 300:
if len(error_msg) == 0 or error_msg[-1] == '\n':
- error_msg = error_msg + " >>" + str
- else:
- error_msg = error_msg + str
+ error_msg = error_msg + " >>" + str
+ else:
+ error_msg = error_msg + str
libxml2.registerErrorHandler(errorHandler, None)
@@ -49,7 +48,7 @@ def testXInclude(filename, id):
error_nr = 0
error_msg = ''
- print "testXInclude(%s, %s)" % (filename, id)
+ print("testXInclude(%s, %s)" % (filename, id))
return 1
def runTest(test, basedir):
@@ -64,158 +63,158 @@ def runTest(test, basedir):
uri = test.prop('href')
id = test.prop('id')
type = test.prop('type')
- if uri == None:
- print "Test without ID:", uri
- return -1
- if id == None:
- print "Test without URI:", id
- return -1
- if type == None:
- print "Test without URI:", id
- return -1
+ if uri is None:
+ print("Test without ID:", uri)
+ return -1
+ if id is None:
+ print("Test without URI:", id)
+ return -1
+ if type is None:
+ print("Test without URI:", id)
+ return -1
if basedir != None:
- URI = basedir + "/" + uri
+ URI = basedir + "/" + uri
else:
URI = uri
if os.access(URI, os.R_OK) == 0:
- print "Test %s missing: base %s uri %s" % (URI, basedir, uri)
- return -1
+ print("Test %s missing: base %s uri %s" % (URI, basedir, uri))
+ return -1
expected = None
outputfile = None
diff = None
if type != 'error':
- output = test.xpathEval('string(output)')
- if output == 'No output file.':
- output = None
- if output == '':
- output = None
- if output != None:
- if basedir != None:
- output = basedir + "/" + output
- if os.access(output, os.R_OK) == 0:
- print "Result for %s missing: %s" % (id, output)
- output = None
- else:
- try:
- f = open(output)
- expected = f.read()
- outputfile = output
- except:
- print "Result for %s unreadable: %s" % (id, output)
+ output = test.xpathEval('string(output)')
+ if output == 'No output file.':
+ output = None
+ if output == '':
+ output = None
+ if output != None:
+ if basedir != None:
+ output = basedir + "/" + output
+ if os.access(output, os.R_OK) == 0:
+ print("Result for %s missing: %s" % (id, output))
+ output = None
+ else:
+ try:
+ f = open(output)
+ expected = f.read()
+ outputfile = output
+ except:
+ print("Result for %s unreadable: %s" % (id, output))
try:
- # print "testing %s" % (URI)
- doc = libxml2.parseFile(URI)
+ # print("testing %s" % (URI))
+ doc = libxml2.parseFile(URI)
except:
doc = None
if doc != None:
res = doc.xincludeProcess()
- if res >= 0 and expected != None:
- result = doc.serialize()
- if result != expected:
- print "Result for %s differs" % (id)
- open("xinclude.res", "w").write(result)
- diff = os.popen("diff %s xinclude.res" % outputfile).read()
-
- doc.freeDoc()
+ if res >= 0 and expected != None:
+ result = doc.serialize()
+ if result != expected:
+ print("Result for %s differs" % (id))
+ open("xinclude.res", "w").write(result)
+ diff = os.popen("diff %s xinclude.res" % outputfile).read()
+
+ doc.freeDoc()
else:
- print "Failed to parse %s" % (URI)
- res = -1
+ print("Failed to parse %s" % (URI))
+ res = -1
+
-
test_nr = test_nr + 1
if type == 'success':
- if res > 0:
- test_succeed = test_succeed + 1
- elif res == 0:
- test_failed = test_failed + 1
- print "Test %s: no substitution done ???" % (id)
- elif res < 0:
- test_error = test_error + 1
- print "Test %s: failed valid XInclude processing" % (id)
+ if res > 0:
+ test_succeed = test_succeed + 1
+ elif res == 0:
+ test_failed = test_failed + 1
+ print("Test %s: no substitution done ???" % (id))
+ elif res < 0:
+ test_error = test_error + 1
+ print("Test %s: failed valid XInclude processing" % (id))
elif type == 'error':
- if res > 0:
- test_error = test_error + 1
- print "Test %s: failed to detect invalid XInclude processing" % (id)
- elif res == 0:
- test_failed = test_failed + 1
- print "Test %s: Invalid but no substitution done" % (id)
- elif res < 0:
- test_succeed = test_succeed + 1
+ if res > 0:
+ test_error = test_error + 1
+ print("Test %s: failed to detect invalid XInclude processing" % (id))
+ elif res == 0:
+ test_failed = test_failed + 1
+ print("Test %s: Invalid but no substitution done" % (id))
+ elif res < 0:
+ test_succeed = test_succeed + 1
elif type == 'optional':
- if res > 0:
- test_succeed = test_succeed + 1
- else:
- print "Test %s: failed optional test" % (id)
+ if res > 0:
+ test_succeed = test_succeed + 1
+ else:
+ print("Test %s: failed optional test" % (id))
# Log the ontext
if res != 1:
- log.write("Test ID %s\n" % (id))
- log.write(" File: %s\n" % (URI))
- content = string.strip(test.content)
- while content[-1] == '\n':
- content = content[0:-1]
- log.write(" %s:%s\n\n" % (type, content))
- if error_msg != '':
- log.write(" ----\n%s ----\n" % (error_msg))
- error_msg = ''
- log.write("\n")
+ log.write("Test ID %s\n" % (id))
+ log.write(" File: %s\n" % (URI))
+ content = test.content.strip()
+ while content[-1] == '\n':
+ content = content[0:-1]
+ log.write(" %s:%s\n\n" % (type, content))
+ if error_msg != '':
+ log.write(" ----\n%s ----\n" % (error_msg))
+ error_msg = ''
+ log.write("\n")
if diff != None:
log.write("diff from test %s:\n" %(id))
- log.write(" -----------\n%s\n -----------\n" % (diff));
+ log.write(" -----------\n%s\n -----------\n" % (diff));
return 0
-
+
def runTestCases(case):
creator = case.prop('creator')
if creator != None:
- print "=>", creator
+ print("=>", creator)
base = case.getBase(None)
basedir = case.prop('basedir')
if basedir != None:
- base = libxml2.buildURI(basedir, base)
+ base = libxml2.buildURI(basedir, base)
test = case.children
while test != None:
if test.name == 'testcase':
- runTest(test, base)
- if test.name == 'testcases':
- runTestCases(test)
+ runTest(test, base)
+ if test.name == 'testcases':
+ runTestCases(test)
test = test.next
-
+
conf = libxml2.parseFile(CONF)
-if conf == None:
- print "Unable to load %s" % CONF
+if conf is None:
+ print("Unable to load %s" % CONF)
sys.exit(1)
testsuite = conf.getRootElement()
if testsuite.name != 'testsuite':
- print "Expecting TESTSUITE root element: aborting"
+ print("Expecting TESTSUITE root element: aborting")
sys.exit(1)
profile = testsuite.prop('PROFILE')
if profile != None:
- print profile
+ print(profile)
start = time.time()
case = testsuite.children
while case != None:
if case.name == 'testcases':
- old_test_nr = test_nr
- old_test_succeed = test_succeed
- old_test_failed = test_failed
- old_test_error = test_error
+ old_test_nr = test_nr
+ old_test_succeed = test_succeed
+ old_test_failed = test_failed
+ old_test_error = test_error
runTestCases(case)
- print " Ran %d tests: %d succeeded, %d failed and %d generated an error" % (
- test_nr - old_test_nr, test_succeed - old_test_succeed,
- test_failed - old_test_failed, test_error - old_test_error)
+ print(" Ran %d tests: %d succeeded, %d failed and %d generated an error" % (
+ test_nr - old_test_nr, test_succeed - old_test_succeed,
+ test_failed - old_test_failed, test_error - old_test_error))
case = case.next
conf.freeDoc()
log.close()
-print "Ran %d tests: %d succeeded, %d failed and %d generated an error in %.2f s." % (
- test_nr, test_succeed, test_failed, test_error, time.time() - start)
+print("Ran %d tests: %d succeeded, %d failed and %d generated an error in %.2f s." % (
+ test_nr, test_succeed, test_failed, test_error, time.time() - start))
diff --git a/chromium/third_party/libxml/src/check-xml-test-suite.py b/chromium/third_party/libxml/src/check-xml-test-suite.py
index 399a8db9f0e..cecb59b77f2 100755
--- a/chromium/third_party/libxml/src/check-xml-test-suite.py
+++ b/chromium/third_party/libxml/src/check-xml-test-suite.py
@@ -1,8 +1,7 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import sys
import time
import os
-import string
sys.path.insert(0, "python")
import libxml2
@@ -31,9 +30,9 @@ def errorHandler(ctx, str):
error_nr = error_nr + 1
if len(error_msg) < 300:
if len(error_msg) == 0 or error_msg[-1] == '\n':
- error_msg = error_msg + " >>" + str
- else:
- error_msg = error_msg + str
+ error_msg = error_msg + " >>" + str
+ else:
+ error_msg = error_msg + str
libxml2.registerErrorHandler(errorHandler, None)
@@ -53,17 +52,17 @@ libxml2.registerErrorHandler(errorHandler, None)
#
def loadNoentDoc(filename):
ctxt = libxml2.createFileParserCtxt(filename)
- if ctxt == None:
+ if ctxt is None:
return None
ctxt.replaceEntities(1)
ctxt.parseDocument()
try:
- doc = ctxt.doc()
+ doc = ctxt.doc()
except:
doc = None
if ctxt.wellFormed() != 1:
doc.freeDoc()
- return None
+ return None
return doc
#
@@ -79,20 +78,20 @@ def testNotWf(filename, id):
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
- if ctxt == None:
+ if ctxt is None:
return -1
ret = ctxt.parseDocument()
try:
- doc = ctxt.doc()
+ doc = ctxt.doc()
except:
doc = None
if doc != None:
- doc.freeDoc()
+ doc.freeDoc()
if ret == 0 or ctxt.wellFormed() != 0:
- print "%s: error: Well Formedness error not detected" % (id)
- log.write("%s: error: Well Formedness error not detected\n" % (id))
- return 0
+ print("%s: error: Well Formedness error not detected" % (id))
+ log.write("%s: error: Well Formedness error not detected\n" % (id))
+ return 0
return 1
def testNotWfEnt(filename, id):
@@ -104,21 +103,21 @@ def testNotWfEnt(filename, id):
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
- if ctxt == None:
+ if ctxt is None:
return -1
ctxt.replaceEntities(1)
ret = ctxt.parseDocument()
try:
- doc = ctxt.doc()
+ doc = ctxt.doc()
except:
doc = None
if doc != None:
- doc.freeDoc()
+ doc.freeDoc()
if ret == 0 or ctxt.wellFormed() != 0:
- print "%s: error: Well Formedness error not detected" % (id)
- log.write("%s: error: Well Formedness error not detected\n" % (id))
- return 0
+ print("%s: error: Well Formedness error not detected" % (id))
+ log.write("%s: error: Well Formedness error not detected\n" % (id))
+ return 0
return 1
def testNotWfEntDtd(filename, id):
@@ -130,22 +129,22 @@ def testNotWfEntDtd(filename, id):
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
- if ctxt == None:
+ if ctxt is None:
return -1
ctxt.replaceEntities(1)
ctxt.loadSubset(1)
ret = ctxt.parseDocument()
try:
- doc = ctxt.doc()
+ doc = ctxt.doc()
except:
doc = None
if doc != None:
- doc.freeDoc()
+ doc.freeDoc()
if ret == 0 or ctxt.wellFormed() != 0:
- print "%s: error: Well Formedness error not detected" % (id)
- log.write("%s: error: Well Formedness error not detected\n" % (id))
- return 0
+ print("%s: error: Well Formedness error not detected" % (id))
+ log.write("%s: error: Well Formedness error not detected\n" % (id))
+ return 0
return 1
def testWfEntDtd(filename, id):
@@ -157,27 +156,27 @@ def testWfEntDtd(filename, id):
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
- if ctxt == None:
+ if ctxt is None:
return -1
ctxt.replaceEntities(1)
ctxt.loadSubset(1)
ret = ctxt.parseDocument()
try:
- doc = ctxt.doc()
+ doc = ctxt.doc()
except:
doc = None
- if doc == None or ret != 0 or ctxt.wellFormed() == 0:
- print "%s: error: wrongly failed to parse the document" % (id)
- log.write("%s: error: wrongly failed to parse the document\n" % (id))
- if doc != None:
- doc.freeDoc()
- return 0
+ if doc is None or ret != 0 or ctxt.wellFormed() == 0:
+ print("%s: error: wrongly failed to parse the document" % (id))
+ log.write("%s: error: wrongly failed to parse the document\n" % (id))
+ if doc != None:
+ doc.freeDoc()
+ return 0
if error_nr != 0:
- print "%s: warning: WF document generated an error msg" % (id)
- log.write("%s: error: WF document generated an error msg\n" % (id))
- doc.freeDoc()
- return 2
+ print("%s: warning: WF document generated an error msg" % (id))
+ log.write("%s: error: WF document generated an error msg\n" % (id))
+ doc.freeDoc()
+ return 2
doc.freeDoc()
return 1
@@ -190,26 +189,26 @@ def testError(filename, id):
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
- if ctxt == None:
+ if ctxt is None:
return -1
ctxt.replaceEntities(1)
ctxt.loadSubset(1)
ret = ctxt.parseDocument()
try:
- doc = ctxt.doc()
+ doc = ctxt.doc()
except:
doc = None
if doc != None:
- doc.freeDoc()
+ doc.freeDoc()
if ctxt.wellFormed() == 0:
- print "%s: warning: failed to parse the document but accepted" % (id)
- log.write("%s: warning: failed to parse the document but accepte\n" % (id))
- return 2
+ print("%s: warning: failed to parse the document but accepted" % (id))
+ log.write("%s: warning: failed to parse the document but accepte\n" % (id))
+ return 2
if error_nr != 0:
- print "%s: warning: WF document generated an error msg" % (id)
- log.write("%s: error: WF document generated an error msg\n" % (id))
- return 2
+ print("%s: warning: WF document generated an error msg" % (id))
+ log.write("%s: error: WF document generated an error msg\n" % (id))
+ return 2
return 1
def testInvalid(filename, id):
@@ -221,31 +220,31 @@ def testInvalid(filename, id):
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
- if ctxt == None:
+ if ctxt is None:
return -1
ctxt.validate(1)
ret = ctxt.parseDocument()
try:
- doc = ctxt.doc()
+ doc = ctxt.doc()
except:
doc = None
valid = ctxt.isValid()
- if doc == None:
- print "%s: error: wrongly failed to parse the document" % (id)
- log.write("%s: error: wrongly failed to parse the document\n" % (id))
- return 0
+ if doc is None:
+ print("%s: error: wrongly failed to parse the document" % (id))
+ log.write("%s: error: wrongly failed to parse the document\n" % (id))
+ return 0
if valid == 1:
- print "%s: error: Validity error not detected" % (id)
- log.write("%s: error: Validity error not detected\n" % (id))
- doc.freeDoc()
- return 0
+ print("%s: error: Validity error not detected" % (id))
+ log.write("%s: error: Validity error not detected\n" % (id))
+ doc.freeDoc()
+ return 0
if error_nr == 0:
- print "%s: warning: Validity error not reported" % (id)
- log.write("%s: warning: Validity error not reported\n" % (id))
- doc.freeDoc()
- return 2
-
+ print("%s: warning: Validity error not reported" % (id))
+ log.write("%s: warning: Validity error not reported\n" % (id))
+ doc.freeDoc()
+ return 2
+
doc.freeDoc()
return 1
@@ -257,30 +256,30 @@ def testValid(filename, id):
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
- if ctxt == None:
+ if ctxt is None:
return -1
ctxt.validate(1)
ctxt.parseDocument()
try:
- doc = ctxt.doc()
+ doc = ctxt.doc()
except:
doc = None
valid = ctxt.isValid()
- if doc == None:
- print "%s: error: wrongly failed to parse the document" % (id)
- log.write("%s: error: wrongly failed to parse the document\n" % (id))
- return 0
+ if doc is None:
+ print("%s: error: wrongly failed to parse the document" % (id))
+ log.write("%s: error: wrongly failed to parse the document\n" % (id))
+ return 0
if valid != 1:
- print "%s: error: Validity check failed" % (id)
- log.write("%s: error: Validity check failed\n" % (id))
- doc.freeDoc()
- return 0
+ print("%s: error: Validity check failed" % (id))
+ log.write("%s: error: Validity check failed\n" % (id))
+ doc.freeDoc()
+ return 0
if error_nr != 0 or valid != 1:
- print "%s: warning: valid document reported an error" % (id)
- log.write("%s: warning: valid document reported an error\n" % (id))
- doc.freeDoc()
- return 2
+ print("%s: warning: valid document reported an error" % (id))
+ log.write("%s: warning: valid document reported an error\n" % (id))
+ doc.freeDoc()
+ return 2
doc.freeDoc()
return 1
@@ -293,21 +292,21 @@ def runTest(test):
uri = test.prop('URI')
id = test.prop('ID')
- if uri == None:
- print "Test without ID:", uri
- return -1
- if id == None:
- print "Test without URI:", id
- return -1
+ if uri is None:
+ print("Test without ID:", uri)
+ return -1
+ if id is None:
+ print("Test without URI:", id)
+ return -1
base = test.getBase(None)
URI = libxml2.buildURI(uri, base)
if os.access(URI, os.R_OK) == 0:
- print "Test %s missing: base %s uri %s" % (URI, base, uri)
- return -1
+ print("Test %s missing: base %s uri %s" % (URI, base, uri))
+ return -1
type = test.prop('TYPE')
- if type == None:
- print "Test %s missing TYPE" % (id)
- return -1
+ if type is None:
+ print("Test %s missing TYPE" % (id))
+ return -1
extra = None
if type == "invalid":
@@ -316,94 +315,94 @@ def runTest(test):
res = testValid(URI, id)
elif type == "not-wf":
extra = test.prop('ENTITIES')
- # print URI
- #if extra == None:
- # res = testNotWfEntDtd(URI, id)
- #elif extra == 'none':
- # res = testNotWf(URI, id)
- #elif extra == 'general':
- # res = testNotWfEnt(URI, id)
- #elif extra == 'both' or extra == 'parameter':
- res = testNotWfEntDtd(URI, id)
- #else:
- # print "Unknown value %s for an ENTITIES test value" % (extra)
- # return -1
+ # print(URI)
+ #if extra is None:
+ # res = testNotWfEntDtd(URI, id)
+ #elif extra == 'none':
+ # res = testNotWf(URI, id)
+ #elif extra == 'general':
+ # res = testNotWfEnt(URI, id)
+ #elif extra == 'both' or extra == 'parameter':
+ res = testNotWfEntDtd(URI, id)
+ #else:
+ # print("Unknown value %s for an ENTITIES test value" % (extra))
+ # return -1
elif type == "error":
- res = testError(URI, id)
+ res = testError(URI, id)
else:
# TODO skipped for now
- return -1
+ return -1
test_nr = test_nr + 1
if res > 0:
- test_succeed = test_succeed + 1
+ test_succeed = test_succeed + 1
elif res == 0:
- test_failed = test_failed + 1
+ test_failed = test_failed + 1
elif res < 0:
- test_error = test_error + 1
+ test_error = test_error + 1
# Log the ontext
if res != 1:
- log.write(" File: %s\n" % (URI))
- content = string.strip(test.content)
- while content[-1] == '\n':
- content = content[0:-1]
- if extra != None:
- log.write(" %s:%s:%s\n" % (type, extra, content))
- else:
- log.write(" %s:%s\n\n" % (type, content))
- if error_msg != '':
- log.write(" ----\n%s ----\n" % (error_msg))
- error_msg = ''
- log.write("\n")
+ log.write(" File: %s\n" % (URI))
+ content = test.content.strip()
+ while content[-1] == '\n':
+ content = content[0:-1]
+ if extra != None:
+ log.write(" %s:%s:%s\n" % (type, extra, content))
+ else:
+ log.write(" %s:%s\n\n" % (type, content))
+ if error_msg != '':
+ log.write(" ----\n%s ----\n" % (error_msg))
+ error_msg = ''
+ log.write("\n")
return 0
-
+
def runTestCases(case):
profile = case.prop('PROFILE')
if profile != None and \
- string.find(profile, "IBM XML Conformance Test Suite - Production") < 0:
- print "=>", profile
+ profile.find("IBM XML Conformance Test Suite - Production") < 0:
+ print("=>", profile)
test = case.children
while test != None:
if test.name == 'TEST':
- runTest(test)
- if test.name == 'TESTCASES':
- runTestCases(test)
+ runTest(test)
+ if test.name == 'TESTCASES':
+ runTestCases(test)
test = test.next
-
+
conf = loadNoentDoc(CONF)
-if conf == None:
- print "Unable to load %s" % CONF
+if conf is None:
+ print("Unable to load %s" % CONF)
sys.exit(1)
testsuite = conf.getRootElement()
if testsuite.name != 'TESTSUITE':
- print "Expecting TESTSUITE root element: aborting"
+ print("Expecting TESTSUITE root element: aborting")
sys.exit(1)
profile = testsuite.prop('PROFILE')
if profile != None:
- print profile
+ print(profile)
start = time.time()
case = testsuite.children
while case != None:
if case.name == 'TESTCASES':
- old_test_nr = test_nr
- old_test_succeed = test_succeed
- old_test_failed = test_failed
- old_test_error = test_error
+ old_test_nr = test_nr
+ old_test_succeed = test_succeed
+ old_test_failed = test_failed
+ old_test_error = test_error
runTestCases(case)
- print " Ran %d tests: %d succeeded, %d failed and %d generated an error" % (
- test_nr - old_test_nr, test_succeed - old_test_succeed,
- test_failed - old_test_failed, test_error - old_test_error)
+ print(" Ran %d tests: %d succeeded, %d failed and %d generated an error" % (
+ test_nr - old_test_nr, test_succeed - old_test_succeed,
+ test_failed - old_test_failed, test_error - old_test_error))
case = case.next
conf.freeDoc()
log.close()
-print "Ran %d tests: %d succeeded, %d failed and %d generated an error in %.2f s." % (
- test_nr, test_succeed, test_failed, test_error, time.time() - start)
+print("Ran %d tests: %d succeeded, %d failed and %d generated an error in %.2f s." % (
+ test_nr, test_succeed, test_failed, test_error, time.time() - start))
diff --git a/chromium/third_party/libxml/src/check-xsddata-test-suite.py b/chromium/third_party/libxml/src/check-xsddata-test-suite.py
index c946129bf37..c34560ea900 100755
--- a/chromium/third_party/libxml/src/check-xsddata-test-suite.py
+++ b/chromium/third_party/libxml/src/check-xsddata-test-suite.py
@@ -1,9 +1,13 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import sys
import time
import os
-import string
-import StringIO
+try:
+ # Python 2
+ from StringIO import StringIO
+except ImportError:
+ # Python 3
+ from io import StringIO
sys.path.insert(0, "python")
import libxml2
@@ -44,8 +48,8 @@ resources = {}
def resolver(URL, ID, ctxt):
global resources
- if resources.has_key(URL):
- return(StringIO.StringIO(resources[URL]))
+ if URL in resources:
+ return(StringIO(resources[URL]))
log.write("Resolver failure: asked %s\n" % (URL))
log.write("resources: %s\n" % (resources))
return None
@@ -59,49 +63,49 @@ def handle_valid(node, schema):
global nb_instances_failed
instance = node.prop("dtd")
- if instance == None:
+ if instance is None:
instance = ""
child = node.children
while child != None:
if child.type != 'text':
- instance = instance + child.serialize()
- child = child.next
+ instance = instance + child.serialize()
+ child = child.next
mem = libxml2.debugMemory(1);
try:
- doc = libxml2.parseDoc(instance)
+ doc = libxml2.parseDoc(instance)
except:
doc = None
- if doc == None:
+ if doc is None:
log.write("\nFailed to parse correct instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
- return
+ nb_instances_failed = nb_instances_failed + 1
+ return
if debug:
- print "instance line %d" % (node.lineNo())
-
+ print("instance line %d" % (node.lineNo()))
+
try:
ctxt = schema.relaxNGNewValidCtxt()
- ret = doc.relaxNGValidateDoc(ctxt)
- del ctxt
+ ret = doc.relaxNGValidateDoc(ctxt)
+ del ctxt
except:
ret = -1
doc.freeDoc()
if mem != libxml2.debugMemory(1):
- print "validating instance %d line %d leaks" % (
- nb_instances_tests, node.lineNo())
+ print("validating instance %d line %d leaks" % (
+ nb_instances_tests, node.lineNo()))
if ret != 0:
log.write("\nFailed to validate correct instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
+ nb_instances_failed = nb_instances_failed + 1
else:
- nb_instances_success = nb_instances_success + 1
+ nb_instances_success = nb_instances_success + 1
#
# handle an invalid instance
@@ -112,50 +116,50 @@ def handle_invalid(node, schema):
global nb_instances_failed
instance = node.prop("dtd")
- if instance == None:
+ if instance is None:
instance = ""
child = node.children
while child != None:
if child.type != 'text':
- instance = instance + child.serialize()
- child = child.next
+ instance = instance + child.serialize()
+ child = child.next
# mem = libxml2.debugMemory(1);
try:
- doc = libxml2.parseDoc(instance)
+ doc = libxml2.parseDoc(instance)
except:
doc = None
- if doc == None:
+ if doc is None:
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- return
+ return
if debug:
- print "instance line %d" % (node.lineNo())
-
+ print("instance line %d" % (node.lineNo()))
+
try:
ctxt = schema.relaxNGNewValidCtxt()
- ret = doc.relaxNGValidateDoc(ctxt)
- del ctxt
+ ret = doc.relaxNGValidateDoc(ctxt)
+ del ctxt
except:
ret = -1
doc.freeDoc()
# if mem != libxml2.debugMemory(1):
-# print "validating instance %d line %d leaks" % (
-# nb_instances_tests, node.lineNo())
-
+# print("validating instance %d line %d leaks" % (
+# nb_instances_tests, node.lineNo()))
+
if ret == 0:
log.write("\nFailed to detect validation problem in instance:\n-----\n")
- log.write(instance)
+ log.write(instance)
log.write("\n-----\n")
- nb_instances_failed = nb_instances_failed + 1
+ nb_instances_failed = nb_instances_failed + 1
else:
- nb_instances_success = nb_instances_success + 1
+ nb_instances_success = nb_instances_success + 1
#
# handle an incorrect test
@@ -169,23 +173,23 @@ def handle_correct(node):
child = node.children
while child != None:
if child.type != 'text':
- schema = schema + child.serialize()
- child = child.next
+ schema = schema + child.serialize()
+ child = child.next
try:
- rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
- rngs = rngp.relaxNGParse()
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
except:
rngs = None
- if rngs == None:
+ if rngs is None:
log.write("\nFailed to compile correct schema:\n-----\n")
- log.write(schema)
+ log.write(schema)
log.write("\n-----\n")
- nb_schemas_failed = nb_schemas_failed + 1
+ nb_schemas_failed = nb_schemas_failed + 1
else:
- nb_schemas_success = nb_schemas_success + 1
+ nb_schemas_success = nb_schemas_success + 1
return rngs
-
+
def handle_incorrect(node):
global log
global nb_schemas_success
@@ -195,24 +199,24 @@ def handle_incorrect(node):
child = node.children
while child != None:
if child.type != 'text':
- schema = schema + child.serialize()
- child = child.next
+ schema = schema + child.serialize()
+ child = child.next
try:
- rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
- rngs = rngp.relaxNGParse()
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
except:
rngs = None
if rngs != None:
log.write("\nFailed to detect schema error in:\n-----\n")
- log.write(schema)
+ log.write(schema)
log.write("\n-----\n")
- nb_schemas_failed = nb_schemas_failed + 1
+ nb_schemas_failed = nb_schemas_failed + 1
else:
-# log.write("\nSuccess detecting schema error in:\n-----\n")
-# log.write(schema)
-# log.write("\n-----\n")
- nb_schemas_success = nb_schemas_success + 1
+# log.write("\nSuccess detecting schema error in:\n-----\n")
+# log.write(schema)
+# log.write("\n-----\n")
+ nb_schemas_success = nb_schemas_success + 1
return None
#
@@ -222,14 +226,14 @@ def handle_resource(node, dir):
global resources
try:
- name = node.prop('name')
+ name = node.prop('name')
except:
name = None
- if name == None or name == '':
+ if name is None or name == '':
log.write("resource has no name")
- return;
-
+ return;
+
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
@@ -238,8 +242,8 @@ def handle_resource(node, dir):
child = node.children
while child != None:
if child.type != 'text':
- res = res + child.serialize()
- child = child.next
+ res = res + child.serialize()
+ child = child.next
resources[name] = res
#
@@ -247,14 +251,14 @@ def handle_resource(node, dir):
#
def handle_dir(node, dir):
try:
- name = node.prop('name')
+ name = node.prop('name')
except:
name = None
- if name == None or name == '':
+ if name is None or name == '':
log.write("resource has no name")
- return;
-
+ return;
+
if dir != None:
# name = libxml2.buildURI(name, dir)
name = dir + '/' + name
@@ -280,7 +284,7 @@ def handle_testCase(node):
nb_schemas_tests, node.lineNo(), sections))
resources = {}
if debug:
- print "test %d line %d" % (nb_schemas_tests, node.lineNo())
+ print("test %d line %d" % (nb_schemas_tests, node.lineNo()))
dirs = node.xpathEval('dir')
for dir in dirs:
@@ -292,27 +296,27 @@ def handle_testCase(node):
tsts = node.xpathEval('incorrect')
if tsts != []:
if len(tsts) != 1:
- print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
- schema = handle_incorrect(tsts[0])
+ print("warning test line %d has more than one <incorrect> example" %(node.lineNo()))
+ schema = handle_incorrect(tsts[0])
else:
tsts = node.xpathEval('correct')
- if tsts != []:
- if len(tsts) != 1:
- print "warning test line %d has more than one <correct> example"% (node.lineNo())
- schema = handle_correct(tsts[0])
- else:
- print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
+ if tsts != []:
+ if len(tsts) != 1:
+ print("warning test line %d has more than one <correct> example"% (node.lineNo()))
+ schema = handle_correct(tsts[0])
+ else:
+ print("warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo()))
nb_schemas_tests = nb_schemas_tests + 1;
-
+
valids = node.xpathEval('valid')
invalids = node.xpathEval('invalid')
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
if schema != None:
for valid in valids:
- handle_valid(valid, schema)
+ handle_valid(valid, schema)
for invalid in invalids:
- handle_invalid(invalid, schema)
+ handle_invalid(invalid, schema)
#
@@ -322,60 +326,60 @@ def handle_testSuite(node, level = 0):
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
global nb_instances_tests, nb_instances_success, nb_instances_failed
if verbose and level >= 0:
- old_schemas_tests = nb_schemas_tests
- old_schemas_success = nb_schemas_success
- old_schemas_failed = nb_schemas_failed
- old_instances_tests = nb_instances_tests
- old_instances_success = nb_instances_success
- old_instances_failed = nb_instances_failed
+ old_schemas_tests = nb_schemas_tests
+ old_schemas_success = nb_schemas_success
+ old_schemas_failed = nb_schemas_failed
+ old_instances_tests = nb_instances_tests
+ old_instances_success = nb_instances_success
+ old_instances_failed = nb_instances_failed
docs = node.xpathEval('documentation')
authors = node.xpathEval('author')
if docs != []:
msg = ""
for doc in docs:
- msg = msg + doc.content + " "
- if authors != []:
- msg = msg + "written by "
- for author in authors:
- msg = msg + author.content + " "
- if quiet == 0:
- print msg
+ msg = msg + doc.content + " "
+ if authors != []:
+ msg = msg + "written by "
+ for author in authors:
+ msg = msg + author.content + " "
+ if quiet == 0:
+ print(msg)
sections = node.xpathEval('section')
if verbose and sections != [] and level <= 0:
msg = ""
for section in sections:
- msg = msg + section.content + " "
- if quiet == 0:
- print "Tests for section %s" % (msg)
+ msg = msg + section.content + " "
+ if quiet == 0:
+ print("Tests for section %s" % (msg))
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
handle_testSuite(test, level + 1)
-
+
if verbose and level >= 0 :
if sections != []:
- msg = ""
- for section in sections:
- msg = msg + section.content + " "
- print "Result of tests for section %s" % (msg)
- elif docs != []:
- msg = ""
- for doc in docs:
- msg = msg + doc.content + " "
- print "Result of tests for %s" % (msg)
+ msg = ""
+ for section in sections:
+ msg = msg + section.content + " "
+ print("Result of tests for section %s" % (msg))
+ elif docs != []:
+ msg = ""
+ for doc in docs:
+ msg = msg + doc.content + " "
+ print("Result of tests for %s" % (msg))
if nb_schemas_tests != old_schemas_tests:
- print "found %d test schemas: %d success %d failures" % (
- nb_schemas_tests - old_schemas_tests,
- nb_schemas_success - old_schemas_success,
- nb_schemas_failed - old_schemas_failed)
- if nb_instances_tests != old_instances_tests:
- print "found %d test instances: %d success %d failures" % (
- nb_instances_tests - old_instances_tests,
- nb_instances_success - old_instances_success,
- nb_instances_failed - old_instances_failed)
+ print("found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests - old_schemas_tests,
+ nb_schemas_success - old_schemas_success,
+ nb_schemas_failed - old_schemas_failed))
+ if nb_instances_tests != old_instances_tests:
+ print("found %d test instances: %d success %d failures" % (
+ nb_instances_tests - old_instances_tests,
+ nb_instances_success - old_instances_success,
+ nb_instances_failed - old_instances_failed))
#
# Parse the conf file
#
@@ -394,18 +398,18 @@ libxml2.registerErrorHandler(callback, "")
libxml2.setEntityLoader(resolver)
root = testsuite.getRootElement()
if root.name != 'testSuite':
- print "%s doesn't start with a testSuite element, aborting" % (CONF)
+ print("%s doesn't start with a testSuite element, aborting" % (CONF))
sys.exit(1)
if quiet == 0:
- print "Running Relax NG testsuite"
+ print("Running Relax NG testsuite")
handle_testSuite(root)
if quiet == 0 or nb_schemas_failed != 0:
- print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
- nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
+ print("\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
+ nb_schemas_tests, nb_schemas_success, nb_schemas_failed))
if quiet == 0 or nb_instances_failed != 0:
- print "found %d test instances: %d success %d failures" % (
- nb_instances_tests, nb_instances_success, nb_instances_failed)
+ print("found %d test instances: %d success %d failures" % (
+ nb_instances_tests, nb_instances_success, nb_instances_failed))
testsuite.freeDoc()
@@ -414,7 +418,7 @@ libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
if quiet == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/chromium/third_party/libxml/src/config.h.cmake.in b/chromium/third_party/libxml/src/config.h.cmake.in
index bb9d340dd5a..5177e45a9fe 100644
--- a/chromium/third_party/libxml/src/config.h.cmake.in
+++ b/chromium/third_party/libxml/src/config.h.cmake.in
@@ -4,18 +4,9 @@
/* Define if __attribute__((destructor)) is accepted */
#cmakedefine ATTRIBUTE_DESTRUCTOR @ATTRIBUTE_DESTRUCTOR@
-/* Type cast for the gethostbyname() argument */
-#cmakedefine GETHOSTBYNAME_ARG_CAST @GETHOSTBYNAME_ARG_CAST@
-
/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H 1
-/* Define to 1 if you have the <arpa/nameser.h> header file. */
-#cmakedefine HAVE_ARPA_NAMESER_H 1
-
-/* Whether struct sockaddr::__ss_family exists */
-#cmakedefine HAVE_BROKEN_SS_FAMILY 1
-
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1
@@ -31,9 +22,6 @@
/* Define to 1 if you have the `ftime' function. */
#cmakedefine HAVE_FTIME 1
-/* Define if getaddrinfo is there */
-#cmakedefine HAVE_GETADDRINFO 1
-
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine HAVE_GETTIMEOFDAY 1
@@ -78,9 +66,6 @@
/* Define to 1 if you have the `rand_r' function. */
#cmakedefine HAVE_RAND_R 1
-/* Define to 1 if you have the <resolv.h> header file. */
-#cmakedefine HAVE_RESOLV_H 1
-
/* Have shl_load based dso */
#cmakedefine HAVE_SHLLOAD 1
@@ -108,9 +93,6 @@
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1
-/* Define to 1 if you have the <sys/types.h> header file. */
-#cmakedefine HAVE_SYS_TYPES_H 1
-
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
@@ -123,9 +105,6 @@
/* Whether __va_copy() is available */
#cmakedefine HAVE___VA_COPY 1
-/* Define as const if the declaration of iconv() needs const. */
-#define ICONV_CONST @ICONV_CONST@
-
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#cmakedefine LT_OBJDIR "@LT_OBJDIR@"
@@ -150,12 +129,6 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
-/* Type cast for the send() function 2nd arg */
-#cmakedefine SEND_ARG2_CAST @SEND_ARG2_CAST@
-
-/* Define to 1 if you have the ANSI C header files. */
-#cmakedefine STDC_HEADERS 1
-
/* Support for IPv6 */
#cmakedefine SUPPORT_IP6 1
@@ -173,9 +146,6 @@
#define below would cause a syntax error. */
#cmakedefine _UINT32_T @_UINT32_T@
-/* ss_family is not defined here, use __ss_family instead */
-#cmakedefine ss_family @ss_family@
-
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#cmakedefine uint32_t @uint32_t@
diff --git a/chromium/third_party/libxml/src/config.h.in b/chromium/third_party/libxml/src/config.h.in
index 20fecebb0c6..0c87bf54c2a 100644
--- a/chromium/third_party/libxml/src/config.h.in
+++ b/chromium/third_party/libxml/src/config.h.in
@@ -3,21 +3,12 @@
/* A form that will not confuse apibuild.py */
#undef ATTRIBUTE_DESTRUCTOR
-/* Type cast for the gethostbyname() argument */
-#undef GETHOSTBYNAME_ARG_CAST
-
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
-/* Define to 1 if you have the <arpa/nameser.h> header file. */
-#undef HAVE_ARPA_NAMESER_H
-
/* Define if __attribute__((destructor)) is accepted */
#undef HAVE_ATTRIBUTE_DESTRUCTOR
-/* Whether struct sockaddr::__ss_family exists */
-#undef HAVE_BROKEN_SS_FAMILY
-
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -33,12 +24,12 @@
/* Define to 1 if you have the `ftime' function. */
#undef HAVE_FTIME
-/* Define if getaddrinfo is there */
-#undef HAVE_GETADDRINFO
-
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
+/* Define to 1 if you have the <glob.h> header file. */
+#undef HAVE_GLOB_H
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -74,7 +65,7 @@
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
-/* Define if <pthread.h> is there */
+/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the `putenv' function. */
@@ -83,9 +74,6 @@
/* Define to 1 if you have the `rand_r' function. */
#undef HAVE_RAND_R
-/* Define to 1 if you have the <resolv.h> header file. */
-#undef HAVE_RESOLV_H
-
/* Have shl_load based dso */
#undef HAVE_SHLLOAD
@@ -146,9 +134,6 @@
/* Whether __va_copy() is available */
#undef HAVE___VA_COPY
-/* Define as const if the declaration of iconv() needs const. */
-#undef ICONV_CONST
-
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
@@ -173,9 +158,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* Type cast for the send() function 2nd arg */
-#undef SEND_ARG2_CAST
-
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
@@ -198,9 +180,6 @@
#define below would cause a syntax error. */
#undef _UINT32_T
-/* ss_family is not defined here, use __ss_family instead */
-#undef ss_family
-
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t
diff --git a/chromium/third_party/libxml/src/configure.ac b/chromium/third_party/libxml/src/configure.ac
index 5f9dfa78afb..13f7a1e76c1 100644
--- a/chromium/third_party/libxml/src/configure.ac
+++ b/chromium/third_party/libxml/src/configure.ac
@@ -2,13 +2,12 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
m4_define([MAJOR_VERSION], 2)
-m4_define([MINOR_VERSION], 9)
-m4_define([MICRO_VERSION], 13)
+m4_define([MINOR_VERSION], 11)
+m4_define([MICRO_VERSION], 0)
AC_INIT([libxml2],[MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION])
AC_CONFIG_SRCDIR([entities.c])
AC_CONFIG_HEADERS([config.h])
-AM_MAINTAINER_MODE([enable])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
@@ -40,44 +39,23 @@ AC_SUBST(LIBXML_VERSION_EXTRA)
VERSION=${LIBXML_VERSION}
-AM_INIT_AUTOMAKE([foreign])
-
-# Support silent build rules, requires at least automake-1.11. Disable
-# by either passing --disable-silent-rules to configure or passing V=1
-# to make
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+AM_INIT_AUTOMAKE([1.16.3 foreign no-dist-gzip dist-xz])
+AM_MAINTAINER_MODE([enable])
+AM_SILENT_RULES([yes])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MKDIR_P
-AC_PROG_CPP
-AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)
AC_PATH_PROG(PERL, perl, /usr/bin/perl)
AC_PATH_PROG(WGET, wget, /usr/bin/wget)
-AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
PKG_PROG_PKG_CONFIG
-LT_INIT
-
-dnl
-dnl if the system support linker version scripts for symbol versioning
-dnl then add it
-dnl
-VERSION_SCRIPT_FLAGS=
-# lt_cv_prog_gnu_ld is from libtool 2.+
-if test "$lt_cv_prog_gnu_ld" = yes; then
- VERSION_SCRIPT_FLAGS=-Wl,--version-script=
-else
- case $host in
- *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
- esac
-fi
-AC_SUBST(VERSION_SCRIPT_FLAGS)
-AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
+LT_INIT([disable-static])
+LT_LIB_M
dnl
dnl We process the AC_ARG_WITH first so that later we can modify
@@ -85,20 +63,12 @@ dnl some of them to try to prevent impossible combinations. This
dnl also allows up so alphabetize the choices
dnl
-dnl
-dnl zlib option might change flags, so we save them initially
-dnl
-_cppflags="${CPPFLAGS}"
-_libs="${LIBS}"
-
AC_ARG_WITH(c14n,
[ --with-c14n add the Canonicalization support (on)])
AC_ARG_WITH(catalog,
[ --with-catalog add the Catalog support (on)])
AC_ARG_WITH(debug,
[ --with-debug add the debugging module (on)])
-AC_ARG_WITH(docbook,
-[ --with-docbook add Docbook SGML support (off)])
AC_ARG_WITH(fexceptions,
[ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
AC_ARG_WITH(ftp,
@@ -107,15 +77,6 @@ AC_ARG_WITH(history,
[ --with-history add history support to xmllint shell(off)])
AC_ARG_WITH(html,
[ --with-html add the HTML support (on)])
-dnl Specific dir for HTML output ?
-AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir=path],
- [path to base html directory, default $docdir/html]),
- [HTML_DIR=$withval], [HTML_DIR='$(docdir)/html'])
-
-AC_ARG_WITH(html-subdir, AS_HELP_STRING([--with-html-subdir=path],
- [directory used under html-dir, default '']),
- [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"])
-AC_SUBST(HTML_DIR)
AC_ARG_WITH(http,
[ --with-http add the HTTP support (on)])
AC_ARG_WITH(iconv,
@@ -137,20 +98,11 @@ AC_ARG_WITH(pattern,
AC_ARG_WITH(push,
[ --with-push add the PUSH parser interfaces (on)])
AC_ARG_WITH(python,
-[ --with-python[[=DIR]] build Python bindings if found])
-AC_ARG_WITH(python_install_dir,
-[ --with-python-install-dir=DIR
- install Python bindings in DIR])
+[ --with-python build Python bindings (on)])
AC_ARG_WITH(reader,
[ --with-reader add the xmlReader parsing interface (on)])
AC_ARG_WITH(readline,
-[ --with-readline=DIR use readline in DIR],[
- if test "$withval" != "no" -a "$withval" != "yes"; then
- RDL_DIR=$withval
- CPPFLAGS="${CPPFLAGS} -I$withval/include"
- LDFLAGS="${LDFLAGS} -L$withval/lib"
- fi
-])
+[ --with-readline[[=DIR]] use readline in DIR])
AC_ARG_WITH(regexps,
[ --with-regexps add Regular Expressions support (on)])
AC_ARG_WITH(run_debug,
@@ -177,333 +129,185 @@ AC_ARG_WITH(xpath,
[ --with-xpath add the XPATH support (on)])
AC_ARG_WITH(xptr,
[ --with-xptr add the XPointer support (on)])
+AC_ARG_WITH(xptr-locs,
+[ --with-xptr-locs add support for XPointer locations (off)])
AC_ARG_WITH(modules,
[ --with-modules add the dynamic modules support (on)])
AC_ARG_WITH(zlib,
-[ --with-zlib[[=DIR]] use libz in DIR],[
- if test "$withval" != "no" -a "$withval" != "yes"; then
- Z_DIR=$withval
- CPPFLAGS="${CPPFLAGS} -I$withval/include"
- LDFLAGS="${LDFLAGS} -L$withval/lib"
- fi
-])
+[ --with-zlib[[=DIR]] use libz in DIR])
AC_ARG_WITH(lzma,
-[ --with-lzma[[=DIR]] use liblzma in DIR],[
- if test "$withval" != "no" -a "$withval" != "yes"; then
- LZMA_DIR=$withval
- CPPFLAGS="${CPPFLAGS} -I$withval/include"
- LDFLAGS="${LDFLAGS} -L$withval/lib"
- fi
-])
+[ --with-lzma[[=DIR]] use liblzma in DIR])
AC_ARG_WITH(coverage,
[ --with-coverage build for code coverage with GCC (off)])
-AC_ARG_ENABLE(rebuild-docs,
-[ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=no]]])
-if test "$enable_rebuild_docs" = "yes" -a "$srcdir" != "."; then
- AC_MSG_ERROR([cannot rebuild docs when builddir != srcdir])
-fi
-AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "yes"])
-
dnl
dnl hard dependencies on options
dnl
-if test "$with_schemas" = "yes"
-then
- with_pattern=yes
- with_regexps=yes
-fi
-if test "$with_schematron" = "yes"
-then
- with_pattern=yes
- with_tree=yes
- with_xpath=yes
-fi
-if test "$with_reader" = "yes"
-then
- with_push=yes
-fi
-if test "$with_xptr" = "yes"
-then
- with_xpath=yes
-fi
-dnl
-dnl option to build a minimal libxml2 library
-dnl
-if test "$with_minimum" = "yes"
-then
- echo "Configuring for a minimal library"
- if test "$with_c14n" = ""
- then
- with_c14n=no
- fi
- if test "$with_catalog" = ""
- then
- with_catalog=no
- fi
- echo So far so good!
- if test "$with_debug" = ""
- then
- with_debug=no
- fi
- if test "$with_fexceptions" = ""
- then
- with_fexceptions=no
- fi
- if test "$with_history" = ""
- then
- with_history=no
- fi
- if test "$with_html" = ""
- then
- with_html=no
- fi
- if test "$with_http" = ""
- then
- with_http=no
- fi
- if test "$with_iconv" = ""
- then
- with_iconv=no
- fi
- if test "$with_iso8859x" = ""
- then
- with_iso8859x=no
+if test "$with_c14n" = "yes"; then
+ if test "$with_output" = "no"; then
+ echo WARNING: --with-c14n overrides --without-output
fi
- if test "$with_mem_debug" = ""
- then
- with_mem_debug=no
+ with_output=yes
+ if test "$with_xpath" = "no"; then
+ echo WARNING: --with-c14n overrides --without-xpath
fi
- if test "$with_output" = ""
- then
- with_output=no
- fi
- if test "$with_pattern" = ""
- then
- with_pattern=no
- fi
- if test "$with_push" = ""
- then
- with_push=no
- fi
- if test "$with_python" = ""
- then
- with_python=no
- fi
- if test "$with_reader" = ""
- then
- with_reader=no
- fi
- if test "$with_readline" = ""
- then
- with_readline=no
- fi
- if test "$with_regexps" = ""
- then
- with_regexps=no
- fi
- if test "$with_run_debug" = ""
- then
- with_run_debug=no
- fi
- if test "$with_sax1" = ""
- then
- with_sax1=no
+ with_xpath=yes
+fi
+if test "$with_schemas" = "yes"; then
+ if test "$with_pattern" = "no"; then
+ echo WARNING: --with-schemas overrides --without-pattern
fi
- if test "$with_schemas" = ""
- then
- with_schemas=no
+ with_pattern=yes
+ if test "$with_regexps" = "no"; then
+ echo WARNING: --with-schemas overrides --without-regexps
fi
- if test "$with_schematron" = ""
- then
- with_schematron=no
+ with_regexps=yes
+fi
+if test "$with_schematron" = "yes"; then
+ if test "$with_pattern" = "no"; then
+ echo WARNING: --with-schematron overrides --without-pattern
fi
- if test "$with_threads" = ""
- then
- with_threads=no
+ with_pattern=yes
+ if test "$with_tree" = "no"; then
+ echo WARNING: --with-schematron overrides --without-tree
fi
- if test "$with_thread_alloc" = ""
- then
- with_thread_alloc=no
- fi
- if test "$with_tree" = ""
- then
- with_tree=no
+ with_tree=yes
+ if test "$with_xpath" = "no"; then
+ echo WARNING: --with-schematron overrides --without-xpath
fi
- if test "$with_valid" = ""
- then
- with_valid=no
+ with_xpath=yes
+fi
+if test "$with_reader" = "yes"; then
+ if test "$with_push" = "no"; then
+ echo WARNING: --with-reader overrides --without-push
fi
- if test "$with_writer" = ""
- then
- with_writer=no
+ with_push=yes
+ if test "$with_tree" = "no"; then
+ echo WARNING: --with-reader overrides --without-tree
fi
- if test "$with_xinclude" = ""
- then
- with_xinclude=no
+ with_tree=yes
+fi
+if test "$with_writer" = "yes"; then
+ if test "$with_output" = "no"; then
+ echo WARNING: --with-writer overrides --without-output
fi
- if test "$with_xpath" = ""
- then
- with_xpath=no
+ with_output=yes
+ if test "$with_push" = "no"; then
+ echo WARNING: --with-writer overrides --without-push
fi
- if test "$with_xptr" = ""
- then
- with_xptr=no
+ with_push=yes
+fi
+if test "$with_xinclude" = "yes"; then
+ if test "$with_xpath" = "no"; then
+ echo WARNING: --with-xinclude overrides --without-xpath
fi
- if test "$with_zlib" = ""
- then
- with_zlib=no
+ with_xpath=yes
+fi
+if test "$with_xptr_locs" = "yes"; then
+ if test "$with_xptr" = "no"; then
+ echo WARNING: --with-xptr-locs overrides --without-xptr
fi
- if test "$with_modules" = ""
- then
- with_modules=no
+ with_xptr=yes
+fi
+if test "$with_xptr" = "yes"; then
+ if test "$with_xpath" = "no"; then
+ echo WARNING: --with-xptr overrides --without-xpath
fi
+ with_xpath=yes
fi
-echo Checking zlib
-
-dnl Checks for zlib library.
-
-WITH_ZLIB=0
-if test "$with_zlib" = "no"; then
- echo "Disabling zlib compression support"
+if test "$with_minimum" = "yes"; then
+ dnl
+ dnl option to build a minimal libxml2 library
+ dnl
+ echo "Configuring for a minimal library"
+ test "$with_c14n" = "" && with_c14n=no
+ test "$with_catalog" = "" && with_catalog=no
+ test "$with_debug" = "" && with_debug=no
+ test "$with_fexceptions" = "" && with_fexceptions=no
+ test "$with_history" = "" && with_history=no
+ test "$with_html" = "" && with_html=no
+ test "$with_http" = "" && with_http=no
+ test "$with_iconv" = "" && with_iconv=no
+ test "$with_iso8859x" = "" && with_iso8859x=no
+ test "$with_mem_debug" = "" && with_mem_debug=no
+ test "$with_output" = "" && with_output=no
+ test "$with_pattern" = "" && with_pattern=no
+ test "$with_push" = "" && with_push=no
+ test "$with_python" = "" && with_python=no
+ test "$with_reader" = "" && with_reader=no
+ test "$with_readline" = "" && with_readline=no
+ test "$with_regexps" = "" && with_regexps=no
+ test "$with_run_debug" = "" && with_run_debug=no
+ test "$with_sax1" = "" && with_sax1=no
+ test "$with_schemas" = "" && with_schemas=no
+ test "$with_schematron" = "" && with_schematron=no
+ test "$with_threads" = "" && with_threads=no
+ test "$with_thread_alloc" = "" && with_thread_alloc=no
+ test "$with_tree" = "" && with_tree=no
+ test "$with_valid" = "" && with_valid=no
+ test "$with_writer" = "" && with_writer=no
+ test "$with_xinclude" = "" && with_xinclude=no
+ test "$with_xpath" = "" && with_xpath=no
+ test "$with_xptr" = "" && with_xptr=no
+ test "$with_zlib" = "" && with_zlib=no
+ test "$with_modules" = "" && with_modules=no
else
- # Don't run pkg-config if with_zlib contains a path.
- if test "x$Z_DIR" = "x"; then
- # Try pkg-config first so that static linking works.
- PKG_CHECK_MODULES([Z],[zlib],
- [WITH_ZLIB=1],
- [:])
+ dnl
+ dnl Disable dependent modules
+ dnl
+ if test "$with_output" = "no"; then
+ with_c14n=no
+ with_writer=no
fi
-
- if test "$WITH_ZLIB" = "0"; then
- AC_CHECK_HEADERS(zlib.h,
- AC_CHECK_LIB(z, gzread,[
- WITH_ZLIB=1
- if test "x${Z_DIR}" != "x"; then
- Z_CFLAGS="-I${Z_DIR}/include"
- Z_LIBS="-L${Z_DIR}/lib -lz"
- [case ${host} in
- *-*-solaris*)
- Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
- ;;
- esac]
- else
- Z_LIBS="-lz"
- fi])
- )
+ if test "$with_pattern" = "no"; then
+ with_schemas=no
+ with_schematron=no
fi
-fi
-
-AC_SUBST(Z_CFLAGS)
-AC_SUBST(Z_LIBS)
-AC_SUBST(WITH_ZLIB)
-
-echo Checking lzma
-
-dnl Checks for lzma library.
-
-WITH_LZMA=0
-if test "$with_lzma" = "no"; then
- echo "Disabling lzma compression support"
-else
- # Don't run pkg-config if with_lzma contains a path.
- if test "x$LZMA_DIR" = "x"; then
- # Try pkg-config first so that static linking works.
- PKG_CHECK_MODULES([LZMA],[liblzma],
- [WITH_LZMA=1],
- [:])
+ if test "$with_push" = "no"; then
+ with_reader=no
+ with_writer=no
fi
-
- # If pkg-config failed, fall back to AC_CHECK_LIB. This
- # will not pick up the necessary LIBS flags for liblzma's
- # private dependencies, though, so static linking may fail.
- if test "$WITH_LZMA" = "0"; then
- AC_CHECK_HEADERS(lzma.h,
- AC_CHECK_LIB(lzma, lzma_code,[
- WITH_LZMA=1
- if test "x${LZMA_DIR}" != "x"; then
- LZMA_CFLAGS="-I${LZMA_DIR}/include"
- LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
- else
- LZMA_LIBS="-llzma"
- fi])
- )
+ if test "$with_regexps" = "no"; then
+ with_schemas=no
+ fi
+ if test "$with_tree" = "no"; then
+ with_reader=no
+ with_schematron=no
+ fi
+ if test "$with_xpath" = "no"; then
+ with_c14n=no
+ with_schematron=no
+ with_xinclude=no
+ with_xptr=no
fi
fi
-AC_SUBST(LZMA_CFLAGS)
-AC_SUBST(LZMA_LIBS)
-AC_SUBST(WITH_LZMA)
-
-CPPFLAGS=${_cppflags}
-LIBS=${_libs}
-
-echo Checking headers
-
+dnl
dnl Checks for header files.
-AC_CHECK_HEADERS([fcntl.h])
-AC_CHECK_HEADERS([unistd.h])
-AC_CHECK_HEADERS([sys/stat.h])
-AC_CHECK_HEADERS([sys/types.h])
-AC_CHECK_HEADERS([stdint.h])
-AC_CHECK_HEADERS([inttypes.h])
-AC_CHECK_HEADERS([sys/socket.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-])
-AC_CHECK_HEADERS([netinet/in.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-])
-AC_CHECK_HEADERS([arpa/inet.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-#if HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-# endif
-])
-AC_CHECK_HEADERS([netdb.h])
-AC_CHECK_HEADERS([sys/time.h])
-AC_CHECK_HEADERS([sys/select.h])
-AC_CHECK_HEADERS([poll.h])
+dnl
+AC_CHECK_HEADERS([stdint.h inttypes.h])
+AC_CHECK_HEADERS([fcntl.h unistd.h sys/stat.h])
AC_CHECK_HEADERS([sys/mman.h])
-AC_CHECK_HEADERS([sys/timeb.h])
-AC_CHECK_HEADERS([arpa/nameser.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-])
-AC_CHECK_HEADERS([resolv.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-# endif
-#if HAVE_ARPA_NAMESER_H
-# include <arpa/nameser.h>
-# endif
-])
-AC_CHECK_HEADERS([dl.h])
-AC_CHECK_HEADERS([dlfcn.h])
-
-
-echo Checking types
+AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h netdb.h])
+AC_CHECK_HEADERS([sys/select.h poll.h])
+AC_CHECK_HEADERS([sys/time.h sys/timeb.h])
+AC_CHECK_HEADERS([dl.h dlfcn.h])
+AC_CHECK_HEADERS([glob.h])
+AM_CONDITIONAL(WITH_GLOB, test "$ac_cv_header_glob_h" = "yes")
+dnl
+dnl Checking types
+dnl
AC_TYPE_UINT32_T
-
-echo Checking libraries
+dnl
+dnl Checking libraries
+dnl
+AC_CHECK_FUNCS(snprintf vsnprintf,, NEED_TRIO=1)
dnl Checks for library functions.
-AC_CHECK_FUNCS(gettimeofday ftime)
-AC_CHECK_FUNCS(stat)
-AC_CHECK_FUNCS(rand_r)
-AC_CHECK_FUNCS(isascii mmap munmap putenv)
+AC_CHECK_FUNCS([gettimeofday ftime stat rand_r isascii mmap munmap putenv])
AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */
#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
@@ -541,68 +345,95 @@ va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1],[
AC_MSG_RESULT(yes)
AC_DEFINE([VA_LIST_IS_ARRAY], [1],[Define if va_list is an array type])])
-dnl Checks for inet libraries:
-AC_SEARCH_LIBS(gethostent, [nsl])
-AC_SEARCH_LIBS(setsockopt, [socket net network])
-AC_SEARCH_LIBS(connect, [inet])
+dnl
+dnl Checks for inet libraries
+dnl
+if test "$with_http" != "no" || test "with_ftp" = "yes"; then
+ case "$host" in
+ *-*-mingw*)
+ dnl AC_SEARCH_LIBS doesn't work because of non-standard calling
+ dnl conventions on 32-bit Windows.
+ NET_LIBS="$NET_LIBS -lws2_32"
+ ;;
+ *)
+ _libs=$LIBS
+ AC_SEARCH_LIBS(gethostbyname, [nsl], [
+ if test "$ac_cv_search_gethostbyname" != "none required"; then
+ NET_LIBS="$NET_LIBS $ac_cv_search_gethostbyname"
+ fi], [:], [$NET_LIBS])
+ AC_SEARCH_LIBS(connect, [bsd socket inet], [
+ if test "$ac_cv_search_connect" != "none required"; then
+ NET_LIBS="$NET_LIBS $ac_cv_search_connect"
+ fi], [:], [$NET_LIBS])
+ LIBS=$_libs
+ ;;
+ esac
-dnl Determine what socket length (socklen_t) data type is
-AC_MSG_CHECKING([for type of socket length (socklen_t)])
-AC_TRY_COMPILE2([
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/socket.h>],[
-(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
- AC_MSG_RESULT(socklen_t *)
- XML_SOCKLEN_T=socklen_t],[
- AC_TRY_COMPILE2([
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/socket.h>],[
-(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
- AC_MSG_RESULT(size_t *)
- XML_SOCKLEN_T=size_t],[
+ dnl Determine what socket length (socklen_t) data type is
+ AC_MSG_CHECKING([for type of socket length (socklen_t)])
AC_TRY_COMPILE2([
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/socket.h>],[
-(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
- AC_MSG_RESULT(int *)
- XML_SOCKLEN_T=int],[
- AC_MSG_WARN(could not determine)
- XML_SOCKLEN_T="int"])])])
-AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
-
-dnl Checking if gethostbyname() argument is const.
-AC_MSG_CHECKING([for const gethostbyname() argument])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
- [[(void)gethostbyname((const char *)"");]])],
-have_gethostbyname_const_arg=yes,
-have_gethostbyname_const_arg=no)
-AC_MSG_RESULT($have_gethostbyname_const_arg)
-if test x"$have_gethostbyname_const_arg" = x"yes"; then
- AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [],
- [Type cast for the gethostbyname() argument])
-else
- AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [(char *)],
- [Type cast for the gethostbyname() argument])
+ #include <stddef.h>
+ #ifdef _WIN32
+ #include <ws2tcpip.h>
+ #else
+ #include <sys/socket.h>
+ #endif],[
+ (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
+ AC_MSG_RESULT(socklen_t *)
+ XML_SOCKLEN_T=socklen_t],[
+ AC_TRY_COMPILE2([
+ #include <stddef.h>
+ #include <sys/socket.h>],[
+ (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
+ AC_MSG_RESULT(size_t *)
+ XML_SOCKLEN_T=size_t],[
+ AC_TRY_COMPILE2([
+ #include <stddef.h>
+ #include <sys/socket.h>],[
+ (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
+ AC_MSG_RESULT(int *)
+ XML_SOCKLEN_T=int],[
+ AC_MSG_WARN(could not determine)
+ XML_SOCKLEN_T="int"])])])
+ AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
+
+ dnl
+ dnl Checking for availability of IPv6
+ dnl
+ AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
+ if test "$with_minimum" = "yes"
+ then
+ enable_ipv6=no
+ fi
+ if test $enable_ipv6 = yes; then
+ AC_MSG_CHECKING([whether to enable IPv6])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #ifdef _WIN32
+ #include <winsock2.h>
+ #else
+ #include <sys/socket.h>
+ #ifdef HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+ #endif
+ ]], [[
+ struct sockaddr_storage ss;
+ socket(AF_INET6, SOCK_STREAM, 0);
+ getaddrinfo(0, 0, 0, 0);
+ ]])], [
+ AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
+ AC_MSG_RESULT([yes])], [
+ AC_MSG_RESULT([no])]
+ )
+ fi
fi
-dnl Checking if send() second argument is const.
-AC_MSG_CHECKING([for const send() second argument])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#include <sys/socket.h>]],
- [[(void)send(1,(const char *)"",1,1);]])],
-have_send_const_arg2=yes,
-have_send_const_arg2=no)
-AC_MSG_RESULT($have_send_const_arg2)
-if test x"$have_send_const_arg2" = x"yes"; then
- AC_DEFINE([SEND_ARG2_CAST], [],
- [Type cast for the send() function 2nd arg])
-else
- AC_DEFINE([SEND_ARG2_CAST], [(char *)],
- [Type cast for the send() function 2nd arg])
-fi
+dnl
+dnl Extra flags
+dnl
+XML_LIBDIR='-L${libdir}'
+XML_INCLUDEDIR='-I${includedir}/libxml2'
+XML_CFLAGS=""
dnl Checking whether __attribute__((destructor)) is accepted by the compiler
AC_MSG_CHECKING([whether __attribute__((destructor)) is accepted])
@@ -614,99 +445,26 @@ f(void) {}], [], [
AC_DEFINE([ATTRIBUTE_DESTRUCTOR], [__attribute__((destructor))],[A form that will not confuse apibuild.py])],[
AC_MSG_RESULT(no)])
-
-dnl ***********************Checking for availability of IPv6*******************
-
-AC_MSG_CHECKING([whether to enable IPv6])
-AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
-if test "$with_minimum" = "yes"
-then
- enable_ipv6=no
-fi
-if test $enable_ipv6 = yes; then
- have_ipv6=no
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-# include <sys/types.h>
-# include <sys/socket.h>
- ]], [[
- struct sockaddr_storage ss;
- socket(AF_INET6, SOCK_STREAM, 0)
- ]])],
- have_ipv6=yes,
- have_ipv6=no
- )
- AC_MSG_RESULT($have_ipv6)
-
- if test $have_ipv6 = yes; then
- AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
- have_broken_ss_family=no
-
- dnl *********************************************************************
- dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
- dnl a ss_family member, but rather __ss_family. Let's detect that
- dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
- dnl platforms. However, we should only do this if ss_family is not
- dnl present.
- dnl ********************************************************************
- AC_MSG_CHECKING([struct sockaddr::ss_family])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-# include <sys/types.h>
-# include <sys/socket.h>
- ]], [[
- struct sockaddr_storage ss ;
- ss.ss_family = 0 ;
- ]])],
- have_ss_family=yes,
- have_ss_family=no
- )
- AC_MSG_RESULT($have_ss_family)
- if test x$have_ss_family = xno ; then
- AC_MSG_CHECKING([broken struct sockaddr::ss_family])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-# include <sys/types.h>
-# include <sys/socket.h>
- ]], [[
- struct sockaddr_storage ss ;
- ss.__ss_family = 0 ;
- ]])],
- have_broken_ss_family=yes,
- have_broken_ss_family=no
- )
- AC_MSG_RESULT($have_broken_ss_family)
- if test x$have_broken_ss_family = xyes ; then
- AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
- [Whether struct sockaddr::__ss_family exists])
- AC_DEFINE(ss_family, __ss_family,
- [ss_family is not defined here, use __ss_family instead])
- else
- AC_MSG_WARN(ss_family and __ss_family not found)
- fi
- fi
-
- have_getaddrinfo=no
- AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
- if test $have_getaddrinfo != yes; then
- for lib in bsd socket inet; do
- AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
- done
- fi
-
- if test $have_getaddrinfo = yes; then
- AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
- fi
- fi
-fi
-
-dnl ******************************End IPv6 checks******************************
-
-XML_LIBDIR='-L${libdir}'
-XML_INCLUDEDIR='-I${includedir}/libxml2'
-
dnl
-dnl Extra flags
+dnl Linker version scripts for symbol versioning
dnl
-XML_CFLAGS=""
-RDL_LIBS=""
+VERSION_SCRIPT_FLAGS=
+# lt_cv_prog_gnu_ld is from libtool 2.+
+if test "$lt_cv_prog_gnu_ld" = yes; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-msys* )
+ ;;
+ *)
+ VERSION_SCRIPT_FLAGS=-Wl,--version-script=
+ ;;
+ esac
+else
+ case $host in
+ *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
+ esac
+fi
+AC_SUBST(VERSION_SCRIPT_FLAGS)
+AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
dnl
dnl Workaround for native compilers
@@ -716,13 +474,13 @@ dnl
if test "${GCC}" != "yes" ; then
case "${host}" in
hppa*-*-hpux* )
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wp,-H30000"
+ AM_CFLAGS="${AM_CFLAGS} -Wp,-H30000"
;;
*-dec-osf* )
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee"
+ AM_CFLAGS="${AM_CFLAGS} -ieee"
;;
alpha*-*-linux* )
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee"
+ AM_CFLAGS="${AM_CFLAGS} -ieee"
;;
esac
else
@@ -732,19 +490,19 @@ else
# Not activated by default because this inflates the code size
# Used to allow propagation of C++ exceptions through the library
#
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -fexceptions"
+ AM_CFLAGS="${AM_CFLAGS} -fexceptions"
fi
# warnings we'd like to see
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
+ AM_CFLAGS="${AM_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline"
# warnings we'd like to suppress
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wno-long-long -Wno-format-extra-args"
+ AM_CFLAGS="${AM_CFLAGS} -Wno-long-long -Wno-format-extra-args"
case "${host}" in
alpha*-*-linux* )
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee"
+ AM_CFLAGS="${AM_CFLAGS} -mieee"
;;
alpha*-*-osf* )
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee"
+ AM_CFLAGS="${AM_CFLAGS} -mieee"
;;
esac
fi
@@ -755,769 +513,227 @@ case ${host} in
hppa*-hp-mpeix)
NEED_TRIO=1
;;
- *-*-mingw* | *-*-cygwin* | *-*-msvc* )
+ *-*-cygwin* | *-*-mingw* | *-*-msys* )
# If the host is Windows, and shared libraries are disabled, we
- # need to add -DLIBXML_STATIC to EXTRA_CFLAGS in order for linking to
+ # need to add -DLIBXML_STATIC to AM_CFLAGS in order for linking to
# work properly (without it, xmlexports.h would force the use of
# DLL imports, which obviously aren't present in a static
# library).
if test "x$enable_shared" = "xno"; then
XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
- EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBXML_STATIC"
+ AM_CFLAGS="$AM_CFLAGS -DLIBXML_STATIC"
fi
;;
esac
dnl
-dnl check for python
-dnl
-
-PYTHON_VERSION=
-PYTHON_INCLUDES=
-PYTHON_SITE_PACKAGES=
-PYTHON_TESTS=
-pythondir=
-if test "$with_python" != "no" ; then
- if test -x "$with_python/bin/python"
- then
- echo Found python in $with_python/bin/python
- PYTHON="$with_python/bin/python"
- else
- if test -x "$with_python/python.exe"
- then
- echo Found python in $with_python/python.exe
- PYTHON="$with_python/python.exe"
- else
- if test -x "$with_python"
- then
- echo Found python in $with_python
- PYTHON="$with_python"
- else
- if test -x "$PYTHON"
- then
- echo Found python in environment PYTHON=$PYTHON
- with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
- else
- AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
- fi
- fi
- fi
- fi
- if test "$PYTHON" != ""
- then
- PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
- PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`
-# does not work as it produce a /usr/lib/python path instead of/usr/lib64/python
-#
-# PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
- echo Found Python version $PYTHON_VERSION
- fi
- if test "$PYTHON_VERSION" != "" -a "$PYTHON_INCLUDES" = ""
- then
- if test -r $with_python/include/python$PYTHON_VERSION/Python.h
- then
- PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
- else
- if test -r $prefix/include/python$PYTHON_VERSION/Python.h
- then
- PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
- else
- if test -r /usr/include/python$PYTHON_VERSION/Python.h
- then
- PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
- else
- if test -r $with_python/include/Python.h
- then
- PYTHON_INCLUDES=$with_python/include
- else
- echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
- fi
- fi
- fi
- fi
- fi
- if test "$with_python_install_dir" != ""
- then
- PYTHON_SITE_PACKAGES="$with_python_install_dir"
- fi
- if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = ""
- then
- if test -d $libdir/python$PYTHON_VERSION/site-packages
- then
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
- else
- if test -d $with_python/lib/site-packages
- then
- PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
- else
- PYTHON_SITE_PACKAGES=$($PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(True,False,"${exec_prefix}"))')
- fi
- fi
- fi
- pythondir='$(PYTHON_SITE_PACKAGES)'
- PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
-else
- PYTHON=
-fi
-AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
-if test "$PYTHON_INCLUDES" != ""
-then
- PYTHON_SUBDIR=python
-else
- PYTHON_SUBDIR=
-fi
-AC_SUBST(pythondir)
-AC_SUBST(PYTHON_SUBDIR)
-AC_SUBST(PYTHON_LIBS)
-
-dnl check for dso support
-WITH_MODULES=0
-TEST_MODULES=
-
-if test "$with_modules" != "no" ; then
- case "$host" in
- *-*-cygwin*)
- MODULE_EXTENSION=".dll"
- AC_CHECK_LIB(cygwin, dlopen, [
- WITH_MODULES=1
- MODULE_PLATFORM_LIBS=
- AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
- ])
- ;;
- *-*-mingw*)
- MODULE_EXTENSION=".dll"
- WITH_MODULES=1
- ;;
- *)
- AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
- AC_CHECK_LIB(dld, shl_load, [
- MODULE_PLATFORM_LIBS="-ldld"
- libxml_have_shl_load=yes], [
- AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
- AC_CHECK_LIB(dl, dlopen, [
- MODULE_PLATFORM_LIBS="-ldl"
- libxml_have_dlopen=yes])])])])
-
- if test "${libxml_have_shl_load}" = "yes"; then
- MODULE_EXTENSION=".sl"
- WITH_MODULES=1
- AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
- fi
-
- if test "${libxml_have_dlopen}" = "yes"; then
- case "${host}" in
- *-*-hpux* )
- MODULE_EXTENSION=".sl"
- ;;
- * )
- MODULE_EXTENSION=".so"
- ;;
- esac
-
- WITH_MODULES=1
- AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
- fi
- ;;
- esac
-fi
-
-if test "${WITH_MODULES}" = "1"; then
- TEST_MODULES="ModuleTests"
-fi
-
-AC_SUBST(WITH_MODULES)
-AC_SUBST(MODULE_PLATFORM_LIBS)
-AC_SUBST(MODULE_EXTENSION)
-AC_SUBST(TEST_MODULES)
-
-dnl
-dnl Check for trio string functions
+dnl Simple API modules
dnl
-if test "${NEED_TRIO}" = "1" ; then
- echo Adding trio library for string functions
- WITH_TRIO=1
-else
- WITH_TRIO=0
-fi
-AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
-AC_SUBST(WITH_TRIO)
-
-dnl
-dnl Allow to enable/disable various pieces
-dnl
-echo Checking configuration requirements
-
-dnl
-dnl Thread-related stuff
-dnl
-THREAD_LIBS=""
-BASE_THREAD_LIBS=""
-WITH_THREADS=0
-THREAD_CFLAGS=""
-TEST_THREADS=""
-THREADS_W32=""
-WITH_THREAD_ALLOC=0
-
-if test "$with_threads" = "no" ; then
- echo Disabling multithreaded support
-else
- echo Enabling multithreaded support
-
- dnl Default to native threads on Windows
- case $host_os in
- *mingw*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
- WITH_THREADS="1"
- THREADS_W32="1"
- THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
- fi
- ;;
- esac
-
- dnl Use pthread by default in other cases
- if test -z "$THREADS_W32"; then
- if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
- AC_CHECK_HEADER(pthread.h,
- AC_CHECK_LIB(pthread, pthread_join,[
- THREAD_LIBS="-lpthread"
- AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
- WITH_THREADS="1"]))
- fi
- fi
-
- case $host_os in
- *cygwin*) THREAD_LIBS=""
- ;;
- *beos*) WITH_THREADS="1"
- THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
- ;;
- *linux*)
- if test "${GCC}" = "yes" ; then
- GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
- GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
- GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
- if test "${THREAD_LIBS}" = "-lpthread" ; then
- if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
- then
- THREAD_LIBS=""
- BASE_THREAD_LIBS="-lpthread"
- else
- if expr ${GCC_MAJOR} \> 3 > /dev/null
- then
- THREAD_LIBS=""
- BASE_THREAD_LIBS="-lpthread"
- else
- echo old GCC disabling weak symbols for pthread
- fi
- fi
- fi
- fi
- ;;
- esac
- if test "$WITH_THREADS" = "1" ; then
- THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
- TEST_THREADS="Threadtests"
- fi
-fi
-if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
- WITH_THREAD_ALLOC=1
-fi
-
-AC_SUBST(THREAD_LIBS)
-AC_SUBST(BASE_THREAD_LIBS)
-AC_SUBST(WITH_THREADS)
-AC_SUBST(THREAD_CFLAGS)
-AC_SUBST(TEST_THREADS)
-AC_SUBST(WITH_THREAD_ALLOC)
-AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"])
-
-dnl
-dnl xmllint shell history
-dnl
-if test "$with_history" = "yes" ; then
- echo Enabling xmllint shell history
- dnl check for terminal library. this is a very cool solution
- dnl from octave's configure.in
- unset tcap
- for termlib in ncurses curses termcap terminfo termlib; do
- AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
- test -n "$tcap" && break
- done
-
- AC_CHECK_HEADER(readline/history.h,
- AC_CHECK_LIB(history, append_history,[
- RDL_LIBS="-lhistory"
- AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
- AC_CHECK_HEADER(readline/readline.h,
- AC_CHECK_LIB(readline, readline,[
- RDL_LIBS="-lreadline $RDL_LIBS $tcap"
- AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
- if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
- CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
- RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
- fi
-fi
-
-dnl
-dnl Tree functions
-dnl
if test "$with_tree" = "no" ; then
echo Disabling DOM like tree manipulation APIs
WITH_TREE=0
-else
+else
WITH_TREE=1
fi
AC_SUBST(WITH_TREE)
if test "$with_ftp" != "yes" ; then
- echo Disabling FTP support
WITH_FTP=0
- FTP_OBJ=
-else
+else
+ echo Enabling FTP support
WITH_FTP=1
- FTP_OBJ=nanoftp.o
fi
AC_SUBST(WITH_FTP)
-AC_SUBST(FTP_OBJ)
+AM_CONDITIONAL(WITH_FTP_SOURCES, test "$WITH_FTP" = "1")
if test "$with_http" = "no" ; then
echo Disabling HTTP support
WITH_HTTP=0
- HTTP_OBJ=
-else
+else
WITH_HTTP=1
- HTTP_OBJ=nanohttp.o
fi
AC_SUBST(WITH_HTTP)
-AC_SUBST(HTTP_OBJ)
+AM_CONDITIONAL(WITH_HTTP_SOURCES, test "$WITH_HTTP" = "1")
if test "$with_legacy" != "yes" ; then
- echo Disabling deprecated APIs
WITH_LEGACY=0
-else
+else
+ echo Enabling deprecated APIs
WITH_LEGACY=1
fi
AC_SUBST(WITH_LEGACY)
+AM_CONDITIONAL(WITH_LEGACY_SOURCES, test "$WITH_LEGACY" = "1")
if test "$with_reader" = "no" ; then
echo Disabling the xmlReader parsing interface
WITH_READER=0
- READER_TEST=
-else
+else
WITH_READER=1
- READER_TEST=Readertests
- if test "$with_push" = "no" ; then
- echo xmlReader requires Push interface - enabling it
- with_push=yes
- fi
fi
AC_SUBST(WITH_READER)
-AC_SUBST(READER_TEST)
+AM_CONDITIONAL(WITH_READER_SOURCES, test "$WITH_READER" = "1")
if test "$with_writer" = "no" ; then
echo Disabling the xmlWriter saving interface
WITH_WRITER=0
-# WRITER_TEST=
-else
+else
WITH_WRITER=1
-# WRITER_TEST=Writertests
- if test "$with_push" = "no" ; then
- echo xmlWriter requires Push interface - enabling it
- with_push=yes
- fi
- if test "$with_output" = "no" ; then
- echo xmlWriter requires Output interface - enabling it
- with_output=yes
- fi
fi
AC_SUBST(WITH_WRITER)
-#AC_SUBST(WRITER_TEST)
+AM_CONDITIONAL(WITH_WRITER_SOURCES, test "$WITH_WRITER" = "1")
if test "$with_pattern" = "no" ; then
echo Disabling the xmlPattern parsing interface
WITH_PATTERN=0
- TEST_PATTERN=
-else
+else
WITH_PATTERN=1
- TEST_PATTERN=Patterntests
fi
AC_SUBST(WITH_PATTERN)
-AC_SUBST(TEST_PATTERN)
+AM_CONDITIONAL(WITH_PATTERN_SOURCES, test "$WITH_PATTERN" = "1")
if test "$with_sax1" = "no" ; then
echo Disabling the older SAX1 interface
WITH_SAX1=0
- TEST_SAX=
-else
+else
WITH_SAX1=1
- TEST_SAX=SAXtests
fi
AC_SUBST(WITH_SAX1)
-AM_CONDITIONAL(WITH_SAX1_SOURCES, test "${WITH_TRIO}" = "1")
-AC_SUBST(TEST_SAX)
+AM_CONDITIONAL(WITH_SAX1_SOURCES, test "$WITH_SAX1" = "1")
if test "$with_push" = "no" ; then
echo Disabling the PUSH parser interfaces
WITH_PUSH=0
- TEST_PUSH=
-else
+else
WITH_PUSH=1
- TEST_PUSH="XMLPushtests"
fi
AC_SUBST(WITH_PUSH)
-AC_SUBST(TEST_PUSH)
if test "$with_html" = "no" ; then
echo Disabling HTML support
WITH_HTML=0
- HTML_OBJ=
- TEST_HTML=
-else
+else
WITH_HTML=1
- HTML_OBJ="HTMLparser.o HTMLtree.o"
- TEST_HTML=HTMLtests
- if test "$with_push" != "no" ; then
- TEST_PHTML=HTMLPushtests
- else
- TEST_PHTML=
- fi
fi
AC_SUBST(WITH_HTML)
-AC_SUBST(HTML_OBJ)
-AC_SUBST(TEST_HTML)
-AC_SUBST(TEST_PHTML)
+AM_CONDITIONAL(WITH_HTML_SOURCES, test "$WITH_HTML" = "1")
if test "$with_valid" = "no" ; then
echo Disabling DTD validation support
WITH_VALID=0
- TEST_VALID=
- TEST_VTIME=
-else
+else
WITH_VALID=1
- TEST_VALID=Validtests
- TEST_VTIME=VTimingtests
fi
AC_SUBST(WITH_VALID)
-AC_SUBST(TEST_VALID)
-AC_SUBST(TEST_VTIME)
+AM_CONDITIONAL(WITH_VALID_SOURCES, test "$WITH_VALID" = "1")
if test "$with_catalog" = "no" ; then
echo Disabling Catalog support
WITH_CATALOG=0
- CATALOG_OBJ=
- TEST_CATALOG=
-else
+else
WITH_CATALOG=1
- CATALOG_OBJ="catalog.o"
- TEST_CATALOG=Catatests
fi
AC_SUBST(WITH_CATALOG)
-AC_SUBST(CATALOG_OBJ)
-AC_SUBST(TEST_CATALOG)
-
-if test "$with_docbook" != "yes" ; then
- echo Disabling Docbook support
- WITH_DOCB=0
- DOCB_OBJ=
-else
- WITH_DOCB=1
- DOCB_OBJ="DOCBparser.o"
-fi
-AC_SUBST(WITH_DOCB)
-AC_SUBST(DOCB_OBJ)
-
+AM_CONDITIONAL(WITH_CATALOG_SOURCES, test "$WITH_CATALOG" = "1")
if test "$with_xptr" = "no" ; then
echo Disabling XPointer support
WITH_XPTR=0
- XPTR_OBJ=
- TEST_XPTR=
-else
+ WITH_XPTR_LOCS=0
+else
WITH_XPTR=1
- XPTR_OBJ=xpointer.o
- TEST_XPTR=XPtrtests
- if test "$with_xpath" = "no" ; then
- echo XPointer requires XPath support - enabling it
- with_xpath=yes
- fi
fi
AC_SUBST(WITH_XPTR)
-AC_SUBST(XPTR_OBJ)
-AC_SUBST(TEST_XPTR)
+AM_CONDITIONAL(WITH_XPTR_SOURCES, test "$WITH_XPTR" = "1")
+
+if test "$with_xptr_locs" != "yes" ; then
+ WITH_XPTR_LOCS=0
+else
+ echo Enabling Xpointer locations support
+ WITH_XPTR_LOCS=1
+fi
+AC_SUBST(WITH_XPTR_LOCS)
if test "$with_c14n" = "no" ; then
echo Disabling C14N support
WITH_C14N=0
- C14N_OBJ=
- TEST_C14N=
-else
+else
WITH_C14N=1
- C14N_OBJ="c14n.c"
- TEST_C14N=C14Ntests
- if test "$with_xpath" = "no" ; then
- echo C14N requires XPath support - enabling it
- with_xpath=yes
- fi
fi
AC_SUBST(WITH_C14N)
-AC_SUBST(C14N_OBJ)
-AC_SUBST(TEST_C14N)
+AM_CONDITIONAL(WITH_C14N_SOURCES, test "$WITH_C14N" = "1")
if test "$with_xinclude" = "no" ; then
echo Disabling XInclude support
WITH_XINCLUDE=0
- XINCLUDE_OBJ=
- with_xinclude="no"
- TEST_XINCLUDE=
-else
+else
WITH_XINCLUDE=1
- XINCLUDE_OBJ=xinclude.o
- TEST_XINCLUDE=XIncludetests
- if test "$with_xpath" = "no" ; then
- echo XInclude requires XPath support - enabling it
- with_xpath=yes
- fi
fi
AC_SUBST(WITH_XINCLUDE)
-AC_SUBST(XINCLUDE_OBJ)
-AC_SUBST(TEST_XINCLUDE)
-
-if test "$with_xptr" = "" -a "$with_xpath" = "no" ; then
- with_xptr=no
-fi
-
-if test "$with_schematron" = "" -a "$with_xpath" = "no" ; then
- with_schematron=no
-fi
+AM_CONDITIONAL(WITH_XINCLUDE_SOURCES, test "$WITH_XINCLUDE" = "1")
if test "$with_schematron" = "no" ; then
echo "Disabling Schematron support"
WITH_SCHEMATRON=0
- TEST_SCHEMATRON=
-else
- echo "Enabled Schematron support"
+else
WITH_SCHEMATRON=1
- TEST_SCHEMATRON="Schematrontests"
- with_xpath=yes
- with_pattern=yes
- with_schematron=yes
fi
AC_SUBST(WITH_SCHEMATRON)
-AC_SUBST(TEST_SCHEMATRON)
+AM_CONDITIONAL(WITH_SCHEMATRON_SOURCES, test "$WITH_SCHEMATRON" = "1")
if test "$with_xpath" = "no" ; then
echo Disabling XPATH support
WITH_XPATH=0
- XPATH_OBJ=
- TEST_XPATH=
-else
+else
WITH_XPATH=1
- XPATH_OBJ=xpath.o
- TEST_XPATH=XPathtests
fi
AC_SUBST(WITH_XPATH)
-AC_SUBST(XPATH_OBJ)
-AC_SUBST(TEST_XPATH)
+AM_CONDITIONAL(WITH_XPATH_SOURCES, test "$WITH_XPATH" = "1")
-dnl
-dnl output functions
-dnl
if test "$with_output" = "no" ; then
echo Disabling serialization/saving support
WITH_OUTPUT=0
-else
+else
WITH_OUTPUT=1
fi
AC_SUBST(WITH_OUTPUT)
+AM_CONDITIONAL(WITH_OUTPUT_SOURCES, test "$WITH_OUTPUT" = "1")
-WITH_ICONV=0
-if test "$with_iconv" = "no" ; then
- echo Disabling ICONV support
-else
- if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
- CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
- # Export this since our headers include iconv.h
- XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
- ICONV_LIBS="-L$with_iconv/lib"
- fi
-
- AC_CHECK_HEADER(iconv.h,
- AC_MSG_CHECKING(for iconv)
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-#include <iconv.h>]],[[
-iconv_t cd = iconv_open ("","");
-iconv (cd, NULL, NULL, NULL, NULL);]])],[
- AC_MSG_RESULT(yes)
- WITH_ICONV=1],[
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(for iconv in -liconv)
-
- _ldflags="${LDFLAGS}"
- _libs="${LIBS}"
- LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
- LIBS="${LIBS} -liconv"
-
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-#include <iconv.h>]],[[
-iconv_t cd = iconv_open ("","");
-iconv (cd, NULL, NULL, NULL, NULL);]])],[
- AC_MSG_RESULT(yes)
- WITH_ICONV=1
- ICONV_LIBS="${ICONV_LIBS} -liconv"
- LIBS="${_libs}"
- LDFLAGS="${_ldflags}"],[
- AC_MSG_RESULT(no)
- LIBS="${_libs}"
- LDFLAGS="${_ldflags}"])]))
-
- if test "$WITH_ICONV" = "1" ; then
- AC_MSG_CHECKING([for iconv declaration])
- AC_CACHE_VAL(xml_cv_iconv_arg2, [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
-]], [])], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
-
- xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
- AC_MSG_RESULT([${xml_xxx:-
- }$xml_cv_iconv_decl])
- AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
- [Define as const if the declaration of iconv() needs const.])
- fi
-fi
-case "$host" in
- *mingw*) M_LIBS=""
- ;;
- *beos*) M_LIBS=""
- ;;
- *haiku*) M_LIBS=""
- ;;
- *) M_LIBS="-lm"
- ;;
-esac
-AC_SUBST(WITH_ICONV)
-
-WITH_ICU=0
-ICU_LIBS=""
-if test "$with_icu" != "yes" ; then
- echo Disabling ICU support
-else
- # Try pkg-config first so that static linking works.
- # If this succeeeds, we ignore the WITH_ICU directory.
- PKG_CHECK_MODULES([ICU],[icu-i18n],
- [have_libicu=yes],
- [have_libicu=no])
-
- # If pkg-config failed, fall back to AC_CHECK_LIB. This
- # will not pick up the necessary LIBS flags for liblzma's
- # private dependencies, though, so static linking may fail.
- if test "x$have_libicu" = "xno"; then
- ICU_CONFIG=icu-config
- if ${ICU_CONFIG} --cflags >/dev/null 2>&1
- then
- ICU_LIBS=`${ICU_CONFIG} --ldflags`
- have_libicu=yes
- echo Enabling ICU support
- else
- if test "$with_icu" != "yes" -a "$with_iconv" != "" ; then
- CPPFLAGS="${CPPFLAGS} -I$with_icu"
- fi
-
- AC_CHECK_HEADER(unicode/ucnv.h,
- AC_MSG_CHECKING(for icu)
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unicode/ucnv.h>]], [[
- UConverter *utf = ucnv_open("UTF-8", NULL);]])],[
- AC_MSG_RESULT(yes)
- have_libicu=yes],[
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(for icu in -licucore)
-
- _ldflags="${LDFLAGS}"
- _libs="${LIBS}"
- LDFLAGS="${LDFLAGS} ${ICU_LIBS}"
- LIBS="${LIBS} -licucore"
-
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unicode/ucnv.h>]], [[
- UConverter *utf = ucnv_open("UTF-8", NULL);]])],[
- AC_MSG_RESULT(yes)
- have_libicu=yes
- ICU_LIBS="${ICU_LIBS} -licucore"
- LIBS="${_libs}"
- LDFLAGS="${_ldflags}"],[
- AC_MSG_RESULT(no)
- LIBS="${_libs}"
- LDFLAGS="${_ldflags}"])]))
- fi
- fi
-
- # Found the library via either method?
- if test "x$have_libicu" = "xyes"; then
- WITH_ICU=1
- fi
-fi
-XML_LIBS="-lxml2"
-XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $M_LIBS $LIBS"
-XML_LIBTOOLLIBS="libxml2.la"
-AC_SUBST(WITH_ICU)
-
-WITH_ISO8859X=1
-if test "$WITH_ICONV" != "1" ; then
-if test "$with_iso8859x" = "no" ; then
+if test "$WITH_ICONV" != "1" && test "$with_iso8859x" = "no" ; then
echo Disabling ISO8859X support
WITH_ISO8859X=0
-fi
+else
+ WITH_ISO8859X=1
fi
AC_SUBST(WITH_ISO8859X)
if test "$with_schemas" = "no" ; then
echo "Disabling Schemas/Relax-NG support"
WITH_SCHEMAS=0
- TEST_SCHEMAS=
-else
- echo "Enabled Schemas/Relax-NG support"
+else
WITH_SCHEMAS=1
- TEST_SCHEMAS="Schemastests Relaxtests"
- if test "$PYTHON_INCLUDES" != "" ; then
- PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
- fi
- with_regexps=yes
fi
AC_SUBST(WITH_SCHEMAS)
-AC_SUBST(TEST_SCHEMAS)
+AM_CONDITIONAL(WITH_SCHEMAS_SOURCES, test "$WITH_SCHEMAS" = "1")
if test "$with_regexps" = "no" ; then
echo Disabling Regexps support
WITH_REGEXPS=0
- TEST_REGEXPS=
-else
+else
WITH_REGEXPS=1
- TEST_REGEXPS="Regexptests Automatatests"
fi
AC_SUBST(WITH_REGEXPS)
-AC_SUBST(TEST_REGEXPS)
+AM_CONDITIONAL(WITH_REGEXPS_SOURCES, test "$WITH_REGEXPS" = "1")
if test "$with_debug" = "no" ; then
echo Disabling DEBUG support
WITH_DEBUG=0
- DEBUG_OBJ=
- TEST_DEBUG=
-else
+else
WITH_DEBUG=1
- DEBUG_OBJ=debugXML.o
- TEST_DEBUG=Scripttests
fi
AC_SUBST(WITH_DEBUG)
-AC_SUBST(DEBUG_OBJ)
-AC_SUBST(TEST_DEBUG)
+AM_CONDITIONAL(WITH_DEBUG_SOURCES, test "$WITH_DEBUG" = "1")
if test "$with_mem_debug" = "yes" ; then
if test "$with_thread_alloc" = "yes" ; then
@@ -1527,113 +743,400 @@ if test "$with_mem_debug" = "yes" ; then
echo Enabling memory debug support
WITH_MEM_DEBUG=1
fi
-else
+else
WITH_MEM_DEBUG=0
fi
AC_SUBST(WITH_MEM_DEBUG)
-if test "$with_run_debug" = "yes" ; then
- echo Enabling runtime debug support
- WITH_RUN_DEBUG=1
+dnl
+dnl Check for Python
+dnl
+
+AS_IF([test "x$with_python" != "xno"], [
+ AM_PATH_PYTHON
+ PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
+])
+AM_CONDITIONAL([WITH_PYTHON], [test "x$with_python" != "xno"])
+
+dnl
+dnl Extra Python flags for Windows
+dnl
+PYTHON_LDFLAGS=
+if test "${PYTHON}" != ""; then
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-msys* )
+ PYTHON_LDFLAGS="-no-undefined -shrext .pyd"
+ ;;
+ esac
+fi
+AC_SUBST(PYTHON_LDFLAGS)
+
+dnl
+dnl Check for DSO support
+dnl
+WITH_MODULES=0
+
+if test "$with_modules" != "no" ; then
+ case "$host" in
+ *-*-cygwin* | *-*-msys* )
+ MODULE_EXTENSION=".dll"
+ ;;
+ *-*-mingw*)
+ MODULE_EXTENSION=".dll"
+ WITH_MODULES=1
+ ;;
+ *-*-hpux*)
+ MODULE_EXTENSION=".sl"
+ ;;
+ *)
+ MODULE_EXTENSION=".so"
+ ;;
+ esac
+
+ if test "$WITH_MODULES" = "0"; then
+ _libs=$LIBS
+ AC_SEARCH_LIBS([dlopen], [dl], [
+ WITH_MODULES=1
+ if test "$ac_cv_search_dlopen" != "none required"; then
+ MODULE_PLATFORM_LIBS=$ac_cv_search_dlopen
+ fi
+ AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])], [
+ AC_SEARCH_LIBS([shl_load], [dld], [
+ WITH_MODULES=1
+ if test "$ac_cv_search_shl_load" != "none required"; then
+ MODULE_PLATFORM_LIBS=$ac_cv_search_shl_load
+ fi
+ AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])])])
+ LIBS=$_libs
+ fi
+fi
+
+AC_SUBST(WITH_MODULES)
+AC_SUBST(MODULE_PLATFORM_LIBS)
+AC_SUBST(MODULE_EXTENSION)
+AM_CONDITIONAL(WITH_MODULES_SOURCES, test "$WITH_MODULES" = "1")
+
+dnl
+dnl Check for trio string functions
+dnl
+if test "${NEED_TRIO}" = "1" ; then
+ echo Adding trio library for string functions
+ WITH_TRIO=1
else
- WITH_RUN_DEBUG=0
+ WITH_TRIO=0
fi
-AC_SUBST(WITH_RUN_DEBUG)
-
-WIN32_EXTRA_LIBADD=
-WIN32_EXTRA_LDFLAGS=
-CYGWIN_EXTRA_LDFLAGS=
-CYGWIN_EXTRA_PYTHON_LIBADD=
-WIN32_EXTRA_PYTHON_LIBADD=
-case "$host" in
- *-*-mingw*)
- CPPFLAGS="$CPPFLAGS -DWIN32"
- WIN32_EXTRA_LIBADD="-lws2_32"
- WIN32_EXTRA_LDFLAGS="-no-undefined"
- if test "${PYTHON}" != ""
- then
- case "$host" in
- *-w64-mingw*)
- WIN32_EXTRA_PYTHON_LIBADD="-shrext .pyd -L${pythondir}/../../lib -lpython${PYTHON_VERSION}"
- ;;
- *)
- WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
- ;;
- esac
- fi
- ;;
- *-*-cygwin*)
- CYGWIN_EXTRA_LDFLAGS="-no-undefined"
- if test "${PYTHON}" != ""
- then
- CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
- fi
- ;;
-esac
-AC_SUBST(WIN32_EXTRA_LIBADD)
-AC_SUBST(WIN32_EXTRA_LDFLAGS)
-AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
-AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
-AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
+AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
+AC_SUBST(WITH_TRIO)
-dnl Checking the standard string functions availability
dnl
-dnl Note mingw* has C99 implementation that produce expected xml numbers
-dnl if code use {v}snprintf functions.
-dnl If you like to activate at run-time C99 compatible number output
-dnl see release note for mingw runtime 3.15:
-dnl http://sourceforge.net/project/shownotes.php?release_id=24832
+dnl Thread-related stuff
dnl
-dnl Also *win32*config.h files redefine them for various MSC compilers.
+THREAD_LIBS=""
+BASE_THREAD_LIBS=""
+WITH_THREADS=0
+THREAD_CFLAGS=""
+WITH_THREAD_ALLOC=0
+
+if test "$with_threads" = "no" ; then
+ echo Disabling multithreaded support
+else
+ case $host_os in
+ *mingw*)
+ dnl Default to native threads on Windows
+ WITH_THREADS="1"
+ ;;
+ *)
+ dnl Use pthread by default in other cases
+ _libs=$LIBS
+ AC_CHECK_HEADERS(pthread.h,
+ AC_SEARCH_LIBS([pthread_join], [pthread], [
+ WITH_THREADS="1"
+ if test "$ac_cv_search_pthread_join" != "none required"; then
+ THREAD_LIBS=$ac_cv_search_pthread_join
+ fi
+ AC_DEFINE([HAVE_PTHREAD_H], [],
+ [Define if <pthread.h> is there])]))
+ LIBS=$_libs
+ ;;
+ esac
+
+ case $host_os in
+ *linux*)
+ if test "${GCC}" = "yes" ; then
+ BASE_THREAD_LIBS="$THREAD_LIBS"
+ THREAD_LIBS=""
+ fi
+ ;;
+ esac
+
+ if test "$WITH_THREADS" = "1" ; then
+ THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
+ fi
+fi
+if test "$with_thread_alloc" = "yes" && test "$WITH_THREADS" = "1" ; then
+ WITH_THREAD_ALLOC=1
+fi
+
+AC_SUBST(THREAD_LIBS)
+AC_SUBST(BASE_THREAD_LIBS)
+AC_SUBST(WITH_THREADS)
+AC_SUBST(THREAD_CFLAGS)
+AC_SUBST(WITH_THREAD_ALLOC)
+
dnl
-dnl So do not redefine {v}snprintf to _{v}snprintf like following:
-dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
-dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
-dnl and do not redefine those functions is C-source files.
+dnl xmllint shell history
dnl
-AC_CHECK_FUNCS(snprintf vsnprintf,,
- NEED_TRIO=1)
+if test "$with_history" = "yes" && test "$with_readline" != "no"; then
+ echo Enabling xmllint shell history
+ dnl check for terminal library. this is a very cool solution
+ dnl from octave's configure.in
+ unset tcap
+ for termlib in ncurses curses termcap terminfo termlib; do
+ AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
+ test -n "$tcap" && break
+ done
-if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
+ _cppflags=$CPPFLAGS
+ _libs=$LIBS
+ if test "$with_readline" != "" && test "$with_readline" != "yes"; then
+ RDL_DIR=$with_readline
+ CPPFLAGS="${CPPFLAGS} -I$RDL_DIR/include"
+ LIBS="${LIBS} -L$RDL_DIR/lib"
+ fi
+ AC_CHECK_HEADER(readline/history.h,
+ AC_CHECK_LIB(history, append_history,[
+ RDL_LIBS="-lhistory"
+ if test "x${RDL_DIR}" != "x"; then
+ RDL_CFLAGS="-I$RDL_DIR/include"
+ RDL_LIBS="-L$RDL_DIR/lib $RDL_LIBS"
+ fi
+ AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
+ AC_CHECK_HEADER(readline/readline.h,
+ AC_CHECK_LIB(readline, readline,[
+ RDL_LIBS="-lreadline $RDL_LIBS $tcap"
+ if test "x$RDL_DIR" != "x"; then
+ RDL_CFLAGS="-I$RDL_DIR/include"
+ RDL_LIBS="-L$RDL_DIR/lib $RDL_LIBS"
+ fi
+ AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
+ CPPFLAGS=$_cppflags
+ LIBS=$_libs
+fi
+AC_SUBST(RDL_CFLAGS)
+AC_SUBST(RDL_LIBS)
+
+dnl
+dnl Checks for zlib library.
+dnl
+WITH_ZLIB=0
+
+if test "$with_zlib" = "no"; then
+ echo "Disabling zlib compression support"
+else
+ if test "$with_zlib" != "yes"; then
+ Z_DIR=$with_zlib
+ fi
+
+ # Don't run pkg-config if with_zlib contains a path.
+ if test "x$Z_DIR" = "x"; then
+ # Try pkg-config first so that static linking works.
+ PKG_CHECK_MODULES([Z],[zlib],
+ [WITH_ZLIB=1],
+ [:])
+ fi
+
+ if test "$WITH_ZLIB" = "0"; then
+ _cppflags=$CPPFLAGS
+ _libs=$LIBS
+ if test "x$Z_DIR" != "x"; then
+ CPPFLAGS="${CPPFLAGS} -I$Z_DIR/include"
+ LIBS="${LIBS} -L$Z_DIR/lib"
+ fi
+ AC_CHECK_HEADERS(zlib.h,
+ AC_CHECK_LIB(z, gzread,[
+ WITH_ZLIB=1
+ if test "x${Z_DIR}" != "x"; then
+ Z_CFLAGS="-I${Z_DIR}/include"
+ Z_LIBS="-L${Z_DIR}/lib -lz"
+ [case ${host} in
+ *-*-solaris*)
+ Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
+ ;;
+ esac]
+ else
+ Z_LIBS="-lz"
+ fi])
+ )
+ CPPFLAGS=$_cppflags
+ LIBS=$_libs
+ fi
+fi
+AC_SUBST(WITH_ZLIB)
+
+dnl
+dnl Checks for lzma library.
+dnl
+WITH_LZMA=0
+
+if test "$with_lzma" = "no"; then
+ echo "Disabling lzma compression support"
+else
+ if test "$with_lzma" != "yes"; then
+ LZMA_DIR=$with_lzma
+ fi
+
+ # Don't run pkg-config if with_lzma contains a path.
+ if test "x$LZMA_DIR" = "x"; then
+ # Try pkg-config first so that static linking works.
+ PKG_CHECK_MODULES([LZMA],[liblzma],
+ [WITH_LZMA=1],
+ [:])
+ fi
+
+ # If pkg-config failed, fall back to AC_CHECK_LIB. This
+ # will not pick up the necessary LIBS flags for liblzma's
+ # private dependencies, though, so static linking may fail.
+ if test "$WITH_LZMA" = "0"; then
+ _cppflags=$CPPFLAGS
+ _libs=$LIBS
+ if test "x$LZMA_DIR" != "x"; then
+ CPPFLAGS="${CPPFLAGS} -I$LZMA_DIR/include"
+ LIBS="${LIBS} -L$LZMA_DIR/lib"
+ fi
+ AC_CHECK_HEADERS(lzma.h,
+ AC_CHECK_LIB(lzma, lzma_code,[
+ WITH_LZMA=1
+ if test "x${LZMA_DIR}" != "x"; then
+ LZMA_CFLAGS="-I${LZMA_DIR}/include"
+ LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
+ else
+ LZMA_LIBS="-llzma"
+ fi])
+ )
+ CPPFLAGS=$_cppflags
+ LIBS=$_libs
+ fi
+fi
+AC_SUBST(WITH_LZMA)
+AM_CONDITIONAL(WITH_LZMA_SOURCES, test "$WITH_LZMA" = "1")
+
+dnl
+dnl Checks for iconv library.
+dnl
+WITH_ICONV=0
+
+if test "$with_iconv" = "no" ; then
+ echo Disabling ICONV support
+else
+ _cppflags=$CPPFLAGS
+ _libs=$LIBS
+ if test "$with_iconv" != "yes" && test "$with_iconv" != "" ; then
+ ICONV_DIR=$with_iconv
+ CPPFLAGS="$CPPFLAGS -I$ICONV_DIR/include"
+ LIBS="$LIBS -L$ICONV_DIR/libs"
+ # Export this since our headers include iconv.h
+ XML_INCLUDEDIR="$XML_INCLUDEDIR -I$ICONV_DIR/include"
+ fi
+ AC_CHECK_HEADER(iconv.h, [
+ AC_SEARCH_LIBS([iconv], [iconv], [
+ WITH_ICONV=1
+ if test "$ac_cv_search_iconv" != "none required"; then
+ ICONV_LIBS=$ac_cv_search_iconv
+ fi], [
+ dnl GNU libiconv prefixes symbols with "lib"
+ AC_CHECK_LIB([iconv], [libiconv], [
+ WITH_ICONV=1
+ ICONV_LIBS="-liconv"])])])
+ if test "$WITH_ICONV" = "1" && test "$ICONV_DIR" != ""; then
+ ICONV_CFLAGS="-I$ICONV_DIR/include"
+ ICONV_LIBS="-L$ICONV_DIR/libs $ICONV_LIBS"
+ fi
+ CPPFLAGS=$_cppflags
+ LIBS=$_libs
+fi
+AC_SUBST(WITH_ICONV)
+
+dnl
+dnl Checks for ICU library.
+dnl
+WITH_ICU=0
+ICU_LIBS=""
+
+if test "$with_icu" != "yes" ; then
+ echo Disabling ICU support
+else
+ # Try pkg-config first so that static linking works.
+ # If this succeeeds, we ignore the WITH_ICU directory.
+ PKG_CHECK_MODULES([ICU], [icu-i18n], [
+ WITH_ICU=1
+ m4_ifdef([PKG_CHECK_VAR],
+ [PKG_CHECK_VAR([ICU_DEFS], [icu-i18n], [DEFS])])
+ if test "x$ICU_DEFS" != "x"; then
+ ICU_CFLAGS="$ICU_CFLAGS $ICU_DEFS"
+ fi],[:])
+
+ if test "$WITH_ICU" = "0"; then
+ ICU_CONFIG=icu-config
+ if ${ICU_CONFIG} --cflags >/dev/null 2>&1
+ then
+ WITH_ICU=1
+ ICU_CFLAGS=`${ICU_CONFIG} --cflags`
+ ICU_LIBS=`${ICU_CONFIG} --ldflags`
+ else
+ _cppflags="${CPPFLAGS}"
+ _libs="${LIBS}"
+ if test "$with_icu" != "yes" && test "$with_icu" != "" ; then
+ ICU_DIR=$with_icu
+ CPPFLAGS="${CPPFLAGS} -I$ICU_DIR/include"
+ LIBS="${LIBS} -L$ICU_DIR/lib"
+ fi
+
+ AC_CHECK_HEADER(unicode/ucnv.h, [
+ AC_CHECK_LIB([icucore], [uconv_open], [
+ WITH_ICU=1
+ ICU_LIBS=-licucore
+ if test "$ICU_DIR" != ""; then
+ ICU_CFLAGS="-I$ICU_DIR/include"
+ ICU_LIBS="-L$ICU_DIR/libs $ICU_LIBS"
+ fi])])
+ CPPFLAGS=$_cppflags
+ LIBS=$_libs
+ fi
+ fi
+fi
+AC_SUBST(WITH_ICU)
+
+if test "$with_coverage" = "yes" && test "${GCC}" = "yes"
then
echo Enabling code coverage for GCC
- EXTRA_CFLAGS="$EXTRA_CFLAGS -fprofile-arcs -ftest-coverage"
- LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
+ AM_CFLAGS="$AM_CFLAGS -fprofile-arcs -ftest-coverage"
+ AM_LDFLAGS="$AM_LDFLAGS -fprofile-arcs -ftest-coverage"
else
echo Disabling code coverage for GCC
fi
-AC_SUBST(CPPFLAGS)
-AC_SUBST(EXTRA_CFLAGS)
-AC_SUBST(LDFLAGS)
+XML_LIBS="-lxml2"
+XML_LIBTOOLLIBS="libxml2.la"
+XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $LIBM $NET_LIBS"
+XML_PRIVATE_CFLAGS="$Z_CFLAGS $LZMA_CFLAGS $THREAD_CFLAGS $ICONV_CFLAGS $ICU_CFLAGS"
+
+AC_SUBST(AM_CFLAGS)
+AC_SUBST(AM_LDFLAGS)
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBDIR)
AC_SUBST(XML_LIBS)
AC_SUBST(XML_PRIVATE_LIBS)
+AC_SUBST(XML_PRIVATE_CFLAGS)
AC_SUBST(XML_LIBTOOLLIBS)
-AC_SUBST(ICONV_LIBS)
-AC_SUBST(ICU_LIBS)
AC_SUBST(XML_INCLUDEDIR)
-AC_SUBST(HTML_DIR)
-AC_SUBST(PYTHON)
-AC_SUBST(PYTHON_VERSION)
-AC_SUBST(PYTHON_INCLUDES)
-AC_SUBST(PYTHON_SITE_PACKAGES)
-
-AC_SUBST(M_LIBS)
-AC_SUBST(RDL_LIBS)
dnl for the spec file
RELDATE=`date +'%a %b %e %Y'`
AC_SUBST(RELDATE)
-AC_SUBST(PYTHON_TESTS)
-
-rm -f COPYING.LIB COPYING
-ln -s $srcdir/Copyright COPYING
# keep on one line for cygwin c.f. #130896
-AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake])
+AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile include/private/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake])
AC_CONFIG_FILES([python/setup.py], [chmod +x python/setup.py])
AC_CONFIG_FILES([xml2-config], [chmod +x xml2-config])
AC_OUTPUT
diff --git a/chromium/third_party/libxml/src/dict.c b/chromium/third_party/libxml/src/dict.c
index ecc90e0fb31..5c9ca71940c 100644
--- a/chromium/third_party/libxml/src/dict.c
+++ b/chromium/third_party/libxml/src/dict.c
@@ -23,6 +23,8 @@
#include <stdlib.h>
#include <time.h>
+#include "private/dict.h"
+
/*
* Following http://www.ocert.org/advisories/ocert-2011-003.html
* it seems that having hash randomization might be a good idea
@@ -127,7 +129,7 @@ struct _xmlDict {
* A mutex for modifying the reference counter for shared
* dictionaries.
*/
-static xmlRMutexPtr xmlDictMutex = NULL;
+static xmlMutexPtr xmlDictMutex = NULL;
/*
* Whether the dictionary mutex was initialized.
@@ -146,8 +148,10 @@ static unsigned int rand_seed = 0;
/**
* xmlInitializeDict:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* Do the dictionary mutex initialization.
- * this function is deprecated
*
* Returns 0 if initialization was already done, and 1 if that
* call led to the initialization
@@ -172,9 +176,9 @@ int __xmlInitializeDict(void) {
if (xmlDictInitialized)
return(1);
- if ((xmlDictMutex = xmlNewRMutex()) == NULL)
+ if ((xmlDictMutex = xmlNewMutex()) == NULL)
return(0);
- xmlRMutexLock(xmlDictMutex);
+ xmlMutexLock(xmlDictMutex);
#ifdef DICT_RANDOMIZATION
#ifdef HAVE_RAND_R
@@ -185,7 +189,7 @@ int __xmlInitializeDict(void) {
#endif
#endif
xmlDictInitialized = 1;
- xmlRMutexUnlock(xmlDictMutex);
+ xmlMutexUnlock(xmlDictMutex);
return(1);
}
@@ -196,13 +200,13 @@ int __xmlRandom(void) {
if (xmlDictInitialized == 0)
__xmlInitializeDict();
- xmlRMutexLock(xmlDictMutex);
+ xmlMutexLock(xmlDictMutex);
#ifdef HAVE_RAND_R
ret = rand_r(& rand_seed);
#else
ret = rand();
#endif
- xmlRMutexUnlock(xmlDictMutex);
+ xmlMutexUnlock(xmlDictMutex);
return(ret);
}
#endif
@@ -210,6 +214,11 @@ int __xmlRandom(void) {
/**
* xmlDictCleanup:
*
+ * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * to free global state but see the warnings there. xmlCleanupParser
+ * should be only called once at program exit. In most cases, you don't
+ * have call cleanup functions at all.
+ *
* Free the dictionary mutex. Do not call unless sure the library
* is not in use anymore !
*/
@@ -218,7 +227,7 @@ xmlDictCleanup(void) {
if (!xmlDictInitialized)
return;
- xmlFreeRMutex(xmlDictMutex);
+ xmlFreeMutex(xmlDictMutex);
xmlDictInitialized = 0;
}
@@ -489,10 +498,10 @@ static unsigned long
xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
const xmlChar *name, int len, int seed)
{
- unsigned long value = (unsigned long) seed;
+ unsigned long value = seed;
if (plen == 0)
- value += 30 * (unsigned long) ':';
+ value += 30 * ':';
else
value += 30 * (*prefix);
@@ -530,7 +539,7 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
}
len -= plen;
if (len > 0) {
- value += (unsigned long) ':';
+ value += ':';
len--;
}
switch (len) {
@@ -643,9 +652,9 @@ xmlDictReference(xmlDictPtr dict) {
return(-1);
if (dict == NULL) return -1;
- xmlRMutexLock(xmlDictMutex);
+ xmlMutexLock(xmlDictMutex);
dict->ref_counter++;
- xmlRMutexUnlock(xmlDictMutex);
+ xmlMutexUnlock(xmlDictMutex);
return(0);
}
@@ -807,14 +816,14 @@ xmlDictFree(xmlDictPtr dict) {
return;
/* decrement the counter, it may be shared by a parser and docs */
- xmlRMutexLock(xmlDictMutex);
+ xmlMutexLock(xmlDictMutex);
dict->ref_counter--;
if (dict->ref_counter > 0) {
- xmlRMutexUnlock(xmlDictMutex);
+ xmlMutexUnlock(xmlDictMutex);
return;
}
- xmlRMutexUnlock(xmlDictMutex);
+ xmlMutexUnlock(xmlDictMutex);
if (dict->subdict != NULL) {
xmlDictFree(dict->subdict);
diff --git a/chromium/third_party/libxml/src/encoding.c b/chromium/third_party/libxml/src/encoding.c
index 730e2532e45..c990bcf16f0 100644
--- a/chromium/third_party/libxml/src/encoding.c
+++ b/chromium/third_party/libxml/src/encoding.c
@@ -40,8 +40,9 @@
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
#ifdef LIBXML_ICU_ENABLED
#include <unicode/ucnv.h>
@@ -532,7 +533,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen,
} else {
tmp = (unsigned char *) in;
c = *tmp++;
- c = c | (((unsigned int)*tmp) << 8);
+ c = c | (*tmp << 8);
in++;
}
if ((c & 0xFC00) == 0xD800) { /* surrogates */
@@ -544,7 +545,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen,
} else {
tmp = (unsigned char *) in;
d = *tmp++;
- d = d | (((unsigned int)*tmp) << 8);
+ d = d | (*tmp << 8);
in++;
}
if ((d & 0xFC00) == 0xDC00) {
@@ -655,7 +656,7 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen,
*out++ = c;
} else {
tmp = (unsigned char *) out;
- *tmp = c ;
+ *tmp = (unsigned char) c; /* Explicit truncation */
*(tmp + 1) = c >> 8 ;
out++;
}
@@ -670,13 +671,13 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen,
} else {
tmp1 = 0xD800 | (c >> 10);
tmp = (unsigned char *) out;
- *tmp = (unsigned char) tmp1;
+ *tmp = (unsigned char) tmp1; /* Explicit truncation */
*(tmp + 1) = tmp1 >> 8;
out++;
tmp2 = 0xDC00 | (c & 0x03FF);
tmp = (unsigned char *) out;
- *tmp = (unsigned char) tmp2;
+ *tmp = (unsigned char) tmp2; /* Explicit truncation */
*(tmp + 1) = tmp2 >> 8;
out++;
}
@@ -773,7 +774,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen,
if (xmlLittleEndian) {
tmp = (unsigned char *) in;
c = *tmp++;
- c = (c << 8) | (unsigned int) *tmp;
+ c = (c << 8) | *tmp;
in++;
} else {
c= *in++;
@@ -785,7 +786,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen,
if (xmlLittleEndian) {
tmp = (unsigned char *) in;
d = *tmp++;
- d = (d << 8) | (unsigned int) *tmp;
+ d = (d << 8) | *tmp;
in++;
} else {
d= *in++;
@@ -895,7 +896,7 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen,
if (xmlLittleEndian) {
tmp = (unsigned char *) out;
*tmp = c >> 8;
- *(tmp + 1) = c;
+ *(tmp + 1) = (unsigned char) c; /* Explicit truncation */
out++;
} else {
*out++ = c;
@@ -908,13 +909,13 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen,
tmp1 = 0xD800 | (c >> 10);
tmp = (unsigned char *) out;
*tmp = tmp1 >> 8;
- *(tmp + 1) = (unsigned char) tmp1;
+ *(tmp + 1) = (unsigned char) tmp1; /* Explicit truncation */
out++;
tmp2 = 0xDC00 | (c & 0x03FF);
tmp = (unsigned char *) out;
*tmp = tmp2 >> 8;
- *(tmp + 1) = (unsigned char) tmp2;
+ *(tmp + 1) = (unsigned char) tmp2; /* Explicit truncation */
out++;
} else {
*out++ = 0xD800 | (c >> 10);
@@ -1408,6 +1409,9 @@ xmlNewCharEncodingHandler(const char *name,
/**
* xmlInitCharEncodingHandlers:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* Initialize the char encoding support, it registers the default
* encoding supported.
* NOTE: while public, this function usually doesn't need to be called
@@ -1468,6 +1472,11 @@ xmlInitCharEncodingHandlers(void) {
/**
* xmlCleanupCharEncodingHandlers:
*
+ * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * to free global state but see the warnings there. xmlCleanupParser
+ * should be only called once at program exit. In most cases, you don't
+ * have call cleanup functions at all.
+ *
* Cleanup the memory allocated for the char encoding support, it
* unregisters all the encoding handlers and the aliases.
*/
@@ -1747,6 +1756,10 @@ xmlFindCharEncodingHandler(const char *name) {
} else if ((icv_in != (iconv_t) -1) || icv_out != (iconv_t) -1) {
xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
"iconv : problems with filters for '%s'\n", name);
+ if (icv_in != (iconv_t) -1)
+ iconv_close(icv_in);
+ else
+ iconv_close(icv_out);
}
#endif /* LIBXML_ICONV_ENABLED */
#ifdef LIBXML_ICU_ENABLED
@@ -1840,7 +1853,10 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
}
icv_inlen = *inlen;
icv_outlen = *outlen;
- ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
+ /*
+ * Some versions take const, other versions take non-const input.
+ */
+ ret = iconv(cd, (void *) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
*inlen -= icv_inlen;
*outlen -= icv_outlen;
if ((icv_inlen != 0) || (ret == (size_t) -1)) {
@@ -2028,7 +2044,7 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
#ifdef LIBXML_ICU_ENABLED
else if (handler->uconv_out != NULL) {
ret = xmlUconvWrapper(handler->uconv_out, 0, out, outlen, in, inlen,
- TRUE);
+ 1);
}
#endif /* LIBXML_ICU_ENABLED */
else {
@@ -2041,11 +2057,10 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
}
/**
- * xmlCharEncFirstLineInt:
+ * xmlCharEncFirstLine:
* @handler: char encoding transformation data structure
* @out: an xmlBuffer for the output.
* @in: an xmlBuffer for the input
- * @len: number of bytes to convert for the first line, or -1
*
* Front-end for the encoding handler input function, but handle only
* the very first line, i.e. limit itself to 45 chars.
@@ -2056,8 +2071,8 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
* the result of transformation can't fit into the encoding we want), or
*/
int
-xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
- xmlBufferPtr in, int len) {
+xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
+ xmlBufferPtr in) {
int ret;
int written;
int toconv;
@@ -2077,13 +2092,8 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
* The actual value depending on guessed encoding is passed as @len
* if provided
*/
- if (len >= 0) {
- if (toconv > len)
- toconv = len;
- } else {
- if (toconv > 180)
- toconv = 180;
- }
+ if (toconv > 180)
+ toconv = 180;
if (toconv * 2 >= written) {
xmlBufferGrow(out, toconv * 2);
written = out->size - out->use - 1;
@@ -2128,26 +2138,6 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
}
/**
- * xmlCharEncFirstLine:
- * @handler: char encoding transformation data structure
- * @out: an xmlBuffer for the output.
- * @in: an xmlBuffer for the input
- *
- * Front-end for the encoding handler input function, but handle only
- * the very first line, i.e. limit itself to 45 chars.
- *
- * Returns the number of byte written if success, or
- * -1 general error
- * -2 if the transcoding fails (for *in is not valid utf8 string or
- * the result of transformation can't fit into the encoding we want), or
- */
-int
-xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
- xmlBufferPtr in) {
- return(xmlCharEncFirstLineInt(handler, out, in, -1));
-}
-
-/**
* xmlCharEncFirstLineInput:
* @input: a parser input buffer
* @len: number of bytes to convert for the first line, or -1
@@ -2182,7 +2172,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
toconv = xmlBufUse(in);
if (toconv == 0)
return (0);
- written = xmlBufAvail(out) - 1; /* count '\0' */
+ written = xmlBufAvail(out);
/*
* echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
* 45 chars should be sufficient to reach the end of the encoding
@@ -2200,7 +2190,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
}
if (toconv * 2 >= written) {
xmlBufGrow(out, toconv * 2);
- written = xmlBufAvail(out) - 1;
+ written = xmlBufAvail(out);
}
if (written > 360)
written = 360;
@@ -2292,13 +2282,9 @@ xmlCharEncInput(xmlParserInputBufferPtr input, int flush)
if ((toconv > 64 * 1024) && (flush == 0))
toconv = 64 * 1024;
written = xmlBufAvail(out);
- if (written > 0)
- written--; /* count '\0' */
if (toconv * 2 >= written) {
xmlBufGrow(out, toconv * 2);
written = xmlBufAvail(out);
- if (written > 0)
- written--; /* count '\0' */
}
if ((written > 128 * 1024) && (flush == 0))
written = 128 * 1024;
@@ -2480,8 +2466,6 @@ xmlCharEncOutput(xmlOutputBufferPtr output, int init)
retry:
written = xmlBufAvail(out);
- if (written > 0)
- written--; /* count '\0' */
/*
* First specific handling of the initialization call
@@ -2510,7 +2494,7 @@ retry:
toconv = 64 * 1024;
if (toconv * 4 >= written) {
xmlBufGrow(out, toconv * 4);
- written = xmlBufAvail(out) - 1;
+ written = xmlBufAvail(out);
}
if (written > 256 * 1024)
written = 256 * 1024;
@@ -2560,7 +2544,7 @@ retry:
break;
case -2: {
xmlChar charref[20];
- int len = (int) xmlBufUse(in);
+ int len = xmlBufUse(in);
xmlChar *content = xmlBufContent(in);
int cur, charrefLen;
@@ -2585,7 +2569,7 @@ retry:
"&#%d;", cur);
xmlBufShrink(in, len);
xmlBufGrow(out, charrefLen * 4);
- c_out = xmlBufAvail(out) - 1;
+ c_out = xmlBufAvail(out);
c_in = charrefLen;
ret = xmlEncOutputChunk(output->encoder, xmlBufEnd(out), &c_out,
charref, &c_in);
@@ -2935,7 +2919,7 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) {
static int
UTF8ToISO8859x(unsigned char* out, int *outlen,
const unsigned char* in, int *inlen,
- unsigned char const *xlattable) {
+ const unsigned char* const xlattable) {
const unsigned char* outstart = out;
const unsigned char* inend;
const unsigned char* instart = in;
@@ -3125,7 +3109,7 @@ static unsigned short const xmlunicodetable_ISO8859_2 [128] = {
0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9,
};
-static unsigned char const xmltranscodetable_ISO8859_2 [48 + 6 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_2 [48 + 6 * 64] = {
"\x00\x00\x01\x05\x02\x04\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3174,7 +3158,7 @@ static unsigned short const xmlunicodetable_ISO8859_3 [128] = {
0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9,
};
-static unsigned char const xmltranscodetable_ISO8859_3 [48 + 7 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_3 [48 + 7 * 64] = {
"\x04\x00\x01\x06\x02\x05\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3227,7 +3211,7 @@ static unsigned short const xmlunicodetable_ISO8859_4 [128] = {
0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9,
};
-static unsigned char const xmltranscodetable_ISO8859_4 [48 + 6 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_4 [48 + 6 * 64] = {
"\x00\x00\x01\x05\x02\x03\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3276,7 +3260,7 @@ static unsigned short const xmlunicodetable_ISO8859_5 [128] = {
0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f,
};
-static unsigned char const xmltranscodetable_ISO8859_5 [48 + 6 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_5 [48 + 6 * 64] = {
"\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3325,7 +3309,7 @@ static unsigned short const xmlunicodetable_ISO8859_6 [128] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
-static unsigned char const xmltranscodetable_ISO8859_6 [48 + 5 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_6 [48 + 5 * 64] = {
"\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x03\x04\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3370,7 +3354,7 @@ static unsigned short const xmlunicodetable_ISO8859_7 [128] = {
0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000,
};
-static unsigned char const xmltranscodetable_ISO8859_7 [48 + 7 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_7 [48 + 7 * 64] = {
"\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x06"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3423,7 +3407,7 @@ static unsigned short const xmlunicodetable_ISO8859_8 [128] = {
0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000,
};
-static unsigned char const xmltranscodetable_ISO8859_8 [48 + 7 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_8 [48 + 7 * 64] = {
"\x02\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3476,7 +3460,7 @@ static unsigned short const xmlunicodetable_ISO8859_9 [128] = {
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff,
};
-static unsigned char const xmltranscodetable_ISO8859_9 [48 + 5 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_9 [48 + 5 * 64] = {
"\x00\x00\x01\x02\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3521,7 +3505,7 @@ static unsigned short const xmlunicodetable_ISO8859_10 [128] = {
0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138,
};
-static unsigned char const xmltranscodetable_ISO8859_10 [48 + 7 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_10 [48 + 7 * 64] = {
"\x00\x00\x01\x06\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3574,7 +3558,7 @@ static unsigned short const xmlunicodetable_ISO8859_11 [128] = {
0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000,
};
-static unsigned char const xmltranscodetable_ISO8859_11 [48 + 6 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_11 [48 + 6 * 64] = {
"\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3623,7 +3607,7 @@ static unsigned short const xmlunicodetable_ISO8859_13 [128] = {
0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019,
};
-static unsigned char const xmltranscodetable_ISO8859_13 [48 + 7 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_13 [48 + 7 * 64] = {
"\x00\x00\x01\x04\x06\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3676,7 +3660,7 @@ static unsigned short const xmlunicodetable_ISO8859_14 [128] = {
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff,
};
-static unsigned char const xmltranscodetable_ISO8859_14 [48 + 10 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_14 [48 + 10 * 64] = {
"\x00\x00\x01\x09\x04\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3741,7 +3725,7 @@ static unsigned short const xmlunicodetable_ISO8859_15 [128] = {
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
};
-static unsigned char const xmltranscodetable_ISO8859_15 [48 + 6 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_15 [48 + 6 * 64] = {
"\x00\x00\x01\x05\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -3790,7 +3774,7 @@ static unsigned short const xmlunicodetable_ISO8859_16 [128] = {
0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff,
};
-static unsigned char const xmltranscodetable_ISO8859_16 [48 + 9 * 64] = {
+static const unsigned char xmltranscodetable_ISO8859_16 [48 + 9 * 64] = {
"\x00\x00\x01\x08\x02\x03\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
diff --git a/chromium/third_party/libxml/src/entities.c b/chromium/third_party/libxml/src/entities.c
index 147a7f73474..81b75df954c 100644
--- a/chromium/third_party/libxml/src/entities.c
+++ b/chromium/third_party/libxml/src/entities.c
@@ -26,7 +26,8 @@
#include <libxml/globals.h>
#include <libxml/dict.h>
-#include "save.h"
+#include "private/entities.h"
+#include "private/error.h"
/*
* The XML predefined entities.
@@ -128,36 +129,19 @@ xmlFreeEntity(xmlEntityPtr entity)
if ((entity->children) && (entity->owner == 1) &&
(entity == (xmlEntityPtr) entity->children->parent))
xmlFreeNodeList(entity->children);
- if (dict != NULL) {
- if ((entity->name != NULL) && (!xmlDictOwns(dict, entity->name)))
- xmlFree((char *) entity->name);
- if ((entity->ExternalID != NULL) &&
- (!xmlDictOwns(dict, entity->ExternalID)))
- xmlFree((char *) entity->ExternalID);
- if ((entity->SystemID != NULL) &&
- (!xmlDictOwns(dict, entity->SystemID)))
- xmlFree((char *) entity->SystemID);
- if ((entity->URI != NULL) && (!xmlDictOwns(dict, entity->URI)))
- xmlFree((char *) entity->URI);
- if ((entity->content != NULL)
- && (!xmlDictOwns(dict, entity->content)))
- xmlFree((char *) entity->content);
- if ((entity->orig != NULL) && (!xmlDictOwns(dict, entity->orig)))
- xmlFree((char *) entity->orig);
- } else {
- if (entity->name != NULL)
- xmlFree((char *) entity->name);
- if (entity->ExternalID != NULL)
- xmlFree((char *) entity->ExternalID);
- if (entity->SystemID != NULL)
- xmlFree((char *) entity->SystemID);
- if (entity->URI != NULL)
- xmlFree((char *) entity->URI);
- if (entity->content != NULL)
- xmlFree((char *) entity->content);
- if (entity->orig != NULL)
- xmlFree((char *) entity->orig);
- }
+ if ((entity->name != NULL) &&
+ ((dict == NULL) || (!xmlDictOwns(dict, entity->name))))
+ xmlFree((char *) entity->name);
+ if (entity->ExternalID != NULL)
+ xmlFree((char *) entity->ExternalID);
+ if (entity->SystemID != NULL)
+ xmlFree((char *) entity->SystemID);
+ if (entity->URI != NULL)
+ xmlFree((char *) entity->URI);
+ if (entity->content != NULL)
+ xmlFree((char *) entity->content);
+ if (entity->orig != NULL)
+ xmlFree((char *) entity->orig);
xmlFree(entity);
}
@@ -194,18 +178,12 @@ xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type,
ret->SystemID = xmlStrdup(SystemID);
} else {
ret->name = xmlDictLookup(dict, name, -1);
- if (ExternalID != NULL)
- ret->ExternalID = xmlDictLookup(dict, ExternalID, -1);
- if (SystemID != NULL)
- ret->SystemID = xmlDictLookup(dict, SystemID, -1);
+ ret->ExternalID = xmlStrdup(ExternalID);
+ ret->SystemID = xmlStrdup(SystemID);
}
if (content != NULL) {
ret->length = xmlStrlen(content);
- if ((dict != NULL) && (ret->length < 5))
- ret->content = (xmlChar *)
- xmlDictLookup(dict, content, ret->length);
- else
- ret->content = xmlStrndup(content, ret->length);
+ ret->content = xmlStrndup(content, ret->length);
} else {
ret->length = 0;
ret->content = NULL;
@@ -628,7 +606,7 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
* allocate an translation buffer.
*/
buffer_size = 1000;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMalloc(buffer_size);
if (buffer == NULL) {
xmlEntitiesErrMemory("xmlEncodeEntities: malloc failed");
return(NULL);
@@ -868,7 +846,7 @@ xmlEncodeSpecialChars(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlChar *input)
* allocate an translation buffer.
*/
buffer_size = 1000;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMalloc(buffer_size);
if (buffer == NULL) {
xmlEntitiesErrMemory("xmlEncodeSpecialChars: malloc failed");
return(NULL);
diff --git a/chromium/third_party/libxml/src/error.c b/chromium/third_party/libxml/src/error.c
index 5f42eadcc6d..c96877f4835 100644
--- a/chromium/third_party/libxml/src/error.c
+++ b/chromium/third_party/libxml/src/error.c
@@ -16,9 +16,7 @@
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
-void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
- const char *msg,
- ...) LIBXML_ATTR_FORMAT(2,3);
+#include "private/error.h"
#define XML_GET_VAR_STR(msg, str) { \
int size, prev_size = -1; \
@@ -83,6 +81,8 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
* initGenericErrorDefaultFunc:
* @handler: the handler
*
+ * DEPRECATED: Use xmlSetGenericErrorFunc.
+ *
* Set or reset (if NULL) the default handler for generic errors
* to the builtin error function.
*/
diff --git a/chromium/third_party/libxml/src/genUnicode.py b/chromium/third_party/libxml/src/genUnicode.py
index f431201fcd6..ebf48e6e325 100755
--- a/chromium/third_party/libxml/src/genUnicode.py
+++ b/chromium/third_party/libxml/src/genUnicode.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python -u
+#!/usr/bin/env python
#
# Original script modified in November 2003 to take advantage of
# the character-validation range routines, and updated to the
@@ -31,7 +31,7 @@ blockAliases.append("PrivateUse:PrivateUseArea,SupplementaryPrivateUseArea-A," +
# number, inline comparisons are generated
minTableSize = 8
-(blockfile, catfile) = string.split(sources)
+(blockfile, catfile) = sources.split()
#
@@ -43,23 +43,23 @@ BlockNames = {}
try:
blocks = open(blockfile, "r")
except:
- print "Missing %s, aborting ..." % blockfile
+ print("Missing %s, aborting ..." % blockfile)
sys.exit(1)
for line in blocks.readlines():
if line[0] == '#':
continue
- line = string.strip(line)
+ line = line.strip()
if line == '':
continue
try:
- fields = string.split(line, ';')
- range = string.strip(fields[0])
- (start, end) = string.split(range, "..")
- name = string.strip(fields[1])
- name = string.replace(name, ' ', '')
+ fields = line.split(';')
+ range = fields[0].strip()
+ (start, end) = range.split("..")
+ name = fields[1].strip()
+ name = name.replace(' ', '')
except:
- print "Failed to process line: %s" % (line)
+ print("Failed to process line: %s" % (line))
continue
start = "0x" + start
end = "0x" + end
@@ -68,19 +68,19 @@ for line in blocks.readlines():
except:
BlockNames[name] = [(start, end)]
blocks.close()
-print "Parsed %d blocks descriptions" % (len(BlockNames.keys()))
+print("Parsed %d blocks descriptions" % (len(BlockNames.keys())))
for block in blockAliases:
- alias = string.split(block,':')
- alist = string.split(alias[1],',')
+ alias = block.split(':')
+ alist = alias[1].split(',')
for comp in alist:
- if BlockNames.has_key(comp):
+ if comp in BlockNames:
if alias[0] not in BlockNames:
BlockNames[alias[0]] = []
for r in BlockNames[comp]:
BlockNames[alias[0]].append(r)
else:
- print "Alias %s: %s not in Blocks" % (alias[0], comp)
+ print("Alias %s: %s not in Blocks" % (alias[0], comp))
continue
#
@@ -96,7 +96,7 @@ for block in blockAliases:
try:
data = open(catfile, "r")
except:
- print "Missing %s, aborting ..." % catfile
+ print("Missing %s, aborting ..." % catfile)
sys.exit(1)
nbchar = 0;
@@ -104,12 +104,12 @@ Categories = {}
for line in data.readlines():
if line[0] == '#':
continue
- line = string.strip(line)
+ line = line.strip()
if line == '':
continue
try:
- fields = string.split(line, ';')
- point = string.strip(fields[0])
+ fields = line.split(';')
+ point = fields[0].strip()
value = 0
while point != '':
value = value * 16
@@ -122,7 +122,7 @@ for line in data.readlines():
point = point[1:]
name = fields[2]
except:
- print "Failed to process line: %s" % (line)
+ print("Failed to process line: %s" % (line))
continue
nbchar = nbchar + 1
@@ -133,7 +133,7 @@ for line in data.readlines():
try:
Categories[name] = [value]
except:
- print "Failed to process line: %s" % (line)
+ print("Failed to process line: %s" % (line))
# update "general category" name
try:
Categories[name[0]].append(value)
@@ -141,10 +141,10 @@ for line in data.readlines():
try:
Categories[name[0]] = [value]
except:
- print "Failed to process line: %s" % (line)
+ print("Failed to process line: %s" % (line))
blocks.close()
-print "Parsed %d char generating %d categories" % (nbchar, len(Categories.keys()))
+print("Parsed %d char generating %d categories" % (nbchar, len(Categories.keys())))
#
# The data is now all read. Time to process it into a more useful form.
@@ -184,11 +184,9 @@ for cat in Categories.keys():
# Assure all data is in alphabetic order, since we will be doing binary
# searches on the tables.
#
-bkeys = BlockNames.keys()
-bkeys.sort()
+bkeys = sorted(BlockNames.keys())
-ckeys = Categories.keys()
-ckeys.sort()
+ckeys = sorted(Categories.keys())
#
# Generate the resulting files
@@ -196,13 +194,13 @@ ckeys.sort()
try:
header = open("include/libxml/xmlunicode.h", "w")
except:
- print "Failed to open include/libxml/xmlunicode.h"
+ print("Failed to open include/libxml/xmlunicode.h")
sys.exit(1)
try:
output = open("xmlunicode.c", "w")
except:
- print "Failed to open xmlunicode.c"
+ print("Failed to open xmlunicode.c")
sys.exit(1)
date = time.asctime(time.localtime(time.time()))
@@ -272,14 +270,14 @@ typedef struct {
} xmlUnicodeNameTable;
-static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname);
+static xmlIntFunc *xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname);
static const xmlUnicodeRange xmlUnicodeBlocks[] = {
""" % (webpage, date, sources));
flag = 0
for block in bkeys:
- name = string.replace(block, '-', '')
+ name = block.replace('-', '')
if flag:
output.write(',\n')
else:
@@ -287,7 +285,7 @@ for block in bkeys:
output.write(' {"%s", xmlUCSIs%s}' % (block, name))
output.write('};\n\n')
-output.write('static xmlUnicodeRange xmlUnicodeCats[] = {\n')
+output.write('static const xmlUnicodeRange xmlUnicodeCats[] = {\n')
flag = 0;
for name in ckeys:
if flag:
@@ -315,7 +313,7 @@ for name in ckeys:
pline = "static const xmlChSRange xml%sS[] = {" % name
sptr = "xml%sS" % name
else:
- pline += ", "
+ pline += ","
numshort += 1
else:
if numlong == 0:
@@ -324,19 +322,21 @@ for name in ckeys:
pline = "static const xmlChLRange xml%sL[] = {" % name
lptr = "xml%sL" % name
else:
- pline += ", "
+ pline += ","
numlong += 1
if len(pline) > 60:
output.write(pline + "\n")
pline = " "
+ elif pline[-1:] == ",":
+ pline += " "
pline += "{%s, %s}" % (hex(low), hex(high))
- output.write(pline + " };\nstatic xmlChRangeGroup xml%sG = {%s,%s,%s,%s};\n\n"
+ output.write(pline + " };\nstatic const xmlChRangeGroup xml%sG = {%s,%s,%s,%s};\n\n"
% (name, numshort, numlong, sptr, lptr))
output.write(
-"""static xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s};
-static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s};
+"""static const xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s};
+static const xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s};
/**
* xmlUnicodeLookup:
@@ -348,9 +348,9 @@ static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s};
* Returns pointer to range function if found, otherwise NULL
*/
static xmlIntFunc
-*xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname) {
+*xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname) {
int low, high, mid, cmp;
- xmlUnicodeRange *sptr;
+ const xmlUnicodeRange *sptr;
if ((tptr == NULL) || (tname == NULL)) return(NULL);
@@ -366,13 +366,13 @@ static xmlIntFunc
else
low = mid + 1;
}
- return (NULL);
+ return (NULL);
}
""" % (len(BlockNames), len(Categories)) )
for block in bkeys:
- name = string.replace(block, '-', '')
+ name = block.replace('-', '')
header.write("XMLPUBFUN int XMLCALL xmlUCSIs%s\t(int code);\n" % name)
output.write("/**\n * xmlUCSIs%s:\n * @code: UCS code point\n" % (name))
output.write(" *\n * Check whether the character is part of %s UCS Block\n"%
diff --git a/chromium/third_party/libxml/src/gentest.py b/chromium/third_party/libxml/src/gentest.py
index 88f88f18973..172ed7e95cf 100755
--- a/chromium/third_party/libxml/src/gentest.py
+++ b/chromium/third_party/libxml/src/gentest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python -u
+#!/usr/bin/env python
#
# generate a tester program for the API
#
@@ -8,7 +8,7 @@ import string
try:
import libxml2
except:
- print "libxml2 python bindings not available, skipping testapi.c generation"
+ print("libxml2 python bindings not available, skipping testapi.c generation")
sys.exit(0)
if len(sys.argv) > 1:
@@ -21,8 +21,6 @@ else:
#
skipped_modules = [ "SAX", "xlink", "threads", "globals",
"xmlmemory", "xmlversion", "xmlexports",
- #deprecated
- "DOCBparser",
]
#
@@ -43,7 +41,6 @@ modules_defines = {
"xmlregexp" : "LIBXML_REGEXP_ENABLED",
"xmlautomata" : "LIBXML_AUTOMATA_ENABLED",
"xmlsave" : "LIBXML_OUTPUT_ENABLED",
- "DOCBparser" : "LIBXML_DOCB_ENABLED",
"xmlmodule" : "LIBXML_MODULES_ENABLED",
"pattern" : "LIBXML_PATTERN_ENABLED",
"schematron" : "LIBXML_SCHEMATRON_ENABLED",
@@ -94,7 +91,6 @@ function_defines = {
"xmlSprintfElementContent": "LIBXML_OUTPUT_ENABLED",
"xmlValidGetPotentialChildren" : "LIBXML_VALID_ENABLED",
"xmlValidGetValidElements" : "LIBXML_VALID_ENABLED",
- "docbDefaultSAXHandlerInit" : "LIBXML_DOCB_ENABLED",
"xmlTextReaderPreservePattern" : "LIBXML_PATTERN_ENABLED",
}
@@ -159,6 +155,13 @@ skipped_functions = [
# Legacy
"xmlCleanupPredefinedEntities", "xmlInitializePredefinedEntities",
"xmlSetFeature", "xmlGetFeature", "xmlGetFeaturesList",
+# location sets
+"xmlXPtrLocationSetAdd",
+"xmlXPtrLocationSetCreate",
+"xmlXPtrLocationSetDel",
+"xmlXPtrLocationSetMerge",
+"xmlXPtrLocationSetRemove",
+"xmlXPtrWrapLocationSet",
]
#
@@ -225,7 +228,7 @@ extra_post_call = {
if (old != NULL) {
xmlUnlinkNode(old);
xmlFreeNode(old) ; old = NULL ; }
- ret_val = NULL;""",
+\t ret_val = NULL;""",
"xmlTextMerge":
"""if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
xmlUnlinkNode(second);
@@ -234,7 +237,7 @@ extra_post_call = {
"""if ((ret_val != NULL) && (ret_val != ncname) &&
(ret_val != prefix) && (ret_val != memory))
xmlFree(ret_val);
- ret_val = NULL;""",
+\t ret_val = NULL;""",
"xmlNewDocElementContent":
"""xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""",
"xmlDictReference": "xmlDictFree(dict);",
@@ -266,29 +269,29 @@ modules = []
def is_skipped_module(name):
for mod in skipped_modules:
if mod == name:
- return 1
+ return 1
return 0
def is_skipped_function(name):
for fun in skipped_functions:
if fun == name:
- return 1
+ return 1
# Do not test destructors
- if string.find(name, 'Free') != -1:
+ if name.find('Free') != -1:
return 1
return 0
def is_skipped_memcheck(name):
for fun in skipped_memcheck:
if fun == name:
- return 1
+ return 1
return 0
missing_types = {}
def add_missing_type(name, func):
try:
list = missing_types[name]
- list.append(func)
+ list.append(func)
except:
missing_types[name] = [func]
@@ -308,7 +311,7 @@ def add_missing_functions(name, module):
missing_functions_nr = missing_functions_nr + 1
try:
list = missing_functions[module]
- list.append(name)
+ list.append(name)
except:
missing_functions[module] = [name]
@@ -317,45 +320,45 @@ def add_missing_functions(name, module):
#
def type_convert(str, name, info, module, function, pos):
-# res = string.replace(str, " ", " ")
-# res = string.replace(str, " ", " ")
-# res = string.replace(str, " ", " ")
- res = string.replace(str, " *", "_ptr")
-# res = string.replace(str, "*", "_ptr")
- res = string.replace(res, " ", "_")
+# res = str.replace(" ", " ")
+# res = str.replace(" ", " ")
+# res = str.replace(" ", " ")
+ res = str.replace(" *", "_ptr")
+# res = str.replace("*", "_ptr")
+ res = res.replace(" ", "_")
if res == 'const_char_ptr':
- if string.find(name, "file") != -1 or \
- string.find(name, "uri") != -1 or \
- string.find(name, "URI") != -1 or \
- string.find(info, "filename") != -1 or \
- string.find(info, "URI") != -1 or \
- string.find(info, "URL") != -1:
- if string.find(function, "Save") != -1 or \
- string.find(function, "Create") != -1 or \
- string.find(function, "Write") != -1 or \
- string.find(function, "Fetch") != -1:
- return('fileoutput')
- return('filepath')
+ if name.find("file") != -1 or \
+ name.find("uri") != -1 or \
+ name.find("URI") != -1 or \
+ info.find("filename") != -1 or \
+ info.find("URI") != -1 or \
+ info.find("URL") != -1:
+ if function.find("Save") != -1 or \
+ function.find("Create") != -1 or \
+ function.find("Write") != -1 or \
+ function.find("Fetch") != -1:
+ return('fileoutput')
+ return('filepath')
if res == 'void_ptr':
if module == 'nanoftp' and name == 'ctx':
- return('xmlNanoFTPCtxtPtr')
+ return('xmlNanoFTPCtxtPtr')
if function == 'xmlNanoFTPNewCtxt' or \
- function == 'xmlNanoFTPConnectTo' or \
- function == 'xmlNanoFTPOpen':
- return('xmlNanoFTPCtxtPtr')
+ function == 'xmlNanoFTPConnectTo' or \
+ function == 'xmlNanoFTPOpen':
+ return('xmlNanoFTPCtxtPtr')
if module == 'nanohttp' and name == 'ctx':
- return('xmlNanoHTTPCtxtPtr')
- if function == 'xmlNanoHTTPMethod' or \
- function == 'xmlNanoHTTPMethodRedir' or \
- function == 'xmlNanoHTTPOpen' or \
- function == 'xmlNanoHTTPOpenRedir':
- return('xmlNanoHTTPCtxtPtr');
+ return('xmlNanoHTTPCtxtPtr')
+ if function == 'xmlNanoHTTPMethod' or \
+ function == 'xmlNanoHTTPMethodRedir' or \
+ function == 'xmlNanoHTTPOpen' or \
+ function == 'xmlNanoHTTPOpenRedir':
+ return('xmlNanoHTTPCtxtPtr');
if function == 'xmlIOHTTPOpen':
- return('xmlNanoHTTPCtxtPtr')
- if string.find(name, "data") != -1:
- return('userdata')
- if string.find(name, "user") != -1:
- return('userdata')
+ return('xmlNanoHTTPCtxtPtr')
+ if name.find("data") != -1:
+ return('userdata')
+ if name.find("user") != -1:
+ return('userdata')
if res == 'xmlDoc_ptr':
res = 'xmlDocPtr'
if res == 'xmlNode_ptr':
@@ -364,18 +367,18 @@ def type_convert(str, name, info, module, function, pos):
res = 'xmlDictPtr'
if res == 'xmlNodePtr' and pos != 0:
if (function == 'xmlAddChild' and pos == 2) or \
- (function == 'xmlAddChildList' and pos == 2) or \
+ (function == 'xmlAddChildList' and pos == 2) or \
(function == 'xmlAddNextSibling' and pos == 2) or \
(function == 'xmlAddSibling' and pos == 2) or \
(function == 'xmlDocSetRootElement' and pos == 2) or \
(function == 'xmlReplaceNode' and pos == 2) or \
(function == 'xmlTextMerge') or \
- (function == 'xmlAddPrevSibling' and pos == 2):
- return('xmlNodePtr_in');
+ (function == 'xmlAddPrevSibling' and pos == 2):
+ return('xmlNodePtr_in');
if res == 'const xmlBufferPtr':
res = 'xmlBufferPtr'
if res == 'xmlChar_ptr' and name == 'name' and \
- string.find(function, "EatName") != -1:
+ function.find("EatName") != -1:
return('eaten_name')
if res == 'void_ptr*':
res = 'void_ptr_ptr'
@@ -391,7 +394,7 @@ def type_convert(str, name, info, module, function, pos):
res = 'debug_FILE_ptr';
if res == 'int' and name == 'options':
if module == 'parser' or module == 'xmlreader':
- res = 'parseroptions'
+ res = 'parseroptions'
return res
@@ -400,38 +403,35 @@ known_param_types = []
def is_known_param_type(name):
for type in known_param_types:
if type == name:
- return 1
+ return 1
return name[-3:] == 'Ptr' or name[-4:] == '_ptr'
def generate_param_type(name, rtype):
global test
for type in known_param_types:
if type == name:
- return
+ return
for type in generated_param_types:
if type == name:
- return
+ return
if name[-3:] == 'Ptr' or name[-4:] == '_ptr':
if rtype[0:6] == 'const ':
- crtype = rtype[6:]
- else:
- crtype = rtype
+ crtype = rtype[6:]
+ else:
+ crtype = rtype
define = 0
- if modules_defines.has_key(module):
- test.write("#ifdef %s\n" % (modules_defines[module]))
- define = 1
+ if module in modules_defines:
+ test.write("#ifdef %s\n" % (modules_defines[module]))
+ define = 1
test.write("""
#define gen_nb_%s 1
-static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-""" % (name, crtype, name, name, rtype))
+#define gen_%s(no, nr) NULL
+#define des_%s(no, val, nr)
+""" % (name, name, name))
if define == 1:
- test.write("#endif\n\n")
+ test.write("#endif\n\n")
add_generated_param_type(name)
#
@@ -443,7 +443,7 @@ known_return_types = []
def is_known_return_type(name):
for type in known_return_types:
if type == name:
- return 1
+ return 1
return 0
#
@@ -469,7 +469,7 @@ def compare_and_save():
try:
os.system("rm testapi.c; mv testapi.c.new testapi.c")
except:
- os.system("mv testapi.c.new testapi.c")
+ os.system("mv testapi.c.new testapi.c")
print("Updated testapi.c")
else:
print("Generated testapi.c is identical")
@@ -479,17 +479,17 @@ while line != "":
if line == "/* CUT HERE: everything below that line is generated */\n":
break;
if line[0:15] == "#define gen_nb_":
- type = string.split(line[15:])[0]
- known_param_types.append(type)
+ type = line[15:].split()[0]
+ known_param_types.append(type)
if line[0:19] == "static void desret_":
- type = string.split(line[19:], '(')[0]
- known_return_types.append(type)
+ type = line[19:].split('(')[0]
+ known_return_types.append(type)
test.write(line)
line = input.readline()
input.close()
if line == "":
- print "Could not find the CUT marker in testapi.c skipping generation"
+ print("Could not find the CUT marker in testapi.c skipping generation")
test.close()
sys.exit(0)
@@ -503,7 +503,7 @@ test.write("/* CUT HERE: everything below that line is generated */\n")
#
doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0)
if doc == None:
- print "Failed to load doc/libxml2-api.xml"
+ print("Failed to load doc/libxml2-api.xml")
sys.exit(1)
ctxt = doc.xpathNewContext()
@@ -517,9 +517,9 @@ for arg in args:
mod = arg.xpathEval('string(../@file)')
func = arg.xpathEval('string(../@name)')
if (mod not in skipped_modules) and (func not in skipped_functions):
- type = arg.xpathEval('string(@type)')
- if not argtypes.has_key(type):
- argtypes[type] = func
+ type = arg.xpathEval('string(@type)')
+ if type not in argtypes:
+ argtypes[type] = func
# similarly for return types
rettypes = {}
@@ -529,8 +529,8 @@ for ret in rets:
func = ret.xpathEval('string(../@name)')
if (mod not in skipped_modules) and (func not in skipped_functions):
type = ret.xpathEval('string(@type)')
- if not rettypes.has_key(type):
- rettypes[type] = func
+ if type not in rettypes:
+ rettypes[type] = func
#
# Generate constructors and return type handling for all enums
@@ -547,49 +547,49 @@ for enum in enums:
continue;
define = 0
- if argtypes.has_key(name) and is_known_param_type(name) == 0:
- values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name)
- i = 0
- vals = []
- for value in values:
- vname = value.xpathEval('string(@name)')
- if vname == None:
- continue;
- i = i + 1
- if i >= 5:
- break;
- vals.append(vname)
- if vals == []:
- print "Didn't find any value for enum %s" % (name)
- continue
- if modules_defines.has_key(module):
- test.write("#ifdef %s\n" % (modules_defines[module]))
- define = 1
- test.write("#define gen_nb_%s %d\n" % (name, len(vals)))
- test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" %
- (name, name))
- i = 1
- for value in vals:
- test.write(" if (no == %d) return(%s);\n" % (i, value))
- i = i + 1
- test.write(""" return(0);
+ if (name in argtypes) and is_known_param_type(name) == 0:
+ values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name)
+ i = 0
+ vals = []
+ for value in values:
+ vname = value.xpathEval('string(@name)')
+ if vname == None:
+ continue;
+ i = i + 1
+ if i >= 5:
+ break;
+ vals.append(vname)
+ if vals == []:
+ print("Didn't find any value for enum %s" % (name))
+ continue
+ if module in modules_defines:
+ test.write("#ifdef %s\n" % (modules_defines[module]))
+ define = 1
+ test.write("#define gen_nb_%s %d\n" % (name, len(vals)))
+ test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" %
+ (name, name))
+ i = 1
+ for value in vals:
+ test.write(" if (no == %d) return(%s);\n" % (i, value))
+ i = i + 1
+ test.write(""" return(0);
}
static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
""" % (name, name));
- known_param_types.append(name)
+ known_param_types.append(name)
if (is_known_return_type(name) == 0) and (name in rettypes):
- if define == 0 and modules_defines.has_key(module):
- test.write("#ifdef %s\n" % (modules_defines[module]))
- define = 1
+ if define == 0 and (module in modules_defines):
+ test.write("#ifdef %s\n" % (modules_defines[module]))
+ define = 1
test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) {
}
""" % (name, name))
- known_return_types.append(name)
+ known_return_types.append(name)
if define == 1:
test.write("#endif\n\n")
@@ -613,9 +613,9 @@ for file in headers:
# do not test deprecated APIs
#
desc = file.xpathEval('string(description)')
- if string.find(desc, 'DEPRECATED') != -1:
- print "Skipping deprecated interface %s" % name
- continue;
+ if desc.find('DEPRECATED') != -1:
+ print("Skipping deprecated interface %s" % name)
+ continue;
test.write("#include <libxml/%s.h>\n" % name)
modules.append(name)
@@ -677,7 +677,7 @@ def generate_test(module, node):
# and store the information for the generation
#
try:
- args = node.xpathEval("arg")
+ args = node.xpathEval("arg")
except:
args = []
t_args = []
@@ -685,37 +685,37 @@ def generate_test(module, node):
for arg in args:
n = n + 1
rtype = arg.xpathEval("string(@type)")
- if rtype == 'void':
- break;
- info = arg.xpathEval("string(@info)")
- nam = arg.xpathEval("string(@name)")
+ if rtype == 'void':
+ break;
+ info = arg.xpathEval("string(@info)")
+ nam = arg.xpathEval("string(@name)")
type = type_convert(rtype, nam, info, module, name, n)
- if is_known_param_type(type) == 0:
- add_missing_type(type, name);
- no_gen = 1
+ if is_known_param_type(type) == 0:
+ add_missing_type(type, name);
+ no_gen = 1
if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
- rtype[0:6] == 'const ':
- crtype = rtype[6:]
- else:
- crtype = rtype
- t_args.append((nam, type, rtype, crtype, info))
+ rtype[0:6] == 'const ':
+ crtype = rtype[6:]
+ else:
+ crtype = rtype
+ t_args.append((nam, type, rtype, crtype, info))
try:
- rets = node.xpathEval("return")
+ rets = node.xpathEval("return")
except:
rets = []
t_ret = None
for ret in rets:
rtype = ret.xpathEval("string(@type)")
- info = ret.xpathEval("string(@info)")
+ info = ret.xpathEval("string(@info)")
type = type_convert(rtype, 'return', info, module, name, 0)
- if rtype == 'void':
- break
- if is_known_return_type(type) == 0:
- add_missing_type(type, name);
- no_gen = 1
- t_ret = (type, rtype, info)
- break
+ if rtype == 'void':
+ break
+ if is_known_return_type(type) == 0:
+ add_missing_type(type, name);
+ no_gen = 1
+ t_ret = (type, rtype, info)
+ break
if no_gen == 0:
for t_arg in t_args:
@@ -731,7 +731,7 @@ test_%s(void) {
if no_gen == 1:
add_missing_functions(name, module)
- test.write("""
+ test.write("""
/* missing type support */
return(test_ret);
}
@@ -740,22 +740,22 @@ test_%s(void) {
return
try:
- conds = node.xpathEval("cond")
- for cond in conds:
- test.write("#if %s\n" % (cond.get_content()))
- nb_cond = nb_cond + 1
+ conds = node.xpathEval("cond")
+ for cond in conds:
+ test.write("#if %s\n" % (cond.get_content()))
+ nb_cond = nb_cond + 1
except:
pass
define = 0
- if function_defines.has_key(name):
+ if name in function_defines:
test.write("#ifdef %s\n" % (function_defines[name]))
- define = 1
+ define = 1
# Declare the memory usage counter
no_mem = is_skipped_memcheck(name)
if no_mem == 0:
- test.write(" int mem_base;\n");
+ test.write(" int mem_base;\n");
# Declare the return value
if t_ret != None:
@@ -764,29 +764,29 @@ test_%s(void) {
# Declare the arguments
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
- # add declaration
- test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
- test.write(" int n_%s;\n" % (nam))
+ # add declaration
+ test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
+ test.write(" int n_%s;\n" % (nam))
test.write("\n")
# Cascade loop on of each argument list of values
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
- #
- test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
- nam, nam, type, nam))
+ #
+ test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
+ nam, nam, type, nam))
# log the memory usage
if no_mem == 0:
- test.write(" mem_base = xmlMemBlocks();\n");
+ test.write(" mem_base = xmlMemBlocks();\n");
# prepare the call
i = 0;
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
- #
- test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
- i = i + 1;
+ #
+ test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
+ i = i + 1;
# add checks to avoid out-of-bounds array access
i = 0;
@@ -795,7 +795,7 @@ test_%s(void) {
# assume that "size", "len", and "start" parameters apply to either
# the nearest preceding or following char pointer
if type == "int" and (nam == "size" or nam == "len" or nam == "start"):
- for j in range(i - 1, -1, -1) + range(i + 1, len(t_args)):
+ for j in (list(range(i - 1, -1, -1)) + list(range(i + 1, len(t_args)))):
(bnam, btype) = t_args[j][:2]
if btype == "const_char_ptr" or btype == "const_xmlChar_ptr":
test.write(
@@ -804,42 +804,42 @@ test_%s(void) {
" continue;\n"
% (bnam, nam, bnam))
break
- i = i + 1;
+ i = i + 1;
# do the call, and clanup the result
- if extra_pre_call.has_key(name):
- test.write(" %s\n"% (extra_pre_call[name]))
+ if name in extra_pre_call:
+ test.write(" %s\n"% (extra_pre_call[name]))
if t_ret != None:
- test.write("\n ret_val = %s(" % (name))
- need = 0
- for arg in t_args:
- (nam, type, rtype, crtype, info) = arg
- if need:
- test.write(", ")
- else:
- need = 1
- if rtype != crtype:
- test.write("(%s)" % rtype)
- test.write("%s" % nam);
- test.write(");\n")
- if extra_post_call.has_key(name):
- test.write(" %s\n"% (extra_post_call[name]))
- test.write(" desret_%s(ret_val);\n" % t_ret[0])
+ test.write("\n ret_val = %s(" % (name))
+ need = 0
+ for arg in t_args:
+ (nam, type, rtype, crtype, info) = arg
+ if need:
+ test.write(", ")
+ else:
+ need = 1
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
+ test.write("%s" % nam);
+ test.write(");\n")
+ if name in extra_post_call:
+ test.write(" %s\n"% (extra_post_call[name]))
+ test.write(" desret_%s(ret_val);\n" % t_ret[0])
else:
- test.write("\n %s(" % (name));
- need = 0;
- for arg in t_args:
- (nam, type, rtype, crtype, info) = arg;
- if need:
- test.write(", ")
- else:
- need = 1
- if rtype != crtype:
- test.write("(%s)" % rtype)
- test.write("%s" % nam)
- test.write(");\n")
- if extra_post_call.has_key(name):
- test.write(" %s\n"% (extra_post_call[name]))
+ test.write("\n %s(" % (name));
+ need = 0;
+ for arg in t_args:
+ (nam, type, rtype, crtype, info) = arg;
+ if need:
+ test.write(", ")
+ else:
+ need = 1
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
+ test.write("%s" % nam)
+ test.write(");\n")
+ if name in extra_post_call:
+ test.write(" %s\n"% (extra_post_call[name]))
test.write(" call_tests++;\n");
@@ -847,32 +847,32 @@ test_%s(void) {
i = 0;
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
- # This is a hack to prevent generating a destructor for the
- # 'input' argument in xmlTextReaderSetup. There should be
- # a better, more generic way to do this!
- if string.find(info, 'destroy') == -1:
- test.write(" des_%s(n_%s, " % (type, nam))
- if rtype != crtype:
- test.write("(%s)" % rtype)
- test.write("%s, %d);\n" % (nam, i))
- i = i + 1;
+ # This is a hack to prevent generating a destructor for the
+ # 'input' argument in xmlTextReaderSetup. There should be
+ # a better, more generic way to do this!
+ if info.find('destroy') == -1:
+ test.write(" des_%s(n_%s, " % (type, nam))
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
+ test.write("%s, %d);\n" % (nam, i))
+ i = i + 1;
test.write(" xmlResetLastError();\n");
# Check the memory usage
if no_mem == 0:
- test.write(""" if (mem_base != xmlMemBlocks()) {
+ test.write(""" if (mem_base != xmlMemBlocks()) {
printf("Leak of %%d blocks found in %s",
- xmlMemBlocks() - mem_base);
- test_ret++;
+\t xmlMemBlocks() - mem_base);
+\t test_ret++;
""" % (name));
- for arg in t_args:
- (nam, type, rtype, crtype, info) = arg;
- test.write(""" printf(" %%d", n_%s);\n""" % (nam))
- test.write(""" printf("\\n");\n""")
- test.write(" }\n")
+ for arg in t_args:
+ (nam, type, rtype, crtype, info) = arg;
+ test.write(""" printf(" %%d", n_%s);\n""" % (nam))
+ test.write(""" printf("\\n");\n""")
+ test.write(" }\n")
for arg in t_args:
- test.write(" }\n")
+ test.write(" }\n")
test.write(" function_tests++;\n")
#
@@ -880,7 +880,7 @@ test_%s(void) {
#
while nb_cond > 0:
test.write("#endif\n")
- nb_cond = nb_cond -1
+ nb_cond = nb_cond -1
if define == 1:
test.write("#endif\n")
@@ -898,10 +898,10 @@ test_%s(void) {
for module in modules:
# gather all the functions exported by that module
try:
- functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module))
+ functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module))
except:
- print "Failed to gather functions from module %s" % (module)
- continue;
+ print("Failed to gather functions from module %s" % (module))
+ continue;
# iterate over all functions in the module generating the test
i = 0
@@ -921,14 +921,14 @@ test_%s(void) {
# iterate over all functions in the module generating the call
for function in functions:
name = function.xpathEval('string(@name)')
- if is_skipped_function(name):
- continue
- test.write(" test_ret += test_%s();\n" % (name))
+ if is_skipped_function(name):
+ continue
+ test.write(" test_ret += test_%s();\n" % (name))
# footer
test.write("""
if (test_ret != 0)
- printf("Module %s: %%d errors\\n", test_ret);
+\tprintf("Module %s: %%d errors\\n", test_ret);
return(test_ret);
}
""" % (module))
@@ -946,7 +946,7 @@ test.write(""" return(0);
}
""");
-print "Generated test for %d modules and %d functions" %(len(modules), nb_tests)
+print("Generated test for %d modules and %d functions" %(len(modules), nb_tests))
compare_and_save()
@@ -958,11 +958,8 @@ for missing in missing_types.keys():
n = len(missing_types[missing])
missing_list.append((n, missing))
-def compare_missing(a, b):
- return b[0] - a[0]
-
-missing_list.sort(compare_missing)
-print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list))
+missing_list.sort(key=lambda a: a[0])
+print("Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list)))
lst = open("missing.lst", "w")
lst.write("Missing support for %d types" % (len(missing_list)))
lst.write("\n")
@@ -972,9 +969,9 @@ for miss in missing_list:
for n in missing_types[miss[1]]:
i = i + 1
if i > 5:
- lst.write(" ...")
- break
- lst.write(" %s" % (n))
+ lst.write(" ...")
+ break
+ lst.write(" %s" % (n))
lst.write("\n")
lst.write("\n")
lst.write("\n")
diff --git a/chromium/third_party/libxml/src/globals.c b/chromium/third_party/libxml/src/globals.c
index 4aec81232be..7e5c1aa9ef3 100644
--- a/chromium/third_party/libxml/src/globals.c
+++ b/chromium/third_party/libxml/src/globals.c
@@ -21,6 +21,10 @@
#include <libxml/xmlmemory.h>
#include <libxml/threads.h>
+#include "private/error.h"
+#include "private/threads.h"
+#include "private/tree.h"
+
/* #define DEBUG_GLOBALS */
/*
@@ -40,6 +44,9 @@ static xmlMutexPtr xmlThrDefMutex = NULL;
/**
* xmlInitGlobals:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* Additional initialisation for multi-threading
*/
void xmlInitGlobals(void)
@@ -134,7 +141,6 @@ xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
#include <libxml/globals.h>
#include <libxml/SAX.h>
-#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
@@ -173,6 +179,8 @@ const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
/**
* xmlBufferAllocScheme:
*
+ * DEPRECATED: Don't use.
+ *
* Global setting, default allocation policy for buffers, default is
* XML_BUFFER_ALLOC_EXACT
*/
@@ -181,6 +189,8 @@ static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_E
/**
* xmlDefaultBufferSize:
*
+ * DEPRECATED: Don't use.
+ *
* Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
*/
int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
@@ -199,6 +209,8 @@ int oldXMLWDcompatibility = 0; /* DEPRECATED */
/**
* xmlParserDebugEntities:
*
+ * DEPRECATED: Don't use
+ *
* Global setting, asking the parser to print out debugging information.
* while handling entities.
* Disabled by default
@@ -208,6 +220,8 @@ static int xmlParserDebugEntitiesThrDef = 0;
/**
* xmlDoValidityCheckingDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_DTDVALID.
+ *
* Global setting, indicate that the parser should work in validating mode.
* Disabled by default.
*/
@@ -216,7 +230,9 @@ static int xmlDoValidityCheckingDefaultValueThrDef = 0;
/**
* xmlGetWarningsDefaultValue:
*
- * Global setting, indicate that the parser should provide warnings.
+ * DEPRECATED: Don't use
+ *
+ * Global setting, indicate that the DTD validation should provide warnings.
* Activated by default.
*/
int xmlGetWarningsDefaultValue = 1;
@@ -224,6 +240,8 @@ static int xmlGetWarningsDefaultValueThrDef = 1;
/**
* xmlLoadExtDtdDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_DTDLOAD.
+ *
* Global setting, indicate that the parser should load DTD while not
* validating.
* Disabled by default.
@@ -233,6 +251,8 @@ static int xmlLoadExtDtdDefaultValueThrDef = 0;
/**
* xmlPedanticParserDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.
+ *
* Global setting, indicate that the parser be pedantic
* Disabled by default.
*/
@@ -241,6 +261,8 @@ static int xmlPedanticParserDefaultValueThrDef = 0;
/**
* xmlLineNumbersDefaultValue:
*
+ * DEPRECATED: The modern options API always enables line numbers.
+ *
* Global setting, indicate that the parser should store the line number
* in the content field of elements in the DOM tree.
* Disabled by default since this may not be safe for old classes of
@@ -251,6 +273,8 @@ static int xmlLineNumbersDefaultValueThrDef = 0;
/**
* xmlKeepBlanksDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.
+ *
* Global setting, indicate that the parser should keep all blanks
* nodes found in the content
* Activated by default, this is actually needed to have the parser
@@ -262,6 +286,8 @@ static int xmlKeepBlanksDefaultValueThrDef = 1;
/**
* xmlSubstituteEntitiesDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOENT.
+ *
* Global setting, indicate that the parser should not generate entity
* references but replace them with the actual content of the entity
* Disabled by default, this should be activated when using XPath since
@@ -271,26 +297,38 @@ static int xmlKeepBlanksDefaultValueThrDef = 1;
int xmlSubstituteEntitiesDefaultValue = 0;
static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
+/**
+ * xmlRegisterNodeDefaultValue:
+ *
+ * DEPRECATED: Don't use
+ */
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
+
+/**
+ * xmlDeregisterNodeDefaultValue:
+ *
+ * DEPRECATED: Don't use
+ */
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
+/**
+ * xmlParserInputBufferCreateFilenameValue:
+ *
+ * DEPRECATED: Don't use
+ */
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
+/**
+ * xmlOutputBufferCreateFilenameValue:
+ *
+ * DEPRECATED: Don't use
+ */
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
-/*
- * Error handling
- */
-
-/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
-/* Must initialize xmlGenericError in xmlInitParser */
-void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
- const char *msg,
- ...);
/**
* xmlGenericError:
*
@@ -356,6 +394,9 @@ static int xmlSaveNoEmptyTagsThrDef = 0;
/**
* xmlDefaultSAXHandler:
*
+ * DEPRECATED: This handler is unused and will be removed from future
+ * versions.
+ *
* Default SAX version1 handler for XML, builds the DOM tree
*/
xmlSAXHandlerV1 xmlDefaultSAXHandler = {
@@ -393,6 +434,8 @@ xmlSAXHandlerV1 xmlDefaultSAXHandler = {
/**
* xmlDefaultSAXLocator:
*
+ * DEPRECATED: Don't use
+ *
* The default SAX Locator
* { getPublicId, getSystemId, getLineNumber, getColumnNumber}
*/
@@ -403,10 +446,13 @@ xmlSAXLocator xmlDefaultSAXLocator = {
xmlSAX2GetColumnNumber
};
-#ifdef LIBXML_HTML_ENABLED
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
/**
* htmlDefaultSAXHandler:
*
+ * DEPRECATED: This handler is unused and will be removed from future
+ * versions.
+ *
* Default old SAX v1 handler for HTML, builds the DOM tree
*/
xmlSAXHandlerV1 htmlDefaultSAXHandler = {
@@ -441,44 +487,6 @@ xmlSAXHandlerV1 htmlDefaultSAXHandler = {
};
#endif /* LIBXML_HTML_ENABLED */
-#ifdef LIBXML_DOCB_ENABLED
-/**
- * docbDefaultSAXHandler:
- *
- * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
- */
-xmlSAXHandlerV1 docbDefaultSAXHandler = {
- xmlSAX2InternalSubset,
- xmlSAX2IsStandalone,
- xmlSAX2HasInternalSubset,
- xmlSAX2HasExternalSubset,
- xmlSAX2ResolveEntity,
- xmlSAX2GetEntity,
- xmlSAX2EntityDecl,
- NULL,
- NULL,
- NULL,
- NULL,
- xmlSAX2SetDocumentLocator,
- xmlSAX2StartDocument,
- xmlSAX2EndDocument,
- xmlSAX2StartElement,
- xmlSAX2EndElement,
- xmlSAX2Reference,
- xmlSAX2Characters,
- xmlSAX2IgnorableWhitespace,
- NULL,
- xmlSAX2Comment,
- xmlParserWarning,
- xmlParserError,
- xmlParserError,
- xmlSAX2GetParameterEntity,
- NULL,
- NULL,
- 0,
-};
-#endif /* LIBXML_DOCB_ENABLED */
-
/**
* xmlInitializeGlobalState:
* @gs: a pointer to a newly allocated global state
@@ -490,8 +498,8 @@ void
xmlInitializeGlobalState(xmlGlobalStatePtr gs)
{
#ifdef DEBUG_GLOBALS
- fprintf(stderr, "Initializing globals at %lu for thread %d\n",
- (unsigned long) gs, xmlGetThreadId());
+ fprintf(stderr, "Initializing globals at %p for thread %d\n",
+ (void *) gs, xmlGetThreadId());
#endif
/*
@@ -502,9 +510,6 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
xmlMutexLock(xmlThrDefMutex);
-#if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
- initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
-#endif
#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
#endif
@@ -562,9 +567,26 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
}
/**
- * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
- * those are really internal work
+ * xmlCleanupGlobals:
+ *
+ * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * to free global state but see the warnings there. xmlCleanupParser
+ * should be only called once at program exit. In most cases, you don't
+ * have call cleanup functions at all.
+ *
+ * Additional cleanup for multi-threading
*/
+void xmlCleanupGlobals(void)
+{
+ xmlResetError(&xmlLastError);
+
+ if (xmlThrDefMutex != NULL) {
+ xmlFreeMutex(xmlThrDefMutex);
+ xmlThrDefMutex = NULL;
+ }
+ __xmlGlobalInitMutexDestroy();
+}
+
void
xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
xmlMutexLock(xmlThrDefMutex);
@@ -685,18 +707,7 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
return(old);
}
-#ifdef LIBXML_DOCB_ENABLED
-#undef docbDefaultSAXHandler
-xmlSAXHandlerV1 *
-__docbDefaultSAXHandler(void) {
- if (IS_MAIN_THREAD)
- return (&docbDefaultSAXHandler);
- else
- return (&xmlGetGlobalState()->docbDefaultSAXHandler);
-}
-#endif
-
-#ifdef LIBXML_HTML_ENABLED
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
#undef htmlDefaultSAXHandler
xmlSAXHandlerV1 *
__htmlDefaultSAXHandler(void) {
@@ -1106,19 +1117,3 @@ __xmlOutputBufferCreateFilenameValue(void) {
return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
}
-/**
- * xmlCleanupGlobals:
- *
- * Additional cleanup for multi-threading
- */
-void xmlCleanupGlobals(void)
-{
- xmlResetError(&xmlLastError);
-
- if (xmlThrDefMutex != NULL) {
- xmlFreeMutex(xmlThrDefMutex);
- xmlThrDefMutex = NULL;
- }
- __xmlGlobalInitMutexDestroy();
-}
-
diff --git a/chromium/third_party/libxml/src/hash.c b/chromium/third_party/libxml/src/hash.c
index 894174fb99a..bccc812a3fd 100644
--- a/chromium/third_party/libxml/src/hash.c
+++ b/chromium/third_party/libxml/src/hash.c
@@ -39,6 +39,8 @@
#include <libxml/xmlerror.h>
#include <libxml/globals.h>
+#include "private/dict.h"
+
#define MAX_HASH_LEN 8
/* #define DEBUG_GROW */
@@ -130,7 +132,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
while ((ch = *prefix++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + ch);
}
- value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
+ value = value ^ ((value << 5) + (value >> 3) + ':');
}
if (name != NULL) {
while ((ch = *name++) != 0) {
@@ -142,7 +144,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
while ((ch = *prefix2++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + ch);
}
- value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
+ value = value ^ ((value << 5) + (value >> 3) + ':');
}
if (name2 != NULL) {
while ((ch = *name2++) != 0) {
@@ -154,7 +156,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
while ((ch = *prefix3++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + ch);
}
- value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
+ value = value ^ ((value << 5) + (value >> 3) + ':');
}
if (name3 != NULL) {
while ((ch = *name3++) != 0) {
diff --git a/chromium/third_party/libxml/src/include/Makefile.am b/chromium/third_party/libxml/src/include/Makefile.am
index 7dbfaa5bb58..2603acc6efa 100644
--- a/chromium/third_party/libxml/src/include/Makefile.am
+++ b/chromium/third_party/libxml/src/include/Makefile.am
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS=libxml
+SUBDIRS=libxml private
EXTRA_DIST = win32config.h wsockcompat.h
diff --git a/chromium/third_party/libxml/src/include/libxml/HTMLparser.h b/chromium/third_party/libxml/src/include/libxml/HTMLparser.h
index 1d4fec2f734..e0e96833978 100644
--- a/chromium/third_party/libxml/src/include/libxml/HTMLparser.h
+++ b/chromium/third_party/libxml/src/include/libxml/HTMLparser.h
@@ -83,6 +83,9 @@ struct _htmlEntityDesc {
/*
* There is only few public functions.
*/
+XML_DEPRECATED
+XMLPUBFUN void XMLCALL
+ htmlInitAutoClose (void);
XMLPUBFUN const htmlElemDesc * XMLCALL
htmlTagLookup (const xmlChar *tag);
XMLPUBFUN const htmlEntityDesc * XMLCALL
@@ -97,16 +100,22 @@ XMLPUBFUN int XMLCALL
htmlAutoCloseTag(htmlDocPtr doc,
const xmlChar *name,
htmlNodePtr elem);
+XML_DEPRECATED
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlParseEntityRef(htmlParserCtxtPtr ctxt,
const xmlChar **str);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
htmlParseCharRef(htmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
htmlParseElement(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlNewParserCtxt(void);
+XMLPUBFUN htmlParserCtxtPtr XMLCALL
+ htmlNewSAXParserCtxt(const htmlSAXHandler *sax,
+ void *userData);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlCreateMemoryParserCtxt(const char *buffer,
@@ -114,6 +123,7 @@ XMLPUBFUN htmlParserCtxtPtr XMLCALL
XMLPUBFUN int XMLCALL
htmlParseDocument(htmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseDoc (const xmlChar *cur,
const char *encoding,
@@ -122,6 +132,10 @@ XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseDoc (const xmlChar *cur,
const char *encoding);
+XMLPUBFUN htmlParserCtxtPtr XMLCALL
+ htmlCreateFileParserCtxt(const char *filename,
+ const char *encoding);
+XML_DEPRECATED
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseFile(const char *filename,
const char *encoding,
diff --git a/chromium/third_party/libxml/src/include/libxml/Makefile.am b/chromium/third_party/libxml/src/include/libxml/Makefile.am
index cf9297aad66..5915e3ec000 100644
--- a/chromium/third_party/libxml/src/include/libxml/Makefile.am
+++ b/chromium/third_party/libxml/src/include/libxml/Makefile.am
@@ -26,8 +26,6 @@ xmlinc_HEADERS = \
uri.h \
valid.h \
xlink.h \
- xmlversion.h \
- DOCBparser.h \
catalog.h \
threads.h \
globals.h \
@@ -51,4 +49,6 @@ xmlinc_HEADERS = \
xmlsave.h \
schematron.h
+nodist_xmlinc_HEADERS = xmlversion.h
+
EXTRA_DIST = xmlversion.h.in
diff --git a/chromium/third_party/libxml/src/include/libxml/SAX.h b/chromium/third_party/libxml/src/include/libxml/SAX.h
index 61876d10682..fa50568f253 100644
--- a/chromium/third_party/libxml/src/include/libxml/SAX.h
+++ b/chromium/third_party/libxml/src/include/libxml/SAX.h
@@ -16,7 +16,6 @@
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
-#include <libxml/xlink.h>
#ifdef LIBXML_LEGACY_ENABLED
@@ -194,11 +193,6 @@ XML_DEPRECATED
XMLPUBFUN void XMLCALL
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif
-#ifdef LIBXML_DOCB_ENABLED
-XML_DEPRECATED
-XMLPUBFUN void XMLCALL
- initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
-#endif
#endif /* LIBXML_SAX1_ENABLED */
#ifdef __cplusplus
diff --git a/chromium/third_party/libxml/src/include/libxml/SAX2.h b/chromium/third_party/libxml/src/include/libxml/SAX2.h
index a55212eb554..2d75f9b0f00 100644
--- a/chromium/third_party/libxml/src/include/libxml/SAX2.h
+++ b/chromium/third_party/libxml/src/include/libxml/SAX2.h
@@ -16,7 +16,6 @@
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
-#include <libxml/xlink.h>
#ifdef __cplusplus
extern "C" {
@@ -99,8 +98,7 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlSAX2EndDocument (void *ctx);
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
- defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || \
- defined(LIBXML_LEGACY_ENABLED)
+ defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
XMLPUBFUN void XMLCALL
xmlSAX2StartElement (void *ctx,
const xmlChar *fullname,
@@ -148,6 +146,7 @@ XMLPUBFUN void XMLCALL
int len);
#ifdef LIBXML_SAX1_ENABLED
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlSAXDefaultVersion (int version);
#endif /* LIBXML_SAX1_ENABLED */
@@ -161,15 +160,11 @@ XMLPUBFUN void XMLCALL
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
htmlDefaultSAXHandlerInit (void);
#endif
-#ifdef LIBXML_DOCB_ENABLED
-XMLPUBFUN void XMLCALL
- xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr);
-XMLPUBFUN void XMLCALL
- docbDefaultSAXHandlerInit (void);
-#endif
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlDefaultSAXHandlerInit (void);
#ifdef __cplusplus
diff --git a/chromium/third_party/libxml/src/include/libxml/dict.h b/chromium/third_party/libxml/src/include/libxml/dict.h
index cf54af1f252..91f74d1b8ff 100644
--- a/chromium/third_party/libxml/src/include/libxml/dict.h
+++ b/chromium/third_party/libxml/src/include/libxml/dict.h
@@ -27,6 +27,7 @@ typedef xmlDict *xmlDictPtr;
/*
* Initializer
*/
+XML_DEPRECATED
XMLPUBFUN int XMLCALL xmlInitializeDict(void);
/*
@@ -70,6 +71,7 @@ XMLPUBFUN int XMLCALL
/*
* Cleanup function
*/
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlDictCleanup (void);
diff --git a/chromium/third_party/libxml/src/include/libxml/encoding.h b/chromium/third_party/libxml/src/include/libxml/encoding.h
index 77f137f440e..381e1886bf8 100644
--- a/chromium/third_party/libxml/src/include/libxml/encoding.h
+++ b/chromium/third_party/libxml/src/include/libxml/encoding.h
@@ -153,8 +153,10 @@ extern "C" {
/*
* Interfaces for encoding handlers.
*/
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlInitCharEncodingHandlers (void);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlCleanupCharEncodingHandlers (void);
XMLPUBFUN void XMLCALL
diff --git a/chromium/third_party/libxml/src/include/libxml/globals.h b/chromium/third_party/libxml/src/include/libxml/globals.h
index 5e41b7bb5f8..a9ec105b38a 100644
--- a/chromium/third_party/libxml/src/include/libxml/globals.h
+++ b/chromium/third_party/libxml/src/include/libxml/globals.h
@@ -24,7 +24,9 @@
extern "C" {
#endif
+XML_DEPRECATED
XMLPUBFUN void XMLCALL xmlInitGlobals(void);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
/**
@@ -67,7 +69,6 @@ XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc
* compatibility support.
*/
-#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
@@ -124,7 +125,7 @@ struct _xmlGlobalState
xmlSAXLocator xmlDefaultSAXLocator;
xmlSAXHandlerV1 xmlDefaultSAXHandler;
- xmlSAXHandlerV1 docbDefaultSAXHandler;
+ xmlSAXHandlerV1 docbDefaultSAXHandler; /* unused */
xmlSAXHandlerV1 htmlDefaultSAXHandler;
xmlFreeFunc xmlFree;
@@ -191,7 +192,6 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
xmlThrDefParserInputBufferCreateFilenameDefault(
xmlParserInputBufferCreateFilenameFunc func);
-/** DOC_DISABLE */
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
@@ -203,6 +203,8 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
+/** DOC_DISABLE */
+
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void);
#define xmlMalloc \
@@ -243,6 +245,7 @@ XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif
+/** DOC_ENABLE */
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
XMLPUBVAR xmlMallocFunc xmlMalloc;
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
@@ -251,22 +254,14 @@ XMLPUBVAR xmlFreeFunc xmlFree;
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif /* LIBXML_THREAD_ALLOC_ENABLED */
-#ifdef LIBXML_DOCB_ENABLED
-XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void);
-#ifdef LIBXML_THREAD_ENABLED
-#define docbDefaultSAXHandler \
-(*(__docbDefaultSAXHandler()))
-#else
-XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler;
-#endif
-#endif
-
#ifdef LIBXML_HTML_ENABLED
+XML_DEPRECATED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler()))
#else
+XML_DEPRECATED
XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif
#endif
@@ -286,46 +281,58 @@ XMLPUBVAR xmlError xmlLastError;
*/
+XML_DEPRECATED
XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
#ifdef LIBXML_THREAD_ENABLED
#define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility()))
#else
+XML_DEPRECATED
XMLPUBVAR int oldXMLWDcompatibility;
#endif
+XML_DEPRECATED
XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme()))
#else
+XML_DEPRECATED
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif
+XML_DEPRECATED
XMLPUBFUN xmlBufferAllocationScheme XMLCALL
xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
+XML_DEPRECATED
XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize()))
#else
+XML_DEPRECATED
XMLPUBVAR int xmlDefaultBufferSize;
#endif
+XML_DEPRECATED
XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
+XML_DEPRECATED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler()))
#else
+XML_DEPRECATED
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
#endif
+XML_DEPRECATED
XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator()))
#else
+XML_DEPRECATED
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
#endif
@@ -406,13 +413,16 @@ XMLPUBVAR int xmlKeepBlanksDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
+XML_DEPRECATED
XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue()))
#else
+XML_DEPRECATED
XMLPUBVAR int xmlLineNumbersDefaultValue;
#endif
+XML_DEPRECATED
XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
@@ -441,13 +451,16 @@ XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
XMLPUBVAR const char * xmlParserVersion;
#endif
+XML_DEPRECATED
XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue()))
#else
+XML_DEPRECATED
XMLPUBVAR int xmlPedanticParserDefaultValue;
#endif
+XML_DEPRECATED
XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
@@ -468,36 +481,44 @@ XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
+XML_DEPRECATED
XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlRegisterNodeDefaultValue \
(*(__xmlRegisterNodeDefaultValue()))
#else
+XML_DEPRECATED
XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
#endif
+XML_DEPRECATED
XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDeregisterNodeDefaultValue \
(*(__xmlDeregisterNodeDefaultValue()))
#else
+XML_DEPRECATED
XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
#endif
+XML_DEPRECATED
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \
__xmlParserInputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserInputBufferCreateFilenameValue \
(*(__xmlParserInputBufferCreateFilenameValue()))
#else
+XML_DEPRECATED
XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
#endif
+XML_DEPRECATED
XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlOutputBufferCreateFilenameValue \
(*(__xmlOutputBufferCreateFilenameValue()))
#else
+XML_DEPRECATED
XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
#endif
diff --git a/chromium/third_party/libxml/src/include/libxml/parser.h b/chromium/third_party/libxml/src/include/libxml/parser.h
index 5dad587a80e..04c53346474 100644
--- a/chromium/third_party/libxml/src/include/libxml/parser.h
+++ b/chromium/third_party/libxml/src/include/libxml/parser.h
@@ -10,8 +10,6 @@
#ifndef __XML_PARSER_H__
#define __XML_PARSER_H__
-#include <stdarg.h>
-
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/dict.h>
@@ -192,7 +190,7 @@ struct _xmlParserCtxt {
const xmlChar *version; /* the XML version string */
const xmlChar *encoding; /* the declared encoding, if any */
int standalone; /* standalone document */
- int html; /* an HTML(1)/Docbook(2) document
+ int html; /* an HTML(1) document
* 3 is HTML after <head>
* 10 is HTML after <body>
*/
@@ -863,11 +861,14 @@ XMLPUBFUN int XMLCALL
/*
* Recovery mode
*/
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverDoc (const xmlChar *cur);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverMemory (const char *buffer,
int size);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverFile (const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
@@ -880,47 +881,59 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
void *user_data,
const char *filename);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
void *user_data,
const char *buffer,
int size);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseDoc (xmlSAXHandlerPtr sax,
const xmlChar *cur,
int recovery);
+// TODO(https://github.com/google/maldoca/issues/87): Re-Deprecate this when
+// maldoca stops using xmlSAXParseMemory.
+//XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseMemory (xmlSAXHandlerPtr sax,
const char *buffer,
int size,
int recovery);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
const char *buffer,
int size,
int recovery,
void *data);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char *filename,
int recovery);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
const char *filename,
int recovery,
void *data);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char *filename);
+XML_DEPRECATED
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseEntity (const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
#ifdef LIBXML_VALID_ENABLED
+XML_DEPRECATED
XMLPUBFUN xmlDtdPtr XMLCALL
xmlSAXParseDTD (xmlSAXHandlerPtr sax,
const xmlChar *ExternalID,
@@ -957,6 +970,7 @@ XMLPUBFUN int XMLCALL
const xmlChar *string,
xmlNodePtr *lst,
int recover);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseExternalEntity (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
@@ -977,6 +991,9 @@ XMLPUBFUN int XMLCALL
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlNewParserCtxt (void);
+XMLPUBFUN xmlParserCtxtPtr XMLCALL
+ xmlNewSAXParserCtxt (const xmlSAXHandler *sax,
+ void *userData);
XMLPUBFUN int XMLCALL
xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
@@ -984,6 +1001,7 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
const xmlChar* buffer,
diff --git a/chromium/third_party/libxml/src/include/libxml/parserInternals.h b/chromium/third_party/libxml/src/include/libxml/parserInternals.h
index 9f3c76f21df..7cb0f517139 100644
--- a/chromium/third_party/libxml/src/include/libxml/parserInternals.h
+++ b/chromium/third_party/libxml/src/include/libxml/parserInternals.h
@@ -279,34 +279,6 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
/**
- * SKIP_EOL:
- * @p: and UTF8 string pointer
- *
- * Skips the end of line chars.
- */
-#define SKIP_EOL(p) \
- if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
- if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
-
-/**
- * MOVETO_ENDTAG:
- * @p: and UTF8 string pointer
- *
- * Skips to the next '>' char.
- */
-#define MOVETO_ENDTAG(p) \
- while ((*p) && (*(p) != '>')) (p)++
-
-/**
- * MOVETO_STARTTAG:
- * @p: and UTF8 string pointer
- *
- * Skips to the next '<' char.
- */
-#define MOVETO_STARTTAG(p) \
- while ((*p) && (*(p) != '<')) (p)++
-
-/**
* Global variables used for predefined strings.
*/
XMLPUBVAR const xmlChar xmlStringText[];
@@ -339,21 +311,12 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler);
-#ifdef IN_LIBXML
-/* internal error reporting */
-XMLPUBFUN void XMLCALL
- __xmlErrEncoding (xmlParserCtxtPtr ctxt,
- xmlParserErrors xmlerr,
- const char *msg,
- const xmlChar * str1,
- const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0);
-#endif
-
/**
* Input Streams.
*/
@@ -387,106 +350,148 @@ XMLPUBFUN xmlChar * XMLCALL
/**
* Generic production rules.
*/
+XML_DEPRECATED
XMLPUBFUN const xmlChar * XMLCALL
xmlParseName (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParseNmtoken (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParseEntityValue (xmlParserCtxtPtr ctxt,
xmlChar **orig);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParseAttValue (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseCharData (xmlParserCtxtPtr ctxt,
int cdata);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParseExternalID (xmlParserCtxtPtr ctxt,
xmlChar **publicID,
int strict);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseComment (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN const xmlChar * XMLCALL
xmlParsePITarget (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParsePI (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
xmlChar **value);
+XML_DEPRECATED
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseNotationType (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseAttributeType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementMixedContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
+XML_DEPRECATED
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementChildrenContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlElementContentPtr *result);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseElementDecl (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseCharRef (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlEntityPtr XMLCALL
xmlParseEntityRef (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseReference (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParsePEReference (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
+XML_DEPRECATED
XMLPUBFUN const xmlChar * XMLCALL
xmlParseAttribute (xmlParserCtxtPtr ctxt,
xmlChar **value);
+XML_DEPRECATED
XMLPUBFUN const xmlChar * XMLCALL
xmlParseStartTag (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseEndTag (xmlParserCtxtPtr ctxt);
#endif /* LIBXML_SAX1_ENABLED */
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseCDSect (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseContent (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseElement (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionNum (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
xmlParseEncName (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN const xmlChar * XMLCALL
xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlParseSDDecl (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseTextDecl (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlParseMisc (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
@@ -570,15 +575,6 @@ XMLPUBFUN int XMLCALL xmlCopyChar (int len,
XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
-#ifdef LIBXML_HTML_ENABLED
-/*
- * Actually comes from the HTML parser but launched from the init stuff.
- */
-XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
-XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
- const char *encoding);
-#endif
-
/*
* Specific function to keep track of entities references
* and used by the XSLT debugger.
@@ -639,15 +635,6 @@ XMLPUBFUN void XMLCALL
#endif /* LIBXML_LEGACY_ENABLED */
-#ifdef IN_LIBXML
-/*
- * internal only
- */
-XMLPUBFUN void XMLCALL
- xmlErrMemory (xmlParserCtxtPtr ctxt,
- const char *extra);
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/chromium/third_party/libxml/src/include/libxml/relaxng.h b/chromium/third_party/libxml/src/include/libxml/relaxng.h
index f269c9ec0db..6369785cef0 100644
--- a/chromium/third_party/libxml/src/include/libxml/relaxng.h
+++ b/chromium/third_party/libxml/src/include/libxml/relaxng.h
@@ -118,6 +118,7 @@ typedef enum {
XMLPUBFUN int XMLCALL
xmlRelaxNGInitTypes (void);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlRelaxNGCleanupTypes (void);
diff --git a/chromium/third_party/libxml/src/include/libxml/schematron.h b/chromium/third_party/libxml/src/include/libxml/schematron.h
index 364eaecde6b..c61e61b3cf5 100644
--- a/chromium/third_party/libxml/src/include/libxml/schematron.h
+++ b/chromium/third_party/libxml/src/include/libxml/schematron.h
@@ -1,5 +1,5 @@
/*
- * Summary: XML Schemastron implementation
+ * Summary: XML Schematron implementation
* Description: interface to the XML Schematron validity checking.
*
* Copy: See Copyright for the status of this software.
diff --git a/chromium/third_party/libxml/src/include/libxml/threads.h b/chromium/third_party/libxml/src/include/libxml/threads.h
index 9969ae7cfd0..5c9d0bd27b0 100644
--- a/chromium/third_party/libxml/src/include/libxml/threads.h
+++ b/chromium/third_party/libxml/src/include/libxml/threads.h
@@ -57,6 +57,7 @@ XMLPUBFUN void XMLCALL
/*
* Library wide APIs.
*/
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlInitThreads (void);
XMLPUBFUN void XMLCALL
@@ -67,19 +68,18 @@ XMLPUBFUN int XMLCALL
xmlGetThreadId (void);
XMLPUBFUN int XMLCALL
xmlIsMainThread (void);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlCleanupThreads(void);
XMLPUBFUN xmlGlobalStatePtr XMLCALL
xmlGetGlobalState(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)
+#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
+ !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
int XMLCALL
xmlDllMain(void *hinstDLL, unsigned long fdwReason,
void *lpvReserved);
#endif
-#endif
#ifdef __cplusplus
}
diff --git a/chromium/third_party/libxml/src/include/libxml/tree.h b/chromium/third_party/libxml/src/include/libxml/tree.h
index 9823654ac8f..4147522cdba 100644
--- a/chromium/third_party/libxml/src/include/libxml/tree.h
+++ b/chromium/third_party/libxml/src/include/libxml/tree.h
@@ -177,11 +177,13 @@ typedef enum {
XML_NAMESPACE_DECL= 18,
XML_XINCLUDE_START= 19,
XML_XINCLUDE_END= 20
-#ifdef LIBXML_DOCB_ENABLED
- ,XML_DOCB_DOCUMENT_NODE= 21
-#endif
+ /* XML_DOCB_DOCUMENT_NODE= 21 */ /* removed */
} xmlElementType;
+/** DOC_DISABLE */
+/* For backward compatibility */
+#define XML_DOCB_DOCUMENT_NODE 21
+/** DOC_ENABLE */
/**
* xmlNotation:
@@ -659,7 +661,7 @@ struct _xmlDOMWrapCtxt {
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || \
defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \
defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \
- defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
+ defined(LIBXML_LEGACY_ENABLED)
XMLPUBFUN int XMLCALL
xmlValidateNCName (const xmlChar *value,
int space);
diff --git a/chromium/third_party/libxml/src/include/libxml/valid.h b/chromium/third_party/libxml/src/include/libxml/valid.h
index 3eaf84adcb4..78771d449ac 100644
--- a/chromium/third_party/libxml/src/include/libxml/valid.h
+++ b/chromium/third_party/libxml/src/include/libxml/valid.h
@@ -58,21 +58,6 @@ typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
-#ifdef IN_LIBXML
-/**
- * XML_VCTXT_DTD_VALIDATED:
- *
- * Set after xmlValidateDtdFinal was called.
- */
-#define XML_VCTXT_DTD_VALIDATED (1u << 0)
-/**
- * XML_VCTXT_USE_PCTXT:
- *
- * Set if the validation context is part of a parser context.
- */
-#define XML_VCTXT_USE_PCTXT (1u << 1)
-#endif
-
/*
* xmlValidCtxt:
* An xmlValidCtxt is used for error reporting when validating.
diff --git a/chromium/third_party/libxml/src/include/libxml/xmlautomata.h b/chromium/third_party/libxml/src/include/libxml/xmlautomata.h
index bf1b131c653..c0ef44f1e6f 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlautomata.h
+++ b/chromium/third_party/libxml/src/include/libxml/xmlautomata.h
@@ -11,11 +11,11 @@
#define __XML_AUTOMATA_H__
#include <libxml/xmlversion.h>
-#include <libxml/tree.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef LIBXML_AUTOMATA_ENABLED
-#include <libxml/xmlregexp.h>
+
+#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
@@ -131,7 +131,7 @@ XMLPUBFUN int XMLCALL
int min,
int max);
-XMLPUBFUN xmlRegexpPtr XMLCALL
+XMLPUBFUN struct _xmlRegexp * XMLCALL
xmlAutomataCompile (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
xmlAutomataIsDeterminist (xmlAutomataPtr am);
diff --git a/chromium/third_party/libxml/src/include/libxml/xmlerror.h b/chromium/third_party/libxml/src/include/libxml/xmlerror.h
index 7b68e4010be..f8ca8ab86b9 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlerror.h
+++ b/chromium/third_party/libxml/src/include/libxml/xmlerror.h
@@ -260,6 +260,7 @@ typedef enum {
XML_DTD_DUP_TOKEN, /* 541 */
XML_HTML_STRUCURE_ERROR = 800,
XML_HTML_UNKNOWN_TAG, /* 801 */
+ XML_HTML_INCORRECTLY_OPENED_COMMENT, /* 802 */
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
XML_RNGP_ATTR_CONFLICT, /* 1001 */
XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */
@@ -863,6 +864,7 @@ typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr erro
XMLPUBFUN void XMLCALL
xmlSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);
@@ -911,35 +913,6 @@ XMLPUBFUN int XMLCALL
xmlCopyError (xmlErrorPtr from,
xmlErrorPtr to);
-#ifdef IN_LIBXML
-/*
- * Internal callback reporting routine
- */
-XMLPUBFUN void XMLCALL
- __xmlRaiseError (xmlStructuredErrorFunc schannel,
- xmlGenericErrorFunc channel,
- void *data,
- void *ctx,
- void *node,
- int domain,
- int code,
- xmlErrorLevel level,
- const char *file,
- int line,
- const char *str1,
- const char *str2,
- const char *str3,
- int int1,
- int col,
- const char *msg,
- ...) LIBXML_ATTR_FORMAT(16,17);
-XMLPUBFUN void XMLCALL
- __xmlSimpleError (int domain,
- int code,
- xmlNodePtr node,
- const char *msg,
- const char *extra) LIBXML_ATTR_FORMAT(4,0);
-#endif
#ifdef __cplusplus
}
#endif
diff --git a/chromium/third_party/libxml/src/include/libxml/xmlexports.h b/chromium/third_party/libxml/src/include/libxml/xmlexports.h
index aceede5ec05..e48a08b74ae 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlexports.h
+++ b/chromium/third_party/libxml/src/include/libxml/xmlexports.h
@@ -67,10 +67,12 @@
*/
#define XMLPUBVAR XMLPUBLIC extern
+/** DOC_DISABLE */
/* Compatibility */
#if !defined(LIBXML_DLL_IMPORT)
#define LIBXML_DLL_IMPORT XMLPUBVAR
#endif
+/** DOC_ENABLE */
#endif /* __XML_EXPORTS_H__ */
diff --git a/chromium/third_party/libxml/src/include/libxml/xmlmemory.h b/chromium/third_party/libxml/src/include/libxml/xmlmemory.h
index 17e375a3c9a..ae2a4275a3b 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlmemory.h
+++ b/chromium/third_party/libxml/src/include/libxml/xmlmemory.h
@@ -126,12 +126,14 @@ XMLPUBFUN int XMLCALL
/*
* Initialization of the memory layer.
*/
+XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlInitMemory (void);
/*
* Cleanup of the memory layer.
*/
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlCleanupMemory (void);
/*
diff --git a/chromium/third_party/libxml/src/include/libxml/xmlschemastypes.h b/chromium/third_party/libxml/src/include/libxml/xmlschemastypes.h
index 35d48d414be..5d588f92ea3 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlschemastypes.h
+++ b/chromium/third_party/libxml/src/include/libxml/xmlschemastypes.h
@@ -32,6 +32,7 @@ typedef enum {
XMLPUBFUN void XMLCALL
xmlSchemaInitTypes (void);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlSchemaCleanupTypes (void);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
diff --git a/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in b/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in
index b1d2a208c9d..e83fb787265 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in
+++ b/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in
@@ -230,15 +230,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
- * LIBXML_DOCB_ENABLED:
- *
- * Whether the SGML Docbook support is configured in
- */
-#if @WITH_DOCB@
-#define LIBXML_DOCB_ENABLED
-#endif
-
-/**
* LIBXML_XPATH_ENABLED:
*
* Whether XPath is configured in
@@ -257,6 +248,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_XPTR_LOCS_ENABLED:
+ *
+ * Whether support for XPointer locations is configured in
+ */
+#if @WITH_XPTR_LOCS@
+#define LIBXML_XPTR_LOCS_ENABLED
+#endif
+
+/**
* LIBXML_XINCLUDE_ENABLED:
*
* Whether XInclude is configured in
@@ -313,9 +313,9 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
/**
* LIBXML_DEBUG_RUNTIME:
*
- * Whether the runtime debugging is configured in
+ * Removed
*/
-#if @WITH_RUN_DEBUG@
+#if 0
#define LIBXML_DEBUG_RUNTIME
#endif
@@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
-
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
+/** DOC_DISABLE */
#ifndef ATTRIBUTE_UNUSED
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
@@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
-/**
- * LIBXML_ATTR_ALLOC_SIZE:
- *
- * Macro used to indicate to GCC this is an allocator function
- */
-
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
@@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
-/**
- * LIBXML_ATTR_FORMAT:
- *
- * Macro used to indicate to GCC the parameter are printf like
- */
-
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
@@ -465,6 +448,19 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
+#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#define XML_IGNORE_FPTR_CAST_WARNINGS \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
+ _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
+#define XML_POP_WARNINGS \
+ _Pragma("GCC diagnostic pop")
+#else
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+#define XML_POP_WARNINGS
+#endif
+
+/** DOC_ENABLE */
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
@@ -493,6 +489,18 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#ifndef XML_DEPRECATED
#define XML_DEPRECATED
#endif
+/**
+ * LIBXML_IGNORE_FPTR_CAST_WARNINGS:
+ *
+ * Macro used to ignore pointer cast warnings that can't be worked around.
+ */
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+/**
+ * LIBXML_POP_WARNINGS:
+ *
+ * Macro used to restore warnings state.
+ */
+#define XML_POP_WARNINGS
#endif /* __GNUC__ */
#ifdef __cplusplus
diff --git a/chromium/third_party/libxml/src/include/libxml/xpath.h b/chromium/third_party/libxml/src/include/libxml/xpath.h
index 539593fa506..bfbc5d6d995 100644
--- a/chromium/third_party/libxml/src/include/libxml/xpath.h
+++ b/chromium/third_party/libxml/src/include/libxml/xpath.h
@@ -104,13 +104,23 @@ typedef enum {
XPATH_BOOLEAN = 2,
XPATH_NUMBER = 3,
XPATH_STRING = 4,
+#ifdef LIBXML_XPTR_LOCS_ENABLED
XPATH_POINT = 5,
XPATH_RANGE = 6,
XPATH_LOCATIONSET = 7,
+#endif
XPATH_USERS = 8,
XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
} xmlXPathObjectType;
+#ifndef LIBXML_XPTR_LOCS_ENABLED
+/** DOC_DISABLE */
+#define XPATH_POINT 5
+#define XPATH_RANGE 6
+#define XPATH_LOCATIONSET 7
+/** DOC_ENABLE */
+#endif
+
typedef struct _xmlXPathObject xmlXPathObject;
typedef xmlXPathObject *xmlXPathObjectPtr;
struct _xmlXPathObject {
@@ -549,6 +559,7 @@ XMLPUBFUN void XMLCALL
xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
#endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlXPathInit (void);
XMLPUBFUN int XMLCALL
diff --git a/chromium/third_party/libxml/src/include/libxml/xpointer.h b/chromium/third_party/libxml/src/include/libxml/xpointer.h
index b99112b87a1..ca7bdbe085f 100644
--- a/chromium/third_party/libxml/src/include/libxml/xpointer.h
+++ b/chromium/third_party/libxml/src/include/libxml/xpointer.h
@@ -28,6 +28,7 @@
extern "C" {
#endif
+#ifdef LIBXML_XPTR_LOCS_ENABLED
/*
* A Location Set
*/
@@ -43,51 +44,68 @@ struct _xmlLocationSet {
* Handling of location sets.
*/
+XML_DEPRECATED
XMLPUBFUN xmlLocationSetPtr XMLCALL
xmlXPtrLocationSetCreate (xmlXPathObjectPtr val);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
+XML_DEPRECATED
XMLPUBFUN xmlLocationSetPtr XMLCALL
xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRange (xmlNodePtr start,
int startindex,
xmlNodePtr end,
int endindex);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
xmlXPathObjectPtr end);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodePoint (xmlNodePtr start,
xmlXPathObjectPtr end);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
xmlNodePtr end);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodes (xmlNodePtr start,
xmlNodePtr end);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewLocationSetNodes (xmlNodePtr start,
xmlNodePtr end);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodeObject (xmlNodePtr start,
xmlXPathObjectPtr end);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewCollapsedRange (xmlNodePtr start);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
+XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
int val);
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
/*
* Functions.
@@ -99,13 +117,18 @@ XMLPUBFUN xmlXPathContextPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrEval (const xmlChar *str,
xmlXPathContextPtr ctx);
+#ifdef LIBXML_XPTR_LOCS_ENABLED
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
int nargs);
+XML_DEPRECATED
XMLPUBFUN xmlNodePtr XMLCALL
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
+XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
#ifdef __cplusplus
}
#endif
diff --git a/chromium/third_party/libxml/src/include/private/Makefile.am b/chromium/third_party/libxml/src/include/private/Makefile.am
new file mode 100644
index 00000000000..a1686980387
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/Makefile.am
@@ -0,0 +1,15 @@
+EXTRA_DIST = \
+ buf.h \
+ dict.h \
+ enc.h \
+ entities.h \
+ error.h \
+ html.h \
+ io.h \
+ parser.h \
+ regexp.h \
+ save.h \
+ string.h \
+ threads.h \
+ tree.h \
+ xzlib.h
diff --git a/chromium/third_party/libxml/src/include/private/Makefile.in b/chromium/third_party/libxml/src/include/private/Makefile.in
new file mode 100644
index 00000000000..2c41f374264
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/Makefile.in
@@ -0,0 +1,541 @@
+# Makefile.in generated by automake 1.16.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2021 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = include/private
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_try_compile2.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_THREAD_LIBS = @BASE_THREAD_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CSCOPE = @CSCOPE@
+CTAGS = @CTAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ETAGS = @ETAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILECMD = @FILECMD@
+GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_DEFS = @ICU_DEFS@
+ICU_LIBS = @ICU_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBM = @LIBM@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@
+LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@
+LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@
+LIBXML_VERSION = @LIBXML_VERSION@
+LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@
+LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
+LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LZMA_CFLAGS = @LZMA_CFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MODULE_EXTENSION = @MODULE_EXTENSION@
+MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PYTHON = @PYTHON@
+PYTHON_CFLAGS = @PYTHON_CFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
+PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RDL_CFLAGS = @RDL_CFLAGS@
+RDL_LIBS = @RDL_LIBS@
+RELDATE = @RELDATE@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TAR = @TAR@
+THREAD_CFLAGS = @THREAD_CFLAGS@
+THREAD_LIBS = @THREAD_LIBS@
+VERSION = @VERSION@
+VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@
+WGET = @WGET@
+WITH_C14N = @WITH_C14N@
+WITH_CATALOG = @WITH_CATALOG@
+WITH_DEBUG = @WITH_DEBUG@
+WITH_FTP = @WITH_FTP@
+WITH_HTML = @WITH_HTML@
+WITH_HTTP = @WITH_HTTP@
+WITH_ICONV = @WITH_ICONV@
+WITH_ICU = @WITH_ICU@
+WITH_ISO8859X = @WITH_ISO8859X@
+WITH_LEGACY = @WITH_LEGACY@
+WITH_LZMA = @WITH_LZMA@
+WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
+WITH_MODULES = @WITH_MODULES@
+WITH_OUTPUT = @WITH_OUTPUT@
+WITH_PATTERN = @WITH_PATTERN@
+WITH_PUSH = @WITH_PUSH@
+WITH_READER = @WITH_READER@
+WITH_REGEXPS = @WITH_REGEXPS@
+WITH_SAX1 = @WITH_SAX1@
+WITH_SCHEMAS = @WITH_SCHEMAS@
+WITH_SCHEMATRON = @WITH_SCHEMATRON@
+WITH_THREADS = @WITH_THREADS@
+WITH_THREAD_ALLOC = @WITH_THREAD_ALLOC@
+WITH_TREE = @WITH_TREE@
+WITH_TRIO = @WITH_TRIO@
+WITH_VALID = @WITH_VALID@
+WITH_WRITER = @WITH_WRITER@
+WITH_XINCLUDE = @WITH_XINCLUDE@
+WITH_XPATH = @WITH_XPATH@
+WITH_XPTR = @WITH_XPTR@
+WITH_XPTR_LOCS = @WITH_XPTR_LOCS@
+WITH_ZLIB = @WITH_ZLIB@
+XML_CFLAGS = @XML_CFLAGS@
+XML_INCLUDEDIR = @XML_INCLUDEDIR@
+XML_LIBDIR = @XML_LIBDIR@
+XML_LIBS = @XML_LIBS@
+XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@
+XML_PRIVATE_CFLAGS = @XML_PRIVATE_CFLAGS@
+XML_PRIVATE_LIBS = @XML_PRIVATE_LIBS@
+XSLTPROC = @XSLTPROC@
+Z_CFLAGS = @Z_CFLAGS@
+Z_LIBS = @Z_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = \
+ buf.h \
+ dict.h \
+ enc.h \
+ entities.h \
+ error.h \
+ html.h \
+ io.h \
+ parser.h \
+ regexp.h \
+ save.h \
+ string.h \
+ threads.h \
+ tree.h \
+ xzlib.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/private/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign include/private/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ cscopelist-am ctags-am distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/chromium/third_party/libxml/src/include/private/buf.h b/chromium/third_party/libxml/src/include/private/buf.h
new file mode 100644
index 00000000000..12f725de09b
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/buf.h
@@ -0,0 +1,48 @@
+#ifndef XML_BUF_H_PRIVATE__
+#define XML_BUF_H_PRIVATE__
+
+#include <libxml/tree.h>
+
+xmlBufPtr xmlBufCreate(void);
+xmlBufPtr xmlBufCreateSize(size_t size);
+xmlBufPtr xmlBufCreateStatic(void *mem, size_t size);
+
+int xmlBufSetAllocationScheme(xmlBufPtr buf,
+ xmlBufferAllocationScheme scheme);
+int xmlBufGetAllocationScheme(xmlBufPtr buf);
+
+void xmlBufFree(xmlBufPtr buf);
+void xmlBufEmpty(xmlBufPtr buf);
+
+/* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
+int xmlBufGrow(xmlBufPtr buf, int len);
+int xmlBufResize(xmlBufPtr buf, size_t len);
+
+int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
+int xmlBufCat(xmlBufPtr buf, const xmlChar *str);
+int xmlBufCCat(xmlBufPtr buf, const char *str);
+int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
+
+size_t xmlBufAvail(const xmlBufPtr buf);
+size_t xmlBufLength(const xmlBufPtr buf);
+/* size_t xmlBufUse(const xmlBufPtr buf); */
+int xmlBufIsEmpty(const xmlBufPtr buf);
+int xmlBufAddLen(xmlBufPtr buf, size_t len);
+
+/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
+/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
+
+xmlChar * xmlBufDetach(xmlBufPtr buf);
+
+size_t xmlBufDump(FILE *file, xmlBufPtr buf);
+
+xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer);
+xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf);
+int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
+
+int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
+size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
+int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
+ size_t base, size_t cur);
+
+#endif /* XML_BUF_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/dict.h b/chromium/third_party/libxml/src/include/private/dict.h
new file mode 100644
index 00000000000..02b18f92f21
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/dict.h
@@ -0,0 +1,7 @@
+#ifndef XML_DICT_H_PRIVATE__
+#define XML_DICT_H_PRIVATE__
+
+int __xmlInitializeDict(void);
+int __xmlRandom(void);
+
+#endif /* XML_DICT_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/enc.h b/chromium/third_party/libxml/src/include/private/enc.h
new file mode 100644
index 00000000000..4fd32342817
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/enc.h
@@ -0,0 +1,11 @@
+#ifndef XML_ENC_H_PRIVATE__
+#define XML_ENC_H_PRIVATE__
+
+#include <libxml/encoding.h>
+#include <libxml/tree.h>
+
+int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len);
+int xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
+int xmlCharEncOutput(xmlOutputBufferPtr output, int init);
+
+#endif /* XML_ENC_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/entities.h b/chromium/third_party/libxml/src/include/private/entities.h
new file mode 100644
index 00000000000..9be17bb31f4
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/entities.h
@@ -0,0 +1,9 @@
+#ifndef XML_ENTITIES_H_PRIVATE__
+#define XML_ENTITIES_H_PRIVATE__
+
+#include <libxml/tree.h>
+#include <libxml/xmlstring.h>
+
+xmlChar *xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input);
+
+#endif /* XML_ENTITIES_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/error.h b/chromium/third_party/libxml/src/include/private/error.h
new file mode 100644
index 00000000000..c76e0733227
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/error.h
@@ -0,0 +1,21 @@
+#ifndef XML_ERROR_H_PRIVATE__
+#define XML_ERROR_H_PRIVATE__
+
+#include <libxml/xmlerror.h>
+#include <libxml/xmlversion.h>
+
+void
+__xmlRaiseError(xmlStructuredErrorFunc schannel,
+ xmlGenericErrorFunc channel, void *data, void *ctx,
+ void *nod, int domain, int code, xmlErrorLevel level,
+ const char *file, int line, const char *str1,
+ const char *str2, const char *str3, int int1, int col,
+ const char *msg, ...) LIBXML_ATTR_FORMAT(16,17);
+void
+__xmlSimpleError(int domain, int code, xmlNodePtr node,
+ const char *msg, const char *extra) LIBXML_ATTR_FORMAT(4,0);
+void
+xmlGenericErrorDefaultFunc(void *ctx, const char *msg,
+ ...) LIBXML_ATTR_FORMAT(2,3);
+
+#endif /* XML_ERROR_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/html.h b/chromium/third_party/libxml/src/include/private/html.h
new file mode 100644
index 00000000000..8f77d33871c
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/html.h
@@ -0,0 +1,13 @@
+#ifndef XML_HTML_H_PRIVATE__
+#define XML_HTML_H_PRIVATE__
+
+#include <libxml/xmlversion.h>
+
+#ifdef LIBXML_HTML_ENABLED
+
+void __htmlParseContent(void *ctx);
+
+#endif /* LIBXML_HTML_ENABLED */
+
+#endif /* XML_HTML_H_PRIVATE__ */
+
diff --git a/chromium/third_party/libxml/src/include/private/io.h b/chromium/third_party/libxml/src/include/private/io.h
new file mode 100644
index 00000000000..d0994dbd2e1
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/io.h
@@ -0,0 +1,18 @@
+#ifndef XML_IO_H_PRIVATE__
+#define XML_IO_H_PRIVATE__
+
+#include <libxml/encoding.h>
+#include <libxml/tree.h>
+#include <libxml/xmlversion.h>
+
+void __xmlIOErr(int domain, int code, const char *extra);
+void __xmlLoaderErr(void *ctx, const char *msg,
+ const char *filename) LIBXML_ATTR_FORMAT(2,0);
+int xmlInputReadCallbackNop(void *context, char *buffer, int len);
+
+#ifdef LIBXML_OUTPUT_ENABLED
+xmlOutputBufferPtr
+xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
+#endif
+
+#endif /* XML_IO_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/parser.h b/chromium/third_party/libxml/src/include/private/parser.h
new file mode 100644
index 00000000000..1bf9ee35fe1
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/parser.h
@@ -0,0 +1,25 @@
+#ifndef XML_PARSER_H_PRIVATE__
+#define XML_PARSER_H_PRIVATE__
+
+#include <libxml/parser.h>
+#include <libxml/xmlversion.h>
+
+/**
+ * XML_VCTXT_DTD_VALIDATED:
+ *
+ * Set after xmlValidateDtdFinal was called.
+ */
+#define XML_VCTXT_DTD_VALIDATED (1u << 0)
+/**
+ * XML_VCTXT_USE_PCTXT:
+ *
+ * Set if the validation context is part of a parser context.
+ */
+#define XML_VCTXT_USE_PCTXT (1u << 1)
+
+void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
+void __xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr,
+ const char *msg, const xmlChar *str1,
+ const xmlChar *str2) LIBXML_ATTR_FORMAT(3,0);
+
+#endif /* XML_PARSER_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/regexp.h b/chromium/third_party/libxml/src/include/private/regexp.h
new file mode 100644
index 00000000000..3ffb378afbc
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/regexp.h
@@ -0,0 +1,8 @@
+#ifndef XML_REGEXP_H_PRIVATE__
+#define XML_REGEXP_H_PRIVATE__
+
+#include <libxml/xmlautomata.h>
+
+void xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
+
+#endif /* XML_REGEXP_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/save.h b/chromium/third_party/libxml/src/include/private/save.h
new file mode 100644
index 00000000000..ec970851f75
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/save.h
@@ -0,0 +1,16 @@
+#ifndef XML_SAVE_H_PRIVATE__
+#define XML_SAVE_H_PRIVATE__
+
+#include <libxml/tree.h>
+#include <libxml/xmlversion.h>
+
+#ifdef LIBXML_OUTPUT_ENABLED
+
+void xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
+ xmlAttrPtr attr, const xmlChar * string);
+void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
+
+#endif /* LIBXML_OUTPUT_ENABLED */
+
+#endif /* XML_SAVE_H_PRIVATE__ */
+
diff --git a/chromium/third_party/libxml/src/include/private/string.h b/chromium/third_party/libxml/src/include/private/string.h
new file mode 100644
index 00000000000..0c4bf5413cc
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/string.h
@@ -0,0 +1,8 @@
+#ifndef XML_STRING_H_PRIVATE__
+#define XML_STRING_H_PRIVATE__
+
+#include <libxml/xmlstring.h>
+
+xmlChar *xmlEscapeFormatString(xmlChar **msg);
+
+#endif /* XML_STRING_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/threads.h b/chromium/third_party/libxml/src/include/private/threads.h
new file mode 100644
index 00000000000..c054a6fb956
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/threads.h
@@ -0,0 +1,8 @@
+#ifndef XML_THREADS_H_PRIVATE__
+#define XML_THREADS_H_PRIVATE__
+
+void __xmlGlobalInitMutexLock(void);
+void __xmlGlobalInitMutexUnlock(void);
+void __xmlGlobalInitMutexDestroy(void);
+
+#endif /* XML_THREADS_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/tree.h b/chromium/third_party/libxml/src/include/private/tree.h
new file mode 100644
index 00000000000..8b7f65d4b79
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/tree.h
@@ -0,0 +1,11 @@
+#ifndef XML_TREE_H_PRIVATE__
+#define XML_TREE_H_PRIVATE__
+
+/*
+ * Internal variable indicating if a callback has been registered for
+ * node creation/destruction. It avoids spending a lot of time in locking
+ * function while checking if the callback exists.
+ */
+extern int __xmlRegisterCallbacks;
+
+#endif /* XML_TREE_H_PRIVATE__ */
diff --git a/chromium/third_party/libxml/src/include/private/xzlib.h b/chromium/third_party/libxml/src/include/private/xzlib.h
new file mode 100644
index 00000000000..001854e5ce7
--- /dev/null
+++ b/chromium/third_party/libxml/src/include/private/xzlib.h
@@ -0,0 +1,27 @@
+/**
+ * xzlib.h: header for the front end for the transparent support of lzma
+ * compression at the I/O layer
+ *
+ * See Copyright for the status of this software.
+ *
+ * Anders F Bjorklund <afb@users.sourceforge.net>
+ */
+
+#ifndef LIBXML2_XZLIB_H
+#define LIBXML2_XZLIB_H
+
+#include <libxml/xmlversion.h>
+
+#ifdef LIBXML_LZMA_ENABLED
+
+typedef void *xzFile; /* opaque lzma file descriptor */
+
+xzFile __libxml2_xzopen(const char *path, const char *mode);
+xzFile __libxml2_xzdopen(int fd, const char *mode);
+int __libxml2_xzread(xzFile file, void *buf, unsigned len);
+int __libxml2_xzclose(xzFile file);
+int __libxml2_xzcompressed(xzFile f);
+
+#endif /* LIBXML_LZMA_ENABLED */
+
+#endif /* LIBXML2_XZLIB_H */
diff --git a/chromium/third_party/libxml/src/include/win32config.h b/chromium/third_party/libxml/src/include/win32config.h
index d804404a46c..2b113237058 100644
--- a/chromium/third_party/libxml/src/include/win32config.h
+++ b/chromium/third_party/libxml/src/include/win32config.h
@@ -1,110 +1,21 @@
#ifndef __LIBXML_WIN32_CONFIG__
#define __LIBXML_WIN32_CONFIG__
-#define SEND_ARG2_CAST
-#define GETHOSTBYNAME_ARG_CAST
-
#define HAVE_SYS_STAT_H
#define HAVE_STAT
#define HAVE_FCNTL_H
-#include <io.h>
-#include <direct.h>
-
-#include <libxml/xmlversion.h>
-
-#ifndef ICONV_CONST
-#define ICONV_CONST const
-#endif
-/*
- * Windows platforms may define except
- */
-#undef except
-
-#define HAVE_ISINF
-#define HAVE_ISNAN
-#include <math.h>
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-/* MS C-runtime has functions which can be used in order to determine if
- a given floating-point variable contains NaN, (+-)INF. These are
- preferred, because floating-point technology is considered proprietary
- by MS and we can assume that their functions know more about their
- oddities than we do. */
-#include <float.h>
-/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
- function. */
-#ifndef isinf
-#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
- : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
-#endif
-/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
-#ifndef isnan
-#define isnan(d) (_isnan(d))
-#endif
-#else /* _MSC_VER */
-#ifndef isinf
-static int isinf (double d) {
- int expon = 0;
- double val = frexp (d, &expon);
- if (expon == 1025) {
- if (val == 0.5) {
- return 1;
- } else if (val == -0.5) {
- return -1;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
-}
+#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
+#define HAVE_STDINT_H
#endif
-#ifndef isnan
-static int isnan (double d) {
- int expon = 0;
- double val = frexp (d, &expon);
- if (expon == 1025) {
- if (val == 0.5) {
- return 0;
- } else if (val == -0.5) {
- return 0;
- } else {
- return 1;
- }
- } else {
- return 0;
- }
-}
-#endif
-#endif /* _MSC_VER */
#if defined(_MSC_VER)
-#define mkdir(p,m) _mkdir(p)
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if _MSC_VER < 1500
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
#endif
-#elif defined(__MINGW32__)
-#define mkdir(p,m) _mkdir(p)
-#endif
-
-/* Threading API to use should be specified here for compatibility reasons.
- This is however best specified on the compiler's command-line. */
-#if defined(LIBXML_THREAD_ENABLED)
-#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE)
-#define HAVE_WIN32_THREADS
-#endif
-#endif
-
-/* Some third-party libraries far from our control assume the following
- is defined, which it is not if we don't include windows.h. */
-#if !defined(FALSE)
-#define FALSE 0
-#endif
-#if !defined(TRUE)
-#define TRUE (!(FALSE))
#endif
#endif /* __LIBXML_WIN32_CONFIG__ */
diff --git a/chromium/third_party/libxml/src/include/wsockcompat.h b/chromium/third_party/libxml/src/include/wsockcompat.h
index 85b9e7d5689..141de0c6405 100644
--- a/chromium/third_party/libxml/src/include/wsockcompat.h
+++ b/chromium/third_party/libxml/src/include/wsockcompat.h
@@ -25,11 +25,14 @@
/* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
#if defined(GetAddrInfo)
#include <wspiapi.h>
-#define HAVE_GETADDRINFO
+#ifndef SUPPORT_IP6
+ #define SUPPORT_IP6
+#endif
#endif
-#undef XML_SOCKLEN_T
+#ifndef XML_SOCKLEN_T
#define XML_SOCKLEN_T int
+#endif
#ifndef ECONNRESET
#define ECONNRESET WSAECONNRESET
diff --git a/chromium/third_party/libxml/src/libxml-2.0-uninstalled.pc.in b/chromium/third_party/libxml/src/libxml-2.0-uninstalled.pc.in
index 60b886b304a..0c3186f7b8d 100644
--- a/chromium/third_party/libxml/src/libxml-2.0-uninstalled.pc.in
+++ b/chromium/third_party/libxml/src/libxml-2.0-uninstalled.pc.in
@@ -2,11 +2,12 @@ prefix=
exec_prefix=
libdir=${pcfiledir}
includedir=${pcfiledir}/include
-
+modules=@WITH_MODULES@
Name: libXML
Version: @VERSION@
Description: libXML library version2.
Requires:
-Libs: -L${libdir} -lxml2 @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
-Cflags: -I${includedir} @XML_INCLUDEDIR@ @XML_CFLAGS@
+Libs: -L${libdir} @XML_LIBS@
+Libs.private: @XML_PRIVATE_LIBS@ @LIBS@
+Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@
diff --git a/chromium/third_party/libxml/src/libxml-2.0.pc.in b/chromium/third_party/libxml/src/libxml-2.0.pc.in
index 2653a7c5685..88e3963b0eb 100644
--- a/chromium/third_party/libxml/src/libxml-2.0.pc.in
+++ b/chromium/third_party/libxml/src/libxml-2.0.pc.in
@@ -8,6 +8,6 @@ Name: libXML
Version: @VERSION@
Description: libXML library version2.
Requires:
-Libs: -L${libdir} -lxml2
-Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @LZMA_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
+Libs: -L${libdir} @XML_LIBS@
+Libs.private: @XML_PRIVATE_LIBS@ @LIBS@
Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@
diff --git a/chromium/third_party/libxml/src/libxml.h b/chromium/third_party/libxml/src/libxml.h
index 1330552b821..59294473c58 100644
--- a/chromium/third_party/libxml/src/libxml.h
+++ b/chromium/third_party/libxml/src/libxml.h
@@ -9,8 +9,10 @@
#ifndef __XML_LIBXML_H__
#define __XML_LIBXML_H__
-#include <libxml/xmlstring.h>
-
+/*
+ * These macros must be defined before including system headers.
+ * Do not add any #include directives above this block.
+ */
#ifndef NO_LARGEFILE_SOURCE
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
@@ -28,6 +30,10 @@
#include "config.h"
#include <libxml/xmlversion.h>
+#ifndef SYSCONFDIR
+ #define SYSCONFDIR "/etc"
+#endif
+
#if defined(__Lynx__)
#include <stdio.h> /* pull definition of size_t */
#include <varargs.h>
@@ -49,60 +55,12 @@ int vfprintf(FILE *, const char *, va_list);
#endif
#if defined(__clang__) || \
- (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406))
-#define XML_IGNORE_PEDANTIC_WARNINGS \
- _Pragma("GCC diagnostic push") \
- _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
-#define XML_POP_WARNINGS \
- _Pragma("GCC diagnostic pop")
-#else
-#define XML_IGNORE_PEDANTIC_WARNINGS
-#define XML_POP_WARNINGS
-#endif
-
-#if defined(__clang__) || \
(defined(__GNUC__) && (__GNUC__ >= 8))
#define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
#else
#define ATTRIBUTE_NO_SANITIZE(arg)
#endif
-/*
- * Internal variable indicating if a callback has been registered for
- * node creation/destruction. It avoids spending a lot of time in locking
- * function while checking if the callback exists.
- */
-extern int __xmlRegisterCallbacks;
-/*
- * internal error reporting routines, shared but not part of the API.
- */
-void __xmlIOErr(int domain, int code, const char *extra);
-void __xmlLoaderErr(void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2,0);
-#ifdef LIBXML_HTML_ENABLED
-/*
- * internal function of HTML parser needed for xmlParseInNodeContext
- * but not part of the API
- */
-void __htmlParseContent(void *ctx);
-#endif
-
-/*
- * internal global initialization critical section routines.
- */
-void __xmlGlobalInitMutexLock(void);
-void __xmlGlobalInitMutexUnlock(void);
-void __xmlGlobalInitMutexDestroy(void);
-
-int __xmlInitializeDict(void);
-
-/*
- * internal thread safe random function
- */
-int __xmlRandom(void);
-
-XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg);
-int xmlInputReadCallbackNop(void *context, char *buffer, int len);
-
#if !defined(PIC) && !defined(NOLIBTOOL) && !defined(LIBXML_STATIC)
# define LIBXML_STATIC
#endif
diff --git a/chromium/third_party/libxml/src/libxml.spec.in b/chromium/third_party/libxml/src/libxml.spec.in
index 73c6fd9e5a1..45083de79a1 100644
--- a/chromium/third_party/libxml/src/libxml.spec.in
+++ b/chromium/third_party/libxml/src/libxml.spec.in
@@ -99,7 +99,7 @@ at parse time or later once the document has been modified.
mkdir py3doc
cp doc/*.py py3doc
-sed -i 's|#!/usr/bin/python |#!%{__python3} |' py3doc/*.py
+sed -i 's|#!/usr/bin/env python|#!/usr/bin/env %{__python3}|' py3doc/*.py
%build
%configure
@@ -144,7 +144,6 @@ rm -fr %{buildroot}
%doc NEWS README.md Copyright TODO
%doc %{_mandir}/man1/xmllint.1*
%doc %{_mandir}/man1/xmlcatalog.1*
-%doc %{_mandir}/man3/libxml.3*
%{_libdir}/lib*.so.*
%{_bindir}/xmllint
diff --git a/chromium/third_party/libxml/src/libxml2.syms b/chromium/third_party/libxml/src/libxml2.syms
index 33bc112c14f..a2f7e416fe2 100644
--- a/chromium/third_party/libxml/src/libxml2.syms
+++ b/chromium/third_party/libxml/src/libxml2.syms
@@ -76,7 +76,7 @@ LIBXML2_2.4.30 {
comment;
# SAX2
- docbDefaultSAXHandlerInit;
+# docbDefaultSAXHandlerInit; removed in 2.10.0
# SAX
elementDecl;
@@ -100,7 +100,7 @@ LIBXML2_2.4.30 {
# SAX
ignorableWhitespace;
- initdocbDefaultSAXHandler;
+# initdocbDefaultSAXHandler; removed in 2.10.0
inithtmlDefaultSAXHandler;
initxmlDefaultSAXHandler;
internalSubset;
@@ -119,9 +119,11 @@ LIBXML2_2.4.30 {
# SAX2
xmlDefaultSAXHandlerInit;
-# parserInternals
+# HTMLparser
htmlCreateFileParserCtxt;
htmlInitAutoClose;
+
+# parserInternals
inputPop;
inputPush;
namePop;
@@ -453,16 +455,16 @@ LIBXML2_2.4.30 {
xmlNanoFTPUpdateURL;
# DOCBparser
- docbCreateFileParserCtxt;
- docbCreatePushParserCtxt;
- docbEncodeEntities;
- docbFreeParserCtxt;
- docbParseChunk;
- docbParseDoc;
- docbParseDocument;
- docbParseFile;
- docbSAXParseDoc;
- docbSAXParseFile;
+# docbCreateFileParserCtxt; removed in 2.10.0
+# docbCreatePushParserCtxt; removed in 2.10.0
+# docbEncodeEntities; removed in 2.10.0
+# docbFreeParserCtxt; removed in 2.10.0
+# docbParseChunk; removed in 2.10.0
+# docbParseDoc; removed in 2.10.0
+# docbParseDocument; removed in 2.10.0
+# docbParseFile; removed in 2.10.0
+# docbSAXParseDoc; removed in 2.10.0
+# docbSAXParseFile; removed in 2.10.0
# xpath
xmlXPathCastBooleanToNumber;
@@ -818,7 +820,7 @@ LIBXML2_2.4.30 {
xmlTextReaderXmlLang;
# globals
- docbDefaultSAXHandler; # variable
+# docbDefaultSAXHandler; removed in 2.10.0
htmlDefaultSAXHandler; # variable
xmlDefaultSAXHandler; # variable
xmlDefaultSAXLocator; # variable
@@ -1503,7 +1505,7 @@ LIBXML2_2.6.0 {
xmlSAX2HasInternalSubset;
xmlSAX2IgnorableWhitespace;
xmlSAX2InitDefaultSAXHandler;
- xmlSAX2InitDocbDefaultSAXHandler;
+# xmlSAX2InitDocbDefaultSAXHandler; removed in 2.10.0
xmlSAX2InitHtmlDefaultSAXHandler;
xmlSAX2InternalSubset;
xmlSAX2IsStandalone;
@@ -1583,7 +1585,7 @@ LIBXML2_2.6.0 {
xmlDictSize;
# parserInternals
- xmlErrMemory;
+# xmlErrMemory; removed in 2.11.0
xmlParserMaxDepth; # variable
xmlStringLenDecodeEntities;
xmlSwitchInputEncoding;
@@ -2293,3 +2295,13 @@ LIBXML2_2.9.11 {
xmlPopOutputCallbacks;
} LIBXML2_2.9.8;
+LIBXML2_2.11.0 {
+ global:
+
+# HTMLparser
+ htmlNewSAXParserCtxt;
+
+# parser
+ xmlNewSAXParserCtxt;
+} LIBXML2_2.9.11;
+
diff --git a/chromium/third_party/libxml/src/nanoftp.c b/chromium/third_party/libxml/src/nanoftp.c
index 6de7d300a3a..b52f9b64808 100644
--- a/chromium/third_party/libxml/src/nanoftp.c
+++ b/chromium/third_party/libxml/src/nanoftp.c
@@ -48,9 +48,6 @@
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
@@ -59,6 +56,9 @@
#include <libxml/nanoftp.h>
#include <libxml/globals.h>
+#include "private/error.h"
+#include "private/io.h"
+
/* #define DEBUG_FTP 1 */
#ifdef STANDALONE
#ifndef DEBUG_FTP
@@ -75,27 +75,16 @@
* A couple portability macros
*/
#ifndef _WINSOCKAPI_
-#if !defined(__BEOS__) || defined(__HAIKU__)
#define closesocket(s) close(s)
#endif
-#endif
-
-#ifdef __BEOS__
-#ifndef PF_INET
-#define PF_INET AF_INET
-#endif
-#endif
-
-#ifdef _AIX
-#ifdef HAVE_BROKEN_SS_FAMILY
-#define ss_family __ss_family
-#endif
-#endif
#ifndef XML_SOCKLEN_T
#define XML_SOCKLEN_T unsigned int
#endif
+#define GETHOSTBYNAME_ARG_CAST (char *)
+#define SEND_ARG2_CAST (char *)
+
#define FTP_COMMAND_OK 200
#define FTP_SYNTAX_ERROR 500
#define FTP_GET_PASSWD 331
diff --git a/chromium/third_party/libxml/src/nanohttp.c b/chromium/third_party/libxml/src/nanohttp.c
index 2eafd3f4910..0678b730eed 100644
--- a/chromium/third_party/libxml/src/nanohttp.c
+++ b/chromium/third_party/libxml/src/nanohttp.c
@@ -22,9 +22,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
@@ -37,12 +34,6 @@
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
-#ifdef HAVE_RESOLV_H
-#ifdef HAVE_ARPA_NAMESER_H
-#include <arpa/nameser.h>
-#endif
-#include <resolv.h>
-#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
@@ -78,27 +69,25 @@
#include <libxml/globals.h>
#include <libxml/uri.h>
+#include "private/error.h"
+#include "private/io.h"
+
/**
* A couple portability macros
*/
#ifndef _WINSOCKAPI_
-#if !defined(__BEOS__) || defined(__HAIKU__)
#define closesocket(s) close(s)
-#endif
#define SOCKET int
#define INVALID_SOCKET (-1)
#endif
-#ifdef __BEOS__
-#ifndef PF_INET
-#define PF_INET AF_INET
-#endif
-#endif
-
#ifndef XML_SOCKLEN_T
#define XML_SOCKLEN_T unsigned int
#endif
+#define GETHOSTBYNAME_ARG_CAST (char *)
+#define SEND_ARG2_CAST (char *)
+
#ifdef STANDALONE
#define DEBUG_HTTP
#define xmlStrncasecmp(a, b, n) strncasecmp((char *)a, (char *)b, n)
@@ -188,20 +177,6 @@ static int socket_errno(void) {
#endif
}
-#ifdef SUPPORT_IP6
-static
-int have_ipv6(void) {
- SOCKET s;
-
- s = socket (AF_INET6, SOCK_STREAM, 0);
- if (s != INVALID_SOCKET) {
- close (s);
- return (1);
- }
- return (0);
-}
-#endif
-
/**
* xmlNanoHTTPInit:
*
@@ -535,7 +510,7 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt)
while (ctxt->state & XML_NANO_HTTP_READ) {
if (ctxt->in == NULL) {
- ctxt->in = (char *) xmlMallocAtomic(65000 * sizeof(char));
+ ctxt->in = (char *) xmlMallocAtomic(65000);
if (ctxt->in == NULL) {
xmlHTTPErrMemory("allocating input");
ctxt->last = -1;
@@ -896,15 +871,6 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
status = ioctl(s, FIONBIO, &enable);
}
#else /* VMS */
-#if defined(__BEOS__) && !defined(__HAIKU__)
- {
- bool noblock = true;
-
- status =
- setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock,
- sizeof(noblock));
- }
-#else /* __BEOS__ */
if ((status = fcntl(s, F_GETFL, 0)) != -1) {
#ifdef O_NONBLOCK
status |= O_NONBLOCK;
@@ -923,7 +889,6 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
closesocket(s);
return INVALID_SOCKET;
}
-#endif /* !__BEOS__ */
#endif /* !VMS */
#endif /* !_WINSOCKAPI_ */
@@ -1042,33 +1007,19 @@ xmlNanoHTTPConnectHost(const char *host, int port)
struct sockaddr_in sockin;
#ifdef SUPPORT_IP6
- struct in6_addr ia6;
struct sockaddr_in6 sockin6;
#endif
SOCKET s;
memset (&sockin, 0, sizeof(sockin));
-#ifdef SUPPORT_IP6
- memset (&sockin6, 0, sizeof(sockin6));
-#endif
-
-#if !defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && defined(RES_USE_INET6)
- if (have_ipv6 ())
- {
- if (!(_res.options & RES_INIT))
- res_init();
- _res.options |= RES_USE_INET6;
- }
-#endif
-#if defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && !defined(_WIN32)
- if (have_ipv6 ())
-#endif
-#if defined(HAVE_GETADDRINFO) && (defined(SUPPORT_IP6) || defined(_WIN32))
+#if defined(SUPPORT_IP6)
{
int status;
struct addrinfo hints, *res, *result;
+ memset (&sockin6, 0, sizeof(sockin6));
+
result = NULL;
memset (&hints, 0,sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
@@ -1089,8 +1040,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
memcpy (&sockin, res->ai_addr, res->ai_addrlen);
sockin.sin_port = htons (port);
addr = (struct sockaddr *)&sockin;
-#ifdef SUPPORT_IP6
- } else if (have_ipv6 () && (res->ai_family == AF_INET6)) {
+ } else if (res->ai_family == AF_INET6) {
if ((size_t)res->ai_addrlen > sizeof(sockin6)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result);
@@ -1099,7 +1049,6 @@ xmlNanoHTTPConnectHost(const char *host, int port)
memcpy (&sockin6, res->ai_addr, res->ai_addrlen);
sockin6.sin6_port = htons (port);
addr = (struct sockaddr *)&sockin6;
-#endif
} else
continue; /* for */
@@ -1113,11 +1062,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
if (result)
freeaddrinfo (result);
}
-#endif
-#if defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && !defined(_WIN32)
- else
-#endif
-#if !defined(HAVE_GETADDRINFO) || !defined(_WIN32)
+#else
{
struct hostent *h;
struct in_addr ia;
@@ -1179,19 +1124,6 @@ xmlNanoHTTPConnectHost(const char *host, int port)
sockin.sin_addr = ia;
sockin.sin_port = (unsigned short)htons ((unsigned short)port);
addr = (struct sockaddr *) &sockin;
-#ifdef SUPPORT_IP6
- } else if (have_ipv6 () && (h->h_addrtype == AF_INET6)) {
- /* AAAA records (IPv6) */
- if ((unsigned int) h->h_length > sizeof(ia6)) {
- __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
- return INVALID_SOCKET;
- }
- memcpy (&ia6, h->h_addr_list[i], h->h_length);
- sockin6.sin6_family = h->h_addrtype;
- sockin6.sin6_addr = ia6;
- sockin6.sin6_port = htons (port);
- addr = (struct sockaddr *) &sockin6;
-#endif
} else
break; /* for */
diff --git a/chromium/third_party/libxml/src/parser.c b/chromium/third_party/libxml/src/parser.c
index 441946b6fb7..cb473fe122b 100644
--- a/chromium/third_party/libxml/src/parser.c
+++ b/chromium/third_party/libxml/src/parser.c
@@ -57,6 +57,7 @@
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
+#include <libxml/HTMLparser.h>
#include <libxml/valid.h>
#include <libxml/entities.h>
#include <libxml/xmlerror.h>
@@ -70,18 +71,17 @@
#include <libxml/xmlschemastypes.h>
#include <libxml/relaxng.h>
#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
+#include <libxml/xpath.h>
#endif
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/html.h"
+#include "private/io.h"
+#include "private/parser.h"
+#include "private/threads.h"
struct _xmlStartTag {
const xmlChar *prefix;
@@ -94,8 +94,9 @@ static void
xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info);
static xmlParserCtxtPtr
-xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
- const xmlChar *base, xmlParserCtxtPtr pctx);
+xmlCreateEntityParserCtxtInternal(xmlSAXHandlerPtr sax, void *userData,
+ const xmlChar *URL, const xmlChar *ID, const xmlChar *base,
+ xmlParserCtxtPtr pctx);
static void xmlHaltParser(xmlParserCtxtPtr ctxt);
@@ -111,6 +112,8 @@ xmlParseElementEnd(xmlParserCtxtPtr ctxt);
* *
************************************************************************/
+#define XML_MAX_HUGE_LENGTH 1000000000
+
#define XML_PARSER_BIG_ENTITY 1000
#define XML_PARSER_LOT_ENTITY 5000
@@ -305,7 +308,7 @@ unsigned int xmlParserMaxDepth = 256;
* List of XML prefixed PI allowed by W3C specs
*/
-static const char *xmlW3CPIs[] = {
+static const char* const xmlW3CPIs[] = {
"xml-stylesheet",
"xml-model",
NULL
@@ -568,7 +571,7 @@ xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
errmsg = "Malformed declaration expecting version";
break;
case XML_ERR_NAME_TOO_LONG:
- errmsg = "Name too long use XML_PARSE_HUGE option";
+ errmsg = "Name too long";
break;
#if 0
case:
@@ -1063,11 +1066,7 @@ xmlHasFeature(xmlFeature feature)
return(0);
#endif
case XML_WITH_DEBUG_RUN:
-#ifdef LIBXML_DEBUG_RUNTIME
- return(1);
-#else
return(0);
-#endif
case XML_WITH_ZLIB:
#ifdef LIBXML_ZLIB_ENABLED
return(1);
@@ -1233,7 +1232,7 @@ xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, xmlChar *src, int *len)
return(NULL);
}
xmlAttrNormalizeSpace(ret, ret);
- *len = (int) strlen((const char *)ret);
+ *len = strlen((const char *)ret);
return(ret);
} else if (remove_head) {
*len -= remove_head;
@@ -1768,9 +1767,7 @@ inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
sizeof(ctxt->inputTab[0]));
if (ctxt->inputTab == NULL) {
xmlErrMemory(ctxt, NULL);
- xmlFreeInputStream(value);
ctxt->inputMax /= 2;
- value = NULL;
return (-1);
}
}
@@ -2180,9 +2177,12 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
#define COPY_BUF(l,b,i,v) \
- if (l == 1) b[i++] = (xmlChar) v; \
+ if (l == 1) b[i++] = v; \
else i += xmlCopyCharMultiByte(&b[i],v)
+#define CUR_CONSUMED \
+ (ctxt->input->consumed + (ctxt->input->cur - ctxt->input->base))
+
/**
* xmlSkipBlankChars:
* @ctxt: the XML parser context
@@ -2215,7 +2215,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
ctxt->input->col++;
}
cur++;
- res++;
+ if (res < INT_MAX)
+ res++;
if (*cur == 0) {
ctxt->input->cur = cur;
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
@@ -2251,7 +2252,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
* by the attachment of one leading and one following space (#x20)
* character."
*/
- res++;
+ if (res < INT_MAX)
+ res++;
}
}
return(res);
@@ -2328,6 +2330,8 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
* xmlParseCharRef:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse Reference declarations
*
* [66] CharRef ::= '&#' [0-9]+ ';' |
@@ -2991,7 +2995,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
*/
max = len * 2;
- buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMallocAtomic(max);
if (buffer == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -3002,8 +3006,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
xmlChar *tmp;
max *= 2;
- tmp = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buffer, max);
if (tmp == NULL) {
xmlFree(buffer);
xmlErrMemory(ctxt, NULL);
@@ -3070,7 +3073,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
*/
max = len * 2;
- buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMallocAtomic(max);
if (buffer == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -3081,8 +3084,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
xmlChar *tmp;
max *= 2;
- tmp = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buffer, max);
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFree(buffer);
@@ -3215,6 +3217,9 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
int len = 0, l;
int c;
int count = 0;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_TEXT_LENGTH :
+ XML_MAX_NAME_LENGTH;
#ifdef DEBUG
nbParseNameComplex++;
@@ -3280,7 +3285,8 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
}
- len += l;
+ if (len <= INT_MAX - l)
+ len += l;
NEXTL(l);
c = CUR_CHAR(l);
}
@@ -3306,13 +3312,13 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
}
- len += l;
+ if (len <= INT_MAX - l)
+ len += l;
NEXTL(l);
c = CUR_CHAR(l);
}
}
- if ((len > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if (len > maxLength) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name");
return(NULL);
}
@@ -3335,6 +3341,8 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
* xmlParseName:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML name.
*
* [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
@@ -3351,7 +3359,10 @@ const xmlChar *
xmlParseName(xmlParserCtxtPtr ctxt) {
const xmlChar *in;
const xmlChar *ret;
- int count = 0;
+ size_t count = 0;
+ size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_TEXT_LENGTH :
+ XML_MAX_NAME_LENGTH;
GROW;
@@ -3375,8 +3386,7 @@ xmlParseName(xmlParserCtxtPtr ctxt) {
in++;
if ((*in > 0) && (*in < 0x80)) {
count = in - ctxt->input->cur;
- if ((count > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if (count > maxLength) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name");
return(NULL);
}
@@ -3397,6 +3407,9 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
int len = 0, l;
int c;
int count = 0;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_TEXT_LENGTH :
+ XML_MAX_NAME_LENGTH;
size_t startPosition = 0;
#ifdef DEBUG
@@ -3417,17 +3430,13 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */
(xmlIsNameChar(ctxt, c) && (c != ':'))) {
if (count++ > XML_PARSER_CHUNK_SIZE) {
- if ((len > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
- return(NULL);
- }
count = 0;
GROW;
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
}
- len += l;
+ if (len <= INT_MAX - l)
+ len += l;
NEXTL(l);
c = CUR_CHAR(l);
if (c == 0) {
@@ -3445,8 +3454,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
c = CUR_CHAR(l);
}
}
- if ((len > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if (len > maxLength) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
return(NULL);
}
@@ -3472,7 +3480,10 @@ static const xmlChar *
xmlParseNCName(xmlParserCtxtPtr ctxt) {
const xmlChar *in, *e;
const xmlChar *ret;
- int count = 0;
+ size_t count = 0;
+ size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_TEXT_LENGTH :
+ XML_MAX_NAME_LENGTH;
#ifdef DEBUG
nbParseNCName++;
@@ -3497,8 +3508,7 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) {
goto complex;
if ((*in > 0) && (*in < 0x80)) {
count = in - ctxt->input->cur;
- if ((count > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if (count > maxLength) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
return(NULL);
}
@@ -3580,6 +3590,9 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
const xmlChar *cur = *str;
int len = 0, l;
int c;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_TEXT_LENGTH :
+ XML_MAX_NAME_LENGTH;
#ifdef DEBUG
nbParseStringName++;
@@ -3605,7 +3618,7 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
xmlChar *buffer;
int max = len * 2;
- buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMallocAtomic(max);
if (buffer == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -3615,15 +3628,8 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
if (len + 10 > max) {
xmlChar *tmp;
- if ((len > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
- xmlFree(buffer);
- return(NULL);
- }
max *= 2;
- tmp = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buffer, max);
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFree(buffer);
@@ -3634,14 +3640,18 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
COPY_BUF(l,buffer,len,c);
cur += l;
c = CUR_SCHAR(cur, l);
+ if (len > maxLength) {
+ xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
+ xmlFree(buffer);
+ return(NULL);
+ }
}
buffer[len] = 0;
*str = cur;
return(buffer);
}
}
- if ((len > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if (len > maxLength) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
return(NULL);
}
@@ -3653,6 +3663,8 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
* xmlParseNmtoken:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML Nmtoken.
*
* [7] Nmtoken ::= (NameChar)+
@@ -3668,6 +3680,9 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
int len = 0, l;
int c;
int count = 0;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_TEXT_LENGTH :
+ XML_MAX_NAME_LENGTH;
#ifdef DEBUG
nbParseNmToken++;
@@ -3701,7 +3716,7 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
xmlChar *buffer;
int max = len * 2;
- buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMallocAtomic(max);
if (buffer == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -3719,15 +3734,8 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
if (len + 10 > max) {
xmlChar *tmp;
- if ((max > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken");
- xmlFree(buffer);
- return(NULL);
- }
max *= 2;
- tmp = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buffer, max);
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFree(buffer);
@@ -3738,6 +3746,11 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
COPY_BUF(l,buffer,len,c);
NEXTL(l);
c = CUR_CHAR(l);
+ if (len > maxLength) {
+ xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken");
+ xmlFree(buffer);
+ return(NULL);
+ }
}
buffer[len] = 0;
return(buffer);
@@ -3745,8 +3758,7 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
}
if (len == 0)
return(NULL);
- if ((len > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if (len > maxLength) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken");
return(NULL);
}
@@ -3758,6 +3770,8 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
* @ctxt: an XML parser context
* @orig: if non-NULL store a copy of the original entity value
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse a value for ENTITY declarations
*
* [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' |
@@ -3772,6 +3786,9 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
int len = 0;
int size = XML_PARSER_BUFFER_SIZE;
int c, l;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_HUGE_LENGTH :
+ XML_MAX_TEXT_LENGTH;
xmlChar stop;
xmlChar *ret = NULL;
const xmlChar *cur = NULL;
@@ -3783,7 +3800,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_STARTED, NULL);
return(NULL);
}
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -3815,7 +3832,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
xmlChar *tmp;
size *= 2;
- tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buf, size);
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
goto error;
@@ -3831,6 +3848,12 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
GROW;
c = CUR_CHAR(l);
}
+
+ if (len > maxLength) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
+ "entity value too long\n");
+ goto error;
+ }
}
buf[len] = 0;
if (ctxt->instate == XML_PARSER_EOF)
@@ -3918,6 +3941,9 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
xmlChar *rep = NULL;
size_t len = 0;
size_t buf_size = 0;
+ size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_HUGE_LENGTH :
+ XML_MAX_TEXT_LENGTH;
int c, l, in_space = 0;
xmlChar *current = NULL;
xmlEntityPtr ent;
@@ -3949,16 +3975,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
while (((NXT(0) != limit) && /* checked */
(IS_CHAR(c)) && (c != '<')) &&
(ctxt->instate != XML_PARSER_EOF)) {
- /*
- * Impose a reasonable limit on attribute size, unless XML_PARSE_HUGE
- * special option is given
- */
- if ((len > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue length too long\n");
- goto mem_error;
- }
if (c == '&') {
in_space = 0;
if (NXT(1) == '#') {
@@ -4106,6 +4122,11 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
}
GROW;
c = CUR_CHAR(l);
+ if (len > maxLength) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
+ "AttValue length too long\n");
+ goto mem_error;
+ }
}
if (ctxt->instate == XML_PARSER_EOF)
goto error;
@@ -4127,17 +4148,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
} else
NEXT;
- /*
- * There we potentially risk an overflow, don't allow attribute value of
- * length more than INT_MAX it is a very reasonable assumption !
- */
- if (len >= INT_MAX) {
- xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue length too long\n");
- goto mem_error;
- }
-
- if (attlen != NULL) *attlen = (int) len;
+ if (attlen != NULL) *attlen = len;
return(buf);
mem_error:
@@ -4154,6 +4165,8 @@ error:
* xmlParseAttValue:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse a value for an attribute
* Note: the parser won't do substitution of entities here, this
* will be handled later in xmlStringGetNodeList
@@ -4194,6 +4207,8 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
* xmlParseSystemLiteral:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML Literal
*
* [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
@@ -4207,6 +4222,9 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
int len = 0;
int size = XML_PARSER_BUFFER_SIZE;
int cur, l;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_TEXT_LENGTH :
+ XML_MAX_NAME_LENGTH;
xmlChar stop;
int state = ctxt->instate;
int count = 0;
@@ -4223,7 +4241,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
return(NULL);
}
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -4234,15 +4252,8 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
if (len + 5 >= size) {
xmlChar *tmp;
- if ((size > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral");
- xmlFree(buf);
- ctxt->instate = (xmlParserInputState) state;
- return(NULL);
- }
size *= 2;
- tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buf, size);
if (tmp == NULL) {
xmlFree(buf);
xmlErrMemory(ctxt, NULL);
@@ -4269,6 +4280,12 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
SHRINK;
cur = CUR_CHAR(l);
}
+ if (len > maxLength) {
+ xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral");
+ xmlFree(buf);
+ ctxt->instate = (xmlParserInputState) state;
+ return(NULL);
+ }
}
buf[len] = 0;
ctxt->instate = (xmlParserInputState) state;
@@ -4284,6 +4301,8 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
* xmlParsePubidLiteral:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML public literal
*
* [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
@@ -4296,6 +4315,9 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len = 0;
int size = XML_PARSER_BUFFER_SIZE;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_TEXT_LENGTH :
+ XML_MAX_NAME_LENGTH;
xmlChar cur;
xmlChar stop;
int count = 0;
@@ -4312,7 +4334,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL);
return(NULL);
}
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -4323,14 +4345,8 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
if (len + 1 >= size) {
xmlChar *tmp;
- if ((size > XML_MAX_NAME_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID");
- xmlFree(buf);
- return(NULL);
- }
size *= 2;
- tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buf, size);
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFree(buf);
@@ -4356,6 +4372,11 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
SHRINK;
cur = CUR;
}
+ if (len > maxLength) {
+ xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID");
+ xmlFree(buf);
+ return(NULL);
+ }
}
buf[len] = 0;
if (cur != stop) {
@@ -4412,6 +4433,8 @@ static const unsigned char test_char_data[256] = {
* @ctxt: an XML parser context
* @cdata: int indicating whether we are within a CDATA section
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse a CharData section.
* if we are within a CDATA section ']]>' marks an end of section.
*
@@ -4666,6 +4689,8 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
* @strict: indicate whether we should restrict parsing to only
* production [75], see NOTE below
*
+ * DEPRECATED: Internal function, don't use.
+ *
* Parse an External ID or a Public ID
*
* NOTE: Productions [75] and [83] interact badly since [75] can generate
@@ -4755,6 +4780,9 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
int r, rl;
int cur, l;
size_t count = 0;
+ size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_HUGE_LENGTH :
+ XML_MAX_TEXT_LENGTH;
int inputid;
inputid = ctxt->input->id;
@@ -4762,7 +4790,7 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
if (buf == NULL) {
len = 0;
size = XML_PARSER_BUFFER_SIZE;
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return;
@@ -4800,13 +4828,6 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
if ((r == '-') && (q == '-')) {
xmlFatalErr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, NULL);
}
- if ((len > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
- "Comment too big found", NULL);
- xmlFree (buf);
- return;
- }
if (len + 5 >= size) {
xmlChar *new_buf;
size_t new_size;
@@ -4844,6 +4865,13 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
GROW;
cur = CUR_CHAR(l);
}
+
+ if (len > maxLength) {
+ xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
+ "Comment too big found", NULL);
+ xmlFree (buf);
+ return;
+ }
}
buf[len] = 0;
if (cur == 0) {
@@ -4877,6 +4905,8 @@ not_terminated:
* xmlParseComment:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* Skip an XML (SGML) comment <!-- .... -->
* The spec says that "For compatibility, the string "--" (double-hyphen)
* must not occur within comments. "
@@ -4888,6 +4918,9 @@ xmlParseComment(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
size_t size = XML_PARSER_BUFFER_SIZE;
size_t len = 0;
+ size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_HUGE_LENGTH :
+ XML_MAX_TEXT_LENGTH;
xmlParserInputState state;
const xmlChar *in;
size_t nbchar = 0;
@@ -4946,7 +4979,7 @@ get_more:
size = nbchar + 1;
else
size = XML_PARSER_BUFFER_SIZE + nbchar;
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
ctxt->instate = state;
@@ -4956,8 +4989,7 @@ get_more:
} else if (len + nbchar + 1 >= size) {
xmlChar *new_buf;
size += len + nbchar + XML_PARSER_BUFFER_SIZE;
- new_buf = (xmlChar *) xmlRealloc(buf,
- size * sizeof(xmlChar));
+ new_buf = (xmlChar *) xmlRealloc(buf, size);
if (new_buf == NULL) {
xmlFree (buf);
xmlErrMemory(ctxt, NULL);
@@ -4971,8 +5003,7 @@ get_more:
buf[len] = 0;
}
}
- if ((len > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if (len > maxLength) {
xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
"Comment too big found", NULL);
xmlFree (buf);
@@ -5052,6 +5083,8 @@ get_more:
* xmlParsePITarget:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the name of a PI
*
* [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
@@ -5160,6 +5193,8 @@ error:
* xmlParsePI:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML Processing Instruction.
*
* [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
@@ -5172,6 +5207,9 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
size_t len = 0;
size_t size = XML_PARSER_BUFFER_SIZE;
+ size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_HUGE_LENGTH :
+ XML_MAX_TEXT_LENGTH;
int cur, l;
const xmlChar *target;
xmlParserInputState state;
@@ -5212,7 +5250,7 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
ctxt->instate = state;
return;
}
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
ctxt->instate = state;
@@ -5247,14 +5285,6 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
return;
}
count = 0;
- if ((len > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
- "PI %s too big found", target);
- xmlFree(buf);
- ctxt->instate = state;
- return;
- }
}
COPY_BUF(l,buf,len,cur);
NEXTL(l);
@@ -5264,15 +5294,14 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
GROW;
cur = CUR_CHAR(l);
}
+ if (len > maxLength) {
+ xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
+ "PI %s too big found", target);
+ xmlFree(buf);
+ ctxt->instate = state;
+ return;
+ }
}
- if ((len > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
- "PI %s too big found", target);
- xmlFree(buf);
- ctxt->instate = state;
- return;
- }
buf[len] = 0;
if (cur != '?') {
xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
@@ -5318,6 +5347,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
* xmlParseNotationDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse a notation declaration
*
* [82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'
@@ -5390,6 +5421,8 @@ xmlParseNotationDecl(xmlParserCtxtPtr ctxt) {
* xmlParseEntityDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse <!ENTITY declarations
*
* [70] EntityDecl ::= GEDecl | PEDecl
@@ -5657,6 +5690,8 @@ done:
* @ctxt: an XML parser context
* @value: Receive a possible fixed default value for the attribute
*
+ * DEPRECATED: Internal function, don't use.
+ *
* Parse an attribute default declaration
*
* [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
@@ -5718,6 +5753,8 @@ xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) {
* xmlParseNotationType:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an Notation attribute type.
*
* Note: the leading 'NOTATION' S part has already being parsed...
@@ -5790,6 +5827,8 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) {
* xmlParseEnumerationType:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an Enumeration attribute type.
*
* [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
@@ -5860,6 +5899,8 @@ xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
* @ctxt: an XML parser context
* @tree: the enumeration tree built while parsing
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an Enumerated attribute type.
*
* [57] EnumeratedType ::= NotationType | Enumeration
@@ -5893,6 +5934,8 @@ xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
* @ctxt: an XML parser context
* @tree: the enumeration tree built while parsing
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the Attribute list def for an element
*
* [54] AttType ::= StringType | TokenizedType | EnumeratedType
@@ -5968,6 +6011,8 @@ xmlParseAttributeType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
* xmlParseAttributeListDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* : parse the Attribute list def for an element
*
* [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'
@@ -6089,6 +6134,8 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
* @ctxt: an XML parser context
* @inputchk: the input used for the current entity, needed for boundary checks
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the declaration for a Mixed Element content
* The leading '(' and spaces have been skipped in xmlParseElementContentDecl
*
@@ -6507,6 +6554,8 @@ xmlParseElementChildrenContentDeclPriv(xmlParserCtxtPtr ctxt, int inputchk,
* @ctxt: an XML parser context
* @inputchk: the input used for the current entity, needed for boundary checks
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the declaration for a Mixed Element content
* The leading '(' and spaces have been skipped in xmlParseElementContentDecl
*
@@ -6544,6 +6593,8 @@ xmlParseElementChildrenContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
* @name: the name of the element being defined.
* @result: the Element Content pointer will be stored here if any
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the declaration for an Element content either Mixed or Children,
* the cases EMPTY and ANY are handled directly in xmlParseElementDecl
*
@@ -6588,6 +6639,8 @@ xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name,
* xmlParseElementDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an Element declaration.
*
* [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'
@@ -6820,12 +6873,12 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
}
SKIP(3);
} else {
- const xmlChar *check = CUR_PTR;
- unsigned int cons = ctxt->input->consumed;
+ int id = ctxt->input->id;
+ unsigned long cons = CUR_CONSUMED;
xmlParseMarkupDecl(ctxt);
- if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
+ if ((id == ctxt->input->id) && (cons == CUR_CONSUMED)) {
xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
xmlHaltParser(ctxt);
goto error;
@@ -6847,6 +6900,8 @@ error:
* xmlParseMarkupDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse Markup declarations
*
* [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl |
@@ -6909,6 +6964,8 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
* xmlParseTextDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML declaration header for external entities
*
* [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
@@ -6977,9 +7034,14 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
NEXT;
} else {
+ int c;
+
xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
- MOVETO_ENDTAG(CUR_PTR);
- NEXT;
+ while ((c = CUR) != 0) {
+ NEXT;
+ if (c == '>')
+ break;
+ }
}
ctxt->instate = oldstate;
@@ -7044,8 +7106,8 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
while (((RAW == '<') && (NXT(1) == '?')) ||
((RAW == '<') && (NXT(1) == '!')) ||
(RAW == '%')) {
- const xmlChar *check = CUR_PTR;
- unsigned int cons = ctxt->input->consumed;
+ int id = ctxt->input->id;
+ unsigned long cons = CUR_CONSUMED;
GROW;
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
@@ -7054,7 +7116,7 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
xmlParseMarkupDecl(ctxt);
SKIP_BLANKS;
- if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
+ if ((id == ctxt->input->id) && (cons == CUR_CONSUMED)) {
xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
break;
}
@@ -7070,6 +7132,8 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
* xmlParseReference:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse and handle entity references in content, depending on the SAX
* interface, this may end-up in a call to character() if this is a
* CharRef, a predefined entity, if there is no reference() callback.
@@ -7250,7 +7314,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
ent->owner = 1;
while (list != NULL) {
list->parent = (xmlNodePtr) ent;
- xmlSetTreeDoc(list, ent->doc);
+ if (list->doc != ent->doc)
+ xmlSetTreeDoc(list, ent->doc);
if (list->next == NULL)
ent->last = list;
list = list->next;
@@ -7516,6 +7581,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
* xmlParseEntityRef:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse ENTITY references declarations
*
* [68] EntityRef ::= '&' Name ';'
@@ -7896,6 +7963,8 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
* xmlParsePEReference:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse PEReference declarations
* The entity content is handled directly by pushing it's content as
* a new input stream.
@@ -8006,7 +8075,7 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
xmlChar start[4];
xmlCharEncoding enc;
- if (xmlParserEntityCheck(ctxt, 0, entity, 0))
+ if (xmlParserEntityCheck(ctxt, 0, entity, 0))
return;
if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
@@ -8095,6 +8164,7 @@ xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
"xmlLoadEntityContent parameter error");
return(-1);
}
+ xmlBufferSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
input = xmlNewEntityInputStream(ctxt, entity);
if (input == NULL) {
@@ -8110,6 +8180,7 @@ xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
*/
if (xmlPushInput(ctxt, input) < 0) {
xmlBufferFree(buf);
+ xmlFreeInputStream(input);
return(-1);
}
@@ -8279,6 +8350,8 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
* xmlParseDocTypeDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse a DOCTYPE declaration
*
* [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S?
@@ -8377,8 +8450,8 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
*/
while (((RAW != ']') || (ctxt->inputNr > baseInputNr)) &&
(ctxt->instate != XML_PARSER_EOF)) {
- const xmlChar *check = CUR_PTR;
- unsigned int cons = ctxt->input->consumed;
+ int id = ctxt->input->id;
+ unsigned long cons = CUR_CONSUMED;
SKIP_BLANKS;
xmlParseMarkupDecl(ctxt);
@@ -8393,7 +8466,7 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
xmlParseConditionalSections(ctxt);
}
- if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
+ if ((id == ctxt->input->id) && (cons == CUR_CONSUMED)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"xmlParseInternalSubset: error detected in Markup declaration\n");
if (ctxt->inputNr > baseInputNr)
@@ -8424,6 +8497,8 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
* @ctxt: an XML parser context
* @value: a xmlChar ** used to store the value of the attribute
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an attribute
*
* [41] Attribute ::= Name Eq AttValue
@@ -8517,6 +8592,8 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
* xmlParseStartTag:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse a start of tag either for rule element or
* EmptyElement. In both case we don't parse the tag closing chars.
*
@@ -8572,8 +8649,8 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) {
while (((RAW != '>') &&
((RAW != '/') || (NXT(1) != '>')) &&
(IS_BYTE_CHAR(RAW))) && (ctxt->instate != XML_PARSER_EOF)) {
- const xmlChar *q = CUR_PTR;
- unsigned int cons = ctxt->input->consumed;
+ int id = ctxt->input->id;
+ unsigned long cons = CUR_CONSUMED;
attname = xmlParseAttribute(ctxt, &attvalue);
if ((attname != NULL) && (attvalue != NULL)) {
@@ -8638,7 +8715,7 @@ failed:
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"attributes construct error\n");
}
- if ((cons == ctxt->input->consumed) && (q == CUR_PTR) &&
+ if ((cons == CUR_CONSUMED) && (id == ctxt->input->id) &&
(attname == NULL) && (attvalue == NULL)) {
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
"xmlParseStartTag: problem parsing attributes\n");
@@ -8736,6 +8813,8 @@ xmlParseEndTag1(xmlParserCtxtPtr ctxt, int line) {
* xmlParseEndTag:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an end of tag
*
* [42] ETag ::= '</' Name S? '>'
@@ -8975,6 +9054,9 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
const xmlChar *in = NULL, *start, *end, *last;
xmlChar *ret = NULL;
int line, col;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_HUGE_LENGTH :
+ XML_MAX_TEXT_LENGTH;
GROW;
in = (xmlChar *) CUR_PTR;
@@ -9014,8 +9096,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
start = in;
if (in >= end) {
GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
- if (((in - start) > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if ((in - start) > maxLength) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
"AttValue length too long\n");
return(NULL);
@@ -9028,8 +9109,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if ((*in++ == 0x20) && (*in == 0x20)) break;
if (in >= end) {
GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
- if (((in - start) > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if ((in - start) > maxLength) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
"AttValue length too long\n");
return(NULL);
@@ -9062,16 +9142,14 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
last = last + delta;
}
end = ctxt->input->end;
- if (((in - start) > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if ((in - start) > maxLength) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
"AttValue length too long\n");
return(NULL);
}
}
}
- if (((in - start) > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if ((in - start) > maxLength) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
"AttValue length too long\n");
return(NULL);
@@ -9084,8 +9162,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
col++;
if (in >= end) {
GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
- if (((in - start) > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if ((in - start) > maxLength) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
"AttValue length too long\n");
return(NULL);
@@ -9093,8 +9170,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
}
}
last = in;
- if (((in - start) > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ if ((in - start) > maxLength) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
"AttValue length too long\n");
return(NULL);
@@ -9104,6 +9180,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
in++;
col++;
if (len != NULL) {
+ if (alloc) *alloc = 0;
*len = last - start;
ret = (xmlChar *) start;
} else {
@@ -9113,7 +9190,6 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
CUR_PTR = in;
ctxt->input->line = line;
ctxt->input->col = col;
- if (alloc) *alloc = 0;
return ret;
need_complex:
if (alloc) *alloc = 1;
@@ -9322,8 +9398,8 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
while (((RAW != '>') &&
((RAW != '/') || (NXT(1) != '>')) &&
(IS_BYTE_CHAR(RAW))) && (ctxt->instate != XML_PARSER_EOF)) {
- const xmlChar *q = CUR_PTR;
- unsigned int cons = ctxt->input->consumed;
+ int id = ctxt->input->id;
+ unsigned long cons = CUR_CONSUMED;
int len = -1, alloc = 0;
attname = xmlParseAttribute2(ctxt, prefix, localname,
@@ -9504,7 +9580,7 @@ next_attr:
"attributes construct error\n");
break;
}
- if ((cons == ctxt->input->consumed) && (q == CUR_PTR) &&
+ if ((cons == CUR_CONSUMED) && (id == ctxt->input->id) &&
(attname == NULL) && (attvalue == NULL)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"xmlParseStartTag: problem parsing attributes\n");
@@ -9765,6 +9841,8 @@ xmlParseEndTag2(xmlParserCtxtPtr ctxt, const xmlStartTag *tag) {
* xmlParseCDSect:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* Parse escaped pure raw content.
*
* [18] CDSect ::= CDStart CData CDEnd
@@ -9784,6 +9862,9 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
int s, sl;
int cur, l;
int count = 0;
+ int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+ XML_MAX_HUGE_LENGTH :
+ XML_MAX_TEXT_LENGTH;
/* Check 2.6.0 was NXT(0) not RAW */
if (CMP9(CUR_PTR, '<', '!', '[', 'C', 'D', 'A', 'T', 'A', '[')) {
@@ -9807,7 +9888,7 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
}
NEXTL(sl);
cur = CUR_CHAR(l);
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return;
@@ -9817,14 +9898,7 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
if (len + 5 >= size) {
xmlChar *tmp;
- if ((size > XML_MAX_TEXT_LENGTH) &&
- ((ctxt->options & XML_PARSE_HUGE) == 0)) {
- xmlFatalErrMsgStr(ctxt, XML_ERR_CDATA_NOT_FINISHED,
- "CData section too big found", NULL);
- xmlFree (buf);
- return;
- }
- tmp = (xmlChar *) xmlRealloc(buf, size * 2 * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buf, size * 2);
if (tmp == NULL) {
xmlFree(buf);
xmlErrMemory(ctxt, NULL);
@@ -9850,6 +9924,12 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
}
NEXTL(l);
cur = CUR_CHAR(l);
+ if (len > maxLength) {
+ xmlFatalErrMsg(ctxt, XML_ERR_CDATA_NOT_FINISHED,
+ "CData section too big found\n");
+ xmlFree(buf);
+ return;
+ }
}
buf[len] = 0;
ctxt->instate = XML_PARSER_CONTENT;
@@ -9888,8 +9968,8 @@ xmlParseContentInternal(xmlParserCtxtPtr ctxt) {
GROW;
while ((RAW != 0) &&
(ctxt->instate != XML_PARSER_EOF)) {
- const xmlChar *test = CUR_PTR;
- unsigned int cons = ctxt->input->consumed;
+ int id = ctxt->input->id;
+ unsigned long cons = CUR_CONSUMED;
const xmlChar *cur = ctxt->input->cur;
/*
@@ -9948,7 +10028,7 @@ xmlParseContentInternal(xmlParserCtxtPtr ctxt) {
GROW;
SHRINK;
- if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
+ if ((cons == CUR_CONSUMED) && (id == ctxt->input->id)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"detected an error in element content\n");
xmlHaltParser(ctxt);
@@ -9985,6 +10065,8 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
* xmlParseElement:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML element
*
* [39] element ::= EmptyElemTag | STag content ETag
@@ -10188,6 +10270,8 @@ xmlParseElementEnd(xmlParserCtxtPtr ctxt) {
* xmlParseVersionNum:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the XML version value.
*
* [26] VersionNum ::= '1.' [0-9]+
@@ -10203,7 +10287,7 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
int size = 10;
xmlChar cur;
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -10228,7 +10312,7 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
xmlChar *tmp;
size *= 2;
- tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buf, size);
if (tmp == NULL) {
xmlFree(buf);
xmlErrMemory(ctxt, NULL);
@@ -10248,6 +10332,8 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
* xmlParseVersionInfo:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the XML version.
*
* [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
@@ -10295,6 +10381,8 @@ xmlParseVersionInfo(xmlParserCtxtPtr ctxt) {
* xmlParseEncName:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the XML encoding name
*
* [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
@@ -10311,7 +10399,7 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) {
cur = CUR;
if (((cur >= 'a') && (cur <= 'z')) ||
((cur >= 'A') && (cur <= 'Z'))) {
- buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
@@ -10329,7 +10417,7 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) {
xmlChar *tmp;
size *= 2;
- tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buf, size);
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFree(buf);
@@ -10357,6 +10445,8 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) {
* xmlParseEncodingDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the XML encoding declaration
*
* [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'")
@@ -10471,6 +10561,8 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
* xmlParseSDDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse the XML standalone declaration
*
* [32] SDDecl ::= S 'standalone' Eq
@@ -10555,6 +10647,8 @@ xmlParseSDDecl(xmlParserCtxtPtr ctxt) {
* xmlParseXMLDecl:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML declaration header
*
* [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
@@ -10660,9 +10754,14 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
NEXT;
} else {
+ int c;
+
xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
- MOVETO_ENDTAG(CUR_PTR);
- NEXT;
+ while ((c = CUR) != 0) {
+ NEXT;
+ if (c == '>')
+ break;
+ }
}
}
@@ -10670,6 +10769,8 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
* xmlParseMisc:
* @ctxt: an XML parser context
*
+ * DEPRECATED: Internal function, don't use.
+ *
* parse an XML Misc* optional field.
*
* [27] Misc ::= Comment | PI | S
@@ -10905,8 +11006,6 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
if ((ctxt == NULL) || (ctxt->input == NULL))
return(-1);
- xmlDefaultSAXHandlerInit();
-
xmlDetectSAX2(ctxt);
GROW;
@@ -11543,15 +11642,15 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
break;
}
case XML_PARSER_CONTENT: {
- const xmlChar *test;
- unsigned int cons;
+ int id;
+ unsigned long cons;
if ((avail < 2) && (ctxt->inputNr == 1))
goto done;
cur = ctxt->input->cur[0];
next = ctxt->input->cur[1];
- test = CUR_PTR;
- cons = ctxt->input->consumed;
+ id = ctxt->input->id;
+ cons = CUR_CONSUMED;
if ((cur == '<') && (next == '/')) {
ctxt->instate = XML_PARSER_END_TAG;
break;
@@ -11632,7 +11731,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
ctxt->checkIndex = 0;
xmlParseCharData(ctxt, 0);
}
- if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
+ if ((cons == CUR_CONSUMED) && (id == ctxt->input->id)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"detected an error in element content\n");
xmlHaltParser(ctxt);
@@ -12470,33 +12569,13 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
buf = xmlAllocParserInputBuffer(enc);
if (buf == NULL) return(NULL);
- ctxt = xmlNewParserCtxt();
+ ctxt = xmlNewSAXParserCtxt(sax, user_data);
if (ctxt == NULL) {
xmlErrMemory(NULL, "creating parser: out of memory\n");
xmlFreeParserInputBuffer(buf);
return(NULL);
}
ctxt->dictNames = 1;
- if (sax != NULL) {
-#ifdef LIBXML_SAX1_ENABLED
- if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
-#endif /* LIBXML_SAX1_ENABLED */
- xmlFree(ctxt->sax);
- ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
- if (ctxt->sax == NULL) {
- xmlErrMemory(ctxt, NULL);
- xmlFreeParserInputBuffer(buf);
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
- memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
- if (sax->initialized == XML_SAX2_MAGIC)
- memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
- else
- memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
if (filename == NULL) {
ctxt->directory = NULL;
} else {
@@ -12632,31 +12711,11 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
return (NULL);
}
- ctxt = xmlNewParserCtxt();
+ ctxt = xmlNewSAXParserCtxt(sax, user_data);
if (ctxt == NULL) {
xmlFreeParserInputBuffer(buf);
return(NULL);
}
- if (sax != NULL) {
-#ifdef LIBXML_SAX1_ENABLED
- if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
-#endif /* LIBXML_SAX1_ENABLED */
- xmlFree(ctxt->sax);
- ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
- if (ctxt->sax == NULL) {
- xmlFreeParserInputBuffer(buf);
- xmlErrMemory(ctxt, NULL);
- xmlFreeParserCtxt(ctxt);
- return(NULL);
- }
- memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
- if (sax->initialized == XML_SAX2_MAGIC)
- memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
- else
- memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
inputStream = xmlNewIOInputStream(ctxt, buf, enc);
if (inputStream == NULL) {
@@ -12698,7 +12757,7 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
if (input == NULL)
return(NULL);
- ctxt = xmlNewParserCtxt();
+ ctxt = xmlNewSAXParserCtxt(sax, NULL);
if (ctxt == NULL) {
xmlFreeParserInputBuffer(input);
return(NULL);
@@ -12707,15 +12766,6 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
/* We are loading a DTD */
ctxt->options |= XML_PARSE_DTDLOAD;
- /*
- * Set-up the SAX context
- */
- if (sax != NULL) {
- if (ctxt->sax != NULL)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- ctxt->userData = ctxt;
- }
xmlDetectSAX2(ctxt);
/*
@@ -12724,7 +12774,6 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
pinput = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE);
if (pinput == NULL) {
- if (sax != NULL) ctxt->sax = NULL;
xmlFreeParserInputBuffer(input);
xmlFreeParserCtxt(ctxt);
return(NULL);
@@ -12734,7 +12783,6 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
* plug some encoding conversion routines here.
*/
if (xmlPushInput(ctxt, pinput) < 0) {
- if (sax != NULL) ctxt->sax = NULL;
xmlFreeParserCtxt(ctxt);
return(NULL);
}
@@ -12801,7 +12849,6 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
xmlFreeDoc(ctxt->myDoc);
ctxt->myDoc = NULL;
}
- if (sax != NULL) ctxt->sax = NULL;
xmlFreeParserCtxt(ctxt);
return(ret);
@@ -12813,6 +12860,8 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
* @ExternalID: a NAME* containing the External ID of the DTD
* @SystemID: a NAME* containing the URL to the DTD
*
+ * DEPRECATED: Don't use.
+ *
* Load and parse an external subset.
*
* Returns the resulting xmlDtdPtr or NULL in case of error.
@@ -12829,7 +12878,7 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
if ((ExternalID == NULL) && (SystemID == NULL)) return(NULL);
- ctxt = xmlNewParserCtxt();
+ ctxt = xmlNewSAXParserCtxt(sax, NULL);
if (ctxt == NULL) {
return(NULL);
}
@@ -12838,16 +12887,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
ctxt->options |= XML_PARSE_DTDLOAD;
/*
- * Set-up the SAX context
- */
- if (sax != NULL) {
- if (ctxt->sax != NULL)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- ctxt->userData = ctxt;
- }
-
- /*
* Canonicalise the system ID
*/
systemIdCanonic = xmlCanonicPath(SystemID);
@@ -12864,7 +12903,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
systemIdCanonic);
if (input == NULL) {
- if (sax != NULL) ctxt->sax = NULL;
xmlFreeParserCtxt(ctxt);
if (systemIdCanonic != NULL)
xmlFree(systemIdCanonic);
@@ -12875,7 +12913,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
* plug some encoding conversion routines here.
*/
if (xmlPushInput(ctxt, input) < 0) {
- if (sax != NULL) ctxt->sax = NULL;
xmlFreeParserCtxt(ctxt);
if (systemIdCanonic != NULL)
xmlFree(systemIdCanonic);
@@ -12903,7 +12940,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
if (ctxt->myDoc == NULL) {
xmlErrMemory(ctxt, "New Doc failed");
- if (sax != NULL) ctxt->sax = NULL;
xmlFreeParserCtxt(ctxt);
return(NULL);
}
@@ -12932,7 +12968,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
xmlFreeDoc(ctxt->myDoc);
ctxt->myDoc = NULL;
}
- if (sax != NULL) ctxt->sax = NULL;
xmlFreeParserCtxt(ctxt);
return(ret);
@@ -13023,7 +13058,6 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
xmlParserCtxtPtr ctxt;
xmlDocPtr newDoc;
xmlNodePtr newRoot;
- xmlSAXHandlerPtr oldsax = NULL;
xmlParserErrors ret = XML_ERR_OK;
xmlChar start[4];
xmlCharEncoding enc;
@@ -13041,17 +13075,11 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
if (doc == NULL)
return(XML_ERR_INTERNAL_ERROR);
-
- ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, oldctxt);
+ ctxt = xmlCreateEntityParserCtxtInternal(sax, user_data, URL, ID, NULL,
+ oldctxt);
if (ctxt == NULL) return(XML_WAR_UNDECLARED_ENTITY);
- ctxt->userData = ctxt;
- if (sax != NULL) {
- oldsax = ctxt->sax;
- ctxt->sax = sax;
- if (user_data != NULL)
- ctxt->userData = user_data;
- }
xmlDetectSAX2(ctxt);
+
newDoc = xmlNewDoc(BAD_CAST "1.0");
if (newDoc == NULL) {
xmlFreeParserCtxt(ctxt);
@@ -13072,7 +13100,6 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
newRoot = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL);
if (newRoot == NULL) {
if (sax != NULL)
- ctxt->sax = oldsax;
xmlFreeParserCtxt(ctxt);
newDoc->intSubset = NULL;
newDoc->extSubset = NULL;
@@ -13213,8 +13240,6 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
if ((oldctxt != NULL) && (ctxt->lastError.code != XML_ERR_OK))
xmlCopyError(&ctxt->lastError, &oldctxt->lastError);
- if (sax != NULL)
- ctxt->sax = oldsax;
if (oldctxt != NULL) {
ctxt->dict = NULL;
ctxt->attsDefault = NULL;
@@ -13606,7 +13631,7 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen,
ctxt->input_id = 2;
ctxt->instate = XML_PARSER_CONTENT;
- fake = xmlNewComment(NULL);
+ fake = xmlNewDocComment(node->doc, NULL);
if (fake == NULL) {
xmlFreeParserCtxt(ctxt);
return(XML_ERR_NO_MEMORY);
@@ -13889,6 +13914,8 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
* @sax: the SAX handler block
* @filename: the filename
*
+ * DEPRECATED: Don't use.
+ *
* parse an XML external entity out of context and build a tree.
* It use the given SAX function block to handle the parsing callback.
* If sax is NULL, fallback to the default DOM tree building routines.
@@ -13965,14 +13992,15 @@ xmlParseEntity(const char *filename) {
* Returns the new parser context or NULL
*/
static xmlParserCtxtPtr
-xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
- const xmlChar *base, xmlParserCtxtPtr pctx) {
+xmlCreateEntityParserCtxtInternal(xmlSAXHandlerPtr sax, void *userData,
+ const xmlChar *URL, const xmlChar *ID, const xmlChar *base,
+ xmlParserCtxtPtr pctx) {
xmlParserCtxtPtr ctxt;
xmlParserInputPtr inputStream;
char *directory = NULL;
xmlChar *uri;
- ctxt = xmlNewParserCtxt();
+ ctxt = xmlNewSAXParserCtxt(sax, userData);
if (ctxt == NULL) {
return(NULL);
}
@@ -14040,7 +14068,7 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
xmlParserCtxtPtr
xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID,
const xmlChar *base) {
- return xmlCreateEntityParserCtxtInternal(URL, ID, base, NULL);
+ return xmlCreateEntityParserCtxtInternal(NULL, NULL, URL, ID, base, NULL);
}
@@ -14118,6 +14146,8 @@ xmlCreateFileParserCtxt(const char *filename)
* documents
* @data: the userdata
*
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.
+ *
* parse an XML file and build a tree. Automatic support for ZLIB/Compress
* compressed document is provided by default if found at compile-time.
* It use the given SAX function block to handle the parsing callback.
@@ -14186,6 +14216,8 @@ xmlSAXParseFileWithData(xmlSAXHandlerPtr sax, const char *filename,
* @recovery: work in recovery mode, i.e. tries to read no Well Formed
* documents
*
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.
+ *
* parse an XML file and build a tree. Automatic support for ZLIB/Compress
* compressed document is provided by default if found at compile-time.
* It use the given SAX function block to handle the parsing callback.
@@ -14204,6 +14236,8 @@ xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename,
* xmlRecoverDoc:
* @cur: a pointer to an array of xmlChar
*
+ * DEPRECATED: Use xmlReadDoc with XML_PARSE_RECOVER.
+ *
* parse an XML in-memory document and build a tree.
* In the case the document is not Well Formed, a attempt to build a
* tree is tried anyway
@@ -14220,6 +14254,8 @@ xmlRecoverDoc(const xmlChar *cur) {
* xmlParseFile:
* @filename: the filename
*
+ * DEPRECATED: Use xmlReadFile.
+ *
* parse an XML file and build a tree. Automatic support for ZLIB/Compress
* compressed document is provided by default if found at compile-time.
*
@@ -14236,6 +14272,8 @@ xmlParseFile(const char *filename) {
* xmlRecoverFile:
* @filename: the filename
*
+ * DEPRECATED: Use xmlReadFile with XML_PARSE_RECOVER.
+ *
* parse an XML file and build a tree. Automatic support for ZLIB/Compress
* compressed document is provided by default if found at compile-time.
* In the case the document is not Well Formed, it attempts to build
@@ -14256,6 +14294,8 @@ xmlRecoverFile(const char *filename) {
* @buffer: a xmlChar * buffer
* @filename: a file name
*
+ * DEPRECATED: Don't use.
+ *
* Setup the parser context to parse a new buffer; Clears any prior
* contents from the parser context. The buffer parameter must not be
* NULL, but the filename parameter can be
@@ -14291,6 +14331,8 @@ xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer,
* @user_data: The user data returned on SAX callbacks
* @filename: a file name
*
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.
+ *
* parse an XML file and call the given SAX handler routines.
* Automatic support for ZLIB/Compress compressed document is provided
*
@@ -14396,6 +14438,8 @@ xmlCreateMemoryParserCtxt(const char *buffer, int size) {
* documents
* @data: the userdata
*
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.
+ *
* parse an XML in-memory block and use the given SAX function block
* to handle the parsing callback. If sax is NULL, fallback to the default
* DOM tree building routines.
@@ -14451,6 +14495,8 @@ xmlSAXParseMemoryWithData(xmlSAXHandlerPtr sax, const char *buffer,
* @recovery: work in recovery mode, i.e. tries to read not Well Formed
* documents
*
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.
+ *
* parse an XML in-memory block and use the given SAX function block
* to handle the parsing callback. If sax is NULL, fallback to the default
* DOM tree building routines.
@@ -14468,6 +14514,8 @@ xmlSAXParseMemory(xmlSAXHandlerPtr sax, const char *buffer,
* @buffer: an pointer to a char array
* @size: the size of the array
*
+ * DEPRECATED: Use xmlReadMemory.
+ *
* parse an XML in-memory block and build a tree.
*
* Returns the resulting document tree
@@ -14482,6 +14530,8 @@ xmlDocPtr xmlParseMemory(const char *buffer, int size) {
* @buffer: an pointer to a char array
* @size: the size of the array
*
+ * DEPRECATED: Use xmlReadMemory with XML_PARSE_RECOVER.
+ *
* parse an XML in-memory block and build a tree.
* In the case the document is not Well Formed, an attempt to
* build a tree is tried anyway
@@ -14500,7 +14550,8 @@ xmlDocPtr xmlRecoverMemory(const char *buffer, int size) {
* @buffer: an in-memory XML document input
* @size: the length of the XML document in bytes
*
- * A better SAX parsing routine.
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.
+ *
* parse an XML in-memory buffer and call the given SAX handler routines.
*
* Returns 0 in case of success or a error number otherwise
@@ -14570,6 +14621,8 @@ xmlCreateDocParserCtxt(const xmlChar *cur) {
* @recovery: work in recovery mode, i.e. tries to read no Well Formed
* documents
*
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadDoc.
+ *
* parse an XML in-memory document and build a tree.
* It use the given SAX function block to handle the parsing callback.
* If sax is NULL, fallback to the default DOM tree building routines.
@@ -14613,6 +14666,8 @@ xmlSAXParseDoc(xmlSAXHandlerPtr sax, const xmlChar *cur, int recovery) {
* xmlParseDoc:
* @cur: a pointer to an array of xmlChar
*
+ * DEPRECATED: Use xmlReadDoc.
+ *
* parse an XML in-memory document and build a tree.
*
* Returns the resulting document tree
@@ -14671,11 +14726,6 @@ xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func)
* *
************************************************************************/
-#ifdef LIBXML_XPATH_ENABLED
-#include <libxml/xpath.h>
-#endif
-
-extern void XMLCDECL xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...);
static int xmlParserInitialized = 0;
/**
@@ -14702,9 +14752,6 @@ xmlInitParser(void) {
#endif
xmlInitThreads();
xmlInitGlobals();
- if ((xmlGenericError == xmlGenericErrorDefaultFunc) ||
- (xmlGenericError == NULL))
- initGenericErrorDefaultFunc(NULL);
xmlInitMemory();
xmlInitializeDict();
xmlInitCharEncodingHandlers();
@@ -14717,7 +14764,7 @@ xmlInitParser(void) {
htmlInitAutoClose();
htmlDefaultSAXHandlerInit();
#endif
-#ifdef LIBXML_XPATH_ENABLED
+#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
xmlXPathInit();
#endif
xmlParserInitialized = 1;
@@ -14843,6 +14890,8 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
ctxt->nameNr = 0;
ctxt->name = NULL;
+ ctxt->nsNr = 0;
+
DICT_FREE(ctxt->version);
ctxt->version = NULL;
DICT_FREE(ctxt->encoding);
@@ -15380,22 +15429,10 @@ xmlDocPtr
xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur,
const char *URL, const char *encoding, int options)
{
- xmlParserInputPtr stream;
-
if (cur == NULL)
return (NULL);
- if (ctxt == NULL)
- return (NULL);
- xmlInitParser();
-
- xmlCtxtReset(ctxt);
-
- stream = xmlNewStringInputStream(ctxt, cur);
- if (stream == NULL) {
- return (NULL);
- }
- inputPush(ctxt, stream);
- return (xmlDoRead(ctxt, URL, encoding, options, 1));
+ return (xmlCtxtReadMemory(ctxt, (const char *) cur, xmlStrlen(cur), URL,
+ encoding, options));
}
/**
diff --git a/chromium/third_party/libxml/src/parserInternals.c b/chromium/third_party/libxml/src/parserInternals.c
index 7d3d13bc73b..c26ccdaa71a 100644
--- a/chromium/third_party/libxml/src/parserInternals.c
+++ b/chromium/third_party/libxml/src/parserInternals.c
@@ -20,19 +20,6 @@
#include <ctype.h>
#include <stdlib.h>
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef LIBXML_ZLIB_ENABLED
-#include <zlib.h>
-#endif
-
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -56,8 +43,11 @@
#define END(ctxt) ctxt->input->end
#define VALID_CTXT(ctxt) (CUR(ctxt) <= END(ctxt))
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/io.h"
+#include "private/parser.h"
/*
* Various global defaults for parsing
@@ -72,7 +62,7 @@
*/
void
xmlCheckVersion(int version) {
- int myversion = (int) LIBXML_VERSION;
+ int myversion = LIBXML_VERSION;
xmlInitParser();
@@ -258,9 +248,9 @@ void check_buffer(xmlParserInputPtr in) {
xmlGenericError(xmlGenericErrorContext,
"xmlParserInput: cur > base + use problem\n");
}
- xmlGenericError(xmlGenericErrorContext,"buffer %x : content %x, cur %d, use %d\n",
- (int) in, (int) xmlBufContent(in->buf->buffer), in->cur - in->base,
- xmlBufUse(in->buf->buffer));
+ xmlGenericError(xmlGenericErrorContext,"buffer %p : content %x, cur %d, use %d\n",
+ (void *) in, (int) xmlBufContent(in->buf->buffer),
+ in->cur - in->base, xmlBufUse(in->buf->buffer));
}
#else
@@ -273,7 +263,7 @@ void check_buffer(xmlParserInputPtr in) {
* @in: an XML parser input
* @len: an indicative size for the lookahead
*
- * This function was internal and is deprecated.
+ * DEPRECATED: This function was internal and is deprecated.
*
* Returns -1 as this is an error to use it.
*/
@@ -287,6 +277,8 @@ xmlParserInputRead(xmlParserInputPtr in ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUS
* @in: an XML parser input
* @len: an indicative size for the lookahead
*
+ * DEPRECATED: Don't use.
+ *
* This function increase the input for the parser. It tries to
* preserve pointers to the input buffer, and keep already read data
*
@@ -297,7 +289,6 @@ int
xmlParserInputGrow(xmlParserInputPtr in, int len) {
int ret;
size_t indx;
- const xmlChar *content;
if ((in == NULL) || (len < 0)) return(-1);
#ifdef DEBUG_INPUT
@@ -322,22 +313,8 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
} else
return(0);
- /*
- * NOTE : in->base may be a "dangling" i.e. freed pointer in this
- * block, but we use it really as an integer to do some
- * pointer arithmetic. Insure will raise it as a bug but in
- * that specific case, that's not !
- */
-
- content = xmlBufContent(in->buf->buffer);
- if (in->base != content) {
- /*
- * the buffer has been reallocated
- */
- indx = in->cur - in->base;
- in->base = content;
- in->cur = &content[indx];
- }
+ in->base = xmlBufContent(in->buf->buffer);
+ in->cur = in->base + indx;
in->end = xmlBufEnd(in->buf->buffer);
CHECK_BUFFER(in);
@@ -355,8 +332,6 @@ void
xmlParserInputShrink(xmlParserInputPtr in) {
size_t used;
size_t ret;
- size_t indx;
- const xmlChar *content;
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext, "Shrink\n");
@@ -369,7 +344,7 @@ xmlParserInputShrink(xmlParserInputPtr in) {
CHECK_BUFFER(in);
- used = in->cur - xmlBufContent(in->buf->buffer);
+ used = in->cur - in->base;
/*
* Do not shrink on large buffers whose only a tiny fraction
* was consumed
@@ -377,27 +352,17 @@ xmlParserInputShrink(xmlParserInputPtr in) {
if (used > INPUT_CHUNK) {
ret = xmlBufShrink(in->buf->buffer, used - LINE_LEN);
if (ret > 0) {
- in->cur -= ret;
+ used -= ret;
in->consumed += ret;
}
- in->end = xmlBufEnd(in->buf->buffer);
}
- CHECK_BUFFER(in);
-
- if (xmlBufUse(in->buf->buffer) > INPUT_CHUNK) {
- return;
- }
- xmlParserInputBufferRead(in->buf, 2 * INPUT_CHUNK);
- content = xmlBufContent(in->buf->buffer);
- if (in->base != content) {
- /*
- * the buffer has been reallocated
- */
- indx = in->cur - in->base;
- in->base = content;
- in->cur = &content[indx];
+ if (xmlBufUse(in->buf->buffer) <= INPUT_CHUNK) {
+ xmlParserInputBufferRead(in->buf, 2 * INPUT_CHUNK);
}
+
+ in->base = xmlBufContent(in->buf->buffer);
+ in->cur = in->base + used;
in->end = xmlBufEnd(in->buf->buffer);
CHECK_BUFFER(in);
@@ -586,7 +551,7 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
if ((*ctxt->input->cur >= 0x20) && (*ctxt->input->cur <= 0x7F)) {
*len = 1;
- return((int) *ctxt->input->cur);
+ return(*ctxt->input->cur);
}
if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
/*
@@ -675,7 +640,7 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
}
return(0xA);
}
- return((int) *ctxt->input->cur);
+ return(*ctxt->input->cur);
}
}
/*
@@ -690,7 +655,7 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
}
return(0xA);
}
- return((int) *ctxt->input->cur);
+ return(*ctxt->input->cur);
encoding_error:
/*
* An encoding problem may arise from a truncated input buffer
@@ -721,7 +686,7 @@ encoding_error:
}
ctxt->charset = XML_CHAR_ENCODING_8859_1;
*len = 1;
- return((int) *ctxt->input->cur);
+ return(*ctxt->input->cur);
}
/**
@@ -793,7 +758,7 @@ xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len)
} else {
/* 1-byte code */
*len = 1;
- return ((int) *cur);
+ return (*cur);
}
}
/*
@@ -802,7 +767,7 @@ xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len)
* XML constructs only use < 128 chars
*/
*len = 1;
- return ((int) *cur);
+ return (*cur);
encoding_error:
/*
@@ -833,7 +798,7 @@ encoding_error:
BAD_CAST buffer, NULL);
}
*len = 1;
- return ((int) *cur);
+ return (*cur);
}
/**
@@ -847,7 +812,7 @@ encoding_error:
*/
int
xmlCopyCharMultiByte(xmlChar *out, int val) {
- if (out == NULL) return(0);
+ if ((out == NULL) || (val < 0)) return(0);
/*
* We are supposed to handle UTF8, check it's valid
* From rfc2044: encoding of the Unicode values on UTF-8:
@@ -873,7 +838,7 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
*out++= ((val >> bits) & 0x3F) | 0x80 ;
return (out - savedout);
}
- *out = (xmlChar) val;
+ *out = val;
return 1;
}
@@ -890,12 +855,12 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
int
xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
- if (out == NULL) return(0);
+ if ((out == NULL) || (val < 0)) return(0);
/* the len parameter is ignored */
if (val >= 0x80) {
return(xmlCopyCharMultiByte (out, val));
}
- *out = (xmlChar) val;
+ *out = val;
return 1;
}
@@ -906,9 +871,6 @@ xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
************************************************************************/
static int
-xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt,
- xmlCharEncodingHandlerPtr handler, int len);
-static int
xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler, int len);
/**
@@ -1008,55 +970,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
/* default encoding, no conversion should be needed */
ctxt->charset = XML_CHAR_ENCODING_UTF8;
return(0);
- case XML_CHAR_ENCODING_UTF16LE:
- break;
- case XML_CHAR_ENCODING_UTF16BE:
- break;
- case XML_CHAR_ENCODING_UCS4LE:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "USC4 little endian", NULL);
- break;
- case XML_CHAR_ENCODING_UCS4BE:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "USC4 big endian", NULL);
- break;
- case XML_CHAR_ENCODING_EBCDIC:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "EBCDIC", NULL);
- break;
- case XML_CHAR_ENCODING_UCS4_2143:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "UCS4 2143", NULL);
- break;
- case XML_CHAR_ENCODING_UCS4_3412:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "UCS4 3412", NULL);
- break;
- case XML_CHAR_ENCODING_UCS2:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "UCS2", NULL);
- break;
case XML_CHAR_ENCODING_8859_1:
- case XML_CHAR_ENCODING_8859_2:
- case XML_CHAR_ENCODING_8859_3:
- case XML_CHAR_ENCODING_8859_4:
- case XML_CHAR_ENCODING_8859_5:
- case XML_CHAR_ENCODING_8859_6:
- case XML_CHAR_ENCODING_8859_7:
- case XML_CHAR_ENCODING_8859_8:
- case XML_CHAR_ENCODING_8859_9:
- /*
- * We used to keep the internal content in the
- * document encoding however this turns being unmaintainable
- * So xmlGetCharEncodingHandler() will return non-null
- * values for this now.
- */
if ((ctxt->inputNr == 1) &&
(ctxt->encoding == NULL) &&
(ctxt->input != NULL) &&
@@ -1065,36 +979,20 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
}
ctxt->charset = enc;
return(0);
- case XML_CHAR_ENCODING_2022_JP:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "ISO-2022-JP", NULL);
- break;
- case XML_CHAR_ENCODING_SHIFT_JIS:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "Shift_JIS", NULL);
- break;
- case XML_CHAR_ENCODING_EUC_JP:
- __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
- "encoding not supported %s\n",
- BAD_CAST "EUC-JP", NULL);
- break;
default:
- break;
- }
- }
- /*
- * TODO: We could recover from errors in external entities if we
- * didn't stop the parser. But most callers of this function don't
- * check the return value.
- */
- if (handler == NULL) {
- xmlStopParser(ctxt);
- return(-1);
+ __xmlErrEncoding(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
+ "encoding not supported: %s\n",
+ BAD_CAST xmlGetCharEncodingName(enc), NULL);
+ /*
+ * TODO: We could recover from errors in external entities
+ * if we didn't stop the parser. But most callers of this
+ * function don't check the return value.
+ */
+ xmlStopParser(ctxt);
+ return(-1);
+ }
}
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- ret = xmlSwitchToEncodingInt(ctxt, handler, len);
+ ret = xmlSwitchInputEncodingInt(ctxt, ctxt->input, handler, len);
if ((ret < 0) || (ctxt->errNo == XML_I18N_CONV_FAILED)) {
/*
* on encoding conversion errors, stop the parser
@@ -1106,7 +1004,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
}
/**
- * xmlSwitchInputEncoding:
+ * xmlSwitchInputEncodingInt:
* @ctxt: the parser context
* @input: the input stream
* @handler: the encoding handler
@@ -1128,6 +1026,8 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
if (input == NULL)
return (-1);
if (input->buf != NULL) {
+ ctxt->charset = XML_CHAR_ENCODING_UTF8;
+
if (input->buf->encoder != NULL) {
/*
* Check in case the auto encoding detection triggered
@@ -1231,12 +1131,9 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
input->buf->rawconsumed += use - xmlBufUse(input->buf->raw);
}
return (0);
- } else if (input->length == 0) {
- /*
- * When parsing a static memory array one must know the
- * size to be able to convert the buffer.
- */
- xmlErrInternal(ctxt, "switching encoding : no input\n", NULL);
+ } else {
+ xmlErrInternal(ctxt,
+ "static memory buffer doesn't support encoding\n", NULL);
/*
* Callers assume that the input buffer takes ownership of the
* encoding handler. xmlCharEncCloseFunc frees unregistered
@@ -1245,11 +1142,6 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
xmlCharEncCloseFunc(handler);
return (-1);
}
- /*
- * We should actually raise an error here, see issue #34.
- */
- xmlCharEncCloseFunc(handler);
- return (0);
}
/**
@@ -1258,6 +1150,8 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
* @input: the input stream
* @handler: the encoding handler
*
+ * DEPRECATED: Use xmlSwitchToEncoding
+ *
* change the input functions when discovering the character encoding
* of a given entity.
*
@@ -1270,41 +1164,6 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
}
/**
- * xmlSwitchToEncodingInt:
- * @ctxt: the parser context
- * @handler: the encoding handler
- * @len: the length to convert or -1
- *
- * change the input functions when discovering the character encoding
- * of a given entity, and convert only @len bytes of the output, this
- * is needed on auto detect to allows any declared encoding later to
- * convert the actual content after the xmlDecl
- *
- * Returns 0 in case of success, -1 otherwise
- */
-static int
-xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt,
- xmlCharEncodingHandlerPtr handler, int len) {
- int ret = 0;
-
- if (handler != NULL) {
- if (ctxt->input != NULL) {
- ret = xmlSwitchInputEncodingInt(ctxt, ctxt->input, handler, len);
- } else {
- xmlErrInternal(ctxt, "xmlSwitchToEncoding : no input\n",
- NULL);
- return(-1);
- }
- /*
- * The parsing is now done in UTF8 natively
- */
- ctxt->charset = XML_CHAR_ENCODING_UTF8;
- } else
- return(-1);
- return(ret);
-}
-
-/**
* xmlSwitchToEncoding:
* @ctxt: the parser context
* @handler: the encoding handler
@@ -1317,7 +1176,9 @@ xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt,
int
xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
{
- return (xmlSwitchToEncodingInt(ctxt, handler, -1));
+ if (ctxt == NULL)
+ return(-1);
+ return(xmlSwitchInputEncodingInt(ctxt, ctxt->input, handler, -1));
}
/************************************************************************
@@ -1494,6 +1355,7 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
xmlParserInputPtr
xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer) {
xmlParserInputPtr input;
+ xmlParserInputBufferPtr buf;
if (buffer == NULL) {
xmlErrInternal(ctxt, "xmlNewStringInputStream string = NULL\n",
@@ -1503,15 +1365,21 @@ xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer) {
if (xmlParserDebugEntities)
xmlGenericError(xmlGenericErrorContext,
"new fixed input: %.30s\n", buffer);
+ buf = xmlParserInputBufferCreateMem((const char *) buffer,
+ xmlStrlen(buffer),
+ XML_CHAR_ENCODING_NONE);
+ if (buf == NULL) {
+ xmlErrMemory(ctxt, NULL);
+ return(NULL);
+ }
input = xmlNewInputStream(ctxt);
if (input == NULL) {
xmlErrMemory(ctxt, "couldn't allocate a new input stream\n");
+ xmlFreeParserInputBuffer(buf);
return(NULL);
}
- input->base = buffer;
- input->cur = buffer;
- input->length = xmlStrlen(buffer);
- input->end = &buffer[input->length];
+ input->buf = buf;
+ xmlBufResetInput(input->buf->buffer, input);
return(input);
}
@@ -1581,16 +1449,19 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
************************************************************************/
/**
- * xmlInitParserCtxt:
- * @ctxt: an XML parser context
+ * xmlInitSAXParserCtxt:
+ * @ctxt: XML parser context
+ * @sax: SAX handlert
+ * @userData: user data
*
- * Initialize a parser context
+ * Initialize a SAX parser context
*
* Returns 0 in case of success and -1 in case of error
*/
-int
-xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
+static int
+xmlInitSAXParserCtxt(xmlParserCtxtPtr ctxt, const xmlSAXHandler *sax,
+ void *userData)
{
xmlParserInputPtr input;
@@ -1599,7 +1470,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
return(-1);
}
- xmlDefaultSAXHandlerInit();
+ xmlInitParser();
if (ctxt->dict == NULL)
ctxt->dict = xmlDictCreate();
@@ -1615,8 +1486,19 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
xmlErrMemory(NULL, "cannot initialize parser context\n");
return(-1);
}
- else
+ if (sax == NULL) {
+ memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
xmlSAXVersion(ctxt->sax, 2);
+ ctxt->userData = ctxt;
+ } else {
+ if (sax->initialized == XML_SAX2_MAGIC) {
+ memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
+ } else {
+ memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
+ memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
+ }
+ ctxt->userData = userData ? userData : ctxt;
+ }
ctxt->maxatts = 0;
ctxt->atts = NULL;
@@ -1714,7 +1596,6 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->spaceMax = 10;
ctxt->spaceTab[0] = -1;
ctxt->space = &ctxt->spaceTab[0];
- ctxt->userData = ctxt;
ctxt->myDoc = NULL;
ctxt->wellFormed = 1;
ctxt->nsWellFormed = 1;
@@ -1767,6 +1648,24 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
}
/**
+ * xmlInitParserCtxt:
+ * @ctxt: an XML parser context
+ *
+ * DEPRECATED: Internal function which will be made private in a future
+ * version.
+ *
+ * Initialize a parser context
+ *
+ * Returns 0 in case of success and -1 in case of error
+ */
+
+int
+xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
+{
+ return(xmlInitSAXParserCtxt(ctxt, NULL, NULL));
+}
+
+/**
* xmlFreeParserCtxt:
* @ctxt: an XML parser context
*
@@ -1863,6 +1762,23 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
xmlParserCtxtPtr
xmlNewParserCtxt(void)
{
+ return(xmlNewSAXParserCtxt(NULL, NULL));
+}
+
+/**
+ * xmlNewSAXParserCtxt:
+ * @sax: SAX handler
+ * @userData: user data
+ *
+ * Allocate and initialize a new SAX parser context. If userData is NULL,
+ * the parser context will be passed as user data.
+ *
+ * Returns the xmlParserCtxtPtr or NULL if memory allocation failed.
+ */
+
+xmlParserCtxtPtr
+xmlNewSAXParserCtxt(const xmlSAXHandler *sax, void *userData)
+{
xmlParserCtxtPtr ctxt;
ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
@@ -1871,7 +1787,7 @@ xmlNewParserCtxt(void)
return(NULL);
}
memset(ctxt, 0, sizeof(xmlParserCtxt));
- if (xmlInitParserCtxt(ctxt) < 0) {
+ if (xmlInitSAXParserCtxt(ctxt, sax, userData) < 0) {
xmlFreeParserCtxt(ctxt);
return(NULL);
}
@@ -1906,6 +1822,8 @@ xmlClearParserCtxt(xmlParserCtxtPtr ctxt)
* @ctx: an XML parser context
* @node: an XML node within the tree
*
+ * DEPRECATED: Don't use.
+ *
* Find the parser node info struct for a given node
*
* Returns an xmlParserNodeInfo block pointer or NULL
@@ -1931,6 +1849,8 @@ xmlParserFindNodeInfo(const xmlParserCtxtPtr ctx, const xmlNodePtr node)
* xmlInitNodeInfoSeq:
* @seq: a node info sequence pointer
*
+ * DEPRECATED: Don't use.
+ *
* -- Initialize (set to initial state) node info sequence
*/
void
@@ -1947,6 +1867,8 @@ xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
* xmlClearNodeInfoSeq:
* @seq: a node info sequence pointer
*
+ * DEPRECATED: Don't use.
+ *
* -- Clear (release memory and reinitialize) node
* info sequence
*/
@@ -1965,6 +1887,7 @@ xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
* @seq: a node info sequence pointer
* @node: an XML node pointer
*
+ * DEPRECATED: Don't use.
*
* xmlParserFindNodeInfoIndex : Find the index that the info record for
* the given node is or should be at in a sorted sequence
@@ -2008,6 +1931,8 @@ xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
* @ctxt: an XML parser context
* @info: a node info sequence pointer
*
+ * DEPRECATED: Don't use.
+ *
* Insert node info record into the sorted sequence
*/
void
@@ -2078,6 +2003,8 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
* xmlPedanticParserDefault:
* @val: int 0 or 1
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.
+ *
* Set and return the previous value for enabling pedantic warnings.
*
* Returns the last value for 0 for no substitution, 1 for substitution.
@@ -2095,6 +2022,8 @@ xmlPedanticParserDefault(int val) {
* xmlLineNumbersDefault:
* @val: int 0 or 1
*
+ * DEPRECATED: The modern options API always enables line numbers.
+ *
* Set and return the previous value for enabling line numbers in elements
* contents. This may break on old application and is turned off by default.
*
@@ -2113,6 +2042,8 @@ xmlLineNumbersDefault(int val) {
* xmlSubstituteEntitiesDefault:
* @val: int 0 or 1
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOENT.
+ *
* Set and return the previous value for default entity support.
* Initially the parser always keep entity references instead of substituting
* entity values in the output. This function has to be used to change the
@@ -2135,6 +2066,8 @@ xmlSubstituteEntitiesDefault(int val) {
* xmlKeepBlanksDefault:
* @val: int 0 or 1
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.
+ *
* Set and return the previous value for default blanks text nodes support.
* The 1.x version of the parser used an heuristic to try to detect
* ignorable white spaces. As a result the SAX callback was generating
diff --git a/chromium/third_party/libxml/src/pattern.c b/chromium/third_party/libxml/src/pattern.c
index 73851a1f0b2..4d0423eef09 100644
--- a/chromium/third_party/libxml/src/pattern.c
+++ b/chromium/third_party/libxml/src/pattern.c
@@ -516,9 +516,6 @@ restart:
goto rollback;
node = node->parent;
if ((node->type == XML_DOCUMENT_NODE) ||
-#ifdef LIBXML_DOCB_ENABLED
- (node->type == XML_DOCB_DOCUMENT_NODE) ||
-#endif
(node->type == XML_HTML_DOCUMENT_NODE))
continue;
goto rollback;
@@ -548,9 +545,6 @@ restart:
if ((node->type != XML_ELEMENT_NODE) &&
(node->type != XML_DOCUMENT_NODE) &&
-#ifdef LIBXML_DOCB_ENABLED
- (node->type != XML_DOCB_DOCUMENT_NODE) &&
-#endif
(node->type != XML_HTML_DOCUMENT_NODE))
goto rollback;
@@ -590,9 +584,6 @@ restart:
case XML_OP_PARENT:
if ((node->type == XML_DOCUMENT_NODE) ||
(node->type == XML_HTML_DOCUMENT_NODE) ||
-#ifdef LIBXML_DOCB_ENABLED
- (node->type == XML_DOCB_DOCUMENT_NODE) ||
-#endif
(node->type == XML_NAMESPACE_DECL))
goto rollback;
node = node->parent;
@@ -631,9 +622,6 @@ restart:
goto rollback;
if ((node->type == XML_DOCUMENT_NODE) ||
(node->type == XML_HTML_DOCUMENT_NODE) ||
-#ifdef LIBXML_DOCB_ENABLED
- (node->type == XML_DOCB_DOCUMENT_NODE) ||
-#endif
(node->type == XML_NAMESPACE_DECL))
goto rollback;
node = node->parent;
@@ -2219,7 +2207,7 @@ stream_next:
int
xmlStreamPush(xmlStreamCtxtPtr stream,
const xmlChar *name, const xmlChar *ns) {
- return (xmlStreamPushInternal(stream, name, ns, (int) XML_ELEMENT_NODE));
+ return (xmlStreamPushInternal(stream, name, ns, XML_ELEMENT_NODE));
}
/**
@@ -2269,7 +2257,7 @@ xmlStreamPushNode(xmlStreamCtxtPtr stream,
int
xmlStreamPushAttr(xmlStreamCtxtPtr stream,
const xmlChar *name, const xmlChar *ns) {
- return (xmlStreamPushInternal(stream, name, ns, (int) XML_ATTRIBUTE_NODE));
+ return (xmlStreamPushInternal(stream, name, ns, XML_ATTRIBUTE_NODE));
}
/**
diff --git a/chromium/third_party/libxml/src/py-compile b/chromium/third_party/libxml/src/py-compile
new file mode 100755
index 00000000000..81b122b0a54
--- /dev/null
+++ b/chromium/third_party/libxml/src/py-compile
@@ -0,0 +1,189 @@
+#!/bin/sh
+# py-compile - Compile a Python program
+
+scriptversion=2021-02-27.01; # UTC
+
+# Copyright (C) 2000-2021 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+if test -z "$PYTHON"; then
+ PYTHON=python
+fi
+
+me=py-compile
+
+usage_error ()
+{
+ echo "$me: $*" >&2
+ echo "Try '$me --help' for more information." >&2
+ exit 1
+}
+
+basedir=
+destdir=
+while test $# -ne 0; do
+ case "$1" in
+ --basedir)
+ if test $# -lt 2; then
+ usage_error "option '--basedir' requires an argument"
+ else
+ basedir=$2
+ fi
+ shift
+ ;;
+ --destdir)
+ if test $# -lt 2; then
+ usage_error "option '--destdir' requires an argument"
+ else
+ destdir=$2
+ fi
+ shift
+ ;;
+ -h|--help)
+ cat <<\EOF
+Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."
+
+Byte compile some python scripts FILES. Use --destdir to specify any
+leading directory path to the FILES that you don't want to include in the
+byte compiled file. Specify --basedir for any additional path information you
+do want to be shown in the byte compiled file.
+
+Example:
+ py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v|--version)
+ echo "$me $scriptversion"
+ exit $?
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ usage_error "unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+files=$*
+if test -z "$files"; then
+ usage_error "no files given"
+fi
+
+# if basedir was given, then it should be prepended to filenames before
+# byte compilation.
+if test -z "$basedir"; then
+ pathtrans="path = file"
+else
+ pathtrans="path = os.path.join('$basedir', file)"
+fi
+
+# if destdir was given, then it needs to be prepended to the filename to
+# byte compile but not go into the compiled file.
+if test -z "$destdir"; then
+ filetrans="filepath = path"
+else
+ filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)"
+fi
+
+python_major=`$PYTHON -V 2>&1 | sed -e 's/.* //;s/\..*$//;1q'`
+if test -z "$python_major"; then
+ echo "$me: could not determine $PYTHON major version, guessing 3" >&2
+ python_major=3
+fi
+
+# The old way to import libraries was deprecated.
+if test "$python_major" -le 2; then
+ import_lib=imp
+ import_test="hasattr(imp, 'get_tag')"
+ import_call=imp.cache_from_source
+ import_arg2=', False' # needed in one call and not the other
+else
+ import_lib=importlib
+ import_test="hasattr(sys.implementation, 'cache_tag')"
+ import_call=importlib.util.cache_from_source
+ import_arg2=
+fi
+
+$PYTHON -c "
+import sys, os, py_compile, $import_lib
+
+files = '''$files'''
+
+sys.stdout.write('Byte-compiling python modules...\n')
+for file in files.split():
+ $pathtrans
+ $filetrans
+ if not os.path.exists(filepath) or not (len(filepath) >= 3
+ and filepath[-3:] == '.py'):
+ continue
+ sys.stdout.write(file)
+ sys.stdout.flush()
+ if $import_test:
+ py_compile.compile(filepath, $import_call(filepath), path)
+ else:
+ py_compile.compile(filepath, filepath + 'c', path)
+sys.stdout.write('\n')" || exit $?
+
+# this will fail for python < 1.5, but that doesn't matter ...
+$PYTHON -O -c "
+import sys, os, py_compile, $import_lib
+
+# pypy does not use .pyo optimization
+if hasattr(sys, 'pypy_translation_info'):
+ sys.exit(0)
+
+files = '''$files'''
+sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
+for file in files.split():
+ $pathtrans
+ $filetrans
+ if not os.path.exists(filepath) or not (len(filepath) >= 3
+ and filepath[-3:] == '.py'):
+ continue
+ sys.stdout.write(file)
+ sys.stdout.flush()
+ if $import_test:
+ py_compile.compile(filepath, $import_call(filepath$import_arg2), path)
+ else:
+ py_compile.compile(filepath, filepath + 'o', path)
+sys.stdout.write('\n')" 2>/dev/null || exit $?
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/chromium/third_party/libxml/src/runsuite.c b/chromium/third_party/libxml/src/runsuite.c
index f7957ce106f..4e406a35670 100644
--- a/chromium/third_party/libxml/src/runsuite.c
+++ b/chromium/third_party/libxml/src/runsuite.c
@@ -13,7 +13,6 @@
#include <unistd.h>
#endif
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -325,6 +324,7 @@ xsdIncorrectTestCase(xmlNodePtr cur) {
fprintf(stderr, "out of memory !\n");
fatalError();
}
+ xmlBufferSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
xmlNodeDump(buf, test->doc, test, 0, 0);
pctxt = xmlRelaxNGNewMemParserCtxt((const char *)buf->content, buf->use);
xmlRelaxNGSetParserErrors(pctxt, testErrorHandler, testErrorHandler,
@@ -363,6 +363,7 @@ installResources(xmlNodePtr tst, const xmlChar *base) {
fprintf(stderr, "out of memory !\n");
fatalError();
}
+ xmlBufferSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
xmlNodeDump(buf, tst->doc, tst, 0, 0);
while (tst != NULL) {
@@ -458,6 +459,7 @@ xsdTestCase(xmlNodePtr tst) {
fprintf(stderr, "out of memory !\n");
fatalError();
}
+ xmlBufferSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
xmlNodeDump(buf, test->doc, test, 0, 0);
pctxt = xmlRelaxNGNewMemParserCtxt((const char *)buf->content, buf->use);
xmlRelaxNGSetParserErrors(pctxt, testErrorHandler, testErrorHandler,
diff --git a/chromium/third_party/libxml/src/runtest.c b/chromium/third_party/libxml/src/runtest.c
index 26443485bb6..ff992951fac 100644
--- a/chromium/third_party/libxml/src/runtest.c
+++ b/chromium/third_party/libxml/src/runtest.c
@@ -18,7 +18,6 @@
#include <unistd.h>
#endif
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -531,7 +530,6 @@ testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, xmlErrorPtr err) {
static void
initializeLibxml2(void) {
- xmlGetWarningsDefaultValue = 0;
xmlPedanticParserDefault(0);
xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
@@ -611,7 +609,7 @@ static int checkTestFile(const char *filename) {
}
static int compareFiles(const char *r1 /* temp */, const char *r2 /* result */) {
- int res1, res2;
+ int res1, res2, total;
int fd1, fd2;
char bytes1[4096];
char bytes2[4096];
@@ -625,16 +623,20 @@ static int compareFiles(const char *r1 /* temp */, const char *r2 /* result */)
close(fd1);
return(-1);
}
+ total = 0;
do {
res1 = read(fd1, bytes1, 4096);
if (res1 <= 0)
break;
+ total += res1;
res2 = write(fd2, bytes1, res1);
if (res2 <= 0 || res2 != res1)
break;
} while (1);
close(fd2);
close(fd1);
+ if (total == 0)
+ unlink(r2);
return(res1 != 0);
}
@@ -642,28 +644,27 @@ static int compareFiles(const char *r1 /* temp */, const char *r2 /* result */)
if (fd1 < 0)
return(-1);
fd2 = open(r2, RD_FLAGS);
- if (fd2 < 0) {
- close(fd1);
- return(-1);
- }
while (1) {
res1 = read(fd1, bytes1, 4096);
- res2 = read(fd2, bytes2, 4096);
+ res2 = fd2 >= 0 ? read(fd2, bytes2, 4096) : 0;
if ((res1 != res2) || (res1 < 0)) {
close(fd1);
- close(fd2);
+ if (fd2 >= 0)
+ close(fd2);
return(1);
}
if (res1 == 0)
break;
if (memcmp(bytes1, bytes2, res1) != 0) {
close(fd1);
- close(fd2);
+ if (fd2 >= 0)
+ close(fd2);
return(1);
}
}
close(fd1);
- close(fd2);
+ if (fd2 >= 0)
+ close(fd2);
return(0);
}
@@ -675,6 +676,10 @@ static int compareFileMem(const char *filename, const char *mem, int size) {
struct stat info;
if (update_results) {
+ if (size == 0) {
+ unlink(filename);
+ return(0);
+ }
fd = open(filename, WR_FLAGS, 0644);
if (fd < 0) {
fprintf(stderr, "failed to open %s for writing", filename);
@@ -686,6 +691,8 @@ static int compareFileMem(const char *filename, const char *mem, int size) {
}
if (stat(filename, &info) < 0) {
+ if (size == 0)
+ return(0);
fprintf(stderr, "failed to stat %s\n", filename);
return(-1);
}
@@ -1718,7 +1725,11 @@ saxParseTest(const char *filename, const char *result,
#ifdef LIBXML_HTML_ENABLED
if (options & XML_PARSE_HTML) {
- htmlSAXParseFile(filename, NULL, emptySAXHandler, NULL);
+ htmlParserCtxtPtr ctxt;
+
+ ctxt = htmlNewSAXParserCtxt(emptySAXHandler, NULL);
+ htmlCtxtReadFile(ctxt, filename, NULL, options);
+ htmlFreeParserCtxt(ctxt);
ret = 0;
} else
#endif
@@ -1742,7 +1753,11 @@ saxParseTest(const char *filename, const char *result,
}
#ifdef LIBXML_HTML_ENABLED
if (options & XML_PARSE_HTML) {
- htmlSAXParseFile(filename, NULL, debugHTMLSAXHandler, NULL);
+ htmlParserCtxtPtr ctxt;
+
+ ctxt = htmlNewSAXParserCtxt(debugHTMLSAXHandler, NULL);
+ htmlCtxtReadFile(ctxt, filename, NULL, options);
+ htmlFreeParserCtxt(ctxt);
ret = 0;
} else
#endif
@@ -2091,10 +2106,8 @@ errParseTest(const char *filename, const char *result, const char *err,
} else
#endif
{
- xmlGetWarningsDefaultValue = 1;
doc = xmlReadFile(filename, NULL, options);
}
- xmlGetWarningsDefaultValue = 0;
if (result) {
if (doc == NULL) {
base = "";
@@ -2147,21 +2160,19 @@ fdParseTest(const char *filename, const char *result, const char *err,
int options) {
xmlDocPtr doc;
const char *base = NULL;
- int size, res = 0;
+ int size, res = 0, fd;
nb_tests++;
- int fd = open(filename, RD_FLAGS);
+ fd = open(filename, RD_FLAGS);
#ifdef LIBXML_HTML_ENABLED
if (options & XML_PARSE_HTML) {
doc = htmlReadFd(fd, filename, NULL, options);
} else
#endif
{
- xmlGetWarningsDefaultValue = 1;
doc = xmlReadFd(fd, filename, NULL, options);
}
close(fd);
- xmlGetWarningsDefaultValue = 0;
if (result) {
if (doc == NULL) {
base = "";
@@ -2274,7 +2285,6 @@ streamProcessTest(const char *filename, const char *result, const char *err,
}
}
#endif
- xmlGetWarningsDefaultValue = 1;
ret = xmlTextReaderRead(reader);
while (ret == 1) {
if ((t != NULL) && (rng == NULL))
@@ -2291,7 +2301,6 @@ streamProcessTest(const char *filename, const char *result, const char *err,
testErrorHandler(NULL, "%s validates\n", filename);
}
}
- xmlGetWarningsDefaultValue = 0;
if (t != NULL) {
fclose(t);
ret = compareFiles(temp, result);
@@ -2418,12 +2427,11 @@ ignoreGenericError(void *ctx ATTRIBUTE_UNUSED,
static void
testXPath(const char *str, int xptr, int expr) {
- xmlGenericErrorFunc handler = ignoreGenericError;
xmlXPathObjectPtr res;
xmlXPathContextPtr ctxt;
/* Don't print generic errors to stderr. */
- initGenericErrorDefaultFunc(&handler);
+ xmlSetGenericErrorFunc(NULL, ignoreGenericError);
nb_tests++;
#if defined(LIBXML_XPTR_ENABLED)
@@ -2455,7 +2463,7 @@ testXPath(const char *str, int xptr, int expr) {
xmlXPathFreeContext(ctxt);
/* Reset generic error handler. */
- initGenericErrorDefaultFunc(NULL);
+ xmlSetGenericErrorFunc(NULL, NULL);
}
/**
@@ -2617,23 +2625,24 @@ xptrDocTest(const char *filename,
glob_t globbuf;
size_t i;
int ret = 0, res;
+ const char *subdir = options == -1 ? "xptr-xp1" : "xptr";
xpathDocument = xmlReadFile(filename, NULL,
- options | XML_PARSE_DTDATTR | XML_PARSE_NOENT);
+ XML_PARSE_DTDATTR | XML_PARSE_NOENT);
if (xpathDocument == NULL) {
fprintf(stderr, "Failed to load %s\n", filename);
return(-1);
}
- res = snprintf(pattern, 499, "./test/XPath/xptr/%s*",
- baseFilename(filename));
+ res = snprintf(pattern, 499, "./test/XPath/%s/%s*",
+ subdir, baseFilename(filename));
if (res >= 499)
pattern[499] = 0;
globbuf.gl_offs = 0;
glob(pattern, GLOB_DOOFFS, NULL, &globbuf);
for (i = 0;i < globbuf.gl_pathc;i++) {
- res = snprintf(result, 499, "result/XPath/xptr/%s",
- baseFilename(globbuf.gl_pathv[i]));
+ res = snprintf(result, 499, "result/XPath/%s/%s",
+ subdir, baseFilename(globbuf.gl_pathv[i]));
if (res >= 499)
result[499] = 0;
res = xpathCommonTest(globbuf.gl_pathv[i], &result[0], 1, 0);
@@ -2927,7 +2936,7 @@ static int urip_rlen;
*/
static int
uripMatch(const char * URI) {
- if ((URI == NULL) || (!strcmp(URI, "file:///etc/xml/catalog")))
+ if ((URI == NULL) || (!strcmp(URI, "file://" SYSCONFDIR "/xml/catalog")))
return(0);
/* Verify we received the escaped URL */
if (strcmp(urip_rcvsURLs[urip_current], URI))
@@ -2946,7 +2955,7 @@ uripMatch(const char * URI) {
*/
static void *
uripOpen(const char * URI) {
- if ((URI == NULL) || (!strcmp(URI, "file:///etc/xml/catalog")))
+ if ((URI == NULL) || (!strcmp(URI, "file://" SYSCONFDIR "/xml/catalog")))
return(NULL);
/* Verify we received the escaped URL */
if (strcmp(urip_rcvsURLs[urip_current], URI))
@@ -3063,7 +3072,6 @@ static int
schemasOneTest(const char *sch,
const char *filename,
const char *result,
- const char *err,
int options,
xmlSchemaPtr schemas) {
xmlDocPtr doc;
@@ -3115,13 +3123,6 @@ schemasOneTest(const char *sch,
free(temp);
}
- if ((validResult != 0) && (err != NULL)) {
- if (compareFileMem(err, testErrors, testErrorsSize)) {
- fprintf(stderr, "Error for %s on %s failed\n", filename, sch);
- ret = 1;
- }
- }
-
xmlSchemaFreeValidCtxt(ctxt);
xmlFreeDoc(doc);
return(ret);
@@ -3148,6 +3149,7 @@ schemasTest(const char *filename,
xmlSchemaParserCtxtPtr ctxt;
xmlSchemaPtr schemas;
int res = 0, len, ret;
+ int parseErrorsSize;
char pattern[500];
char prefix[500];
char result[500];
@@ -3161,6 +3163,7 @@ schemasTest(const char *filename,
xmlSchemaSetParserErrors(ctxt, testErrorHandler, testErrorHandler, ctxt);
schemas = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
+ parseErrorsSize = testErrorsSize;
/*
* most of the mess is about the output filenames generated by the Makefile
@@ -3180,7 +3183,7 @@ schemasTest(const char *filename,
memcpy(prefix, base, len);
prefix[len] = 0;
- if (snprintf(pattern, 499, "./test/schemas/%s_?.xml", prefix) >= 499)
+ if (snprintf(pattern, 499, "./test/schemas/%s_*.xml", prefix) >= 499)
pattern[499] = 0;
if (base[len] == '_') {
@@ -3192,8 +3195,8 @@ schemasTest(const char *filename,
globbuf.gl_offs = 0;
glob(pattern, GLOB_DOOFFS, NULL, &globbuf);
for (i = 0;i < globbuf.gl_pathc;i++) {
- testErrorsSize = 0;
- testErrors[0] = 0;
+ testErrorsSize = parseErrorsSize;
+ testErrors[parseErrorsSize] = 0;
instance = globbuf.gl_pathv[i];
base2 = baseFilename(instance);
len = strlen(base2);
@@ -3211,14 +3214,17 @@ schemasTest(const char *filename,
fprintf(stderr, "don't know how to process %s\n", instance);
continue;
}
- if (schemas == NULL) {
- } else {
+ if (schemas != NULL) {
nb_tests++;
- ret = schemasOneTest(filename, instance, result, err,
- options, schemas);
+ ret = schemasOneTest(filename, instance, result, options, schemas);
if (ret != 0)
res = ret;
}
+ if (compareFileMem(err, testErrors, testErrorsSize)) {
+ fprintf(stderr, "Error for %s on %s failed\n", instance,
+ filename);
+ res = 1;
+ }
}
globfree(&globbuf);
xmlSchemaFree(schemas);
@@ -3235,7 +3241,6 @@ static int
rngOneTest(const char *sch,
const char *filename,
const char *result,
- const char *err,
int options,
xmlRelaxNGPtr schemas) {
xmlDocPtr doc;
@@ -3287,15 +3292,6 @@ rngOneTest(const char *sch,
free(temp);
}
- if (err != NULL) {
- if (compareFileMem(err, testErrors, testErrorsSize)) {
- fprintf(stderr, "Error for %s on %s failed\n", filename, sch);
- ret = 1;
- printf("%s", testErrors);
- }
- }
-
-
xmlRelaxNGFreeValidCtxt(ctxt);
xmlFreeDoc(doc);
return(ret);
@@ -3321,6 +3317,7 @@ rngTest(const char *filename,
xmlRelaxNGParserCtxtPtr ctxt;
xmlRelaxNGPtr schemas;
int res = 0, len, ret = 0;
+ int parseErrorsSize;
char pattern[500];
char prefix[500];
char result[500];
@@ -3334,6 +3331,10 @@ rngTest(const char *filename,
xmlRelaxNGSetParserErrors(ctxt, testErrorHandler, testErrorHandler, ctxt);
schemas = xmlRelaxNGParse(ctxt);
xmlRelaxNGFreeParserCtxt(ctxt);
+ if (schemas == NULL)
+ testErrorHandler(NULL, "Relax-NG schema %s failed to compile\n",
+ filename);
+ parseErrorsSize = testErrorsSize;
/*
* most of the mess is about the output filenames generated by the Makefile
@@ -3353,8 +3354,8 @@ rngTest(const char *filename,
globbuf.gl_offs = 0;
glob(pattern, GLOB_DOOFFS, NULL, &globbuf);
for (i = 0;i < globbuf.gl_pathc;i++) {
- testErrorsSize = 0;
- testErrors[0] = 0;
+ testErrorsSize = parseErrorsSize;
+ testErrors[parseErrorsSize] = 0;
instance = globbuf.gl_pathv[i];
base2 = baseFilename(instance);
len = strlen(base2);
@@ -3372,14 +3373,17 @@ rngTest(const char *filename,
fprintf(stderr, "don't know how to process %s\n", instance);
continue;
}
- if (schemas == NULL) {
- } else {
+ if (schemas != NULL) {
nb_tests++;
- res = rngOneTest(filename, instance, result, err,
- options, schemas);
+ res = rngOneTest(filename, instance, result, options, schemas);
if (res != 0)
ret = res;
}
+ if (compareFileMem(err, testErrors, testErrorsSize)) {
+ fprintf(stderr, "Error for %s on %s failed\n", instance,
+ filename);
+ res = 1;
+ }
}
globfree(&globbuf);
xmlRelaxNGFree(schemas);
@@ -3591,10 +3595,6 @@ patternTest(const char *filename,
fprintf(stderr, "Missing xml file %s\n", xml);
return(-1);
}
- if (!checkTestFile(result) && !update_results) {
- fprintf(stderr, "Missing result file %s\n", result);
- return(-1);
- }
f = fopen(filename, "rb");
if (f == NULL) {
fprintf(stderr, "Failed to open %s\n", filename);
@@ -3963,10 +3963,6 @@ c14nCommonTest(const char *filename, int with_comments, int mode,
if (snprintf(buf, 499, "result/c14n/%s/%s", subdir, prefix) >= 499)
buf[499] = 0;
- if (!checkTestFile(buf) && !update_results) {
- fprintf(stderr, "Missing result file %s", buf);
- return(-1);
- }
result = strdup(buf);
if (snprintf(buf, 499, "test/c14n/%s/%s.xpath", subdir, prefix) >= 499)
buf[499] = 0;
@@ -4178,58 +4174,6 @@ testThread(void)
return (res);
}
-#elif defined __BEOS__
-#include <OS.h>
-
-static thread_id tid[MAX_ARGC];
-
-static int
-testThread(void)
-{
- unsigned int i, repeat;
- status_t ret;
- int res = 0;
-
- xmlInitParser();
- for (repeat = 0; repeat < 500; repeat++) {
- xmlLoadCatalog(catalog);
- for (i = 0; i < num_threads; i++) {
- tid[i] = (thread_id) - 1;
- }
- for (i = 0; i < num_threads; i++) {
- tid[i] =
- spawn_thread(thread_specific_data, "xmlTestThread",
- B_NORMAL_PRIORITY, (void *) &threadParams[i]);
- if (tid[i] < B_OK) {
- fprintf(stderr, "beos_thread_create failed\n");
- return (1);
- }
- printf("beos_thread_create %d -> %d\n", i, tid[i]);
- }
- for (i = 0; i < num_threads; 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");
- return (1);
- }
- }
-
- xmlCatalogCleanup();
- ret = B_OK;
- for (i = 0; i < num_threads; i++)
- if (threadParams[i].okay == 0) {
- printf("Thread %d handling %s failed\n", i,
- threadParams[i].filename);
- ret = B_ERROR;
- }
- }
- if (ret != B_OK)
- return(1);
- return (0);
-}
-
#elif defined HAVE_PTHREAD_H
#include <pthread.h>
@@ -4297,6 +4241,354 @@ threadsTest(const char *filename ATTRIBUTE_UNUSED,
return(testThread());
}
#endif
+
+#if defined(LIBXML_REGEXP_ENABLED)
+/************************************************************************
+ * *
+ * Regexp tests *
+ * *
+ ************************************************************************/
+
+static void testRegexp(FILE *output, xmlRegexpPtr comp, const char *value) {
+ int ret;
+
+ ret = xmlRegexpExec(comp, (const xmlChar *) value);
+ if (ret == 1)
+ fprintf(output, "%s: Ok\n", value);
+ else if (ret == 0)
+ fprintf(output, "%s: Fail\n", value);
+ else
+ fprintf(output, "%s: Error: %d\n", value, ret);
+}
+
+static int
+regexpTest(const char *filename, const char *result, const char *err,
+ int options ATTRIBUTE_UNUSED) {
+ xmlRegexpPtr comp = NULL;
+ FILE *input, *output;
+ char *temp;
+ char expression[5000];
+ int len, ret, res = 0;
+
+ nb_tests++;
+
+ input = fopen(filename, "rb");
+ if (input == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Cannot open %s for reading\n", filename);
+ return(-1);
+ }
+ temp = resultFilename(filename, "", ".res");
+ if (temp == NULL) {
+ fprintf(stderr, "Out of memory\n");
+ fatalError();
+ }
+ output = fopen(temp, "wb");
+ if (output == NULL) {
+ fprintf(stderr, "failed to open output file %s\n", temp);
+ free(temp);
+ return(-1);
+ }
+ while (fgets(expression, 4500, input) != NULL) {
+ len = strlen(expression);
+ len--;
+ while ((len >= 0) &&
+ ((expression[len] == '\n') || (expression[len] == '\t') ||
+ (expression[len] == '\r') || (expression[len] == ' '))) len--;
+ expression[len + 1] = 0;
+ if (len >= 0) {
+ if (expression[0] == '#')
+ continue;
+ if ((expression[0] == '=') && (expression[1] == '>')) {
+ char *pattern = &expression[2];
+
+ if (comp != NULL) {
+ xmlRegFreeRegexp(comp);
+ comp = NULL;
+ }
+ fprintf(output, "Regexp: %s\n", pattern) ;
+ comp = xmlRegexpCompile((const xmlChar *) pattern);
+ if (comp == NULL) {
+ fprintf(output, " failed to compile\n");
+ break;
+ }
+ } else if (comp == NULL) {
+ fprintf(output, "Regexp: %s\n", expression) ;
+ comp = xmlRegexpCompile((const xmlChar *) expression);
+ if (comp == NULL) {
+ fprintf(output, " failed to compile\n");
+ break;
+ }
+ } else if (comp != NULL) {
+ testRegexp(output, comp, expression);
+ }
+ }
+ }
+ fclose(output);
+ fclose(input);
+ if (comp != NULL)
+ xmlRegFreeRegexp(comp);
+
+ ret = compareFiles(temp, result);
+ if (ret) {
+ fprintf(stderr, "Result for %s failed in %s\n", filename, result);
+ res = 1;
+ }
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
+
+ ret = compareFileMem(err, testErrors, testErrorsSize);
+ if (ret != 0) {
+ fprintf(stderr, "Error for %s failed\n", filename);
+ res = 1;
+ }
+
+ return(res);
+}
+
+#endif /* LIBXML_REGEXPS_ENABLED */
+
+#ifdef LIBXML_AUTOMATA_ENABLED
+/************************************************************************
+ * *
+ * Automata tests *
+ * *
+ ************************************************************************/
+
+static int scanNumber(char **ptr) {
+ int ret = 0;
+ char *cur;
+
+ cur = *ptr;
+ while ((*cur >= '0') && (*cur <= '9')) {
+ ret = ret * 10 + (*cur - '0');
+ cur++;
+ }
+ *ptr = cur;
+ return(ret);
+}
+
+static int
+automataTest(const char *filename, const char *result,
+ const char *err ATTRIBUTE_UNUSED, int options ATTRIBUTE_UNUSED) {
+ FILE *input, *output;
+ char *temp;
+ char expr[5000];
+ int len;
+ int ret;
+ int i;
+ int res = 0;
+ xmlAutomataPtr am;
+ xmlAutomataStatePtr states[1000];
+ xmlRegexpPtr regexp = NULL;
+ xmlRegExecCtxtPtr exec = NULL;
+
+ nb_tests++;
+
+ for (i = 0;i<1000;i++)
+ states[i] = NULL;
+
+ input = fopen(filename, "rb");
+ if (input == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Cannot open %s for reading\n", filename);
+ return(-1);
+ }
+ temp = resultFilename(filename, "", ".res");
+ if (temp == NULL) {
+ fprintf(stderr, "Out of memory\n");
+ fatalError();
+ }
+ output = fopen(temp, "wb");
+ if (output == NULL) {
+ fprintf(stderr, "failed to open output file %s\n", temp);
+ free(temp);
+ return(-1);
+ }
+
+ am = xmlNewAutomata();
+ if (am == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Cannot create automata\n");
+ fclose(input);
+ return(-1);
+ }
+ states[0] = xmlAutomataGetInitState(am);
+ if (states[0] == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Cannot get start state\n");
+ xmlFreeAutomata(am);
+ fclose(input);
+ return(-1);
+ }
+ ret = 0;
+
+ while (fgets(expr, 4500, input) != NULL) {
+ if (expr[0] == '#')
+ continue;
+ len = strlen(expr);
+ len--;
+ while ((len >= 0) &&
+ ((expr[len] == '\n') || (expr[len] == '\t') ||
+ (expr[len] == '\r') || (expr[len] == ' '))) len--;
+ expr[len + 1] = 0;
+ if (len >= 0) {
+ if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) {
+ char *ptr = &expr[2];
+ int from, to;
+
+ from = scanNumber(&ptr);
+ if (*ptr != ' ') {
+ xmlGenericError(xmlGenericErrorContext,
+ "Bad line %s\n", expr);
+ break;
+ }
+ if (states[from] == NULL)
+ states[from] = xmlAutomataNewState(am);
+ ptr++;
+ to = scanNumber(&ptr);
+ if (*ptr != ' ') {
+ xmlGenericError(xmlGenericErrorContext,
+ "Bad line %s\n", expr);
+ break;
+ }
+ if (states[to] == NULL)
+ states[to] = xmlAutomataNewState(am);
+ ptr++;
+ xmlAutomataNewTransition(am, states[from], states[to],
+ BAD_CAST ptr, NULL);
+ } else if ((am != NULL) && (expr[0] == 'e') && (expr[1] == ' ')) {
+ char *ptr = &expr[2];
+ int from, to;
+
+ from = scanNumber(&ptr);
+ if (*ptr != ' ') {
+ xmlGenericError(xmlGenericErrorContext,
+ "Bad line %s\n", expr);
+ break;
+ }
+ if (states[from] == NULL)
+ states[from] = xmlAutomataNewState(am);
+ ptr++;
+ to = scanNumber(&ptr);
+ if (states[to] == NULL)
+ states[to] = xmlAutomataNewState(am);
+ xmlAutomataNewEpsilon(am, states[from], states[to]);
+ } else if ((am != NULL) && (expr[0] == 'f') && (expr[1] == ' ')) {
+ char *ptr = &expr[2];
+ int state;
+
+ state = scanNumber(&ptr);
+ if (states[state] == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Bad state %d : %s\n", state, expr);
+ break;
+ }
+ xmlAutomataSetFinalState(am, states[state]);
+ } else if ((am != NULL) && (expr[0] == 'c') && (expr[1] == ' ')) {
+ char *ptr = &expr[2];
+ int from, to;
+ int min, max;
+
+ from = scanNumber(&ptr);
+ if (*ptr != ' ') {
+ xmlGenericError(xmlGenericErrorContext,
+ "Bad line %s\n", expr);
+ break;
+ }
+ if (states[from] == NULL)
+ states[from] = xmlAutomataNewState(am);
+ ptr++;
+ to = scanNumber(&ptr);
+ if (*ptr != ' ') {
+ xmlGenericError(xmlGenericErrorContext,
+ "Bad line %s\n", expr);
+ break;
+ }
+ if (states[to] == NULL)
+ states[to] = xmlAutomataNewState(am);
+ ptr++;
+ min = scanNumber(&ptr);
+ if (*ptr != ' ') {
+ xmlGenericError(xmlGenericErrorContext,
+ "Bad line %s\n", expr);
+ break;
+ }
+ ptr++;
+ max = scanNumber(&ptr);
+ if (*ptr != ' ') {
+ xmlGenericError(xmlGenericErrorContext,
+ "Bad line %s\n", expr);
+ break;
+ }
+ ptr++;
+ xmlAutomataNewCountTrans(am, states[from], states[to],
+ BAD_CAST ptr, min, max, NULL);
+ } else if ((am != NULL) && (expr[0] == '-') && (expr[1] == '-')) {
+ /* end of the automata */
+ regexp = xmlAutomataCompile(am);
+ xmlFreeAutomata(am);
+ am = NULL;
+ if (regexp == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "Failed to compile the automata");
+ break;
+ }
+ } else if ((expr[0] == '=') && (expr[1] == '>')) {
+ if (regexp == NULL) {
+ fprintf(output, "=> failed not compiled\n");
+ } else {
+ if (exec == NULL)
+ exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
+ if (ret == 0) {
+ ret = xmlRegExecPushString(exec, NULL, NULL);
+ }
+ if (ret == 1)
+ fprintf(output, "=> Passed\n");
+ else if ((ret == 0) || (ret == -1))
+ fprintf(output, "=> Failed\n");
+ else if (ret < 0)
+ fprintf(output, "=> Error\n");
+ xmlRegFreeExecCtxt(exec);
+ exec = NULL;
+ }
+ ret = 0;
+ } else if (regexp != NULL) {
+ if (exec == NULL)
+ exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
+ ret = xmlRegExecPushString(exec, BAD_CAST expr, NULL);
+ } else {
+ xmlGenericError(xmlGenericErrorContext,
+ "Unexpected line %s\n", expr);
+ }
+ }
+ }
+ fclose(output);
+ fclose(input);
+ if (regexp != NULL)
+ xmlRegFreeRegexp(regexp);
+ if (exec != NULL)
+ xmlRegFreeExecCtxt(exec);
+ if (am != NULL)
+ xmlFreeAutomata(am);
+
+ ret = compareFiles(temp, result);
+ if (ret) {
+ fprintf(stderr, "Result for %s failed in %s\n", filename, result);
+ res = 1;
+ }
+ if (temp != NULL) {
+ unlink(temp);
+ free(temp);
+ }
+
+ return(res);
+}
+
+#endif /* LIBXML_AUTOMATA_ENABLED */
+
/************************************************************************
* *
* Tests Descriptions *
@@ -4434,6 +4726,11 @@ testDesc testDescriptions[] = {
#ifdef LIBXML_XPTR_ENABLED
{ "XPointer document queries regression tests" ,
xptrDocTest, "./test/XPath/docs/*", NULL, NULL, NULL,
+ -1 },
+#endif
+#ifdef LIBXML_XPTR_LOCS_ENABLED
+ { "XPointer xpointer() queries regression tests" ,
+ xptrDocTest, "./test/XPath/docs/*", NULL, NULL, NULL,
0 },
#endif
#ifdef LIBXML_VALID_ENABLED
@@ -4491,6 +4788,19 @@ testDesc testDescriptions[] = {
threadsTest, NULL, NULL, NULL, NULL,
0 },
#endif
+ { "SVG parsing regression tests" ,
+ oldParseTest, "./test/SVG/*.xml", "result/SVG/", "", NULL,
+ 0 },
+#if defined(LIBXML_REGEXP_ENABLED)
+ { "Regexp regression tests" ,
+ regexpTest, "./test/regexp/*", "result/regexp/", "", ".err",
+ 0 },
+#endif
+#if defined(LIBXML_AUTOMATA_ENABLED)
+ { "Automata regression tests" ,
+ automataTest, "./test/automata/*", "result/automata/", "", NULL,
+ 0 },
+#endif
{NULL, NULL, NULL, NULL, NULL, NULL, 0}
};
@@ -4546,35 +4856,29 @@ launchTests(testDescPtr tst) {
} else {
error = NULL;
}
- if ((result) &&(!checkTestFile(result)) && !update_results) {
- fprintf(stderr, "Missing result file %s\n", result);
- } else if ((error) &&(!checkTestFile(error)) && !update_results) {
- fprintf(stderr, "Missing error file %s\n", error);
- } else {
- mem = xmlMemUsed();
- extraMemoryFromResolver = 0;
- testErrorsSize = 0;
- testErrors[0] = 0;
- res = tst->func(globbuf.gl_pathv[i], result, error,
- tst->options | XML_PARSE_COMPACT);
- xmlResetLastError();
- if (res != 0) {
- fprintf(stderr, "File %s generated an error\n",
- globbuf.gl_pathv[i]);
- nb_errors++;
- err++;
- }
- else if (xmlMemUsed() != mem) {
- if ((xmlMemUsed() != mem) &&
- (extraMemoryFromResolver == 0)) {
- fprintf(stderr, "File %s leaked %d bytes\n",
- globbuf.gl_pathv[i], xmlMemUsed() - mem);
- nb_leaks++;
- err++;
- }
- }
- testErrorsSize = 0;
- }
+ mem = xmlMemUsed();
+ extraMemoryFromResolver = 0;
+ testErrorsSize = 0;
+ testErrors[0] = 0;
+ res = tst->func(globbuf.gl_pathv[i], result, error,
+ tst->options | XML_PARSE_COMPACT);
+ xmlResetLastError();
+ if (res != 0) {
+ fprintf(stderr, "File %s generated an error\n",
+ globbuf.gl_pathv[i]);
+ nb_errors++;
+ err++;
+ }
+ else if (xmlMemUsed() != mem) {
+ if ((xmlMemUsed() != mem) &&
+ (extraMemoryFromResolver == 0)) {
+ fprintf(stderr, "File %s leaked %d bytes\n",
+ globbuf.gl_pathv[i], xmlMemUsed() - mem);
+ nb_leaks++;
+ err++;
+ }
+ }
+ testErrorsSize = 0;
if (result)
free(result);
if (error)
@@ -4684,6 +4988,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
int
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
fprintf(stderr, "runtest requires output to be enabled in libxml2\n");
- return(1);
+ return(0);
}
#endif
diff --git a/chromium/third_party/libxml/src/runxmlconf.c b/chromium/third_party/libxml/src/runxmlconf.c
index 7196c28a99c..69ce39fc4a8 100644
--- a/chromium/third_party/libxml/src/runxmlconf.c
+++ b/chromium/third_party/libxml/src/runxmlconf.c
@@ -15,7 +15,6 @@
#include <unistd.h>
#endif
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -601,7 +600,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
#else /* ! LIBXML_XPATH_ENABLED */
#include <stdio.h>
int
-main(int argc, char **argv) {
+main(int argc ATTRIBUTE_UNUSED, char **argv) {
fprintf(stderr, "%s need XPath support\n", argv[0]);
}
#endif
diff --git a/chromium/third_party/libxml/src/testThreads.c b/chromium/third_party/libxml/src/testThreads.c
index bef6537744b..0714deba8a9 100644
--- a/chromium/third_party/libxml/src/testThreads.c
+++ b/chromium/third_party/libxml/src/testThreads.c
@@ -10,10 +10,8 @@
#include <libxml/catalog.h>
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
-#elif defined HAVE_WIN32_THREADS
+#elif defined(_WIN32)
#include <windows.h>
-#elif defined HAVE_BEOS_THREADS
-#include <OS.h>
#endif
#include <string.h>
#if !defined(_MSC_VER)
@@ -25,10 +23,8 @@
#define TEST_REPEAT_COUNT 500
#ifdef HAVE_PTHREAD_H
static pthread_t tid[MAX_ARGC];
-#elif defined HAVE_WIN32_THREADS
+#elif defined(_WIN32)
static HANDLE tid[MAX_ARGC];
-#elif defined HAVE_BEOS_THREADS
-static thread_id tid[MAX_ARGC];
#endif
typedef struct {
@@ -145,7 +141,7 @@ main(void)
xmlMemoryDump();
return (0);
}
-#elif defined HAVE_WIN32_THREADS
+#elif defined(_WIN32)
static DWORD WINAPI
win32_thread_specific_data(void *private_data)
{
@@ -209,61 +205,7 @@ main(void)
return (0);
}
-#elif defined HAVE_BEOS_THREADS
-int
-main(void)
-{
- unsigned int i, repeat;
- status_t ret;
-
- xmlInitParser();
- printf("Parser initialized\n");
- for (repeat = 0;repeat < TEST_REPEAT_COUNT;repeat++) {
- printf("repeat: %d\n",repeat);
- xmlLoadCatalog(catalog);
- printf("loaded catalog: %s\n", catalog);
- for (i = 0; i < num_threads; i++) {
- tid[i] = (thread_id) -1;
- }
- printf("cleaned threads\n");
- for (i = 0; i < num_threads; i++) {
- tid[i] = spawn_thread(thread_specific_data, "xmlTestThread", B_NORMAL_PRIORITY, (void *) &threadParams[i]);
- if (tid[i] < B_OK) {
- perror("beos_thread_create");
- exit(1);
- }
- printf("beos_thread_create %d -> %d\n", i, tid[i]);
- }
- for (i = 0; i < num_threads; i++) {
- void *result;
- ret = wait_for_thread(tid[i], &result);
- printf("beos_thread_wait %d -> %d\n", i, ret);
- if (ret != B_OK) {
- perror("beos_thread_wait");
- exit(1);
- }
- }
-
- xmlCatalogCleanup();
- ret = B_OK;
- for (i = 0; i < num_threads; i++)
- if (threadParams[i].okay == 0) {
- printf("Thread %d handling %s failed\n", i,
- threadParams[i].filename);
- ret = B_ERROR;
- }
- }
- xmlCleanupParser();
- xmlMemoryDump();
-
- if (ret == B_OK)
- printf("testThread : BeOS : SUCCESS!\n");
- else
- printf("testThread : BeOS : FAILED!\n");
-
- return (0);
-}
-#endif /* pthreads or BeOS threads */
+#endif /* pthreads */
#else /* !LIBXML_THREADS_ENABLED */
int
diff --git a/chromium/third_party/libxml/src/testapi.c b/chromium/third_party/libxml/src/testapi.c
index 54a8092bb60..2701f27fc33 100644
--- a/chromium/third_party/libxml/src/testapi.c
+++ b/chromium/third_party/libxml/src/testapi.c
@@ -124,6 +124,14 @@ int main(int argc, char **argv) {
int ret;
int blocks, mem;
+#if defined(_WIN32)
+ setvbuf(stdout, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
+
+ printf("Skipping on Windows for now\n");
+ return(0);
+#endif
+
#ifdef HAVE_PUTENV
/* access to the proxy can slow up regression tests a lot */
putenv((char *) "http_proxy=");
@@ -142,6 +150,7 @@ int main(int argc, char **argv) {
LIBXML_TEST_VERSION
xmlSetStructuredErrorFunc(NULL, structured_errors);
+ xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader);
if (argc >= 2) {
if (!strcmp(argv[1], "-q")) {
@@ -309,6 +318,8 @@ static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
+#ifdef LIBXML_SCHEMAS_ENABLED
+
#define gen_nb_unsigned_long 4
static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
@@ -321,6 +332,20 @@ static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
+#define gen_nb_unsigned_long_ptr 2
+
+static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
+ if (no == 0) return(&longtab[nr]);
+ return(NULL);
+}
+
+static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
+}
+
+#endif /* LIBXML_SCHEMAS_ENABLED */
+
+#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
+
#define gen_nb_double 4
static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
@@ -335,15 +360,7 @@ static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
-#define gen_nb_unsigned_long_ptr 2
-
-static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
- if (no == 0) return(&longtab[nr]);
- return(NULL);
-}
-
-static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#endif /* defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
#define gen_nb_int_ptr 2
@@ -434,7 +451,7 @@ static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSE
#define gen_nb_fileoutput 6
static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
- if (no == 0) return("/missing.xml");
+ if (no == 0) return("missing/dir/missing.xml");
if (no == 1) return("<foo/>");
if (no == 2) return(REMOTE2GOOD);
if (no == 3) return(REMOTE1GOOD);
@@ -457,6 +474,7 @@ static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val,
#define gen_nb_xmlSAXHandlerPtr 2
static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
+ (void) no;
#ifdef LIBXML_SAX1_ENABLED
if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
#endif
@@ -467,12 +485,14 @@ static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val A
#define gen_nb_xmlValidCtxtPtr 2
static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
+ (void) no;
#ifdef LIBXML_VALID_ENABLED
if (no == 0) return(xmlNewValidCtxt());
#endif
return(NULL);
}
static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
+ (void) val;
#ifdef LIBXML_VALID_ENABLED
if (val != NULL)
xmlFreeValidCtxt(val);
@@ -665,21 +685,6 @@ static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr v
}
#endif
-#ifdef LIBXML_FTP_ENABLED
-#define gen_nb_xmlNanoFTPCtxtPtr 4
-static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
- if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD));
- if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD));
- if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
- return(NULL);
-}
-static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
- if (val != NULL) {
- xmlNanoFTPFreeCtxt(val);
- }
-}
-#endif
-
#ifdef LIBXML_HTTP_ENABLED
#define gen_nb_xmlNanoHTTPCtxtPtr 1
static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
@@ -762,8 +767,10 @@ static void desret_long(long val ATTRIBUTE_UNUSED) {
}
static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
}
+#if defined(LIBXML_XPATH_ENABLED)
static void desret_double(double val ATTRIBUTE_UNUSED) {
}
+#endif
static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
}
#if 0
@@ -874,11 +881,6 @@ static void desret_xmlNanoHTTPCtxtPtr(void *val) {
xmlNanoHTTPClose(val);
}
#endif
-#ifdef LIBXML_FTP_ENABLED
-static void desret_xmlNanoFTPCtxtPtr(void *val) {
- xmlNanoFTPClose(val);
-}
-#endif
/* cut and pasted from autogenerated to avoid troubles */
#define gen_nb_const_xmlChar_ptr_ptr 1
static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
@@ -993,12 +995,15 @@ static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeIn
static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
}
+#if defined(LIBXML_MODULES_ENABLED) || defined(LIBXML_READER_ENABLED) || \
+ defined(LIBXML_SCHEMAS_ENABLED)
#define gen_nb_void_ptr_ptr 1
static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
+#endif
/************************************************************************
* *
@@ -1172,7 +1177,6 @@ static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaW
#include <libxml/entities.h>
#include <libxml/hash.h>
#include <libxml/list.h>
-#include <libxml/nanoftp.h>
#include <libxml/nanohttp.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
@@ -1211,7 +1215,6 @@ static int test_encoding(void);
static int test_entities(void);
static int test_hash(void);
static int test_list(void);
-static int test_nanoftp(void);
static int test_nanohttp(void);
static int test_parser(void);
static int test_parserInternals(void);
@@ -1264,7 +1267,6 @@ testlibxml2(void)
test_ret += test_entities();
test_ret += test_hash();
test_ret += test_list();
- test_ret += test_nanoftp();
test_ret += test_nanohttp();
test_ret += test_parser();
test_ret += test_parserInternals();
@@ -1355,11 +1357,8 @@ test_UTF8ToHtml(void) {
#ifdef LIBXML_HTML_ENABLED
#define gen_nb_const_htmlElemDesc_ptr 1
-static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_htmlElemDesc_ptr(no, nr) NULL
+#define des_const_htmlElemDesc_ptr(no, val, nr)
#endif
@@ -1413,11 +1412,8 @@ test_htmlAttrAllowed(void) {
#ifdef LIBXML_HTML_ENABLED
#define gen_nb_htmlNodePtr 1
-static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_htmlNodePtr(no, nr) NULL
+#define des_htmlNodePtr(no, val, nr)
#endif
@@ -1470,6 +1466,47 @@ test_htmlAutoCloseTag(void) {
static int
+test_htmlCreateFileParserCtxt(void) {
+ int test_ret = 0;
+
+#if defined(LIBXML_HTML_ENABLED)
+ int mem_base;
+ htmlParserCtxtPtr ret_val;
+ const char * filename; /* the filename */
+ int n_filename;
+ char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
+ int n_encoding;
+
+ for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
+ for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
+ mem_base = xmlMemBlocks();
+ filename = gen_fileoutput(n_filename, 0);
+ encoding = gen_const_char_ptr(n_encoding, 1);
+
+ ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
+ desret_htmlParserCtxtPtr(ret_val);
+ call_tests++;
+ des_fileoutput(n_filename, filename, 0);
+ des_const_char_ptr(n_encoding, (const char *)encoding, 1);
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf(" %d", n_filename);
+ printf(" %d", n_encoding);
+ printf("\n");
+ }
+ }
+ }
+ function_tests++;
+#endif
+
+ return(test_ret);
+}
+
+
+static int
test_htmlCreateMemoryParserCtxt(void) {
int test_ret = 0;
@@ -1515,11 +1552,8 @@ test_htmlCreateMemoryParserCtxt(void) {
#ifdef LIBXML_HTML_ENABLED
#define gen_nb_htmlSAXHandlerPtr 1
-static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_htmlSAXHandlerPtr(no, nr) NULL
+#define des_htmlSAXHandlerPtr(no, val, nr)
#endif
@@ -2092,6 +2126,31 @@ test_htmlHandleOmittedElem(void) {
static int
+test_htmlInitAutoClose(void) {
+ int test_ret = 0;
+
+#if defined(LIBXML_HTML_ENABLED)
+ int mem_base;
+
+ mem_base = xmlMemBlocks();
+
+ htmlInitAutoClose();
+ call_tests++;
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in htmlInitAutoClose",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf("\n");
+ }
+ function_tests++;
+#endif
+
+ return(test_ret);
+}
+
+
+static int
test_htmlIsAutoClosed(void) {
int test_ret = 0;
@@ -2194,6 +2253,47 @@ test_htmlNewParserCtxt(void) {
static int
+test_htmlNewSAXParserCtxt(void) {
+ int test_ret = 0;
+
+#if defined(LIBXML_HTML_ENABLED)
+ int mem_base;
+ htmlParserCtxtPtr ret_val;
+ htmlSAXHandlerPtr sax; /* SAX handler */
+ int n_sax;
+ void * userData; /* user data */
+ int n_userData;
+
+ for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
+ for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
+ mem_base = xmlMemBlocks();
+ sax = gen_htmlSAXHandlerPtr(n_sax, 0);
+ userData = gen_userdata(n_userData, 1);
+
+ ret_val = htmlNewSAXParserCtxt(sax, userData);
+ desret_htmlParserCtxtPtr(ret_val);
+ call_tests++;
+ des_htmlSAXHandlerPtr(n_sax, sax, 0);
+ des_userdata(n_userData, userData, 1);
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in htmlNewSAXParserCtxt",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf(" %d", n_sax);
+ printf(" %d", n_userData);
+ printf("\n");
+ }
+ }
+ }
+ function_tests++;
+#endif
+
+ return(test_ret);
+}
+
+
+static int
test_htmlNodeStatus(void) {
int test_ret = 0;
@@ -2798,10 +2898,11 @@ static int
test_HTMLparser(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n");
+ if (quiet == 0) printf("Testing HTMLparser : 35 of 41 functions ...\n");
test_ret += test_UTF8ToHtml();
test_ret += test_htmlAttrAllowed();
test_ret += test_htmlAutoCloseTag();
+ test_ret += test_htmlCreateFileParserCtxt();
test_ret += test_htmlCreateMemoryParserCtxt();
test_ret += test_htmlCreatePushParserCtxt();
test_ret += test_htmlCtxtReadDoc();
@@ -2815,9 +2916,11 @@ test_HTMLparser(void) {
test_ret += test_htmlEntityLookup();
test_ret += test_htmlEntityValueLookup();
test_ret += test_htmlHandleOmittedElem();
+ test_ret += test_htmlInitAutoClose();
test_ret += test_htmlIsAutoClosed();
test_ret += test_htmlIsScriptAttribute();
test_ret += test_htmlNewParserCtxt();
+ test_ret += test_htmlNewSAXParserCtxt();
test_ret += test_htmlNodeStatus();
test_ret += test_htmlParseCharRef();
test_ret += test_htmlParseChunk();
@@ -2979,11 +3082,8 @@ test_htmlDocDump(void) {
#define gen_nb_xmlChar_ptr_ptr 1
-static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlChar_ptr_ptr(no, nr) NULL
+#define des_xmlChar_ptr_ptr(no, val, nr)
static int
test_htmlDocDumpMemory(void) {
@@ -3717,33 +3817,6 @@ test_HTMLtree(void) {
}
static int
-test_docbDefaultSAXHandlerInit(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_DOCB_ENABLED)
-#ifdef LIBXML_DOCB_ENABLED
- int mem_base;
-
- mem_base = xmlMemBlocks();
-
- docbDefaultSAXHandlerInit();
- call_tests++;
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf("\n");
- }
- function_tests++;
-#endif
-#endif
-
- return(test_ret);
-}
-
-
-static int
test_htmlDefaultSAXHandlerInit(void) {
int test_ret = 0;
@@ -3794,11 +3867,8 @@ test_xmlDefaultSAXHandlerInit(void) {
#define gen_nb_xmlEnumerationPtr 1
-static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlEnumerationPtr(no, nr) NULL
+#define des_xmlEnumerationPtr(no, val, nr)
static int
test_xmlSAX2AttributeDecl(void) {
@@ -4088,7 +4158,7 @@ static int
test_xmlSAX2EndElement(void) {
int test_ret = 0;
-#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
+#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_SAX1_ENABLED
int mem_base;
void * ctx; /* the user data (XML parser context) */
@@ -4610,11 +4680,8 @@ test_xmlSAX2IgnorableWhitespace(void) {
#define gen_nb_xmlSAXHandler_ptr 1
-static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSAXHandler_ptr(no, nr) NULL
+#define des_xmlSAXHandler_ptr(no, val, nr)
static int
test_xmlSAX2InitDefaultSAXHandler(void) {
@@ -4654,38 +4721,6 @@ test_xmlSAX2InitDefaultSAXHandler(void) {
static int
-test_xmlSAX2InitDocbDefaultSAXHandler(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_DOCB_ENABLED)
- int mem_base;
- xmlSAXHandler * hdlr; /* the SAX handler */
- int n_hdlr;
-
- for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
- mem_base = xmlMemBlocks();
- hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
-
- xmlSAX2InitDocbDefaultSAXHandler(hdlr);
- call_tests++;
- des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_hdlr);
- printf("\n");
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
int test_ret = 0;
@@ -4979,11 +5014,8 @@ test_xmlSAX2ResolveEntity(void) {
#define gen_nb_xmlSAXLocatorPtr 1
-static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSAXLocatorPtr(no, nr) NULL
+#define des_xmlSAXLocatorPtr(no, val, nr)
static int
test_xmlSAX2SetDocumentLocator(void) {
@@ -5056,7 +5088,7 @@ static int
test_xmlSAX2StartElement(void) {
int test_ret = 0;
-#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
+#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_SAX1_ENABLED
int mem_base;
void * ctx; /* the user data (XML parser context) */
@@ -5322,8 +5354,7 @@ static int
test_SAX2(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
- test_ret += test_docbDefaultSAXHandlerInit();
+ if (quiet == 0) printf("Testing SAX2 : 36 of 36 functions ...\n");
test_ret += test_htmlDefaultSAXHandlerInit();
test_ret += test_xmlDefaultSAXHandlerInit();
test_ret += test_xmlSAX2AttributeDecl();
@@ -5346,7 +5377,6 @@ test_SAX2(void) {
test_ret += test_xmlSAX2HasInternalSubset();
test_ret += test_xmlSAX2IgnorableWhitespace();
test_ret += test_xmlSAX2InitDefaultSAXHandler();
- test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
test_ret += test_xmlSAX2InternalSubset();
test_ret += test_xmlSAX2IsStandalone();
@@ -5607,11 +5637,8 @@ test_c14n(void) {
#ifdef LIBXML_CATALOG_ENABLED
#define gen_nb_xmlCatalogPtr 1
-static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlCatalogPtr(no, nr) NULL
+#define des_xmlCatalogPtr(no, val, nr)
#endif
@@ -6623,11 +6650,8 @@ test_catalog(void) {
}
#define gen_nb_const_xmlChRangeGroup_ptr 1
-static xmlChRangeGroup * gen_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroup * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlChRangeGroup_ptr(no, nr) NULL
+#define des_const_xmlChRangeGroup_ptr(no, val, nr)
static int
test_xmlCharInRange(void) {
@@ -7527,11 +7551,8 @@ test_xmlShell(void) {
#define gen_nb_char_ptr 1
-static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_char_ptr(no, nr) NULL
+#define des_char_ptr(no, val, nr)
static int
test_xmlShellBase(void) {
@@ -8686,11 +8707,8 @@ test_xmlAddEncodingAlias(void) {
#define gen_nb_xmlCharEncodingHandler_ptr 1
-static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlCharEncodingHandler_ptr(no, nr) NULL
+#define des_xmlCharEncodingHandler_ptr(no, val, nr)
static int
test_xmlCharEncCloseFunc(void) {
@@ -9113,11 +9131,8 @@ test_xmlParseCharEncoding(void) {
#define gen_nb_xmlCharEncodingHandlerPtr 1
-static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlCharEncodingHandlerPtr(no, nr) NULL
+#define des_xmlCharEncodingHandlerPtr(no, val, nr)
static int
test_xmlRegisterCharEncodingHandler(void) {
@@ -9333,11 +9348,8 @@ test_xmlCreateEntitiesTable(void) {
#define gen_nb_xmlEntitiesTablePtr 1
-static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlEntitiesTablePtr(no, nr) NULL
+#define des_xmlEntitiesTablePtr(no, val, nr)
static int
test_xmlDumpEntitiesTable(void) {
@@ -9379,11 +9391,8 @@ test_xmlDumpEntitiesTable(void) {
#define gen_nb_xmlEntityPtr 1
-static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlEntityPtr(no, nr) NULL
+#define des_xmlEntityPtr(no, val, nr)
static int
test_xmlDumpEntityDecl(void) {
@@ -9464,11 +9473,8 @@ test_xmlEncodeEntitiesReentrant(void) {
#define gen_nb_const_xmlDoc_ptr 1
-static xmlDoc * gen_const_xmlDoc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlDoc_ptr(int no ATTRIBUTE_UNUSED, const xmlDoc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlDoc_ptr(no, nr) NULL
+#define des_const_xmlDoc_ptr(no, val, nr)
static int
test_xmlEncodeSpecialChars(void) {
@@ -10738,11 +10744,8 @@ test_hash(void) {
}
#define gen_nb_xmlLinkPtr 1
-static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlLinkPtr(no, nr) NULL
+#define des_xmlLinkPtr(no, val, nr)
static int
test_xmlLinkGetData(void) {
@@ -10846,11 +10849,8 @@ test_xmlListClear(void) {
#define gen_nb_const_xmlListPtr 1
-static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlListPtr(no, nr) NULL
+#define des_const_xmlListPtr(no, val, nr)
static int
test_xmlListCopy(void) {
@@ -11520,569 +11520,6 @@ test_list(void) {
}
static int
-test_xmlNanoFTPCheckResponse(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
-
- ret_val = xmlNanoFTPCheckResponse(ctx);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf("\n");
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPCleanup(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
-
- mem_base = xmlMemBlocks();
-
- xmlNanoFTPCleanup();
- call_tests++;
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPCleanup",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf("\n");
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPCloseConnection(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
-
- ret_val = xmlNanoFTPCloseConnection(ctx);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf("\n");
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPCwd(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
- char * directory; /* a directory on the server */
- int n_directory;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
- directory = gen_const_char_ptr(n_directory, 1);
-
- ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- des_const_char_ptr(n_directory, (const char *)directory, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPCwd",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf(" %d", n_directory);
- printf("\n");
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPDele(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
- const char * file; /* a file or directory on the server */
- int n_file;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
- file = gen_filepath(n_file, 1);
-
- ret_val = xmlNanoFTPDele(ctx, file);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- des_filepath(n_file, file, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPDele",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf(" %d", n_file);
- printf("\n");
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPGet(void) {
- int test_ret = 0;
-
-
- /* missing type support */
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPGetConnection(void) {
- int test_ret = 0;
-
-
- /* missing type support */
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPGetResponse(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
-
- ret_val = xmlNanoFTPGetResponse(ctx);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf("\n");
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPGetSocket(void) {
- int test_ret = 0;
-
-
- /* missing type support */
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPInit(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
-
- mem_base = xmlMemBlocks();
-
- xmlNanoFTPInit();
- call_tests++;
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPInit",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf("\n");
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPList(void) {
- int test_ret = 0;
-
-
- /* missing type support */
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPNewCtxt(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- void * ret_val;
- const char * URL; /* The URL used to initialize the context */
- int n_URL;
-
- for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
- mem_base = xmlMemBlocks();
- URL = gen_filepath(n_URL, 0);
-
- ret_val = xmlNanoFTPNewCtxt(URL);
- desret_xmlNanoFTPCtxtPtr(ret_val);
- call_tests++;
- des_filepath(n_URL, URL, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPNewCtxt",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_URL);
- printf("\n");
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPOpen(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- void * ret_val;
- const char * URL; /* the URL to the resource */
- int n_URL;
-
- for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
- mem_base = xmlMemBlocks();
- URL = gen_filepath(n_URL, 0);
-
- ret_val = xmlNanoFTPOpen(URL);
- desret_xmlNanoFTPCtxtPtr(ret_val);
- call_tests++;
- des_filepath(n_URL, URL, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPOpen",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_URL);
- printf("\n");
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPProxy(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- char * host; /* the proxy host name */
- int n_host;
- int port; /* the proxy port */
- int n_port;
- char * user; /* the proxy user name */
- int n_user;
- char * passwd; /* the proxy password */
- int n_passwd;
- int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
- int n_type;
-
- for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
- for (n_port = 0;n_port < gen_nb_int;n_port++) {
- for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
- for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
- for (n_type = 0;n_type < gen_nb_int;n_type++) {
- host = gen_const_char_ptr(n_host, 0);
- port = gen_int(n_port, 1);
- user = gen_const_char_ptr(n_user, 2);
- passwd = gen_const_char_ptr(n_passwd, 3);
- type = gen_int(n_type, 4);
-
- xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
- call_tests++;
- des_const_char_ptr(n_host, (const char *)host, 0);
- des_int(n_port, port, 1);
- des_const_char_ptr(n_user, (const char *)user, 2);
- des_const_char_ptr(n_passwd, (const char *)passwd, 3);
- des_int(n_type, type, 4);
- xmlResetLastError();
- }
- }
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPQuit(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
-
- ret_val = xmlNanoFTPQuit(ctx);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPQuit",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf("\n");
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPRead(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* the FTP context */
- int n_ctx;
- void * dest; /* a buffer */
- int n_dest;
- int len; /* the buffer length */
- int n_len;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
- for (n_len = 0;n_len < gen_nb_int;n_len++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
- dest = gen_void_ptr(n_dest, 1);
- len = gen_int(n_len, 2);
-
- ret_val = xmlNanoFTPRead(ctx, dest, len);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- des_void_ptr(n_dest, dest, 1);
- des_int(n_len, len, 2);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPRead",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf(" %d", n_dest);
- printf(" %d", n_len);
- printf("\n");
- }
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPScanProxy(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- const char * URL; /* The proxy URL used to initialize the proxy context */
- int n_URL;
-
- for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
- URL = gen_filepath(n_URL, 0);
-
- xmlNanoFTPScanProxy(URL);
- call_tests++;
- des_filepath(n_URL, URL, 0);
- xmlResetLastError();
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlNanoFTPUpdateURL(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
- const char * URL; /* The URL used to update the context */
- int n_URL;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
- URL = gen_filepath(n_URL, 1);
-
- ret_val = xmlNanoFTPUpdateURL(ctx, URL);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- des_filepath(n_URL, URL, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf(" %d", n_URL);
- printf("\n");
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-static int
-test_nanoftp(void) {
- int test_ret = 0;
-
- if (quiet == 0) printf("Testing nanoftp : 14 of 22 functions ...\n");
- test_ret += test_xmlNanoFTPCheckResponse();
- test_ret += test_xmlNanoFTPCleanup();
- test_ret += test_xmlNanoFTPCloseConnection();
- test_ret += test_xmlNanoFTPCwd();
- test_ret += test_xmlNanoFTPDele();
- test_ret += test_xmlNanoFTPGet();
- test_ret += test_xmlNanoFTPGetConnection();
- test_ret += test_xmlNanoFTPGetResponse();
- test_ret += test_xmlNanoFTPGetSocket();
- test_ret += test_xmlNanoFTPInit();
- test_ret += test_xmlNanoFTPList();
- test_ret += test_xmlNanoFTPNewCtxt();
- test_ret += test_xmlNanoFTPOpen();
- test_ret += test_xmlNanoFTPProxy();
- test_ret += test_xmlNanoFTPQuit();
- test_ret += test_xmlNanoFTPRead();
- test_ret += test_xmlNanoFTPScanProxy();
- test_ret += test_xmlNanoFTPUpdateURL();
-
- if (test_ret != 0)
- printf("Module nanoftp: %d errors\n", test_ret);
- return(test_ret);
-}
-
-static int
test_xmlNanoHTTPAuthHeader(void) {
int test_ret = 0;
@@ -12210,11 +11647,8 @@ test_xmlNanoHTTPEncoding(void) {
#define gen_nb_char_ptr_ptr 1
-static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_char_ptr_ptr(no, nr) NULL
+#define des_char_ptr_ptr(no, val, nr)
static int
test_xmlNanoHTTPFetch(void) {
@@ -13445,13 +12879,49 @@ test_xmlNewParserCtxt(void) {
}
-#define gen_nb_xmlNodePtr_ptr 1
-static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
+static int
+test_xmlNewSAXParserCtxt(void) {
+ int test_ret = 0;
+
+ int mem_base;
+ xmlParserCtxtPtr ret_val;
+ xmlSAXHandlerPtr sax; /* SAX handler */
+ int n_sax;
+ void * userData; /* user data */
+ int n_userData;
+
+ for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
+ for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
+ mem_base = xmlMemBlocks();
+ sax = gen_xmlSAXHandlerPtr(n_sax, 0);
+ userData = gen_userdata(n_userData, 1);
+
+ ret_val = xmlNewSAXParserCtxt(sax, userData);
+ desret_xmlParserCtxtPtr(ret_val);
+ call_tests++;
+ des_xmlSAXHandlerPtr(n_sax, sax, 0);
+ des_userdata(n_userData, userData, 1);
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in xmlNewSAXParserCtxt",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf(" %d", n_sax);
+ printf(" %d", n_userData);
+ printf("\n");
+ }
+ }
+ }
+ function_tests++;
+
+ return(test_ret);
}
+
+#define gen_nb_xmlNodePtr_ptr 1
+#define gen_xmlNodePtr_ptr(no, nr) NULL
+#define des_xmlNodePtr_ptr(no, val, nr)
+
static int
test_xmlParseBalancedChunkMemory(void) {
int test_ret = 0;
@@ -14125,11 +13595,8 @@ test_xmlParseMemory(void) {
#define gen_nb_const_xmlParserNodeInfoPtr 1
-static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlParserNodeInfoPtr(no, nr) NULL
+#define des_const_xmlParserNodeInfoPtr(no, val, nr)
static int
test_xmlParserAddNodeInfo(void) {
@@ -14169,18 +13636,12 @@ test_xmlParserAddNodeInfo(void) {
#define gen_nb_const_xmlParserCtxtPtr 1
-static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlParserCtxtPtr(no, nr) NULL
+#define des_const_xmlParserCtxtPtr(no, val, nr)
#define gen_nb_const_xmlNodePtr 1
-static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlNodePtr(no, nr) NULL
+#define des_const_xmlNodePtr(no, val, nr)
static int
test_xmlParserFindNodeInfo(void) {
@@ -14222,11 +13683,8 @@ test_xmlParserFindNodeInfo(void) {
#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
-static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlParserNodeInfoSeqPtr(no, nr) NULL
+#define des_const_xmlParserNodeInfoSeqPtr(no, val, nr)
static int
test_xmlParserFindNodeInfoIndex(void) {
@@ -14268,11 +13726,8 @@ test_xmlParserFindNodeInfoIndex(void) {
#define gen_nb_xmlParserInputPtr 1
-static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlParserInputPtr(no, nr) NULL
+#define des_xmlParserInputPtr(no, val, nr)
static int
test_xmlParserInputGrow(void) {
@@ -15286,7 +14741,7 @@ static int
test_parser(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing parser : 58 of 70 functions ...\n");
+ if (quiet == 0) printf("Testing parser : 59 of 71 functions ...\n");
test_ret += test_xmlByteConsumed();
test_ret += test_xmlClearNodeInfoSeq();
test_ret += test_xmlClearParserCtxt();
@@ -15309,6 +14764,7 @@ test_parser(void) {
test_ret += test_xmlLoadExternalEntity();
test_ret += test_xmlNewIOInputStream();
test_ret += test_xmlNewParserCtxt();
+ test_ret += test_xmlNewSAXParserCtxt();
test_ret += test_xmlParseBalancedChunkMemory();
test_ret += test_xmlParseBalancedChunkMemoryRecover();
test_ret += test_xmlParseChunk();
@@ -15354,72 +14810,6 @@ test_parser(void) {
}
static int
-test_htmlCreateFileParserCtxt(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_HTML_ENABLED)
- int mem_base;
- htmlParserCtxtPtr ret_val;
- const char * filename; /* the filename */
- int n_filename;
- char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
- int n_encoding;
-
- for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
- for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
- mem_base = xmlMemBlocks();
- filename = gen_fileoutput(n_filename, 0);
- encoding = gen_const_char_ptr(n_encoding, 1);
-
- ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
- desret_htmlParserCtxtPtr(ret_val);
- call_tests++;
- des_fileoutput(n_filename, filename, 0);
- des_const_char_ptr(n_encoding, (const char *)encoding, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_filename);
- printf(" %d", n_encoding);
- printf("\n");
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_htmlInitAutoClose(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_HTML_ENABLED)
- int mem_base;
-
- mem_base = xmlMemBlocks();
-
- htmlInitAutoClose();
- call_tests++;
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in htmlInitAutoClose",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf("\n");
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
test_inputPop(void) {
int test_ret = 0;
@@ -15948,43 +15338,6 @@ test_xmlCurrentChar(void) {
static int
-test_xmlErrMemory(void) {
- int test_ret = 0;
-
- int mem_base;
- xmlParserCtxtPtr ctxt; /* an XML parser context */
- int n_ctxt;
- char * extra; /* extra information */
- int n_extra;
-
- for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
- for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
- mem_base = xmlMemBlocks();
- ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
- extra = gen_const_char_ptr(n_extra, 1);
-
- xmlErrMemory(ctxt, (const char *)extra);
- call_tests++;
- des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
- des_const_char_ptr(n_extra, (const char *)extra, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlErrMemory",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctxt);
- printf(" %d", n_extra);
- printf("\n");
- }
- }
- }
- function_tests++;
-
- return(test_ret);
-}
-
-
-static int
test_xmlIsLetter(void) {
int test_ret = 0;
@@ -16669,9 +16022,7 @@ static int
test_parserInternals(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
- test_ret += test_htmlCreateFileParserCtxt();
- test_ret += test_htmlInitAutoClose();
+ if (quiet == 0) printf("Testing parserInternals : 30 of 87 functions ...\n");
test_ret += test_inputPop();
test_ret += test_inputPush();
test_ret += test_namePop();
@@ -16686,7 +16037,6 @@ test_parserInternals(void) {
test_ret += test_xmlCreateMemoryParserCtxt();
test_ret += test_xmlCreateURLParserCtxt();
test_ret += test_xmlCurrentChar();
- test_ret += test_xmlErrMemory();
test_ret += test_xmlIsLetter();
test_ret += test_xmlNewEntityInputStream();
test_ret += test_xmlNewInputFromFile();
@@ -16909,11 +16259,8 @@ test_xmlPatterncompile(void) {
#ifdef LIBXML_PATTERN_ENABLED
#define gen_nb_xmlStreamCtxtPtr 1
-static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlStreamCtxtPtr(no, nr) NULL
+#define des_xmlStreamCtxtPtr(no, val, nr)
#endif
@@ -17160,11 +16507,8 @@ test_pattern(void) {
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlRelaxNGPtr 1
-static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlRelaxNGPtr(no, nr) NULL
+#define des_xmlRelaxNGPtr(no, val, nr)
#endif
@@ -17248,31 +16592,22 @@ test_xmlRelaxNGDumpTree(void) {
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlRelaxNGParserCtxtPtr 1
-static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlRelaxNGParserCtxtPtr(no, nr) NULL
+#define des_xmlRelaxNGParserCtxtPtr(no, val, nr)
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
-static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlRelaxNGValidityErrorFunc_ptr(no, nr) NULL
+#define des_xmlRelaxNGValidityErrorFunc_ptr(no, val, nr)
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
-static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlRelaxNGValidityWarningFunc_ptr(no, nr) NULL
+#define des_xmlRelaxNGValidityWarningFunc_ptr(no, val, nr)
#endif
@@ -17333,11 +16668,8 @@ test_xmlRelaxNGGetParserErrors(void) {
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlRelaxNGValidCtxtPtr 1
-static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlRelaxNGValidCtxtPtr(no, nr) NULL
+#define des_xmlRelaxNGValidCtxtPtr(no, val, nr)
#endif
@@ -17974,11 +17306,8 @@ test_xmlSchematronSetValidStructuredErrors(void) {
#ifdef LIBXML_SCHEMATRON_ENABLED
#define gen_nb_xmlSchematronValidCtxtPtr 1
-static xmlSchematronValidCtxtPtr gen_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchematronValidCtxtPtr(no, nr) NULL
+#define des_xmlSchematronValidCtxtPtr(no, val, nr)
#endif
@@ -18298,11 +17627,8 @@ test_xmlAttrSerializeTxtContent(void) {
#define gen_nb_const_xmlBuf_ptr 1
-static xmlBuf * gen_const_xmlBuf_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlBuf_ptr(int no ATTRIBUTE_UNUSED, const xmlBuf * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlBuf_ptr(no, nr) NULL
+#define des_const_xmlBuf_ptr(no, val, nr)
static int
test_xmlBufContent(void) {
@@ -18337,11 +17663,8 @@ test_xmlBufContent(void) {
#define gen_nb_xmlBufPtr 1
-static xmlBufPtr gen_xmlBufPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlBufPtr(int no ATTRIBUTE_UNUSED, xmlBufPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlBufPtr(no, nr) NULL
+#define des_xmlBufPtr(no, val, nr)
static int
test_xmlBufEnd(void) {
@@ -18376,11 +17699,8 @@ test_xmlBufEnd(void) {
#define gen_nb_const_xmlNode_ptr 1
-static xmlNode * gen_const_xmlNode_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlNode_ptr(int no ATTRIBUTE_UNUSED, const xmlNode * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlNode_ptr(no, nr) NULL
+#define des_const_xmlNode_ptr(no, val, nr)
static int
test_xmlBufGetNodeContent(void) {
@@ -18628,11 +17948,8 @@ test_xmlBufferCat(void) {
#define gen_nb_const_xmlBuffer_ptr 1
-static xmlBuffer * gen_const_xmlBuffer_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlBuffer_ptr(int no ATTRIBUTE_UNUSED, const xmlBuffer * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_const_xmlBuffer_ptr(no, nr) NULL
+#define des_const_xmlBuffer_ptr(no, val, nr)
static int
test_xmlBufferContent(void) {
@@ -19509,11 +18826,8 @@ test_xmlCreateIntSubset(void) {
#define gen_nb_xmlDOMWrapCtxtPtr 1
-static xmlDOMWrapCtxtPtr gen_xmlDOMWrapCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlDOMWrapCtxtPtr(int no ATTRIBUTE_UNUSED, xmlDOMWrapCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlDOMWrapCtxtPtr(no, nr) NULL
+#define des_xmlDOMWrapCtxtPtr(no, val, nr)
static int
test_xmlDOMWrapAdoptNode(void) {
@@ -23940,7 +23254,7 @@ static int
test_xmlValidateNCName(void) {
int test_ret = 0;
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_TREE_ENABLED
int mem_base;
int ret_val;
@@ -24440,11 +23754,8 @@ test_xmlParseURIRaw(void) {
#define gen_nb_xmlURIPtr 1
-static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlURIPtr(no, nr) NULL
+#define des_xmlURIPtr(no, val, nr)
static int
test_xmlParseURIReference(void) {
@@ -24991,11 +24302,8 @@ test_xmlCreateEnumeration(void) {
#define gen_nb_xmlAttributePtr 1
-static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlAttributePtr(no, nr) NULL
+#define des_xmlAttributePtr(no, val, nr)
static int
test_xmlDumpAttributeDecl(void) {
@@ -25037,11 +24345,8 @@ test_xmlDumpAttributeDecl(void) {
#define gen_nb_xmlAttributeTablePtr 1
-static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlAttributeTablePtr(no, nr) NULL
+#define des_xmlAttributeTablePtr(no, val, nr)
static int
test_xmlDumpAttributeTable(void) {
@@ -25083,11 +24388,8 @@ test_xmlDumpAttributeTable(void) {
#define gen_nb_xmlElementPtr 1
-static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlElementPtr(no, nr) NULL
+#define des_xmlElementPtr(no, val, nr)
static int
test_xmlDumpElementDecl(void) {
@@ -25129,11 +24431,8 @@ test_xmlDumpElementDecl(void) {
#define gen_nb_xmlElementTablePtr 1
-static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlElementTablePtr(no, nr) NULL
+#define des_xmlElementTablePtr(no, val, nr)
static int
test_xmlDumpElementTable(void) {
@@ -25175,11 +24474,8 @@ test_xmlDumpElementTable(void) {
#define gen_nb_xmlNotationPtr 1
-static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlNotationPtr(no, nr) NULL
+#define des_xmlNotationPtr(no, val, nr)
static int
test_xmlDumpNotationDecl(void) {
@@ -25221,11 +24517,8 @@ test_xmlDumpNotationDecl(void) {
#define gen_nb_xmlNotationTablePtr 1
-static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlNotationTablePtr(no, nr) NULL
+#define des_xmlNotationTablePtr(no, val, nr)
static int
test_xmlDumpNotationTable(void) {
@@ -26017,11 +25310,8 @@ test_xmlValidCtxtNormalizeAttributeValue(void) {
#define gen_nb_xmlElementContent_ptr 1
-static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlElementContent_ptr(no, nr) NULL
+#define des_xmlElementContent_ptr(no, val, nr)
static int
test_xmlValidGetPotentialChildren(void) {
@@ -27367,11 +26657,8 @@ test_xmlXIncludeProcessFlagsData(void) {
#ifdef LIBXML_XINCLUDE_ENABLED
#define gen_nb_xmlXIncludeCtxtPtr 1
-static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlXIncludeCtxtPtr(no, nr) NULL
+#define des_xmlXIncludeCtxtPtr(no, val, nr)
#endif
@@ -29209,11 +28496,8 @@ test_xmlAutomataGetInitState(void) {
#ifdef LIBXML_AUTOMATA_ENABLED
#define gen_nb_xmlAutomataPtr 1
-static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlAutomataPtr(no, nr) NULL
+#define des_xmlAutomataPtr(no, val, nr)
#endif
@@ -29421,11 +28705,8 @@ test_xmlAutomataNewTransition2(void) {
#ifdef LIBXML_AUTOMATA_ENABLED
#define gen_nb_xmlAutomataStatePtr 1
-static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlAutomataStatePtr(no, nr) NULL
+#define des_xmlAutomataStatePtr(no, val, nr)
#endif
@@ -29509,11 +28790,8 @@ test_xmlautomata(void) {
}
#define gen_nb_xmlGenericErrorFunc_ptr 1
-static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlGenericErrorFunc_ptr(no, nr) NULL
+#define des_xmlGenericErrorFunc_ptr(no, val, nr)
static int
test_initGenericErrorDefaultFunc(void) {
@@ -29546,11 +28824,8 @@ test_initGenericErrorDefaultFunc(void) {
#define gen_nb_xmlErrorPtr 1
-static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlErrorPtr(no, nr) NULL
+#define des_xmlErrorPtr(no, val, nr)
static int
test_xmlCopyError(void) {
@@ -29833,11 +29108,8 @@ test_xmlerror(void) {
#ifdef LIBXML_MODULES_ENABLED
#define gen_nb_xmlModulePtr 1
-static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlModulePtr(no, nr) NULL
+#define des_xmlModulePtr(no, val, nr)
#endif
@@ -31204,11 +30476,8 @@ test_xmlTextReaderGetAttributeNs(void) {
#ifdef LIBXML_READER_ENABLED
#define gen_nb_xmlTextReaderErrorFunc_ptr 1
-static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlTextReaderErrorFunc_ptr(no, nr) NULL
+#define des_xmlTextReaderErrorFunc_ptr(no, val, nr)
#endif
@@ -31641,11 +30910,8 @@ test_xmlTextReaderLocalName(void) {
#ifdef LIBXML_READER_ENABLED
#define gen_nb_xmlTextReaderLocatorPtr 1
-static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlTextReaderLocatorPtr(no, nr) NULL
+#define des_xmlTextReaderLocatorPtr(no, val, nr)
#endif
@@ -33464,11 +32730,8 @@ test_xmlExpSubsume(void) {
#ifdef LIBXML_REGEXP_ENABLED
#define gen_nb_xmlRegExecCtxtPtr 1
-static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlRegExecCtxtPtr(no, nr) NULL
+#define des_xmlRegExecCtxtPtr(no, val, nr)
#endif
@@ -33728,11 +32991,8 @@ test_xmlRegexpCompile(void) {
#ifdef LIBXML_REGEXP_ENABLED
#define gen_nb_xmlRegexpPtr 1
-static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlRegexpPtr(no, nr) NULL
+#define des_xmlRegexpPtr(no, val, nr)
#endif
@@ -33888,11 +33148,8 @@ test_xmlregexp(void) {
#ifdef LIBXML_OUTPUT_ENABLED
#define gen_nb_xmlSaveCtxtPtr 1
-static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSaveCtxtPtr(no, nr) NULL
+#define des_xmlSaveCtxtPtr(no, val, nr)
#endif
@@ -34156,31 +33413,22 @@ test_xmlSchemaDump(void) {
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaParserCtxtPtr 1
-static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchemaParserCtxtPtr(no, nr) NULL
+#define des_xmlSchemaParserCtxtPtr(no, val, nr)
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
-static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchemaValidityErrorFunc_ptr(no, nr) NULL
+#define des_xmlSchemaValidityErrorFunc_ptr(no, val, nr)
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
-static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchemaValidityWarningFunc_ptr(no, nr) NULL
+#define des_xmlSchemaValidityWarningFunc_ptr(no, val, nr)
#endif
@@ -34472,11 +33720,8 @@ test_xmlSchemaSAXPlug(void) {
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaSAXPlugPtr 1
-static xmlSchemaSAXPlugPtr gen_xmlSchemaSAXPlugPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchemaSAXPlugPtr(int no ATTRIBUTE_UNUSED, xmlSchemaSAXPlugPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchemaSAXPlugPtr(no, nr) NULL
+#define des_xmlSchemaSAXPlugPtr(no, val, nr)
#endif
@@ -34940,21 +34185,15 @@ test_xmlschemas(void) {
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaFacetPtr 1
-static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchemaFacetPtr(no, nr) NULL
+#define des_xmlSchemaFacetPtr(no, val, nr)
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaTypePtr 1
-static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchemaTypePtr(no, nr) NULL
+#define des_xmlSchemaTypePtr(no, val, nr)
#endif
@@ -35066,11 +34305,8 @@ test_xmlSchemaCollapseString(void) {
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaValPtr 1
-static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchemaValPtr(no, nr) NULL
+#define des_xmlSchemaValPtr(no, val, nr)
#endif
@@ -35537,11 +34773,8 @@ test_xmlSchemaNewStringValue(void) {
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaValPtr_ptr 1
-static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlSchemaValPtr_ptr(no, nr) NULL
+#define des_xmlSchemaValPtr_ptr(no, val, nr)
#endif
@@ -46376,21 +45609,15 @@ test_xmlXPathCompile(void) {
#ifdef LIBXML_XPATH_ENABLED
#define gen_nb_xmlXPathCompExprPtr 1
-static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlXPathCompExprPtr(no, nr) NULL
+#define des_xmlXPathCompExprPtr(no, val, nr)
#endif
#ifdef LIBXML_XPATH_ENABLED
#define gen_nb_xmlXPathContextPtr 1
-static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlXPathContextPtr(no, nr) NULL
+#define des_xmlXPathContextPtr(no, val, nr)
#endif
@@ -47110,11 +46337,8 @@ test_xpath(void) {
#ifdef LIBXML_XPATH_ENABLED
#define gen_nb_xmlXPathParserContextPtr 1
-static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
+#define gen_xmlXPathParserContextPtr(no, nr) NULL
+#define des_xmlXPathParserContextPtr(no, val, nr)
#endif
@@ -51396,7 +50620,7 @@ static int
test_xmlXPtrBuildNodeList(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlNodePtr ret_val;
xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
@@ -51471,7 +50695,7 @@ static int
test_xmlXPtrEvalRangePredicate(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
int n_ctxt;
@@ -51498,159 +50722,12 @@ test_xmlXPtrEvalRangePredicate(void) {
return(test_ret);
}
-#ifdef LIBXML_XPTR_ENABLED
-
-#define gen_nb_xmlLocationSetPtr 1
-static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-#endif
-
-
-static int
-test_xmlXPtrLocationSetAdd(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_XPTR_ENABLED)
- int mem_base;
- xmlLocationSetPtr cur; /* the initial range set */
- int n_cur;
- xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
- int n_val;
-
- for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
- for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
- mem_base = xmlMemBlocks();
- cur = gen_xmlLocationSetPtr(n_cur, 0);
- val = gen_xmlXPathObjectPtr(n_val, 1);
-
- xmlXPtrLocationSetAdd(cur, val);
- call_tests++;
- des_xmlLocationSetPtr(n_cur, cur, 0);
- des_xmlXPathObjectPtr(n_val, val, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_cur);
- printf(" %d", n_val);
- printf("\n");
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlXPtrLocationSetCreate(void) {
- int test_ret = 0;
-
-
- /* missing type support */
- return(test_ret);
-}
-
-
-static int
-test_xmlXPtrLocationSetDel(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_XPTR_ENABLED)
- int mem_base;
- xmlLocationSetPtr cur; /* the initial range set */
- int n_cur;
- xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
- int n_val;
-
- for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
- for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
- mem_base = xmlMemBlocks();
- cur = gen_xmlLocationSetPtr(n_cur, 0);
- val = gen_xmlXPathObjectPtr(n_val, 1);
-
- xmlXPtrLocationSetDel(cur, val);
- call_tests++;
- des_xmlLocationSetPtr(n_cur, cur, 0);
- des_xmlXPathObjectPtr(n_val, val, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_cur);
- printf(" %d", n_val);
- printf("\n");
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
-
-static int
-test_xmlXPtrLocationSetMerge(void) {
- int test_ret = 0;
-
-
- /* missing type support */
- return(test_ret);
-}
-
-
-static int
-test_xmlXPtrLocationSetRemove(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_XPTR_ENABLED)
- int mem_base;
- xmlLocationSetPtr cur; /* the initial range set */
- int n_cur;
- int val; /* the index to remove */
- int n_val;
-
- for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
- for (n_val = 0;n_val < gen_nb_int;n_val++) {
- mem_base = xmlMemBlocks();
- cur = gen_xmlLocationSetPtr(n_cur, 0);
- val = gen_int(n_val, 1);
-
- xmlXPtrLocationSetRemove(cur, val);
- call_tests++;
- des_xmlLocationSetPtr(n_cur, cur, 0);
- des_int(n_val, val, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_cur);
- printf(" %d", n_val);
- printf("\n");
- }
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
static int
test_xmlXPtrNewCollapsedRange(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlNodePtr start; /* the starting and ending node */
@@ -51694,7 +50771,7 @@ static int
test_xmlXPtrNewLocationSetNodeSet(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlNodeSetPtr set; /* a node set */
@@ -51728,7 +50805,7 @@ static int
test_xmlXPtrNewLocationSetNodes(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlNodePtr start; /* the start NodePtr value */
@@ -51769,7 +50846,7 @@ static int
test_xmlXPtrNewRange(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlNodePtr start; /* the starting node */
@@ -51824,7 +50901,7 @@ static int
test_xmlXPtrNewRangeNodeObject(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlNodePtr start; /* the starting node */
@@ -51865,7 +50942,7 @@ static int
test_xmlXPtrNewRangeNodePoint(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlNodePtr start; /* the starting node */
@@ -51906,7 +50983,7 @@ static int
test_xmlXPtrNewRangeNodes(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlNodePtr start; /* the starting node */
@@ -51947,7 +51024,7 @@ static int
test_xmlXPtrNewRangePointNode(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlXPathObjectPtr start; /* the starting point */
@@ -51988,7 +51065,7 @@ static int
test_xmlXPtrNewRangePoints(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathObjectPtr ret_val;
xmlXPathObjectPtr start; /* the starting point */
@@ -52029,7 +51106,7 @@ static int
test_xmlXPtrRangeToFunction(void) {
int test_ret = 0;
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_ENABLED) && defined(LIBXML_XPTR_LOCS_ENABLED)
int mem_base;
xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
int n_ctxt;
@@ -52063,53 +51140,14 @@ test_xmlXPtrRangeToFunction(void) {
return(test_ret);
}
-
-static int
-test_xmlXPtrWrapLocationSet(void) {
- int test_ret = 0;
-
-#if defined(LIBXML_XPTR_ENABLED)
- int mem_base;
- xmlXPathObjectPtr ret_val;
- xmlLocationSetPtr val; /* the LocationSet value */
- int n_val;
-
- for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
- mem_base = xmlMemBlocks();
- val = gen_xmlLocationSetPtr(n_val, 0);
-
- ret_val = xmlXPtrWrapLocationSet(val);
- desret_xmlXPathObjectPtr(ret_val);
- call_tests++;
- des_xmlLocationSetPtr(n_val, val, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_val);
- printf("\n");
- }
- }
- function_tests++;
-#endif
-
- return(test_ret);
-}
-
static int
test_xpointer(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
+ if (quiet == 0) printf("Testing xpointer : 13 of 21 functions ...\n");
test_ret += test_xmlXPtrBuildNodeList();
test_ret += test_xmlXPtrEval();
test_ret += test_xmlXPtrEvalRangePredicate();
- test_ret += test_xmlXPtrLocationSetAdd();
- test_ret += test_xmlXPtrLocationSetCreate();
- test_ret += test_xmlXPtrLocationSetDel();
- test_ret += test_xmlXPtrLocationSetMerge();
- test_ret += test_xmlXPtrLocationSetRemove();
test_ret += test_xmlXPtrNewCollapsedRange();
test_ret += test_xmlXPtrNewContext();
test_ret += test_xmlXPtrNewLocationSetNodeSet();
@@ -52121,7 +51159,6 @@ test_xpointer(void) {
test_ret += test_xmlXPtrNewRangePointNode();
test_ret += test_xmlXPtrNewRangePoints();
test_ret += test_xmlXPtrRangeToFunction();
- test_ret += test_xmlXPtrWrapLocationSet();
if (test_ret != 0)
printf("Module xpointer: %d errors\n", test_ret);
@@ -52141,7 +51178,6 @@ test_module(const char *module) {
if (!strcmp(module, "entities")) return(test_entities());
if (!strcmp(module, "hash")) return(test_hash());
if (!strcmp(module, "list")) return(test_list());
- if (!strcmp(module, "nanoftp")) return(test_nanoftp());
if (!strcmp(module, "nanohttp")) return(test_nanohttp());
if (!strcmp(module, "parser")) return(test_parser());
if (!strcmp(module, "parserInternals")) return(test_parserInternals());
diff --git a/chromium/third_party/libxml/src/testchar.c b/chromium/third_party/libxml/src/testchar.c
index 51e4acfcb16..2fc38697cb0 100644
--- a/chromium/third_party/libxml/src/testchar.c
+++ b/chromium/third_party/libxml/src/testchar.c
@@ -7,11 +7,10 @@
#include <stdio.h>
#include <string.h>
+#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
-#include "buf.h"
-
int lastError;
static void errorHandler(void *unused, xmlErrorPtr err) {
@@ -23,7 +22,7 @@ static void errorHandler(void *unused, xmlErrorPtr err) {
char document1[100] = "<doc>XXXX</doc>";
char document2[100] = "<doc foo='XXXX'/>";
-static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
+static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
int len, char *data, int forbid1, int forbid2) {
int i;
xmlDocPtr res;
@@ -37,33 +36,41 @@ static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
res = xmlReadMemory(document, len, "test", NULL, 0);
if ((i == forbid1) || (i == forbid2)) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Byte 0x%02X: %c\n",
i, i);
+ return(1);
+ }
}
else if ((i == '<') || (i == '&')) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect illegal char %c for Byte 0x%02X\n", i, i);
+ return(1);
+ }
}
else if (((i < 0x20) || (i >= 0x80)) &&
(i != 0x9) && (i != 0xA) && (i != 0xD)) {
- if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL))
+ if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Byte 0x%02X\n", i);
+ return(1);
+ }
}
else if (res == NULL) {
fprintf(stderr,
"Failed to parse valid char for Byte 0x%02X : %c\n", i, i);
+ return(1);
}
if (res != NULL)
xmlFreeDoc(res);
}
+ return(0);
}
-static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
+static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
int len, char *data) {
int i, j;
xmlDocPtr res;
@@ -80,10 +87,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
/* if first bit of first char is set, then second bit must too */
if ((i & 0x80) && ((i & 0x40) == 0)) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
+ }
}
/*
@@ -91,10 +100,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* bits must be 10
*/
else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
+ }
}
/*
@@ -102,10 +113,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* than 0x80, i.e. one of bits 5 to 1 of i must be set
*/
else if ((i & 0x80) && ((i & 0x1E) == 0)) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
+ }
}
/*
@@ -113,10 +126,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* at least 3 bytes, but we give only 2 !
*/
else if ((i & 0xE0) == 0xE0) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
i, j);
+ return(1);
+ }
}
/*
@@ -125,11 +140,13 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
else if ((lastError != 0) || (res == NULL)) {
fprintf(stderr,
"Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j);
+ return(1);
}
if (res != NULL)
xmlFreeDoc(res);
}
}
+ return(0);
}
/**
@@ -141,9 +158,10 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* CDATA in text or in attribute values.
*/
-static void testDocumentRanges(void) {
+static int testDocumentRanges(void) {
xmlParserCtxtPtr ctxt;
char *data;
+ int test_ret = 0;
/*
* Set up a parsing context using the first document as
@@ -152,7 +170,7 @@ static void testDocumentRanges(void) {
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
fprintf(stderr, "Failed to allocate parser context\n");
- return;
+ return(1);
}
printf("testing 1 byte char in document: 1");
@@ -163,7 +181,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at beginning of area */
- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
data, -1, -1);
printf(" 2");
fflush(stdout);
@@ -172,7 +190,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at end of area */
- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
data + 3, -1, -1);
printf(" 3");
@@ -183,7 +201,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at beginning of area */
- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
data, '\'', -1);
printf(" 4");
fflush(stdout);
@@ -192,7 +210,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at end of area */
- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
data + 3, '\'', -1);
printf(" done\n");
@@ -204,7 +222,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at beginning of area */
- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
data);
printf(" 2");
fflush(stdout);
@@ -213,7 +231,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at end of area */
- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
data + 2);
printf(" 3");
@@ -224,7 +242,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at beginning of area */
- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
data);
printf(" 4");
fflush(stdout);
@@ -233,14 +251,15 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at end of area */
- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
data + 2);
printf(" done\n");
xmlFreeParserCtxt(ctxt);
+ return(test_ret);
}
-static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
int i = 0;
int len, c;
@@ -255,19 +274,25 @@ static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
c = xmlCurrentChar(ctxt, &len);
if ((i == 0) || (i >= 0x80)) {
/* we must see an error there */
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Byte 0x%02X\n", i);
+ return(1);
+ }
} else if (i == 0xD) {
- if ((c != 0xA) || (len != 1))
+ if ((c != 0xA) || (len != 1)) {
fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i);
+ return(1);
+ }
} else if ((c != i) || (len != 1)) {
fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i);
+ return(1);
}
}
+ return(0);
}
-static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
int i, j;
int len, c;
@@ -284,10 +309,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
/* if first bit of first char is set, then second bit must too */
if ((i & 0x80) && ((i & 0x40) == 0)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
+ }
}
/*
@@ -295,10 +322,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* bits must be 10
*/
else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
i, j, c);
+ return(1);
+ }
}
/*
@@ -306,10 +335,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* than 0x80, i.e. one of bits 5 to 1 of i must be set
*/
else if ((i & 0x80) && ((i & 0x1E) == 0)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
i, j, c);
+ return(1);
+ }
}
/*
@@ -317,10 +348,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* at least 3 bytes, but we give only 2 !
*/
else if ((i & 0xE0) == 0xE0) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
i, j);
+ return(1);
+ }
}
/*
@@ -329,6 +362,7 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
else if ((lastError != 0) || (len != 2)) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j);
+ return(1);
}
/*
@@ -338,12 +372,14 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n",
i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c);
+ return(1);
}
}
}
+ return(0);
}
-static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
int i, j, k, K;
int len, c;
unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
@@ -368,20 +404,24 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
* at least 4 bytes, but we give only 3 !
*/
if ((i & 0xF0) == 0xF0) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, data[3]);
+ return(1);
+ }
}
/*
* The second and the third bytes must start with 10
*/
else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
+ }
}
/*
@@ -390,10 +430,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
* the 6th byte of data[1] must be set
*/
else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
+ }
}
/*
@@ -401,10 +443,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
*/
else if (((value > 0xD7FF) && (value <0xE000)) ||
((value > 0xFFFD) && (value <0x10000))) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n",
value, i, j, K);
+ return(1);
+ }
}
/*
@@ -414,6 +458,7 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
}
/*
@@ -423,13 +468,15 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
i, j, data[2], value, c);
+ return(1);
}
}
}
}
+ return(0);
}
-static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
int i, j, k, K, l, L;
int len, c;
unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
@@ -458,10 +505,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* at least 5 bytes, but we give only 4 !
*/
if ((i & 0xF8) == 0xF8) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, data[3]);
+ return(1);
+ }
}
/*
@@ -469,10 +518,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
*/
else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) ||
((L & 0xC0) != 0x80)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, L);
+ return(1);
+ }
}
/*
@@ -481,10 +532,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* the 6 or 5th byte of j must be set
*/
else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, L);
+ return(1);
+ }
}
/*
@@ -493,10 +546,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
else if (((value > 0xD7FF) && (value <0xE000)) ||
((value > 0xFFFD) && (value <0x10000)) ||
(value > 0x10FFFF)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
value, i, j, K, L);
+ return(1);
+ }
}
/*
@@ -506,6 +561,7 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
}
/*
@@ -515,11 +571,13 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
i, j, data[2], value, c);
+ return(1);
}
}
}
}
}
+ return(0);
}
/**
@@ -530,11 +588,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* cover the full range of UTF-8 chars accepted by XML-1.0
*/
-static void testCharRanges(void) {
+static int testCharRanges(void) {
char data[5];
xmlParserCtxtPtr ctxt;
xmlParserInputBufferPtr buf;
xmlParserInputPtr input;
+ int test_ret = 0;
memset(data, 0, 5);
@@ -545,17 +604,19 @@ static void testCharRanges(void) {
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
fprintf(stderr, "Failed to allocate parser context\n");
- return;
+ return(1);
}
buf = xmlParserInputBufferCreateStatic(data, sizeof(data),
XML_CHAR_ENCODING_NONE);
if (buf == NULL) {
fprintf(stderr, "Failed to allocate input buffer\n");
+ test_ret = 1;
goto error;
}
input = xmlNewInputStream(ctxt);
if (input == NULL) {
xmlFreeParserInputBuffer(buf);
+ test_ret = 1;
goto error;
}
input->filename = NULL;
@@ -567,25 +628,28 @@ static void testCharRanges(void) {
printf("testing char range: 1");
fflush(stdout);
- testCharRangeByte1(ctxt, data);
+ test_ret += testCharRangeByte1(ctxt, data);
printf(" 2");
fflush(stdout);
- testCharRangeByte2(ctxt, data);
+ test_ret += testCharRangeByte2(ctxt, data);
printf(" 3");
fflush(stdout);
- testCharRangeByte3(ctxt, data);
+ test_ret += testCharRangeByte3(ctxt, data);
printf(" 4");
fflush(stdout);
- testCharRangeByte4(ctxt, data);
+ test_ret += testCharRangeByte4(ctxt, data);
printf(" done\n");
fflush(stdout);
error:
xmlFreeParserCtxt(ctxt);
+ return(test_ret);
}
int main(void) {
+ int ret = 0;
+
/*
* this initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
@@ -602,8 +666,8 @@ int main(void) {
/*
* Run the tests
*/
- testCharRanges();
- testDocumentRanges();
+ ret += testCharRanges();
+ ret += testDocumentRanges();
/*
* Cleanup function for the XML library.
@@ -613,5 +677,5 @@ int main(void) {
* this is to debug memory for regression tests
*/
xmlMemoryDump();
- return(0);
+ return(ret ? 1 : 0);
}
diff --git a/chromium/third_party/libxml/src/testlimits.c b/chromium/third_party/libxml/src/testlimits.c
index 0b045eac83d..6322f8ba40c 100644
--- a/chromium/third_party/libxml/src/testlimits.c
+++ b/chromium/third_party/libxml/src/testlimits.c
@@ -17,7 +17,6 @@
#include <unistd.h>
#endif
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
@@ -1261,19 +1260,15 @@ saxTest(const char *filename, size_t limit, int options, int fail) {
int res = 0;
xmlParserCtxtPtr ctxt;
xmlDocPtr doc;
- xmlSAXHandlerPtr old_sax;
nb_tests++;
maxlen = limit;
- ctxt = xmlNewParserCtxt();
+ ctxt = xmlNewSAXParserCtxt(callbackSAX2Handler, NULL);
if (ctxt == NULL) {
fprintf(stderr, "Failed to create parser context\n");
return(1);
}
- old_sax = ctxt->sax;
- ctxt->sax = callbackSAX2Handler;
- ctxt->userData = NULL;
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
if (doc != NULL) {
@@ -1296,7 +1291,6 @@ saxTest(const char *filename, size_t limit, int options, int fail) {
} else
res = 0;
}
- ctxt->sax = old_sax;
xmlFreeParserCtxt(ctxt);
return(res);
diff --git a/chromium/third_party/libxml/src/testrecurse.c b/chromium/third_party/libxml/src/testrecurse.c
index fabc5138906..d213ebc63dc 100644
--- a/chromium/third_party/libxml/src/testrecurse.c
+++ b/chromium/third_party/libxml/src/testrecurse.c
@@ -17,7 +17,6 @@
#include <unistd.h>
#endif
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/chromium/third_party/libxml/src/threads.c b/chromium/third_party/libxml/src/threads.c
index 5e4db16c9ac..9fa477e53b6 100644
--- a/chromium/third_party/libxml/src/threads.c
+++ b/chromium/third_party/libxml/src/threads.c
@@ -16,37 +16,32 @@
#include <libxml/threads.h>
#include <libxml/globals.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#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>
-#endif
-#endif
-
-#ifdef HAVE_BEOS_THREADS
-#include <OS.h>
-#include <TLS.h>
+#ifdef LIBXML_THREAD_ENABLED
+ #ifdef HAVE_PTHREAD_H
+ #include <pthread.h>
+ #define HAVE_POSIX_THREADS
+ #elif defined(_WIN32)
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+ #ifndef HAVE_COMPILER_TLS
+ #include <process.h>
+ #endif
+ #define HAVE_WIN32_THREADS
+ #endif
#endif
#if defined(SOLARIS)
#include <note.h>
#endif
+#include "private/dict.h"
+#include "private/threads.h"
+
/* #define DEBUG_THREADS */
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 303) && \
- defined(__GLIBC__) && defined(__linux__)
+#if defined(__GNUC__) && defined(__linux__)
static int libxml_is_threaded = -1;
@@ -76,7 +71,7 @@ static int libxml_is_threaded = 1;
#endif /* __GNUC__, __GLIBC__, __linux__ */
-#endif /* HAVE_PTHREAD_H */
+#endif /* HAVE_POSIX_THREADS */
/*
* TODO: this module still uses malloc/free and not xmlMalloc/xmlFree
@@ -88,13 +83,10 @@ static int libxml_is_threaded = 1;
* xmlMutex are a simple mutual exception locks
*/
struct _xmlMutex {
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
pthread_mutex_t lock;
#elif defined HAVE_WIN32_THREADS
- HANDLE mutex;
-#elif defined HAVE_BEOS_THREADS
- sem_id sem;
- thread_id tid;
+ CRITICAL_SECTION cs;
#else
int empty;
#endif
@@ -104,7 +96,7 @@ struct _xmlMutex {
* xmlRMutex are reentrant mutual exception locks
*/
struct _xmlRMutex {
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
pthread_mutex_t lock;
unsigned int held;
unsigned int waiters;
@@ -112,11 +104,6 @@ struct _xmlRMutex {
pthread_cond_t cv;
#elif defined HAVE_WIN32_THREADS
CRITICAL_SECTION cs;
- unsigned int count;
-#elif defined HAVE_BEOS_THREADS
- xmlMutexPtr lock;
- thread_id tid;
- int32 count;
#else
int empty;
#endif
@@ -128,7 +115,7 @@ struct _xmlRMutex {
* - globalkey used for per-thread data
*/
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
static pthread_key_t globalkey;
static pthread_t mainthread;
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
@@ -147,14 +134,6 @@ static struct {
LONG control;
} run_once = { 0, 0};
static volatile LPCRITICAL_SECTION global_init_lock = NULL;
-
-/* endif HAVE_WIN32_THREADS */
-#elif defined HAVE_BEOS_THREADS
-int32 globalkey = 0;
-thread_id mainthread = 0;
-int32 run_once_init = 0;
-static int32 global_init_lock = -1;
-static vint32 global_init_count = 0;
#endif
static xmlRMutexPtr xmlLibraryLock = NULL;
@@ -178,17 +157,11 @@ xmlNewMutex(void)
if ((tok = malloc(sizeof(xmlMutex))) == NULL)
return (NULL);
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded != 0)
pthread_mutex_init(&tok->lock, NULL);
#elif defined HAVE_WIN32_THREADS
- tok->mutex = CreateMutex(NULL, FALSE, NULL);
-#elif defined HAVE_BEOS_THREADS
- if ((tok->sem = create_sem(1, "xmlMutex")) < B_OK) {
- free(tok);
- return NULL;
- }
- tok->tid = -1;
+ InitializeCriticalSection(&tok->cs);
#endif
return (tok);
}
@@ -206,13 +179,11 @@ xmlFreeMutex(xmlMutexPtr tok)
if (tok == NULL)
return;
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded != 0)
pthread_mutex_destroy(&tok->lock);
#elif defined HAVE_WIN32_THREADS
- CloseHandle(tok->mutex);
-#elif defined HAVE_BEOS_THREADS
- delete_sem(tok->sem);
+ DeleteCriticalSection(&tok->cs);
#endif
free(tok);
}
@@ -228,19 +199,11 @@ xmlMutexLock(xmlMutexPtr tok)
{
if (tok == NULL)
return;
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded != 0)
pthread_mutex_lock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
- WaitForSingleObject(tok->mutex, INFINITE);
-#elif defined HAVE_BEOS_THREADS
- if (acquire_sem(tok->sem) != B_NO_ERROR) {
-#ifdef DEBUG_THREADS
- xmlGenericError(xmlGenericErrorContext,
- "xmlMutexLock():BeOS:Couldn't acquire semaphore\n");
-#endif
- }
- tok->tid = find_thread(NULL);
+ EnterCriticalSection(&tok->cs);
#endif
}
@@ -256,16 +219,11 @@ xmlMutexUnlock(xmlMutexPtr tok)
{
if (tok == NULL)
return;
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded != 0)
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
- ReleaseMutex(tok->mutex);
-#elif defined HAVE_BEOS_THREADS
- if (tok->tid == find_thread(NULL)) {
- tok->tid = -1;
- release_sem(tok->sem);
- }
+ LeaveCriticalSection(&tok->cs);
#endif
}
@@ -286,7 +244,7 @@ xmlNewRMutex(void)
if ((tok = malloc(sizeof(xmlRMutex))) == NULL)
return (NULL);
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded != 0) {
pthread_mutex_init(&tok->lock, NULL);
tok->held = 0;
@@ -295,13 +253,6 @@ xmlNewRMutex(void)
}
#elif defined HAVE_WIN32_THREADS
InitializeCriticalSection(&tok->cs);
- tok->count = 0;
-#elif defined HAVE_BEOS_THREADS
- if ((tok->lock = xmlNewMutex()) == NULL) {
- free(tok);
- return NULL;
- }
- tok->count = 0;
#endif
return (tok);
}
@@ -318,15 +269,13 @@ xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
{
if (tok == NULL)
return;
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded != 0) {
pthread_mutex_destroy(&tok->lock);
pthread_cond_destroy(&tok->cv);
}
#elif defined HAVE_WIN32_THREADS
DeleteCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
- xmlFreeMutex(tok->lock);
#endif
free(tok);
}
@@ -342,7 +291,7 @@ xmlRMutexLock(xmlRMutexPtr tok)
{
if (tok == NULL)
return;
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded == 0)
return;
@@ -364,15 +313,6 @@ xmlRMutexLock(xmlRMutexPtr tok)
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
EnterCriticalSection(&tok->cs);
- tok->count++;
-#elif defined HAVE_BEOS_THREADS
- if (tok->lock->tid == find_thread(NULL)) {
- tok->count++;
- return;
- } else {
- xmlMutexLock(tok->lock);
- tok->count = 1;
- }
#endif
}
@@ -387,7 +327,7 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
{
if (tok == NULL)
return;
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded == 0)
return;
@@ -400,18 +340,7 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
}
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
- if (tok->count > 0) {
- tok->count--;
- LeaveCriticalSection(&tok->cs);
- }
-#elif defined HAVE_BEOS_THREADS
- if (tok->lock->tid == find_thread(NULL)) {
- tok->count--;
- if (tok->count == 0) {
- xmlMutexUnlock(tok->lock);
- }
- return;
- }
+ LeaveCriticalSection(&tok->cs);
#endif
}
@@ -425,7 +354,7 @@ void
__xmlGlobalInitMutexLock(void)
{
/* Make sure the global init lock is initialized and then lock it. */
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
/* The mutex is statically initialized, so we just lock it. */
#ifdef XML_PTHREAD_WEAK
if (pthread_mutex_lock == NULL)
@@ -465,41 +394,13 @@ __xmlGlobalInitMutexLock(void)
/* Lock the chosen critical section */
EnterCriticalSection(global_init_lock);
-#elif defined HAVE_BEOS_THREADS
- int32 sem;
-
- /* Allocate a new semaphore */
- sem = create_sem(1, "xmlGlobalinitMutex");
-
- while (global_init_lock == -1) {
- if (atomic_add(&global_init_count, 1) == 0) {
- global_init_lock = sem;
- } else {
- snooze(1);
- atomic_add(&global_init_count, -1);
- }
- }
-
- /* If another thread successfully recorded its critical
- * section in the global_init_lock then discard the one
- * allocated by this thread. */
- if (global_init_lock != sem)
- delete_sem(sem);
-
- /* Acquire the chosen semaphore */
- if (acquire_sem(global_init_lock) != B_NO_ERROR) {
-#ifdef DEBUG_THREADS
- xmlGenericError(xmlGenericErrorContext,
- "xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n");
-#endif
- }
#endif
}
void
__xmlGlobalInitMutexUnlock(void)
{
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
#ifdef XML_PTHREAD_WEAK
if (pthread_mutex_unlock == NULL)
return;
@@ -509,8 +410,6 @@ __xmlGlobalInitMutexUnlock(void)
if (global_init_lock != NULL) {
LeaveCriticalSection(global_init_lock);
}
-#elif defined HAVE_BEOS_THREADS
- release_sem(global_init_lock);
#endif
}
@@ -523,7 +422,7 @@ __xmlGlobalInitMutexUnlock(void)
void
__xmlGlobalInitMutexDestroy(void)
{
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
#elif defined HAVE_WIN32_THREADS
if (global_init_lock != NULL) {
DeleteCriticalSection(global_init_lock);
@@ -588,7 +487,7 @@ xmlNewGlobalState(void)
}
#endif /* LIBXML_THREAD_ENABLED */
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
#elif defined HAVE_WIN32_THREADS
#if !defined(HAVE_COMPILER_TLS)
#if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
@@ -623,24 +522,6 @@ static CRITICAL_SECTION cleanup_helpers_cs;
#endif /* HAVE_COMPILER_TLS */
#endif /* HAVE_WIN32_THREADS */
-#if defined HAVE_BEOS_THREADS
-
-/**
- * xmlGlobalStateCleanup:
- * @data: unused parameter
- *
- * Used for Beos only
- */
-void
-xmlGlobalStateCleanup(void *data)
-{
- void *globalval = tls_get(globalkey);
-
- if (globalval != NULL)
- xmlFreeGlobalState(globalval);
-}
-#endif
-
/**
* xmlGetGlobalState:
*
@@ -651,7 +532,7 @@ xmlGlobalStateCleanup(void *data)
xmlGlobalStatePtr
xmlGetGlobalState(void)
{
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
xmlGlobalState *globalval;
if (libxml_is_threaded == 0)
@@ -723,21 +604,6 @@ xmlGetGlobalState(void)
}
return (globalval);
#endif /* HAVE_COMPILER_TLS */
-#elif defined HAVE_BEOS_THREADS
- xmlGlobalState *globalval;
-
- xmlOnceInit();
-
- if ((globalval = (xmlGlobalState *) tls_get(globalkey)) == NULL) {
- xmlGlobalState *tsd = xmlNewGlobalState();
- if (tsd == NULL)
- return (NULL);
-
- tls_set(globalkey, tsd);
- on_exit_thread(xmlGlobalStateCleanup, NULL);
- return (tsd);
- }
- return (globalval);
#else
return (NULL);
#endif
@@ -761,7 +627,7 @@ xmlGetGlobalState(void)
int
xmlGetThreadId(void)
{
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
pthread_t id;
int ret;
@@ -773,8 +639,6 @@ xmlGetThreadId(void)
return (ret);
#elif defined HAVE_WIN32_THREADS
return GetCurrentThreadId();
-#elif defined HAVE_BEOS_THREADS
- return find_thread(NULL);
#else
return ((int) 0);
#endif
@@ -790,7 +654,7 @@ xmlGetThreadId(void)
int
xmlIsMainThread(void)
{
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded == -1)
xmlInitThreads();
if (libxml_is_threaded == 0)
@@ -798,19 +662,15 @@ xmlIsMainThread(void)
pthread_once(&once_control, xmlOnceInit);
#elif defined HAVE_WIN32_THREADS
xmlOnceInit();
-#elif defined HAVE_BEOS_THREADS
- xmlOnceInit();
#endif
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext, "xmlIsMainThread()\n");
#endif
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
return (pthread_equal(mainthread,pthread_self()));
#elif defined HAVE_WIN32_THREADS
return (mainthread == GetCurrentThreadId());
-#elif defined HAVE_BEOS_THREADS
- return (mainthread == find_thread(NULL));
#else
return (1);
#endif
@@ -849,13 +709,16 @@ xmlUnlockLibrary(void)
/**
* xmlInitThreads:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* xmlInitThreads() is used to to initialize all the thread related
* data of the libxml2 library.
*/
void
xmlInitThreads(void)
{
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
#ifdef XML_PTHREAD_WEAK
if (libxml_is_threaded == -1) {
if ((pthread_once != NULL) &&
@@ -889,6 +752,11 @@ xmlInitThreads(void)
/**
* xmlCleanupThreads:
*
+ * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * to free global state but see the warnings there. xmlCleanupParser
+ * should be only called once at program exit. In most cases, you don't
+ * have call cleanup functions at all.
+ *
* xmlCleanupThreads() is used to to cleanup all the thread related
* data of the libxml2 library once processing has ended.
*
@@ -906,12 +774,14 @@ xmlCleanupThreads(void)
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n");
#endif
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
if (libxml_is_threaded != 0)
pthread_key_delete(globalkey);
once_control = once_control_init;
-#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
+#elif defined(HAVE_WIN32_THREADS)
+#if !defined(HAVE_COMPILER_TLS)
if (globalkey != TLS_OUT_OF_INDEXES) {
+#if !defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)
xmlGlobalStateCleanupHelperParams *p;
EnterCriticalSection(&cleanup_helpers_cs);
@@ -925,11 +795,17 @@ xmlCleanupThreads(void)
}
cleanup_helpers_head = 0;
LeaveCriticalSection(&cleanup_helpers_cs);
+#endif
TlsFree(globalkey);
globalkey = TLS_OUT_OF_INDEXES;
}
+#if !defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)
DeleteCriticalSection(&cleanup_helpers_cs);
#endif
+#endif
+ run_once.done = 0;
+ run_once.control = 0;
+#endif
}
#ifdef LIBXML_THREAD_ENABLED
@@ -946,7 +822,7 @@ xmlCleanupThreads(void)
static void
xmlOnceInit(void)
{
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
(void) pthread_key_create(&globalkey, xmlFreeGlobalState);
mainthread = pthread_self();
__xmlInitializeDict();
@@ -969,14 +845,6 @@ xmlOnceInit(void)
Sleep(0);
}
}
-#elif defined HAVE_BEOS_THREADS
- if (atomic_add(&run_once_init, 1) == 0) {
- globalkey = tls_allocate();
- tls_set(globalkey, NULL);
- mainthread = find_thread(NULL);
- __xmlInitializeDict();
- } else
- atomic_add(&run_once_init, -1);
#endif
}
#endif
@@ -992,7 +860,7 @@ xmlOnceInit(void)
*
* Returns TRUE always
*/
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
#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
diff --git a/chromium/third_party/libxml/src/tree.c b/chromium/third_party/libxml/src/tree.c
index 1253274f9ae..6a42f1187d3 100644
--- a/chromium/third_party/libxml/src/tree.c
+++ b/chromium/third_party/libxml/src/tree.c
@@ -44,8 +44,10 @@
#include <libxml/debugXML.h>
#endif
-#include "buf.h"
-#include "save.h"
+#include "private/buf.h"
+#include "private/entities.h"
+#include "private/error.h"
+#include "private/tree.h"
int __xmlRegisterCallbacks = 0;
@@ -355,7 +357,7 @@ xmlSplitQName3(const xmlChar *name, int *len) {
#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
-#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
/**
* xmlValidateNCName:
* @value: the value to check
@@ -1214,11 +1216,6 @@ xmlFreeDoc(xmlDocPtr cur) {
#endif
return;
}
-#ifdef LIBXML_DEBUG_RUNTIME
-#ifdef LIBXML_DEBUG_ENABLED
- xmlDebugCheckDocument(stderr, cur);
-#endif
-#endif
if (cur != NULL) dict = cur->dict;
@@ -1284,7 +1281,7 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
buf = xmlBufCreateSize(0);
if (buf == NULL) return(NULL);
- xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_HYBRID);
+ xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
q = cur;
while ((cur < end) && (*cur != 0)) {
@@ -1505,7 +1502,7 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
buf = xmlBufCreateSize(0);
if (buf == NULL) return(NULL);
- xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_HYBRID);
+ xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
q = cur;
while (*cur != 0) {
@@ -2221,7 +2218,8 @@ xmlNewDocPI(xmlDocPtr doc, const xmlChar *name, const xmlChar *content) {
* @content: the PI content
*
* Creation of a processing instruction element.
- * Use xmlDocNewPI preferably to get string interning
+ *
+ * Use of this function is DISCOURAGED in favor of xmlNewDocPI.
*
* Returns a pointer to the new node object.
*/
@@ -2237,6 +2235,8 @@ xmlNewPI(const xmlChar *name, const xmlChar *content) {
*
* Creation of a new node element. @ns is optional (NULL).
*
+ * Use of this function is DISCOURAGED in favor of xmlNewDocNode.
+ *
* Returns a pointer to the new node object. Uses xmlStrdup() to make
* copy of @name.
*/
@@ -2278,6 +2278,8 @@ xmlNewNode(xmlNsPtr ns, const xmlChar *name) {
*
* Creation of a new node element. @ns is optional (NULL).
*
+ * Use of this function is DISCOURAGED in favor of xmlNewDocNodeEatName.
+ *
* Returns a pointer to the new node object, with pointer @name as
* new node's name. Use xmlNewNode() if a copy of @name string is
* is needed as new node's name.
@@ -2452,6 +2454,9 @@ xmlNewDocFragment(xmlDocPtr doc) {
* @content: the text content
*
* Creation of a new text node.
+ *
+ * Use of this function is DISCOURAGED in favor of xmlNewDocText.
+ *
* Returns a pointer to the new node object.
*/
xmlNodePtr
@@ -2682,6 +2687,8 @@ xmlNewDocText(const xmlDoc *doc, const xmlChar *content) {
* @content: the text content
* @len: the text len.
*
+ * Use of this function is DISCOURAGED in favor of xmlNewDocTextLen.
+ *
* Creation of a new text node with an extra parameter for the content's length
* Returns a pointer to the new node object.
*/
@@ -2733,6 +2740,8 @@ xmlNewDocTextLen(xmlDocPtr doc, const xmlChar *content, int len) {
* xmlNewComment:
* @content: the comment content
*
+ * Use of this function is DISCOURAGED in favor of xmlNewDocComment.
+ *
* Creation of a new node containing a comment.
* Returns a pointer to the new node object.
*/
@@ -2812,6 +2821,20 @@ xmlNewDocComment(xmlDocPtr doc, const xmlChar *content) {
return(cur);
}
+static const xmlChar *_copyStringForNewDictIfNeeded(xmlDictPtr oldDict, xmlDictPtr newDict, const xmlChar *oldValue) {
+ const xmlChar *newValue = oldValue;
+ if (oldValue) {
+ int oldDictOwnsOldValue = oldDict && (xmlDictOwns(oldDict, oldValue) == 1);
+ if (oldDictOwnsOldValue) {
+ if (newDict)
+ newValue = xmlDictLookup(newDict, oldValue, -1);
+ else
+ newValue = xmlStrdup(oldValue);
+ }
+ }
+ return newValue;
+}
+
/**
* xmlSetTreeDoc:
* @tree: the top element
@@ -2826,6 +2849,9 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
if ((tree == NULL) || (tree->type == XML_NAMESPACE_DECL))
return;
if (tree->doc != doc) {
+ xmlDictPtr oldTreeDict = tree->doc ? tree->doc->dict : NULL;
+ xmlDictPtr newDict = doc ? doc->dict : NULL;
+
if(tree->type == XML_ELEMENT_NODE) {
prop = tree->properties;
while (prop != NULL) {
@@ -2833,7 +2859,11 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
xmlRemoveID(tree->doc, prop);
}
- prop->doc = doc;
+ if (prop->doc != doc) {
+ xmlDictPtr oldPropDict = prop->doc ? prop->doc->dict : NULL;
+ prop->name = _copyStringForNewDictIfNeeded(oldPropDict, newDict, prop->name);
+ prop->doc = doc;
+ }
xmlSetListDoc(prop->children, doc);
/*
@@ -2862,6 +2892,10 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
} else if (tree->children != NULL) {
xmlSetListDoc(tree->children, doc);
}
+
+ tree->name = _copyStringForNewDictIfNeeded(oldTreeDict, newDict, tree->name);
+ tree->content = (xmlChar *)_copyStringForNewDictIfNeeded(oldTreeDict, NULL, tree->content);
+ /* FIXME: tree->ns should be updated as in xmlStaticCopyNode(). */
tree->doc = doc;
}
}
@@ -2978,6 +3012,8 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns,
* When inserting after @cur, @prev is passed as @cur.
* If an existing attribute is found it is destroyed prior to adding @prop.
*
+ * See the note regarding namespaces in xmlAddChild.
+ *
* Returns the attribute being inserted or NULL in case of error.
*/
static xmlNodePtr
@@ -3030,6 +3066,8 @@ xmlAddPropSibling(xmlNodePtr prev, xmlNodePtr cur, xmlNodePtr prop) {
* If the new node is ATTRIBUTE, it is added into properties instead of children.
* If there is an attribute with equal name, it is first destroyed.
*
+ * See the note regarding namespaces in xmlAddChild.
+ *
* Returns the new node or NULL in case of error.
*/
xmlNodePtr
@@ -3108,6 +3146,8 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
* If the new node is ATTRIBUTE, it is added into properties instead of children.
* If there is an attribute with equal name, it is first destroyed.
*
+ * See the note regarding namespaces in xmlAddChild.
+ *
* Returns the new node or NULL in case of error.
*/
xmlNodePtr
@@ -3184,6 +3224,8 @@ xmlAddPrevSibling(xmlNodePtr cur, xmlNodePtr elem) {
* If the new element was already inserted in a document it is
* first unlinked from its existing context.
*
+ * See the note regarding namespaces in xmlAddChild.
+ *
* Returns the new element or NULL in case of error.
*/
xmlNodePtr
@@ -3260,6 +3302,8 @@ xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem) {
* Add a list of node at the end of the child list of the parent
* merging adjacent TEXT nodes (@cur may be freed)
*
+ * See the note regarding namespaces in xmlAddChild.
+ *
* Returns the last child or NULL in case of error.
*/
xmlNodePtr
@@ -3346,6 +3390,12 @@ xmlAddChildList(xmlNodePtr parent, xmlNodePtr cur) {
* If the new node is ATTRIBUTE, it is added into properties instead of children.
* If there is an attribute with equal name, it is first destroyed.
*
+ * All tree manipulation functions can safely move nodes within a document.
+ * But when moving nodes from one document to another, references to
+ * namespaces in element or attribute nodes are NOT fixed. In this case,
+ * you MUST call xmlReconciliateNs after the move operation to avoid
+ * memory errors.
+ *
* Returns the child or NULL in case of error.
*/
xmlNodePtr
@@ -3703,9 +3753,6 @@ xmlFreeNodeList(xmlNodePtr cur) {
while (1) {
while ((cur->children != NULL) &&
(cur->type != XML_DOCUMENT_NODE) &&
-#ifdef LIBXML_DOCB_ENABLED
- (cur->type != XML_DOCB_DOCUMENT_NODE) &&
-#endif
(cur->type != XML_HTML_DOCUMENT_NODE) &&
(cur->type != XML_DTD_NODE) &&
(cur->type != XML_ENTITY_REF_NODE)) {
@@ -3716,9 +3763,6 @@ xmlFreeNodeList(xmlNodePtr cur) {
next = cur->next;
parent = cur->parent;
if ((cur->type == XML_DOCUMENT_NODE) ||
-#ifdef LIBXML_DOCB_ENABLED
- (cur->type == XML_DOCB_DOCUMENT_NODE) ||
-#endif
(cur->type == XML_HTML_DOCUMENT_NODE)) {
xmlFreeDoc((xmlDocPtr) cur);
} else if (cur->type != XML_DTD_NODE) {
@@ -3809,18 +3853,18 @@ xmlFreeNode(xmlNodePtr cur) {
if ((cur->children != NULL) &&
(cur->type != XML_ENTITY_REF_NODE))
xmlFreeNodeList(cur->children);
- if (((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_XINCLUDE_START) ||
- (cur->type == XML_XINCLUDE_END)) &&
- (cur->properties != NULL))
- xmlFreePropList(cur->properties);
- if ((cur->type != XML_ELEMENT_NODE) &&
- (cur->content != NULL) &&
- (cur->type != XML_ENTITY_REF_NODE) &&
- (cur->type != XML_XINCLUDE_END) &&
- (cur->type != XML_XINCLUDE_START) &&
- (cur->content != (xmlChar *) &(cur->properties))) {
- DICT_FREE(cur->content)
+
+ if ((cur->type == XML_ELEMENT_NODE) ||
+ (cur->type == XML_XINCLUDE_START) ||
+ (cur->type == XML_XINCLUDE_END)) {
+ if (cur->properties != NULL)
+ xmlFreePropList(cur->properties);
+ if (cur->nsDef != NULL)
+ xmlFreeNsList(cur->nsDef);
+ } else if ((cur->content != NULL) &&
+ (cur->type != XML_ENTITY_REF_NODE) &&
+ (cur->content != (xmlChar *) &(cur->properties))) {
+ DICT_FREE(cur->content)
}
/*
@@ -3833,11 +3877,6 @@ xmlFreeNode(xmlNodePtr cur) {
(cur->type != XML_COMMENT_NODE))
DICT_FREE(cur->name)
- if (((cur->type == XML_ELEMENT_NODE) ||
- (cur->type == XML_XINCLUDE_START) ||
- (cur->type == XML_XINCLUDE_END)) &&
- (cur->nsDef != NULL))
- xmlFreeNsList(cur->nsDef);
xmlFree(cur);
}
@@ -3925,6 +3964,8 @@ xmlUnlinkNode(xmlNodePtr cur) {
* at the same place. If @cur was already inserted in a document it is
* first unlinked from its existing context.
*
+ * See the note regarding namespaces in xmlAddChild.
+ *
* Returns the @old node
*/
xmlNodePtr
@@ -4235,9 +4276,6 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
#ifdef LIBXML_TREE_ENABLED
return((xmlNodePtr) xmlCopyDoc((xmlDocPtr) node, extended));
#endif /* LIBXML_TREE_ENABLED */
@@ -4296,6 +4334,14 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
xmlRegisterNodeDefaultValue((xmlNodePtr)ret);
+ /*
+ * Note that since ret->parent is already set, xmlAddChild will
+ * return early and not actually insert the node. It will only
+ * coalesce text nodes and unnecessarily call xmlSetTreeDoc.
+ * Assuming that the subtree to be copied always has its text
+ * nodes coalesced, the somewhat confusing call to xmlAddChild
+ * could be removed.
+ */
tmp = xmlAddChild(parent, ret);
/* node could have coalesced */
if (tmp != ret)
@@ -4351,8 +4397,49 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
}
ret->last = ret->children;
} else if ((node->children != NULL) && (extended != 2)) {
- ret->children = xmlStaticCopyNodeList(node->children, doc, ret);
- UPDATE_LAST_CHILD_AND_PARENT(ret)
+ xmlNodePtr cur, insert;
+
+ cur = node->children;
+ insert = ret;
+ while (cur != NULL) {
+ xmlNodePtr copy = xmlStaticCopyNode(cur, doc, insert, 2);
+ if (copy == NULL) {
+ xmlFreeNode(ret);
+ return(NULL);
+ }
+
+ /* Check for coalesced text nodes */
+ if (insert->last != copy) {
+ if (insert->last == NULL) {
+ insert->children = copy;
+ } else {
+ copy->prev = insert->last;
+ insert->last->next = copy;
+ }
+ insert->last = copy;
+ }
+
+ if ((cur->type != XML_ENTITY_REF_NODE) &&
+ (cur->children != NULL)) {
+ cur = cur->children;
+ insert = copy;
+ continue;
+ }
+
+ while (1) {
+ if (cur->next != NULL) {
+ cur = cur->next;
+ break;
+ }
+
+ cur = cur->parent;
+ insert = insert->parent;
+ if (cur == node) {
+ cur = NULL;
+ break;
+ }
+ }
+ }
}
out:
@@ -4718,12 +4805,12 @@ xmlGetNodePath(const xmlNode *node)
return (NULL);
buf_len = 500;
- buffer = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMallocAtomic(buf_len);
if (buffer == NULL) {
xmlTreeErrMemory("getting node path");
return (NULL);
}
- buf = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar));
+ buf = (xmlChar *) xmlMallocAtomic(buf_len);
if (buf == NULL) {
xmlTreeErrMemory("getting node path");
xmlFree(buffer);
@@ -5037,9 +5124,6 @@ xmlNodeSetLang(xmlNodePtr cur, const xmlChar *lang) {
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_NAMESPACE_DECL:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
return;
@@ -5113,9 +5197,6 @@ xmlNodeSetSpacePreserve(xmlNodePtr cur, int val) {
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return;
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
@@ -5196,9 +5277,6 @@ xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) {
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return;
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
@@ -5269,9 +5347,6 @@ xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) {
case XML_ATTRIBUTE_NODE:
break;
case XML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
case XML_HTML_DOCUMENT_NODE: {
xmlDocPtr doc = (xmlDocPtr) cur;
@@ -5533,9 +5608,6 @@ xmlBufGetNodeContent(xmlBufPtr buf, const xmlNode *cur)
case XML_XINCLUDE_END:
break;
case XML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
case XML_HTML_DOCUMENT_NODE:
cur = cur->children;
while (cur!= NULL) {
@@ -5583,6 +5655,7 @@ xmlNodeGetContent(const xmlNode *cur)
buf = xmlBufCreateSize(64);
if (buf == NULL)
return (NULL);
+ xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
xmlBufGetNodeContent(buf, cur);
ret = xmlBufDetach(buf);
xmlBufFree(buf);
@@ -5608,6 +5681,7 @@ xmlNodeGetContent(const xmlNode *cur)
buf = xmlBufCreate();
if (buf == NULL)
return (NULL);
+ xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
xmlBufGetNodeContent(buf, cur);
@@ -5623,9 +5697,6 @@ xmlNodeGetContent(const xmlNode *cur)
case XML_XINCLUDE_END:
return (NULL);
case XML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
case XML_HTML_DOCUMENT_NODE: {
xmlBufPtr buf;
xmlChar *ret;
@@ -5633,6 +5704,7 @@ xmlNodeGetContent(const xmlNode *cur)
buf = xmlBufCreate();
if (buf == NULL)
return (NULL);
+ xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
xmlBufGetNodeContent(buf, (xmlNodePtr) cur);
@@ -5710,16 +5782,12 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
} else
cur->content = NULL;
cur->properties = NULL;
- cur->nsDef = NULL;
break;
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
break;
case XML_NOTATION_NODE:
break;
@@ -5788,7 +5856,6 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
} else
cur->content = NULL;
cur->properties = NULL;
- cur->nsDef = NULL;
break;
case XML_DOCUMENT_NODE:
case XML_DTD_NODE:
@@ -5797,9 +5864,6 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
break;
case XML_ELEMENT_DECL:
/* TODO !!! */
@@ -5841,7 +5905,7 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
xmlNodePtr last, newNode, tmp;
last = cur->last;
- newNode = xmlNewTextLen(content, len);
+ newNode = xmlNewDocTextLen(cur->doc, content, len);
if (newNode != NULL) {
tmp = xmlAddChild(cur, newNode);
if (tmp != newNode)
@@ -5867,11 +5931,11 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
xmlDictOwns(cur->doc->dict, cur->content))) {
cur->content = xmlStrncatNew(cur->content, content, len);
cur->properties = NULL;
- cur->nsDef = NULL;
- break;
- }
- cur->content = xmlStrncat(cur->content, content, len);
+ } else {
+ cur->content = xmlStrncat(cur->content, content, len);
+ }
}
+ break;
case XML_DOCUMENT_NODE:
case XML_DTD_NODE:
case XML_HTML_DOCUMENT_NODE:
@@ -5879,9 +5943,6 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
break;
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
@@ -7082,7 +7143,7 @@ xmlBufferCreate(void) {
ret->use = 0;
ret->size = xmlDefaultBufferSize;
ret->alloc = xmlBufferAllocScheme;
- ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
+ ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
if (ret->content == NULL) {
xmlTreeErrMemory("creating buffer");
xmlFree(ret);
@@ -7104,6 +7165,8 @@ xmlBufferPtr
xmlBufferCreateSize(size_t size) {
xmlBufferPtr ret;
+ if (size >= UINT_MAX)
+ return(NULL);
ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
if (ret == NULL) {
xmlTreeErrMemory("creating buffer");
@@ -7111,9 +7174,9 @@ xmlBufferCreateSize(size_t size) {
}
ret->use = 0;
ret->alloc = xmlBufferAllocScheme;
- ret->size = (size ? size+2 : 0); /* +1 for ending null */
+ ret->size = (size ? size + 1 : 0); /* +1 for ending null */
if (ret->size){
- ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
+ ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
if (ret->content == NULL) {
xmlTreeErrMemory("creating buffer");
xmlFree(ret);
@@ -7171,6 +7234,8 @@ xmlBufferCreateStatic(void *mem, size_t size) {
if ((mem == NULL) || (size == 0))
return(NULL);
+ if (size > UINT_MAX)
+ return(NULL);
ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
if (ret == NULL) {
@@ -7318,28 +7383,25 @@ xmlBufferShrink(xmlBufferPtr buf, unsigned int len) {
*/
int
xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
- int size;
+ unsigned int size;
xmlChar *newbuf;
if (buf == NULL) return(-1);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
- if (len + buf->use < buf->size) return(0);
+ if (len < buf->size - buf->use)
+ return(0);
+ if (len >= UINT_MAX - buf->use) {
+ xmlTreeErrMemory("growing buffer past UINT_MAX");
+ return(-1);
+ }
- /*
- * Windows has a BIG problem on realloc timing, so we try to double
- * the buffer size (if that's enough) (bug 146697)
- * Apparently BSD too, and it's probably best for linux too
- * On an embedded system this may be something to change
- */
-#if 1
- if (buf->size > len)
- size = buf->size * 2;
- else
- size = buf->use + len + 100;
-#else
- size = buf->use + len + 100;
-#endif
+ if (buf->size > (size_t) len) {
+ size = buf->size > UINT_MAX / 2 ? UINT_MAX : buf->size * 2;
+ } else {
+ size = buf->use + len;
+ size = size > UINT_MAX - 100 ? UINT_MAX : size + 100;
+ }
if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
size_t start_buf = buf->content - buf->contentIO;
@@ -7360,7 +7422,7 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
buf->content = newbuf;
}
buf->size = size;
- return(buf->size - buf->use);
+ return(buf->size - buf->use - 1);
}
/**
@@ -7373,7 +7435,7 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
*/
int
xmlBufferDump(FILE *file, xmlBufferPtr buf) {
- int ret;
+ size_t ret;
if (buf == NULL) {
#ifdef DEBUG_BUFFER
@@ -7391,8 +7453,8 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) {
}
if (file == NULL)
file = stdout;
- ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file);
- return(ret);
+ ret = fwrite(buf->content, 1, buf->use, file);
+ return(ret > INT_MAX ? INT_MAX : ret);
}
/**
@@ -7457,7 +7519,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
return 1;
if (size > UINT_MAX - 10) {
- xmlTreeErrMemory("growing buffer");
+ xmlTreeErrMemory("growing buffer past UINT_MAX");
return 0;
}
@@ -7466,7 +7528,10 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
case XML_BUFFER_ALLOC_IO:
case XML_BUFFER_ALLOC_DOUBLEIT:
/*take care of empty case*/
- newSize = (buf->size ? buf->size : size + 10);
+ if (buf->size == 0)
+ newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10);
+ else
+ newSize = buf->size;
while (size > newSize) {
if (newSize > UINT_MAX / 2) {
xmlTreeErrMemory("growing buffer");
@@ -7476,7 +7541,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
}
break;
case XML_BUFFER_ALLOC_EXACT:
- newSize = size+10;
+ newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10);
break;
case XML_BUFFER_ALLOC_HYBRID:
if (buf->use < BASE_BUFFER_SIZE)
@@ -7494,7 +7559,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
break;
default:
- newSize = size+10;
+ newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10);
break;
}
@@ -7519,6 +7584,8 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
} else {
if (buf->content == NULL) {
rebuf = (xmlChar *) xmlMallocAtomic(newSize);
+ buf->use = 0;
+ rebuf[buf->use] = 0;
} else if (buf->size - buf->use < 100) {
rebuf = (xmlChar *) xmlRealloc(buf->content, newSize);
} else {
@@ -7580,15 +7647,20 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
if (len < 0) return -1;
if (len == 0) return 0;
- needSize = buf->use + len + 2;
- if (needSize > buf->size){
+ /* Note that both buf->size and buf->use can be zero here. */
+ if ((unsigned) len >= buf->size - buf->use) {
+ if ((unsigned) len >= UINT_MAX - buf->use) {
+ xmlTreeErrMemory("growing buffer past UINT_MAX");
+ return XML_ERR_NO_MEMORY;
+ }
+ needSize = buf->use + len + 1;
if (!xmlBufferResize(buf, needSize)){
xmlTreeErrMemory("growing buffer");
return XML_ERR_NO_MEMORY;
}
}
- memmove(&buf->content[buf->use], str, len*sizeof(xmlChar));
+ memmove(&buf->content[buf->use], str, len);
buf->use += len;
buf->content[buf->use] = 0;
return 0;
@@ -7645,11 +7717,17 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
memmove(&buf->content[0], str, len);
buf->use += len;
buf->size += len;
+ buf->content[buf->use] = 0;
return(0);
}
}
- needSize = buf->use + len + 2;
- if (needSize > buf->size){
+ /* Note that both buf->size and buf->use can be zero here. */
+ if ((unsigned) len >= buf->size - buf->use) {
+ if ((unsigned) len >= UINT_MAX - buf->use) {
+ xmlTreeErrMemory("growing buffer past UINT_MAX");
+ return(-1);
+ }
+ needSize = buf->use + len + 1;
if (!xmlBufferResize(buf, needSize)){
xmlTreeErrMemory("growing buffer");
return XML_ERR_NO_MEMORY;
@@ -7694,29 +7772,7 @@ xmlBufferCat(xmlBufferPtr buf, const xmlChar *str) {
*/
int
xmlBufferCCat(xmlBufferPtr buf, const char *str) {
- const char *cur;
-
- if (buf == NULL)
- return(-1);
- if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
- if (str == NULL) {
-#ifdef DEBUG_BUFFER
- xmlGenericError(xmlGenericErrorContext,
- "xmlBufferCCat: str == NULL\n");
-#endif
- return -1;
- }
- for (cur = str;*cur != 0;cur++) {
- if (buf->use + 10 >= buf->size) {
- if (!xmlBufferResize(buf, buf->use+10)){
- xmlTreeErrMemory("growing buffer");
- return XML_ERR_NO_MEMORY;
- }
- }
- buf->content[buf->use++] = *cur;
- }
- buf->content[buf->use] = 0;
- return 0;
+ return xmlBufferCat(buf, (const xmlChar *) str);
}
/**
@@ -9545,7 +9601,8 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
/*
* Attributes (xmlAttr).
*/
- clone = (xmlNodePtr) xmlMalloc(sizeof(xmlAttr));
+ /* Use xmlRealloc to avoid -Warray-bounds warning */
+ clone = (xmlNodePtr) xmlRealloc(NULL, sizeof(xmlAttr));
if (clone == NULL) {
xmlTreeErrMemory("xmlDOMWrapCloneNode(): allocating an attr-node");
goto internal_error;
@@ -10188,3 +10245,48 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt,
return (0);
}
+/************************************************************************
+ * *
+ * XHTML detection *
+ * *
+ ************************************************************************/
+
+#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
+ "-//W3C//DTD XHTML 1.0 Strict//EN"
+#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
+ "-//W3C//DTD XHTML 1.0 Frameset//EN"
+#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
+#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+/**
+ * xmlIsXHTML:
+ * @systemID: the system identifier
+ * @publicID: the public identifier
+ *
+ * Try to find if the document correspond to an XHTML DTD
+ *
+ * Returns 1 if true, 0 if not and -1 in case of error
+ */
+int
+xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
+ if ((systemID == NULL) && (publicID == NULL))
+ return(-1);
+ if (publicID != NULL) {
+ if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
+ if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
+ if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
+ }
+ if (systemID != NULL) {
+ if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
+ if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
+ if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
+ }
+ return(0);
+}
+
diff --git a/chromium/third_party/libxml/src/uri.c b/chromium/third_party/libxml/src/uri.c
index e5c790ebd91..e6f1c3e704a 100644
--- a/chromium/third_party/libxml/src/uri.c
+++ b/chromium/third_party/libxml/src/uri.c
@@ -19,6 +19,8 @@
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
+#include "private/error.h"
+
/**
* MAX_URI_LENGTH:
*
@@ -1074,7 +1076,7 @@ xmlSaveUri(xmlURIPtr uri) {
max = 80;
- ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar));
+ ret = (xmlChar *) xmlMallocAtomic(max + 1);
if (ret == NULL) {
xmlURIErrMemory("saving URI\n");
return(NULL);
@@ -1655,6 +1657,7 @@ xmlURIUnescapeString(const char *str, int len, char *target) {
c = c * 16 + (*in - 'A') + 10;
in++;
len -= 3;
+ /* Explicit sign change */
*out++ = (char) c;
} else {
*out++ = *in++;
diff --git a/chromium/third_party/libxml/src/valid.c b/chromium/third_party/libxml/src/valid.c
index 16fa9238bc3..182ffed1df2 100644
--- a/chromium/third_party/libxml/src/valid.c
+++ b/chromium/third_party/libxml/src/valid.c
@@ -23,6 +23,9 @@
#include <libxml/list.h>
#include <libxml/globals.h>
+#include "private/error.h"
+#include "private/parser.h"
+
static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
int create);
/* #define DEBUG_VALID_ALGO */
@@ -518,11 +521,6 @@ xmlValidPrintNode(xmlNodePtr cur) {
case XML_HTML_DOCUMENT_NODE:
xmlGenericError(xmlGenericErrorContext, "?html? ");
break;
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
- xmlGenericError(xmlGenericErrorContext, "?docb? ");
- break;
-#endif
case XML_DTD_NODE:
xmlGenericError(xmlGenericErrorContext, "?dtd? ");
break;
@@ -837,7 +835,7 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
xmlSnprintfElementContent(expr, 5000, elem->content, 1);
xmlErrValidNode(ctxt, (xmlNodePtr) elem,
XML_DTD_CONTENT_NOT_DETERMINIST,
- "Content model of %s is not determinist: %s\n",
+ "Content model of %s is not deterministic: %s\n",
elem->name, BAD_CAST expr, NULL);
#ifdef DEBUG_REGEXP_ALGO
xmlRegexpPrint(stderr, elem->contModel);
@@ -1044,6 +1042,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
tmp->type = cur->type;
tmp->ocur = cur->ocur;
prev->c2 = tmp;
+ tmp->parent = prev;
if (cur->name != NULL) {
if (dict)
tmp->name = xmlDictLookup(dict, cur->name, -1);
@@ -4907,6 +4906,7 @@ cont:
*/
if ((CONT != NULL) &&
((CONT->parent == NULL) ||
+ (CONT->parent == (xmlElementContentPtr) 1) ||
(CONT->parent->type != XML_ELEMENT_CONTENT_OR)) &&
((CONT->ocur == XML_ELEMENT_CONTENT_MULT) ||
(CONT->ocur == XML_ELEMENT_CONTENT_OPT) ||
@@ -5019,7 +5019,7 @@ cont:
* save the second branch 'or' branch
*/
DEBUG_VALID_MSG("saving 'or' branch");
- if (vstateVPush(ctxt, CONT->c2, NODE, (unsigned char)(DEPTH + 1),
+ if (vstateVPush(ctxt, CONT->c2, NODE, DEPTH + 1,
OCCURS, ROLLBACK_OR) < 0)
return(-1);
DEPTH++;
@@ -5159,7 +5159,8 @@ analyze:
* Then act accordingly at the parent level
*/
RESET_OCCURRENCE;
- if (CONT->parent == NULL)
+ if ((CONT->parent == NULL) ||
+ (CONT->parent == (xmlElementContentPtr) 1))
break;
switch (CONT->parent->type) {
@@ -5283,9 +5284,6 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) {
break;
case XML_ATTRIBUTE_NODE:
case XML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
case XML_HTML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
@@ -5444,9 +5442,13 @@ fail:
STATE = 0;
ret = xmlValidateElementType(ctxt);
if ((ret == -3) && (warn)) {
- xmlErrValidWarning(ctxt, child, XML_DTD_CONTENT_NOT_DETERMINIST,
- "Content model for Element %s is ambiguous\n",
- name, NULL, NULL);
+ char expr[5000];
+ expr[0] = 0;
+ xmlSnprintfElementContent(expr, 5000, elemDecl->content, 1);
+ xmlErrValidNode(ctxt, (xmlNodePtr) elemDecl,
+ XML_DTD_CONTENT_NOT_DETERMINIST,
+ "Content model of %s is not deterministic: %s\n",
+ name, BAD_CAST expr, NULL);
} else if (ret == -2) {
/*
* An entities reference appeared at this level.
@@ -5667,6 +5669,7 @@ done:
return(ret);
}
+#ifdef LIBXML_REGEXP_ENABLED
/**
* xmlValidateCheckMixed:
* @ctxt: the validation context
@@ -5732,6 +5735,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt,
}
return(0);
}
+#endif /* LIBXML_REGEXP_ENABLED */
/**
* xmlValidGetElemDecl:
diff --git a/chromium/third_party/libxml/src/win32/Makefile.bcb b/chromium/third_party/libxml/src/win32/Makefile.bcb
index d326fb99568..4b0a2ef51ca 100644
--- a/chromium/third_party/libxml/src/win32/Makefile.bcb
+++ b/chromium/third_party/libxml/src/win32/Makefile.bcb
@@ -42,7 +42,7 @@ XML_INTDIR_A = int.a.bcb
UTILS_INTDIR = int.utils.bcb
# The preprocessor and its options.
-CPP = cpp32.exe -P- -DWIN32
+CPP = cpp32.exe -P-
CPPFLAGS = -I"$(XML_SRCDIR)\include" -DNOLIBTOOL
!if "$(WITH_THREADS)" != "no"
CPPFLAGS = $(CPPFLAGS) -D_REENTRANT -D__MT__
@@ -50,7 +50,7 @@ CPPFLAGS = $(CPPFLAGS) -D_REENTRANT -D__MT__
# The compiler and its options.
CC = bcc32.exe
-CFLAGS = -q -DWIN32 -D_NO_VCL -D_WINDOWS -D_MBCS -DEILSEQ=2 -DNOLIBTOOL -w-
+CFLAGS = -q -D_NO_VCL -D_WINDOWS -D_MBCS -DEILSEQ=2 -DNOLIBTOOL -w-
CFLAGS = $(CFLAGS) -I"$(XML_SRCDIR)" -I"$(XML_SRCDIR)\include" -I"$(INCPREFIX)" -I"$(INCLUDE)"
!if "$(WITH_THREADS)" != "no"
CFLAGS = $(CFLAGS) -D_REENTRANT -tWM
@@ -59,9 +59,7 @@ CFLAGS = $(CFLAGS) -D_REENTRANT -tWM
CFLAGS = $(CFLAGS) -tWR
!endif
!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls"
-CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
-!else if "$(WITH_THREADS)" == "native"
-CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS
+CFLAGS = $(CFLAGS) -DHAVE_COMPILER_TLS
!else if "$(WITH_THREADS)" == "posix"
CFLAGS = $(CFLAGS) -DHAVE_PTHREAD_H
!endif
@@ -119,7 +117,6 @@ XML_OBJS = $(XML_INTDIR)\buf.obj\
$(XML_INTDIR)\chvalid.obj\
$(XML_INTDIR)\debugXML.obj\
$(XML_INTDIR)\dict.obj\
- $(XML_INTDIR)\DOCBparser.obj\
$(XML_INTDIR)\encoding.obj\
$(XML_INTDIR)\entities.obj\
$(XML_INTDIR)\error.obj\
@@ -165,7 +162,6 @@ XML_OBJS_A = $(XML_INTDIR_A)\buf.obj\
$(XML_INTDIR_A)\chvalid.obj\
$(XML_INTDIR_A)\debugXML.obj\
$(XML_INTDIR_A)\dict.obj\
- $(XML_INTDIR_A)\DOCBparser.obj\
$(XML_INTDIR_A)\encoding.obj\
$(XML_INTDIR_A)\entities.obj\
$(XML_INTDIR_A)\error.obj\
@@ -207,18 +203,7 @@ XML_OBJS_A = $(XML_INTDIR_A)\buf.obj\
# Xmllint and friends executables.
UTILS = $(BINDIR)\xmllint.exe\
$(BINDIR)\xmlcatalog.exe\
- $(BINDIR)\testAutomata.exe\
- $(BINDIR)\testC14N.exe\
- $(BINDIR)\testDocbook.exe\
- $(BINDIR)\testHTML.exe\
- $(BINDIR)\testReader.exe\
- $(BINDIR)\testRelax.exe\
- $(BINDIR)\testRegexp.exe\
$(BINDIR)\testModule.exe\
- $(BINDIR)\testSAX.exe\
- $(BINDIR)\testSchemas.exe\
- $(BINDIR)\testURI.exe\
- $(BINDIR)\testXPath.exe\
$(BINDIR)\runtest.exe\
$(BINDIR)\runsuite.exe\
$(BINDIR)\testapi.exe\
diff --git a/chromium/third_party/libxml/src/win32/Makefile.mingw b/chromium/third_party/libxml/src/win32/Makefile.mingw
index 9dfa4abec69..bd0c4297d3f 100644
--- a/chromium/third_party/libxml/src/win32/Makefile.mingw
+++ b/chromium/third_party/libxml/src/win32/Makefile.mingw
@@ -40,19 +40,16 @@ endif
# The compiler and its options.
CC = gcc.exe
-CFLAGS += -DWIN32 -D_WINDOWS -D_MBCS -DNOLIBTOOL
+CFLAGS += -D_WINDOWS -D_MBCS -DNOLIBTOOL
CFLAGS += -I$(XML_SRCDIR) -I$(XML_SRCDIR)/include -I$(INCPREFIX) $(INCLUDE)
ifneq ($(WITH_THREADS),no)
CFLAGS += -D_REENTRANT
endif
ifeq ($(WITH_THREADS),yes)
-CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
+CFLAGS += -DHAVE_COMPILER_TLS
endif
ifeq ($(WITH_THREADS),ctls)
-CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
-endif
-ifeq ($(WITH_THREADS),native)
-CFLAGS += -DHAVE_WIN32_THREADS
+CFLAGS += -DHAVE_COMPILER_TLS
endif
ifeq ($(WITH_THREADS),posix)
CFLAGS += -DHAVE_PTHREAD_H
@@ -111,7 +108,6 @@ XML_OBJS = $(XML_INTDIR)/buf.o\
$(XML_INTDIR)/chvalid.o\
$(XML_INTDIR)/debugXML.o\
$(XML_INTDIR)/dict.o\
- $(XML_INTDIR)/DOCBparser.o\
$(XML_INTDIR)/encoding.o\
$(XML_INTDIR)/entities.o\
$(XML_INTDIR)/error.o\
@@ -159,7 +155,6 @@ XML_OBJS_A = $(XML_INTDIR_A)/buf.o\
$(XML_INTDIR_A)/chvalid.o\
$(XML_INTDIR_A)/debugXML.o\
$(XML_INTDIR_A)/dict.o\
- $(XML_INTDIR_A)/DOCBparser.o\
$(XML_INTDIR_A)/encoding.o\
$(XML_INTDIR_A)/entities.o\
$(XML_INTDIR_A)/error.o\
@@ -203,18 +198,7 @@ XML_SRCS_A = $(subst .o,.c,$(subst $(XML_INTDIR_A)/,$(XML_SRCDIR)/,$(XML_OBJS_A)
# Xmllint and friends executables.
UTILS = $(BINDIR)/xmllint.exe\
$(BINDIR)/xmlcatalog.exe\
- $(BINDIR)/testAutomata.exe\
- $(BINDIR)/testC14N.exe\
- $(BINDIR)/testDocbook.exe\
- $(BINDIR)/testHTML.exe\
- $(BINDIR)/testReader.exe\
- $(BINDIR)/testRegexp.exe\
$(BINDIR)/testModule.exe\
- $(BINDIR)/testRelax.exe\
- $(BINDIR)/testSAX.exe\
- $(BINDIR)/testSchemas.exe\
- $(BINDIR)/testURI.exe\
- $(BINDIR)/testXPath.exe\
$(BINDIR)/runtest.exe\
$(BINDIR)/runsuite.exe\
$(BINDIR)/testapi.exe\
diff --git a/chromium/third_party/libxml/src/win32/Makefile.msvc b/chromium/third_party/libxml/src/win32/Makefile.msvc
index 725b0ca1d68..7cc25b84a7d 100644
--- a/chromium/third_party/libxml/src/win32/Makefile.msvc
+++ b/chromium/third_party/libxml/src/win32/Makefile.msvc
@@ -50,9 +50,7 @@ CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX)
CFLAGS = $(CFLAGS) /D "_REENTRANT"
!endif
!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls"
-CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS" /D "HAVE_COMPILER_TLS"
-!else if "$(WITH_THREADS)" == "native"
-CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS"
+CFLAGS = $(CFLAGS) /D "HAVE_COMPILER_TLS"
!else if "$(WITH_THREADS)" == "posix"
CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H"
!endif
@@ -118,7 +116,6 @@ XML_OBJS = $(XML_INTDIR)\buf.obj\
$(XML_INTDIR)\chvalid.obj\
$(XML_INTDIR)\debugXML.obj\
$(XML_INTDIR)\dict.obj\
- $(XML_INTDIR)\DOCBparser.obj\
$(XML_INTDIR)\encoding.obj\
$(XML_INTDIR)\entities.obj\
$(XML_INTDIR)\error.obj\
@@ -164,7 +161,6 @@ XML_OBJS_A = $(XML_INTDIR_A)\buf.obj\
$(XML_INTDIR_A)\chvalid.obj\
$(XML_INTDIR_A)\debugXML.obj\
$(XML_INTDIR_A)\dict.obj\
- $(XML_INTDIR_A)\DOCBparser.obj\
$(XML_INTDIR_A)\encoding.obj\
$(XML_INTDIR_A)\entities.obj\
$(XML_INTDIR_A)\error.obj\
@@ -210,7 +206,6 @@ XML_OBJS_A_DLL = $(XML_INTDIR_A_DLL)\buf.obj\
$(XML_INTDIR_A_DLL)\chvalid.obj\
$(XML_INTDIR_A_DLL)\debugXML.obj\
$(XML_INTDIR_A_DLL)\dict.obj\
- $(XML_INTDIR_A_DLL)\DOCBparser.obj\
$(XML_INTDIR_A_DLL)\encoding.obj\
$(XML_INTDIR_A_DLL)\entities.obj\
$(XML_INTDIR_A_DLL)\error.obj\
@@ -258,18 +253,7 @@ XML_OBJS_A_DLL = $(XML_OBJS_A_DLL) $(XML_INTDIR_A_DLL)\xzlib.obj
# Xmllint and friends executables.
UTILS = $(BINDIR)\xmllint.exe\
$(BINDIR)\xmlcatalog.exe\
- $(BINDIR)\testAutomata.exe\
- $(BINDIR)\testC14N.exe\
- $(BINDIR)\testDocbook.exe\
- $(BINDIR)\testHTML.exe\
- $(BINDIR)\testReader.exe\
- $(BINDIR)\testRelax.exe\
- $(BINDIR)\testRegexp.exe\
$(BINDIR)\testModule.exe\
- $(BINDIR)\testSAX.exe\
- $(BINDIR)\testSchemas.exe\
- $(BINDIR)\testURI.exe\
- $(BINDIR)\testXPath.exe\
$(BINDIR)\runtest.exe\
$(BINDIR)\runsuite.exe\
$(BINDIR)\runxmlconf.exe\
@@ -440,63 +424,3 @@ checktests : $(UTILS)
cd .. && win32\$(BINDIR)\testdict.exe
cd .. && win32\$(BINDIR)\runxmlconf.exe
-XPathtests : $(BINDIR)\testXPath.exe
- @echo. 2> .memdump
- @echo ## XPath regression tests
- @-$(BINDIR)\testXPath.exe | find /C "support not compiled in" 1>nul
- @if %ERRORLEVEL% NEQ 0 @( \
- echo Skipping debug not compiled in\
- @exit 0 \
- )
- @for %%I in ($(XML_SRCDIR)\test\XPath\expr\*.*) do @( \
- @IF NOT EXIST $(XML_SRCDIR)\result\XPath\expr\%%~nxI ( \
- @echo New test %%~nxI &&\
- @echo %%~nxI &&\
- $(BINDIR)\testXPath.exe -f --expr %%I > $(XML_SRCDIR)/result/XPath/expr/%%~nxI &&\
- findstr /C:"MEMORY ALLOCATED : 0" \
- ) ELSE ( \
- $(BINDIR)\testXPath.exe -f --expr %%I 2>&1 > result.%%~nxI &&\
- fc $(XML_SRCDIR)\result\XPath\expr\%%~nxI result.%%~nxI >nul &\
- iF ERRORLEVEL 1 exit 1 & \
- findstr "MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" >nul &&\
- del result.%%~nxI \
- ) \
- )
- @for %%I in ($(XML_SRCDIR)\test\XPath\docs\*.*) do @( \
- for %%J in ($(XML_SRCDIR)\test\XPath\tests\%%~nxI*.*) do @( \
- if not exist $(XML_SRCDIR)\result\XPath\tests\%%~nxJ ( \
- $(BINDIR)\testXPath.exe -f -i %%I %%J > $(XML_SRCDIR)\result\XPath\tests\%%~nxJ &&\
- findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > nul \
- ) ELSE ( \
- $(BINDIR)\testXPAth.exe -f -i %%I %%J 2>&1 > result.%%~nxJ &&\
- findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0">null &&\
- fc $(XML_SRCDIR)\result\XPath\tests\%%~nxJ result.%%~nxJ >null & \
- IF ERRORLEVEL 1 (echo Error: %%I %%J & exit 1) & \
- del result.%%~nxJ \
- )\
- )\
- )
-
-XMLtests : $(BINDIR)\xmllint.exe
- @echo. 2> .memdump
- @echo ## XML regression tests
- -@for %%I in ($(XML_SRCDIR)\test\*) do @( \
- if not exist $(XML_SRCDIR)\result\%%~nxI ( \
- echo New test file %%~nxI &\
- $(BINDIR)\xmllint.exe %%I > $(XML_SRCDIR)\result\%%~nxI && \
- findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > null \
- ) ELSE ( \
- $(BINDIR)\xmllint.exe %%I 2>&1 > result.%%~nxI && \
- findstr /C:"MEMORY ALLOC" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > null && \
- fc $(XML_SRCDIR)\result\%%~nxI result.%%~nxI > null && \
- $(BINDIR)\xmllint.exe result.%%~nxI 2>&1 > result2.%%~nxI | findstr /V /C:"failed to load external entity" && \
- fc result.%%~nxI result2.%%~nxI & \
- del result.%%~nxI result2.%%~nxI\
- ) \
- )
-
-
-
-
-
-
diff --git a/chromium/third_party/libxml/src/win32/configure.js b/chromium/third_party/libxml/src/win32/configure.js
index d784f3bf7b1..e53cfcb7838 100644
--- a/chromium/third_party/libxml/src/win32/configure.js
+++ b/chromium/third_party/libxml/src/win32/configure.js
@@ -35,9 +35,9 @@ var withHttp = true;
var withHtml = true;
var withC14n = true;
var withCatalog = true;
-var withDocb = true;
var withXpath = true;
var withXptr = true;
+var withXptrLocs = false;
var withXinclude = true;
var withIconv = true;
var withIcu = false;
@@ -46,7 +46,6 @@ var withZlib = false;
var withLzma = false;
var withDebug = true;
var withMemDebug = false;
-var withRunDebug = false;
var withSchemas = true;
var withSchematron = true;
var withRegExps = true;
@@ -121,9 +120,9 @@ function usage()
txt += " html: Enable HTML processor (" + (withHtml? "yes" : "no") + ")\n";
txt += " c14n: Enable C14N support (" + (withC14n? "yes" : "no") + ")\n";
txt += " catalog: Enable catalog support (" + (withCatalog? "yes" : "no") + ")\n";
- txt += " docb: Enable DocBook support (" + (withDocb? "yes" : "no") + ")\n";
txt += " xpath: Enable XPath support (" + (withXpath? "yes" : "no") + ")\n";
txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n";
+ txt += " xptr_locs: Enable XPointer locs support (" + (withXptrLocs? "yes" : "no") + ")\n";
txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n";
txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n";
txt += " icu: Enable icu support (" + (withIcu? "yes" : "no") + ")\n";
@@ -132,7 +131,6 @@ function usage()
txt += " lzma: Enable lzma support (" + (withLzma? "yes" : "no") + ")\n";
txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n";
txt += " mem_debug: Enable memory debugger (" + (withMemDebug? "yes" : "no") + ")\n";
- txt += " run_debug: Enable memory debugger (" + (withRunDebug? "yes" : "no") + ")\n";
txt += " regexps: Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n";
txt += " modules: Enable module support (" + (withModules? "yes" : "no") + ")\n";
txt += " tree: Enable tree api (" + (withTree? "yes" : "no") + ")\n";
@@ -218,9 +216,9 @@ function discoverVersion()
vf.WriteLine("WITH_HTML=" + (withHtml? "1" : "0"));
vf.WriteLine("WITH_C14N=" + (withC14n? "1" : "0"));
vf.WriteLine("WITH_CATALOG=" + (withCatalog? "1" : "0"));
- vf.WriteLine("WITH_DOCB=" + (withDocb? "1" : "0"));
vf.WriteLine("WITH_XPATH=" + (withXpath? "1" : "0"));
vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0"));
+ vf.WriteLine("WITH_XPTR_LOCS=" + (withXptrLocs? "1" : "0"));
vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0"));
vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0"));
vf.WriteLine("WITH_ICU=" + (withIcu? "1" : "0"));
@@ -229,7 +227,6 @@ function discoverVersion()
vf.WriteLine("WITH_LZMA=" + (withLzma? "1" : "0"));
vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0"));
vf.WriteLine("WITH_MEM_DEBUG=" + (withMemDebug? "1" : "0"));
- vf.WriteLine("WITH_RUN_DEBUG=" + (withRunDebug? "1" : "0"));
vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0"));
vf.WriteLine("WITH_SCHEMATRON=" + (withSchematron? "1" : "0"));
vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0"));
@@ -315,12 +312,12 @@ function configureLibxml()
of.WriteLine(s.replace(/\@WITH_C14N\@/, withC14n? "1" : "0"));
} else if (s.search(/\@WITH_CATALOG\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_CATALOG\@/, withCatalog? "1" : "0"));
- } else if (s.search(/\@WITH_DOCB\@/) != -1) {
- of.WriteLine(s.replace(/\@WITH_DOCB\@/, withDocb? "1" : "0"));
} else if (s.search(/\@WITH_XPATH\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_XPATH\@/, withXpath? "1" : "0"));
} else if (s.search(/\@WITH_XPTR\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_XPTR\@/, withXptr? "1" : "0"));
+ } else if (s.search(/\@WITH_XPTR_LOCS\@/) != -1) {
+ of.WriteLine(s.replace(/\@WITH_XPTR_LOCS\@/, withXptrLocs? "1" : "0"));
} else if (s.search(/\@WITH_XINCLUDE\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0"));
} else if (s.search(/\@WITH_ICONV\@/) != -1) {
@@ -337,8 +334,6 @@ function configureLibxml()
of.WriteLine(s.replace(/\@WITH_DEBUG\@/, withDebug? "1" : "0"));
} else if (s.search(/\@WITH_MEM_DEBUG\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_MEM_DEBUG\@/, withMemDebug? "1" : "0"));
- } else if (s.search(/\@WITH_RUN_DEBUG\@/) != -1) {
- of.WriteLine(s.replace(/\@WITH_RUN_DEBUG\@/, withRunDebug? "1" : "0"));
} else if (s.search(/\@WITH_SCHEMAS\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_SCHEMAS\@/, withSchemas? "1" : "0"));
} else if (s.search(/\@WITH_SCHEMATRON\@/) != -1) {
@@ -470,12 +465,12 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
withC14n = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "catalog")
withCatalog = strToBool(arg.substring(opt.length + 1, arg.length));
- else if (opt == "docb")
- withDocb = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "xpath")
withXpath = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "xptr")
withXptr = strToBool(arg.substring(opt.length + 1, arg.length));
+ else if (opt == "xptr_locs")
+ withXptrLocs = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "xinclude")
withXinclude = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "iconv")
@@ -492,8 +487,6 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
withDebug = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "mem_debug")
withMemDebug = strToBool(arg.substring(opt.length + 1, arg.length));
- else if (opt == "run_debug")
- withRunDebug = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "schemas")
withSchemas = strToBool(arg.substring(opt.length + 1, arg.length));
else if (opt == "schematron")
@@ -661,9 +654,9 @@ txtOut += " HTTP client: " + boolToStr(withHttp) + "\n";
txtOut += " HTML processor: " + boolToStr(withHtml) + "\n";
txtOut += " C14N support: " + boolToStr(withC14n) + "\n";
txtOut += " Catalog support: " + boolToStr(withCatalog) + "\n";
-txtOut += " DocBook support: " + boolToStr(withDocb) + "\n";
txtOut += " XPath support: " + boolToStr(withXpath) + "\n";
txtOut += " XPointer support: " + boolToStr(withXptr) + "\n";
+txtOut += " XPointer locs: " + boolToStr(withXptrLocs) + "\n";
txtOut += " XInclude support: " + boolToStr(withXinclude) + "\n";
txtOut += " iconv support: " + boolToStr(withIconv) + "\n";
txtOut += " icu support: " + boolToStr(withIcu) + "\n";
@@ -672,7 +665,6 @@ txtOut += " zlib support: " + boolToStr(withZlib) + "\n";
txtOut += " lzma support: " + boolToStr(withLzma) + "\n";
txtOut += " Debugging module: " + boolToStr(withDebug) + "\n";
txtOut += " Memory debugging: " + boolToStr(withMemDebug) + "\n";
-txtOut += " Runtime debugging: " + boolToStr(withRunDebug) + "\n";
txtOut += " Regexp support: " + boolToStr(withRegExps) + "\n";
txtOut += " Module support: " + boolToStr(withModules) + "\n";
txtOut += " Tree support: " + boolToStr(withTree) + "\n";
diff --git a/chromium/third_party/libxml/src/win32/defgen.xsl b/chromium/third_party/libxml/src/win32/defgen.xsl
index a598ff19e5d..423a231189d 100644
--- a/chromium/third_party/libxml/src/win32/defgen.xsl
+++ b/chromium/third_party/libxml/src/win32/defgen.xsl
@@ -34,9 +34,6 @@
<xsl:if test="@file = 'debugXML'">
<xsl:text>#ifdef LIBXML_DEBUG_ENABLED&nl;</xsl:text>
</xsl:if>
- <xsl:if test="@file = 'DOCBparser'">
- <xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
- </xsl:if>
<xsl:if test="(@file = 'HTMLparser')
or (@file = 'HTMLtree')">
<xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
@@ -86,10 +83,6 @@
or (@name = 'xmlIOHTTPClose')">
<xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
</xsl:if>
- <xsl:if test="(@name = 'docbDefaultSAXHandlerInit')
- or (@name = 'initdocbDefaultSAXHandler')">
- <xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
- </xsl:if>
<xsl:if test="@name = 'xmlValidBuildContentModel'">
<xsl:text>#ifdef LIBXML_REGEXP_ENABLED&nl;</xsl:text>
</xsl:if>
@@ -129,8 +122,7 @@
<xsl:text> DATA&nl;</xsl:text>
<xsl:text>#endif&nl;</xsl:text>
</xsl:when>
- <xsl:when test="(@name = 'docbDefaultSAXHandler')
- or (@name = 'htmlDefaultSAXHandler')
+ <xsl:when test="(@name = 'htmlDefaultSAXHandler')
or (@name = 'oldXMLWDcompatibility')
or (@name = 'xmlBufferAllocScheme')
or (@name = 'xmlDefaultBufferSize')
@@ -153,33 +145,21 @@
or (@name = 'xmlRegisterNodeDefaultValue')
or (@name = 'xmlDeregisterNodeDefaultValue')">
<xsl:text>#ifdef LIBXML_THREAD_ENABLED&nl;</xsl:text>
- <xsl:if test="@name = 'docbDefaultSAXHandler'">
- <xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
- </xsl:if>
<xsl:if test="@name = 'htmlDefaultSAXHandler'">
<xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
</xsl:if>
<xsl:text>__</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&nl;</xsl:text>
- <xsl:if test="@name = 'docbDefaultSAXHandler'">
- <xsl:text>#endif&nl;</xsl:text>
- </xsl:if>
<xsl:if test="@name = 'htmlDefaultSAXHandler'">
<xsl:text>#endif&nl;</xsl:text>
</xsl:if>
<xsl:text>#else&nl;</xsl:text>
- <xsl:if test="@name = 'docbDefaultSAXHandler'">
- <xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
- </xsl:if>
<xsl:if test="@name = 'htmlDefaultSAXHandler'">
<xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
</xsl:if>
<xsl:value-of select="@name"/>
<xsl:text> DATA&nl;</xsl:text>
- <xsl:if test="@name = 'docbDefaultSAXHandler'">
- <xsl:text>#endif&nl;</xsl:text>
- </xsl:if>
<xsl:if test="@name = 'htmlDefaultSAXHandler'">
<xsl:text>#endif&nl;</xsl:text>
</xsl:if>
@@ -203,9 +183,6 @@
<xsl:if test="@file = 'debugXML'">
<xsl:text>#endif&nl;</xsl:text>
</xsl:if>
- <xsl:if test="@file = 'DOCBparser'">
- <xsl:text>#endif&nl;</xsl:text>
- </xsl:if>
<xsl:if test="(@file = 'HTMLparser')
or (@file = 'HTMLtree')">
<xsl:text>#endif&nl;</xsl:text>
@@ -255,10 +232,6 @@
or (@name = 'xmlIOHTTPClose')">
<xsl:text>#endif&nl;</xsl:text>
</xsl:if>
- <xsl:if test="(@name = 'docbDefaultSAXHandlerInit')
- or (@name = 'initdocbDefaultSAXHandler')">
- <xsl:text>#endif&nl;</xsl:text>
- </xsl:if>
<xsl:if test="@name = 'xmlValidBuildContentModel'">
<xsl:text>#endif&nl;</xsl:text>
</xsl:if>
diff --git a/chromium/third_party/libxml/src/win32/libxml2.def.src b/chromium/third_party/libxml/src/win32/libxml2.def.src
index c50d649846e..86f687baa7c 100644
--- a/chromium/third_party/libxml/src/win32/libxml2.def.src
+++ b/chromium/third_party/libxml/src/win32/libxml2.def.src
@@ -2,15 +2,6 @@
#include "../include/libxml/xmlversion.h"
LIBRARY libxml2
EXPORTS
-#ifdef LIBXML_THREAD_ENABLED
-#ifdef LIBXML_DOCB_ENABLED
-__docbDefaultSAXHandler
-#endif
-#else
-#ifdef LIBXML_DOCB_ENABLED
-docbDefaultSAXHandler DATA
-#endif
-#endif
#ifdef LIBXML_REGEXP_ENABLED
emptyExp DATA
#endif
@@ -191,39 +182,6 @@ cdataBlock
characters
checkNamespace
comment
-#ifdef LIBXML_DOCB_ENABLED
-docbCreateFileParserCtxt
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbCreatePushParserCtxt
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbDefaultSAXHandlerInit
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbEncodeEntities
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbFreeParserCtxt
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbParseChunk
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbParseDoc
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbParseDocument
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbParseFile
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbSAXParseDoc
-#endif
-#ifdef LIBXML_DOCB_ENABLED
-docbSAXParseFile
-#endif
elementDecl
endDocument
endElement
@@ -246,8 +204,10 @@ htmlAttrAllowed
htmlAutoCloseTag
#endif
#ifdef LIBXML_HTML_ENABLED
+#ifdef LIBXML_HTML_ENABLED
htmlCreateFileParserCtxt
#endif
+#endif
#ifdef LIBXML_HTML_ENABLED
htmlCreateMemoryParserCtxt
#endif
@@ -318,8 +278,10 @@ htmlGetMetaEncoding
htmlHandleOmittedElem
#endif
#ifdef LIBXML_HTML_ENABLED
+#ifdef LIBXML_HTML_ENABLED
htmlInitAutoClose
#endif
+#endif
#ifdef LIBXML_HTML_ENABLED
htmlIsAutoClosed
#endif
@@ -339,6 +301,9 @@ htmlNewDocNoDtD
htmlNewParserCtxt
#endif
#ifdef LIBXML_HTML_ENABLED
+htmlNewSAXParserCtxt
+#endif
+#ifdef LIBXML_HTML_ENABLED
htmlNodeDump
#endif
#ifdef LIBXML_HTML_ENABLED
@@ -415,9 +380,6 @@ htmlTagLookup
#endif
ignorableWhitespace
initGenericErrorDefaultFunc
-#ifdef LIBXML_DOCB_ENABLED
-initdocbDefaultSAXHandler
-#endif
#ifdef LIBXML_HTML_ENABLED
inithtmlDefaultSAXHandler
#endif
@@ -802,7 +764,6 @@ xmlElemDump
xmlEncodeEntities
xmlEncodeEntitiesReentrant
xmlEncodeSpecialChars
-xmlErrMemory
#ifdef LIBXML_REGEXP_ENABLED
xmlExpCtxtNbCons
#endif
@@ -1259,6 +1220,7 @@ xmlNewParserCtxt
xmlNewProp
xmlNewRMutex
xmlNewReference
+xmlNewSAXParserCtxt
xmlNewStringInputStream
xmlNewText
xmlNewTextChild
@@ -1580,7 +1542,6 @@ xmlSAX2HasExternalSubset
xmlSAX2HasInternalSubset
xmlSAX2IgnorableWhitespace
xmlSAX2InitDefaultSAXHandler
-xmlSAX2InitDocbDefaultSAXHandler
xmlSAX2InitHtmlDefaultSAXHandler
xmlSAX2InternalSubset
xmlSAX2IsStandalone
diff --git a/chromium/third_party/libxml/src/xmlIO.c b/chromium/third_party/libxml/src/xmlIO.c
index a80ef11f1a5..834b4ae5874 100644
--- a/chromium/third_party/libxml/src/xmlIO.c
+++ b/chromium/third_party/libxml/src/xmlIO.c
@@ -15,9 +15,6 @@
#include <stdlib.h>
#include <errno.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@@ -37,6 +34,8 @@
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include <io.h>
+#include <direct.h>
#endif
#ifndef S_ISDIR
@@ -64,8 +63,11 @@
#endif
#include <libxml/globals.h>
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/io.h"
+#include "private/parser.h"
/* #define VERBOSE_FAILURE */
/* #define DEBUG_EXTERNAL_ENTITIES */
@@ -109,9 +111,6 @@ typedef struct _xmlOutputCallback {
static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
static int xmlOutputCallbackNr = 0;
static int xmlOutputCallbackInitialized = 0;
-
-xmlOutputBufferPtr
-xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
@@ -120,7 +119,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
* *
************************************************************************/
-static const char *IOerr[] = {
+static const char* const IOerr[] = {
"Unknown IO error", /* UNKNOWN */
"Permission denied", /* EACCES */
"Resource temporarily unavailable",/* EAGAIN */
@@ -1128,7 +1127,7 @@ xmlGzfileOpen_real (const char *filename) {
* xmlGzfileOpen:
* @filename: the URI for matching
*
- * Wrapper around xmlGzfileOpen if the open fais, it will
+ * Wrapper around xmlGzfileOpen_real if the open fails, it will
* try to unescape @filename
*/
static void *
@@ -1264,7 +1263,7 @@ xmlGzfileClose (void * context) {
* I/O for compressed file accesses *
* *
************************************************************************/
-#include "xzlib.h"
+#include "private/xzlib.h"
/**
* xmlXzfileMatch:
* @filename: the URI for matching
@@ -2033,8 +2032,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
xmlGenericError( xmlGenericErrorContext,
"Transmitted content saved in file: %s\n", buffer );
- fwrite( http_content, sizeof( char ),
- content_lgth, tst_file );
+ fwrite( http_content, 1, content_lgth, tst_file );
fclose( tst_file );
}
@@ -2048,7 +2046,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
while ( (avail = xmlNanoHTTPRead( http_ctxt,
buffer, sizeof( buffer ) )) > 0 ) {
- fwrite( buffer, sizeof( char ), avail, tst_file );
+ fwrite( buffer, 1, avail, tst_file );
}
fclose( tst_file );
@@ -2344,7 +2342,7 @@ xmlAllocParserInputBuffer(xmlCharEncoding enc) {
xmlIOErrMemory("creating input buffer");
return(NULL);
}
- memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
+ memset(ret, 0, sizeof(xmlParserInputBuffer));
ret->buffer = xmlBufCreateSize(2 * xmlDefaultBufferSize);
if (ret->buffer == NULL) {
xmlFree(ret);
@@ -2383,16 +2381,13 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
xmlIOErrMemory("creating output buffer");
return(NULL);
}
- memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
+ memset(ret, 0, sizeof(xmlOutputBuffer));
ret->buffer = xmlBufCreate();
if (ret->buffer == NULL) {
xmlFree(ret);
return(NULL);
}
-
- /* try to avoid a performance problem with Windows realloc() */
- if (xmlBufGetAllocationScheme(ret->buffer) == XML_BUFFER_ALLOC_EXACT)
- xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_DOUBLEIT);
+ xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_DOUBLEIT);
ret->encoder = encoder;
if (encoder != NULL) {
@@ -2434,7 +2429,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) {
xmlIOErrMemory("creating output buffer");
return(NULL);
}
- memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
+ memset(ret, 0, sizeof(xmlOutputBuffer));
ret->buffer = xmlBufCreate();
if (ret->buffer == NULL) {
xmlFree(ret);
@@ -2989,8 +2984,8 @@ xmlParserInputBufferCreateStatic(const char *mem, int size,
xmlIOErrMemory("creating input buffer");
return(NULL);
}
- memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
- ret->buffer = xmlBufCreateStatic((void *)mem, (size_t) size);
+ memset(ret, 0, sizeof(xmlParserInputBuffer));
+ ret->buffer = xmlBufCreateStatic((void *)mem, size);
if (ret->buffer == NULL) {
xmlFree(ret);
return(NULL);
@@ -3497,7 +3492,7 @@ xmlEscapeContent(unsigned char* out, int *outlen,
*out++ = '3';
*out++ = ';';
} else {
- *out++ = (unsigned char) *in;
+ *out++ = *in;
}
++in;
}
@@ -3548,7 +3543,7 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
* how many bytes to consume and how many bytes to store.
*/
cons = len;
- chunk = xmlBufAvail(out->buffer) - 1;
+ chunk = xmlBufAvail(out->buffer);
/*
* make sure we have enough room to save first, if this is
diff --git a/chromium/third_party/libxml/src/xmlmemory.c b/chromium/third_party/libxml/src/xmlmemory.c
index eeb76c3724f..892d50c306d 100644
--- a/chromium/third_party/libxml/src/xmlmemory.c
+++ b/chromium/third_party/libxml/src/xmlmemory.c
@@ -12,10 +12,6 @@
#include <ctype.h>
#include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
/* #define DEBUG_MEMORY */
/**
@@ -939,6 +935,9 @@ xmlMemoryDump(void)
/**
* xmlInitMemory:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* Initialize the memory layer.
*
* Returns 0 on success
@@ -978,6 +977,11 @@ xmlInitMemory(void)
/**
* xmlCleanupMemory:
*
+ * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * to free global state but see the warnings there. xmlCleanupParser
+ * should be only called once at program exit. In most cases, you don't
+ * have call cleanup functions at all.
+ *
* Free up all the memory allocated by the library for its own
* use. This should not be called by user level code.
*/
diff --git a/chromium/third_party/libxml/src/xmlreader.c b/chromium/third_party/libxml/src/xmlreader.c
index 45062a47095..9c2da90e456 100644
--- a/chromium/third_party/libxml/src/xmlreader.c
+++ b/chromium/third_party/libxml/src/xmlreader.c
@@ -39,7 +39,8 @@
#include <libxml/pattern.h>
#endif
-#include "buf.h"
+#include "private/buf.h"
+#include "private/tree.h"
#define MAX_ERR_MSG_SIZE 64000
@@ -1180,6 +1181,7 @@ xmlTextReaderCollectSiblings(xmlNodePtr node)
buffer = xmlBufferCreate();
if (buffer == NULL)
return NULL;
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
for ( ; node != NULL; node = node->next) {
switch (node->type) {
@@ -1384,9 +1386,6 @@ get_next_node:
reader->node = reader->node->parent;
if ((reader->node == NULL) ||
(reader->node->type == XML_DOCUMENT_NODE) ||
-#ifdef LIBXML_DOCB_ENABLED
- (reader->node->type == XML_DOCB_DOCUMENT_NODE) ||
-#endif
(reader->node->type == XML_HTML_DOCUMENT_NODE)) {
if (reader->mode != XML_TEXTREADER_MODE_EOF) {
val = xmlParseChunk(reader->ctxt, "", 0, 1);
@@ -1636,11 +1635,14 @@ xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
buff = xmlBufferCreate();
if (buff == NULL)
return NULL;
+ xmlBufferSetAllocationScheme(buff, XML_BUFFER_ALLOC_DOUBLEIT);
for (cur_node = reader->node->children; cur_node != NULL;
cur_node = cur_node->next) {
/* XXX: Why is the node copied? */
node = xmlDocCopyNode(cur_node, doc, 1);
+ /* XXX: Why do we need a second buffer? */
buff2 = xmlBufferCreate();
+ xmlBufferSetAllocationScheme(buff2, XML_BUFFER_ALLOC_DOUBLEIT);
if (xmlNodeDump(buff2, doc, node, 0, 0) == -1) {
xmlFreeNode(node);
xmlBufferFree(buff2);
@@ -1690,6 +1692,7 @@ xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
node = xmlDocCopyNode(node, doc, 1);
}
buff = xmlBufferCreate();
+ xmlBufferSetAllocationScheme(buff, XML_BUFFER_ALLOC_DOUBLEIT);
if (xmlNodeDump(buff, doc, node, 0, 0) == -1) {
xmlFreeNode(node);
xmlBufferFree(buff);
@@ -2020,7 +2023,7 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
}
/* no operation on a reader should require a huge buffer */
xmlBufSetAllocationScheme(ret->buffer,
- XML_BUFFER_ALLOC_BOUNDED);
+ XML_BUFFER_ALLOC_DOUBLEIT);
ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
if (ret->sax == NULL) {
xmlBufFree(ret->buffer);
@@ -2179,36 +2182,16 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
xmlFree(reader->patternTab);
}
#endif
- if (reader->faketext != NULL) {
- xmlFreeNode(reader->faketext);
- }
+ if (reader->mode != XML_TEXTREADER_MODE_CLOSED)
+ xmlTextReaderClose(reader);
if (reader->ctxt != NULL) {
if (reader->dict == reader->ctxt->dict)
reader->dict = NULL;
-#ifdef LIBXML_VALID_ENABLED
- if ((reader->ctxt->vctxt.vstateTab != NULL) &&
- (reader->ctxt->vctxt.vstateMax > 0)){
-#ifdef LIBXML_REGEXP_ENABLED
- while (reader->ctxt->vctxt.vstateNr > 0)
- xmlValidatePopElement(&reader->ctxt->vctxt, NULL, NULL, NULL);
-#endif /* LIBXML_REGEXP_ENABLED */
- xmlFree(reader->ctxt->vctxt.vstateTab);
- reader->ctxt->vctxt.vstateTab = NULL;
- reader->ctxt->vctxt.vstateMax = 0;
- }
-#endif /* LIBXML_VALID_ENABLED */
- if (reader->ctxt->myDoc != NULL) {
- if (reader->preserve == 0)
- xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);
- reader->ctxt->myDoc = NULL;
- }
if (reader->allocs & XML_TEXTREADER_CTXT)
xmlFreeParserCtxt(reader->ctxt);
}
if (reader->sax != NULL)
xmlFree(reader->sax);
- if ((reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT))
- xmlFreeParserInputBuffer(reader->input);
if (reader->buffer != NULL)
xmlBufFree(reader->buffer);
if (reader->entTab != NULL)
@@ -2239,7 +2222,23 @@ xmlTextReaderClose(xmlTextReaderPtr reader) {
reader->node = NULL;
reader->curnode = NULL;
reader->mode = XML_TEXTREADER_MODE_CLOSED;
+ if (reader->faketext != NULL) {
+ xmlFreeNode(reader->faketext);
+ reader->faketext = NULL;
+ }
if (reader->ctxt != NULL) {
+#ifdef LIBXML_VALID_ENABLED
+ if ((reader->ctxt->vctxt.vstateTab != NULL) &&
+ (reader->ctxt->vctxt.vstateMax > 0)){
+#ifdef LIBXML_REGEXP_ENABLED
+ while (reader->ctxt->vctxt.vstateNr > 0)
+ xmlValidatePopElement(&reader->ctxt->vctxt, NULL, NULL, NULL);
+#endif /* LIBXML_REGEXP_ENABLED */
+ xmlFree(reader->ctxt->vctxt.vstateTab);
+ reader->ctxt->vctxt.vstateTab = NULL;
+ reader->ctxt->vctxt.vstateMax = 0;
+ }
+#endif /* LIBXML_VALID_ENABLED */
xmlStopParser(reader->ctxt);
if (reader->ctxt->myDoc != NULL) {
if (reader->preserve == 0)
@@ -2978,9 +2977,6 @@ xmlTextReaderNodeType(xmlTextReaderPtr reader) {
return(XML_READER_TYPE_COMMENT);
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return(XML_READER_TYPE_DOCUMENT);
case XML_DOCUMENT_FRAG_NODE:
return(XML_READER_TYPE_DOCUMENT_FRAGMENT);
@@ -3135,9 +3131,6 @@ xmlTextReaderName(xmlTextReaderPtr reader) {
return(xmlStrdup(BAD_CAST "#comment"));
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return(xmlStrdup(BAD_CAST "#document"));
case XML_DOCUMENT_FRAG_NODE:
return(xmlStrdup(BAD_CAST "#document-fragment"));
@@ -3206,9 +3199,6 @@ xmlTextReaderConstName(xmlTextReaderPtr reader) {
return(CONSTSTR(BAD_CAST "#comment"));
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return(CONSTSTR(BAD_CAST "#document"));
case XML_DOCUMENT_FRAG_NODE:
return(CONSTSTR(BAD_CAST "#document-fragment"));
@@ -3567,7 +3557,7 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
return (NULL);
}
xmlBufSetAllocationScheme(reader->buffer,
- XML_BUFFER_ALLOC_BOUNDED);
+ XML_BUFFER_ALLOC_DOUBLEIT);
} else
xmlBufEmpty(reader->buffer);
xmlBufGetNodeContent(reader->buffer, node);
@@ -3577,7 +3567,7 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
xmlBufFree(reader->buffer);
reader->buffer = xmlBufCreateSize(100);
xmlBufSetAllocationScheme(reader->buffer,
- XML_BUFFER_ALLOC_BOUNDED);
+ XML_BUFFER_ALLOC_DOUBLEIT);
ret = BAD_CAST "";
}
return(ret);
@@ -3624,7 +3614,7 @@ xmlTextReaderQuoteChar(xmlTextReaderPtr reader) {
if (reader == NULL)
return(-1);
/* TODO maybe lookup the attribute value for " first */
- return((int) '"');
+ return('"');
}
/**
@@ -5091,7 +5081,7 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
}
/* no operation on a reader should require a huge buffer */
xmlBufSetAllocationScheme(reader->buffer,
- XML_BUFFER_ALLOC_BOUNDED);
+ XML_BUFFER_ALLOC_DOUBLEIT);
if (reader->sax == NULL)
reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
if (reader->sax == NULL) {
diff --git a/chromium/third_party/libxml/src/xmlsave.c b/chromium/third_party/libxml/src/xmlsave.c
index 3addd6528d6..77cb7b9b012 100644
--- a/chromium/third_party/libxml/src/xmlsave.c
+++ b/chromium/third_party/libxml/src/xmlsave.c
@@ -19,56 +19,14 @@
#include <libxml/HTMLtree.h>
-#include "buf.h"
-#include "enc.h"
-#include "save.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/save.h"
-/************************************************************************
- * *
- * XHTML detection *
- * *
- ************************************************************************/
-#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Strict//EN"
-#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Frameset//EN"
-#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
-#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
- "-//W3C//DTD XHTML 1.0 Transitional//EN"
-#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+#ifdef LIBXML_OUTPUT_ENABLED
#define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml"
-/**
- * xmlIsXHTML:
- * @systemID: the system identifier
- * @publicID: the public identifier
- *
- * Try to find if the document correspond to an XHTML DTD
- *
- * Returns 1 if true, 0 if not and -1 in case of error
- */
-int
-xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
- if ((systemID == NULL) && (publicID == NULL))
- return(-1);
- if (publicID != NULL) {
- if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
- if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
- if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
- }
- if (systemID != NULL) {
- if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
- if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
- if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
- }
- return(0);
-}
-
-#ifdef LIBXML_OUTPUT_ENABLED
#define TODO \
xmlGenericError(xmlGenericErrorContext, \
@@ -463,7 +421,7 @@ xmlAttrSerializeContent(xmlOutputBufferPtr buf, xmlAttrPtr attr)
*
* This will dump the content of the notation table as an XML DTD definition
*/
-void
+static void
xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
xmlBufferPtr buffer;
@@ -474,6 +432,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
*/
return;
}
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlDumpNotationTable(buffer, table);
xmlBufMergeBuffer(buf, buffer);
}
@@ -486,7 +445,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
* This will dump the content of the element declaration as an XML
* DTD definition
*/
-void
+static void
xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
xmlBufferPtr buffer;
@@ -497,6 +456,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
*/
return;
}
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlDumpElementDecl(buffer, elem);
xmlBufMergeBuffer(buf, buffer);
}
@@ -509,7 +469,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
* This will dump the content of the attribute declaration as an XML
* DTD definition
*/
-void
+static void
xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
xmlBufferPtr buffer;
@@ -520,6 +480,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
*/
return;
}
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlDumpAttributeDecl(buffer, attr);
xmlBufMergeBuffer(buf, buffer);
}
@@ -531,7 +492,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
*
* This will dump the content of the entity table as an XML DTD definition
*/
-void
+static void
xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) {
xmlBufferPtr buffer;
@@ -542,6 +503,7 @@ xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) {
*/
return;
}
+ xmlBufferSetAllocationScheme(buffer, XML_BUFFER_ALLOC_DOUBLEIT);
xmlDumpEntityDecl(buffer, ent);
xmlBufMergeBuffer(buf, buffer);
}
@@ -591,7 +553,6 @@ static void
xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
#endif
static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
-void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur);
/**
@@ -1375,7 +1336,7 @@ xhtmlAttrListDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) {
(htmlIsBooleanAttr(cur->name))) {
if (cur->children != NULL)
xmlFreeNode(cur->children);
- cur->children = xmlNewText(cur->name);
+ cur->children = xmlNewDocText(cur->doc, cur->name);
if (cur->children != NULL)
cur->children->parent = (xmlNodePtr) cur;
}
@@ -2174,7 +2135,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
xmlBufBackToBuffer(buffer);
if (ret > INT_MAX)
return(-1);
- return((int) ret);
+ return(ret);
}
/**
diff --git a/chromium/third_party/libxml/src/xmlstring.c b/chromium/third_party/libxml/src/xmlstring.c
index d4d352b15bc..7fbf9d079e2 100644
--- a/chromium/third_party/libxml/src/xmlstring.c
+++ b/chromium/third_party/libxml/src/xmlstring.c
@@ -23,6 +23,9 @@
#include <libxml/parserInternals.h>
#include <libxml/xmlstring.h>
+#include "private/parser.h"
+#include "private/string.h"
+
/************************************************************************
* *
* Commodity functions to handle xmlChars *
@@ -43,12 +46,12 @@ xmlStrndup(const xmlChar *cur, int len) {
xmlChar *ret;
if ((cur == NULL) || (len < 0)) return(NULL);
- ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar));
+ ret = (xmlChar *) xmlMallocAtomic((size_t) len + 1);
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(NULL);
}
- memcpy(ret, cur, len * sizeof(xmlChar));
+ memcpy(ret, cur, len);
ret[len] = 0;
return(ret);
}
@@ -88,12 +91,13 @@ xmlCharStrndup(const char *cur, int len) {
xmlChar *ret;
if ((cur == NULL) || (len < 0)) return(NULL);
- ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar));
+ ret = (xmlChar *) xmlMallocAtomic((size_t) len + 1);
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(NULL);
}
for (i = 0;i < len;i++) {
+ /* Explicit sign change */
ret[i] = (xmlChar) cur[i];
if (ret[i] == 0) return(ret);
}
@@ -457,12 +461,12 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
size = xmlStrlen(cur);
if ((size < 0) || (size > INT_MAX - len))
return(NULL);
- ret = (xmlChar *) xmlRealloc(cur, ((size_t) size + len + 1) * sizeof(xmlChar));
+ ret = (xmlChar *) xmlRealloc(cur, (size_t) size + len + 1);
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(cur);
}
- memcpy(&ret[size], add, len * sizeof(xmlChar));
+ memcpy(&ret[size], add, len);
ret[size + len] = 0;
return(ret);
}
@@ -497,13 +501,13 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
size = xmlStrlen(str1);
if ((size < 0) || (size > INT_MAX - len))
return(NULL);
- ret = (xmlChar *) xmlMalloc(((size_t) size + len + 1) * sizeof(xmlChar));
+ ret = (xmlChar *) xmlMalloc((size_t) size + len + 1);
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(xmlStrndup(str1, size));
}
- memcpy(ret, str1, size * sizeof(xmlChar));
- memcpy(&ret[size], str2, len * sizeof(xmlChar));
+ memcpy(ret, str1, size);
+ memcpy(&ret[size], str2, len);
ret[size + len] = 0;
return(ret);
}
@@ -844,21 +848,17 @@ xmlUTF8Strsize(const xmlChar *utf, int len) {
while ( len-- > 0) {
if ( !*ptr )
break;
- if ( (ch = *ptr++) & 0x80) {
- // Workaround for an optimization bug in VS 2015 Update 2, remove
- // once the fix is released. crbug.com/599427
- // https://connect.microsoft.com/VisualStudio/feedback/details/2582138
- xmlChar ch2 = ch;
- while ((ch2<<=1) & 0x80 ) {
+ if ( (ch = *ptr++) & 0x80)
+ while ((ch<<=1) & 0x80 ) {
+ if (*ptr == 0) break;
ptr++;
- if (*ptr == 0) break;
- }
- }
+ }
}
ret = ptr - utf;
return (ret > INT_MAX ? 0 : ret);
}
+
/**
* xmlUTF8Strndup:
* @utf: the input UTF8 *
@@ -875,11 +875,11 @@ xmlUTF8Strndup(const xmlChar *utf, int len) {
if ((utf == NULL) || (len < 0)) return(NULL);
i = xmlUTF8Strsize(utf, len);
- ret = (xmlChar *) xmlMallocAtomic(((size_t) i + 1) * sizeof(xmlChar));
+ ret = (xmlChar *) xmlMallocAtomic((size_t) i + 1);
if (ret == NULL) {
return(NULL);
}
- memcpy(ret, utf, i * sizeof(xmlChar));
+ memcpy(ret, utf, i);
ret[i] = 0;
return(ret);
}
@@ -1026,7 +1026,7 @@ xmlEscapeFormatString(xmlChar **msg)
if ((count > INT_MAX) || (msgLen > INT_MAX - count))
return(NULL);
resultLen = msgLen + count + 1;
- result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
+ result = (xmlChar *) xmlMallocAtomic(resultLen);
if (result == NULL) {
/* Clear *msg to prevent format string vulnerabilities in
out-of-memory situations. */
diff --git a/chromium/third_party/libxml/src/xmlunicode.c b/chromium/third_party/libxml/src/xmlunicode.c
index d34ba8f31a5..677f25e8712 100644
--- a/chromium/third_party/libxml/src/xmlunicode.c
+++ b/chromium/third_party/libxml/src/xmlunicode.c
@@ -34,7 +34,7 @@ typedef struct {
} xmlUnicodeNameTable;
-static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname);
+static xmlIntFunc *xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname);
static const xmlUnicodeRange xmlUnicodeBlocks[] = {
{"AegeanNumbers", xmlUCSIsAegeanNumbers},
@@ -166,7 +166,7 @@ static const xmlUnicodeRange xmlUnicodeBlocks[] = {
{"YiSyllables", xmlUCSIsYiSyllables},
{"YijingHexagramSymbols", xmlUCSIsYijingHexagramSymbols}};
-static xmlUnicodeRange xmlUnicodeCats[] = {
+static const xmlUnicodeRange xmlUnicodeCats[] = {
{"C", xmlUCSIsCatC},
{"Cc", xmlUCSIsCatCc},
{"Cf", xmlUCSIsCatCf},
@@ -212,7 +212,7 @@ static const xmlChSRange xmlCS[] = {{0x0, 0x1f}, {0x7f, 0x9f},
static const xmlChLRange xmlCL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001},
{0xe0020, 0xe007f}, {0xf0000, 0xf0000}, {0xffffd, 0xffffd},
{0x100000, 0x100000}, {0x10fffd, 0x10fffd} };
-static xmlChRangeGroup xmlCG = {18,7,xmlCS,xmlCL};
+static const xmlChRangeGroup xmlCG = {18,7,xmlCS,xmlCL};
static const xmlChSRange xmlCfS[] = {{0xad, 0xad}, {0x600, 0x603},
{0x6dd, 0x6dd}, {0x70f, 0x70f}, {0x17b4, 0x17b5}, {0x200b, 0x200f},
@@ -220,7 +220,7 @@ static const xmlChSRange xmlCfS[] = {{0xad, 0xad}, {0x600, 0x603},
{0xfff9, 0xfffb} };
static const xmlChLRange xmlCfL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001},
{0xe0020, 0xe007f} };
-static xmlChRangeGroup xmlCfG = {11,3,xmlCfS,xmlCfL};
+static const xmlChRangeGroup xmlCfG = {11,3,xmlCfS,xmlCfL};
static const xmlChSRange xmlLS[] = {{0x41, 0x5a}, {0x61, 0x7a},
{0xaa, 0xaa}, {0xb5, 0xb5}, {0xba, 0xba}, {0xc0, 0xd6}, {0xd8, 0xf6},
@@ -309,7 +309,7 @@ static const xmlChLRange xmlLL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026},
{0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788},
{0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9},
{0x20000, 0x20000}, {0x2a6d6, 0x2a6d6}, {0x2f800, 0x2fa1d} };
-static xmlChRangeGroup xmlLG = {279,50,xmlLS,xmlLL};
+static const xmlChRangeGroup xmlLG = {279,50,xmlLS,xmlLL};
static const xmlChSRange xmlLlS[] = {{0x61, 0x7a}, {0xaa, 0xaa},
{0xb5, 0xb5}, {0xba, 0xba}, {0xdf, 0xf6}, {0xf8, 0xff}, {0x101, 0x101},
@@ -421,7 +421,7 @@ static const xmlChLRange xmlLlL[] = {{0x10428, 0x1044f}, {0x1d41a, 0x1d433},
{0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e},
{0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f},
{0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9} };
-static xmlChRangeGroup xmlLlG = {396,28,xmlLlS,xmlLlL};
+static const xmlChRangeGroup xmlLlG = {396,28,xmlLlS,xmlLlL};
static const xmlChSRange xmlLmS[] = {{0x2b0, 0x2c1}, {0x2c6, 0x2d1},
{0x2e0, 0x2e4}, {0x2ee, 0x2ee}, {0x37a, 0x37a}, {0x559, 0x559},
@@ -429,7 +429,7 @@ static const xmlChSRange xmlLmS[] = {{0x2b0, 0x2c1}, {0x2c6, 0x2d1},
{0x17d7, 0x17d7}, {0x1843, 0x1843}, {0x1d2c, 0x1d61}, {0x3005, 0x3005},
{0x3031, 0x3035}, {0x303b, 0x303b}, {0x309d, 0x309e}, {0x30fc, 0x30fe},
{0xff70, 0xff70}, {0xff9e, 0xff9f} };
-static xmlChRangeGroup xmlLmG = {20,0,xmlLmS,NULL};
+static const xmlChRangeGroup xmlLmG = {20,0,xmlLmS,NULL};
static const xmlChSRange xmlLoS[] = {{0x1bb, 0x1bb}, {0x1c0, 0x1c3},
{0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, {0x641, 0x64a},
@@ -492,12 +492,12 @@ static const xmlChLRange xmlLoL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026},
{0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835},
{0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x1083f},
{0x20000, 0x20000}, {0x2a6d6, 0x2a6d6}, {0x2f800, 0x2fa1d} };
-static xmlChRangeGroup xmlLoG = {211,20,xmlLoS,xmlLoL};
+static const xmlChRangeGroup xmlLoG = {211,20,xmlLoS,xmlLoL};
static const xmlChSRange xmlLtS[] = {{0x1c5, 0x1c5}, {0x1c8, 0x1c8},
{0x1cb, 0x1cb}, {0x1f2, 0x1f2}, {0x1f88, 0x1f8f}, {0x1f98, 0x1f9f},
{0x1fa8, 0x1faf}, {0x1fbc, 0x1fbc}, {0x1fcc, 0x1fcc}, {0x1ffc, 0x1ffc} };
-static xmlChRangeGroup xmlLtG = {10,0,xmlLtS,NULL};
+static const xmlChRangeGroup xmlLtG = {10,0,xmlLtS,NULL};
static const xmlChSRange xmlLuS[] = {{0x41, 0x5a}, {0xc0, 0xd6},
{0xd8, 0xde}, {0x100, 0x100}, {0x102, 0x102}, {0x104, 0x104},
@@ -608,7 +608,7 @@ static const xmlChLRange xmlLuL[] = {{0x10400, 0x10427}, {0x1d400, 0x1d419},
{0x1d608, 0x1d621}, {0x1d63c, 0x1d655}, {0x1d670, 0x1d689},
{0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734},
{0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8} };
-static xmlChRangeGroup xmlLuG = {390,31,xmlLuS,xmlLuL};
+static const xmlChRangeGroup xmlLuG = {390,31,xmlLuS,xmlLuL};
static const xmlChSRange xmlMS[] = {{0x300, 0x357}, {0x35d, 0x36f},
{0x483, 0x486}, {0x488, 0x489}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
@@ -642,7 +642,7 @@ static const xmlChSRange xmlMS[] = {{0x300, 0x357}, {0x35d, 0x36f},
static const xmlChLRange xmlML[] = {{0x1d165, 0x1d169}, {0x1d16d, 0x1d172},
{0x1d17b, 0x1d182}, {0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad},
{0xe0100, 0xe01ef} };
-static xmlChRangeGroup xmlMG = {113,6,xmlMS,xmlML};
+static const xmlChRangeGroup xmlMG = {113,6,xmlMS,xmlML};
static const xmlChSRange xmlMcS[] = {{0x903, 0x903}, {0x93e, 0x940},
{0x949, 0x94c}, {0x982, 0x983}, {0x9be, 0x9c0}, {0x9c7, 0x9c8},
@@ -660,7 +660,7 @@ static const xmlChSRange xmlMcS[] = {{0x903, 0x903}, {0x93e, 0x940},
{0x17c7, 0x17c8}, {0x1923, 0x1926}, {0x1929, 0x192b}, {0x1930, 0x1931},
{0x1933, 0x1938} };
static const xmlChLRange xmlMcL[] = {{0x1d165, 0x1d166}, {0x1d16d, 0x1d172} };
-static xmlChRangeGroup xmlMcG = {55,2,xmlMcS,xmlMcL};
+static const xmlChRangeGroup xmlMcG = {55,2,xmlMcS,xmlMcL};
static const xmlChSRange xmlMnS[] = {{0x300, 0x357}, {0x35d, 0x36f},
{0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, {0x5bb, 0x5bd},
@@ -692,7 +692,7 @@ static const xmlChSRange xmlMnS[] = {{0x300, 0x357}, {0x35d, 0x36f},
{0xfe00, 0xfe0f}, {0xfe20, 0xfe23} };
static const xmlChLRange xmlMnL[] = {{0x1d167, 0x1d169}, {0x1d17b, 0x1d182},
{0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad}, {0xe0100, 0xe01ef} };
-static xmlChRangeGroup xmlMnG = {108,5,xmlMnS,xmlMnL};
+static const xmlChRangeGroup xmlMnG = {108,5,xmlMnS,xmlMnL};
static const xmlChSRange xmlNS[] = {{0x30, 0x39}, {0xb2, 0xb3},
{0xb9, 0xb9}, {0xbc, 0xbe}, {0x660, 0x669}, {0x6f0, 0x6f9},
@@ -707,7 +707,7 @@ static const xmlChSRange xmlNS[] = {{0x30, 0x39}, {0xb2, 0xb3},
{0x3251, 0x325f}, {0x3280, 0x3289}, {0x32b1, 0x32bf}, {0xff10, 0xff19} };
static const xmlChLRange xmlNL[] = {{0x10107, 0x10133}, {0x10320, 0x10323},
{0x1034a, 0x1034a}, {0x104a0, 0x104a9}, {0x1d7ce, 0x1d7ff} };
-static xmlChRangeGroup xmlNG = {42,5,xmlNS,xmlNL};
+static const xmlChRangeGroup xmlNG = {42,5,xmlNS,xmlNL};
static const xmlChSRange xmlNdS[] = {{0x30, 0x39}, {0x660, 0x669},
{0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f},
@@ -716,7 +716,7 @@ static const xmlChSRange xmlNdS[] = {{0x30, 0x39}, {0x660, 0x669},
{0xf20, 0xf29}, {0x1040, 0x1049}, {0x1369, 0x1371}, {0x17e0, 0x17e9},
{0x1810, 0x1819}, {0x1946, 0x194f}, {0xff10, 0xff19} };
static const xmlChLRange xmlNdL[] = {{0x104a0, 0x104a9}, {0x1d7ce, 0x1d7ff} };
-static xmlChRangeGroup xmlNdG = {21,2,xmlNdS,xmlNdL};
+static const xmlChRangeGroup xmlNdG = {21,2,xmlNdS,xmlNdL};
static const xmlChSRange xmlNoS[] = {{0xb2, 0xb3}, {0xb9, 0xb9},
{0xbc, 0xbe}, {0x9f4, 0x9f9}, {0xbf0, 0xbf2}, {0xf2a, 0xf33},
@@ -725,7 +725,7 @@ static const xmlChSRange xmlNoS[] = {{0xb2, 0xb3}, {0xb9, 0xb9},
{0x2776, 0x2793}, {0x3192, 0x3195}, {0x3220, 0x3229}, {0x3251, 0x325f},
{0x3280, 0x3289}, {0x32b1, 0x32bf} };
static const xmlChLRange xmlNoL[] = {{0x10107, 0x10133}, {0x10320, 0x10323} };
-static xmlChRangeGroup xmlNoG = {20,2,xmlNoS,xmlNoL};
+static const xmlChRangeGroup xmlNoG = {20,2,xmlNoS,xmlNoL};
static const xmlChSRange xmlPS[] = {{0x21, 0x23}, {0x25, 0x2a},
{0x2c, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40}, {0x5b, 0x5d}, {0x5f, 0x5f},
@@ -749,13 +749,13 @@ static const xmlChSRange xmlPS[] = {{0x21, 0x23}, {0x25, 0x2a},
{0xff0c, 0xff0f}, {0xff1a, 0xff1b}, {0xff1f, 0xff20}, {0xff3b, 0xff3d},
{0xff3f, 0xff3f}, {0xff5b, 0xff5b}, {0xff5d, 0xff5d}, {0xff5f, 0xff65} };
static const xmlChLRange xmlPL[] = {{0x10100, 0x10101}, {0x1039f, 0x1039f} };
-static xmlChRangeGroup xmlPG = {84,2,xmlPS,xmlPL};
+static const xmlChRangeGroup xmlPG = {84,2,xmlPS,xmlPL};
static const xmlChSRange xmlPdS[] = {{0x2d, 0x2d}, {0x58a, 0x58a},
{0x1806, 0x1806}, {0x2010, 0x2015}, {0x301c, 0x301c}, {0x3030, 0x3030},
{0x30a0, 0x30a0}, {0xfe31, 0xfe32}, {0xfe58, 0xfe58}, {0xfe63, 0xfe63},
{0xff0d, 0xff0d} };
-static xmlChRangeGroup xmlPdG = {11,0,xmlPdS,NULL};
+static const xmlChRangeGroup xmlPdG = {11,0,xmlPdS,NULL};
static const xmlChSRange xmlPeS[] = {{0x29, 0x29}, {0x5d, 0x5d},
{0x7d, 0x7d}, {0xf3b, 0xf3b}, {0xf3d, 0xf3d}, {0x169c, 0x169c},
@@ -774,7 +774,7 @@ static const xmlChSRange xmlPeS[] = {{0x29, 0x29}, {0x5d, 0x5d},
{0xfe48, 0xfe48}, {0xfe5a, 0xfe5a}, {0xfe5c, 0xfe5c}, {0xfe5e, 0xfe5e},
{0xff09, 0xff09}, {0xff3d, 0xff3d}, {0xff5d, 0xff5d}, {0xff60, 0xff60},
{0xff63, 0xff63} };
-static xmlChRangeGroup xmlPeG = {63,0,xmlPeS,NULL};
+static const xmlChRangeGroup xmlPeG = {63,0,xmlPeS,NULL};
static const xmlChSRange xmlPoS[] = {{0x21, 0x23}, {0x25, 0x27},
{0x2a, 0x2a}, {0x2c, 0x2c}, {0x2e, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40},
@@ -795,7 +795,7 @@ static const xmlChSRange xmlPoS[] = {{0x21, 0x23}, {0x25, 0x27},
{0xff0a, 0xff0a}, {0xff0c, 0xff0c}, {0xff0e, 0xff0f}, {0xff1a, 0xff1b},
{0xff1f, 0xff20}, {0xff3c, 0xff3c}, {0xff61, 0xff61}, {0xff64, 0xff64} };
static const xmlChLRange xmlPoL[] = {{0x10100, 0x10101}, {0x1039f, 0x1039f} };
-static xmlChRangeGroup xmlPoG = {72,2,xmlPoS,xmlPoL};
+static const xmlChRangeGroup xmlPoG = {72,2,xmlPoS,xmlPoL};
static const xmlChSRange xmlPsS[] = {{0x28, 0x28}, {0x5b, 0x5b},
{0x7b, 0x7b}, {0xf3a, 0xf3a}, {0xf3c, 0xf3c}, {0x169b, 0x169b},
@@ -814,7 +814,7 @@ static const xmlChSRange xmlPsS[] = {{0x28, 0x28}, {0x5b, 0x5b},
{0xfe41, 0xfe41}, {0xfe43, 0xfe43}, {0xfe47, 0xfe47}, {0xfe59, 0xfe59},
{0xfe5b, 0xfe5b}, {0xfe5d, 0xfe5d}, {0xff08, 0xff08}, {0xff3b, 0xff3b},
{0xff5b, 0xff5b}, {0xff5f, 0xff5f}, {0xff62, 0xff62} };
-static xmlChRangeGroup xmlPsG = {65,0,xmlPsS,NULL};
+static const xmlChRangeGroup xmlPsG = {65,0,xmlPsS,NULL};
static const xmlChSRange xmlSS[] = {{0x24, 0x24}, {0x2b, 0x2b},
{0x3c, 0x3e}, {0x5e, 0x5e}, {0x60, 0x60}, {0x7c, 0x7c}, {0x7e, 0x7e},
@@ -857,13 +857,13 @@ static const xmlChLRange xmlSL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f},
{0x1d6db, 0x1d6db}, {0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715},
{0x1d735, 0x1d735}, {0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f},
{0x1d789, 0x1d789}, {0x1d7a9, 0x1d7a9}, {0x1d7c3, 0x1d7c3} };
-static xmlChRangeGroup xmlSG = {133,20,xmlSS,xmlSL};
+static const xmlChRangeGroup xmlSG = {133,20,xmlSS,xmlSL};
static const xmlChSRange xmlScS[] = {{0x24, 0x24}, {0xa2, 0xa5},
{0x9f2, 0x9f3}, {0xaf1, 0xaf1}, {0xbf9, 0xbf9}, {0xe3f, 0xe3f},
{0x17db, 0x17db}, {0x20a0, 0x20b1}, {0xfdfc, 0xfdfc}, {0xfe69, 0xfe69},
{0xff04, 0xff04}, {0xffe0, 0xffe1}, {0xffe5, 0xffe6} };
-static xmlChRangeGroup xmlScG = {13,0,xmlScS,NULL};
+static const xmlChRangeGroup xmlScG = {13,0,xmlScS,NULL};
static const xmlChSRange xmlSkS[] = {{0x5e, 0x5e}, {0x60, 0x60},
{0xa8, 0xa8}, {0xaf, 0xaf}, {0xb4, 0xb4}, {0xb8, 0xb8}, {0x2c2, 0x2c5},
@@ -871,7 +871,7 @@ static const xmlChSRange xmlSkS[] = {{0x5e, 0x5e}, {0x60, 0x60},
{0x384, 0x385}, {0x1fbd, 0x1fbd}, {0x1fbf, 0x1fc1}, {0x1fcd, 0x1fcf},
{0x1fdd, 0x1fdf}, {0x1fed, 0x1fef}, {0x1ffd, 0x1ffe}, {0x309b, 0x309c},
{0xff3e, 0xff3e}, {0xff40, 0xff40}, {0xffe3, 0xffe3} };
-static xmlChRangeGroup xmlSkG = {22,0,xmlSkS,NULL};
+static const xmlChRangeGroup xmlSkG = {22,0,xmlSkS,NULL};
static const xmlChSRange xmlSmS[] = {{0x2b, 0x2b}, {0x3c, 0x3e},
{0x7c, 0x7c}, {0x7e, 0x7e}, {0xac, 0xac}, {0xb1, 0xb1}, {0xd7, 0xd7},
@@ -890,7 +890,7 @@ static const xmlChLRange xmlSmL[] = {{0x1d6c1, 0x1d6c1}, {0x1d6db, 0x1d6db},
{0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715}, {0x1d735, 0x1d735},
{0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f}, {0x1d789, 0x1d789},
{0x1d7a9, 0x1d7a9}, {0x1d7c3, 0x1d7c3} };
-static xmlChRangeGroup xmlSmG = {48,10,xmlSmS,xmlSmL};
+static const xmlChRangeGroup xmlSmG = {48,10,xmlSmS,xmlSmL};
static const xmlChSRange xmlSoS[] = {{0xa6, 0xa7}, {0xa9, 0xa9},
{0xae, 0xae}, {0xb0, 0xb0}, {0xb6, 0xb6}, {0x482, 0x482},
@@ -923,15 +923,15 @@ static const xmlChLRange xmlSoL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f},
{0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d12a, 0x1d164},
{0x1d16a, 0x1d16c}, {0x1d183, 0x1d184}, {0x1d18c, 0x1d1a9},
{0x1d1ae, 0x1d1dd}, {0x1d300, 0x1d356} };
-static xmlChRangeGroup xmlSoG = {103,10,xmlSoS,xmlSoL};
+static const xmlChRangeGroup xmlSoG = {103,10,xmlSoS,xmlSoL};
static const xmlChSRange xmlZS[] = {{0x20, 0x20}, {0xa0, 0xa0},
{0x1680, 0x1680}, {0x180e, 0x180e}, {0x2000, 0x200a}, {0x2028, 0x2029},
{0x202f, 0x202f}, {0x205f, 0x205f}, {0x3000, 0x3000} };
-static xmlChRangeGroup xmlZG = {9,0,xmlZS,NULL};
+static const xmlChRangeGroup xmlZG = {9,0,xmlZS,NULL};
-static xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, 128};
-static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36};
+static const xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, 128};
+static const xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36};
/**
* xmlUnicodeLookup:
@@ -943,7 +943,7 @@ static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36};
* Returns pointer to range function if found, otherwise NULL
*/
static xmlIntFunc
-*xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname) {
+*xmlUnicodeLookup(const xmlUnicodeNameTable *tptr, const char *tname) {
int low, high, mid, cmp;
const xmlUnicodeRange *sptr;
diff --git a/chromium/third_party/libxml/src/xmlwriter.c b/chromium/third_party/libxml/src/xmlwriter.c
index 2ca2056e234..278f25d61a5 100644
--- a/chromium/third_party/libxml/src/xmlwriter.c
+++ b/chromium/third_party/libxml/src/xmlwriter.c
@@ -21,9 +21,10 @@
#include <libxml/xmlwriter.h>
-#include "buf.h"
-#include "enc.h"
-#include "save.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/save.h"
#define B64LINELEN 72
#define B64CRLF "\r\n"
@@ -188,7 +189,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out)
"xmlNewTextWriter : out of memory!\n");
return NULL;
}
- memset(ret, 0, (size_t) sizeof(xmlTextWriter));
+ memset(ret, 0, sizeof(xmlTextWriter));
ret->nodes = xmlListCreate(xmlFreeTextWriterStackEntry,
xmlCmpTextWriterStackEntry);
@@ -1541,7 +1542,7 @@ static int
xmlOutputBufferWriteBase64(xmlOutputBufferPtr out, int len,
const unsigned char *data)
{
- static unsigned char dtable[64] =
+ static const unsigned char dtable[64] =
{'A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'a','b','c','d','e','f','g','h','i','j','k','l','m',
@@ -1674,7 +1675,7 @@ xmlOutputBufferWriteBinHex(xmlOutputBufferPtr out,
{
int count;
int sum;
- static char hex[16] =
+ static const char hex[16] =
{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
int i;
diff --git a/chromium/third_party/libxml/src/xpath.c b/chromium/third_party/libxml/src/xpath.c
index 982fc833df7..aa86fd3a754 100644
--- a/chromium/third_party/libxml/src/xpath.c
+++ b/chromium/third_party/libxml/src/xpath.c
@@ -29,10 +29,6 @@
#include <float.h>
#include <ctype.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/valid.h>
@@ -40,7 +36,7 @@
#include <libxml/xpathInternals.h>
#include <libxml/parserInternals.h>
#include <libxml/hash.h>
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
#include <libxml/xpointer.h>
#endif
#ifdef LIBXML_DEBUG_ENABLED
@@ -53,7 +49,8 @@
#include <libxml/pattern.h>
#endif
-#include "buf.h"
+#include "private/buf.h"
+#include "private/error.h"
#ifdef LIBXML_PATTERN_ENABLED
#define XPATH_STREAMING
@@ -133,6 +130,9 @@
*/
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
#define XPATH_MAX_RECURSION_DEPTH 500
+#elif defined(_WIN32)
+/* Windows typically limits stack size to 1MB. */
+#define XPATH_MAX_RECURSION_DEPTH 1000
#else
#define XPATH_MAX_RECURSION_DEPTH 5000
#endif
@@ -479,23 +479,32 @@ int wrap_cmp( xmlNodePtr x, xmlNodePtr y );
* *
************************************************************************/
-double xmlXPathNAN;
-double xmlXPathPINF;
-double xmlXPathNINF;
+double xmlXPathNAN = 0.0;
+double xmlXPathPINF = 0.0;
+double xmlXPathNINF = 0.0;
/**
* xmlXPathInit:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* Initialize the XPath environment
*/
ATTRIBUTE_NO_SANITIZE("float-divide-by-zero")
void
xmlXPathInit(void) {
+#if defined(NAN) && defined(INFINITY)
+ xmlXPathNAN = NAN;
+ xmlXPathPINF = INFINITY;
+ xmlXPathNINF = -INFINITY;
+#else
/* MSVC doesn't allow division by zero in constant expressions. */
double zero = 0.0;
xmlXPathNAN = 0.0 / zero;
xmlXPathPINF = 1.0 / zero;
xmlXPathNINF = -xmlXPathPINF;
+#endif
}
/**
@@ -581,7 +590,7 @@ static int xmlXPathDisableOptimizer = 0;
/*
* The array xmlXPathErrorMessages corresponds to the enum xmlXPathError
*/
-static const char *xmlXPathErrorMessages[] = {
+static const char* const xmlXPathErrorMessages[] = {
"Ok\n",
"Number encoding\n",
"Unfinished literal\n",
@@ -902,7 +911,7 @@ typedef enum {
XPATH_OP_PREDICATE,
XPATH_OP_FILTER, /* 16 */
XPATH_OP_SORT /* 17 */
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
,XPATH_OP_RANGETO
#endif
} xmlXPathOp;
@@ -1353,7 +1362,7 @@ xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) {
fprintf(output, "%d", i + 1);
xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1);
}
-#if defined(LIBXML_XPTR_ENABLED)
+#if defined(LIBXML_XPTR_LOCS_ENABLED)
static void
xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
int i;
@@ -1376,7 +1385,7 @@ xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
xmlXPathDebugDumpObject(output, cur->locTab[i], depth + 1);
}
}
-#endif /* LIBXML_XPTR_ENABLED */
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
/**
* xmlXPathDebugDumpObject:
@@ -1445,6 +1454,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
xmlDebugDumpString(output, cur->stringval);
fprintf(output, "\n");
break;
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
fprintf(output, "Object is a point : index %d in node", cur->index);
xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user, depth + 1);
@@ -1480,12 +1490,11 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
}
break;
case XPATH_LOCATIONSET:
-#if defined(LIBXML_XPTR_ENABLED)
fprintf(output, "Object is a Location Set:\n");
xmlXPathDebugDumpLocationSet(output,
(xmlLocationSetPtr) cur->user, depth);
-#endif
break;
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
case XPATH_USERS:
fprintf(output, "Object is user defined\n");
break;
@@ -1653,7 +1662,7 @@ xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
case XPATH_OP_ARG: fprintf(output, "ARG"); break;
case XPATH_OP_PREDICATE: fprintf(output, "PREDICATE"); break;
case XPATH_OP_FILTER: fprintf(output, "FILTER"); break;
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_OP_RANGETO: fprintf(output, "RANGETO"); break;
#endif
default:
@@ -1845,6 +1854,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt,
case XPATH_STRING:
cache->dbgReusedString++;
break;
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
cache->dbgReusedPoint++;
break;
@@ -1854,6 +1864,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt,
case XPATH_LOCATIONSET:
cache->dbgReusedLocset++;
break;
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
case XPATH_USERS:
cache->dbgReusedUsers++;
break;
@@ -1912,6 +1923,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt,
xmlXPathDebugObjMaxString =
xmlXPathDebugObjCounterString;
break;
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
if (! isCached)
xmlXPathDebugObjTotalPoint++;
@@ -1939,6 +1951,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt,
xmlXPathDebugObjMaxLocset =
xmlXPathDebugObjCounterLocset;
break;
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
case XPATH_USERS:
if (! isCached)
xmlXPathDebugObjTotalUsers++;
@@ -1999,6 +2012,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt,
case XPATH_STRING:
cache->dbgCachedString++;
break;
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
cache->dbgCachedPoint++;
break;
@@ -2008,6 +2022,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt,
case XPATH_LOCATIONSET:
cache->dbgCachedLocset++;
break;
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
case XPATH_USERS:
cache->dbgCachedUsers++;
break;
@@ -2036,6 +2051,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt,
case XPATH_STRING:
xmlXPathDebugObjCounterString--;
break;
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
xmlXPathDebugObjCounterPoint--;
break;
@@ -2045,6 +2061,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt,
case XPATH_LOCATIONSET:
xmlXPathDebugObjCounterLocset--;
break;
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
case XPATH_USERS:
xmlXPathDebugObjCounterUsers--;
break;
@@ -2191,7 +2208,7 @@ xmlXPathNewCache(void)
xmlXPathErrMemory(NULL, "creating object cache\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathContextCache));
+ memset(ret, 0 , sizeof(xmlXPathContextCache));
ret->maxNodeset = 100;
ret->maxString = 100;
ret->maxBoolean = 100;
@@ -2697,9 +2714,11 @@ xmlXPathCacheConvertString(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) {
res = xmlXPathCastNumberToString(val->floatval);
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO;
break;
}
@@ -3082,7 +3101,7 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) {
#define CUR_CHAR(l) xmlXPathCurrentChar(ctxt, &l)
#define COPY_BUF(l,b,i,v) \
- if (l == 1) b[i++] = (xmlChar) v; \
+ if (l == 1) b[i++] = v; \
else i += xmlCopyChar(l,&b[i],v)
#define NEXTL(l) ctxt->cur += l
@@ -3289,7 +3308,7 @@ xmlXPathOrderDocElems(xmlDocPtr doc) {
}
} while (cur != NULL);
}
- return((long) count);
+ return(count);
}
/**
@@ -3565,7 +3584,7 @@ xmlXPathNodeSetCreate(xmlNodePtr val) {
xmlXPathErrMemory(NULL, "creating nodeset\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlNodeSet));
+ memset(ret, 0 , sizeof(xmlNodeSet));
if (val != NULL) {
ret->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
sizeof(xmlNodePtr));
@@ -3575,7 +3594,7 @@ xmlXPathNodeSetCreate(xmlNodePtr val) {
return(NULL);
}
memset(ret->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+ XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
ret->nodeMax = XML_NODESET_DEFAULT;
if (val->type == XML_NAMESPACE_DECL) {
xmlNsPtr ns = (xmlNsPtr) val;
@@ -3669,7 +3688,7 @@ xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) {
return(-1);
}
memset(cur->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+ XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
cur->nodeMax = XML_NODESET_DEFAULT;
} else if (cur->nodeNr == cur->nodeMax) {
xmlNodePtr *temp;
@@ -3725,7 +3744,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
return(-1);
}
memset(cur->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+ XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
cur->nodeMax = XML_NODESET_DEFAULT;
} else if (cur->nodeNr == cur->nodeMax) {
xmlNodePtr *temp;
@@ -3780,7 +3799,7 @@ xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) {
return(-1);
}
memset(cur->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+ XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
cur->nodeMax = XML_NODESET_DEFAULT;
} else if (cur->nodeNr == cur->nodeMax) {
xmlNodePtr *temp;
@@ -3897,7 +3916,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) {
return(NULL);
}
memset(val1->nodeTab, 0 ,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+ XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
val1->nodeMax = XML_NODESET_DEFAULT;
} else if (val1->nodeNr == val1->nodeMax) {
xmlNodePtr *temp;
@@ -3983,7 +4002,7 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2)
return(NULL);
}
memset(set1->nodeTab, 0,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+ XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
set1->nodeMax = XML_NODESET_DEFAULT;
} else if (set1->nodeNr >= set1->nodeMax) {
xmlNodePtr *temp;
@@ -4037,7 +4056,7 @@ xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2)
return(NULL);
}
memset(set1->nodeTab, 0,
- XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+ XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
set1->nodeMax = XML_NODESET_DEFAULT;
} else if (set1->nodeNr >= set1->nodeMax) {
xmlNodePtr *temp;
@@ -4296,7 +4315,7 @@ xmlXPathNewNodeSet(xmlNodePtr val) {
xmlXPathErrMemory(NULL, "creating nodeset\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_NODESET;
ret->boolval = 0;
/* TODO: Check memory error. */
@@ -4326,7 +4345,7 @@ xmlXPathNewValueTree(xmlNodePtr val) {
xmlXPathErrMemory(NULL, "creating result value tree\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_XSLT_TREE;
ret->boolval = 0;
ret->user = (void *) val;
@@ -4387,7 +4406,7 @@ xmlXPathWrapNodeSet(xmlNodeSetPtr val) {
xmlXPathErrMemory(NULL, "creating node set object\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_NODESET;
ret->nodesetval = val;
#ifdef XP_DEBUG_OBJ_USAGE
@@ -4839,7 +4858,7 @@ xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt, const xmlChar *name,
return(-1);
if (f == NULL)
return(xmlHashRemoveEntry2(ctxt->funcHash, name, ns_uri, NULL));
-XML_IGNORE_PEDANTIC_WARNINGS
+XML_IGNORE_FPTR_CAST_WARNINGS
return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, (void *) f));
XML_POP_WARNINGS
}
@@ -4922,7 +4941,7 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
if (ctxt->funcHash == NULL)
return(NULL);
-XML_IGNORE_PEDANTIC_WARNINGS
+XML_IGNORE_FPTR_CAST_WARNINGS
ret = (xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri);
XML_POP_WARNINGS
return(ret);
@@ -5196,7 +5215,7 @@ xmlXPathNewFloat(double val) {
xmlXPathErrMemory(NULL, "creating float object\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_NUMBER;
ret->floatval = val;
#ifdef XP_DEBUG_OBJ_USAGE
@@ -5222,7 +5241,7 @@ xmlXPathNewBoolean(int val) {
xmlXPathErrMemory(NULL, "creating boolean object\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_BOOLEAN;
ret->boolval = (val != 0);
#ifdef XP_DEBUG_OBJ_USAGE
@@ -5248,7 +5267,7 @@ xmlXPathNewString(const xmlChar *val) {
xmlXPathErrMemory(NULL, "creating string object\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_STRING;
if (val != NULL)
ret->stringval = xmlStrdup(val);
@@ -5277,7 +5296,7 @@ xmlXPathWrapString (xmlChar *val) {
xmlXPathErrMemory(NULL, "creating string object\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_STRING;
ret->stringval = val;
#ifdef XP_DEBUG_OBJ_USAGE
@@ -5303,7 +5322,7 @@ xmlXPathNewCString(const char *val) {
xmlXPathErrMemory(NULL, "creating string object\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_STRING;
ret->stringval = xmlStrdup(BAD_CAST val);
#ifdef XP_DEBUG_OBJ_USAGE
@@ -5342,7 +5361,7 @@ xmlXPathWrapExternal (void *val) {
xmlXPathErrMemory(NULL, "creating user object\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_USERS;
ret->user = val;
#ifdef XP_DEBUG_OBJ_USAGE
@@ -5371,15 +5390,17 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) {
xmlXPathErrMemory(NULL, "copying object\n");
return(NULL);
}
- memcpy(ret, val , (size_t) sizeof(xmlXPathObject));
+ memcpy(ret, val , sizeof(xmlXPathObject));
#ifdef XP_DEBUG_OBJ_USAGE
xmlXPathDebugObjUsageRequested(NULL, val->type);
#endif
switch (val->type) {
case XPATH_BOOLEAN:
case XPATH_NUMBER:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
break;
case XPATH_STRING:
ret->stringval = xmlStrdup(val->stringval);
@@ -5423,8 +5444,8 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) {
/* Do not deallocate the copied tree value */
ret->boolval = 0;
break;
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_LOCATIONSET:
-#ifdef LIBXML_XPTR_ENABLED
{
xmlLocationSetPtr loc = val->user;
ret->user = (void *) xmlXPtrLocationSetMerge(NULL, loc);
@@ -5467,7 +5488,7 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) {
if (obj->nodesetval != NULL)
xmlXPathFreeNodeSet(obj->nodesetval);
}
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
} else if (obj->type == XPATH_LOCATIONSET) {
if (obj->user != NULL)
xmlXPtrFreeLocationSet(obj->user);
@@ -5557,7 +5578,7 @@ xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj)
goto obj_cached;
}
break;
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_LOCATIONSET:
if (obj->user != NULL) {
xmlXPtrFreeLocationSet(obj->user);
@@ -5760,9 +5781,11 @@ xmlXPathCastToString(xmlXPathObjectPtr val) {
break;
}
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO
ret = xmlStrdup((const xmlChar *) "");
break;
@@ -5805,9 +5828,11 @@ xmlXPathConvertString(xmlXPathObjectPtr val) {
res = xmlXPathCastNumberToString(val->floatval);
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO;
break;
}
@@ -5925,9 +5950,11 @@ xmlXPathCastToNumber(xmlXPathObjectPtr val) {
ret = xmlXPathCastBooleanToNumber(val->boolval);
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO;
ret = xmlXPathNAN;
break;
@@ -6037,9 +6064,11 @@ xmlXPathCastToBoolean (xmlXPathObjectPtr val) {
ret = val->boolval;
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO;
ret = 0;
break;
@@ -6093,7 +6122,7 @@ xmlXPathNewContext(xmlDocPtr doc) {
xmlXPathErrMemory(NULL, "creating context\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathContext));
+ memset(ret, 0 , sizeof(xmlXPathContext));
ret->doc = doc;
ret->node = NULL;
@@ -6201,7 +6230,7 @@ xmlXPathNewParserContext(const xmlChar *str, xmlXPathContextPtr ctxt) {
xmlXPathErrMemory(ctxt, "creating parser context\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext));
+ memset(ret, 0 , sizeof(xmlXPathParserContext));
ret->cur = ret->base = str;
ret->context = ctxt;
@@ -6237,7 +6266,7 @@ xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) {
xmlXPathErrMemory(ctxt, "creating evaluation context\n");
return(NULL);
}
- memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext));
+ memset(ret, 0 , sizeof(xmlXPathParserContext));
/* Allocate the value stack */
ret->valueTab = (xmlXPathObjectPtr *)
@@ -6335,16 +6364,14 @@ xmlXPathNodeValHash(xmlNodePtr node) {
return(0);
if (string[0] == 0)
return(0);
- return(((unsigned int) string[0]) +
- (((unsigned int) string[1]) << 8));
+ return(string[0] + (string[1] << 8));
case XML_NAMESPACE_DECL:
string = ((xmlNsPtr)node)->href;
if (string == NULL)
return(0);
if (string[0] == 0)
return(0);
- return(((unsigned int) string[0]) +
- (((unsigned int) string[1]) << 8));
+ return(string[0] + (string[1] << 8));
case XML_ATTRIBUTE_NODE:
tmp = ((xmlAttrPtr) node)->children;
break;
@@ -6366,14 +6393,13 @@ xmlXPathNodeValHash(xmlNodePtr node) {
}
if ((string != NULL) && (string[0] != 0)) {
if (len == 1) {
- return(ret + (((unsigned int) string[0]) << 8));
+ return(ret + (string[0] << 8));
}
if (string[1] == 0) {
len = 1;
- ret = (unsigned int) string[0];
+ ret = string[0];
} else {
- return(((unsigned int) string[0]) +
- (((unsigned int) string[1]) << 8));
+ return(string[0] + (string[1] << 8));
}
}
/*
@@ -6422,11 +6448,10 @@ xmlXPathNodeValHash(xmlNodePtr node) {
static unsigned int
xmlXPathStringHash(const xmlChar * string) {
if (string == NULL)
- return((unsigned int) 0);
+ return(0);
if (string[0] == 0)
return(0);
- return(((unsigned int) string[0]) +
- (((unsigned int) string[1]) << 8));
+ return(string[0] + (string[1] << 8));
}
/**
@@ -6976,9 +7001,11 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
ret = (arg1->boolval == ret);
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO
break;
case XPATH_NODESET:
@@ -7033,9 +7060,11 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
}
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO
break;
case XPATH_NODESET:
@@ -7094,9 +7123,11 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
}
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO
break;
case XPATH_NODESET:
@@ -7105,9 +7136,11 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
}
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO
break;
case XPATH_NODESET:
@@ -7190,9 +7223,11 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) {
ret = xmlXPathEqualNodeSetString(arg1, arg2->stringval, 0);
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO
break;
}
@@ -7275,9 +7310,11 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) {
ret = xmlXPathEqualNodeSetString(arg1, arg2->stringval,1);
break;
case XPATH_USERS:
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
TODO
break;
}
@@ -7642,9 +7679,6 @@ xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return(((xmlDocPtr) ctxt->context->node)->children);
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
@@ -7700,9 +7734,6 @@ xmlXPathNextChildElement(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
return(NULL);
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return(xmlDocGetRootElement((xmlDocPtr) cur));
default:
return(NULL);
@@ -7763,9 +7794,6 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur,
case XML_XINCLUDE_START:
case XML_DOCUMENT_FRAG_NODE:
case XML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
case XML_HTML_DOCUMENT_NODE:
return(contextNode);
default:
@@ -7790,9 +7818,6 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur,
break;
/* Not sure if we need those here. */
case XML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
case XML_HTML_DOCUMENT_NODE:
if (cur != start)
return(cur);
@@ -7959,9 +7984,6 @@ xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return(NULL);
case XML_NAMESPACE_DECL: {
xmlNsPtr ns = (xmlNsPtr) ctxt->context->node;
@@ -8032,9 +8054,6 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return(NULL);
case XML_NAMESPACE_DECL: {
xmlNsPtr ns = (xmlNsPtr) ctxt->context->node;
@@ -8093,9 +8112,6 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
return(NULL);
}
return(NULL);
@@ -9180,7 +9196,7 @@ xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
if (target) {
point = xmlStrstr(str->stringval, find->stringval);
if (point) {
- offset = (int)(point - str->stringval);
+ offset = point - str->stringval;
xmlBufAdd(target, str->stringval, offset);
}
valuePush(ctxt, xmlXPathCacheNewString(ctxt->context,
@@ -9223,7 +9239,7 @@ xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) {
if (target) {
point = xmlStrstr(str->stringval, find->stringval);
if (point) {
- offset = (int)(point - str->stringval) + xmlStrlen(find->stringval);
+ offset = point - str->stringval + xmlStrlen(find->stringval);
xmlBufAdd(target, &str->stringval[offset],
xmlStrlen(str->stringval) - offset);
}
@@ -9251,52 +9267,45 @@ xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) {
*/
void
xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- xmlXPathObjectPtr obj = NULL;
- xmlChar *source = NULL;
- xmlBufPtr target;
- xmlChar blank;
-
- if (ctxt == NULL) return;
- if (nargs == 0) {
- /* Use current context node */
- valuePush(ctxt,
- xmlXPathCacheWrapString(ctxt->context,
- xmlXPathCastNodeToString(ctxt->context->node)));
- nargs = 1;
- }
+ xmlChar *source, *target;
+ int blank;
- CHECK_ARITY(1);
- CAST_TO_STRING;
- CHECK_TYPE(XPATH_STRING);
- obj = valuePop(ctxt);
- source = obj->stringval;
+ if (ctxt == NULL) return;
+ if (nargs == 0) {
+ /* Use current context node */
+ valuePush(ctxt,
+ xmlXPathCacheWrapString(ctxt->context,
+ xmlXPathCastNodeToString(ctxt->context->node)));
+ nargs = 1;
+ }
- target = xmlBufCreate();
- if (target && source) {
+ CHECK_ARITY(1);
+ CAST_TO_STRING;
+ CHECK_TYPE(XPATH_STRING);
+ source = ctxt->value->stringval;
+ if (source == NULL)
+ return;
+ target = source;
/* Skip leading whitespaces */
while (IS_BLANK_CH(*source))
- source++;
+ source++;
/* Collapse intermediate whitespaces, and skip trailing whitespaces */
blank = 0;
while (*source) {
- if (IS_BLANK_CH(*source)) {
- blank = 0x20;
- } else {
- if (blank) {
- xmlBufAdd(target, &blank, 1);
- blank = 0;
- }
- xmlBufAdd(target, source, 1);
- }
- source++;
+ if (IS_BLANK_CH(*source)) {
+ blank = 1;
+ } else {
+ if (blank) {
+ *target++ = 0x20;
+ blank = 0;
+ }
+ *target++ = *source;
+ }
+ source++;
}
- valuePush(ctxt, xmlXPathCacheNewString(ctxt->context,
- xmlBufContent(target)));
- xmlBufFree(target);
- }
- xmlXPathReleaseObject(ctxt->context, obj);
+ *target = 0;
}
/**
@@ -9733,7 +9742,7 @@ xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) {
} else {
/* 1-byte code */
*len = 1;
- return((int) *cur);
+ return(*cur);
}
encoding_error:
/*
@@ -9915,7 +9924,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
if (len > XML_MAX_NAME_LENGTH) {
XP_ERRORNULL(XPATH_EXPR_ERROR);
}
- buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+ buffer = (xmlChar *) xmlMallocAtomic(max);
if (buffer == NULL) {
XP_ERRORNULL(XPATH_MEMORY_ERROR);
}
@@ -9932,8 +9941,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
XP_ERRORNULL(XPATH_EXPR_ERROR);
}
max *= 2;
- tmp = (xmlChar *) xmlRealloc(buffer,
- max * sizeof(xmlChar));
+ tmp = (xmlChar *) xmlRealloc(buffer, max);
if (tmp == NULL) {
xmlFree(buffer);
XP_ERRORNULL(XPATH_MEMORY_ERROR);
@@ -10494,7 +10502,7 @@ xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) {
static xmlChar *
xmlXPathScanName(xmlXPathParserContextPtr ctxt) {
- int len = 0, l;
+ int l;
int c;
const xmlChar *cur;
xmlChar *ret;
@@ -10514,7 +10522,6 @@ xmlXPathScanName(xmlXPathParserContextPtr ctxt) {
(c == '_') || (c == ':') ||
(IS_COMBINING(c)) ||
(IS_EXTENDER(c)))) {
- len += l;
NEXTL(l);
c = CUR_CHAR(l);
}
@@ -10616,7 +10623,7 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) {
"PathExpr: Type search\n");
#endif
lc = 1;
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
} else if (ctxt->xptr &&
xmlStrEqual(name, BAD_CAST "range-to")) {
lc = 1;
@@ -11267,7 +11274,7 @@ xmlXPathIsAxisName(const xmlChar *name) {
*/
static void
xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
int rangeto = 0;
int op2 = -1;
#endif
@@ -11292,7 +11299,7 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
/*
* The modification needed for XPointer change to the production
*/
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
if (ctxt->xptr) {
name = xmlXPathParseNCName(ctxt);
if ((name != NULL) && (xmlStrEqual(name, BAD_CAST "range-to"))) {
@@ -11377,7 +11384,7 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
xmlGenericErrorContextNodeSet(stdout, ctxt->value->nodesetval);
#endif
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
eval_predicates:
#endif
op1 = ctxt->comp->last;
@@ -11388,7 +11395,7 @@ eval_predicates:
xmlXPathCompPredicate(ctxt, 0);
}
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
if (rangeto) {
PUSH_BINARY_EXPR(XPATH_OP_RANGETO, op2, op1, 0, 0);
} else
@@ -11731,7 +11738,7 @@ xmlXPathNodeSetFilter(xmlXPathParserContextPtr ctxt,
xpctxt->proximityPosition = oldpp;
}
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
/**
* xmlXPathLocationSetFilter:
* @ctxt: the XPath Parser context
@@ -11848,7 +11855,7 @@ xmlXPathLocationSetFilter(xmlXPathParserContextPtr ctxt,
xpctxt->contextSize = oldcs;
xpctxt->proximityPosition = oldpp;
}
-#endif /* LIBXML_XPTR_ENABLED */
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
/**
* xmlXPathCompOpEvalPredicate:
@@ -12266,9 +12273,6 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
switch (cur->type) {
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_PI_NODE:
@@ -12907,7 +12911,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
if (ctxt->value == NULL)
return (total);
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
/*
* Hum are we filtering the result of an XPointer expression
*/
@@ -12922,7 +12926,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
return (total);
}
-#endif /* LIBXML_XPTR_ENABLED */
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
CHECK_TYPE0(XPATH_NODESET);
set = ctxt->value->nodesetval;
@@ -13330,7 +13334,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
if (ctxt->value == NULL)
break;
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
/*
* Hum are we filtering the result of an XPointer expression
*/
@@ -13340,7 +13344,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
1, locset->locNr);
break;
}
-#endif /* LIBXML_XPTR_ENABLED */
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
CHECK_TYPE0(XPATH_NODESET);
set = ctxt->value->nodesetval;
@@ -13361,7 +13365,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlXPathNodeSetSort(ctxt->value->nodesetval);
}
break;
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_OP_RANGETO:{
xmlXPathObjectPtr range;
xmlXPathObjectPtr res, obj;
@@ -13519,7 +13523,7 @@ rangeto_error:
ctxt->context->proximityPosition = oldpp;
break;
}
-#endif /* LIBXML_XPTR_ENABLED */
+#endif /* LIBXML_XPTR_LOCS_ENABLED */
default:
xmlGenericError(xmlGenericErrorContext,
"XPath: unknown precompiled operation %d\n", op->op);
@@ -13698,9 +13702,6 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp,
case XML_DOCUMENT_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_HTML_DOCUMENT_NODE:
-#ifdef LIBXML_DOCB_ENABLED
- case XML_DOCB_DOCUMENT_NODE:
-#endif
cur = ctxt->node;
break;
case XML_ATTRIBUTE_NODE:
@@ -13881,19 +13882,18 @@ static int
xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool)
{
xmlXPathCompExprPtr comp;
+ int oldDepth;
if ((ctxt == NULL) || (ctxt->comp == NULL))
return(-1);
- ctxt->context->depth = 0;
-
if (ctxt->valueTab == NULL) {
/* Allocate the value stack */
ctxt->valueTab = (xmlXPathObjectPtr *)
xmlMalloc(10 * sizeof(xmlXPathObjectPtr));
if (ctxt->valueTab == NULL) {
xmlXPathPErrMemory(ctxt, "creating evaluation context\n");
- xmlFree(ctxt);
+ return(-1);
}
ctxt->valueNr = 0;
ctxt->valueMax = 10;
@@ -13940,11 +13940,13 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool)
"xmlXPathRunEval: last is less than zero\n");
return(-1);
}
+ oldDepth = ctxt->context->depth;
if (toBool)
return(xmlXPathCompOpEvalToBoolean(ctxt,
&comp->steps[comp->last], 0));
else
xmlXPathCompOpEval(ctxt, &comp->steps[comp->last]);
+ ctxt->context->depth = oldDepth;
return(0);
}
@@ -14030,7 +14032,7 @@ xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt,
return(res->nodesetval->nodeNr != 0);
case XPATH_STRING:
return((res->stringval != NULL) && (res->stringval[0] != 0));
-#ifdef LIBXML_XPTR_ENABLED
+#ifdef LIBXML_XPTR_LOCS_ENABLED
case XPATH_LOCATIONSET:{
xmlLocationSetPtr ptr = res->user;
if (ptr == NULL)
@@ -14215,6 +14217,7 @@ xmlXPathCompExprPtr
xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
xmlXPathParserContextPtr pctxt;
xmlXPathCompExprPtr comp;
+ int oldDepth = 0;
#ifdef XPATH_STREAMING
comp = xmlXPathTryStreamCompile(ctxt, str);
@@ -14228,8 +14231,10 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
if (pctxt == NULL)
return NULL;
if (ctxt != NULL)
- ctxt->depth = 0;
+ oldDepth = ctxt->depth;
xmlXPathCompileExpr(pctxt, 1);
+ if (ctxt != NULL)
+ ctxt->depth = oldDepth;
if( pctxt->error != XPATH_EXPRESSION_OK )
{
@@ -14250,8 +14255,10 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
comp = pctxt->comp;
if ((comp->nbStep > 1) && (comp->last >= 0)) {
if (ctxt != NULL)
- ctxt->depth = 0;
+ oldDepth = ctxt->depth;
xmlXPathOptimizeExpression(pctxt, &comp->steps[comp->last]);
+ if (ctxt != NULL)
+ ctxt->depth = oldDepth;
}
pctxt->comp = NULL;
}
@@ -14407,6 +14414,7 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
#ifdef XPATH_STREAMING
xmlXPathCompExprPtr comp;
#endif
+ int oldDepth = 0;
if (ctxt == NULL) return;
@@ -14420,8 +14428,10 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
#endif
{
if (ctxt->context != NULL)
- ctxt->context->depth = 0;
+ oldDepth = ctxt->context->depth;
xmlXPathCompileExpr(ctxt, 1);
+ if (ctxt->context != NULL)
+ ctxt->context->depth = oldDepth;
CHECK_ERROR;
/* Check for trailing characters. */
@@ -14430,9 +14440,11 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
if ((ctxt->comp->nbStep > 1) && (ctxt->comp->last >= 0)) {
if (ctxt->context != NULL)
- ctxt->context->depth = 0;
+ oldDepth = ctxt->context->depth;
xmlXPathOptimizeExpression(ctxt,
&ctxt->comp->steps[ctxt->comp->last]);
+ if (ctxt->context != NULL)
+ ctxt->context->depth = oldDepth;
}
}
diff --git a/chromium/third_party/libxml/win32/config.h b/chromium/third_party/libxml/win32/config.h
index d804404a46c..2b113237058 100644
--- a/chromium/third_party/libxml/win32/config.h
+++ b/chromium/third_party/libxml/win32/config.h
@@ -1,110 +1,21 @@
#ifndef __LIBXML_WIN32_CONFIG__
#define __LIBXML_WIN32_CONFIG__
-#define SEND_ARG2_CAST
-#define GETHOSTBYNAME_ARG_CAST
-
#define HAVE_SYS_STAT_H
#define HAVE_STAT
#define HAVE_FCNTL_H
-#include <io.h>
-#include <direct.h>
-
-#include <libxml/xmlversion.h>
-
-#ifndef ICONV_CONST
-#define ICONV_CONST const
-#endif
-/*
- * Windows platforms may define except
- */
-#undef except
-
-#define HAVE_ISINF
-#define HAVE_ISNAN
-#include <math.h>
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-/* MS C-runtime has functions which can be used in order to determine if
- a given floating-point variable contains NaN, (+-)INF. These are
- preferred, because floating-point technology is considered proprietary
- by MS and we can assume that their functions know more about their
- oddities than we do. */
-#include <float.h>
-/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
- function. */
-#ifndef isinf
-#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
- : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
-#endif
-/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
-#ifndef isnan
-#define isnan(d) (_isnan(d))
-#endif
-#else /* _MSC_VER */
-#ifndef isinf
-static int isinf (double d) {
- int expon = 0;
- double val = frexp (d, &expon);
- if (expon == 1025) {
- if (val == 0.5) {
- return 1;
- } else if (val == -0.5) {
- return -1;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
-}
+#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
+#define HAVE_STDINT_H
#endif
-#ifndef isnan
-static int isnan (double d) {
- int expon = 0;
- double val = frexp (d, &expon);
- if (expon == 1025) {
- if (val == 0.5) {
- return 0;
- } else if (val == -0.5) {
- return 0;
- } else {
- return 1;
- }
- } else {
- return 0;
- }
-}
-#endif
-#endif /* _MSC_VER */
#if defined(_MSC_VER)
-#define mkdir(p,m) _mkdir(p)
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if _MSC_VER < 1500
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
#endif
-#elif defined(__MINGW32__)
-#define mkdir(p,m) _mkdir(p)
-#endif
-
-/* Threading API to use should be specified here for compatibility reasons.
- This is however best specified on the compiler's command-line. */
-#if defined(LIBXML_THREAD_ENABLED)
-#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE)
-#define HAVE_WIN32_THREADS
-#endif
-#endif
-
-/* Some third-party libraries far from our control assume the following
- is defined, which it is not if we don't include windows.h. */
-#if !defined(FALSE)
-#define FALSE 0
-#endif
-#if !defined(TRUE)
-#define TRUE (!(FALSE))
#endif
#endif /* __LIBXML_WIN32_CONFIG__ */
diff --git a/chromium/third_party/libxml/win32/include/libxml/xmlversion.h b/chromium/third_party/libxml/win32/include/libxml/xmlversion.h
index 72883c81c93..d84600c05ad 100644
--- a/chromium/third_party/libxml/win32/include/libxml/xmlversion.h
+++ b/chromium/third_party/libxml/win32/include/libxml/xmlversion.h
@@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
-#define LIBXML_DOTTED_VERSION "2.9.13"
+#define LIBXML_DOTTED_VERSION "2.11.0"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
-#define LIBXML_VERSION 20913
+#define LIBXML_VERSION 21100
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
-#define LIBXML_VERSION_STRING "20913"
+#define LIBXML_VERSION_STRING "21100"
/**
* LIBXML_VERSION_EXTRA:
@@ -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(20913);
+#define LIBXML_TEST_VERSION xmlCheckVersion(21100);
#ifndef VMS
#if 0
@@ -230,15 +230,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
- * LIBXML_DOCB_ENABLED:
- *
- * Whether the SGML Docbook support is configured in
- */
-#if 0
-#define LIBXML_DOCB_ENABLED
-#endif
-
-/**
* LIBXML_XPATH_ENABLED:
*
* Whether XPath is configured in
@@ -257,6 +248,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_XPTR_LOCS_ENABLED:
+ *
+ * Whether support for XPointer locations is configured in
+ */
+#if 0
+#define LIBXML_XPTR_LOCS_ENABLED
+#endif
+
+/**
* LIBXML_XINCLUDE_ENABLED:
*
* Whether XInclude is configured in
@@ -313,7 +313,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
/**
* LIBXML_DEBUG_RUNTIME:
*
- * Whether the runtime debugging is configured in
+ * Removed
*/
#if 0
#define LIBXML_DEBUG_RUNTIME
@@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
-
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
+/** DOC_DISABLE */
#ifndef ATTRIBUTE_UNUSED
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
@@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
-/**
- * LIBXML_ATTR_ALLOC_SIZE:
- *
- * Macro used to indicate to GCC this is an allocator function
- */
-
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
@@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
-/**
- * LIBXML_ATTR_FORMAT:
- *
- * Macro used to indicate to GCC the parameter are printf like
- */
-
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
@@ -465,6 +448,19 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
+#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#define XML_IGNORE_FPTR_CAST_WARNINGS \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
+ _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
+#define XML_POP_WARNINGS \
+ _Pragma("GCC diagnostic pop")
+#else
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+#define XML_POP_WARNINGS
+#endif
+
+/** DOC_ENABLE */
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
@@ -493,6 +489,18 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#ifndef XML_DEPRECATED
#define XML_DEPRECATED
#endif
+/**
+ * LIBXML_IGNORE_FPTR_CAST_WARNINGS:
+ *
+ * Macro used to ignore pointer cast warnings that can't be worked around.
+ */
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+/**
+ * LIBXML_POP_WARNINGS:
+ *
+ * Macro used to restore warnings state.
+ */
+#define XML_POP_WARNINGS
#endif /* __GNUC__ */
#ifdef __cplusplus