diff options
author | Mike Hommey <glandium@debian.org> | 2009-03-01 10:54:49 +0100 |
---|---|---|
committer | Mike Hommey <glandium@debian.org> | 2009-03-01 10:54:49 +0100 |
commit | 0c8f97ec9edb09da2e0b19c4f9ddf8c725cebc59 (patch) | |
tree | 0377a21019ca1b10325934c4b4deaff6f8619396 | |
parent | 0c1d871e4c5e46a2945cccb2ce765f9be2fe01fb (diff) | |
download | libxml2-0c8f97ec9edb09da2e0b19c4f9ddf8c725cebc59.tar.gz |
Import upstream version 2.7.2upstream/2.7.2.dfsg
-rw-r--r-- | ChangeLog | 36 | ||||
-rw-r--r-- | HTMLparser.c | 32 | ||||
-rw-r--r-- | NEWS | 11 | ||||
-rw-r--r-- | config.h.in | 3 | ||||
-rwxr-xr-x | configure | 294 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | dict.c | 4 | ||||
-rw-r--r-- | doc/APIfiles.html | 5 | ||||
-rw-r--r-- | doc/APIsymbols.html | 3 | ||||
-rw-r--r-- | doc/devhelp/libxml2-xmlsave.html | 5 | ||||
-rw-r--r-- | doc/devhelp/libxml2.devhelp | 3 | ||||
-rw-r--r-- | doc/html/libxml-xmlsave.html | 3 | ||||
-rw-r--r-- | doc/libxml2-api.xml | 10 | ||||
-rw-r--r-- | doc/libxml2.xsa | 33 | ||||
-rw-r--r-- | doc/news.html | 9 | ||||
-rw-r--r-- | doc/xml.html | 11 | ||||
-rw-r--r-- | include/libxml/xmlsave.h | 5 | ||||
-rw-r--r-- | include/libxml/xmlversion.h | 8 | ||||
-rw-r--r-- | libxml2.spec | 6 | ||||
-rw-r--r-- | parser.c | 6 | ||||
-rwxr-xr-x | python/setup.py | 2 | ||||
-rw-r--r-- | runxmlconf.c | 10 | ||||
-rw-r--r-- | xmlreader.c | 57 | ||||
-rw-r--r-- | xmlsave.c | 27 |
24 files changed, 514 insertions, 73 deletions
@@ -1,3 +1,39 @@ +Fri Oct 3 09:43:45 CEST 2008 Daniel Veillard <daniel@veillard.com> + + * 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 <daniel@veillard.com> + + * parser.c: fix a nasty bug introduced when cleaning up + entities processing in 2.7.x , fixes #554660 + +Thu Sep 25 18:04:20 CEST 2008 Daniel Veillard <daniel@veillard.com> + + * HTMLparser.c: fix an HTML parsing error on large data sections + reported by Mike Day + * test/HTML/utf8bug.html result/HTML/utf8bug.html.err + result/HTML/utf8bug.html.sax result/HTML/utf8bug.html: add the + reproducer to the test suite + +Thu Sep 25 17:35:57 CEST 2008 Daniel Veillard <daniel@veillard.com> + + * runxmlconf.c: fix compilation if XPath is not included + +Thu Sep 25 16:54:04 CEST 2008 Daniel Veillard <daniel@veillard.com> + + * xmlreader.c: patch from Riccardo Scussat fixing custom error + handlers problems. + +Thu Sep 25 16:30:11 CEST 2008 Daniel Veillard <daniel@veillard.com> + + * include/libxml/xmlsave.h xmlsave.c: new options to serialize + as XML/HTML/XHTML and restore old entry point behaviours + Mon Sep 1 16:49:05 CEST 2008 Daniel Veillard <daniel@veillard.com> * doc/xml.html doc/news.html configure.in python/setup.py NEWS: diff --git a/HTMLparser.c b/HTMLparser.c index 57e64df..24b0fc0 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -2768,6 +2768,7 @@ htmlParseCharData(htmlParserCtxtPtr ctxt) { xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 5]; int nbchar = 0; int cur, l; + int chunk = 0; SHRINK; cur = CUR_CHAR(l); @@ -2798,6 +2799,12 @@ htmlParseCharData(htmlParserCtxtPtr ctxt) { nbchar = 0; } NEXTL(l); + chunk++; + if (chunk > HTML_PARSER_BUFFER_SIZE) { + chunk = 0; + SHRINK; + GROW; + } cur = CUR_CHAR(l); if (cur == 0) { SHRINK; @@ -4113,6 +4120,8 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { int htmlParseDocument(htmlParserCtxtPtr ctxt) { + xmlChar start[4]; + xmlCharEncoding enc; xmlDtdPtr dtd; xmlInitParser(); @@ -4132,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 '<' */ @@ -4151,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; - } + } /* @@ -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 f8435d4..1285789 100644 --- a/config.h.in +++ b/config.h.in @@ -85,6 +85,9 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the <inttypes.h.h> header file. */ +#undef HAVE_INTTYPES_H_H + /* Define if isinf is there */ #undef HAVE_ISINF @@ -2191,7 +2191,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac 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 @@ -22663,6 +22663,286 @@ fi done +for ac_header in stdint.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in inttypes.h.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + for ac_header in time.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -26382,7 +26662,7 @@ fi { echo "$as_me:$LINENO: checking for type of socket length (socklen_t)" >&5 echo $ECHO_N "checking for type of socket length (socklen_t)... $ECHO_C" >&6; } cat > conftest.$ac_ext <<EOF -#line 26385 "configure" +#line 26665 "configure" #include "confdefs.h" #include <stddef.h> @@ -26393,7 +26673,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL) ; return 0; } EOF -if { (eval echo configure:26396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26676: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* { echo "$as_me:$LINENO: result: socklen_t *" >&5 @@ -26405,7 +26685,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 26408 "configure" +#line 26688 "configure" #include "confdefs.h" #include <stddef.h> @@ -26416,7 +26696,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL) ; return 0; } EOF -if { (eval echo configure:26419: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* { echo "$as_me:$LINENO: result: size_t *" >&5 @@ -26428,7 +26708,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 26431 "configure" +#line 26711 "configure" #include "confdefs.h" #include <stddef.h> @@ -26439,7 +26719,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (int *)NULL) ; return 0; } EOF -if { (eval echo configure:26442: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* { echo "$as_me:$LINENO: result: int *" >&5 diff --git a/configure.in b/configure.in index 17dad0b..04f363f 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]) @@ -22,9 +22,13 @@ #include <string.h> #ifdef HAVE_STDINT_H #include <stdint.h> +#else +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> #elif defined(WIN32) typedef unsigned __int32 uint32_t; #endif +#endif #include <libxml/tree.h> #include <libxml/dict.h> #include <libxml/xmlmemory.h> diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 479d244..f4ef0e5 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -2797,10 +2797,13 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlregexp.html#xmlRegexpIsDeterminist">xmlRegexpIsDeterminist</a><br /> <a href="html/libxml-xmlregexp.html#xmlRegexpPrint">xmlRegexpPrint</a><br /> <a href="html/libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a><br /> -</p><h2><a name="xmlsave" id="xmlsave">Module xmlsave</a>:</h2><p><a href="html/libxml-xmlsave.html#XML_SAVE_FORMAT">XML_SAVE_FORMAT</a><br /> +</p><h2><a name="xmlsave" id="xmlsave">Module xmlsave</a>:</h2><p><a href="html/libxml-xmlsave.html#XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a><br /> +<a href="html/libxml-xmlsave.html#XML_SAVE_AS_XML">XML_SAVE_AS_XML</a><br /> +<a href="html/libxml-xmlsave.html#XML_SAVE_FORMAT">XML_SAVE_FORMAT</a><br /> <a href="html/libxml-xmlsave.html#XML_SAVE_NO_DECL">XML_SAVE_NO_DECL</a><br /> <a href="html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a><br /> <a href="html/libxml-xmlsave.html#XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a><br /> +<a href="html/libxml-xmlsave.html#XML_SAVE_XHTML">XML_SAVE_XHTML</a><br /> <a href="html/libxml-xmlsave.html#xmlSaveClose">xmlSaveClose</a><br /> <a href="html/libxml-xmlsave.html#xmlSaveCtxt">xmlSaveCtxt</a><br /> <a href="html/libxml-xmlsave.html#xmlSaveCtxtPtr">xmlSaveCtxtPtr</a><br /> diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 952abf5..9a1cf8e 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -788,6 +788,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlerror.html#XML_RNGP_VALUE_NO_CONTENT">XML_RNGP_VALUE_NO_CONTENT</a><br /> <a href="html/libxml-xmlerror.html#XML_RNGP_XMLNS_NAME">XML_RNGP_XMLNS_NAME</a><br /> <a href="html/libxml-xmlerror.html#XML_RNGP_XML_NS">XML_RNGP_XML_NS</a><br /> +<a href="html/libxml-xmlsave.html#XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a><br /> +<a href="html/libxml-xmlsave.html#XML_SAVE_AS_XML">XML_SAVE_AS_XML</a><br /> <a href="html/libxml-xmlerror.html#XML_SAVE_CHAR_INVALID">XML_SAVE_CHAR_INVALID</a><br /> <a href="html/libxml-xmlsave.html#XML_SAVE_FORMAT">XML_SAVE_FORMAT</a><br /> <a href="html/libxml-xmlerror.html#XML_SAVE_NOT_UTF8">XML_SAVE_NOT_UTF8</a><br /> @@ -796,6 +798,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a><br /> <a href="html/libxml-xmlsave.html#XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a><br /> <a href="html/libxml-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING">XML_SAVE_UNKNOWN_ENCODING</a><br /> +<a href="html/libxml-xmlsave.html#XML_SAVE_XHTML">XML_SAVE_XHTML</a><br /> <a href="html/libxml-parser.html#XML_SAX2_MAGIC">XML_SAX2_MAGIC</a><br /> <a href="html/libxml-xmlerror.html#XML_SCHEMAP_AG_PROPS_CORRECT">XML_SCHEMAP_AG_PROPS_CORRECT</a><br /> <a href="html/libxml-xmlerror.html#XML_SCHEMAP_ATTRFORMDEFAULT_VALUE">XML_SCHEMAP_ATTRFORMDEFAULT_VALUE</a><br /> diff --git a/doc/devhelp/libxml2-xmlsave.html b/doc/devhelp/libxml2-xmlsave.html index cbe12bb..852a906 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. <a name="XML_SAVE_FORMAT">XML_SAVE_FORMAT</a> = 1 /* format save output */ <a name="XML_SAVE_NO_DECL">XML_SAVE_NO_DECL</a> = 2 /* drop the xml declaration */ <a name="XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a> = 4 /* no empty tags */ - <a name="XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a> = 8 /* disable XHTML1 specific rules */ + <a name="XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a> = 8 /* disable XHTML1 specific rules */ + <a name="XML_SAVE_XHTML">XML_SAVE_XHTML</a> = 16 /* force XHTML1 specific rules */ + <a name="XML_SAVE_AS_XML">XML_SAVE_AS_XML</a> = 32 /* force XML serialization on HTML doc */ + <a name="XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a> = 64 /* force HTML serialization on XML doc */ }; </pre><p/> </div> diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp index 1288b18..31a5d91 100644 --- a/doc/devhelp/libxml2.devhelp +++ b/doc/devhelp/libxml2.devhelp @@ -969,6 +969,8 @@ <function name="XML_RNGP_VALUE_NO_CONTENT" link="libxml2-xmlerror.html#XML_RNGP_VALUE_NO_CONTENT"/> <function name="XML_RNGP_XMLNS_NAME" link="libxml2-xmlerror.html#XML_RNGP_XMLNS_NAME"/> <function name="XML_RNGP_XML_NS" link="libxml2-xmlerror.html#XML_RNGP_XML_NS"/> + <function name="XML_SAVE_AS_HTML" link="libxml2-xmlsave.html#XML_SAVE_AS_HTML"/> + <function name="XML_SAVE_AS_XML" link="libxml2-xmlsave.html#XML_SAVE_AS_XML"/> <function name="XML_SAVE_CHAR_INVALID" link="libxml2-xmlerror.html#XML_SAVE_CHAR_INVALID"/> <function name="XML_SAVE_FORMAT" link="libxml2-xmlsave.html#XML_SAVE_FORMAT"/> <function name="XML_SAVE_NOT_UTF8" link="libxml2-xmlerror.html#XML_SAVE_NOT_UTF8"/> @@ -977,6 +979,7 @@ <function name="XML_SAVE_NO_EMPTY" link="libxml2-xmlsave.html#XML_SAVE_NO_EMPTY"/> <function name="XML_SAVE_NO_XHTML" link="libxml2-xmlsave.html#XML_SAVE_NO_XHTML"/> <function name="XML_SAVE_UNKNOWN_ENCODING" link="libxml2-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING"/> + <function name="XML_SAVE_XHTML" link="libxml2-xmlsave.html#XML_SAVE_XHTML"/> <function name="XML_SCHEMAP_AG_PROPS_CORRECT" link="libxml2-xmlerror.html#XML_SCHEMAP_AG_PROPS_CORRECT"/> <function name="XML_SCHEMAP_ATTRFORMDEFAULT_VALUE" link="libxml2-xmlerror.html#XML_SCHEMAP_ATTRFORMDEFAULT_VALUE"/> <function name="XML_SCHEMAP_ATTRGRP_NONAME_NOREF" link="libxml2-xmlerror.html#XML_SCHEMAP_ATTRGRP_NONAME_NOREF"/> diff --git a/doc/html/libxml-xmlsave.html b/doc/html/libxml-xmlsave.html index ec9b5da..8609169 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. <a name="XML_SAVE_NO_DECL" id="XML_SAVE_NO_DECL">XML_SAVE_NO_DECL</a> = 2 : drop the xml declaration <a name="XML_SAVE_NO_EMPTY" id="XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a> = 4 : no empty tags <a name="XML_SAVE_NO_XHTML" id="XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a> = 8 : disable XHTML1 specific rules + <a name="XML_SAVE_XHTML" id="XML_SAVE_XHTML">XML_SAVE_XHTML</a> = 16 : force XHTML1 specific rules + <a name="XML_SAVE_AS_XML" id="XML_SAVE_AS_XML">XML_SAVE_AS_XML</a> = 32 : force XML serialization on HTML doc + <a name="XML_SAVE_AS_HTML" id="XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a> = 64 : force HTML serialization on XML doc } </pre><h3><a name="xmlSaveClose" id="xmlSaveClose"></a>Function: xmlSaveClose</h3><pre class="programlisting">int xmlSaveClose (<a href="libxml-xmlsave.html#xmlSaveCtxtPtr">xmlSaveCtxtPtr</a> ctxt)<br /> </pre><p>Close a document saving context, i.e. make sure that all bytes have been output and free the associated data.</p> diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 98dc568..b396c3e 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -2982,9 +2982,12 @@ <summary>the XML document serializer</summary> <description>API to save document or subtree of document </description> <author>Daniel Veillard </author> + <exports symbol='XML_SAVE_XHTML' type='enum'/> + <exports symbol='XML_SAVE_AS_XML' type='enum'/> <exports symbol='XML_SAVE_NO_EMPTY' type='enum'/> - <exports symbol='XML_SAVE_NO_DECL' type='enum'/> <exports symbol='XML_SAVE_NO_XHTML' type='enum'/> + <exports symbol='XML_SAVE_NO_DECL' type='enum'/> + <exports symbol='XML_SAVE_AS_HTML' type='enum'/> <exports symbol='XML_SAVE_FORMAT' type='enum'/> <exports symbol='xmlSaveOption' type='typedef'/> <exports symbol='xmlSaveCtxt' type='typedef'/> @@ -5235,14 +5238,17 @@ crash if you try to modify the tree)'/> <enum name='XML_RNGP_VALUE_NO_CONTENT' file='xmlerror' value='1120' type='xmlParserErrors' info='1120'/> <enum name='XML_RNGP_XMLNS_NAME' file='xmlerror' value='1121' type='xmlParserErrors' info='1121'/> <enum name='XML_RNGP_XML_NS' file='xmlerror' value='1122' type='xmlParserErrors' info='1122'/> + <enum name='XML_SAVE_AS_HTML' file='xmlsave' value='64' type='xmlSaveOption' info=' force HTML serialization on XML doc'/> + <enum name='XML_SAVE_AS_XML' file='xmlsave' value='32' type='xmlSaveOption' info='force XML serialization on HTML doc'/> <enum name='XML_SAVE_CHAR_INVALID' file='xmlerror' value='1401' type='xmlParserErrors' info='1401'/> <enum name='XML_SAVE_FORMAT' file='xmlsave' value='1' type='xmlSaveOption' info='format save output'/> <enum name='XML_SAVE_NOT_UTF8' file='xmlerror' value='1400' type='xmlParserErrors'/> <enum name='XML_SAVE_NO_DECL' file='xmlsave' value='2' type='xmlSaveOption' info='drop the xml declaration'/> <enum name='XML_SAVE_NO_DOCTYPE' file='xmlerror' value='1402' type='xmlParserErrors' info='1402'/> <enum name='XML_SAVE_NO_EMPTY' file='xmlsave' value='4' type='xmlSaveOption' info='no empty tags'/> - <enum name='XML_SAVE_NO_XHTML' file='xmlsave' value='8' type='xmlSaveOption' info=' disable XHTML1 specific rules'/> + <enum name='XML_SAVE_NO_XHTML' file='xmlsave' value='8' type='xmlSaveOption' info='disable XHTML1 specific rules'/> <enum name='XML_SAVE_UNKNOWN_ENCODING' file='xmlerror' value='1403' type='xmlParserErrors' info='1403'/> + <enum name='XML_SAVE_XHTML' file='xmlsave' value='16' type='xmlSaveOption' info='force XHTML1 specific rules'/> <enum name='XML_SCHEMAP_AG_PROPS_CORRECT' file='xmlerror' value='3087' type='xmlParserErrors' info='3086'/> <enum name='XML_SCHEMAP_ATTRFORMDEFAULT_VALUE' file='xmlerror' value='1701' type='xmlParserErrors' info='1701'/> <enum name='XML_SCHEMAP_ATTRGRP_NONAME_NOREF' file='xmlerror' value='1702' type='xmlParserErrors' info='1702'/> diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index bcb3a0e..5a673bb 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,33 +8,14 @@ </vendor> <product id="libxml2"> <name>libxml2</name> - <version>2.7.0</version> - <last-release> Aug 30 2008</last-release> + <version>2.7.1</version> + <last-release> Sep 1 2008</last-release> <info-url>http://xmlsoft.org/</info-url> - <changes> - 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 + <changes> - 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 </changes> </product> diff --git a/doc/news.html b/doc/news.html index d9dd809..31a0cf0 100644 --- a/doc/news.html +++ b/doc/news.html @@ -12,7 +12,14 @@ to help those</p><ul><li>More testing on RelaxNG</li> <li>Finishing up <a href="http://www.w3.org/TR/xmlschema-1/">XML Schemas</a></li> </ul><p>The <a href="ChangeLog.html">change log</a> describes the recents commits -to the <a href="http://svn.gnome.org/viewcvs/libxml2/trunk/">SVN</a> code base.</p><p>Here is the list of public releases:</p><h3>2.7.1: Sep 1 2008</h3><ul><li>Portability fix: Borland C fix (Moritz Both)</li> +to the <a href="http://svn.gnome.org/viewcvs/libxml2/trunk/">SVN</a> code base.</p><p>Here is the list of public releases:</p><h3>2.7.2: Oct 3 2008</h3><ul><li>Portability fix: fix solaris compilation problem, fix compilation + if XPath is not configured in</li> + <li>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) + </li><li>Improvement: xmlSave options for more flexibility to save as + XML/HTML/XHTML, handle leading BOM in HTML documents</li> +</ul><h3>2.7.1: Sep 1 2008</h3><ul><li>Portability fix: Borland C fix (Moritz Both)</li> <li>Bug fixes: python serialization wrappers, XPath QName corner case handking and leaks (Martin)</li> <li>Improvement: extend the xmlSave to handle HTML documents and trees</li> diff --git a/doc/xml.html b/doc/xml.html index 9117958..b443229 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -727,6 +727,17 @@ to the <a href="http://svn.gnome.org/viewcvs/libxml2/trunk/">SVN</a> code base.< <p>Here is the list of public releases:</p> +<h3>2.7.2: Oct 3 2008</h3> +<ul> + <li>Portability fix: fix solaris compilation problem, fix compilation + if XPath is not configured in</li> + <li>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) + <li>Improvement: xmlSave options for more flexibility to save as + XML/HTML/XHTML, handle leading BOM in HTML documents</li> +</ul> + <h3>2.7.1: Sep 1 2008</h3> <ul> <li>Portability fix: Borland C fix (Moritz Both)</li> diff --git a/include/libxml/xmlsave.h b/include/libxml/xmlsave.h index c71c71a..4201b4d 100644 --- a/include/libxml/xmlsave.h +++ b/include/libxml/xmlsave.h @@ -30,7 +30,10 @@ typedef enum { XML_SAVE_FORMAT = 1<<0, /* format save output */ XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ - XML_SAVE_NO_XHTML = 1<<3 /* disable XHTML1 specific rules */ + XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ + XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ + XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ + XML_SAVE_AS_HTML = 1<<6 /* force HTML serialization on XML doc */ } xmlSaveOption; diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h index 227a860..6c5d342 100644 --- a/include/libxml/xmlversion.h +++ b/include/libxml/xmlversion.h @@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.7.1" +#define LIBXML_DOTTED_VERSION "2.7.2" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20701 +#define LIBXML_VERSION 20702 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20701" +#define LIBXML_VERSION_STRING "20702" /** * LIBXML_VERSION_EXTRA: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20701); +#define LIBXML_TEST_VERSION xmlCheckVersion(20702); #ifndef VMS #if 0 diff --git a/libxml2.spec b/libxml2.spec index 039c198..a6da308 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,6 +1,6 @@ Summary: Library providing XML and HTML support Name: libxml2 -Version: 2.7.1 +Version: 2.7.2 Release: 1 License: MIT Group: Development/Libraries @@ -128,6 +128,6 @@ rm -fr %{buildroot} %doc doc/python.html %changelog -* Mon Sep 1 2008 Daniel Veillard <veillard@redhat.com> -- upstream release 2.7.1 see http://xmlsoft.org/news.html +* Fri Oct 3 2008 Daniel Veillard <veillard@redhat.com> +- upstream release 2.7.2 see http://xmlsoft.org/news.html @@ -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); } @@ -7225,8 +7226,11 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) { * Predefined entites override any extra definition */ ent = xmlGetPredefinedEntity(name); - if (ent != NULL) + if (ent != NULL) { + xmlFree(name); + *str = ptr; return(ent); + } /* * Increate the number of entity references parsed diff --git a/python/setup.py b/python/setup.py index 75b3a40..50585c8 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/runxmlconf.c b/runxmlconf.c index 8ef7f74..38b0ce4 100644 --- a/runxmlconf.c +++ b/runxmlconf.c @@ -12,6 +12,8 @@ #include <stdio.h> #endif +#ifdef LIBXML_XPATH_ENABLED + #if !defined(_WIN32) || defined(__CYGWIN__) #include <unistd.h> #endif @@ -605,3 +607,11 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { fclose(logfile); return(ret); } + +#else /* ! LIBXML_XPATH_ENABLED */ +#include <stdio.h> +int +main(int argc, char **argv) { + fprintf(stderr, "%s need XPath support\n", argv[0]); +} +#endif diff --git a/xmlreader.c b/xmlreader.c index bd47ea5..d42b1a0 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -44,6 +44,27 @@ #include <libxml/pattern.h> #endif +#define MAX_ERR_MSG_SIZE 64000 + +/* + * The following VA_COPY was coded following an example in + * the Samba project. It may not be sufficient for some + * esoteric implementations of va_list (i.e. it may need + * something involving a memcpy) but (hopefully) will be + * sufficient for libxml2. + */ +#ifndef VA_COPY + #ifdef HAVE_VA_COPY + #define VA_COPY(dest, src) va_copy(dest, src) + #else + #ifdef HAVE___VA_COPY + #define VA_COPY(dest,src) __va_copy(dest, src) + #else + #define VA_COPY(dest,src) (dest) = (src) + #endif + #endif +#endif + /* #define DEBUG_CALLBACKS */ /* #define DEBUG_READER */ @@ -4500,30 +4521,32 @@ xmlTextReaderStandalone(xmlTextReaderPtr reader) { /* helper to build a xmlMalloc'ed string from a format and va_list */ static char * xmlTextReaderBuildMessage(const char *msg, va_list ap) { - int size; + int size = 0; int chars; char *larger; - char *str; - - str = (char *) xmlMallocAtomic(150); - if (str == NULL) { - xmlGenericError(xmlGenericErrorContext, "xmlMalloc failed !\n"); - return NULL; - } - - size = 150; + char *str = NULL; + va_list aq; while (1) { - chars = vsnprintf(str, size, msg, ap); - if ((chars > -1) && (chars < size)) + VA_COPY(aq, ap); + chars = vsnprintf(str, size, msg, aq); + va_end(aq); + if (chars < 0) { + xmlGenericError(xmlGenericErrorContext, "vsnprintf failed !\n"); + if (str) + xmlFree(str); + return NULL; + } + if ((chars < size) || (size == MAX_ERR_MSG_SIZE)) break; - if (chars > -1) - size += chars + 1; - else - size += 100; + if (chars < MAX_ERR_MSG_SIZE) + size = chars + 1; + else + size = MAX_ERR_MSG_SIZE; if ((larger = (char *) xmlRealloc(str, size)) == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n"); - xmlFree(str); + if (str) + xmlFree(str); return NULL; } str = larger; @@ -757,8 +757,14 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; } #ifdef LIBXML_HTML_ENABLED - if ((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL) && - (cur->doc->type == XML_HTML_DOCUMENT_NODE)) { + if (ctxt->options & XML_SAVE_XHTML) { + xhtmlNodeDumpOutput(ctxt, cur); + return; + } + if (((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL) && + (cur->doc->type == XML_HTML_DOCUMENT_NODE) && + ((ctxt->options & XML_SAVE_AS_XML) == 0)) || + (ctxt->options & XML_SAVE_AS_HTML)) { htmlNodeDumpOutputInternal(ctxt, cur); return; } @@ -953,7 +959,10 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) { xmlGetCharEncodingName((xmlCharEncoding) cur->charset); } - if (cur->type == XML_HTML_DOCUMENT_NODE) { + if (((cur->type == XML_HTML_DOCUMENT_NODE) && + ((ctxt->options & XML_SAVE_AS_XML) == 0) && + ((ctxt->options & XML_SAVE_XHTML) == 0)) || + (ctxt->options & XML_SAVE_AS_HTML)) { #ifdef LIBXML_HTML_ENABLED if (encoding != NULL) htmlSetMetaEncoding(cur, (const xmlChar *) encoding); @@ -981,7 +990,9 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) { #else return(-1); #endif - } else if (cur->type == XML_DOCUMENT_NODE) { + } else if ((cur->type == XML_DOCUMENT_NODE) || + (ctxt->options & XML_SAVE_AS_XML) || + (ctxt->options & XML_SAVE_XHTML)) { enc = xmlParseCharEncoding((const char*) encoding); if ((encoding != NULL) && (oldctxtenc == NULL) && (buf->encoder == NULL) && (buf->conv == NULL) && @@ -1032,6 +1043,8 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) { } #ifdef LIBXML_HTML_ENABLED + if (ctxt->options & XML_SAVE_XHTML) + is_xhtml = 1; if ((ctxt->options & XML_SAVE_NO_XHTML) == 0) { dtd = xmlGetIntSubset(cur); if (dtd != NULL) { @@ -2123,6 +2136,7 @@ xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, ctxt.format = format; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; #ifdef LIBXML_HTML_ENABLED dtd = xmlGetIntSubset(doc); @@ -2208,6 +2222,7 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr, ctxt.format = format; ctxt.encoding = (const xmlChar *) txt_encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, out_doc); xmlOutputBufferFlush(out_buff); if (out_buff->conv != NULL) { @@ -2326,6 +2341,7 @@ xmlDocFormatDump(FILE *f, xmlDocPtr cur, int format) { ctxt.format = format; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); @@ -2375,6 +2391,7 @@ xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) { ctxt.format = 0; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); return(ret); @@ -2414,6 +2431,7 @@ xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, ctxt.format = format; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); return (ret); @@ -2468,6 +2486,7 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur, ctxt.format = format; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); |