From 7f4547cdbd76a2931553759fb433df88b8b99452 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Fri, 3 Oct 2008 07:58:23 +0000 Subject: [PATCH] preparing the release of 2.7.2 fix the Solaris portability issue * configure.in doc/* NEWS: preparing the release of 2.7.2 * dict.c: fix the Solaris portability issue * parser.c: additional cleanup on #554660 fix * test/ent13 result/ent13* result/noent/ent13*: added the example in the regression test suite. * HTMLparser.c: handle leading BOM in htmlParseElement() Daniel svn path=/trunk/; revision=3799 --- ChangeLog | 9 +++++++++ HTMLparser.c | 25 +++++++++++++++++++++--- NEWS | 11 +++++++++++ config.h.in | 3 +++ configure.in | 4 +++- dict.c | 4 ++++ doc/APIfiles.html | 5 ++++- doc/APIsymbols.html | 3 +++ doc/devhelp/libxml2-xmlsave.html | 5 ++++- doc/devhelp/libxml2.devhelp | 3 +++ doc/html/libxml-xmlsave.html | 3 +++ doc/libxml2-api.xml | 10 ++++++++-- doc/libxml2-refs.xml | 9 +++++++++ doc/libxml2.xsa | 33 +++++++------------------------- doc/news.html | 9 ++++++++- doc/xml.html | 11 +++++++++++ parser.c | 2 ++ python/setup.py | 2 +- result/ent13 | 5 +++++ result/ent13.rde | 4 ++++ result/ent13.rdr | 4 ++++ result/ent13.sax | 11 +++++++++++ result/ent13.sax2 | 11 +++++++++++ result/noent/ent13 | 5 +++++ test/ent13 | 6 ++++++ 25 files changed, 161 insertions(+), 36 deletions(-) create mode 100644 result/ent13 create mode 100644 result/ent13.rde create mode 100644 result/ent13.rdr create mode 100644 result/ent13.sax create mode 100644 result/ent13.sax2 create mode 100644 result/noent/ent13 create mode 100644 test/ent13 diff --git a/ChangeLog b/ChangeLog index d950076d..a37871eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Fri Oct 3 09:43:45 CEST 2008 Daniel Veillard + + * configure.in doc/* NEWS: preparing the release of 2.7.2 + * dict.c: fix the Solaris portability issue + * parser.c: additional cleanup on #554660 fix + * test/ent13 result/ent13* result/noent/ent13*: added the + example in the regression test suite. + * HTMLparser.c: handle leading BOM in htmlParseElement() + Thu Oct 2 22:53:39 CEST 2008 Daniel Veillard * parser.c: fix a nasty bug introduced when cleaning up diff --git a/HTMLparser.c b/HTMLparser.c index 202b24a2..24b0fc0f 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -4120,6 +4120,8 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { int htmlParseDocument(htmlParserCtxtPtr ctxt) { + xmlChar start[4]; + xmlCharEncoding enc; xmlDtdPtr dtd; xmlInitParser(); @@ -4139,6 +4141,23 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) { if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator); + if ((ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) && + ((ctxt->input->end - ctxt->input->cur) >= 4)) { + /* + * Get the 4 first bytes and decode the charset + * if enc != XML_CHAR_ENCODING_NONE + * plug some encoding conversion routines. + */ + start[0] = RAW; + start[1] = NXT(1); + start[2] = NXT(2); + start[3] = NXT(3); + enc = xmlDetectCharEncoding(&start[0], 4); + if (enc != XML_CHAR_ENCODING_NONE) { + xmlSwitchEncoding(ctxt, enc); + } + } + /* * Wipe out everything which is before the first '<' */ @@ -4158,10 +4177,10 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) { while (((CUR == '<') && (NXT(1) == '!') && (NXT(2) == '-') && (NXT(3) == '-')) || ((CUR == '<') && (NXT(1) == '?'))) { - htmlParseComment(ctxt); - htmlParsePI(ctxt); + htmlParseComment(ctxt); + htmlParsePI(ctxt); SKIP_BLANKS; - } + } /* diff --git a/NEWS b/NEWS index 8c343200..6928d5ba 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,17 @@ ChangeLog.html to the SVN at http://svn.gnome.org/viewcvs/libxml2/trunk/ code base.Here is the list of public releases: +2.7.2: Oct 3 2008: + - Portability fix: fix solaris compilation problem, fix compilation + if XPath is not configured in + - Bug fixes: nasty entity bug introduced in 2.7.0, restore old behaviour + when saving an HTML doc with an xml dump function, HTML UTF-8 parsing + bug, fix reader custom error handlers (Riccardo Scussat) + + - Improvement: xmlSave options for more flexibility to save as + XML/HTML/XHTML, handle leading BOM in HTML documents + + 2.7.1: Sep 1 2008: - Portability fix: Borland C fix (Moritz Both) - Bug fixes: python serialization wrappers, XPath QName corner diff --git a/config.h.in b/config.h.in index f8435d4f..12857890 100644 --- a/config.h.in +++ b/config.h.in @@ -85,6 +85,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H_H + /* Define if isinf is there */ #undef HAVE_ISINF diff --git a/configure.in b/configure.in index 17dad0b7..04f363fb 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=7 -LIBXML_MICRO_VERSION=1 +LIBXML_MICRO_VERSION=2 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -378,6 +378,8 @@ AC_CHECK_HEADERS([malloc.h]) AC_CHECK_HEADERS([stdarg.h]) AC_CHECK_HEADERS([sys/stat.h]) AC_CHECK_HEADERS([sys/types.h]) +AC_CHECK_HEADERS([stdint.h]) +AC_CHECK_HEADERS([inttypes.h.h]) AC_CHECK_HEADERS([time.h]) AC_CHECK_HEADERS([ansidecl.h]) AC_CHECK_HEADERS([ieeefp.h]) diff --git a/dict.c b/dict.c index 20bd3104..0e07e8dc 100644 --- a/dict.c +++ b/dict.c @@ -22,9 +22,13 @@ #include #ifdef HAVE_STDINT_H #include +#else +#ifdef HAVE_INTTYPES_H +#include #elif defined(WIN32) typedef unsigned __int32 uint32_t; #endif +#endif #include #include #include diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 479d244a..f4ef0e56 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -2797,10 +2797,13 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRegexpIsDeterminist
xmlRegexpPrint
xmlRegexpPtr
-

Module xmlsave:

XML_SAVE_FORMAT
+

Module xmlsave:

XML_SAVE_AS_HTML
+XML_SAVE_AS_XML
+XML_SAVE_FORMAT
XML_SAVE_NO_DECL
XML_SAVE_NO_EMPTY
XML_SAVE_NO_XHTML
+XML_SAVE_XHTML
xmlSaveClose
xmlSaveCtxt
xmlSaveCtxtPtr
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 952abf56..9a1cf8ec 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -788,6 +788,8 @@ A:link, A:visited, A:active { text-decoration: underline } XML_RNGP_VALUE_NO_CONTENT
XML_RNGP_XMLNS_NAME
XML_RNGP_XML_NS
+XML_SAVE_AS_HTML
+XML_SAVE_AS_XML
XML_SAVE_CHAR_INVALID
XML_SAVE_FORMAT
XML_SAVE_NOT_UTF8
@@ -796,6 +798,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SAVE_NO_EMPTY
XML_SAVE_NO_XHTML
XML_SAVE_UNKNOWN_ENCODING
+XML_SAVE_XHTML
XML_SAX2_MAGIC
XML_SCHEMAP_AG_PROPS_CORRECT
XML_SCHEMAP_ATTRFORMDEFAULT_VALUE
diff --git a/doc/devhelp/libxml2-xmlsave.html b/doc/devhelp/libxml2-xmlsave.html index cbe12bbf..852a9068 100644 --- a/doc/devhelp/libxml2-xmlsave.html +++ b/doc/devhelp/libxml2-xmlsave.html @@ -78,7 +78,10 @@ The content of this structure is not made public by the API. XML_SAVE_FORMAT = 1 /* format save output */ XML_SAVE_NO_DECL = 2 /* drop the xml declaration */ XML_SAVE_NO_EMPTY = 4 /* no empty tags */ - XML_SAVE_NO_XHTML = 8 /* disable XHTML1 specific rules */ + XML_SAVE_NO_XHTML = 8 /* disable XHTML1 specific rules */ + XML_SAVE_XHTML = 16 /* force XHTML1 specific rules */ + XML_SAVE_AS_XML = 32 /* force XML serialization on HTML doc */ + XML_SAVE_AS_HTML = 64 /* force HTML serialization on XML doc */ };

diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp index 1288b18a..31a5d916 100644 --- a/doc/devhelp/libxml2.devhelp +++ b/doc/devhelp/libxml2.devhelp @@ -969,6 +969,8 @@ + + @@ -977,6 +979,7 @@ + diff --git a/doc/html/libxml-xmlsave.html b/doc/html/libxml-xmlsave.html index ec9b5da1..86091695 100644 --- a/doc/html/libxml-xmlsave.html +++ b/doc/html/libxml-xmlsave.html @@ -32,6 +32,9 @@ The content of this structure is not made public by the API. XML_SAVE_NO_DECL = 2 : drop the xml declaration XML_SAVE_NO_EMPTY = 4 : no empty tags XML_SAVE_NO_XHTML = 8 : disable XHTML1 specific rules + XML_SAVE_XHTML = 16 : force XHTML1 specific rules + XML_SAVE_AS_XML = 32 : force XML serialization on HTML doc + XML_SAVE_AS_HTML = 64 : force HTML serialization on XML doc }

Function: xmlSaveClose

int	xmlSaveClose			(xmlSaveCtxtPtr ctxt)

Close a document saving context, i.e. make sure that all bytes have been output and free the associated data.

diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 98dc5687..b396c3e4 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -2982,9 +2982,12 @@ the XML document serializer API to save document or subtree of document Daniel Veillard + + - + + @@ -5235,14 +5238,17 @@ crash if you try to modify the tree)'/> + + - + + diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml index 31945166..d5bfd8ef 100644 --- a/doc/libxml2-refs.xml +++ b/doc/libxml2-refs.xml @@ -782,6 +782,8 @@ + + @@ -790,6 +792,7 @@ + @@ -4319,6 +4322,8 @@ + + @@ -4327,6 +4332,7 @@ + @@ -13414,10 +13420,13 @@ + + + diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index bcb3a0e1..5a673bb8 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,33 +8,14 @@ libxml2 - 2.7.0 - Aug 30 2008 + 2.7.1 + Sep 1 2008 http://xmlsoft.org/ - - Documentation: switch ChangeLog to UTF-8, improve mutithreads and - xmlParserCleanup docs - - Portability fixes: Older Win32 platforms (Rob Richards), MSVC - porting fix (Rob Richards), Mac OS X regression tests (Sven Herzberg), - non GNUCC builds (Rob Richards), compilation on Haiku (Andreas Färber) - - - Bug fixes: various realloc problems (Ashwin), potential double-free - (Ashwin), regexp crash, icrash with invalid whitespace facets (Rob - Richards), pattern fix when streaming (William Brack), various XML - parsing and validation fixes based on the W3C regression tests, reader - tree skipping function fix (Ashwin), Schemas regexps escaping fix - (Volker Grabsch), handling of entity push errors (Ashwin), fix a slowdown - when encoder cant serialize characters on output - - Code cleanup: compilation fix without the reader, without the output - (Robert Schwebel), python whitespace (Martin), many space/tabs cleanups, - serious cleanup of the entity handling code - - Improvement: switch parser to XML-1.0 5th edition, add parsing flags - for old versions, switch URI parsing to RFC 3986, - add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer), - new hashing functions for dictionnaries (based on Stefan Behnel work), - improve handling of misplaced html/head/body in HTML parser, better - regression test tools and code coverage display, better algorithms - to detect various versions of the billion laughts attacks, make - arbitrary parser limits avoidable as a parser option + - Portability fix: Borland C fix (Moritz Both) + - Bug fixes: python serialization wrappers, XPath QName corner + case handking and leaks (Martin) + - Improvement: extend the xmlSave to handle HTML documents and trees + - Cleanup: python serialization wrappers diff --git a/doc/news.html b/doc/news.html index d9dd8094..31a0cf0b 100644 --- a/doc/news.html +++ b/doc/news.html @@ -12,7 +12,14 @@ to help those

The change log describes the recents commits -to the SVN code base.

Here is the list of public releases:

