summaryrefslogtreecommitdiff
path: root/chromium/third_party/libxml
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libxml')
-rw-r--r--chromium/third_party/libxml/BUILD.gn65
-rw-r--r--chromium/third_party/libxml/OWNERS5
-rw-r--r--chromium/third_party/libxml/README.chromium55
-rw-r--r--chromium/third_party/libxml/chromium/chromium-issue-599427.patch28
-rw-r--r--chromium/third_party/libxml/chromium/chromium-issue-628581.patch177
-rw-r--r--chromium/third_party/libxml/chromium/chromium-issue-708434.patch19
-rw-r--r--chromium/third_party/libxml/chromium/libxml2-2.9.4-security-CVE-2017-7376-nanohttp-out-of-bounds-write.patch13
-rw-r--r--chromium/third_party/libxml/chromium/libxml2-2.9.4-security-xpath-nodetab-uaf.patch15
-rw-r--r--chromium/third_party/libxml/chromium/libxml_utils.cc140
-rw-r--r--chromium/third_party/libxml/chromium/libxml_utils.h45
-rwxr-xr-xchromium/third_party/libxml/chromium/roll.py467
-rw-r--r--chromium/third_party/libxml/linux/config.h61
-rw-r--r--chromium/third_party/libxml/linux/include/libxml/xmlversion.h51
-rwxr-xr-xchromium/third_party/libxml/linux/xml2-config10
-rw-r--r--chromium/third_party/libxml/mac/config.h58
-rw-r--r--chromium/third_party/libxml/mac/include/libxml/xmlversion.h51
-rw-r--r--chromium/third_party/libxml/src/ChangeLog18
-rw-r--r--chromium/third_party/libxml/src/HTMLparser.c24
-rw-r--r--chromium/third_party/libxml/src/HTMLtree.c122
-rw-r--r--chromium/third_party/libxml/src/Makefile.am162
-rw-r--r--chromium/third_party/libxml/src/NEWS453
-rw-r--r--chromium/third_party/libxml/src/README.zOS212
-rw-r--r--chromium/third_party/libxml/src/SAX2.c29
-rw-r--r--chromium/third_party/libxml/src/aclocal.m4207
-rw-r--r--chromium/third_party/libxml/src/buf.c6
-rw-r--r--chromium/third_party/libxml/src/config.h.in48
-rw-r--r--chromium/third_party/libxml/src/configure.ac124
-rw-r--r--chromium/third_party/libxml/src/dict.c41
-rw-r--r--chromium/third_party/libxml/src/elfgcchack.h2
-rw-r--r--chromium/third_party/libxml/src/encoding.c625
-rw-r--r--chromium/third_party/libxml/src/entities.c26
-rw-r--r--chromium/third_party/libxml/src/error.c6
-rwxr-xr-xchromium/third_party/libxml/src/genUnicode.py4
-rwxr-xr-xchromium/third_party/libxml/src/gentest.py42
-rw-r--r--chromium/third_party/libxml/src/globals.c22
-rw-r--r--chromium/third_party/libxml/src/hash.c23
-rw-r--r--chromium/third_party/libxml/src/include/libxml/HTMLparser.h4
-rw-r--r--chromium/third_party/libxml/src/include/libxml/encoding.h5
-rw-r--r--chromium/third_party/libxml/src/include/libxml/globals.h1
-rw-r--r--chromium/third_party/libxml/src/include/libxml/hash.h9
-rw-r--r--chromium/third_party/libxml/src/include/libxml/list.h6
-rw-r--r--chromium/third_party/libxml/src/include/libxml/nanoftp.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/schemasInternals.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/threads.h9
-rw-r--r--chromium/third_party/libxml/src/include/libxml/tree.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlexports.h6
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlreader.h2
-rw-r--r--chromium/third_party/libxml/src/include/libxml/xmlversion.h.in3
-rw-r--r--chromium/third_party/libxml/src/include/win32config.h6
-rw-r--r--chromium/third_party/libxml/src/include/wsockcompat.h76
-rw-r--r--chromium/third_party/libxml/src/libxml.h18
-rw-r--r--chromium/third_party/libxml/src/libxml.m42
-rw-r--r--chromium/third_party/libxml/src/libxml.spec.in29
-rw-r--r--chromium/third_party/libxml/src/libxml2.spec35
-rw-r--r--chromium/third_party/libxml/src/libxml2.syms7
-rw-r--r--chromium/third_party/libxml/src/list.c8
-rw-r--r--chromium/third_party/libxml/src/macos/src/XMLTestPrefix.h2
-rw-r--r--chromium/third_party/libxml/src/macos/src/XMLTestPrefix2.h2
-rw-r--r--chromium/third_party/libxml/src/macos/src/config-mac.h42
-rw-r--r--chromium/third_party/libxml/src/macos/src/libxml2_GUSIConfig.cp2
-rw-r--r--chromium/third_party/libxml/src/macos/src/macos_main.c2
-rw-r--r--chromium/third_party/libxml/src/nanoftp.c18
-rw-r--r--chromium/third_party/libxml/src/nanohttp.c63
-rw-r--r--chromium/third_party/libxml/src/parser.c1315
-rw-r--r--chromium/third_party/libxml/src/parserInternals.c51
-rw-r--r--chromium/third_party/libxml/src/pattern.c1
-rw-r--r--chromium/third_party/libxml/src/runsuite.c37
-rw-r--r--chromium/third_party/libxml/src/runtest.c272
-rw-r--r--chromium/third_party/libxml/src/testC14N.c3
-rw-r--r--chromium/third_party/libxml/src/testRelax.c12
-rw-r--r--chromium/third_party/libxml/src/testSchemas.c12
-rw-r--r--chromium/third_party/libxml/src/testThreads.c139
-rw-r--r--chromium/third_party/libxml/src/testURI.c13
-rw-r--r--chromium/third_party/libxml/src/testapi.c416
-rw-r--r--chromium/third_party/libxml/src/testlimits.c9
-rw-r--r--chromium/third_party/libxml/src/testrecurse.c8
-rw-r--r--chromium/third_party/libxml/src/threads.c115
-rw-r--r--chromium/third_party/libxml/src/timsort.h584
-rw-r--r--chromium/third_party/libxml/src/tree.c30
-rw-r--r--chromium/third_party/libxml/src/uri.c91
-rw-r--r--chromium/third_party/libxml/src/valid.c186
-rw-r--r--chromium/third_party/libxml/src/win32/Makefile.bcb10
-rw-r--r--chromium/third_party/libxml/src/win32/Makefile.mingw19
-rw-r--r--chromium/third_party/libxml/src/win32/Makefile.msvc34
-rw-r--r--chromium/third_party/libxml/src/win32/configure.js12
-rw-r--r--chromium/third_party/libxml/src/win32/libxml2.rc36
-rw-r--r--chromium/third_party/libxml/src/xmlIO.c243
-rw-r--r--chromium/third_party/libxml/src/xmlmemory.c27
-rw-r--r--chromium/third_party/libxml/src/xmlreader.c49
-rw-r--r--chromium/third_party/libxml/src/xmlsave.c60
-rw-r--r--chromium/third_party/libxml/src/xmlstring.c9
-rw-r--r--chromium/third_party/libxml/src/xmlunicode.c6
-rw-r--r--chromium/third_party/libxml/src/xmlwriter.c21
-rw-r--r--chromium/third_party/libxml/src/xpath.c1114
-rw-r--r--chromium/third_party/libxml/win32/config.h6
-rw-r--r--chromium/third_party/libxml/win32/include/libxml/xmlversion.h45
96 files changed, 4963 insertions, 3841 deletions
diff --git a/chromium/third_party/libxml/BUILD.gn b/chromium/third_party/libxml/BUILD.gn
index 383157ca896..59e4d08e4d7 100644
--- a/chromium/third_party/libxml/BUILD.gn
+++ b/chromium/third_party/libxml/BUILD.gn
@@ -63,12 +63,25 @@ config("libxml_warnings") {
# trio_is_special_quantity and trio_is_negative are only
# used with certain preprocessor defines set.
"-Wno-unused-function",
+
+ # Comparison between xmlElementType and xmlXPathTypeVal.
+ # TODO(hans): See if we can fix upstream (http://crbug.com/763944).
+ "-Wno-enum-compare",
+ ]
+ } else if (is_linux) {
+ cflags = [
+ # gcc spits out a bunch of warnings about passing too many arguments to
+ # __xmlSimpleError.
+ "-Wno-format-extra-args",
]
}
}
static_library("bundled_libxml") {
output_name = "libxml2"
+
+ # 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 = [
"chromium/libxml_utils.cc",
"chromium/libxml_utils.h",
@@ -76,17 +89,21 @@ static_library("bundled_libxml") {
"linux/include/libxml/xmlversion.h",
"mac/config.h",
"mac/include/libxml/xmlversion.h",
- "src/DOCBparser.c",
+
+ #"src/DOCBparser.c",
"src/HTMLparser.c",
"src/HTMLtree.c",
- "src/SAX.c",
+
+ #"src/SAX.c",
"src/SAX2.c",
"src/buf.c",
"src/buf.h",
- "src/c14n.c",
- "src/catalog.c",
+
+ #"src/c14n.c",
+ #"src/catalog.c",
"src/chvalid.c",
- "src/debugXML.c",
+
+ #"src/debugXML.c",
"src/dict.c",
"src/elfgcchack.h",
"src/enc.h",
@@ -110,6 +127,8 @@ static_library("bundled_libxml") {
"src/include/libxml/globals.h",
"src/include/libxml/hash.h",
"src/include/libxml/list.h",
+ "src/include/libxml/nanoftp.h",
+ "src/include/libxml/nanohttp.h",
"src/include/libxml/parser.h",
"src/include/libxml/parserInternals.h",
"src/include/libxml/pattern.h",
@@ -141,45 +160,54 @@ static_library("bundled_libxml") {
"src/include/libxml/xpointer.h",
"src/include/win32config.h",
"src/include/wsockcompat.h",
- "src/legacy.c",
+
+ #"src/legacy.c",
"src/libxml.h",
"src/list.c",
"src/parser.c",
"src/parserInternals.c",
"src/pattern.c",
- "src/relaxng.c",
+
+ #"src/relaxng.c",
"src/save.h",
- "src/schematron.c",
+
+ #"src/schematron.c",
"src/threads.c",
"src/timsort.h",
"src/tree.c",
+ "src/triodef.h",
+ "src/trionan.h",
#"src/trio.c",
#"src/trio.h",
#"src/triodef.h",
+ # Note: xpath.c #includes trionan.c
#"src/trionan.c",
- #"src/trionan.h",
#"src/triop.h",
#"src/triostr.c",
#"src/triostr.h",
"src/uri.c",
"src/valid.c",
- "src/xinclude.c",
- "src/xlink.c",
+
+ #"src/xinclude.c",
+ #"src/xlink.c",
"src/xmlIO.c",
"src/xmlmemory.c",
- "src/xmlmodule.c",
+
+ #"src/xmlmodule.c",
"src/xmlreader.c",
- "src/xmlregexp.c",
+
+ #"src/xmlregexp.c",
"src/xmlsave.c",
- "src/xmlschemas.c",
- "src/xmlschemastypes.c",
+
+ #"src/xmlschemas.c",
+ #"src/xmlschemastypes.c",
"src/xmlstring.c",
"src/xmlunicode.c",
"src/xmlwriter.c",
"src/xpath.c",
- "src/xpointer.c",
+ #"src/xpointer.c",
#"src/xzlib.c",
"src/xzlib.h",
"win32/config.h",
@@ -194,6 +222,11 @@ static_library("bundled_libxml") {
":libxml_warnings",
]
+ if (is_win) {
+ # libxml2 already defines WIN32_LEAN_AND_MEAN.
+ configs -= [ "//build/config/win:lean_and_mean" ]
+ }
+
public_configs = [ ":libxml_config" ]
public_deps = [
"//third_party/icu:icuuc",
diff --git a/chromium/third_party/libxml/OWNERS b/chromium/third_party/libxml/OWNERS
index 5f395a589d0..b4a51977a21 100644
--- a/chromium/third_party/libxml/OWNERS
+++ b/chromium/third_party/libxml/OWNERS
@@ -1,5 +1,6 @@
# There's no real owners here. If you're familiar with the code please send
# a CL to add yourself here.
-cpu@chromium.org
-dominicc@chromium.org
+dcheng@chromium.org
scottmg@chromium.org
+
+# COMPONENT: Blink>XML
diff --git a/chromium/third_party/libxml/README.chromium b/chromium/third_party/libxml/README.chromium
index e7ad3737e61..c77276cb96e 100644
--- a/chromium/third_party/libxml/README.chromium
+++ b/chromium/third_party/libxml/README.chromium
@@ -1,6 +1,6 @@
Name: libxml
URL: http://xmlsoft.org
-Version: 3169602058bd2d04913909e869c61d1540bc7fb4
+Version: 6a6fb8560e75c3b9c15744ef20df9fce9fcd8c6e
License: MIT
License File: src/Copyright
Security Critical: yes
@@ -12,46 +12,13 @@ libxml2 from libxml.org.
Modifications:
- Add helper classes in chromium/libxml_utils.cc and
chromium/include/libxml/libxml_utils.h.
-- Fix printf format specifiers, https://chromium.googlesource.com/chromium/src/+/d31995076e55f1aac2f935c53b585a90ece27a11
-- Add second workaround for VS 2015 Update 2 code-gen bug - crbug.com/599427
-- Apply patch contributed here: https://crbug.com/623378#c7
-- Apply patch contributed here: https://crbug.com/624011
-- Apply patch contributed here: https://crbug.com/628581#c18
-- Apply patch contributed here: https://crbug.com/620679#c34
-
-This import was generated by this script: https://goo.gl/72CTWf
-
-To import a new snapshot:
-
-On Linux, get the latest tar, untar, and replace src/ with libxml2-X.Y.Z/.
-
-Generate config.h, include/libxml/xmlversion.h, and xml2-config:
-
-cd linux
-../src/configure --without-iconv --with-icu --without-ftp --without-http \
- --without-lzma
-cd ..
-Patch config.h to not define HAVE_RAND_R since we use this file on Android
-and it does not have it.
-
-On a Mac, do the same in the mac/ subdir for config.h and
-include/libxml/xmlversion.h and copy those to the Linux box in mac/
-
-On a Windows box:
-cd libxml2-2.9.2\win32
-cscript //E:jscript configure.js compiler=msvc iconv=no icu=yes ftp=no http=no
-Then copy VC10/config.h and include/libxml/xmlversion.h to win32/ on Linux.
-
-Remove:
- src/doc/
- src/example/
- src/macos/libxml2.mcp.xml.sit.hqx
- src/os400/
- src/python/
- src/result/
- src/test/
- src/vms/
- src/win32/wince
- src/VxWorks/
-
-Update BUILD.gn and libxml.gyp as necessary to add/remove files, etc.
+- Applied these patches in chromium/*.patch:
+ chromium-issue-599427.patch: workaround for VS 2015 Update 2 code-gen bug
+ chromium-issue-628581.patch: See https://crbug.com/628581#c18
+ libxml2-2.9.4-security-CVE-2017-7376-nanohttp-out-of-bounds-write.patch:
+ 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.
+- Delete various unused files, see chromium/roll.py
+
+This import was generated by the chromium/roll.py script.
diff --git a/chromium/third_party/libxml/chromium/chromium-issue-599427.patch b/chromium/third_party/libxml/chromium/chromium-issue-599427.patch
new file mode 100644
index 00000000000..20e26c51942
--- /dev/null
+++ b/chromium/third_party/libxml/chromium/chromium-issue-599427.patch
@@ -0,0 +1,28 @@
+--- a/xmlstring.c 2016-05-13 17:24:58.870079372 +0900
++++ b/xmlstring.c 2016-04-25 13:58:09.879238595 +0900
+@@ -835,16 +835,20 @@
+ while ( len-- > 0) {
+ if ( !*ptr )
+ break;
+- if ( (ch = *ptr++) & 0x80)
+- while ((ch<<=1) & 0x80 ) {
+- if (*ptr == 0) 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 ) {
+ ptr++;
+- }
++ if (*ptr == 0) break;
++ }
++ }
+ }
+ return (ptr - utf);
+ }
+
+-
+ /**
+ * xmlUTF8Strndup:
+ * @utf: the input UTF8 *
diff --git a/chromium/third_party/libxml/chromium/chromium-issue-628581.patch b/chromium/third_party/libxml/chromium/chromium-issue-628581.patch
new file mode 100644
index 00000000000..2fcf4e5beaa
--- /dev/null
+++ b/chromium/third_party/libxml/chromium/chromium-issue-628581.patch
@@ -0,0 +1,177 @@
+diff --git a/entities.c b/entities.c
+index 43549bc5..e4a09d62 100644
+--- a/entities.c
++++ b/entities.c
+@@ -164,6 +164,7 @@ xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type,
+ memset(ret, 0, sizeof(xmlEntity));
+ ret->type = XML_ENTITY_DECL;
+ ret->checked = 0;
++ ret->guard = XML_ENTITY_NOT_BEING_CHECKED;
+
+ /*
+ * fill the structure.
+@@ -936,6 +937,7 @@ xmlCopyEntity(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ cur->orig = xmlStrdup(ent->orig);
+ if (ent->URI != NULL)
+ cur->URI = xmlStrdup(ent->URI);
++ cur->guard = 0;
+ return(cur);
+ }
+
+diff --git a/include/libxml/entities.h b/include/libxml/entities.h
+index 47b4573e..012efab2 100644
+--- a/include/libxml/entities.h
++++ b/include/libxml/entities.h
+@@ -35,8 +35,13 @@ typedef enum {
+ * and the linkind data needed for the linking in the hash table.
+ */
+
++typedef enum {
++ XML_ENTITY_NOT_BEING_CHECKED,
++ XML_ENTITY_BEING_CHECKED /* entity check is in progress */
++} xmlEntityRecursionGuard;
++
+ struct _xmlEntity {
+- void *_private; /* application data */
++ void *_private; /* application data */
+ xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
+ const xmlChar *name; /* Entity name */
+ struct _xmlNode *children; /* First child link */
+@@ -56,10 +61,11 @@ struct _xmlEntity {
+ struct _xmlEntity *nexte; /* unused */
+ const xmlChar *URI; /* the full URI as computed */
+ int owner; /* does the entity own the childrens */
+- int checked; /* was the entity content checked */
+- /* this is also used to count entities
+- * references done from that entity
+- * and if it contains '<' */
++ int checked; /* was the entity content checked and */
++ /* l.o. bit: replacement contains '<' */
++ /* remaining bits: one plus count of */
++ /* entity references from this entity */
++ xmlEntityRecursionGuard guard;
+ };
+
+ /*
+diff --git a/parser.c b/parser.c
+index ca9fde2c..4264445a 100644
+--- a/parser.c
++++ b/parser.c
+@@ -137,18 +137,24 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
+ * This may look absurd but is needed to detect
+ * entities problems
+ */
++ if ((ent != NULL) && (ent->guard == XML_ENTITY_BEING_CHECKED)) {
++ xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
++ return (1);
++ }
+ if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
+ (ent->content != NULL) && (ent->checked == 0) &&
+ (ctxt->errNo != XML_ERR_ENTITY_LOOP)) {
+ unsigned long oldnbent = ctxt->nbentities;
+ xmlChar *rep;
+
++ ent->guard = XML_ENTITY_BEING_CHECKED;
+ ent->checked = 1;
+
+ ++ctxt->depth;
+ rep = xmlStringDecodeEntities(ctxt, ent->content,
+ XML_SUBSTITUTE_REF, 0, 0, 0);
+ --ctxt->depth;
++ ent->guard = XML_ENTITY_NOT_BEING_CHECKED;
+ if ((rep == NULL) || (ctxt->errNo == XML_ERR_ENTITY_LOOP)) {
+ ent->content[0] = 0;
+ }
+@@ -7105,23 +7111,28 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
+ * if its replacement text matches the production labeled
+ * content.
+ */
+- if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) {
+- ctxt->depth++;
+- ret = xmlParseBalancedChunkMemoryInternal(ctxt, ent->content,
+- user_data, &list);
+- ctxt->depth--;
+-
+- } else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
+- ctxt->depth++;
+- ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, ctxt->sax,
+- user_data, ctxt->depth, ent->URI,
+- ent->ExternalID, &list);
+- ctxt->depth--;
+- } else {
+- ret = XML_ERR_ENTITY_PE_INTERNAL;
+- xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
+- "invalid entity type found\n", NULL);
+- }
++ if (ent->guard == XML_ENTITY_BEING_CHECKED) {
++ ret = XML_ERR_ENTITY_LOOP;
++ } else {
++ ent->guard = XML_ENTITY_BEING_CHECKED;
++ if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) {
++ ctxt->depth++;
++ ret = xmlParseBalancedChunkMemoryInternal(ctxt, ent->content,
++ user_data, &list);
++ ctxt->depth--;
++ } else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
++ ctxt->depth++;
++ ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, ctxt->sax,
++ user_data, ctxt->depth, ent->URI,
++ ent->ExternalID, &list);
++ ctxt->depth--;
++ } else {
++ ret = XML_ERR_ENTITY_PE_INTERNAL;
++ xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
++ "invalid entity type found\n", NULL);
++ }
++ ent->guard = XML_ENTITY_NOT_BEING_CHECKED;
++ }
+
+ /*
+ * Store the number of entities needing parsing for this entity
+@@ -7229,23 +7240,29 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
+ else
+ user_data = ctxt->userData;
+
+- if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) {
+- ctxt->depth++;
+- ret = xmlParseBalancedChunkMemoryInternal(ctxt,
+- ent->content, user_data, NULL);
+- ctxt->depth--;
+- } else if (ent->etype ==
+- XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
+- ctxt->depth++;
+- ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt,
+- ctxt->sax, user_data, ctxt->depth,
+- ent->URI, ent->ExternalID, NULL);
+- ctxt->depth--;
+- } else {
+- ret = XML_ERR_ENTITY_PE_INTERNAL;
+- xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
+- "invalid entity type found\n", NULL);
+- }
++ if (ent->guard == XML_ENTITY_BEING_CHECKED) {
++ ret = XML_ERR_ENTITY_LOOP;
++ } else {
++ ent->guard = XML_ENTITY_BEING_CHECKED;
++ if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) {
++ ctxt->depth++;
++ ret = xmlParseBalancedChunkMemoryInternal(ctxt,
++ ent->content, user_data, NULL);
++ ctxt->depth--;
++ } else if (ent->etype ==
++ XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
++ ctxt->depth++;
++ ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt,
++ ctxt->sax, user_data, ctxt->depth,
++ ent->URI, ent->ExternalID, NULL);
++ ctxt->depth--;
++ } else {
++ ret = XML_ERR_ENTITY_PE_INTERNAL;
++ xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
++ "invalid entity type found\n", NULL);
++ }
++ ent->guard = XML_ENTITY_NOT_BEING_CHECKED;
++ }
+ if (ret == XML_ERR_ENTITY_LOOP) {
+ xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+ return;
diff --git a/chromium/third_party/libxml/chromium/chromium-issue-708434.patch b/chromium/third_party/libxml/chromium/chromium-issue-708434.patch
new file mode 100644
index 00000000000..bd8e1a6ac99
--- /dev/null
+++ b/chromium/third_party/libxml/chromium/chromium-issue-708434.patch
@@ -0,0 +1,19 @@
+diff --git a/third_party/libxml/src/parserInternals.c b/third_party/libxml/src/parserInternals.c
+index bfc778ac1f77..286fdcea9760 100644
+--- src/parserInternals.c
++++ src/parserInternals.c
+@@ -1369,8 +1369,13 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
+ * should not happen while parsing which is the situation where
+ * the id is actually needed.
+ */
+- if (ctxt != NULL)
++ if (ctxt != NULL) {
++ if (ctxt->input_id >= INT_MAX) {
++ xmlErrMemory(ctxt, "Input ID overflow\n");
++ return(NULL);
++ }
+ input->id = ctxt->input_id++;
++ }
+
+ return(input);
+ }
diff --git a/chromium/third_party/libxml/chromium/libxml2-2.9.4-security-CVE-2017-7376-nanohttp-out-of-bounds-write.patch b/chromium/third_party/libxml/chromium/libxml2-2.9.4-security-CVE-2017-7376-nanohttp-out-of-bounds-write.patch
new file mode 100644
index 00000000000..d0d877dca3d
--- /dev/null
+++ b/chromium/third_party/libxml/chromium/libxml2-2.9.4-security-CVE-2017-7376-nanohttp-out-of-bounds-write.patch
@@ -0,0 +1,13 @@
+https://bugzilla.gnome.org/show_bug.cgi?id=780690
+
+--- src/uri.c
++++ src/uri.c
+@@ -334,7 +335,7 @@ xmlParse3986Port(xmlURIPtr uri, const char **str)
+ cur++;
+ }
+ if (uri != NULL)
+- uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */
++ uri->port = port & USHRT_MAX; /* port value modulo USHRT_MAX+1 */
+ *str = cur;
+ return(0);
+ }
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
new file mode 100644
index 00000000000..ecf93074a68
--- /dev/null
+++ b/chromium/third_party/libxml/chromium/libxml2-2.9.4-security-xpath-nodetab-uaf.patch
@@ -0,0 +1,15 @@
+not upstream yet, fix from nmehta@
+see https://docs.google.com/document/d/1-Cd_Yq8MZ7am2ZhKhbDhqZ_L0aLJPBg0w1QLXGVoNmY/edit
+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 @@
+ }
+ memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+ ret->type = XPATH_XSLT_TREE;
+- ret->boolval = 1;
++ ret->boolval = 0;
+ ret->user = (void *) val;
+ ret->nodesetval = xmlXPathNodeSetCreate(val);
+ #ifdef XP_DEBUG_OBJ_USAGE
diff --git a/chromium/third_party/libxml/chromium/libxml_utils.cc b/chromium/third_party/libxml/chromium/libxml_utils.cc
index a237be59a03..c0e542b0371 100644
--- a/chromium/third_party/libxml/chromium/libxml_utils.cc
+++ b/chromium/third_party/libxml/chromium/libxml_utils.cc
@@ -4,16 +4,66 @@
#include "libxml_utils.h"
+#include <vector>
+
#include "libxml/xmlreader.h"
+namespace {
+
+// Converts a libxml xmlChar* into a UTF-8 std::string.
+// NULL inputs produce an empty string.
std::string XmlStringToStdString(const xmlChar* xmlstring) {
+ if (!xmlstring)
+ return std::string();
+
// xmlChar*s are UTF-8, so this cast is safe.
- if (xmlstring)
- return std::string(reinterpret_cast<const char*>(xmlstring));
- else
- return "";
+ return std::string(reinterpret_cast<const char*>(xmlstring));
+}
+
+// Same as XmlStringToStdString but also frees |xmlstring|.
+std::string XmlStringToStdStringWithDelete(xmlChar* xmlstring) {
+ std::string result = XmlStringToStdString(xmlstring);
+ xmlFree(xmlstring);
+ return result;
+}
+
+enum GetAttributesQueryType { ATTRIBUTES, NAMESPACES_PREFIXES };
+
+// Populates |names| with the names of the attributes or prefix of namespaces
+// (depending on |query_type|) for the current node in |reader|.
+// Returns true if attribute names/namespace prefixes were retrieved, false
+// otherwise.
+// Note the strings in |names| are valid as long as |reader| is valid and should
+// not be deleted.
+bool GetNodeAttributeNames(xmlTextReaderPtr reader,
+ GetAttributesQueryType query_type,
+ std::vector<const xmlChar*>* names) {
+ if (xmlTextReaderHasAttributes(reader) <= 0)
+ return false;
+
+ if (!xmlTextReaderMoveToFirstAttribute(reader))
+ return false;
+
+ do {
+ bool is_namespace = xmlTextReaderIsNamespaceDecl(reader) == 1;
+ if (query_type == NAMESPACES_PREFIXES && is_namespace) {
+ // Use the local name for namespaces so we don't include 'xmlns:".
+ names->push_back(xmlTextReaderConstLocalName(reader));
+ } else if (query_type == ATTRIBUTES && !is_namespace) {
+ // Use the fully qualified name for attributes.
+ names->push_back(xmlTextReaderConstName(reader));
+ }
+ } while (xmlTextReaderMoveToNextAttribute(reader) > 0);
+
+ // Move the reader from the attributes back to the containing element.
+ if (!xmlTextReaderMoveToElement(reader))
+ return false;
+
+ return true;
}
+} // namespace
+
XmlReader::XmlReader() : reader_(NULL) {
}
@@ -23,8 +73,7 @@ XmlReader::~XmlReader() {
}
bool XmlReader::Load(const std::string& input) {
- const int kParseOptions = XML_PARSE_RECOVER | // recover on errors
- XML_PARSE_NONET; // forbid network access
+ const int kParseOptions = XML_PARSE_NONET; // forbid network access
// TODO(evanm): Verify it's OK to pass NULL for the URL and encoding.
// The libxml code allows for these, but it's unclear what effect is has.
reader_ = xmlReaderForMemory(input.data(), static_cast<int>(input.size()),
@@ -33,25 +82,92 @@ bool XmlReader::Load(const std::string& input) {
}
bool XmlReader::LoadFile(const std::string& file_path) {
- const int kParseOptions = XML_PARSE_RECOVER | // recover on errors
- XML_PARSE_NONET; // forbid network access
+ const int kParseOptions = XML_PARSE_NONET; // forbid network access
reader_ = xmlReaderForFile(file_path.c_str(), NULL, kParseOptions);
return reader_ != NULL;
}
+std::string XmlReader::NodeName() {
+ return XmlStringToStdString(xmlTextReaderConstLocalName(reader_));
+}
+
+std::string XmlReader::NodeFullName() {
+ return XmlStringToStdString(xmlTextReaderConstName(reader_));
+}
+
bool XmlReader::NodeAttribute(const char* name, std::string* out) {
xmlChar* value = xmlTextReaderGetAttribute(reader_, BAD_CAST name);
if (!value)
return false;
- *out = XmlStringToStdString(value);
- xmlFree(value);
+ *out = XmlStringToStdStringWithDelete(value);
+ return true;
+}
+
+bool XmlReader::GetAllNodeAttributes(
+ std::map<std::string, std::string>* attributes) {
+ std::vector<const xmlChar*> attribute_names;
+ if (!GetNodeAttributeNames(reader_, ATTRIBUTES, &attribute_names))
+ return false;
+
+ // Retrieve the attribute values.
+ for (const auto* name : attribute_names) {
+ (*attributes)[XmlStringToStdString(name)] = XmlStringToStdStringWithDelete(
+ xmlTextReaderGetAttribute(reader_, name));
+ }
+ return true;
+}
+
+bool XmlReader::GetAllDeclaredNamespaces(
+ std::map<std::string, std::string>* namespaces) {
+ std::vector<const xmlChar*> prefixes;
+ if (!GetNodeAttributeNames(reader_, NAMESPACES_PREFIXES, &prefixes))
+ return false;
+
+ // Retrieve the namespace URIs.
+ for (const auto* prefix : prefixes) {
+ bool default_namespace = xmlStrcmp(prefix, BAD_CAST "xmlns") == 0;
+
+ std::string value = XmlStringToStdStringWithDelete(
+ xmlTextReaderLookupNamespace(reader_, prefix));
+ if (value.empty() && default_namespace) {
+ // Default namespace is treated as an attribute for some reason.
+ value = XmlStringToStdStringWithDelete(
+ xmlTextReaderGetAttribute(reader_, prefix));
+ }
+ (*namespaces)[default_namespace ? "" : XmlStringToStdString(prefix)] =
+ value;
+ }
+ return true;
+}
+
+bool XmlReader::GetTextIfTextElement(std::string* content) {
+ if (NodeType() != XML_READER_TYPE_TEXT)
+ return false;
+
+ *content = XmlStringToStdString(xmlTextReaderConstValue(reader_));
+ return true;
+}
+
+bool XmlReader::GetTextIfCDataElement(std::string* content) {
+ if (NodeType() != XML_READER_TYPE_CDATA)
+ return false;
+
+ *content = XmlStringToStdString(xmlTextReaderConstValue(reader_));
return true;
}
+bool XmlReader::IsElement() {
+ return NodeType() == XML_READER_TYPE_ELEMENT;
+}
+
bool XmlReader::IsClosingElement() {
return NodeType() == XML_READER_TYPE_END_ELEMENT;
}
+bool XmlReader::IsEmptyElement() {
+ return xmlTextReaderIsEmptyElement(reader_);
+}
+
bool XmlReader::ReadElementContent(std::string* content) {
const int start_depth = Depth();
@@ -125,3 +241,7 @@ void XmlWriter::StopWriting() {
xmlFreeTextWriter(writer_);
writer_ = NULL;
}
+
+std::string XmlWriter::GetWrittenString() {
+ return buffer_ ? XmlStringToStdString(buffer_->content) : "";
+}
diff --git a/chromium/third_party/libxml/chromium/libxml_utils.h b/chromium/third_party/libxml/chromium/libxml_utils.h
index 9091f491b48..c1ee08c1a2c 100644
--- a/chromium/third_party/libxml/chromium/libxml_utils.h
+++ b/chromium/third_party/libxml/chromium/libxml_utils.h
@@ -6,15 +6,12 @@
#define THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
#pragma once
+#include <map>
#include <string>
#include "libxml/xmlreader.h"
#include "libxml/xmlwriter.h"
-// Converts a libxml xmlChar* into a UTF-8 std::string.
-// NULL inputs produce an empty string.
-std::string XmlStringToStdString(const xmlChar* xmlstring);
-
// libxml uses a global error function pointer for reporting errors.
// A ScopedXmlErrorFunc object lets you change the global error pointer
// for the duration of the object's lifetime.
@@ -62,10 +59,12 @@ class XmlReader {
int Depth() { return xmlTextReaderDepth(reader_); }
// Returns the "local" name of the current node.
+ // For a tag like <foo:bar>, this is the string "bar".
+ std::string NodeName();
+
+ // Returns the name of the current node.
// For a tag like <foo:bar>, this is the string "foo:bar".
- std::string NodeName() {
- return XmlStringToStdString(xmlTextReaderConstLocalName(reader_));
- }
+ std::string NodeFullName();
// When pointing at a tag, retrieves the value of an attribute.
// Returns false on failure.
@@ -73,9 +72,35 @@ class XmlReader {
// returns true and |value| is set to "a".
bool NodeAttribute(const char* name, std::string* value);
+ // Populates |attributes| with all the attributes of the current tag and
+ // returns true. Note that namespace declarations are not reported.
+ // Returns false if there are no attributes in the current tag.
+ bool GetAllNodeAttributes(std::map<std::string, std::string>* attributes);
+
+ // Populates |namespaces| with all the namespaces (prefix/URI pairs) declared
+ // in the current tag and returns true. Note that the default namespace, if
+ // declared in the tag, is populated with an empty prefix.
+ // 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.
+ bool GetTextIfTextElement(std::string* content);
+ bool GetTextIfCDataElement(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
+ // check for those.
+ bool IsElement();
+
// Returns true if the node is a closing element (e.g. </foo>).
bool IsClosingElement();
+ // Returns true if the current node is an empty (self-closing) element (e.g.
+ // <foo/>).
+ bool IsEmptyElement();
+
// Helper functions not provided by libxml ----------------------------------
// Return the string content within an element.
@@ -163,11 +188,7 @@ class XmlWriter {
// Helper functions not provided by xmlTextWriter ---------------------------
// Returns the string that has been written to the buffer.
- std::string GetWrittenString() {
- if (buffer_ == NULL)
- return "";
- return XmlStringToStdString(buffer_->content);
- }
+ std::string GetWrittenString();
private:
// The underlying libxml xmlTextWriter.
diff --git a/chromium/third_party/libxml/chromium/roll.py b/chromium/third_party/libxml/chromium/roll.py
new file mode 100755
index 00000000000..5dadf621aba
--- /dev/null
+++ b/chromium/third_party/libxml/chromium/roll.py
@@ -0,0 +1,467 @@
+#!/usr/bin/env python
+
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import argparse
+import os
+import os.path
+import shutil
+import subprocess
+import sys
+import stat
+import tempfile
+
+# How to patch libxml2 in Chromium:
+#
+# 1. Write a .patch file and add it to third_party/libxml/chromium.
+# 2. Apply the patch in src: patch -p1 <../chromium/foo.patch
+# 3. Add the patch to the list of patches in this file.
+# 4. Update README.chromium with the provenance of the patch.
+# 5. Upload a change with the modified documentation, roll script,
+# patch, applied patch and any other relevant changes like
+# regression tests. Go through the usual review and commit process.
+#
+# How to roll libxml2 in Chromium:
+#
+# Prerequisites:
+#
+# 1. Check out Chromium somewhere on Linux, Mac and Windows.
+# 2. On Linux:
+# a. sudo apt-get install libicu-dev
+# b. git clone https://github.com/GNOME/libxml2.git somewhere
+# 3. On Mac, install these MacPorts:
+# autoconf automake libtool pkgconfig icu
+#
+# Procedure:
+#
+# Warning: This process is destructive. Run it on a clean branch.
+#
+# 1. On Linux, in the libxml2 repo directory:
+# a. git remote update origin
+# b. git checkout origin/master
+#
+# This will be the upstream version of libxml you are rolling to.
+#
+# 2. On Linux, in the Chromium src director:
+# a. third_party/libxml/chromium/roll.py --linux /path/to/libxml2
+#
+# If this fails, it may be a patch no longer applies. Reset to
+# head; modify the patch files, this script, and
+# README.chromium; then commit the result and run it again.
+#
+# b. Upload a CL, but do not Start Review.
+#
+# 2. On Windows, in the Chromium src directory:
+# a. git cl patch <Gerrit Issue ID>
+# b. third_party\libxml\chromium\roll.py --win32
+# c. git cl upload
+#
+# 3. On Mac, in the Chromium src directory:
+# a. git cl patch <Gerrit Issue ID>
+# b. third_party/libxml/chromium/roll.py --mac
+# c. Make and commit any final changes to README.chromium, BUILD.gn, etc.
+# d. git cl upload
+# e. Complete the review as usual
+
+PATCHES = [
+ 'chromium-issue-599427.patch',
+ 'chromium-issue-628581.patch',
+ 'libxml2-2.9.4-security-CVE-2017-7376-nanohttp-out-of-bounds-write.patch',
+ 'libxml2-2.9.4-security-xpath-nodetab-uaf.patch',
+ 'chromium-issue-708434.patch',
+]
+
+
+# See libxml2 configure.ac and win32/configure.js to learn what
+# options are available. We include every option here to more easily track
+# changes from one version to the next, and to be sure we only include what
+# we need.
+# These two sets of options should be in sync. You can check the
+# generated #defines in (win32|mac|linux)/include/libxml/xmlversion.h to confirm
+# this.
+# We would like to disable python but it introduces a host of build errors
+SHARED_XML_CONFIGURE_OPTIONS = [
+ # These options are turned ON
+ ('--with-html', 'html=yes'),
+ ('--with-icu', 'icu=yes'),
+ ('--with-output', 'output=yes'),
+ ('--with-push', 'push=yes'),
+ ('--with-python', 'python=yes'),
+ ('--with-reader', 'reader=yes'),
+ ('--with-sax1', 'sax1=yes'),
+ ('--with-tree', 'tree=yes'),
+ ('--with-writer', 'writer=yes'),
+ ('--with-xpath', 'xpath=yes'),
+ # These options are turned OFF
+ ('--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'),
+ ('--without-iso8859x', 'iso8859x=no'),
+ ('--without-legacy', 'legacy=no'),
+ ('--without-lzma', 'lzma=no'),
+ ('--without-mem-debug', 'mem_debug=no'),
+ ('--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-zlib', 'zlib=no'),
+]
+
+
+# These options are only available in configure.ac for Linux and Mac.
+EXTRA_NIX_XML_CONFIGURE_OPTIONS = [
+ '--without-fexceptions',
+ '--without-minimum',
+ '--without-readline',
+ '--without-history',
+]
+
+
+# These options are only available in win32/configure.js for Windows.
+EXTRA_WIN32_XML_CONFIGURE_OPTIONS = [
+ 'trio=no',
+ 'walker=no',
+]
+
+
+XML_CONFIGURE_OPTIONS = (
+ [option[0] for option in SHARED_XML_CONFIGURE_OPTIONS] +
+ EXTRA_NIX_XML_CONFIGURE_OPTIONS)
+
+
+XML_WIN32_CONFIGURE_OPTIONS = (
+ [option[1] for option in SHARED_XML_CONFIGURE_OPTIONS] +
+ EXTRA_WIN32_XML_CONFIGURE_OPTIONS)
+
+
+FILES_TO_REMOVE = [
+ 'src/DOCBparser.c',
+ 'src/HACKING',
+ 'src/INSTALL',
+ 'src/INSTALL.libxml2',
+ 'src/MAINTAINERS',
+ 'src/Makefile.in',
+ 'src/Makefile.win',
+ 'src/README.cvs-commits',
+ # This is unneeded "legacy" SAX API, even though we enable SAX1.
+ 'src/SAX.c',
+ 'src/VxWorks',
+ 'src/autogen.sh',
+ 'src/autom4te.cache',
+ 'src/bakefile',
+ 'src/build_glob.py',
+ 'src/c14n.c',
+ 'src/catalog.c',
+ 'src/compile',
+ 'src/config.guess',
+ 'src/config.sub',
+ 'src/configure',
+ 'src/chvalid.def',
+ 'src/debugXML.c',
+ 'src/depcomp',
+ 'src/doc',
+ 'src/example',
+ 'src/genChRanges.py',
+ 'src/global.data',
+ 'src/include/libxml/Makefile.in',
+ 'src/include/libxml/xmlversion.h',
+ 'src/include/libxml/xmlwin32version.h',
+ 'src/include/libxml/xmlwin32version.h.in',
+ 'src/include/Makefile.in',
+ 'src/install-sh',
+ 'src/legacy.c',
+ 'src/libxml2.doap',
+ 'src/ltmain.sh',
+ 'src/m4',
+ 'src/macos/libxml2.mcp.xml.sit.hqx',
+ 'src/missing',
+ 'src/optim',
+ 'src/os400',
+ 'src/python',
+ 'src/relaxng.c',
+ 'src/result',
+ 'src/rngparser.c',
+ 'src/schematron.c',
+ 'src/test',
+ 'src/testOOM.c',
+ 'src/testOOMlib.c',
+ 'src/testOOMlib.h',
+ 'src/trio.c',
+ 'src/trio.h',
+ 'src/triop.h',
+ 'src/triostr.c',
+ 'src/triostr.h',
+ 'src/vms',
+ 'src/win32/VC10/config.h',
+ 'src/win32/wince',
+ 'src/xinclude.c',
+ 'src/xlink.c',
+ 'src/xml2-config.in',
+ 'src/xmlcatalog.c',
+ 'src/xmllint.c',
+ 'src/xmlmodule.c',
+ 'src/xmlregexp.c',
+ 'src/xmlschemas.c',
+ 'src/xmlschemastypes.c',
+ 'src/xpointer.c',
+ 'src/xstc',
+ 'src/xzlib.c',
+]
+
+
+THIRD_PARTY_LIBXML_SRC = 'third_party/libxml/src'
+
+
+class WorkingDir(object):
+ """"Changes the working directory and resets it on exit."""
+ def __init__(self, path):
+ self.prev_path = os.getcwd()
+ self.path = path
+
+ def __enter__(self):
+ os.chdir(self.path)
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ if exc_value:
+ print('was in %s; %s before that' % (self.path, self.prev_path))
+ os.chdir(self.prev_path)
+
+
+def git(*args):
+ """Runs a git subcommand.
+
+ On Windows this uses the shell because there's a git wrapper
+ batch file in depot_tools.
+
+ Arguments:
+ args: The arguments to pass to git.
+ """
+ command = ['git'] + list(args)
+ subprocess.check_call(command, shell=(os.name == 'nt'))
+
+
+def remove_tracked_and_local_dir(path):
+ """Removes the contents of a directory from git, and the filesystem.
+
+ Arguments:
+ path: The path to remove.
+ """
+ remove_tracked_files([path])
+ shutil.rmtree(path, ignore_errors=True)
+ os.mkdir(path)
+
+
+def remove_tracked_files(files_to_remove):
+ """Removes tracked files from git.
+
+ Arguments:
+ files_to_remove: The files to remove.
+ """
+ files_to_remove = [f for f in files_to_remove if os.path.exists(f)]
+ if files_to_remove:
+ git('rm', '-rf', *files_to_remove)
+
+
+def sed_in_place(input_filename, program):
+ """Replaces text in a file.
+
+ Arguments:
+ input_filename: The file to edit.
+ program: The sed program to perform edits on the file.
+ """
+ # OS X's sed requires -e
+ subprocess.check_call(['sed', '-i', '-e', program, input_filename])
+
+
+def check_copying(full_path_to_third_party_libxml_src):
+ path = os.path.join(full_path_to_third_party_libxml_src, 'COPYING')
+ if not os.path.exists(path):
+ return
+ with open(path) as f:
+ s = f.read()
+ if 'GNU' in s:
+ raise Exception('check COPYING')
+
+
+def prepare_libxml_distribution(libxml2_repo_path, temp_dir):
+ """Makes a libxml2 distribution.
+
+ Args:
+ libxml2_repo_path: The path to the local clone of the libxml2 repo.
+ temp_dir: A temporary directory to stage the distribution to.
+
+ Returns: A tuple of commit hash and full path to the archive.
+ """
+ # If it was necessary to push from a distribution prepared upstream,
+ # this is the point to inject it: Return the version string and the
+ # distribution tar file.
+
+ # The libxml2 repo we're pulling changes from should not have
+ # local changes. This *should* be a commit that's publicly visible
+ # in the upstream repo; reviewers should check this.
+ check_clean(libxml2_repo_path)
+
+ temp_config_path = os.path.join(temp_dir, 'config')
+ os.mkdir(temp_config_path)
+ temp_src_path = os.path.join(temp_dir, 'src')
+ os.mkdir(temp_src_path)
+
+ with WorkingDir(libxml2_repo_path):
+ commit = subprocess.check_output(
+ ['git', 'log', '-n', '1', '--pretty=format:%H', 'HEAD'])
+ subprocess.check_call(
+ 'git archive HEAD | tar -x -C "%s"' % temp_src_path,
+ shell=True)
+ with WorkingDir(temp_src_path):
+ os.remove('.gitignore')
+ with WorkingDir(temp_config_path):
+ print('../src/autogen.sh %s' % XML_CONFIGURE_OPTIONS)
+ subprocess.check_call(['../src/autogen.sh'] + XML_CONFIGURE_OPTIONS)
+ subprocess.check_call(['make', 'dist-all'])
+
+ # 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''',
+ shell=True)
+ return commit, os.path.abspath(tar_file)
+
+
+def roll_libxml_linux(src_path, libxml2_repo_path):
+ with WorkingDir(src_path):
+ # Export the upstream git repo.
+ try:
+ temp_dir = tempfile.mkdtemp()
+ print('temporary directory: %s' % temp_dir)
+
+ commit, tar_file = prepare_libxml_distribution(libxml2_repo_path,
+ temp_dir)
+
+ # Remove all of the old libxml to ensure only desired cruft
+ # accumulates
+ remove_tracked_and_local_dir(THIRD_PARTY_LIBXML_SRC)
+
+ # 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,
+ shell=True)
+ finally:
+ shutil.rmtree(temp_dir)
+
+ with WorkingDir(THIRD_PARTY_LIBXML_SRC):
+ # Put the version number is the README file
+ sed_in_place('../README.chromium',
+ 's/Version: .*$/Version: %s/' % commit)
+
+ for patch in PATCHES:
+ print(patch)
+ subprocess.check_call(
+ 'cat ../chromium/%s | patch -p1 --fuzz=0' % patch,
+ shell=True)
+
+ with WorkingDir('../linux'):
+ subprocess.check_call(
+ ['../src/autogen.sh'] + XML_CONFIGURE_OPTIONS)
+ check_copying(os.getcwd())
+ sed_in_place('config.h', 's/#define HAVE_RAND_R 1//')
+
+ # Add *everything*
+ with WorkingDir('../src'):
+ git('add', '*')
+ git('commit', '-am', '%s libxml, linux' % commit)
+ print('Now push to Windows and run steps there.')
+
+
+def roll_libxml_win32(src_path):
+ with WorkingDir(src_path):
+ # Run the configure script.
+ with WorkingDir(os.path.join(THIRD_PARTY_LIBXML_SRC, 'win32')):
+ subprocess.check_call(
+ ['cscript', '//E:jscript', 'configure.js', 'compiler=msvc'] +
+ XML_WIN32_CONFIGURE_OPTIONS)
+
+ # Add and commit the result.
+ shutil.move('VC10/config.h', '../../win32/config.h')
+ git('add', '../../win32/config.h')
+ shutil.move('../include/libxml/xmlversion.h',
+ '../../win32/include/libxml/xmlversion.h')
+ git('add', '../../win32/include/libxml/xmlversion.h')
+ git('commit', '-m', 'Windows')
+ git('clean', '-f')
+ print('Now push to Mac and run steps there.')
+
+
+def roll_libxml_mac(src_path):
+ full_path_to_third_party_libxml = os.path.join(
+ src_path, THIRD_PARTY_LIBXML_SRC, '..')
+
+ with WorkingDir(os.path.join(full_path_to_third_party_libxml, 'mac')):
+ subprocess.check_call(['autoreconf', '-i', '../src'])
+ os.chmod('../src/configure',
+ os.stat('../src/configure').st_mode | stat.S_IXUSR)
+ subprocess.check_call(['../src/configure'] + XML_CONFIGURE_OPTIONS)
+ sed_in_place('config.h', 's/#define HAVE_RAND_R 1//')
+
+ with WorkingDir(full_path_to_third_party_libxml):
+ commit = subprocess.check_output(['awk', '/Version:/ {print $2}',
+ 'README.chromium'])
+ remove_tracked_files(FILES_TO_REMOVE)
+ commit_message = 'Roll libxml to %s' % commit
+ git('commit', '-am', commit_message)
+ print('Now upload for review, etc.')
+
+
+def check_clean(path):
+ with WorkingDir(path):
+ status = subprocess.check_output(['git', 'status', '-s'])
+ if len(status) > 0:
+ raise Exception('repository at %s is not clean' % path)
+
+
+def main():
+ src_dir = os.getcwd()
+ if not os.path.exists(os.path.join(src_dir, 'third_party')):
+ print('error: run this script from the Chromium src directory')
+ sys.exit(1)
+
+ parser = argparse.ArgumentParser(
+ description='Roll the libxml2 dependency in Chromium')
+ platform = parser.add_mutually_exclusive_group(required=True)
+ platform.add_argument('--linux', action='store_true')
+ platform.add_argument('--win32', action='store_true')
+ platform.add_argument('--mac', action='store_true')
+ parser.add_argument(
+ 'libxml2_repo_path',
+ type=str,
+ nargs='?',
+ help='The path to the local clone of the libxml2 git repo.')
+ args = parser.parse_args()
+
+ if args.linux:
+ libxml2_repo_path = args.libxml2_repo_path
+ if not libxml2_repo_path:
+ print('Specify the path to the local libxml2 repo clone.')
+ sys.exit(1)
+ libxml2_repo_path = os.path.abspath(libxml2_repo_path)
+ roll_libxml_linux(src_dir, libxml2_repo_path)
+ elif args.win32:
+ roll_libxml_win32(src_dir)
+ elif args.mac:
+ roll_libxml_mac(src_dir)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/chromium/third_party/libxml/linux/config.h b/chromium/third_party/libxml/linux/config.h
index e2371b4c4b6..7d273f6cb42 100644
--- a/chromium/third_party/libxml/linux/config.h
+++ b/chromium/third_party/libxml/linux/config.h
@@ -4,9 +4,6 @@
/* Type cast for the gethostbyname() argument */
#define GETHOSTBYNAME_ARG_CAST /**/
-/* Define to 1 if you have the <ansidecl.h> header file. */
-/* #undef HAVE_ANSIDECL_H */
-
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
@@ -16,9 +13,6 @@
/* Whether struct sockaddr::__ss_family exists */
/* #undef HAVE_BROKEN_SS_FAMILY */
-/* Define to 1 if you have the `class' function. */
-/* #undef HAVE_CLASS */
-
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
@@ -29,7 +23,7 @@
#define HAVE_DLFCN_H 1
/* Have dlopen based dso */
-#define HAVE_DLOPEN /**/
+/* #undef HAVE_DLOPEN */
/* Define to 1 if you have the <dl.h> header file. */
/* #undef HAVE_DL_H */
@@ -40,24 +34,12 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
-/* Define to 1 if you have the `finite' function. */
-#define HAVE_FINITE 1
-
/* Define to 1 if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
-/* Define to 1 if you have the `fpclass' function. */
-/* #undef HAVE_FPCLASS */
-
/* Define to 1 if you have the `fprintf' function. */
#define HAVE_FPRINTF 1
-/* Define to 1 if you have the `fp_class' function. */
-/* #undef HAVE_FP_CLASS */
-
-/* Define to 1 if you have the <fp_class.h> header file. */
-/* #undef HAVE_FP_CLASS_H */
-
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
@@ -67,9 +49,6 @@
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
-/* Define to 1 if you have the <ieeefp.h> header file. */
-/* #undef HAVE_IEEEFP_H */
-
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@@ -82,24 +61,15 @@
/* Define if isnan is there */
#define HAVE_ISNAN /**/
-/* Define to 1 if you have the `isnand' function. */
-/* #undef HAVE_ISNAND */
-
/* Define if history library is there (-lhistory) */
/* #undef HAVE_LIBHISTORY */
-/* Have compression library */
-/* #undef HAVE_LIBLZMA */
-
/* Define if pthread library is there (-lpthread) */
-#define HAVE_LIBPTHREAD /**/
+/* #undef HAVE_LIBPTHREAD */
/* Define if readline library is there (-lreadline) */
/* #undef HAVE_LIBREADLINE */
-/* Have compression library */
-#define HAVE_LIBZ 1
-
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
@@ -129,9 +99,6 @@
# undef /**/ HAVE_MMAP
#endif
-/* Define to 1 if you have the <nan.h> header file. */
-/* #undef HAVE_NAN_H */
-
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
@@ -148,7 +115,7 @@
#define HAVE_PRINTF 1
/* Define if <pthread.h> is there */
-#define HAVE_PTHREAD_H /**/
+/* #undef HAVE_PTHREAD_H */
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
@@ -195,12 +162,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
@@ -210,9 +171,6 @@
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
-/* Define to 1 if you have the `strndup' function. */
-#define HAVE_STRNDUP 1
-
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
@@ -264,10 +222,7 @@
#define HAVE_VSPRINTF 1
/* Define to 1 if you have the <zlib.h> header file. */
-#define HAVE_ZLIB_H 1
-
-/* Define to 1 if you have the `_stat' function. */
-/* #undef HAVE__STAT */
+/* #undef HAVE_ZLIB_H */
/* Whether __va_copy() is available */
/* #undef HAVE___VA_COPY */
@@ -275,8 +230,7 @@
/* Define as const if the declaration of iconv() needs const. */
/* #undef ICONV_CONST */
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Name of package */
@@ -313,7 +267,7 @@
#define VA_LIST_IS_ARRAY 1
/* Version number of package */
-#define VERSION "2.9.4"
+#define VERSION "2.9.9"
/* Determine what socket length (socklen_t) data type is */
#define XML_SOCKLEN_T socklen_t
@@ -323,9 +277,6 @@
#define below would cause a syntax error. */
/* #undef _UINT32_T */
-/* Using the Win32 Socket implementation */
-/* #undef _WINSOCKAPI_ */
-
/* ss_family is not defined here, use __ss_family instead */
/* #undef ss_family */
diff --git a/chromium/third_party/libxml/linux/include/libxml/xmlversion.h b/chromium/third_party/libxml/linux/include/libxml/xmlversion.h
index ebf1374c1b7..59cc485d619 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.4"
+#define LIBXML_DOTTED_VERSION "2.9.9"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
-#define LIBXML_VERSION 20904
+#define LIBXML_VERSION 20909
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
-#define LIBXML_VERSION_STRING "20904"
+#define LIBXML_VERSION_STRING "20909"
/**
* 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(20904);
+#define LIBXML_TEST_VERSION xmlCheckVersion(20909);
#ifndef VMS
#if 0
@@ -90,7 +90,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the thread support is configured in
*/
-#if 1
+#if 0
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED
@@ -147,7 +147,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the xmlPattern node selection interface is configured in
*/
-#if 1
+#if 0
#define LIBXML_PATTERN_ENABLED
#endif
@@ -192,7 +192,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the DTD validation support is configured in
*/
-#if 1
+#if 0
#define LIBXML_VALID_ENABLED
#endif
@@ -210,7 +210,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the deprecated APIs are compiled in for compatibility
*/
-#if 1
+#if 0
#define LIBXML_LEGACY_ENABLED
#endif
@@ -219,7 +219,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Canonicalization support is configured in
*/
-#if 1
+#if 0
#define LIBXML_C14N_ENABLED
#endif
@@ -228,7 +228,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Catalog support is configured in
*/
-#if 1
+#if 0
#define LIBXML_CATALOG_ENABLED
#endif
@@ -237,7 +237,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the SGML Docbook support is configured in
*/
-#if 1
+#if 0
#define LIBXML_DOCB_ENABLED
#endif
@@ -255,7 +255,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether XPointer is configured in
*/
-#if 1
+#if 0
#define LIBXML_XPTR_ENABLED
#endif
@@ -264,7 +264,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether XInclude is configured in
*/
-#if 1
+#if 0
#define LIBXML_XINCLUDE_ENABLED
#endif
@@ -291,7 +291,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether ISO-8859-* support is made available in case iconv is not
*/
-#if 1
+#if 0
#define LIBXML_ISO8859X_ENABLED
#endif
@@ -300,7 +300,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether Debugging module is configured in
*/
-#if 1
+#if 0
#define LIBXML_DEBUG_ENABLED
#endif
@@ -327,7 +327,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Unicode related interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_UNICODE_ENABLED
#endif
@@ -336,7 +336,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the regular expressions interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_REGEXP_ENABLED
#endif
@@ -345,7 +345,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the automata interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_AUTOMATA_ENABLED
#endif
@@ -354,7 +354,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the formal expressions interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_EXPR_ENABLED
#endif
@@ -363,7 +363,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Schemas validation interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_SCHEMAS_ENABLED
#endif
@@ -372,7 +372,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Schematron validation interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_SCHEMATRON_ENABLED
#endif
@@ -381,14 +381,14 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the module interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_MODULES_ENABLED
/**
* LIBXML_MODULE_EXTENSION:
*
* the string suffix used by dynamic modules (usually shared libraries)
*/
-#define LIBXML_MODULE_EXTENSION ".so"
+#define LIBXML_MODULE_EXTENSION ""
#endif
/**
@@ -396,7 +396,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Zlib support is compiled in
*/
-#if 1
+#if 0
#define LIBXML_ZLIB_ENABLED
#endif
@@ -410,9 +410,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
/**
* ATTRIBUTE_UNUSED:
diff --git a/chromium/third_party/libxml/linux/xml2-config b/chromium/third_party/libxml/linux/xml2-config
index 2efbfd72815..9ae21093d22 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.4
+ echo 2.9.9
exit 0
;;
@@ -78,7 +78,7 @@ while test $# -gt 0; do
;;
--modules)
- echo 1
+ echo 0
;;
--libs)
@@ -86,12 +86,12 @@ while test $# -gt 0; do
then
if [ "-L${libdir}" = "-L/usr/lib" -o "-L${libdir}" = "-L/usr/lib64" ]
then
- echo -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl
+ echo -lxml2 -licui18n -licuuc -licudata -lm
else
- echo -L${libdir} -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl
+ echo -L${libdir} -lxml2 -licui18n -licuuc -licudata -lm
fi
else
- echo -L${libdir} -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl
+ echo -L${libdir} -lxml2 -licui18n -licuuc -licudata -lm
fi
;;
diff --git a/chromium/third_party/libxml/mac/config.h b/chromium/third_party/libxml/mac/config.h
index d17857b8999..047e06617ae 100644
--- a/chromium/third_party/libxml/mac/config.h
+++ b/chromium/third_party/libxml/mac/config.h
@@ -4,9 +4,6 @@
/* Type cast for the gethostbyname() argument */
#define GETHOSTBYNAME_ARG_CAST /**/
-/* Define to 1 if you have the <ansidecl.h> header file. */
-/* #undef HAVE_ANSIDECL_H */
-
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
@@ -16,9 +13,6 @@
/* Whether struct sockaddr::__ss_family exists */
/* #undef HAVE_BROKEN_SS_FAMILY */
-/* Define to 1 if you have the `class' function. */
-/* #undef HAVE_CLASS */
-
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
@@ -29,7 +23,7 @@
#define HAVE_DLFCN_H 1
/* Have dlopen based dso */
-#define HAVE_DLOPEN /**/
+/* #undef HAVE_DLOPEN */
/* Define to 1 if you have the <dl.h> header file. */
/* #undef HAVE_DL_H */
@@ -40,24 +34,12 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
-/* Define to 1 if you have the `finite' function. */
-#define HAVE_FINITE 1
-
/* Define to 1 if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
-/* Define to 1 if you have the `fpclass' function. */
-/* #undef HAVE_FPCLASS */
-
/* Define to 1 if you have the `fprintf' function. */
#define HAVE_FPRINTF 1
-/* Define to 1 if you have the `fp_class' function. */
-/* #undef HAVE_FP_CLASS */
-
-/* Define to 1 if you have the <fp_class.h> header file. */
-/* #undef HAVE_FP_CLASS_H */
-
/* Define to 1 if you have the `ftime' function. */
#define HAVE_FTIME 1
@@ -67,9 +49,6 @@
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
-/* Define to 1 if you have the <ieeefp.h> header file. */
-/* #undef HAVE_IEEEFP_H */
-
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@@ -82,24 +61,15 @@
/* Define if isnan is there */
#define HAVE_ISNAN /**/
-/* Define to 1 if you have the `isnand' function. */
-/* #undef HAVE_ISNAND */
-
/* Define if history library is there (-lhistory) */
/* #undef HAVE_LIBHISTORY */
-/* Have compression library */
-/* #undef HAVE_LIBLZMA */
-
/* Define if pthread library is there (-lpthread) */
-#define HAVE_LIBPTHREAD /**/
+/* #undef HAVE_LIBPTHREAD */
/* Define if readline library is there (-lreadline) */
/* #undef HAVE_LIBREADLINE */
-/* Have compression library */
-#define HAVE_LIBZ 1
-
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
@@ -129,9 +99,6 @@
# undef /**/ HAVE_MMAP
#endif
-/* Define to 1 if you have the <nan.h> header file. */
-/* #undef HAVE_NAN_H */
-
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
@@ -148,7 +115,7 @@
#define HAVE_PRINTF 1
/* Define if <pthread.h> is there */
-#define HAVE_PTHREAD_H /**/
+/* #undef HAVE_PTHREAD_H */
/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1
@@ -195,12 +162,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
@@ -210,9 +171,6 @@
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
-/* Define to 1 if you have the `strndup' function. */
-#define HAVE_STRNDUP 1
-
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
@@ -264,10 +222,7 @@
#define HAVE_VSPRINTF 1
/* Define to 1 if you have the <zlib.h> header file. */
-#define HAVE_ZLIB_H 1
-
-/* Define to 1 if you have the `_stat' function. */
-/* #undef HAVE__STAT */
+/* #undef HAVE_ZLIB_H */
/* Whether __va_copy() is available */
/* #undef HAVE___VA_COPY */
@@ -312,7 +267,7 @@
#define VA_LIST_IS_ARRAY 1
/* Version number of package */
-#define VERSION "2.9.4"
+#define VERSION "2.9.9"
/* Determine what socket length (socklen_t) data type is */
#define XML_SOCKLEN_T socklen_t
@@ -322,9 +277,6 @@
#define below would cause a syntax error. */
/* #undef _UINT32_T */
-/* Using the Win32 Socket implementation */
-/* #undef _WINSOCKAPI_ */
-
/* ss_family is not defined here, use __ss_family instead */
/* #undef ss_family */
diff --git a/chromium/third_party/libxml/mac/include/libxml/xmlversion.h b/chromium/third_party/libxml/mac/include/libxml/xmlversion.h
index ebf1374c1b7..59cc485d619 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.4"
+#define LIBXML_DOTTED_VERSION "2.9.9"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
-#define LIBXML_VERSION 20904
+#define LIBXML_VERSION 20909
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
-#define LIBXML_VERSION_STRING "20904"
+#define LIBXML_VERSION_STRING "20909"
/**
* 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(20904);
+#define LIBXML_TEST_VERSION xmlCheckVersion(20909);
#ifndef VMS
#if 0
@@ -90,7 +90,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the thread support is configured in
*/
-#if 1
+#if 0
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED
@@ -147,7 +147,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the xmlPattern node selection interface is configured in
*/
-#if 1
+#if 0
#define LIBXML_PATTERN_ENABLED
#endif
@@ -192,7 +192,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the DTD validation support is configured in
*/
-#if 1
+#if 0
#define LIBXML_VALID_ENABLED
#endif
@@ -210,7 +210,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the deprecated APIs are compiled in for compatibility
*/
-#if 1
+#if 0
#define LIBXML_LEGACY_ENABLED
#endif
@@ -219,7 +219,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Canonicalization support is configured in
*/
-#if 1
+#if 0
#define LIBXML_C14N_ENABLED
#endif
@@ -228,7 +228,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Catalog support is configured in
*/
-#if 1
+#if 0
#define LIBXML_CATALOG_ENABLED
#endif
@@ -237,7 +237,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the SGML Docbook support is configured in
*/
-#if 1
+#if 0
#define LIBXML_DOCB_ENABLED
#endif
@@ -255,7 +255,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether XPointer is configured in
*/
-#if 1
+#if 0
#define LIBXML_XPTR_ENABLED
#endif
@@ -264,7 +264,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether XInclude is configured in
*/
-#if 1
+#if 0
#define LIBXML_XINCLUDE_ENABLED
#endif
@@ -291,7 +291,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether ISO-8859-* support is made available in case iconv is not
*/
-#if 1
+#if 0
#define LIBXML_ISO8859X_ENABLED
#endif
@@ -300,7 +300,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether Debugging module is configured in
*/
-#if 1
+#if 0
#define LIBXML_DEBUG_ENABLED
#endif
@@ -327,7 +327,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Unicode related interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_UNICODE_ENABLED
#endif
@@ -336,7 +336,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the regular expressions interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_REGEXP_ENABLED
#endif
@@ -345,7 +345,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the automata interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_AUTOMATA_ENABLED
#endif
@@ -354,7 +354,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the formal expressions interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_EXPR_ENABLED
#endif
@@ -363,7 +363,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Schemas validation interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_SCHEMAS_ENABLED
#endif
@@ -372,7 +372,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Schematron validation interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_SCHEMATRON_ENABLED
#endif
@@ -381,14 +381,14 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the module interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_MODULES_ENABLED
/**
* LIBXML_MODULE_EXTENSION:
*
* the string suffix used by dynamic modules (usually shared libraries)
*/
-#define LIBXML_MODULE_EXTENSION ".so"
+#define LIBXML_MODULE_EXTENSION ""
#endif
/**
@@ -396,7 +396,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Zlib support is compiled in
*/
-#if 1
+#if 0
#define LIBXML_ZLIB_ENABLED
#endif
@@ -410,9 +410,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
/**
* ATTRIBUTE_UNUSED:
diff --git a/chromium/third_party/libxml/src/ChangeLog b/chromium/third_party/libxml/src/ChangeLog
index ef6cb8e427f..896fbbb6538 100644
--- a/chromium/third_party/libxml/src/ChangeLog
+++ b/chromium/third_party/libxml/src/ChangeLog
@@ -1929,7 +1929,7 @@ Mon Jun 12 12:54:25 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
* tree.c: Fixed xmlGetNodePath() to generate the node test "*"
for elements in the default namespace, rather than generating
- an unprefixed named node test and loosing the namespace
+ an unprefixed named node test and losing the namespace
information.
Fri Jun 9 21:45:02 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
@@ -2305,7 +2305,7 @@ Mon Mar 6 14:21:08 CET 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
* tree.c: Simplified usage of the internal xmlNsMap. Added a
"strict" lookup for namespaces based on a prefix. Fixed a
namespace processing issue in the clone-node function, which
- occured if a @ctxt argument was given.
+ occurred if a @ctxt argument was given.
Fri Mar 3 17:44:10 CET 2006 Rob Richards <rrichards@ctindustries.net>
@@ -3951,7 +3951,7 @@ Thu Jun 30 15:01:52 CEST 2005 Daniel Veillard <daniel@veillard.com>
* README: updated
* debugXML.c: fix a bug raised by bill on IRC
* relaxng.c: fix a leak in weird circumstances
- * runsuite.c Makefile.am: standalone test tool agaisnt
+ * runsuite.c Makefile.am: standalone test tool against
the regression suites, work in progress
Tue Jun 28 08:30:26 CEST 2005 Daniel Veillard <daniel@veillard.com>
@@ -4356,7 +4356,7 @@ Fri Apr 8 21:58:04 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c: Added substitution group constraints; changed
the build of the pre-computed substitution groups. Channeled
errors during xsi assembling of schemas to the validation
- context. Fixed a big memory leak, which occured when using
+ context. Fixed a big memory leak, which occurred when using
IDCs: the precomputed value of attributes was not freed if
the attribute did not resolve to an IDC field (discovered
with the help of Randy J. Ray's schema, posted to the
@@ -4551,7 +4551,7 @@ Mon Mar 21 22:58:37 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
Mon Mar 21 21:09:07 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
- * xmlschemas.c: Fixed a segfault, which occured during bubbling
+ * xmlschemas.c: Fixed a segfault, which occurred during bubbling
of IDC nodes (bug #170779 and #170778, reported by GUY Fabrice):
a variable was missed to be reset in a loop. Deactivated bubbling,
if not referenced by a keyref.
@@ -11220,7 +11220,7 @@ Fri Mar 7 19:29:40 CET 2003 Daniel Veillard <daniel@veillard.com>
* test/xsdtest/xsdtest.xml uri.c: after and exchange with James
Clark it appeared I had bug in URI parsing code ...
* relaxng.c include/libxml/relaxng.h: completely revamped error
- reporting to not loose message from optional parts.
+ reporting to not lose message from optional parts.
* xmllint.c: added timing for RNG validation steps
* result/relaxng/*: updated the result, all error messages changed
@@ -13182,7 +13182,7 @@ Thu Aug 1 12:17:30 CEST 2002 Daniel Veillard <daniel@veillard.com>
xmlNewCharEncodingHandler as requested in #89415
* python/generator.py python/setup.py.in: applied cleanup
patches from Marc-Andre Lemburg
- * tree.c: fixing bug #89332 on a specific case of loosing
+ * tree.c: fixing bug #89332 on a specific case of losing
the XML-1.0 namespace on xml:xxx attributes
Wed Jul 31 23:27:42 2002 Aleksey Sanin <aleksey@aleksey.com>
@@ -15356,7 +15356,7 @@ Sat Oct 6 15:27:12 CEST 2001 Daniel Veillard <daniel@veillard.com>
Sat Oct 6 15:07:14 CEST 2001 Daniel Veillard <daniel@veillard.com>
- * xpath.c: fixing #61673 part I, do not loose doc information
+ * xpath.c: fixing #61673 part I, do not lose doc information
when copying result value trees.
Sat Oct 6 11:58:58 CEST 2001 Daniel Veillard <daniel@veillard.com>
@@ -15970,7 +15970,7 @@ Tue Jul 10 17:47:09 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
Mon Jul 9 22:06:53 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* valid.c: fixed "Internal: MIXED struct bad" when #CDATA elements
- validation occured on content with element child
+ validation occurred on content with element child
Mon Jul 9 17:59:08 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
diff --git a/chromium/third_party/libxml/src/HTMLparser.c b/chromium/third_party/libxml/src/HTMLparser.c
index d1395fa507c..9e60e27ec1c 100644
--- a/chromium/third_party/libxml/src/HTMLparser.c
+++ b/chromium/third_party/libxml/src/HTMLparser.c
@@ -26,7 +26,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
@@ -1084,7 +1084,7 @@ static const char * const htmlStartClose[] = {
"menu", "p", "head", "ul", NULL,
"p", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", FONTSTYLE, NULL,
"div", "p", "head", NULL,
-"noscript", "p", NULL,
+"noscript", "script", NULL,
"center", "font", "b", "i", "p", "head", NULL,
"a", "a", "head", NULL,
"caption", "p", NULL,
@@ -2528,8 +2528,12 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) {
}
}
- if (ctxt->input->base > ctxt->input->cur - len)
- return(NULL);
+ if (ctxt->input->cur - ctxt->input->base < len) {
+ /* Sanity check */
+ htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
+ "unexpected change of input buffer", NULL, NULL);
+ return (NULL);
+ }
return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
}
@@ -3632,12 +3636,12 @@ htmlCheckEncodingDirect(htmlParserCtxtPtr ctxt, const xmlChar *encoding) {
processed = ctxt->input->cur - ctxt->input->base;
xmlBufShrink(ctxt->input->buf->buffer, processed);
nbchars = xmlCharEncInput(ctxt->input->buf, 1);
+ xmlBufResetInput(ctxt->input->buf->buffer, ctxt->input);
if (nbchars < 0) {
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
"htmlCheckEncoding: encoder error\n",
NULL, NULL);
}
- xmlBufResetInput(ctxt->input->buf->buffer, ctxt->input);
}
}
}
@@ -4444,7 +4448,7 @@ static void
htmlParseElementInternal(htmlParserCtxtPtr ctxt) {
const xmlChar *name;
const htmlElemDesc * info;
- htmlParserNodeInfo node_info = { 0, };
+ htmlParserNodeInfo node_info = { NULL, 0, 0, 0, 0 };
int failed;
if ((ctxt == NULL) || (ctxt->input == NULL)) {
@@ -4941,6 +4945,7 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
ctxt->wellFormed = 1;
ctxt->replaceEntities = 0;
ctxt->linenumbers = xmlLineNumbersDefaultValue;
+ ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
ctxt->html = 1;
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0;
ctxt->vctxt.userData = ctxt;
@@ -6273,7 +6278,8 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
*/
htmlDocPtr
-htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void *userData) {
+htmlSAXParseDoc(const xmlChar *cur, const char *encoding,
+ htmlSAXHandlerPtr sax, void *userData) {
htmlDocPtr ret;
htmlParserCtxtPtr ctxt;
@@ -6312,7 +6318,7 @@ htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void
*/
htmlDocPtr
-htmlParseDoc(xmlChar *cur, const char *encoding) {
+htmlParseDoc(const xmlChar *cur, const char *encoding) {
return(htmlSAXParseDoc(cur, encoding, NULL, NULL));
}
@@ -6668,7 +6674,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) {
- xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree);
+ xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
ctxt->attsDefault = NULL;
}
if (ctxt->attsSpecial != NULL) {
diff --git a/chromium/third_party/libxml/src/HTMLtree.c b/chromium/third_party/libxml/src/HTMLtree.c
index 2fd0c9c5671..21cfcfe591e 100644
--- a/chromium/third_party/libxml/src/HTMLtree.c
+++ b/chromium/third_party/libxml/src/HTMLtree.c
@@ -502,17 +502,17 @@ htmlNodeDumpFileFormat(FILE *out, xmlDocPtr doc,
if (handler == NULL)
htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
}
+ } else {
+ /*
+ * Fallback to HTML or ASCII when the encoding is unspecified
+ */
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("HTML");
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("ascii");
}
/*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
- /*
* save the content to a temp buffer.
*/
buf = xmlOutputBufferCreateFile(out, handler);
@@ -570,33 +570,22 @@ htmlDocDumpMemoryFormat(xmlDocPtr cur, xmlChar**mem, int *size, int format) {
xmlCharEncoding enc;
enc = xmlParseCharEncoding(encoding);
- if (enc != cur->charset) {
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * Not supported yet
- */
- *mem = NULL;
- *size = 0;
- return;
- }
-
+ if (enc != XML_CHAR_ENCODING_UTF8) {
handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL)
htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
- } else {
- handler = xmlFindCharEncodingHandler(encoding);
}
+ } else {
+ /*
+ * Fallback to HTML or ASCII when the encoding is unspecified
+ */
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("HTML");
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("ascii");
}
- /*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
buf = xmlAllocOutputBufferInternal(handler);
if (buf == NULL) {
*mem = NULL;
@@ -1101,30 +1090,21 @@ htmlDocDump(FILE *f, xmlDocPtr cur) {
xmlCharEncoding enc;
enc = xmlParseCharEncoding(encoding);
- if (enc != cur->charset) {
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * Not supported yet
- */
- return(-1);
- }
-
+ if (enc != XML_CHAR_ENCODING_UTF8) {
handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL)
htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
- } else {
- handler = xmlFindCharEncodingHandler(encoding);
}
+ } else {
+ /*
+ * Fallback to HTML or ASCII when the encoding is unspecified
+ */
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("HTML");
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("ascii");
}
- /*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
buf = xmlOutputBufferCreateFile(f, handler);
if (buf == NULL) return(-1);
htmlDocContentDumpOutput(buf, cur, NULL);
@@ -1160,29 +1140,22 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) {
xmlCharEncoding enc;
enc = xmlParseCharEncoding(encoding);
- if (enc != cur->charset) {
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * Not supported yet
- */
- return(-1);
- }
-
+ if (enc != XML_CHAR_ENCODING_UTF8) {
handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL)
htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
}
+ } else {
+ /*
+ * Fallback to HTML or ASCII when the encoding is unspecified
+ */
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("HTML");
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("ascii");
}
/*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
-
- /*
* save the content to a temp buffer.
*/
buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression);
@@ -1221,14 +1194,7 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
xmlCharEncoding enc;
enc = xmlParseCharEncoding(encoding);
- if (enc != cur->charset) {
- if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- /*
- * Not supported yet
- */
- return(-1);
- }
-
+ if (enc != XML_CHAR_ENCODING_UTF8) {
handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL)
htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
@@ -1236,15 +1202,15 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
htmlSetMetaEncoding(cur, (const xmlChar *) encoding);
} else {
htmlSetMetaEncoding(cur, (const xmlChar *) "UTF-8");
- }
- /*
- * Fallback to HTML or ASCII when the encoding is unspecified
- */
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("HTML");
- if (handler == NULL)
- handler = xmlFindCharEncodingHandler("ascii");
+ /*
+ * Fallback to HTML or ASCII when the encoding is unspecified
+ */
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("HTML");
+ if (handler == NULL)
+ handler = xmlFindCharEncodingHandler("ascii");
+ }
/*
* save the content to a temp buffer.
diff --git a/chromium/third_party/libxml/src/Makefile.am b/chromium/third_party/libxml/src/Makefile.am
index 9f988b069bf..174b98436ce 100644
--- a/chromium/third_party/libxml/src/Makefile.am
+++ b/chromium/third_party/libxml/src/Makefile.am
@@ -8,12 +8,12 @@ DIST_SUBDIRS = include . doc example python xstc
AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include
-AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)
+AM_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)
-noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
- testThreads testC14N testAutomata testRegexp \
- testReader testapi testModule runtest runsuite testchar \
- testdict runxmlconf testrecurse testlimits
+check_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
+ testThreads testC14N testAutomata testRegexp \
+ testReader testapi testModule runtest runsuite testchar \
+ testdict runxmlconf testrecurse testlimits
bin_PROGRAMS = xmllint xmlcatalog
@@ -126,11 +126,7 @@ testC14N_LDFLAGS =
testC14N_DEPENDENCIES = $(DEPS)
testC14N_LDADD= $(LDADDS)
-if THREADS_W32
-testThreads_SOURCES = testThreadsWin32.c
-else
testThreads_SOURCES = testThreads.c
-endif
testThreads_LDFLAGS =
testThreads_DEPENDENCIES = $(DEPS)
testThreads_LDADD= $(BASE_THREAD_LIBS) $(LDADDS)
@@ -202,10 +198,16 @@ runxmlconf_LDADD= $(LDADDS)
#testOOM_DEPENDENCIES = $(DEPS)
#testOOM_LDADD= $(LDADDS)
-runtests:
+runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
+ testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
[ -d test ] || $(LN_S) $(srcdir)/test .
[ -d result ] || $(LN_S) $(srcdir)/result .
- $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
+ $(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)
@@ -224,12 +226,12 @@ 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) tests ; fi)
- @(cd doc/examples ; $(MAKE) tests)
+ $(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"
- -@($(CHECKER) $(top_builddir)/testapi -q)
+ -@(ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) $(top_builddir)/testapi -q)
HTMLtests : testHTML$(EXEEXT)
@(echo > .memdump)
@@ -247,7 +249,7 @@ HTMLtests : testHTML$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name result2.$$name error.$$name ; \
fi ; fi ; done)
@@ -268,7 +270,7 @@ HTMLPushtests : testHTML$(EXEEXT)
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 ; \
+ 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"
@@ -282,7 +284,7 @@ HTMLPushtests : testHTML$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name.sax ; \
fi ; fi ; done)
@echo "## Push HTML SAX regression tests"
@@ -296,7 +298,7 @@ HTMLPushtests : testHTML$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name.sax ; \
fi ; fi ; done)
@@ -317,7 +319,7 @@ XMLtests : xmllint$(EXEEXT)
$(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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name result2.$$name ; \
fi ; fi ; done)
@echo "## XML regression tests on memory"
@@ -334,7 +336,7 @@ XMLtests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
diff result.$$name result2.$$name ; \
rm result.$$name result2.$$name ; \
fi ; fi ; done)
@@ -356,7 +358,7 @@ XMLPushtests: xmllint$(EXEEXT)
$(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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name result2.$$name ; \
fi ; fi ; done)
@@ -377,7 +379,7 @@ NStests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name error.$$name ; \
fi ; fi ; done)
@@ -398,7 +400,7 @@ IDtests : xmllint$(EXEEXT) testXPath$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name error.$$name ; \
fi ; fi ; done)
@@ -419,7 +421,25 @@ Errtests : xmllint$(EXEEXT)
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 ; \
+ 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"
@@ -436,7 +456,7 @@ Errtests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm error.$$name ; \
fi ; fi ; done)
@@ -459,7 +479,7 @@ XMLenttests : xmllint$(EXEEXT)
$(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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name result2.$$name ; \
fi ; fi ; done)
@@ -477,7 +497,7 @@ URItests : testURI$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
-@(for i in $(srcdir)/test/URI/*.uri ; do \
@@ -491,7 +511,7 @@ URItests : testURI$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@@ -505,13 +525,13 @@ XPathtests : testXPath$(EXEEXT)
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 ; \
+ $(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 2>&1 > result.$$name ; \
+ 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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done ; \
for i in $(srcdir)/test/XPath/docs/* ; do \
@@ -526,10 +546,10 @@ XPathtests : testXPath$(EXEEXT)
$(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 2>&1 > result.$$name ; \
+ 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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done ; fi ; done)
@@ -547,13 +567,13 @@ XPtrtests : testXPath$(EXEEXT)
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 ; \
+ $(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 2>&1 > result.$$name ; \
+ 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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done ; fi ; done)
@@ -572,7 +592,7 @@ XIncludetests : xmllint$(EXEEXT)
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 ; \
+ 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 \
@@ -587,7 +607,7 @@ XIncludetests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name error.$$name ; \
fi ; fi ; done)
@(echo > .memdump)
@@ -604,7 +624,7 @@ XIncludetests : xmllint$(EXEEXT)
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 ; \
+ 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 \
@@ -619,7 +639,7 @@ XIncludetests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name error.$$name ; \
fi ; fi ; done)
@@ -640,7 +660,7 @@ Scripttests : xmllint$(EXEEXT)
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/scripts/$$name result.$$name ; \
diff $(srcdir)/result/scripts/$$name.err result.$$name.err` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name result.$$name.err ; \
fi ; fi ; done)
@@ -659,7 +679,7 @@ Catatests : xmlcatalog$(EXEEXT)
log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/catalogs/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
-@(for i in $(srcdir)/test/catalogs/*.script ; do \
@@ -674,7 +694,7 @@ Catatests : xmlcatalog$(EXEEXT)
log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/catalogs/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@echo "## Add and del operations on XML Catalogs"
@@ -738,7 +758,7 @@ Readertests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@echo "## Reader on memory regression tests"
@@ -753,7 +773,7 @@ Readertests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@(echo > .memdump)
@@ -769,7 +789,7 @@ Readertests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@echo "## Reader entities substitution regression tests"
@@ -784,7 +804,7 @@ Readertests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@@ -802,7 +822,7 @@ SAXtests : testSAX$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@echo "## SAX2 callbacks regression tests"
@@ -817,7 +837,22 @@ SAXtests : testSAX$(EXEEXT)
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 ; \
+ 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)
@@ -829,7 +864,7 @@ Validtests : xmllint$(EXEEXT)
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 ; \
+ 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 \
@@ -843,7 +878,7 @@ Validtests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@echo "## General documents valid regression tests"
@@ -859,7 +894,7 @@ Validtests : xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name error.$$name ; \
fi ; fi ; done)
@@ -877,7 +912,7 @@ Regexptests: testRegexp$(EXEEXT)
log=`$(CHECKER) $(top_builddir)/testRegexp -i $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/regexp/$$name result.$$name` ; \
- if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@echo "## Formal expresssions regression tests"
@@ -892,7 +927,7 @@ Regexptests: testRegexp$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@@ -910,7 +945,7 @@ Automatatests: testAutomata$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@@ -961,7 +996,7 @@ C14Ntests : testC14N$(EXEEXT)
cmdline="$$cmdline '`cat $(srcdir)/test/c14n/$$m/$$name.ns`'"; \
fi; \
fi; \
- $$cmdline > $(srcdir)/test/c14n/test.tmp; \
+ $$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 \
@@ -1002,7 +1037,7 @@ Schemastests: testSchemas$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo "$$name"_"$$sno"_"$$xno" result ; echo "$$log" ; fi ; \
rm res.$$name err.$$name ; \
fi ; fi ;\
done; done)
@@ -1027,7 +1062,7 @@ Relaxtests: xmllint$(EXEEXT)
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 ; \
+ 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 \
@@ -1049,7 +1084,7 @@ Relaxtests: xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo "$$log" ; fi ; \
rm res.$$name err.$$name ; \
fi ; fi ; \
done; done)
@@ -1075,7 +1110,7 @@ Relaxtests: xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo "$$log" ; fi ; \
rm res.$$name err.$$name ; \
fi ; fi ; \
done; done)
@@ -1104,7 +1139,7 @@ Schematrontests: xmllint$(EXEEXT)
diff $(srcdir)/result/schematron/"$$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 ; \
+ if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo "$$log" ; fi ; \
rm res.$$name err.$$name ; \
fi ; fi ; \
done; done)
@@ -1153,7 +1188,7 @@ Patterntests: xmllint$(EXEEXT)
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 ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
rm result.$$name ; \
fi ; fi ; done ;)
@@ -1214,9 +1249,10 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \
libxml2-config.cmake.in autogen.sh \
trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
triop.h triodef.h libxml.h elfgcchack.h xzlib.h buf.h \
- enc.h save.h testThreadsWin32.c genUnicode.py TODO_SCHEMAS \
+ enc.h save.h genUnicode.py TODO_SCHEMAS \
dbgen.pl dbgenattr.pl regressions.py regressions.xml \
README.tests Makefile.tests libxml2.syms timsort.h \
+ README.zOS \
$(CVS_EXTRA_DIST)
diff --git a/chromium/third_party/libxml/src/NEWS b/chromium/third_party/libxml/src/NEWS
index d248c6936f5..5504bed8864 100644
--- a/chromium/third_party/libxml/src/NEWS
+++ b/chromium/third_party/libxml/src/NEWS
@@ -8,8 +8,451 @@ The change log at
ChangeLog.html
describes the recents commits
to the GIT at
-http://git.gnome.org/browse/libxml2/
+https://gitlab.gnome.org/GNOME/libxml2
code base.Here is the list of public releases:
+v2.9.9: Jan 03 2019:
+ - Security:
+ CVE-2018-9251 CVE-2018-14567 Fix infinite loop in LZMA decompression (Nick Wellnhofer),
+ CVE-2018-14404 Fix nullptr deref with XPath logic ops (Nick Wellnhofer),
+
+ - Documentation:
+ reader: Fix documentation comment (Mohammed Sadiq)
+
+ - Portability:
+ Fix MSVC build with lzma (Nick Wellnhofer),
+ Variables need 'extern' in static lib on Cygwin (Michael Haubenwallner),
+ Really declare dllexport/dllimport for Cygwin (Michael Haubenwallner),
+ Merge branch 'patch-2' into 'master' (Nick Wellnhofer),
+ Change dir to $THEDIR after ACLOCAL_PATH check autoreconf creates aclocal.m4 in $srcdir (Vitaly Buka),
+ Improve error message if pkg.m4 couldn't be found (Nick Wellnhofer),
+ NaN and Inf fixes for pre-C99 compilers (Nick Wellnhofer)
+
+ - Bug Fixes:
+ Revert "Support xmlTextReaderNextSibling w/o preparsed doc" (Nick Wellnhofer),
+ Fix building relative URIs (Thomas Holder),
+ Problem with data in interleave in RelaxNG validation (Nikolai Weibull),
+ Fix memory leak in xmlSwitchInputEncodingInt error path (Nick Wellnhofer),
+ Set doc on element obtained from freeElems (Nick Wellnhofer),
+ Fix HTML serialization with UTF-8 encoding (Nick Wellnhofer),
+ Use actual doc in xmlTextReaderRead*Xml (Nick Wellnhofer),
+ Unlink node before freeing it in xmlSAX2StartElement (Nick Wellnhofer),
+ Check return value of nodePush in xmlSAX2StartElement (Nick Wellnhofer),
+ Free input buffer in xmlHaltParser (Nick Wellnhofer),
+ Reset HTML parser input pointers on encoding failure (Nick Wellnhofer),
+ Don't run icu_parse_test if EUC-JP is unsupported (Nick Wellnhofer),
+ Fix xmlSchemaValidCtxtPtr reuse memory leak (Greg Hildstrom),
+ Fix xmlTextReaderNext with preparsed document (Felix Bünemann),
+ Remove stray character from comment (Nick Wellnhofer),
+ Remove a misleading line from xmlCharEncOutput (Andrey Bienkowski),
+ HTML noscript should not close p (Daniel Veillard),
+ Don't change context node in xmlXPathRoot (Nick Wellnhofer),
+ Stop using XPATH_OP_RESET (Nick Wellnhofer),
+ Revert "Change calls to xmlCharEncInput to set flush false" (Nick Wellnhofer)
+
+ - Improvements:
+ Fix "Problem with data in interleave in RelaxNG validation" (Nikolai Weibull),
+ cleanup: remove some unreachable code (Thomas Holder),
+ add --relative to testURI (Thomas Holder),
+ Remove redefined starts and defines inside include elements (Nikolai Weibull),
+ Allow choice within choice in nameClass in RELAX NG (Nikolai Weibull),
+ Look inside divs for starts and defines inside include (Nikolai Weibull),
+ Add compile and libxml2-config.cmake to .gitignore (Nikolai Weibull),
+ Stop using doc->charset outside parser code (Nick Wellnhofer),
+ Add newlines to 'xmllint --xpath' output (Nick Wellnhofer),
+ Don't include SAX.h from globals.h (Nick Wellnhofer),
+ Support xmlTextReaderNextSibling w/o preparsed doc (Felix Bünemann),
+ Don't instruct user to run make when autogen.sh failed (林博仁(Buo-ren Lin)),
+ Run Travis ASan tests with "sudo: required" (Nick Wellnhofer),
+ Improve restoring of context size and position (Nick Wellnhofer),
+ Simplify and harden nodeset filtering (Nick Wellnhofer),
+ Avoid unnecessary backups of the context node (Nick Wellnhofer),
+ Fix inconsistency in xmlXPathIsInf (Nick Wellnhofer)
+
+ - Cleanups:
+
+
+
+v2.9.8: Mar 05 2018:
+ - Portability:
+ python: remove single use of _PyVerify_fd (Patrick Welche),
+ Build more test executables on Windows/MSVC (Nick Wellnhofer),
+ Stop including ansidecl.h (Nick Wellnhofer),
+ Fix libz and liblzma detection (Nick Wellnhofer),
+ Revert "Compile testapi with -Wno-unused-function" (Nick Wellnhofer)
+
+ - Bug Fixes:
+ Fix xmlParserEntityCheck (Nick Wellnhofer),
+ Halt parser in case of encoding error (Nick Wellnhofer),
+ Clear entity content in case of errors (Nick Wellnhofer),
+ Change calls to xmlCharEncInput to set flush false when not final call. Having flush incorrectly set to true causes errors for ICU. (Joel Hockey),
+ Fix buffer over-read in xmlParseNCNameComplex (Nick Wellnhofer),
+ Fix ICU library filenames on Windows/MSVC (Nick Wellnhofer),
+ Fix xmlXPathIsNaN broken by recent commit (Nick Wellnhofer),
+ Fix -Wenum-compare warnings (Nick Wellnhofer),
+ Fix callback signature in testapi.c (Nick Wellnhofer),
+ Fix unused parameter warning without ICU (Nick Wellnhofer),
+ Fix IO callback signatures (Nick Wellnhofer),
+ Fix misc callback signatures (Nick Wellnhofer),
+ Fix list callback signatures (Nick Wellnhofer),
+ Fix hash callback signatures (Nick Wellnhofer),
+ Refactor name and type signature for xmlNop (Vlad Tsyrklevich),
+ Fixed ICU to set flush correctly and provide pivot buffer. (Joel Hockey),
+ Skip EBCDIC tests if EBCDIC isn't supported (Nick Wellnhofer)
+
+ - Improvements:
+ Disable pointer-overflow UBSan checks under Travis (Nick Wellnhofer),
+ Improve handling of context input_id (Daniel Veillard),
+ Add resource file to Windows DLL (ccpaging),
+ Run Travis tests with -Werror (Nick Wellnhofer),
+ Build with "-Wall -Wextra" (Nick Wellnhofer),
+ Fix -Wtautological-pointer-compare warnings (Nick Wellnhofer),
+ Remove unused AC_CHECKs (Nick Wellnhofer),
+ Update information about contributing (Nick Wellnhofer),
+ Fix -Wmisleading-indentation warnings (Nick Wellnhofer),
+ Don't touch CFLAGS in configure.ac (Nick Wellnhofer),
+ Ignore function pointer cast warnings (Nick Wellnhofer),
+ Simplify XPath NaN, inf and -0 handling (Nick Wellnhofer),
+ Introduce xmlPosixStrdup and update xmlMemStrdup (Nick Wellnhofer),
+ Add test for ICU flush and pivot buffer (Nick Wellnhofer),
+ Compile testapi with -Wno-unused-function (Nick Wellnhofer)
+
+
+
+2.9.7: Nov 02 2017:
+ - Documentation:
+ xmlcatalog: refresh man page wrt. quering system catalog easily (Jan Pokorný)
+
+ - Portability:
+ Fix deprecated Travis compiler flag (Nick Wellnhofer),
+ Add declaration for DllMain (J. Peter Mugaas),
+ Fix preprocessor conditional in threads.h (J. Peter Mugaas),
+ Fix pointer comparison warnings on 64-bit Windows (J. Peter Mugaas),
+ Fix macro redefinition warning (J. Peter Mugaas),
+ Default to native threads on MinGW-w64 (Nick Wellnhofer),
+ Simplify Windows IO functions (Nick Wellnhofer),
+ Fix runtest on Windows (Nick Wellnhofer),
+ socklen_t is always int on Windows (Nick Wellnhofer),
+ Don't redefine socket error codes on Windows (Nick Wellnhofer),
+ Fix pointer/int cast warnings on 64-bit Windows (Nick Wellnhofer),
+ Fix Windows compiler warnings in xmlCanonicPath (Nick Wellnhofer)
+
+ - Bug Fixes:
+ xmlcatalog: restore ability to query system catalog easily (Jan Pokorný),
+ Fix comparison of nodesets to strings (Nick Wellnhofer)
+
+ - Improvements:
+ Add Makefile rules to rebuild HTML man pages (Nick Wellnhofer),
+ Fix mixed decls and code in timsort.h (Nick Wellnhofer),
+ Rework handling of return values in thread tests (Nick Wellnhofer),
+ Fix unused variable warnings in testrecurse (Nick Wellnhofer),
+ Fix -Wimplicit-fallthrough warnings (J. Peter Mugaas),
+ Upgrade timsort.h to latest revision (Nick Wellnhofer),
+ Increase warning level to /W3 under MSVC (Nick Wellnhofer),
+ Fix a couple of warnings in dict.c and threads.c (Nick Wellnhofer),
+ Update .gitignore for Windows (Nick Wellnhofer),
+ Fix unused variable warnings in nanohttp.c (Nick Wellnhofer),
+ Fix the Windows header mess (Nick Wellnhofer),
+ Don't include winsock2.h in xmllint.c (Nick Wellnhofer),
+ Remove generated file python/setup.py from version control (Nick Wellnhofer),
+ Use __linux__ macro in generated code (Nick Wellnhofer)
+
+
+
+v2.9.6: Oct 06 2017:
+ - Portability:
+ Change preprocessor OS tests to __linux__ (Nick Wellnhofer)
+
+ - Bug Fixes:
+ Fix XPath stack frame logic (Nick Wellnhofer),
+ Report undefined XPath variable error message (Nick Wellnhofer),
+ Fix regression with librsvg (Nick Wellnhofer),
+ Handle more invalid entity values in recovery mode (Nick Wellnhofer),
+ Fix structured validation errors (Nick Wellnhofer),
+ Fix memory leak in LZMA decompressor (Nick Wellnhofer),
+ Set memory limit for LZMA decompression (Nick Wellnhofer),
+ Handle illegal entity values in recovery mode (Nick Wellnhofer),
+ Fix debug dump of streaming XPath expressions (Nick Wellnhofer),
+ Fix memory leak in nanoftp (Nick Wellnhofer),
+ Fix memory leaks in SAX1 parser (Nick Wellnhofer)
+
+
+
+v2.9.5: Sep 04 2017:
+ - Security:
+ Detect infinite recursion in parameter entities (Nick Wellnhofer),
+ Fix handling of parameter-entity references (Nick Wellnhofer),
+ Disallow namespace nodes in XPointer ranges (Nick Wellnhofer),
+ Fix XPointer paths beginning with range-to (Nick Wellnhofer)
+
+ - Documentation:
+ Documentation fixes (Nick Wellnhofer),
+ Spelling and grammar fixes (Nick Wellnhofer)
+
+ - Portability:
+ Adding README.zOS to list of extra files for the release (Daniel Veillard),
+ Description of work needed to compile on zOS (Stéphane Michaut),
+ Porting libxml2 on zOS encoding of code (Stéphane Michaut),
+ small changes for OS/400 (Patrick Monnerat),
+ relaxng.c, xmlschemas.c: Fix build on pre-C99 compilers (Chun-wei Fan)
+
+ - Bug Fixes:
+ Problem resolving relative URIs (Daniel Veillard),
+ Fix unwanted warnings when switching encodings (Nick Wellnhofer),
+ Fix signature of xmlSchemaAugmentImportedIDC (Daniel Veillard),
+ Heap-buffer-overflow read of size 1 in xmlFAParsePosCharGroup (David Kilzer),
+ Fix NULL pointer deref in xmlFAParseCharClassEsc (Nick Wellnhofer),
+ Fix infinite loops with push parser in recovery mode (Nick Wellnhofer),
+ Send xmllint usage error to stderr (Nick Wellnhofer),
+ Fix NULL deref in xmlParseExternalEntityPrivate (Nick Wellnhofer),
+ Make sure not to call IS_BLANK_CH when parsing the DTD (Nick Wellnhofer),
+ Fix xmlHaltParser (Nick Wellnhofer),
+ Fix pathological performance when outputting charrefs (Nick Wellnhofer),
+ Fix invalid-source-encoding warnings in testWriter.c (Nick Wellnhofer),
+ Fix duplicate SAX callbacks for entity content (David Kilzer),
+ Treat URIs with scheme as absolute in C14N (Nick Wellnhofer),
+ Fix copy-paste errors in error messages (Nick Wellnhofer),
+ Fix sanity check in htmlParseNameComplex (Nick Wellnhofer),
+ Fix potential infinite loop in xmlStringLenDecodeEntities (Nick Wellnhofer),
+ Reset parser input pointers on encoding failure (Nick Wellnhofer),
+ Fix memory leak in xmlParseEntityDecl error path (Nick Wellnhofer),
+ Fix xmlBuildRelativeURI for URIs starting with './' (Nick Wellnhofer),
+ Fix type confusion in xmlValidateOneNamespace (Nick Wellnhofer),
+ Fix memory leak in xmlStringLenGetNodeList (Nick Wellnhofer),
+ Fix NULL pointer deref in xmlDumpElementContent (Daniel Veillard),
+ Fix memory leak in xmlBufAttrSerializeTxtContent (Nick Wellnhofer),
+ Stop parser on unsupported encodings (Nick Wellnhofer),
+ Check for integer overflow in memory debug code (Nick Wellnhofer),
+ Fix buffer size checks in xmlSnprintfElementContent (Nick Wellnhofer),
+ Avoid reparsing in xmlParseStartTag2 (Nick Wellnhofer),
+ Fix undefined behavior in xmlRegExecPushStringInternal (Nick Wellnhofer),
+ Check XPath exponents for overflow (Nick Wellnhofer),
+ Check for overflow in xmlXPathIsPositionalPredicate (Nick Wellnhofer),
+ Fix spurious error message (Nick Wellnhofer),
+ Fix memory leak in xmlCanonicPath (Nick Wellnhofer),
+ Fix memory leak in xmlXPathCompareNodeSetValue (Nick Wellnhofer),
+ Fix memory leak in pattern error path (Nick Wellnhofer),
+ Fix memory leak in parser error path (Nick Wellnhofer),
+ Fix memory leaks in XPointer error paths (Nick Wellnhofer),
+ Fix memory leak in xmlXPathNodeSetMergeAndClear (Nick Wellnhofer),
+ Fix memory leak in XPath filter optimizations (Nick Wellnhofer),
+ Fix memory leaks in XPath error paths (Nick Wellnhofer),
+ Do not leak the new CData node if adding fails (David Tardon),
+ Prevent unwanted external entity reference (Neel Mehta),
+ Increase buffer space for port in HTTP redirect support (Daniel Veillard),
+ Fix more NULL pointer derefs in xpointer.c (Nick Wellnhofer),
+ Avoid function/data pointer conversion in xpath.c (Nick Wellnhofer),
+ Fix format string warnings (Nick Wellnhofer),
+ Disallow namespace nodes in XPointer points (Nick Wellnhofer),
+ Fix comparison with root node in xmlXPathCmpNodes (Nick Wellnhofer),
+ Fix attribute decoding during XML schema validation (Alex Henrie),
+ Fix NULL pointer deref in XPointer range-to (Nick Wellnhofer)
+
+ - Improvements:
+ Updating the spec file to reflect Fedora 24 (Daniel Veillard),
+ Add const in five places to move 1 KiB to .rdata (Bruce Dawson),
+ Fix missing part of comment for function xmlXPathEvalExpression() (Daniel Veillard),
+ Get rid of "blanks wrapper" for parameter entities (Nick Wellnhofer),
+ Simplify handling of parameter entity references (Nick Wellnhofer),
+ Deduplicate code in encoding.c (Nick Wellnhofer),
+ Make HTML parser functions take const pointers (Nick Wellnhofer),
+ Build test programs only when needed (Nick Wellnhofer),
+ Fix doc/examples/index.py (Nick Wellnhofer),
+ Fix compiler warnings in threads.c (Nick Wellnhofer),
+ Fix empty-body warning in nanohttp.c (Nick Wellnhofer),
+ Fix cast-align warnings (Nick Wellnhofer),
+ Fix unused-parameter warnings (Nick Wellnhofer),
+ Rework entity boundary checks (Nick Wellnhofer),
+ Don't switch encoding for internal parameter entities (Nick Wellnhofer),
+ Merge duplicate code paths handling PE references (Nick Wellnhofer),
+ Test SAX2 callbacks with entity substitution (Nick Wellnhofer),
+ Support catalog and threads tests under --without-sax1 (Nick Wellnhofer),
+ Misc fixes for 'make tests' (Nick Wellnhofer),
+ Initialize keepBlanks in HTML parser (Nick Wellnhofer),
+ Add test cases for bug 758518 (David Kilzer),
+ Fix compiler warning in htmlParseElementInternal (Nick Wellnhofer),
+ Remove useless check in xmlParseAttributeListDecl (Nick Wellnhofer),
+ Allow zero sized memory input buffers (Nick Wellnhofer),
+ Add TODO comment in xmlSwitchEncoding (Nick Wellnhofer),
+ Check for integer overflow in xmlXPathFormatNumber (Nick Wellnhofer),
+ Make Travis print UBSan stacktraces (Nick Wellnhofer),
+ Add .travis.yml (Nick Wellnhofer),
+ Fix expected error output in Python tests (Nick Wellnhofer),
+ Simplify control flow in xmlParseStartTag2 (Nick Wellnhofer),
+ Disable LeakSanitizer when running API tests (Nick Wellnhofer),
+ Avoid out-of-bound array access in API tests (Nick Wellnhofer),
+ Avoid spurious UBSan errors in parser.c (Nick Wellnhofer),
+ Parse small XPath numbers more accurately (Nick Wellnhofer),
+ Rework XPath rounding functions (Nick Wellnhofer),
+ Fix white space in test output (Nick Wellnhofer),
+ Fix axis traversal from attribute and namespace nodes (Nick Wellnhofer),
+ Check for trailing characters in XPath expressions earlier (Nick Wellnhofer),
+ Rework final handling of XPath results (Nick Wellnhofer),
+ Make xmlXPathEvalExpression call xmlXPathEval (Nick Wellnhofer),
+ Remove unused variables (Nick Wellnhofer),
+ Don't print generic error messages in XPath tests (Nick Wellnhofer)
+
+ - Cleanups:
+ Fix a couple of misleading indentation errors (Daniel Veillard),
+ Remove unnecessary calls to xmlPopInput (Nick Wellnhofer)
+
+
+
+2.9.4: May 23 2016:
+ - Security:
+ More format string warnings with possible format string vulnerability (David Kilzer),
+ Avoid building recursive entities (Daniel Veillard),
+ Heap-based buffer overread in htmlCurrentChar (Pranjal Jumde),
+ Heap-based buffer-underreads due to xmlParseName (David Kilzer),
+ Heap use-after-free in xmlSAX2AttributeNs (Pranjal Jumde),
+ Heap use-after-free in htmlParsePubidLiteral and htmlParseSystemiteral (Pranjal Jumde),
+ Fix some format string warnings with possible format string vulnerability (David Kilzer),
+ Detect change of encoding when parsing HTML names (Hugh Davenport),
+ Fix inappropriate fetch of entities content (Daniel Veillard),
+ Bug 759398: Heap use-after-free in xmlDictComputeFastKey <https://bugzilla.gnome.org/show_bug.cgi?id=759398> (Pranjal Jumde),
+ Bug 758605: Heap-based buffer overread in xmlDictAddString <https://bugzilla.gnome.org/show_bug.cgi?id=758605> (Pranjal Jumde),
+ Bug 758588: Heap-based buffer overread in xmlParserPrintFileContextInternal <https://bugzilla.gnome.org/show_bug.cgi?id=758588> (David Kilzer),
+ Bug 757711: heap-buffer-overflow in xmlFAParsePosCharGroup <https://bugzilla.gnome.org/show_bug.cgi?id=757711> (Pranjal Jumde),
+ Add missing increments of recursion depth counter to XML parser. (Peter Simons)
+
+ - Documentation:
+ Fix typo: s{ ec -> cr }cipt (Jan Pokorný),
+ Fix typos: dictio{ nn -> n }ar{y,ies} (Jan Pokorný),
+ Fix typos: PATH_{ SEAPARATOR -> SEPARATOR } (Jan Pokorný),
+ Correct a typo. (Shlomi Fish)
+
+ - Portability:
+ Correct the usage of LDFLAGS (Mattias Hansson),
+ Revert the use of SAVE_LDFLAGS in configure.ac (Mattias Hansson),
+ libxml2 hardcodes -L/lib in zlib/lzma tests which breaks cross-compiles (Mike Frysinger),
+ Fix apibuild for a recently added construct (Daniel Veillard),
+ Use pkg-config to locate zlib when possible (Stewart Brodie),
+ Use pkg-config to locate ICU when possible (Stewart Brodie),
+ Portability to non C99 compliant compilers (Patrick Monnerat),
+ dict.h: Move xmlDictPtr definition before includes to allow direct inclusion. (Patrick Monnerat),
+ os400: tell about xmllint and xmlcatalog in README400. (Patrick Monnerat),
+ os400: properly process SGML add in XMLCATALOG command. (Patrick Monnerat),
+ os400: implement CL command XMLCATALOG. (Patrick Monnerat),
+ os400: compile and install program xmlcatalog (qshell-only). (Patrick Monnerat),
+ os400: expand tabs in sources, strip trailing blanks. (Patrick Monnerat),
+ os400: implement CL command XMLLINT. (Patrick Monnerat),
+ os400: compile and install program xmllint (qshell-only). (Patrick Monnerat),
+ os400: initscript make_module(): Use options instead of positional parameters. (Patrick Monnerat),
+ os400: c14n.rpgle: allow *omit for nullable reference parameters. (Patrick Monnerat),
+ os400: use like() for double type. (Patrick Monnerat),
+ os400: use like() for int type. (Patrick Monnerat),
+ os400: use like() for unsigned int type. (Patrick Monnerat),
+ os400: use like() for enum types. (Patrick Monnerat),
+ Add xz to xml2-config --libs output (Baruch Siach),
+ Bug 760190: configure.ac should be able to build --with-icu without icu-config tool <https://bugzilla.gnome.org/show_bug.cgi?id=760190> (David Kilzer),
+ win32\VC10\config.h and VS 2015 (Bruce Dawson),
+ Add configure maintainer mode (orzen)
+
+ - Bug Fixes:
+ Avoid an out of bound access when serializing malformed strings (Daniel Veillard),
+ Unsigned addition may overflow in xmlMallocAtomicLoc() (David Kilzer),
+ Integer signed/unsigned type mismatch in xmlParserInputGrow() (David Kilzer),
+ Bug 763071: heap-buffer-overflow in xmlStrncat <https://bugzilla.gnome.org/show_bug.cgi?id=763071> (Pranjal Jumde),
+ Integer overflow parsing port number in URI (Michael Paddon),
+ Fix an error with regexp on nullable counted char transition (Daniel Veillard),
+ Fix memory leak with XPath namespace nodes (Nick Wellnhofer),
+ Fix namespace axis traversal (Nick Wellnhofer),
+ Fix null pointer deref in docs with no root element (Hugh Davenport),
+ Fix XSD validation of URIs with ampersands (Alex Henrie),
+ xmlschemastypes.c: accept endOfDayFrag Times set to "24:00:00" mean "end of day" and should not cause an error. (Patrick Monnerat),
+ xmlcatalog: flush stdout before interactive shell input. (Patrick Monnerat),
+ xmllint: flush stdout before interactive shell input. (Patrick Monnerat),
+ Don't recurse into OP_VALUEs in xmlXPathOptimizeExpression (Nick Wellnhofer),
+ Fix namespace::node() XPath expression (Nick Wellnhofer),
+ Fix OOB write in xmlXPathEmptyNodeSet (Nick Wellnhofer),
+ Fix parsing of NCNames in XPath (Nick Wellnhofer),
+ Fix OOB read with invalid UTF-8 in xmlUTF8Strsize (Nick Wellnhofer),
+ Do normalize string-based datatype value in RelaxNG facet checking (Audric Schiltknecht),
+ Bug 760921: REGRESSION (8eb55d78): doc/examples/io1 test fails after fix for "xmlSaveUri() incorrectly recomposes URIs with rootless paths" <https://bugzilla.gnome.org/show_bug.cgi?id=760921> (David Kilzer),
+ Bug 760861: REGRESSION (bf9c1dad): Missing results for test/schemas/regexp-char-ref_[01].xsd <https://bugzilla.gnome.org/show_bug.cgi?id=760861> (David Kilzer),
+ error.c: *input->cur == 0 does not mean no error (Pavel Raiskup),
+ Add missing RNG test files (David Kilzer),
+ Bug 760183: REGRESSION (v2.9.3): XML push parser fails with bogus UTF-8 encoding error when multi-byte character in large CDATA section is split across buffer <https://bugzilla.gnome.org/show_bug.cgi?id=760183> (David Kilzer),
+ Bug 758572: ASAN crash in make check <https://bugzilla.gnome.org/show_bug.cgi?id=758572> (David Kilzer),
+ Bug 721158: Missing ICU string when doing --version on xmllint <https://bugzilla.gnome.org/show_bug.cgi?id=721158> (David Kilzer),
+ python 3: libxml2.c wrappers create Unicode str already (Michael Stahl),
+ Add autogen.sh to distrib (orzen),
+ Heap-based buffer overread in xmlNextChar (Daniel Veillard)
+
+ - Improvements:
+ Add more debugging info to runtest (Daniel Veillard),
+ Implement "runtest -u" mode (David Kilzer),
+ Add a make rule to rebuild for ASAN (Daniel Veillard)
+
+
+
+v2.9.3: Nov 20 2015:
+ - Security:
+ CVE-2015-8242 Buffer overead with HTML parser in push mode (Hugh Davenport),
+ CVE-2015-7500 Fix memory access error due to incorrect entities boundaries (Daniel Veillard),
+ CVE-2015-7499-2 Detect incoherency on GROW (Daniel Veillard),
+ CVE-2015-7499-1 Add xmlHaltParser() to stop the parser (Daniel Veillard),
+ CVE-2015-5312 Another entity expansion issue (David Drysdale),
+ CVE-2015-7497 Avoid an heap buffer overflow in xmlDictComputeFastQKey (David Drysdale),
+ CVE-2015-7498 Avoid processing entities after encoding conversion failures (Daniel Veillard),
+ CVE-2015-8035 Fix XZ compression support loop (Daniel Veillard),
+ CVE-2015-7942-2 Fix an error in previous Conditional section patch (Daniel Veillard),
+ CVE-2015-7942 Another variation of overflow in Conditional sections (Daniel Veillard),
+ CVE-2015-1819 Enforce the reader to run in constant memory (Daniel Veillard)
+ CVE-2015-7941_2 Cleanup conditional section error handling (Daniel Veillard),
+ CVE-2015-7941_1 Stop parsing on entities boundaries errors (Daniel Veillard),
+
+ - Documentation:
+ Correct spelling of "calling" (Alex Henrie),
+ Fix a small error in xmllint --format description (Fabien Degomme),
+ Avoid XSS on the search of xmlsoft.org (Daniel Veillard)
+
+ - Portability:
+ threads: use forward declarations only for glibc (Michael Heimpold),
+ Update Win32 configure.js to search for configure.ac (Daniel Veillard)
+
+ - Bug Fixes:
+ Bug on creating new stream from entity (Daniel Veillard),
+ Fix some loop issues embedding NEXT (Daniel Veillard),
+ Do not print error context when there is none (Daniel Veillard),
+ Avoid extra processing of MarkupDecl when EOF (Hugh Davenport),
+ Fix parsing short unclosed comment uninitialized access (Daniel Veillard),
+ Add missing Null check in xmlParseExternalEntityPrivate (Gaurav Gupta),
+ Fix a bug in CData error handling in the push parser (Daniel Veillard),
+ Fix a bug on name parsing at the end of current input buffer (Daniel Veillard),
+ Fix the spurious ID already defined error (Daniel Veillard),
+ Fix previous change to node sort order (Nick Wellnhofer),
+ Fix a self assignment issue raised by clang (Scott Graham),
+ Fail parsing early on if encoding conversion failed (Daniel Veillard),
+ Do not process encoding values if the declaration if broken (Daniel Veillard),
+ Silence clang's -Wunknown-attribute (Michael Catanzaro),
+ xmlMemUsed is not thread-safe (Martin von Gagern),
+ Fix support for except in nameclasses (Daniel Veillard),
+ Fix order of root nodes (Nick Wellnhofer),
+ Allow attributes on descendant-or-self axis (Nick Wellnhofer),
+ Fix the fix to Windows locking (Steve Nairn),
+ Fix timsort invariant loop re: Envisage article (Christopher Swenson),
+ Don't add IDs in xmlSetTreeDoc (Nick Wellnhofer),
+ Account for ID attributes in xmlSetTreeDoc (Nick Wellnhofer),
+ Remove various unused value assignments (Philip Withnall),
+ Fix missing entities after CVE-2014-3660 fix (Daniel Veillard),
+ Revert "Missing initialization for the catalog module" (Daniel Veillard)
+
+ - Improvements:
+ Reuse xmlHaltParser() where it makes sense (Daniel Veillard),
+ xmlStopParser reset errNo (Daniel Veillard),
+ Reenable xz support by default (Daniel Veillard),
+ Recover unescaped less-than character in HTML recovery parsing (Daniel Veillard),
+ Allow HTML serializer to output HTML5 DOCTYPE (Shaun McCance),
+ Regression test for bug #695699 (Nick Wellnhofer),
+ Add a couple of XPath tests (Nick Wellnhofer),
+ Add Python 3 rpm subpackage (Tomas Radej),
+ libxml2-config.cmake.in: update include directories (Samuel Martin),
+ Adding example from bugs 738805 to regression tests (Daniel Veillard)
+
+ - Cleanups:
+
+
+
2.9.2: Oct 16 2014:
- Security:
Fix for CVE-2014-3660 billion laugh variant (Daniel Veillard),
@@ -845,7 +1288,7 @@ Gansterer),
- Improvement: switch parser to XML-1.0 5th edition, add parsing flags
for old versions, switch URI parsing to RFC 3986,
add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer),
- new hashing functions for dictionaries (based on Stefan Behnel work),
+ new hashing functions for dictionnaries (based on Stefan Behnel work),
improve handling of misplaced html/head/body in HTML parser, better
regression test tools and code coverage display, better algorithms
to detect various versions of the billion laughts attacks, make
@@ -1231,7 +1674,7 @@ Do not use or package 2.6.25
Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed),
some gcc4 fixes, HP-UX portability fixes (Rick Jones).
- bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and
- xmlreader stopping on non-fatal errors, thread support for dictionaries
+ xmlreader stopping on non-fatal errors, thread support for dictionnaries
reference counting (Gary Coady), internal subset and push problem, URL
saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths
fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix
@@ -1482,7 +1925,7 @@ Do not use or package 2.6.25
William) reported by Yuuichi Teranishi
- bugfixes: make test and path issues, xmlWriter attribute serialization
(William Brack), xmlWriter indentation (William), schemas validation
- (Eric Haszlakiewicz), XInclude dictionaries issues (William and Oleg
+ (Eric Haszlakiewicz), XInclude dictionnaries issues (William and Oleg
Paraschenko), XInclude empty fallback (William), HTML warnings (William),
XPointer in XInclude (William), Python namespace serialization,
isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter
@@ -1503,7 +1946,7 @@ Do not use or package 2.6.25
2.6.5: Jan 25 2004:
- - Bugfixes: dictionaries for schemas (William Brack), regexp segfault
+ - Bugfixes: dictionnaries for schemas (William Brack), regexp segfault
(William), xs:all problem (William), a number of XPointer bugfixes
(William), xmllint error go to stderr, DTD validation problem with
namespace, memory leak (William), SAX1 cleanup and minimal options fixes
diff --git a/chromium/third_party/libxml/src/README.zOS b/chromium/third_party/libxml/src/README.zOS
new file mode 100644
index 00000000000..6b6669ae4a4
--- /dev/null
+++ b/chromium/third_party/libxml/src/README.zOS
@@ -0,0 +1,212 @@
+Notes for compiling on zOS:
+
+- since testapi.c file is huge (over 52000 lines), it's compilation
+ fails: I skipped the problem by removing all references to testapi in the
+ Makefile.in, but it would be neater if one can build without test files
+ (I didn't find an option in configure...)
+
+- since the name of files (or qualifier) in PDS are limited to 8 I had to
+ rename xmlschemas.c and xmlschemastypes.c in (resp.) xmlsche.c xmlschet.c
+ (and I had to modify all occurences of these files accordingly in the
+ rest of the Makefile !!!).
+
+- in order to copy objects to PDS, I had the cp command at line 860
+ of Makefile.in
+
+libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) $(libxml2_la_LIBADD) $(LIBS)
+ # Copy objects to PDS
+ @list='$(libxml2_OBJECTS)' ; for p in $$list; do \
+ cp -ACMv $$p "//'<PDS NAME>'"; \
+ done
+
+ with <PDS NAME> stands for the name of my PDS and
+
+libxml2_OBJECTS = SAX.o entities.o encoding.o error.o \
+ parserInternals.o parser.o tree.o hash.o list.o xmlIO.o \
+ xmlmemory.o uri.o valid.o xlink.o HTMLparser.o \
+ HTMLtree.o debugXML.o xpath.o xpointer.o xinclude.o \
+ nanohttp.o nanoftp.o triostr.o trio.o catalog.o globals.o \
+ threads.o c14n.o xmlstring.o buf.o xmlregexp.o \
+ xmlsche.o xmlschet.o xmlunicode.o \
+ xmlreader.o relaxng.o dict.o SAX2.o \
+ xmlwriter.o legacy.o chvalid.o pattern.o xmlsave.o \
+ xmlmodule.o schematron.o xzlib.o
+
+In order to handle the support of zOS without breaking the existing
+Makefile maybe a new option/flag zOs would copy xmlschemas.c and
+xmlschemastypes.c files and use specifics targets rather than existing
+ones with the longer names... A variable to handle the PDS name has to
+be provided also...
+
+See patch below for set of changes to Makefile.in
+
+Stéphane Michaut <smichaut@axway.com>
+July 2017
+
+
+--- Makefile.in 2017-08-01 08:17:15.000000000 +0200
++++ Makefile-new.in 2017-08-01 08:07:26.000000000 +0200
+@@ -41,7 +41,7 @@
+ testSAX$(EXEEXT) testHTML$(EXEEXT) testXPath$(EXEEXT) \
+ testURI$(EXEEXT) testThreads$(EXEEXT) testC14N$(EXEEXT) \
+ testAutomata$(EXEEXT) testRegexp$(EXEEXT) testReader$(EXEEXT) \
+- testapi$(EXEEXT) testModule$(EXEEXT) runtest$(EXEEXT) \
++ testModule$(EXEEXT) runtest$(EXEEXT) \
+ runsuite$(EXEEXT) testchar$(EXEEXT) testdict$(EXEEXT) \
+ runxmlconf$(EXEEXT) testrecurse$(EXEEXT) testlimits$(EXEEXT)
+ bin_PROGRAMS = xmllint$(EXEEXT) xmlcatalog$(EXEEXT)
+@@ -106,6 +106,7 @@
+ debugXML.c xpath.c xpointer.c xinclude.c nanohttp.c nanoftp.c \
+ DOCBparser.c catalog.c globals.c threads.c c14n.c xmlstring.c \
+ buf.c xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
++ xmlsche.c xmlschet.c \
+ triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c \
+ xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c xmlmodule.c \
+ schematron.c xzlib.c
+@@ -118,10 +119,24 @@
+ nanohttp.lo nanoftp.lo $(am__objects_1) catalog.lo globals.lo \
+ threads.lo c14n.lo xmlstring.lo buf.lo xmlregexp.lo \
+ xmlschemas.lo xmlschemastypes.lo xmlunicode.lo \
++ xmlsche.lo xmlschet.lo \
+ $(am__objects_2) xmlreader.lo relaxng.lo dict.lo SAX2.lo \
+ xmlwriter.lo legacy.lo chvalid.lo pattern.lo xmlsave.lo \
+ xmlmodule.lo schematron.lo xzlib.lo
+ libxml2_la_OBJECTS = $(am_libxml2_la_OBJECTS)
++
++libxml2_OBJECTS = SAX.o entities.o encoding.o error.o \
++ parserInternals.o parser.o tree.o hash.o list.o xmlIO.o \
++ xmlmemory.o uri.o valid.o xlink.o HTMLparser.o \
++ HTMLtree.o debugXML.o xpath.o xpointer.o xinclude.o \
++ nanohttp.o nanoftp.o triostr.o trio.o catalog.o globals.o \
++ threads.o c14n.o xmlstring.o buf.o xmlregexp.o \
++ xmlschemas.o xmlschemastypes.o xmlunicode.o \
++ xmlsche.o xmlschemast.o \
++ xmlreader.o relaxng.o dict.o SAX2.o \
++ xmlwriter.o legacy.o chvalid.o pattern.o xmlsave.o \
++ xmlmodule.o schematron.o xzlib.o
++
+ AM_V_lt = $(am__v_lt_$(V))
+ am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+ am__v_lt_0 = --silent
+@@ -216,11 +231,6 @@
+ testXPath_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(testXPath_LDFLAGS) $(LDFLAGS) -o $@
+-am_testapi_OBJECTS = testapi.$(OBJEXT)
+-testapi_OBJECTS = $(am_testapi_OBJECTS)
+-testapi_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+- $(testapi_LDFLAGS) $(LDFLAGS) -o $@
+ am_testchar_OBJECTS = testchar.$(OBJEXT)
+ testchar_OBJECTS = $(am_testchar_OBJECTS)
+ testchar_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+@@ -285,7 +295,7 @@
+ $(testReader_SOURCES) $(testRegexp_SOURCES) \
+ $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) \
+ $(testThreads_SOURCES) $(testURI_SOURCES) $(testXPath_SOURCES) \
+- $(testapi_SOURCES) $(testchar_SOURCES) $(testdict_SOURCES) \
++ $(testchar_SOURCES) $(testdict_SOURCES) \
+ $(testlimits_SOURCES) $(testrecurse_SOURCES) \
+ $(xmlcatalog_SOURCES) $(xmllint_SOURCES)
+ DIST_SOURCES = $(am__libxml2_la_SOURCES_DIST) $(testdso_la_SOURCES) \
+@@ -295,7 +305,7 @@
+ $(testReader_SOURCES) $(testRegexp_SOURCES) \
+ $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) \
+ $(am__testThreads_SOURCES_DIST) $(testURI_SOURCES) \
+- $(testXPath_SOURCES) $(testapi_SOURCES) $(testchar_SOURCES) \
++ $(testXPath_SOURCES) $(testchar_SOURCES) \
+ $(testdict_SOURCES) $(testlimits_SOURCES) \
+ $(testrecurse_SOURCES) $(xmlcatalog_SOURCES) \
+ $(xmllint_SOURCES)
+@@ -700,11 +710,6 @@
+ noinst_LTLIBRARIES = testdso.la
+ testdso_la_SOURCES = testdso.c
+ testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
+-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)
+@@ -854,6 +859,12 @@
+ done
+ libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) $(libxml2_la_LIBADD) $(LIBS)
++ # Copie des obj
++ @list='$(libxml2_OBJECTS)' ; for p in $$list; do \
++ echo "copy to PDS: $$p"; \
++ cp -ACMv $$p "//'A009153.XRDEV230.FIC.OBJLIB.LIBXML'"; \
++ done
++
+ testdso.la: $(testdso_la_OBJECTS) $(testdso_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(testdso_la_LINK) $(testdso_la_OBJECTS) $(testdso_la_LIBADD) $(LIBS)
+ install-binPROGRAMS: $(bin_PROGRAMS)
+@@ -953,9 +964,6 @@
+ testXPath$(EXEEXT): $(testXPath_OBJECTS) $(testXPath_DEPENDENCIES)
+ @rm -f testXPath$(EXEEXT)
+ $(AM_V_CCLD)$(testXPath_LINK) $(testXPath_OBJECTS) $(testXPath_LDADD) $(LIBS)
+-testapi$(EXEEXT): $(testapi_OBJECTS) $(testapi_DEPENDENCIES)
+- @rm -f testapi$(EXEEXT)
+- $(AM_V_CCLD)$(testapi_LINK) $(testapi_OBJECTS) $(testapi_LDADD) $(LIBS)
+ testchar$(EXEEXT): $(testchar_OBJECTS) $(testchar_DEPENDENCIES)
+ @rm -f testchar$(EXEEXT)
+ $(AM_V_CCLD)$(testchar_LINK) $(testchar_OBJECTS) $(testchar_LDADD) $(LIBS)
+@@ -1056,7 +1064,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testThreadsWin32.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testURI.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testXPath.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testapi.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testchar.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdict.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdso.Plo@am__quote@
+@@ -1755,18 +1762,6 @@
+ uninstall-local uninstall-m4dataDATA uninstall-man \
+ uninstall-man1 uninstall-man3 uninstall-pkgconfigDATA
+
+-
+-# 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 )
+-
+ #testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c
+ #testOOM_LDFLAGS =
+ #testOOM_DEPENDENCIES = $(DEPS)
+@@ -1775,7 +1770,7 @@
+ runtests:
+ [ -d test ] || $(LN_S) $(srcdir)/test .
+ [ -d result ] || $(LN_S) $(srcdir)/result .
+- $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
++ $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
+ @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
+ $(MAKE) tests ; fi)
+
+@@ -1797,10 +1792,6 @@
+ $(MAKE) tests ; fi)
+ @(cd doc/examples ; $(MAKE) tests)
+
+-APItests: testapi$(EXEEXT)
+- @echo "## Running the API regression tests this may take a little while"
+- -@($(CHECKER) $(top_builddir)/testapi -q)
+-
+ HTMLtests : testHTML$(EXEEXT)
+ @(echo > .memdump)
+ @echo "## HTML regression tests"
+@@ -2746,7 +2737,7 @@
+ dist-test: distdir
+ (mkdir -p $(distdir))
+ (cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git xstc/Tests) | (cd $(distdir); tar xf -)
+- tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests $(distdir)/Makefile.tests $(distdir)/README $(distdir)/README.tests $(distdir)/AUTHORS $(distdir)/testapi.c $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-tests+"`.tar.gz
++ tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests $(distdir)/Makefile.tests $(distdir)/README $(distdir)/README.tests $(distdir)/AUTHORS $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-tests+"`.tar.gz
+ @(rm -rf $(distdir)/xstc/Test)
+
+ cleantar:
diff --git a/chromium/third_party/libxml/src/SAX2.c b/chromium/third_party/libxml/src/SAX2.c
index 5cbb700af54..fee66b7fb8a 100644
--- a/chromium/third_party/libxml/src/SAX2.c
+++ b/chromium/third_party/libxml/src/SAX2.c
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
+#include <stddef.h>
#include <libxml/xmlmemory.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -1181,6 +1182,8 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
if (name != NULL)
xmlFree(name);
+ if (nval != NULL)
+ xmlFree(nval);
return;
}
} else {
@@ -1242,6 +1245,8 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
xmlFree(ns);
if (name != NULL)
xmlFree(name);
+ if (nval != NULL)
+ xmlFree(nval);
return;
}
} else {
@@ -1311,6 +1316,8 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
name, namespace->href);
ctxt->wellFormed = 0;
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
+ if (name != NULL)
+ xmlFree(name);
goto error;
}
}
@@ -1658,7 +1665,13 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
#ifdef DEBUG_SAX_TREE
xmlGenericError(xmlGenericErrorContext, "pushing(%s)\n", name);
#endif
- nodePush(ctxt, ret);
+ if (nodePush(ctxt, ret) < 0) {
+ xmlUnlinkNode(ret);
+ xmlFreeNode(ret);
+ if (prefix != NULL)
+ xmlFree(prefix);
+ return;
+ }
/*
* Link the child element
@@ -1908,7 +1921,7 @@ skip:
else {
ret->line = 65535;
if (ctxt->options & XML_PARSE_BIG_LINES)
- ret->psvi = (void *) (long) ctxt->input->line;
+ ret->psvi = (void *) (ptrdiff_t) ctxt->input->line;
}
}
}
@@ -2250,6 +2263,7 @@ xmlSAX2StartElementNs(void *ctx,
ctxt->freeElems = ret->next;
ctxt->freeElemsNr--;
memset(ret, 0, sizeof(xmlNode));
+ ret->doc = ctxt->myDoc;
ret->type = XML_ELEMENT_NODE;
if (ctxt->dictNames)
@@ -2311,7 +2325,7 @@ xmlSAX2StartElementNs(void *ctx,
} else {
/*
* any out of memory error would already have been raised
- * but we can't be garanteed it's the actual error due to the
+ * but we can't be guaranteed it's the actual error due to the
* API, best is to skip in this case
*/
continue;
@@ -2329,7 +2343,11 @@ xmlSAX2StartElementNs(void *ctx,
/*
* We are parsing a new node.
*/
- nodePush(ctxt, ret);
+ if (nodePush(ctxt, ret) < 0) {
+ xmlUnlinkNode(ret);
+ xmlFreeNode(ret);
+ return;
+ }
/*
* Link the child element
@@ -2805,7 +2823,8 @@ xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
xmlTextConcat(lastChild, value, len);
} else {
ret = xmlNewCDataBlock(ctxt->myDoc, value, len);
- xmlAddChild(ctxt->node, ret);
+ if (xmlAddChild(ctxt->node, ret) == NULL)
+ xmlFreeNode(ret);
}
}
diff --git a/chromium/third_party/libxml/src/aclocal.m4 b/chromium/third_party/libxml/src/aclocal.m4
index b19601b7b8e..6db5ac1b4bc 100644
--- a/chromium/third_party/libxml/src/aclocal.m4
+++ b/chromium/third_party/libxml/src/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -20,9 +20,9 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29.1)
-dnl
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
+
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
@@ -63,7 +63,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29.1])
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
@@ -164,7 +164,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -174,11 +174,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
- else
+ else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
@@ -195,7 +195,7 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -296,7 +296,7 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -308,10 +308,10 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.15'
+[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.16.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -327,14 +327,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.16.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -386,7 +386,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -417,7 +417,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -608,13 +608,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 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_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@@ -622,49 +621,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
- case $CONFIG_FILES in
- *\'*) eval set x "$CONFIG_FILES" ;;
- *) set x $CONFIG_FILES ;;
- esac
+ # TODO: see whether this extra hack can be removed once we start
+ # requiring Autoconf 2.70 or later.
+ AS_CASE([$CONFIG_FILES],
+ [*\'*], [eval set x "$CONFIG_FILES"],
+ [*], [set x $CONFIG_FILES])
shift
- for mf
+ # Used to flag and report bootstrapping failures.
+ am_rc=0
+ for am_mf
do
# Strip MF so we end up with the name of the file.
- mf=`echo "$mf" | sed -e 's/:.*$//'`
- # Check whether this is an Automake generated Makefile or not.
- # We used to match only the files named 'Makefile.in', but
- # some people rename them; so instead we look at the file content.
- # Grep'ing the first line is not enough: some people post-process
- # each Makefile.in and add a new line on top of each file to say so.
- # Grep'ing the whole file is not good either: AIX grep has a line
+ am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile which includes
+ # dependency-tracking related rules and includes.
+ # Grep'ing the whole file directly is not great: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
- if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
- dirpart=`AS_DIRNAME("$mf")`
- else
- continue
- fi
- # Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running 'make'.
- DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
- test -z "$DEPDIR" && continue
- am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "$am__include" && continue
- am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
- # Find all dependency output files, they are included files with
- # $(DEPDIR) in their names. We invoke sed twice because it is the
- # simplest approach to changing $(DEPDIR) to its actual value in the
- # expansion.
- for file in `sed -n "
- s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
- # Make sure the directory exists.
- test -f "$dirpart/$file" && continue
- fdir=`AS_DIRNAME(["$file"])`
- AS_MKDIR_P([$dirpart/$fdir])
- # echo "creating $dirpart/$file"
- echo '# dummy' > "$dirpart/$file"
- done
+ sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+ || continue
+ am_dirpart=`AS_DIRNAME(["$am_mf"])`
+ am_filepart=`AS_BASENAME(["$am_mf"])`
+ AM_RUN_LOG([cd "$am_dirpart" \
+ && sed -e '/# am--include-marker/d' "$am_filepart" \
+ | $MAKE -f - am--depfiles]) || am_rc=$?
done
+ if test $am_rc -ne 0; then
+ AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
+ for automatic dependency tracking. Try re-running configure with the
+ '--disable-dependency-tracking' option to at least be able to build
+ the package (albeit without support for automatic dependency tracking).])
+ fi
+ AS_UNSET([am_dirpart])
+ AS_UNSET([am_filepart])
+ AS_UNSET([am_mf])
+ AS_UNSET([am_rc])
+ rm -f conftest-deps.mk
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
@@ -673,18 +664,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
-# This code is only required when automatic dependency tracking
-# is enabled. FIXME. This creates each '.P' file that we will
-# need in order to bootstrap the dependency handling code.
+# This code is only required when automatic dependency tracking is enabled.
+# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
+# order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
- [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
+ [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -771,8 +761,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
@@ -839,7 +829,7 @@ END
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -881,7 +871,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -902,7 +892,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -924,7 +914,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -959,7 +949,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -967,49 +957,42 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# AM_MAKE_INCLUDE()
# -----------------
-# Check to see how make treats includes.
+# Check whether make has an 'include' directive that can support all
+# the idioms we need for our automatic dependency tracking code.
AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
+[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
+cat > confinc.mk << 'END'
am__doit:
- @echo this is the am__doit target
+ @echo this is the am__doit target >confinc.out
.PHONY: am__doit
END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
- am__include=include
- am__quote=
- _am_result=GNU
- ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
- echo '.include "confinc"' > confmf
- case `$am_make -s -f confmf 2> /dev/null` in #(
- *the\ am__doit\ target*)
- am__include=.include
- am__quote="\""
- _am_result=BSD
- ;;
- esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+ AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
+ AS_CASE([$?:`cat confinc.out 2>/dev/null`],
+ ['0:this is the am__doit target'],
+ [AS_CASE([$s],
+ [BSD], [am__include='.include' am__quote='"'],
+ [am__include='include' am__quote=''])])
+ if test "$am__include" != "#"; then
+ _am_result="yes ($s style)"
+ break
+ fi
+done
+rm -f confinc.* confmf.*
+AC_MSG_RESULT([${_am_result}])
+AC_SUBST([am__include])])
+AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1048,7 +1031,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1077,7 +1060,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1124,7 +1107,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1143,7 +1126,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1224,7 +1207,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1284,7 +1267,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1312,7 +1295,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1331,7 +1314,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/chromium/third_party/libxml/src/buf.c b/chromium/third_party/libxml/src/buf.c
index 07922ff693e..21cb9d80477 100644
--- a/chromium/third_party/libxml/src/buf.c
+++ b/chromium/third_party/libxml/src/buf.c
@@ -49,7 +49,7 @@ struct _xmlBuf {
size_t use; /* The buffer size used */
size_t size; /* The buffer size */
xmlBufferPtr buffer; /* wrapper for an old buffer */
- int error; /* an error code if a failure occured */
+ int error; /* an error code if a failure occurred */
};
#ifdef WITH_BUFFER_COMPAT
@@ -231,7 +231,7 @@ xmlBufPtr
xmlBufCreateStatic(void *mem, size_t size) {
xmlBufPtr ret;
- if ((mem == NULL) || (size == 0))
+ if (mem == NULL)
return(NULL);
ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf));
@@ -701,7 +701,7 @@ xmlBufUse(const xmlBufPtr buf)
* used in the buffer. It does not account for the terminating zero
* usually needed
*
- * Returns the amount or 0 if none or an error occured
+ * Returns the amount or 0 if none or an error occurred
*/
size_t
diff --git a/chromium/third_party/libxml/src/config.h.in b/chromium/third_party/libxml/src/config.h.in
index 749b1d6228c..a751769cdba 100644
--- a/chromium/third_party/libxml/src/config.h.in
+++ b/chromium/third_party/libxml/src/config.h.in
@@ -3,9 +3,6 @@
/* Type cast for the gethostbyname() argument */
#undef GETHOSTBYNAME_ARG_CAST
-/* Define to 1 if you have the <ansidecl.h> header file. */
-#undef HAVE_ANSIDECL_H
-
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
@@ -15,9 +12,6 @@
/* Whether struct sockaddr::__ss_family exists */
#undef HAVE_BROKEN_SS_FAMILY
-/* Define to 1 if you have the `class' function. */
-#undef HAVE_CLASS
-
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
@@ -39,24 +33,12 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Define to 1 if you have the `finite' function. */
-#undef HAVE_FINITE
-
/* Define to 1 if you have the <float.h> header file. */
#undef HAVE_FLOAT_H
-/* Define to 1 if you have the `fpclass' function. */
-#undef HAVE_FPCLASS
-
/* Define to 1 if you have the `fprintf' function. */
#undef HAVE_FPRINTF
-/* Define to 1 if you have the `fp_class' function. */
-#undef HAVE_FP_CLASS
-
-/* Define to 1 if you have the <fp_class.h> header file. */
-#undef HAVE_FP_CLASS_H
-
/* Define to 1 if you have the `ftime' function. */
#undef HAVE_FTIME
@@ -66,9 +48,6 @@
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
-/* Define to 1 if you have the <ieeefp.h> header file. */
-#undef HAVE_IEEEFP_H
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -81,24 +60,15 @@
/* Define if isnan is there */
#undef HAVE_ISNAN
-/* Define to 1 if you have the `isnand' function. */
-#undef HAVE_ISNAND
-
/* Define if history library is there (-lhistory) */
#undef HAVE_LIBHISTORY
-/* Have compression library */
-#undef HAVE_LIBLZMA
-
/* Define if pthread library is there (-lpthread) */
#undef HAVE_LIBPTHREAD
/* Define if readline library is there (-lreadline) */
#undef HAVE_LIBREADLINE
-/* Have compression library */
-#undef HAVE_LIBZ
-
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
@@ -128,9 +98,6 @@
# undef /**/ HAVE_MMAP
#endif
-/* Define to 1 if you have the <nan.h> header file. */
-#undef HAVE_NAN_H
-
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
@@ -194,12 +161,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define to 1 if you have the `strdup' function. */
-#undef HAVE_STRDUP
-
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME
@@ -209,9 +170,6 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
-/* Define to 1 if you have the `strndup' function. */
-#undef HAVE_STRNDUP
-
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
@@ -265,9 +223,6 @@
/* Define to 1 if you have the <zlib.h> header file. */
#undef HAVE_ZLIB_H
-/* Define to 1 if you have the `_stat' function. */
-#undef HAVE__STAT
-
/* Whether __va_copy() is available */
#undef HAVE___VA_COPY
@@ -321,9 +276,6 @@
#define below would cause a syntax error. */
#undef _UINT32_T
-/* Using the Win32 Socket implementation */
-#undef _WINSOCKAPI_
-
/* ss_family is not defined here, use __ss_family instead */
#undef ss_family
diff --git a/chromium/third_party/libxml/src/configure.ac b/chromium/third_party/libxml/src/configure.ac
index 911984e1511..9cae50c8581 100644
--- a/chromium/third_party/libxml/src/configure.ac
+++ b/chromium/third_party/libxml/src/configure.ac
@@ -9,7 +9,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=9
-LIBXML_MICRO_VERSION=4
+LIBXML_MICRO_VERSION=9
LIBXML_MICRO_VERSION_SUFFIX=
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@@ -389,18 +389,20 @@ dnl Checks for zlib library.
WITH_ZLIB=0
if test "$with_zlib" = "no"; then
- echo "Disabling compression support"
+ echo "Disabling zlib compression support"
else
- # Try pkg-config first so that static linking works.
- # If this succeeeds, we ignore the WITH_ZLIB directory.
- PKG_CHECK_MODULES([Z],[zlib],
- [have_libz=yes],
- [have_libz=no])
+ # 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 "x$have_libz" = "xno"; then
+ if test "$WITH_ZLIB" = "0"; then
AC_CHECK_HEADERS(zlib.h,
AC_CHECK_LIB(z, gzread,[
- have_libz=yes
+ WITH_ZLIB=1
if test "x${Z_DIR}" != "x"; then
Z_CFLAGS="-I${Z_DIR}/include"
Z_LIBS="-L${Z_DIR}/lib -lz"
@@ -411,18 +413,8 @@ else
esac]
else
Z_LIBS="-lz"
- fi],
- [have_libz=no])
- )
- else
- # we still need to check for zlib.h header
- AC_CHECK_HEADERS([zlib.h])
- fi
-
- # Found the library via either method?
- if test "x$have_libz" = "xyes"; then
- AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
- WITH_ZLIB=1
+ fi])
+ )
fi
fi
@@ -436,38 +428,30 @@ dnl Checks for lzma library.
WITH_LZMA=0
if test "$with_lzma" = "no"; then
- echo "Disabling compression support"
+ echo "Disabling lzma compression support"
else
- # Try pkg-config first so that static linking works.
- # If this succeeeds, we ignore the WITH_LZMA directory.
- PKG_CHECK_MODULES([LZMA],[liblzma],
- [have_liblzma=yes],
- [have_liblzma=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_liblzma" = "xno"; then
- AC_CHECK_HEADERS(lzma.h,
+ # 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
+ AC_CHECK_HEADERS(lzma.h,
AC_CHECK_LIB(lzma, lzma_code,[
- have_liblzma=yes
+ 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],
- [have_liblzma=no])
- )
- else
- # we still need to check for lzma,h header
- AC_CHECK_HEADERS([lzma.h])
- fi
-
- # Found the library via either method?
- if test "x$have_liblzma" = "xyes"; then
- AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
- WITH_LZMA=1
+ fi])
+ )
fi
fi
@@ -495,12 +479,8 @@ AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_HEADERS([time.h])
-AC_CHECK_HEADERS([ansidecl.h])
-AC_CHECK_HEADERS([ieeefp.h])
-AC_CHECK_HEADERS([nan.h])
AC_CHECK_HEADERS([math.h])
AC_CHECK_HEADERS([limits.h])
-AC_CHECK_HEADERS([fp_class.h])
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([sys/socket.h], [], [],
@@ -557,10 +537,8 @@ echo Checking libraries
dnl Checks for library functions.
AC_FUNC_STRFTIME
-AC_CHECK_FUNCS(strdup strndup strerror)
-AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
-AC_CHECK_FUNCS(stat _stat signal)
+AC_CHECK_FUNCS(stat signal)
AC_CHECK_FUNCS(rand rand_r srand time)
AC_CHECK_FUNCS(isascii mmap munmap putenv)
@@ -771,13 +749,13 @@ dnl
if test "${GCC}" != "yes" ; then
case "${host}" in
hppa*-*-hpux* )
- CFLAGS="${CFLAGS} -Wp,-H30000"
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wp,-H30000"
;;
*-dec-osf* )
- CFLAGS="${CFLAGS} -ieee"
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee"
;;
alpha*-*-linux* )
- CFLAGS="${CFLAGS} -ieee"
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee"
;;
esac
else
@@ -787,19 +765,19 @@ else
# Not activated by default because this inflates the code size
# Used to allow propagation of C++ exceptions through the library
#
- CFLAGS="${CFLAGS} -fexceptions"
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -fexceptions"
fi
# warnings we'd like to see
- CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wno-format-extra-args -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
+ 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"
# warnings we'd like to supress
- CFLAGS="${CFLAGS} -Wno-long-long"
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wno-long-long -Wno-format-extra-args -Wno-array-bounds"
case "${host}" in
alpha*-*-linux* )
- CFLAGS="${CFLAGS} -mieee"
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee"
;;
alpha*-*-osf* )
- CFLAGS="${CFLAGS} -mieee"
+ EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee"
;;
esac
fi
@@ -812,13 +790,13 @@ case ${host} in
;;
*-*-mingw* | *-*-cygwin* | *-*-msvc* )
# If the host is Windows, and shared libraries are disabled, we
- # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
+ # need to add -DLIBXML_STATIC to EXTRA_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"
- CFLAGS="$CFLAGS -DLIBXML_STATIC"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBXML_STATIC"
fi
;;
esac
@@ -1010,7 +988,7 @@ if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
fi
fi
if test "${GCC}" = "yes" ; then
- CFLAGS="-g -O -pedantic -W -Wformat -Wno-format-extra-args -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
+ EXTRA_CFLAGS="-g -O -pedantic -W -Wformat -Wno-format-extra-args -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
fi
STATIC_BINARIES="-static"
dnl -Wcast-qual -ansi
@@ -1053,9 +1031,9 @@ if test "$with_threads" = "no" ; then
else
echo Enabling multithreaded support
- dnl Default to native threads on Win32
+ dnl Default to native threads on Windows
case $host_os in
- *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
+ *mingw*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
WITH_THREADS="1"
THREADS_W32="1"
THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
@@ -1640,10 +1618,16 @@ case "$host" in
CPPFLAGS="$CPPFLAGS -DWIN32"
WIN32_EXTRA_LIBADD="-lws2_32"
WIN32_EXTRA_LDFLAGS="-no-undefined"
- AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
if test "${PYTHON}" != ""
then
- WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
+ 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*)
@@ -1681,14 +1665,14 @@ AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscan
if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
then
echo Enabling code coverage for GCC
- CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -fprofile-arcs -ftest-coverage"
LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
else
echo Disabling code coverage for GCC
fi
AC_SUBST(CPPFLAGS)
-AC_SUBST(CFLAGS)
+AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(XML_CFLAGS)
diff --git a/chromium/third_party/libxml/src/dict.c b/chromium/third_party/libxml/src/dict.c
index c0585fe2396..0ef3718da28 100644
--- a/chromium/third_party/libxml/src/dict.c
+++ b/chromium/third_party/libxml/src/dict.c
@@ -48,7 +48,7 @@
#else
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
-#elif defined(WIN32)
+#elif defined(_WIN32)
typedef unsigned __int32 uint32_t;
#endif
#endif
@@ -249,7 +249,7 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, unsigned int namelen) {
#endif
pool = dict->strings;
while (pool != NULL) {
- if (pool->end - pool->free > namelen)
+ if ((size_t)(pool->end - pool->free) > namelen)
goto found_pool;
if (pool->size > size) size = pool->size;
limit += pool->size;
@@ -317,7 +317,7 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, unsigned int plen,
#endif
pool = dict->strings;
while (pool != NULL) {
- if (pool->end - pool->free > namelen + plen + 1)
+ if ((size_t)(pool->end - pool->free) > namelen + plen + 1)
goto found_pool;
if (pool->size > size) size = pool->size;
limit += pool->size;
@@ -453,14 +453,23 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
}
switch (namelen) {
case 10: value += name[9];
+ /* Falls through. */
case 9: value += name[8];
+ /* Falls through. */
case 8: value += name[7];
+ /* Falls through. */
case 7: value += name[6];
+ /* Falls through. */
case 6: value += name[5];
+ /* Falls through. */
case 5: value += name[4];
+ /* Falls through. */
case 4: value += name[3];
+ /* Falls through. */
case 3: value += name[2];
+ /* Falls through. */
case 2: value += name[1];
+ /* Falls through. */
default: break;
}
return(value);
@@ -496,15 +505,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
}
switch (plen) {
case 10: value += prefix[9];
+ /* Falls through. */
case 9: value += prefix[8];
+ /* Falls through. */
case 8: value += prefix[7];
+ /* Falls through. */
case 7: value += prefix[6];
+ /* Falls through. */
case 6: value += prefix[5];
+ /* Falls through. */
case 5: value += prefix[4];
+ /* Falls through. */
case 4: value += prefix[3];
+ /* Falls through. */
case 3: value += prefix[2];
+ /* Falls through. */
case 2: value += prefix[1];
+ /* Falls through. */
case 1: value += prefix[0];
+ /* Falls through. */
default: break;
}
len -= plen;
@@ -514,15 +533,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
}
switch (len) {
case 10: value += name[9];
+ /* Falls through. */
case 9: value += name[8];
+ /* Falls through. */
case 8: value += name[7];
+ /* Falls through. */
case 7: value += name[6];
+ /* Falls through. */
case 6: value += name[5];
+ /* Falls through. */
case 5: value += name[4];
+ /* Falls through. */
case 4: value += name[3];
+ /* Falls through. */
case 3: value += name[2];
+ /* Falls through. */
case 2: value += name[1];
+ /* Falls through. */
case 1: value += name[0];
+ /* Falls through. */
default: break;
}
return(value);
@@ -533,7 +562,7 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
*
* Create a new dictionary
*
- * Returns the newly created dictionary, or NULL if an error occured.
+ * Returns the newly created dictionary, or NULL if an error occurred.
*/
xmlDictPtr
xmlDictCreate(void) {
@@ -580,7 +609,7 @@ xmlDictCreate(void) {
* new dictionary, then in @sub, and if not found are created in the
* new dictionary.
*
- * Returns the newly created dictionary, or NULL if an error occured.
+ * Returns the newly created dictionary, or NULL if an error occurred.
*/
xmlDictPtr
xmlDictCreateSub(xmlDictPtr sub) {
@@ -699,7 +728,7 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
} else {
/*
* we don't have much ways to alert from herei
- * result is loosing an entry and unicity garantee
+ * result is losing an entry and unicity guarantee
*/
ret = -1;
}
diff --git a/chromium/third_party/libxml/src/elfgcchack.h b/chromium/third_party/libxml/src/elfgcchack.h
index 8c52884a37a..5ac93bfb9f4 100644
--- a/chromium/third_party/libxml/src/elfgcchack.h
+++ b/chromium/third_party/libxml/src/elfgcchack.h
@@ -11,7 +11,7 @@
#ifdef IN_LIBXML
#ifdef __GNUC__
#ifdef PIC
-#ifdef linux
+#ifdef __linux__
#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
#include "libxml/c14n.h"
diff --git a/chromium/third_party/libxml/src/encoding.c b/chromium/third_party/libxml/src/encoding.c
index e49c7f898fc..a3aaf10ec1b 100644
--- a/chromium/third_party/libxml/src/encoding.c
+++ b/chromium/third_party/libxml/src/encoding.c
@@ -110,6 +110,9 @@ openIcuConverter(const char* name, int toUnicode)
if (conv == NULL)
return NULL;
+ conv->pivot_source = conv->pivot_buf;
+ conv->pivot_target = conv->pivot_buf;
+
conv->uconv = ucnv_open(name, &status);
if (U_FAILURE(status))
goto error;
@@ -354,8 +357,14 @@ UTF8ToUTF8(unsigned char* out, int *outlen,
{
int len;
- if ((out == NULL) || (inb == NULL) || (outlen == NULL) || (inlenb == NULL))
+ if ((out == NULL) || (outlen == NULL) || (inlenb == NULL))
return(-1);
+ if (inb == NULL) {
+ /* inb == NULL means output is initialized. */
+ *outlen = 0;
+ *inlenb = 0;
+ return(0);
+ }
if (*outlen > *inlenb) {
len = *inlenb;
} else {
@@ -1844,6 +1853,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
* @outlen: the length of @out
* @in: a pointer to an array of ISO Latin 1 chars
* @inlen: the length of @in
+ * @flush: if true, indicates end of input
*
* Returns 0 if success, or
* -1 by lack of space, or
@@ -1857,7 +1867,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
*/
static int
xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
- const unsigned char *in, int *inlen) {
+ const unsigned char *in, int *inlen, int flush) {
const char *ucv_in = (const char *) in;
char *ucv_out = (char *) out;
UErrorCode err = U_ZERO_ERROR;
@@ -1867,33 +1877,31 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
return(-1);
}
- /*
- * TODO(jungshik)
- * 1. is ucnv_convert(To|From)Algorithmic better?
- * 2. had we better use an explicit pivot buffer?
- * 3. error returned comes from 'fromUnicode' only even
- * when toUnicode is true !
- */
if (toUnicode) {
/* encoding => UTF-16 => UTF-8 */
ucnv_convertEx(cd->utf8, cd->uconv, &ucv_out, ucv_out + *outlen,
- &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL,
- 0, TRUE, &err);
+ &ucv_in, ucv_in + *inlen, cd->pivot_buf,
+ &cd->pivot_source, &cd->pivot_target,
+ cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, flush, &err);
} else {
/* UTF-8 => UTF-16 => encoding */
ucnv_convertEx(cd->uconv, cd->utf8, &ucv_out, ucv_out + *outlen,
- &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL,
- 0, TRUE, &err);
+ &ucv_in, ucv_in + *inlen, cd->pivot_buf,
+ &cd->pivot_source, &cd->pivot_target,
+ cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, flush, &err);
}
*inlen = ucv_in - (const char*) in;
*outlen = ucv_out - (char *) out;
- if (U_SUCCESS(err))
+ if (U_SUCCESS(err)) {
+ /* reset pivot buf if this is the last call for input (flush==TRUE) */
+ if (flush)
+ cd->pivot_source = cd->pivot_target = cd->pivot_buf;
return 0;
+ }
if (err == U_BUFFER_OVERFLOW_ERROR)
return -1;
if (err == U_INVALID_CHAR_FOUND || err == U_ILLEGAL_CHAR_FOUND)
return -2;
- /* if (err == U_TRUNCATED_CHAR_FOUND) */
return -3;
}
#endif /* LIBXML_ICU_ENABLED */
@@ -1904,6 +1912,64 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
* *
************************************************************************/
+static int
+xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
+ int *outlen, const unsigned char *in, int *inlen, int flush) {
+ int ret;
+ (void)flush;
+
+ if (handler->input != NULL) {
+ ret = handler->input(out, outlen, in, inlen);
+ }
+#ifdef LIBXML_ICONV_ENABLED
+ else if (handler->iconv_in != NULL) {
+ ret = xmlIconvWrapper(handler->iconv_in, out, outlen, in, inlen);
+ }
+#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ else if (handler->uconv_in != NULL) {
+ ret = xmlUconvWrapper(handler->uconv_in, 1, out, outlen, in, inlen,
+ flush);
+ }
+#endif /* LIBXML_ICU_ENABLED */
+ else {
+ *outlen = 0;
+ *inlen = 0;
+ ret = -2;
+ }
+
+ return(ret);
+}
+
+/* Returns -4 if no output function was found. */
+static int
+xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
+ int *outlen, const unsigned char *in, int *inlen) {
+ int ret;
+
+ if (handler->output != NULL) {
+ ret = handler->output(out, outlen, in, inlen);
+ }
+#ifdef LIBXML_ICONV_ENABLED
+ else if (handler->iconv_out != NULL) {
+ ret = xmlIconvWrapper(handler->iconv_out, out, outlen, in, inlen);
+ }
+#endif /* LIBXML_ICONV_ENABLED */
+#ifdef LIBXML_ICU_ENABLED
+ else if (handler->uconv_out != NULL) {
+ ret = xmlUconvWrapper(handler->uconv_out, 0, out, outlen, in, inlen,
+ TRUE);
+ }
+#endif /* LIBXML_ICU_ENABLED */
+ else {
+ *outlen = 0;
+ *inlen = 0;
+ ret = -4;
+ }
+
+ return(ret);
+}
+
/**
* xmlCharEncFirstLineInt:
* @handler: char enconding transformation data structure
@@ -1922,7 +1988,7 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
int
xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in, int len) {
- int ret = -2;
+ int ret;
int written;
int toconv;
@@ -1953,33 +2019,13 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
written = out->size - out->use - 1;
}
- if (handler->input != NULL) {
- ret = handler->input(&out->content[out->use], &written,
- in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (handler->iconv_in != NULL) {
- ret = xmlIconvWrapper(handler->iconv_in, &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- if (ret == -1) ret = -3;
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef LIBXML_ICU_ENABLED
- else if (handler->uconv_in != NULL) {
- ret = xmlUconvWrapper(handler->uconv_in, 1, &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- if (ret == -1) ret = -3;
- }
-#endif /* LIBXML_ICU_ENABLED */
+ ret = xmlEncInputChunk(handler, &out->content[out->use], &written,
+ in->content, &toconv, 0);
+ xmlBufferShrink(in, toconv);
+ out->use += written;
+ out->content[out->use] = 0;
+ if (ret == -1) ret = -3;
+
#ifdef DEBUG_ENCODING
switch (ret) {
case 0:
@@ -2049,7 +2095,7 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
int
xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
{
- int ret = -2;
+ int ret;
size_t written;
size_t toconv;
int c_in;
@@ -2091,32 +2137,13 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
c_in = toconv;
c_out = written;
- if (input->encoder->input != NULL) {
- ret = input->encoder->input(xmlBufEnd(out), &c_out,
- xmlBufContent(in), &c_in);
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (input->encoder->iconv_in != NULL) {
- ret = xmlIconvWrapper(input->encoder->iconv_in, xmlBufEnd(out),
- &c_out, xmlBufContent(in), &c_in);
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- if (ret == -1)
- ret = -3;
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef LIBXML_ICU_ENABLED
- else if (input->encoder->uconv_in != NULL) {
- ret = xmlUconvWrapper(input->encoder->uconv_in, 1, xmlBufEnd(out),
- &c_out, xmlBufContent(in), &c_in);
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- if (ret == -1)
- ret = -3;
- }
-#endif /* LIBXML_ICU_ENABLED */
+ ret = xmlEncInputChunk(input->encoder, xmlBufEnd(out), &c_out,
+ xmlBufContent(in), &c_in, 0);
+ xmlBufShrink(in, c_in);
+ xmlBufAddLen(out, c_out);
+ if (ret == -1)
+ ret = -3;
+
switch (ret) {
case 0:
#ifdef DEBUG_ENCODING
@@ -2175,7 +2202,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
int
xmlCharEncInput(xmlParserInputBufferPtr input, int flush)
{
- int ret = -2;
+ int ret;
size_t written;
size_t toconv;
int c_in;
@@ -2208,32 +2235,13 @@ xmlCharEncInput(xmlParserInputBufferPtr input, int flush)
c_in = toconv;
c_out = written;
- if (input->encoder->input != NULL) {
- ret = input->encoder->input(xmlBufEnd(out), &c_out,
- xmlBufContent(in), &c_in);
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (input->encoder->iconv_in != NULL) {
- ret = xmlIconvWrapper(input->encoder->iconv_in, xmlBufEnd(out),
- &c_out, xmlBufContent(in), &c_in);
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- if (ret == -1)
- ret = -3;
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef LIBXML_ICU_ENABLED
- else if (input->encoder->uconv_in != NULL) {
- ret = xmlUconvWrapper(input->encoder->uconv_in, 1, xmlBufEnd(out),
- &c_out, xmlBufContent(in), &c_in);
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- if (ret == -1)
- ret = -3;
- }
-#endif /* LIBXML_ICU_ENABLED */
+ ret = xmlEncInputChunk(input->encoder, xmlBufEnd(out), &c_out,
+ xmlBufContent(in), &c_in, flush);
+ xmlBufShrink(in, c_in);
+ xmlBufAddLen(out, c_out);
+ if (ret == -1)
+ ret = -3;
+
switch (ret) {
case 0:
#ifdef DEBUG_ENCODING
@@ -2294,7 +2302,7 @@ int
xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
xmlBufferPtr in)
{
- int ret = -2;
+ int ret;
int written;
int toconv;
@@ -2313,35 +2321,14 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
xmlBufferGrow(out, out->size + toconv * 2);
written = out->size - out->use - 1;
}
- if (handler->input != NULL) {
- ret = handler->input(&out->content[out->use], &written,
- in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (handler->iconv_in != NULL) {
- ret = xmlIconvWrapper(handler->iconv_in, &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- if (ret == -1)
- ret = -3;
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef LIBXML_ICU_ENABLED
- else if (handler->uconv_in != NULL) {
- ret = xmlUconvWrapper(handler->uconv_in, 1, &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- out->content[out->use] = 0;
- if (ret == -1)
- ret = -3;
- }
-#endif /* LIBXML_ICU_ENABLED */
+ ret = xmlEncInputChunk(handler, &out->content[out->use], &written,
+ in->content, &toconv, 1);
+ xmlBufferShrink(in, toconv);
+ out->use += written;
+ out->content[out->use] = 0;
+ if (ret == -1)
+ ret = -3;
+
switch (ret) {
case 0:
#ifdef DEBUG_ENCODING
@@ -2405,7 +2392,7 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
int
xmlCharEncOutput(xmlOutputBufferPtr output, int init)
{
- int ret = -2;
+ int ret;
size_t written;
size_t writtentot = 0;
size_t toconv;
@@ -2413,7 +2400,6 @@ xmlCharEncOutput(xmlOutputBufferPtr output, int init)
int c_out;
xmlBufPtr in;
xmlBufPtr out;
- int charref_len = 0;
if ((output == NULL) || (output->encoder == NULL) ||
(output->buffer == NULL) || (output->conv == NULL))
@@ -2433,26 +2419,10 @@ retry:
if (init) {
c_in = 0;
c_out = written;
- if (output->encoder->output != NULL) {
- ret = output->encoder->output(xmlBufEnd(out), &c_out,
- NULL, &c_in);
- if (ret > 0) /* Gennady: check return value */
- xmlBufAddLen(out, c_out);
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (output->encoder->iconv_out != NULL) {
- ret = xmlIconvWrapper(output->encoder->iconv_out, xmlBufEnd(out),
- &c_out, NULL, &c_in);
- xmlBufAddLen(out, c_out);
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef LIBXML_ICU_ENABLED
- else if (output->encoder->uconv_out != NULL) {
- ret = xmlUconvWrapper(output->encoder->uconv_out, 0, xmlBufEnd(out),
- &c_out, NULL, &c_in);
- xmlBufAddLen(out, c_out);
- }
-#endif /* LIBXML_ICU_ENABLED */
+ /* TODO: Check return value. */
+ xmlEncOutputChunk(output->encoder, xmlBufEnd(out), &c_out,
+ NULL, &c_in);
+ xmlBufAddLen(out, c_out);
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"initialized encoder\n");
@@ -2477,60 +2447,18 @@ retry:
c_in = toconv;
c_out = written;
- if (output->encoder->output != NULL) {
- ret = output->encoder->output(xmlBufEnd(out), &c_out,
- xmlBufContent(in), &c_in);
+ ret = xmlEncOutputChunk(output->encoder, xmlBufEnd(out), &c_out,
+ xmlBufContent(in), &c_in);
+ xmlBufShrink(in, c_in);
+ xmlBufAddLen(out, c_out);
+ writtentot += c_out;
+ if (ret == -1) {
if (c_out > 0) {
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- writtentot += c_out;
+ /* Can be a limitation of iconv or uconv */
+ goto retry;
}
+ ret = -3;
}
-#ifdef LIBXML_ICONV_ENABLED
- else if (output->encoder->iconv_out != NULL) {
- ret = xmlIconvWrapper(output->encoder->iconv_out, xmlBufEnd(out),
- &c_out, xmlBufContent(in), &c_in);
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- writtentot += c_out;
- if (ret == -1) {
- if (c_out > 0) {
- /*
- * Can be a limitation of iconv
- */
- charref_len = 0;
- goto retry;
- }
- ret = -3;
- }
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef LIBXML_ICU_ENABLED
- else if (output->encoder->uconv_out != NULL) {
- ret = xmlUconvWrapper(output->encoder->uconv_out, 0, xmlBufEnd(out),
- &c_out, xmlBufContent(in), &c_in);
- xmlBufShrink(in, c_in);
- xmlBufAddLen(out, c_out);
- writtentot += c_out;
- if (ret == -1) {
- if (c_out > 0) {
- /*
- * Can be a limitation of uconv
- */
- charref_len = 0;
- goto retry;
- }
- ret = -3;
- }
- }
-#endif /* LIBXML_ICU_ENABLED */
- else {
- xmlEncodingErr(XML_I18N_NO_OUTPUT,
- "xmlCharEncOutFunc: no output function !\n", NULL);
- return(-1);
- }
-
- if (ret >= 0) output += ret;
/*
* Attempt to handle error cases
@@ -2555,47 +2483,44 @@ retry:
c_in, c_out, (int) xmlBufUse(in));
#endif
break;
+ case -4:
+ xmlEncodingErr(XML_I18N_NO_OUTPUT,
+ "xmlCharEncOutFunc: no output function !\n", NULL);
+ ret = -1;
+ break;
case -2: {
+ xmlChar charref[20];
int len = (int) xmlBufUse(in);
xmlChar *content = xmlBufContent(in);
- int cur;
+ int cur, charrefLen;
cur = xmlGetUTF8Char(content, &len);
- if ((charref_len != 0) && (c_out < charref_len)) {
- /*
- * We attempted to insert a character reference and failed.
- * Undo what was written and skip the remaining charref.
- */
- xmlBufErase(out, c_out);
- writtentot -= c_out;
- xmlBufShrink(in, charref_len - c_out);
- charref_len = 0;
-
- ret = -1;
+ if (cur <= 0)
break;
- } else if (cur > 0) {
- xmlChar charref[20];
#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "handling output conversion error\n");
- xmlGenericError(xmlGenericErrorContext,
- "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- content[0], content[1],
- content[2], content[3]);
+ xmlGenericError(xmlGenericErrorContext,
+ "handling output conversion error\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
+ content[0], content[1],
+ content[2], content[3]);
#endif
- /*
- * Removes the UTF8 sequence, and replace it by a charref
- * and continue the transcoding phase, hoping the error
- * did not mangle the encoder state.
- */
- charref_len = snprintf((char *) &charref[0], sizeof(charref),
- "&#%d;", cur);
- xmlBufShrink(in, len);
- xmlBufAddHead(in, charref, -1);
-
- goto retry;
- } else {
+ /*
+ * Removes the UTF8 sequence, and replace it by a charref
+ * and continue the transcoding phase, hoping the error
+ * did not mangle the encoder state.
+ */
+ charrefLen = snprintf((char *) &charref[0], sizeof(charref),
+ "&#%d;", cur);
+ xmlBufShrink(in, len);
+ xmlBufGrow(out, charrefLen * 4);
+ c_out = xmlBufAvail(out) - 1;
+ c_in = charrefLen;
+ ret = xmlEncOutputChunk(output->encoder, xmlBufEnd(out), &c_out,
+ charref, &c_in);
+
+ if ((ret < 0) || (c_in != charrefLen)) {
char buf[50];
snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
@@ -2607,8 +2532,12 @@ retry:
buf);
if (xmlBufGetAllocationScheme(in) != XML_BUFFER_ALLOC_IMMUTABLE)
content[0] = ' ';
+ break;
}
- break;
+
+ xmlBufAddLen(out, c_out);
+ writtentot += c_out;
+ goto retry;
}
}
return(ret);
@@ -2636,12 +2565,11 @@ retry:
int
xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in) {
- int ret = -2;
+ int ret;
int written;
int writtentot = 0;
int toconv;
int output = 0;
- int charref_len = 0;
if (handler == NULL) return(-1);
if (out == NULL) return(-1);
@@ -2658,31 +2586,11 @@ retry:
*/
if (in == NULL) {
toconv = 0;
- if (handler->output != NULL) {
- ret = handler->output(&out->content[out->use], &written,
- NULL, &toconv);
- if (ret >= 0) { /* Gennady: check return value */
- out->use += written;
- out->content[out->use] = 0;
- }
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (handler->iconv_out != NULL) {
- ret = xmlIconvWrapper(handler->iconv_out, &out->content[out->use],
- &written, NULL, &toconv);
- out->use += written;
- out->content[out->use] = 0;
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef LIBXML_ICU_ENABLED
- else if (handler->uconv_out != NULL) {
- ret = xmlUconvWrapper(handler->uconv_out, 0,
- &out->content[out->use],
- &written, NULL, &toconv);
- out->use += written;
- out->content[out->use] = 0;
- }
-#endif /* LIBXML_ICU_ENABLED */
+ /* TODO: Check return value. */
+ xmlEncOutputChunk(handler, &out->content[out->use], &written,
+ NULL, &toconv);
+ out->use += written;
+ out->content[out->use] = 0;
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"initialized encoder\n");
@@ -2700,61 +2608,18 @@ retry:
xmlBufferGrow(out, toconv * 4);
written = out->size - out->use - 1;
}
- if (handler->output != NULL) {
- ret = handler->output(&out->content[out->use], &written,
- in->content, &toconv);
- if (written > 0) {
- xmlBufferShrink(in, toconv);
- out->use += written;
- writtentot += written;
- }
- out->content[out->use] = 0;
- }
-#ifdef LIBXML_ICONV_ENABLED
- else if (handler->iconv_out != NULL) {
- ret = xmlIconvWrapper(handler->iconv_out, &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- writtentot += written;
- out->content[out->use] = 0;
- if (ret == -1) {
- if (written > 0) {
- /*
- * Can be a limitation of iconv
- */
- charref_len = 0;
- goto retry;
- }
- ret = -3;
- }
- }
-#endif /* LIBXML_ICONV_ENABLED */
-#ifdef LIBXML_ICU_ENABLED
- else if (handler->uconv_out != NULL) {
- ret = xmlUconvWrapper(handler->uconv_out, 0,
- &out->content[out->use],
- &written, in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- writtentot += written;
- out->content[out->use] = 0;
- if (ret == -1) {
- if (written > 0) {
- /*
- * Can be a limitation of iconv
- */
- charref_len = 0;
- goto retry;
- }
- ret = -3;
- }
- }
-#endif /* LIBXML_ICU_ENABLED */
- else {
- xmlEncodingErr(XML_I18N_NO_OUTPUT,
- "xmlCharEncOutFunc: no output function !\n", NULL);
- return(-1);
+ ret = xmlEncOutputChunk(handler, &out->content[out->use], &written,
+ in->content, &toconv);
+ xmlBufferShrink(in, toconv);
+ out->use += written;
+ writtentot += written;
+ out->content[out->use] = 0;
+ if (ret == -1) {
+ if (written > 0) {
+ /* Can be a limitation of iconv or uconv */
+ goto retry;
+ }
+ ret = -3;
}
if (ret >= 0) output += ret;
@@ -2782,47 +2647,44 @@ retry:
toconv, written, in->use);
#endif
break;
+ case -4:
+ xmlEncodingErr(XML_I18N_NO_OUTPUT,
+ "xmlCharEncOutFunc: no output function !\n", NULL);
+ ret = -1;
+ break;
case -2: {
+ xmlChar charref[20];
int len = in->use;
const xmlChar *utf = (const xmlChar *) in->content;
- int cur;
+ int cur, charrefLen;
cur = xmlGetUTF8Char(utf, &len);
- if ((charref_len != 0) && (written < charref_len)) {
- /*
- * We attempted to insert a character reference and failed.
- * Undo what was written and skip the remaining charref.
- */
- out->use -= written;
- writtentot -= written;
- xmlBufferShrink(in, charref_len - written);
- charref_len = 0;
-
- ret = -1;
+ if (cur <= 0)
break;
- } else if (cur > 0) {
- xmlChar charref[20];
#ifdef DEBUG_ENCODING
- xmlGenericError(xmlGenericErrorContext,
- "handling output conversion error\n");
- xmlGenericError(xmlGenericErrorContext,
- "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
- in->content[0], in->content[1],
- in->content[2], in->content[3]);
+ xmlGenericError(xmlGenericErrorContext,
+ "handling output conversion error\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
+ in->content[0], in->content[1],
+ in->content[2], in->content[3]);
#endif
- /*
- * Removes the UTF8 sequence, and replace it by a charref
- * and continue the transcoding phase, hoping the error
- * did not mangle the encoder state.
- */
- charref_len = snprintf((char *) &charref[0], sizeof(charref),
- "&#%d;", cur);
- xmlBufferShrink(in, len);
- xmlBufferAddHead(in, charref, -1);
-
- goto retry;
- } else {
+ /*
+ * Removes the UTF8 sequence, and replace it by a charref
+ * and continue the transcoding phase, hoping the error
+ * did not mangle the encoder state.
+ */
+ charrefLen = snprintf((char *) &charref[0], sizeof(charref),
+ "&#%d;", cur);
+ xmlBufferShrink(in, len);
+ xmlBufferGrow(out, charrefLen * 4);
+ written = out->size - out->use - 1;
+ toconv = charrefLen;
+ ret = xmlEncOutputChunk(handler, &out->content[out->use], &written,
+ charref, &toconv);
+
+ if ((ret < 0) || (toconv != charrefLen)) {
char buf[50];
snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
@@ -2834,8 +2696,13 @@ retry:
buf);
if (in->alloc != XML_BUFFER_ALLOC_IMMUTABLE)
in->content[0] = ' ';
+ break;
}
- break;
+
+ out->use += written;
+ writtentot += written;
+ out->content[out->use] = 0;
+ goto retry;
}
}
return(ret);
@@ -2954,54 +2821,20 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) {
int ret;
- if (handler->output != NULL) {
- do {
- toconv = in->end - cur;
- written = 32000;
- ret = handler->output(&convbuf[0], &written,
- cur, &toconv);
- if (ret == -1) return(-1);
- unused += written;
- cur += toconv;
- } while (ret == -2);
-#ifdef LIBXML_ICONV_ENABLED
- } else if (handler->iconv_out != NULL) {
- do {
- toconv = in->end - cur;
- written = 32000;
- ret = xmlIconvWrapper(handler->iconv_out, &convbuf[0],
- &written, cur, &toconv);
- if (ret < 0) {
- if (written > 0)
- ret = -2;
- else
- return(-1);
- }
- unused += written;
- cur += toconv;
- } while (ret == -2);
-#endif
-#ifdef LIBXML_ICU_ENABLED
- } else if (handler->uconv_out != NULL) {
- do {
- toconv = in->end - cur;
- written = 32000;
- ret = xmlUconvWrapper(handler->uconv_out, 0, &convbuf[0],
- &written, cur, &toconv);
- if (ret < 0) {
- if (written > 0)
- ret = -2;
- else
- return(-1);
- }
- unused += written;
- cur += toconv;
- } while (ret == -2);
-#endif
- } else {
- /* could not find a converter */
- return(-1);
- }
+ do {
+ toconv = in->end - cur;
+ written = 32000;
+ ret = xmlEncOutputChunk(handler, &convbuf[0], &written,
+ cur, &toconv);
+ if (ret < 0) {
+ if (written > 0)
+ ret = -2;
+ else
+ return(-1);
+ }
+ unused += written;
+ cur += toconv;
+ } while (ret == -2);
}
if (in->buf->rawconsumed < unused)
return(-1);
diff --git a/chromium/third_party/libxml/src/entities.c b/chromium/third_party/libxml/src/entities.c
index 2851e2d4311..e4a09d62985 100644
--- a/chromium/third_party/libxml/src/entities.c
+++ b/chromium/third_party/libxml/src/entities.c
@@ -6,6 +6,11 @@
* daniel@veillard.com
*/
+/* To avoid EBCDIC trouble when parsing on zOS */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
+
#define IN_LIBXML
#include "libxml.h"
@@ -881,10 +886,9 @@ xmlCreateEntitiesTable(void) {
* Deallocate the memory used by an entities in the hash table.
*/
static void
-xmlFreeEntityWrapper(xmlEntityPtr entity,
- const xmlChar *name ATTRIBUTE_UNUSED) {
+xmlFreeEntityWrapper(void *entity, const xmlChar *name ATTRIBUTE_UNUSED) {
if (entity != NULL)
- xmlFreeEntity(entity);
+ xmlFreeEntity((xmlEntityPtr) entity);
}
/**
@@ -895,7 +899,7 @@ xmlFreeEntityWrapper(xmlEntityPtr entity,
*/
void
xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntityWrapper);
+ xmlHashFree(table, xmlFreeEntityWrapper);
}
#ifdef LIBXML_TREE_ENABLED
@@ -907,8 +911,9 @@ xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
*
* Returns the new xmlEntitiesPtr or NULL in case of error.
*/
-static xmlEntityPtr
-xmlCopyEntity(xmlEntityPtr ent) {
+static void *
+xmlCopyEntity(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlEntityPtr ent = (xmlEntityPtr) payload;
xmlEntityPtr cur;
cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));
@@ -946,7 +951,7 @@ xmlCopyEntity(xmlEntityPtr ent) {
*/
xmlEntitiesTablePtr
xmlCopyEntitiesTable(xmlEntitiesTablePtr table) {
- return(xmlHashCopy(table, (xmlHashCopier) xmlCopyEntity));
+ return(xmlHashCopy(table, xmlCopyEntity));
}
#endif /* LIBXML_TREE_ENABLED */
@@ -1087,8 +1092,9 @@ xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) {
* When using the hash table scan function, arguments need to be reversed
*/
static void
-xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) {
- xmlDumpEntityDecl(buf, ent);
+xmlDumpEntityDeclScan(void *ent, void *buf,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlDumpEntityDecl((xmlBufferPtr) buf, (xmlEntityPtr) ent);
}
/**
@@ -1100,7 +1106,7 @@ xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) {
*/
void
xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) {
- xmlHashScan(table, (xmlHashScanner)xmlDumpEntityDeclScan, buf);
+ xmlHashScan(table, xmlDumpEntityDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
#define bottom_entities
diff --git a/chromium/third_party/libxml/src/error.c b/chromium/third_party/libxml/src/error.c
index 9606f1357e0..9d39f79e346 100644
--- a/chromium/third_party/libxml/src/error.c
+++ b/chromium/third_party/libxml/src/error.c
@@ -631,7 +631,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
(channel == xmlParserValidityError) ||
(channel == xmlParserValidityWarning))
xmlReportError(to, ctxt, str, NULL, NULL);
- else if ((channel == (xmlGenericErrorFunc) fprintf) ||
+ else if (((void(*)(void)) channel == (void(*)(void)) fprintf) ||
(channel == xmlGenericErrorDefaultFunc))
xmlReportError(to, ctxt, str, channel, data);
else
@@ -853,7 +853,7 @@ xmlParserValidityWarning(void *ctx, const char *msg, ...)
* Get the last global error registered. This is per thread if compiled
* with thread support.
*
- * Returns NULL if no error occured or a pointer to the error
+ * Returns NULL if no error occurred or a pointer to the error
*/
xmlErrorPtr
xmlGetLastError(void)
@@ -910,7 +910,7 @@ xmlResetLastError(void)
*
* Get the last parsing error registered.
*
- * Returns NULL if no error occured or a pointer to the error
+ * Returns NULL if no error occurred or a pointer to the error
*/
xmlErrorPtr
xmlCtxtGetLastError(void *ctx)
diff --git a/chromium/third_party/libxml/src/genUnicode.py b/chromium/third_party/libxml/src/genUnicode.py
index 56e4e9ba2ab..4487eeb5cac 100755
--- a/chromium/third_party/libxml/src/genUnicode.py
+++ b/chromium/third_party/libxml/src/genUnicode.py
@@ -267,14 +267,14 @@ typedef struct {
} xmlUnicodeRange;
typedef struct {
- xmlUnicodeRange *table;
+ const xmlUnicodeRange *table;
int numentries;
} xmlUnicodeNameTable;
static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname);
-static xmlUnicodeRange xmlUnicodeBlocks[] = {
+static const xmlUnicodeRange xmlUnicodeBlocks[] = {
""" % (webpage, date, sources));
flag = 0
diff --git a/chromium/third_party/libxml/src/gentest.py b/chromium/third_party/libxml/src/gentest.py
index f1786205020..b76330047f3 100755
--- a/chromium/third_party/libxml/src/gentest.py
+++ b/chromium/third_party/libxml/src/gentest.py
@@ -399,14 +399,20 @@ def type_convert(str, name, info, module, function, pos):
known_param_types = []
-def is_known_param_type(name, rtype):
- global test
+def is_known_param_type(name):
for type in known_param_types:
if type == name:
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
for type in generated_param_types:
if type == name:
- return 1
+ return
if name[-3:] == 'Ptr' or name[-4:] == '_ptr':
if rtype[0:6] == 'const ':
@@ -429,9 +435,6 @@ static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTR
if define == 1:
test.write("#endif\n\n")
add_generated_param_type(name)
- return 1
-
- return 0
#
# Provide the type destructors for the return values
@@ -546,7 +549,7 @@ for enum in enums:
continue;
define = 0
- if argtypes.has_key(name) and is_known_param_type(name, name) == 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 = []
@@ -689,7 +692,7 @@ def generate_test(module, node):
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, rtype) == 0:
+ if is_known_param_type(type) == 0:
add_missing_type(type, name);
no_gen = 1
if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
@@ -716,6 +719,11 @@ def generate_test(module, node):
t_ret = (type, rtype, info)
break
+ if no_gen == 0:
+ for t_arg in t_args:
+ (nam, type, rtype, crtype, info) = t_arg
+ generate_param_type(type, rtype)
+
test.write("""
static int
test_%s(void) {
@@ -782,6 +790,24 @@ test_%s(void) {
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;
+ for arg in t_args:
+ (nam, type, rtype, crtype, info) = arg;
+ # 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)):
+ (bnam, btype) = t_args[j][:2]
+ if btype == "const_char_ptr" or btype == "const_xmlChar_ptr":
+ test.write(
+ " if ((%s != NULL) &&\n"
+ " (%s > (int) strlen((const char *) %s) + 1))\n"
+ " continue;\n"
+ % (bnam, nam, bnam))
+ break
+ 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]))
diff --git a/chromium/third_party/libxml/src/globals.c b/chromium/third_party/libxml/src/globals.c
index e351b03ff5c..20b430880ab 100644
--- a/chromium/third_party/libxml/src/globals.c
+++ b/chromium/third_party/libxml/src/globals.c
@@ -92,7 +92,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
*
* The variable holding the libxml free() implementation
*/
-xmlFreeFunc xmlFree = (xmlFreeFunc) free;
+xmlFreeFunc xmlFree = free;
/**
* xmlMalloc:
* @size: the size requested in bytes
@@ -101,7 +101,7 @@ xmlFreeFunc xmlFree = (xmlFreeFunc) free;
*
* Returns a pointer to the newly allocated block or NULL in case of error
*/
-xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
+xmlMallocFunc xmlMalloc = malloc;
/**
* xmlMallocAtomic:
* @size: the size requested in bytes
@@ -112,7 +112,7 @@ xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
*
* Returns a pointer to the newly allocated block or NULL in case of error
*/
-xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
+xmlMallocFunc xmlMallocAtomic = malloc;
/**
* xmlRealloc:
* @mem: an already allocated block of memory
@@ -122,7 +122,19 @@ xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
*
* Returns a pointer to the newly reallocated block or NULL in case of error
*/
-xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
+xmlReallocFunc xmlRealloc = realloc;
+/**
+ * xmlPosixStrdup
+ * @cur: the input char *
+ *
+ * a strdup implementation with a type signature matching POSIX
+ *
+ * Returns a new xmlChar * or NULL
+ */
+static char *
+xmlPosixStrdup(const char *cur) {
+ return((char*) xmlCharStrdup(cur));
+}
/**
* xmlMemStrdup:
* @str: a zero terminated string
@@ -131,7 +143,7 @@ xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
*
* Returns the copy of the string or NULL in case of error
*/
-xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
+xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
#include <libxml/threads.h>
diff --git a/chromium/third_party/libxml/src/hash.c b/chromium/third_party/libxml/src/hash.c
index f9a20172244..b0b4abc92e4 100644
--- a/chromium/third_party/libxml/src/hash.c
+++ b/chromium/third_party/libxml/src/hash.c
@@ -168,7 +168,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
*
* Create a new xmlHashTablePtr.
*
- * Returns the newly created object, or NULL if an error occured.
+ * Returns the newly created object, or NULL if an error occurred.
*/
xmlHashTablePtr
xmlHashCreate(int size) {
@@ -202,7 +202,7 @@ xmlHashCreate(int size) {
*
* Create a new xmlHashTablePtr which will use @dict as the internal dictionary
*
- * Returns the newly created object, or NULL if an error occured.
+ * Returns the newly created object, or NULL if an error occurred.
*/
xmlHashTablePtr
xmlHashCreateDict(int size, xmlDictPtr dict) {
@@ -361,6 +361,18 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) {
}
/**
+ * xmlHashDefaultDeallocator:
+ * @entry: the hash table entry
+ * @name: the entry's name
+ *
+ * Free a hash table entry with xmlFree.
+ */
+void
+xmlHashDefaultDeallocator(void *entry, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlFree(entry);
+}
+
+/**
* xmlHashAddEntry:
* @table: the hash table
* @name: the name of the userdata
@@ -912,8 +924,11 @@ void
xmlHashScan3(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3,
xmlHashScanner f, void *data) {
- xmlHashScanFull3 (table, name, name2, name3,
- (xmlHashScannerFull) f, data);
+ stubData stubdata;
+ stubdata.data = data;
+ stubdata.hashscanner = f;
+ xmlHashScanFull3(table, name, name2, name3, stubHashScannerFull,
+ &stubdata);
}
/**
diff --git a/chromium/third_party/libxml/src/include/libxml/HTMLparser.h b/chromium/third_party/libxml/src/include/libxml/HTMLparser.h
index 551186cb0cc..1d4fec2f734 100644
--- a/chromium/third_party/libxml/src/include/libxml/HTMLparser.h
+++ b/chromium/third_party/libxml/src/include/libxml/HTMLparser.h
@@ -115,12 +115,12 @@ XMLPUBFUN htmlParserCtxtPtr XMLCALL
XMLPUBFUN int XMLCALL
htmlParseDocument(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlDocPtr XMLCALL
- htmlSAXParseDoc (xmlChar *cur,
+ htmlSAXParseDoc (const xmlChar *cur,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
- htmlParseDoc (xmlChar *cur,
+ htmlParseDoc (const xmlChar *cur,
const char *encoding);
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseFile(const char *filename,
diff --git a/chromium/third_party/libxml/src/include/libxml/encoding.h b/chromium/third_party/libxml/src/include/libxml/encoding.h
index 7967cc66a96..c875af6fb7c 100644
--- a/chromium/third_party/libxml/src/include/libxml/encoding.h
+++ b/chromium/third_party/libxml/src/include/libxml/encoding.h
@@ -129,9 +129,14 @@ typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
* If iconv is supported, there are two extra fields.
*/
#ifdef LIBXML_ICU_ENABLED
+/* Size of pivot buffer, same as icu/source/common/ucnv.cpp CHUNK_SIZE */
+#define ICU_PIVOT_BUF_SIZE 1024
struct _uconv_t {
UConverter *uconv; /* for conversion between an encoding and UTF-16 */
UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
+ UChar pivot_buf[ICU_PIVOT_BUF_SIZE];
+ UChar *pivot_source;
+ UChar *pivot_target;
};
typedef struct _uconv_t uconv_t;
#endif
diff --git a/chromium/third_party/libxml/src/include/libxml/globals.h b/chromium/third_party/libxml/src/include/libxml/globals.h
index a9305aa97e8..5e41b7bb5f8 100644
--- a/chromium/third_party/libxml/src/include/libxml/globals.h
+++ b/chromium/third_party/libxml/src/include/libxml/globals.h
@@ -17,7 +17,6 @@
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
-#include <libxml/SAX.h>
#include <libxml/SAX2.h>
#include <libxml/xmlmemory.h>
diff --git a/chromium/third_party/libxml/src/include/libxml/hash.h b/chromium/third_party/libxml/src/include/libxml/hash.h
index dc8ab7ec52c..6352874ef26 100644
--- a/chromium/third_party/libxml/src/include/libxml/hash.h
+++ b/chromium/third_party/libxml/src/include/libxml/hash.h
@@ -66,7 +66,7 @@ extern "C" {
*
* Callback to free data from a hash.
*/
-typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
+typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
/**
* xmlHashCopier:
* @payload: the data in the hash
@@ -76,7 +76,7 @@ typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
*
* Returns a copy of the data or NULL in case of error.
*/
-typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
+typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name);
/**
* xmlHashScanner:
* @payload: the data in the hash
@@ -85,7 +85,7 @@ typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
*
* Callback when scanning data in a hash with the simple scanner.
*/
-typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name);
+typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name);
/**
* xmlHashScannerFull:
* @payload: the data in the hash
@@ -111,6 +111,9 @@ XMLPUBFUN xmlHashTablePtr XMLCALL
XMLPUBFUN void XMLCALL
xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f);
+XMLPUBFUN void XMLCALL
+ xmlHashDefaultDeallocator(void *entry,
+ const xmlChar *name);
/*
* Add a new entry to the hash table.
diff --git a/chromium/third_party/libxml/src/include/libxml/list.h b/chromium/third_party/libxml/src/include/libxml/list.h
index 0504e0cff4a..3211c755247 100644
--- a/chromium/third_party/libxml/src/include/libxml/list.h
+++ b/chromium/third_party/libxml/src/include/libxml/list.h
@@ -49,7 +49,7 @@ typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
*
* Returns 0 to stop walking the list, 1 otherwise.
*/
-typedef int (*xmlListWalker) (const void *data, const void *user);
+typedef int (*xmlListWalker) (const void *data, void *user);
/* Creation/Deletion */
XMLPUBFUN xmlListPtr XMLCALL
@@ -110,11 +110,11 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlListWalk (xmlListPtr l,
xmlListWalker walker,
- const void *user);
+ void *user);
XMLPUBFUN void XMLCALL
xmlListReverseWalk (xmlListPtr l,
xmlListWalker walker,
- const void *user);
+ void *user);
XMLPUBFUN void XMLCALL
xmlListMerge (xmlListPtr l1,
xmlListPtr l2);
diff --git a/chromium/third_party/libxml/src/include/libxml/nanoftp.h b/chromium/third_party/libxml/src/include/libxml/nanoftp.h
index abb4bf7142b..7335faf1075 100644
--- a/chromium/third_party/libxml/src/include/libxml/nanoftp.h
+++ b/chromium/third_party/libxml/src/include/libxml/nanoftp.h
@@ -16,7 +16,7 @@
#ifdef LIBXML_FTP_ENABLED
/* Needed for portability to Windows 64 bits */
-#if defined(__MINGW32__) || defined(_WIN32_WCE)
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include <winsock2.h>
#else
/**
diff --git a/chromium/third_party/libxml/src/include/libxml/schemasInternals.h b/chromium/third_party/libxml/src/include/libxml/schemasInternals.h
index c7cf55255a0..6fb71139ce9 100644
--- a/chromium/third_party/libxml/src/include/libxml/schemasInternals.h
+++ b/chromium/third_party/libxml/src/include/libxml/schemasInternals.h
@@ -3,7 +3,7 @@
* Description: internal interfaces for the XML Schemas handling
* and schema validity checking
* The Schemas development is a Work In Progress.
- * Some of those interfaces are not garanteed to be API or ABI stable !
+ * Some of those interfaces are not guaranteed to be API or ABI stable !
*
* 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 d31f16acbd4..9969ae7cfd0 100644
--- a/chromium/third_party/libxml/src/include/libxml/threads.h
+++ b/chromium/third_party/libxml/src/include/libxml/threads.h
@@ -72,8 +72,13 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN xmlGlobalStatePtr XMLCALL
xmlGetGlobalState(void);
-#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
-int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved);
+#ifdef HAVE_PTHREAD_H
+#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
+#if defined(LIBXML_STATIC_FOR_DLL)
+int XMLCALL
+xmlDllMain(void *hinstDLL, unsigned long fdwReason,
+ void *lpvReserved);
+#endif
#endif
#ifdef __cplusplus
diff --git a/chromium/third_party/libxml/src/include/libxml/tree.h b/chromium/third_party/libxml/src/include/libxml/tree.h
index 4a9b3bc6347..626ed6ae384 100644
--- a/chromium/third_party/libxml/src/include/libxml/tree.h
+++ b/chromium/third_party/libxml/src/include/libxml/tree.h
@@ -575,7 +575,7 @@ struct _xmlDoc {
void *ids; /* Hash table for ID attributes if any */
void *refs; /* Hash table for IDREFs attributes if any */
const xmlChar *URL; /* The URI for that document */
- int charset; /* encoding of the in-memory content
+ int charset; /* Internal flag for charset handling,
actually an xmlCharEncoding */
struct _xmlDict *dict; /* dict used to allocate names or NULL */
void *psvi; /* for type/PSVI informations */
diff --git a/chromium/third_party/libxml/src/include/libxml/xmlexports.h b/chromium/third_party/libxml/src/include/libxml/xmlexports.h
index 2c79f814b45..31ab8a10abd 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlexports.h
+++ b/chromium/third_party/libxml/src/include/libxml/xmlexports.h
@@ -131,8 +131,8 @@
#endif
#endif
-/* Cygwin platform, GNU compiler */
-#if defined(_WIN32) && defined(__CYGWIN__)
+/* Cygwin platform (does not define _WIN32), GNU compiler */
+#if defined(__CYGWIN__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
@@ -145,7 +145,7 @@
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
- #define XMLPUBVAR
+ #define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
diff --git a/chromium/third_party/libxml/src/include/libxml/xmlreader.h b/chromium/third_party/libxml/src/include/libxml/xmlreader.h
index 2c99e3a765d..e8a8bcc9aab 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlreader.h
+++ b/chromium/third_party/libxml/src/include/libxml/xmlreader.h
@@ -393,7 +393,7 @@ typedef void * xmlTextReaderLocatorPtr;
* @arg: the user argument
* @msg: the message
* @severity: the severity of the error
- * @locator: a locator indicating where the error occured
+ * @locator: a locator indicating where the error occurred
*
* Signature of an error callback from a reader parser
*/
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 b173be9e073..d10f9754eac 100644
--- a/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in
+++ b/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in
@@ -410,9 +410,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
/**
* ATTRIBUTE_UNUSED:
diff --git a/chromium/third_party/libxml/src/include/win32config.h b/chromium/third_party/libxml/src/include/win32config.h
index 40cf7df8047..7fc74031400 100644
--- a/chromium/third_party/libxml/src/include/win32config.h
+++ b/chromium/third_party/libxml/src/include/win32config.h
@@ -10,11 +10,9 @@
#if defined(_WIN32_WCE)
#undef HAVE_ERRNO_H
-#include <windows.h>
#include "wincecompat.h"
#else
#define HAVE_SYS_STAT_H
-#define HAVE__STAT
#define HAVE_STAT
#define HAVE_STDLIB_H
#define HAVE_TIME_H
@@ -29,10 +27,6 @@
#define ICONV_CONST const
#endif
-#ifdef NEED_SOCKETS
-#include <wsockcompat.h>
-#endif
-
/*
* Windows platforms may define except
*/
diff --git a/chromium/third_party/libxml/src/include/wsockcompat.h b/chromium/third_party/libxml/src/include/wsockcompat.h
index e6a1a993e77..e57ca8ec56e 100644
--- a/chromium/third_party/libxml/src/include/wsockcompat.h
+++ b/chromium/third_party/libxml/src/include/wsockcompat.h
@@ -8,9 +8,14 @@
#ifdef _WIN32_WCE
#include <winsock.h>
#else
-#undef HAVE_ERRNO_H
+#include <errno.h>
#include <winsock2.h>
+/* Fix for old MinGW. */
+#ifndef _WINSOCKAPI_
+#define _WINSOCKAPI_
+#endif
+
/* the following is a workaround a problem for 'inline' keyword in said
header when compiled with Borland C++ 6 */
#if defined(__BORLANDC__) && !defined(__cplusplus)
@@ -27,60 +32,23 @@
#endif
#endif
-#if defined( __MINGW32__ ) || defined( _MSC_VER )
-/* Include <errno.h> here to ensure that it doesn't get included later
- * (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */
-#include <errno.h>
-#undef EWOULDBLOCK
-#endif
+#undef XML_SOCKLEN_T
+#define XML_SOCKLEN_T int
-#if !defined SOCKLEN_T
-#define SOCKLEN_T int
+#ifndef ECONNRESET
+#define ECONNRESET WSAECONNRESET
+#endif
+#ifndef EINPROGRESS
+#define EINPROGRESS WSAEINPROGRESS
+#endif
+#ifndef EINTR
+#define EINTR WSAEINTR
+#endif
+#ifndef ESHUTDOWN
+#define ESHUTDOWN WSAESHUTDOWN
+#endif
+#ifndef EWOULDBLOCK
+#define EWOULDBLOCK WSAEWOULDBLOCK
#endif
-
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#define ESHUTDOWN WSAESHUTDOWN
-
-#if (!defined(_MSC_VER) || (_MSC_VER < 1600))
-#define EINPROGRESS WSAEINPROGRESS
-#define EALREADY WSAEALREADY
-#define ENOTSOCK WSAENOTSOCK
-#define EDESTADDRREQ WSAEDESTADDRREQ
-#define EMSGSIZE WSAEMSGSIZE
-#define EPROTOTYPE WSAEPROTOTYPE
-#define ENOPROTOOPT WSAENOPROTOOPT
-#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
-#define EOPNOTSUPP WSAEOPNOTSUPP
-#define EPFNOSUPPORT WSAEPFNOSUPPORT
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
-#define EADDRINUSE WSAEADDRINUSE
-#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
-#define ENETDOWN WSAENETDOWN
-#define ENETUNREACH WSAENETUNREACH
-#define ENETRESET WSAENETRESET
-#define ECONNABORTED WSAECONNABORTED
-#define ECONNRESET WSAECONNRESET
-#define ENOBUFS WSAENOBUFS
-#define EISCONN WSAEISCONN
-#define ENOTCONN WSAENOTCONN
-#define ETOOMANYREFS WSAETOOMANYREFS
-#define ETIMEDOUT WSAETIMEDOUT
-#define ECONNREFUSED WSAECONNREFUSED
-#define ELOOP WSAELOOP
-#define EHOSTDOWN WSAEHOSTDOWN
-#define EHOSTUNREACH WSAEHOSTUNREACH
-#define EPROCLIM WSAEPROCLIM
-#define EUSERS WSAEUSERS
-#define EDQUOT WSAEDQUOT
-#define ESTALE WSAESTALE
-#define EREMOTE WSAEREMOTE
-/* These cause conflicts with the codes from errno.h. Since they are
- not used in the relevant code (nanoftp, nanohttp), we can leave
- them disabled.
-#define ENAMETOOLONG WSAENAMETOOLONG
-#define ENOTEMPTY WSAENOTEMPTY
-*/
-#endif /* _MSC_VER */
#endif /* __XML_WSOCKCOMPAT_H__ */
diff --git a/chromium/third_party/libxml/src/libxml.h b/chromium/third_party/libxml/src/libxml.h
index 88e515f5d4c..64e30f77046 100644
--- a/chromium/third_party/libxml/src/libxml.h
+++ b/chromium/third_party/libxml/src/libxml.h
@@ -60,6 +60,18 @@ int vfprintf(FILE *, const char *, va_list);
#include "trio.h"
#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
+
/*
* Internal variable indicating if a callback has been registered for
* node creation/destruction. It avoids spending a lot of time in locking
@@ -96,12 +108,12 @@ int __xmlRandom(void);
#endif
XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg);
-int xmlNop(void);
+int xmlInputReadCallbackNop(void *context, char *buffer, int len);
#ifdef IN_LIBXML
#ifdef __GNUC__
#ifdef PIC
-#ifdef linux
+#ifdef __linux__
#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
#include "elfgcchack.h"
#endif
@@ -109,7 +121,7 @@ int xmlNop(void);
#endif
#endif
#endif
-#if !defined(PIC) && !defined(NOLIBTOOL)
+#if !defined(PIC) && !defined(NOLIBTOOL) && !defined(LIBXML_STATIC)
# define LIBXML_STATIC
#endif
#endif /* ! __XML_LIBXML_H__ */
diff --git a/chromium/third_party/libxml/src/libxml.m4 b/chromium/third_party/libxml/src/libxml.m4
index 68cd8242fbc..2d7a6f53fb8 100644
--- a/chromium/third_party/libxml/src/libxml.m4
+++ b/chromium/third_party/libxml/src/libxml.m4
@@ -170,7 +170,7 @@ main()
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
+ echo "*** exact error that occurred. This usually means LIBXML was incorrectly installed"
echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
CPPFLAGS="$ac_save_CPPFLAGS"
diff --git a/chromium/third_party/libxml/src/libxml.spec.in b/chromium/third_party/libxml/src/libxml.spec.in
index 9029a1806de..d5f5ccbb7dd 100644
--- a/chromium/third_party/libxml/src/libxml.spec.in
+++ b/chromium/third_party/libxml/src/libxml.spec.in
@@ -57,12 +57,15 @@ Requires: libxml2 = %{version}-%{release}
Static library for libxml2 provided for specific uses or shaving a few
microseconds when parsing, do not link to them for generic purpose packages.
-%package python
+%package -n python-%{name}
+%{?python_provide:%python_provide python-%{name}}
Summary: Python bindings for the libxml2 library
Group: Development/Libraries
Requires: libxml2 = %{version}-%{release}
+Obsoletes: %{name}-python < %{version}-%{release}
+Provides: %{name}-python = %{version}-%{release}
-%description python
+%description -n python-%{name}
The libxml2-python package contains a Python 2 module that permits applications
written in the Python programming language, version 2, to use the interface
supplied by the libxml2 library to manipulate XML files.
@@ -73,12 +76,14 @@ this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
%if 0%{?with_python3}
-%package python3
+%package -n python3-%{name}
Summary: Python 3 bindings for the libxml2 library
Group: Development/Libraries
Requires: libxml2 = %{version}-%{release}
+Obsoletes: %{name}-python3 < %{version}-%{release}
+Provides: %{name}-python3 = %{version}-%{release}
-%description python3
+%description -n python3-%{name}
The libxml2-python3 package contains a Python 3 module that permits
applications written in the Python programming language, version 3, to use the
interface supplied by the libxml2 library to manipulate XML files.
@@ -92,10 +97,16 @@ at parse time or later once the document has been modified.
%prep
%setup -q
+mkdir py3doc
+cp doc/*.py py3doc
+sed -i 's|#!/usr/bin/python |#!%{__python3} |' py3doc/*.py
+
%build
%configure
make %{_smp_mflags}
+find doc -type f -exec chmod 0644 \{\} \;
+
%install
rm -fr %{buildroot}
@@ -165,7 +176,7 @@ rm -fr %{buildroot}
%{_libdir}/*a
-%files python
+%files -n python-%{name}
%defattr(-, root, root)
%{_libdir}/python2*/site-packages/libxml2.py*
@@ -178,18 +189,16 @@ rm -fr %{buildroot}
%doc doc/python.html
%if 0%{?with_python3}
-%files python3
+%files -n python3-%{name}
%defattr(-, root, root)
%{_libdir}/python3*/site-packages/libxml2.py*
%{_libdir}/python3*/site-packages/drv_libxml2.py*
-%{_libdir}/python3*/site-packages/__pycache__/libxml2.cpython-34.py*
-%{_libdir}/python3*/site-packages/__pycache__/drv_libxml2.cpython-34.py*
+%{_libdir}/python3*/site-packages/__pycache__/*py*
%{_libdir}/python3*/site-packages/libxml2mod*
%doc python/TODO
%doc python/libxml2class.txt
-%doc python/tests/*.py
-%doc doc/*.py
+%doc py3doc/*.py
%doc doc/python.html
%endif # with_python3
diff --git a/chromium/third_party/libxml/src/libxml2.spec b/chromium/third_party/libxml/src/libxml2.spec
index fe8a30bf4ce..52cbeb835c3 100644
--- a/chromium/third_party/libxml/src/libxml2.spec
+++ b/chromium/third_party/libxml/src/libxml2.spec
@@ -2,7 +2,7 @@
Summary: Library providing XML and HTML support
Name: libxml2
-Version: 2.9.4
+Version: 2.9.9
Release: 1%{?dist}%{?extra_release}
License: MIT
Group: Development/Libraries
@@ -57,12 +57,15 @@ Requires: libxml2 = %{version}-%{release}
Static library for libxml2 provided for specific uses or shaving a few
microseconds when parsing, do not link to them for generic purpose packages.
-%package python
+%package -n python-%{name}
+%{?python_provide:%python_provide python-%{name}}
Summary: Python bindings for the libxml2 library
Group: Development/Libraries
Requires: libxml2 = %{version}-%{release}
+Obsoletes: %{name}-python < %{version}-%{release}
+Provides: %{name}-python = %{version}-%{release}
-%description python
+%description -n python-%{name}
The libxml2-python package contains a Python 2 module that permits applications
written in the Python programming language, version 2, to use the interface
supplied by the libxml2 library to manipulate XML files.
@@ -73,12 +76,14 @@ this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
%if 0%{?with_python3}
-%package python3
+%package -n python3-%{name}
Summary: Python 3 bindings for the libxml2 library
Group: Development/Libraries
Requires: libxml2 = %{version}-%{release}
+Obsoletes: %{name}-python3 < %{version}-%{release}
+Provides: %{name}-python3 = %{version}-%{release}
-%description python3
+%description -n python3-%{name}
The libxml2-python3 package contains a Python 3 module that permits
applications written in the Python programming language, version 3, to use the
interface supplied by the libxml2 library to manipulate XML files.
@@ -92,10 +97,16 @@ at parse time or later once the document has been modified.
%prep
%setup -q
+mkdir py3doc
+cp doc/*.py py3doc
+sed -i 's|#!/usr/bin/python |#!%{__python3} |' py3doc/*.py
+
%build
%configure
make %{_smp_mflags}
+find doc -type f -exec chmod 0644 \{\} \;
+
%install
rm -fr %{buildroot}
@@ -165,7 +176,7 @@ rm -fr %{buildroot}
%{_libdir}/*a
-%files python
+%files -n python-%{name}
%defattr(-, root, root)
%{_libdir}/python2*/site-packages/libxml2.py*
@@ -178,22 +189,20 @@ rm -fr %{buildroot}
%doc doc/python.html
%if 0%{?with_python3}
-%files python3
+%files -n python3-%{name}
%defattr(-, root, root)
%{_libdir}/python3*/site-packages/libxml2.py*
%{_libdir}/python3*/site-packages/drv_libxml2.py*
-%{_libdir}/python3*/site-packages/__pycache__/libxml2.cpython-34.py*
-%{_libdir}/python3*/site-packages/__pycache__/drv_libxml2.cpython-34.py*
+%{_libdir}/python3*/site-packages/__pycache__/*py*
%{_libdir}/python3*/site-packages/libxml2mod*
%doc python/TODO
%doc python/libxml2class.txt
-%doc python/tests/*.py
-%doc doc/*.py
+%doc py3doc/*.py
%doc doc/python.html
%endif # with_python3
%changelog
-* Wed Oct 12 2016 Daniel Veillard <veillard@redhat.com>
-- upstream release 2.9.4 see http://xmlsoft.org/news.html
+* Tue Feb 19 2019 Daniel Veillard <veillard@redhat.com>
+- upstream release 2.9.9 see http://xmlsoft.org/news.html
diff --git a/chromium/third_party/libxml/src/libxml2.syms b/chromium/third_party/libxml/src/libxml2.syms
index 370dcf17701..9889cb20117 100644
--- a/chromium/third_party/libxml/src/libxml2.syms
+++ b/chromium/third_party/libxml/src/libxml2.syms
@@ -2279,3 +2279,10 @@ LIBXML2_2.9.1 {
xmlXPathSetContextNode;
} LIBXML2_2.9.0;
+LIBXML2_2.9.8 {
+ global:
+
+# hash
+ xmlHashDefaultDeallocator;
+} LIBXML2_2.9.1;
+
diff --git a/chromium/third_party/libxml/src/list.c b/chromium/third_party/libxml/src/list.c
index d33d92818a5..24da6b1e9b6 100644
--- a/chromium/third_party/libxml/src/list.c
+++ b/chromium/third_party/libxml/src/list.c
@@ -347,7 +347,7 @@ void xmlListDelete(xmlListPtr l)
*
* Remove the first instance associated to data in the list
*
- * Returns 1 if a deallocation occured, or 0 if not found
+ * Returns 1 if a deallocation occurred, or 0 if not found
*/
int
xmlListRemoveFirst(xmlListPtr l, void *data)
@@ -372,7 +372,7 @@ xmlListRemoveFirst(xmlListPtr l, void *data)
*
* Remove the last instance associated to data in the list
*
- * Returns 1 if a deallocation occured, or 0 if not found
+ * Returns 1 if a deallocation occurred, or 0 if not found
*/
int
xmlListRemoveLast(xmlListPtr l, void *data)
@@ -673,7 +673,7 @@ xmlListSort(xmlListPtr l)
* apply the walker function to it
*/
void
-xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user) {
+xmlListWalk(xmlListPtr l, xmlListWalker walker, void *user) {
xmlLinkPtr lk;
if ((l == NULL) || (walker == NULL))
@@ -694,7 +694,7 @@ xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user) {
* apply the walker function to it
*/
void
-xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, const void *user) {
+xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, void *user) {
xmlLinkPtr lk;
if ((l == NULL) || (walker == NULL))
diff --git a/chromium/third_party/libxml/src/macos/src/XMLTestPrefix.h b/chromium/third_party/libxml/src/macos/src/XMLTestPrefix.h
index 594c9b768b8..3e84255cb61 100644
--- a/chromium/third_party/libxml/src/macos/src/XMLTestPrefix.h
+++ b/chromium/third_party/libxml/src/macos/src/XMLTestPrefix.h
@@ -1 +1 @@
-int test_main(int argc, char **argv);
+int test_main(int argc, char **argv); #define main(X,Y) test_main(X,Y) \ No newline at end of file
diff --git a/chromium/third_party/libxml/src/macos/src/XMLTestPrefix2.h b/chromium/third_party/libxml/src/macos/src/XMLTestPrefix2.h
index 0431ed47144..55df51eabba 100644
--- a/chromium/third_party/libxml/src/macos/src/XMLTestPrefix2.h
+++ b/chromium/third_party/libxml/src/macos/src/XMLTestPrefix2.h
@@ -1 +1 @@
-int test_main(int argc, char* argv[]);
+int test_main(int argc, char* argv[]); #define main() test_main(int argc, char* argv[]) \ No newline at end of file
diff --git a/chromium/third_party/libxml/src/macos/src/config-mac.h b/chromium/third_party/libxml/src/macos/src/config-mac.h
index e9a8f9d9289..ca6f9939410 100644
--- a/chromium/third_party/libxml/src/macos/src/config-mac.h
+++ b/chromium/third_party/libxml/src/macos/src/config-mac.h
@@ -21,27 +21,9 @@
#define HAVE_PTHREAD_H
#define LIBXML_THREAD_ENABLED
-/* Define if you have the _stat function. */
-#define HAVE__STAT
-
-/* Define if you have the class function. */
-#undef HAVE_CLASS
-
-/* Define if you have the finite function. */
-#undef HAVE_FINITE
-
-/* Define if you have the fp_class function. */
-#undef HAVE_FP_CLASS
-
-/* Define if you have the fpclass function. */
-#undef HAVE_FPCLASS
-
/* Define if you have the fprintf function. */
#define HAVE_FPRINTF
-/* Define if you have the isnand function. */
-#undef HAVE_ISNAND
-
/* Define if you have the localtime function. */
#define HAVE_LOCALTIME
@@ -63,18 +45,9 @@
/* Define if you have the stat function. */
#define HAVE_STAT
-/* Define if you have the strdup function. */
-#define HAVE_STRDUP
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR
-
/* Define if you have the strftime function. */
#define HAVE_STRFTIME
-/* Define if you have the strndup function. */
-#define HAVE_STRNDUP
-
/* Define if you have the vfprintf function. */
#define HAVE_VFPRINTF
@@ -84,9 +57,6 @@
/* Define if you have the vsprintf function. */
#define HAVE_VSPRINTF
-/* Define if you have the <ansidecl.h> header file. */
-#define HAVE_ANSIDECL_H
-
/* Define if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H
@@ -108,21 +78,12 @@
/* Define if you have the <float.h> header file. */
#define HAVE_FLOAT_H
-/* Define if you have the <fp_class.h> header file. */
-#define HAVE_FP_CLASS_H
-
-/* Define if you have the <ieeefp.h> header file. */
-#define HAVE_IEEEFP_H
-
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <math.h> header file. */
#define HAVE_MATH_H
-/* Define if you have the <nan.h> header file. */
-#define HAVE_NAN_H
-
/* Define if you have the <ndir.h> header file. */
#define HAVE_NDIR_H
@@ -174,9 +135,6 @@
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H
-/* Define if you have the <zlib.h> header file. */
-#undef HAVE_ZLIB_H
-
/* Name of package */
#define PACKAGE
diff --git a/chromium/third_party/libxml/src/macos/src/libxml2_GUSIConfig.cp b/chromium/third_party/libxml/src/macos/src/libxml2_GUSIConfig.cp
index b5d1feb2d61..77d0c93a646 100644
--- a/chromium/third_party/libxml/src/macos/src/libxml2_GUSIConfig.cp
+++ b/chromium/third_party/libxml/src/macos/src/libxml2_GUSIConfig.cp
@@ -1 +1 @@
-/**************** BEGIN GUSI CONFIGURATION ****************************
+/**************** BEGIN GUSI CONFIGURATION **************************** * * GUSI Configuration section generated by GUSI Configurator * last modified: Wed Oct 31 17:07:45 2001 * * This section will be overwritten by the next run of Configurator. */ #define GUSI_SOURCE #include <GUSIConfig.h> #include <sys/cdefs.h> /* Declarations of Socket Factories */ __BEGIN_DECLS void GUSIwithInetSockets(); void GUSIwithLocalSockets(); void GUSIwithMTInetSockets(); void GUSIwithMTTcpSockets(); void GUSIwithMTUdpSockets(); void GUSIwithOTInetSockets(); void GUSIwithOTTcpSockets(); void GUSIwithOTUdpSockets(); void GUSIwithPPCSockets(); void GUSISetupFactories(); __END_DECLS /* Configure Socket Factories */ void GUSISetupFactories() { #ifdef GUSISetupFactories_BeginHook GUSISetupFactories_BeginHook #endif GUSIwithInetSockets(); #ifdef GUSISetupFactories_EndHook GUSISetupFactories_EndHook #endif } /* Declarations of File Devices */ __BEGIN_DECLS void GUSIwithNullSockets(); void GUSISetupDevices(); __END_DECLS /* Configure File Devices */ void GUSISetupDevices() { #ifdef GUSISetupDevices_BeginHook GUSISetupDevices_BeginHook #endif GUSIwithNullSockets(); #ifdef GUSISetupDevices_EndHook GUSISetupDevices_EndHook #endif } #ifndef __cplusplus #error GUSISetupConfig() needs to be written in C++ #endif GUSIConfiguration::FileSuffix sSuffices[] = { "", '????', '????' }; extern "C" void GUSISetupConfig() { GUSIConfiguration * config = GUSIConfiguration::CreateInstance(GUSIConfiguration::kNoResource); config->ConfigureDefaultTypeCreator('TEXT', 'CWIE'); config->ConfigureSuffices( sizeof(sSuffices)/sizeof(GUSIConfiguration::FileSuffix)-1, sSuffices); } /**************** END GUSI CONFIGURATION *************************/ \ No newline at end of file
diff --git a/chromium/third_party/libxml/src/macos/src/macos_main.c b/chromium/third_party/libxml/src/macos/src/macos_main.c
index 4187dfc5ced..262500038fb 100644
--- a/chromium/third_party/libxml/src/macos/src/macos_main.c
+++ b/chromium/third_party/libxml/src/macos/src/macos_main.c
@@ -1 +1 @@
-#include <GUSICommandLine.h>
+#include <GUSICommandLine.h> #include <stdlib.h> #undef main DECLARE_MAIN(test) REGISTER_MAIN_START REGISTER_MAIN(test) REGISTER_MAIN_END int main() { (void) exec_commands(); return 0; } \ No newline at end of file
diff --git a/chromium/third_party/libxml/src/nanoftp.c b/chromium/third_party/libxml/src/nanoftp.c
index 2135ab9b08b..54fa026d1bc 100644
--- a/chromium/third_party/libxml/src/nanoftp.c
+++ b/chromium/third_party/libxml/src/nanoftp.c
@@ -12,8 +12,6 @@
#define HAVE_NETINET_IN_H
#define HAVE_NETDB_H
#define HAVE_SYS_TIME_H
-#else /* TESTING */
-#define NEED_SOCKETS
#endif /* TESTING */
#define IN_LIBXML
@@ -77,14 +75,8 @@
#endif
-#if defined(__MINGW32__) || defined(_WIN32_WCE)
-#ifndef _WINSOCKAPI_
-#define _WINSOCKAPI_
-#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include <wsockcompat.h>
-#include <winsock2.h>
-#undef XML_SOCKLEN_T
-#define XML_SOCKLEN_T unsigned int
#endif
/**
@@ -511,6 +503,8 @@ xmlNanoFTPFreeCtxt(void * ctx) {
if (ctxt->hostname != NULL) xmlFree(ctxt->hostname);
if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
if (ctxt->path != NULL) xmlFree(ctxt->path);
+ if (ctxt->user != NULL) xmlFree(ctxt->user);
+ if (ctxt->passwd != NULL) xmlFree(ctxt->passwd);
ctxt->passive = 1;
if (ctxt->controlFd != INVALID_SOCKET) closesocket(ctxt->controlFd);
ctxt->controlFd = INVALID_SOCKET;
@@ -907,7 +901,7 @@ xmlNanoFTPConnect(void *ctx) {
__xmlIOErr(XML_FROM_FTP, 0, "getaddrinfo failed");
return (-1);
}
- if (tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) {
+ if ((size_t)tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) {
if (result)
freeaddrinfo (result);
__xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch");
@@ -1042,6 +1036,7 @@ xmlNanoFTPConnect(void *ctx) {
case 2:
if (proxyPasswd == NULL)
break;
+ /* Falls through. */
case 3:
if (proxyPasswd != NULL)
snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
@@ -1111,6 +1106,7 @@ xmlNanoFTPConnect(void *ctx) {
ctxt->controlFd = INVALID_SOCKET;
return(-1);
}
+ /* Falls through. */
case 2:
/* USER user@host command */
if (ctxt->user == NULL)
@@ -1164,6 +1160,7 @@ xmlNanoFTPConnect(void *ctx) {
ctxt->controlFd = INVALID_SOCKET;
return(-1);
}
+ /* Falls through. */
case 3:
/*
* If you need support for other Proxy authentication scheme
@@ -1212,6 +1209,7 @@ xmlNanoFTPConnect(void *ctx) {
case 3:
__xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT,
"FTP server asking for ACCNT on anonymous\n");
+ /* Falls through. */
case 1:
case 4:
case 5:
diff --git a/chromium/third_party/libxml/src/nanohttp.c b/chromium/third_party/libxml/src/nanohttp.c
index e109ad753c6..2143718a142 100644
--- a/chromium/third_party/libxml/src/nanohttp.c
+++ b/chromium/third_party/libxml/src/nanohttp.c
@@ -11,7 +11,6 @@
* daniel@veillard.com
*/
-#define NEED_SOCKETS
#define IN_LIBXML
#include "libxml.h"
@@ -64,7 +63,7 @@
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
@@ -74,14 +73,8 @@
#define XML_SOCKLEN_T unsigned int
#endif
-#if defined(__MINGW32__) || defined(_WIN32_WCE)
-#ifndef _WINSOCKAPI_
-#define _WINSOCKAPI_
-#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include <wsockcompat.h>
-#include <winsock2.h>
-#undef XML_SOCKLEN_T
-#define XML_SOCKLEN_T unsigned int
#endif
#include <libxml/globals.h>
@@ -152,7 +145,7 @@ typedef struct xmlNanoHTTPCtxt {
char *authHeader; /* contents of {WWW,Proxy}-Authenticate header */
char *encoding; /* encoding extracted from the contentType */
char *mimeType; /* Mime-Type extracted from the contentType */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
z_stream *strm; /* Zlib stream object */
int usesGzip; /* "Content-Encoding: gzip" was detected */
#endif
@@ -182,7 +175,21 @@ xmlHTTPErrMemory(const char *extra)
*/
static int socket_errno(void) {
#ifdef _WINSOCKAPI_
- return(WSAGetLastError());
+ int err = WSAGetLastError();
+ switch(err) {
+ case WSAECONNRESET:
+ return(ECONNRESET);
+ case WSAEINPROGRESS:
+ return(EINPROGRESS);
+ case WSAEINTR:
+ return(EINTR);
+ case WSAESHUTDOWN:
+ return(ESHUTDOWN);
+ case WSAEWOULDBLOCK:
+ return(EWOULDBLOCK);
+ default:
+ return(err);
+ }
#else
return(errno);
#endif
@@ -427,7 +434,7 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) {
if (ctxt->mimeType != NULL) xmlFree(ctxt->mimeType);
if (ctxt->location != NULL) xmlFree(ctxt->location);
if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (ctxt->strm != NULL) {
inflateEnd(ctxt->strm);
xmlFree(ctxt->strm);
@@ -629,7 +636,7 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt)
if ((select(ctxt->fd + 1, &rfd, NULL, NULL, &tv) < 1)
#if defined(EINTR)
- && (errno != EINTR)
+ && (socket_errno() != EINTR)
#endif
)
return (0);
@@ -810,7 +817,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
if (ctxt->authHeader != NULL)
xmlFree(ctxt->authHeader);
ctxt->authHeader = xmlMemStrdup(cur);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
} else if ( !xmlStrncasecmp( BAD_CAST line, BAD_CAST"Content-Encoding:", 17) ) {
cur += 17;
while ((*cur == ' ') || (*cur == '\t')) cur++;
@@ -1038,16 +1045,13 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
static SOCKET
xmlNanoHTTPConnectHost(const char *host, int port)
{
- struct hostent *h;
struct sockaddr *addr = NULL;
- struct in_addr ia;
struct sockaddr_in sockin;
#ifdef SUPPORT_IP6
struct in6_addr ia6;
struct sockaddr_in6 sockin6;
#endif
- int i;
SOCKET s;
memset (&sockin, 0, sizeof(sockin));
@@ -1084,7 +1088,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
for (res = result; res; res = res->ai_next) {
if (res->ai_family == AF_INET) {
- if (res->ai_addrlen > sizeof(sockin)) {
+ if ((size_t)res->ai_addrlen > sizeof(sockin)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result);
return INVALID_SOCKET;
@@ -1094,7 +1098,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
addr = (struct sockaddr *)&sockin;
#ifdef SUPPORT_IP6
} else if (have_ipv6 () && (res->ai_family == AF_INET6)) {
- if (res->ai_addrlen > sizeof(sockin6)) {
+ if ((size_t)res->ai_addrlen > sizeof(sockin6)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result);
return INVALID_SOCKET;
@@ -1122,6 +1126,10 @@ xmlNanoHTTPConnectHost(const char *host, int port)
#endif
#if !defined(HAVE_GETADDRINFO) || !defined(_WIN32)
{
+ struct hostent *h;
+ struct in_addr ia;
+ int i;
+
h = gethostbyname (GETHOSTBYNAME_ARG_CAST host);
if (h == NULL) {
@@ -1130,7 +1138,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
* extraction code. it work on Linux, if it work on your platform
* and one want to enable it, send me the defined(foobar) needed
*/
-#if defined(HAVE_NETDB_H) && defined(HOST_NOT_FOUND) && defined(linux)
+#if defined(HAVE_NETDB_H) && defined(HOST_NOT_FOUND) && defined(__linux__)
const char *h_err_txt = "";
switch (h_errno) {
@@ -1265,7 +1273,7 @@ xmlNanoHTTPOpenRedir(const char *URL, char **contentType, char **redir) {
int
xmlNanoHTTPRead(void *ctx, void *dest, int len) {
xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
int bytes_read = 0;
int orig_avail_in;
int z_ret;
@@ -1275,7 +1283,7 @@ xmlNanoHTTPRead(void *ctx, void *dest, int len) {
if (dest == NULL) return(-1);
if (len <= 0) return(0);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (ctxt->usesGzip == 1) {
if (ctxt->strm == NULL) return(0);
@@ -1416,16 +1424,16 @@ retry:
/* 1 for '?' */
blen += strlen(ctxt->query) + 1;
blen += strlen(method) + strlen(ctxt->path) + 24;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
/* reserve for possible 'Accept-Encoding: gzip' string */
blen += 23;
#endif
if (ctxt->port != 80) {
/* reserve space for ':xxxxx', incl. potential proxy */
if (proxy)
- blen += 12;
+ blen += 17;
else
- blen += 6;
+ blen += 11;
}
bp = (char*)xmlMallocAtomic(blen);
if ( bp == NULL ) {
@@ -1460,7 +1468,7 @@ retry:
ctxt->hostname, ctxt->port);
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
p += snprintf(p, blen - (p - bp), "Accept-Encoding: gzip\r\n");
#endif
@@ -1534,7 +1542,8 @@ retry:
xmlGenericError(xmlGenericErrorContext,
"\nRedirect to: %s\n", ctxt->location);
#endif
- while ( xmlNanoHTTPRecv(ctxt) > 0 ) ;
+ while ( xmlNanoHTTPRecv(ctxt) > 0 )
+ ;
if (nbRedirects < XML_NANO_HTTP_MAX_REDIR) {
nbRedirects++;
if (redirURL != NULL)
diff --git a/chromium/third_party/libxml/src/parser.c b/chromium/third_party/libxml/src/parser.c
index 33786f08354..3a8a0d79e96 100644
--- a/chromium/third_party/libxml/src/parser.c
+++ b/chromium/third_party/libxml/src/parser.c
@@ -30,10 +30,15 @@
* daniel@veillard.com
*/
+/* To avoid EBCDIC trouble when parsing on zOS */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
+
#define IN_LIBXML
#include "libxml.h"
-#if defined(WIN32) && !defined (__CYGWIN__)
+#if defined(_WIN32) && !defined (__CYGWIN__)
#define XML_DIR_SEP '\\'
#else
#define XML_DIR_SEP '/'
@@ -43,6 +48,7 @@
#include <limits.h>
#include <string.h>
#include <stdarg.h>
+#include <stddef.h>
#include <libxml/xmlmemory.h>
#include <libxml/threads.h>
#include <libxml/globals.h>
@@ -77,12 +83,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-#ifdef HAVE_LZMA_H
-#include <lzma.h>
-#endif
#include "buf.h"
#include "enc.h"
@@ -155,7 +155,7 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
XML_SUBSTITUTE_REF, 0, 0, 0);
--ctxt->depth;
ent->guard = XML_ENTITY_NOT_BEING_CHECKED;
- if (ctxt->errNo == XML_ERR_ENTITY_LOOP) {
+ if ((rep == NULL) || (ctxt->errNo == XML_ERR_ENTITY_LOOP)) {
ent->content[0] = 0;
}
@@ -1093,7 +1093,12 @@ typedef xmlDefAttrs *xmlDefAttrsPtr;
struct _xmlDefAttrs {
int nbAttrs; /* number of defaulted attributes on that element */
int maxAttrs; /* the size of the array */
- const xmlChar *values[5]; /* array of localname/prefix/values/external */
+#if __STDC_VERSION__ >= 199901L
+ /* Using a C99 flexible array member avoids UBSan errors. */
+ const xmlChar *values[]; /* array of localname/prefix/values/external */
+#else
+ const xmlChar *values[5];
+#endif
};
/**
@@ -1330,7 +1335,7 @@ xmlAddSpecialAttr(xmlParserCtxtPtr ctxt,
return;
xmlHashAddEntry2(ctxt->attsSpecial, fullname, fullattr,
- (void *) (long) type);
+ (void *) (ptrdiff_t) type);
return;
mem_error:
@@ -1349,7 +1354,7 @@ xmlCleanSpecialAttrCallback(void *payload, void *data,
const xmlChar *unused ATTRIBUTE_UNUSED) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) data;
- if (((long) payload) == XML_ATTRIBUTE_CDATA) {
+ if (((ptrdiff_t) payload) == XML_ATTRIBUTE_CDATA) {
xmlHashRemoveEntry2(ctxt->attsSpecial, fullname, fullattr, NULL);
}
}
@@ -1861,7 +1866,7 @@ nameNsPush(xmlParserCtxtPtr ctxt, const xmlChar * value,
ctxt->name = value;
ctxt->pushTab[ctxt->nameNr * 3] = (void *) prefix;
ctxt->pushTab[ctxt->nameNr * 3 + 1] = (void *) URI;
- ctxt->pushTab[ctxt->nameNr * 3 + 2] = (void *) (long) nsNr;
+ ctxt->pushTab[ctxt->nameNr * 3 + 2] = (void *) (ptrdiff_t) nsNr;
return (ctxt->nameNr++);
mem_error:
xmlErrMemory(ctxt, NULL);
@@ -2043,10 +2048,8 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
#define SKIP(val) do { \
ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val); \
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
- if ((*ctxt->input->cur == 0) && \
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) \
- xmlPopInput(ctxt); \
+ if (*ctxt->input->cur == 0) \
+ xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
} while (0)
#define SKIPL(val) do { \
@@ -2058,10 +2061,8 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
ctxt->nbChars++; \
ctxt->input->cur++; \
} \
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
- if ((*ctxt->input->cur == 0) && \
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) \
- xmlPopInput(ctxt); \
+ if (*ctxt->input->cur == 0) \
+ xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \
} while (0)
#define SHRINK if ((ctxt->progressive == 0) && \
@@ -2071,10 +2072,9 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
static void xmlSHRINK (xmlParserCtxtPtr ctxt) {
xmlParserInputShrink(ctxt->input);
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
- xmlPopInput(ctxt);
- }
+ if (*ctxt->input->cur == 0)
+ xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
+}
#define GROW if ((ctxt->progressive == 0) && \
(ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \
@@ -2086,7 +2086,8 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
if (((curEnd > (unsigned long) XML_MAX_LOOKUP_LIMIT) ||
(curBase > (unsigned long) XML_MAX_LOOKUP_LIMIT)) &&
- ((ctxt->input->buf) && (ctxt->input->buf->readcallback != (xmlInputReadCallback) xmlNop)) &&
+ ((ctxt->input->buf) &&
+ (ctxt->input->buf->readcallback != xmlInputReadCallbackNop)) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup");
xmlHaltParser(ctxt);
@@ -2099,9 +2100,8 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "cur index out of bound");
return;
}
- if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
- xmlPopInput(ctxt);
+ if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0))
+ xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
}
#define SKIP_BLANKS xmlSkipBlankChars(ctxt)
@@ -2121,7 +2121,6 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
ctxt->input->line++; ctxt->input->col = 1; \
} else ctxt->input->col++; \
ctxt->input->cur += l; \
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \
} while (0)
#define CUR_CHAR(l) xmlCurrentChar(ctxt, &l)
@@ -2171,26 +2170,35 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
}
ctxt->input->cur = cur;
} else {
- int cur;
- do {
- cur = CUR;
- while ((IS_BLANK_CH(cur) && /* CHECKED tstblanks.xml */
- (ctxt->instate != XML_PARSER_EOF))) {
+ int expandPE = ((ctxt->external != 0) || (ctxt->inputNr != 1));
+
+ while (1) {
+ if (IS_BLANK_CH(CUR)) { /* CHECKED tstblanks.xml */
NEXT;
- cur = CUR;
- res++;
- }
- while ((cur == 0) && (ctxt->inputNr > 1) &&
- (ctxt->instate != XML_PARSER_COMMENT)) {
- xmlPopInput(ctxt);
- cur = CUR;
- }
- /*
- * Need to handle support of entities branching here
- */
- if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt);
- } while ((IS_BLANK(cur)) && /* CHECKED tstblanks.xml */
- (ctxt->instate != XML_PARSER_EOF));
+ } else if (CUR == '%') {
+ /*
+ * Need to handle support of entities branching here
+ */
+ if ((expandPE == 0) || (IS_BLANK_CH(NXT(1))) || (NXT(1) == 0))
+ break;
+ xmlParsePEReference(ctxt);
+ } else if (CUR == 0) {
+ if (ctxt->inputNr <= 1)
+ break;
+ xmlPopInput(ctxt);
+ } else {
+ break;
+ }
+
+ /*
+ * Also increase the counter when entering or exiting a PERef.
+ * The spec says: "When a parameter-entity reference is recognized
+ * in the DTD and included, its replacement text MUST be enlarged
+ * by the attachment of one leading and one following space (#x20)
+ * character."
+ */
+ res++;
+ }
}
return(res);
}
@@ -2216,10 +2224,13 @@ xmlPopInput(xmlParserCtxtPtr ctxt) {
if (xmlParserDebugEntities)
xmlGenericError(xmlGenericErrorContext,
"Popping input %d\n", ctxt->inputNr);
+ if ((ctxt->inputNr > 1) && (ctxt->inSubset == 0) &&
+ (ctxt->instate != XML_PARSER_EOF))
+ xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
+ "Unfinished entity outside the DTD");
xmlFreeInputStream(inputPop(ctxt));
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
- return(xmlPopInput(ctxt));
+ if (*ctxt->input->cur == 0)
+ xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
return(CUR);
}
@@ -2245,6 +2256,13 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
xmlGenericError(xmlGenericErrorContext,
"Pushing input %d : %.30s\n", ctxt->inputNr+1, input->cur);
}
+ if (((ctxt->inputNr > 40) && ((ctxt->options & XML_PARSE_HUGE) == 0)) ||
+ (ctxt->inputNr > 1024)) {
+ xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+ while (ctxt->inputNr > 1)
+ xmlFreeInputStream(inputPop(ctxt));
+ return(-1);
+ }
ret = inputPush(ctxt, input);
if (ctxt->instate == XML_PARSER_EOF)
return(-1);
@@ -2450,57 +2468,6 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
}
/**
- * xmlNewBlanksWrapperInputStream:
- * @ctxt: an XML parser context
- * @entity: an Entity pointer
- *
- * Create a new input stream for wrapping
- * blanks around a PEReference
- *
- * Returns the new input stream or NULL
- */
-
-static void deallocblankswrapper (xmlChar *str) {xmlFree(str);}
-
-static xmlParserInputPtr
-xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
- xmlParserInputPtr input;
- xmlChar *buffer;
- size_t length;
- if (entity == NULL) {
- xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
- "xmlNewBlanksWrapperInputStream entity\n");
- return(NULL);
- }
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "new blanks wrapper for entity: %s\n", entity->name);
- input = xmlNewInputStream(ctxt);
- if (input == NULL) {
- return(NULL);
- }
- length = xmlStrlen(entity->name) + 5;
- buffer = xmlMallocAtomic(length);
- if (buffer == NULL) {
- xmlErrMemory(ctxt, NULL);
- xmlFree(input);
- return(NULL);
- }
- buffer [0] = ' ';
- buffer [1] = '%';
- buffer [length-3] = ';';
- buffer [length-2] = ' ';
- buffer [length-1] = 0;
- memcpy(buffer + 2, entity->name, length - 5);
- input->free = deallocblankswrapper;
- input->base = buffer;
- input->cur = buffer;
- input->length = length;
- input->end = &buffer[length];
- return(input);
-}
-
-/**
* xmlParserHandlePEReference:
* @ctxt: the parser context
*
@@ -2534,11 +2501,6 @@ xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
*/
void
xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
- const xmlChar *name;
- xmlEntityPtr entity = NULL;
- xmlParserInputPtr input;
-
- if (RAW != '%') return;
switch(ctxt->instate) {
case XML_PARSER_CDATA_SECTION:
return;
@@ -2593,128 +2555,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
return;
}
- NEXT;
- name = xmlParseName(ctxt);
- if (xmlParserDebugEntities)
- xmlGenericError(xmlGenericErrorContext,
- "PEReference: %s\n", name);
- if (name == NULL) {
- xmlFatalErr(ctxt, XML_ERR_PEREF_NO_NAME, NULL);
- } else {
- if (RAW == ';') {
- NEXT;
- if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL))
- entity = ctxt->sax->getParameterEntity(ctxt->userData, name);
- if (ctxt->instate == XML_PARSER_EOF)
- return;
- if (entity == NULL) {
-
- /*
- * [ WFC: Entity Declared ]
- * In a document without any DTD, a document with only an
- * internal DTD subset which contains no parameter entity
- * references, or a document with "standalone='yes'", ...
- * ... The declaration of a parameter entity must precede
- * any reference to it...
- */
- if ((ctxt->standalone == 1) ||
- ((ctxt->hasExternalSubset == 0) &&
- (ctxt->hasPErefs == 0))) {
- xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
- "PEReference: %%%s; not found\n", name);
- } else {
- /*
- * [ VC: Entity Declared ]
- * In a document with an external subset or external
- * parameter entities with "standalone='no'", ...
- * ... The declaration of a parameter entity must precede
- * any reference to it...
- */
- if ((ctxt->validate) && (ctxt->vctxt.error != NULL)) {
- xmlValidityError(ctxt, XML_WAR_UNDECLARED_ENTITY,
- "PEReference: %%%s; not found\n",
- name, NULL);
- } else
- xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY,
- "PEReference: %%%s; not found\n",
- name, NULL);
- ctxt->valid = 0;
- }
- xmlParserEntityCheck(ctxt, 0, NULL, 0);
- } else if (ctxt->input->free != deallocblankswrapper) {
- input = xmlNewBlanksWrapperInputStream(ctxt, entity);
- if (xmlPushInput(ctxt, input) < 0)
- return;
- } else {
- if ((entity->etype == XML_INTERNAL_PARAMETER_ENTITY) ||
- (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY)) {
- xmlChar start[4];
- xmlCharEncoding enc;
-
- /*
- * Note: external parameter entities will not be loaded, it
- * is not required for a non-validating parser, unless the
- * option of validating, or substituting entities were
- * given. Doing so is far more secure as the parser will
- * only process data coming from the document entity by
- * default.
- */
- if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
- ((ctxt->options & XML_PARSE_NOENT) == 0) &&
- ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
- ((ctxt->options & XML_PARSE_DTDLOAD) == 0) &&
- ((ctxt->options & XML_PARSE_DTDATTR) == 0) &&
- (ctxt->replaceEntities == 0) &&
- (ctxt->validate == 0))
- return;
-
- /*
- * handle the extra spaces added before and after
- * c.f. http://www.w3.org/TR/REC-xml#as-PE
- * this is done independently.
- */
- input = xmlNewEntityInputStream(ctxt, entity);
- if (xmlPushInput(ctxt, input) < 0)
- return;
-
- /*
- * Get the 4 first bytes and decode the charset
- * if enc != XML_CHAR_ENCODING_NONE
- * plug some encoding conversion routines.
- * Note that, since we may have some non-UTF8
- * encoding (like UTF16, bug 135229), the 'length'
- * is not known, but we can calculate based upon
- * the amount of data in the buffer.
- */
- GROW
- if (ctxt->instate == XML_PARSER_EOF)
- return;
- if ((ctxt->input->end - ctxt->input->cur)>=4) {
- start[0] = RAW;
- start[1] = NXT(1);
- start[2] = NXT(2);
- start[3] = NXT(3);
- enc = xmlDetectCharEncoding(start, 4);
- if (enc != XML_CHAR_ENCODING_NONE) {
- xmlSwitchEncoding(ctxt, enc);
- }
- }
-
- if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
- (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l' )) &&
- (IS_BLANK_CH(NXT(5)))) {
- xmlParseTextDecl(ctxt);
- }
- } else {
- xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER,
- "PEReference: %s is not a parameter entity\n",
- name);
- }
- }
- } else {
- xmlFatalErr(ctxt, XML_ERR_PEREF_SEMICOL_MISSING, NULL);
- }
- }
+ xmlParsePEReference(ctxt);
}
/*
@@ -2796,9 +2637,9 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
if (c == 0) break;
if ((c == '&') && (str[1] == '#')) {
int val = xmlParseStringCharRef(ctxt, &str);
- if (val != 0) {
- COPY_BUF(0,buffer,nbchars,val);
- }
+ if (val == 0)
+ goto int_error;
+ COPY_BUF(0,buffer,nbchars,val);
if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
}
@@ -2808,9 +2649,6 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
"String decoding Entity Reference: %.30s\n",
str);
ent = xmlParseStringEntityRef(ctxt, &str);
- if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) ||
- (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR))
- goto int_error;
xmlParserEntityCheck(ctxt, 0, ent, 0);
if (ent != NULL)
ctxt->nbentities += ent->checked / 2;
@@ -2824,30 +2662,27 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
} else {
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
"predefined entity has no content\n");
+ goto int_error;
}
} else if ((ent != NULL) && (ent->content != NULL)) {
ctxt->depth++;
rep = xmlStringDecodeEntities(ctxt, ent->content, what,
0, 0, 0);
ctxt->depth--;
-
- if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) ||
- (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR))
- goto int_error;
-
- if (rep != NULL) {
- current = rep;
- while (*current != 0) { /* non input consuming loop */
- buffer[nbchars++] = *current++;
- if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
- if (xmlParserEntityCheck(ctxt, nbchars, ent, 0))
- goto int_error;
- growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
- }
- }
- xmlFree(rep);
- rep = NULL;
- }
+ if (rep == NULL)
+ goto int_error;
+
+ current = rep;
+ while (*current != 0) { /* non input consuming loop */
+ buffer[nbchars++] = *current++;
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
+ if (xmlParserEntityCheck(ctxt, nbchars, ent, 0))
+ goto int_error;
+ growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
+ }
+ }
+ xmlFree(rep);
+ rep = NULL;
} else if (ent != NULL) {
int i = xmlStrlen(ent->name);
const xmlChar *cur = ent->name;
@@ -2865,8 +2700,6 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
xmlGenericError(xmlGenericErrorContext,
"String decoding PE Reference: %.30s\n", str);
ent = xmlParseStringPEReference(ctxt, &str);
- if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP)
- goto int_error;
xmlParserEntityCheck(ctxt, 0, ent, 0);
if (ent != NULL)
ctxt->nbentities += ent->checked / 2;
@@ -2892,19 +2725,19 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
rep = xmlStringDecodeEntities(ctxt, ent->content, what,
0, 0, 0);
ctxt->depth--;
- if (rep != NULL) {
- current = rep;
- while (*current != 0) { /* non input consuming loop */
- buffer[nbchars++] = *current++;
- if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
- if (xmlParserEntityCheck(ctxt, nbchars, ent, 0))
- goto int_error;
- growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
- }
- }
- xmlFree(rep);
- rep = NULL;
- }
+ if (rep == NULL)
+ goto int_error;
+ current = rep;
+ while (*current != 0) { /* non input consuming loop */
+ buffer[nbchars++] = *current++;
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
+ if (xmlParserEntityCheck(ctxt, nbchars, ent, 0))
+ goto int_error;
+ growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
+ }
+ }
+ xmlFree(rep);
+ rep = NULL;
}
} else {
COPY_BUF(l,buffer,nbchars,c);
@@ -3412,13 +3245,6 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
len += l;
NEXTL(l);
c = CUR_CHAR(l);
- if (c == 0) {
- count = 0;
- GROW;
- if (ctxt->instate == XML_PARSER_EOF)
- return(NULL);
- c = CUR_CHAR(l);
- }
}
}
if ((len > XML_MAX_NAME_LENGTH) &&
@@ -3426,15 +3252,18 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name");
return(NULL);
}
- if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) {
- if (ctxt->input->base > ctxt->input->cur - (len + 1)) {
- return(NULL);
- }
- return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len));
- }
- if (ctxt->input->base > ctxt->input->cur - len) {
- return(NULL);
+ if (ctxt->input->cur - ctxt->input->base < len) {
+ /*
+ * There were a couple of bugs where PERefs lead to to a change
+ * of the buffer. Check the buffer size to avoid passing an invalid
+ * pointer to xmlDictLookup.
+ */
+ xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
+ "unexpected change of input buffer");
+ return (NULL);
}
+ if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r'))
+ return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len));
return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
}
@@ -3547,9 +3376,9 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
*/
ctxt->input->cur -= l;
GROW;
- ctxt->input->cur += l;
if (ctxt->instate == XML_PARSER_EOF)
return(NULL);
+ ctxt->input->cur += l;
c = CUR_CHAR(l);
}
}
@@ -3905,10 +3734,8 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
ctxt->instate = XML_PARSER_ENTITY_VALUE;
input = ctxt->input;
GROW;
- if (ctxt->instate == XML_PARSER_EOF) {
- xmlFree(buf);
- return(NULL);
- }
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto error;
NEXT;
c = CUR_CHAR(l);
/*
@@ -3929,18 +3756,12 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
- xmlFree(buf);
- return(NULL);
+ goto error;
}
buf = tmp;
}
COPY_BUF(l,buf,len,c);
NEXTL(l);
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1)) /* non input consuming */
- xmlPopInput(ctxt);
GROW;
c = CUR_CHAR(l);
@@ -3950,10 +3771,13 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
}
}
buf[len] = 0;
- if (ctxt->instate == XML_PARSER_EOF) {
- xmlFree(buf);
- return(NULL);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto error;
+ if (c != stop) {
+ xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_FINISHED, NULL);
+ goto error;
}
+ NEXT;
/*
* Raise problem w.r.t. '&' and '%' being used in non-entities
@@ -3965,20 +3789,25 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
if ((*cur == '%') || ((*cur == '&') && (cur[1] != '#'))) {
xmlChar *name;
xmlChar tmp = *cur;
+ int nameOk = 0;
cur++;
name = xmlParseStringName(ctxt, &cur);
- if ((name == NULL) || (*cur != ';')) {
+ if (name != NULL) {
+ nameOk = 1;
+ xmlFree(name);
+ }
+ if ((nameOk == 0) || (*cur != ';')) {
xmlFatalErrMsgInt(ctxt, XML_ERR_ENTITY_CHAR_ERROR,
"EntityValue: '%c' forbidden except for entities references\n",
tmp);
+ goto error;
}
if ((tmp == '%') && (ctxt->inSubset == 1) &&
(ctxt->inputNr == 1)) {
xmlFatalErr(ctxt, XML_ERR_ENTITY_PE_INTERNAL, NULL);
+ goto error;
}
- if (name != NULL)
- xmlFree(name);
if (*cur == 0)
break;
}
@@ -3987,28 +3816,24 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
/*
* Then PEReference entities are substituted.
+ *
+ * NOTE: 4.4.7 Bypassed
+ * When a general entity reference appears in the EntityValue in
+ * an entity declaration, it is bypassed and left as is.
+ * so XML_SUBSTITUTE_REF is not set here.
*/
- if (c != stop) {
- xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_FINISHED, NULL);
- xmlFree(buf);
- } else {
- NEXT;
- /*
- * NOTE: 4.4.7 Bypassed
- * When a general entity reference appears in the EntityValue in
- * an entity declaration, it is bypassed and left as is.
- * so XML_SUBSTITUTE_REF is not set here.
- */
- ++ctxt->depth;
- ret = xmlStringDecodeEntities(ctxt, buf, XML_SUBSTITUTE_PEREF,
- 0, 0, 0);
- --ctxt->depth;
- if (orig != NULL)
- *orig = buf;
- else
- xmlFree(buf);
+ ++ctxt->depth;
+ ret = xmlStringDecodeEntities(ctxt, buf, XML_SUBSTITUTE_PEREF,
+ 0, 0, 0);
+ --ctxt->depth;
+ if (orig != NULL) {
+ *orig = buf;
+ buf = NULL;
}
+error:
+ if (buf != NULL)
+ xmlFree(buf);
return(ret);
}
@@ -4178,7 +4003,9 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
ent->checked |= 1;
xmlFree(rep);
rep = NULL;
- }
+ } else {
+ ent->content[0] = 0;
+ }
}
/*
@@ -4602,7 +4429,7 @@ get_more:
if (*in == ']') {
if ((in[1] == ']') && (in[2] == '>')) {
xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL);
- ctxt->input->cur = in;
+ ctxt->input->cur = in + 1;
return;
}
in++;
@@ -4795,22 +4622,20 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) {
*publicID = NULL;
if (CMP6(CUR_PTR, 'S', 'Y', 'S', 'T', 'E', 'M')) {
SKIP(6);
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'SYSTEM'\n");
}
- SKIP_BLANKS;
URI = xmlParseSystemLiteral(ctxt);
if (URI == NULL) {
xmlFatalErr(ctxt, XML_ERR_URI_REQUIRED, NULL);
}
} else if (CMP6(CUR_PTR, 'P', 'U', 'B', 'L', 'I', 'C')) {
SKIP(6);
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'PUBLIC'\n");
}
- SKIP_BLANKS;
*publicID = xmlParsePubidLiteral(ctxt);
if (*publicID == NULL) {
xmlFatalErr(ctxt, XML_ERR_PUBID_REQUIRED, NULL);
@@ -4819,26 +4644,20 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) {
/*
* We don't handle [83] so "S SystemLiteral" is required.
*/
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the Public Identifier\n");
}
} else {
/*
* We handle [83] so we return immediately, if
- * "S SystemLiteral" is not detected. From a purely parsing
- * point of view that's a nice mess.
+ * "S SystemLiteral" is not detected. We skip blanks if no
+ * system literal was found, but this is harmless since we must
+ * be at the end of a NotationDecl.
*/
- const xmlChar *ptr;
- GROW;
-
- ptr = CUR_PTR;
- if (!IS_BLANK_CH(*ptr)) return(NULL);
-
- while (IS_BLANK_CH(*ptr)) ptr++; /* TODO: dangerous, fix ! */
- if ((*ptr != '\'') && (*ptr != '"')) return(NULL);
+ if (SKIP_BLANKS == 0) return(NULL);
+ if ((CUR != '\'') && (CUR != '"')) return(NULL);
}
- SKIP_BLANKS;
URI = xmlParseSystemLiteral(ctxt);
if (URI == NULL) {
xmlFatalErr(ctxt, XML_ERR_URI_REQUIRED, NULL);
@@ -4968,7 +4787,8 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
} else {
if (inputid != ctxt->input->id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "Comment doesn't start and stop in the same entity\n");
+ "Comment doesn't start and stop in the same"
+ " entity\n");
}
NEXT;
if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
@@ -5116,7 +4936,8 @@ get_more:
if (in[2] == '>') {
if (ctxt->input->id != inputid) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "comment doesn't start and stop in the same entity\n");
+ "comment doesn't start and stop in the"
+ " same entity\n");
}
SKIP(3);
if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
@@ -5284,7 +5105,7 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
int count = 0;
if ((RAW == '<') && (NXT(1) == '?')) {
- xmlParserInputPtr input = ctxt->input;
+ int inputid = ctxt->input->id;
state = ctxt->instate;
ctxt->instate = XML_PARSER_PI;
/*
@@ -5300,9 +5121,10 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
target = xmlParsePITarget(ctxt);
if (target != NULL) {
if ((RAW == '?') && (NXT(1) == '>')) {
- if (input != ctxt->input) {
+ if (inputid != ctxt->input->id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "PI declaration doesn't start and stop in the same entity\n");
+ "PI declaration doesn't start and stop in"
+ " the same entity\n");
}
SKIP(2);
@@ -5323,12 +5145,10 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
ctxt->instate = state;
return;
}
- cur = CUR;
- if (!IS_BLANK(cur)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsgStr(ctxt, XML_ERR_SPACE_REQUIRED,
"ParsePI: PI %s space expected\n", target);
}
- SKIP_BLANKS;
cur = CUR_CHAR(l);
while (IS_CHAR(cur) && /* checked */
((cur != '?') || (NXT(1) != '>'))) {
@@ -5384,9 +5204,10 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
"ParsePI: PI %s never end ...\n", target);
} else {
- if (input != ctxt->input) {
- xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
- "PI declaration doesn't start and stop in the same entity\n");
+ if (inputid != ctxt->input->id) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "PI declaration doesn't start and stop in"
+ " the same entity\n");
}
SKIP(2);
@@ -5442,32 +5263,30 @@ xmlParseNotationDecl(xmlParserCtxtPtr ctxt) {
xmlChar *Systemid;
if (CMP10(CUR_PTR, '<', '!', 'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N')) {
- xmlParserInputPtr input = ctxt->input;
+ int inputid = ctxt->input->id;
SHRINK;
SKIP(10);
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after '<!NOTATION'\n");
return;
}
- SKIP_BLANKS;
name = xmlParseName(ctxt);
if (name == NULL) {
xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL);
return;
}
- if (!IS_BLANK_CH(CUR)) {
- xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
- "Space required after the NOTATION name'\n");
- return;
- }
if (xmlStrchr(name, ':') != NULL) {
xmlNsErr(ctxt, XML_NS_ERR_COLON,
"colons are forbidden from notation names '%s'\n",
name, NULL, NULL);
}
- SKIP_BLANKS;
+ if (SKIP_BLANKS == 0) {
+ xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
+ "Space required after the NOTATION name'\n");
+ return;
+ }
/*
* Parse the IDs.
@@ -5476,9 +5295,10 @@ xmlParseNotationDecl(xmlParserCtxtPtr ctxt) {
SKIP_BLANKS;
if (RAW == '>') {
- if (input != ctxt->input) {
- xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
- "Notation declaration doesn't start and stop in the same entity\n");
+ if (inputid != ctxt->input->id) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "Notation declaration doesn't start and stop"
+ " in the same entity\n");
}
NEXT;
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
@@ -5522,23 +5342,20 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
const xmlChar *ndata = NULL;
int isParameter = 0;
xmlChar *orig = NULL;
- int skipped;
/* GROW; done in the caller */
if (CMP8(CUR_PTR, '<', '!', 'E', 'N', 'T', 'I', 'T', 'Y')) {
- xmlParserInputPtr input = ctxt->input;
+ int inputid = ctxt->input->id;
SHRINK;
SKIP(8);
- skipped = SKIP_BLANKS;
- if (skipped == 0) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after '<!ENTITY'\n");
}
if (RAW == '%') {
NEXT;
- skipped = SKIP_BLANKS;
- if (skipped == 0) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after '%%'\n");
}
@@ -5556,8 +5373,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
"colons are forbidden from entities names '%s'\n",
name, NULL, NULL);
}
- skipped = SKIP_BLANKS;
- if (skipped == 0) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the entity name\n");
}
@@ -5668,18 +5484,16 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
xmlFreeURI(uri);
}
}
- if ((RAW != '>') && (!IS_BLANK_CH(CUR))) {
+ if ((RAW != '>') && (SKIP_BLANKS == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required before 'NDATA'\n");
}
- SKIP_BLANKS;
if (CMP5(CUR_PTR, 'N', 'D', 'A', 'T', 'A')) {
SKIP(5);
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'NDATA'\n");
}
- SKIP_BLANKS;
ndata = xmlParseName(ctxt);
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
(ctxt->sax->unparsedEntityDecl != NULL))
@@ -5718,16 +5532,17 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
}
}
if (ctxt->instate == XML_PARSER_EOF)
- return;
+ goto done;
SKIP_BLANKS;
if (RAW != '>') {
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
"xmlParseEntityDecl: entity %s not terminated\n", name);
xmlHaltParser(ctxt);
} else {
- if (input != ctxt->input) {
+ if (inputid != ctxt->input->id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "Entity declaration doesn't start and stop in the same entity\n");
+ "Entity declaration doesn't start and stop in"
+ " the same entity\n");
}
NEXT;
}
@@ -5749,17 +5564,17 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
cur = xmlSAX2GetEntity(ctxt, name);
}
}
- if (cur != NULL) {
- if (cur->orig != NULL)
- xmlFree(orig);
- else
- cur->orig = orig;
- } else
- xmlFree(orig);
+ if ((cur != NULL) && (cur->orig == NULL)) {
+ cur->orig = orig;
+ orig = NULL;
+ }
}
+
+done:
if (value != NULL) xmlFree(value);
if (URI != NULL) xmlFree(URI);
if (literal != NULL) xmlFree(literal);
+ if (orig != NULL) xmlFree(orig);
}
}
@@ -5810,11 +5625,10 @@ xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) {
if (CMP6(CUR_PTR, '#', 'F', 'I', 'X', 'E', 'D')) {
SKIP(6);
val = XML_ATTRIBUTE_FIXED;
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after '#FIXED'\n");
}
- SKIP_BLANKS;
}
ret = xmlParseAttValue(ctxt);
ctxt->instate = XML_PARSER_DTD;
@@ -5986,12 +5800,11 @@ int
xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
if (CMP8(CUR_PTR, 'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N')) {
SKIP(8);
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'NOTATION'\n");
return(0);
}
- SKIP_BLANKS;
*tree = xmlParseNotationType(ctxt);
if (*tree == NULL) return(0);
return(XML_ATTRIBUTE_NOTATION);
@@ -6095,14 +5908,13 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
xmlEnumerationPtr tree;
if (CMP9(CUR_PTR, '<', '!', 'A', 'T', 'T', 'L', 'I', 'S', 'T')) {
- xmlParserInputPtr input = ctxt->input;
+ int inputid = ctxt->input->id;
SKIP(9);
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after '<!ATTLIST'\n");
}
- SKIP_BLANKS;
elemName = xmlParseName(ctxt);
if (elemName == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
@@ -6112,7 +5924,6 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
SKIP_BLANKS;
GROW;
while ((RAW != '>') && (ctxt->instate != XML_PARSER_EOF)) {
- const xmlChar *check = CUR_PTR;
int type;
int def;
xmlChar *defaultValue = NULL;
@@ -6126,12 +5937,11 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
break;
}
GROW;
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the attribute name\n");
break;
}
- SKIP_BLANKS;
type = xmlParseAttributeType(ctxt, &tree);
if (type <= 0) {
@@ -6139,14 +5949,13 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
}
GROW;
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the attribute type\n");
if (tree != NULL)
xmlFreeEnumeration(tree);
break;
}
- SKIP_BLANKS;
def = xmlParseDefaultDecl(ctxt, &defaultValue);
if (def <= 0) {
@@ -6161,7 +5970,7 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
GROW;
if (RAW != '>') {
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the attribute default value\n");
if (defaultValue != NULL)
@@ -6170,16 +5979,6 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
xmlFreeEnumeration(tree);
break;
}
- SKIP_BLANKS;
- }
- if (check == CUR_PTR) {
- xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
- "in xmlParseAttributeListDecl\n");
- if (defaultValue != NULL)
- xmlFree(defaultValue);
- if (tree != NULL)
- xmlFreeEnumeration(tree);
- break;
}
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
(ctxt->sax->attributeDecl != NULL))
@@ -6201,10 +6000,10 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
GROW;
}
if (RAW == '>') {
- if (input != ctxt->input) {
- xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "Attribute list declaration doesn't start and stop in the same entity\n",
- NULL, NULL);
+ if (inputid != ctxt->input->id) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "Attribute list declaration doesn't start and"
+ " stop in the same entity\n");
}
NEXT;
}
@@ -6241,10 +6040,10 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
SKIP_BLANKS;
SHRINK;
if (RAW == ')') {
- if ((ctxt->validate) && (ctxt->input->id != inputchk)) {
- xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
-"Element content declaration doesn't start and stop in the same entity\n",
- NULL, NULL);
+ if (ctxt->input->id != inputchk) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "Element content declaration doesn't start and"
+ " stop in the same entity\n");
}
NEXT;
ret = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_PCDATA);
@@ -6285,7 +6084,7 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
if (elem == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"xmlParseElementMixedContentDecl : Name expected\n");
- xmlFreeDocElementContent(ctxt->myDoc, cur);
+ xmlFreeDocElementContent(ctxt->myDoc, ret);
return(NULL);
}
SKIP_BLANKS;
@@ -6300,10 +6099,10 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
}
if (ret != NULL)
ret->ocur = XML_ELEMENT_CONTENT_MULT;
- if ((ctxt->validate) && (ctxt->input->id != inputchk)) {
- xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
-"Element content declaration doesn't start and stop in the same entity\n",
- NULL, NULL);
+ if (ctxt->input->id != inputchk) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "Element content declaration doesn't start and"
+ " stop in the same entity\n");
}
SKIP(2);
} else {
@@ -6543,10 +6342,10 @@ xmlParseElementChildrenContentDeclPriv(xmlParserCtxtPtr ctxt, int inputchk,
if (last != NULL)
last->parent = cur;
}
- if ((ctxt->validate) && (ctxt->input->id != inputchk)) {
- xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
-"Element content declaration doesn't start and stop in the same entity\n",
- NULL, NULL);
+ if (ctxt->input->id != inputchk) {
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "Element content declaration doesn't start and stop in"
+ " the same entity\n");
}
NEXT;
if (RAW == '?') {
@@ -6719,28 +6518,24 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) {
/* GROW; done in the caller */
if (CMP9(CUR_PTR, '<', '!', 'E', 'L', 'E', 'M', 'E', 'N', 'T')) {
- xmlParserInputPtr input = ctxt->input;
+ int inputid = ctxt->input->id;
SKIP(9);
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'ELEMENT'\n");
return(-1);
}
- SKIP_BLANKS;
name = xmlParseName(ctxt);
if (name == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"xmlParseElementDecl: no name for Element\n");
return(-1);
}
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the element name\n");
}
- SKIP_BLANKS;
if (CMP5(CUR_PTR, 'E', 'M', 'P', 'T', 'Y')) {
SKIP(5);
/*
@@ -6772,12 +6567,6 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) {
}
SKIP_BLANKS;
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
- SKIP_BLANKS;
if (RAW != '>') {
xmlFatalErr(ctxt, XML_ERR_GT_REQUIRED, NULL);
@@ -6785,9 +6574,10 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) {
xmlFreeDocElementContent(ctxt->myDoc, content);
}
} else {
- if (input != ctxt->input) {
+ if (inputid != ctxt->input->id) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "Element declaration doesn't start and stop in the same entity\n");
+ "Element declaration doesn't start and stop in"
+ " the same entity\n");
}
NEXT;
@@ -6840,9 +6630,9 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
return;
} else {
if (ctxt->input->id != id) {
- xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "All markup of the conditional section is not in the same entity\n",
- NULL, NULL);
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "All markup of the conditional section is not"
+ " in the same entity\n");
}
NEXT;
}
@@ -6855,6 +6645,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
"Entering INCLUDE Conditional Section\n");
}
+ SKIP_BLANKS;
+ GROW;
while (((RAW != 0) && ((RAW != ']') || (NXT(1) != ']') ||
(NXT(2) != '>'))) && (ctxt->instate != XML_PARSER_EOF)) {
const xmlChar *check = CUR_PTR;
@@ -6862,18 +6654,11 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
xmlParseConditionalSections(ctxt);
- } else if (IS_BLANK_CH(CUR)) {
- NEXT;
- } else if (RAW == '%') {
- xmlParsePEReference(ctxt);
} else
xmlParseMarkupDecl(ctxt);
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
+ SKIP_BLANKS;
+ GROW;
if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
@@ -6903,9 +6688,9 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
return;
} else {
if (ctxt->input->id != id) {
- xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "All markup of the conditional section is not in the same entity\n",
- NULL, NULL);
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "All markup of the conditional section is not"
+ " in the same entity\n");
}
NEXT;
}
@@ -6967,9 +6752,9 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
} else {
if (ctxt->input->id != id) {
- xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "All markup of the conditional section is not in the same entity\n",
- NULL, NULL);
+ xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "All markup of the conditional section is not in"
+ " the same entity\n");
}
if ((ctxt-> instate != XML_PARSER_EOF) &&
((ctxt->input->cur + 3) <= ctxt->input->end))
@@ -7037,13 +6822,6 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
return;
/*
- * This is only for internal subset. On external entities,
- * the replacement is done before parsing stage
- */
- if ((ctxt->external == 0) && (ctxt->inputNr == 1))
- xmlParsePEReference(ctxt);
-
- /*
* Conditional sections are allowed from entities included
* by PE References in the internal subset.
*/
@@ -7080,11 +6858,10 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
return;
}
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space needed after '<?xml'\n");
}
- SKIP_BLANKS;
/*
* We may have the VersionInfo here.
@@ -7093,7 +6870,7 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
if (version == NULL)
version = xmlCharStrdup(XML_DEFAULT_VERSION);
else {
- if (!IS_BLANK_CH(CUR)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space needed here\n");
}
@@ -7184,27 +6961,19 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
ctxt->instate = XML_PARSER_DTD;
ctxt->external = 1;
+ SKIP_BLANKS;
while (((RAW == '<') && (NXT(1) == '?')) ||
((RAW == '<') && (NXT(1) == '!')) ||
- (RAW == '%') || IS_BLANK_CH(CUR)) {
+ (RAW == '%')) {
const xmlChar *check = CUR_PTR;
unsigned int cons = ctxt->input->consumed;
GROW;
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
xmlParseConditionalSections(ctxt);
- } else if (IS_BLANK_CH(CUR)) {
- NEXT;
- } else if (RAW == '%') {
- xmlParsePEReference(ctxt);
} else
xmlParseMarkupDecl(ctxt);
-
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
+ SKIP_BLANKS;
if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
@@ -7246,7 +7015,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
*/
if (NXT(1) == '#') {
int i = 0;
- xmlChar out[10];
+ xmlChar out[16];
int hex = NXT(2);
int value = xmlParseCharRef(ctxt);
@@ -7431,6 +7200,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
(ret != XML_WAR_UNDECLARED_ENTITY)) {
xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
"Entity '%s' failed to parse\n", ent->name);
+ if (ent->content != NULL)
+ ent->content[0] = 0;
xmlParserEntityCheck(ctxt, 0, ent, 0);
} else if (list != NULL) {
xmlFreeNodeList(list);
@@ -7438,6 +7209,9 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
}
if (ent->checked == 0)
ent->checked = 2;
+
+ /* Prevent entity from being parsed and expanded twice (Bug 760367). */
+ was_checked = 0;
} else if (ent->checked != 1) {
ctxt->nbentities += ent->checked / 2;
}
@@ -8080,12 +7854,14 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
NEXT;
name = xmlParseName(ctxt);
if (name == NULL) {
- xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
- "xmlParsePEReference: no name\n");
+ xmlFatalErrMsg(ctxt, XML_ERR_PEREF_NO_NAME, "PEReference: no name\n");
return;
}
+ if (xmlParserDebugEntities)
+ xmlGenericError(xmlGenericErrorContext,
+ "PEReference: %s\n", name);
if (RAW != ';') {
- xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL);
+ xmlFatalErr(ctxt, XML_ERR_PEREF_SEMICOL_MISSING, NULL);
return;
}
@@ -8127,10 +7903,15 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
* ... The declaration of a parameter entity must
* precede any reference to it...
*/
- xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY,
- "PEReference: %%%s; not found\n",
- name, NULL);
- ctxt->valid = 0;
+ if ((ctxt->validate) && (ctxt->vctxt.error != NULL)) {
+ xmlValidityError(ctxt, XML_WAR_UNDECLARED_ENTITY,
+ "PEReference: %%%s; not found\n",
+ name, NULL);
+ } else
+ xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY,
+ "PEReference: %%%s; not found\n",
+ name, NULL);
+ ctxt->valid = 0;
}
xmlParserEntityCheck(ctxt, 0, NULL, 0);
} else {
@@ -8142,33 +7923,54 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY,
"Internal: %%%s; is not a parameter entity\n",
name, NULL);
- } else if (ctxt->input->free != deallocblankswrapper) {
- input = xmlNewBlanksWrapperInputStream(ctxt, entity);
- if (xmlPushInput(ctxt, input) < 0)
- return;
} else {
- /*
- * TODO !!!
- * handle the extra spaces added before and after
- * c.f. http://www.w3.org/TR/REC-xml#as-PE
- */
+ xmlChar start[4];
+ xmlCharEncoding enc;
+
+ if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
+ ((ctxt->options & XML_PARSE_NOENT) == 0) &&
+ ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
+ ((ctxt->options & XML_PARSE_DTDLOAD) == 0) &&
+ ((ctxt->options & XML_PARSE_DTDATTR) == 0) &&
+ (ctxt->replaceEntities == 0) &&
+ (ctxt->validate == 0))
+ return;
+
input = xmlNewEntityInputStream(ctxt, entity);
- if (xmlPushInput(ctxt, input) < 0)
+ if (xmlPushInput(ctxt, input) < 0) {
+ xmlFreeInputStream(input);
return;
- if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
- (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) &&
- (IS_BLANK_CH(NXT(5)))) {
- xmlParseTextDecl(ctxt);
- if (ctxt->errNo ==
- XML_ERR_UNSUPPORTED_ENCODING) {
- /*
- * The XML REC instructs us to stop parsing
- * right here
- */
- xmlHaltParser(ctxt);
- return;
- }
- }
+ }
+
+ if (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) {
+ /*
+ * Get the 4 first bytes and decode the charset
+ * if enc != XML_CHAR_ENCODING_NONE
+ * plug some encoding conversion routines.
+ * Note that, since we may have some non-UTF8
+ * encoding (like UTF16, bug 135229), the 'length'
+ * is not known, but we can calculate based upon
+ * the amount of data in the buffer.
+ */
+ GROW
+ if (ctxt->instate == XML_PARSER_EOF)
+ return;
+ if ((ctxt->input->end - ctxt->input->cur)>=4) {
+ start[0] = RAW;
+ start[1] = NXT(1);
+ start[2] = NXT(2);
+ start[3] = NXT(3);
+ enc = xmlDetectCharEncoding(start, 4);
+ if (enc != XML_CHAR_ENCODING_NONE) {
+ xmlSwitchEncoding(ctxt, enc);
+ }
+ }
+
+ if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) &&
+ (IS_BLANK_CH(NXT(5)))) {
+ xmlParseTextDecl(ctxt);
+ }
+ }
}
}
ctxt->hasPErefs = 1;
@@ -8344,6 +8146,7 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
entity = ctxt->sax->getParameterEntity(ctxt->userData, name);
if (ctxt->instate == XML_PARSER_EOF) {
xmlFree(name);
+ *str = ptr;
return(NULL);
}
if (entity == NULL) {
@@ -8482,6 +8285,7 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
* Is there any DTD definition ?
*/
if (RAW == '[') {
+ int baseInputNr = ctxt->inputNr;
ctxt->instate = XML_PARSER_DTD;
NEXT;
/*
@@ -8489,7 +8293,8 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
* PEReferences.
* Subsequence (markupdecl | PEReference | S)*
*/
- while ((RAW != ']') && (ctxt->instate != XML_PARSER_EOF)) {
+ while (((RAW != ']') || (ctxt->inputNr > baseInputNr)) &&
+ (ctxt->instate != XML_PARSER_EOF)) {
const xmlChar *check = CUR_PTR;
unsigned int cons = ctxt->input->consumed;
@@ -8497,16 +8302,13 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
xmlParseMarkupDecl(ctxt);
xmlParsePEReference(ctxt);
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
-
if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"xmlParseInternalSubset: error detected in Markup declaration\n");
- break;
+ if (ctxt->inputNr > baseInputNr)
+ xmlPopInput(ctxt);
+ else
+ break;
}
}
if (RAW == ']') {
@@ -8584,7 +8386,7 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
ctxt->instate = XML_PARSER_CONTENT;
} else {
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
- "Specification mandate value for attribute %s\n", name);
+ "Specification mandates value for attribute %s\n", name);
return(NULL);
}
@@ -8741,11 +8543,10 @@ failed:
GROW
if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
break;
- if (!IS_BLANK_CH(RAW)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"attributes construct error\n");
}
- SKIP_BLANKS;
if ((cons == ctxt->input->consumed) && (q == CUR_PTR) &&
(attname == NULL) && (attvalue == NULL)) {
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
@@ -9283,8 +9084,8 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
if (ctxt->attsSpecial != NULL) {
int type;
- type = (int) (long) xmlHashQLookup2(ctxt->attsSpecial,
- pref, elem, *prefix, name);
+ type = (int) (ptrdiff_t) xmlHashQLookup2(ctxt->attsSpecial,
+ pref, elem, *prefix, name);
if (type != 0)
normalize = 1;
}
@@ -9317,7 +9118,7 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
ctxt->instate = XML_PARSER_CONTENT;
} else {
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
- "Specification mandate value for attribute %s\n",
+ "Specification mandates value for attribute %s\n",
name);
return (NULL);
}
@@ -9400,9 +9201,8 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
xmlChar *attvalue;
const xmlChar **atts = ctxt->atts;
int maxatts = ctxt->maxatts;
- int nratts, nbatts, nbdef;
- int i, j, nbNs, attval, oldline, oldcol, inputNr;
- const xmlChar *base;
+ int nratts, nbatts, nbdef, inputid;
+ int i, j, nbNs, attval;
unsigned long cur;
int nsNr = ctxt->nsNr;
@@ -9416,13 +9216,9 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
* The Shrinking is only possible once the full set of attribute
* callbacks have been done.
*/
-reparse:
SHRINK;
- base = ctxt->input->base;
cur = ctxt->input->cur - ctxt->input->base;
- inputNr = ctxt->inputNr;
- oldline = ctxt->input->line;
- oldcol = ctxt->input->col;
+ inputid = ctxt->input->id;
nbatts = 0;
nratts = 0;
nbdef = 0;
@@ -9446,8 +9242,6 @@ reparse:
*/
SKIP_BLANKS;
GROW;
- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
- goto base_changed;
while (((RAW != '>') &&
((RAW != '/') || (NXT(1) != '>')) &&
@@ -9458,211 +9252,182 @@ reparse:
attname = xmlParseAttribute2(ctxt, prefix, localname,
&aprefix, &attvalue, &len, &alloc);
- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr)) {
- if ((attvalue != NULL) && (alloc != 0))
- xmlFree(attvalue);
- attvalue = NULL;
- goto base_changed;
- }
- if ((attname != NULL) && (attvalue != NULL)) {
- if (len < 0) len = xmlStrlen(attvalue);
- if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) {
- const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
- xmlURIPtr uri;
-
- if (URL == NULL) {
- xmlErrMemory(ctxt, "dictionary allocation failure");
- if ((attvalue != NULL) && (alloc != 0))
- xmlFree(attvalue);
- return(NULL);
- }
- if (*URL != 0) {
- uri = xmlParseURI((const char *) URL);
- if (uri == NULL) {
- xmlNsErr(ctxt, XML_WAR_NS_URI,
- "xmlns: '%s' is not a valid URI\n",
- URL, NULL, NULL);
- } else {
- if (uri->scheme == NULL) {
- xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
- "xmlns: URI %s is not absolute\n",
- URL, NULL, NULL);
- }
- xmlFreeURI(uri);
- }
- if (URL == ctxt->str_xml_ns) {
- if (attname != ctxt->str_xml) {
- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
- "xml namespace URI cannot be the default namespace\n",
- NULL, NULL, NULL);
- }
- goto skip_default_ns;
- }
- if ((len == 29) &&
- (xmlStrEqual(URL,
- BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
- "reuse of the xmlns namespace name is forbidden\n",
- NULL, NULL, NULL);
- goto skip_default_ns;
- }
- }
- /*
- * check that it's not a defined namespace
- */
- for (j = 1;j <= nbNs;j++)
- if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL)
- break;
- if (j <= nbNs)
- xmlErrAttributeDup(ctxt, NULL, attname);
- else
- if (nsPush(ctxt, NULL, URL) > 0) nbNs++;
-skip_default_ns:
- if ((attvalue != NULL) && (alloc != 0)) {
- xmlFree(attvalue);
- attvalue = NULL;
- }
- if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
- break;
- if (!IS_BLANK_CH(RAW)) {
- xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
- "attributes construct error\n");
- break;
- }
- SKIP_BLANKS;
- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
- goto base_changed;
- continue;
- }
- if (aprefix == ctxt->str_xmlns) {
- const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
- xmlURIPtr uri;
-
- if (attname == ctxt->str_xml) {
- if (URL != ctxt->str_xml_ns) {
- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
- "xml namespace prefix mapped to wrong URI\n",
- NULL, NULL, NULL);
- }
- /*
- * Do not keep a namespace definition node
- */
- goto skip_ns;
- }
+ if ((attname == NULL) || (attvalue == NULL))
+ goto next_attr;
+ if (len < 0) len = xmlStrlen(attvalue);
+
+ if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) {
+ const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
+ xmlURIPtr uri;
+
+ if (URL == NULL) {
+ xmlErrMemory(ctxt, "dictionary allocation failure");
+ if ((attvalue != NULL) && (alloc != 0))
+ xmlFree(attvalue);
+ localname = NULL;
+ goto done;
+ }
+ if (*URL != 0) {
+ uri = xmlParseURI((const char *) URL);
+ if (uri == NULL) {
+ xmlNsErr(ctxt, XML_WAR_NS_URI,
+ "xmlns: '%s' is not a valid URI\n",
+ URL, NULL, NULL);
+ } else {
+ if (uri->scheme == NULL) {
+ xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
+ "xmlns: URI %s is not absolute\n",
+ URL, NULL, NULL);
+ }
+ xmlFreeURI(uri);
+ }
if (URL == ctxt->str_xml_ns) {
- if (attname != ctxt->str_xml) {
- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
- "xml namespace URI mapped to wrong prefix\n",
- NULL, NULL, NULL);
- }
- goto skip_ns;
- }
- if (attname == ctxt->str_xmlns) {
- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
- "redefinition of the xmlns prefix is forbidden\n",
- NULL, NULL, NULL);
- goto skip_ns;
- }
- if ((len == 29) &&
- (xmlStrEqual(URL,
- BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
- "reuse of the xmlns namespace name is forbidden\n",
- NULL, NULL, NULL);
- goto skip_ns;
- }
- if ((URL == NULL) || (URL[0] == 0)) {
- xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
- "xmlns:%s: Empty XML namespace is not allowed\n",
- attname, NULL, NULL);
- goto skip_ns;
- } else {
- uri = xmlParseURI((const char *) URL);
- if (uri == NULL) {
- xmlNsErr(ctxt, XML_WAR_NS_URI,
- "xmlns:%s: '%s' is not a valid URI\n",
- attname, URL, NULL);
- } else {
- if ((ctxt->pedantic) && (uri->scheme == NULL)) {
- xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
- "xmlns:%s: URI %s is not absolute\n",
- attname, URL, NULL);
- }
- xmlFreeURI(uri);
- }
- }
+ if (attname != ctxt->str_xml) {
+ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+ "xml namespace URI cannot be the default namespace\n",
+ NULL, NULL, NULL);
+ }
+ goto next_attr;
+ }
+ if ((len == 29) &&
+ (xmlStrEqual(URL,
+ BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
+ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+ "reuse of the xmlns namespace name is forbidden\n",
+ NULL, NULL, NULL);
+ goto next_attr;
+ }
+ }
+ /*
+ * check that it's not a defined namespace
+ */
+ for (j = 1;j <= nbNs;j++)
+ if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL)
+ break;
+ if (j <= nbNs)
+ xmlErrAttributeDup(ctxt, NULL, attname);
+ else
+ if (nsPush(ctxt, NULL, URL) > 0) nbNs++;
+
+ } else if (aprefix == ctxt->str_xmlns) {
+ const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
+ xmlURIPtr uri;
+
+ if (attname == ctxt->str_xml) {
+ if (URL != ctxt->str_xml_ns) {
+ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+ "xml namespace prefix mapped to wrong URI\n",
+ NULL, NULL, NULL);
+ }
+ /*
+ * Do not keep a namespace definition node
+ */
+ goto next_attr;
+ }
+ if (URL == ctxt->str_xml_ns) {
+ if (attname != ctxt->str_xml) {
+ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+ "xml namespace URI mapped to wrong prefix\n",
+ NULL, NULL, NULL);
+ }
+ goto next_attr;
+ }
+ if (attname == ctxt->str_xmlns) {
+ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+ "redefinition of the xmlns prefix is forbidden\n",
+ NULL, NULL, NULL);
+ goto next_attr;
+ }
+ if ((len == 29) &&
+ (xmlStrEqual(URL,
+ BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
+ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+ "reuse of the xmlns namespace name is forbidden\n",
+ NULL, NULL, NULL);
+ goto next_attr;
+ }
+ if ((URL == NULL) || (URL[0] == 0)) {
+ xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
+ "xmlns:%s: Empty XML namespace is not allowed\n",
+ attname, NULL, NULL);
+ goto next_attr;
+ } else {
+ uri = xmlParseURI((const char *) URL);
+ if (uri == NULL) {
+ xmlNsErr(ctxt, XML_WAR_NS_URI,
+ "xmlns:%s: '%s' is not a valid URI\n",
+ attname, URL, NULL);
+ } else {
+ if ((ctxt->pedantic) && (uri->scheme == NULL)) {
+ xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
+ "xmlns:%s: URI %s is not absolute\n",
+ attname, URL, NULL);
+ }
+ xmlFreeURI(uri);
+ }
+ }
- /*
- * check that it's not a defined namespace
- */
- for (j = 1;j <= nbNs;j++)
- if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname)
- break;
- if (j <= nbNs)
- xmlErrAttributeDup(ctxt, aprefix, attname);
- else
- if (nsPush(ctxt, attname, URL) > 0) nbNs++;
-skip_ns:
- if ((attvalue != NULL) && (alloc != 0)) {
- xmlFree(attvalue);
- attvalue = NULL;
- }
- if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
- break;
- if (!IS_BLANK_CH(RAW)) {
- xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
- "attributes construct error\n");
- break;
- }
- SKIP_BLANKS;
- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
- goto base_changed;
- continue;
- }
+ /*
+ * check that it's not a defined namespace
+ */
+ for (j = 1;j <= nbNs;j++)
+ if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname)
+ break;
+ if (j <= nbNs)
+ xmlErrAttributeDup(ctxt, aprefix, attname);
+ else
+ if (nsPush(ctxt, attname, URL) > 0) nbNs++;
- /*
- * Add the pair to atts
- */
- if ((atts == NULL) || (nbatts + 5 > maxatts)) {
- if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
- if (attvalue[len] == 0)
- xmlFree(attvalue);
- goto failed;
- }
- maxatts = ctxt->maxatts;
- atts = ctxt->atts;
- }
- ctxt->attallocs[nratts++] = alloc;
- atts[nbatts++] = attname;
- atts[nbatts++] = aprefix;
- atts[nbatts++] = NULL; /* the URI will be fetched later */
- atts[nbatts++] = attvalue;
- attvalue += len;
- atts[nbatts++] = attvalue;
- /*
- * tag if some deallocation is needed
- */
- if (alloc != 0) attval = 1;
- } else {
- if ((attvalue != NULL) && (attvalue[len] == 0))
- xmlFree(attvalue);
- }
+ } else {
+ /*
+ * Add the pair to atts
+ */
+ if ((atts == NULL) || (nbatts + 5 > maxatts)) {
+ if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
+ goto next_attr;
+ }
+ maxatts = ctxt->maxatts;
+ atts = ctxt->atts;
+ }
+ ctxt->attallocs[nratts++] = alloc;
+ atts[nbatts++] = attname;
+ atts[nbatts++] = aprefix;
+ /*
+ * The namespace URI field is used temporarily to point at the
+ * base of the current input buffer for non-alloced attributes.
+ * When the input buffer is reallocated, all the pointers become
+ * invalid, but they can be reconstructed later.
+ */
+ if (alloc)
+ atts[nbatts++] = NULL;
+ else
+ atts[nbatts++] = ctxt->input->base;
+ atts[nbatts++] = attvalue;
+ attvalue += len;
+ atts[nbatts++] = attvalue;
+ /*
+ * tag if some deallocation is needed
+ */
+ if (alloc != 0) attval = 1;
+ attvalue = NULL; /* moved into atts */
+ }
-failed:
+next_attr:
+ if ((attvalue != NULL) && (alloc != 0)) {
+ xmlFree(attvalue);
+ attvalue = NULL;
+ }
GROW
if (ctxt->instate == XML_PARSER_EOF)
break;
- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
- goto base_changed;
if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
break;
- if (!IS_BLANK_CH(RAW)) {
+ if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"attributes construct error\n");
break;
}
- SKIP_BLANKS;
if ((cons == ctxt->input->consumed) && (q == CUR_PTR) &&
(attname == NULL) && (attvalue == NULL)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
@@ -9670,8 +9435,27 @@ failed:
break;
}
GROW;
- if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr))
- goto base_changed;
+ }
+
+ if (ctxt->input->id != inputid) {
+ xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
+ "Unexpected change of input\n");
+ localname = NULL;
+ goto done;
+ }
+
+ /* Reconstruct attribute value pointers. */
+ for (i = 0, j = 0; j < nratts; i += 5, j++) {
+ if (atts[i+2] != NULL) {
+ /*
+ * Arithmetic on dangling pointers is technically undefined
+ * behavior, but well...
+ */
+ ptrdiff_t offset = ctxt->input->base - atts[i+2];
+ atts[i+2] = NULL; /* Reset repurposed namespace URI */
+ atts[i+3] += offset; /* value */
+ atts[i+4] += offset; /* valuend */
+ }
}
/*
@@ -9731,7 +9515,8 @@ failed:
if ((atts == NULL) || (nbatts + 5 > maxatts)) {
if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
- return(NULL);
+ localname = NULL;
+ goto done;
}
maxatts = ctxt->maxatts;
atts = ctxt->atts;
@@ -9818,6 +9603,7 @@ failed:
nsname, 0, NULL, nbatts / 5, nbdef, atts);
}
+done:
/*
* Free up attribute allocated strings if needed
*/
@@ -9828,34 +9614,6 @@ failed:
}
return(localname);
-
-base_changed:
- /*
- * the attribute strings are valid iif the base didn't changed
- */
- if (attval != 0) {
- for (i = 3,j = 0; j < nratts;i += 5,j++)
- if ((ctxt->attallocs[j] != 0) && (atts[i] != NULL))
- xmlFree((xmlChar *) atts[i]);
- }
-
- /*
- * We can't switch from one entity to another in the middle
- * of a start tag
- */
- if (inputNr != ctxt->inputNr) {
- xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "Start tag doesn't start and stop in the same entity\n");
- return(NULL);
- }
-
- ctxt->input->cur = ctxt->input->base + cur;
- ctxt->input->line = oldline;
- ctxt->input->col = oldcol;
- if (ctxt->wellFormed == 1) {
- goto reparse;
- }
- return(NULL);
}
/**
@@ -10124,11 +9882,6 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
}
GROW;
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
SHRINK;
if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
@@ -11281,7 +11034,7 @@ xmlParseGetLasts(xmlParserCtxtPtr ctxt, const xmlChar **lastlt,
* Check that the block of characters is okay as SCdata content [20]
*
* Returns the number of bytes to pass if okay, a negative index where an
- * UTF-8 error occured otherwise
+ * UTF-8 error occurred otherwise
*/
static int
xmlCheckCdataPush(const xmlChar *utf, int len, int complete) {
@@ -11423,13 +11176,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
return(0);
-
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
-
if (ctxt->input == NULL) break;
if (ctxt->input->buf == NULL)
avail = ctxt->input->length -
@@ -11780,11 +11526,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
ctxt->checkIndex = 0;
xmlParseCharData(ctxt, 0);
}
- /*
- * Pop-up of finished entities.
- */
- while ((RAW == 0) && (ctxt->inputNr > 1))
- xmlPopInput(ctxt);
if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"detected an error in element content\n");
@@ -11807,9 +11548,10 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
}
if (ctxt->sax2) {
xmlParseEndTag2(ctxt,
- (void *) ctxt->pushTab[ctxt->nameNr * 3 - 3],
- (void *) ctxt->pushTab[ctxt->nameNr * 3 - 2], 0,
- (int) (long) ctxt->pushTab[ctxt->nameNr * 3 - 1], 0);
+ (void *) ctxt->pushTab[ctxt->nameNr * 3 - 3],
+ (void *) ctxt->pushTab[ctxt->nameNr * 3 - 2], 0,
+ (int) (ptrdiff_t)
+ ctxt->pushTab[ctxt->nameNr * 3 - 1], 0);
nameNsPop(ctxt);
}
#ifdef LIBXML_SAX1_ENABLED
@@ -12495,6 +12237,7 @@ xmldecl_done:
/* TODO 2.6.0 */
xmlGenericError(xmlGenericErrorContext,
"xmlParseChunk: encoder error\n");
+ xmlHaltParser(ctxt);
return(XML_ERR_INVALID_ENCODING);
}
xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current);
@@ -12727,6 +12470,8 @@ xmlHaltParser(xmlParserCtxtPtr ctxt) {
return;
ctxt->instate = XML_PARSER_EOF;
ctxt->disableSAX = 1;
+ while (ctxt->inputNr > 1)
+ xmlFreeInputStream(inputPop(ctxt));
if (ctxt->input != NULL) {
/*
* in case there was a specific allocation deallocate before
@@ -12736,8 +12481,14 @@ xmlHaltParser(xmlParserCtxtPtr ctxt) {
ctxt->input->free((xmlChar *) ctxt->input->base);
ctxt->input->free = NULL;
}
+ if (ctxt->input->buf != NULL) {
+ xmlFreeParserInputBuffer(ctxt->input->buf);
+ ctxt->input->buf = NULL;
+ }
ctxt->input->cur = BAD_CAST"";
+ ctxt->input->length = 0;
ctxt->input->base = ctxt->input->cur;
+ ctxt->input->end = ctxt->input->cur;
}
}
@@ -13506,7 +13257,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
/*
* And record the last error if any
*/
- if (ctxt->lastError.code != XML_ERR_OK)
+ if ((oldctxt != NULL) && (ctxt->lastError.code != XML_ERR_OK))
xmlCopyError(&ctxt->lastError, &oldctxt->lastError);
if (sax != NULL)
@@ -13640,6 +13391,7 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
ctxt->userData = ctxt;
if (ctxt->dict != NULL) xmlDictFree(ctxt->dict);
ctxt->dict = oldctxt->dict;
+ ctxt->input_id = oldctxt->input_id + 1;
ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3);
ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5);
ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
@@ -13893,6 +13645,7 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen,
xmlDetectSAX2(ctxt);
ctxt->myDoc = doc;
/* parsing in context, i.e. as within existing content */
+ ctxt->input_id = 2;
ctxt->instate = XML_PARSER_CONTENT;
fake = xmlNewComment(NULL);
@@ -14105,6 +13858,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
newDoc->oldNs = doc->oldNs;
}
ctxt->instate = XML_PARSER_CONTENT;
+ ctxt->input_id = 2;
ctxt->depth = depth;
/*
@@ -14265,6 +14019,11 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
if (pctx != NULL) {
ctxt->options = pctx->options;
ctxt->_private = pctx->_private;
+ /*
+ * this is a subparser of pctx, so the input_id should be
+ * incremented to distinguish from main entity
+ */
+ ctxt->input_id = pctx->input_id + 1;
}
uri = xmlBuildURI(URL, base);
@@ -15146,7 +14905,7 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) {
- xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree);
+ xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
ctxt->attsDefault = NULL;
}
if (ctxt->attsSpecial != NULL) {
diff --git a/chromium/third_party/libxml/src/parserInternals.c b/chromium/third_party/libxml/src/parserInternals.c
index bfc778ac1f7..265223b4822 100644
--- a/chromium/third_party/libxml/src/parserInternals.c
+++ b/chromium/third_party/libxml/src/parserInternals.c
@@ -10,7 +10,7 @@
#define IN_LIBXML
#include "libxml.h"
-#if defined(WIN32) && !defined (__CYGWIN__)
+#if defined(_WIN32) && !defined (__CYGWIN__)
#define XML_DIR_SEP '\\'
#else
#define XML_DIR_SEP '/'
@@ -32,7 +32,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
@@ -435,8 +435,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
if ((*ctxt->input->cur == 0) &&
(xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
- if ((ctxt->instate != XML_PARSER_COMMENT))
- xmlPopInput(ctxt);
return;
}
@@ -470,8 +468,8 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
c = *cur;
if (c & 0x80) {
- if (c == 0xC0)
- goto encoding_error;
+ if (c == 0xC0)
+ goto encoding_error;
if (cur[1] == 0) {
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
cur = ctxt->input->cur;
@@ -523,8 +521,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
ctxt->input->cur++;
ctxt->nbChars++;
- if (*ctxt->input->cur == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
} else {
/*
* Assume it's a fixed length encoding (1) with
@@ -538,14 +534,9 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
ctxt->input->col++;
ctxt->input->cur++;
ctxt->nbChars++;
- if (*ctxt->input->cur == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
}
- if ((*ctxt->input->cur == '%') && (!ctxt->html))
- xmlParserHandlePEReference(ctxt);
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
- xmlPopInput(ctxt);
+ if (*ctxt->input->cur == 0)
+ xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
return;
encoding_error:
/*
@@ -1101,8 +1092,15 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
break;
}
}
- if (handler == NULL)
+ /*
+ * TODO: We could recover from errors in external entites 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);
+ }
ctxt->charset = XML_CHAR_ENCODING_UTF8;
ret = xmlSwitchToEncodingInt(ctxt, handler, len);
if ((ret < 0) || (ctxt->errNo == XML_I18N_CONV_FAILED)) {
@@ -1226,6 +1224,7 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
*/
nbchars = xmlCharEncFirstLineInput(input->buf, len);
}
+ xmlBufResetInput(input->buf->buffer, input);
if (nbchars < 0) {
xmlErrInternal(ctxt,
"switching encoding: encoder error\n",
@@ -1233,7 +1232,6 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
return (-1);
}
input->buf->rawconsumed += use - xmlBufUse(input->buf->raw);
- xmlBufResetInput(input->buf->buffer, input);
}
return (0);
} else if (input->length == 0) {
@@ -1242,8 +1240,18 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
* size to be able to convert the buffer.
*/
xmlErrInternal(ctxt, "switching encoding : no input\n", NULL);
+ /*
+ * Callers assume that the input buffer takes ownership of the
+ * encoding handler. xmlCharEncCloseFunc frees unregistered
+ * handlers and avoids a memory leak.
+ */
+ xmlCharEncCloseFunc(handler);
return (-1);
}
+ /*
+ * We should actually raise an error here, see issue #34.
+ */
+ xmlCharEncCloseFunc(handler);
return (0);
}
@@ -1369,8 +1377,13 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
* should not happen while parsing which is the situation where
* the id is actually needed.
*/
- if (ctxt != NULL)
+ if (ctxt != NULL) {
+ if (ctxt->input_id >= INT_MAX) {
+ xmlErrMemory(ctxt, "Input ID overflow\n");
+ return(NULL);
+ }
input->id = ctxt->input_id++;
+ }
return(input);
}
@@ -1797,7 +1810,7 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
if (ctxt->pushTab != NULL) xmlFree(ctxt->pushTab);
if (ctxt->attallocs != NULL) xmlFree(ctxt->attallocs);
if (ctxt->attsDefault != NULL)
- xmlHashFree(ctxt->attsDefault, (xmlHashDeallocator) xmlFree);
+ xmlHashFree(ctxt->attsDefault, xmlHashDefaultDeallocator);
if (ctxt->attsSpecial != NULL)
xmlHashFree(ctxt->attsSpecial, NULL);
if (ctxt->freeElems != NULL) {
diff --git a/chromium/third_party/libxml/src/pattern.c b/chromium/third_party/libxml/src/pattern.c
index 33dee3aacef..0eb8d81244d 100644
--- a/chromium/third_party/libxml/src/pattern.c
+++ b/chromium/third_party/libxml/src/pattern.c
@@ -969,6 +969,7 @@ xmlCompileAttributeTest(xmlPatParserContextPtr ctxt) {
ERROR5(NULL, NULL, NULL,
"xmlCompileAttributeTest : no namespace bound to prefix %s\n",
prefix);
+ XML_PAT_FREE_STRING(ctxt, prefix);
ctxt->error = 1;
goto error;
}
diff --git a/chromium/third_party/libxml/src/runsuite.c b/chromium/third_party/libxml/src/runsuite.c
index aaab13e1ee6..767455bd0a4 100644
--- a/chromium/third_party/libxml/src/runsuite.c
+++ b/chromium/third_party/libxml/src/runsuite.c
@@ -327,10 +327,8 @@ xsdIncorectTestCase(xmlNodePtr cur) {
}
xmlNodeDump(buf, test->doc, test, 0, 0);
pctxt = xmlRelaxNGNewMemParserCtxt((const char *)buf->content, buf->use);
- xmlRelaxNGSetParserErrors(pctxt,
- (xmlRelaxNGValidityErrorFunc) testErrorHandler,
- (xmlRelaxNGValidityWarningFunc) testErrorHandler,
- pctxt);
+ xmlRelaxNGSetParserErrors(pctxt, testErrorHandler, testErrorHandler,
+ pctxt);
rng = xmlRelaxNGParse(pctxt);
xmlRelaxNGFreeParserCtxt(pctxt);
if (rng != NULL) {
@@ -462,10 +460,8 @@ xsdTestCase(xmlNodePtr tst) {
}
xmlNodeDump(buf, test->doc, test, 0, 0);
pctxt = xmlRelaxNGNewMemParserCtxt((const char *)buf->content, buf->use);
- xmlRelaxNGSetParserErrors(pctxt,
- (xmlRelaxNGValidityErrorFunc) testErrorHandler,
- (xmlRelaxNGValidityWarningFunc) testErrorHandler,
- pctxt);
+ xmlRelaxNGSetParserErrors(pctxt, testErrorHandler, testErrorHandler,
+ pctxt);
rng = xmlRelaxNGParse(pctxt);
xmlRelaxNGFreeParserCtxt(pctxt);
if (extraMemoryFromResolver)
@@ -510,9 +506,7 @@ xsdTestCase(xmlNodePtr tst) {
nb_tests++;
ctxt = xmlRelaxNGNewValidCtxt(rng);
xmlRelaxNGSetValidErrors(ctxt,
- (xmlRelaxNGValidityErrorFunc) testErrorHandler,
- (xmlRelaxNGValidityWarningFunc) testErrorHandler,
- ctxt);
+ testErrorHandler, testErrorHandler, ctxt);
ret = xmlRelaxNGValidateDoc(ctxt, doc);
xmlRelaxNGFreeValidCtxt(ctxt);
if (ret > 0) {
@@ -567,9 +561,7 @@ xsdTestCase(xmlNodePtr tst) {
nb_tests++;
ctxt = xmlRelaxNGNewValidCtxt(rng);
xmlRelaxNGSetValidErrors(ctxt,
- (xmlRelaxNGValidityErrorFunc) testErrorHandler,
- (xmlRelaxNGValidityWarningFunc) testErrorHandler,
- ctxt);
+ testErrorHandler, testErrorHandler, ctxt);
ret = xmlRelaxNGValidateDoc(ctxt, doc);
xmlRelaxNGFreeValidCtxt(ctxt);
if (ret == 0) {
@@ -825,10 +817,7 @@ xstcTestInstance(xmlNodePtr cur, xmlSchemaPtr schemas,
}
ctxt = xmlSchemaNewValidCtxt(schemas);
- xmlSchemaSetValidErrors(ctxt,
- (xmlSchemaValidityErrorFunc) testErrorHandler,
- (xmlSchemaValidityWarningFunc) testErrorHandler,
- ctxt);
+ xmlSchemaSetValidErrors(ctxt, testErrorHandler, testErrorHandler, ctxt);
ret = xmlSchemaValidateDoc(ctxt, doc);
if (xmlStrEqual(validity, BAD_CAST "valid")) {
@@ -916,10 +905,8 @@ xstcTestGroup(xmlNodePtr cur, const char *base) {
if (xmlStrEqual(validity, BAD_CAST "valid")) {
nb_schematas++;
ctxt = xmlSchemaNewParserCtxt((const char *) path);
- xmlSchemaSetParserErrors(ctxt,
- (xmlSchemaValidityErrorFunc) testErrorHandler,
- (xmlSchemaValidityWarningFunc) testErrorHandler,
- ctxt);
+ xmlSchemaSetParserErrors(ctxt, testErrorHandler, testErrorHandler,
+ ctxt);
schemas = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
if (schemas == NULL) {
@@ -952,10 +939,8 @@ xstcTestGroup(xmlNodePtr cur, const char *base) {
} else if (xmlStrEqual(validity, BAD_CAST "invalid")) {
nb_schematas++;
ctxt = xmlSchemaNewParserCtxt((const char *) path);
- xmlSchemaSetParserErrors(ctxt,
- (xmlSchemaValidityErrorFunc) testErrorHandler,
- (xmlSchemaValidityWarningFunc) testErrorHandler,
- ctxt);
+ xmlSchemaSetParserErrors(ctxt, testErrorHandler, testErrorHandler,
+ ctxt);
schemas = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
if (schemas != NULL) {
diff --git a/chromium/third_party/libxml/src/runtest.c b/chromium/third_party/libxml/src/runtest.c
index 18615773228..b1c30d8525d 100644
--- a/chromium/third_party/libxml/src/runtest.c
+++ b/chromium/third_party/libxml/src/runtest.c
@@ -23,8 +23,10 @@
#include <fcntl.h>
#include <libxml/parser.h>
+#include <libxml/parserInternals.h>
#include <libxml/tree.h>
#include <libxml/uri.h>
+#include <libxml/encoding.h>
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef LIBXML_READER_ENABLED
@@ -118,8 +120,8 @@ typedef struct
} glob_t;
#define GLOB_DOOFFS 0
-static int glob(const char *pattern, int flags,
- int errfunc(const char *epath, int eerrno),
+static int glob(const char *pattern, ATTRIBUTE_UNUSED int flags,
+ ATTRIBUTE_UNUSED int errfunc(const char *epath, int eerrno),
glob_t *pglob) {
glob_t *ret;
WIN32_FIND_DATA FindFileData;
@@ -585,8 +587,8 @@ static char *resultFilename(const char *filename, const char *out,
suffixbuff[0]='_';
#endif
- snprintf(res, 499, "%s%s%s", out, base, suffixbuff);
- res[499] = 0;
+ if (snprintf(res, 499, "%s%s%s", out, base, suffixbuff) >= 499)
+ res[499] = 0;
return(strdup(res));
}
@@ -688,7 +690,7 @@ static int compareFileMem(const char *filename, const char *mem, int size) {
}
if (info.st_size != size) {
fprintf(stderr, "file %s is %ld bytes, result is %d bytes\n",
- filename, info.st_size, size);
+ filename, (long) info.st_size, size);
return(-1);
}
fd = open(filename, RD_FLAGS);
@@ -1677,7 +1679,6 @@ static xmlSAXHandler debugHTMLSAXHandlerStruct = {
static xmlSAXHandlerPtr debugHTMLSAXHandler = &debugHTMLSAXHandlerStruct;
#endif /* LIBXML_HTML_ENABLED */
-#ifdef LIBXML_SAX1_ENABLED
/**
* saxParseTest:
* @filename: the file to parse
@@ -1718,7 +1719,15 @@ saxParseTest(const char *filename, const char *result,
ret = 0;
} else
#endif
- ret = xmlSAXUserParseFile(emptySAXHandler, NULL, filename);
+ {
+ xmlParserCtxtPtr ctxt = xmlCreateFileParserCtxt(filename);
+ memcpy(ctxt->sax, emptySAXHandler, sizeof(xmlSAXHandler));
+ xmlCtxtUseOptions(ctxt, options);
+ xmlParseDocument(ctxt);
+ ret = ctxt->wellFormed ? 0 : ctxt->errNo;
+ xmlFreeDoc(ctxt->myDoc);
+ xmlFreeParserCtxt(ctxt);
+ }
if (ret == XML_WAR_UNDECLARED_ENTITY) {
fprintf(SAXdebug, "xmlSAXUserParseFile returned error %d\n", ret);
ret = 0;
@@ -1734,10 +1743,19 @@ saxParseTest(const char *filename, const char *result,
ret = 0;
} else
#endif
- if (options & XML_PARSE_SAX1) {
- ret = xmlSAXUserParseFile(debugSAXHandler, NULL, filename);
- } else {
- ret = xmlSAXUserParseFile(debugSAX2Handler, NULL, filename);
+ {
+ xmlParserCtxtPtr ctxt = xmlCreateFileParserCtxt(filename);
+ if (options & XML_PARSE_SAX1) {
+ memcpy(ctxt->sax, debugSAXHandler, sizeof(xmlSAXHandler));
+ options -= XML_PARSE_SAX1;
+ } else {
+ memcpy(ctxt->sax, debugSAX2Handler, sizeof(xmlSAXHandler));
+ }
+ xmlCtxtUseOptions(ctxt, options);
+ xmlParseDocument(ctxt);
+ ret = ctxt->wellFormed ? 0 : ctxt->errNo;
+ xmlFreeDoc(ctxt->myDoc);
+ xmlFreeParserCtxt(ctxt);
}
if (ret == XML_WAR_UNDECLARED_ENTITY) {
fprintf(SAXdebug, "xmlSAXUserParseFile returned error %d\n", ret);
@@ -1761,7 +1779,6 @@ done:
return(ret);
}
-#endif
/************************************************************************
* *
@@ -1854,6 +1871,7 @@ pushParseTest(const char *filename, const char *result,
const char *base;
int size, res;
int cur = 0;
+ int chunkSize = 4;
nb_tests++;
/*
@@ -1864,17 +1882,21 @@ pushParseTest(const char *filename, const char *result,
return(-1);
}
+ if (chunkSize > size)
+ chunkSize = size;
+
#ifdef LIBXML_HTML_ENABLED
if (options & XML_PARSE_HTML)
- ctxt = htmlCreatePushParserCtxt(NULL, NULL, base + cur, 4, filename,
+ ctxt = htmlCreatePushParserCtxt(NULL, NULL, base + cur, chunkSize, filename,
XML_CHAR_ENCODING_NONE);
else
#endif
- ctxt = xmlCreatePushParserCtxt(NULL, NULL, base + cur, 4, filename);
+ ctxt = xmlCreatePushParserCtxt(NULL, NULL, base + cur, chunkSize, filename);
xmlCtxtUseOptions(ctxt, options);
- cur += 4;
+ cur += chunkSize;
+ chunkSize = 1024;
do {
- if (cur + 1024 >= size) {
+ if (cur + chunkSize >= size) {
#ifdef LIBXML_HTML_ENABLED
if (options & XML_PARSE_HTML)
htmlParseChunk(ctxt, base + cur, size - cur, 1);
@@ -1885,11 +1907,11 @@ pushParseTest(const char *filename, const char *result,
} else {
#ifdef LIBXML_HTML_ENABLED
if (options & XML_PARSE_HTML)
- htmlParseChunk(ctxt, base + cur, 1024, 0);
+ htmlParseChunk(ctxt, base + cur, chunkSize, 0);
else
#endif
- xmlParseChunk(ctxt, base + cur, 1024, 0);
- cur += 1024;
+ xmlParseChunk(ctxt, base + cur, chunkSize, 0);
+ cur += chunkSize;
}
} while (cur < size);
doc = ctxt->myDoc;
@@ -2142,7 +2164,8 @@ static void processNode(FILE *out, xmlTextReaderPtr reader) {
}
static int
streamProcessTest(const char *filename, const char *result, const char *err,
- xmlTextReaderPtr reader, const char *rng, int options) {
+ xmlTextReaderPtr reader, const char *rng,
+ int options ATTRIBUTE_UNUSED) {
int ret;
char *temp = NULL;
FILE *t = NULL;
@@ -2478,13 +2501,17 @@ xpathDocTest(const char *filename,
return(-1);
}
- snprintf(pattern, 499, "./test/XPath/tests/%s*", baseFilename(filename));
- pattern[499] = 0;
+ res = snprintf(pattern, 499, "./test/XPath/tests/%s*",
+ 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++) {
- snprintf(result, 499, "result/XPath/tests/%s",
+ res = snprintf(result, 499, "result/XPath/tests/%s",
baseFilename(globbuf.gl_pathv[i]));
+ if (res >= 499)
+ result[499] = 0;
res = xpathCommonTest(globbuf.gl_pathv[i], &result[0], 0, 0);
if (res != 0)
ret = res;
@@ -2526,13 +2553,17 @@ xptrDocTest(const char *filename,
return(-1);
}
- snprintf(pattern, 499, "./test/XPath/xptr/%s*", baseFilename(filename));
- pattern[499] = 0;
+ res = snprintf(pattern, 499, "./test/XPath/xptr/%s*",
+ 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++) {
- snprintf(result, 499, "result/XPath/xptr/%s",
+ res = snprintf(result, 499, "result/XPath/xptr/%s",
baseFilename(globbuf.gl_pathv[i]));
+ if (res >= 499)
+ result[499] = 0;
res = xpathCommonTest(globbuf.gl_pathv[i], &result[0], 1, 0);
if (res != 0)
ret = res;
@@ -2988,10 +3019,7 @@ schemasOneTest(const char *sch,
}
ctxt = xmlSchemaNewValidCtxt(schemas);
- xmlSchemaSetValidErrors(ctxt,
- (xmlSchemaValidityErrorFunc) testErrorHandler,
- (xmlSchemaValidityWarningFunc) testErrorHandler,
- ctxt);
+ xmlSchemaSetValidErrors(ctxt, testErrorHandler, testErrorHandler, ctxt);
validResult = xmlSchemaValidateDoc(ctxt, doc);
if (validResult == 0) {
fprintf(schemasOutput, "%s validates\n", filename);
@@ -3056,10 +3084,7 @@ schemasTest(const char *filename,
/* first compile the schemas if possible */
ctxt = xmlSchemaNewParserCtxt(filename);
- xmlSchemaSetParserErrors(ctxt,
- (xmlSchemaValidityErrorFunc) testErrorHandler,
- (xmlSchemaValidityWarningFunc) testErrorHandler,
- ctxt);
+ xmlSchemaSetParserErrors(ctxt, testErrorHandler, testErrorHandler, ctxt);
schemas = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
@@ -3081,8 +3106,8 @@ schemasTest(const char *filename,
memcpy(prefix, base, len);
prefix[len] = 0;
- snprintf(pattern, 499, "./test/schemas/%s_?.xml", prefix);
- pattern[499] = 0;
+ if (snprintf(pattern, 499, "./test/schemas/%s_?.xml", prefix) >= 499)
+ pattern[499] = 0;
if (base[len] == '_') {
len += 2;
@@ -3100,12 +3125,14 @@ schemasTest(const char *filename,
len = strlen(base2);
if ((len > 6) && (base2[len - 6] == '_')) {
count = base2[len - 5];
- snprintf(result, 499, "result/schemas/%s_%c",
+ ret = snprintf(result, 499, "result/schemas/%s_%c",
prefix, count);
- result[499] = 0;
- snprintf(err, 499, "result/schemas/%s_%c.err",
+ if (ret >= 499)
+ result[499] = 0;
+ ret = snprintf(err, 499, "result/schemas/%s_%c.err",
prefix, count);
- err[499] = 0;
+ if (ret >= 499)
+ err[499] = 0;
} else {
fprintf(stderr, "don't know how to process %s\n", instance);
continue;
@@ -3163,10 +3190,7 @@ rngOneTest(const char *sch,
}
ctxt = xmlRelaxNGNewValidCtxt(schemas);
- xmlRelaxNGSetValidErrors(ctxt,
- (xmlRelaxNGValidityErrorFunc) testErrorHandler,
- (xmlRelaxNGValidityWarningFunc) testErrorHandler,
- ctxt);
+ xmlRelaxNGSetValidErrors(ctxt, testErrorHandler, testErrorHandler, ctxt);
ret = xmlRelaxNGValidateDoc(ctxt, doc);
if (ret == 0) {
testErrorHandler(NULL, "%s validates\n", filename);
@@ -3233,10 +3257,7 @@ rngTest(const char *filename,
/* first compile the schemas if possible */
ctxt = xmlRelaxNGNewParserCtxt(filename);
- xmlRelaxNGSetParserErrors(ctxt,
- (xmlRelaxNGValidityErrorFunc) testErrorHandler,
- (xmlRelaxNGValidityWarningFunc) testErrorHandler,
- ctxt);
+ xmlRelaxNGSetParserErrors(ctxt, testErrorHandler, testErrorHandler, ctxt);
schemas = xmlRelaxNGParse(ctxt);
xmlRelaxNGFreeParserCtxt(ctxt);
@@ -3252,8 +3273,8 @@ rngTest(const char *filename,
memcpy(prefix, base, len);
prefix[len] = 0;
- snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix);
- pattern[499] = 0;
+ if (snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix) >= 499)
+ pattern[499] = 0;
globbuf.gl_offs = 0;
glob(pattern, GLOB_DOOFFS, NULL, &globbuf);
@@ -3265,12 +3286,14 @@ rngTest(const char *filename,
len = strlen(base2);
if ((len > 6) && (base2[len - 6] == '_')) {
count = base2[len - 5];
- snprintf(result, 499, "result/relaxng/%s_%c",
+ res = snprintf(result, 499, "result/relaxng/%s_%c",
prefix, count);
- result[499] = 0;
- snprintf(err, 499, "result/relaxng/%s_%c.err",
+ if (res >= 499)
+ result[499] = 0;
+ res = snprintf(err, 499, "result/relaxng/%s_%c.err",
prefix, count);
- err[499] = 0;
+ if (res >= 499)
+ err[499] = 0;
} else {
fprintf(stderr, "don't know how to process %s\n", instance);
continue;
@@ -3278,7 +3301,7 @@ rngTest(const char *filename,
if (schemas == NULL) {
} else {
nb_tests++;
- ret = rngOneTest(filename, instance, result, err,
+ res = rngOneTest(filename, instance, result, err,
options, schemas);
if (res != 0)
ret = res;
@@ -3341,8 +3364,8 @@ rngStreamTest(const char *filename,
(!strcmp(prefix, "tutor8_2")))
disable_err = 1;
- snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix);
- pattern[499] = 0;
+ if (snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix) >= 499)
+ pattern[499] = 0;
globbuf.gl_offs = 0;
glob(pattern, GLOB_DOOFFS, NULL, &globbuf);
@@ -3354,12 +3377,14 @@ rngStreamTest(const char *filename,
len = strlen(base2);
if ((len > 6) && (base2[len - 6] == '_')) {
count = base2[len - 5];
- snprintf(result, 499, "result/relaxng/%s_%c",
+ ret = snprintf(result, 499, "result/relaxng/%s_%c",
prefix, count);
- result[499] = 0;
- snprintf(err, 499, "result/relaxng/%s_%c.err",
+ if (ret >= 499)
+ result[499] = 0;
+ ret = snprintf(err, 499, "result/relaxng/%s_%c.err",
prefix, count);
- err[499] = 0;
+ if (ret >= 499)
+ err[499] = 0;
} else {
fprintf(stderr, "don't know how to process %s\n", instance);
continue;
@@ -3484,8 +3509,8 @@ patternTest(const char *filename,
len -= 4;
memcpy(xml, filename, len);
xml[len] = 0;
- snprintf(result, 499, "result/pattern/%s", baseFilename(xml));
- result[499] = 0;
+ if (snprintf(result, 499, "result/pattern/%s", baseFilename(xml)) >= 499)
+ result[499] = 0;
memcpy(xml + len, ".xml", 5);
if (!checkTestFile(xml) && !update_results) {
@@ -3862,17 +3887,20 @@ c14nCommonTest(const char *filename, int with_comments, int mode,
memcpy(prefix, base, len);
prefix[len] = 0;
- snprintf(buf, 499, "result/c14n/%s/%s", subdir,prefix);
+ 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);
- snprintf(buf, 499, "test/c14n/%s/%s.xpath", subdir,prefix);
+ if (snprintf(buf, 499, "test/c14n/%s/%s.xpath", subdir, prefix) >= 499)
+ buf[499] = 0;
if (checkTestFile(buf)) {
xpath = strdup(buf);
}
- snprintf(buf, 499, "test/c14n/%s/%s.ns", subdir,prefix);
+ if (snprintf(buf, 499, "test/c14n/%s/%s.ns", subdir, prefix) >= 499)
+ buf[499] = 0;
if (checkTestFile(buf)) {
ns = strdup(buf);
}
@@ -3917,7 +3945,7 @@ c14n11WithoutCommentTest(const char *filename,
return(c14nCommonTest(filename, 0, XML_C14N_1_1, "1-1-without-comments"));
}
#endif
-#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined (LIBXML_SAX1_ENABLED)
+#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED)
/************************************************************************
* *
* Catalog and threads test *
@@ -3929,19 +3957,23 @@ c14n11WithoutCommentTest(const char *filename,
*/
#define MAX_ARGC 20
+typedef struct {
+ const char *filename;
+ int okay;
+} xmlThreadParams;
+
static const char *catalog = "test/threads/complex.xml";
-static const char *testfiles[] = {
- "test/threads/abc.xml",
- "test/threads/acb.xml",
- "test/threads/bac.xml",
- "test/threads/bca.xml",
- "test/threads/cab.xml",
- "test/threads/cba.xml",
- "test/threads/invalid.xml",
+static xmlThreadParams threadParams[] = {
+ { "test/threads/abc.xml", 0 },
+ { "test/threads/acb.xml", 0 },
+ { "test/threads/bac.xml", 0 },
+ { "test/threads/bca.xml", 0 },
+ { "test/threads/cab.xml", 0 },
+ { "test/threads/cba.xml", 0 },
+ { "test/threads/invalid.xml", 0 }
};
-
-static const char *Okay = "OK";
-static const char *Failed = "Failed";
+static const unsigned int num_threads = sizeof(threadParams) /
+ sizeof(threadParams[0]);
#ifndef xmlDoValidityCheckingDefaultValue
#error xmlDoValidityCheckingDefaultValue is not a macro
@@ -3954,7 +3986,8 @@ static void *
thread_specific_data(void *private_data)
{
xmlDocPtr myDoc;
- const char *filename = (const char *) private_data;
+ xmlThreadParams *params = (xmlThreadParams *) private_data;
+ const char *filename = params->filename;
int okay = 1;
if (!strcmp(filename, "test/threads/invalid.xml")) {
@@ -3964,7 +3997,11 @@ thread_specific_data(void *private_data)
xmlDoValidityCheckingDefaultValue = 1;
xmlGenericErrorContext = stderr;
}
+#ifdef LIBXML_SAX1_ENABLED
myDoc = xmlParseFile(filename);
+#else
+ myDoc = xmlReadFile(filename, NULL, XML_WITH_CATALOG);
+#endif
if (myDoc) {
xmlFreeDoc(myDoc);
} else {
@@ -3990,12 +4027,11 @@ thread_specific_data(void *private_data)
okay = 0;
}
}
- if (okay == 0)
- return ((void *) Failed);
- return ((void *) Okay);
+ params->okay = okay;
+ return(NULL);
}
-#if defined WIN32
+#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
#include <string.h>
@@ -4006,15 +4042,14 @@ static HANDLE tid[MAX_ARGC];
static DWORD WINAPI
win32_thread_specific_data(void *private_data)
{
- return((DWORD) thread_specific_data(private_data));
+ thread_specific_data(private_data);
+ return(0);
}
static int
testThread(void)
{
unsigned int i, repeat;
- unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]);
- DWORD results[MAX_ARGC];
BOOL ret;
int res = 0;
@@ -4024,7 +4059,6 @@ testThread(void)
nb_tests++;
for (i = 0; i < num_threads; i++) {
- results[i] = 0;
tid[i] = (HANDLE) - 1;
}
@@ -4033,7 +4067,7 @@ testThread(void)
tid[i] = CreateThread(NULL, 0,
win32_thread_specific_data,
- (void *) testfiles[i], 0,
+ (void *) &threadParams[i], 0,
&useless);
if (tid[i] == NULL) {
fprintf(stderr, "CreateThread failed\n");
@@ -4048,7 +4082,8 @@ testThread(void)
}
for (i = 0; i < num_threads; i++) {
- ret = GetExitCodeThread(tid[i], &results[i]);
+ DWORD exitCode;
+ ret = GetExitCodeThread(tid[i], &exitCode);
if (ret == 0) {
fprintf(stderr, "GetExitCodeThread failed\n");
return(1);
@@ -4058,9 +4093,9 @@ testThread(void)
xmlCatalogCleanup();
for (i = 0; i < num_threads; i++) {
- if (results[i] != (DWORD) Okay) {
+ if (threadParams[i].okay == 0) {
fprintf(stderr, "Thread %d handling %s failed\n",
- i, testfiles[i]);
+ i, threadParams[i].filename);
res = 1;
}
}
@@ -4078,8 +4113,6 @@ static int
testThread(void)
{
unsigned int i, repeat;
- unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]);
- void *results[MAX_ARGC];
status_t ret;
int res = 0;
@@ -4087,13 +4120,12 @@ testThread(void)
for (repeat = 0; repeat < 500; repeat++) {
xmlLoadCatalog(catalog);
for (i = 0; i < num_threads; i++) {
- results[i] = NULL;
tid[i] = (thread_id) - 1;
}
for (i = 0; i < num_threads; i++) {
tid[i] =
spawn_thread(thread_specific_data, "xmlTestThread",
- B_NORMAL_PRIORITY, (void *) testfiles[i]);
+ B_NORMAL_PRIORITY, (void *) &threadParams[i]);
if (tid[i] < B_OK) {
fprintf(stderr, "beos_thread_create failed\n");
return (1);
@@ -4101,7 +4133,8 @@ testThread(void)
printf("beos_thread_create %d -> %d\n", i, tid[i]);
}
for (i = 0; i < num_threads; i++) {
- ret = wait_for_thread(tid[i], &results[i]);
+ void *result;
+ ret = wait_for_thread(tid[i], &result);
printf("beos_thread_wait %d -> %d\n", i, ret);
if (ret != B_OK) {
fprintf(stderr, "beos_thread_wait failed\n");
@@ -4112,8 +4145,9 @@ testThread(void)
xmlCatalogCleanup();
ret = B_OK;
for (i = 0; i < num_threads; i++)
- if (results[i] != (void *) Okay) {
- printf("Thread %d handling %s failed\n", i, testfiles[i]);
+ if (threadParams[i].okay == 0) {
+ printf("Thread %d handling %s failed\n", i,
+ threadParams[i].filename);
ret = B_ERROR;
}
}
@@ -4131,8 +4165,6 @@ static int
testThread(void)
{
unsigned int i, repeat;
- unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]);
- void *results[MAX_ARGC];
int ret;
int res = 0;
@@ -4143,20 +4175,20 @@ testThread(void)
nb_tests++;
for (i = 0; i < num_threads; i++) {
- results[i] = NULL;
tid[i] = (pthread_t) - 1;
}
for (i = 0; i < num_threads; i++) {
ret = pthread_create(&tid[i], 0, thread_specific_data,
- (void *) testfiles[i]);
+ (void *) &threadParams[i]);
if (ret != 0) {
fprintf(stderr, "pthread_create failed\n");
return (1);
}
}
for (i = 0; i < num_threads; i++) {
- ret = pthread_join(tid[i], &results[i]);
+ void *result;
+ ret = pthread_join(tid[i], &result);
if (ret != 0) {
fprintf(stderr, "pthread_join failed\n");
return (1);
@@ -4165,9 +4197,9 @@ testThread(void)
xmlCatalogCleanup();
for (i = 0; i < num_threads; i++)
- if (results[i] != (void *) Okay) {
+ if (threadParams[i].okay == 0) {
fprintf(stderr, "Thread %d handling %s failed\n",
- i, testfiles[i]);
+ i, threadParams[i].filename);
res = 1;
}
}
@@ -4214,6 +4246,9 @@ testDesc testDescriptions[] = {
{ "Error cases regression tests",
errParseTest, "./test/errors/*.xml", "result/errors/", "", ".err",
0 },
+ { "Error cases regression tests (old 1.0)",
+ errParseTest, "./test/errors10/*.xml", "result/errors10/", "", ".err",
+ XML_PARSE_OLD10 },
#ifdef LIBXML_READER_ENABLED
{ "Error cases stream regression tests",
streamParseTest, "./test/errors/*.xml", "result/errors/", NULL, ".str",
@@ -4235,10 +4270,13 @@ testDesc testDescriptions[] = {
{ "SAX1 callbacks regression tests" ,
saxParseTest, "./test/*", "result/", ".sax", NULL,
XML_PARSE_SAX1 },
+#endif
{ "SAX2 callbacks regression tests" ,
saxParseTest, "./test/*", "result/", ".sax2", NULL,
0 },
-#endif
+ { "SAX2 callbacks regression tests with entity substitution" ,
+ saxParseTest, "./test/*", "result/noent/", ".sax2", NULL,
+ XML_PARSE_NOENT },
#ifdef LIBXML_PUSH_ENABLED
{ "XML push regression tests" ,
pushParseTest, "./test/*", "result/", "", NULL,
@@ -4253,12 +4291,10 @@ testDesc testDescriptions[] = {
pushParseTest, "./test/HTML/*", "result/HTML/", "", ".err",
XML_PARSE_HTML },
#endif
-#ifdef LIBXML_SAX1_ENABLED
{ "HTML SAX regression tests" ,
saxParseTest, "./test/HTML/*", "result/HTML/", ".sax", NULL,
XML_PARSE_HTML },
#endif
-#endif
#ifdef LIBXML_VALID_ENABLED
{ "Valid documents regression tests" ,
errParseTest, "./test/VCM/*", NULL, NULL, NULL,
@@ -4361,7 +4397,7 @@ testDesc testDescriptions[] = {
c14n11WithoutCommentTest, "./test/c14n/1-1-without-comments/*.xml", NULL, NULL, NULL,
0 },
#endif
-#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_SAX1_ENABLED)
+#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED)
{ "Catalog and Threads regression tests" ,
threadsTest, NULL, NULL, NULL, NULL,
0 },
@@ -4382,6 +4418,10 @@ launchTests(testDescPtr tst) {
char *result;
char *error;
int mem;
+ xmlCharEncodingHandlerPtr ebcdicHandler, eucJpHandler;
+
+ ebcdicHandler = xmlGetCharEncodingHandler(XML_CHAR_ENCODING_EBCDIC);
+ eucJpHandler = xmlGetCharEncodingHandler(XML_CHAR_ENCODING_EUC_JP);
if (tst == NULL) return(-1);
if (tst->in != NULL) {
@@ -4392,6 +4432,11 @@ launchTests(testDescPtr tst) {
for (i = 0;i < globbuf.gl_pathc;i++) {
if (!checkTestFile(globbuf.gl_pathv[i]))
continue;
+ if (((ebcdicHandler == NULL) &&
+ (strstr(globbuf.gl_pathv[i], "ebcdic") != NULL)) ||
+ ((eucJpHandler == NULL) &&
+ (strstr(globbuf.gl_pathv[i], "icu_parse_test") != NULL)))
+ continue;
if (tst->suffix != NULL) {
result = resultFilename(globbuf.gl_pathv[i], tst->out,
tst->suffix);
@@ -4457,6 +4502,10 @@ launchTests(testDescPtr tst) {
err++;
}
}
+
+ xmlCharEncCloseFunc(ebcdicHandler);
+ xmlCharEncCloseFunc(eucJpHandler);
+
return(err);
}
@@ -4493,6 +4542,11 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
int i, a, ret = 0;
int subset = 0;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ setvbuf(stdout, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
+#endif
+
initializeLibxml2();
for (a = 1; a < argc;a++) {
diff --git a/chromium/third_party/libxml/src/testC14N.c b/chromium/third_party/libxml/src/testC14N.c
index 86e58f27e40..addc800e0be 100644
--- a/chromium/third_party/libxml/src/testC14N.c
+++ b/chromium/third_party/libxml/src/testC14N.c
@@ -18,6 +18,9 @@
#define STDOUT_FILENO fileno(stdout)
#endif /* HAVE_UNISTD_H */
#endif
+#ifdef _WIN32
+#include <io.h>
+#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
diff --git a/chromium/third_party/libxml/src/testRelax.c b/chromium/third_party/libxml/src/testRelax.c
index 8e94a7a8194..3549f938f1d 100644
--- a/chromium/third_party/libxml/src/testRelax.c
+++ b/chromium/third_party/libxml/src/testRelax.c
@@ -101,9 +101,7 @@ int main(int argc, char **argv) {
ctxt = xmlRelaxNGNewMemParserCtxt((char *)base,info.st_size);
xmlRelaxNGSetParserErrors(ctxt,
- (xmlRelaxNGValidityErrorFunc) fprintf,
- (xmlRelaxNGValidityWarningFunc) fprintf,
- stderr);
+ xmlGenericError, xmlGenericError, NULL);
schema = xmlRelaxNGParse(ctxt);
xmlRelaxNGFreeParserCtxt(ctxt);
munmap((char *) base, info.st_size);
@@ -112,9 +110,7 @@ int main(int argc, char **argv) {
{
ctxt = xmlRelaxNGNewParserCtxt(argv[i]);
xmlRelaxNGSetParserErrors(ctxt,
- (xmlRelaxNGValidityErrorFunc) fprintf,
- (xmlRelaxNGValidityWarningFunc) fprintf,
- stderr);
+ xmlGenericError, xmlGenericError, NULL);
schema = xmlRelaxNGParse(ctxt);
xmlRelaxNGFreeParserCtxt(ctxt);
}
@@ -144,9 +140,7 @@ int main(int argc, char **argv) {
ctxt = xmlRelaxNGNewValidCtxt(schema);
xmlRelaxNGSetValidErrors(ctxt,
- (xmlRelaxNGValidityErrorFunc) fprintf,
- (xmlRelaxNGValidityWarningFunc) fprintf,
- stderr);
+ xmlGenericError, xmlGenericError, NULL);
ret = xmlRelaxNGValidateDoc(ctxt, doc);
if (ret == 0) {
printf("%s validates\n", argv[i]);
diff --git a/chromium/third_party/libxml/src/testSchemas.c b/chromium/third_party/libxml/src/testSchemas.c
index b98e6313e43..fc39862c641 100644
--- a/chromium/third_party/libxml/src/testSchemas.c
+++ b/chromium/third_party/libxml/src/testSchemas.c
@@ -97,9 +97,7 @@ int main(int argc, char **argv) {
ctxt = xmlSchemaNewMemParserCtxt((char *)base,info.st_size);
xmlSchemaSetParserErrors(ctxt,
- (xmlSchemaValidityErrorFunc) fprintf,
- (xmlSchemaValidityWarningFunc) fprintf,
- stderr);
+ xmlGenericError, xmlGenericError, NULL);
schema = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
munmap((char *) base, info.st_size);
@@ -108,9 +106,7 @@ int main(int argc, char **argv) {
{
ctxt = xmlSchemaNewParserCtxt(argv[i]);
xmlSchemaSetParserErrors(ctxt,
- (xmlSchemaValidityErrorFunc) fprintf,
- (xmlSchemaValidityWarningFunc) fprintf,
- stderr);
+ xmlGenericError, xmlGenericError, NULL);
schema = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
}
@@ -135,9 +131,7 @@ int main(int argc, char **argv) {
ctxt = xmlSchemaNewValidCtxt(schema);
xmlSchemaSetValidErrors(ctxt,
- (xmlSchemaValidityErrorFunc) fprintf,
- (xmlSchemaValidityWarningFunc) fprintf,
- stderr);
+ xmlGenericError, xmlGenericError, NULL);
ret = xmlSchemaValidateDoc(ctxt, doc);
if (ret == 0) {
printf("%s validates\n", argv[i]);
diff --git a/chromium/third_party/libxml/src/testThreads.c b/chromium/third_party/libxml/src/testThreads.c
index bff53912ecb..bef6537744b 100644
--- a/chromium/third_party/libxml/src/testThreads.c
+++ b/chromium/third_party/libxml/src/testThreads.c
@@ -3,13 +3,15 @@
#include <stdlib.h>
#include <stdio.h>
-#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_SAX1_ENABLED)
+#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED)
#include <libxml/globals.h>
#include <libxml/threads.h>
#include <libxml/parser.h>
#include <libxml/catalog.h>
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
+#elif defined HAVE_WIN32_THREADS
+#include <windows.h>
#elif defined HAVE_BEOS_THREADS
#include <OS.h>
#endif
@@ -20,25 +22,32 @@
#include <assert.h>
#define MAX_ARGC 20
+#define TEST_REPEAT_COUNT 500
#ifdef HAVE_PTHREAD_H
static pthread_t tid[MAX_ARGC];
+#elif defined HAVE_WIN32_THREADS
+static HANDLE tid[MAX_ARGC];
#elif defined HAVE_BEOS_THREADS
static thread_id tid[MAX_ARGC];
#endif
+typedef struct {
+ const char *filename;
+ int okay;
+} xmlThreadParams;
+
static const char *catalog = "test/threads/complex.xml";
-static const char *testfiles[] = {
- "test/threads/abc.xml",
- "test/threads/acb.xml",
- "test/threads/bac.xml",
- "test/threads/bca.xml",
- "test/threads/cab.xml",
- "test/threads/cba.xml",
- "test/threads/invalid.xml",
+static xmlThreadParams threadParams[] = {
+ { "test/threads/abc.xml", 0 },
+ { "test/threads/acb.xml", 0 },
+ { "test/threads/bac.xml", 0 },
+ { "test/threads/bca.xml", 0 },
+ { "test/threads/cab.xml", 0 },
+ { "test/threads/cba.xml", 0 },
+ { "test/threads/invalid.xml", 0 }
};
-
-static const char *Okay = "OK";
-static const char *Failed = "Failed";
+static const unsigned int num_threads = sizeof(threadParams) /
+ sizeof(threadParams[0]);
#ifndef xmlDoValidityCheckingDefaultValue
#error xmlDoValidityCheckingDefaultValue is not a macro
@@ -51,7 +60,8 @@ static void *
thread_specific_data(void *private_data)
{
xmlDocPtr myDoc;
- const char *filename = (const char *) private_data;
+ xmlThreadParams *params = (xmlThreadParams *) private_data;
+ const char *filename = params->filename;
int okay = 1;
if (!strcmp(filename, "test/threads/invalid.xml")) {
@@ -61,7 +71,11 @@ thread_specific_data(void *private_data)
xmlDoValidityCheckingDefaultValue = 1;
xmlGenericErrorContext = stderr;
}
+#ifdef LIBXML_SAX1_ENABLED
myDoc = xmlParseFile(filename);
+#else
+ myDoc = xmlReadFile(filename, NULL, XML_WITH_CATALOG);
+#endif
if (myDoc) {
xmlFreeDoc(myDoc);
} else {
@@ -87,9 +101,8 @@ thread_specific_data(void *private_data)
okay = 0;
}
}
- if (okay == 0)
- return((void *) Failed);
- return ((void *) Okay);
+ params->okay = okay;
+ return(NULL);
}
#ifdef HAVE_PTHREAD_H
@@ -97,27 +110,25 @@ int
main(void)
{
unsigned int i, repeat;
- unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]);
- void *results[MAX_ARGC];
int ret;
xmlInitParser();
- for (repeat = 0;repeat < 500;repeat++) {
+ for (repeat = 0;repeat < TEST_REPEAT_COUNT;repeat++) {
xmlLoadCatalog(catalog);
- memset(results, 0, sizeof(*results)*num_threads);
memset(tid, 0xff, sizeof(*tid)*num_threads);
for (i = 0; i < num_threads; i++) {
ret = pthread_create(&tid[i], NULL, thread_specific_data,
- (void *) testfiles[i]);
+ (void *) &threadParams[i]);
if (ret != 0) {
perror("pthread_create");
exit(1);
}
}
for (i = 0; i < num_threads; i++) {
- ret = pthread_join(tid[i], &results[i]);
+ void *result;
+ ret = pthread_join(tid[i], &result);
if (ret != 0) {
perror("pthread_join");
exit(1);
@@ -126,11 +137,76 @@ main(void)
xmlCatalogCleanup();
for (i = 0; i < num_threads; i++)
- if (results[i] != (void *) Okay)
- printf("Thread %d handling %s failed\n", i, testfiles[i]);
+ if (threadParams[i].okay == 0)
+ printf("Thread %d handling %s failed\n", i,
+ threadParams[i].filename);
+ }
+ xmlCleanupParser();
+ xmlMemoryDump();
+ return (0);
+}
+#elif defined HAVE_WIN32_THREADS
+static DWORD WINAPI
+win32_thread_specific_data(void *private_data)
+{
+ thread_specific_data(private_data);
+ return(0);
+}
+
+int
+main(void)
+{
+ unsigned int i, repeat;
+ BOOL ret;
+
+ xmlInitParser();
+ for (repeat = 0;repeat < TEST_REPEAT_COUNT;repeat++)
+ {
+ xmlLoadCatalog(catalog);
+
+ for (i = 0; i < num_threads; i++)
+ {
+ tid[i] = (HANDLE) -1;
+ }
+
+ for (i = 0; i < num_threads; i++)
+ {
+ DWORD useless;
+ tid[i] = CreateThread(NULL, 0,
+ win32_thread_specific_data, &threadParams[i], 0, &useless);
+ if (tid[i] == NULL)
+ {
+ perror("CreateThread");
+ exit(1);
+ }
+ }
+
+ if (WaitForMultipleObjects (num_threads, tid, TRUE, INFINITE) == WAIT_FAILED)
+ perror ("WaitForMultipleObjects failed");
+
+ for (i = 0; i < num_threads; i++)
+ {
+ DWORD exitCode;
+ ret = GetExitCodeThread (tid[i], &exitCode);
+ if (ret == 0)
+ {
+ perror("GetExitCodeThread");
+ exit(1);
+ }
+ CloseHandle (tid[i]);
+ }
+
+ xmlCatalogCleanup();
+ for (i = 0; i < num_threads; i++) {
+ if (threadParams[i].okay == 0)
+ printf("Thread %d handling %s failed\n", i,
+ threadParams[i].filename);
+ }
}
+
xmlCleanupParser();
xmlMemoryDump();
+
return (0);
}
#elif defined HAVE_BEOS_THREADS
@@ -138,23 +214,20 @@ int
main(void)
{
unsigned int i, repeat;
- unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]);
- void *results[MAX_ARGC];
status_t ret;
xmlInitParser();
printf("Parser initialized\n");
- for (repeat = 0;repeat < 500;repeat++) {
+ 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++) {
- results[i] = NULL;
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 *) testfiles[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);
@@ -162,7 +235,8 @@ main(void)
printf("beos_thread_create %d -> %d\n", i, tid[i]);
}
for (i = 0; i < num_threads; i++) {
- ret = wait_for_thread(tid[i], &results[i]);
+ void *result;
+ ret = wait_for_thread(tid[i], &result);
printf("beos_thread_wait %d -> %d\n", i, ret);
if (ret != B_OK) {
perror("beos_thread_wait");
@@ -173,8 +247,9 @@ main(void)
xmlCatalogCleanup();
ret = B_OK;
for (i = 0; i < num_threads; i++)
- if (results[i] != (void *) Okay) {
- printf("Thread %d handling %s failed\n", i, testfiles[i]);
+ if (threadParams[i].okay == 0) {
+ printf("Thread %d handling %s failed\n", i,
+ threadParams[i].filename);
ret = B_ERROR;
}
}
diff --git a/chromium/third_party/libxml/src/testURI.c b/chromium/third_party/libxml/src/testURI.c
index d20989d4b35..0043b203dde 100644
--- a/chromium/third_party/libxml/src/testURI.c
+++ b/chromium/third_party/libxml/src/testURI.c
@@ -19,6 +19,7 @@
static const char *base = NULL;
static int escape = 0;
static int debug = 0;
+static int relative = 0;
static void handleURI(const char *str) {
int ret;
@@ -57,7 +58,12 @@ static void handleURI(const char *str) {
}
}
} else {
- res = xmlBuildURI((xmlChar *)str, (xmlChar *) base);
+ if (relative) {
+ res = xmlBuildRelativeURI((xmlChar *)str, (xmlChar *) base);
+ } else {
+ res = xmlBuildURI((xmlChar *)str, (xmlChar *) base);
+ }
+
if (res != NULL) {
printf("%s\n", (char *) res);
}
@@ -75,6 +81,11 @@ int main(int argc, char **argv) {
int i, arg = 1;
if ((argc > arg) && (argv[arg] != NULL) &&
+ (!strcmp(argv[arg], "--relative"))) {
+ arg++;
+ relative++;
+ }
+ if ((argc > arg) && (argv[arg] != NULL) &&
((!strcmp(argv[arg], "-base")) || (!strcmp(argv[arg], "--base")))) {
arg++;
base = argv[arg];
diff --git a/chromium/third_party/libxml/src/testapi.c b/chromium/third_party/libxml/src/testapi.c
index 60f4bddb7ca..980d7fb5497 100644
--- a/chromium/third_party/libxml/src/testapi.c
+++ b/chromium/third_party/libxml/src/testapi.c
@@ -737,7 +737,8 @@ static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtx
#define gen_nb_xmlHashDeallocator 2
static void
-test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
+test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
}
static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
@@ -1480,6 +1481,9 @@ test_htmlCreateMemoryParserCtxt(void) {
mem_base = xmlMemBlocks();
buffer = gen_const_char_ptr(n_buffer, 0);
size = gen_int(n_size, 1);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
desret_htmlParserCtxtPtr(ret_val);
@@ -1547,6 +1551,9 @@ test_htmlCreatePushParserCtxt(void) {
size = gen_int(n_size, 3);
filename = gen_fileoutput(n_filename, 4);
enc = gen_xmlCharEncoding(n_enc, 5);
+ if ((chunk != NULL) &&
+ (size > (int) strlen((const char *) chunk) + 1))
+ continue;
ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
desret_htmlParserCtxtPtr(ret_val);
@@ -1721,6 +1728,9 @@ test_htmlCtxtReadMemory(void) {
URL = gen_filepath(n_URL, 3);
encoding = gen_const_char_ptr(n_encoding, 4);
options = gen_int(n_options, 5);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
desret_htmlDocPtr(ret_val);
@@ -2278,6 +2288,9 @@ test_htmlParseChunk(void) {
chunk = gen_const_char_ptr(n_chunk, 1);
size = gen_int(n_size, 2);
terminate = gen_int(n_terminate, 3);
+ if ((chunk != NULL) &&
+ (size > (int) strlen((const char *) chunk) + 1))
+ continue;
ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
@@ -2321,16 +2334,16 @@ test_htmlParseDoc(void) {
char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
int n_encoding;
- for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
+ for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
mem_base = xmlMemBlocks();
- cur = gen_xmlChar_ptr(n_cur, 0);
+ cur = gen_const_xmlChar_ptr(n_cur, 0);
encoding = gen_const_char_ptr(n_encoding, 1);
- ret_val = htmlParseDoc(cur, (const char *)encoding);
+ ret_val = htmlParseDoc((const xmlChar *)cur, (const char *)encoding);
desret_htmlDocPtr(ret_val);
call_tests++;
- des_xmlChar_ptr(n_cur, cur, 0);
+ des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
des_const_char_ptr(n_encoding, (const char *)encoding, 1);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
@@ -2621,6 +2634,9 @@ test_htmlReadMemory(void) {
URL = gen_filepath(n_URL, 2);
encoding = gen_const_char_ptr(n_encoding, 3);
options = gen_int(n_options, 4);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
desret_htmlDocPtr(ret_val);
@@ -2670,20 +2686,20 @@ test_htmlSAXParseDoc(void) {
void * userData; /* if using SAX, this pointer will be provided on callbacks. */
int n_userData;
- for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
+ for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
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();
- cur = gen_xmlChar_ptr(n_cur, 0);
+ cur = gen_const_xmlChar_ptr(n_cur, 0);
encoding = gen_const_char_ptr(n_encoding, 1);
sax = gen_htmlSAXHandlerPtr(n_sax, 2);
userData = gen_userdata(n_userData, 3);
- ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
+ ret_val = htmlSAXParseDoc((const xmlChar *)cur, (const char *)encoding, sax, userData);
desret_htmlDocPtr(ret_val);
call_tests++;
- des_xmlChar_ptr(n_cur, cur, 0);
+ des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
des_const_char_ptr(n_encoding, (const char *)encoding, 1);
des_htmlSAXHandlerPtr(n_sax, sax, 2);
des_userdata(n_userData, userData, 3);
@@ -3870,6 +3886,9 @@ test_xmlSAX2CDataBlock(void) {
ctx = gen_void_ptr(n_ctx, 0);
value = gen_const_xmlChar_ptr(n_value, 1);
len = gen_int(n_len, 2);
+ if ((value != NULL) &&
+ (len > (int) strlen((const char *) value) + 1))
+ continue;
xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
call_tests++;
@@ -3914,6 +3933,9 @@ test_xmlSAX2Characters(void) {
ctx = gen_void_ptr(n_ctx, 0);
ch = gen_const_xmlChar_ptr(n_ch, 1);
len = gen_int(n_len, 2);
+ if ((ch != NULL) &&
+ (len > (int) strlen((const char *) ch) + 1))
+ continue;
xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
call_tests++;
@@ -4554,6 +4576,9 @@ test_xmlSAX2IgnorableWhitespace(void) {
ctx = gen_void_ptr(n_ctx, 0);
ch = gen_const_xmlChar_ptr(n_ch, 1);
len = gen_int(n_len, 2);
+ if ((ch != NULL) &&
+ (len > (int) strlen((const char *) ch) + 1))
+ continue;
xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
call_tests++;
@@ -7486,13 +7511,6 @@ test_xmlLsOneNode(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) {
-}
-
static int
test_xmlShell(void) {
int test_ret = 0;
@@ -7503,6 +7521,13 @@ 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) {
+}
+
static int
test_xmlShellBase(void) {
int test_ret = 0;
@@ -8221,6 +8246,9 @@ test_xmlDictExists(void) {
dict = gen_xmlDictPtr(n_dict, 0);
name = gen_const_xmlChar_ptr(n_name, 1);
len = gen_int(n_len, 2);
+ if ((name != NULL) &&
+ (len > (int) strlen((const char *) name) + 1))
+ continue;
ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
desret_const_xmlChar_ptr(ret_val);
@@ -8277,6 +8305,9 @@ test_xmlDictLookup(void) {
dict = gen_xmlDictPtr(n_dict, 0);
name = gen_const_xmlChar_ptr(n_name, 1);
len = gen_int(n_len, 2);
+ if ((name != NULL) &&
+ (len > (int) strlen((const char *) name) + 1))
+ continue;
ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
desret_const_xmlChar_ptr(ret_val);
@@ -9303,13 +9334,6 @@ test_xmlCleanupPredefinedEntities(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) {
-}
-
static int
test_xmlCopyEntitiesTable(void) {
int test_ret = 0;
@@ -9330,6 +9354,13 @@ 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) {
+}
+
static int
test_xmlDumpEntitiesTable(void) {
int test_ret = 0;
@@ -9958,6 +9989,43 @@ test_xmlHashCreateDict(void) {
static int
+test_xmlHashDefaultDeallocator(void) {
+ int test_ret = 0;
+
+ int mem_base;
+ void * entry; /* the hash table entry */
+ int n_entry;
+ xmlChar * name; /* the entry's name */
+ int n_name;
+
+ for (n_entry = 0;n_entry < gen_nb_void_ptr;n_entry++) {
+ for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
+ mem_base = xmlMemBlocks();
+ entry = gen_void_ptr(n_entry, 0);
+ name = gen_const_xmlChar_ptr(n_name, 1);
+
+ xmlHashDefaultDeallocator(entry, (const xmlChar *)name);
+ call_tests++;
+ des_void_ptr(n_entry, entry, 0);
+ des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in xmlHashDefaultDeallocator",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf(" %d", n_entry);
+ printf(" %d", n_name);
+ printf("\n");
+ }
+ }
+ }
+ function_tests++;
+
+ return(test_ret);
+}
+
+
+static int
test_xmlHashLookup(void) {
int test_ret = 0;
@@ -10689,13 +10757,14 @@ static int
test_hash(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
+ if (quiet == 0) printf("Testing hash : 17 of 25 functions ...\n");
test_ret += test_xmlHashAddEntry();
test_ret += test_xmlHashAddEntry2();
test_ret += test_xmlHashAddEntry3();
test_ret += test_xmlHashCopy();
test_ret += test_xmlHashCreate();
test_ret += test_xmlHashCreateDict();
+ test_ret += test_xmlHashDefaultDeallocator();
test_ret += test_xmlHashLookup();
test_ret += test_xmlHashLookup2();
test_ret += test_xmlHashLookup3();
@@ -12727,6 +12796,9 @@ test_xmlCreatePushParserCtxt(void) {
chunk = gen_const_char_ptr(n_chunk, 2);
size = gen_int(n_size, 3);
filename = gen_fileoutput(n_filename, 4);
+ if ((chunk != NULL) &&
+ (size > (int) strlen((const char *) chunk) + 1))
+ continue;
ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
desret_xmlParserCtxtPtr(ret_val);
@@ -12905,6 +12977,9 @@ test_xmlCtxtReadMemory(void) {
URL = gen_filepath(n_URL, 3);
encoding = gen_const_char_ptr(n_encoding, 4);
options = gen_parseroptions(n_options, 5);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
desret_xmlDocPtr(ret_val);
@@ -12998,6 +13073,9 @@ test_xmlCtxtResetPush(void) {
size = gen_int(n_size, 2);
filename = gen_filepath(n_filename, 3);
encoding = gen_const_char_ptr(n_encoding, 4);
+ if ((chunk != NULL) &&
+ (size > (int) strlen((const char *) chunk) + 1))
+ continue;
ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
desret_int(ret_val);
@@ -13709,6 +13787,9 @@ test_xmlParseChunk(void) {
chunk = gen_const_char_ptr(n_chunk, 1);
size = gen_int(n_size, 2);
terminate = gen_int(n_terminate, 3);
+ if ((chunk != NULL) &&
+ (size > (int) strlen((const char *) chunk) + 1))
+ continue;
ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
@@ -14166,6 +14247,9 @@ test_xmlParseMemory(void) {
mem_base = xmlMemBlocks();
buffer = gen_const_char_ptr(n_buffer, 0);
size = gen_int(n_size, 1);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlParseMemory((const char *)buffer, size);
desret_xmlDocPtr(ret_val);
@@ -14578,6 +14662,9 @@ test_xmlReadMemory(void) {
URL = gen_filepath(n_URL, 2);
encoding = gen_const_char_ptr(n_encoding, 3);
options = gen_parseroptions(n_options, 4);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
desret_xmlDocPtr(ret_val);
@@ -14700,6 +14787,9 @@ test_xmlRecoverMemory(void) {
mem_base = xmlMemBlocks();
buffer = gen_const_char_ptr(n_buffer, 0);
size = gen_int(n_size, 1);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlRecoverMemory((const char *)buffer, size);
desret_xmlDocPtr(ret_val);
@@ -15001,6 +15091,9 @@ test_xmlSAXParseMemory(void) {
buffer = gen_const_char_ptr(n_buffer, 1);
size = gen_int(n_size, 2);
recovery = gen_int(n_recovery, 3);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
desret_xmlDocPtr(ret_val);
@@ -15062,6 +15155,9 @@ test_xmlSAXParseMemoryWithData(void) {
size = gen_int(n_size, 2);
recovery = gen_int(n_recovery, 3);
data = gen_userdata(n_data, 4);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
desret_xmlDocPtr(ret_val);
@@ -15177,6 +15273,9 @@ test_xmlSAXUserParseMemory(void) {
user_data = gen_userdata(n_user_data, 1);
buffer = gen_const_char_ptr(n_buffer, 2);
size = gen_int(n_size, 3);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
#ifdef LIBXML_SAX1_ENABLED
if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
@@ -15948,6 +16047,9 @@ test_xmlCreateMemoryParserCtxt(void) {
mem_base = xmlMemBlocks();
buffer = gen_const_char_ptr(n_buffer, 0);
size = gen_int(n_size, 1);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
desret_xmlParserCtxtPtr(ret_val);
@@ -16603,6 +16705,9 @@ test_xmlStringLenDecodeEntities(void) {
end = gen_xmlChar(n_end, 4);
end2 = gen_xmlChar(n_end2, 5);
end3 = gen_xmlChar(n_end3, 6);
+ if ((str != NULL) &&
+ (len > (int) strlen((const char *) str) + 1))
+ continue;
ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
desret_xmlChar_ptr(ret_val);
@@ -17573,6 +17678,9 @@ test_xmlRelaxNGNewMemParserCtxt(void) {
mem_base = xmlMemBlocks();
buffer = gen_const_char_ptr(n_buffer, 0);
size = gen_int(n_size, 1);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
desret_xmlRelaxNGParserCtxtPtr(ret_val);
@@ -17849,6 +17957,9 @@ test_xmlRelaxNGValidatePushCData(void) {
ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
data = gen_const_xmlChar_ptr(n_data, 1);
len = gen_int(n_len, 2);
+ if ((data != NULL) &&
+ (len > (int) strlen((const char *) data) + 1))
+ continue;
ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
desret_int(ret_val);
@@ -18034,16 +18145,6 @@ test_xmlSchematronNewParserCtxt(void) {
return(test_ret);
}
-#ifdef LIBXML_SCHEMATRON_ENABLED
-
-#define gen_nb_xmlSchematronPtr 1
-static xmlSchematronPtr gen_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, xmlSchematronPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-#endif
-
static int
test_xmlSchematronNewValidCtxt(void) {
@@ -18054,19 +18155,19 @@ test_xmlSchematronNewValidCtxt(void) {
return(test_ret);
}
-#ifdef LIBXML_SCHEMATRON_ENABLED
-#define gen_nb_xmlSchematronParserCtxtPtr 1
-static xmlSchematronParserCtxtPtr gen_xmlSchematronParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSchematronParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
+static int
+test_xmlSchematronParse(void) {
+ int test_ret = 0;
+
+
+ /* missing type support */
+ return(test_ret);
}
-#endif
static int
-test_xmlSchematronParse(void) {
+test_xmlSchematronSetValidStructuredErrors(void) {
int test_ret = 0;
@@ -18086,16 +18187,6 @@ static void des_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematron
static int
-test_xmlSchematronSetValidStructuredErrors(void) {
- int test_ret = 0;
-
-
- /* missing type support */
- return(test_ret);
-}
-
-
-static int
test_xmlSchematronValidateDoc(void) {
int test_ret = 0;
@@ -18554,13 +18645,6 @@ test_xmlBufShrink(void) {
}
-#define gen_nb_const_xmlBufPtr 1
-static xmlBufPtr gen_const_xmlBufPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_const_xmlBufPtr(int no ATTRIBUTE_UNUSED, const xmlBufPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-
static int
test_xmlBufUse(void) {
int test_ret = 0;
@@ -18591,6 +18675,9 @@ test_xmlBufferAdd(void) {
buf = gen_xmlBufferPtr(n_buf, 0);
str = gen_const_xmlChar_ptr(n_str, 1);
len = gen_int(n_len, 2);
+ if ((str != NULL) &&
+ (len > (int) strlen((const char *) str) + 1))
+ continue;
ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
desret_int(ret_val);
@@ -18637,6 +18724,9 @@ test_xmlBufferAddHead(void) {
buf = gen_xmlBufferPtr(n_buf, 0);
str = gen_const_xmlChar_ptr(n_str, 1);
len = gen_int(n_len, 2);
+ if ((str != NULL) &&
+ (len > (int) strlen((const char *) str) + 1))
+ continue;
ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
desret_int(ret_val);
@@ -19209,6 +19299,9 @@ test_xmlBuildQName(void) {
prefix = gen_const_xmlChar_ptr(n_prefix, 1);
memory = gen_xmlChar_ptr(n_memory, 2);
len = gen_int(n_len, 3);
+ if ((prefix != NULL) &&
+ (len > (int) strlen((const char *) prefix) + 1))
+ continue;
ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
if ((ret_val != NULL) && (ret_val != ncname) &&
@@ -20980,6 +21073,9 @@ test_xmlNewCDataBlock(void) {
doc = gen_xmlDocPtr(n_doc, 0);
content = gen_const_xmlChar_ptr(n_content, 1);
len = gen_int(n_len, 2);
+ if ((content != NULL) &&
+ (len > (int) strlen((const char *) content) + 1))
+ continue;
ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
desret_xmlNodePtr(ret_val);
@@ -21553,6 +21649,9 @@ test_xmlNewDocTextLen(void) {
doc = gen_xmlDocPtr(n_doc, 0);
content = gen_const_xmlChar_ptr(n_content, 1);
len = gen_int(n_len, 2);
+ if ((content != NULL) &&
+ (len > (int) strlen((const char *) content) + 1))
+ continue;
ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
desret_xmlNodePtr(ret_val);
@@ -22096,6 +22195,9 @@ test_xmlNewTextLen(void) {
mem_base = xmlMemBlocks();
content = gen_const_xmlChar_ptr(n_content, 0);
len = gen_int(n_len, 1);
+ if ((content != NULL) &&
+ (len > (int) strlen((const char *) content) + 1))
+ continue;
ret_val = xmlNewTextLen((const xmlChar *)content, len);
desret_xmlNodePtr(ret_val);
@@ -22209,6 +22311,9 @@ test_xmlNodeAddContentLen(void) {
cur = gen_xmlNodePtr(n_cur, 0);
content = gen_const_xmlChar_ptr(n_content, 1);
len = gen_int(n_len, 2);
+ if ((content != NULL) &&
+ (len > (int) strlen((const char *) content) + 1))
+ continue;
xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
call_tests++;
@@ -22759,6 +22864,9 @@ test_xmlNodeSetContentLen(void) {
cur = gen_xmlNodePtr(n_cur, 0);
content = gen_const_xmlChar_ptr(n_content, 1);
len = gen_int(n_len, 2);
+ if ((content != NULL) &&
+ (len > (int) strlen((const char *) content) + 1))
+ continue;
xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
call_tests++;
@@ -23823,6 +23931,9 @@ test_xmlStringLenGetNodeList(void) {
doc = gen_const_xmlDoc_ptr(n_doc, 0);
value = gen_const_xmlChar_ptr(n_value, 1);
len = gen_int(n_len, 2);
+ if ((value != NULL) &&
+ (len > (int) strlen((const char *) value) + 1))
+ continue;
ret_val = xmlStringLenGetNodeList((const xmlDoc *)doc, (const xmlChar *)value, len);
desret_xmlNodePtr(ret_val);
@@ -23869,6 +23980,9 @@ test_xmlTextConcat(void) {
node = gen_xmlNodePtr(n_node, 0);
content = gen_const_xmlChar_ptr(n_content, 1);
len = gen_int(n_len, 2);
+ if ((content != NULL) &&
+ (len > (int) strlen((const char *) content) + 1))
+ continue;
ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
desret_int(ret_val);
@@ -24959,13 +25073,6 @@ test_xmlAddRef(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) {
-}
-
static int
test_xmlCopyAttributeTable(void) {
int test_ret = 0;
@@ -25047,13 +25154,6 @@ test_xmlCopyElementContent(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) {
-}
-
static int
test_xmlCopyElementTable(void) {
int test_ret = 0;
@@ -25074,13 +25174,6 @@ test_xmlCopyEnumeration(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) {
-}
-
static int
test_xmlCopyNotationTable(void) {
int test_ret = 0;
@@ -25147,6 +25240,13 @@ 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) {
+}
+
static int
test_xmlDumpAttributeTable(void) {
int test_ret = 0;
@@ -25232,6 +25332,13 @@ 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) {
+}
+
static int
test_xmlDumpElementTable(void) {
int test_ret = 0;
@@ -25317,6 +25424,13 @@ 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) {
+}
+
static int
test_xmlDumpNotationTable(void) {
int test_ret = 0;
@@ -27125,6 +27239,9 @@ test_xmlValidatePushCData(void) {
ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
data = gen_const_xmlChar_ptr(n_data, 1);
len = gen_int(n_len, 2);
+ if ((data != NULL) &&
+ (len > (int) strlen((const char *) data) + 1))
+ continue;
ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
desret_int(ret_val);
@@ -28661,6 +28778,9 @@ test_xmlOutputBufferWrite(void) {
out = gen_xmlOutputBufferPtr(n_out, 0);
len = gen_int(n_len, 1);
buf = gen_const_char_ptr(n_buf, 2);
+ if ((buf != NULL) &&
+ (len > (int) strlen((const char *) buf) + 1))
+ continue;
ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
desret_int(ret_val);
@@ -28887,6 +29007,9 @@ test_xmlParserInputBufferCreateMem(void) {
mem = gen_const_char_ptr(n_mem, 0);
size = gen_int(n_size, 1);
enc = gen_xmlCharEncoding(n_enc, 2);
+ if ((mem != NULL) &&
+ (size > (int) strlen((const char *) mem) + 1))
+ continue;
ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
desret_xmlParserInputBufferPtr(ret_val);
@@ -28933,6 +29056,9 @@ test_xmlParserInputBufferCreateStatic(void) {
mem = gen_const_char_ptr(n_mem, 0);
size = gen_int(n_size, 1);
enc = gen_xmlCharEncoding(n_enc, 2);
+ if ((mem != NULL) &&
+ (size > (int) strlen((const char *) mem) + 1))
+ continue;
ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
desret_xmlParserInputBufferPtr(ret_val);
@@ -29018,6 +29144,9 @@ test_xmlParserInputBufferPush(void) {
in = gen_xmlParserInputBufferPtr(n_in, 0);
len = gen_int(n_len, 1);
buf = gen_const_char_ptr(n_buf, 2);
+ if ((buf != NULL) &&
+ (len > (int) strlen((const char *) buf) + 1))
+ continue;
ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
desret_int(ret_val);
@@ -29233,16 +29362,6 @@ test_xmlIO(void) {
printf("Module xmlIO: %d errors\n", test_ret);
return(test_ret);
}
-#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) {
-}
-#endif
-
static int
test_xmlAutomataCompile(void) {
@@ -29263,6 +29382,16 @@ test_xmlAutomataGetInitState(void) {
return(test_ret);
}
+#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) {
+}
+#endif
+
static int
test_xmlAutomataIsDeterminist(void) {
@@ -29297,16 +29426,6 @@ test_xmlAutomataIsDeterminist(void) {
return(test_ret);
}
-#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) {
-}
-#endif
-
static int
test_xmlAutomataNewAllTrans(void) {
@@ -29475,6 +29594,16 @@ test_xmlAutomataNewTransition2(void) {
return(test_ret);
}
+#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) {
+}
+#endif
+
static int
test_xmlAutomataSetFinalState(void) {
@@ -30200,6 +30329,9 @@ test_xmlReaderForMemory(void) {
URL = gen_filepath(n_URL, 2);
encoding = gen_const_char_ptr(n_encoding, 3);
options = gen_parseroptions(n_options, 4);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
desret_xmlTextReaderPtr(ret_val);
@@ -30383,6 +30515,9 @@ test_xmlReaderNewMemory(void) {
URL = gen_filepath(n_URL, 3);
encoding = gen_const_char_ptr(n_encoding, 4);
options = gen_parseroptions(n_options, 5);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
desret_int(ret_val);
@@ -33746,16 +33881,6 @@ test_xmlRegExecPushString2(void) {
return(test_ret);
}
-#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) {
-}
-#endif
-
static int
test_xmlRegNewExecCtxt(void) {
@@ -33776,6 +33901,16 @@ test_xmlRegexpCompile(void) {
return(test_ret);
}
+#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) {
+}
+#endif
+
static int
test_xmlRegexpExec(void) {
@@ -34420,6 +34555,9 @@ test_xmlSchemaNewMemParserCtxt(void) {
mem_base = xmlMemBlocks();
buffer = gen_const_char_ptr(n_buffer, 0);
size = gen_int(n_size, 1);
+ if ((buffer != NULL) &&
+ (size > (int) strlen((const char *) buffer) + 1))
+ continue;
ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
desret_xmlSchemaParserCtxtPtr(ret_val);
@@ -34497,16 +34635,6 @@ test_xmlSchemaParse(void) {
return(test_ret);
}
-#ifdef LIBXML_SCHEMAS_ENABLED
-
-#define gen_nb_xmlSAXHandlerPtr_ptr 1
-static xmlSAXHandlerPtr * gen_xmlSAXHandlerPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
- return(NULL);
-}
-static void des_xmlSAXHandlerPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-#endif
-
static int
test_xmlSchemaSAXPlug(void) {
@@ -36304,6 +36432,9 @@ test_xmlCharStrndup(void) {
mem_base = xmlMemBlocks();
cur = gen_const_char_ptr(n_cur, 0);
len = gen_int(n_len, 1);
+ if ((cur != NULL) &&
+ (len > (int) strlen((const char *) cur) + 1))
+ continue;
ret_val = xmlCharStrndup((const char *)cur, len);
desret_xmlChar_ptr(ret_val);
@@ -36743,6 +36874,9 @@ test_xmlStrncasecmp(void) {
str1 = gen_const_xmlChar_ptr(n_str1, 0);
str2 = gen_const_xmlChar_ptr(n_str2, 1);
len = gen_int(n_len, 2);
+ if ((str2 != NULL) &&
+ (len > (int) strlen((const char *) str2) + 1))
+ continue;
ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
desret_int(ret_val);
@@ -36789,6 +36923,9 @@ test_xmlStrncatNew(void) {
str1 = gen_const_xmlChar_ptr(n_str1, 0);
str2 = gen_const_xmlChar_ptr(n_str2, 1);
len = gen_int(n_len, 2);
+ if ((str2 != NULL) &&
+ (len > (int) strlen((const char *) str2) + 1))
+ continue;
ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
desret_xmlChar_ptr(ret_val);
@@ -36835,6 +36972,9 @@ test_xmlStrncmp(void) {
str1 = gen_const_xmlChar_ptr(n_str1, 0);
str2 = gen_const_xmlChar_ptr(n_str2, 1);
len = gen_int(n_len, 2);
+ if ((str2 != NULL) &&
+ (len > (int) strlen((const char *) str2) + 1))
+ continue;
ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
desret_int(ret_val);
@@ -36877,6 +37017,9 @@ test_xmlStrndup(void) {
mem_base = xmlMemBlocks();
cur = gen_const_xmlChar_ptr(n_cur, 0);
len = gen_int(n_len, 1);
+ if ((cur != NULL) &&
+ (len > (int) strlen((const char *) cur) + 1))
+ continue;
ret_val = xmlStrndup((const xmlChar *)cur, len);
desret_xmlChar_ptr(ret_val);
@@ -36959,6 +37102,12 @@ test_xmlStrsub(void) {
str = gen_const_xmlChar_ptr(n_str, 0);
start = gen_int(n_start, 1);
len = gen_int(n_len, 2);
+ if ((str != NULL) &&
+ (start > (int) strlen((const char *) str) + 1))
+ continue;
+ if ((str != NULL) &&
+ (len > (int) strlen((const char *) str) + 1))
+ continue;
ret_val = xmlStrsub((const xmlChar *)str, start, len);
desret_xmlChar_ptr(ret_val);
@@ -37143,6 +37292,9 @@ test_xmlUTF8Strndup(void) {
mem_base = xmlMemBlocks();
utf = gen_const_xmlChar_ptr(n_utf, 0);
len = gen_int(n_len, 1);
+ if ((utf != NULL) &&
+ (len > (int) strlen((const char *) utf) + 1))
+ continue;
ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
desret_xmlChar_ptr(ret_val);
@@ -37221,6 +37373,9 @@ test_xmlUTF8Strsize(void) {
mem_base = xmlMemBlocks();
utf = gen_const_xmlChar_ptr(n_utf, 0);
len = gen_int(n_len, 1);
+ if ((utf != NULL) &&
+ (len > (int) strlen((const char *) utf) + 1))
+ continue;
ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
desret_int(ret_val);
@@ -37264,6 +37419,12 @@ test_xmlUTF8Strsub(void) {
utf = gen_const_xmlChar_ptr(n_utf, 0);
start = gen_int(n_start, 1);
len = gen_int(n_len, 2);
+ if ((utf != NULL) &&
+ (start > (int) strlen((const char *) utf) + 1))
+ continue;
+ if ((utf != NULL) &&
+ (len > (int) strlen((const char *) utf) + 1))
+ continue;
ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
desret_xmlChar_ptr(ret_val);
@@ -44576,6 +44737,12 @@ test_xmlTextWriterWriteBase64(void) {
data = gen_const_char_ptr(n_data, 1);
start = gen_int(n_start, 2);
len = gen_int(n_len, 3);
+ if ((data != NULL) &&
+ (start > (int) strlen((const char *) data) + 1))
+ continue;
+ if ((data != NULL) &&
+ (len > (int) strlen((const char *) data) + 1))
+ continue;
ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
desret_int(ret_val);
@@ -44631,6 +44798,12 @@ test_xmlTextWriterWriteBinHex(void) {
data = gen_const_char_ptr(n_data, 1);
start = gen_int(n_start, 2);
len = gen_int(n_len, 3);
+ if ((data != NULL) &&
+ (start > (int) strlen((const char *) data) + 1))
+ continue;
+ if ((data != NULL) &&
+ (len > (int) strlen((const char *) data) + 1))
+ continue;
ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
desret_int(ret_val);
@@ -45561,6 +45734,9 @@ test_xmlTextWriterWriteRawLen(void) {
writer = gen_xmlTextWriterPtr(n_writer, 0);
content = gen_const_xmlChar_ptr(n_content, 1);
len = gen_int(n_len, 2);
+ if ((content != NULL) &&
+ (len > (int) strlen((const char *) content) + 1))
+ continue;
ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
desret_int(ret_val);
diff --git a/chromium/third_party/libxml/src/testlimits.c b/chromium/third_party/libxml/src/testlimits.c
index 577f593ce49..68c94dbcf2b 100644
--- a/chromium/third_party/libxml/src/testlimits.c
+++ b/chromium/third_party/libxml/src/testlimits.c
@@ -1284,13 +1284,14 @@ saxTest(const char *filename, size_t limit, int options, int fail) {
if (fail)
res = 0;
else {
- fprintf(stderr, "Failed to parse '%s' %lu\n", filename, limit);
+ fprintf(stderr, "Failed to parse '%s' %lu\n", filename,
+ (unsigned long) limit);
res = 1;
}
} else {
if (fail) {
fprintf(stderr, "Failed to get failure for '%s' %lu\n",
- filename, limit);
+ filename, (unsigned long) limit);
res = 1;
} else
res = 0;
@@ -1339,7 +1340,7 @@ readerTest(const char *filename, size_t limit, int options, int fail) {
filename, crazy_indx);
else
fprintf(stderr, "Failed to parse '%s' %lu\n",
- filename, limit);
+ filename, (unsigned long) limit);
res = 1;
}
} else {
@@ -1349,7 +1350,7 @@ readerTest(const char *filename, size_t limit, int options, int fail) {
filename, crazy_indx);
else
fprintf(stderr, "Failed to get failure for '%s' %lu\n",
- filename, limit);
+ filename, (unsigned long) limit);
res = 1;
} else
res = 0;
diff --git a/chromium/third_party/libxml/src/testrecurse.c b/chromium/third_party/libxml/src/testrecurse.c
index e5d5d1b307a..64b9cd0b7ea 100644
--- a/chromium/third_party/libxml/src/testrecurse.c
+++ b/chromium/third_party/libxml/src/testrecurse.c
@@ -69,8 +69,8 @@ typedef struct
} glob_t;
#define GLOB_DOOFFS 0
-static int glob(const char *pattern, int flags,
- int errfunc(const char *epath, int eerrno),
+static int glob(const char *pattern, ATTRIBUTE_UNUSED int flags,
+ ATTRIBUTE_UNUSED int errfunc(const char *epath, int eerrno),
glob_t *pglob) {
glob_t *ret;
WIN32_FIND_DATA FindFileData;
@@ -632,8 +632,8 @@ static char *resultFilename(const char *filename, const char *out,
suffixbuff[0]='_';
#endif
- snprintf(res, 499, "%s%s%s", out, base, suffixbuff);
- res[499] = 0;
+ if (snprintf(res, 499, "%s%s%s", out, base, suffixbuff) >= 499)
+ res[499] = 0;
return(strdup(res));
}
diff --git a/chromium/third_party/libxml/src/threads.c b/chromium/third_party/libxml/src/threads.c
index b9d6cae3533..0433ac0f591 100644
--- a/chromium/third_party/libxml/src/threads.c
+++ b/chromium/third_party/libxml/src/threads.c
@@ -27,6 +27,7 @@
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#elif defined HAVE_WIN32_THREADS
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifndef HAVE_COMPILER_TLS
#include <process.h>
@@ -46,50 +47,37 @@
#ifdef HAVE_PTHREAD_H
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 303) && \
+ defined(__GLIBC__) && defined(__linux__)
+
static int libxml_is_threaded = -1;
-#if defined(__GNUC__) && defined(__GLIBC__)
-#ifdef linux
-#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
-extern int pthread_once (pthread_once_t *__once_control,
- void (*__init_routine) (void))
- __attribute((weak));
-extern void *pthread_getspecific (pthread_key_t __key)
- __attribute((weak));
-extern int pthread_setspecific (pthread_key_t __key,
- __const void *__pointer)
- __attribute((weak));
-extern int pthread_key_create (pthread_key_t *__key,
- void (*__destr_function) (void *))
- __attribute((weak));
-extern int pthread_key_delete (pthread_key_t __key)
- __attribute((weak));
-extern int pthread_mutex_init ()
- __attribute((weak));
-extern int pthread_mutex_destroy ()
- __attribute((weak));
-extern int pthread_mutex_lock ()
- __attribute((weak));
-extern int pthread_mutex_unlock ()
- __attribute((weak));
-extern int pthread_cond_init ()
- __attribute((weak));
-extern int pthread_cond_destroy ()
- __attribute((weak));
-extern int pthread_cond_wait ()
- __attribute((weak));
-extern int pthread_equal ()
- __attribute((weak));
-extern pthread_t pthread_self ()
- __attribute((weak));
-extern int pthread_key_create ()
- __attribute((weak));
-extern int pthread_key_delete ()
- __attribute((weak));
-extern int pthread_cond_signal ()
- __attribute((weak));
-#endif
-#endif /* linux */
-#endif /* defined(__GNUC__) && defined(__GLIBC__) */
+
+#define XML_PTHREAD_WEAK
+
+#pragma weak pthread_once
+#pragma weak pthread_getspecific
+#pragma weak pthread_setspecific
+#pragma weak pthread_key_create
+#pragma weak pthread_key_delete
+#pragma weak pthread_mutex_init
+#pragma weak pthread_mutex_destroy
+#pragma weak pthread_mutex_lock
+#pragma weak pthread_mutex_unlock
+#pragma weak pthread_cond_init
+#pragma weak pthread_cond_destroy
+#pragma weak pthread_cond_wait
+#pragma weak pthread_equal
+#pragma weak pthread_self
+#pragma weak pthread_key_create
+#pragma weak pthread_key_delete
+#pragma weak pthread_cond_signal
+
+#else /* __GNUC__, __GLIBC__, __linux__ */
+
+static int libxml_is_threaded = 1;
+
+#endif /* __GNUC__, __GLIBC__, __linux__ */
+
#endif /* HAVE_PTHREAD_H */
/*
@@ -158,7 +146,7 @@ static DWORD globalkey = TLS_OUT_OF_INDEXES;
static DWORD mainthread;
static struct {
DWORD done;
- DWORD control;
+ LONG control;
} run_once = { 0, 0};
static volatile LPCRITICAL_SECTION global_init_lock = NULL;
@@ -441,8 +429,11 @@ __xmlGlobalInitMutexLock(void)
/* Make sure the global init lock is initialized and then lock it. */
#ifdef HAVE_PTHREAD_H
/* The mutex is statically initialized, so we just lock it. */
- if (pthread_mutex_lock != NULL)
- pthread_mutex_lock(&global_init_lock);
+#ifdef XML_PTHREAD_WEAK
+ if (pthread_mutex_lock == NULL)
+ return;
+#endif /* XML_PTHREAD_WEAK */
+ pthread_mutex_lock(&global_init_lock);
#elif defined HAVE_WIN32_THREADS
LPCRITICAL_SECTION cs;
@@ -458,7 +449,8 @@ __xmlGlobalInitMutexLock(void)
/* Swap it into the global_init_lock */
#ifdef InterlockedCompareExchangePointer
- InterlockedCompareExchangePointer(&global_init_lock, cs, NULL);
+ InterlockedCompareExchangePointer((void **) &global_init_lock,
+ cs, NULL);
#else /* Use older void* version */
InterlockedCompareExchange((void **) &global_init_lock,
(void *) cs, NULL);
@@ -510,8 +502,11 @@ void
__xmlGlobalInitMutexUnlock(void)
{
#ifdef HAVE_PTHREAD_H
- if (pthread_mutex_unlock != NULL)
- pthread_mutex_unlock(&global_init_lock);
+#ifdef XML_PTHREAD_WEAK
+ if (pthread_mutex_unlock == NULL)
+ return;
+#endif /* XML_PTHREAD_WEAK */
+ pthread_mutex_unlock(&global_init_lock);
#elif defined HAVE_WIN32_THREADS
if (global_init_lock != NULL) {
LeaveCriticalSection(global_init_lock);
@@ -863,6 +858,7 @@ void
xmlInitThreads(void)
{
#ifdef HAVE_PTHREAD_H
+#ifdef XML_PTHREAD_WEAK
if (libxml_is_threaded == -1) {
if ((pthread_once != NULL) &&
(pthread_getspecific != NULL) &&
@@ -888,6 +884,7 @@ xmlInitThreads(void)
libxml_is_threaded = 0;
}
}
+#endif /* XML_PTHREAD_WEAK */
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
InitializeCriticalSection(&cleanup_helpers_cs);
#endif
@@ -914,7 +911,7 @@ xmlCleanupThreads(void)
xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n");
#endif
#ifdef HAVE_PTHREAD_H
- if ((libxml_is_threaded) && (pthread_key_delete != NULL))
+ 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))
@@ -999,11 +996,23 @@ xmlOnceInit(void)
#ifdef HAVE_PTHREAD_H
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
-BOOL XMLCALL
-xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+int XMLCALL
+xmlDllMain(ATTRIBUTE_UNUSED void *hinstDLL, unsigned long fdwReason,
+ ATTRIBUTE_UNUSED void *lpvReserved)
#else
+/* declare to avoid "no previous prototype for 'DllMain'" warning */
+/* Note that we do NOT want to include this function declaration in
+ a public header because it's meant to be called by Windows itself,
+ not a program that uses this library. This also has to be exported. */
+
+XMLPUBFUN BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved);
+
BOOL WINAPI
-DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+DllMain(ATTRIBUTE_UNUSED HINSTANCE hinstDLL, DWORD fdwReason,
+ ATTRIBUTE_UNUSED LPVOID lpvReserved)
#endif
{
switch (fdwReason) {
diff --git a/chromium/third_party/libxml/src/timsort.h b/chromium/third_party/libxml/src/timsort.h
index 84bb1b73d3b..0c6346b8a6e 100644
--- a/chromium/third_party/libxml/src/timsort.h
+++ b/chromium/third_party/libxml/src/timsort.h
@@ -1,312 +1,350 @@
/*
- * taken from https://github.com/swenson/sort
- * Kept as is for the moment to be able to apply upstream patches for that
- * code, currently used only to speed up XPath node sorting, see xpath.c
+ * Taken from https://github.com/swenson/sort
+ * Revision: 05fd77bfec049ce8b7c408c4d3dd2d51ee061a15
+ * Removed all code unrelated to Timsort and made minor adjustments for
+ * cross-platform compatibility.
*/
/*
- * All code in this header, unless otherwise specified, is hereby licensed under the MIT Public License:
-
-Copyright (c) 2010 Christopher Swenson
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2010-2017 Christopher Swenson.
+ * Copyright (c) 2012 Vojtech Fried.
+ * Copyright (c) 2012 Google Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
-#else
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#elif defined(WIN32)
-typedef __int64 int64_t;
+#elif defined(_WIN32)
typedef unsigned __int64 uint64_t;
#endif
+
+#ifndef SORT_NAME
+#error "Must declare SORT_NAME"
#endif
-#ifndef MK_UINT64
-#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
-#define MK_UINT64(x) ((uint64_t)(x))
-#else
-#define MK_UINT64(x) x##ULL
+#ifndef SORT_TYPE
+#error "Must declare SORT_TYPE"
#endif
+
+#ifndef SORT_CMP
+#define SORT_CMP(x, y) ((x) < (y) ? -1 : ((x) == (y) ? 0 : 1))
#endif
+#ifndef TIM_SORT_STACK_SIZE
+#define TIM_SORT_STACK_SIZE 128
+#endif
+
+#define SORT_SWAP(x,y) {SORT_TYPE __SORT_SWAP_t = (x); (x) = (y); (y) = __SORT_SWAP_t;}
+
+
+/* Common, type-agnosting functions and constants that we don't want to declare twice. */
+#ifndef SORT_COMMON_H
+#define SORT_COMMON_H
+
#ifndef MAX
#define MAX(x,y) (((x) > (y) ? (x) : (y)))
#endif
+
#ifndef MIN
#define MIN(x,y) (((x) < (y) ? (x) : (y)))
#endif
-int compute_minrun(uint64_t);
+static int compute_minrun(const uint64_t);
#ifndef CLZ
-#if defined(__GNUC__) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3))
+#ifdef __GNUC__
#define CLZ __builtin_clzll
#else
-int clzll(uint64_t);
+static int clzll(uint64_t);
/* adapted from Hacker's Delight */
-int clzll(uint64_t x) /* {{{ */
-{
+static int clzll(uint64_t x) {
int n;
- if (x == 0) return(64);
+ if (x == 0) {
+ return 64;
+ }
+
n = 0;
- if (x <= MK_UINT64(0x00000000FFFFFFFF)) {n = n + 32; x = x << 32;}
- if (x <= MK_UINT64(0x0000FFFFFFFFFFFF)) {n = n + 16; x = x << 16;}
- if (x <= MK_UINT64(0x00FFFFFFFFFFFFFF)) {n = n + 8; x = x << 8;}
- if (x <= MK_UINT64(0x0FFFFFFFFFFFFFFF)) {n = n + 4; x = x << 4;}
- if (x <= MK_UINT64(0x3FFFFFFFFFFFFFFF)) {n = n + 2; x = x << 2;}
- if (x <= MK_UINT64(0x7FFFFFFFFFFFFFFF)) {n = n + 1;}
+
+ if (x <= 0x00000000FFFFFFFFL) {
+ n = n + 32;
+ x = x << 32;
+ }
+
+ if (x <= 0x0000FFFFFFFFFFFFL) {
+ n = n + 16;
+ x = x << 16;
+ }
+
+ if (x <= 0x00FFFFFFFFFFFFFFL) {
+ n = n + 8;
+ x = x << 8;
+ }
+
+ if (x <= 0x0FFFFFFFFFFFFFFFL) {
+ n = n + 4;
+ x = x << 4;
+ }
+
+ if (x <= 0x3FFFFFFFFFFFFFFFL) {
+ n = n + 2;
+ x = x << 2;
+ }
+
+ if (x <= 0x7FFFFFFFFFFFFFFFL) {
+ n = n + 1;
+ }
+
return n;
}
-/* }}} */
#define CLZ clzll
#endif
#endif
-int compute_minrun(uint64_t size) /* {{{ */
-{
+static __inline int compute_minrun(const uint64_t size) {
const int top_bit = 64 - CLZ(size);
const int shift = MAX(top_bit, 6) - 6;
const int minrun = size >> shift;
- const uint64_t mask = (MK_UINT64(1) << shift) - 1;
- if (mask & size) return minrun + 1;
- return minrun;
-}
-/* }}} */
-
-#ifndef SORT_NAME
-#error "Must declare SORT_NAME"
-#endif
+ const uint64_t mask = (1ULL << shift) - 1;
-#ifndef SORT_TYPE
-#error "Must declare SORT_TYPE"
-#endif
-
-#ifndef SORT_CMP
-#define SORT_CMP(x, y) ((x) < (y) ? -1 : ((x) == (y) ? 0 : 1))
-#endif
+ if (mask & size) {
+ return minrun + 1;
+ }
+ return minrun;
+}
-#define SORT_SWAP(x,y) {SORT_TYPE __SORT_SWAP_t = (x); (x) = (y); (y) = __SORT_SWAP_t;}
+#endif /* SORT_COMMON_H */
#define SORT_CONCAT(x, y) x ## _ ## y
#define SORT_MAKE_STR1(x, y) SORT_CONCAT(x,y)
#define SORT_MAKE_STR(x) SORT_MAKE_STR1(SORT_NAME,x)
-#define BINARY_INSERTION_FIND SORT_MAKE_STR(binary_insertion_find)
-#define BINARY_INSERTION_SORT_START SORT_MAKE_STR(binary_insertion_sort_start)
-#define BINARY_INSERTION_SORT SORT_MAKE_STR(binary_insertion_sort)
-#define REVERSE_ELEMENTS SORT_MAKE_STR(reverse_elements)
-#define COUNT_RUN SORT_MAKE_STR(count_run)
-#define CHECK_INVARIANT SORT_MAKE_STR(check_invariant)
-#define TIM_SORT SORT_MAKE_STR(tim_sort)
-#define TIM_SORT_RESIZE SORT_MAKE_STR(tim_sort_resize)
-#define TIM_SORT_MERGE SORT_MAKE_STR(tim_sort_merge)
-#define TIM_SORT_COLLAPSE SORT_MAKE_STR(tim_sort_collapse)
+#define BINARY_INSERTION_FIND SORT_MAKE_STR(binary_insertion_find)
+#define BINARY_INSERTION_SORT_START SORT_MAKE_STR(binary_insertion_sort_start)
+#define BINARY_INSERTION_SORT SORT_MAKE_STR(binary_insertion_sort)
+#define REVERSE_ELEMENTS SORT_MAKE_STR(reverse_elements)
+#define COUNT_RUN SORT_MAKE_STR(count_run)
+#define CHECK_INVARIANT SORT_MAKE_STR(check_invariant)
+#define TIM_SORT SORT_MAKE_STR(tim_sort)
+#define TIM_SORT_RESIZE SORT_MAKE_STR(tim_sort_resize)
+#define TIM_SORT_MERGE SORT_MAKE_STR(tim_sort_merge)
+#define TIM_SORT_COLLAPSE SORT_MAKE_STR(tim_sort_collapse)
-#define TIM_SORT_RUN_T SORT_MAKE_STR(tim_sort_run_t)
-#define TEMP_STORAGE_T SORT_MAKE_STR(temp_storage_t)
+#ifndef MAX
+#define MAX(x,y) (((x) > (y) ? (x) : (y)))
+#endif
+#ifndef MIN
+#define MIN(x,y) (((x) < (y) ? (x) : (y)))
+#endif
typedef struct {
- int64_t start;
- int64_t length;
+ size_t start;
+ size_t length;
} TIM_SORT_RUN_T;
+
void BINARY_INSERTION_SORT(SORT_TYPE *dst, const size_t size);
void TIM_SORT(SORT_TYPE *dst, const size_t size);
+
/* Function used to do a binary search for binary insertion sort */
-static int64_t BINARY_INSERTION_FIND(SORT_TYPE *dst, const SORT_TYPE x, const size_t size)
-{
- int64_t l, c, r;
- SORT_TYPE lx;
+static __inline size_t BINARY_INSERTION_FIND(SORT_TYPE *dst, const SORT_TYPE x,
+ const size_t size) {
+ size_t l, c, r;
SORT_TYPE cx;
l = 0;
r = size - 1;
c = r >> 1;
- lx = dst[l];
- /* check for beginning conditions */
- if (SORT_CMP(x, lx) < 0)
+ /* check for out of bounds at the beginning. */
+ if (SORT_CMP(x, dst[0]) < 0) {
return 0;
- else if (SORT_CMP(x, lx) == 0)
- {
- int64_t i = 1;
- while (SORT_CMP(x, dst[i]) == 0) i++;
- return i;
+ } else if (SORT_CMP(x, dst[r]) > 0) {
+ return r;
}
cx = dst[c];
- while (1)
- {
+
+ while (1) {
const int val = SORT_CMP(x, cx);
- if (val < 0)
- {
- if (c - l <= 1) return c;
+
+ if (val < 0) {
+ if (c - l <= 1) {
+ return c;
+ }
+
r = c;
- }
- else if (val > 0)
- {
- if (r - c <= 1) return c + 1;
+ } else { /* allow = for stability. The binary search favors the right. */
+ if (r - c <= 1) {
+ return c + 1;
+ }
+
l = c;
- lx = cx;
- }
- else
- {
- do
- {
- cx = dst[++c];
- } while (SORT_CMP(x, cx) == 0);
- return c;
}
+
c = l + ((r - l) >> 1);
cx = dst[c];
}
}
/* Binary insertion sort, but knowing that the first "start" entries are sorted. Used in timsort. */
-static void BINARY_INSERTION_SORT_START(SORT_TYPE *dst, const size_t start, const size_t size)
-{
- int64_t i;
- for (i = start; i < (int64_t) size; i++)
- {
- int64_t j;
+static void BINARY_INSERTION_SORT_START(SORT_TYPE *dst, const size_t start, const size_t size) {
+ size_t i;
+
+ for (i = start; i < size; i++) {
+ size_t j;
SORT_TYPE x;
- int64_t location;
+ size_t location;
+
/* If this entry is already correct, just move along */
- if (SORT_CMP(dst[i - 1], dst[i]) <= 0) continue;
+ if (SORT_CMP(dst[i - 1], dst[i]) <= 0) {
+ continue;
+ }
/* Else we need to find the right place, shift everything over, and squeeze in */
x = dst[i];
location = BINARY_INSERTION_FIND(dst, x, i);
- for (j = i - 1; j >= location; j--)
- {
+
+ for (j = i - 1; j >= location; j--) {
dst[j + 1] = dst[j];
+
+ if (j == 0) { /* check edge case because j is unsigned */
+ break;
+ }
}
+
dst[location] = x;
}
}
/* Binary insertion sort */
-void BINARY_INSERTION_SORT(SORT_TYPE *dst, const size_t size)
-{
+void BINARY_INSERTION_SORT(SORT_TYPE *dst, const size_t size) {
+ /* don't bother sorting an array of size <= 1 */
+ if (size <= 1) {
+ return;
+ }
+
BINARY_INSERTION_SORT_START(dst, 1, size);
}
/* timsort implementation, based on timsort.txt */
-static void REVERSE_ELEMENTS(SORT_TYPE *dst, int64_t start, int64_t end)
-{
- while (1)
- {
- if (start >= end) return;
+static __inline void REVERSE_ELEMENTS(SORT_TYPE *dst, size_t start, size_t end) {
+ while (1) {
+ if (start >= end) {
+ return;
+ }
+
SORT_SWAP(dst[start], dst[end]);
start++;
end--;
}
}
-static int64_t COUNT_RUN(SORT_TYPE *dst, const int64_t start, const size_t size)
-{
- int64_t curr;
- if (size - start == 1) return 1;
- if (start >= (int64_t) size - 2)
- {
- if (SORT_CMP(dst[size - 2], dst[size - 1]) > 0)
+static size_t COUNT_RUN(SORT_TYPE *dst, const size_t start, const size_t size) {
+ size_t curr;
+
+ if (size - start == 1) {
+ return 1;
+ }
+
+ if (start >= size - 2) {
+ if (SORT_CMP(dst[size - 2], dst[size - 1]) > 0) {
SORT_SWAP(dst[size - 2], dst[size - 1]);
+ }
+
return 2;
}
curr = start + 2;
- if (SORT_CMP(dst[start], dst[start + 1]) <= 0)
- {
+ if (SORT_CMP(dst[start], dst[start + 1]) <= 0) {
/* increasing run */
- while (1)
- {
- if (curr == (int64_t) size - 1) break;
- if (SORT_CMP(dst[curr - 1], dst[curr]) > 0) break;
+ while (1) {
+ if (curr == size - 1) {
+ break;
+ }
+
+ if (SORT_CMP(dst[curr - 1], dst[curr]) > 0) {
+ break;
+ }
+
curr++;
}
+
return curr - start;
- }
- else
- {
+ } else {
/* decreasing run */
- while (1)
- {
- if (curr == (int64_t) size - 1) break;
- if (SORT_CMP(dst[curr - 1], dst[curr]) <= 0) break;
+ while (1) {
+ if (curr == size - 1) {
+ break;
+ }
+
+ if (SORT_CMP(dst[curr - 1], dst[curr]) <= 0) {
+ break;
+ }
+
curr++;
}
+
/* reverse in-place */
REVERSE_ELEMENTS(dst, start, curr - 1);
return curr - start;
}
}
-#define PUSH_NEXT() do {\
-len = COUNT_RUN(dst, curr, size);\
-run = minrun;\
-if (run < minrun) run = minrun;\
-if (run > (int64_t) size - curr) run = size - curr;\
-if (run > len)\
-{\
- BINARY_INSERTION_SORT_START(&dst[curr], len, run);\
- len = run;\
-}\
-{\
-run_stack[stack_curr].start = curr;\
-run_stack[stack_curr].length = len;\
-stack_curr++;\
-}\
-curr += len;\
-if (curr == (int64_t) size)\
-{\
- /* finish up */ \
- while (stack_curr > 1) \
- { \
- TIM_SORT_MERGE(dst, run_stack, stack_curr, store); \
- run_stack[stack_curr - 2].length += run_stack[stack_curr - 1].length; \
- stack_curr--; \
- } \
- if (store->storage != NULL)\
- {\
- free(store->storage);\
- store->storage = NULL;\
- }\
- return;\
-}\
-}\
-while (0)
-
-static int CHECK_INVARIANT(TIM_SORT_RUN_T *stack, const int stack_curr)
-{
- int64_t A, B, C;
- if (stack_curr < 2) return 1;
- if (stack_curr == 2)
- {
- const int64_t A1 = stack[stack_curr - 2].length;
- const int64_t B1 = stack[stack_curr - 1].length;
- if (A1 <= B1) return 0;
+static int CHECK_INVARIANT(TIM_SORT_RUN_T *stack, const int stack_curr) {
+ size_t A, B, C;
+
+ if (stack_curr < 2) {
return 1;
}
+
+ if (stack_curr == 2) {
+ const size_t A1 = stack[stack_curr - 2].length;
+ const size_t B1 = stack[stack_curr - 1].length;
+
+ if (A1 <= B1) {
+ return 0;
+ }
+
+ return 1;
+ }
+
A = stack[stack_curr - 3].length;
B = stack[stack_curr - 2].length;
C = stack[stack_curr - 1].length;
- if ((A <= B + C) || (B <= C)) return 0;
+
+ if ((A <= B + C) || (B <= C)) {
+ return 0;
+ }
+
return 1;
}
@@ -315,86 +353,78 @@ typedef struct {
SORT_TYPE *storage;
} TEMP_STORAGE_T;
-
-static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size)
-{
- if (store->alloc < new_size)
- {
+static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size) {
+ if (store->alloc < new_size) {
SORT_TYPE *tempstore = (SORT_TYPE *)realloc(store->storage, new_size * sizeof(SORT_TYPE));
- if (tempstore == NULL)
- {
- fprintf(stderr, "Error allocating temporary storage for tim sort: need %llu bytes", (unsigned long long)(sizeof(SORT_TYPE) * new_size));
+
+ if (tempstore == NULL) {
+ fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes",
+ (unsigned long)(sizeof(SORT_TYPE) * new_size));
exit(1);
}
+
store->storage = tempstore;
store->alloc = new_size;
}
}
-static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr, TEMP_STORAGE_T *store)
-{
- const int64_t A = stack[stack_curr - 2].length;
- const int64_t B = stack[stack_curr - 1].length;
- const int64_t curr = stack[stack_curr - 2].start;
+static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr,
+ TEMP_STORAGE_T *store) {
+ const size_t A = stack[stack_curr - 2].length;
+ const size_t B = stack[stack_curr - 1].length;
+ const size_t curr = stack[stack_curr - 2].start;
SORT_TYPE *storage;
- int64_t i, j, k;
-
+ size_t i, j, k;
TIM_SORT_RESIZE(store, MIN(A, B));
storage = store->storage;
/* left merge */
- if (A < B)
- {
+ if (A < B) {
memcpy(storage, &dst[curr], A * sizeof(SORT_TYPE));
i = 0;
j = curr + A;
- for (k = curr; k < curr + A + B; k++)
- {
- if ((i < A) && (j < curr + A + B))
- {
- if (SORT_CMP(storage[i], dst[j]) <= 0)
+ for (k = curr; k < curr + A + B; k++) {
+ if ((i < A) && (j < curr + A + B)) {
+ if (SORT_CMP(storage[i], dst[j]) <= 0) {
dst[k] = storage[i++];
- else
+ } else {
dst[k] = dst[j++];
- }
- else if (i < A)
- {
+ }
+ } else if (i < A) {
dst[k] = storage[i++];
+ } else {
+ break;
}
- else
- dst[k] = dst[j++];
}
- }
- /* right merge */
- else
- {
+ } else {
+ /* right merge */
memcpy(storage, &dst[curr + A], B * sizeof(SORT_TYPE));
- i = B - 1;
- j = curr + A - 1;
-
- for (k = curr + A + B - 1; k >= curr; k--)
- {
- if ((i >= 0) && (j >= curr))
- {
- if (SORT_CMP(dst[j], storage[i]) > 0)
- dst[k] = dst[j--];
- else
- dst[k] = storage[i--];
+ i = B;
+ j = curr + A;
+ k = curr + A + B;
+
+ while (k-- > curr) {
+ if ((i > 0) && (j > curr)) {
+ if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) {
+ dst[k] = dst[--j];
+ } else {
+ dst[k] = storage[--i];
+ }
+ } else if (i > 0) {
+ dst[k] = storage[--i];
+ } else {
+ break;
}
- else if (i >= 0)
- dst[k] = storage[i--];
- else
- dst[k] = dst[j--];
}
}
}
-static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_curr, TEMP_STORAGE_T *store, const size_t size)
-{
+static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_curr,
+ TEMP_STORAGE_T *store, const size_t size) {
while (1) {
- int64_t A, B, C, D;
- int ABC, BCD, BD, CD;
+ size_t A, B, C, D;
+ int ABC, BCD, CD;
/* if the stack only has one thing on it, we are done with the collapse */
if (stack_curr <= 1) {
@@ -431,7 +461,6 @@ static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_cu
BCD = (B <= C + D) || ABC;
CD = (C <= D);
- BD = (B < D);
/* Both invariants are good */
if (!BCD && !CD) {
@@ -455,41 +484,94 @@ static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_cu
return stack_curr;
}
-void TIM_SORT(SORT_TYPE *dst, const size_t size)
-{
- int minrun;
+static __inline int PUSH_NEXT(SORT_TYPE *dst,
+ const size_t size,
+ TEMP_STORAGE_T *store,
+ const size_t minrun,
+ TIM_SORT_RUN_T *run_stack,
+ size_t *stack_curr,
+ size_t *curr) {
+ size_t len = COUNT_RUN(dst, *curr, size);
+ size_t run = minrun;
+
+ if (run > size - *curr) {
+ run = size - *curr;
+ }
+
+ if (run > len) {
+ BINARY_INSERTION_SORT_START(&dst[*curr], len, run);
+ len = run;
+ }
+
+ run_stack[*stack_curr].start = *curr;
+ run_stack[*stack_curr].length = len;
+ (*stack_curr)++;
+ *curr += len;
+
+ if (*curr == size) {
+ /* finish up */
+ while (*stack_curr > 1) {
+ TIM_SORT_MERGE(dst, run_stack, *stack_curr, store);
+ run_stack[*stack_curr - 2].length += run_stack[*stack_curr - 1].length;
+ (*stack_curr)--;
+ }
+
+ if (store->storage != NULL) {
+ free(store->storage);
+ store->storage = NULL;
+ }
+
+ return 0;
+ }
+
+ return 1;
+}
+
+void TIM_SORT(SORT_TYPE *dst, const size_t size) {
+ size_t minrun;
TEMP_STORAGE_T _store, *store;
- TIM_SORT_RUN_T run_stack[128];
- int stack_curr = 0;
- int64_t len, run;
- int64_t curr = 0;
+ TIM_SORT_RUN_T run_stack[TIM_SORT_STACK_SIZE];
+ size_t stack_curr = 0;
+ size_t curr = 0;
- if (size < 64)
- {
+ /* don't bother sorting an array of size 1 */
+ if (size <= 1) {
+ return;
+ }
+
+ if (size < 64) {
BINARY_INSERTION_SORT(dst, size);
return;
}
/* compute the minimum run length */
minrun = compute_minrun(size);
-
/* temporary storage for merges */
store = &_store;
store->alloc = 0;
store->storage = NULL;
- PUSH_NEXT();
- PUSH_NEXT();
- PUSH_NEXT();
+ if (!PUSH_NEXT(dst, size, store, minrun, run_stack, &stack_curr, &curr)) {
+ return;
+ }
+
+ if (!PUSH_NEXT(dst, size, store, minrun, run_stack, &stack_curr, &curr)) {
+ return;
+ }
- while (1)
- {
- if (!CHECK_INVARIANT(run_stack, stack_curr))
- {
+ if (!PUSH_NEXT(dst, size, store, minrun, run_stack, &stack_curr, &curr)) {
+ return;
+ }
+
+ while (1) {
+ if (!CHECK_INVARIANT(run_stack, stack_curr)) {
stack_curr = TIM_SORT_COLLAPSE(dst, run_stack, stack_curr, store, size);
continue;
}
- PUSH_NEXT();
+
+ if (!PUSH_NEXT(dst, size, store, minrun, run_stack, &stack_curr, &curr)) {
+ return;
+ }
}
}
diff --git a/chromium/third_party/libxml/src/tree.c b/chromium/third_party/libxml/src/tree.c
index 9d330b85cd3..959421bd652 100644
--- a/chromium/third_party/libxml/src/tree.c
+++ b/chromium/third_party/libxml/src/tree.c
@@ -10,10 +10,16 @@
*
*/
+/* To avoid EBCDIC trouble when parsing on zOS */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
+
#define IN_LIBXML
#include "libxml.h"
#include <string.h> /* for memset() only ! */
+#include <stddef.h>
#include <limits.h>
#ifdef HAVE_CTYPE_H
#include <ctype.h>
@@ -21,7 +27,7 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
@@ -254,10 +260,10 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
*
* [NS 7] LocalPart ::= NCName
*
- * Returns NULL if not a QName, otherwise the local part, and prefix
- * is updated to get the Prefix if any.
+ * Returns NULL if the name doesn't have a prefix. Otherwise, returns the
+ * local part, and prefix is updated to get the Prefix. Both the return value
+ * and the prefix must be freed by the caller.
*/
-
xmlChar *
xmlSplitQName2(const xmlChar *name, xmlChar **prefix) {
int len = 0;
@@ -1401,6 +1407,8 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
else if ((ent != NULL) && (ent->children == NULL)) {
xmlNodePtr temp;
+ /* Set to non-NULL value to avoid recursion. */
+ ent->children = (xmlNodePtr) -1;
ent->children = xmlStringGetNodeList(doc,
(const xmlChar*)node->content);
ent->owner = 1;
@@ -1593,6 +1601,7 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
else if ((ent != NULL) && (ent->children == NULL)) {
xmlNodePtr temp;
+ /* Set to non-NULL value to avoid recursion. */
ent->children = (xmlNodePtr) -1;
ent->children = xmlStringGetNodeList(doc,
(const xmlChar*)node->content);
@@ -1600,6 +1609,7 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
temp = ent->children;
while (temp) {
temp->parent = (xmlNodePtr)ent;
+ ent->last = temp;
temp = temp->next;
}
}
@@ -4596,7 +4606,7 @@ xmlGetLineNoInternal(const xmlNode *node, int depth)
(node->type == XML_PI_NODE)) {
if (node->line == 65535) {
if ((node->type == XML_TEXT_NODE) && (node->psvi != NULL))
- result = (long) node->psvi;
+ result = (long) (ptrdiff_t) node->psvi;
else if ((node->type == XML_ELEMENT_NODE) &&
(node->children != NULL))
result = xmlGetLineNoInternal(node->children, depth + 1);
@@ -4755,8 +4765,8 @@ xmlGetNodePath(const xmlNode *node)
if (occur == 0) {
tmp = cur->next;
while (tmp != NULL && occur == 0) {
- if (tmp->type == XML_COMMENT_NODE)
- occur++;
+ if (tmp->type == XML_COMMENT_NODE)
+ occur++;
tmp = tmp->next;
}
if (occur != 0)
@@ -8249,7 +8259,7 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc,
ns = ns->next;
} while (ns != NULL);
}
- /* No break on purpose. */
+ /* Falls through. */
case XML_ATTRIBUTE_NODE:
if (node->ns != NULL) {
/*
@@ -8840,7 +8850,7 @@ next_ns_decl:
}
if (! adoptns)
goto ns_end;
- /* No break on purpose. */
+ /* Falls through. */
case XML_ATTRIBUTE_NODE:
/* No ns, no fun. */
if (cur->ns == NULL)
@@ -9121,7 +9131,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt,
goto internal_error;
}
}
- /* No break on purpose. */
+ /* Falls through. */
case XML_ATTRIBUTE_NODE:
/* No namespace, no fun. */
if (cur->ns == NULL)
diff --git a/chromium/third_party/libxml/src/uri.c b/chromium/third_party/libxml/src/uri.c
index 2bd5720de97..d4f0f5ecdb7 100644
--- a/chromium/third_party/libxml/src/uri.c
+++ b/chromium/third_party/libxml/src/uri.c
@@ -334,7 +334,7 @@ xmlParse3986Port(xmlURIPtr uri, const char **str)
cur++;
}
if (uri != NULL)
- uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */
+ uri->port = port & USHRT_MAX; /* port value modulo USHRT_MAX+1 */
*str = cur;
return(0);
}
@@ -1961,8 +1961,9 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
res->scheme = xmlMemStrdup(bas->scheme);
if (bas->authority != NULL)
res->authority = xmlMemStrdup(bas->authority);
- else if (bas->server != NULL) {
- res->server = xmlMemStrdup(bas->server);
+ else if ((bas->server != NULL) || (bas->port == -1)) {
+ if (bas->server != NULL)
+ res->server = xmlMemStrdup(bas->server);
if (bas->user != NULL)
res->user = xmlMemStrdup(bas->user);
res->port = bas->port;
@@ -2024,8 +2025,9 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
}
if (bas->authority != NULL)
res->authority = xmlMemStrdup(bas->authority);
- else if (bas->server != NULL) {
- res->server = xmlMemStrdup(bas->server);
+ else if ((bas->server != NULL) || (bas->port == -1)) {
+ if (bas->server != NULL)
+ res->server = xmlMemStrdup(bas->server);
if (bas->user != NULL)
res->user = xmlMemStrdup(bas->user);
res->port = bas->port;
@@ -2163,7 +2165,6 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base)
xmlChar *val = NULL;
int ret;
int ix;
- int pos = 0;
int nbslash = 0;
int len;
xmlURIPtr ref = NULL;
@@ -2235,38 +2236,24 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base)
* First we take care of the special case where either of the
* two path components may be missing (bug 316224)
*/
- if (bas->path == NULL) {
- if (ref->path != NULL) {
- uptr = (xmlChar *) ref->path;
- if (*uptr == '/')
- uptr++;
- /* exception characters from xmlSaveUri */
- val = xmlURIEscapeStr(uptr, BAD_CAST "/;&=+$,");
- }
- goto done;
- }
bptr = (xmlChar *)bas->path;
- if (ref->path == NULL) {
- for (ix = 0; bptr[ix] != 0; ix++) {
- if (bptr[ix] == '/')
- nbslash++;
- }
- uptr = NULL;
- len = 1; /* this is for a string terminator only */
- } else {
- /*
- * Next we compare the two strings and find where they first differ
- */
- if ((ref->path[pos] == '.') && (ref->path[pos+1] == '/'))
- pos += 2;
+ {
+ xmlChar *rptr = (xmlChar *) ref->path;
+ int pos = 0;
+
+ /*
+ * Next we compare the two strings and find where they first differ
+ */
+ if ((*rptr == '.') && (rptr[1] == '/'))
+ rptr += 2;
if ((*bptr == '.') && (bptr[1] == '/'))
bptr += 2;
- else if ((*bptr == '/') && (ref->path[pos] != '/'))
+ else if ((*bptr == '/') && (*rptr != '/'))
bptr++;
- while ((bptr[pos] == ref->path[pos]) && (bptr[pos] != 0))
+ while ((bptr[pos] == rptr[pos]) && (bptr[pos] != 0))
pos++;
- if (bptr[pos] == ref->path[pos]) {
+ if (bptr[pos] == rptr[pos]) {
val = xmlStrdup(BAD_CAST "");
goto done; /* (I can't imagine why anyone would do this) */
}
@@ -2276,30 +2263,28 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base)
* beginning of the "unique" suffix of URI
*/
ix = pos;
- if ((ref->path[ix] == '/') && (ix > 0))
- ix--;
- else if ((ref->path[ix] == 0) && (ix > 1) && (ref->path[ix - 1] == '/'))
- ix -= 2;
for (; ix > 0; ix--) {
- if (ref->path[ix] == '/')
+ if (rptr[ix - 1] == '/')
break;
}
- if (ix == 0) {
- uptr = (xmlChar *)ref->path;
- } else {
- ix++;
- uptr = (xmlChar *)&ref->path[ix];
- }
+ uptr = (xmlChar *)&rptr[ix];
/*
* In base, count the number of '/' from the differing point
*/
- if (bptr[pos] != ref->path[pos]) {/* check for trivial URI == base */
- for (; bptr[ix] != 0; ix++) {
- if (bptr[ix] == '/')
- nbslash++;
- }
+ for (; bptr[ix] != 0; ix++) {
+ if (bptr[ix] == '/')
+ nbslash++;
}
+
+ /*
+ * e.g: URI="foo/" base="foo/bar" -> "./"
+ */
+ if (nbslash == 0 && !uptr[0]) {
+ val = xmlStrdup(BAD_CAST "./");
+ goto done;
+ }
+
len = xmlStrlen (uptr) + 1;
}
@@ -2390,8 +2375,7 @@ xmlCanonicPath(const xmlChar *path)
*/
#if defined(_WIN32) && !defined(__CYGWIN__)
int len = 0;
- int i = 0;
- xmlChar *p = NULL;
+ char *p = NULL;
#endif
xmlURIPtr uri;
xmlChar *ret;
@@ -2455,6 +2439,7 @@ xmlCanonicPath(const xmlChar *path)
xmlFreeURI(uri);
return escURI;
}
+ xmlFree(escURI);
}
}
@@ -2472,7 +2457,7 @@ path_processing:
len = xmlStrlen(path);
if ((len > 2) && IS_WINDOWS_PATH(path)) {
/* make the scheme 'file' */
- uri->scheme = xmlStrdup(BAD_CAST "file");
+ uri->scheme = (char *) xmlStrdup(BAD_CAST "file");
/* allocate space for leading '/' + path + string terminator */
uri->path = xmlMallocAtomic(len + 2);
if (uri->path == NULL) {
@@ -2482,9 +2467,9 @@ path_processing:
/* Put in leading '/' plus path */
uri->path[0] = '/';
p = uri->path + 1;
- strncpy(p, path, len + 1);
+ strncpy(p, (char *) path, len + 1);
} else {
- uri->path = xmlStrdup(path);
+ uri->path = (char *) xmlStrdup(path);
if (uri->path == NULL) {
xmlFreeURI(uri);
return(NULL);
diff --git a/chromium/third_party/libxml/src/valid.c b/chromium/third_party/libxml/src/valid.c
index 19f84b82623..b1cfede2dbb 100644
--- a/chromium/third_party/libxml/src/valid.c
+++ b/chromium/third_party/libxml/src/valid.c
@@ -163,7 +163,7 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt,
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
XML_ERR_ERROR, NULL, 0,
(const char *) str1,
- (const char *) str1,
+ (const char *) str2,
(const char *) str3, 0, 0, msg, str1, str2, str3);
}
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
@@ -247,7 +247,7 @@ xmlErrValidWarning(xmlValidCtxtPtr ctxt,
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
XML_ERR_WARNING, NULL, 0,
(const char *) str1,
- (const char *) str1,
+ (const char *) str2,
(const char *) str3, 0, 0, msg, str1, str2, str3);
}
@@ -1172,29 +1172,33 @@ xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob)
xmlBufferWriteCHAR(buf, content->name);
break;
case XML_ELEMENT_CONTENT_SEQ:
- if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
- (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
+ if ((content->c1 != NULL) &&
+ ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
+ (content->c1->type == XML_ELEMENT_CONTENT_SEQ)))
xmlDumpElementContent(buf, content->c1, 1);
else
xmlDumpElementContent(buf, content->c1, 0);
xmlBufferWriteChar(buf, " , ");
- if ((content->c2->type == XML_ELEMENT_CONTENT_OR) ||
- ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) &&
- (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)))
+ if ((content->c2 != NULL) &&
+ ((content->c2->type == XML_ELEMENT_CONTENT_OR) ||
+ ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) &&
+ (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE))))
xmlDumpElementContent(buf, content->c2, 1);
else
xmlDumpElementContent(buf, content->c2, 0);
break;
case XML_ELEMENT_CONTENT_OR:
- if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
- (content->c1->type == XML_ELEMENT_CONTENT_SEQ))
+ if ((content->c1 != NULL) &&
+ ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
+ (content->c1->type == XML_ELEMENT_CONTENT_SEQ)))
xmlDumpElementContent(buf, content->c1, 1);
else
xmlDumpElementContent(buf, content->c1, 0);
xmlBufferWriteChar(buf, " | ");
- if ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) ||
- ((content->c2->type == XML_ELEMENT_CONTENT_OR) &&
- (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)))
+ if ((content->c2 != NULL) &&
+ ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) ||
+ ((content->c2->type == XML_ELEMENT_CONTENT_OR) &&
+ (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE))))
xmlDumpElementContent(buf, content->c2, 1);
else
xmlDumpElementContent(buf, content->c2, 0);
@@ -1262,22 +1266,23 @@ xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int
case XML_ELEMENT_CONTENT_PCDATA:
strcat(buf, "#PCDATA");
break;
- case XML_ELEMENT_CONTENT_ELEMENT:
+ case XML_ELEMENT_CONTENT_ELEMENT: {
+ int qnameLen = xmlStrlen(content->name);
+
+ if (content->prefix != NULL)
+ qnameLen += xmlStrlen(content->prefix) + 1;
+ if (size - len < qnameLen + 10) {
+ strcat(buf, " ...");
+ return;
+ }
if (content->prefix != NULL) {
- if (size - len < xmlStrlen(content->prefix) + 10) {
- strcat(buf, " ...");
- return;
- }
strcat(buf, (char *) content->prefix);
strcat(buf, ":");
}
- if (size - len < xmlStrlen(content->name) + 10) {
- strcat(buf, " ...");
- return;
- }
if (content->name != NULL)
strcat(buf, (char *) content->name);
break;
+ }
case XML_ELEMENT_CONTENT_SEQ:
if ((content->c1->type == XML_ELEMENT_CONTENT_OR) ||
(content->c1->type == XML_ELEMENT_CONTENT_SEQ))
@@ -1319,6 +1324,7 @@ xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int
xmlSnprintfElementContent(buf, size, content->c2, 0);
break;
}
+ if (size - strlen(buf) <= 2) return;
if (englob)
strcat(buf, ")");
switch (content->ocur) {
@@ -1591,6 +1597,11 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt,
return(ret);
}
+static void
+xmlFreeElementTableEntry(void *elem, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlFreeElement((xmlElementPtr) elem);
+}
+
/**
* xmlFreeElementTable:
* @table: An element table
@@ -1599,7 +1610,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt,
*/
void
xmlFreeElementTable(xmlElementTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeElement);
+ xmlHashFree(table, xmlFreeElementTableEntry);
}
#ifdef LIBXML_TREE_ENABLED
@@ -1611,8 +1622,9 @@ xmlFreeElementTable(xmlElementTablePtr table) {
*
* Returns the new xmlElementPtr or NULL in case of error.
*/
-static xmlElementPtr
-xmlCopyElement(xmlElementPtr elem) {
+static void *
+xmlCopyElement(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlElementPtr elem = (xmlElementPtr) payload;
xmlElementPtr cur;
cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
@@ -1647,8 +1659,7 @@ xmlCopyElement(xmlElementPtr elem) {
*/
xmlElementTablePtr
xmlCopyElementTable(xmlElementTablePtr table) {
- return((xmlElementTablePtr) xmlHashCopy(table,
- (xmlHashCopier) xmlCopyElement));
+ return((xmlElementTablePtr) xmlHashCopy(table, xmlCopyElement));
}
#endif /* LIBXML_TREE_ENABLED */
@@ -1722,8 +1733,9 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
* the arguments.
*/
static void
-xmlDumpElementDeclScan(xmlElementPtr elem, xmlBufferPtr buf) {
- xmlDumpElementDecl(buf, elem);
+xmlDumpElementDeclScan(void *elem, void *buf,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlDumpElementDecl((xmlBufferPtr) buf, (xmlElementPtr) elem);
}
/**
@@ -1737,7 +1749,7 @@ void
xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) {
if ((buf == NULL) || (table == NULL))
return;
- xmlHashScan(table, (xmlHashScanner) xmlDumpElementDeclScan, buf);
+ xmlHashScan(table, xmlDumpElementDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -2137,6 +2149,11 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt,
return(ret);
}
+static void
+xmlFreeAttributeTableEntry(void *attr, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlFreeAttribute((xmlAttributePtr) attr);
+}
+
/**
* xmlFreeAttributeTable:
* @table: An attribute table
@@ -2145,7 +2162,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt,
*/
void
xmlFreeAttributeTable(xmlAttributeTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeAttribute);
+ xmlHashFree(table, xmlFreeAttributeTableEntry);
}
#ifdef LIBXML_TREE_ENABLED
@@ -2157,8 +2174,9 @@ xmlFreeAttributeTable(xmlAttributeTablePtr table) {
*
* Returns the new xmlAttributePtr or NULL in case of error.
*/
-static xmlAttributePtr
-xmlCopyAttribute(xmlAttributePtr attr) {
+static void *
+xmlCopyAttribute(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlAttributePtr attr = (xmlAttributePtr) payload;
xmlAttributePtr cur;
cur = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute));
@@ -2192,8 +2210,7 @@ xmlCopyAttribute(xmlAttributePtr attr) {
*/
xmlAttributeTablePtr
xmlCopyAttributeTable(xmlAttributeTablePtr table) {
- return((xmlAttributeTablePtr) xmlHashCopy(table,
- (xmlHashCopier) xmlCopyAttribute));
+ return((xmlAttributeTablePtr) xmlHashCopy(table, xmlCopyAttribute));
}
#endif /* LIBXML_TREE_ENABLED */
@@ -2288,8 +2305,9 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) {
* This is used with the hash scan function - just reverses arguments
*/
static void
-xmlDumpAttributeDeclScan(xmlAttributePtr attr, xmlBufferPtr buf) {
- xmlDumpAttributeDecl(buf, attr);
+xmlDumpAttributeDeclScan(void *attr, void *buf,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlDumpAttributeDecl((xmlBufferPtr) buf, (xmlAttributePtr) attr);
}
/**
@@ -2303,7 +2321,7 @@ void
xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) {
if ((buf == NULL) || (table == NULL))
return;
- xmlHashScan(table, (xmlHashScanner) xmlDumpAttributeDeclScan, buf);
+ xmlHashScan(table, xmlDumpAttributeDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -2409,6 +2427,11 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
return(ret);
}
+static void
+xmlFreeNotationTableEntry(void *nota, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlFreeNotation((xmlNotationPtr) nota);
+}
+
/**
* xmlFreeNotationTable:
* @table: An notation table
@@ -2417,7 +2440,7 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
*/
void
xmlFreeNotationTable(xmlNotationTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeNotation);
+ xmlHashFree(table, xmlFreeNotationTableEntry);
}
#ifdef LIBXML_TREE_ENABLED
@@ -2429,8 +2452,9 @@ xmlFreeNotationTable(xmlNotationTablePtr table) {
*
* Returns the new xmlNotationPtr or NULL in case of error.
*/
-static xmlNotationPtr
-xmlCopyNotation(xmlNotationPtr nota) {
+static void *
+xmlCopyNotation(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlNotationPtr nota = (xmlNotationPtr) payload;
xmlNotationPtr cur;
cur = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
@@ -2463,8 +2487,7 @@ xmlCopyNotation(xmlNotationPtr nota) {
*/
xmlNotationTablePtr
xmlCopyNotationTable(xmlNotationTablePtr table) {
- return((xmlNotationTablePtr) xmlHashCopy(table,
- (xmlHashCopier) xmlCopyNotation));
+ return((xmlNotationTablePtr) xmlHashCopy(table, xmlCopyNotation));
}
#endif /* LIBXML_TREE_ENABLED */
@@ -2504,8 +2527,9 @@ xmlDumpNotationDecl(xmlBufferPtr buf, xmlNotationPtr nota) {
* This is called with the hash scan function, and just reverses args
*/
static void
-xmlDumpNotationDeclScan(xmlNotationPtr nota, xmlBufferPtr buf) {
- xmlDumpNotationDecl(buf, nota);
+xmlDumpNotationDeclScan(void *nota, void *buf,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlDumpNotationDecl((xmlBufferPtr) buf, (xmlNotationPtr) nota);
}
/**
@@ -2519,7 +2543,7 @@ void
xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
if ((buf == NULL) || (table == NULL))
return;
- xmlHashScan(table, (xmlHashScanner) xmlDumpNotationDeclScan, buf);
+ xmlHashScan(table, xmlDumpNotationDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -2647,6 +2671,11 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
return(ret);
}
+static void
+xmlFreeIDTableEntry(void *id, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlFreeID((xmlIDPtr) id);
+}
+
/**
* xmlFreeIDTable:
* @table: An id table
@@ -2655,7 +2684,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
*/
void
xmlFreeIDTable(xmlIDTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeID);
+ xmlHashFree(table, xmlFreeIDTableEntry);
}
/**
@@ -2755,7 +2784,7 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
return(-1);
}
- xmlHashRemoveEntry(table, ID, (xmlHashDeallocator) xmlFreeID);
+ xmlHashRemoveEntry(table, ID, xmlFreeIDTableEntry);
xmlFree(ID);
attr->atype = 0;
return(0);
@@ -2839,13 +2868,14 @@ xmlFreeRef(xmlLinkPtr lk) {
}
/**
- * xmlFreeRefList:
+ * xmlFreeRefTableEntry:
* @list_ref: A list of references.
*
* Deallocate the memory used by a list of references
*/
static void
-xmlFreeRefList(xmlListPtr list_ref) {
+xmlFreeRefTableEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlListPtr list_ref = (xmlListPtr) payload;
if (list_ref == NULL) return;
xmlListDelete(list_ref);
}
@@ -2858,7 +2888,7 @@ xmlFreeRefList(xmlListPtr list_ref) {
* Returns 0 to abort the walk or 1 to continue
*/
static int
-xmlWalkRemoveRef(const void *data, const void *user)
+xmlWalkRemoveRef(const void *data, void *user)
{
xmlAttrPtr attr0 = ((xmlRefPtr)data)->attr;
xmlAttrPtr attr1 = ((xmlRemoveMemoPtr)user)->ap;
@@ -2996,7 +3026,7 @@ failed:
*/
void
xmlFreeRefTable(xmlRefTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeRefList);
+ xmlHashFree(table, xmlFreeRefTableEntry);
}
/**
@@ -3093,8 +3123,7 @@ xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) {
/*If the list is empty then remove the list entry in the hash */
if (xmlListEmpty(ref_list))
- xmlHashUpdateEntry(table, ID, NULL, (xmlHashDeallocator)
- xmlFreeRefList);
+ xmlHashUpdateEntry(table, ID, NULL, xmlFreeRefTableEntry);
xmlFree(ID);
return(0);
}
@@ -4090,8 +4119,10 @@ xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
}
static void
-xmlValidateAttributeIdCallback(xmlAttributePtr attr, int *count,
- const xmlChar* name ATTRIBUTE_UNUSED) {
+xmlValidateAttributeIdCallback(void *payload, void *data,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlAttributePtr attr = (xmlAttributePtr) payload;
+ int *count = (int *) data;
if (attr->atype == XML_ATTRIBUTE_ID) (*count)++;
}
@@ -4163,7 +4194,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
nbId = 0;
if (doc->intSubset != NULL) {
table = (xmlAttributeTablePtr) doc->intSubset->attributes;
- xmlHashScan3(table, NULL, NULL, attr->elem, (xmlHashScanner)
+ xmlHashScan3(table, NULL, NULL, attr->elem,
xmlValidateAttributeIdCallback, &nbId);
}
}
@@ -4621,6 +4652,12 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
}
}
+ /*
+ * Casting ns to xmlAttrPtr is wrong. We'd need separate functions
+ * xmlAddID and xmlAddRef for namespace declarations, but it makes
+ * no practical sense to use ID types anyway.
+ */
+#if 0
/* Validity Constraint: ID uniqueness */
if (attrDecl->atype == XML_ATTRIBUTE_ID) {
if (xmlAddID(ctxt, doc, value, (xmlAttrPtr) ns) == NULL)
@@ -4632,6 +4669,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
if (xmlAddRef(ctxt, doc, value, (xmlAttrPtr) ns) == NULL)
ret = 0;
}
+#endif
/* Validity Constraint: Notation Attributes */
if (attrDecl->atype == XML_ATTRIBUTE_NOTATION) {
@@ -5177,6 +5215,7 @@ xmlSnprintfElements(char *buf, int size, xmlNodePtr node, int glob) {
case XML_TEXT_NODE:
if (xmlIsBlankNode(cur))
break;
+ /* Falls through. */
case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE:
strcat(buf, "CDATA");
@@ -5725,7 +5764,7 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
xmlElementPtr elemDecl;
/*
- * Check the new element agaisnt the content model of the new elem.
+ * Check the new element against the content model of the new elem.
*/
if (state->elemDecl != NULL) {
elemDecl = state->elemDecl;
@@ -5817,7 +5856,7 @@ xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) {
xmlElementPtr elemDecl;
/*
- * Check the new element agaisnt the content model of the new elem.
+ * Check the new element against the content model of the new elem.
*/
if (state->elemDecl != NULL) {
elemDecl = state->elemDecl;
@@ -5891,7 +5930,7 @@ xmlValidatePopElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc ATTRIBUTE_UNUSED,
xmlElementPtr elemDecl;
/*
- * Check the new element agaisnt the content model of the new elem.
+ * Check the new element against the content model of the new elem.
*/
if (state->elemDecl != NULL) {
elemDecl = state->elemDecl;
@@ -6516,7 +6555,7 @@ xmlValidateRef(xmlRefPtr ref, xmlValidCtxtPtr ctxt,
* Returns 0 to abort the walk or 1 to continue
*/
static int
-xmlWalkValidateList(const void *data, const void *user)
+xmlWalkValidateList(const void *data, void *user)
{
xmlValidateMemoPtr memo = (xmlValidateMemoPtr)user;
xmlValidateRef((xmlRefPtr)data, memo->ctxt, memo->name);
@@ -6531,8 +6570,9 @@ xmlWalkValidateList(const void *data, const void *user)
*
*/
static void
-xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlValidCtxtPtr ctxt,
- const xmlChar *name) {
+xmlValidateCheckRefCallback(void *payload, void *data, const xmlChar *name) {
+ xmlListPtr ref_list = (xmlListPtr) payload;
+ xmlValidCtxtPtr ctxt = (xmlValidCtxtPtr) data;
xmlValidateMemo memo;
if (ref_list == NULL)
@@ -6588,7 +6628,7 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
table = (xmlRefTablePtr) doc->refs;
ctxt->doc = doc;
ctxt->valid = 1;
- xmlHashScan(table, (xmlHashScanner) xmlValidateCheckRefCallback, ctxt);
+ xmlHashScan(table, xmlValidateCheckRefCallback, ctxt);
ctxt->finishDtd = save;
return(ctxt->valid);
@@ -6645,8 +6685,10 @@ xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd) {
}
static void
-xmlValidateNotationCallback(xmlEntityPtr cur, xmlValidCtxtPtr ctxt,
+xmlValidateNotationCallback(void *payload, void *data,
const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlEntityPtr cur = (xmlEntityPtr) payload;
+ xmlValidCtxtPtr ctxt = (xmlValidCtxtPtr) data;
if (cur == NULL)
return;
if (cur->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
@@ -6664,8 +6706,10 @@ xmlValidateNotationCallback(xmlEntityPtr cur, xmlValidCtxtPtr ctxt,
}
static void
-xmlValidateAttributeCallback(xmlAttributePtr cur, xmlValidCtxtPtr ctxt,
- const xmlChar *name ATTRIBUTE_UNUSED) {
+xmlValidateAttributeCallback(void *payload, void *data,
+ const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlAttributePtr cur = (xmlAttributePtr) payload;
+ xmlValidCtxtPtr ctxt = (xmlValidCtxtPtr) data;
int ret;
xmlDocPtr doc;
xmlElementPtr elem = NULL;
@@ -6764,22 +6808,20 @@ xmlValidateDtdFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
dtd = doc->intSubset;
if ((dtd != NULL) && (dtd->attributes != NULL)) {
table = (xmlAttributeTablePtr) dtd->attributes;
- xmlHashScan(table, (xmlHashScanner) xmlValidateAttributeCallback, ctxt);
+ xmlHashScan(table, xmlValidateAttributeCallback, ctxt);
}
if ((dtd != NULL) && (dtd->entities != NULL)) {
entities = (xmlEntitiesTablePtr) dtd->entities;
- xmlHashScan(entities, (xmlHashScanner) xmlValidateNotationCallback,
- ctxt);
+ xmlHashScan(entities, xmlValidateNotationCallback, ctxt);
}
dtd = doc->extSubset;
if ((dtd != NULL) && (dtd->attributes != NULL)) {
table = (xmlAttributeTablePtr) dtd->attributes;
- xmlHashScan(table, (xmlHashScanner) xmlValidateAttributeCallback, ctxt);
+ xmlHashScan(table, xmlValidateAttributeCallback, ctxt);
}
if ((dtd != NULL) && (dtd->entities != NULL)) {
entities = (xmlEntitiesTablePtr) dtd->entities;
- xmlHashScan(entities, (xmlHashScanner) xmlValidateNotationCallback,
- ctxt);
+ xmlHashScan(entities, xmlValidateNotationCallback, ctxt);
}
return(ctxt->valid);
}
diff --git a/chromium/third_party/libxml/src/win32/Makefile.bcb b/chromium/third_party/libxml/src/win32/Makefile.bcb
index 7129c617503..d326fb99568 100644
--- a/chromium/third_party/libxml/src/win32/Makefile.bcb
+++ b/chromium/third_party/libxml/src/win32/Makefile.bcb
@@ -65,12 +65,6 @@ CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS
!else if "$(WITH_THREADS)" == "posix"
CFLAGS = $(CFLAGS) -DHAVE_PTHREAD_H
!endif
-!if "$(WITH_ZLIB)" == "1"
-CFLAGS = $(CFLAGS) -DHAVE_ZLIB_H
-!endif
-!if "$(WITH_LZMA)" == "1"
-CFLAGS = $(CFLAGS) -DHAVE_LZMA_H
-!endif
# The linker and its options.
LD = ilink32.exe
@@ -231,9 +225,7 @@ UTILS = $(BINDIR)\xmllint.exe\
$(BINDIR)\testlimits.exe
-!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" || "$(WITH_THREADS)" == "native"
-UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe
-!else if "$(WITH_THREADS)" == "posix"
+!if "$(WITH_THREADS)" != "no"
UTILS = $(UTILS) $(BINDIR)\testThreads.exe
!endif
diff --git a/chromium/third_party/libxml/src/win32/Makefile.mingw b/chromium/third_party/libxml/src/win32/Makefile.mingw
index 18893760d64..9dfa4abec69 100644
--- a/chromium/third_party/libxml/src/win32/Makefile.mingw
+++ b/chromium/third_party/libxml/src/win32/Makefile.mingw
@@ -57,12 +57,6 @@ endif
ifeq ($(WITH_THREADS),posix)
CFLAGS += -DHAVE_PTHREAD_H
endif
-ifeq ($(WITH_ZLIB),1)
-CFLAGS += -DHAVE_ZLIB_H
-endif
-ifeq ($(WITH_LZMA),1)
-CFLAGS += -DHAVE_LZMA_H
-endif
# The linker and its options.
LD = gcc.exe
@@ -71,11 +65,9 @@ LDFLAGS += -Wl,--minor-image-version,$(LIBXML_MINOR_VERSION)
LDFLAGS += -Wl,-L,$(BINDIR) -Wl,-L,$(LIBPREFIX)
LIBS =
ifeq ($(WITH_FTP),1)
-CFLAGS += -D_WINSOCKAPI_
LIBS += -lwsock32 -lws2_32
endif
ifeq ($(WITH_HTTP),1)
-CFLAGS += -D_WINSOCKAPI_
LIBS += -lwsock32 -lws2_32
endif
ifeq ($(WITH_ICONV),1)
@@ -228,16 +220,7 @@ UTILS = $(BINDIR)/xmllint.exe\
$(BINDIR)/testapi.exe\
$(BINDIR)/testlimits.exe
-ifeq ($(WITH_THREADS),yes)
-UTILS += $(BINDIR)/testThreadsWin32.exe
-endif
-ifeq ($(WITH_THREADS),ctls)
-UTILS += $(BINDIR)/testThreadsWin32.exe
-endif
-ifeq ($(WITH_THREADS),native)
-UTILS += $(BINDIR)/testThreadsWin32.exe
-endif
-ifeq ($(WITH_THREADS),posix)
+ifneq ($(WITH_THREADS),no)
UTILS += $(BINDIR)/testThreads.exe
endif
diff --git a/chromium/third_party/libxml/src/win32/Makefile.msvc b/chromium/third_party/libxml/src/win32/Makefile.msvc
index d16c1a2d51b..f6a0182d55d 100644
--- a/chromium/third_party/libxml/src/win32/Makefile.msvc
+++ b/chromium/third_party/libxml/src/win32/Makefile.msvc
@@ -22,6 +22,7 @@ AUTOCONF = .\config.msvc
XML_NAME = xml2
XML_BASENAME = lib$(XML_NAME)
XML_SO = $(XML_BASENAME).dll
+XML_RES = $(XML_BASENAME).res
XML_IMP = $(XML_BASENAME).lib
XML_DEF = $(XML_BASENAME).def
XML_A = $(XML_BASENAME)_a.lib
@@ -43,7 +44,7 @@ CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT"
# The compiler and its options.
CC = cl.exe
-CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W1 $(CRUNTIME)
+CFLAGS = /nologo /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W3 /wd4244 /wd4267 $(CRUNTIME)
CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX)
!if "$(WITH_THREADS)" != "no"
CFLAGS = $(CFLAGS) /D "_REENTRANT"
@@ -55,12 +56,6 @@ CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS"
!else if "$(WITH_THREADS)" == "posix"
CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H"
!endif
-!if "$(WITH_ZLIB)" == "1"
-CFLAGS = $(CFLAGS) /D "HAVE_ZLIB_H"
-!endif
-!if "$(WITH_LZMA)" == "1"
-CFLAGS = $(CFLAGS) /D "HAVE_LZMA_H"
-!endif
CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
# The linker and its options.
@@ -75,7 +70,11 @@ LIBS = $(LIBS) wsock32.lib ws2_32.lib
LIBS = $(LIBS) iconv.lib
!endif
!if "$(WITH_ICU)" == "1"
-LIBS = $(LIBS) icu.lib
+!if "$(STATIC)" == "1"
+LIBS = $(LIBS) advapi32.lib sicuuc.lib sicuin.lib sicudt.lib
+!else
+LIBS = $(LIBS) icuuc.lib icuin.lib icudt.lib
+!endif
!endif
!if "$(WITH_ZLIB)" == "1"
# could be named differently zdll or zlib
@@ -245,6 +244,12 @@ XML_OBJS_A_DLL = $(XML_INTDIR_A_DLL)\buf.obj\
$(XML_INTDIR_A_DLL)\xpointer.obj\
$(XML_INTDIR_A_DLL)\xmlstring.obj
+!if "$(WITH_LZMA)" == "1"
+XML_OBJS = $(XML_OBJS) $(XML_INTDIR)\xzlib.obj
+XML_OBJS_A = $(XML_OBJS_A) $(XML_INTDIR_A)\xzlib.obj
+XML_OBJS_A_DLL = $(XML_OBJS_A_DLL) $(XML_INTDIR_A_DLL)\xzlib.obj
+!endif
+
# Xmllint and friends executables.
UTILS = $(BINDIR)\xmllint.exe\
$(BINDIR)\xmlcatalog.exe\
@@ -262,13 +267,14 @@ UTILS = $(BINDIR)\xmllint.exe\
$(BINDIR)\testXPath.exe\
$(BINDIR)\runtest.exe\
$(BINDIR)\runsuite.exe\
+ $(BINDIR)\runxmlconf.exe\
$(BINDIR)\testapi.exe\
+ $(BINDIR)\testchar.exe\
+ $(BINDIR)\testdict.exe\
$(BINDIR)\testlimits.exe\
$(BINDIR)\testrecurse.exe
-!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" || "$(WITH_THREADS)" == "native"
-UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe
-!else if "$(WITH_THREADS)" == "posix"
+!if "$(WITH_THREADS)" != "no"
UTILS = $(UTILS) $(BINDIR)\testThreads.exe
!endif
@@ -373,11 +379,13 @@ $(XML_OBJS_A_DLL) : $(XML_INTDIR_A_DLL)
# Creates the export definition file (DEF) for libxml.
$(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src
$(CPP) $(CPPFLAGS) $(XML_DEF).src > $(XML_INTDIR)\$(XML_DEF)
+$(XML_INTDIR)\$(XML_RES) : $(XML_INTDIR) libxml2.rc
+ rc -Fo $(XML_INTDIR)\$(XML_RES) libxml2.rc
# Creates the libxml shared object.
-$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF)
+$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) $(XML_INTDIR)\$(XML_RES)
$(LD) $(LDFLAGS) /DLL \
- /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS)
+ /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(XML_INTDIR)\$(XML_RES) $(LIBS)
@$(_VC_MANIFEST_EMBED_DLL)
#$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF)
diff --git a/chromium/third_party/libxml/src/win32/configure.js b/chromium/third_party/libxml/src/win32/configure.js
index 92b9ba052c2..dbf238c70c4 100644
--- a/chromium/third_party/libxml/src/win32/configure.js
+++ b/chromium/third_party/libxml/src/win32/configure.js
@@ -280,6 +280,18 @@ function discoverVersion()
vf.WriteLine("DYNRUNTIME=" + (dynruntime? "1" : "0"));
}
vf.Close();
+ versionFile = "rcVersion.h"
+ vf = fso.CreateTextFile(versionFile, true);
+ vf.WriteLine("/*");
+ vf.WriteLine(" " + versionFile);
+ vf.WriteLine(" This file is generated automatically by " + WScript.ScriptName + ".");
+ vf.WriteLine("*/");
+ vf.WriteBlankLines(1);
+ vf.WriteLine("#define LIBXML_MAJOR_VERSION " + verMajor);
+ vf.WriteLine("#define LIBXML_MINOR_VERSION " + verMinor);
+ vf.WriteLine("#define LIBXML_MICRO_VERSION " + verMicro);
+ vf.WriteLine("#define LIBXML_DOTTED_VERSION " + "\"" + verMajor + "." + verMinor + "." + verMicro + "\"");
+ vf.Close()
}
/* Configures libxml. This one will generate xmlversion.h from xmlversion.h.in
diff --git a/chromium/third_party/libxml/src/win32/libxml2.rc b/chromium/third_party/libxml/src/win32/libxml2.rc
new file mode 100644
index 00000000000..c774a5ee5a9
--- /dev/null
+++ b/chromium/third_party/libxml/src/win32/libxml2.rc
@@ -0,0 +1,36 @@
+#include <winver.h>
+#include "rcVersion.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION LIBXML_MAJOR_VERSION,LIBXML_MINOR_VERSION,LIBXML_MICRO_VERSION,0
+ PRODUCTVERSION LIBXML_MAJOR_VERSION,LIBXML_MINOR_VERSION,LIBXML_MICRO_VERSION,0
+ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE VFT2_UNKNOWN // not used
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "04090000" /* Lang = US English, Charset = ASCII */
+ BEGIN
+ VALUE "FileDescription", "libxml2 library\0"
+ VALUE "FileVersion", LIBXML_DOTTED_VERSION "\0"
+ VALUE "InternalName", "libxml2.dll\0"
+ VALUE "LegalCopyright", "Copyright (C) Daniel Veillard\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "libxml2.dll\0"
+ VALUE "ProductName", "libxml2\0"
+ VALUE "ProductVersion", LIBXML_DOTTED_VERSION "\0"
+ VALUE "Comments", "For more information visit http://xmlsoft.org/\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 0 /* US English, ASCII */
+ END
+END
diff --git a/chromium/third_party/libxml/src/xmlIO.c b/chromium/third_party/libxml/src/xmlIO.c
index 1a79c09605e..f61dd05a905 100644
--- a/chromium/third_party/libxml/src/xmlIO.c
+++ b/chromium/third_party/libxml/src/xmlIO.c
@@ -12,6 +12,7 @@
#include "libxml.h"
#include <string.h>
+#include <stddef.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
@@ -32,14 +33,15 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
-#ifdef HAVE_LZMA_H
+#ifdef LIBXML_LZMA_ENABLED
#include <lzma.h>
#endif
-#if defined(WIN32) || defined(_WIN32)
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
@@ -47,38 +49,14 @@
#include <winnls.h> /* for CP_UTF8 */
#endif
-/* Figure a portable way to know if a file is a directory. */
-#ifndef HAVE_STAT
-# ifdef HAVE__STAT
- /* MS C library seems to define stat and _stat. The definition
- is identical. Still, mapping them to each other causes a warning. */
-# ifndef _MSC_VER
-# define stat(x,y) _stat(x,y)
-# endif
-# define HAVE_STAT
-# endif
-#else
-# ifdef HAVE__STAT
-# if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
-# define stat _stat
-# endif
-# endif
-#endif
-#ifdef HAVE_STAT
-# ifndef S_ISDIR
-# ifdef _S_ISDIR
-# define S_ISDIR(x) _S_ISDIR(x)
-# else
-# ifdef S_IFDIR
-# ifndef S_IFMT
-# ifdef _S_IFMT
-# define S_IFMT _S_IFMT
-# endif
-# endif
-# ifdef S_IFMT
-# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-# endif
-# endif
+#ifndef S_ISDIR
+# ifdef _S_ISDIR
+# define S_ISDIR(x) _S_ISDIR(x)
+# elif defined(S_IFDIR)
+# ifdef S_IFMT
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# elif defined(_S_IFMT)
+# define S_ISDIR(m) (((m) & _S_IFMT) == S_IFDIR)
# endif
# endif
#endif
@@ -619,7 +597,7 @@ xmlWrapOpenUtf8(const char *path,int mode)
return fd;
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
static gzFile
xmlWrapGzOpenUtf8(const char *path, const char *mode)
{
@@ -656,99 +634,19 @@ xmlWrapGzOpenUtf8(const char *path, const char *mode)
*
*/
static int
-xmlWrapStatUtf8(const char *path,struct stat *info)
-{
-#ifdef HAVE_STAT
+xmlWrapStatUtf8(const char *path, struct _stat *info) {
int retval = -1;
wchar_t *wPath;
wPath = __xmlIOWin32UTF8ToWChar(path);
- if (wPath)
- {
- retval = _wstat(wPath,info);
+ if (wPath) {
+ retval = _wstat(wPath, info);
xmlFree(wPath);
}
/* maybe path in native encoding */
if(retval < 0)
- retval = stat(path,info);
+ retval = _stat(path, info);
return retval;
-#else
- return -1;
-#endif
-}
-
-/**
- * xmlWrapOpenNative:
- * @path: the path
- * @mode: type of access (0 - read, 1 - write)
- *
- * function opens the file specified by @path
- *
- */
-static FILE*
-xmlWrapOpenNative(const char *path,int mode)
-{
- return fopen(path,mode ? "wb" : "rb");
-}
-
-/**
- * xmlWrapStatNative:
- * @path: the path
- * @info: structure that stores results
- *
- * function obtains information about the file or directory
- *
- */
-static int
-xmlWrapStatNative(const char *path,struct stat *info)
-{
-#ifdef HAVE_STAT
- return stat(path,info);
-#else
- return -1;
-#endif
-}
-
-typedef int (* xmlWrapStatFunc) (const char *f, struct stat *s);
-static xmlWrapStatFunc xmlWrapStat = xmlWrapStatNative;
-typedef FILE* (* xmlWrapOpenFunc)(const char *f,int mode);
-static xmlWrapOpenFunc xmlWrapOpen = xmlWrapOpenNative;
-#ifdef HAVE_ZLIB_H
-typedef gzFile (* xmlWrapGzOpenFunc) (const char *f, const char *mode);
-static xmlWrapGzOpenFunc xmlWrapGzOpen = gzopen;
-#endif
-/**
- * xmlInitPlatformSpecificIo:
- *
- * Initialize platform specific features.
- */
-static void
-xmlInitPlatformSpecificIo(void)
-{
- static int xmlPlatformIoInitialized = 0;
- OSVERSIONINFO osvi;
-
- if(xmlPlatformIoInitialized)
- return;
-
- osvi.dwOSVersionInfoSize = sizeof(osvi);
-
- if(GetVersionEx(&osvi) && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) {
- xmlWrapStat = xmlWrapStatUtf8;
- xmlWrapOpen = xmlWrapOpenUtf8;
-#ifdef HAVE_ZLIB_H
- xmlWrapGzOpen = xmlWrapGzOpenUtf8;
-#endif
- } else {
- xmlWrapStat = xmlWrapStatNative;
- xmlWrapOpen = xmlWrapOpenNative;
-#ifdef HAVE_ZLIB_H
- xmlWrapGzOpen = gzopen;
-#endif
- }
-
- xmlPlatformIoInitialized = 1;
- return;
}
#endif
@@ -771,8 +669,12 @@ int
xmlCheckFilename (const char *path)
{
#ifdef HAVE_STAT
+#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
+ struct _stat stat_buffer;
+#else
struct stat stat_buffer;
#endif
+#endif
if (path == NULL)
return(0);
@@ -786,7 +688,7 @@ xmlCheckFilename (const char *path)
(path[3] == '\\') )
return 1;
- if (xmlWrapStat(path, &stat_buffer) == -1)
+ if (xmlWrapStatUtf8(path, &stat_buffer) == -1)
return 0;
#else
if (stat(path, &stat_buffer) == -1)
@@ -801,14 +703,16 @@ xmlCheckFilename (const char *path)
}
/**
- * xmlNop:
+ * xmlInputReadCallbackNop:
*
- * No Operation function, does nothing, no input
+ * No Operation xmlInputReadCallback function, does nothing.
*
* Returns zero
*/
int
-xmlNop(void) {
+xmlInputReadCallbackNop(void *context ATTRIBUTE_UNUSED,
+ char *buffer ATTRIBUTE_UNUSED,
+ int len ATTRIBUTE_UNUSED) {
return(0);
}
@@ -826,7 +730,7 @@ static int
xmlFdRead (void * context, char * buffer, int len) {
int ret;
- ret = read((int) (long) context, &buffer[0], len);
+ ret = read((int) (ptrdiff_t) context, &buffer[0], len);
if (ret < 0) xmlIOErr(0, "read()");
return(ret);
}
@@ -847,7 +751,7 @@ xmlFdWrite (void * context, const char * buffer, int len) {
int ret = 0;
if (len > 0) {
- ret = write((int) (long) context, &buffer[0], len);
+ ret = write((int) (ptrdiff_t) context, &buffer[0], len);
if (ret < 0) xmlIOErr(0, "write()");
}
return(ret);
@@ -865,7 +769,7 @@ xmlFdWrite (void * context, const char * buffer, int len) {
static int
xmlFdClose (void * context) {
int ret;
- ret = close((int) (long) context);
+ ret = close((int) (ptrdiff_t) context);
if (ret < 0) xmlIOErr(0, "close()");
return(ret);
}
@@ -926,11 +830,14 @@ xmlFileOpen_real (const char *filename) {
#endif
}
+ /* Do not check DDNAME on zOS ! */
+#if !defined(__MVS__)
if (!xmlCheckFilename(path))
return(NULL);
+#endif
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
- fd = xmlWrapOpen(path, 0);
+ fd = xmlWrapOpenUtf8(path, 0);
#else
fd = fopen(path, "r");
#endif /* WIN32 */
@@ -1003,12 +910,14 @@ xmlFileOpenW (const char *filename) {
return(NULL);
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
- fd = xmlWrapOpen(path, 1);
+ fd = xmlWrapOpenUtf8(path, 1);
+#elif(__MVS__)
+ fd = fopen(path, "w");
#else
- fd = fopen(path, "wb");
+ fd = fopen(path, "wb");
#endif /* WIN32 */
- if (fd == NULL) xmlIOErr(0, path);
+ if (fd == NULL) xmlIOErr(0, path);
return((void *) fd);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -1129,7 +1038,7 @@ xmlBufferWrite (void * context, const char * buffer, int len) {
}
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
/************************************************************************
* *
* I/O for compressed file accesses *
@@ -1193,7 +1102,7 @@ xmlGzfileOpen_real (const char *filename) {
return(NULL);
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
- fd = xmlWrapGzOpen(path, "rb");
+ fd = xmlWrapGzOpenUtf8(path, "rb");
#else
fd = gzopen(path, "rb");
#endif
@@ -1270,7 +1179,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
return(NULL);
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
- fd = xmlWrapGzOpen(path, mode);
+ fd = xmlWrapGzOpenUtf8(path, mode);
#else
fd = gzopen(path, mode);
#endif
@@ -1286,7 +1195,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
*
* Read @len bytes to @buffer from the compressed I/O channel.
*
- * Returns the number of bytes written
+ * Returns the number of bytes read.
*/
static int
xmlGzfileRead (void * context, char * buffer, int len) {
@@ -1332,7 +1241,7 @@ xmlGzfileClose (void * context) {
if (ret < 0) xmlIOErr(0, "gzclose()");
return(ret);
}
-#endif /* HAVE_ZLIB_H */
+#endif /* LIBXML_ZLIB_ENABLED */
#ifdef LIBXML_LZMA_ENABLED
/************************************************************************
@@ -1471,7 +1380,7 @@ typedef struct xmlIOHTTPWriteCtxt_
} xmlIOHTTPWriteCtxt, *xmlIOHTTPWriteCtxtPtr;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#define DFLT_WBITS ( -15 )
#define DFLT_MEM_LVL ( 8 )
@@ -1674,7 +1583,7 @@ xmlZMemBuffExtend( xmlZMemBuffPtr buff, size_t ext_amt ) {
xmlStrPrintf(msg, 500,
"xmlZMemBuffExtend: %s %lu bytes.\n",
"Allocation failure extending output buffer to",
- new_size );
+ (unsigned long) new_size );
xmlIOErr(XML_IO_WRITE, (const char *) msg);
}
@@ -1799,7 +1708,7 @@ xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) {
return ( zlgth );
}
#endif /* LIBXML_OUTPUT_ENABLED */
-#endif /* HAVE_ZLIB_H */
+#endif /* LIBXML_ZLIB_ENABLED */
#ifdef LIBXML_OUTPUT_ENABLED
/**
@@ -1818,7 +1727,7 @@ xmlFreeHTTPWriteCtxt( xmlIOHTTPWriteCtxtPtr ctxt )
if ( ctxt->doc_buff != NULL ) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ( ctxt->compression > 0 ) {
xmlFreeZMemBuff( ctxt->doc_buff );
}
@@ -1876,7 +1785,7 @@ xmlIOHTTPOpen (const char *filename) {
*/
void *
-xmlIOHTTPOpenW(const char *post_uri, int compression)
+xmlIOHTTPOpenW(const char *post_uri, int compression ATTRIBUTE_UNUSED)
{
xmlIOHTTPWriteCtxtPtr ctxt = NULL;
@@ -1905,7 +1814,7 @@ xmlIOHTTPOpenW(const char *post_uri, int compression)
* ** is being used to avoid pushing the data to disk and back.
*/
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((compression > 0) && (compression <= 9)) {
ctxt->compression = compression;
@@ -1985,7 +1894,7 @@ xmlIOHTTPWrite( void * context, const char * buffer, int len ) {
/* Use gzwrite or fwrite as previously setup in the open call */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ( ctxt->compression > 0 )
len = xmlZMemBuffAppend( ctxt->doc_buff, buffer, len );
@@ -2049,7 +1958,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
/* Retrieve the content from the appropriate buffer */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ( ctxt->compression > 0 ) {
content_lgth = xmlZMemBuffGetContent( ctxt->doc_buff, &http_content );
@@ -2318,16 +2227,12 @@ xmlRegisterDefaultInputCallbacks(void) {
if (xmlInputCallbackInitialized)
return;
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
- xmlInitPlatformSpecificIo();
-#endif
-
xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen,
xmlFileRead, xmlFileClose);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
xmlGzfileRead, xmlGzfileClose);
-#endif /* HAVE_ZLIB_H */
+#endif /* LIBXML_ZLIB_ENABLED */
#ifdef LIBXML_LZMA_ENABLED
xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen,
xmlXzfileRead, xmlXzfileClose);
@@ -2356,10 +2261,6 @@ xmlRegisterDefaultOutputCallbacks (void) {
if (xmlOutputCallbackInitialized)
return;
-#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
- xmlInitPlatformSpecificIo();
-#endif
-
xmlRegisterOutputCallbacks(xmlFileMatch, xmlFileOpenW,
xmlFileWrite, xmlFileClose);
@@ -2373,7 +2274,7 @@ xmlRegisterDefaultOutputCallbacks (void) {
uncompressed ones except opening if existing then closing
and saving with same compression ratio ... a pain.
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
xmlRegisterOutputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
xmlGzfileWrite, xmlGzfileClose);
#endif
@@ -2663,7 +2564,7 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
ret->context = context;
ret->readcallback = xmlInputCallbackTable[i].readcallback;
ret->closecallback = xmlInputCallbackTable[i].closecallback;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((xmlInputCallbackTable[i].opencallback == xmlGzfileOpen) &&
(strcmp(URI, "-") != 0)) {
#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1230
@@ -2727,7 +2628,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
int i = 0;
void *context = NULL;
char *unescaped = NULL;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
int is_file_uri = 1;
#endif
@@ -2738,7 +2639,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
puri = xmlParseURI(URI);
if (puri != NULL) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((puri->scheme != NULL) &&
(!xmlStrEqual(BAD_CAST puri->scheme, BAD_CAST "file")))
is_file_uri = 0;
@@ -2758,7 +2659,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
* try with an unescaped version of the URI
*/
if (unescaped != NULL) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) {
context = xmlGzfileOpenW(unescaped, compression);
if (context != NULL) {
@@ -2776,7 +2677,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
(xmlOutputCallbackTable[i].matchcallback(unescaped) != 0)) {
-#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
+#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED)
/* Need to pass compression parameter into HTTP open calls */
if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
context = xmlIOHTTPOpenW(unescaped, compression);
@@ -2795,7 +2696,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
* filename
*/
if (context == NULL) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) {
context = xmlGzfileOpenW(URI, compression);
if (context != NULL) {
@@ -2812,7 +2713,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
(xmlOutputCallbackTable[i].matchcallback(URI) != 0)) {
-#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
+#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED)
/* Need to pass compression parameter into HTTP open calls */
if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
context = xmlIOHTTPOpenW(URI, compression);
@@ -2942,10 +2843,8 @@ xmlOutputBufferCreateBuffer(xmlBufferPtr buffer,
if (buffer == NULL) return(NULL);
- ret = xmlOutputBufferCreateIO((xmlOutputWriteCallback)
- xmlBufferWrite,
- (xmlOutputCloseCallback)
- NULL, (void *) buffer, encoder);
+ ret = xmlOutputBufferCreateIO(xmlBufferWrite, NULL, (void *) buffer,
+ encoder);
return(ret);
}
@@ -3003,7 +2902,7 @@ xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc) {
ret = xmlAllocParserInputBuffer(enc);
if (ret != NULL) {
- ret->context = (void *) (long) fd;
+ ret->context = (void *) (ptrdiff_t) fd;
ret->readcallback = xmlFdRead;
ret->closecallback = xmlFdClose;
}
@@ -3027,13 +2926,13 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
int errcode;
- if (size <= 0) return(NULL);
+ if (size < 0) return(NULL);
if (mem == NULL) return(NULL);
ret = xmlAllocParserInputBuffer(enc);
if (ret != NULL) {
ret->context = (void *) mem;
- ret->readcallback = (xmlInputReadCallback) xmlNop;
+ ret->readcallback = xmlInputReadCallbackNop;
ret->closecallback = NULL;
errcode = xmlBufAdd(ret->buffer, (const xmlChar *) mem, size);
if (errcode != 0) {
@@ -3063,7 +2962,7 @@ xmlParserInputBufferCreateStatic(const char *mem, int size,
xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
- if (size <= 0) return(NULL);
+ if (size < 0) return(NULL);
if (mem == NULL) return(NULL);
ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer));
@@ -3109,7 +3008,7 @@ xmlOutputBufferCreateFd(int fd, xmlCharEncodingHandlerPtr encoder) {
ret = xmlAllocOutputBufferInternal(encoder);
if (ret != NULL) {
- ret->context = (void *) (long) fd;
+ ret->context = (void *) (ptrdiff_t) fd;
ret->writecallback = xmlFdWrite;
ret->closecallback = NULL;
}
@@ -3823,7 +3722,7 @@ xmlParserGetDirectory(const char *filename) {
if (filename == NULL) return(NULL);
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
# define IS_XMLPGD_SEP(ch) ((ch=='/')||(ch=='\\'))
#else
# define IS_XMLPGD_SEP(ch) (ch=='/')
diff --git a/chromium/third_party/libxml/src/xmlmemory.c b/chromium/third_party/libxml/src/xmlmemory.c
index f08c8c3d3bb..6f16c4b3caf 100644
--- a/chromium/third_party/libxml/src/xmlmemory.c
+++ b/chromium/third_party/libxml/src/xmlmemory.c
@@ -111,7 +111,7 @@ typedef struct memnod {
#define MAX_SIZE_T ((size_t)-1)
-#define CLIENT_2_HDR(a) ((MEMHDR *) (((char *) (a)) - RESERVE_SIZE))
+#define CLIENT_2_HDR(a) ((void *) (((char *) (a)) - RESERVE_SIZE))
#define HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE))
@@ -172,6 +172,13 @@ xmlMallocLoc(size_t size, const char * file, int line)
TEST_POINT
+ if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlMallocLoc : Unsigned overflow\n");
+ xmlMemoryDump();
+ return(NULL);
+ }
+
p = (MEMHDR *) malloc(RESERVE_SIZE+size);
if (!p) {
@@ -243,7 +250,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
xmlGenericError(xmlGenericErrorContext,
- "xmlMallocAtomicLoc : Unsigned overflow prevented\n");
+ "xmlMallocAtomicLoc : Unsigned overflow\n");
xmlMemoryDump();
return(NULL);
}
@@ -352,6 +359,13 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
#endif
xmlMutexUnlock(xmlMemMutex);
+ if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlReallocLoc : Unsigned overflow\n");
+ xmlMemoryDump();
+ return(NULL);
+ }
+
tmp = (MEMHDR *) realloc(p,RESERVE_SIZE+size);
if (!tmp) {
free(p);
@@ -473,7 +487,7 @@ xmlMemFree(void *ptr)
error:
xmlGenericError(xmlGenericErrorContext,
- "xmlMemFree(%lX) error\n", (unsigned long) ptr);
+ "xmlMemFree(%p) error\n", ptr);
xmlMallocBreakpoint();
return;
}
@@ -499,6 +513,13 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
if (!xmlMemInitialized) xmlInitMemory();
TEST_POINT
+ if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlMemStrdupLoc : Unsigned overflow\n");
+ xmlMemoryDump();
+ return(NULL);
+ }
+
p = (MEMHDR *) malloc(RESERVE_SIZE+size);
if (!p) {
goto error;
diff --git a/chromium/third_party/libxml/src/xmlreader.c b/chromium/third_party/libxml/src/xmlreader.c
index f285790be21..1f6d8f6a06e 100644
--- a/chromium/third_party/libxml/src/xmlreader.c
+++ b/chromium/third_party/libxml/src/xmlreader.c
@@ -32,6 +32,7 @@
#include <libxml/xmlIO.h>
#include <libxml/xmlreader.h>
#include <libxml/parserInternals.h>
+
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/relaxng.h>
#include <libxml/xmlschemas.h>
@@ -238,6 +239,8 @@ xmlFreeID(xmlIDPtr id) {
if (id->value != NULL)
DICT_FREE(id->value)
+ if (id->name != NULL)
+ DICT_FREE(id->name)
xmlFree(id);
}
@@ -271,6 +274,7 @@ xmlTextReaderRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
return(-1);
}
id->name = attr->name;
+ attr->name = NULL;
id->attr = NULL;
return(0);
}
@@ -491,6 +495,11 @@ xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) {
}
}
+static void
+xmlTextReaderFreeIDTableEntry(void *id, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlFreeID((xmlIDPtr) id);
+}
+
/**
* xmlTextReaderFreeIDTable:
* @table: An id table
@@ -499,7 +508,7 @@ xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) {
*/
static void
xmlTextReaderFreeIDTable(xmlIDTablePtr table) {
- xmlHashFree(table, (xmlHashDeallocator) xmlFreeID);
+ xmlHashFree(table, xmlTextReaderFreeIDTableEntry);
}
/**
@@ -1107,11 +1116,11 @@ xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
continue;
} else {
/*
- * The error has probably be raised already.
+ * The error has probably been raised already.
*/
if (node == oldnode)
break;
- node = node->next;
+ goto skip_children;
}
#ifdef LIBXML_REGEXP_ENABLED
} else if (node->type == XML_ELEMENT_NODE) {
@@ -1133,6 +1142,7 @@ xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
} else if (node->type == XML_ELEMENT_NODE) {
xmlTextReaderValidatePop(reader);
}
+skip_children:
if (node->next != NULL) {
node = node->next;
continue;
@@ -1706,10 +1716,11 @@ xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
if (xmlTextReaderExpand(reader) == NULL) {
return NULL;
}
- doc = reader->doc;
+ doc = reader->node->doc;
buff = xmlBufferCreate();
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);
buff2 = xmlBufferCreate();
if (xmlNodeDump(buff2, doc, node, 0, 0) == -1) {
@@ -1750,10 +1761,11 @@ xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
xmlDocPtr doc;
node = reader->node;
- doc = reader->doc;
+ doc = node->doc;
if (xmlTextReaderExpand(reader) == NULL) {
return NULL;
}
+ /* XXX: Why is the node copied? */
if (node->type == XML_DTD_NODE) {
node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node);
} else {
@@ -1912,12 +1924,9 @@ xmlTextReaderNextTree(xmlTextReaderPtr reader)
/* if reader->node->next is NULL mean no subtree for current node,
so need to move to sibling of parent node if present */
- if ((reader->node->type == XML_ELEMENT_NODE) ||
- (reader->node->type == XML_ATTRIBUTE_NODE)) {
- reader->state = XML_TEXTREADER_BACKTRACK;
- /* This will move to parent if present */
- xmlTextReaderRead(reader);
- }
+ reader->state = XML_TEXTREADER_BACKTRACK;
+ /* This will move to parent if present */
+ xmlTextReaderRead(reader);
}
if (reader->node->next != 0) {
@@ -2258,17 +2267,21 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
if (reader->ctxt != NULL) {
if (reader->dict == reader->ctxt->dict)
reader->dict = NULL;
- if (reader->ctxt->myDoc != NULL) {
- if (reader->preserve == 0)
- xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);
- reader->ctxt->myDoc = NULL;
- }
+#ifdef LIBXML_REGEXP_ENABLED
if ((reader->ctxt->vctxt.vstateTab != NULL) &&
(reader->ctxt->vctxt.vstateMax > 0)){
+ while (reader->ctxt->vctxt.vstateNr > 0)
+ xmlValidatePopElement(&reader->ctxt->vctxt, NULL, NULL, NULL);
xmlFree(reader->ctxt->vctxt.vstateTab);
reader->ctxt->vctxt.vstateTab = NULL;
reader->ctxt->vctxt.vstateMax = 0;
}
+#endif
+ 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);
}
@@ -3001,7 +3014,7 @@ xmlTextReaderAttributeCount(xmlTextReaderPtr reader) {
* Reference:
* http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html
*
- * Returns the xmlNodeType of the current node or -1 in case of error
+ * Returns the xmlReaderTypes of the current node or -1 in case of error
*/
int
xmlTextReaderNodeType(xmlTextReaderPtr reader) {
@@ -3982,7 +3995,7 @@ xmlTextReaderPreserve(xmlTextReaderPtr reader) {
* pattern. The caller must also use xmlTextReaderCurrentDoc() to
* keep an handle on the resulting document once parsing has finished
*
- * Returns a positive number in case of success and -1 in case of error
+ * Returns a non-negative number in case of success and -1 in case of error
*/
int
xmlTextReaderPreservePattern(xmlTextReaderPtr reader, const xmlChar *pattern,
diff --git a/chromium/third_party/libxml/src/xmlsave.c b/chromium/third_party/libxml/src/xmlsave.c
index 4a8e3f39032..7a05d832495 100644
--- a/chromium/third_party/libxml/src/xmlsave.c
+++ b/chromium/third_party/libxml/src/xmlsave.c
@@ -1123,9 +1123,6 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) {
cur->encoding = BAD_CAST ctxt->encoding;
} else if (cur->encoding != NULL) {
encoding = cur->encoding;
- } else if (cur->charset != XML_CHAR_ENCODING_UTF8) {
- encoding = (const xmlChar *)
- xmlGetCharEncodingName((xmlCharEncoding) cur->charset);
}
if (((cur->type == XML_HTML_DOCUMENT_NODE) &&
@@ -1595,31 +1592,31 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
if (cur->properties != NULL)
xhtmlAttrListDumpOutput(ctxt, cur->properties);
- if ((cur->type == XML_ELEMENT_NODE) &&
- (cur->parent != NULL) &&
- (cur->parent->parent == (xmlNodePtr) cur->doc) &&
- xmlStrEqual(cur->name, BAD_CAST"head") &&
- xmlStrEqual(cur->parent->name, BAD_CAST"html")) {
-
- tmp = cur->children;
- while (tmp != NULL) {
- if (xmlStrEqual(tmp->name, BAD_CAST"meta")) {
- xmlChar *httpequiv;
-
- httpequiv = xmlGetProp(tmp, BAD_CAST"http-equiv");
- if (httpequiv != NULL) {
- if (xmlStrcasecmp(httpequiv, BAD_CAST"Content-Type") == 0) {
- xmlFree(httpequiv);
- break;
- }
- xmlFree(httpequiv);
- }
- }
- tmp = tmp->next;
- }
- if (tmp == NULL)
- addmeta = 1;
- }
+ if ((cur->type == XML_ELEMENT_NODE) &&
+ (cur->parent != NULL) &&
+ (cur->parent->parent == (xmlNodePtr) cur->doc) &&
+ xmlStrEqual(cur->name, BAD_CAST"head") &&
+ xmlStrEqual(cur->parent->name, BAD_CAST"html")) {
+
+ tmp = cur->children;
+ while (tmp != NULL) {
+ if (xmlStrEqual(tmp->name, BAD_CAST"meta")) {
+ xmlChar *httpequiv;
+
+ httpequiv = xmlGetProp(tmp, BAD_CAST"http-equiv");
+ if (httpequiv != NULL) {
+ if (xmlStrcasecmp(httpequiv, BAD_CAST"Content-Type") == 0) {
+ xmlFree(httpequiv);
+ break;
+ }
+ xmlFree(httpequiv);
+ }
+ }
+ tmp = tmp->next;
+ }
+ if (tmp == NULL)
+ addmeta = 1;
+ }
if ((cur->type == XML_ELEMENT_NODE) && (cur->children == NULL)) {
if (((cur->ns == NULL) || (cur->ns->prefix == NULL)) &&
@@ -2109,8 +2106,6 @@ xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
xmlBufAdd(buf, base, cur - base);
if (*cur < 0xC0) {
xmlSaveErr(XML_SAVE_NOT_UTF8, (xmlNodePtr) attr, NULL);
- if (doc != NULL)
- doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
xmlSerializeHexCharRef(tmp, *cur);
xmlBufAdd(buf, (xmlChar *) tmp, -1);
cur++;
@@ -2140,9 +2135,6 @@ xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
}
if ((l == 1) || (!IS_CHAR(val))) {
xmlSaveErr(XML_SAVE_CHAR_INVALID, (xmlNodePtr) attr, NULL);
- if (doc != NULL)
- doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
-
xmlSerializeHexCharRef(tmp, *cur);
xmlBufAdd(buf, (xmlChar *) tmp, -1);
cur++;
@@ -2709,7 +2701,7 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur,
return(-1);
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (cur->compression < 0) cur->compression = xmlGetCompressMode();
#endif
/*
diff --git a/chromium/third_party/libxml/src/xmlstring.c b/chromium/third_party/libxml/src/xmlstring.c
index 9e704a9f346..780c6435a0f 100644
--- a/chromium/third_party/libxml/src/xmlstring.c
+++ b/chromium/third_party/libxml/src/xmlstring.c
@@ -440,8 +440,8 @@ xmlStrlen(const xmlChar *str) {
* first bytes of @add. Note that if @len < 0 then this is an API error
* and NULL will be returned.
*
- * Returns a new xmlChar *, the original @cur is reallocated if needed
- * and should not be freed
+ * Returns a new xmlChar *, the original @cur is reallocated and should
+ * not be freed.
*/
xmlChar *
@@ -519,7 +519,8 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
* encoded in UTF-8 or an encoding with 8bit based chars, we assume
* a termination mark of '0'.
*
- * Returns a new xmlChar * containing the concatenated string.
+ * Returns a new xmlChar * containing the concatenated string. The original
+ * @cur is reallocated and should not be freed.
*/
xmlChar *
xmlStrcat(xmlChar *cur, const xmlChar *add) {
@@ -822,7 +823,7 @@ xmlCheckUTF8(const unsigned char *utf)
* @len: the number of characters in the array
*
* storage size of an UTF8 string
- * the behaviour is not garanteed if the input string is not UTF-8
+ * the behaviour is not guaranteed if the input string is not UTF-8
*
* Returns the storage size of
* the first 'len' characters of ARRAY
diff --git a/chromium/third_party/libxml/src/xmlunicode.c b/chromium/third_party/libxml/src/xmlunicode.c
index ce6e9a4f10d..6d0a96a0e27 100644
--- a/chromium/third_party/libxml/src/xmlunicode.c
+++ b/chromium/third_party/libxml/src/xmlunicode.c
@@ -29,14 +29,14 @@ typedef struct {
} xmlUnicodeRange;
typedef struct {
- xmlUnicodeRange *table;
+ const xmlUnicodeRange *table;
int numentries;
} xmlUnicodeNameTable;
static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname);
-static xmlUnicodeRange xmlUnicodeBlocks[] = {
+static const xmlUnicodeRange xmlUnicodeBlocks[] = {
{"AegeanNumbers", xmlUCSIsAegeanNumbers},
{"AlphabeticPresentationForms", xmlUCSIsAlphabeticPresentationForms},
{"Arabic", xmlUCSIsArabic},
@@ -945,7 +945,7 @@ static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, 36};
static xmlIntFunc
*xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname) {
int low, high, mid, cmp;
- xmlUnicodeRange *sptr;
+ const xmlUnicodeRange *sptr;
if ((tptr == NULL) || (tname == NULL)) return(NULL);
diff --git a/chromium/third_party/libxml/src/xmlwriter.c b/chromium/third_party/libxml/src/xmlwriter.c
index 69541b894f6..b5cd171f5bc 100644
--- a/chromium/third_party/libxml/src/xmlwriter.c
+++ b/chromium/third_party/libxml/src/xmlwriter.c
@@ -110,7 +110,7 @@ static void xmlFreeTextWriterNsStackEntry(xmlLinkPtr lk);
static int xmlCmpTextWriterNsStackEntry(const void *data0,
const void *data1);
static int xmlTextWriterWriteDocCallback(void *context,
- const xmlChar * str, int len);
+ const char *str, int len);
static int xmlTextWriterCloseDocCallback(void *context);
static xmlChar *xmlTextWriterVSprintf(const char *format, va_list argptr) LIBXML_ATTR_FORMAT(1,0);
@@ -190,9 +190,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out)
}
memset(ret, 0, (size_t) sizeof(xmlTextWriter));
- ret->nodes = xmlListCreate((xmlListDeallocator)
- xmlFreeTextWriterStackEntry,
- (xmlListDataCompare)
+ ret->nodes = xmlListCreate(xmlFreeTextWriterStackEntry,
xmlCmpTextWriterStackEntry);
if (ret->nodes == NULL) {
xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
@@ -201,9 +199,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out)
return NULL;
}
- ret->nsstack = xmlListCreate((xmlListDeallocator)
- xmlFreeTextWriterNsStackEntry,
- (xmlListDataCompare)
+ ret->nsstack = xmlListCreate(xmlFreeTextWriterNsStackEntry,
xmlCmpTextWriterNsStackEntry);
if (ret->nsstack == NULL) {
xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
@@ -329,9 +325,7 @@ xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt,
return NULL;
}
- out = xmlOutputBufferCreateIO((xmlOutputWriteCallback)
- xmlTextWriterWriteDocCallback,
- (xmlOutputCloseCallback)
+ out = xmlOutputBufferCreateIO(xmlTextWriterWriteDocCallback,
xmlTextWriterCloseDocCallback,
(void *) ctxt, NULL);
if (out == NULL) {
@@ -3754,6 +3748,7 @@ xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer)
if (count < 0)
return -1;
sum += count;
+ /* Falls through. */
case XML_TEXTWRITER_DTD_ENTY:
case XML_TEXTWRITER_DTD_PENT:
count = xmlOutputBufferWriteString(writer->out, ">");
@@ -4421,12 +4416,12 @@ xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1)
* Returns -1, 0, 1
*/
static int
-xmlTextWriterWriteDocCallback(void *context, const xmlChar * str, int len)
+xmlTextWriterWriteDocCallback(void *context, const char *str, int len)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) context;
int rc;
- if ((rc = xmlParseChunk(ctxt, (const char *) str, len, 0)) != 0) {
+ if ((rc = xmlParseChunk(ctxt, str, len, 0)) != 0) {
xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR,
"xmlTextWriterWriteDocCallback : XML error %d !\n",
rc);
@@ -4452,7 +4447,7 @@ xmlTextWriterCloseDocCallback(void *context)
if ((rc = xmlParseChunk(ctxt, NULL, 0, 1)) != 0) {
xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR,
- "xmlTextWriterWriteDocCallback : XML error %d !\n",
+ "xmlTextWriterCloseDocCallback : XML error %d !\n",
rc);
return -1;
}
diff --git a/chromium/third_party/libxml/src/xpath.c b/chromium/third_party/libxml/src/xpath.c
index 7c24a824ec0..59f2e102359 100644
--- a/chromium/third_party/libxml/src/xpath.c
+++ b/chromium/third_party/libxml/src/xpath.c
@@ -2,7 +2,7 @@
* xpath.c: XML Path Language implementation
* XPath is a language for addressing parts of an XML document,
* designed to be used by both XSLT and XPointer
- *f
+ *
* Reference: W3C Recommendation 16 November 1999
* http://www.w3.org/TR/1999/REC-xpath-19991116
* Public reference:
@@ -14,10 +14,17 @@
*
*/
+/* To avoid EBCDIC trouble when parsing on zOS */
+#if defined(__MVS__)
+#pragma convert("ISO8859-1")
+#endif
+
#define IN_LIBXML
#include "libxml.h"
+#include <limits.h>
#include <string.h>
+#include <stddef.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -153,7 +160,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) {
int misc = 0, precedence1 = 0, precedence2 = 0;
xmlNodePtr miscNode1 = NULL, miscNode2 = NULL;
xmlNodePtr cur, root;
- long l1, l2;
+ ptrdiff_t l1, l2;
if ((node1 == NULL) || (node2 == NULL))
return(-2);
@@ -167,12 +174,12 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) {
switch (node1->type) {
case XML_ELEMENT_NODE:
if (node2->type == XML_ELEMENT_NODE) {
- if ((0 > (long) node1->content) && /* TODO: Would a != 0 suffice here? */
- (0 > (long) node2->content) &&
+ if ((0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc))
{
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
@@ -217,7 +224,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) {
node1 = node1->parent;
}
if ((node1 == NULL) || (node1->type != XML_ELEMENT_NODE) ||
- (0 <= (long) node1->content)) {
+ (0 <= (ptrdiff_t) node1->content)) {
/*
* Fallback for whatever case.
*/
@@ -267,7 +274,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) {
node2 = node2->parent;
}
if ((node2 == NULL) || (node2->type != XML_ELEMENT_NODE) ||
- (0 <= (long) node2->content))
+ (0 <= (ptrdiff_t) node2->content))
{
node2 = miscNode2;
precedence2 = 0;
@@ -340,12 +347,12 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) {
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
- (0 > (long) node1->content) &&
- (0 > (long) node2->content) &&
+ (0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc)) {
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
@@ -408,12 +415,12 @@ turtle_comparison:
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
- (0 > (long) node1->content) &&
- (0 > (long) node2->content) &&
+ (0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc)) {
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
@@ -470,19 +477,17 @@ int wrap_cmp( xmlNodePtr x, xmlNodePtr y );
* *
************************************************************************/
-#ifndef TRIO_REPLACE_STDIO
-#define TRIO_PUBLIC static
+#ifndef INFINITY
+#define INFINITY (DBL_MAX * DBL_MAX)
#endif
-#include "trionan.c"
-/*
- * The lack of portability of this section of the libc is annoying !
- */
-double xmlXPathNAN = 0;
-double xmlXPathPINF = 1;
-double xmlXPathNINF = -1;
-static double xmlXPathNZERO = 0; /* not exported from headers */
-static int xmlXPathInitialized = 0;
+#ifndef NAN
+#define NAN (INFINITY / INFINITY)
+#endif
+
+double xmlXPathNAN;
+double xmlXPathPINF;
+double xmlXPathNINF;
/**
* xmlXPathInit:
@@ -491,63 +496,48 @@ static int xmlXPathInitialized = 0;
*/
void
xmlXPathInit(void) {
- if (xmlXPathInitialized) return;
-
- xmlXPathPINF = trio_pinf();
- xmlXPathNINF = trio_ninf();
- xmlXPathNAN = trio_nan();
- xmlXPathNZERO = trio_nzero();
-
- xmlXPathInitialized = 1;
+ xmlXPathNAN = NAN;
+ xmlXPathPINF = INFINITY;
+ xmlXPathNINF = -INFINITY;
}
/**
* xmlXPathIsNaN:
* @val: a double value
*
- * Provides a portable isnan() function to detect whether a double
- * is a NotaNumber. Based on trio code
- * http://sourceforge.net/projects/ctrio/
- *
* Returns 1 if the value is a NaN, 0 otherwise
*/
int
xmlXPathIsNaN(double val) {
- return(trio_isnan(val));
+#ifdef isnan
+ return isnan(val);
+#else
+ return !(val == val);
+#endif
}
/**
* xmlXPathIsInf:
* @val: a double value
*
- * Provides a portable isinf() function to detect whether a double
- * is a +Infinite or -Infinite. Based on trio code
- * http://sourceforge.net/projects/ctrio/
- *
- * Returns 1 vi the value is +Infinite, -1 if -Infinite, 0 otherwise
+ * Returns 1 if the value is +Infinite, -1 if -Infinite, 0 otherwise
*/
int
xmlXPathIsInf(double val) {
- return(trio_isinf(val));
+#ifdef isinf
+ return isinf(val) ? (val > 0 ? 1 : -1) : 0;
+#else
+ if (val >= INFINITY)
+ return 1;
+ if (val <= -INFINITY)
+ return -1;
+ return 0;
+#endif
}
#endif /* SCHEMAS or XPATH */
-#ifdef LIBXML_XPATH_ENABLED
-/**
- * xmlXPathGetSign:
- * @val: a double value
- *
- * Provides a portable function to detect the sign of a double
- * Modified from trio code
- * http://sourceforge.net/projects/ctrio/
- *
- * Returns 1 if the value is Negative, 0 if positive
- */
-static int
-xmlXPathGetSign(double val) {
- return(trio_signbit(val));
-}
+#ifdef LIBXML_XPATH_ENABLED
/*
* TODO: when compatibility allows remove all "fake node libxslt" strings
@@ -878,15 +868,14 @@ typedef enum {
XPATH_OP_UNION,
XPATH_OP_ROOT,
XPATH_OP_NODE,
- XPATH_OP_RESET, /* 10 */
XPATH_OP_COLLECT,
- XPATH_OP_VALUE, /* 12 */
+ XPATH_OP_VALUE, /* 11 */
XPATH_OP_VARIABLE,
XPATH_OP_FUNCTION,
XPATH_OP_ARG,
XPATH_OP_PREDICATE,
- XPATH_OP_FILTER, /* 17 */
- XPATH_OP_SORT /* 18 */
+ XPATH_OP_FILTER, /* 16 */
+ XPATH_OP_SORT /* 17 */
#ifdef LIBXML_XPTR_ENABLED
,XPATH_OP_RANGETO
#endif
@@ -935,7 +924,7 @@ struct _xmlXPathStepOp {
int value3;
void *value4;
void *value5;
- void *cache;
+ xmlXPathFunction cache;
void *cacheURI;
};
@@ -971,6 +960,8 @@ static int
xmlXPathCompOpEvalToBoolean(xmlXPathParserContextPtr ctxt,
xmlXPathStepOpPtr op,
int isPredicate);
+static void
+xmlXPathFreeObjectEntry(void *obj, const xmlChar *name);
/************************************************************************
* *
@@ -1414,7 +1405,8 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
default:
if (xmlXPathIsNaN(cur->floatval)) {
fprintf(output, "Object is a number : NaN\n");
- } else if (cur->floatval == 0 && xmlXPathGetSign(cur->floatval) != 0) {
+ } else if (cur->floatval == 0) {
+ /* Omit sign for negative zero. */
fprintf(output, "Object is a number : 0\n");
} else {
fprintf(output, "Object is a number : %0g\n", cur->floatval);
@@ -1533,8 +1525,6 @@ xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
fprintf(output, "ROOT"); break;
case XPATH_OP_NODE:
fprintf(output, "NODE"); break;
- case XPATH_OP_RESET:
- fprintf(output, "RESET"); break;
case XPATH_OP_SORT:
fprintf(output, "SORT"); break;
case XPATH_OP_COLLECT: {
@@ -1672,10 +1662,17 @@ xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
fprintf(output, "%s", shift);
- fprintf(output, "Compiled Expression : %d elements\n",
- comp->nbStep);
- i = comp->last;
- xmlXPathDebugDumpStepOp(output, comp, &comp->steps[i], depth + 1);
+#ifdef XPATH_STREAMING
+ if (comp->stream) {
+ fprintf(output, "Streaming Expression\n");
+ } else
+#endif
+ {
+ fprintf(output, "Compiled Expression : %d elements\n",
+ comp->nbStep);
+ i = comp->last;
+ xmlXPathDebugDumpStepOp(output, comp, &comp->steps[i], depth + 1);
+ }
}
#ifdef XP_DEBUG_OBJ_USAGE
@@ -3103,9 +3100,11 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
if (xmlXPathIsNaN(number)) {
if (buffersize > (int)sizeof("NaN"))
snprintf(buffer, buffersize, "NaN");
- } else if (number == 0 && xmlXPathGetSign(number) != 0) {
+ } else if (number == 0) {
+ /* Omit sign for negative zero. */
snprintf(buffer, buffersize, "0");
- } else if (number == ((int) number)) {
+ } else if ((number > INT_MIN) && (number < INT_MAX) &&
+ (number == (int) number)) {
char work[30];
char *ptr, *cur;
int value = (int) number;
@@ -3225,7 +3224,7 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
*/
long
xmlXPathOrderDocElems(xmlDocPtr doc) {
- long count = 0;
+ ptrdiff_t count = 0;
xmlNodePtr cur;
if (doc == NULL)
@@ -3257,7 +3256,7 @@ xmlXPathOrderDocElems(xmlDocPtr doc) {
}
} while (cur != NULL);
}
- return(count);
+ return((long) count);
}
/**
@@ -3325,13 +3324,13 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
- (0 > (long) node1->content) &&
- (0 > (long) node2->content) &&
+ (0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc)) {
- long l1, l2;
+ ptrdiff_t l1, l2;
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
@@ -3342,13 +3341,13 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
* compute depth to root
*/
for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) {
- if (cur == node1)
+ if (cur->parent == node1)
return(1);
depth2++;
}
root = cur;
for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) {
- if (cur == node2)
+ if (cur->parent == node2)
return(-1);
depth1++;
}
@@ -3388,13 +3387,13 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
- (0 > (long) node1->content) &&
- (0 > (long) node2->content) &&
+ (0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc)) {
- long l1, l2;
+ ptrdiff_t l1, l2;
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
@@ -4021,13 +4020,7 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2,
set1->nodeTab = temp;
set1->nodeMax *= 2;
}
- if (n2->type == XML_NAMESPACE_DECL) {
- xmlNsPtr ns = (xmlNsPtr) n2;
-
- set1->nodeTab[set1->nodeNr++] =
- xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
- } else
- set1->nodeTab[set1->nodeNr++] = n2;
+ set1->nodeTab[set1->nodeNr++] = n2;
skip_node:
{}
}
@@ -4196,33 +4189,6 @@ xmlXPathFreeNodeSet(xmlNodeSetPtr obj) {
}
/**
- * xmlXPathNodeSetClear:
- * @set: the node set to clear
- *
- * Clears the list from all temporary XPath objects (e.g. namespace nodes
- * are feed), but does *not* free the list itself. Sets the length of the
- * list to 0.
- */
-static void
-xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes)
-{
- if ((set == NULL) || (set->nodeNr <= 0))
- return;
- else if (hasNsNodes) {
- int i;
- xmlNodePtr node;
-
- for (i = 0; i < set->nodeNr; i++) {
- node = set->nodeTab[i];
- if ((node != NULL) &&
- (node->type == XML_NAMESPACE_DECL))
- xmlXPathNodeSetFreeNs((xmlNsPtr) node);
- }
- }
- set->nodeNr = 0;
-}
-
-/**
* xmlXPathNodeSetClearFromPos:
* @set: the node set to be cleared
* @pos: the start position to clear from
@@ -4234,7 +4200,7 @@ xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes)
static void
xmlXPathNodeSetClearFromPos(xmlNodeSetPtr set, int pos, int hasNsNodes)
{
- if ((set == NULL) || (set->nodeNr <= 0) || (pos >= set->nodeNr))
+ if ((set == NULL) || (pos >= set->nodeNr))
return;
else if ((hasNsNodes)) {
int i;
@@ -4251,6 +4217,46 @@ xmlXPathNodeSetClearFromPos(xmlNodeSetPtr set, int pos, int hasNsNodes)
}
/**
+ * xmlXPathNodeSetClear:
+ * @set: the node set to clear
+ *
+ * Clears the list from all temporary XPath objects (e.g. namespace nodes
+ * are feed), but does *not* free the list itself. Sets the length of the
+ * list to 0.
+ */
+static void
+xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes)
+{
+ xmlXPathNodeSetClearFromPos(set, 0, hasNsNodes);
+}
+
+/**
+ * xmlXPathNodeSetKeepLast:
+ * @set: the node set to be cleared
+ *
+ * Move the last node to the first position and clear temporary XPath objects
+ * (e.g. namespace nodes) from all other nodes. Sets the length of the list
+ * to 1.
+ */
+static void
+xmlXPathNodeSetKeepLast(xmlNodeSetPtr set)
+{
+ int i;
+ xmlNodePtr node;
+
+ if ((set == NULL) || (set->nodeNr <= 1))
+ return;
+ for (i = 0; i < set->nodeNr - 1; i++) {
+ node = set->nodeTab[i];
+ if ((node != NULL) &&
+ (node->type == XML_NAMESPACE_DECL))
+ xmlXPathNodeSetFreeNs((xmlNsPtr) node);
+ }
+ set->nodeTab[0] = set->nodeTab[set->nodeNr-1];
+ set->nodeNr = 1;
+}
+
+/**
* xmlXPathFreeValueTree:
* @obj: the xmlNodeSetPtr to free
*
@@ -4368,7 +4374,7 @@ xmlXPathNewValueTree(xmlNodePtr val) {
}
memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
ret->type = XPATH_XSLT_TREE;
- ret->boolval = 1;
+ ret->boolval = 0;
ret->user = (void *) val;
ret->nodesetval = xmlXPathNodeSetCreate(val);
#ifdef XP_DEBUG_OBJ_USAGE
@@ -4560,7 +4566,7 @@ xmlXPathDistinctSorted (xmlNodeSetPtr nodes) {
xmlFree(strval);
}
}
- xmlHashFree(hash, (xmlHashDeallocator) xmlFree);
+ xmlHashFree(hash, xmlHashDefaultDeallocator);
return(ret);
}
@@ -4872,7 +4878,9 @@ xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt, const xmlChar *name,
return(-1);
if (f == NULL)
return(xmlHashRemoveEntry2(ctxt->funcHash, name, ns_uri, NULL));
- return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, XML_CAST_FPTR(f)));
+XML_IGNORE_PEDANTIC_WARNINGS
+ return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, (void *) f));
+XML_POP_WARNINGS
}
/**
@@ -4953,7 +4961,9 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
if (ctxt->funcHash == NULL)
return(NULL);
- XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->funcHash, name, ns_uri);
+XML_IGNORE_PEDANTIC_WARNINGS
+ ret = (xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri);
+XML_POP_WARNINGS
return(ret);
}
@@ -5022,10 +5032,9 @@ xmlXPathRegisterVariableNS(xmlXPathContextPtr ctxt, const xmlChar *name,
return(-1);
if (value == NULL)
return(xmlHashRemoveEntry2(ctxt->varHash, name, ns_uri,
- (xmlHashDeallocator)xmlXPathFreeObject));
+ xmlXPathFreeObjectEntry));
return(xmlHashUpdateEntry2(ctxt->varHash, name, ns_uri,
- (void *) value,
- (xmlHashDeallocator)xmlXPathFreeObject));
+ (void *) value, xmlXPathFreeObjectEntry));
}
/**
@@ -5115,7 +5124,7 @@ xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt) {
if (ctxt == NULL)
return;
- xmlHashFree(ctxt->varHash, (xmlHashDeallocator)xmlXPathFreeObject);
+ xmlHashFree(ctxt->varHash, xmlXPathFreeObjectEntry);
ctxt->varHash = NULL;
}
@@ -5146,9 +5155,9 @@ xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix,
return(-1);
if (ns_uri == NULL)
return(xmlHashRemoveEntry(ctxt->nsHash, prefix,
- (xmlHashDeallocator)xmlFree));
+ xmlHashDefaultDeallocator));
return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) xmlStrdup(ns_uri),
- (xmlHashDeallocator)xmlFree));
+ xmlHashDefaultDeallocator));
}
/**
@@ -5197,7 +5206,7 @@ xmlXPathRegisteredNsCleanup(xmlXPathContextPtr ctxt) {
if (ctxt == NULL)
return;
- xmlHashFree(ctxt->nsHash, (xmlHashDeallocator)xmlFree);
+ xmlHashFree(ctxt->nsHash, xmlHashDefaultDeallocator);
ctxt->nsHash = NULL;
}
@@ -5511,6 +5520,11 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) {
xmlFree(obj);
}
+static void
+xmlXPathFreeObjectEntry(void *obj, const xmlChar *name ATTRIBUTE_UNUSED) {
+ xmlXPathFreeObject((xmlXPathObjectPtr) obj);
+}
+
/**
* xmlXPathReleaseObject:
* @obj: the xmlXPathObjectPtr to free or to cache
@@ -5700,7 +5714,8 @@ xmlXPathCastNumberToString (double val) {
default:
if (xmlXPathIsNaN(val)) {
ret = xmlStrdup((const xmlChar *) "NaN");
- } else if (val == 0 && xmlXPathGetSign(val) != 0) {
+ } else if (val == 0) {
+ /* Omit sign for negative zero. */
ret = xmlStrdup((const xmlChar *) "0");
} else {
/* could be improved */
@@ -5882,10 +5897,10 @@ xmlXPathCastNodeToNumber (xmlNodePtr node) {
double ret;
if (node == NULL)
- return(xmlXPathNAN);
+ return(NAN);
strval = xmlXPathCastNodeToString(node);
if (strval == NULL)
- return(xmlXPathNAN);
+ return(NAN);
ret = xmlXPathCastStringToNumber(strval);
xmlFree(strval);
@@ -5906,7 +5921,7 @@ xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns) {
double ret;
if (ns == NULL)
- return(xmlXPathNAN);
+ return(NAN);
str = xmlXPathCastNodeSetToString(ns);
ret = xmlXPathCastStringToNumber(str);
xmlFree(str);
@@ -5926,13 +5941,13 @@ xmlXPathCastToNumber(xmlXPathObjectPtr val) {
double ret = 0.0;
if (val == NULL)
- return(xmlXPathNAN);
+ return(NAN);
switch (val->type) {
case XPATH_UNDEFINED:
#ifdef DEGUB_EXPR
xmlGenericError(xmlGenericErrorContext, "NUMBER: undefined\n");
#endif
- ret = xmlXPathNAN;
+ ret = NAN;
break;
case XPATH_NODESET:
case XPATH_XSLT_TREE:
@@ -5952,7 +5967,7 @@ xmlXPathCastToNumber(xmlXPathObjectPtr val) {
case XPATH_RANGE:
case XPATH_LOCATIONSET:
TODO;
- ret = xmlXPathNAN;
+ ret = NAN;
break;
}
return(ret);
@@ -6289,7 +6304,15 @@ xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) {
*/
void
xmlXPathFreeParserContext(xmlXPathParserContextPtr ctxt) {
+ int i;
+
if (ctxt->valueTab != NULL) {
+ for (i = 0; i < ctxt->valueNr; i++) {
+ if (ctxt->context)
+ xmlXPathReleaseObject(ctxt->context, ctxt->valueTab[i]);
+ else
+ xmlXPathFreeObject(ctxt->valueTab[i]);
+ }
xmlFree(ctxt->valueTab);
}
if (ctxt->comp != NULL) {
@@ -6371,16 +6394,12 @@ xmlXPathNodeValHash(xmlNodePtr node) {
}
while (tmp != NULL) {
switch (tmp->type) {
- case XML_COMMENT_NODE:
- case XML_PI_NODE:
case XML_CDATA_SECTION_NODE:
case XML_TEXT_NODE:
string = tmp->content;
break;
- case XML_NAMESPACE_DECL:
- string = ((xmlNsPtr)tmp)->href;
- break;
default:
+ string = NULL;
break;
}
if ((string != NULL) && (string[0] != 0)) {
@@ -6702,7 +6721,13 @@ xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict,
valuePush(ctxt, val);
return(xmlXPathCompareValues(ctxt, inf, strict));
default:
- TODO
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompareNodeSetValue: Can't compare node set "
+ "and object of type %d\n",
+ val->type);
+ xmlXPathReleaseObject(ctxt->context, arg);
+ xmlXPathReleaseObject(ctxt->context, val);
+ XP_ERROR0(XPATH_INVALID_TYPE);
}
return(0);
}
@@ -7010,7 +7035,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
valuePush(ctxt, arg2);
xmlXPathNumberFunction(ctxt, 1);
arg2 = valuePop(ctxt);
- /* no break on purpose */
+ /* Falls through. */
case XPATH_NUMBER:
/* Hand check NaN and Infinity equalities */
if (xmlXPathIsNaN(arg1->floatval) ||
@@ -7446,20 +7471,7 @@ xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return;
CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER);
- if (xmlXPathIsNaN(ctxt->value->floatval))
- ctxt->value->floatval=xmlXPathNAN;
- else if (xmlXPathIsInf(ctxt->value->floatval) == 1)
- ctxt->value->floatval=xmlXPathNINF;
- else if (xmlXPathIsInf(ctxt->value->floatval) == -1)
- ctxt->value->floatval=xmlXPathPINF;
- else if (ctxt->value->floatval == 0) {
- if (xmlXPathGetSign(ctxt->value->floatval) == 0)
- ctxt->value->floatval = xmlXPathNZERO;
- else
- ctxt->value->floatval = 0;
- }
- else
- ctxt->value->floatval = - ctxt->value->floatval;
+ ctxt->value->floatval = -ctxt->value->floatval;
}
/**
@@ -7551,25 +7563,7 @@ xmlXPathDivValues(xmlXPathParserContextPtr ctxt) {
xmlXPathReleaseObject(ctxt->context, arg);
CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER);
- if (xmlXPathIsNaN(val) || xmlXPathIsNaN(ctxt->value->floatval))
- ctxt->value->floatval = xmlXPathNAN;
- else if (val == 0 && xmlXPathGetSign(val) != 0) {
- if (ctxt->value->floatval == 0)
- ctxt->value->floatval = xmlXPathNAN;
- else if (ctxt->value->floatval > 0)
- ctxt->value->floatval = xmlXPathNINF;
- else if (ctxt->value->floatval < 0)
- ctxt->value->floatval = xmlXPathPINF;
- }
- else if (val == 0) {
- if (ctxt->value->floatval == 0)
- ctxt->value->floatval = xmlXPathNAN;
- else if (ctxt->value->floatval > 0)
- ctxt->value->floatval = xmlXPathPINF;
- else if (ctxt->value->floatval < 0)
- ctxt->value->floatval = xmlXPathNINF;
- } else
- ctxt->value->floatval /= val;
+ ctxt->value->floatval /= val;
}
/**
@@ -7594,7 +7588,7 @@ xmlXPathModValues(xmlXPathParserContextPtr ctxt) {
CHECK_TYPE(XPATH_NUMBER);
arg1 = ctxt->value->floatval;
if (arg2 == 0)
- ctxt->value->floatval = xmlXPathNAN;
+ ctxt->value->floatval = NAN;
else {
ctxt->value->floatval = fmod(arg1, arg2);
}
@@ -8114,12 +8108,12 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
return(NULL);
return(cur->parent);
case XML_ATTRIBUTE_NODE: {
- xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node;
+ xmlAttrPtr att = (xmlAttrPtr) cur;
return(att->parent);
}
case XML_NAMESPACE_DECL: {
- xmlNsPtr ns = (xmlNsPtr) ctxt->context->node;
+ xmlNsPtr ns = (xmlNsPtr) cur;
if ((ns->next != NULL) &&
(ns->next->type != XML_NAMESPACE_DECL))
@@ -8236,10 +8230,16 @@ xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if (cur == NULL) {
cur = ctxt->context->node;
- if (cur->type == XML_NAMESPACE_DECL)
- return(NULL);
- if (cur->type == XML_ATTRIBUTE_NODE)
+ if (cur->type == XML_ATTRIBUTE_NODE) {
cur = cur->parent;
+ } else if (cur->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr ns = (xmlNsPtr) cur;
+
+ if ((ns->next == NULL) ||
+ (ns->next->type == XML_NAMESPACE_DECL))
+ return (NULL);
+ cur = (xmlNodePtr) ns->next;
+ }
}
if (cur == NULL) return(NULL) ; /* ERROR */
if (cur->next != NULL) return(cur->next) ;
@@ -8300,10 +8300,16 @@ xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL) {
cur = ctxt->context->node;
- if (cur->type == XML_NAMESPACE_DECL)
- return(NULL);
- if (cur->type == XML_ATTRIBUTE_NODE)
- return(cur->parent);
+ if (cur->type == XML_ATTRIBUTE_NODE) {
+ cur = cur->parent;
+ } else if (cur->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr ns = (xmlNsPtr) cur;
+
+ if ((ns->next == NULL) ||
+ (ns->next->type == XML_NAMESPACE_DECL))
+ return (NULL);
+ cur = (xmlNodePtr) ns->next;
+ }
}
if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL))
return (NULL);
@@ -8348,8 +8354,16 @@ xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt,
cur = ctxt->context->node;
if (cur == NULL)
return (NULL);
- if (cur->type == XML_NAMESPACE_DECL)
- return (NULL);
+ if (cur->type == XML_ATTRIBUTE_NODE) {
+ cur = cur->parent;
+ } else if (cur->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr ns = (xmlNsPtr) cur;
+
+ if ((ns->next == NULL) ||
+ (ns->next->type == XML_NAMESPACE_DECL))
+ return (NULL);
+ cur = (xmlNodePtr) ns->next;
+ }
ctxt->ancestor = cur->parent;
}
if (cur->type == XML_NAMESPACE_DECL)
@@ -8463,9 +8477,8 @@ void
xmlXPathRoot(xmlXPathParserContextPtr ctxt) {
if ((ctxt == NULL) || (ctxt->context == NULL))
return;
- ctxt->context->node = (xmlNodePtr) ctxt->context->doc;
valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context,
- ctxt->context->node));
+ (xmlNodePtr) ctxt->context->doc));
}
/************************************************************************
@@ -9634,18 +9647,6 @@ xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathReleaseObject(ctxt->context, cur);
}
-/*
- * To assure working code on multiple platforms, we want to only depend
- * upon the characteristic truncation of converting a floating point value
- * to an integer. Unfortunately, because of the different storage sizes
- * of our internal floating point value (double) and integer (int), we
- * can't directly convert (see bug 301162). This macro is a messy
- * 'workaround'
- */
-#define XTRUNC(f, v) \
- f = fmod((v), INT_MAX); \
- f = (v) - (f) + (double)((int)(f));
-
/**
* xmlXPathFloorFunction:
* @ctxt: the XPath Parser context
@@ -9658,19 +9659,11 @@ xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs) {
*/
void
xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- double f;
-
CHECK_ARITY(1);
CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER);
- XTRUNC(f, ctxt->value->floatval);
- if (f != ctxt->value->floatval) {
- if (ctxt->value->floatval > 0)
- ctxt->value->floatval = f;
- else
- ctxt->value->floatval = f - 1;
- }
+ ctxt->value->floatval = floor(ctxt->value->floatval);
}
/**
@@ -9685,28 +9678,11 @@ xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs) {
*/
void
xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs) {
- double f;
-
CHECK_ARITY(1);
CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER);
-#if 0
ctxt->value->floatval = ceil(ctxt->value->floatval);
-#else
- XTRUNC(f, ctxt->value->floatval);
- if (f != ctxt->value->floatval) {
- if (ctxt->value->floatval > 0)
- ctxt->value->floatval = f + 1;
- else {
- if (ctxt->value->floatval < 0 && f == 0)
- ctxt->value->floatval = xmlXPathNZERO;
- else
- ctxt->value->floatval = f;
- }
-
- }
-#endif
}
/**
@@ -9718,7 +9694,7 @@ xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs) {
* number round(number)
* The round function returns the number that is closest to the
* argument and that is an integer. If there are two such numbers,
- * then the one that is even is returned.
+ * then the one that is closest to positive infinity is returned.
*/
void
xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) {
@@ -9728,25 +9704,17 @@ xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) {
CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER);
- if ((xmlXPathIsNaN(ctxt->value->floatval)) ||
- (xmlXPathIsInf(ctxt->value->floatval) == 1) ||
- (xmlXPathIsInf(ctxt->value->floatval) == -1) ||
- (ctxt->value->floatval == 0.0))
- return;
+ f = ctxt->value->floatval;
- XTRUNC(f, ctxt->value->floatval);
- if (ctxt->value->floatval < 0) {
- if (ctxt->value->floatval < f - 0.5)
- ctxt->value->floatval = f - 1;
- else
- ctxt->value->floatval = f;
- if (ctxt->value->floatval == 0)
- ctxt->value->floatval = xmlXPathNZERO;
- } else {
- if (ctxt->value->floatval < f + 0.5)
- ctxt->value->floatval = f;
- else
- ctxt->value->floatval = f + 1;
+ if ((f >= -0.5) && (f < 0.5)) {
+ /* Handles negative zero. */
+ ctxt->value->floatval *= 0.0;
+ }
+ else {
+ double rounded = floor(f);
+ if (f - rounded >= 0.5)
+ rounded += 1.0;
+ ctxt->value->floatval = rounded;
}
}
@@ -10056,20 +10024,6 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
#define MAX_FRAC 20
-/*
- * These are used as divisors for the fractional part of a number.
- * Since the table includes 1.0 (representing '0' fractional digits),
- * it must be dimensioned at MAX_FRAC+1 (bug 133921)
- */
-static double my_pow10[MAX_FRAC+1] = {
- 1.0, 10.0, 100.0, 1000.0, 10000.0,
- 100000.0, 1000000.0, 10000000.0, 100000000.0, 1000000000.0,
- 10000000000.0, 100000000000.0, 1000000000000.0, 10000000000000.0,
- 100000000000000.0,
- 1000000000000000.0, 10000000000000000.0, 100000000000000000.0,
- 1000000000000000000.0, 10000000000000000000.0, 100000000000000000000.0
-};
-
/**
* xmlXPathStringEvalNumber:
* @str: A string to scan
@@ -10101,7 +10055,7 @@ xmlXPathStringEvalNumber(const xmlChar *str) {
if (cur == NULL) return(0);
while (IS_BLANK_CH(*cur)) cur++;
if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) {
- return(xmlXPathNAN);
+ return(NAN);
}
if (*cur == '-') {
isneg = 1;
@@ -10132,20 +10086,25 @@ xmlXPathStringEvalNumber(const xmlChar *str) {
#endif
if (*cur == '.') {
- int v, frac = 0;
+ int v, frac = 0, max;
double fraction = 0;
cur++;
if (((*cur < '0') || (*cur > '9')) && (!ok)) {
- return(xmlXPathNAN);
+ return(NAN);
}
- while (((*cur >= '0') && (*cur <= '9')) && (frac < MAX_FRAC)) {
+ while (*cur == '0') {
+ frac = frac + 1;
+ cur++;
+ }
+ max = frac + MAX_FRAC;
+ while (((*cur >= '0') && (*cur <= '9')) && (frac < max)) {
v = (*cur - '0');
fraction = fraction * 10 + v;
frac = frac + 1;
cur++;
}
- fraction /= my_pow10[frac];
+ fraction /= pow(10.0, frac);
ret = ret + fraction;
while ((*cur >= '0') && (*cur <= '9'))
cur++;
@@ -10159,12 +10118,13 @@ xmlXPathStringEvalNumber(const xmlChar *str) {
cur++;
}
while ((*cur >= '0') && (*cur <= '9')) {
- exponent = exponent * 10 + (*cur - '0');
+ if (exponent < 1000000)
+ exponent = exponent * 10 + (*cur - '0');
cur++;
}
}
while (IS_BLANK_CH(*cur)) cur++;
- if (*cur != 0) return(xmlXPathNAN);
+ if (*cur != 0) return(NAN);
if (isneg) ret = -ret;
if (is_exponent_negative) exponent = -exponent;
ret *= pow(10.0, (double)exponent);
@@ -10221,20 +10181,25 @@ xmlXPathCompNumber(xmlXPathParserContextPtr ctxt)
}
#endif
if (CUR == '.') {
- int v, frac = 0;
+ int v, frac = 0, max;
double fraction = 0;
NEXT;
if (((CUR < '0') || (CUR > '9')) && (!ok)) {
XP_ERROR(XPATH_NUMBER_ERROR);
}
- while ((CUR >= '0') && (CUR <= '9') && (frac < MAX_FRAC)) {
+ while (CUR == '0') {
+ frac = frac + 1;
+ NEXT;
+ }
+ max = frac + MAX_FRAC;
+ while ((CUR >= '0') && (CUR <= '9') && (frac < max)) {
v = (CUR - '0');
fraction = fraction * 10 + v;
frac = frac + 1;
NEXT;
}
- fraction /= my_pow10[frac];
+ fraction /= pow(10.0, frac);
ret = ret + fraction;
while ((CUR >= '0') && (CUR <= '9'))
NEXT;
@@ -10248,7 +10213,8 @@ xmlXPathCompNumber(xmlXPathParserContextPtr ctxt)
NEXT;
}
while ((CUR >= '0') && (CUR <= '9')) {
- exponent = exponent * 10 + (CUR - '0');
+ if (exponent < 1000000)
+ exponent = exponent * 10 + (CUR - '0');
NEXT;
}
if (is_exponent_negative)
@@ -10379,6 +10345,7 @@ xmlXPathCompVariableReference(xmlXPathParserContextPtr ctxt) {
NEXT;
name = xmlXPathParseQName(ctxt, &prefix);
if (name == NULL) {
+ xmlFree(prefix);
XP_ERROR(XPATH_VARIABLE_REF_ERROR);
}
ctxt->comp->last = -1;
@@ -10452,6 +10419,8 @@ xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) {
#endif
if (CUR != '(') {
+ xmlFree(name);
+ xmlFree(prefix);
XP_ERROR(XPATH_EXPR_ERROR);
}
NEXT;
@@ -10480,6 +10449,8 @@ xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) {
nbargs++;
if (CUR == ')') break;
if (CUR != ',') {
+ xmlFree(name);
+ xmlFree(prefix);
XP_ERROR(XPATH_EXPR_ERROR);
}
NEXT;
@@ -10698,9 +10669,11 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) {
"PathExpr: Type search\n");
#endif
lc = 1;
+#ifdef LIBXML_XPTR_ENABLED
} else if (ctxt->xptr &&
xmlStrEqual(name, BAD_CAST "range-to")) {
lc = 1;
+#endif
} else {
#ifdef DEBUG_STEP
xmlGenericError(xmlGenericErrorContext,
@@ -10758,7 +10731,6 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) {
PUSH_LONG_EXPR(XPATH_OP_COLLECT, AXIS_DESCENDANT_OR_SELF,
NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
- PUSH_UNARY_EXPR(XPATH_OP_RESET, ctxt->comp->last, 1, 0);
xmlXPathCompRelativeLocationPath(ctxt);
} else if (CUR == '/') {
@@ -11689,6 +11661,7 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt,
xmlXPathContextPtr xpctxt = ctxt->context;
xmlNodePtr contextNode, oldContextNode;
xmlDocPtr oldContextDoc;
+ int oldcs, oldpp;
int i, res, contextPos = 0, newContextSize;
xmlXPathStepOpPtr exprOp;
xmlXPathObjectPtr contextObj = NULL, exprRes = NULL;
@@ -11725,6 +11698,8 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt,
*/
oldContextNode = xpctxt->node;
oldContextDoc = xpctxt->doc;
+ oldcs = xpctxt->contextSize;
+ oldpp = xpctxt->proximityPosition;
/*
* Get the expression of this predicate.
*/
@@ -11811,8 +11786,8 @@ evaluation_exit:
*/
xpctxt->node = oldContextNode;
xpctxt->doc = oldContextDoc;
- xpctxt->contextSize = -1;
- xpctxt->proximityPosition = -1;
+ xpctxt->contextSize = oldcs;
+ xpctxt->proximityPosition = oldpp;
return(newContextSize);
}
return(contextSize);
@@ -11855,6 +11830,7 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
return (contextSize);
} else {
xmlDocPtr oldContextDoc;
+ int oldcs, oldpp;
int i, pos = 0, newContextSize = 0, contextPos = 0, res;
xmlXPathStepOpPtr exprOp;
xmlXPathObjectPtr contextObj = NULL, exprRes = NULL;
@@ -11875,6 +11851,8 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
*/
oldContextNode = xpctxt->node;
oldContextDoc = xpctxt->doc;
+ oldcs = xpctxt->contextSize;
+ oldpp = xpctxt->proximityPosition;
/*
* Get the expression of this predicate.
*/
@@ -11913,11 +11891,11 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
}
}
- frame = xmlXPathSetFrame(ctxt);
valuePush(ctxt, contextObj);
+ frame = xmlXPathSetFrame(ctxt);
res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
- tmp = valuePop(ctxt);
xmlXPathPopFrame(ctxt, frame);
+ tmp = valuePop(ctxt);
if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
while (tmp != contextObj) {
@@ -12011,8 +11989,8 @@ evaluation_exit:
*/
xpctxt->node = oldContextNode;
xpctxt->doc = oldContextDoc;
- xpctxt->contextSize = -1;
- xpctxt->proximityPosition = -1;
+ xpctxt->contextSize = oldcs;
+ xpctxt->proximityPosition = oldpp;
return(newContextSize);
}
return(contextSize);
@@ -12052,6 +12030,8 @@ xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt,
(exprOp->value4 != NULL) &&
(((xmlXPathObjectPtr) exprOp->value4)->type == XPATH_NUMBER))
{
+ double floatval = ((xmlXPathObjectPtr) exprOp->value4)->floatval;
+
/*
* We have a "[n]" predicate here.
* TODO: Unfortunately this simplistic test here is not
@@ -12062,13 +12042,12 @@ xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt,
* like it "[position() < 5]", is also not detected.
* Maybe we could rewrite the AST to ease the optimization.
*/
- *maxPos = (int) ((xmlXPathObjectPtr) exprOp->value4)->floatval;
- if (((xmlXPathObjectPtr) exprOp->value4)->floatval ==
- (float) *maxPos)
- {
- return(1);
- }
+ if ((floatval > INT_MIN) && (floatval < INT_MAX)) {
+ *maxPos = (int) floatval;
+ if (floatval == (double) *maxPos)
+ return(1);
+ }
}
return(0);
}
@@ -12409,7 +12388,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
default:
break;
}
- } else if (cur->type == type) {
+ } else if (cur->type == (xmlElementType) type) {
if (cur->type == XML_NAMESPACE_DECL)
XP_TEST_HIT_NS
else
@@ -12770,11 +12749,15 @@ xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt,
xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch2],
first);
CHECK_ERROR0;
- CHECK_TYPE0(XPATH_NODESET);
- arg2 = valuePop(ctxt);
- CHECK_TYPE0(XPATH_NODESET);
+ arg2 = valuePop(ctxt);
arg1 = valuePop(ctxt);
+ if ((arg1 == NULL) || (arg1->type != XPATH_NODESET) ||
+ (arg2 == NULL) || (arg2->type != XPATH_NODESET)) {
+ xmlXPathReleaseObject(ctxt->context, arg1);
+ xmlXPathReleaseObject(ctxt->context, arg2);
+ XP_ERROR0(XPATH_INVALID_TYPE);
+ }
arg1->nodesetval = xmlXPathNodeSetMerge(arg1->nodesetval,
arg2->nodesetval);
@@ -12797,15 +12780,6 @@ xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt,
valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context,
ctxt->context->node));
return (total);
- case XPATH_OP_RESET:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- ctxt->context->node = NULL;
- return (total);
case XPATH_OP_COLLECT:{
if (op->ch1 == -1)
return (total);
@@ -12861,10 +12835,6 @@ xmlXPathCompOpEvalLast(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op,
int total = 0, cur;
xmlXPathCompExprPtr comp;
xmlXPathObjectPtr arg1, arg2;
- xmlNodePtr bak;
- xmlDocPtr bakd;
- int pp;
- int cs;
CHECK_ERROR0;
comp = ctxt->comp;
@@ -12872,10 +12842,6 @@ xmlXPathCompOpEvalLast(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op,
case XPATH_OP_END:
return (0);
case XPATH_OP_UNION:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
total =
xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], last);
CHECK_ERROR0;
@@ -12893,10 +12859,6 @@ xmlXPathCompOpEvalLast(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op,
nodesetval->nodeNr -
1];
}
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
cur =
xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch2], last);
CHECK_ERROR0;
@@ -12905,11 +12867,15 @@ xmlXPathCompOpEvalLast(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op,
&& (ctxt->value->nodesetval != NULL)
&& (ctxt->value->nodesetval->nodeNr >= 1)) { /* TODO: NOP ? */
}
- CHECK_TYPE0(XPATH_NODESET);
- arg2 = valuePop(ctxt);
- CHECK_TYPE0(XPATH_NODESET);
+ arg2 = valuePop(ctxt);
arg1 = valuePop(ctxt);
+ if ((arg1 == NULL) || (arg1->type != XPATH_NODESET) ||
+ (arg2 == NULL) || (arg2->type != XPATH_NODESET)) {
+ xmlXPathReleaseObject(ctxt->context, arg1);
+ xmlXPathReleaseObject(ctxt->context, arg2);
+ XP_ERROR0(XPATH_INVALID_TYPE);
+ }
arg1->nodesetval = xmlXPathNodeSetMerge(arg1->nodesetval,
arg2->nodesetval);
@@ -12932,15 +12898,6 @@ xmlXPathCompOpEvalLast(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op,
valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context,
ctxt->context->node));
return (total);
- case XPATH_OP_RESET:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- ctxt->context->node = NULL;
- return (total);
case XPATH_OP_COLLECT:{
if (op->ch1 == -1)
return (0);
@@ -12985,6 +12942,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
xmlNodeSetPtr oldset;
xmlNodePtr oldnode;
xmlDocPtr oldDoc;
+ int oldcs, oldpp;
int i;
CHECK_ERROR0;
@@ -13020,13 +12978,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
(ctxt->value->nodesetval != NULL) &&
(ctxt->value->nodesetval->nodeTab != NULL) &&
(ctxt->value->nodesetval->nodeNr > 1)) {
- ctxt->value->nodesetval->nodeTab[0] =
- ctxt->value->nodesetval->nodeTab[ctxt->
- value->
- nodesetval->
- nodeNr -
- 1];
- ctxt->value->nodesetval->nodeNr = 1;
+ xmlXPathNodeSetKeepLast(ctxt->value->nodesetval);
*first = *(ctxt->value->nodesetval->nodeTab);
}
return (total);
@@ -13042,7 +12994,6 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
return (total);
#ifdef LIBXML_XPTR_ENABLED
- oldnode = ctxt->context->node;
/*
* Hum are we filtering the result of an XPointer expression
*/
@@ -13057,23 +13008,17 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
* up a new locset.
*/
CHECK_TYPE0(XPATH_LOCATIONSET);
+
+ if ((ctxt->value->user == NULL) ||
+ (((xmlLocationSetPtr) ctxt->value->user)->locNr == 0))
+ return (total);
+
obj = valuePop(ctxt);
oldlocset = obj->user;
- ctxt->context->node = NULL;
+ oldnode = ctxt->context->node;
+ oldcs = ctxt->context->contextSize;
+ oldpp = ctxt->context->proximityPosition;
- if ((oldlocset == NULL) || (oldlocset->locNr == 0)) {
- ctxt->context->contextSize = 0;
- ctxt->context->proximityPosition = 0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- res = valuePop(ctxt);
- if (res != NULL) {
- xmlXPathReleaseObject(ctxt->context, res);
- }
- valuePush(ctxt, obj);
- CHECK_ERROR0;
- return (total);
- }
newlocset = xmlXPtrLocationSetCreate(NULL);
for (i = 0; i < oldlocset->locNr; i++) {
@@ -13097,8 +13042,8 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
if (op->ch2 != -1)
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
if (ctxt->error != XPATH_EXPRESSION_OK) {
- xmlXPathFreeObject(obj);
- return(0);
+ xmlXPtrFreeLocationSet(newlocset);
+ goto xptr_error;
}
/*
* The result of the evaluation need to be tested to
@@ -13126,7 +13071,6 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
/* OLD: xmlXPathFreeObject(res); */
} else
tmp = NULL;
- ctxt->context->node = NULL;
/*
* Only put the first node in the result, then leave.
*/
@@ -13141,12 +13085,12 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
/*
* The result is used as the new evaluation locset.
*/
- xmlXPathReleaseObject(ctxt->context, obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset));
+xptr_error:
+ xmlXPathReleaseObject(ctxt->context, obj);
ctxt->context->node = oldnode;
+ ctxt->context->contextSize = oldcs;
+ ctxt->context->proximityPosition = oldpp;
return (total);
}
#endif /* LIBXML_XPTR_ENABLED */
@@ -13157,32 +13101,19 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
* up a new set.
*/
CHECK_TYPE0(XPATH_NODESET);
- obj = valuePop(ctxt);
- oldset = obj->nodesetval;
- oldnode = ctxt->context->node;
- oldDoc = ctxt->context->doc;
- ctxt->context->node = NULL;
-
- if ((oldset == NULL) || (oldset->nodeNr == 0)) {
- ctxt->context->contextSize = 0;
- ctxt->context->proximityPosition = 0;
- /* QUESTION TODO: Why was this code commented out?
- if (op->ch2 != -1)
- total +=
- xmlXPathCompOpEval(ctxt,
- &comp->steps[op->ch2]);
- CHECK_ERROR0;
- res = valuePop(ctxt);
- if (res != NULL)
- xmlXPathFreeObject(res);
- */
- valuePush(ctxt, obj);
- ctxt->context->node = oldnode;
- CHECK_ERROR0;
- } else {
+ if ((ctxt->value->nodesetval != NULL) &&
+ (ctxt->value->nodesetval->nodeNr != 0)) {
xmlNodeSetPtr newset;
xmlXPathObjectPtr tmp = NULL;
+
+ obj = valuePop(ctxt);
+ oldset = obj->nodesetval;
+ oldnode = ctxt->context->node;
+ oldDoc = ctxt->context->doc;
+ oldcs = ctxt->context->contextSize;
+ oldpp = ctxt->context->proximityPosition;
+
/*
* Initialize the new set.
* Also set the xpath document in case things like
@@ -13216,8 +13147,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
if (ctxt->error != XPATH_EXPRESSION_OK) {
xmlXPathFreeNodeSet(newset);
- xmlXPathFreeObject(obj);
- return(0);
+ goto error;
}
/*
* The result of the evaluation needs to be tested to
@@ -13244,7 +13174,6 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
xmlXPathNodeSetClear(tmp->nodesetval, 1);
} else
tmp = NULL;
- ctxt->context->node = NULL;
/*
* Only put the first node in the result, then leave.
*/
@@ -13259,15 +13188,14 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
/*
* The result is used as the new evaluation set.
*/
+ valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, newset));
+error:
xmlXPathReleaseObject(ctxt->context, obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
- /* may want to move this past the '}' later */
+ ctxt->context->node = oldnode;
ctxt->context->doc = oldDoc;
- valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, newset));
+ ctxt->context->contextSize = oldcs;
+ ctxt->context->proximityPosition = oldpp;
}
- ctxt->context->node = oldnode;
return(total);
}
#endif /* XP_OPTIMIZED_FILTER_FIRST */
@@ -13287,10 +13215,6 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
int equal, ret;
xmlXPathCompExprPtr comp;
xmlXPathObjectPtr arg1, arg2;
- xmlNodePtr bak;
- xmlDocPtr bakd;
- int pp;
- int cs;
CHECK_ERROR0;
comp = ctxt->comp;
@@ -13298,68 +13222,42 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
case XPATH_OP_END:
return (0);
case XPATH_OP_AND:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
CHECK_ERROR0;
xmlXPathBooleanFunction(ctxt, 1);
if ((ctxt->value == NULL) || (ctxt->value->boolval == 0))
return (total);
arg2 = valuePop(ctxt);
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
if (ctxt->error) {
xmlXPathFreeObject(arg2);
return(0);
}
xmlXPathBooleanFunction(ctxt, 1);
- arg1 = valuePop(ctxt);
- arg1->boolval &= arg2->boolval;
- valuePush(ctxt, arg1);
+ if (ctxt->value != NULL)
+ ctxt->value->boolval &= arg2->boolval;
xmlXPathReleaseObject(ctxt->context, arg2);
return (total);
case XPATH_OP_OR:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
CHECK_ERROR0;
xmlXPathBooleanFunction(ctxt, 1);
if ((ctxt->value == NULL) || (ctxt->value->boolval == 1))
return (total);
arg2 = valuePop(ctxt);
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
if (ctxt->error) {
xmlXPathFreeObject(arg2);
return(0);
}
xmlXPathBooleanFunction(ctxt, 1);
- arg1 = valuePop(ctxt);
- arg1->boolval |= arg2->boolval;
- valuePush(ctxt, arg1);
+ if (ctxt->value != NULL)
+ ctxt->value->boolval |= arg2->boolval;
xmlXPathReleaseObject(ctxt->context, arg2);
return (total);
case XPATH_OP_EQUAL:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
CHECK_ERROR0;
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
CHECK_ERROR0;
if (op->value)
@@ -13369,33 +13267,17 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, equal));
return (total);
case XPATH_OP_CMP:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
CHECK_ERROR0;
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
CHECK_ERROR0;
ret = xmlXPathCompareValues(ctxt, op->value, op->value2);
valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, ret));
return (total);
case XPATH_OP_PLUS:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
CHECK_ERROR0;
if (op->ch2 != -1) {
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
}
CHECK_ERROR0;
@@ -13411,16 +13293,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
}
return (total);
case XPATH_OP_MULT:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
CHECK_ERROR0;
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
CHECK_ERROR0;
if (op->value == 0)
@@ -13431,23 +13305,19 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlXPathModValues(ctxt);
return (total);
case XPATH_OP_UNION:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
CHECK_ERROR0;
- ctxt->context->doc = bakd;
- ctxt->context->node = bak;
- ctxt->context->proximityPosition = pp;
- ctxt->context->contextSize = cs;
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
CHECK_ERROR0;
- CHECK_TYPE0(XPATH_NODESET);
- arg2 = valuePop(ctxt);
- CHECK_TYPE0(XPATH_NODESET);
+ arg2 = valuePop(ctxt);
arg1 = valuePop(ctxt);
+ if ((arg1 == NULL) || (arg1->type != XPATH_NODESET) ||
+ (arg2 == NULL) || (arg2->type != XPATH_NODESET)) {
+ xmlXPathReleaseObject(ctxt->context, arg1);
+ xmlXPathReleaseObject(ctxt->context, arg2);
+ XP_ERROR0(XPATH_INVALID_TYPE);
+ }
if ((arg1->nodesetval == NULL) ||
((arg2->nodesetval != NULL) &&
@@ -13473,15 +13343,6 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context,
ctxt->context->node));
return (total);
- case XPATH_OP_RESET:
- if (op->ch1 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- CHECK_ERROR0;
- if (op->ch2 != -1)
- total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- CHECK_ERROR0;
- ctxt->context->node = NULL;
- return (total);
case XPATH_OP_COLLECT:{
if (op->ch1 == -1)
return (total);
@@ -13505,10 +13366,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
if (op->value5 == NULL) {
val = xmlXPathVariableLookup(ctxt->context, op->value4);
- if (val == NULL) {
- ctxt->error = XPATH_UNDEF_VARIABLE_ERROR;
- return(0);
- }
+ if (val == NULL)
+ XP_ERROR0(XPATH_UNDEF_VARIABLE_ERROR);
valuePush(ctxt, val);
} else {
const xmlChar *URI;
@@ -13523,10 +13382,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
}
val = xmlXPathVariableLookupNS(ctxt->context,
op->value4, URI);
- if (val == NULL) {
- ctxt->error = XPATH_UNDEF_VARIABLE_ERROR;
- return(0);
- }
+ if (val == NULL)
+ XP_ERROR0(XPATH_UNDEF_VARIABLE_ERROR);
valuePush(ctxt, val);
}
return (total);
@@ -13563,7 +13420,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
}
}
if (op->cache != NULL)
- XML_CAST_FPTR(func) = op->cache;
+ func = op->cache;
else {
const xmlChar *URI = NULL;
@@ -13590,7 +13447,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
(char *)op->value4);
XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR);
}
- op->cache = XML_CAST_FPTR(func);
+ op->cache = func;
op->cacheURI = (void *) URI;
}
oldFunc = ctxt->context->function;
@@ -13604,24 +13461,12 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
return (total);
}
case XPATH_OP_ARG:
- bakd = ctxt->context->doc;
- bak = ctxt->context->node;
- pp = ctxt->context->proximityPosition;
- cs = ctxt->context->contextSize;
if (op->ch1 != -1) {
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
- ctxt->context->contextSize = cs;
- ctxt->context->proximityPosition = pp;
- ctxt->context->node = bak;
- ctxt->context->doc = bakd;
CHECK_ERROR0;
}
if (op->ch2 != -1) {
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
- ctxt->context->contextSize = cs;
- ctxt->context->proximityPosition = pp;
- ctxt->context->node = bak;
- ctxt->context->doc = bakd;
CHECK_ERROR0;
}
return (total);
@@ -13633,6 +13478,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlNodeSetPtr oldset;
xmlNodePtr oldnode;
xmlDocPtr oldDoc;
+ int oldcs, oldpp;
int i;
/*
@@ -13675,7 +13521,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
(ctxt->value->type == XPATH_NODESET) &&
(ctxt->value->nodesetval != NULL) &&
(ctxt->value->nodesetval->nodeNr > 1))
- ctxt->value->nodesetval->nodeNr = 1;
+ xmlXPathNodeSetClearFromPos(ctxt->value->nodesetval,
+ 1, 1);
return (total);
}
}
@@ -13709,15 +13556,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
(ctxt->value->type == XPATH_NODESET) &&
(ctxt->value->nodesetval != NULL) &&
(ctxt->value->nodesetval->nodeTab != NULL) &&
- (ctxt->value->nodesetval->nodeNr > 1)) {
- ctxt->value->nodesetval->nodeTab[0] =
- ctxt->value->nodesetval->nodeTab[ctxt->
- value->
- nodesetval->
- nodeNr -
- 1];
- ctxt->value->nodesetval->nodeNr = 1;
- }
+ (ctxt->value->nodesetval->nodeNr > 1))
+ xmlXPathNodeSetKeepLast(ctxt->value->nodesetval);
return (total);
}
}
@@ -13741,8 +13581,6 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
if (ctxt->value == NULL)
return (total);
- oldnode = ctxt->context->node;
-
#ifdef LIBXML_XPTR_ENABLED
/*
* Hum are we filtering the result of an XPointer expression
@@ -13757,25 +13595,17 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
* up a new locset.
*/
CHECK_TYPE0(XPATH_LOCATIONSET);
+
+ if ((ctxt->value->user == NULL) ||
+ (((xmlLocationSetPtr) ctxt->value->user)->locNr == 0))
+ return (total);
+
obj = valuePop(ctxt);
oldlocset = obj->user;
- ctxt->context->node = NULL;
+ oldnode = ctxt->context->node;
+ oldcs = ctxt->context->contextSize;
+ oldpp = ctxt->context->proximityPosition;
- if ((oldlocset == NULL) || (oldlocset->locNr == 0)) {
- ctxt->context->contextSize = 0;
- ctxt->context->proximityPosition = 0;
- if (op->ch2 != -1)
- total +=
- xmlXPathCompOpEval(ctxt,
- &comp->steps[op->ch2]);
- res = valuePop(ctxt);
- if (res != NULL) {
- xmlXPathReleaseObject(ctxt->context, res);
- }
- valuePush(ctxt, obj);
- CHECK_ERROR0;
- return (total);
- }
newlocset = xmlXPtrLocationSetCreate(NULL);
for (i = 0; i < oldlocset->locNr; i++) {
@@ -13795,8 +13625,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlXPathCompOpEval(ctxt,
&comp->steps[op->ch2]);
if (ctxt->error != XPATH_EXPRESSION_OK) {
- xmlXPathFreeObject(obj);
- return(0);
+ xmlXPtrFreeLocationSet(newlocset);
+ goto filter_xptr_error;
}
/*
@@ -13820,19 +13650,17 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
res = valuePop(ctxt);
xmlXPathReleaseObject(ctxt->context, res);
}
-
- ctxt->context->node = NULL;
}
/*
* The result is used as the new evaluation locset.
*/
- xmlXPathReleaseObject(ctxt->context, obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset));
+filter_xptr_error:
+ xmlXPathReleaseObject(ctxt->context, obj);
ctxt->context->node = oldnode;
+ ctxt->context->contextSize = oldcs;
+ ctxt->context->proximityPosition = oldpp;
return (total);
}
#endif /* LIBXML_XPTR_ENABLED */
@@ -13843,30 +13671,15 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
* up a new set.
*/
CHECK_TYPE0(XPATH_NODESET);
- obj = valuePop(ctxt);
- oldset = obj->nodesetval;
- oldnode = ctxt->context->node;
- oldDoc = ctxt->context->doc;
- ctxt->context->node = NULL;
-
- if ((oldset == NULL) || (oldset->nodeNr == 0)) {
- ctxt->context->contextSize = 0;
- ctxt->context->proximityPosition = 0;
-/*
- if (op->ch2 != -1)
- total +=
- xmlXPathCompOpEval(ctxt,
- &comp->steps[op->ch2]);
- CHECK_ERROR0;
- res = valuePop(ctxt);
- if (res != NULL)
- xmlXPathFreeObject(res);
-*/
- valuePush(ctxt, obj);
- ctxt->context->node = oldnode;
- CHECK_ERROR0;
- } else {
+ if ((ctxt->value->nodesetval != NULL) &&
+ (ctxt->value->nodesetval->nodeNr != 0)) {
+ obj = valuePop(ctxt);
+ oldset = obj->nodesetval;
+ oldnode = ctxt->context->node;
+ oldDoc = ctxt->context->doc;
+ oldcs = ctxt->context->contextSize;
+ oldpp = ctxt->context->proximityPosition;
tmp = NULL;
/*
* Initialize the new set.
@@ -13932,8 +13745,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
&comp->steps[op->ch2]);
if (ctxt->error != XPATH_EXPRESSION_OK) {
xmlXPathFreeNodeSet(newset);
- xmlXPathFreeObject(obj);
- return(0);
+ goto filter_error;
}
/*
@@ -13967,23 +13779,21 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
*/
} else
tmp = NULL;
- ctxt->context->node = NULL;
}
if (tmp != NULL)
xmlXPathReleaseObject(ctxt->context, tmp);
/*
* The result is used as the new evaluation set.
*/
- xmlXPathReleaseObject(ctxt->context, obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
- /* may want to move this past the '}' later */
- ctxt->context->doc = oldDoc;
valuePush(ctxt,
xmlXPathCacheWrapNodeSet(ctxt->context, newset));
+filter_error:
+ xmlXPathReleaseObject(ctxt->context, obj);
+ ctxt->context->node = oldnode;
+ ctxt->context->doc = oldDoc;
+ ctxt->context->contextSize = oldcs;
+ ctxt->context->proximityPosition = oldpp;
}
- ctxt->context->node = oldnode;
return (total);
}
case XPATH_OP_SORT:
@@ -14006,6 +13816,9 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlLocationSetPtr newlocset = NULL;
xmlLocationSetPtr oldlocset;
xmlNodeSetPtr oldset;
+ xmlNodePtr oldnode = ctxt->context->node;
+ int oldcs = ctxt->context->contextSize;
+ int oldpp = ctxt->context->proximityPosition;
int i, j;
if (op->ch1 != -1) {
@@ -14026,22 +13839,14 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
* up a new locset.
*/
CHECK_TYPE0(XPATH_LOCATIONSET);
+
+ if ((ctxt->value->user == NULL) ||
+ (((xmlLocationSetPtr) ctxt->value->user)->locNr == 0))
+ return (total);
+
obj = valuePop(ctxt);
oldlocset = obj->user;
- if ((oldlocset == NULL) || (oldlocset->locNr == 0)) {
- ctxt->context->node = NULL;
- ctxt->context->contextSize = 0;
- ctxt->context->proximityPosition = 0;
- total += xmlXPathCompOpEval(ctxt,&comp->steps[op->ch2]);
- res = valuePop(ctxt);
- if (res != NULL) {
- xmlXPathReleaseObject(ctxt->context, res);
- }
- valuePush(ctxt, obj);
- CHECK_ERROR0;
- return (total);
- }
newlocset = xmlXPtrLocationSetCreate(NULL);
for (i = 0; i < oldlocset->locNr; i++) {
@@ -14061,8 +13866,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlXPathCompOpEval(ctxt,
&comp->steps[op->ch2]);
if (ctxt->error != XPATH_EXPRESSION_OK) {
- xmlXPathFreeObject(obj);
- return(0);
+ xmlXPtrFreeLocationSet(newlocset);
+ goto rangeto_error;
}
res = valuePop(ctxt);
@@ -14097,14 +13902,11 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
res = valuePop(ctxt);
xmlXPathReleaseObject(ctxt->context, res);
}
-
- ctxt->context->node = NULL;
}
} else { /* Not a location set */
CHECK_TYPE0(XPATH_NODESET);
obj = valuePop(ctxt);
oldset = obj->nodesetval;
- ctxt->context->node = NULL;
newlocset = xmlXPtrLocationSetCreate(NULL);
@@ -14127,8 +13929,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlXPathCompOpEval(ctxt,
&comp->steps[op->ch2]);
if (ctxt->error != XPATH_EXPRESSION_OK) {
- xmlXPathFreeObject(obj);
- return(0);
+ xmlXPtrFreeLocationSet(newlocset);
+ goto rangeto_error;
}
res = valuePop(ctxt);
@@ -14149,8 +13951,6 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
res = valuePop(ctxt);
xmlXPathReleaseObject(ctxt->context, res);
}
-
- ctxt->context->node = NULL;
}
}
}
@@ -14158,11 +13958,12 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
/*
* The result is used as the new evaluation set.
*/
- xmlXPathReleaseObject(ctxt->context, obj);
- ctxt->context->node = NULL;
- ctxt->context->contextSize = -1;
- ctxt->context->proximityPosition = -1;
valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset));
+rangeto_error:
+ xmlXPathReleaseObject(ctxt->context, obj);
+ ctxt->context->node = oldnode;
+ ctxt->context->contextSize = oldcs;
+ ctxt->context->proximityPosition = oldpp;
return (total);
}
#endif /* LIBXML_XPTR_ENABLED */
@@ -14906,10 +14707,11 @@ xmlXPathCompile(const xmlChar *str) {
static int
xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctxt,
- xmlXPathObjectPtr *resObj,
+ xmlXPathObjectPtr *resObjPtr,
int toBool)
{
xmlXPathParserContextPtr pctxt;
+ xmlXPathObjectPtr resObj;
#ifndef LIBXML_THREAD_ENABLED
static int reentance = 0;
#endif
@@ -14937,43 +14739,26 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp,
pctxt = xmlXPathCompParserContext(comp, ctxt);
res = xmlXPathRunEval(pctxt, toBool);
- if (resObj) {
- if (pctxt->value == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompiledEval: evaluation failed\n");
- *resObj = NULL;
- } else {
- *resObj = valuePop(pctxt);
- }
+ if (pctxt->error != XPATH_EXPRESSION_OK) {
+ resObj = NULL;
+ } else {
+ resObj = valuePop(pctxt);
+ if (resObj == NULL) {
+ if (!toBool)
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompiledEval: No result on the stack.\n");
+ } else if (pctxt->valueNr > 0) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompiledEval: %d object(s) left on the stack.\n",
+ pctxt->valueNr);
+ }
}
- /*
- * Pop all remaining objects from the stack.
- */
- if (pctxt->valueNr > 0) {
- xmlXPathObjectPtr tmp;
- int stack = 0;
-
- do {
- tmp = valuePop(pctxt);
- if (tmp != NULL) {
- stack++;
- xmlXPathReleaseObject(ctxt, tmp);
- }
- } while (tmp != NULL);
- if ((stack != 0) &&
- ((toBool) || ((resObj) && (*resObj))))
- {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathCompiledEval: %d objects left on the stack.\n",
- stack);
- }
- }
+ if (resObjPtr)
+ *resObjPtr = resObj;
+ else
+ xmlXPathReleaseObject(ctxt, resObj);
- if ((pctxt->error != XPATH_EXPRESSION_OK) && (resObj) && (*resObj)) {
- xmlXPathFreeObject(*resObj);
- *resObj = NULL;
- }
pctxt->comp = NULL;
xmlXPathFreeParserContext(pctxt);
#ifndef LIBXML_THREAD_ENABLED
@@ -15041,22 +14826,21 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
if (ctxt->comp != NULL)
xmlXPathFreeCompExpr(ctxt->comp);
ctxt->comp = comp;
- if (ctxt->cur != NULL)
- while (*ctxt->cur != 0) ctxt->cur++;
} else
#endif
{
xmlXPathCompileExpr(ctxt, 1);
- if ((ctxt->error == XPATH_EXPRESSION_OK) &&
- (ctxt->comp != NULL) &&
- (ctxt->comp->nbStep > 1) &&
- (ctxt->comp->last >= 0))
- {
+ CHECK_ERROR;
+
+ /* Check for trailing characters. */
+ if (*ctxt->cur != 0)
+ XP_ERROR(XPATH_EXPR_ERROR);
+
+ if ((ctxt->comp->nbStep > 1) && (ctxt->comp->last >= 0))
xmlXPathOptimizeExpression(ctxt->comp,
&ctxt->comp->steps[ctxt->comp->last]);
- }
}
- CHECK_ERROR;
+
xmlXPathRunEval(ctxt, 0);
}
@@ -15073,8 +14857,7 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr
xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
xmlXPathParserContextPtr ctxt;
- xmlXPathObjectPtr res, tmp, init = NULL;
- int stack = 0;
+ xmlXPathObjectPtr res;
CHECK_CTXT(ctx)
@@ -15085,37 +14868,18 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
return NULL;
xmlXPathEvalExpr(ctxt);
- if (ctxt->value == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathEval: evaluation failed\n");
- res = NULL;
- } else if ((*ctxt->cur != 0) && (ctxt->comp != NULL)
-#ifdef XPATH_STREAMING
- && (ctxt->comp->stream == NULL)
-#endif
- ) {
- xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
+ if (ctxt->error != XPATH_EXPRESSION_OK) {
res = NULL;
} else {
res = valuePop(ctxt);
- }
-
- do {
- tmp = valuePop(ctxt);
- if (tmp != NULL) {
- if (tmp != init)
- stack++;
- xmlXPathReleaseObject(ctx, tmp);
+ if (res == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompiledEval: No result on the stack.\n");
+ } else if (ctxt->valueNr > 0) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompiledEval: %d object(s) left on the stack.\n",
+ ctxt->valueNr);
}
- } while (tmp != NULL);
- if ((stack != 0) && (res != NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathEval: %d object left on the stack\n",
- stack);
- }
- if (ctxt->error != XPATH_EXPRESSION_OK) {
- xmlXPathFreeObject(res);
- res = NULL;
}
xmlXPathFreeParserContext(ctxt);
@@ -15170,46 +14934,14 @@ xmlXPathNodeEval(xmlNodePtr node, const xmlChar *str, xmlXPathContextPtr ctx) {
* @str: the XPath expression
* @ctxt: the XPath context
*
- * Evaluate the XPath expression in the given context.
+ * Alias for xmlXPathEval().
*
* Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
* the caller has to free the object.
*/
xmlXPathObjectPtr
xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) {
- xmlXPathParserContextPtr pctxt;
- xmlXPathObjectPtr res, tmp;
- int stack = 0;
-
- CHECK_CTXT(ctxt)
-
- xmlXPathInit();
-
- pctxt = xmlXPathNewParserContext(str, ctxt);
- if (pctxt == NULL)
- return NULL;
- xmlXPathEvalExpr(pctxt);
-
- if ((*pctxt->cur != 0) || (pctxt->error != XPATH_EXPRESSION_OK)) {
- xmlXPatherror(pctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);
- res = NULL;
- } else {
- res = valuePop(pctxt);
- }
- do {
- tmp = valuePop(pctxt);
- if (tmp != NULL) {
- xmlXPathReleaseObject(ctxt, tmp);
- stack++;
- }
- } while (tmp != NULL);
- if ((stack != 0) && (res != NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlXPathEvalExpression: %d object left on the stack\n",
- stack);
- }
- xmlXPathFreeParserContext(pctxt);
- return(res);
+ return(xmlXPathEval(str, ctxt));
}
/************************************************************************
diff --git a/chromium/third_party/libxml/win32/config.h b/chromium/third_party/libxml/win32/config.h
index 891b57e43cf..c1e16f141cd 100644
--- a/chromium/third_party/libxml/win32/config.h
+++ b/chromium/third_party/libxml/win32/config.h
@@ -9,11 +9,9 @@
#if defined(_WIN32_WCE)
#undef HAVE_ERRNO_H
-#include <windows.h>
#include "wincecompat.h"
#else
#define HAVE_SYS_STAT_H
-#define HAVE__STAT
#define HAVE_STAT
#define HAVE_STDLIB_H
#define HAVE_TIME_H
@@ -28,10 +26,6 @@
#define ICONV_CONST const
#endif
-#ifdef NEED_SOCKETS
-#include <wsockcompat.h>
-#endif
-
/*
* Windows platforms may define except
*/
diff --git a/chromium/third_party/libxml/win32/include/libxml/xmlversion.h b/chromium/third_party/libxml/win32/include/libxml/xmlversion.h
index 2a9dfebbc27..23989a56d3e 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.3"
+#define LIBXML_DOTTED_VERSION "2.9.9"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
-#define LIBXML_VERSION 20903
+#define LIBXML_VERSION 20909
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
-#define LIBXML_VERSION_STRING "20903"
+#define LIBXML_VERSION_STRING "20909"
/**
* 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(20903);
+#define LIBXML_TEST_VERSION xmlCheckVersion(20909);
#ifndef VMS
#if 0
@@ -90,7 +90,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the thread support is configured in
*/
-#if 1
+#if 0
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED
@@ -147,7 +147,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the xmlPattern node selection interface is configured in
*/
-#if 1
+#if 0
#define LIBXML_PATTERN_ENABLED
#endif
@@ -192,7 +192,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the DTD validation support is configured in
*/
-#if 1
+#if 0
#define LIBXML_VALID_ENABLED
#endif
@@ -210,7 +210,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the deprecated APIs are compiled in for compatibility
*/
-#if 1
+#if 0
#define LIBXML_LEGACY_ENABLED
#endif
@@ -219,7 +219,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Canonicalization support is configured in
*/
-#if 1
+#if 0
#define LIBXML_C14N_ENABLED
#endif
@@ -228,7 +228,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Catalog support is configured in
*/
-#if 1
+#if 0
#define LIBXML_CATALOG_ENABLED
#endif
@@ -237,7 +237,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the SGML Docbook support is configured in
*/
-#if 1
+#if 0
#define LIBXML_DOCB_ENABLED
#endif
@@ -255,7 +255,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether XPointer is configured in
*/
-#if 1
+#if 0
#define LIBXML_XPTR_ENABLED
#endif
@@ -264,7 +264,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether XInclude is configured in
*/
-#if 1
+#if 0
#define LIBXML_XINCLUDE_ENABLED
#endif
@@ -300,7 +300,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether Debugging module is configured in
*/
-#if 1
+#if 0
#define LIBXML_DEBUG_ENABLED
#endif
@@ -327,7 +327,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Unicode related interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_UNICODE_ENABLED
#endif
@@ -336,7 +336,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the regular expressions interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_REGEXP_ENABLED
#endif
@@ -345,7 +345,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the automata interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_AUTOMATA_ENABLED
#endif
@@ -354,7 +354,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the formal expressions interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_EXPR_ENABLED
#endif
@@ -363,7 +363,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Schemas validation interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_SCHEMAS_ENABLED
#endif
@@ -372,7 +372,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the Schematron validation interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_SCHEMATRON_ENABLED
#endif
@@ -381,7 +381,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Whether the module interfaces are compiled in
*/
-#if 1
+#if 0
#define LIBXML_MODULES_ENABLED
/**
* LIBXML_MODULE_EXTENSION:
@@ -410,9 +410,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
/**
* ATTRIBUTE_UNUSED: