https://git.reactos.org/?p=reactos.git;a=commitdiff;h=40ee59d609a4597e904888...
commit 40ee59d609a4597e904888a2242e318aba6cab81 Author: Thomas Faber thomas.faber@reactos.org AuthorDate: Sun Sep 12 13:24:24 2021 -0400 Commit: Thomas Faber thomas.faber@reactos.org CommitDate: Sat Sep 18 21:42:26 2021 -0400
[LIBXML2] Update to version 2.9.12. CORE-17766 --- media/doc/3rd Party Files.txt | 2 +- sdk/include/reactos/libs/libxml/c14n.h | 10 +- sdk/include/reactos/libs/libxml/parser.h | 16 +- sdk/include/reactos/libs/libxml/tree.h | 6 +- sdk/include/reactos/libs/libxml/xmlIO.h | 2 + sdk/include/reactos/libs/libxml/xmlexports.h | 154 +-- sdk/include/reactos/libs/libxml/xmlschemas.h | 2 +- sdk/include/reactos/libs/libxml/xmlversion.h | 14 +- sdk/include/reactos/libs/libxml/xmlversion.h.in | 4 +- sdk/include/reactos/libs/libxml/xpath.h | 4 +- sdk/lib/3rdparty/libxml2/ChangeLog | 214 ++-- sdk/lib/3rdparty/libxml2/HTMLparser.c | 1199 ++++++++++++----------- sdk/lib/3rdparty/libxml2/HTMLtree.c | 497 +++++----- sdk/lib/3rdparty/libxml2/README | 2 +- sdk/lib/3rdparty/libxml2/SAX2.c | 174 ++-- sdk/lib/3rdparty/libxml2/TODO | 8 +- sdk/lib/3rdparty/libxml2/buf.c | 16 +- sdk/lib/3rdparty/libxml2/c14n.c | 20 +- sdk/lib/3rdparty/libxml2/catalog.c | 18 +- sdk/lib/3rdparty/libxml2/config.h | 6 + sdk/lib/3rdparty/libxml2/debugXML.c | 10 +- sdk/lib/3rdparty/libxml2/dict.c | 4 +- sdk/lib/3rdparty/libxml2/encoding.c | 100 +- sdk/lib/3rdparty/libxml2/entities.c | 58 +- sdk/lib/3rdparty/libxml2/error.c | 26 +- sdk/lib/3rdparty/libxml2/globals.c | 2 +- sdk/lib/3rdparty/libxml2/hash.c | 2 +- sdk/lib/3rdparty/libxml2/include/win32config.h | 6 +- sdk/lib/3rdparty/libxml2/list.c | 2 +- sdk/lib/3rdparty/libxml2/nanoftp.c | 29 +- sdk/lib/3rdparty/libxml2/nanohttp.c | 14 +- sdk/lib/3rdparty/libxml2/parser.c | 637 ++++++------ sdk/lib/3rdparty/libxml2/parserInternals.c | 17 +- sdk/lib/3rdparty/libxml2/relaxng.c | 12 +- sdk/lib/3rdparty/libxml2/schematron.c | 4 +- sdk/lib/3rdparty/libxml2/threads.c | 5 +- sdk/lib/3rdparty/libxml2/tree.c | 81 +- sdk/lib/3rdparty/libxml2/trio.c | 2 +- sdk/lib/3rdparty/libxml2/trio.h | 2 +- sdk/lib/3rdparty/libxml2/triodef.h | 2 +- sdk/lib/3rdparty/libxml2/trionan.c | 6 +- sdk/lib/3rdparty/libxml2/trionan.h | 2 +- sdk/lib/3rdparty/libxml2/triop.h | 2 +- sdk/lib/3rdparty/libxml2/triostr.c | 2 +- sdk/lib/3rdparty/libxml2/triostr.h | 2 +- sdk/lib/3rdparty/libxml2/uri.c | 31 +- sdk/lib/3rdparty/libxml2/valid.c | 67 +- sdk/lib/3rdparty/libxml2/xinclude.c | 221 +++-- sdk/lib/3rdparty/libxml2/xmlIO.c | 55 +- sdk/lib/3rdparty/libxml2/xmlcatalog.c | 2 +- sdk/lib/3rdparty/libxml2/xmllint.c | 48 +- sdk/lib/3rdparty/libxml2/xmlmemory.c | 2 +- sdk/lib/3rdparty/libxml2/xmlreader.c | 112 ++- sdk/lib/3rdparty/libxml2/xmlregexp.c | 137 ++- sdk/lib/3rdparty/libxml2/xmlsave.c | 1143 +++++++++++---------- sdk/lib/3rdparty/libxml2/xmlschemas.c | 533 ++++++---- sdk/lib/3rdparty/libxml2/xmlschemastypes.c | 214 +++- sdk/lib/3rdparty/libxml2/xmlstring.c | 21 +- sdk/lib/3rdparty/libxml2/xpath.c | 173 ++-- sdk/lib/3rdparty/libxml2/xpointer.c | 61 +- 60 files changed, 3385 insertions(+), 2832 deletions(-)
diff --git a/media/doc/3rd Party Files.txt b/media/doc/3rd Party Files.txt index c0d4d7dcb69..ae3c85ff2ae 100644 --- a/media/doc/3rd Party Files.txt +++ b/media/doc/3rd Party Files.txt @@ -233,7 +233,7 @@ URL: https://github.com/win-iconv/win-iconv
Title: LibXML Path: sdk/lib/libxml2 -Used Version: 2.9.10 +Used Version: 2.9.12 License: MIT (https://spdx.org/licenses/MIT.htmlf) URL: http://xmlsoft.org, ftp://xmlsoft.org/libxml2/
diff --git a/sdk/include/reactos/libs/libxml/c14n.h b/sdk/include/reactos/libs/libxml/c14n.h index d74847df842..af93de63a4c 100644 --- a/sdk/include/reactos/libs/libxml/c14n.h +++ b/sdk/include/reactos/libs/libxml/c14n.h @@ -16,17 +16,19 @@ */ #ifndef __XML_C14N_H__ #define __XML_C14N_H__ + +#include <libxml/xmlversion.h> + #ifdef LIBXML_C14N_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
+#include <libxml/tree.h> +#include <libxml/xpath.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */
-#include <libxml/xmlversion.h> -#include <libxml/tree.h> -#include <libxml/xpath.h> - /* * XML Canonicalization * http://www.w3.org/TR/xml-c14n diff --git a/sdk/include/reactos/libs/libxml/parser.h b/sdk/include/reactos/libs/libxml/parser.h index c295554f36a..0ba1c387a97 100644 --- a/sdk/include/reactos/libs/libxml/parser.h +++ b/sdk/include/reactos/libs/libxml/parser.h @@ -79,7 +79,7 @@ struct _xmlParserInput { /** * xmlParserNodeInfo: * - * The parser can be asked to collect Node informations, i.e. at what + * The parser can be asked to collect Node information, i.e. at what * place in the file they were detected. * NOTE: This is off by default and not very well tested. */ @@ -169,6 +169,8 @@ typedef enum { XML_PARSE_READER = 5 } xmlParserMode;
+typedef struct _xmlStartTag xmlStartTag; + /** * xmlParserCtxt: * @@ -231,7 +233,7 @@ struct _xmlParserCtxt { int nameMax; /* Max depth of the parsing stack */ const xmlChar * *nameTab; /* array of nodes */
- long nbChars; /* number of xmlChar processed */ + long nbChars; /* unused */ long checkIndex; /* used by progressive parsing lookup */ int keepBlanks; /* ugly but ... */ int disableSAX; /* SAX callbacks are disabled */ @@ -280,7 +282,7 @@ struct _xmlParserCtxt { int nsMax; /* the size of the arrays */ const xmlChar * *nsTab; /* the array of prefix/namespace name */ int *attallocs; /* which attribute were allocated */ - void * *pushTab; /* array of data for push */ + xmlStartTag *pushTab; /* array of data for push */ xmlHashTablePtr attsDefault; /* defaulted attributes if any */ xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ int nsWellFormed; /* is the document XML Namespace okay */ @@ -296,7 +298,7 @@ struct _xmlParserCtxt { xmlAttrPtr freeAttrs; /* List of freed attributes nodes */
/* - * the complete error informations for the last error. + * the complete error information for the last error. */ xmlError lastError; xmlParserMode parseMode; /* the parser mode */ @@ -329,7 +331,7 @@ struct _xmlSAXLocator { * xmlSAXHandler: * * A SAX handler is bunch of callbacks called by the parser when processing - * of the input generate data or structure informations. + * of the input generate data or structure information. */
/** @@ -685,7 +687,7 @@ typedef int (*hasExternalSubsetSAXFunc) (void *ctx); * attribute values. * * SAX2 callback when an element start has been detected by the parser. - * It provides the namespace informations for the element, as well as + * It provides the namespace information for the element, as well as * the new namespace declarations on the element. */
@@ -707,7 +709,7 @@ typedef void (*startElementNsSAX2Func) (void *ctx, * @URI: the element namespace name if available * * SAX2 callback when an element end has been detected by the parser. - * It provides the namespace informations for the element. + * It provides the namespace information for the element. */
typedef void (*endElementNsSAX2Func) (void *ctx, diff --git a/sdk/include/reactos/libs/libxml/tree.h b/sdk/include/reactos/libs/libxml/tree.h index 6cfd73188cf..1e79be92ea9 100644 --- a/sdk/include/reactos/libs/libxml/tree.h +++ b/sdk/include/reactos/libs/libxml/tree.h @@ -443,7 +443,7 @@ struct _xmlAttr { struct _xmlDoc *doc; /* the containing document */ xmlNs *ns; /* pointer to the associated namespace */ xmlAttributeType atype; /* the attribute type if validating */ - void *psvi; /* for type/PSVI informations */ + void *psvi; /* for type/PSVI information */ };
/** @@ -502,7 +502,7 @@ struct _xmlNode { xmlChar *content; /* the content */ struct _xmlAttr *properties;/* properties list */ xmlNs *nsDef; /* namespace definitions on this node */ - void *psvi; /* for type/PSVI informations */ + void *psvi; /* for type/PSVI information */ unsigned short line; /* line number */ unsigned short extra; /* extra data for XPath/XSLT */ }; @@ -578,7 +578,7 @@ struct _xmlDoc { 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 */ + void *psvi; /* for type/PSVI information */ int parseFlags; /* set of xmlParserOption used to parse the document */ int properties; /* set of xmlDocProperties for this document diff --git a/sdk/include/reactos/libs/libxml/xmlIO.h b/sdk/include/reactos/libs/libxml/xmlIO.h index 8690d668c25..095b2f56d96 100644 --- a/sdk/include/reactos/libs/libxml/xmlIO.h +++ b/sdk/include/reactos/libs/libxml/xmlIO.h @@ -217,6 +217,8 @@ xmlParserInputBufferPtr */ XMLPUBFUN void XMLCALL xmlCleanupOutputCallbacks (void); +XMLPUBFUN int XMLCALL + xmlPopOutputCallbacks (void); XMLPUBFUN void XMLCALL xmlRegisterDefaultOutputCallbacks(void); XMLPUBFUN xmlOutputBufferPtr XMLCALL diff --git a/sdk/include/reactos/libs/libxml/xmlexports.h b/sdk/include/reactos/libs/libxml/xmlexports.h index f03af0d03a6..aceede5ec05 100644 --- a/sdk/include/reactos/libs/libxml/xmlexports.h +++ b/sdk/include/reactos/libs/libxml/xmlexports.h @@ -3,43 +3,46 @@ * Description: macros for marking symbols as exportable/importable. * * Copy: See Copyright for the status of this software. - * - * Author: Igor Zlatovic igor@zlatkovic.com */
#ifndef __XML_EXPORTS_H__ #define __XML_EXPORTS_H__
-/** - * XMLPUBFUN, XMLPUBVAR, XMLCALL - * - * Macros which declare an exportable function, an exportable variable and - * the calling convention used for functions. - * - * Please use an extra block for every platform/compiler combination when - * modifying this, rather than overlong #ifdef lines. This helps - * readability as well as the fact that different compilers on the same - * platform might need different definitions. - */ +#if defined(_WIN32) || defined(__CYGWIN__) +/** DOC_DISABLE */ + +#ifdef LIBXML_STATIC + #define XMLPUBLIC +#elif defined(IN_LIBXML) + #define XMLPUBLIC __declspec(dllexport) +#else + #define XMLPUBLIC __declspec(dllimport) +#endif + +#if defined(LIBXML_FASTCALL) + #define XMLCALL __fastcall +#else + #define XMLCALL __cdecl +#endif +#define XMLCDECL __cdecl + +/** DOC_ENABLE */ +#else /* not Windows */
/** - * XMLPUBFUN: - * - * Macros which declare an exportable function - */ -#define XMLPUBFUN -/** - * XMLPUBVAR: + * XMLPUBLIC: * - * Macros which declare an exportable variable + * Macro which declares a public symbol */ -#define XMLPUBVAR extern +#define XMLPUBLIC + /** * XMLCALL: * - * Macros which declare the called convention for exported functions + * Macro which declares the calling convention for exported functions */ #define XMLCALL + /** * XMLCDECL: * @@ -48,100 +51,21 @@ */ #define XMLCDECL
-/** DOC_DISABLE */ - -/* Windows platform with MS compiler */ -#if defined(_WIN32) && defined(_MSC_VER) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #if defined(LIBXML_FASTCALL) - #define XMLCALL __fastcall - #else - #define XMLCALL __cdecl - #endif - #define XMLCDECL __cdecl -#endif +#endif /* platform switch */
-/* Windows platform with Borland compiler */ -#if defined(_WIN32) && defined(__BORLANDC__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) extern - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl -#endif - -/* Windows platform with GNU compiler (Mingw) */ -#if defined(_WIN32) && defined(__MINGW32__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - /* - * if defined(IN_LIBXML) this raises problems on mingw with msys - * _imp__xmlFree listed as missing. Try to workaround the problem - * by also making that declaration when compiling client code. - */ - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) extern - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl -#endif +/* + * XMLPUBFUN: + * + * Macro which declares an exportable function + */ +#define XMLPUBFUN XMLPUBLIC
-/* Cygwin platform (does not define _WIN32), GNU compiler */ -#if defined(__CYGWIN__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl -#endif +/** + * XMLPUBVAR: + * + * Macro which declares an exportable variable + */ +#define XMLPUBVAR XMLPUBLIC extern
/* Compatibility */ #if !defined(LIBXML_DLL_IMPORT) diff --git a/sdk/include/reactos/libs/libxml/xmlschemas.h b/sdk/include/reactos/libs/libxml/xmlschemas.h index 97930c7c3f4..b90e9d18c6e 100644 --- a/sdk/include/reactos/libs/libxml/xmlschemas.h +++ b/sdk/include/reactos/libs/libxml/xmlschemas.h @@ -122,7 +122,7 @@ typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; * @line: returned line information * * A schemas validation locator, a callback called by the validator. - * This is used when file or node informations are not available + * This is used when file or node information are not available * to find out what file and line number are affected * * Returns: 0 in case of success and -1 in case of error diff --git a/sdk/include/reactos/libs/libxml/xmlversion.h b/sdk/include/reactos/libs/libxml/xmlversion.h index 2ac15f54044..cd2dc1dbc1d 100644 --- a/sdk/include/reactos/libs/libxml/xmlversion.h +++ b/sdk/include/reactos/libs/libxml/xmlversion.h @@ -1,6 +1,6 @@ /* - * Summary: compile-time version informations - * Description: compile-time version informations for the XML library + * Summary: compile-time version information + * Description: compile-time version information for the XML library * * Copy: See Copyright for the status of this software. * @@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.9.10" +#define LIBXML_DOTTED_VERSION "2.9.12"
/** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20910 +#define LIBXML_VERSION 20912
/** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20910" +#define LIBXML_VERSION_STRING "20912"
/** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-GITv2.9.10-rc1-2-ga5bb6aaa2" +#define LIBXML_VERSION_EXTRA "-GITv2.9.11"
/** * LIBXML_TEST_VERSION: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20910); +#define LIBXML_TEST_VERSION xmlCheckVersion(20912);
#ifndef VMS #if 0 diff --git a/sdk/include/reactos/libs/libxml/xmlversion.h.in b/sdk/include/reactos/libs/libxml/xmlversion.h.in index 964f10d81ab..c995fe512bd 100644 --- a/sdk/include/reactos/libs/libxml/xmlversion.h.in +++ b/sdk/include/reactos/libs/libxml/xmlversion.h.in @@ -1,6 +1,6 @@ /* - * Summary: compile-time version informations - * Description: compile-time version informations for the XML library + * Summary: compile-time version information + * Description: compile-time version information for the XML library * * Copy: See Copyright for the status of this software. * diff --git a/sdk/include/reactos/libs/libxml/xpath.h b/sdk/include/reactos/libs/libxml/xpath.h index 4ef3909b409..539593fa506 100644 --- a/sdk/include/reactos/libs/libxml/xpath.h +++ b/sdk/include/reactos/libs/libxml/xpath.h @@ -359,8 +359,6 @@ struct _xmlXPathContext { unsigned long opLimit; unsigned long opCount; int depth; - int maxDepth; - int maxParserDepth; };
/* @@ -373,7 +371,7 @@ typedef xmlXPathCompExpr *xmlXPathCompExprPtr; /** * xmlXPathParserContext: * - * An XPath parser context. It contains pure parsing informations, + * An XPath parser context. It contains pure parsing information, * an xmlXPathContext, and the stack of objects. */ struct _xmlXPathParserContext { diff --git a/sdk/lib/3rdparty/libxml2/ChangeLog b/sdk/lib/3rdparty/libxml2/ChangeLog index b3f3fc1ff1b..264067061aa 100644 --- a/sdk/lib/3rdparty/libxml2/ChangeLog +++ b/sdk/lib/3rdparty/libxml2/ChangeLog @@ -379,7 +379,7 @@ Tue Aug 26 09:42:08 CEST 2008 Daniel Veillard daniel@veillard.com * test/schemas/regexp-char-ref_0.xml test/schemas/regexp-char-ref_0.xsd test/schemas/regexp-char-ref_1.xsd result/schemas/regexp-char-ref_0_0 result/schemas/regexp-char-ref_1_0: Volker Grabsch also provided - regession tests for this + regression tests for this
Tue Aug 26 09:25:39 CEST 2008 Daniel Veillard daniel@veillard.com
@@ -475,7 +475,7 @@ Thu Jul 31 10:15:53 CEST 2008 Daniel Veillard daniel@veillard.com * include/libxml/xmlerror.h parser.c: clean up namespace errors checking and reporting, errors when a document is labelled as UTF-16 while it is parsed as UTF-8 and no encoding was given - explicitely. + explicitly. * result/errors/webdav.xml.*: some warnings are no recategorized as Namespace errors
@@ -663,7 +663,7 @@ Thu Apr 3 11:44:57 CEST 2008 Daniel Veillard daniel@veillard.com
Thu Apr 3 11:02:02 CEST 2008 Daniel Veillard daniel@veillard.com
- * HTMLparser.c: apparently it's okay to forget the semicolumn after + * HTMLparser.c: apparently it's okay to forget the semicolon after entity refs in HTML, fixing char refs parsing accordingly based on T. Manske patch, this should fix #517653
@@ -787,7 +787,7 @@ Wed Mar 12 18:56:22 CET 2008 Daniel Veillard daniel@veillard.com
Wed Mar 12 10:22:01 CET 2008 Daniel Veillard daniel@veillard.com
- * python/types.c: fix a memory errro when using namespace nodes + * python/types.c: fix a memory error when using namespace nodes returned from XPath queries, should fix #521699 * python/tests/Makefile.am python/tests/xpathns.py: add a specific regression test for it @@ -917,7 +917,7 @@ Fri Jan 25 20:01:42 CET 2007 Rob Richards rrichards@ctindustries.net
Thu Jan 24 15:37:04 CET 2008 Daniel Veillard daniel@veillard.com
- * parser.c: fix a memeory leak in internal subset parsing with + * parser.c: fix a memory leak in internal subset parsing with a fix from Ashwin * test/errors/content1.xml result/errors/content1.xml*: add test to regressions @@ -1230,7 +1230,7 @@ Thu May 10 01:52:42 CEST 2007 Daniel Veillard daniel@veillard.com
* list.c: applied patch to fix xmlListAppend() from Georges-André SILBER - * valid.c: also fix the place wher it was called. + * valid.c: also fix the place where it was called.
Wed May 2 18:47:33 CEST 2007 Daniel Veillard daniel@veillard.com
@@ -1424,7 +1424,7 @@ Thu Jan 4 18:27:49 CET 2007 Daniel Veillard daniel@veillard.com test/relaxng/empty1_0.xml test/relaxng/comps.rng test/relaxng/empty0.rng test/relaxng/empty0_0.xml test/relaxng/empty1_1.xml: tests which were apparently - never commited to CVS + never committed to CVS
Wed Jan 3 16:05:21 PST 2007 Aleksey Sanin aleksey@aleksey.com
@@ -1531,7 +1531,7 @@ Tue Oct 17 18:12:34 CEST 2006 Daniel Veillard daniel@veillard.com * HTMLparser.c: fixing HTML minimized attribute values to be generated internally if not present, fixes bug #332124 * result/HTML/doc2.htm.sax result/HTML/doc3.htm.sax - result/HTML/wired.html.sax: this affects the SAX event strem for + result/HTML/wired.html.sax: this affects the SAX event stream for a few test cases
Tue Oct 17 17:56:31 CEST 2006 Daniel Veillard daniel@veillard.com @@ -1627,7 +1627,7 @@ Wed Oct 11 23:11:58 CEST 2006 Daniel Veillard daniel@veillard.com
Wed Oct 11 18:40:00 CEST 2006 Daniel Veillard daniel@veillard.com
- * valid.c: fixed a weird error where validity context whould not + * valid.c: fixed a weird error where validity context would not show up if warnings were disabled pointed out by Bob Stayton * xmlIO.c doc/generator.py: cleanup and fix to regenerate the docs * doc//* testapi.c: rebuilt the docs @@ -1740,7 +1740,7 @@ Thu Aug 17 00:48:31 CEST 2006 Rob Richards rrichards@ctindustries.net Wed Aug 16 01:15:12 CEST 2006 Rob Richards rrichards@ctindustries.net
* HTMLtree.c xmlsave.c: Add linefeeds to error messages allowing - for consistant handling. + for consistent handling.
Tue Aug 15 15:02:18 CEST 2006 Kasimier Buchcik libxml2-cvs@cazic.net
@@ -1857,7 +1857,7 @@ Mon Jun 26 16:22:50 CEST 2006 Kasimier Buchcik libxml2-cvs@cazic.net initialized to zero here; this could lead to the activation of the axis rewrite code in xmlXPathNodeCollectAndTest() when @rewriteType is randomly set to the value 1. A test - (hardcoding the intial value to 1) revealed that the + (hardcoding the initial value to 1) revealed that the resulting incorrect behaviour is similar to the behaviour as described by Arnold Hendriks on the mailing list; so I hope that will fix the issue. @@ -1912,7 +1912,7 @@ Fri Jun 16 21:37:44 CEST 2006 Kasimier Buchcik libxml2-cvs@cazic.net for my custom handling of ns-references in my DOM wrapper. Substituted code which created the XML namespace decl on the doc for a call to xmlTreeEnsureXMLDecl(). Removed - those nastly "warnigns" from the docs of the clone/adopt + those nasty "warnings" from the docs of the clone/adopt functions; they work fine on my side. Mon Jun 12 13:23:11 CEST 2006 Kasimier Buchcik libxml2-cvs@cazic.net @@ -2033,7 +2033,7 @@ Tue May 30 11:21:34 CEST 2006 Kasimier Buchcik libxml2-cvs@cazic.net Mon May 29 18:06:17 CEST 2006 Kasimier Buchcik libxml2-cvs@cazic.net
* xpath.c include/libxml/xpath.h: Added an XPath object cache. - It sits on an xmlXPathContext and need to be explicitely + It sits on an xmlXPathContext and need to be explicitly activated (or deactivated again) with xmlXPathContextSetObjectCache(). The cache consists of 5 lists for node-set, string, number, boolean and misc XPath @@ -2052,7 +2052,7 @@ Wed May 24 10:54:25 CEST 2006 Kasimier Buchcik libxml2-cvs@cazic.net
* xpath.c: Removed a memcpy if xmlXPathNodeSetMerge(); it seems we really need to walk the whole list, since those - nastly namespace nodes need to be added with + nasty namespace nodes need to be added with xmlXPathNodeSetDupNs(); thus a pure memcpy is not possible. A flag on the node-set indicating if namespace nodes are in the set would help here; this is the 3rd flag which would @@ -2063,7 +2063,7 @@ Wed May 24 10:54:25 CEST 2006 Kasimier Buchcik libxml2-cvs@cazic.net 2) Of what type are the nodes in the set (or of mixed type)? This would allow for faster merging of node-sets. 3) Are namespace nodes in the set? - This would allow to skipp all the namespace node specific + This would allow to skip all the namespace node specific special handling. Faster node-set merging if the first set is empty; just memcpy the set.
@@ -2485,7 +2485,7 @@ Mon Jan 9 15:33:16 CET 2006 Daniel Veillard daniel@veillard.com
Thu Jan 5 16:25:06 CET 2006 Daniel Veillard daniel@veillard.com
- * NEWS configure.in libxml.spec.in testapi.c doc/*: upated the news + * NEWS configure.in libxml.spec.in testapi.c doc/*: updated the news regenerated the docs, preparing for release of 2.6.23 * pattern.c xmlschemas.c: fixed some comments @@ -2520,7 +2520,7 @@ Wed Jan 4 18:07:47 CET 2006 Daniel Veillard daniel@veillard.com Wed Jan 4 15:00:51 CET 2006 Daniel Veillard daniel@veillard.com
* SAX2.c: fix bug #324432 with xml:foo/ - * test/ns7 resul//ns7*: added to the regression tests + * test/ns7 result/ns7*: added to the regression tests
Wed Jan 4 10:53:56 CET 2006 Daniel Veillard daniel@veillard.com
@@ -2861,7 +2861,7 @@ Fri Oct 21 10:50:14 EDT 2005 Rob Richards rrichards@ctindustries.net
Wed Oct 19 16:53:47 BST 2005 Daniel Veillard daniel@veillard.com
- * xmlregexp.c: commiting a some fixes and debug done yesterday in + * xmlregexp.c: committing a some fixes and debug done yesterday in the London airport.
Thu Oct 20 12:54:23 CEST 2005 Kasimier Buchcik libxml2-cvs@cazic.net @@ -2932,7 +2932,7 @@ Fri Oct 14 16:21:22 CEST 2005 Kasimier Buchcik libxml2-cvs@cazic.net Allowed IDCs to resolve also to nodes of complex type with simple content. Added check for keyrefs with references to keyrefs. - IDC target-nodes were interferring with IDC node-tables, + IDC target-nodes were interfering with IDC node-tables, since they used one list of entries only. I separated this one big list into 3 lists: 1 for IDC node-table entries, 1 for _duplicates_ of IDC node-table entries and 1 for @@ -3053,7 +3053,7 @@ Mon Sep 12 21:00:53 CEST 2005 Kasimier Buchcik libxml2-cvs@cazic.net * xmlschemas.c include/libxml/schemasInternals.h include/libxml/xmlerror.h: Completion of the schema graph. Centralisation, more robustness of the schema document - aquisition story. Centralised and restructured component fixup. + acquisition story. Centralised and restructured component fixup. Fixed attribute derivation when 'prohibiting' attribute uses. Added warnings: when schema documents cannot be localized during imports; when we get duplicate and pointless attribute @@ -3385,7 +3385,7 @@ Wed Aug 10 18:21:41 CEST 2005 Daniel Veillard daniel@veillard.com list values. * test/relaxng/307377* result/relaxng/307377* Makefile.am runtest.c: added examples to the regression tests, problem is that streaming - version gives slightly more informations. + version gives slightly more information.
Wed Aug 10 15:25:53 CEST 2005 Daniel Veillard daniel@veillard.com
@@ -3398,7 +3398,7 @@ Wed Aug 10 11:59:46 CEST 2005 Kasimier Buchcik libxml2-cvs@cazic.net Tue Aug 9 23:37:22 CEST 2005 Daniel Veillard daniel@veillard.com
* xmlregexp.c: fixed a determinism detection problem exposed by - ##other tests commited by Kasimier, also added a small speedup + ##other tests committed by Kasimier, also added a small speedup of determinism detection. * test/results/any6_2_0* any8_1_0* any7_1_2* any7_2_2*: added the results to the regression tests now @@ -3424,7 +3424,7 @@ Tue Aug 9 13:07:27 CEST 2005 Daniel Veillard daniel@veillard.com * result/schemas/any7* test/schemas/any7: completed the tests and added the results * result/schemas/any3_0_0.err result/schemas/any5_0_0.err - result/schemas/any5_1_0.err: this slightly chnages the output + result/schemas/any5_1_0.err: this slightly changes the output from 3 existing tests
Mon Aug 8 22:33:08 CEST 2005 Daniel Veillard daniel@veillard.com @@ -3468,7 +3468,7 @@ Mon Aug 8 01:41:53 CEST 2005 Daniel Veillard daniel@veillard.com
Sun Aug 7 12:39:35 CEST 2005 Daniel Veillard daniel@veillard.com
- * test/relaxng/docbook_0.xml: get rid of the dependancy on a locally + * test/relaxng/docbook_0.xml: get rid of the dependency on a locally installed DTD * uri.c include/libxml/uri.h xmlIO.c nanoftp.c nanohttp.c: try to cleanup the Path/URI conversion mess, needed fixing in various @@ -3522,7 +3522,7 @@ Sat Jul 30 17:26:58 EDT 2005 Daniel Veillard daniel@veillard.com
Sat Jul 30 17:08:07 EDT 2005 Daniel Veillard daniel@veillard.com
- * schematron.c xmllint.c include/libxml/schematron.h: commiting + * schematron.c xmllint.c include/libxml/schematron.h: committing work done on the plane last week-end
Sat Jul 30 15:16:29 CEST 2005 Daniel Veillard daniel@veillard.com @@ -4029,7 +4029,7 @@ Mon Jun 27 01:01:32 CEST 2005 Daniel Veillard daniel@veillard.com
Sun Jun 26 20:08:24 CEST 2005 Daniel Veillard daniel@veillard.com
- * include/libxml/valid.h valid.c: avoid name glob in agruments as + * include/libxml/valid.h valid.c: avoid name glob in arguments as it matches the glob() routine. * runtest.c Makefile.am: first steps toward a C regression test framework. @@ -4463,7 +4463,7 @@ Fri Apr 1 16:07:59 CEST 2005 Daniel Veillard daniel@veillard.com
* doc/apibuild.py doc/elfgcchack.xsl: revamped the elfgcchack.h format to cope with gcc4 change of aliasing allowed scopes, had - to add extra informations to doc/libxml2-api.xml to separate + to add extra information to doc/libxml2-api.xml to separate the header from the c module source. * *.c: updated all c library files to add a #define bottom_xxx and reimport elfgcchack.h thereafter, and a bit of cleanups. @@ -4955,9 +4955,9 @@ Fri Jan 28 18:37:18 CET 2005 Daniel Veillard daniel@veillard.com
Fri Jan 28 16:51:47 CET 2005 Kasimier Buchcik libxml2-cvs@cazic.net
- * xmlschemas.c: Corrected an ambigious symbol-space for + * xmlschemas.c: Corrected an ambiguous symbol-space for local attribute declarations. IFDEFed more IDC code to - surpress compiler warnings. + suppress compiler warnings.
Fri Jan 28 00:57:04 CET 2005 Daniel Veillard daniel@veillard.com
@@ -4978,7 +4978,7 @@ Thu Jan 27 13:39:04 CET 2005 Kasimier Buchcik libxml2-cvs@cazic.net Added an initial skeleton for indentity-constraints. This is all defined out, since not complete, plus it needs support from other modules. - Added machanism to store element information for the + Added mechanism to store element information for the ancestor-or-self axis; this is needed for identity-constraints and should be helpful for a future streamable validation. * include/libxml/xmlerror.h: Added an error code for @@ -5028,7 +5028,7 @@ Sun Jan 23 21:14:20 CET 2005 Daniel Veillard daniel@veillard.com
Sun Jan 23 18:35:00 CET 2005 Daniel Veillard daniel@veillard.com
- * parser.c: boosting common commnent parsing code, it was really + * parser.c: boosting common comment parsing code, it was really slow. * test/comment[3-5].xml result//comment[3-5].xml*: added sprecific regression tests @@ -5179,7 +5179,7 @@ Sat Jan 8 23:04:10 CET 2005 Daniel Veillard daniel@veillard.com Fri Jan 7 14:54:51 CET 2005 Daniel Veillard daniel@veillard.com
* TODO: small update - * xmlregexp.c: trying to add an API to get useful error informations + * xmlregexp.c: trying to add an API to get useful error information back from a failing regexp context.
Thu Jan 6 17:35:41 HKT 2005 William Brack wbrack@mmm.com.hk @@ -5280,7 +5280,7 @@ Sat Dec 25 18:10:02 HKT 2004 William Brack wbrack@mmm.com.hk Fri Dec 24 16:31:22 HKT 2004 William Brack wbrack@mmm.com.hk
- * python/generator.py: added most required entires to + * python/generator.py: added most required entries to foreign encoding table, plus some additional logic to assure only the 1st param uses the 't#' format. Fixes bug #152286, but may still have some other UTF-16 problems. @@ -5360,7 +5360,7 @@ Fri Nov 26 13:09:04 CET 2004 Kasimier Buchcik libxml2-cvs@cazic.net of elements for which a declaration existed were still processed by the wildcard mechanism (reported by philippe ventrillon to the mailing list). - Changed the import and include machanism to share dictionaries. + Changed the import and include mechanism to share dictionaries.
Fri Nov 26 11:44:36 CET 2004 Daniel Veillard daniel@veillard.com
@@ -5640,7 +5640,7 @@ Tue Nov 2 15:49:34 CET 2004 Daniel Veillard daniel@veillard.com * SAX2.c nanoftp.c parser.c parserInternals.c tree.c xmlIO.c xmlstring.c: various API hardeing changes as a result of running the first set of automatic API regression tests. - * test/slashdot16.xml: apparently missing from CVS, commited it + * test/slashdot16.xml: apparently missing from CVS, committed it
Mon Nov 1 15:54:18 CET 2004 Daniel Veillard daniel@veillard.com
@@ -5867,7 +5867,7 @@ Wed Sep 29 15:00:11 CEST 2004 Kasimier Buchcik libxml2-cvs@cazic.net model group "all". * test/schemas/bug152470_1.xsd: Removed an "abstract" attribute, which broke the test. - * xstc/xstc.py: Workaround to accomodate case insensitive + * xstc/xstc.py: Workaround to accommodate case insensitive test definitions in ms-test.def.xml (was missing in a previous commit).
@@ -5961,7 +5961,7 @@ Thu Sep 16 13:24:27 CEST 2004 Kasimier Buchcik libxml2-cvs@cazic.net
* xmlschemas.c include/libxml/schemasInternals.h test/schemas/bug152470_1.* result/schemas/bug152470_1_1*: - Simpified attribute wildcard creation and assignment to get rid + Simplified attribute wildcard creation and assignment to get rid of memory leaks. Restructured the validation process. Restructured and expanded parsing of <attributeGroup>. @@ -5978,7 +5978,7 @@ Thu Sep 16 13:24:27 CEST 2004 Kasimier Buchcik libxml2-cvs@cazic.net 'anyType' using the short-hand form (see bug # 152470, submitted by Thilo Jeremias). * include/libxml/xmlschematypes.h: Cleaned up some comments. - * xstc/xstc.py: Workaround to accomodate case insensitive + * xstc/xstc.py: Workaround to accommodate case insensitive test definitions in ms-test.def.xml. * result/schemas/deter0_0_0.err result/schemas/ns0_0_2.err result/schemas/ns0_1_2.err: Adapted. @@ -6321,7 +6321,7 @@ Sat Aug 14 13:18:57 CEST 2004 Daniel Veillard daniel@veillard.com to document xmlSchemasSetValidErrors() limitations, #141827 * error.c: Add information in generic and structured error setter functions that this need to be done per thread #144308 - * xmlsave.c: fixed bug whith missing NOTATION(s) serialization + * xmlsave.c: fixed bug with missing NOTATION(s) serialization bug #144162 * doc/xmllint.xml: typo fix #144840
@@ -6691,7 +6691,7 @@ Tue Jun 8 21:27:03 HKT 2004 William Brack wbrack@mmm.com.hk Tue Jun 8 14:01:14 CEST 2004 Daniel Veillard daniel@veillard.com
* parser.c xmlreader.c include/libxml/parser.h: fixed a serious - problem when substituing entities using the Reader, the entities + problem when substituting entities using the Reader, the entities content might be freed and if rereferenced would crash * Makefile.am test/* result/*: added a new test case and a new test operation for the reader with substitution of entities. @@ -6847,7 +6847,7 @@ Sun May 16 03:06:31 CEST 2004 Daniel Veillard daniel@veillard.com Sat May 15 20:14:21 CEST 2004 Daniel Veillard daniel@veillard.com
* doc/ChangeLog.awk doc/ChangeLog.xsl: first steps of a good - ChangeLog page generation. The awk shoudl escape characters + ChangeLog page generation. The awk should escape characters not okay in XML and the xslt should make links to functions or variables or bug reported in the entries.
@@ -7049,7 +7049,7 @@ Sun Apr 18 23:45:46 CEST 2004 Daniel Veillard daniel@veillard.com
Sun Apr 18 22:51:43 CEST 2004 Daniel Veillard daniel@veillard.com
- * xpath.c: relaxed id() to not check taht the name(s) passed + * xpath.c: relaxed id() to not check that the name(s) passed are actually NCName, decided this in agreement with Aleksey Sanin since existing specs like Visa3D broke that conformance checking and other tools seems to not implement it sigh... @@ -7062,7 +7062,7 @@ Sun Apr 18 21:46:17 CEST 2004 Daniel Veillard daniel@veillard.com * xpath.c: work around Microsoft compiler NaN bug raise reported by Mark Vakoc * xmlschemas.c include/libxml/schemasInternals.h - include/libxml/xmlerror.h: fixed a recusive extention schemas + include/libxml/xmlerror.h: fixed a recursive extension schemas compilation error raised by taihei goi
Sun Apr 18 16:57:02 CEST 2004 Daniel Veillard daniel@veillard.com @@ -7228,7 +7228,7 @@ Tue Mar 23 12:35:08 CET 2004 Daniel Veillard daniel@veillard.com
* configure.in doc/* News: preparing 2.6.8 release, updated and rebuilt the docs. - * Makefile.am: use valgring fro the new Python based regression tests + * Makefile.am: use valgring for the new Python based regression tests
Mon Mar 22 20:07:27 CET 2004 Daniel Veillard daniel@veillard.com
@@ -7292,7 +7292,7 @@ Wed Mar 10 17:22:48 CET 2004 Daniel Veillard daniel@veillard.com
Wed Mar 10 19:42:22 HKT 2004 William Brack wbrack@mmm.com.hk
- * doc/search.php: Minor change for later verson of php requiring + * doc/search.php: Minor change for later version of php requiring $HTTP_GET_VARS.
Wed Mar 10 00:12:31 HKT 2004 William Brack wbrack@mmm.com.hk @@ -7361,8 +7361,8 @@ Thu Mar 4 15:00:45 CET 2004 Daniel Veillard daniel@veillard.com
Thu Mar 4 14:39:38 CET 2004 Daniel Veillard daniel@veillard.com
- * Makefile.am tree.c xmlsave.c include/libxml/xmlsave.h: commiting - the new xmlsave module before the actuall big code change. + * Makefile.am tree.c xmlsave.c include/libxml/xmlsave.h: committing + the new xmlsave module before the actual big code change.
Thu Mar 4 12:38:53 CET 2004 Daniel Veillard daniel@veillard.com
@@ -7872,7 +7872,7 @@ Mon Jan 5 20:47:07 MST 2004 John Fleck jfleck@inkstain.net
Tue Jan 6 00:10:33 CET 2004 Daniel Veillard daniel@veillard.com
- * rngparser.c: commiting the compact relax ng parser. It's not + * rngparser.c: committing the compact relax ng parser. It's not completely finished, it's not integrated but I want to save the current state
@@ -8026,7 +8026,7 @@ Wed Dec 24 00:29:30 CET 2003 Daniel Veillard daniel@veillard.com Tue Dec 23 15:14:37 HKT 2003 William Brack wbrack@mmm.com.hk
* valid.c: fixed bug concerning validation using external - dtd of element with mutiple namespace declarations + dtd of element with multiple namespace declarations (Bug 129821)
Tue Dec 23 11:41:42 HKT 2003 William Brack wbrack@mmm.com.hk @@ -8407,7 +8407,7 @@ Thu Nov 20 12:54:30 CET 2003 Daniel Veillard daniel@veillard.com * doc/examples/*: added his test as the xmlWriter example * doc/html/ doc/*.html: this resulted in some improvements * include/libxml/hash.h: fixed an inclusion problem when - <libxml/hash.h> wasn't preceeded by <xml/parser.h> + <libxml/hash.h> wasn't preceded by <xml/parser.h>
Wed Nov 19 17:19:35 CET 2003 Daniel Veillard daniel@veillard.com
@@ -8430,7 +8430,7 @@ Wed Nov 19 00:48:56 CET 2003 Daniel Veillard daniel@veillard.com Tue Nov 18 21:51:15 CET 2003 Daniel Veillard daniel@veillard.com
* include/libxml/*.h include/libxml/*.h.in: modified the file - header to add more informations, painful... + header to add more information, painful... * genChRanges.py genUnicode.py: updated to generate said changes in headers * doc/apibuild.py: extract headers, add them to libxml2-api.xml @@ -8572,7 +8572,7 @@ Wed Nov 12 01:38:16 CET 2003 Daniel Veillard daniel@veillard.com added autogeneration of a web page for the examples * doc/examples/example1.c doc/examples/.cvsignore doc/examples/examples.xml doc/examples/index.py: updated the - informations extracted, improved the format and indexing. + information extracted, improved the format and indexing.
Tue Nov 11 22:08:59 CET 2003 Daniel Veillard daniel@veillard.com
@@ -8774,7 +8774,7 @@ Tue Oct 28 16:42:16 CET 2003 Daniel Veillard daniel@veillard.com * error.c valid.c include/libxml/xmlerror.h: fixing bug #125653 sometimes the error handlers can get a parser context on DTD errors, and sometime they don't. So be very careful when trying - to grab those informations. + to grab those information.
Tue Oct 28 15:26:18 CET 2003 Daniel Veillard daniel@veillard.com
@@ -8884,7 +8884,7 @@ Mon Oct 20 19:02:53 CEST 2003 Daniel Veillard daniel@veillard.com * python/tests/Makefile.am python/tests/reader7.py python/tests/walker.py: adding regression testing for the new xmlreader APIs, new APIs for reader creation, including - makeing reader "walker" operating on preparsed document trees. + making reader "walker" operating on preparsed document trees.
Sun Oct 20 22:37:03 HKT 2003 William Brack wbrack@mmm.com.hk
@@ -9084,7 +9084,7 @@ Fri Oct 10 16:45:20 CEST 2003 Daniel Veillard daniel@veillard.com Fri Oct 10 16:19:17 CEST 2003 Daniel Veillard daniel@veillard.com
* include/libxml/tree.h: make room in Doc, Element, Attributes - for PSVI type informations. + for PSVI type information.
Fri Oct 10 16:08:02 CEST 2003 Daniel Veillard daniel@veillard.com
@@ -9251,7 +9251,7 @@ Fri Oct 3 00:19:02 CEST 2003 Daniel Veillard daniel@veillard.com scrolling to see where thing broke wasn't pleasant * configure.in: some beta4 preparation, but not ready yet * error.c globals.c include/libxml/globals.h include/libxml/xmlerror.h: - new error handling code, last error informations are stored + new error handling code, last error information are stored in the parsing context or a global variable, new APIs to handle the xmlErrorPtr type. * parser.c parserInternals.c valid.c : started migrating to the @@ -9261,7 +9261,7 @@ Fri Oct 3 00:19:02 CEST 2003 Daniel Veillard daniel@veillard.com * parser.c: small potential buffer access problem in push code provided by Justin Fletcher * result/*.sax result/VC/PENesting* result/namespaces/* - result/valid/*.err: some error messages were sligthly changed. + result/valid/*.err: some error messages were slightly changed.
Thu Oct 2 13:01:13 2003 Aleksey Sanin aleksey@aleksey.com
@@ -9369,7 +9369,7 @@ Sun Sep 28 02:15:07 CEST 2003 Daniel Veillard daniel@veillard.com * include/libxml/SAX.h include/libxml/parser.h: move the SAXv1 block definitions to parser.h fixes bug #123380 * xmlreader.c include/libxml/xmlreader.h: reinstanciate - the attribute and element pool borken 2 commits ago. + the attribute and element pool broken 2 commits ago. Start playing with an entry point to preserve a subtree. * entities.c: remove a warning.
@@ -9436,7 +9436,7 @@ Thu Sep 25 16:23:58 CEST 2003 Daniel Veillard daniel@veillard.com include/libxml/globals.h include/libxml/SAX.h: make sure the global variables for the default SAX handler are V1 ones to avoid ABI compat problems. - * xmlreader.c: cleanup of uneeded code + * xmlreader.c: cleanup of unneeded code * hash.c: fix a comment
Thu Sep 25 14:16:51 CEST 2003 Daniel Veillard daniel@veillard.com @@ -9734,7 +9734,7 @@ Sun Sep 7 11:11:45 CEST 2003 Daniel Veillard daniel@veillard.com * dict.c: allow to give -1 for undefined length in lookups * include/libxml/parser.h parser.c parserInternals.c testSAX.c: first round of work on the new SAX2 interfaces, the API - will change but commiting before changing for historical + will change but committing before changing for historical reference.
Sat Sep 6 10:55:01 PTD 2003 William Brack wbrack@mmm.com.hk @@ -10091,7 +10091,7 @@ Thu Aug 7 21:13:22 HKT 2003 William Brack wbrack@mmm.com.hk Wed Aug 6 12:32:11 HKT 2003 William Brack wbrack@mmm.com.hk
* error.c trionan.[ch] testThreads.c python/generator.py: - further small changes to elminate most of the remaining + further small changes to eliminate most of the remaining warnings.
Tue Aug 5 23:51:21 HKT 2003 William Brack wbrack@mmm.com.hk @@ -10130,7 +10130,7 @@ Sun Aug 3 21:02:30 EDT 2003 Daniel Veillard daniel@veillard.com * valid.c: fixed another problem with namespaces on element in mixed content case * python/tests/reader2.py: updated the testcase with - Bjorn Reese fix to reader for unsignificant white space + Bjorn Reese fix to reader for insignificant white space * parser.c HTMLparser.c: cleanup.
Sun Aug 3 20:55:40 EDT 2003 Daniel Veillard daniel@veillard.com @@ -10151,7 +10151,7 @@ Sun Aug 3 18:56:54 EDT 2003 Daniel Veillard daniel@veillard.com Fri Aug 1 23:55:23 HKT 2003 William Brack wbrack@mmm.com.hk
Coninuing work on bug 118559 - * DOCBparser.c: removed 2 unsed vars + * DOCBparser.c: removed 2 unused vars * xmlregexp.c: changed some numeric const to their enum symbols * xmlreader.c: changed one var define from int to enum (a little more to be done, awaiting co-ordination) @@ -10318,7 +10318,7 @@ Thu Jul 10 16:02:47 CEST 2003 Daniel Veillard daniel@veillard.com
Tue Jul 8 16:02:19 CEST 2003 Daniel Veillard daniel@veillard.com
- * globals.c threads.c: fixes some problem when freeing unititialized + * globals.c threads.c: fixes some problem when freeing uninitialized mutexes
Tue Jul 8 14:15:07 CEST 2003 Daniel Veillard daniel@veillard.com @@ -10373,7 +10373,7 @@ Sat Jul 5 22:30:25 CEST 2003 Daniel Veillard daniel@veillard.com Sat Jul 5 00:51:30 HKT 2003 William Brack wbrack@mmm.com.hk
Fixed problem with multi-threading, shown by the test program - testThreads. After fix, ran mutiple tests on various speed + testThreads. After fix, ran multiple tests on various speed machines (single and dual processor X86), which all seem okay.
* catalog.c: added missing xmlRMutexUnlock in xmlLoadCatalog @@ -10451,7 +10451,7 @@ Thu Jun 5 11:31:02 CEST 2003 Daniel Veillard daniel@veillard.com
Mon Jun 2 21:56:15 MVT 2003 Daniel Veillard daniel@veillard.com
- * relaxng.c xmlschemas.c include/libxml/schemasInternals.h: commiting + * relaxng.c xmlschemas.c include/libxml/schemasInternals.h: committing some work done while in the Maldives (hence the timezone on the laptop !) * result/schemas/length3* test/schemas/deter0_* @@ -11398,7 +11398,7 @@ Wed Feb 19 14:26:51 CET 2003 Daniel Veillard daniel@veillard.com
Wed Feb 19 01:17:48 CET 2003 Daniel Veillard daniel@veillard.com
- * relaxng.c: guess what ! Relax-NG bugfixing, what a surprize... + * relaxng.c: guess what ! Relax-NG bugfixing, what a surprise...
Tue Feb 18 22:09:50 CET 2003 Daniel Veillard daniel@veillard.com
@@ -11929,10 +11929,10 @@ Mon Jan 6 14:06:07 CET 2003 Daniel Veillard daniel@veillard.com
* configure.in NEWS: preparing 2.5.0 release * SAX.c: only warn in pedantic mode about namespace name - brokeness + brokenness * globals.c: fix a doc generation problem * uri.c: fix #101520 - * doc/*: updated and rebuilt the doc for the release, includuding + * doc/*: updated and rebuilt the doc for the release, including stylesheet update * python/Makefile.am: fix a filename bug
@@ -12092,7 +12092,7 @@ Sun Dec 29 12:13:18 CET 2002 Daniel Veillard daniel@veillard.com Sat Dec 28 23:49:12 CET 2002 Daniel Veillard daniel@veillard.com
* xmlreader.c include/libxml/xmlreader.h doc/libxml2-api.xml: - extended the XmlTextReader API a bit, addding accessors for + extended the XmlTextReader API a bit, adding accessors for the current doc and node, and an entity substitution mode for the parser. * python/libxml.py python/libxml2class.txt: related updates @@ -12479,7 +12479,7 @@ Sun Nov 17 10:25:43 CET 2002 Daniel Veillard daniel@veillard.com
Sat Nov 16 16:30:25 CET 2002 Daniel Veillard daniel@veillard.com
- * parser.c xpath.c: fixing #96925 wich was also dependent on the + * parser.c xpath.c: fixing #96925 which was also dependent on the processing of parsed entities, and XPath computation on sustitued entities. * testXPath.c: make sure entities are substituted. @@ -12715,7 +12715,7 @@ Wed Oct 16 16:05:38 CEST 2002 Daniel Veillard daniel@veillard.com
Tue Oct 15 12:41:01 CEST 2002 Daniel Veillard daniel@veillard.com
- * README: updated the contact informations + * README: updated the contact information
Tue Oct 15 10:35:57 CEST 2002 Daniel Veillard daniel@veillard.com
@@ -13009,7 +13009,7 @@ Thu Sep 5 13:10:57 CEST 2002 Daniel Veillard daniel@veillard.com
Thu Sep 5 12:57:38 CEST 2002 Daniel Veillard daniel@veillard.com
- * valid.c: try to provide file and line informations, not all + * valid.c: try to provide file and line information, not all messages are covered, but it's a (good) start
Thu Sep 5 12:49:35 CEST 2002 Daniel Veillard daniel@veillard.com @@ -13060,7 +13060,7 @@ Wed Aug 28 13:44:54 CEST 2002 Daniel Veillard daniel@veillard.com
Sun Aug 25 16:38:05 CEST 2002 Daniel Veillard daniel@veillard.com
- * xmlIO.c: handle Windows sepecific file://localhost/ semantic ... + * xmlIO.c: handle Windows specific file://localhost/ semantic ...
Thu Aug 22 22:03:19 CEST 2002 Daniel Veillard daniel@veillard.com
@@ -13394,7 +13394,7 @@ Mon Jun 03 00:04:21 2002 Chema Celorio chema@ximian.com
* tree.h: added xmlDocFormatDump which is just as xmlDocDump but with the format parameter - * tree.c: made xmlDocDump a wrapper arround xmlDocFormatDump + * tree.c: made xmlDocDump a wrapper around xmlDocFormatDump
Fri May 31 12:16:48 2002 Aleksey Sanin aleksey@aleksey.com
@@ -13499,13 +13499,13 @@ Wed May 15 00:25:34 CEST 2002 Igor Zlatkovic igor@stud.fh-frankfurt.de
Tue May 14 13:00:48 CEST 2002 Daniel Veillard daniel@veillard.com
- * xpath.c: fixing an XPath function evalutation bug pointed out + * xpath.c: fixing an XPath function evaluation bug pointed out by Alexey Efimov where the context was lost when evaluating the function arguments
Mon 13 May 2002 11:37:39 PM PDT Aleksey Sanin aleksey@aleksey.com
- * xpath.c include/libxml/xpathInternals.h: maked xmlXPathNodeSetAddNs() + * xpath.c include/libxml/xpathInternals.h: made xmlXPathNodeSetAddNs() function public for XMLSec performance optimizations
Mon May 13 12:32:22 CEST 2002 Daniel Veillard daniel@veillard.com @@ -13542,7 +13542,7 @@ Wed 01 May 2002 11:29:27 AM PDT Aleksey Sanin aleksey@aleksey.com * include/libxml/xmlIO.h win32/dsp/libxml2.def.src win32/libxml2.def.src xmlIO.c: exported default 'file:', 'http:' and 'ftp:' protocols input handlers - and maked protocols comparisson case insensitive + and made protocols comparison case insensitive
Tue Apr 30 16:29:05 CEST 2002 Daniel Veillard daniel@veillard.com
@@ -13999,7 +13999,7 @@ Mon Mar 11 10:10:30 CET 2002 Daniel Veillard daniel@veillard.com Sun Mar 10 17:47:58 CET 2002 Daniel Veillard daniel@veillard.com
* valid.c: applied patch from Dodji Seketeli fixing an - uninitailized variable in xmlValidGetValidElements() + uninitialized variable in xmlValidGetValidElements()
Sat Mar 9 15:10:49 CET 2002 Daniel Veillard daniel@veillard.com
@@ -14139,12 +14139,12 @@ Fri Mar 1 17:12:15 CET 2002 Daniel Veillard daniel@veillard.com
Fri Mar 1 13:56:12 CET 2002 Daniel Veillard daniel@veillard.com
- * python/*: commiting some Python bindings work done while travelling + * python/*: committing some Python bindings work done while travelling
Fri Mar 1 10:11:15 CET 2002 Daniel Veillard daniel@veillard.com
* xmllint.c: close #72663 and #72658, don't memdump unless compiled - explicitely with memory debugging switched on + explicitly with memory debugging switched on
Sat Feb 23 11:08:09 CET 2002 Daniel Veillard daniel@veillard.com
@@ -14496,7 +14496,7 @@ Sat Feb 2 11:25:51 CET 2002 Daniel Veillard daniel@veillard.com Sat Feb 2 10:13:52 CET 2002 Daniel Veillard daniel@veillard.com
* configure.in libxml.spec.in python/Makefile.am python/TODO - python/generator.py python/libxml2class.txt: added more informations + python/generator.py python/libxml2class.txt: added more information in the libxml2-python package including docs. Slightly changed the class hierarchy * python/tests/*: added basic regression tests infrastructure too @@ -14543,7 +14543,7 @@ Wed Jan 30 21:51:26 CET 2002 Daniel Veillard daniel@veillard.com Wed Jan 30 17:35:33 CET 2002 Daniel Veillard daniel@veillard.com
* python/generator.py python/libxml.c python/libxml.py - python/libxml_wrap.h: commited early version of a python binding + python/libxml_wrap.h: committed early version of a python binding for private use only ATM
Sat Jan 26 22:41:13 CET 2002 Daniel Veillard daniel@veillard.com @@ -15441,7 +15441,7 @@ Thu Sep 20 15:54:29 CEST 2001 Daniel Veillard daniel@veillard.com Wed Sep 19 10:01:37 CEST 2001 Daniel Veillard daniel@veillard.com
* Makefile.am libxml.spec.in: backing up non-documented changes - commited without review or aproval by Jens Finke jens@gnome.org + committed without review or approval by Jens Finke jens@gnome.org * HACKING: made 100% clear that no commit should be done directly
Mon Sep 17 18:52:37 CEST 2001 Daniel Veillard daniel@veillard.com @@ -15586,7 +15586,7 @@ Sat Aug 25 15:30:17 CEST 2001 Daniel Veillard daniel@veillard.com Thu Aug 23 23:16:32 CEST 2001 Daniel Veillard daniel@veillard.com
* catalog.c xmlIO.c: started some serious testing and fixed - a few bug and optmization needs. + a few bug and optimization needs.
Thu Aug 23 17:26:58 CEST 2001 Daniel Veillard daniel@veillard.com
@@ -15874,7 +15874,7 @@ Tue Jul 24 15:39:11 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr this slightly * include/libxml/parser.h SAX.c parser.c parserInternals.c xmllint.c: make element content line number generation - optionnal to avoid breaking old apps added interface to switch + optional to avoid breaking old apps added interface to switch
Tue Jul 24 15:06:58 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr
@@ -16543,7 +16543,7 @@ Sun May 20 15:15:46 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr
Sat May 19 17:11:15 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr
- * doc/xml.html: update with 2.3.9 informations + * doc/xml.html: update with 2.3.9 information
Sat May 19 16:50:47 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr
@@ -16738,7 +16738,7 @@ Sat Apr 28 18:54:28 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr Sat Apr 28 16:33:05 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr
* xpath.c: simple and efficient optimization, XPath functions - aways bind to the same code, cache this + always bind to the same code, cache this * TODO: updated (by saying some is obsolete)
Sat Apr 28 14:23:30 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr @@ -16977,7 +16977,7 @@ Thu Apr 12 10:50:34 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr Wed Apr 11 16:37:50 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr
* tree.h: include xmlmemory.h this seems to havoid a nasty glibc - bug where the linktime verions of free() won't work ... + bug where the linktime versions of free() won't work ...
Wed Apr 11 14:21:31 CEST 2001 Daniel Veillard Daniel.Veillard@imag.fr
@@ -17376,7 +17376,7 @@ Thu Feb 15 15:57:14 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr Wed Feb 14 11:35:39 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr
* hash.[ch]: added Paolo Casarini patch to provide Delete from - hash functionnalities. + hash functionalities. * doc/html/* : rebuild the doc
Tue Feb 13 18:01:48 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr @@ -17514,7 +17514,7 @@ Thu Jan 25 13:34:11 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr
Wed Jan 24 20:27:28 COT 2001 Alejandro Forero bachue@bachue.com
- * xmlIO.c (xmlFileOpen, xmlFileOpenW): Removed unnecesary checks. + * xmlIO.c (xmlFileOpen, xmlFileOpenW): Removed unnecessary checks.
* xmlIO.c (xmlCheckFilename): Function added to know whether a given filename points to a valid file (not a directory). @@ -17551,7 +17551,7 @@ Mon Jan 22 10:35:40 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr of the data format with node set, as well as operators. * HTMLtree.c: added a newline at the end of the doctype output whe this one is not present initially. - * tree.c: make sure taht the parent and doc pointers are properly + * tree.c: make sure that the parent and doc pointers are properly set when copying attributes (lists).
Sun Jan 21 10:47:38 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr @@ -17613,7 +17613,7 @@ Sat Jan 6 22:05:09 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr
Sat Jan 6 19:13:27 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr
- * Makefile.am: applied patch fro make check from Martin Vidner + * Makefile.am: applied patch for make check from Martin Vidner
Thu Jan 4 19:07:49 CET 2001 Daniel Veillard Daniel.Veillard@imag.fr
@@ -17667,7 +17667,7 @@ Wed Dec 27 12:35:49 CET 2000 Daniel Veillard Daniel.Veillard@w3.org of xmllint too when using --memory flag, added a memory test suite at the Makefile level. * xpathInternals.h xpath.[ch] xpointer.c: fixed problems - with namespace use when encountering QNames in XPath evalation, + with namespace use when encountering QNames in XPath evaluation, added xmlns() scheme in XPointer. * nanoftp.c : incorporated a fix * parser.c xmlIO.c: fixed problems raised with encoding when using @@ -17892,7 +17892,7 @@ Sun Oct 22 13:59:50 CEST 2000 Daniel Veillard Daniel.Veillard@w3.org * valid.c: handling of blank nodes in DTd validation (raised by problems with a posteriori validation). * nanohttp.c: changing behaviour on HTTP write stuff. - * HTMLtree.c: forced body and html to be explicitely closed. + * HTMLtree.c: forced body and html to be explicitly closed. * xpath.h: exported more XPath functions.
Sun Oct 15 22:28:32 CEST 2000 Daniel Veillard Daniel.Veillard@w3.org @@ -18037,7 +18037,7 @@ Fri Oct 6 12:58:04 CEST 2000 Daniel Veillard Daniel.Veillard@w3.org
Thu Oct 5 18:13:15 CEST 2000 Daniel Veillard Daniel.Veillard@w3.org
- * debugXML.c testXPath.c xpath.[ch]: got pissed by some nastyness + * debugXML.c testXPath.c xpath.[ch]: got pissed by some nastiness in the XPath engine, rewrote large parts of it, now it's far cleaner and in sync with the REC not an old WD. Fixed a parsing problem in the interactive XML shell found when testing XPath. @@ -18895,7 +18895,7 @@ Tue Dec 21 14:29:34 CET 1999 Daniel Veillard Daniel.Veillard@w3.org * result/HTML/*.htm*: Updated the HTML examples regression tests output * SAX.c tree.c: fixed bug on defaulting namespaces on attributes * debugXML.c: fixed a bug on printing default namespaces. - * HTMLtree.c: fixed a problem when outputing XML parsed docs as HTML + * HTMLtree.c: fixed a problem when outputting XML parsed docs as HTML
Mon Dec 20 16:20:55 CET 1999 Daniel Veillard Daniel.Veillard@w3.org
@@ -18922,7 +18922,7 @@ Sat Dec 18 16:07:03 CET 1999 Daniel Veillard Daniel.Veillard@w3.org Thu Dec 16 16:19:29 CET 1999 Daniel Veillard Daniel.Veillard@w3.org
* tree.c: fixed a bug introduced in 1.8.0 and breaking default - namespace recognition, and Dia as a resul :-( + namespace recognition, and Dia as a result :-( * encoding.c: closed bug #3950
Wed Dec 15 19:22:23 CET 1999 Daniel Veillard Daniel.Veillard@w3.org @@ -18952,7 +18952,7 @@ Sun Dec 12 13:08:15 CET 1999 Daniel Veillard Daniel.Veillard@w3.org buffers instead, this was really needed, validation was breaking in strange ways due to that. Added xmlParseStringPEReference() and other parsing from strings functions. Entities processing - modified again, but PERef are still not handled correcly but + modified again, but PERef are still not handled correctly but unless you're Eve Maller you won't notice :-) * HTMLparser.c: large changes toward reliability, and switched to lowercase internal tags, XHTML is lowercase, so it will help @@ -19042,8 +19042,8 @@ Mon Oct 25 12:13:25 CEST 1999 Daniel Veillard Daniel.Veillard@w3.org a new release out * HTMLparser.c: fixed auto-close bugs on list items, zeroing some structures, comments before and after the - main element, and other nastyness - * HTMLtree.c tree.c: accomodate the extended HTML supported + main element, and other nastiness + * HTMLtree.c tree.c: accommodate the extended HTML supported * configure.in: pushing 1.7.4 * test/ent8 and related outputs : added a new test for bug #2784 * test/HTML/wired.html and related output: a nasty HTML example @@ -19450,7 +19450,7 @@ Sun Jan 31 22:06:48 CET 1999 Daniel Veillard Daniel.Veillard@w3.org
* valid.[ch], tree.c, parser.c : more work toward full parsing of XML DTDs. - * README: added informations about mailing-list and on-line + * README: added information about mailing-list and on-line documentation
1999-01-27 Raja R Harinath harinath@cs.umn.edu @@ -19535,7 +19535,7 @@ Thu Oct 29 00:48:45 EST 1998 Daniel Veillard Daniel.Veillard@w3.org
Wed Oct 28 17:56:35 EST 1998 Daniel Veillard Daniel.Veillard@w3.org
- * tree.[ch]: more cleanup on the API, made the tree mor conformant. + * tree.[ch]: more cleanup on the API, made the tree more conformant.
Tue Oct 27 17:54:00 EST 1998 Daniel Veillard Daniel.Veillard@w3.org
@@ -19594,7 +19594,7 @@ Sat Oct 17 02:43:21 EDT 1998 Daniel Veillard Daniel.Veillard@w3.org Tue Oct 13 21:46:57 EDT 1998 Daniel Veillard Daniel.Veillard@w3.org
* tree.h, tree.c, parser.c: added prev and doc pointers to Node, - and changed NODEs contants for conformity with DOM Level 1 + and changed NODEs constants for conformity with DOM Level 1
Wed Oct 7 23:42:46 EDT 1998 Daniel Veillard Daniel.Veillard@w3.org
@@ -19631,7 +19631,7 @@ Mon Sep 21 20:11:13 EDT 1998 Daniel Veillard Daniel.Veillard@w3.org
1998-08-20 Raja R Harinath harinath@cs.umn.edu
- * error.h: New file. Contains prototyes from `error.c'. + * error.h: New file. Contains prototypes from `error.c'.
Thu Aug 13 19:02:34 1998 Tom Tromey tromey@cygnus.com
@@ -19662,13 +19662,13 @@ Sun Jul 26 17:29:52 EDT 1998 Daniel Veillard Daniel.Veillard@w3.org Sun Jul 26 00:17:51 EDT 1998 Daniel Veillard Daniel.Veillard@w3.org
* configure.in: added test for CPP - * AUTHORS, Changelog: the original ones didn't get commited but the + * AUTHORS, Changelog: the original ones didn't get committed but the glib ones instead, fixed. * Makefile.am: corrected an error in library naming
Fri Jul 24 16:47:14 1998 Daniel Veillard Daniel.Veillard@w3.org
- * integrated code developped at W3C + * integrated code developed at W3C * changed the original Copyright * migrated to automake * prefixed the filenames by xml_ to avoid filename clashes diff --git a/sdk/lib/3rdparty/libxml2/HTMLparser.c b/sdk/lib/3rdparty/libxml2/HTMLparser.c index 7b6d68961c4..b56363a3a03 100644 --- a/sdk/lib/3rdparty/libxml2/HTMLparser.c +++ b/sdk/lib/3rdparty/libxml2/HTMLparser.c @@ -69,7 +69,7 @@ static void htmlParseComment(htmlParserCtxtPtr ctxt); /** * htmlErrMemory: * @ctxt: an HTML parser context - * @extra: extra informations + * @extra: extra information * * Handle a redefinition of attribute error */ @@ -296,7 +296,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
#define UPPER (toupper(*ctxt->input->cur))
-#define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val) +#define SKIP(val) ctxt->input->cur += (val),ctxt->input->col+=(val)
#define NXT(val) ctxt->input->cur[(val)]
@@ -330,7 +330,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt) if (*(ctxt->input->cur) == '\n') { \ ctxt->input->line++; ctxt->input->col = 1; \ } else ctxt->input->col++; \ - ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \ + ctxt->token = 0; ctxt->input->cur += l; \ } while (0)
/************ @@ -414,6 +414,10 @@ htmlFindEncoding(xmlParserCtxtPtr ctxt) {
static int htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { + const unsigned char *cur; + unsigned char c; + unsigned int val; + if (ctxt->instate == XML_PARSER_EOF) return(0);
@@ -421,99 +425,29 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { *len = 0; return(ctxt->token); } - if (ctxt->charset == XML_CHAR_ENCODING_UTF8) { - /* - * We are supposed to handle UTF8, check it's valid - * From rfc2044: encoding of the Unicode values on UTF-8: - * - * UCS-4 range (hex.) UTF-8 octet sequence (binary) - * 0000 0000-0000 007F 0xxxxxxx - * 0000 0080-0000 07FF 110xxxxx 10xxxxxx - * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx - * - * Check for the 0x110000 limit too - */ - const unsigned char *cur = ctxt->input->cur; - unsigned char c; - unsigned int val; - - c = *cur; - if (c & 0x80) { - if (cur[1] == 0) { - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - cur = ctxt->input->cur; - } - if ((cur[1] & 0xc0) != 0x80) - goto encoding_error; - if ((c & 0xe0) == 0xe0) { + if (ctxt->charset != XML_CHAR_ENCODING_UTF8) { + xmlChar * guess; + xmlCharEncodingHandlerPtr handler;
- if (cur[2] == 0) { - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - cur = ctxt->input->cur; - } - if ((cur[2] & 0xc0) != 0x80) - goto encoding_error; - if ((c & 0xf0) == 0xf0) { - if (cur[3] == 0) { - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - cur = ctxt->input->cur; - } - if (((c & 0xf8) != 0xf0) || - ((cur[3] & 0xc0) != 0x80)) - goto encoding_error; - /* 4-byte code */ - *len = 4; - val = (cur[0] & 0x7) << 18; - val |= (cur[1] & 0x3f) << 12; - val |= (cur[2] & 0x3f) << 6; - val |= cur[3] & 0x3f; - } else { - /* 3-byte code */ - *len = 3; - val = (cur[0] & 0xf) << 12; - val |= (cur[1] & 0x3f) << 6; - val |= cur[2] & 0x3f; - } - } else { - /* 2-byte code */ - *len = 2; - val = (cur[0] & 0x1f) << 6; - val |= cur[1] & 0x3f; - } - if (!IS_CHAR(val)) { - htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, - "Char 0x%X out of allowed range\n", val); - } - return(val); - } else { + /* + * Assume it's a fixed length encoding (1) with + * a compatible encoding for the ASCII set, since + * HTML constructs only use < 128 chars + */ + if ((int) *ctxt->input->cur < 0x80) { + *len = 1; if ((*ctxt->input->cur == 0) && (ctxt->input->cur < ctxt->input->end)) { - htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, - "Char 0x%X out of allowed range\n", 0); - *len = 1; + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Char 0x%X out of allowed range\n", 0); return(' '); } - /* 1-byte code */ - *len = 1; - return((int) *ctxt->input->cur); - } - } - /* - * Assume it's a fixed length encoding (1) with - * a compatible encoding for the ASCII set, since - * XML constructs only use < 128 chars - */ - *len = 1; - if ((int) *ctxt->input->cur < 0x80) - return((int) *ctxt->input->cur); - - /* - * Humm this is bad, do an automatic flow conversion - */ - { - xmlChar * guess; - xmlCharEncodingHandlerPtr handler; + return((int) *ctxt->input->cur); + }
+ /* + * Humm this is bad, do an automatic flow conversion + */ guess = htmlFindEncoding(ctxt); if (guess == NULL) { xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1); @@ -523,7 +457,12 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { ctxt->input->encoding = guess; handler = xmlFindCharEncodingHandler((const char *) guess); if (handler != NULL) { - xmlSwitchToEncoding(ctxt, handler); + /* + * Don't use UTF-8 encoder which isn't required and + * can produce invalid UTF-8. + */ + if (!xmlStrEqual(BAD_CAST handler->name, BAD_CAST "UTF-8")) + xmlSwitchToEncoding(ctxt, handler); } else { htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, "Unsupported encoding %s", guess, NULL); @@ -532,7 +471,86 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { ctxt->charset = XML_CHAR_ENCODING_UTF8; }
- return(xmlCurrentChar(ctxt, len)); + /* + * We are supposed to handle UTF8, check it's valid + * From rfc2044: encoding of the Unicode values on UTF-8: + * + * UCS-4 range (hex.) UTF-8 octet sequence (binary) + * 0000 0000-0000 007F 0xxxxxxx + * 0000 0080-0000 07FF 110xxxxx 10xxxxxx + * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx + * + * Check for the 0x110000 limit too + */ + cur = ctxt->input->cur; + c = *cur; + if (c & 0x80) { + if ((c & 0x40) == 0) + goto encoding_error; + if (cur[1] == 0) { + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + cur = ctxt->input->cur; + } + if ((cur[1] & 0xc0) != 0x80) + goto encoding_error; + if ((c & 0xe0) == 0xe0) { + + if (cur[2] == 0) { + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + cur = ctxt->input->cur; + } + if ((cur[2] & 0xc0) != 0x80) + goto encoding_error; + if ((c & 0xf0) == 0xf0) { + if (cur[3] == 0) { + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + cur = ctxt->input->cur; + } + if (((c & 0xf8) != 0xf0) || + ((cur[3] & 0xc0) != 0x80)) + goto encoding_error; + /* 4-byte code */ + *len = 4; + val = (cur[0] & 0x7) << 18; + val |= (cur[1] & 0x3f) << 12; + val |= (cur[2] & 0x3f) << 6; + val |= cur[3] & 0x3f; + if (val < 0x10000) + goto encoding_error; + } else { + /* 3-byte code */ + *len = 3; + val = (cur[0] & 0xf) << 12; + val |= (cur[1] & 0x3f) << 6; + val |= cur[2] & 0x3f; + if (val < 0x800) + goto encoding_error; + } + } else { + /* 2-byte code */ + *len = 2; + val = (cur[0] & 0x1f) << 6; + val |= cur[1] & 0x3f; + if (val < 0x80) + goto encoding_error; + } + if (!IS_CHAR(val)) { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Char 0x%X out of allowed range\n", val); + } + return(val); + } else { + if ((*ctxt->input->cur == 0) && + (ctxt->input->cur < ctxt->input->end)) { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Char 0x%X out of allowed range\n", 0); + *len = 1; + return(' '); + } + /* 1-byte code */ + *len = 1; + return((int) *ctxt->input->cur); + }
encoding_error: /* @@ -557,7 +575,16 @@ encoding_error: BAD_CAST buffer, NULL); }
- ctxt->charset = XML_CHAR_ENCODING_8859_1; + /* + * Don't switch encodings twice. Note that if there's an encoder, we + * shouldn't receive invalid UTF-8 anyway. + * + * Note that if ctxt->input->buf == NULL, switching encodings is + * impossible, see Gitlab issue #34. + */ + if ((ctxt->input->buf != NULL) && + (ctxt->input->buf->encoder == NULL)) + xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1); *len = 1; return((int) *ctxt->input->cur); } @@ -584,7 +611,6 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { ctxt->input->line++; ctxt->input->col = 1; } else ctxt->input->col++; ctxt->input->cur++; - ctxt->nbChars++; if (*ctxt->input->cur == 0) xmlParserInputGrow(ctxt->input, INPUT_CHUNK); } @@ -1046,102 +1072,266 @@ html40ElementTable[] = { } };
+typedef struct { + const char *oldTag; + const char *newTag; +} htmlStartCloseEntry; + /* * start tags that imply the end of current element */ -static const char * const htmlStartClose[] = { -"form", "form", "p", "hr", "h1", "h2", "h3", "h4", "h5", "h6", - "dl", "ul", "ol", "menu", "dir", "address", "pre", - "listing", "xmp", "head", NULL, -"head", "p", NULL, -"title", "p", NULL, -"body", "head", "style", "link", "title", "p", NULL, -"frameset", "head", "style", "link", "title", "p", NULL, -"li", "p", "h1", "h2", "h3", "h4", "h5", "h6", "dl", "address", - "pre", "listing", "xmp", "head", "li", NULL, -"hr", "p", "head", NULL, -"h1", "p", "head", NULL, -"h2", "p", "head", NULL, -"h3", "p", "head", NULL, -"h4", "p", "head", NULL, -"h5", "p", "head", NULL, -"h6", "p", "head", NULL, -"dir", "p", "head", NULL, -"address", "p", "head", "ul", NULL, -"pre", "p", "head", "ul", NULL, -"listing", "p", "head", NULL, -"xmp", "p", "head", NULL, -"blockquote", "p", "head", NULL, -"dl", "p", "dt", "menu", "dir", "address", "pre", "listing", - "xmp", "head", NULL, -"dt", "p", "menu", "dir", "address", "pre", "listing", "xmp", - "head", "dd", NULL, -"dd", "p", "menu", "dir", "address", "pre", "listing", "xmp", - "head", "dt", NULL, -"ul", "p", "head", "ol", "menu", "dir", "address", "pre", - "listing", "xmp", NULL, -"ol", "p", "head", "ul", NULL, -"menu", "p", "head", "ul", NULL, -"p", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", FONTSTYLE, NULL, -"div", "p", "head", NULL, -"noscript", "script", NULL, -"center", "font", "b", "i", "p", "head", NULL, -"a", "a", "head", NULL, -"caption", "p", NULL, -"colgroup", "caption", "colgroup", "col", "p", NULL, -"col", "caption", "col", "p", NULL, -"table", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", "pre", - "listing", "xmp", "a", NULL, -"th", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL, -"td", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL, -"tr", "th", "td", "tr", "caption", "col", "colgroup", "p", NULL, -"thead", "caption", "col", "colgroup", NULL, -"tfoot", "th", "td", "tr", "caption", "col", "colgroup", "thead", - "tbody", "p", NULL, -"tbody", "th", "td", "tr", "caption", "col", "colgroup", "thead", - "tfoot", "tbody", "p", NULL, -"optgroup", "option", NULL, -"option", "option", NULL, -"fieldset", "legend", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", - "pre", "listing", "xmp", "a", NULL, -/* most tags in in FONTSTYLE, PHRASE and SPECIAL should close <head> */ -"tt", "head", NULL, -"i", "head", NULL, -"b", "head", NULL, -"u", "head", NULL, -"s", "head", NULL, -"strike", "head", NULL, -"big", "head", NULL, -"small", "head", NULL, - -"em", "head", NULL, -"strong", "head", NULL, -"dfn", "head", NULL, -"code", "head", NULL, -"samp", "head", NULL, -"kbd", "head", NULL, -"var", "head", NULL, -"cite", "head", NULL, -"abbr", "head", NULL, -"acronym", "head", NULL, - -/* "a" */ -"img", "head", NULL, -/* "applet" */ -/* "embed" */ -/* "object" */ -"font", "head", NULL, -/* "basefont" */ -"br", "head", NULL, -/* "script" */ -"map", "head", NULL, -"q", "head", NULL, -"sub", "head", NULL, -"sup", "head", NULL, -"span", "head", NULL, -"bdo", "head", NULL, -"iframe", "head", NULL, -NULL +static const htmlStartCloseEntry htmlStartClose[] = { + { "a", "a" }, + { "a", "fieldset" }, + { "a", "table" }, + { "a", "td" }, + { "a", "th" }, + { "address", "dd" }, + { "address", "dl" }, + { "address", "dt" }, + { "address", "form" }, + { "address", "li" }, + { "address", "ul" }, + { "b", "center" }, + { "b", "p" }, + { "b", "td" }, + { "b", "th" }, + { "big", "p" }, + { "caption", "col" }, + { "caption", "colgroup" }, + { "caption", "tbody" }, + { "caption", "tfoot" }, + { "caption", "thead" }, + { "caption", "tr" }, + { "col", "col" }, + { "col", "colgroup" }, + { "col", "tbody" }, + { "col", "tfoot" }, + { "col", "thead" }, + { "col", "tr" }, + { "colgroup", "colgroup" }, + { "colgroup", "tbody" }, + { "colgroup", "tfoot" }, + { "colgroup", "thead" }, + { "colgroup", "tr" }, + { "dd", "dt" }, + { "dir", "dd" }, + { "dir", "dl" }, + { "dir", "dt" }, + { "dir", "form" }, + { "dir", "ul" }, + { "dl", "form" }, + { "dl", "li" }, + { "dt", "dd" }, + { "dt", "dl" }, + { "font", "center" }, + { "font", "td" }, + { "font", "th" }, + { "form", "form" }, + { "h1", "fieldset" }, + { "h1", "form" }, + { "h1", "li" }, + { "h1", "p" }, + { "h1", "table" }, + { "h2", "fieldset" }, + { "h2", "form" }, + { "h2", "li" }, + { "h2", "p" }, + { "h2", "table" }, + { "h3", "fieldset" }, + { "h3", "form" }, + { "h3", "li" }, + { "h3", "p" }, + { "h3", "table" }, + { "h4", "fieldset" }, + { "h4", "form" }, + { "h4", "li" }, + { "h4", "p" }, + { "h4", "table" }, + { "h5", "fieldset" }, + { "h5", "form" }, + { "h5", "li" }, + { "h5", "p" }, + { "h5", "table" }, + { "h6", "fieldset" }, + { "h6", "form" }, + { "h6", "li" }, + { "h6", "p" }, + { "h6", "table" }, + { "head", "a" }, + { "head", "abbr" }, + { "head", "acronym" }, + { "head", "address" }, + { "head", "b" }, + { "head", "bdo" }, + { "head", "big" }, + { "head", "blockquote" }, + { "head", "body" }, + { "head", "br" }, + { "head", "center" }, + { "head", "cite" }, + { "head", "code" }, + { "head", "dd" }, + { "head", "dfn" }, + { "head", "dir" }, + { "head", "div" }, + { "head", "dl" }, + { "head", "dt" }, + { "head", "em" }, + { "head", "fieldset" }, + { "head", "font" }, + { "head", "form" }, + { "head", "frameset" }, + { "head", "h1" }, + { "head", "h2" }, + { "head", "h3" }, + { "head", "h4" }, + { "head", "h5" }, + { "head", "h6" }, + { "head", "hr" }, + { "head", "i" }, + { "head", "iframe" }, + { "head", "img" }, + { "head", "kbd" }, + { "head", "li" }, + { "head", "listing" }, + { "head", "map" }, + { "head", "menu" }, + { "head", "ol" }, + { "head", "p" }, + { "head", "pre" }, + { "head", "q" }, + { "head", "s" }, + { "head", "samp" }, + { "head", "small" }, + { "head", "span" }, + { "head", "strike" }, + { "head", "strong" }, + { "head", "sub" }, + { "head", "sup" }, + { "head", "table" }, + { "head", "tt" }, + { "head", "u" }, + { "head", "ul" }, + { "head", "var" }, + { "head", "xmp" }, + { "hr", "form" }, + { "i", "center" }, + { "i", "p" }, + { "i", "td" }, + { "i", "th" }, + { "legend", "fieldset" }, + { "li", "li" }, + { "link", "body" }, + { "link", "frameset" }, + { "listing", "dd" }, + { "listing", "dl" }, + { "listing", "dt" }, + { "listing", "fieldset" }, + { "listing", "form" }, + { "listing", "li" }, + { "listing", "table" }, + { "listing", "ul" }, + { "menu", "dd" }, + { "menu", "dl" }, + { "menu", "dt" }, + { "menu", "form" }, + { "menu", "ul" }, + { "ol", "form" }, + { "ol", "ul" }, + { "option", "optgroup" }, + { "option", "option" }, + { "p", "address" }, + { "p", "blockquote" }, + { "p", "body" }, + { "p", "caption" }, + { "p", "center" }, + { "p", "col" }, + { "p", "colgroup" }, + { "p", "dd" }, + { "p", "dir" }, + { "p", "div" }, + { "p", "dl" }, + { "p", "dt" }, + { "p", "fieldset" }, + { "p", "form" }, + { "p", "frameset" }, + { "p", "h1" }, + { "p", "h2" }, + { "p", "h3" }, + { "p", "h4" }, + { "p", "h5" }, + { "p", "h6" }, + { "p", "head" }, + { "p", "hr" }, + { "p", "li" }, + { "p", "listing" }, + { "p", "menu" }, + { "p", "ol" }, + { "p", "p" }, + { "p", "pre" }, + { "p", "table" }, + { "p", "tbody" }, + { "p", "td" }, + { "p", "tfoot" }, + { "p", "th" }, + { "p", "title" }, + { "p", "tr" }, + { "p", "ul" }, + { "p", "xmp" }, + { "pre", "dd" }, + { "pre", "dl" }, + { "pre", "dt" }, + { "pre", "fieldset" }, + { "pre", "form" }, + { "pre", "li" }, + { "pre", "table" }, + { "pre", "ul" }, + { "s", "p" }, + { "script", "noscript" }, + { "small", "p" }, + { "span", "td" }, + { "span", "th" }, + { "strike", "p" }, + { "style", "body" }, + { "style", "frameset" }, + { "tbody", "tbody" }, + { "tbody", "tfoot" }, + { "td", "tbody" }, + { "td", "td" }, + { "td", "tfoot" }, + { "td", "th" }, + { "td", "tr" }, + { "tfoot", "tbody" }, + { "th", "tbody" }, + { "th", "td" }, + { "th", "tfoot" }, + { "th", "th" }, + { "th", "tr" }, + { "thead", "tbody" }, + { "thead", "tfoot" }, + { "title", "body" }, + { "title", "frameset" }, + { "tr", "tbody" }, + { "tr", "tfoot" }, + { "tr", "tr" }, + { "tt", "p" }, + { "u", "p" }, + { "u", "td" }, + { "u", "th" }, + { "ul", "address" }, + { "ul", "form" }, + { "ul", "menu" }, + { "ul", "ol" }, + { "ul", "pre" }, + { "xmp", "dd" }, + { "xmp", "dl" }, + { "xmp", "dt" }, + { "xmp", "fieldset" }, + { "xmp", "form" }, + { "xmp", "li" }, + { "xmp", "table" }, + { "xmp", "ul" } };
/* @@ -1211,9 +1401,6 @@ static const elementPriority htmlEndPriority[] = { {NULL, 100} /* Default priority */ };
-static const char** htmlStartCloseIndex[100]; -static int htmlStartCloseIndexinitialized = 0; - /************************************************************************ * * * functions to handle HTML specific data * @@ -1223,24 +1410,18 @@ static int htmlStartCloseIndexinitialized = 0; /** * htmlInitAutoClose: * - * Initialize the htmlStartCloseIndex for fast lookup of closing tags names. - * This is not reentrant. Call xmlInitParser() once before processing in - * case of use in multithreaded programs. + * This is a no-op now. */ void htmlInitAutoClose(void) { - int indx, i = 0; +}
- if (htmlStartCloseIndexinitialized) return; +static int +htmlCompareTags(const void *key, const void *member) { + const xmlChar *tag = (const xmlChar *) key; + const htmlElemDesc *desc = (const htmlElemDesc *) member;
- for (indx = 0;indx < 100;indx ++) htmlStartCloseIndex[indx] = NULL; - indx = 0; - while ((htmlStartClose[i] != NULL) && (indx < 100 - 1)) { - htmlStartCloseIndex[indx++] = (const char**) &htmlStartClose[i]; - while (htmlStartClose[i] != NULL) i++; - i++; - } - htmlStartCloseIndexinitialized = 1; + return(xmlStrcasecmp(tag, BAD_CAST desc->name)); }
/** @@ -1253,14 +1434,12 @@ htmlInitAutoClose(void) { */ const htmlElemDesc * htmlTagLookup(const xmlChar *tag) { - unsigned int i; + if (tag == NULL) + return(NULL);
- for (i = 0; i < (sizeof(html40ElementTable) / - sizeof(html40ElementTable[0]));i++) { - if (!xmlStrcasecmp(tag, BAD_CAST html40ElementTable[i].name)) - return((htmlElemDescPtr) &html40ElementTable[i]); - } - return(NULL); + return((const htmlElemDesc *) bsearch(tag, html40ElementTable, + sizeof(html40ElementTable) / sizeof(htmlElemDesc), + sizeof(htmlElemDesc), htmlCompareTags)); }
/** @@ -1281,6 +1460,19 @@ htmlGetEndPriority (const xmlChar *name) { }
+static int +htmlCompareStartClose(const void *vkey, const void *member) { + const htmlStartCloseEntry *key = (const htmlStartCloseEntry *) vkey; + const htmlStartCloseEntry *entry = (const htmlStartCloseEntry *) member; + int ret; + + ret = strcmp(key->oldTag, entry->oldTag); + if (ret == 0) + ret = strcmp(key->newTag, entry->newTag); + + return(ret); +} + /** * htmlCheckAutoClose: * @newtag: The new tag name @@ -1288,37 +1480,21 @@ htmlGetEndPriority (const xmlChar *name) { * * Checks whether the new tag is one of the registered valid tags for * closing old. - * Initialize the htmlStartCloseIndex for fast lookup of closing tags names. * * Returns 0 if no, 1 if yes. */ static int htmlCheckAutoClose(const xmlChar * newtag, const xmlChar * oldtag) { - int i, indx; - const char **closed = NULL; - - if (htmlStartCloseIndexinitialized == 0) - htmlInitAutoClose(); - - /* inefficient, but not a big deal */ - for (indx = 0; indx < 100; indx++) { - closed = htmlStartCloseIndex[indx]; - if (closed == NULL) - return (0); - if (xmlStrEqual(BAD_CAST * closed, newtag)) - break; - } - - i = closed - htmlStartClose; - i++; - while (htmlStartClose[i] != NULL) { - if (xmlStrEqual(BAD_CAST htmlStartClose[i], oldtag)) { - return (1); - } - i++; - } - return (0); + htmlStartCloseEntry key; + void *res; + + key.oldTag = (const char *) oldtag; + key.newTag = (const char *) newtag; + res = bsearch(&key, htmlStartClose, + sizeof(htmlStartClose) / sizeof(htmlStartCloseEntry), + sizeof(htmlStartCloseEntry), htmlCompareStartClose); + return(res != NULL); }
/** @@ -2482,7 +2658,6 @@ htmlParseName(htmlParserCtxtPtr ctxt) { count = in - ctxt->input->cur; ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); ctxt->input->cur = in; - ctxt->nbChars += count; ctxt->input->col += count; return(ret); } @@ -2789,47 +2964,39 @@ htmlParseAttValue(htmlParserCtxtPtr ctxt) { static xmlChar * htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { size_t len = 0, startPosition = 0; + int err = 0; + int quote; xmlChar *ret = NULL;
- if (CUR == '"') { - NEXT; + if ((CUR != '"') && (CUR != ''')) { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, + "SystemLiteral " or ' expected\n", NULL, NULL); + return(NULL); + } + quote = CUR; + NEXT;
- if (CUR_PTR < BASE_PTR) - return(ret); - startPosition = CUR_PTR - BASE_PTR; + if (CUR_PTR < BASE_PTR) + return(ret); + startPosition = CUR_PTR - BASE_PTR;
- while ((IS_CHAR_CH(CUR)) && (CUR != '"')) { - NEXT; - len++; - } - if (!IS_CHAR_CH(CUR)) { - htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, - "Unfinished SystemLiteral\n", NULL, NULL); - } else { - ret = xmlStrndup((BASE_PTR+startPosition), len); - NEXT; + while ((CUR != 0) && (CUR != quote)) { + /* TODO: Handle UTF-8 */ + if (!IS_CHAR_CH(CUR)) { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in SystemLiteral 0x%X\n", CUR); + err = 1; } - } else if (CUR == ''') { NEXT; - - if (CUR_PTR < BASE_PTR) - return(ret); - startPosition = CUR_PTR - BASE_PTR; - - while ((IS_CHAR_CH(CUR)) && (CUR != ''')) { - NEXT; - len++; - } - if (!IS_CHAR_CH(CUR)) { - htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, - "Unfinished SystemLiteral\n", NULL, NULL); - } else { - ret = xmlStrndup((BASE_PTR+startPosition), len); - NEXT; - } + len++; + } + if (CUR != quote) { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, + "Unfinished SystemLiteral\n", NULL, NULL); } else { - htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, - " or ' expected\n", NULL, NULL); + NEXT; + if (err == 0) + ret = xmlStrndup((BASE_PTR+startPosition), len); }
return(ret); @@ -2849,51 +3016,42 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { static xmlChar * htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { size_t len = 0, startPosition = 0; + int err = 0; + int quote; xmlChar *ret = NULL; + + if ((CUR != '"') && (CUR != ''')) { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, + "PubidLiteral " or ' expected\n", NULL, NULL); + return(NULL); + } + quote = CUR; + NEXT; + /* * Name ::= (Letter | '_') (NameChar)* */ - if (CUR == '"') { - NEXT; - - if (CUR_PTR < BASE_PTR) - return(ret); - startPosition = CUR_PTR - BASE_PTR; - - while (IS_PUBIDCHAR_CH(CUR)) { - len++; - NEXT; + if (CUR_PTR < BASE_PTR) + return(ret); + startPosition = CUR_PTR - BASE_PTR; + + while ((CUR != 0) && (CUR != quote)) { + if (!IS_PUBIDCHAR_CH(CUR)) { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in PubidLiteral 0x%X\n", CUR); + err = 1; } - - if (CUR != '"') { - htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, - "Unfinished PubidLiteral\n", NULL, NULL); - } else { - ret = xmlStrndup((BASE_PTR + startPosition), len); - NEXT; - } - } else if (CUR == ''') { + len++; NEXT; + }
- if (CUR_PTR < BASE_PTR) - return(ret); - startPosition = CUR_PTR - BASE_PTR; - - while ((IS_PUBIDCHAR_CH(CUR)) && (CUR != ''')){ - len++; - NEXT; - } - - if (CUR != ''') { - htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, - "Unfinished PubidLiteral\n", NULL, NULL); - } else { - ret = xmlStrndup((BASE_PTR + startPosition), len); - NEXT; - } + if (CUR != '"') { + htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, + "Unfinished PubidLiteral\n", NULL, NULL); } else { - htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, - "PubidLiteral " or ' expected\n", NULL, NULL); + NEXT; + if (err == 0) + ret = xmlStrndup((BASE_PTR + startPosition), len); }
return(ret); @@ -2928,7 +3086,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
SHRINK; cur = CUR_CHAR(l); - while (IS_CHAR_CH(cur)) { + while (cur != 0) { if ((cur == '<') && (NXT(1) == '/')) { /* * One should break here, the specification is clear: @@ -2959,7 +3117,12 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { } } } - COPY_BUF(l,buf,nbchar,cur); + if (IS_CHAR(cur)) { + COPY_BUF(l,buf,nbchar,cur); + } else { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in CDATA 0x%X\n", cur); + } if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { buf[nbchar] = 0; if (ctxt->sax->cdataBlock!= NULL) { @@ -2977,14 +3140,6 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { cur = CUR_CHAR(l); }
- if ((!(IS_CHAR_CH(cur))) && (!((cur == 0) && (ctxt->progressive)))) { - htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, - "Invalid char in CDATA 0x%X\n", cur); - if (ctxt->input->cur < ctxt->input->end) { - NEXT; - } - } - if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { buf[nbchar] = 0; if (ctxt->sax->cdataBlock!= NULL) { @@ -3232,7 +3387,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) { } SKIP_BLANKS; cur = CUR_CHAR(l); - while (IS_CHAR(cur) && (cur != '>')) { + while ((cur != 0) && (cur != '>')) { if (len + 5 >= size) { xmlChar *tmp;
@@ -3251,7 +3406,13 @@ htmlParsePI(htmlParserCtxtPtr ctxt) { GROW; count = 0; } - COPY_BUF(l,buf,len,cur); + if (IS_CHAR(cur)) { + COPY_BUF(l,buf,len,cur); + } else { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in processing instruction " + "0x%X\n", cur); + } NEXTL(l); cur = CUR_CHAR(l); if (cur == 0) { @@ -3300,6 +3461,7 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { int q, ql; int r, rl; int cur, l; + int next, nl; xmlParserInputState state;
/* @@ -3321,17 +3483,32 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { len = 0; buf[len] = 0; q = CUR_CHAR(ql); - if (!IS_CHAR(q)) + if (q == 0) goto unfinished; NEXTL(ql); r = CUR_CHAR(rl); - if (!IS_CHAR(r)) + if (r == 0) goto unfinished; NEXTL(rl); cur = CUR_CHAR(l); - while (IS_CHAR(cur) && + while ((cur != 0) && ((cur != '>') || (r != '-') || (q != '-'))) { + NEXTL(l); + next = CUR_CHAR(nl); + if (next == 0) { + SHRINK; + GROW; + next = CUR_CHAR(nl); + } + + if ((q == '-') && (r == '-') && (cur == '!') && (next == '>')) { + htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, + "Comment incorrectly closed by '--!>'", NULL, NULL); + cur = '>'; + break; + } + if (len + 5 >= size) { xmlChar *tmp;
@@ -3345,21 +3522,22 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { } buf = tmp; } - COPY_BUF(ql,buf,len,q); + if (IS_CHAR(q)) { + COPY_BUF(ql,buf,len,q); + } else { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in comment 0x%X\n", q); + } + q = r; ql = rl; r = cur; rl = l; - NEXTL(l); - cur = CUR_CHAR(l); - if (cur == 0) { - SHRINK; - GROW; - cur = CUR_CHAR(l); - } + cur = next; + l = nl; } buf[len] = 0; - if (IS_CHAR(cur)) { + if (cur == '>') { NEXT; if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) && (!ctxt->disableSAX)) @@ -3400,13 +3578,16 @@ htmlParseCharRef(htmlParserCtxtPtr ctxt) { ((NXT(2) == 'x') || NXT(2) == 'X')) { SKIP(3); while (CUR != ';') { - if ((CUR >= '0') && (CUR <= '9')) - val = val * 16 + (CUR - '0'); - else if ((CUR >= 'a') && (CUR <= 'f')) - val = val * 16 + (CUR - 'a') + 10; - else if ((CUR >= 'A') && (CUR <= 'F')) - val = val * 16 + (CUR - 'A') + 10; - else { + if ((CUR >= '0') && (CUR <= '9')) { + if (val < 0x110000) + val = val * 16 + (CUR - '0'); + } else if ((CUR >= 'a') && (CUR <= 'f')) { + if (val < 0x110000) + val = val * 16 + (CUR - 'a') + 10; + } else if ((CUR >= 'A') && (CUR <= 'F')) { + if (val < 0x110000) + val = val * 16 + (CUR - 'A') + 10; + } else { htmlParseErr(ctxt, XML_ERR_INVALID_HEX_CHARREF, "htmlParseCharRef: missing semicolon\n", NULL, NULL); @@ -3419,9 +3600,10 @@ htmlParseCharRef(htmlParserCtxtPtr ctxt) { } else if ((CUR == '&') && (NXT(1) == '#')) { SKIP(2); while (CUR != ';') { - if ((CUR >= '0') && (CUR <= '9')) - val = val * 10 + (CUR - '0'); - else { + if ((CUR >= '0') && (CUR <= '9')) { + if (val < 0x110000) + val = val * 10 + (CUR - '0'); + } else { htmlParseErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, "htmlParseCharRef: missing semicolon\n", NULL, NULL); @@ -3440,6 +3622,9 @@ htmlParseCharRef(htmlParserCtxtPtr ctxt) { */ if (IS_CHAR(val)) { return(val); + } else if (val >= 0x110000) { + htmlParseErr(ctxt, XML_ERR_INVALID_CHAR, + "htmlParseCharRef: value too large\n", NULL, NULL); } else { htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, "htmlParseCharRef: invalid xmlChar value %d\n", @@ -3499,9 +3684,12 @@ htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) { if (CUR != '>') { htmlParseErr(ctxt, XML_ERR_DOCTYPE_NOT_FINISHED, "DOCTYPE improperly terminated\n", NULL, NULL); - /* We shouldn't try to resynchronize ... */ + /* Ignore bogus content */ + while ((CUR != 0) && (CUR != '>')) + NEXT; } - NEXT; + if (CUR == '>') + NEXT;
/* * Create or update the document accordingly to the DOCTYPE @@ -3779,7 +3967,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
/* Dump the bogus tag like browsers do */ - while ((IS_CHAR_CH(CUR)) && (CUR != '>') && + while ((CUR != 0) && (CUR != '>') && (ctxt->instate != XML_PARSER_EOF)) NEXT; return -1; @@ -3835,11 +4023,9 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { * (S Attribute)* S? */ SKIP_BLANKS; - while ((IS_CHAR_CH(CUR)) && + while ((CUR != 0) && (CUR != '>') && ((CUR != '/') || (NXT(1) != '>'))) { - long cons = ctxt->nbChars; - GROW; attname = htmlParseAttribute(ctxt, &attvalue); if (attname != NULL) { @@ -3898,7 +4084,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { xmlFree(attvalue); /* Dump the bogus attribute string up to the next blank or * the end of the tag. */ - while ((IS_CHAR_CH(CUR)) && + while ((CUR != 0) && !(IS_BLANK_CH(CUR)) && (CUR != '>') && ((CUR != '/') || (NXT(1) != '>'))) NEXT; @@ -3906,12 +4092,6 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
failed: SKIP_BLANKS; - if (cons == ctxt->nbChars) { - htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, - "htmlParseStartTag: problem parsing attributes\n", - NULL, NULL); - break; - } }
/* @@ -3979,19 +4159,14 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) * We should definitely be at the ending "S? '>'" part */ SKIP_BLANKS; - if ((!IS_CHAR_CH(CUR)) || (CUR != '>')) { + if (CUR != '>') { htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, "End tag : expected '>'\n", NULL, NULL); - if (ctxt->recovery) { - /* - * We're not at the ending > !! - * Error, unless in recover mode where we search forwards - * until we find a > - */ - while (CUR != '\0' && CUR != '>') NEXT; - NEXT; - } - } else + /* Skip to next '>' */ + while ((CUR != 0) && (CUR != '>')) + NEXT; + } + if (CUR == '>') NEXT;
/* @@ -4032,12 +4207,10 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) * With the exception that the autoclose may have popped stuff out * of the stack. */ - if (!xmlStrEqual(name, ctxt->name)) { - if ((ctxt->name != NULL) && (!xmlStrEqual(ctxt->name, name))) { - htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH, - "Opening and ending tag mismatch: %s and %s\n", - name, ctxt->name); - } + if ((ctxt->name != NULL) && (!xmlStrEqual(ctxt->name, name))) { + htmlParseErr(ctxt, XML_ERR_TAG_NAME_MISMATCH, + "Opening and ending tag mismatch: %s and %s\n", + name, ctxt->name); }
/* @@ -4152,8 +4325,6 @@ htmlParseContent(htmlParserCtxtPtr ctxt) { currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; while (1) { - long cons = ctxt->nbChars; - GROW;
if (ctxt->instate == XML_PARSER_EOF) @@ -4181,7 +4352,7 @@ htmlParseContent(htmlParserCtxtPtr ctxt) { "htmlParseStartTag: invalid element name\n", NULL, NULL); /* Dump the bogus tag like browsers do */ - while ((IS_CHAR_CH(CUR)) && (CUR != '>')) + while ((CUR != 0) && (CUR != '>')) NEXT;
if (currentNode != NULL) @@ -4273,15 +4444,6 @@ htmlParseContent(htmlParserCtxtPtr ctxt) { else { htmlParseCharData(ctxt); } - - if (cons == ctxt->nbChars) { - if (ctxt->node != NULL) { - htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, - "detected an error in element content\n", - NULL, NULL); - } - break; - } } GROW; } @@ -4396,7 +4558,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { */ currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; - while (IS_CHAR_CH(CUR)) { + while (CUR != 0) { oldptr = ctxt->input->cur; htmlParseContent(ctxt); if (oldptr==ctxt->input->cur) break; @@ -4413,7 +4575,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { node_info.node = ctxt->node; xmlParserAddNodeInfo(ctxt, &node_info); } - if (!IS_CHAR_CH(CUR)) { + if (CUR == 0) { htmlAutoCloseOnEnd(ctxt); }
@@ -4434,7 +4596,7 @@ htmlParserFinishElementParsing(htmlParserCtxtPtr ctxt) { xmlParserAddNodeInfo(ctxt, ctxt->nodeInfo); htmlNodeInfoPop(ctxt); } - if (!IS_CHAR_CH(CUR)) { + if (CUR == 0) { htmlAutoCloseOnEnd(ctxt); } } @@ -4552,8 +4714,6 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) { currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; while (1) { - long cons = ctxt->nbChars; - GROW;
if (ctxt->instate == XML_PARSER_EOF) @@ -4583,7 +4743,7 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) { "htmlParseStartTag: invalid element name\n", NULL, NULL); /* Dump the bogus tag like browsers do */ - while ((IS_CHAR_CH(CUR)) && (CUR != '>')) + while ((CUR == 0) && (CUR != '>')) NEXT;
htmlParserFinishElementParsing(ctxt); @@ -4687,15 +4847,6 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) { else { htmlParseCharData(ctxt); } - - if (cons == ctxt->nbChars) { - if (ctxt->node != NULL) { - htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, - "detected an error in element content\n", - NULL, NULL); - } - break; - } } GROW; } @@ -4959,7 +5110,6 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt) ctxt->vctxt.warning = xmlParserValidityWarning; ctxt->record_info = 0; ctxt->validate = 0; - ctxt->nbChars = 0; ctxt->checkIndex = 0; ctxt->catalogs = NULL; xmlInitNodeInfoSeq(&ctxt->node_seq); @@ -5119,7 +5269,7 @@ htmlCreateDocParserCtxt(const xmlChar *cur, const char *encoding) { * @first: the first char to lookup * @next: the next char to lookup or zero * @third: the next char to lookup or zero - * @comment: flag to force checking inside comments + * @ignoreattrval: skip over attribute values * * Try to find if a sequence (first, next, third) or just (first next) or * (first) is available in the input stream. @@ -5133,13 +5283,11 @@ htmlCreateDocParserCtxt(const xmlChar *cur, const char *encoding) { */ static int htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, - xmlChar next, xmlChar third, int iscomment, - int ignoreattrval) + xmlChar next, xmlChar third, int ignoreattrval) { int base, len; htmlParserInputPtr in; const xmlChar *buf; - int incomment = 0; int invalue = 0; char valdellim = 0x0;
@@ -5151,8 +5299,11 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, if (base < 0) return (-1);
- if (ctxt->checkIndex > base) + if (ctxt->checkIndex > base) { base = ctxt->checkIndex; + /* Abuse hasPErefs member to restore current state. */ + invalue = ctxt->hasPErefs & 1 ? 1 : 0; + }
if (in->buf == NULL) { buf = in->base; @@ -5168,14 +5319,6 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, else if (next) len--; for (; base < len; base++) { - if ((!incomment) && (base + 4 < len) && (!iscomment)) { - if ((buf[base] == '<') && (buf[base + 1] == '!') && - (buf[base + 2] == '-') && (buf[base + 3] == '-')) { - incomment = 1; - /* do not increment past <! - some people use <!--> */ - base += 2; - } - } if (ignoreattrval) { if (buf[base] == '"' || buf[base] == ''') { if (invalue) { @@ -5192,16 +5335,6 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, continue; } } - if (incomment) { - if (base + 3 > len) - return (-1); - if ((buf[base] == '-') && (buf[base + 1] == '-') && - (buf[base + 2] == '>')) { - incomment = 0; - base += 2; - } - continue; - } if (buf[base] == first) { if (third != 0) { if ((buf[base + 1] != next) || (buf[base + 2] != third)) @@ -5228,8 +5361,12 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, return (base - (in->cur - in->base)); } } - if ((!incomment) && (!invalue)) - ctxt->checkIndex = base; + ctxt->checkIndex = base; + /* Abuse hasPErefs member to track current state. */ + if (invalue) + ctxt->hasPErefs |= 1; + else + ctxt->hasPErefs &= ~1; #ifdef DEBUG_PUSH if (next == 0) xmlGenericError(xmlGenericErrorContext, @@ -5246,79 +5383,38 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, }
/** - * htmlParseLookupChars: + * htmlParseLookupCommentEnd: * @ctxt: an HTML parser context - * @stop: Array of chars, which stop the lookup. - * @stopLen: Length of stop-Array * - * Try to find if any char of the stop-Array is available in the input - * stream. + * Try to find a comment end tag in the input stream + * The search includes "-->" as well as WHATWG-recommended incorrectly-closed tags. + * (See https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-...) * This function has a side effect of (possibly) incrementing ctxt->checkIndex * to avoid rescanning sequences of bytes, it DOES change the state of the * parser, do not use liberally. + * This wraps to htmlParseLookupSequence() * - * Returns the index to the current parsing point if a stopChar - * is available, -1 otherwise. + * Returns the index to the current parsing point if the full sequence is available, -1 otherwise. */ static int -htmlParseLookupChars(htmlParserCtxtPtr ctxt, const xmlChar * stop, - int stopLen) +htmlParseLookupCommentEnd(htmlParserCtxtPtr ctxt) { - int base, len; - htmlParserInputPtr in; - const xmlChar *buf; - int incomment = 0; - int i; - - in = ctxt->input; - if (in == NULL) - return (-1); - - base = in->cur - in->base; - if (base < 0) - return (-1); - - if (ctxt->checkIndex > base) - base = ctxt->checkIndex; - - if (in->buf == NULL) { - buf = in->base; - len = in->length; - } else { - buf = xmlBufContent(in->buf->buffer); - len = xmlBufUse(in->buf->buffer); - } - - for (; base < len; base++) { - if (!incomment && (base + 4 < len)) { - if ((buf[base] == '<') && (buf[base + 1] == '!') && - (buf[base + 2] == '-') && (buf[base + 3] == '-')) { - incomment = 1; - /* do not increment past <! - some people use <!--> */ - base += 2; - } - } - if (incomment) { - if (base + 3 > len) - return (-1); - if ((buf[base] == '-') && (buf[base + 1] == '-') && - (buf[base + 2] == '>')) { - incomment = 0; - base += 2; - } - continue; - } - for (i = 0; i < stopLen; ++i) { - if (buf[base] == stop[i]) { - ctxt->checkIndex = 0; - return (base - (in->cur - in->base)); - } - } + int mark = 0; + int cur = CUR_PTR - BASE_PTR; + + while (mark >= 0) { + mark = htmlParseLookupSequence(ctxt, '-', '-', 0, 0); + if ((mark < 0) || + (NXT(mark+2) == '>') || + ((NXT(mark+2) == '!') && (NXT(mark+3) == '>'))) { + return mark; + } + ctxt->checkIndex = cur + mark + 1; } - ctxt->checkIndex = base; - return (-1); + return mark; }
+ /** * htmlParseTryOrFinish: * @ctxt: an HTML parser context @@ -5332,7 +5428,7 @@ static int htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { int ret = 0; htmlParserInputPtr in; - int avail = 0; + ptrdiff_t avail = 0; xmlChar cur, next;
htmlParserNodeInfo node_info; @@ -5397,7 +5493,8 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); + avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) - + (in->cur - in->base); if ((avail == 0) && (terminate)) { htmlAutoCloseOnEnd(ctxt); if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { @@ -5411,6 +5508,12 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { } if (avail < 1) goto done; + /* + * This is done to make progress and avoid an infinite loop + * if a parsing attempt was aborted by hitting a NUL byte. After + * changing htmlCurrentChar, this probably isn't necessary anymore. + * We should consider removing this check. + */ cur = in->cur[0]; if (cur == 0) { SKIP(1); @@ -5433,7 +5536,8 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); + avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) - + (in->cur - in->base); } if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) ctxt->sax->setDocumentLocator(ctxt->userData, @@ -5450,7 +5554,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5475,14 +5579,15 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); + avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) - + (in->cur - in->base); /* * no chars in buffer */ if (avail < 1) goto done; /* - * not enouth chars in buffer + * not enough chars in buffer */ if (avail < 2) { if (!terminate) @@ -5495,8 +5600,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { cur = in->cur[0]; if ((cur == '<') && (next == '!') && (in->cur[2] == '-') && (in->cur[3] == '-')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) + if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5506,7 +5610,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->instate = XML_PARSER_MISC; } else if ((cur == '<') && (next == '?')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5520,7 +5624,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5536,7 +5640,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (avail < 9)) { goto done; } else { - ctxt->instate = XML_PARSER_START_TAG; + ctxt->instate = XML_PARSER_CONTENT; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, "HPP: entering START_TAG\n"); @@ -5548,15 +5652,15 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); + avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) - + (in->cur - in->base); if (avail < 2) goto done; cur = in->cur[0]; next = in->cur[1]; if ((cur == '<') && (next == '!') && (in->cur[2] == '-') && (in->cur[3] == '-')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) + if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5566,7 +5670,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->instate = XML_PARSER_PROLOG; } else if ((cur == '<') && (next == '?')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5578,7 +5682,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (avail < 4)) { goto done; } else { - ctxt->instate = XML_PARSER_START_TAG; + ctxt->instate = XML_PARSER_CONTENT; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, "HPP: entering START_TAG\n"); @@ -5589,7 +5693,8 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); + avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) - + (in->cur - in->base); if (avail < 1) goto done; cur = in->cur[0]; @@ -5602,8 +5707,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { next = in->cur[1]; if ((cur == '<') && (next == '!') && (in->cur[2] == '-') && (in->cur[3] == '-')) { - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) + if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5613,7 +5717,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->instate = XML_PARSER_EPILOG; } else if ((cur == '<') && (next == '?')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5648,7 +5752,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (avail < 1) goto done; /* - * not enouth chars in buffer + * not enough chars in buffer */ if (avail < 2) { if (!terminate) @@ -5677,7 +5781,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { break; } if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0)) goto done;
/* Capture start position */ @@ -5769,7 +5873,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { } case XML_PARSER_CONTENT: { xmlChar chr[2] = { 0, 0 }; - long cons;
/* * Handle preparsed entities and charRef @@ -5814,7 +5917,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { goto done; cur = in->cur[0]; next = in->cur[1]; - cons = ctxt->nbChars; if ((xmlStrEqual(ctxt->name, BAD_CAST"script")) || (xmlStrEqual(ctxt->name, BAD_CAST"style"))) { /* @@ -5824,7 +5926,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { int idx; xmlChar val;
- idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0, 0); + idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0); if (idx < 0) goto done; val = in->cur[idx + 2]; @@ -5851,7 +5953,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0)) goto done; htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, "Misplaced DOCTYPE declaration\n", @@ -5859,9 +5961,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { htmlParseDocTypeDecl(ctxt); } else if ((cur == '<') && (next == '!') && (in->cur[2] == '-') && (in->cur[3] == '-')) { - if ((!terminate) && - (htmlParseLookupSequence( - ctxt, '-', '-', '>', 1, 1) < 0)) + if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5871,7 +5971,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->instate = XML_PARSER_CONTENT; } else if ((cur == '<') && (next == '?')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5890,24 +5990,35 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { #endif break; } else if (cur == '<') { - ctxt->instate = XML_PARSER_START_TAG; - ctxt->checkIndex = 0; + if ((!terminate) && (next == 0)) + goto done; + /* + * Only switch to START_TAG if the next character + * starts a valid name. Otherwise, htmlParseStartTag + * might return without consuming all characters + * up to the final '>'. + */ + if ((IS_ASCII_LETTER(next)) || + (next == '_') || (next == ':') || (next == '.')) { + ctxt->instate = XML_PARSER_START_TAG; + ctxt->checkIndex = 0; #ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: entering START_TAG\n"); + xmlGenericError(xmlGenericErrorContext, + "HPP: entering START_TAG\n"); #endif + } else { + htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, + "htmlParseTryOrFinish: " + "invalid element name\n", + NULL, NULL); + htmlCheckParagraph(ctxt); + if ((ctxt->sax != NULL) && + (ctxt->sax->characters != NULL)) + ctxt->sax->characters(ctxt->userData, + in->cur, 1); + NEXT; + } break; - } else if (cur == '&') { - if ((!terminate) && - (htmlParseLookupChars(ctxt, - BAD_CAST "; >/", 4) < 0)) - goto done; -#ifdef DEBUG_PUSH - xmlGenericError(xmlGenericErrorContext, - "HPP: Parsing Reference\n"); -#endif - /* TODO: check generation of subtrees if noent !!! */ - htmlParseReference(ctxt); } else { /* * check that the text sequence is complete @@ -5916,25 +6027,24 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { * data detection. */ if ((!terminate) && - (htmlParseLookupChars(ctxt, BAD_CAST "<&", 2) < 0)) + (htmlParseLookupSequence(ctxt, '<', 0, 0, 0) < 0)) goto done; ctxt->checkIndex = 0; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, "HPP: Parsing char data\n"); #endif - htmlParseCharData(ctxt); + while ((ctxt->instate != XML_PARSER_EOF) && + (cur != '<') && (in->cur < in->end)) { + if (cur == '&') { + htmlParseReference(ctxt); + } else { + htmlParseCharData(ctxt); + } + cur = in->cur[0]; + } } } - if (cons == ctxt->nbChars) { - if (ctxt->node != NULL) { - htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, - "detected an error in element content\n", - NULL, NULL); - } - NEXT; - break; - }
break; } @@ -5942,7 +6052,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (avail < 2) goto done; if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) goto done; htmlParseEndTag(ctxt); if (ctxt->nameNr == 0) { @@ -6124,12 +6234,12 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, int res;
res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk); + xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur); if (res < 0) { ctxt->errNo = XML_PARSER_EOF; ctxt->disableSAX = 1; return (XML_PARSER_EOF); } - xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur); #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); #endif @@ -6148,12 +6258,12 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, size_t current = ctxt->input->cur - ctxt->input->base;
nbchars = xmlCharEncInput(in, terminate); + xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current); if (nbchars < 0) { htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, "encoder error\n", NULL, NULL); return(XML_ERR_INVALID_ENCODING); } - xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current); } } } @@ -6671,7 +6781,6 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) ctxt->vctxt.error = xmlParserValidityError; ctxt->vctxt.warning = xmlParserValidityWarning; ctxt->record_info = 0; - ctxt->nbChars = 0; ctxt->checkIndex = 0; ctxt->inSubset = 0; ctxt->errNo = XML_ERR_OK; diff --git a/sdk/lib/3rdparty/libxml2/HTMLtree.c b/sdk/lib/3rdparty/libxml2/HTMLtree.c index db63b371f06..24434d453e1 100644 --- a/sdk/lib/3rdparty/libxml2/HTMLtree.c +++ b/sdk/lib/3rdparty/libxml2/HTMLtree.c @@ -226,7 +226,7 @@ found_head: found_meta: /* * Search and update all the remaining the meta elements carrying - * encoding informations + * encoding information */ while (cur != NULL) { if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { @@ -345,7 +345,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder); ************************************************************************/ /** * htmlSaveErrMemory: - * @extra: extra informations + * @extra: extra information * * Handle an out of memory condition */ @@ -359,7 +359,7 @@ htmlSaveErrMemory(const char *extra) * htmlSaveErr: * @code: the error number * @node: the location of the error. - * @extra: extra informations + * @extra: extra information * * Handle an out of memory condition */ @@ -518,7 +518,7 @@ htmlNodeDumpFileFormat(FILE *out, xmlDocPtr doc, buf = xmlOutputBufferCreateFile(out, handler); if (buf == NULL) return(0);
- htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format); + htmlNodeDumpFormatOutput(buf, doc, cur, NULL, format);
ret = xmlOutputBufferClose(buf); return(ret); @@ -670,13 +670,11 @@ htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, * @buf: the HTML buffer output * @doc: the document * @cur: the attribute pointer - * @encoding: the encoding string * * Dump an HTML attribute */ static void -htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, - const char *encoding ATTRIBUTE_UNUSED) { +htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) { xmlChar *value;
/* @@ -706,49 +704,22 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, (!xmlStrcasecmp(cur->name, BAD_CAST "src")) || ((!xmlStrcasecmp(cur->name, BAD_CAST "name")) && (!xmlStrcasecmp(cur->parent->name, BAD_CAST "a"))))) { + xmlChar *escaped; xmlChar *tmp = value; - /* xmlURIEscapeStr() escapes '"' so it can be safely used. */ - xmlBufCCat(buf->buffer, """);
while (IS_BLANK_CH(*tmp)) tmp++;
- /* URI Escape everything, except server side includes. */ - for ( ; ; ) { - xmlChar *escaped; - xmlChar endChar; - xmlChar *end = NULL; - xmlChar *start = (xmlChar *)xmlStrstr(tmp, BAD_CAST "<!--"); - if (start != NULL) { - end = (xmlChar *)xmlStrstr(tmp, BAD_CAST "-->"); - if (end != NULL) { - *start = '\0'; - } - } - - /* Escape the whole string, or until start (set to '\0'). */ - escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+"); - if (escaped != NULL) { - xmlBufCat(buf->buffer, escaped); - xmlFree(escaped); - } else { - xmlBufCat(buf->buffer, tmp); - } - - if (end == NULL) { /* Everything has been written. */ - break; - } - - /* Do not escape anything within server side includes. */ - *start = '<'; /* Restore the first character of "<!--". */ - end += 3; /* strlen("-->") */ - endChar = *end; - *end = '\0'; - xmlBufCat(buf->buffer, start); - *end = endChar; - tmp = end; + /* + * the < and > have already been escaped at the entity level + * And doing so here breaks server side includes + */ + escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+<>"); + if (escaped != NULL) { + xmlBufWriteQuotedString(buf->buffer, escaped); + xmlFree(escaped); + } else { + xmlBufWriteQuotedString(buf->buffer, value); } - - xmlBufCCat(buf->buffer, """); } else { xmlBufWriteQuotedString(buf->buffer, value); } @@ -759,63 +730,22 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, } }
-/** - * htmlAttrListDumpOutput: - * @buf: the HTML buffer output - * @doc: the document - * @cur: the first attribute pointer - * @encoding: the encoding string - * - * Dump a list of HTML attributes - */ -static void -htmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, const char *encoding) { - if (cur == NULL) { - return; - } - while (cur != NULL) { - htmlAttrDumpOutput(buf, doc, cur, encoding); - cur = cur->next; - } -} - - - -/** - * htmlNodeListDumpOutput: - * @buf: the HTML buffer output - * @doc: the document - * @cur: the first node - * @encoding: the encoding string - * @format: should formatting spaces been added - * - * Dump an HTML node list, recursive behaviour,children are printed too. - */ -static void -htmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, - xmlNodePtr cur, const char *encoding, int format) { - if (cur == NULL) { - return; - } - while (cur != NULL) { - htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format); - cur = cur->next; - } -} - /** * htmlNodeDumpFormatOutput: * @buf: the HTML buffer output * @doc: the document * @cur: the current node - * @encoding: the encoding string + * @encoding: the encoding string (unused) * @format: should formatting spaces been added * * Dump an HTML node, recursive behaviour,children are printed too. */ void htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, - xmlNodePtr cur, const char *encoding, int format) { + xmlNodePtr cur, const char *encoding ATTRIBUTE_UNUSED, + int format) { + xmlNodePtr root; + xmlAttrPtr attr; const htmlElemDesc * info;
xmlInitParser(); @@ -823,172 +753,199 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, if ((cur == NULL) || (buf == NULL)) { return; } - /* - * Special cases. - */ - if (cur->type == XML_DTD_NODE) - return; - if ((cur->type == XML_HTML_DOCUMENT_NODE) || - (cur->type == XML_DOCUMENT_NODE)){ - htmlDocContentDumpOutput(buf, (xmlDocPtr) cur, encoding); - return; - } - if (cur->type == XML_ATTRIBUTE_NODE) { - htmlAttrDumpOutput(buf, doc, (xmlAttrPtr) cur, encoding); - return; - } - if (cur->type == HTML_TEXT_NODE) { - if (cur->content != NULL) { - if (((cur->name == (const xmlChar *)xmlStringText) || - (cur->name != (const xmlChar *)xmlStringTextNoenc)) && - ((cur->parent == NULL) || - ((xmlStrcasecmp(cur->parent->name, BAD_CAST "script")) && - (xmlStrcasecmp(cur->parent->name, BAD_CAST "style"))))) { - xmlChar *buffer; - - buffer = xmlEncodeEntitiesReentrant(doc, cur->content); - if (buffer != NULL) { - xmlOutputBufferWriteString(buf, (const char *)buffer); - xmlFree(buffer); - } - } else { - xmlOutputBufferWriteString(buf, (const char *)cur->content); - } - } - return; - } - if (cur->type == HTML_COMMENT_NODE) { - if (cur->content != NULL) { - xmlOutputBufferWriteString(buf, "<!--"); - xmlOutputBufferWriteString(buf, (const char *)cur->content); - xmlOutputBufferWriteString(buf, "-->"); - } - return; - } - if (cur->type == HTML_PI_NODE) { - if (cur->name == NULL) - return; - xmlOutputBufferWriteString(buf, "<?"); - xmlOutputBufferWriteString(buf, (const char *)cur->name); - if (cur->content != NULL) { - xmlOutputBufferWriteString(buf, " "); - xmlOutputBufferWriteString(buf, (const char *)cur->content); - } - xmlOutputBufferWriteString(buf, ">"); - return; - } - if (cur->type == HTML_ENTITY_REF_NODE) { - xmlOutputBufferWriteString(buf, "&"); - xmlOutputBufferWriteString(buf, (const char *)cur->name); - xmlOutputBufferWriteString(buf, ";"); - return; - } - if (cur->type == HTML_PRESERVE_NODE) { - if (cur->content != NULL) { - xmlOutputBufferWriteString(buf, (const char *)cur->content); - } - return; - }
- /* - * Get specific HTML info for that node. - */ - if (cur->ns == NULL) - info = htmlTagLookup(cur->name); - else - info = NULL; + root = cur; + while (1) { + switch (cur->type) { + case XML_HTML_DOCUMENT_NODE: + case XML_DOCUMENT_NODE: + if (((xmlDocPtr) cur)->intSubset != NULL) { + htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL); + } + if (cur->children != NULL) { + cur = cur->children; + continue; + } + break;
- xmlOutputBufferWriteString(buf, "<"); - if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { - xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); - xmlOutputBufferWriteString(buf, ":"); - } - xmlOutputBufferWriteString(buf, (const char *)cur->name); - if (cur->nsDef) - xmlNsListDumpOutput(buf, cur->nsDef); - if (cur->properties != NULL) - htmlAttrListDumpOutput(buf, doc, cur->properties, encoding); - - if ((info != NULL) && (info->empty)) { - xmlOutputBufferWriteString(buf, ">"); - if ((format) && (!info->isinline) && (cur->next != NULL)) { - if ((cur->next->type != HTML_TEXT_NODE) && - (cur->next->type != HTML_ENTITY_REF_NODE) && - (cur->parent != NULL) && - (cur->parent->name != NULL) && - (cur->parent->name[0] != 'p')) /* p, pre, param */ - xmlOutputBufferWriteString(buf, "\n"); - } - return; - } - if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) && - (cur->children == NULL)) { - if ((info != NULL) && (info->saveEndTag != 0) && - (xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) && - (xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) { - xmlOutputBufferWriteString(buf, ">"); - } else { - xmlOutputBufferWriteString(buf, "></"); + case XML_ELEMENT_NODE: + /* + * Get specific HTML info for that node. + */ + if (cur->ns == NULL) + info = htmlTagLookup(cur->name); + else + info = NULL; + + xmlOutputBufferWriteString(buf, "<"); if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); xmlOutputBufferWriteString(buf, ":"); } - xmlOutputBufferWriteString(buf, (const char *)cur->name); - xmlOutputBufferWriteString(buf, ">"); - } - if ((format) && (cur->next != NULL) && - (info != NULL) && (!info->isinline)) { - if ((cur->next->type != HTML_TEXT_NODE) && - (cur->next->type != HTML_ENTITY_REF_NODE) && - (cur->parent != NULL) && - (cur->parent->name != NULL) && - (cur->parent->name[0] != 'p')) /* p, pre, param */ - xmlOutputBufferWriteString(buf, "\n"); - } - return; - } - xmlOutputBufferWriteString(buf, ">"); - if ((cur->type != XML_ELEMENT_NODE) && - (cur->content != NULL)) { - /* - * Uses the OutputBuffer property to automatically convert - * invalids to charrefs - */ - - xmlOutputBufferWriteString(buf, (const char *) cur->content); - } - if (cur->children != NULL) { - if ((format) && (info != NULL) && (!info->isinline) && - (cur->children->type != HTML_TEXT_NODE) && - (cur->children->type != HTML_ENTITY_REF_NODE) && - (cur->children != cur->last) && - (cur->name != NULL) && - (cur->name[0] != 'p')) /* p, pre, param */ - xmlOutputBufferWriteString(buf, "\n"); - htmlNodeListDumpOutput(buf, doc, cur->children, encoding, format); - if ((format) && (info != NULL) && (!info->isinline) && - (cur->last->type != HTML_TEXT_NODE) && - (cur->last->type != HTML_ENTITY_REF_NODE) && - (cur->children != cur->last) && - (cur->name != NULL) && - (cur->name[0] != 'p')) /* p, pre, param */ - xmlOutputBufferWriteString(buf, "\n"); - } - xmlOutputBufferWriteString(buf, "</"); - if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { - xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); - xmlOutputBufferWriteString(buf, ":"); - } - xmlOutputBufferWriteString(buf, (const char *)cur->name); - xmlOutputBufferWriteString(buf, ">"); - if ((format) && (info != NULL) && (!info->isinline) && - (cur->next != NULL)) { - if ((cur->next->type != HTML_TEXT_NODE) && - (cur->next->type != HTML_ENTITY_REF_NODE) && - (cur->parent != NULL) && - (cur->parent->name != NULL) && - (cur->parent->name[0] != 'p')) /* p, pre, param */ - xmlOutputBufferWriteString(buf, "\n"); + xmlOutputBufferWriteString(buf, (const char *)cur->name); + if (cur->nsDef) + xmlNsListDumpOutput(buf, cur->nsDef); + attr = cur->properties; + while (attr != NULL) { + htmlAttrDumpOutput(buf, doc, attr); + attr = attr->next; + } + + if ((info != NULL) && (info->empty)) { + xmlOutputBufferWriteString(buf, ">"); + } else if (cur->children == NULL) { + if ((info != NULL) && (info->saveEndTag != 0) && + (xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) && + (xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) { + xmlOutputBufferWriteString(buf, ">"); + } else { + xmlOutputBufferWriteString(buf, "></"); + if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { + xmlOutputBufferWriteString(buf, + (const char *)cur->ns->prefix); + xmlOutputBufferWriteString(buf, ":"); + } + xmlOutputBufferWriteString(buf, (const char *)cur->name); + xmlOutputBufferWriteString(buf, ">"); + } + } else { + xmlOutputBufferWriteString(buf, ">"); + if ((format) && (info != NULL) && (!info->isinline) && + (cur->children->type != HTML_TEXT_NODE) && + (cur->children->type != HTML_ENTITY_REF_NODE) && + (cur->children != cur->last) && + (cur->name != NULL) && + (cur->name[0] != 'p')) /* p, pre, param */ + xmlOutputBufferWriteString(buf, "\n"); + cur = cur->children; + continue; + } + + if ((format) && (cur->next != NULL) && + (info != NULL) && (!info->isinline)) { + if ((cur->next->type != HTML_TEXT_NODE) && + (cur->next->type != HTML_ENTITY_REF_NODE) && + (cur->parent != NULL) && + (cur->parent->name != NULL) && + (cur->parent->name[0] != 'p')) /* p, pre, param */ + xmlOutputBufferWriteString(buf, "\n"); + } + + break; + + case XML_ATTRIBUTE_NODE: + htmlAttrDumpOutput(buf, doc, (xmlAttrPtr) cur); + break; + + case HTML_TEXT_NODE: + if (cur->content == NULL) + break; + if (((cur->name == (const xmlChar *)xmlStringText) || + (cur->name != (const xmlChar *)xmlStringTextNoenc)) && + ((cur->parent == NULL) || + ((xmlStrcasecmp(cur->parent->name, BAD_CAST "script")) && + (xmlStrcasecmp(cur->parent->name, BAD_CAST "style"))))) { + xmlChar *buffer; + + buffer = xmlEncodeEntitiesReentrant(doc, cur->content); + if (buffer != NULL) { + xmlOutputBufferWriteString(buf, (const char *)buffer); + xmlFree(buffer); + } + } else { + xmlOutputBufferWriteString(buf, (const char *)cur->content); + } + break; + + case HTML_COMMENT_NODE: + if (cur->content != NULL) { + xmlOutputBufferWriteString(buf, "<!--"); + xmlOutputBufferWriteString(buf, (const char *)cur->content); + xmlOutputBufferWriteString(buf, "-->"); + } + break; + + case HTML_PI_NODE: + if (cur->name != NULL) { + xmlOutputBufferWriteString(buf, "<?"); + xmlOutputBufferWriteString(buf, (const char *)cur->name); + if (cur->content != NULL) { + xmlOutputBufferWriteString(buf, " "); + xmlOutputBufferWriteString(buf, + (const char *)cur->content); + } + xmlOutputBufferWriteString(buf, ">"); + } + break; + + case HTML_ENTITY_REF_NODE: + xmlOutputBufferWriteString(buf, "&"); + xmlOutputBufferWriteString(buf, (const char *)cur->name); + xmlOutputBufferWriteString(buf, ";"); + break; + + case HTML_PRESERVE_NODE: + if (cur->content != NULL) { + xmlOutputBufferWriteString(buf, (const char *)cur->content); + } + break; + + default: + break; + } + + while (1) { + if (cur == root) + return; + if (cur->next != NULL) { + cur = cur->next; + break; + } + + /* + * The parent should never be NULL here but we want to handle + * corrupted documents gracefully. + */ + if (cur->parent == NULL) + return; + cur = cur->parent; + + if ((cur->type == XML_HTML_DOCUMENT_NODE) || + (cur->type == XML_DOCUMENT_NODE)) { + xmlOutputBufferWriteString(buf, "\n"); + } else { + if ((format) && (cur->ns == NULL)) + info = htmlTagLookup(cur->name); + else + info = NULL; + + if ((format) && (info != NULL) && (!info->isinline) && + (cur->last->type != HTML_TEXT_NODE) && + (cur->last->type != HTML_ENTITY_REF_NODE) && + (cur->children != cur->last) && + (cur->name != NULL) && + (cur->name[0] != 'p')) /* p, pre, param */ + xmlOutputBufferWriteString(buf, "\n"); + + xmlOutputBufferWriteString(buf, "</"); + if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { + xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); + xmlOutputBufferWriteString(buf, ":"); + } + xmlOutputBufferWriteString(buf, (const char *)cur->name); + xmlOutputBufferWriteString(buf, ">"); + + if ((format) && (info != NULL) && (!info->isinline) && + (cur->next != NULL)) { + if ((cur->next->type != HTML_TEXT_NODE) && + (cur->next->type != HTML_ENTITY_REF_NODE) && + (cur->parent != NULL) && + (cur->parent->name != NULL) && + (cur->parent->name[0] != 'p')) /* p, pre, param */ + xmlOutputBufferWriteString(buf, "\n"); + } + } + } } }
@@ -997,63 +954,45 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, * @buf: the HTML buffer output * @doc: the document * @cur: the current node - * @encoding: the encoding string + * @encoding: the encoding string (unused) * * Dump an HTML node, recursive behaviour,children are printed too, * and formatting returns/spaces are added. */ void htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, - xmlNodePtr cur, const char *encoding) { - htmlNodeDumpFormatOutput(buf, doc, cur, encoding, 1); + xmlNodePtr cur, const char *encoding ATTRIBUTE_UNUSED) { + htmlNodeDumpFormatOutput(buf, doc, cur, NULL, 1); }
/** * htmlDocContentDumpFormatOutput: * @buf: the HTML buffer output * @cur: the document - * @encoding: the encoding string + * @encoding: the encoding string (unused) * @format: should formatting spaces been added * * Dump an HTML document. */ void htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, - const char *encoding, int format) { - int type; - - xmlInitParser(); - - if ((buf == NULL) || (cur == NULL)) - return; - - /* - * force to output the stuff as HTML, especially for entities - */ - type = cur->type; - cur->type = XML_HTML_DOCUMENT_NODE; - if (cur->intSubset != NULL) { - htmlDtdDumpOutput(buf, cur, NULL); - } - if (cur->children != NULL) { - htmlNodeListDumpOutput(buf, cur, cur->children, encoding, format); - } - xmlOutputBufferWriteString(buf, "\n"); - cur->type = (xmlElementType) type; + const char *encoding ATTRIBUTE_UNUSED, + int format) { + htmlNodeDumpFormatOutput(buf, cur, (xmlNodePtr) cur, NULL, format); }
/** * htmlDocContentDumpOutput: * @buf: the HTML buffer output * @cur: the document - * @encoding: the encoding string + * @encoding: the encoding string (unused) * * Dump an HTML document. Formatting return/spaces are added. */ void htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, - const char *encoding) { - htmlDocContentDumpFormatOutput(buf, cur, encoding, 1); + const char *encoding ATTRIBUTE_UNUSED) { + htmlNodeDumpFormatOutput(buf, cur, (xmlNodePtr) cur, NULL, 1); }
/************************************************************************ diff --git a/sdk/lib/3rdparty/libxml2/README b/sdk/lib/3rdparty/libxml2/README index 5c7bddf8de2..495751781d4 100644 --- a/sdk/lib/3rdparty/libxml2/README +++ b/sdk/lib/3rdparty/libxml2/README @@ -19,7 +19,7 @@ To assert build quality: There is 3 standalone tools runtest.c runsuite.c testapi.c, which should compile as part of the build or as any application would. Launch them from this directory to get results, runtest checks - the proper functionning of libxml2 main APIs while testapi does + the proper functioning of libxml2 main APIs while testapi does a full coverage check. Report failures to the list.
To report bugs, follow the instructions at: diff --git a/sdk/lib/3rdparty/libxml2/SAX2.c b/sdk/lib/3rdparty/libxml2/SAX2.c index 5f141f9a3cc..99019a984cd 100644 --- a/sdk/lib/3rdparty/libxml2/SAX2.c +++ b/sdk/lib/3rdparty/libxml2/SAX2.c @@ -590,36 +590,6 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) } else { ret = xmlGetDocEntity(ctxt->myDoc, name); } - if ((ret != NULL) && - ((ctxt->validate) || (ctxt->replaceEntities)) && - (ret->children == NULL) && - (ret->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) { - int val; - - /* - * for validation purposes we really need to fetch and - * parse the external entity - */ - xmlNodePtr children; - unsigned long oldnbent = ctxt->nbentities; - - val = xmlParseCtxtExternalEntity(ctxt, ret->URI, - ret->ExternalID, &children); - if (val == 0) { - xmlAddChildList((xmlNodePtr) ret, children); - } else { - xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, - "Failure to process entity %s\n", name, NULL); - ctxt->validate = 0; - return(NULL); - } - ret->owner = 1; - if (ret->checked == 0) { - ret->checked = (ctxt->nbentities - oldnbent + 1) * 2; - if ((ret->content != NULL) && (xmlStrchr(ret->content, '<'))) - ret->checked |= 1; - } - } return(ret); }
@@ -1693,23 +1663,23 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) } }
- /* - * Insert all the defaulted attributes from the DTD especially namespaces - */ - if ((!ctxt->html) && - ((ctxt->myDoc->intSubset != NULL) || - (ctxt->myDoc->extSubset != NULL))) { - xmlCheckDefaultedAttributes(ctxt, name, prefix, atts); - } + if (!ctxt->html) { + /* + * Insert all the defaulted attributes from the DTD especially + * namespaces + */ + if ((ctxt->myDoc->intSubset != NULL) || + (ctxt->myDoc->extSubset != NULL)) { + xmlCheckDefaultedAttributes(ctxt, name, prefix, atts); + }
- /* - * process all the attributes whose name start with "xmlns" - */ - if (atts != NULL) { - i = 0; - att = atts[i++]; - value = atts[i++]; - if (!ctxt->html) { + /* + * process all the attributes whose name start with "xmlns" + */ + if (atts != NULL) { + i = 0; + att = atts[i++]; + value = atts[i++]; while ((att != NULL) && (value != NULL)) { if ((att[0] == 'x') && (att[1] == 'm') && (att[2] == 'l') && (att[3] == 'n') && (att[4] == 's')) @@ -1718,30 +1688,30 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) att = atts[i++]; value = atts[i++]; } - } - } + }
- /* - * Search the namespace, note that since the attributes have been - * processed, the local namespaces are available. - */ - ns = xmlSearchNs(ctxt->myDoc, ret, prefix); - if ((ns == NULL) && (parent != NULL)) - ns = xmlSearchNs(ctxt->myDoc, parent, prefix); - if ((prefix != NULL) && (ns == NULL)) { - ns = xmlNewNs(ret, NULL, prefix); - xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, - "Namespace prefix %s is not defined\n", - prefix, NULL); - } + /* + * Search the namespace, note that since the attributes have been + * processed, the local namespaces are available. + */ + ns = xmlSearchNs(ctxt->myDoc, ret, prefix); + if ((ns == NULL) && (parent != NULL)) + ns = xmlSearchNs(ctxt->myDoc, parent, prefix); + if ((prefix != NULL) && (ns == NULL)) { + ns = xmlNewNs(ret, NULL, prefix); + xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, + "Namespace prefix %s is not defined\n", + prefix, NULL); + }
- /* - * set the namespace node, making sure that if the default namespace - * is unbound on a parent we simply keep it NULL - */ - if ((ns != NULL) && (ns->href != NULL) && - ((ns->href[0] != 0) || (ns->prefix != NULL))) - xmlSetNs(ret, ns); + /* + * set the namespace node, making sure that if the default namespace + * is unbound on a parent we simply keep it NULL + */ + if ((ns != NULL) && (ns->href != NULL) && + ((ns->href[0] != 0) || (ns->prefix != NULL))) + xmlSetNs(ret, ns); + }
/* * process all the other attributes @@ -2203,7 +2173,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, * attribute values. * * SAX2 callback when an element start has been detected by the parser. - * It provides the namespace informations for the element, as well as + * It provides the namespace information for the element, as well as * the new namespace declarations on the element. */ void @@ -2456,7 +2426,7 @@ xmlSAX2StartElementNs(void *ctx, * @URI: the element namespace name if available * * SAX2 callback when an element end has been detected by the parser. - * It provides the namespace informations for the element. + * It provides the namespace information for the element. */ void xmlSAX2EndElementNs(void *ctx, @@ -2523,20 +2493,21 @@ xmlSAX2Reference(void *ctx, const xmlChar *name) }
/** - * xmlSAX2Characters: + * xmlSAX2Text: * @ctx: the user data (XML parser context) * @ch: a xmlChar string * @len: the number of xmlChar + * @type: text or cdata * - * receiving some chars from the parser. + * Append characters. */ -void -xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) +static void +xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len, + xmlElementType type) { - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNodePtr lastChild;
- if (ctx == NULL) return; + if (ctxt == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2Characters(%.30s, %d)\n", ch, len); @@ -2565,7 +2536,10 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) * elements. Use an attribute in the structure !!! */ if (lastChild == NULL) { - lastChild = xmlSAX2TextNode(ctxt, ch, len); + if (type == XML_TEXT_NODE) + lastChild = xmlSAX2TextNode(ctxt, ch, len); + else + lastChild = xmlNewCDataBlock(ctxt->myDoc, ch, len); if (lastChild != NULL) { ctxt->node->children = lastChild; ctxt->node->last = lastChild; @@ -2579,8 +2553,9 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) } } else { int coalesceText = (lastChild != NULL) && - (lastChild->type == XML_TEXT_NODE) && - (lastChild->name == xmlStringText); + (lastChild->type == type) && + ((type != XML_TEXT_NODE) || + (lastChild->name == xmlStringText)); if ((coalesceText) && (ctxt->nodemem != 0)) { /* * The whole point of maintaining nodelen and nodemem, @@ -2637,7 +2612,10 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) } } else { /* Mixed content, first time */ - lastChild = xmlSAX2TextNode(ctxt, ch, len); + if (type == XML_TEXT_NODE) + lastChild = xmlSAX2TextNode(ctxt, ch, len); + else + lastChild = xmlNewCDataBlock(ctxt->myDoc, ch, len); if (lastChild != NULL) { xmlAddChild(ctxt->node, lastChild); if (ctxt->node->children != NULL) { @@ -2649,6 +2627,20 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) } }
+/** + * xmlSAX2Characters: + * @ctx: the user data (XML parser context) + * @ch: a xmlChar string + * @len: the number of xmlChar + * + * receiving some chars from the parser. + */ +void +xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) +{ + xmlSAX2Text((xmlParserCtxtPtr) ctx, ch, len, XML_TEXT_NODE); +} + /** * xmlSAX2IgnorableWhitespace: * @ctx: the user data (XML parser context) @@ -2805,27 +2797,7 @@ xmlSAX2Comment(void *ctx, const xmlChar *value) void xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len) { - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlNodePtr ret, lastChild; - - if (ctx == NULL) return; -#ifdef DEBUG_SAX - xmlGenericError(xmlGenericErrorContext, - "SAX.pcdata(%.10s, %d)\n", value, len); -#endif - lastChild = xmlGetLastChild(ctxt->node); -#ifdef DEBUG_SAX_TREE - xmlGenericError(xmlGenericErrorContext, - "add chars to %s \n", ctxt->node->name); -#endif - if ((lastChild != NULL) && - (lastChild->type == XML_CDATA_SECTION_NODE)) { - xmlTextConcat(lastChild, value, len); - } else { - ret = xmlNewCDataBlock(ctxt->myDoc, value, len); - if (xmlAddChild(ctxt->node, ret) == NULL) - xmlFreeNode(ret); - } + xmlSAX2Text((xmlParserCtxtPtr) ctx, value, len, XML_CDATA_SECTION_NODE); }
static int xmlSAX2DefaultVersionValue = 2; diff --git a/sdk/lib/3rdparty/libxml2/TODO b/sdk/lib/3rdparty/libxml2/TODO index 9c322249824..94d34c8b6ef 100644 --- a/sdk/lib/3rdparty/libxml2/TODO +++ b/sdk/lib/3rdparty/libxml2/TODO @@ -202,7 +202,7 @@ Done: by the XML parser, UTF-8 should be checked when there is no "encoding" declared ! - Support for UTF-8 and UTF-16 encoding - => added some convertion routines provided by Martin Durst + => added some conversion routines provided by Martin Durst patched them, got fixes from @@@ I plan to keep everything internally as UTF-8 (or ISO-Latin-X) this is slightly more costly but more compact, and recent processors @@ -212,7 +212,7 @@ Done: is enabled, tested the ISO->UTF-8 stuff - External entities loading: - allow override by client code - - make sure it is alled for all external entities referenced + - make sure it is called for all external entities referenced Done, client code should use xmlSetExternalEntityLoader() to set the default loading routine. It will be called each time an external entity entity resolution is triggered. @@ -245,8 +245,8 @@ Done: most cases !
- progressive reading. The entity support is a first step toward - asbtraction of an input stream. A large part of the context is still - located on the stack, moving to a state machine and putting everyting + abstraction of an input stream. A large part of the context is still + located on the stack, moving to a state machine and putting everything in the parsing context should provide an adequate solution. => Rather than progressive parsing, give more power to the SAX-like interface. Currently the DOM-like representation is built but diff --git a/sdk/lib/3rdparty/libxml2/buf.c b/sdk/lib/3rdparty/libxml2/buf.c index d46da365142..24368d379f8 100644 --- a/sdk/lib/3rdparty/libxml2/buf.c +++ b/sdk/lib/3rdparty/libxml2/buf.c @@ -83,7 +83,7 @@ struct _xmlBuf {
/** * xmlBufMemoryError: - * @extra: extra informations + * @extra: extra information * * Handle an out of memory condition * To be improved... @@ -98,7 +98,7 @@ xmlBufMemoryError(xmlBufPtr buf, const char *extra)
/** * xmlBufOverflowError: - * @extra: extra informations + * @extra: extra information * * Handle a buffer overflow error * To be improved... @@ -1233,10 +1233,12 @@ xmlBufBackToBuffer(xmlBufPtr buf) { * Keep the buffer but provide a truncated size value. */ xmlBufOverflowError(buf, "Allocated size too big for xmlBuffer"); + ret->use = (int) buf->use; ret->size = INT_MAX; + } else { + ret->use = (int) buf->use; + ret->size = (int) buf->size; } - ret->use = (int) buf->use; - ret->size = (int) buf->size; ret->alloc = buf->alloc; ret->content = buf->content; ret->contentIO = buf->contentIO; @@ -1332,8 +1334,12 @@ xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input) { int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, size_t base, size_t cur) { - if ((input == NULL) || (buf == NULL) || (buf->error)) + if (input == NULL) return(-1); + if ((buf == NULL) || (buf->error)) { + input->base = input->cur = input->end = BAD_CAST ""; + return(-1); + } CHECK_COMPAT(buf) input->base = &buf->content[base]; input->cur = input->base + cur; diff --git a/sdk/lib/3rdparty/libxml2/c14n.c b/sdk/lib/3rdparty/libxml2/c14n.c index 5b3fbe70c6c..3efcd92eefa 100644 --- a/sdk/lib/3rdparty/libxml2/c14n.c +++ b/sdk/lib/3rdparty/libxml2/c14n.c @@ -132,7 +132,7 @@ static xmlChar *xmlC11NNormalizeString(const xmlChar * input,
/** * xmlC14NErrMemory: - * @extra: extra informations + * @extra: extra information * * Handle a redefinition of memory error */ @@ -147,7 +147,7 @@ xmlC14NErrMemory(const char *extra)
/** * xmlC14NErrParam: - * @extra: extra informations + * @extra: extra information * * Handle a redefinition of param error */ @@ -162,7 +162,7 @@ xmlC14NErrParam(const char *extra)
/** * xmlC14NErrInternal: - * @extra: extra informations + * @extra: extra information * * Handle a redefinition of internal error */ @@ -177,7 +177,7 @@ xmlC14NErrInternal(const char *extra)
/** * xmlC14NErrInvalidNode: - * @extra: extra informations + * @extra: extra information * * Handle a redefinition of invalid node error */ @@ -192,7 +192,7 @@ xmlC14NErrInvalidNode(const char *node_type, const char *extra)
/** * xmlC14NErrUnknownNode: - * @extra: extra informations + * @extra: extra information * * Handle a redefinition of unknown node error */ @@ -207,7 +207,7 @@ xmlC14NErrUnknownNode(int node_type, const char *extra)
/** * xmlC14NErrRelativeNamespace: - * @extra: extra informations + * @extra: extra information * * Handle a redefinition of relative namespace error */ @@ -228,7 +228,7 @@ xmlC14NErrRelativeNamespace(const char *ns_uri) * @node: the context node * @error: the error code * @msg: the message - * @extra: extra informations + * @extra: extra information * * Handle a redefinition of attribute error */ @@ -2033,13 +2033,13 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, }
ret = xmlBufUse(buf->buffer); - if (ret > 0) { + if (ret >= 0) { *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->buffer), ret); } (void) xmlOutputBufferClose(buf);
- if ((*doc_txt_ptr == NULL) && (ret > 0)) { - xmlC14NErrMemory("coping canonicalized document"); + if ((*doc_txt_ptr == NULL) && (ret >= 0)) { + xmlC14NErrMemory("copying canonicalized document"); return (-1); } return (ret); diff --git a/sdk/lib/3rdparty/libxml2/catalog.c b/sdk/lib/3rdparty/libxml2/catalog.c index 7328fd319c0..effbb2e6f48 100644 --- a/sdk/lib/3rdparty/libxml2/catalog.c +++ b/sdk/lib/3rdparty/libxml2/catalog.c @@ -216,7 +216,7 @@ static int xmlCatalogInitialized = 0;
/** * xmlCatalogErrMemory: - * @extra: extra informations + * @extra: extra information * * Handle an out of memory condition */ @@ -234,7 +234,7 @@ xmlCatalogErrMemory(const char *extra) * @catal: the Catalog entry * @node: the context node * @msg: the error message - * @extra: extra informations + * @extra: extra information * * Handle a catalog error */ @@ -924,7 +924,7 @@ xmlParseCatalogFile(const char *filename) { xmlBufResetInput(buf->buffer, inputStream);
inputPush(ctxt, inputStream); - if ((ctxt->directory == NULL) && (directory == NULL)) + if (ctxt->directory == NULL) directory = xmlParserGetDirectory(filename); if ((ctxt->directory == NULL) && (directory != NULL)) ctxt->directory = directory; @@ -2069,8 +2069,7 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID, ret = xmlCatalogXMLResolve(catal->children, pubID, sysID); if (ret != NULL) { break; - } else if ((catal->children != NULL) && - (catal->children->depth > MAX_CATAL_DEPTH)) { + } else if (catal->children->depth > MAX_CATAL_DEPTH) { ret = NULL; break; } @@ -2353,7 +2352,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, xmlCatalogEntryType type = XML_CATA_NONE;
cur = xmlParseSGMLCatalogName(cur, &name); - if (name == NULL) { + if (cur == NULL || name == NULL) { /* error */ break; } @@ -3254,6 +3253,7 @@ xmlLoadCatalogs(const char *pathss) { while ((*cur != 0) && (*cur != PATH_SEPARATOR) && (!xmlIsBlank_ch(*cur))) cur++; path = xmlStrndup((const xmlChar *)paths, cur - paths); + if (path != NULL) { #ifdef _WIN32 iLen = strlen((const char*)path); for(i = 0; i < iLen; i++) { @@ -3262,7 +3262,6 @@ xmlLoadCatalogs(const char *pathss) { } } #endif - if (path != NULL) { xmlLoadCatalog((const char *) path); xmlFree(path); } @@ -3427,9 +3426,10 @@ xmlCatalogAdd(const xmlChar *type, const xmlChar *orig, const xmlChar *replace) (xmlStrEqual(type, BAD_CAST "catalog"))) { xmlDefaultCatalog = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer); - xmlDefaultCatalog->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL, + if (xmlDefaultCatalog != NULL) { + xmlDefaultCatalog->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL, orig, NULL, xmlCatalogDefaultPrefer, NULL); - + } xmlRMutexUnlock(xmlCatalogMutex); return(0); } diff --git a/sdk/lib/3rdparty/libxml2/config.h b/sdk/lib/3rdparty/libxml2/config.h index 55aa50cf4e4..d6756c32de0 100644 --- a/sdk/lib/3rdparty/libxml2/config.h +++ b/sdk/lib/3rdparty/libxml2/config.h @@ -1,6 +1,9 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */
+/* A form that will not confuse apibuild.py */ +/* #undef ATTRIBUTE_DESTRUCTOR */ + /* Type cast for the gethostbyname() argument */ #define GETHOSTBYNAME_ARG_CAST
@@ -10,6 +13,9 @@ /* Define to 1 if you have the <arpa/nameser.h> header file. */ /* #undef HAVE_ARPA_NAMESER_H */
+/* Define if __attribute__((destructor)) is accepted */ +/* #undef HAVE_ATTRIBUTE_DESTRUCTOR */ + /* Whether struct sockaddr::__ss_family exists */ /* #undef HAVE_BROKEN_SS_FAMILY */
diff --git a/sdk/lib/3rdparty/libxml2/debugXML.c b/sdk/lib/3rdparty/libxml2/debugXML.c index d855555861d..7a2ca47d225 100644 --- a/sdk/lib/3rdparty/libxml2/debugXML.c +++ b/sdk/lib/3rdparty/libxml2/debugXML.c @@ -1342,7 +1342,7 @@ xmlCtxtDumpDTD(xmlDebugCtxtPtr ctxt, xmlDtdPtr dtd) * @output: the FILE * for the output * @str: the string * - * Dumps informations about the string, shorten it if necessary + * Dumps information about the string, shorten it if necessary */ void xmlDebugDumpString(FILE * output, const xmlChar * str) @@ -2190,7 +2190,7 @@ xmlShellRegisterRootNamespaces(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED, * @node2: unused * * Implements the XML shell function "grep" - * dumps informations about the node (namespace, attributes, content). + * dumps information about the node (namespace, attributes, content). * * Returns 0 */ @@ -2268,7 +2268,7 @@ xmlShellGrep(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, * @node2: unused * * Implements the XML shell function "dir" - * dumps informations about the node (namespace, attributes, content). + * dumps information about the node (namespace, attributes, content). * * Returns 0 */ @@ -2302,7 +2302,7 @@ xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, * @node2: unused * * Implements the XML shell function "dir" - * dumps informations about the node (namespace, attributes, content). + * dumps information about the node (namespace, attributes, content). * * Returns 0 */ @@ -2900,7 +2900,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, fprintf(ctxt->output, "\tbye leave shell\n"); fprintf(ctxt->output, "\tcat [node] display node or current node\n"); fprintf(ctxt->output, "\tcd [path] change directory to path or to root\n"); - fprintf(ctxt->output, "\tdir [path] dumps informations about the node (namespace, attributes, content)\n"); + fprintf(ctxt->output, "\tdir [path] dumps information about the node (namespace, attributes, content)\n"); fprintf(ctxt->output, "\tdu [path] show the structure of the subtree under path or the current node\n"); fprintf(ctxt->output, "\texit leave shell\n"); fprintf(ctxt->output, "\thelp display this help\n"); diff --git a/sdk/lib/3rdparty/libxml2/dict.c b/sdk/lib/3rdparty/libxml2/dict.c index 336e046aecf..90e4d81403c 100644 --- a/sdk/lib/3rdparty/libxml2/dict.c +++ b/sdk/lib/3rdparty/libxml2/dict.c @@ -10,7 +10,7 @@ * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. * * Author: daniel@veillard.com @@ -452,7 +452,7 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) { unsigned long value = seed;
if (name == NULL) return(0); - value = *name; + value += *name; value <<= 5; if (namelen > 10) { value += name[namelen - 1]; diff --git a/sdk/lib/3rdparty/libxml2/encoding.c b/sdk/lib/3rdparty/libxml2/encoding.c index ad4d8a63a31..cdff6ae7bfb 100644 --- a/sdk/lib/3rdparty/libxml2/encoding.c +++ b/sdk/lib/3rdparty/libxml2/encoding.c @@ -76,7 +76,7 @@ static int xmlLittleEndian = 1;
/** * xmlEncodingErrMemory: - * @extra: extra informations + * @extra: extra information * * Handle an out of memory condition */ @@ -170,7 +170,7 @@ closeIcuConverter(uconv_t *conv) * Returns 0 if success, or -1 otherwise * The value of @inlen after return is the number of octets consumed * if the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. + * The value of @outlen after return is the number of octets produced. */ static int asciiToUTF8(unsigned char* out, int *outlen, @@ -217,7 +217,7 @@ asciiToUTF8(unsigned char* out, int *outlen, * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise * The value of @inlen after return is the number of octets consumed * if the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. + * The value of @outlen after return is the number of octets produced. */ static int UTF8Toascii(unsigned char* out, int *outlen, @@ -301,7 +301,7 @@ UTF8Toascii(unsigned char* out, int *outlen, * Returns the number of bytes written if success, or -1 otherwise * The value of @inlen after return is the number of octets consumed * if the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. + * The value of @outlen after return is the number of octets produced. */ int isolat1ToUTF8(unsigned char* out, int *outlen, @@ -373,6 +373,11 @@ UTF8ToUTF8(unsigned char* out, int *outlen, if (len < 0) return(-1);
+ /* + * FIXME: Conversion functions must assure valid UTF-8, so we have + * to check for UTF-8 validity. Preferably, this converter shouldn't + * be used at all. + */ memcpy(out, inb, len);
*outlen = len; @@ -396,7 +401,7 @@ UTF8ToUTF8(unsigned char* out, int *outlen, or -1 otherwise * The value of @inlen after return is the number of octets consumed * if the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. + * The value of @outlen after return is the number of octets produced. */ int UTF8Toisolat1(unsigned char* out, int *outlen, @@ -496,13 +501,18 @@ UTF16LEToUTF8(unsigned char* out, int *outlen, { unsigned char* outstart = out; const unsigned char* processed = inb; - unsigned char* outend = out + *outlen; + unsigned char* outend; unsigned short* in = (unsigned short*) inb; unsigned short* inend; unsigned int c, d, inlen; unsigned char *tmp; int bits;
+ if (*outlen == 0) { + *inlenb = 0; + return(0); + } + outend = out + *outlen; if ((*inlenb % 2) == 1) (*inlenb)--; inlen = *inlenb / 2; @@ -1483,16 +1493,25 @@ xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) { if ((handler == NULL) || (handlers == NULL)) { xmlEncodingErr(XML_I18N_NO_HANDLER, "xmlRegisterCharEncodingHandler: NULL handler !\n", NULL); - return; + goto free_handler; }
if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) { xmlEncodingErr(XML_I18N_EXCESS_HANDLER, "xmlRegisterCharEncodingHandler: Too many handler registered, see %s\n", "MAX_ENCODING_HANDLERS"); - return; + goto free_handler; } handlers[nbCharEncodingHandler++] = handler; + return; + +free_handler: + if (handler != NULL) { + if (handler->name != NULL) { + xmlFree(handler->name); + } + xmlFree(handler); + } }
/** @@ -1784,7 +1803,7 @@ xmlFindCharEncodingHandler(const char *name) { * @cd: iconv converter data structure * @out: a pointer to an array of bytes to store the result * @outlen: the length of @out - * @in: a pointer to an array of ISO Latin 1 chars + * @in: a pointer to an array of input bytes * @inlen: the length of @in * * Returns 0 if success, or @@ -1795,7 +1814,7 @@ xmlFindCharEncodingHandler(const char *name) { * * The value of @inlen after return is the number of octets consumed * as the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. + * The value of @outlen after return is the number of octets produced. */ static int xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, @@ -1851,7 +1870,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, * @toUnicode : non-zero if toUnicode. 0 otherwise. * @out: a pointer to an array of bytes to store the result * @outlen: the length of @out - * @in: a pointer to an array of ISO Latin 1 chars + * @in: a pointer to an array of input bytes * @inlen: the length of @in * @flush: if true, indicates end of input * @@ -1863,7 +1882,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, * * The value of @inlen after return is the number of octets consumed * as the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. + * The value of @outlen after return is the number of octets produced. */ static int xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen, @@ -1912,6 +1931,25 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen, * * ************************************************************************/
+/** + * xmlEncInputChunk: + * @handler: encoding handler + * @out: a pointer to an array of bytes to store the result + * @outlen: the length of @out + * @in: a pointer to an array of input bytes + * @inlen: the length of @in + * @flush: flush (ICU-related) + * + * Returns 0 if success, or + * -1 by lack of space, or + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + * -3 if there the last byte can't form a single output char. + * + * The value of @inlen after return is the number of octets consumed + * as the return value is 0, else unpredictable. + * The value of @outlen after return is the number of octets produced. + */ static int xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out, int *outlen, const unsigned char *in, int *inlen, int flush) { @@ -1920,6 +1958,8 @@ xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
if (handler->input != NULL) { ret = handler->input(out, outlen, in, inlen); + if (ret > 0) + ret = 0; } #ifdef LIBXML_ICONV_ENABLED else if (handler->iconv_in != NULL) { @@ -1941,7 +1981,25 @@ xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out, return(ret); }
-/* Returns -4 if no output function was found. */ +/** + * xmlEncOutputChunk: + * @handler: encoding handler + * @out: a pointer to an array of bytes to store the result + * @outlen: the length of @out + * @in: a pointer to an array of input bytes + * @inlen: the length of @in + * + * Returns 0 if success, or + * -1 by lack of space, or + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + * -3 if there the last byte can't form a single output char. + * -4 if no output function was found. + * + * The value of @inlen after return is the number of octets consumed + * as the return value is 0, else unpredictable. + * The value of @outlen after return is the number of octets produced. + */ static int xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out, int *outlen, const unsigned char *in, int *inlen) { @@ -1949,6 +2007,8 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
if (handler->output != NULL) { ret = handler->output(out, outlen, in, inlen); + if (ret > 0) + ret = 0; } #ifdef LIBXML_ICONV_ENABLED else if (handler->iconv_out != NULL) { @@ -1958,7 +2018,7 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out, #ifdef LIBXML_ICU_ENABLED else if (handler->uconv_out != NULL) { ret = xmlUconvWrapper(handler->uconv_out, 0, out, outlen, in, inlen, - TRUE); + 1); } #endif /* LIBXML_ICU_ENABLED */ else { @@ -2054,7 +2114,7 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, */ if (ret == -3) ret = 0; if (ret == -1) ret = 0; - return(ret); + return(written ? written : ret); }
/** @@ -2184,7 +2244,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len) */ if (ret == -3) ret = 0; if (ret == -1) ret = 0; - return(ret); + return(c_out ? c_out : ret); }
/** @@ -2394,7 +2454,7 @@ xmlCharEncOutput(xmlOutputBufferPtr output, int init) { int ret; size_t written; - size_t writtentot = 0; + int writtentot = 0; size_t toconv; int c_in; int c_out; @@ -2427,7 +2487,7 @@ retry: xmlGenericError(xmlGenericErrorContext, "initialized encoder\n"); #endif - return(0); + return(c_out); }
/* @@ -2540,7 +2600,7 @@ retry: goto retry; } } - return(ret); + return(writtentot ? writtentot : ret); } #endif
@@ -2705,7 +2765,7 @@ retry: goto retry; } } - return(ret); + return(writtentot ? writtentot : ret); }
/** diff --git a/sdk/lib/3rdparty/libxml2/entities.c b/sdk/lib/3rdparty/libxml2/entities.c index d575e9d177b..1a8f86f0dc2 100644 --- a/sdk/lib/3rdparty/libxml2/entities.c +++ b/sdk/lib/3rdparty/libxml2/entities.c @@ -71,7 +71,7 @@ static xmlEntity xmlEntityApos = {
/** * xmlEntitiesErrMemory: - * @extra: extra informations + * @extra: extra information * * Handle an out of memory condition */ @@ -210,7 +210,7 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, const xmlChar *content) { xmlDictPtr dict = NULL; xmlEntitiesTablePtr table = NULL; - xmlEntityPtr ret; + xmlEntityPtr ret, predef;
if (name == NULL) return(NULL); @@ -223,6 +223,44 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, case XML_INTERNAL_GENERAL_ENTITY: case XML_EXTERNAL_GENERAL_PARSED_ENTITY: case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: + predef = xmlGetPredefinedEntity(name); + if (predef != NULL) { + int valid = 0; + + /* 4.6 Predefined Entities */ + if ((type == XML_INTERNAL_GENERAL_ENTITY) && + (content != NULL)) { + int c = predef->content[0]; + + if (((content[0] == c) && (content[1] == 0)) && + ((c == '>') || (c == ''') || (c == '"'))) { + valid = 1; + } else if ((content[0] == '&') && (content[1] == '#')) { + if (content[2] == 'x') { + xmlChar *hex = BAD_CAST "0123456789ABCDEF"; + xmlChar ref[] = "00;"; + + ref[0] = hex[c / 16 % 16]; + ref[1] = hex[c % 16]; + if (xmlStrcasecmp(&content[3], ref) == 0) + valid = 1; + } else { + xmlChar ref[] = "00;"; + + ref[0] = '0' + c / 10 % 10; + ref[1] = '0' + c % 10; + if (xmlStrEqual(&content[2], ref)) + valid = 1; + } + } + } + if (!valid) { + xmlEntitiesErr(XML_ERR_ENTITY_PROCESSING, + "xmlAddEntity: invalid redeclaration of predefined" + " entity"); + return(NULL); + } + } if (dtd->entities == NULL) dtd->entities = xmlHashCreateDict(0, dict); table = dtd->entities; @@ -666,11 +704,25 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) { } else { /* * We assume we have UTF-8 input. + * It must match either: + * 110xxxxx 10xxxxxx + * 1110xxxx 10xxxxxx 10xxxxxx + * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + * That is: + * cur[0] is 11xxxxxx + * cur[1] is 10xxxxxx + * cur[2] is 10xxxxxx if cur[0] is 111xxxxx + * cur[3] is 10xxxxxx if cur[0] is 1111xxxx + * cur[0] is not 11111xxx */ char buf[11], *ptr; int val = 0, l = 1;
- if (*cur < 0xC0) { + if (((cur[0] & 0xC0) != 0xC0) || + ((cur[1] & 0xC0) != 0x80) || + (((cur[0] & 0xE0) == 0xE0) && ((cur[2] & 0xC0) != 0x80)) || + (((cur[0] & 0xF0) == 0xF0) && ((cur[3] & 0xC0) != 0x80)) || + (((cur[0] & 0xF8) == 0xF8))) { xmlEntitiesErr(XML_CHECK_NOT_UTF8, "xmlEncodeEntities: input not UTF-8"); if (doc != NULL) diff --git a/sdk/lib/3rdparty/libxml2/error.c b/sdk/lib/3rdparty/libxml2/error.c index b7d5b36bc79..9ff1c2ba490 100644 --- a/sdk/lib/3rdparty/libxml2/error.c +++ b/sdk/lib/3rdparty/libxml2/error.c @@ -146,7 +146,7 @@ xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { * xmlParserPrintFileInfo: * @input: an xmlParserInputPtr input * - * Displays the associated file and line informations for the current input + * Displays the associated file and line information for the current input */
void @@ -557,6 +557,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, * of the usual "base" (doc->URL) for the node (bug 152623). */ xmlNodePtr prev = baseptr; + char *href = NULL; int inclcount = 0; while (prev != NULL) { if (prev->prev == NULL) @@ -564,21 +565,20 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, else { prev = prev->prev; if (prev->type == XML_XINCLUDE_START) { - if (--inclcount < 0) - break; + if (inclcount > 0) { + --inclcount; + } else { + href = (char *) xmlGetProp(prev, BAD_CAST "href"); + if (href != NULL) + break; + } } else if (prev->type == XML_XINCLUDE_END) inclcount++; } } - if (prev != NULL) { - if (prev->type == XML_XINCLUDE_START) { - prev->type = XML_ELEMENT_NODE; ... 7011 lines suppressed ...