2.7.1: Sep 1 2008

  • Portability fix: Borland C fix (Moritz Both)
  • +to the SVN code base.

    Here is the list of public releases:

    2.7.2: Oct 3 2008

    • Portability fix: fix solaris compilation problem, fix compilation + if XPath is not configured in
    • +
    • Bug fixes: nasty entity bug introduced in 2.7.0, restore old behaviour + when saving an HTML doc with an xml dump function, HTML UTF-8 parsing + bug, fix reader custom error handlers (Riccardo Scussat) +
    • Improvement: xmlSave options for more flexibility to save as + XML/HTML/XHTML, handle leading BOM in HTML documents
    • +

    2.7.1: Sep 1 2008

    • Portability fix: Borland C fix (Moritz Both)
    • Bug fixes: python serialization wrappers, XPath QName corner case handking and leaks (Martin)
    • Improvement: extend the xmlSave to handle HTML documents and trees
    • diff --git a/doc/xml.html b/doc/xml.html index 91179584..b4432298 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -727,6 +727,17 @@ to the SVN code base.<

      Here is the list of public releases:

      +

      2.7.2: Oct 3 2008

      +
        +
      • Portability fix: fix solaris compilation problem, fix compilation + if XPath is not configured in
      • +
      • Bug fixes: nasty entity bug introduced in 2.7.0, restore old behaviour + when saving an HTML doc with an xml dump function, HTML UTF-8 parsing + bug, fix reader custom error handlers (Riccardo Scussat) +
      • Improvement: xmlSave options for more flexibility to save as + XML/HTML/XHTML, handle leading BOM in HTML documents
      • +
      +

      2.7.1: Sep 1 2008

      • Portability fix: Borland C fix (Moritz Both)
      • diff --git a/parser.c b/parser.c index fe4e6a00..4b7b7584 100644 --- a/parser.c +++ b/parser.c @@ -7215,6 +7215,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) { } if (*ptr != ';') { xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); + xmlFree(name); *str = ptr; return(NULL); } @@ -7226,6 +7227,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) { */ ent = xmlGetPredefinedEntity(name); if (ent != NULL) { + xmlFree(name); *str = ptr; return(ent); } diff --git a/python/setup.py b/python/setup.py index 75b3a40b..50585c8a 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.7.1", + version = "2.7.2", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/result/ent13 b/result/ent13 new file mode 100644 index 00000000..8dd96c98 --- /dev/null +++ b/result/ent13 @@ -0,0 +1,5 @@ + + +]> +a diff --git a/result/ent13.rde b/result/ent13.rde new file mode 100644 index 00000000..d9227fc1 --- /dev/null +++ b/result/ent13.rde @@ -0,0 +1,4 @@ +0 10 test 0 0 +0 1 t 0 0 +1 3 #text 0 1 a +0 15 t 0 0 diff --git a/result/ent13.rdr b/result/ent13.rdr new file mode 100644 index 00000000..d9227fc1 --- /dev/null +++ b/result/ent13.rdr @@ -0,0 +1,4 @@ +0 10 test 0 0 +0 1 t 0 0 +1 3 #text 0 1 a +0 15 t 0 0 diff --git a/result/ent13.sax b/result/ent13.sax new file mode 100644 index 00000000..5e4bb44b --- /dev/null +++ b/result/ent13.sax @@ -0,0 +1,11 @@ +SAX.setDocumentLocator() +SAX.startDocument() +SAX.internalSubset(test, , ) +SAX.entityDecl(ampproblem, 1, (null), (null), &) +SAX.getEntity(ampproblem) +SAX.externalSubset(test, , ) +SAX.getEntity(ampproblem) +SAX.startElement(t, a='&problem;') +SAX.characters(a, 1) +SAX.endElement(t) +SAX.endDocument() diff --git a/result/ent13.sax2 b/result/ent13.sax2 new file mode 100644 index 00000000..3414da6e --- /dev/null +++ b/result/ent13.sax2 @@ -0,0 +1,11 @@ +SAX.setDocumentLocator() +SAX.startDocument() +SAX.internalSubset(test, , ) +SAX.entityDecl(ampproblem, 1, (null), (null), &) +SAX.getEntity(ampproblem) +SAX.externalSubset(test, , ) +SAX.getEntity(ampproblem) +SAX.startElementNs(t, NULL, NULL, 0, 1, 0, a='&...', 12) +SAX.characters(a, 1) +SAX.endElementNs(t, NULL, NULL) +SAX.endDocument() diff --git a/result/noent/ent13 b/result/noent/ent13 new file mode 100644 index 00000000..02bc0690 --- /dev/null +++ b/result/noent/ent13 @@ -0,0 +1,5 @@ + + +]> +a diff --git a/test/ent13 b/test/ent13 new file mode 100644 index 00000000..f5ebd891 --- /dev/null +++ b/test/ent13 @@ -0,0 +1,6 @@ + + +]> +a +