update libxml2 to version 2.7.6

svn path=/trunk/; revision=43624
This commit is contained in:
Christoph von Wittich 2009-10-19 19:59:37 +00:00
parent 751ac9df16
commit 82e600f4fe
86 changed files with 24227 additions and 25794 deletions

View file

@ -116,7 +116,7 @@ extern "C" {
* Whether module support is configured into libxslt
* Note: no default module path for win32 platforms
*/
#if 1
#if 0
#ifndef WITH_MODULES
#define WITH_MODULES
#endif
@ -126,11 +126,11 @@ extern "C" {
/**
* Locale support
*/
#if 1
#if 0
#ifndef XSLT_LOCALE_XLOCALE
#define XSLT_LOCALE_XLOCALE
#endif
#elif 0
#elif 1
#ifndef XSLT_LOCALE_WINAPI
#define XSLT_LOCALE_WINAPI
#endif

View file

@ -1,8 +1,9 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -16,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@ -43,6 +45,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = xmlversion.h
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@ -50,9 +53,23 @@ am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(xmlincdir)"
xmlincHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(xmlinc_HEADERS)
ETAGS = etags
CTAGS = ctags
@ -73,10 +90,6 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@
CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@
@ -85,14 +98,14 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOCB_OBJ = @DOCB_OBJ@
ECHO = @ECHO@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
FTP_OBJ = @FTP_OBJ@
GREP = @GREP@
HAVE_ISINF = @HAVE_ISINF@
@ -106,6 +119,7 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@ -117,6 +131,7 @@ LIBXML_VERSION = @LIBXML_VERSION@
LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@
LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
@ -125,8 +140,12 @@ MODULE_EXTENSION = @MODULE_EXTENSION@
MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@
MV = @MV@
M_LIBS = @M_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -137,6 +156,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PYTHON = @PYTHON@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_LIBS = @PYTHON_LIBS@
PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
PYTHON_SUBDIR = @PYTHON_SUBDIR@
PYTHON_TESTS = @PYTHON_TESTS@
@ -175,6 +195,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@
THREAD_LIBS = @THREAD_LIBS@
U = @U@
VERSION = @VERSION@
VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@
WGET = @WGET@
WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
@ -225,8 +246,7 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@ -257,6 +277,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@ -270,6 +291,7 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
xmlincdir = $(includedir)/libxml2/libxml
@ -330,13 +352,13 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/libxml/Makefile'; \
cd $(top_srcdir) && \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu include/libxml/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@ -355,6 +377,7 @@ $(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
xmlversion.h: $(top_builddir)/config.status $(srcdir)/xmlversion.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
@ -366,34 +389,37 @@ clean-libtool:
install-xmlincHEADERS: $(xmlinc_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(xmlincdir)" || $(MKDIR_P) "$(DESTDIR)$(xmlincdir)"
@list='$(xmlinc_HEADERS)'; for p in $$list; do \
@list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(xmlincHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(xmlincdir)/$$f'"; \
$(xmlincHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(xmlincdir)/$$f"; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(xmlincdir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(xmlincdir)" || exit $$?; \
done
uninstall-xmlincHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(xmlinc_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(xmlincdir)/$$f'"; \
rm -f "$(DESTDIR)$(xmlincdir)/$$f"; \
done
@list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(xmlincdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(xmlincdir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@ -401,29 +427,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@ -444,13 +475,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@ -481,6 +516,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -499,6 +535,8 @@ dvi-am:
html: html-am
html-am:
info: info-am
info-am:
@ -507,20 +545,29 @@ install-data-am: install-xmlincHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
@ -559,6 +606,7 @@ uninstall-am: uninstall-xmlincHEADERS
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(xmlincdir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -52,11 +52,22 @@ extern "C" {
* ...
*/
/*
* xmlC14NMode:
*
* Predefined values for C14N modes
*
*/
typedef enum {
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
XML_C14N_1_1 = 2 /* C14N 1.1 spec */
} xmlC14NMode;
XMLPUBFUN int XMLCALL
xmlC14NDocSaveTo (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int exclusive,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf);
@ -64,7 +75,7 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlC14NDocDumpMemory (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int exclusive,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlChar **doc_txt_ptr);
@ -72,7 +83,7 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlC14NDocSave (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int exclusive,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
const char* filename,
@ -100,7 +111,7 @@ XMLPUBFUN int XMLCALL
xmlC14NExecute (xmlDocPtr doc,
xmlC14NIsVisibleCallback is_visible_callback,
void* user_data,
int exclusive,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf);

View file

@ -76,6 +76,7 @@ XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc
#undef xmlGenericError
#undef xmlStructuredError
#undef xmlGenericErrorContext
#undef xmlStructuredErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlTreeIndentString
@ -158,6 +159,8 @@ struct _xmlGlobalState
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
void *xmlStructuredErrorContext;
};
#ifdef __cplusplus
@ -354,6 +357,14 @@ XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
XMLPUBVAR void * xmlGenericErrorContext;
#endif
XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredErrorContext \
(*(__xmlStructuredErrorContext()))
#else
XMLPUBVAR void * xmlStructuredErrorContext;
#endif
XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGetWarningsDefaultValue \

View file

@ -190,7 +190,10 @@ struct _xmlParserCtxt {
const xmlChar *version; /* the XML version string */
const xmlChar *encoding; /* the declared encoding, if any */
int standalone; /* standalone document */
int html; /* an HTML(1)/Docbook(2) document */
int html; /* an HTML(1)/Docbook(2) document
* 3 is HTML after <head>
* 10 is HTML after <body>
*/
/* Input stream stack */
xmlParserInputPtr input; /* Current input stream */
@ -594,7 +597,7 @@ typedef void (*cdataBlockSAXFunc) (
* Display and format a warning messages, callback.
*/
typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* errorSAXFunc:
* @ctx: an XML parser context
@ -604,7 +607,7 @@ typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
* Display and format an error messages, callback.
*/
typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* fatalErrorSAXFunc:
* @ctx: an XML parser context
@ -616,7 +619,7 @@ typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
* get all the callbacks for errors.
*/
typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx,
const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* isStandaloneSAXFunc:
* @ctx: the user data (XML parser context)
@ -850,7 +853,7 @@ XMLPUBFUN int XMLCALL
* Recovery mode
*/
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverDoc (xmlChar *cur);
xmlRecoverDoc (const xmlChar *cur);
XMLPUBFUN xmlDocPtr XMLCALL
xmlRecoverMemory (const char *buffer,
int size);

View file

@ -32,7 +32,7 @@ typedef xmlRelaxNG *xmlRelaxNGPtr;
*
* Signature of an error callback from a Relax-NG validation
*/
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlRelaxNGValidityWarningFunc:
@ -42,7 +42,7 @@ typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg
*
* Signature of a warning callback from a Relax-NG validation
*/
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* A schemas validation context

View file

@ -41,7 +41,7 @@ typedef xmlValidState *xmlValidStatePtr;
*/
typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
const char *msg,
...) ATTRIBUTE_PRINTF(2,3);
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlValidityWarningFunc:
@ -56,7 +56,7 @@ typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
*/
typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
const char *msg,
...) ATTRIBUTE_PRINTF(2,3);
...) LIBXML_ATTR_FORMAT(2,3);
#ifdef IN_LIBXML
/**

View file

@ -98,6 +98,10 @@ XMLPUBFUN int XMLCALL
xmlXIncludeProcessFlagsData(xmlDocPtr doc,
int flags,
void *data);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
int flags,
void *data);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTree (xmlNodePtr tree);
XMLPUBFUN int XMLCALL

View file

@ -843,7 +843,7 @@ typedef enum {
*/
typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
const char *msg,
...) ATTRIBUTE_PRINTF(2,3);
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlStructuredErrorFunc:
* @userData: user provided data for the error callback
@ -874,19 +874,19 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCDECL
xmlParserError (void *ctx,
const char *msg,
...) ATTRIBUTE_PRINTF(2,3);
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserWarning (void *ctx,
const char *msg,
...) ATTRIBUTE_PRINTF(2,3);
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserValidityError (void *ctx,
const char *msg,
...) ATTRIBUTE_PRINTF(2,3);
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserValidityWarning (void *ctx,
const char *msg,
...) ATTRIBUTE_PRINTF(2,3);
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCALL
xmlParserPrintFileInfo (xmlParserInputPtr input);
XMLPUBFUN void XMLCALL
@ -930,7 +930,7 @@ XMLPUBFUN void XMLCALL
int int1,
int col,
const char *msg,
...) ATTRIBUTE_PRINTF(16,17);
...) LIBXML_ATTR_FORMAT(16,17);
XMLPUBFUN void XMLCALL
__xmlSimpleError (int domain,
int code,

View file

@ -108,7 +108,12 @@
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
/*
* 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(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else

View file

@ -63,7 +63,7 @@ typedef void (XMLCALL *xmlFreeFunc)(void *mem);
*
* Returns a pointer to the newly allocated block or NULL in case of error.
*/
typedef void *(ATTRIBUTE_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
/**
* xmlReallocFunc:
@ -88,11 +88,11 @@ typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
/*
* The 4 interfaces used for all memory handling within libxml.
LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMallocAtomic;
LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
LIBXML_DLL_IMPORT xmlFreeFunc xmlFree;
LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc;
LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic;
LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc;
LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup;
*/
/*
@ -150,7 +150,7 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlMemoryDump (void);
XMLPUBFUN void * XMLCALL
xmlMemMalloc (size_t size) ATTRIBUTE_ALLOC_SIZE(1);
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
xmlMemRealloc (void *ptr,size_t size);
XMLPUBFUN void XMLCALL
@ -158,11 +158,11 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN char * XMLCALL
xmlMemoryStrdup (const char *str);
XMLPUBFUN void * XMLCALL
xmlMallocLoc (size_t size, const char *file, int line) ATTRIBUTE_ALLOC_SIZE(1);
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
XMLPUBFUN void * XMLCALL
xmlMallocAtomicLoc (size_t size, const char *file, int line) ATTRIBUTE_ALLOC_SIZE(1);
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN char * XMLCALL
xmlMemStrdupLoc (const char *str, const char *file, int line);

View file

@ -92,7 +92,7 @@ typedef xmlSchema *xmlSchemaPtr;
*
* Signature of an error callback from an XSD validation
*/
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlSchemaValidityWarningFunc:
@ -102,7 +102,7 @@ typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg,
*
* Signature of a warning callback from an XSD validation
*/
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* A schemas validation context

View file

@ -59,7 +59,7 @@ XMLPUBFUN const xmlChar * XMLCALL
const xmlChar *val);
XMLPUBFUN const xmlChar * XMLCALL
xmlStrcasestr (const xmlChar *str,
xmlChar *val);
const xmlChar *val);
XMLPUBFUN int XMLCALL
xmlStrcmp (const xmlChar *str1,
const xmlChar *str2);

View file

@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.7.3"
#define LIBXML_DOTTED_VERSION "2.7.6"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 20703
#define LIBXML_VERSION 20706
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "20703"
#define LIBXML_VERSION_STRING "20706"
/**
* LIBXML_VERSION_EXTRA:
*
* extra version information, used to show a CVS compilation
*/
#define LIBXML_VERSION_EXTRA "-CVS2831"
#define LIBXML_VERSION_EXTRA "-GITv2.7.6"
/**
* 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(20703);
#define LIBXML_TEST_VERSION xmlCheckVersion(20706);
#ifndef VMS
#if 0
@ -398,35 +398,35 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
* ATTRIBUTE_ALLOC_SIZE:
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#ifndef ATTRIBUTE_ALLOC_SIZE
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
# define ATTRIBUTE_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# else
# define ATTRIBUTE_ALLOC_SIZE(x)
# define LIBXML_ATTR_ALLOC_SIZE(x)
# endif
#else
# define ATTRIBUTE_ALLOC_SIZE(x)
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
/**
* ATTRIBUTE_PRINTF:
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#ifndef ATTRIBUTE_PRINTF
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define ATTRIBUTE_PRINTF(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
# else
# define ATTRIBUTE_PRINTF(fmt,args)
# define LIBXML_ATTR_FORMAT(fmt,args)
# endif
#else
# define ATTRIBUTE_PRINTF(fmt,args)
# define LIBXML_ATTR_FORMAT(fmt,args)
#endif
#else /* ! __GNUC__ */
@ -437,17 +437,17 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*/
#define ATTRIBUTE_UNUSED
/**
* ATTRIBUTE_ALLOC_SIZE:
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#define ATTRIBUTE_ALLOC_SIZE(x)
#define LIBXML_ATTR_ALLOC_SIZE(x)
/**
* ATTRIBUTE_PRINTF:
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#define ATTRIBUTE_PRINTF(fmt,args)
#define LIBXML_ATTR_FORMAT(fmt,args)
#endif /* __GNUC__ */
#ifdef __cplusplus

View file

@ -398,35 +398,35 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
* ATTRIBUTE_ALLOC_SIZE:
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#ifndef ATTRIBUTE_ALLOC_SIZE
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
# define ATTRIBUTE_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# else
# define ATTRIBUTE_ALLOC_SIZE(x)
# define LIBXML_ATTR_ALLOC_SIZE(x)
# endif
#else
# define ATTRIBUTE_ALLOC_SIZE(x)
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
/**
* ATTRIBUTE_PRINTF:
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#ifndef ATTRIBUTE_PRINTF
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define ATTRIBUTE_PRINTF(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
# else
# define ATTRIBUTE_PRINTF(fmt,args)
# define LIBXML_ATTR_FORMAT(fmt,args)
# endif
#else
# define ATTRIBUTE_PRINTF(fmt,args)
# define LIBXML_ATTR_FORMAT(fmt,args)
#endif
#else /* ! __GNUC__ */
@ -437,17 +437,17 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*/
#define ATTRIBUTE_UNUSED
/**
* ATTRIBUTE_ALLOC_SIZE:
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#define ATTRIBUTE_ALLOC_SIZE(x)
#define LIBXML_ATTR_ALLOC_SIZE(x)
/**
* ATTRIBUTE_PRINTF:
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#define ATTRIBUTE_PRINTF(fmt,args)
#define LIBXML_ATTR_FORMAT(fmt,args)
#endif /* __GNUC__ */
#ifdef __cplusplus

View file

@ -70,12 +70,12 @@ extern "C" {
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
const char *format, ...)
ATTRIBUTE_PRINTF(2,3);
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
const char *format,
va_list argptr)
ATTRIBUTE_PRINTF(2,0);
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr
writer,
const xmlChar *
@ -105,13 +105,13 @@ extern "C" {
xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
ATTRIBUTE_PRINTF(3,4);
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
ATTRIBUTE_PRINTF(3,0);
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr
writer,
const xmlChar * name,
@ -123,7 +123,7 @@ extern "C" {
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
ATTRIBUTE_PRINTF(5,6);
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
@ -131,7 +131,7 @@ extern "C" {
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
ATTRIBUTE_PRINTF(5,0);
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr
writer,
const xmlChar *
@ -148,11 +148,11 @@ extern "C" {
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
const char *format, ...)
ATTRIBUTE_PRINTF(2,3);
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
const char *format, va_list argptr)
ATTRIBUTE_PRINTF(2,0);
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
const xmlChar * content, int len);
@ -163,13 +163,13 @@ extern "C" {
writer,
const char
*format, ...)
ATTRIBUTE_PRINTF(2,3);
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr
writer,
const char
*format,
va_list argptr)
ATTRIBUTE_PRINTF(2,0);
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer,
const xmlChar *
content);
@ -204,13 +204,13 @@ extern "C" {
xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
ATTRIBUTE_PRINTF(3,4);
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
ATTRIBUTE_PRINTF(3,0);
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr
writer,
const xmlChar * name,
@ -222,7 +222,7 @@ extern "C" {
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
ATTRIBUTE_PRINTF(5,6);
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
@ -230,7 +230,7 @@ extern "C" {
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
ATTRIBUTE_PRINTF(5,0);
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
writer,
const xmlChar *
@ -257,12 +257,12 @@ extern "C" {
xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
const xmlChar * target,
const char *format, ...)
ATTRIBUTE_PRINTF(3,4);
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
const xmlChar * target,
const char *format, va_list argptr)
ATTRIBUTE_PRINTF(3,0);
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWritePI(xmlTextWriterPtr writer,
const xmlChar * target,
@ -287,11 +287,11 @@ extern "C" {
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
const char *format, ...)
ATTRIBUTE_PRINTF(2,3);
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
const char *format, va_list argptr)
ATTRIBUTE_PRINTF(2,0);
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
const xmlChar * content);
@ -315,14 +315,14 @@ extern "C" {
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, ...)
ATTRIBUTE_PRINTF(5,6);
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, va_list argptr)
ATTRIBUTE_PRINTF(5,0);
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
const xmlChar * name,
@ -353,13 +353,13 @@ extern "C" {
xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
ATTRIBUTE_PRINTF(3,4);
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
ATTRIBUTE_PRINTF(3,0);
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr
writer,
const xmlChar *
@ -383,13 +383,13 @@ extern "C" {
xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
ATTRIBUTE_PRINTF(3,4);
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
ATTRIBUTE_PRINTF(3,0);
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
writer,
const xmlChar *
@ -414,14 +414,14 @@ extern "C" {
int pe,
const xmlChar * name,
const char *format, ...)
ATTRIBUTE_PRINTF(4,5);
LIBXML_ATTR_FORMAT(4,5);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char *format,
va_list argptr)
ATTRIBUTE_PRINTF(4,0);
LIBXML_ATTR_FORMAT(4,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
int pe,

View file

@ -116,7 +116,7 @@ extern "C" {
* Whether module support is configured into libxslt
* Note: no default module path for win32 platforms
*/
#if 1
#if 0
#ifndef WITH_MODULES
#define WITH_MODULES
#endif
@ -126,11 +126,11 @@ extern "C" {
/**
* Locale support
*/
#if 1
#if 0
#ifndef XSLT_LOCALE_XLOCALE
#define XSLT_LOCALE_XLOCALE
#endif
#elif 0
#elif 1
#ifndef XSLT_LOCALE_WINAPI
#define XSLT_LOCALE_WINAPI
#endif

View file

@ -1,7 +1,139 @@
Fri Jul 10 16:11:34 CEST 2009 Daniel Veillard <daniel@veillard.com>
* parser.c: fix a regression in entity parsing when using the reader
introduced because we were not reusing _private on entities parsing
context
Thu Jul 9 10:21:00 CEST 2009 Daniel Veillard <daniel@veillard.com>
Aleksey Sanin support for c14n 1.1
* c14n.c include/libxml/c14n.h: adds support for C14N 1.1,
new flags at the API level
* runtest.c Makefile.am testC14N.c xmllint.c: add support in CLI
tools and test binaries
* result/c14n/1-1-without-comments/* test/c14n/1-1-without-comments/*:
add a new batch of tests
Thu Jul 9 08:52:35 CEST 2009 Daniel Veillard <daniel@veillard.com>
* config.h.in: update of libtool seems to have modified it
* python/libxml2class.txt: python update modified the order
of classes apparently
Thu Jul 9 08:43:06 CEST 2009 Daniel Veillard <daniel@veillard.com>
* tree.c: avoid calling xmlAddID with NULL values
* parser.c: add a few xmlInitParser in some entry points
Fri Jun 19 19:51:08 CEST 2009 Rob Richards <rrichards@cdatazone.org>
* parser.c: use options from current parser context when creating
a parser context within xmlParseCtxtExternalEntity
* xmlwriter.c: fix error message when unable to create output file
Thu Jun 4 11:17:23 CEST 2009 Daniel Veillard <daniel@veillard.com>
* c14n.c debugXML.c doc/examples/io2.c parser.c schematron.c
valid.c xmlschemas.c xmlwriter.c xpath.c: use %s to printf string
patch by Christian Persch, fixes #581612
Thu Jun 4 11:06:07 CEST 2009 Daniel Veillard <daniel@veillard.com>
* parser.c threads.c: change the threading initialization sequence
as suggested by Igor Novoseltsev to avoid crash if xmlInitParser()
is called from a thread which is not the main one, should fix
#584605
Fri May 15 17:54:48 CEST 2009 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: make sure we keep line numbers fixes #580705
based Aaron Patterson patch
Tue May 12 09:13:58 CEST 2009 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: a broken HTML table attributes initialization,
fixes #581803, by Roland Steiner <rolandsteiner@google.com>
Tue May 12 08:54:20 CEST 2009 Daniel Veillard <daniel@veillard.com>
* libxml2.doap: adding RDF dope file.
Tue May 12 08:42:52 CEST 2009 Daniel Veillard <daniel@veillard.com>
* configure.in: adapt the extra version detection code to git
Wed Apr 29 16:09:38 CEST 2009 Rob Richards <rrichards@cdatazone.org>
* parser.c: do not set error code in xmlNsWarn
Wed Apr 15 11:18:24 CEST 2009 Daniel Veillard <daniel@veillard.com>
* include/libxml/parser.h include/libxml/xmlwriter.h
include/libxml/relaxng.h include/libxml/xmlversion.h.in
include/libxml/xmlwin32version.h.in include/libxml/valid.h
include/libxml/xmlschemas.h include/libxml/xmlerror.h: change
ATTRIBUTE_PRINTF into LIBXML_ATTR_FORMAT to avoid macro name
collisions with other packages and headers as reported by
Belgabor and Mike Hommey
Thu Apr 2 13:57:15 CEST 2009 Daniel Veillard <daniel@veillard.com>
* error.c: fix structured error handling problems #564217
Thu Mar 26 19:08:08 CET 2009 Rob Richards <rrichards@cdatazone.org>
* parser.c: use options from current parser context when creating
an entity parser context
Wed Mar 25 11:40:34 CET 2009 Daniel Veillard <daniel@veillard.com>
* doc/*: updated SVN URL for GNOME as pointed by Vincent Lefevre
and regenerated docs
Wed Mar 25 11:21:26 CET 2009 Daniel Veillard <daniel@veillard.com>
* parser.c: hide the nbParse* variables used for debugging
as pointed by Mike Hommey
Wed Mar 25 10:50:05 CET 2009 Daniel Veillard <daniel@veillard.com>
* include/wsockcompat.h win32/Makefile.bcb xpath.c: fixes for
Borland/CodeGear/Embarcadero compilers by Eric Zurcher
Wed Mar 25 10:43:07 CET 2009 Daniel Veillard <daniel@veillard.com>
* xpath.c: xmlXPathRegisterNs should not allow enpty prefixes
Mon Mar 23 20:27:15 CET 2009 Daniel Veillard <daniel@veillard.com>
* tree.c: add a missing check in xmlAddSibling, patch by Kris Breuker
* xmlIO.c: avoid xmlAllocOutputBuffer using XML_BUFFER_EXACT which
leads to performances problems especially on Windows.
Tue Mar 3 14:30.28 HKT 2009 William Brack <wbrack@mmm.com.hk>
* trio.h: changed include of config.h to be surrounded by
quotation marks #570806
Sat Feb 21 10:20:34 CET 2009 Daniel Veillard <daniel@veillard.com>
* threads.c parser.c: more warnings about xmlCleanupThreads and
xmlCleanupParser to avoid troubles like #571409
Fri Feb 20 09:40:04 CET 2009 Daniel Veillard <daniel@veillard.com>
* xmlwriter.c: cleanups and error reports when xmlTextWriterVSprintf
fails, by Jinmei Tatuya
Fri Feb 20 09:18:56 CET 2009 Daniel Veillard <daniel@veillard.com>
* xmlwriter.c: remove a couple of leaks on errors reported by
Jinmei Tatuya
Sun Jan 18 22:37:59 CET 2009 Daniel Veillard <daniel@veillard.com>
* configure.in doc/xml.html doc/*: preparing 0.7.3 release
* include/libxml/parserInternals.h SAX2.c: fix a typo in an name
* include/libxml/parserInternals.h SAX2.c: fix a typo in a name
Sun Jan 18 21:48:28 CET 2009 Daniel Veillard <daniel@veillard.com>

View file

@ -163,6 +163,10 @@ htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
static int
htmlnamePush(htmlParserCtxtPtr ctxt, const xmlChar * value)
{
if ((ctxt->html < 3) && (xmlStrEqual(value, BAD_CAST "head")))
ctxt->html = 3;
if ((ctxt->html < 10) && (xmlStrEqual(value, BAD_CAST "body")))
ctxt->html = 10;
if (ctxt->nameNr >= ctxt->nameMax) {
ctxt->nameMax *= 2;
ctxt->nameTab = (const xmlChar * *)
@ -287,6 +291,58 @@ htmlnamePop(htmlParserCtxtPtr ctxt)
if (l == 1) b[i++] = (xmlChar) v; \
else i += xmlCopyChar(l,&b[i],v)
/**
* htmlFindEncoding:
* @the HTML parser context
*
* Ty to find and encoding in the current data available in the input
* buffer this is needed to try to switch to the proper encoding when
* one face a character error.
* That's an heuristic, since it's operating outside of parsing it could
* try to use a meta which had been commented out, that's the reason it
* should only be used in case of error, not as a default.
*
* Returns an encoding string or NULL if not found, the string need to
* be freed
*/
static xmlChar *
htmlFindEncoding(xmlParserCtxtPtr ctxt) {
const xmlChar *start, *cur, *end;
if ((ctxt == NULL) || (ctxt->input == NULL) ||
(ctxt->input->encoding != NULL) || (ctxt->input->buf == NULL) ||
(ctxt->input->buf->encoder != NULL))
return(NULL);
if ((ctxt->input->cur == NULL) || (ctxt->input->end == NULL))
return(NULL);
start = ctxt->input->cur;
end = ctxt->input->end;
/* we also expect the input buffer to be zero terminated */
if (*end != 0)
return(NULL);
cur = xmlStrcasestr(start, BAD_CAST "HTTP-EQUIV");
if (cur == NULL)
return(NULL);
cur = xmlStrcasestr(cur, BAD_CAST "CONTENT");
if (cur == NULL)
return(NULL);
cur = xmlStrcasestr(cur, BAD_CAST "CHARSET=");
if (cur == NULL)
return(NULL);
cur += 8;
start = cur;
while (((*cur >= 'A') && (*cur <= 'Z')) ||
((*cur >= 'a') && (*cur <= 'z')) ||
((*cur >= '0') && (*cur <= '9')) ||
(*cur == '-') || (*cur == '_') || (*cur == ':') || (*cur == '/'))
cur++;
if (cur == start)
return(NULL);
return(xmlStrndup(start, cur - start));
}
/**
* htmlCurrentChar:
* @ctxt: the HTML parser context
@ -328,19 +384,25 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
c = *cur;
if (c & 0x80) {
if (cur[1] == 0)
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)
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)
if (cur[3] == 0) {
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
cur = ctxt->input->cur;
}
if (((c & 0xf8) != 0xf0) ||
((cur[3] & 0xc0) != 0x80))
goto encoding_error;
@ -369,6 +431,13 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
}
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);
@ -386,8 +455,28 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
/*
* Humm this is bad, do an automatic flow conversion
*/
{
xmlChar * guess;
xmlCharEncodingHandlerPtr handler;
guess = htmlFindEncoding(ctxt);
if (guess == NULL) {
xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1);
} else {
if (ctxt->input->encoding != NULL)
xmlFree((xmlChar *) ctxt->input->encoding);
ctxt->input->encoding = guess;
handler = xmlFindCharEncodingHandler((const char *) guess);
if (handler != NULL) {
xmlSwitchToEncoding(ctxt, handler);
} else {
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
"Unsupported encoding %s", guess, NULL);
}
}
ctxt->charset = XML_CHAR_ENCODING_UTF8;
}
return(xmlCurrentChar(ctxt, len));
encoding_error:
@ -606,7 +695,7 @@ static const char* const language_attr[] = { "language", NULL } ;
static const char* const select_content[] = { "optgroup", "option", NULL } ;
static const char* const select_attrs[] = { ATTRS, "name", "size", "multiple", "disabled", "tabindex", "onfocus", "onblur", "onchange", NULL } ;
static const char* const style_attrs[] = { I18N, "media", "title", NULL } ;
static const char* const table_attrs[] = { ATTRS "summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding", "datapagesize", NULL } ;
static const char* const table_attrs[] = { ATTRS, "summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding", "datapagesize", NULL } ;
static const char* const table_depr[] = { "align", "bgcolor", NULL } ;
static const char* const table_contents[] = { "caption", "col", "colgroup", "thead", "tfoot", "tbody", "tr", NULL} ;
static const char* const tr_elt[] = { "tr", NULL } ;
@ -938,7 +1027,7 @@ static const char * const htmlStartClose[] = {
"listing", "xmp", NULL,
"ol", "p", "head", "ul", NULL,
"menu", "p", "head", "ul", NULL,
"p", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", NULL,
"p", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", FONTSTYLE, NULL,
"div", "p", "head", NULL,
"noscript", "p", "head", NULL,
"center", "font", "b", "i", "p", "head", NULL,
@ -1303,6 +1392,8 @@ htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem) {
*/
static void
htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
int i;
if (!htmlOmittedDefaultValue)
return;
if (xmlStrEqual(newtag, BAD_CAST"html"))
@ -1321,6 +1412,10 @@ htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
(xmlStrEqual(newtag, BAD_CAST"link")) ||
(xmlStrEqual(newtag, BAD_CAST"title")) ||
(xmlStrEqual(newtag, BAD_CAST"base")))) {
if (ctxt->html >= 3) {
/* we already saw or generated an <head> before */
return;
}
/*
* dropped OBJECT ... i you put it first BODY will be
* assumed !
@ -1331,7 +1426,10 @@ htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
} else if ((!xmlStrEqual(newtag, BAD_CAST"noframes")) &&
(!xmlStrEqual(newtag, BAD_CAST"frame")) &&
(!xmlStrEqual(newtag, BAD_CAST"frameset"))) {
int i;
if (ctxt->html >= 10) {
/* we already saw or generated a <body> before */
return;
}
for (i = 0;i < ctxt->nameNr;i++) {
if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"body")) {
return;
@ -2201,11 +2299,12 @@ htmlParseHTMLName(htmlParserCtxtPtr ctxt) {
xmlChar loc[HTML_PARSER_BUFFER_SIZE];
if (!IS_ASCII_LETTER(CUR) && (CUR != '_') &&
(CUR != ':')) return(NULL);
(CUR != ':') && (CUR != '.')) return(NULL);
while ((i < HTML_PARSER_BUFFER_SIZE) &&
((IS_ASCII_LETTER(CUR)) || (IS_ASCII_DIGIT(CUR)) ||
(CUR == ':') || (CUR == '-') || (CUR == '_'))) {
(CUR == ':') || (CUR == '-') || (CUR == '_') ||
(CUR == '.'))) {
if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20;
else loc[i] = CUR;
i++;
@ -2461,7 +2560,7 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
NEXT;
}
}
*out++ = 0;
*out = 0;
return(buffer);
}
@ -3446,6 +3545,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
int i;
int discardtag = 0;
if (ctxt->instate == XML_PARSER_EOF)
return(-1);
if ((ctxt == NULL) || (ctxt->input == NULL)) {
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
"htmlParseStartTag: context error\n", NULL, NULL);
@ -3464,7 +3565,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
"htmlParseStartTag: invalid element name\n",
NULL, NULL);
/* Dump the bogus tag like browsers do */
while ((IS_CHAR_CH(CUR)) && (CUR != '>'))
while ((IS_CHAR_CH(CUR)) && (CUR != '>') &&
(ctxt->instate != XML_PARSER_EOF))
NEXT;
return -1;
}
@ -3837,6 +3939,10 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
long cons = ctxt->nbChars;
GROW;
if (ctxt->instate == XML_PARSER_EOF)
break;
/*
* Our tag or one of it's parent or children is ending.
*/
@ -4005,6 +4111,10 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
"htmlParseElement: context error\n", NULL, NULL);
return;
}
if (ctxt->instate == XML_PARSER_EOF)
return;
/* Capture start position */
if (ctxt->record_info) {
node_info.begin_pos = ctxt->input->consumed +
@ -4134,6 +4244,7 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
return(XML_ERR_INTERNAL_ERROR);
}
ctxt->html = 1;
ctxt->linenumbers = 1;
GROW;
/*
* SAX: beginning of the document processing.
@ -4520,18 +4631,27 @@ htmlCreateDocParserCtxt(const xmlChar *cur, const char *encoding) {
*/
static int
htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
xmlChar next, xmlChar third, int iscomment) {
xmlChar next, xmlChar third, int iscomment,
int ignoreattrval)
{
int base, len;
htmlParserInputPtr in;
const xmlChar *buf;
int incomment = 0;
int invalue = 0;
char valdellim = 0x0;
in = ctxt->input;
if (in == NULL) return(-1);
if (in == NULL)
return (-1);
base = in->cur - in->base;
if (base < 0) return(-1);
if (base < 0)
return (-1);
if (ctxt->checkIndex > base)
base = ctxt->checkIndex;
if (in->buf == NULL) {
buf = in->base;
len = in->length;
@ -4539,11 +4659,14 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
buf = in->buf->buffer->content;
len = in->buf->buffer->use;
}
/* take into account the sequence length */
if (third) len -= 2;
else if (next) len --;
if (third)
len -= 2;
else if (next)
len--;
for (; base < len; base++) {
if (!incomment && (base + 4 < len) && !iscomment) {
if ((!incomment) && (base + 4 < len) && (!iscomment)) {
if ((buf[base] == '<') && (buf[base + 1] == '!') &&
(buf[base + 2] == '-') && (buf[base + 3] == '-')) {
incomment = 1;
@ -4551,6 +4674,22 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
base += 2;
}
}
if (ignoreattrval) {
if (buf[base] == '"' || buf[base] == '\'') {
if (invalue) {
if (buf[base] == valdellim) {
invalue = 0;
continue;
}
} else {
valdellim = buf[base];
invalue = 1;
continue;
}
} else if (invalue) {
continue;
}
}
if (incomment) {
if (base + 3 > len)
return (-1);
@ -4563,10 +4702,11 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
}
if (buf[base] == first) {
if (third != 0) {
if ((buf[base + 1] != next) ||
(buf[base + 2] != third)) continue;
if ((buf[base + 1] != next) || (buf[base + 2] != third))
continue;
} else if (next != 0) {
if (buf[base + 1] != next) continue;
if (buf[base + 1] != next)
continue;
}
ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
@ -4586,6 +4726,7 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
return (base - (in->cur - in->base));
}
}
if ((!incomment) && (!invalue))
ctxt->checkIndex = base;
#ifdef DEBUG_PUSH
if (next == 0)
@ -4596,11 +4737,86 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
"HPP: lookup '%c%c' failed\n", first, next);
else
xmlGenericError(xmlGenericErrorContext,
"HPP: lookup '%c%c%c' failed\n", first, next, third);
"HPP: lookup '%c%c%c' failed\n", first, next,
third);
#endif
return (-1);
}
/**
* htmlParseLookupChars:
* @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.
* 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.
*
* Returns the index to the current parsing point if a stopChar
* is available, -1 otherwise.
*/
static int
htmlParseLookupChars(htmlParserCtxtPtr ctxt, const xmlChar * stop,
int stopLen)
{
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 = in->buf->buffer->content;
len = in->buf->buffer->use;
}
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));
}
}
}
ctxt->checkIndex = base;
return (-1);
}
/**
* htmlParseTryOrFinish:
* @ctxt: an HTML parser context
@ -4730,7 +4946,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
(UPP(6) == 'Y') && (UPP(7) == 'P') &&
(UPP(8) == 'E')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -4763,7 +4979,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((cur == '<') && (next == '!') &&
(in->cur[2] == '-') && (in->cur[3] == '-')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0))
(htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -4773,7 +4989,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
ctxt->instate = XML_PARSER_MISC;
} else if ((cur == '<') && (next == '?')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -4787,7 +5003,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
(UPP(6) == 'Y') && (UPP(7) == 'P') &&
(UPP(8) == 'E')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -4823,7 +5039,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((cur == '<') && (next == '!') &&
(in->cur[2] == '-') && (in->cur[3] == '-')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0))
(htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -4833,7 +5049,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
ctxt->instate = XML_PARSER_PROLOG;
} else if ((cur == '<') && (next == '?')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -4870,7 +5086,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((cur == '<') && (next == '!') &&
(in->cur[2] == '-') && (in->cur[3] == '-')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0))
(htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -4880,7 +5096,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
ctxt->instate = XML_PARSER_EPILOG;
} else if ((cur == '<') && (next == '?')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -4930,7 +5146,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
break;
}
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
failed = htmlParseStartTag(ctxt);
@ -5055,7 +5271,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
int idx;
xmlChar val;
idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0);
idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0, 1);
if (idx < 0)
goto done;
val = in->cur[idx + 2];
@ -5082,7 +5298,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
(UPP(6) == 'Y') && (UPP(7) == 'P') &&
(UPP(8) == 'E')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR,
"Misplaced DOCTYPE declaration\n",
@ -5092,7 +5308,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
(in->cur[2] == '-') && (in->cur[3] == '-')) {
if ((!terminate) &&
(htmlParseLookupSequence(
ctxt, '-', '-', '>', 1) < 0))
ctxt, '-', '-', '>', 1, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -5102,7 +5318,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
ctxt->instate = XML_PARSER_CONTENT;
} else if ((cur == '<') && (next == '?')) {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -5130,7 +5346,8 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
break;
} else if (cur == '&') {
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, ';', 0, 0, 0) < 0))
(htmlParseLookupChars(ctxt,
BAD_CAST "; >/", 4) < 0))
goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
@ -5146,7 +5363,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
* data detection.
*/
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '<', 0, 0, 0) < 0))
(htmlParseLookupChars(ctxt, BAD_CAST "<&", 2) < 0))
goto done;
ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
@ -5172,7 +5389,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if (avail < 2)
goto done;
if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0))
goto done;
htmlParseEndTag(ctxt);
if (ctxt->nameNr == 0) {
@ -5971,6 +6188,10 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options)
ctxt->options |= HTML_PARSE_COMPACT;
options -= HTML_PARSE_COMPACT;
}
if (options & XML_PARSE_HUGE) {
ctxt->options |= XML_PARSE_HUGE;
options -= XML_PARSE_HUGE;
}
ctxt->dictNames = 0;
return (options);
}

View file

@ -160,14 +160,18 @@ found_content:
*/
int
htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
htmlNodePtr cur, meta;
const xmlChar *content;
htmlNodePtr cur, meta = NULL, head = NULL;
const xmlChar *content = NULL;
char newcontent[100];
if (doc == NULL)
return(-1);
/* html isn't a real encoding it's just libxml2 way to get entities */
if (!xmlStrcasecmp(encoding, BAD_CAST "html"))
return(-1);
if (encoding != NULL) {
snprintf(newcontent, sizeof(newcontent), "text/html; charset=%s",
(char *)encoding);
@ -201,39 +205,24 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) {
if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0)
break;
if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0)
if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) {
head = cur->parent;
goto found_meta;
}
}
cur = cur->next;
}
if (cur == NULL)
return(-1);
found_head:
if (cur->children == NULL) {
if (encoding == NULL)
return(0);
meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL);
xmlAddChild(cur, meta);
xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type");
xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
return(0);
}
head = cur;
if (cur->children == NULL)
goto create;
cur = cur->children;
found_meta:
if (encoding != NULL) {
/*
* Create a new Meta element with the right attributes
*/
meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL);
xmlAddPrevSibling(cur, meta);
xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type");
xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
}
/*
* Search and destroy all the remaining the meta elements carrying
* Search and update all the remaining the meta elements carrying
* encoding informations
*/
while (cur != NULL) {
@ -266,16 +255,36 @@ found_meta:
}
if ((http != 0) && (content != NULL)) {
meta = cur;
cur = cur->next;
xmlUnlinkNode(meta);
xmlFreeNode(meta);
continue;
break;
}
}
}
cur = cur->next;
}
create:
if (meta == NULL) {
if ((encoding != NULL) && (head != NULL)) {
/*
* Create a new Meta element with the right attributes
*/
meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL);
if (head->children == NULL)
xmlAddChild(head, meta);
else
xmlAddPrevSibling(head->children, meta);
xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type");
xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent);
}
} else {
/* change the document only if there is a real encoding change */
if (xmlStrcasestr(content, encoding) == NULL) {
xmlSetProp(meta, BAD_CAST"content", BAD_CAST newcontent);
}
}
return(0);
}
@ -1173,8 +1182,8 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL)
return(-1);
htmlSetMetaEncoding(cur, (const xmlChar *) encoding);
}
htmlSetMetaEncoding(cur, (const xmlChar *) encoding);
} else {
htmlSetMetaEncoding(cur, (const xmlChar *) "UTF-8");
}

View file

@ -58,4 +58,4 @@ Compilation
Daniel
veillard@redhat.com
$Id: INSTALL,v 1.4 2006/03/24 14:02:54 veillard Exp $
$Id$

View file

@ -18,7 +18,16 @@ bin_SCRIPTS=xml2-config
lib_LTLIBRARIES = libxml2.la
libxml2_la_LIBADD = @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) @M_LIBS@ @WIN32_EXTRA_LIBADD@
libxml2_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -version-info @LIBXML_VERSION_INFO@ @MODULE_PLATFORM_LIBS@
if USE_VERSION_SCRIPT
LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
else
LIBXML2_VERSION_SCRIPT =
endif
libxml2_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ \
$(LIBXML2_VERSION_SCRIPT) \
-version-info @LIBXML_VERSION_INFO@ \
@MODULE_PLATFORM_LIBS@
if WITH_TRIO_SOURCES
libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
@ -923,7 +932,7 @@ VTimingtests: xmllint$(EXEEXT)
C14Ntests : testC14N$(EXEEXT)
@echo "## C14N and XPath regression tests"
-@(for m in with-comments without-comments exc-without-comments ; do \
-@(for m in with-comments without-comments 1-1-without-comments exc-without-comments ; do \
for i in $(srcdir)/test/c14n/$$m/*.xml ; do \
if [ ! -d $$i ] ; then \
name=`basename $$i .xml`; \
@ -1044,7 +1053,7 @@ Relaxtests: xmllint$(EXEEXT)
> res.$$name 2> err.$$name;\
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/relaxng/"$$name"_"$$xno" res.$$name;\
if [ "$$name" != "tutor10_1" -a "$$name" != "tutor10_2" -a "$$name" != "tutor3_2" -a "$$name" != "307377" ] ; then \
if [ "$$name" != "tutor10_1" -a "$$name" != "tutor10_2" -a "$$name" != "tutor3_2" -a "$$name" != "307377" -a "$$name" != "tutor8_2" ] ; then \
diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
err.$$name | grep -v "error detected at";\
fi ; grep Unimplemented err.$$name`; \
@ -1141,7 +1150,7 @@ cleanup:
dist-hook: cleanup libxml2.spec
-cp libxml2.spec $(distdir)
(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn win32 macos vms bakefile test result) | (cd $(distdir); tar xf -)
(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn win32 macos vms VxWorks bakefile test result) | (cd $(distdir); tar xf -)
dist-source: distdir
$(AMTAR) -chof - --exclude Tests --exclude test --exclude result $(distdir) | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-sources+"`.tar.gz
@ -1187,7 +1196,7 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \
triop.h triodef.h libxml.h elfgcchack.h \
testThreadsWin32.c genUnicode.py TODO_SCHEMAS \
dbgen.pl dbgenattr.pl regressions.py regressions.xml \
README.tests Makefile.tests \
README.tests Makefile.tests libxml2.syms \
$(CVS_EXTRA_DIST)
@ -1211,12 +1220,12 @@ install-data-local:
-@INSTALL@ -m 0644 $(srcdir)/testXPath.c $(DESTDIR)$(EXAMPLES_DIR)
uninstall-local:
rm $(DESTDIR)$(EXAMPLES_DIR)/testXPath.c
rm $(DESTDIR)$(EXAMPLES_DIR)/testHTML.c
rm $(DESTDIR)$(EXAMPLES_DIR)/testSAX.c
rm $(DESTDIR)$(EXAMPLES_DIR)/xmllint.c
rm -f $(DESTDIR)$(EXAMPLES_DIR)/testXPath.c
rm -f $(DESTDIR)$(EXAMPLES_DIR)/testHTML.c
rm -f $(DESTDIR)$(EXAMPLES_DIR)/testSAX.c
rm -f $(DESTDIR)$(EXAMPLES_DIR)/xmllint.c
rm -rf $(DESTDIR)$(EXAMPLES_DIR)
rm $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)/Copyright
rm -f $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)/Copyright
rm -rf $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
tst: tst.c

File diff suppressed because it is too large Load diff

View file

@ -13,8 +13,169 @@ The change log at
ChangeLog.html
describes the recents commits
to the SVN at
http://svn.gnome.org/viewcvs/libxml2/trunk/
http://svn.gnome.org/viewvc/libxml2/trunk/
code base.Here is the list of public releases:
2.7.6: Oct 6 2009:
- Bug Fixes:
Restore thread support in default configuration (Andrew W. Nosenko),
URI with no path parsing problem (Daniel Veillard),
Minor patch for conditional defines in threads.c (Eric Zurcher)
2.7.5: Sep 24 2009:
- Bug Fixes:
Restore behavior of --with-threads without argument (Andrew W. Nosenko),
Fix memory leak when doc is NULL (Rob Richards),
595792 fixing a RelaxNG bug introduced in 2.7.4 (Daniel Veillard),
Fix a Relaxng bug raised by libvirt test suite (Daniel Veillard),
Fix a parsing problem with little data at startup (Daniel Veillard),
link python module with python library (Frederic Crozat),
594874 Forgot an fclose in xmllint (Daniel Veillard)
- Cleanup:
Adding symbols.xml to EXTRA_DIST (Daniel Veillard)
2.7.4: Sep 10 2009:
- Improvements:
Switch to GIT (GNOME),
Add symbol versioning to libxml2 shared libs (Daniel Veillard)
- Portability:
593857 try to work around thread pbm MinGW 4.4 (Daniel Veillard),
594250 rename ATTRIBUTE_ALLOC_SIZE to avoid clashes (Daniel Veillard),
Fix Windows build * relaxng.c: fix windows build (Rob Richards),
Fix the globals.h to use XMLPUBFUN (Paul Smith),
Problem with extern extern in header (Daniel Veillard),
Add -lnetwork for compiling on Haiku (Scott McCreary),
Runtest portability patch for Solaris (Tim Rice),
Small patch to accomodate the Haiku OS (Scott McCreary),
584605 package VxWorks folder in the distribution (Daniel Veillard),
574017 Realloc too expensive on most platform (Daniel Veillard),
Fix windows build (Rob Richards),
545579 doesn't compile without schema support (Daniel Veillard),
xmllint use xmlGetNodePath when not compiled in (Daniel Veillard),
Try to avoid __imp__xmlFree link trouble on msys (Daniel Veillard),
Allow to select the threading system on Windows (LRN),
Fix Solaris binary links, cleanups (Daniel Veillard),
Bug 571059 – MSVC doesn't work with the bakefile (Intron),
fix ATTRIBUTE_PRINTF header clash (Belgabor and Mike Hommey),
fixes for Borland/CodeGear/Embarcadero compilers (Eric Zurcher)
- Documentation:
544910 typo: "renciliateNs" (Leonid Evdokimov),
Add VxWorks to list of OSes (Daniel Veillard),
Regenerate the documentation and update for git (Daniel Veillard),
560524 ¿ xmlTextReaderLocalName description (Daniel Veillard),
Added sponsoring by AOE media for the server (Daniel Veillard),
updated URLs for GNOME (Vincent Lefevre),
more warnings about xmlCleanupThreads and xmlCleanupParser (Daniel Veillard)
- Bug fixes:
594514 memory leaks - duplicate initialization (MOD),
Wrong block opening in htmlNodeDumpOutputInternal (Daniel Veillard),
492317 Fix Relax-NG validation problems (Daniel Veillard),
558452 fight with reg test and error report (Daniel Veillard),
558452 RNG compilation of optional multiple child (Daniel Veillard),
579746 XSD validation not correct / nilable groups (Daniel Veillard),
502960 provide namespace stack when parsing entity (Daniel Veillard),
566012 part 2 fix regresion tests and push mode (Daniel Veillard),
566012 autodetected encoding and encoding conflict (Daniel Veillard),
584220 xpointer(/) and xinclude problems (Daniel Veillard),
587663 Incorrect Attribute-Value Normalization (Daniel Veillard),
444994 HTML chunked failure for attribute with <> (Daniel Veillard),
Fix end of buffer char being split in XML parser (Daniel Veillard),
Non ASCII character may be split at buffer end (Adiel Mittmann),
440226 Add xmlXIncludeProcessTreeFlagsData API (Stefan Behnel),
572129 speed up parsing of large HTML text nodes (Markus Kull),
Fix HTML parsing with 0 character in CDATA (Daniel Veillard),
Fix SetGenericErrorFunc and SetStructured clash (Wang Lam),
566012 Incomplete EBCDIC parsing support (Martin Kogler),
541335 HTML avoid creating 2 head or 2 body element (Daniel Veillard),
541237 error correcting missing end tags in HTML (Daniel Veillard),
583439 missing line numbers in push mode (Daniel Veillard),
587867 xmllint --html --xmlout serializing as HTML (Daniel Veillard),
559501 avoid select and use poll for nanohttp (Raphael Prevost),
559410 - Regexp bug on (...)? constructs (Daniel Veillard),
Fix a small problem on previous HTML parser patch (Daniel Veillard),
592430 - HTML parser runs into endless loop (Daniel Veillard),
447899 potential double free in xmlFreeTextReader (Daniel Veillard),
446613 small validation bug mixed content with NS (Daniel Veillard),
Fix the problem of revalidating a doc with RNG (Daniel Veillard),
Fix xmlKeepBlanksDefault to not break indent (Nick Wellnhofer),
512131 refs from externalRef part need to be added (Daniel Veillard),
512131 crash in xmlRelaxNGValidateFullElement (Daniel Veillard),
588441 allow '.' in HTML Names even if invalid (Daniel Veillard),
582913 Fix htmlSetMetaEncoding() to be nicer (Daniel Veillard),
579317 Try to find the HTML encoding information (Daniel Veillard),
575875 don't output charset=html (Daniel Veillard),
571271 fix semantic of xsd:all with minOccurs=0 (Daniel Veillard),
570702 fix a bug in regexp determinism checking (Daniel Veillard),
567619 xmlValidateNotationUse missing param test (Daniel Veillard),
574393 ¿ utf-8 filename magic for compressed files (Hans Breuer),
Fix a couple of problems in the parser (Daniel Veillard),
585505 ¿ Document ids and refs populated by XSD (Wayne Jensen),
582906 XSD validating multiple imports of the same schema (Jason Childs),
Bug 582887 ¿ problems validating complex schemas (Jason Childs),
Bug 579729 ¿ fix XSD schemas parsing crash (Miroslav Bajtos),
576368 ¿ htmlChunkParser with special attributes (Jiri Netolicky),
Bug 565747 ¿ relax anyURI data character checking (Vincent Lefevre),
Preserve attributes of include start on tree copy (Petr Pajas),
Skip silently unrecognized XPointer schemes (Jakub Wilk),
Fix leak on SAX1, xmllint --sax1 option and debug (Daniel Veillard),
potential NULL dereference on non-glibc (Jim Meyering),
Fix an XSD validation crash (Daniel Veillard),
Fix a regression in streaming entities support (Daniel Veillard),
Fix a couple of ABI issues with C14N 1.1 (Aleksey Sanin),
Aleksey Sanin support for c14n 1.1 (Aleksey Sanin),
reader bug fix with entities (Daniel Veillard),
use options from current parser ctxt for external entities (Rob Richards),
581612 use %s to printf strings (Christian Persch),
584605 change the threading initialization sequence (Igor Novoseltsev),
580705 keep line numbers in HTML parser (Aaron Patterson),
581803 broken HTML table attributes init (Roland Steiner),
do not set error code in xmlNsWarn (Rob Richards),
564217 fix structured error handling problems,
reuse options from current parser for entities (Rob Richards),
xmlXPathRegisterNs should not allow enpty prefixes (Daniel Veillard),
add a missing check in xmlAddSibling (Kris Breuker),
avoid leaks on errors (Jinmei Tatuya)
- Cleanup:
Chasing dead assignments reported by clang-scan (Daniel Veillard),
A few more safety cleanup raised by scan (Daniel Veillard),
Fixing assorted potential problems raised by scan (Daniel Veillard),
Potential uninitialized arguments raised by scan (Daniel Veillard),
Fix a bunch of scan 'dead increments' and cleanup (Daniel Veillard),
Remove a pedantic warning (Daniel Veillard),
555833 always use rm -f in uninstall-local (Daniel Veillard),
542394 xmlRegisterOutputCallbacks MAX_INPUT_CALLBACK (Daniel Veillard),
Autoregenerate libxml2.syms automated checkings (Daniel Veillard),
Make xmlRecoverDoc const (Martin Trappel) (Daniel Veillard),
Both args of xmlStrcasestr are const (Daniel Veillard),
hide the nbParse* variables used for debugging (Mike Hommey),
570806 changed include of config.h (William M. Brack),
cleanups and error reports when xmlTextWriterVSprintf fails (Jinmei Tatuya)
2.7.3: Jan 18 2009:
- Build fix: fix build when HTML support is not included.
- Bug fixes: avoid memory overflow in gigantic text nodes,
indentation problem on the writed (Rob Richards),
xmlAddChildList pointer problem (Rob Richards and Kevin Milburn),
xmlAddChild problem with attribute (Rob Richards and Kris Breuker),
avoid a memory leak in an edge case (Daniel Zimmermann),
deallocate some pthread data (Alex Ott).
- Improvements: configure option to avoid rebuilding docs (Adrian Bunk),
limit text nodes to 10MB max by default, add element traversal
APIs, add a parser option to enable pre 2.7 SAX behavior (Rob Richards),
add gcc malloc checking (Marcus Meissner), add gcc printf like functions
parameters checking (Marcus Meissner).
2.7.2: Oct 3 2008:
- Portability fix: fix solaris compilation problem, fix compilation
if XPath is not configured in
@ -39,7 +200,7 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/
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)
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
@ -141,9 +302,9 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/
flag fix (Richard Jones), regexp interpretation of \,
htmlCreateDocParserCtxt (Jean-Daniel Dupas), configure.in
typo (Bjorn Reese), entity content failure, xmlListAppend() fix
(Georges-André Silber), XPath number serialization (William Brack),
(Georges-André Silber), XPath number serialization (William Brack),
nanohttp gzipped stream fix (William Brack and Alex Cornejo),
xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon),
xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon),
XPath string value of PI nodes (William Brack), XPath node set
sorting bugs (William Brack), avoid outputting namespace decl
dups in the writer (Rob Richards), xmlCtxtReset bug, UTF-8 encoding
@ -151,7 +312,7 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/
workaround wrong file: URIs, htmlNodeDumpFormatOutput on attributes,
invalid character in attribute detection bug, big comments before
internal subset streaming bug, HTML parsing of attributes with : in
the name, IDness of name in HTML (Dagfinn I. Mannsåker)
the name, IDness of name in HTML (Dagfinn I. Mannsåker)
- Improvement: keep URI query parts in raw form (Richard Jones),
embed tag support in HTML (Michael Day)
@ -166,7 +327,7 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/
(Steven Rainwater), user data propagation in XInclude (Michael Day),
standalone and XML decl detection (Michael Day), Python id ouptut
for some id, fix the big python string memory leak, URI parsing fixes
(Stéphane Bidoul and William), long comments parsing bug (William),
(Stéphane Bidoul and William), long comments parsing bug (William),
concurrent threads initialization (Ted Phelps), invalid char
in text XInclude (William), XPath memory leak (William), tab in
python problems (Andreas Hanke), XPath node comparison error
@ -176,7 +337,7 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/
min occurs of 0 (William), HTML script/style parsing (Mike Day)
- Improvement: make xmlTextReaderSetup() public
- Compilation and postability: fix a missing include problem (William),
__ss_familly on AIX again (Björn Wiberg), compilation without zlib
__ss_familly on AIX again (Björn Wiberg), compilation without zlib
(Michael Day), catalog patch for Win32 (Christian Ehrlicher),
Windows CE fixes (Andreas Stricke)
- Various CVS to SVN infrastructure changes
@ -323,7 +484,7 @@ Do not use or package 2.6.25
2.6.22: Sep 12 2005:
- build fixes: compile without schematron (Stéphane Bidoul)
- build fixes: compile without schematron (Stéphane Bidoul)
- bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i,
CDATA push parser bug, xmlElemDump problem with XHTML1 doc,
XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some
@ -596,7 +757,7 @@ Do not use or package 2.6.25
streaming problem (Steve Ball), DTD serialization problem (William),
libxml.m4 fixes (Mike Hommey), do not provide destructors as methods on
Python classes, xmlReader buffer bug, Python bindings memory interfaces
improvement (with Stéphane Bidoul), Fixed the push parser to be back to
improvement (with Stéphane Bidoul), Fixed the push parser to be back to
synchronous behaviour.
- improvement: custom per-thread I/O enhancement (Rob Richards), register
namespace in debug shell (Stefano Debenedetti), Python based regression
@ -722,8 +883,8 @@ Do not use or package 2.6.25
callbacks order for XPath callbacks (Frederic Peters)
- Documentation: python scripts (William Brack), xslt stylesheets (John
Fleck), doc (Sven Zimmerman), I/O example.
- Python bindings: fixes (William), enum support (Stéphane Bidoul),
structured error reporting (Stéphane Bidoul)
- Python bindings: fixes (William), enum support (Stéphane Bidoul),
structured error reporting (Stéphane Bidoul)
- XInclude: various fixes for conformance, problem related to dictionnary
references (William & me), recursion (William)
- xmlWriter: indentation (Lucas Brasilino), memory leaks (Alfred
@ -853,7 +1014,7 @@ Do not use or package 2.6.25
and charset information if available.
- Relax-NG: bug fixes including the one reported by Martijn Faassen and
zeroOrMore, better error reporting.
- Python bindings (Stéphane Bidoul), never use stdout for errors
- Python bindings (Stéphane Bidoul), never use stdout for errors
output
- Portability: all the headers have macros for export and calling
convention definitions (Igor Zlatkovic), VMS update (Craig A. Berry),
@ -934,11 +1095,11 @@ A bugfixes only release - Windows Makefiles (William Brack)
- portability: DJGPP (MsDos) , OpenVMS (Craig A. Berry)
- William Brack fixed multithreading lock problems
- IPv6 patch for FTP and HTTP accesses (Archana Shah/Wipro)
- Windows fixes (Igor Zlatkovic, Eric Zurcher), threading (Stéphane
- Windows fixes (Igor Zlatkovic, Eric Zurcher), threading (Stéphane
Bidoul)
- A few W3C Schemas Structure improvements
- W3C Schemas Datatype improvements (Charlie Bozeman)
- Python bindings for thread globals (Stéphane Bidoul), and method/class
- Python bindings for thread globals (Stéphane Bidoul), and method/class
generator
- added --nonet option to xmllint
- documentation improvements (John Fleck)
@ -1014,7 +1175,7 @@ A bugfixes only release - Windows Makefiles (William Brack)
- First implementation of RelaxNG, added --relaxng flag to xmllint
- Schemas support now compiled in by default.
- Bug fixes: DTD validation, namespace checking, XInclude and entities,
delegateURI in XML Catalogs, HTML parser, XML reader (Stéphane Bidoul),
delegateURI in XML Catalogs, HTML parser, XML reader (Stéphane Bidoul),
XPath parser and evaluation, UTF8ToUTF8 serialization, XML reader memory
consumption, HTML parser, HTML serialization in the presence of
namespaces
@ -1023,7 +1184,7 @@ A bugfixes only release - Windows Makefiles (William Brack)
patches (Stefan Kost)
- Portability fixes: NetBSD (Julio Merino), Windows (Igor Zlatkovic)
- Added python bindings for XPointer, contextual error reporting
(Stéphane Bidoul)
(Stéphane Bidoul)
- URI/file escaping problems (Stefano Zacchiroli)
@ -1035,11 +1196,11 @@ A bugfixes only release - Windows Makefiles (William Brack)
2.5.0: Jan 6 2003:
- New XmltextReader interface based on C#
API (with help of Stéphane Bidoul)
API (with help of Stéphane Bidoul)
- Windows: more exports, including the new API (Igor)
- XInclude fallback fix
- Python: bindings for the new API, packaging (Stéphane Bidoul),
drv_libxml2.py Python xml.sax driver (Stéphane Bidoul), fixes, speedup
- Python: bindings for the new API, packaging (Stéphane Bidoul),
drv_libxml2.py Python xml.sax driver (Stéphane Bidoul), fixes, speedup
and iterators for Python-2.2 (Hannu Krosing)
- Tutorial fixes (john Fleck and Niraj Tolia) xmllint man update
(John)
@ -1059,7 +1220,7 @@ A bugfixes only release - Windows Makefiles (William Brack)
2.4.29: Dec 11 2002:
- Windows fixes (Igor): Windows CE port, pthread linking, python bindings
(Stéphane Bidoul), Mingw (Magnus Henoch), and export list updates
(Stéphane Bidoul), Mingw (Magnus Henoch), and export list updates
- Fix for prev in python bindings (ERDI Gergo)
- Fix for entities handling (Marcus Clarke)
- Refactored the XML and HTML dumps to a single code path, fixed XHTML1
@ -1406,7 +1567,7 @@ it's actually not compiled in by default. The real fixes are: - a couple of bu
2.3.9: May 19 2001:
Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #54891 and another patch from Jonas Borgström
Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #54891 and another patch from Jonas Borgström
- some serious speed optimization again
- some documentation cleanups
- trying to get better linking on Solaris (-R)

View file

@ -36,4 +36,4 @@ required and justified.
Daniel Veillard
$Id: README,v 1.13 2005/07/10 21:38:25 veillard Exp $
$Id$

View file

@ -1246,13 +1246,14 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
}
if (ns != NULL) {
xmlAttrPtr prop;
namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns);
if (namespace == NULL) {
xmlNsErrMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace prefix %s of attribute %s is not defined\n",
ns, name);
}
} else {
xmlAttrPtr prop;
prop = ctxt->node->properties;
while (prop != NULL) {
@ -1270,6 +1271,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
}
prop = prop->next;
}
}
} else {
namespace = NULL;
}
@ -1420,6 +1422,10 @@ process_external_subset:
} else {
fulln = xmlStrdup(attr->name);
}
if (fulln == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
break;
}
/*
* Check that the attribute is not declared in the
@ -1442,6 +1448,7 @@ process_external_subset:
(const char *)fulln,
(const char *)attr->elem);
}
xmlFree(fulln);
}
attr = attr->nexth;
}
@ -2278,9 +2285,14 @@ xmlSAX2StartElementNs(void *ctx,
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
return;
}
if (prefix != NULL)
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace prefix %s was not found\n",
prefix, NULL);
else
xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace default prefix was not found\n",
NULL, NULL);
}
}
@ -2554,7 +2566,6 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
ret = xmlNewDocPI(ctxt->myDoc, target, data);
if (ret == NULL) return;
parent = ctxt->node;
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {

View file

@ -5,7 +5,7 @@
TODO for the XML parser and stuff:
==================================
$Id: TODO,v 1.44 2005/01/07 13:56:19 veillard Exp $
$Id$
this tend to be outdated :-\ ...

File diff suppressed because it is too large Load diff

View file

@ -61,8 +61,10 @@ typedef struct _xmlC14NCtx {
int parent_is_doc;
xmlC14NVisibleNsStackPtr ns_rendered;
/* C14N mode */
xmlC14NMode mode;
/* exclusive canonicalization */
int exclusive;
xmlChar **inclusive_ns_prefixes;
/* error number */
@ -117,6 +119,9 @@ static xmlChar *xmlC11NNormalizeString(const xmlChar * input,
(ctx)->is_visible_callback((ctx)->user_data, \
(xmlNodePtr)(node), (xmlNodePtr)(parent)) : 1)
#define xmlC14NIsExclusive( ctx ) \
( (ctx)->mode == XML_C14N_EXCLUSIVE_1_0 )
/************************************************************************
* *
* Some factorized error routines *
@ -234,7 +239,7 @@ xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error,
__xmlRaiseError(NULL, NULL, NULL,
ctxt, node, XML_FROM_C14N, error,
XML_ERR_ERROR, NULL, 0,
NULL, NULL, NULL, 0, 0, msg);
NULL, NULL, NULL, 0, 0, "%s", msg);
}
/************************************************************************
@ -492,9 +497,7 @@ xmlC14NIsXmlNs(xmlNsPtr ns)
{
return ((ns != NULL) &&
(xmlStrEqual(ns->prefix, BAD_CAST "xml")) &&
(xmlStrEqual(ns->href,
BAD_CAST
"http://www.w3.org/XML/1998/namespace")));
(xmlStrEqual(ns->href, XML_XML_NAMESPACE)));
}
@ -713,7 +716,7 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
return (-1);
}
if(!ctx->exclusive) {
if(!xmlC14NIsExclusive(ctx)) {
xmlC14NErrParam("processing namespaces axis (exc c14n)");
return (-1);
@ -844,6 +847,25 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
}
/**
* xmlC14NIsXmlAttr:
* @attr: the attr to check
*
* Checks whether the given attribute is a default "xml:" namespace
* with href="http://www.w3.org/XML/1998/namespace"
*
* Returns 1 if the node is default or 0 otherwise
*/
/* todo: make it a define? */
static int
xmlC14NIsXmlAttr(xmlAttrPtr attr)
{
return ((attr->ns != NULL) &&
(xmlC14NIsXmlNs(attr->ns) != 0));
}
/**
* xmlC14NAttrsCompare:
* @attr1: the pointer tls o first attr
@ -925,7 +947,7 @@ xmlC14NPrintAttrs(const xmlAttrPtr attr, xmlC14NCtxPtr ctx)
xmlOutputBufferWriteString(ctx->buf, (const char *) attr->name);
xmlOutputBufferWriteString(ctx->buf, "=\"");
value = xmlNodeListGetString(attr->doc, attr->children, 1);
value = xmlNodeListGetString(ctx->doc, attr->children, 1);
/* todo: should we log an error if value==NULL ? */
if (value != NULL) {
buffer = xmlC11NNormalizeAttr(value);
@ -942,11 +964,134 @@ xmlC14NPrintAttrs(const xmlAttrPtr attr, xmlC14NCtxPtr ctx)
return (1);
}
/**
* xmlC14NFindHiddenParentAttr:
*
* Finds an attribute in a hidden parent node.
*
* Returns a pointer to the attribute node (if found) or NULL otherwise.
*/
static xmlAttrPtr
xmlC14NFindHiddenParentAttr(xmlC14NCtxPtr ctx, xmlNodePtr cur, const xmlChar * name, const xmlChar * ns)
{
xmlAttrPtr res;
while((cur != NULL) && (!xmlC14NIsVisible(ctx, cur, cur->parent))) {
res = xmlHasNsProp(cur, name, ns);
if(res != NULL) {
return res;
}
cur = cur->parent;
}
return NULL;
}
/**
* xmlC14NFixupBaseAttr:
*
* Fixes up the xml:base attribute
*
* Returns the newly created attribute or NULL
*/
static xmlAttrPtr
xmlC14NFixupBaseAttr(xmlC14NCtxPtr ctx, xmlAttrPtr xml_base_attr)
{
xmlChar * res = NULL;
xmlNodePtr cur;
xmlAttrPtr attr;
xmlChar * tmp_str;
xmlChar * tmp_str2;
int tmp_str_len;
if ((ctx == NULL) || (xml_base_attr == NULL) || (xml_base_attr->parent == NULL)) {
xmlC14NErrParam("processing xml:base attribute");
return (NULL);
}
/* start from current value */
res = xmlNodeListGetString(ctx->doc, xml_base_attr->children, 1);
if(res == NULL) {
xmlC14NErrInternal("processing xml:base attribute - can't get attr value");
return (NULL);
}
/* go up the stack until we find a node that we rendered already */
cur = xml_base_attr->parent->parent;
while((cur != NULL) && (!xmlC14NIsVisible(ctx, cur, cur->parent))) {
attr = xmlHasNsProp(cur, BAD_CAST "base", XML_XML_NAMESPACE);
if(attr != NULL) {
/* get attr value */
tmp_str = xmlNodeListGetString(ctx->doc, attr->children, 1);
if(tmp_str == NULL) {
xmlFree(res);
xmlC14NErrInternal("processing xml:base attribute - can't get attr value");
return (NULL);
}
/* we need to add '/' if our current base uri ends with '..' or '.'
to ensure that we are forced to go "up" all the time */
tmp_str_len = xmlStrlen(tmp_str);
if(tmp_str_len > 1 && tmp_str[tmp_str_len - 2] == '.') {
tmp_str2 = xmlStrcat(tmp_str, BAD_CAST "/");
if(tmp_str2 == NULL) {
xmlFree(tmp_str);
xmlFree(res);
xmlC14NErrInternal("processing xml:base attribute - can't modify uri");
return (NULL);
}
tmp_str = tmp_str2;
}
/* build uri */
tmp_str2 = xmlBuildURI(res, tmp_str);
if(tmp_str2 == NULL) {
xmlFree(tmp_str);
xmlFree(res);
xmlC14NErrInternal("processing xml:base attribute - can't construct uri");
return (NULL);
}
/* cleanup and set the new res */
xmlFree(tmp_str);
xmlFree(res);
res = tmp_str2;
}
/* next */
cur = cur->parent;
}
/* check if result uri is empty or not */
if((res == NULL) || xmlStrEqual(res, BAD_CAST "")) {
xmlFree(res);
return (NULL);
}
/* create and return the new attribute node */
attr = xmlNewNsProp(NULL, xml_base_attr->ns, BAD_CAST "base", res);
if(attr == NULL) {
xmlFree(res);
xmlC14NErrInternal("processing xml:base attribute - can't construct attribute");
return (NULL);
}
/* done */
xmlFree(res);
return (attr);
}
/**
* xmlC14NProcessAttrsAxis:
* @ctx: the C14N context
* @cur: the current node
* @parent_visible: the visibility of parent node
* @all_parents_visible: the visibility of all parent nodes
*
* Prints out canonical attribute axis of the current node to the
* buffer from C14N context as follows
@ -979,6 +1124,12 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
{
xmlAttrPtr attr;
xmlListPtr list;
xmlAttrPtr attrs_to_delete = NULL;
/* special processing for 1.1 spec */
xmlAttrPtr xml_base_attr = NULL;
xmlAttrPtr xml_lang_attr = NULL;
xmlAttrPtr xml_space_attr = NULL;
if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
xmlC14NErrParam("processing attributes axis");
@ -994,6 +1145,19 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
return (-1);
}
switch(ctx->mode) {
case XML_C14N_1_0:
/* The processing of an element node E MUST be modified slightly when an XPath node-set is
* given as input and the element's parent is omitted from the node-set. The method for processing
* the attribute axis of an element E in the node-set is enhanced. All element nodes along E's
* ancestor axis are examined for nearest occurrences of attributes in the xml namespace, such
* as xml:lang and xml:space (whether or not they are in the node-set). From this list of attributes,
* remove any that are in E's attribute axis (whether or not they are in the node-set). Then,
* lexicographically merge this attribute list with the nodes of E's attribute axis that are in
* the node-set. The result of visiting the attribute axis is computed by processing the attribute
* nodes in this merged attribute list.
*/
/*
* Add all visible attributes from current node.
*/
@ -1007,31 +1171,160 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
}
/*
* include attributes in "xml" namespace defined in ancestors
* (only for non-exclusive XML Canonicalization)
* Handle xml attributes
*/
if (parent_visible && (!ctx->exclusive) && (cur->parent != NULL)
&& (!xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent))) {
if (parent_visible && (cur->parent != NULL) &&
(!xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent)))
{
xmlNodePtr tmp;
/*
* If XPath node-set is not specified then the parent is always
* visible!
*/
cur = cur->parent;
while (cur != NULL) {
attr = cur->properties;
tmp = cur->parent;
while (tmp != NULL) {
attr = tmp->properties;
while (attr != NULL) {
if ((attr->ns != NULL)
&& (xmlStrEqual(attr->ns->prefix, BAD_CAST "xml"))) {
if (xmlC14NIsXmlAttr(attr) != 0) {
if (xmlListSearch(list, attr) == NULL) {
xmlListInsert(list, attr);
}
}
attr = attr->next;
}
cur = cur->parent;
tmp = tmp->parent;
}
}
/* done */
break;
case XML_C14N_EXCLUSIVE_1_0:
/* attributes in the XML namespace, such as xml:lang and xml:space
* are not imported into orphan nodes of the document subset
*/
/*
* Add all visible attributes from current node.
*/
attr = cur->properties;
while (attr != NULL) {
/* check that attribute is visible */
if (xmlC14NIsVisible(ctx, attr, cur)) {
xmlListInsert(list, attr);
}
attr = attr->next;
}
/* do nothing special for xml attributes */
break;
case XML_C14N_1_1:
/* The processing of an element node E MUST be modified slightly when an XPath node-set is
* given as input and some of the element's ancestors are omitted from the node-set.
*
* Simple inheritable attributes are attributes that have a value that requires at most a simple
* redeclaration. This redeclaration is done by supplying a new value in the child axis. The
* redeclaration of a simple inheritable attribute A contained in one of E's ancestors is done
* by supplying a value to an attribute Ae inside E with the same name. Simple inheritable attributes
* are xml:lang and xml:space.
*
* The method for processing the attribute axis of an element E in the node-set is hence enhanced.
* All element nodes along E's ancestor axis are examined for the nearest occurrences of simple
* inheritable attributes in the xml namespace, such as xml:lang and xml:space (whether or not they
* are in the node-set). From this list of attributes, any simple inheritable attributes that are
* already in E's attribute axis (whether or not they are in the node-set) are removed. Then,
* lexicographically merge this attribute list with the nodes of E's attribute axis that are in
* the node-set. The result of visiting the attribute axis is computed by processing the attribute
* nodes in this merged attribute list.
*
* The xml:id attribute is not a simple inheritable attribute and no processing of these attributes is
* performed.
*
* The xml:base attribute is not a simple inheritable attribute and requires special processing beyond
* a simple redeclaration.
*
* Attributes in the XML namespace other than xml:base, xml:id, xml:lang, and xml:space MUST be processed
* as ordinary attributes.
*/
/*
* Add all visible attributes from current node.
*/
attr = cur->properties;
while (attr != NULL) {
/* special processing for XML attribute kiks in only when we have invisible parents */
if ((!parent_visible) || (xmlC14NIsXmlAttr(attr) == 0)) {
/* check that attribute is visible */
if (xmlC14NIsVisible(ctx, attr, cur)) {
xmlListInsert(list, attr);
}
} else {
int matched = 0;
/* check for simple inheritance attributes */
if((!matched) && (xml_lang_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "lang")) {
xml_lang_attr = attr;
matched = 1;
}
if((!matched) && (xml_space_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "space")) {
xml_space_attr = attr;
matched = 1;
}
/* check for base attr */
if((!matched) && (xml_base_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "base")) {
xml_base_attr = attr;
matched = 1;
}
/* otherwise, it is a normal attribute, so just check if it is visible */
if((!matched) && xmlC14NIsVisible(ctx, attr, cur)) {
xmlListInsert(list, attr);
}
}
/* move to the next one */
attr = attr->next;
}
/* special processing for XML attribute kiks in only when we have invisible parents */
if ((parent_visible)) {
/* simple inheritance attributes - copy */
if(xml_lang_attr == NULL) {
xml_lang_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "lang", XML_XML_NAMESPACE);
}
if(xml_lang_attr != NULL) {
xmlListInsert(list, xml_lang_attr);
}
if(xml_space_attr == NULL) {
xml_space_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "space", XML_XML_NAMESPACE);
}
if(xml_space_attr != NULL) {
xmlListInsert(list, xml_space_attr);
}
/* base uri attribute - fix up */
if(xml_base_attr == NULL) {
/* if we don't have base uri attribute, check if we have a "hidden" one above */
xml_base_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "base", XML_XML_NAMESPACE);
}
if(xml_base_attr != NULL) {
xml_base_attr = xmlC14NFixupBaseAttr(ctx, xml_base_attr);
if(xml_base_attr != NULL) {
xmlListInsert(list, xml_base_attr);
/* note that we MUST delete returned attr node ourselves! */
xml_base_attr->next = attrs_to_delete;
attrs_to_delete = xml_base_attr;
}
}
}
/* done */
break;
}
/*
* print out all elements from list
*/
@ -1040,6 +1333,7 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
/*
* Cleanup
*/
xmlFreePropList(attrs_to_delete);
xmlListDelete(list);
return (0);
}
@ -1096,6 +1390,8 @@ xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur)
* xmlC14NProcessElementNode:
* @ctx: the pointer to C14N context object
* @cur: the node to process
* @visible: this node is visible
* @all_parents_visible: whether all the parents of this node are visible
*
* Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n)
*
@ -1159,7 +1455,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
xmlOutputBufferWriteString(ctx->buf, (const char *) cur->name);
}
if (!ctx->exclusive) {
if (!xmlC14NIsExclusive(ctx)) {
ret = xmlC14NProcessNamespacesAxis(ctx, cur, visible);
} else {
ret = xmlExcC14NProcessNamespacesAxis(ctx, cur, visible);
@ -1457,9 +1753,10 @@ xmlC14NFreeCtx(xmlC14NCtxPtr ctx)
* or not
* @user_data: the first parameter for @is_visible_callback function
* (in most cases, it is nodes set)
* @mode: the c14n mode (see @xmlC14NMode)
* @inclusive_ns_prefixe the list of inclusive namespace prefixes
* ended with a NULL or NULL if there is no
* inclusive namespaces (only for exclusive
* inclusive namespaces (only for `
* canonicalization)
* @with_comments: include comments in the result (!=0) or not (==0)
* @buf: the output buffer to store canonical XML; this
@ -1473,7 +1770,7 @@ xmlC14NFreeCtx(xmlC14NCtxPtr ctx)
static xmlC14NCtxPtr
xmlC14NNewCtx(xmlDocPtr doc,
xmlC14NIsVisibleCallback is_visible_callback, void* user_data,
int exclusive, xmlChar ** inclusive_ns_prefixes,
xmlC14NMode mode, xmlChar ** inclusive_ns_prefixes,
int with_comments, xmlOutputBufferPtr buf)
{
xmlC14NCtxPtr ctx = NULL;
@ -1531,11 +1828,11 @@ xmlC14NNewCtx(xmlDocPtr doc,
}
/*
* Set "exclusive" flag, create a nodes set for namespaces
* stack and remember list of incluseve prefixes
* Set "mode" flag and remember list of incluseve prefixes
* for exclusive c14n
*/
if (exclusive) {
ctx->exclusive = 1;
ctx->mode = mode;
if(xmlC14NIsExclusive(ctx)) {
ctx->inclusive_ns_prefixes = inclusive_ns_prefixes;
}
return (ctx);
@ -1548,8 +1845,7 @@ xmlC14NNewCtx(xmlDocPtr doc,
* or not
* @user_data: the first parameter for @is_visible_callback function
* (in most cases, it is nodes set)
* @exclusive: the exclusive flag (0 - non-exclusive canonicalization;
* otherwise - exclusive canonicalization)
* @mode: the c14n mode (see @xmlC14NMode)
* @inclusive_ns_prefixes: the list of inclusive namespace prefixes
* ended with a NULL or NULL if there is no
* inclusive namespaces (only for exclusive
@ -1567,10 +1863,11 @@ xmlC14NNewCtx(xmlDocPtr doc,
*/
int
xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback,
void* user_data, int exclusive, xmlChar **inclusive_ns_prefixes,
void* user_data, int mode, xmlChar **inclusive_ns_prefixes,
int with_comments, xmlOutputBufferPtr buf) {
xmlC14NCtxPtr ctx;
xmlC14NMode c14n_mode = XML_C14N_1_0;
int ret;
if ((buf == NULL) || (doc == NULL)) {
@ -1578,6 +1875,19 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback,
return (-1);
}
/* for backward compatibility, we have to have "mode" as "int"
and here we check that user gives valid value */
switch(mode) {
case XML_C14N_1_0:
case XML_C14N_EXCLUSIVE_1_0:
case XML_C14N_1_1:
c14n_mode = (xmlC14NMode)mode;
break;
default:
xmlC14NErrParam("invalid mode for executing c14n");
return (-1);
}
/*
* Validate the encoding output buffer encoding
*/
@ -1588,7 +1898,7 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback,
}
ctx = xmlC14NNewCtx(doc, is_visible_callback, user_data,
exclusive, inclusive_ns_prefixes,
c14n_mode, inclusive_ns_prefixes,
with_comments, buf);
if (ctx == NULL) {
xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_CREATE_CTXT,
@ -1637,8 +1947,7 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback,
* @doc: the XML document for canonization
* @nodes: the nodes set to be included in the canonized image
* or NULL if all document nodes should be included
* @exclusive: the exclusive flag (0 - non-exclusive canonicalization;
* otherwise - exclusive canonicalization)
* @mode: the c14n mode (see @xmlC14NMode)
* @inclusive_ns_prefixes: the list of inclusive namespace prefixes
* ended with a NULL or NULL if there is no
* inclusive namespaces (only for exclusive
@ -1656,12 +1965,12 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback,
*/
int
xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes,
int exclusive, xmlChar ** inclusive_ns_prefixes,
int mode, xmlChar ** inclusive_ns_prefixes,
int with_comments, xmlOutputBufferPtr buf) {
return(xmlC14NExecute(doc,
(xmlC14NIsVisibleCallback)xmlC14NIsNodeInNodeset,
nodes,
exclusive,
mode,
inclusive_ns_prefixes,
with_comments,
buf));
@ -1673,8 +1982,7 @@ xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes,
* @doc: the XML document for canonization
* @nodes: the nodes set to be included in the canonized image
* or NULL if all document nodes should be included
* @exclusive: the exclusive flag (0 - non-exclusive canonicalization;
* otherwise - exclusive canonicalization)
* @mode: the c14n mode (see @xmlC14NMode)
* @inclusive_ns_prefixes: the list of inclusive namespace prefixes
* ended with a NULL or NULL if there is no
* inclusive namespaces (only for exclusive
@ -1692,7 +2000,7 @@ xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes,
*/
int
xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes,
int exclusive, xmlChar ** inclusive_ns_prefixes,
int mode, xmlChar ** inclusive_ns_prefixes,
int with_comments, xmlChar ** doc_txt_ptr)
{
int ret;
@ -1717,7 +2025,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes,
/*
* canonize document and write to buffer
*/
ret = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes,
ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes,
with_comments, buf);
if (ret < 0) {
xmlC14NErrInternal("saving doc to output buffer");
@ -1743,8 +2051,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes,
* @doc: the XML document for canonization
* @nodes: the nodes set to be included in the canonized image
* or NULL if all document nodes should be included
* @exclusive: the exclusive flag (0 - non-exclusive canonicalization;
* otherwise - exclusive canonicalization)
* @mode: the c14n mode (see @xmlC14NMode)
* @inclusive_ns_prefixes: the list of inclusive namespace prefixes
* ended with a NULL or NULL if there is no
* inclusive namespaces (only for exclusive
@ -1764,7 +2071,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes,
*/
int
xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes,
int exclusive, xmlChar ** inclusive_ns_prefixes,
int mode, xmlChar ** inclusive_ns_prefixes,
int with_comments, const char *filename, int compression)
{
xmlOutputBufferPtr buf;
@ -1791,7 +2098,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes,
/*
* canonize document and write to buffer
*/
ret = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes,
ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes,
with_comments, buf);
if (ret < 0) {
xmlC14NErrInternal("cannicanize document to buffer");
@ -1919,7 +2226,7 @@ xmlC11NNormalizeString(const xmlChar * input,
}
cur++;
}
*out++ = 0;
*out = 0;
return (buffer);
}
#endif /* LIBXML_OUTPUT_ENABLED */

View file

@ -3250,7 +3250,7 @@ xmlLoadCatalogs(const char *pathss) {
cur++;
path = xmlStrndup((const xmlChar *)paths, cur - paths);
#ifdef _WIN32
iLen = strlen((const char *)path);
iLen = strlen(path);
for(i = 0; i < iLen; i++) {
if(path[i] == '\\') {
path[i] = '/';

View file

@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2007-05-17'
timestamp='2009-04-27'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -56,8 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -324,14 +324,30 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@ -532,7 +548,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[45])
*:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@ -796,9 +812,12 @@ EOF
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
EM64T | authenticamd | genuineintel)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
@ -833,7 +852,14 @@ EOF
echo ${UNAME_MACHINE}-pc-minix
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@ -925,6 +951,9 @@ EOF
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@ -954,8 +983,8 @@ EOF
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit ;;
xtensa:Linux:*:*)
echo xtensa-unknown-linux-gnu
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
@ -975,9 +1004,6 @@ EOF
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
@ -1092,8 +1118,11 @@ EOF
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
@ -1131,6 +1160,16 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@ -1206,6 +1245,9 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@ -1314,6 +1356,9 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@ -1474,9 +1519,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run ($0) is already up to date, please
send the following data and any information you think might be

View file

@ -136,6 +136,9 @@
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define to 1 if you have the `printf' function. */
#undef HAVE_PRINTF
@ -252,6 +255,10 @@
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE

View file

@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2007-04-29'
timestamp='2009-04-17'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -72,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -122,6 +122,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@ -249,13 +250,16 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep \
| maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64vr | mips64vrel \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
@ -268,6 +272,7 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nios | nios2 \
@ -277,7 +282,7 @@ case $basic_machine in
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@ -286,7 +291,7 @@ case $basic_machine in
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
@ -329,14 +334,17 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
@ -358,20 +366,24 @@ case $basic_machine in
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
@ -435,6 +447,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux)
basic_machine=m68k-apple
os=-aux
@ -443,10 +459,22 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@ -475,8 +503,8 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
cr16)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
@ -514,6 +542,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
@ -668,6 +700,14 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
@ -813,6 +853,14 @@ case $basic_machine in
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
@ -1021,6 +1069,10 @@ case $basic_machine in
basic_machine=tic6x-unknown
os=-coff
;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
@ -1096,6 +1148,10 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
@ -1134,7 +1190,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@ -1206,8 +1262,9 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@ -1216,7 +1273,7 @@ case $os in
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
@ -1356,6 +1413,9 @@ case $os in
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-none)
;;
*)

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=7
LIBXML_MICRO_VERSION=3
LIBXML_MICRO_VERSION=6
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
@ -26,6 +26,14 @@ else if test -d .svn ; then
then
LIBXML_VERSION_EXTRA="-SVN$extra"
fi
else if test -d .git ; then
extra=`git describe | sed 's+LIBXML[[0-9.]]*-++'`
echo extra=$extra
if test "$extra" != ""
then
LIBXML_VERSION_EXTRA="-GIT$extra"
fi
fi
fi
fi
AC_SUBST(LIBXML_MAJOR_VERSION)
@ -59,6 +67,18 @@ test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
dnl
dnl if the system support linker version scripts for symbol versioning
dnl then add it
dnl
VERSION_SCRIPT_FLAGS=
$(/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null) && \
VERSION_SCRIPT_FLAGS=-Wl,--version-script=
test "`uname`" == "SunOS" && \
VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
AC_SUBST(VERSION_SCRIPT_FLAGS)
AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
dnl
dnl We process the AC_ARG_WITH first so that later we can modify
dnl some of them to try to prevent impossible combinations. This
@ -414,6 +434,7 @@ AC_CHECK_HEADERS([arpa/inet.h], [], [],
AC_CHECK_HEADERS([netdb.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_HEADERS([poll.h])
AC_CHECK_HEADERS([sys/mman.h])
AC_CHECK_HEADERS([sys/timeb.h])
AC_CHECK_HEADERS([signal.h])
@ -473,7 +494,7 @@ fi
dnl Checks for inet libraries:
AC_SEARCH_LIBS(gethostent, [nsl])
AC_SEARCH_LIBS(setsockopt, [socket net])
AC_SEARCH_LIBS(setsockopt, [socket net network])
AC_SEARCH_LIBS(connect, [inet])
dnl Determine what socket length (socklen_t) data type is
@ -721,6 +742,7 @@ if test "$with_python" != "no" ; then
PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
fi
fi
PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
fi
if test "$with_python" != ""
then
@ -740,6 +762,7 @@ else
fi
AC_SUBST(pythondir)
AC_SUBST(PYTHON_SUBDIR)
AC_SUBST(PYTHON_LIBS)
dnl check for dso support
WITH_MODULES=0
@ -862,17 +885,21 @@ if test "$with_threads" = "no" ; then
echo Disabling multithreaded support
else
echo Enabling multithreaded support
dnl Use pthread by default
if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
AC_CHECK_HEADER(pthread.h,
AC_CHECK_LIB(pthread, pthread_join,[
THREAD_LIBS="-lpthread"
AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
WITH_THREADS="1"]))
fi
case $host_os in
*mingw32*) WITH_THREADS="1"
*mingw32*) if test "$THREAD_LIBS" != "-lpthread"; then
WITH_THREADS="1"
THREADS_W32="Win32"
THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
fi
;;
*cygwin*) THREAD_LIBS=""
;;
@ -1261,6 +1288,8 @@ case "$host" in
;;
*beos*) M_LIBS=""
;;
*haiku*) M_LIBS=""
;;
*) M_LIBS="-lm"
;;
esac

View file

@ -141,9 +141,9 @@ xmlCtxtDumpSpaces(xmlDebugCtxtPtr ctxt)
return;
if ((ctxt->output != NULL) && (ctxt->depth > 0)) {
if (ctxt->depth < 50)
fprintf(ctxt->output, &ctxt->shift[100 - 2 * ctxt->depth]);
fprintf(ctxt->output, "%s", &ctxt->shift[100 - 2 * ctxt->depth]);
else
fprintf(ctxt->output, ctxt->shift);
fprintf(ctxt->output, "%s", ctxt->shift);
}
}
@ -162,7 +162,7 @@ xmlDebugErr(xmlDebugCtxtPtr ctxt, int error, const char *msg)
NULL, ctxt->node, XML_FROM_CHECK,
error, XML_ERR_ERROR, NULL, 0,
NULL, NULL, NULL, 0, 0,
msg);
"%s", msg);
}
static void
xmlDebugErr2(xmlDebugCtxtPtr ctxt, int error, const char *msg, int extra)
@ -259,7 +259,9 @@ xmlCtxtCheckName(xmlDebugCtxtPtr ctxt, const xmlChar * name)
"Name is not an NCName '%s'", (const char *) name);
}
if ((ctxt->dict != NULL) &&
(!xmlDictOwns(ctxt->dict, name))) {
(!xmlDictOwns(ctxt->dict, name)) &&
((ctxt->doc == NULL) ||
((ctxt->doc->parseFlags & (XML_PARSE_SAX1 | XML_PARSE_NODICT)) == 0))) {
xmlDebugErr3(ctxt, XML_CHECK_OUTSIDE_DICT,
"Name is not from the document dictionnary '%s'",
(const char *) name);
@ -2801,7 +2803,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
{
char prompt[500] = "/ > ";
char *cmdline = NULL, *cur;
int nbargs;
char command[100];
char arg[400];
int i;
@ -2853,7 +2854,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
* Parse the command itself
*/
cur = cmdline;
nbargs = 0;
while ((*cur == ' ') || (*cur == '\t'))
cur++;
i = 0;
@ -2866,7 +2866,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
command[i] = 0;
if (i == 0)
continue;
nbargs++;
/*
* Parse the argument
@ -2880,8 +2879,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
arg[i++] = *cur++;
}
arg[i] = 0;
if (i != 0)
nbargs++;
/*
* start interpreting the command

View file

@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2007-03-29.01
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -17,9 +17,7 @@ scriptversion=2007-03-29.01
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@ -192,14 +199,14 @@ sgi)
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@ -328,7 +335,12 @@ hp2)
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@ -404,7 +416,7 @@ dashmstdout)
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@ -455,32 +467,39 @@ makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
@ -500,7 +519,7 @@ cpp)
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@ -538,13 +557,27 @@ cpp)
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
@ -557,16 +590,23 @@ msvisualcpp)
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
@ -585,5 +625,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View file

@ -698,7 +698,6 @@ xmlDictFree(xmlDictPtr dict) {
inside_dict = 0;
iter = next;
}
inside_dict = 0;
}
xmlFree(dict->dict);
}

View file

@ -15489,6 +15489,18 @@ extern __typeof (xmlXIncludeProcessTreeFlags) xmlXIncludeProcessTreeFlags__inter
#endif
#endif
#if defined(LIBXML_XINCLUDE_ENABLED)
#ifdef bottom_xinclude
#undef xmlXIncludeProcessTreeFlagsData
extern __typeof (xmlXIncludeProcessTreeFlagsData) xmlXIncludeProcessTreeFlagsData __attribute((alias("xmlXIncludeProcessTreeFlagsData__internal_alias")));
#else
#ifndef xmlXIncludeProcessTreeFlagsData
extern __typeof (xmlXIncludeProcessTreeFlagsData) xmlXIncludeProcessTreeFlagsData__internal_alias __attribute((visibility("hidden")));
#define xmlXIncludeProcessTreeFlagsData xmlXIncludeProcessTreeFlagsData__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_XINCLUDE_ENABLED)
#ifdef bottom_xinclude
#undef xmlXIncludeSetFlags

View file

@ -1414,7 +1414,7 @@ xmlCleanupCharEncodingHandlers(void) {
void
xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
if (handlers == NULL) xmlInitCharEncodingHandlers();
if (handler == NULL) {
if ((handler == NULL) || (handlers == NULL)) {
xmlEncodingErr(XML_I18N_NO_HANDLER,
"xmlRegisterCharEncodingHandler: NULL handler !\n", NULL);
return;
@ -1458,6 +1458,8 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
if (handler != NULL) return(handler);
handler = xmlFindCharEncodingHandler("ebcdic");
if (handler != NULL) return(handler);
handler = xmlFindCharEncodingHandler("EBCDIC-US");
if (handler != NULL) return(handler);
break;
case XML_CHAR_ENCODING_UCS4BE:
handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4");
@ -1600,7 +1602,8 @@ xmlFindCharEncodingHandler(const char *name) {
}
upper[i] = 0;
for (i = 0;i < nbCharEncodingHandler; i++)
if (handlers != NULL) {
for (i = 0;i < nbCharEncodingHandler; i++) {
if (!strcmp(upper, handlers[i]->name)) {
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
@ -1608,6 +1611,8 @@ xmlFindCharEncodingHandler(const char *name) {
#endif
return(handlers[i]);
}
}
}
#ifdef LIBXML_ICONV_ENABLED
/* check whether iconv can handle this */
@ -1735,12 +1740,16 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
* The real API used by libxml for on-the-fly conversion *
* *
************************************************************************/
int
xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in, int len);
/**
* xmlCharEncFirstLine:
* xmlCharEncFirstLineInt:
* @handler: char enconding transformation data structure
* @out: an xmlBuffer for the output.
* @in: an xmlBuffer for the input
* @len: number of bytes to convert for the first line, or -1
*
* Front-end for the encoding handler input function, but handle only
* the very first line, i.e. limit itself to 45 chars.
@ -1751,8 +1760,8 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
* the result of transformation can't fit into the encoding we want), or
*/
int
xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in) {
xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in, int len) {
int ret = -2;
int written;
int toconv;
@ -1769,9 +1778,16 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
* 45 chars should be sufficient to reach the end of the encoding
* declaration without going too far inside the document content.
* on UTF-16 this means 90bytes, on UCS4 this means 180
* The actual value depending on guessed encoding is passed as @len
* if provided
*/
if (len >= 0) {
if (toconv > len)
toconv = len;
} else {
if (toconv > 180)
toconv = 180;
}
if (toconv * 2 >= written) {
xmlBufferGrow(out, toconv);
written = out->size - out->use - 1;
@ -1825,6 +1841,26 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
return(ret);
}
/**
* xmlCharEncFirstLine:
* @handler: char enconding transformation data structure
* @out: an xmlBuffer for the output.
* @in: an xmlBuffer for the input
*
* Front-end for the encoding handler input function, but handle only
* the very first line, i.e. limit itself to 45 chars.
*
* Returns the number of byte written if success, or
* -1 general error
* -2 if the transcoding fails (for *in is not valid utf8 string or
* the result of transformation can't fit into the encoding we want), or
*/
int
xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in) {
return(xmlCharEncFirstLineInt(handler, out, in, -1));
}
/**
* xmlCharEncInFunc:
* @handler: char encoding transformation data structure

View file

@ -690,7 +690,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
}
cur++;
}
*out++ = 0;
*out = 0;
return(buffer);
}
@ -772,7 +772,7 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
}
cur++;
}
*out++ = 0;
*out = 0;
return(buffer);
}

View file

@ -132,7 +132,7 @@ xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
*/
void
xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
xmlGenericErrorContext = ctx;
xmlStructuredErrorContext = ctx;
xmlStructuredError = handler;
}
@ -471,7 +471,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
* if user has defined handler, change data ptr to user's choice
*/
if (schannel != NULL)
data = xmlGenericErrorContext;
data = xmlStructuredErrorContext;
}
if ((domain == XML_FROM_VALID) &&
((channel == xmlParserValidityError) ||
@ -573,7 +573,6 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
if ((to->file == NULL) && (node != NULL) && (node->doc != NULL)) {
to->file = (char *) xmlStrdup(node->doc->URL);
}
file = to->file;
}
to->line = line;
if (str1 != NULL)
@ -593,21 +592,24 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
/*
* Find the callback channel if channel param is NULL
*/
if ((ctxt != NULL) && (channel == NULL) && (xmlStructuredError == NULL) && (ctxt->sax != NULL)) {
if ((ctxt != NULL) && (channel == NULL) &&
(xmlStructuredError == NULL) && (ctxt->sax != NULL)) {
if (level == XML_ERR_WARNING)
channel = ctxt->sax->warning;
else
channel = ctxt->sax->error;
data = ctxt->userData;
} else if (channel == NULL) {
if (xmlStructuredError != NULL)
if ((schannel == NULL) && (xmlStructuredError != NULL)) {
schannel = xmlStructuredError;
else
data = xmlStructuredErrorContext;
} else {
channel = xmlGenericError;
if (!data) {
data = xmlGenericErrorContext;
}
}
}
if (schannel != NULL) {
schannel(data, to);
return;

View file

@ -46,6 +46,7 @@ static xmlMutexPtr xmlThrDefMutex = NULL;
*/
void xmlInitGlobals(void)
{
if (xmlThrDefMutex != NULL)
xmlThrDefMutex = xmlNewMutex();
}
@ -148,6 +149,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#undef xmlGenericError
#undef xmlStructuredError
#undef xmlGenericErrorContext
#undef xmlStructuredErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlTreeIndentString
@ -314,6 +316,13 @@ static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
*/
void *xmlGenericErrorContext = NULL;
static void *xmlGenericErrorContextThrDef = NULL;
/**
* xmlStructuredErrorContext:
*
* Global setting passed to structured error callbacks
*/
void *xmlStructuredErrorContext = NULL;
static void *xmlStructuredErrorContextThrDef = NULL;
xmlError xmlLastError;
/*
@ -545,6 +554,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlGenericError = xmlGenericErrorThrDef;
gs->xmlStructuredError = xmlStructuredErrorThrDef;
gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
@ -573,7 +583,7 @@ xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
void
xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
xmlMutexLock(xmlThrDefMutex);
xmlGenericErrorContextThrDef = ctx;
xmlStructuredErrorContextThrDef = ctx;
xmlStructuredErrorThrDef = handler;
xmlMutexUnlock(xmlThrDefMutex);
}
@ -876,6 +886,15 @@ __xmlGenericErrorContext(void) {
return (&xmlGetGlobalState()->xmlGenericErrorContext);
}
#undef xmlStructuredErrorContext
void * *
__xmlStructuredErrorContext(void) {
if (IS_MAIN_THREAD)
return (&xmlStructuredErrorContext);
else
return (&xmlGetGlobalState()->xmlStructuredErrorContext);
}
#undef xmlGetWarningsDefaultValue
int *
__xmlGetWarningsDefaultValue(void) {

View file

@ -320,7 +320,6 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) {
inside_table = 0;
iter = next;
}
inside_table = 0;
}
xmlFree(table->table);
}

View file

@ -1,8 +1,9 @@
# Makefile.in generated by automake 1.9.2 from Makefile.am.
# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -13,15 +14,12 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@ -45,21 +43,51 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
@ -75,10 +103,6 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@
CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@
@ -87,25 +111,28 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOCB_OBJ = @DOCB_OBJ@
ECHO = @ECHO@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
FTP_OBJ = @FTP_OBJ@
GREP = @GREP@
HAVE_ISINF = @HAVE_ISINF@
HAVE_ISNAN = @HAVE_ISNAN@
HTML_DIR = @HTML_DIR@
HTML_OBJ = @HTML_OBJ@
HTTP_OBJ = @HTTP_OBJ@
ICONV_LIBS = @ICONV_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@ -117,15 +144,21 @@ LIBXML_VERSION = @LIBXML_VERSION@
LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@
LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MODULE_EXTENSION = @MODULE_EXTENSION@
MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@
MV = @MV@
M_LIBS = @M_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -136,6 +169,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PYTHON = @PYTHON@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_LIBS = @PYTHON_LIBS@
PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
PYTHON_SUBDIR = @PYTHON_SUBDIR@
PYTHON_TESTS = @PYTHON_TESTS@
@ -145,6 +179,7 @@ RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STATIC_BINARIES = @STATIC_BINARIES@
@ -161,6 +196,7 @@ TEST_PUSH = @TEST_PUSH@
TEST_REGEXPS = @TEST_REGEXPS@
TEST_SAX = @TEST_SAX@
TEST_SCHEMAS = @TEST_SCHEMAS@
TEST_SCHEMATRON = @TEST_SCHEMATRON@
TEST_THREADS = @TEST_THREADS@
TEST_VALID = @TEST_VALID@
TEST_VTIME = @TEST_VTIME@
@ -172,6 +208,8 @@ THREAD_CFLAGS = @THREAD_CFLAGS@
THREAD_LIBS = @THREAD_LIBS@
U = @U@
VERSION = @VERSION@
VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@
WGET = @WGET@
WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
WITH_C14N = @WITH_C14N@
@ -189,23 +227,21 @@ WITH_MODULES = @WITH_MODULES@
WITH_OUTPUT = @WITH_OUTPUT@
WITH_PATTERN = @WITH_PATTERN@
WITH_PUSH = @WITH_PUSH@
WITH_PYTHON_FALSE = @WITH_PYTHON_FALSE@
WITH_PYTHON_TRUE = @WITH_PYTHON_TRUE@
WITH_READER = @WITH_READER@
WITH_REGEXPS = @WITH_REGEXPS@
WITH_RUN_DEBUG = @WITH_RUN_DEBUG@
WITH_SAX1 = @WITH_SAX1@
WITH_SCHEMAS = @WITH_SCHEMAS@
WITH_SCHEMATRON = @WITH_SCHEMATRON@
WITH_THREADS = @WITH_THREADS@
WITH_TREE = @WITH_TREE@
WITH_TRIO = @WITH_TRIO@
WITH_TRIO_SOURCES_FALSE = @WITH_TRIO_SOURCES_FALSE@
WITH_TRIO_SOURCES_TRUE = @WITH_TRIO_SOURCES_TRUE@
WITH_VALID = @WITH_VALID@
WITH_WRITER = @WITH_WRITER@
WITH_XINCLUDE = @WITH_XINCLUDE@
WITH_XPATH = @WITH_XPATH@
WITH_XPTR = @WITH_XPTR@
WITH_ZLIB = @WITH_ZLIB@
XINCLUDE_OBJ = @XINCLUDE_OBJ@
XMLLINT = @XMLLINT@
XML_CFLAGS = @XML_CFLAGS@
@ -218,19 +254,12 @@ XPTR_OBJ = @XPTR_OBJ@
XSLTPROC = @XSLTPROC@
Z_CFLAGS = @Z_CFLAGS@
Z_LIBS = @Z_LIBS@
ac_ct_AR = @ac_ct_AR@
ac_ct_AS = @ac_ct_AS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
ac_ct_F77 = @ac_ct_F77@
ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@ -242,29 +271,42 @@ build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = libxml
EXTRA_DIST = win32config.h wsockcompat.h
all: all-recursive
@ -274,13 +316,13 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \
cd $(top_srcdir) && \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu include/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@ -299,6 +341,7 @@ $(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
@ -306,10 +349,6 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
@ -317,7 +356,13 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@ -328,16 +373,21 @@ $(RECURSIVE_TARGETS):
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@ -357,16 +407,16 @@ maintainer-clean-recursive:
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@ -374,14 +424,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
@ -393,81 +443,101 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
@ -497,6 +567,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -507,8 +578,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
@ -516,18 +586,38 @@ dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
@ -546,22 +636,25 @@ ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-am:
uninstall-info: uninstall-info-recursive
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
clean clean-generic clean-libtool clean-recursive ctags \
ctags-recursive distclean distclean-generic distclean-libtool \
distclean-recursive distclean-tags distdir dvi dvi-am html \
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-libtool \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-info-am
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -6,7 +6,7 @@
#define HAVE_MALLOC_H
#define HAVE_ERRNO_H
#ifdef _WIN32_WCE
#if defined(_WIN32_WCE)
#undef HAVE_ERRNO_H
#include <windows.h>
#include "wincecompat.h"
@ -23,10 +23,19 @@
#include <libxml/xmlversion.h>
#ifndef ICONV_CONST
#define ICONV_CONST const
#endif
#ifdef NEED_SOCKETS
#include <wsockcompat.h>
#endif
/*
* Windows platforms may define except
*/
#undef except
#define HAVE_ISINF
#define HAVE_ISNAN
#include <math.h>
@ -84,16 +93,20 @@ static int isnan (double d) {
#endif
#endif /* _MSC_VER */
#if defined(_MSC_VER) || defined(__MINGW32__)
#if defined(_MSC_VER)
#define mkdir(p,m) _mkdir(p)
#define snprintf _snprintf
#if _MSC_VER < 1500
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
#endif
#elif defined(__MINGW32__)
#define mkdir(p,m) _mkdir(p)
#endif
/* Threading API to use should be specified here for compatibility reasons.
This is however best specified on the compiler's command-line. */
#if defined(LIBXML_THREAD_ENABLED)
#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS)
#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE)
#define HAVE_WIN32_THREADS
#endif
#endif

View file

@ -10,6 +10,28 @@
#else
#undef HAVE_ERRNO_H
#include <winsock2.h>
/* the following is a workaround a problem for 'inline' keyword in said
header when compiled with Borland C++ 6 */
#if defined(__BORLANDC__) && !defined(__cplusplus)
#define inline __inline
#define _inline __inline
#endif
#include <ws2tcpip.h>
/* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
#if defined(GetAddrInfo)
#include <wspiapi.h>
#define HAVE_GETADDRINFO
#endif
#endif
#ifdef __MINGW32__
/* Include <errno.h> here to ensure that it doesn't get included later
* (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */
#include <errno.h>
#undef EWOULDBLOCK
#endif
#if !defined SOCKLEN_T

View file

@ -4,12 +4,10 @@ Version: @VERSION@
Release: 1
License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2-%{version}.tar.gz
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: python python-devel zlib-devel
BuildRequires: python python-devel zlib-devel pkgconfig
URL: http://xmlsoft.org/
Prefix: %{_prefix}
Docdir: %{_docdir}
%description
This library allows to manipulate XML files. It includes support
@ -62,14 +60,14 @@ at parse time or later once the document has been modified.
%build
%configure
make
make %{_smp_mflags}
gzip -9 ChangeLog
%install
rm -fr %{buildroot}
%makeinstall
(cd doc/examples ; make clean ; rm -rf .deps)
(cd doc/examples ; make clean ; rm -rf .deps Makefile)
gzip -9 doc/libxml2-api.xml
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
@ -91,17 +89,18 @@ rm -fr %{buildroot}
%doc %{_mandir}/man3/libxml.3*
%{_libdir}/lib*.so.*
%{prefix}/bin/xmllint
%{prefix}/bin/xmlcatalog
%{_bindir}/xmllint
%{_bindir}/xmlcatalog
%files devel
%defattr(-, root, root)
%doc %{_mandir}/man1/xml2-config.1*
%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO
%doc AUTHORS ChangeLog.gz NEWS README Copyright
%doc doc/*.html doc/html doc/*.gif doc/*.png
%doc doc/tutorial doc/libxml2-api.xml.gz
%doc doc/examples
%doc %dir %{_datadir}/gtk-doc/html/libxml2
%doc %{_datadir}/gtk-doc/html/libxml2/*.devhelp
%doc %{_datadir}/gtk-doc/html/libxml2/*.html
%doc %{_datadir}/gtk-doc/html/libxml2/*.png
@ -110,9 +109,9 @@ rm -fr %{buildroot}
%{_libdir}/lib*.so
%{_libdir}/*a
%{_libdir}/*.sh
%{prefix}/include/*
%{prefix}/bin/xml2-config
%{prefix}/share/aclocal/libxml.m4
%{_includedir}/*
%{_bindir}/xml2-config
%{_datadir}/aclocal/libxml.m4
%{_libdir}/pkgconfig/libxml-2.0.pc
%files python
%defattr(-, root, root)

View file

@ -1,15 +1,13 @@
Summary: Library providing XML and HTML support
Name: libxml2
Version: 2.7.3
Version: 2.7.6
Release: 1
License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2-%{version}.tar.gz
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: python python-devel zlib-devel
BuildRequires: python python-devel zlib-devel pkgconfig
URL: http://xmlsoft.org/
Prefix: %{_prefix}
Docdir: %{_docdir}
%description
This library allows to manipulate XML files. It includes support
@ -62,14 +60,14 @@ at parse time or later once the document has been modified.
%build
%configure
make
make %{_smp_mflags}
gzip -9 ChangeLog
%install
rm -fr %{buildroot}
%makeinstall
(cd doc/examples ; make clean ; rm -rf .deps)
(cd doc/examples ; make clean ; rm -rf .deps Makefile)
gzip -9 doc/libxml2-api.xml
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
@ -91,17 +89,18 @@ rm -fr %{buildroot}
%doc %{_mandir}/man3/libxml.3*
%{_libdir}/lib*.so.*
%{prefix}/bin/xmllint
%{prefix}/bin/xmlcatalog
%{_bindir}/xmllint
%{_bindir}/xmlcatalog
%files devel
%defattr(-, root, root)
%doc %{_mandir}/man1/xml2-config.1*
%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO
%doc AUTHORS ChangeLog.gz NEWS README Copyright
%doc doc/*.html doc/html doc/*.gif doc/*.png
%doc doc/tutorial doc/libxml2-api.xml.gz
%doc doc/examples
%doc %dir %{_datadir}/gtk-doc/html/libxml2
%doc %{_datadir}/gtk-doc/html/libxml2/*.devhelp
%doc %{_datadir}/gtk-doc/html/libxml2/*.html
%doc %{_datadir}/gtk-doc/html/libxml2/*.png
@ -110,9 +109,9 @@ rm -fr %{buildroot}
%{_libdir}/lib*.so
%{_libdir}/*a
%{_libdir}/*.sh
%{prefix}/include/*
%{prefix}/bin/xml2-config
%{prefix}/share/aclocal/libxml.m4
%{_includedir}/*
%{_bindir}/xml2-config
%{_datadir}/aclocal/libxml.m4
%{_libdir}/pkgconfig/libxml-2.0.pc
%files python
%defattr(-, root, root)
@ -128,6 +127,6 @@ rm -fr %{buildroot}
%doc doc/python.html
%changelog
* Sun Jan 18 2009 Daniel Veillard <veillard@redhat.com>
- upstream release 2.7.3 see http://xmlsoft.org/news.html
* Tue Oct 6 2009 Daniel Veillard <veillard@redhat.com>
- upstream release 2.7.6 see http://xmlsoft.org/news.html

File diff suppressed because it is too large Load diff

View file

@ -78,13 +78,11 @@
#if defined(__MINGW32__) || defined(_WIN32_WCE)
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#endif
#include <wsockcompat.h>
#include <winsock2.h>
#undef XML_SOCKLEN_T
#define XML_SOCKLEN_T int
#define XML_SOCKLEN_T unsigned int
#endif
/**

View file

@ -54,9 +54,13 @@
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifndef HAVE_POLL_H
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#else
#include <poll.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
@ -75,13 +79,11 @@
#endif
#if defined(__MINGW32__) || defined(_WIN32_WCE)
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#endif
#include <wsockcompat.h>
#include <winsock2.h>
#undef XML_SOCKLEN_T
#define XML_SOCKLEN_T int
#define XML_SOCKLEN_T unsigned int
#endif
@ -148,6 +150,7 @@ typedef struct xmlNanoHTTPCtxt {
int inlen; /* len of the input buffer */
int last; /* return code for last operation */
int returnValue; /* the protocol return value */
int version; /* the protocol version */
int ContentLength; /* specified content length from HTTP header */
char *contentType; /* the MIME type for the input */
char *location; /* the new URL in case of redirect */
@ -441,14 +444,21 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) {
*/
static int
xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char * xmt_ptr, int outlen) {
xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char *xmt_ptr, int outlen)
{
int total_sent = 0;
#ifdef HAVE_POLL_H
struct pollfd p;
#else
struct timeval tv;
fd_set wfd;
#endif
if ((ctxt->state & XML_NANO_HTTP_WRITE) && (xmt_ptr != NULL)) {
while (total_sent < outlen) {
int nsent = send(ctxt->fd, xmt_ptr + total_sent,
outlen - total_sent, 0);
if (nsent > 0)
total_sent += nsent;
else if ((nsent == -1) &&
@ -460,17 +470,16 @@ xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char * xmt_ptr, int outlen) {
if (total_sent == 0)
total_sent = -1;
break;
}
else {
} else {
/*
** No data sent
** Since non-blocking sockets are used, wait for
** socket to be writable or default timeout prior
** to retrying.
* No data sent
* Since non-blocking sockets are used, wait for
* socket to be writable or default timeout prior
* to retrying.
*/
struct timeval tv;
fd_set wfd;
#ifndef HAVE_POLL_H
if (ctxt->fd > FD_SETSIZE)
return -1;
tv.tv_sec = timeout;
tv.tv_usec = 0;
@ -484,6 +493,11 @@ xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char * xmt_ptr, int outlen) {
#pragma warning(pop)
#endif
(void) select(ctxt->fd + 1, NULL, &wfd, NULL, &tv);
#else
p.fd = ctxt->fd;
p.events = POLLOUT;
(void) poll(&p, 1, timeout * 1000);
#endif /* !HAVE_POLL_H */
}
}
}
@ -502,9 +516,14 @@ xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char * xmt_ptr, int outlen) {
*/
static int
xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) {
xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt)
{
#ifdef HAVE_POLL_H
struct pollfd p;
#else
fd_set rfd;
struct timeval tv;
#endif
while (ctxt->state & XML_NANO_HTTP_READ) {
@ -571,15 +590,30 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) {
return (-1);
}
}
#ifdef HAVE_POLL_H
p.fd = ctxt->fd;
p.events = POLLIN;
if ((poll(&p, 1, timeout * 1000) < 1)
#if defined(EINTR)
&& (errno != EINTR)
#endif
)
return (0);
#else /* !HAVE_POLL_H */
if (ctxt->fd > FD_SETSIZE)
return 0;
tv.tv_sec = timeout;
tv.tv_usec = 0;
FD_ZERO(&rfd);
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4018)
#endif
FD_SET(ctxt->fd, &rfd);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
@ -590,6 +624,7 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) {
#endif
)
return (0);
#endif /* !HAVE_POLL_H */
}
return (0);
}
@ -688,6 +723,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
}
if ((*cur != 0) && (*cur != ' ') && (*cur != '\t')) return;
ctxt->returnValue = ret;
ctxt->version = version;
} else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"Content-Type:", 13)) {
const xmlChar *charset, *last, *mime;
cur += 13;
@ -805,21 +841,26 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
static int
xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
{
#ifndef HAVE_POLL_H
fd_set wfd;
#ifdef _WINSOCKAPI_
fd_set xfd;
#endif
struct timeval tv;
#else /* !HAVE_POLL_H */
struct pollfd p;
#endif /* !HAVE_POLL_H */
int status;
int addrlen;
SOCKET s;
#ifdef SUPPORT_IP6
if (addr->sa_family == AF_INET6) {
s = socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP);
addrlen = sizeof(struct sockaddr_in6);
}
else
} else
#endif
{
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
@ -832,7 +873,6 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
__xmlIOErr(XML_FROM_HTTP, 0, "socket failed\n");
return (-1);
}
#ifdef _WINSOCKAPI_
{
u_long one = 1;
@ -843,13 +883,17 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
#if defined(VMS)
{
int enable = 1;
status = ioctl(s, FIONBIO, &enable);
}
#else /* VMS */
#if defined(__BEOS__) && !defined(__HAIKU__)
{
bool noblock = true;
status = setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock, sizeof(noblock));
status =
setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock,
sizeof(noblock));
}
#else /* __BEOS__ */
if ((status = fcntl(s, F_GETFL, 0)) != -1) {
@ -880,12 +924,13 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
case EWOULDBLOCK:
break;
default:
__xmlIOErr(XML_FROM_HTTP, 0, "error connecting to HTTP server");
__xmlIOErr(XML_FROM_HTTP, 0,
"error connecting to HTTP server");
closesocket(s);
return (-1);
}
}
#ifndef HAVE_POLL_H
tv.tv_sec = timeout;
tv.tv_usec = 0;
@ -893,6 +938,8 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
#pragma warning(push)
#pragma warning(disable: 4018)
#endif
if (s > FD_SETSIZE)
return -1;
FD_ZERO(&wfd);
FD_SET(s, &wfd);
@ -907,6 +954,13 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#else /* !HAVE_POLL_H */
p.fd = s;
p.events = POLLOUT;
switch (poll(&p, 1, timeout * 1000))
#endif /* !HAVE_POLL_H */
{
case 0:
/* Time out */
@ -920,22 +974,30 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
return (-1);
}
#ifndef HAVE_POLL_H
if (FD_ISSET(s, &wfd)
#ifdef _WINSOCKAPI_
|| FD_ISSET(s, &xfd)
#endif
) {
)
#else /* !HAVE_POLL_H */
if (p.revents == POLLOUT)
#endif /* !HAVE_POLL_H */
{
XML_SOCKLEN_T len;
len = sizeof(status);
#ifdef SO_ERROR
if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*)&status, &len) < 0 ) {
if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &status, &len) <
0) {
/* Solaris error code */
__xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n");
return (-1);
}
#endif
if (status) {
__xmlIOErr(XML_FROM_HTTP, 0, "Error connecting to remote host");
__xmlIOErr(XML_FROM_HTTP, 0,
"Error connecting to remote host");
closesocket(s);
errno = status;
return (-1);
@ -1275,7 +1337,6 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input,
xmlNanoHTTPCtxtPtr ctxt;
char *bp, *p;
int blen, ret;
int head;
int nbRedirects = 0;
char *redirURL = NULL;
#ifdef DEBUG_HTTP
@ -1437,11 +1498,9 @@ retry:
}
ctxt->state = XML_NANO_HTTP_READ;
head = 1;
while ((p = xmlNanoHTTPReadLine(ctxt)) != NULL) {
if (head && (*p == 0)) {
head = 0;
if (*p == 0) {
ctxt->content = ctxt->inrptr;
xmlFree(p);
break;

View file

@ -83,6 +83,10 @@
static void
xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info);
static xmlParserCtxtPtr
xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
const xmlChar *base, xmlParserCtxtPtr pctx);
/************************************************************************
* *
* Arbitrary limits set in the parser. See XML_PARSE_HUGE *
@ -198,7 +202,7 @@ static const char *xmlW3CPIs[] = {
/* DEPR void xmlParserHandleReference(xmlParserCtxtPtr ctxt); */
xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt,
static xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt,
const xmlChar **str);
static xmlParserErrors
@ -246,14 +250,15 @@ xmlErrAttributeDup(xmlParserCtxtPtr ctxt, const xmlChar * prefix,
return;
if (ctxt != NULL)
ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED;
if (prefix == NULL)
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
ctxt->errNo, XML_ERR_FATAL, NULL, 0,
XML_ERR_ATTRIBUTE_REDEFINED, XML_ERR_FATAL, NULL, 0,
(const char *) localname, NULL, NULL, 0, 0,
"Attribute %s redefined\n", localname);
else
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER,
ctxt->errNo, XML_ERR_FATAL, NULL, 0,
XML_ERR_ATTRIBUTE_REDEFINED, XML_ERR_FATAL, NULL, 0,
(const char *) prefix, (const char *) localname,
NULL, 0, 0, "Attribute %s:%s redefined\n", prefix,
localname);
@ -489,7 +494,7 @@ xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg);
XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg);
if (ctxt != NULL) {
ctxt->wellFormed = 0;
if (ctxt->recovery == 0)
@ -519,6 +524,7 @@ xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if ((ctxt != NULL) && (ctxt->sax != NULL) &&
(ctxt->sax->initialized == XML_SAX2_MAGIC))
schannel = ctxt->sax->serror;
if (ctxt != NULL) {
__xmlRaiseError(schannel,
(ctxt->sax) ? ctxt->sax->warning : NULL,
ctxt->userData,
@ -526,6 +532,13 @@ xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
XML_ERR_WARNING, NULL, 0,
(const char *) str1, (const char *) str2, NULL, 0, 0,
msg, (const char *) str1, (const char *) str2);
} else {
__xmlRaiseError(schannel, NULL, NULL,
ctxt, NULL, XML_FROM_PARSER, error,
XML_ERR_WARNING, NULL, 0,
(const char *) str1, (const char *) str2, NULL, 0, 0,
msg, (const char *) str1, (const char *) str2);
}
}
/**
@ -551,14 +564,20 @@ xmlValidityError(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC))
schannel = ctxt->sax->serror;
}
if (ctxt != NULL) {
__xmlRaiseError(schannel,
ctxt->vctxt.error, ctxt->vctxt.userData,
ctxt, NULL, XML_FROM_DTD, error,
XML_ERR_ERROR, NULL, 0, (const char *) str1,
(const char *) str2, NULL, 0, 0,
msg, (const char *) str1, (const char *) str2);
if (ctxt != NULL) {
ctxt->valid = 0;
} else {
__xmlRaiseError(schannel, NULL, NULL,
ctxt, NULL, XML_FROM_DTD, error,
XML_ERR_ERROR, NULL, 0, (const char *) str1,
(const char *) str2, NULL, 0, 0,
msg, (const char *) str1, (const char *) str2);
}
}
@ -723,8 +742,6 @@ xmlNsWarn(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
(ctxt->instate == XML_PARSER_EOF))
return;
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
XML_ERR_WARNING, NULL, 0, (const char *) info1,
(const char *) info2, (const char *) info3, 0, 0, msg,
@ -1342,7 +1359,7 @@ xmlCheckLanguageID(const xmlChar * lang)
* *
************************************************************************/
xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt,
static xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt,
const xmlChar ** str);
#ifdef SAX2
@ -2614,7 +2631,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
else
c = 0;
}
buffer[nbchars++] = 0;
buffer[nbchars] = 0;
return(buffer);
mem_error:
@ -2917,12 +2934,15 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
* Routines to parse Name, NCName and NmToken *
* *
************************************************************************/
unsigned long nbParseName = 0;
unsigned long nbParseNmToken = 0;
unsigned long nbParseNCName = 0;
unsigned long nbParseNCNameComplex = 0;
unsigned long nbParseNameComplex = 0;
unsigned long nbParseStringName = 0;
#ifdef DEBUG
static unsigned long nbParseName = 0;
static unsigned long nbParseNmToken = 0;
static unsigned long nbParseNCName = 0;
static unsigned long nbParseNCNameComplex = 0;
static unsigned long nbParseNameComplex = 0;
static unsigned long nbParseStringName = 0;
#endif
/*
* The two following functions are related to the change of accepted
* characters for Name and NmToken in the Revision 5 of XML-1.0
@ -3012,7 +3032,9 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
int c;
int count = 0;
#ifdef DEBUG
nbParseNameComplex++;
#endif
/*
* Handler for more complex cases
@ -3128,7 +3150,9 @@ xmlParseName(xmlParserCtxtPtr ctxt) {
GROW;
#ifdef DEBUG
nbParseName++;
#endif
/*
* Accelerator for simple ASCII names
@ -3165,7 +3189,9 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
int c;
int count = 0;
#ifdef DEBUG
nbParseNCNameComplex++;
#endif
/*
* Handler for more complex cases
@ -3211,7 +3237,9 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) {
const xmlChar *ret;
int count = 0;
#ifdef DEBUG
nbParseNCName++;
#endif
/*
* Accelerator for simple ASCII names
@ -3306,7 +3334,9 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
int len = 0, l;
int c;
#ifdef DEBUG
nbParseStringName++;
#endif
c = CUR_SCHAR(cur, l);
if (!xmlIsNameStartChar(ctxt, c)) {
@ -3380,7 +3410,9 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
int c;
int count = 0;
#ifdef DEBUG
nbParseNmToken++;
#endif
GROW;
c = CUR_CHAR(l);
@ -3688,6 +3720,11 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
if (rep != NULL) {
current = rep;
while (*current != 0) { /* non input consuming */
if ((*current == 0xD) || (*current == 0xA) ||
(*current == 0x9)) {
buf[len++] = 0x20;
current++;
} else
buf[len++] = *current++;
if (len > buf_size - 10) {
growBuffer(buf, 10);
@ -3978,7 +4015,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
return(buf);
}
void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata);
static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata);
/*
* used for the test in the inner loop of the char data testing
@ -4183,7 +4220,7 @@ get_more:
* of xmlParseCharData() when the parsing requires handling
* of non-ASCII characters.
*/
void
static void
xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
xmlChar buf[XML_PARSER_BIG_BUFFER_SIZE + 5];
int nbchar = 0;
@ -5306,7 +5343,8 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) {
if (name == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"Name expected in NOTATION declaration\n");
return(ret);
xmlFreeEnumeration(ret);
return(NULL);
}
tmp = ret;
while (tmp != NULL) {
@ -5322,7 +5360,10 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) {
}
if (tmp == NULL) {
cur = xmlCreateEnumeration(name);
if (cur == NULL) return(ret);
if (cur == NULL) {
xmlFreeEnumeration(ret);
return(NULL);
}
if (last == NULL) ret = last = cur;
else {
last->next = cur;
@ -5333,9 +5374,8 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) {
} while (RAW == '|');
if (RAW != ')') {
xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_FINISHED, NULL);
if ((last != NULL) && (last != ret))
xmlFreeEnumeration(last);
return(ret);
xmlFreeEnumeration(ret);
return(NULL);
}
NEXT;
return(ret);
@ -5390,7 +5430,10 @@ xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
cur = xmlCreateEnumeration(name);
if (!xmlDictOwns(ctxt->dict, name))
xmlFree(name);
if (cur == NULL) return(ret);
if (cur == NULL) {
xmlFreeEnumeration(ret);
return(NULL);
}
if (last == NULL) ret = last = cur;
else {
last->next = cur;
@ -5738,6 +5781,7 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
if (cur->c2 != NULL)
cur->c2->parent = cur;
}
if (ret != NULL)
ret->ocur = XML_ELEMENT_CONTENT_MULT;
if ((ctxt->validate) && (ctxt->input->id != inputchk)) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
@ -5758,9 +5802,10 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
}
/**
* xmlParseElementChildrenContentDecl:
* xmlParseElementChildrenContentDeclPriv:
* @ctxt: an XML parser context
* @inputchk: the input used for the current entity, needed for boundary checks
* @depth: the level of recursion
*
* parse the declaration for a Mixed Element content
* The leading '(' and spaces have been skipped in xmlParseElementContentDecl
@ -5788,12 +5833,20 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
* Returns the tree of xmlElementContentPtr describing the element
* hierarchy.
*/
xmlElementContentPtr
xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk) {
static xmlElementContentPtr
xmlParseElementChildrenContentDeclPriv(xmlParserCtxtPtr ctxt, int inputchk,
int depth) {
xmlElementContentPtr ret = NULL, cur = NULL, last = NULL, op = NULL;
const xmlChar *elem;
xmlChar type = 0;
if (((depth > 128) && ((ctxt->options & XML_PARSE_HUGE) == 0)) ||
(depth > 2048)) {
xmlFatalErrMsgInt(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED,
"xmlParseElementChildrenContentDecl : depth %d too deep, use XML_PARSE_HUGE\n",
depth);
return(NULL);
}
SKIP_BLANKS;
GROW;
if (RAW == '(') {
@ -5802,7 +5855,8 @@ xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk) {
/* Recurse on first child */
NEXT;
SKIP_BLANKS;
cur = ret = xmlParseElementChildrenContentDecl(ctxt, inputid);
cur = ret = xmlParseElementChildrenContentDeclPriv(ctxt, inputid,
depth + 1);
SKIP_BLANKS;
GROW;
} else {
@ -5934,7 +5988,8 @@ xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk) {
/* Recurse on second child */
NEXT;
SKIP_BLANKS;
last = xmlParseElementChildrenContentDecl(ctxt, inputid);
last = xmlParseElementChildrenContentDeclPriv(ctxt, inputid,
depth + 1);
SKIP_BLANKS;
} else {
elem = xmlParseName(ctxt);
@ -6044,6 +6099,42 @@ xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk) {
return(ret);
}
/**
* xmlParseElementChildrenContentDecl:
* @ctxt: an XML parser context
* @inputchk: the input used for the current entity, needed for boundary checks
*
* parse the declaration for a Mixed Element content
* The leading '(' and spaces have been skipped in xmlParseElementContentDecl
*
* [47] children ::= (choice | seq) ('?' | '*' | '+')?
*
* [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
*
* [49] choice ::= '(' S? cp ( S? '|' S? cp )* S? ')'
*
* [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
*
* [ VC: Proper Group/PE Nesting ] applies to [49] and [50]
* TODO Parameter-entity replacement text must be properly nested
* with parenthesized groups. That is to say, if either of the
* opening or closing parentheses in a choice, seq, or Mixed
* construct is contained in the replacement text for a parameter
* entity, both must be contained in the same replacement text. For
* interoperability, if a parameter-entity reference appears in a
* choice, seq, or Mixed construct, its replacement text should not
* be empty, and neither the first nor last non-blank character of
* the replacement text should be a connector (| or ,).
*
* Returns the tree of xmlElementContentPtr describing the element
* hierarchy.
*/
xmlElementContentPtr
xmlParseElementChildrenContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
/* stub left for API/ABI compat */
return(xmlParseElementChildrenContentDeclPriv(ctxt, inputchk, 1));
}
/**
* xmlParseElementContentDecl:
* @ctxt: an XML parser context
@ -6080,7 +6171,7 @@ xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name,
tree = xmlParseElementMixedContentDecl(ctxt, inputid);
res = XML_ELEMENT_TYPE_MIXED;
} else {
tree = xmlParseElementChildrenContentDecl(ctxt, inputid);
tree = xmlParseElementChildrenContentDeclPriv(ctxt, inputid, 1);
res = XML_ELEMENT_TYPE_ELEMENT;
}
SKIP_BLANKS;
@ -7202,7 +7293,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
* Returns the xmlEntityPtr if found, or NULL otherwise. The str pointer
* is updated to the current location in the string.
*/
xmlEntityPtr
static xmlEntityPtr
xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
xmlChar *name;
const xmlChar *ptr;
@ -7217,7 +7308,6 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
return(NULL);
ptr++;
cur = *ptr;
name = xmlParseStringName(ctxt, &ptr);
if (name == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
@ -7611,7 +7701,7 @@ xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
* Returns the string of the entity content.
* str is updated to the current value of the index
*/
xmlEntityPtr
static xmlEntityPtr
xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
const xmlChar *ptr;
xmlChar cur;
@ -7624,7 +7714,6 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
if (cur != '%')
return(NULL);
ptr++;
cur = *ptr;
name = xmlParseStringName(ctxt, &ptr);
if (name == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
@ -8288,7 +8377,7 @@ xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix) {
static const xmlChar *
xmlParseQNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *name,
xmlChar const *prefix) {
const xmlChar *cmp = name;
const xmlChar *cmp;
const xmlChar *in;
const xmlChar *ret;
const xmlChar *prefix2;
@ -9111,6 +9200,8 @@ xmlParseEndTag2(xmlParserCtxtPtr ctxt, const xmlChar *prefix,
*/
if (name != (xmlChar*)1) {
if (name == NULL) name = BAD_CAST "unparseable";
if ((line == 0) && (ctxt->node != NULL))
line = ctxt->node->line;
xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NAME_MISMATCH,
"Opening and ending tag mismatch: %s line %d and %s\n",
ctxt->name, line, name);
@ -9330,8 +9421,8 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
void
xmlParseElement(xmlParserCtxtPtr ctxt) {
const xmlChar *name;
const xmlChar *prefix;
const xmlChar *URI;
const xmlChar *prefix = NULL;
const xmlChar *URI = NULL;
xmlParserNodeInfo node_info;
int line, tlen;
xmlNodePtr ret;
@ -9930,6 +10021,12 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
}
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "Blank needed here\n");
}
/*
* We can grow the input buffer freely at that point
*/
GROW;
SKIP_BLANKS;
ctxt->input->standalone = xmlParseSDDecl(ctxt);
@ -10032,8 +10129,13 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
/*
* Check for the XMLDecl in the Prolog.
* do not GROW here to avoid the detected encoder to decode more
* than just the first line, unless the amount of data is really
* too small to hold "<?xml version="1.0" encoding="foo"
*/
if ((ctxt->input->end - ctxt->input->cur) < 35) {
GROW;
}
if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
/*
@ -10700,8 +10802,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
break;
case XML_PARSER_START_TAG: {
const xmlChar *name;
const xmlChar *prefix;
const xmlChar *URI;
const xmlChar *prefix = NULL;
const xmlChar *URI = NULL;
int nsNr = ctxt->nsNr;
if ((avail < 2) && (ctxt->inputNr == 1))
@ -11415,6 +11517,7 @@ int
xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
int terminate) {
int end_in_lf = 0;
int remain = 0;
if (ctxt == NULL)
return(XML_ERR_INTERNAL_ERROR);
@ -11427,12 +11530,41 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
end_in_lf = 1;
size--;
}
xmldecl_done:
if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
(ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) {
int base = ctxt->input->base - ctxt->input->buf->buffer->content;
int cur = ctxt->input->cur - ctxt->input->base;
int res;
/*
* Specific handling if we autodetected an encoding, we should not
* push more than the first line ... which depend on the encoding
* And only push the rest once the final encoding was detected
*/
if ((ctxt->instate == XML_PARSER_START) && (ctxt->input != NULL) &&
(ctxt->input->buf != NULL) && (ctxt->input->buf->encoder != NULL)) {
int len = 45;
if ((xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name,
BAD_CAST "UTF-16")) ||
(xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name,
BAD_CAST "UTF16")))
len = 90;
else if ((xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name,
BAD_CAST "UCS-4")) ||
(xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name,
BAD_CAST "UCS4")))
len = 180;
if (ctxt->input->buf->rawconsumed < len)
len -= ctxt->input->buf->rawconsumed;
remain = size - len;
size = len;
}
res =xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
if (res < 0) {
ctxt->errNo = XML_PARSER_EOF;
@ -11464,13 +11596,23 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
}
}
}
if (remain != 0)
xmlParseTryOrFinish(ctxt, 0);
else
xmlParseTryOrFinish(ctxt, terminate);
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
return(ctxt->errNo);
if (remain != 0) {
chunk += size;
size = remain;
remain = 0;
goto xmldecl_done;
}
if ((end_in_lf == 1) && (ctxt->input != NULL) &&
(ctxt->input->buf != NULL)) {
xmlParserInputBufferPush(ctxt->input->buf, 1, "\r");
}
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
return(ctxt->errNo);
if (terminate) {
/*
* Check for termination
@ -12034,8 +12176,6 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
int ret = 0;
xmlChar start[4];
xmlCharEncoding enc;
xmlParserInputPtr inputStream;
char *directory = NULL;
if (ctx == NULL) return(-1);
@ -12051,27 +12191,11 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL,
if (ctx->myDoc == NULL) /* @@ relax but check for dereferences */
return(-1);
ctxt = xmlNewParserCtxt();
ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, ctx);
if (ctxt == NULL) {
return(-1);
}
ctxt->userData = ctxt;
ctxt->_private = ctx->_private;
inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt);
if (inputStream == NULL) {
xmlFreeParserCtxt(ctxt);
return(-1);
}
inputPush(ctxt, inputStream);
if ((ctxt->directory == NULL) && (directory == NULL))
directory = xmlParserGetDirectory((char *)URL);
if ((ctxt->directory == NULL) && (directory != NULL))
ctxt->directory = directory;
oldsax = ctxt->sax;
ctxt->sax = ctx->sax;
xmlDetectSAX2(ctxt);
@ -12264,7 +12388,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
return(XML_ERR_INTERNAL_ERROR);
ctxt = xmlCreateEntityParserCtxt(URL, ID, NULL);
ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, oldctxt);
if (ctxt == NULL) return(XML_WAR_UNDECLARED_ENTITY);
ctxt->userData = ctxt;
if (oldctxt != NULL) {
@ -12394,7 +12518,9 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
* Record in the parent context the number of entities replacement
* done when parsing that reference.
*/
if (oldctxt != NULL)
oldctxt->nbentities += ctxt->nbentities;
/*
* Also record the size of the entity parsed
*/
@ -12512,6 +12638,9 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
xmlNodePtr last = NULL;
int size;
xmlParserErrors ret = XML_ERR_OK;
#ifdef SAX2
int i;
#endif
if (((oldctxt->depth > 40) && ((oldctxt->options & XML_PARSE_HUGE) == 0)) ||
(oldctxt->depth > 1024)) {
@ -12538,6 +12667,13 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5);
ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
#ifdef SAX2
/* propagate namespaces down the entity */
for (i = 0;i < oldctxt->nsNr;i += 2) {
nsPush(ctxt, oldctxt->nsTab[i], oldctxt->nsTab[i+1]);
}
#endif
oldsax = ctxt->sax;
ctxt->sax = oldctxt->sax;
xmlDetectSAX2(ctxt);
@ -12643,7 +12779,9 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
* Record in the parent context the number of entities replacement
* done when parsing that reference.
*/
if (oldctxt != NULL)
oldctxt->nbentities += ctxt->nbentities;
/*
* Also record the last error if any
*/
@ -13099,10 +13237,11 @@ xmlParseEntity(const char *filename) {
#endif /* LIBXML_SAX1_ENABLED */
/**
* xmlCreateEntityParserCtxt:
* xmlCreateEntityParserCtxtInternal:
* @URL: the entity URL
* @ID: the entity PUBLIC ID
* @base: a possible base for the target URI
* @pctx: parser context used to set options on new context
*
* Create a parser context for an external entity
* Automatic support for ZLIB/Compress compressed document is provided
@ -13110,9 +13249,9 @@ xmlParseEntity(const char *filename) {
*
* Returns the new parser context or NULL
*/
xmlParserCtxtPtr
xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID,
const xmlChar *base) {
static xmlParserCtxtPtr
xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
const xmlChar *base, xmlParserCtxtPtr pctx) {
xmlParserCtxtPtr ctxt;
xmlParserInputPtr inputStream;
char *directory = NULL;
@ -13123,6 +13262,11 @@ xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID,
return(NULL);
}
if (pctx != NULL) {
ctxt->options = pctx->options;
ctxt->_private = pctx->_private;
}
uri = xmlBuildURI(URL, base);
if (uri == NULL) {
@ -13157,6 +13301,25 @@ xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID,
return(ctxt);
}
/**
* xmlCreateEntityParserCtxt:
* @URL: the entity URL
* @ID: the entity PUBLIC ID
* @base: a possible base for the target URI
*
* Create a parser context for an external entity
* Automatic support for ZLIB/Compress compressed document is provided
* by default if found at compile-time.
*
* Returns the new parser context or NULL
*/
xmlParserCtxtPtr
xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID,
const xmlChar *base) {
return xmlCreateEntityParserCtxtInternal(URL, ID, base, NULL);
}
/************************************************************************
* *
* Front ends when parsing from a file *
@ -13325,7 +13488,7 @@ xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename,
*/
xmlDocPtr
xmlRecoverDoc(xmlChar *cur) {
xmlRecoverDoc(const xmlChar *cur) {
return(xmlSAXParseDoc(NULL, cur, 1));
}
@ -13527,6 +13690,8 @@ xmlSAXParseMemoryWithData(xmlSAXHandlerPtr sax, const char *buffer,
xmlDocPtr ret;
xmlParserCtxtPtr ctxt;
xmlInitParser();
ctxt = xmlCreateMemoryParserCtxt(buffer, size);
if (ctxt == NULL) return(NULL);
if (sax != NULL) {
@ -13623,6 +13788,8 @@ int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
int ret = 0;
xmlParserCtxtPtr ctxt;
xmlInitParser();
ctxt = xmlCreateMemoryParserCtxt(buffer, size);
if (ctxt == NULL) return -1;
if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
@ -13806,11 +13973,11 @@ xmlInitParser(void) {
__xmlGlobalInitMutexLock();
if (xmlParserInitialized == 0) {
#endif
xmlInitGlobals();
xmlInitThreads();
if ((xmlGenericError == xmlGenericErrorDefaultFunc) ||
(xmlGenericError == NULL))
initGenericErrorDefaultFunc(NULL);
xmlInitGlobals();
xmlInitThreads();
xmlInitMemory();
xmlInitCharEncodingHandlers();
xmlDefaultSAXHandlerInit();
@ -13844,6 +14011,14 @@ xmlInitParser(void) {
* the library and all XML/HTML documents built with it.
* See also xmlInitParser() which has the opposite function of preparing
* the library for operations.
*
* WARNING: if your application is multithreaded or has plugin support
* calling this may crash the application if another thread or
* a plugin is still using libxml2. It's sometimes very hard to
* guess if libxml2 is in use in the application, some libraries
* or plugins may use it without notice. In case of doubt abstain
* from calling this function or do it just before calling exit()
* to avoid leak reports from valgrind !
*/
void

View file

@ -494,20 +494,26 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
if (c & 0x80) {
if (c == 0xC0)
goto encoding_error;
if (cur[1] == 0)
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) {
unsigned int val;
if (cur[2] == 0)
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)
if (cur[3] == 0) {
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
cur = ctxt->input->cur;
}
if (((c & 0xf8) != 0xf0) ||
((cur[3] & 0xc0) != 0x80))
goto encoding_error;
@ -640,18 +646,24 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
if (c & 0x80) {
if (((c & 0x40) == 0) || (c == 0xC0))
goto encoding_error;
if (cur[1] == 0)
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)
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)
if (cur[3] == 0) {
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
cur = ctxt->input->cur;
}
if (((c & 0xf8) != 0xf0) ||
((cur[3] & 0xc0) != 0x80))
goto encoding_error;
@ -933,6 +945,17 @@ xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
* *
************************************************************************/
/* defined in encoding.c, not public */
int
xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in, int len);
static int
xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler, int len);
static int
xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler, int len);
/**
* xmlSwitchEncoding:
* @ctxt: the parser context
@ -947,6 +970,7 @@ int
xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
{
xmlCharEncodingHandlerPtr handler;
int len = -1;
if (ctxt == NULL) return(-1);
switch (enc) {
@ -990,8 +1014,32 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
(ctxt->input->cur[2] == 0xBF)) {
ctxt->input->cur += 3;
}
len = 90;
break;
default:
case XML_CHAR_ENCODING_UCS2:
len = 90;
break;
case XML_CHAR_ENCODING_UCS4BE:
case XML_CHAR_ENCODING_UCS4LE:
case XML_CHAR_ENCODING_UCS4_2143:
case XML_CHAR_ENCODING_UCS4_3412:
len = 180;
break;
case XML_CHAR_ENCODING_EBCDIC:
case XML_CHAR_ENCODING_8859_1:
case XML_CHAR_ENCODING_8859_2:
case XML_CHAR_ENCODING_8859_3:
case XML_CHAR_ENCODING_8859_4:
case XML_CHAR_ENCODING_8859_5:
case XML_CHAR_ENCODING_8859_6:
case XML_CHAR_ENCODING_8859_7:
case XML_CHAR_ENCODING_8859_8:
case XML_CHAR_ENCODING_8859_9:
case XML_CHAR_ENCODING_ASCII:
case XML_CHAR_ENCODING_2022_JP:
case XML_CHAR_ENCODING_SHIFT_JIS:
case XML_CHAR_ENCODING_EUC_JP:
len = 45;
break;
}
handler = xmlGetCharEncodingHandler(enc);
@ -1083,7 +1131,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
if (handler == NULL)
return(-1);
ctxt->charset = XML_CHAR_ENCODING_UTF8;
return(xmlSwitchToEncoding(ctxt, handler));
return(xmlSwitchToEncodingInt(ctxt, handler, len));
}
/**
@ -1091,15 +1139,16 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
* @ctxt: the parser context
* @input: the input stream
* @handler: the encoding handler
* @len: the number of bytes to convert for the first line or -1
*
* change the input functions when discovering the character encoding
* of a given entity.
*
* Returns 0 in case of success, -1 otherwise
*/
int
xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler)
static int
xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler, int len)
{
int nbchars;
@ -1196,9 +1245,10 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
* parsed with the autodetected encoding
* into the parser reading buffer.
*/
nbchars = xmlCharEncFirstLine(input->buf->encoder,
nbchars = xmlCharEncFirstLineInt(input->buf->encoder,
input->buf->buffer,
input->buf->raw);
input->buf->raw,
len);
}
if (nbchars < 0) {
xmlErrInternal(ctxt,
@ -1224,8 +1274,9 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
}
/**
* xmlSwitchToEncoding:
* xmlSwitchInputEncoding:
* @ctxt: the parser context
* @input: the input stream
* @handler: the encoding handler
*
* change the input functions when discovering the character encoding
@ -1234,13 +1285,32 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
* Returns 0 in case of success, -1 otherwise
*/
int
xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
{
xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler) {
return(xmlSwitchInputEncodingInt(ctxt, input, handler, -1));
}
/**
* xmlSwitchToEncodingInt:
* @ctxt: the parser context
* @handler: the encoding handler
* @len: the lenght to convert or -1
*
* change the input functions when discovering the character encoding
* of a given entity, and convert only @len bytes of the output, this
* is needed on auto detect to allows any declared encoding later to
* convert the actual content after the xmlDecl
*
* Returns 0 in case of success, -1 otherwise
*/
static int
xmlSwitchToEncodingInt(xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler, int len) {
int ret = 0;
if (handler != NULL) {
if (ctxt->input != NULL) {
ret = xmlSwitchInputEncoding(ctxt, ctxt->input, handler);
ret = xmlSwitchInputEncodingInt(ctxt, ctxt->input, handler, len);
} else {
xmlErrInternal(ctxt, "xmlSwitchToEncoding : no input\n",
NULL);
@ -1255,6 +1325,22 @@ xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
return(ret);
}
/**
* xmlSwitchToEncoding:
* @ctxt: the parser context
* @handler: the encoding handler
*
* change the input functions when discovering the character encoding
* of a given entity.
*
* Returns 0 in case of success, -1 otherwise
*/
int
xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
{
return (xmlSwitchToEncodingInt(ctxt, handler, -1));
}
/************************************************************************
* *
* Commodity functions to handle entities processing *
@ -2067,7 +2153,7 @@ xmlKeepBlanksDefault(int val) {
int old = xmlKeepBlanksDefaultValue;
xmlKeepBlanksDefaultValue = val;
xmlIndentTreeOutput = !val;
if (!val) xmlIndentTreeOutput = 1;
return(old);
}

View file

@ -149,6 +149,7 @@ typedef enum {
#define IS_PROCESSED (1 << 5)
#define IS_COMPILABLE (1 << 6)
#define IS_NOT_COMPILABLE (1 << 7)
#define IS_EXTERNAL_REF (1 << 8)
struct _xmlRelaxNGDefine {
xmlRelaxNGType type; /* the type of definition */
@ -414,6 +415,7 @@ struct _xmlRelaxNGDocument {
xmlDocPtr doc; /* the associated XML document */
xmlRelaxNGDefinePtr content; /* the definitions */
xmlRelaxNGPtr schema; /* the schema */
int externalRef; /* 1 if an external ref */
};
@ -1006,7 +1008,7 @@ xmlRelaxNGNewStates(xmlRelaxNGValidCtxtPtr ctxt, int size)
xmlRelaxNGStatesPtr ret;
if ((ctxt != NULL) &&
(ctxt->freeState != NULL) && (ctxt->freeStatesNr > 0)) {
(ctxt->freeStates != NULL) && (ctxt->freeStatesNr > 0)) {
ctxt->freeStatesNr--;
ret = ctxt->freeStates[ctxt->freeStatesNr];
ret->nbState = 0;
@ -1970,6 +1972,7 @@ xmlRelaxNGLoadExternalRef(xmlRelaxNGParserCtxtPtr ctxt,
ret->doc = doc;
ret->href = xmlStrdup(URL);
ret->next = ctxt->documents;
ret->externalRef = 1;
ctxt->documents = ret;
/*
@ -2372,6 +2375,9 @@ xmlRelaxNGAddValidError(xmlRelaxNGValidCtxtPtr ctxt,
} else {
node = seq = NULL;
}
if ((node == NULL) && (seq == NULL)) {
node = ctxt->pnode;
}
xmlRelaxNGShowValidError(ctxt, err, node, seq, arg1, arg2);
}
/*
@ -2849,6 +2855,10 @@ xmlRelaxNGCleanupTypes(void)
* *
************************************************************************/
/* from automata.c but not exported */
void xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
static int xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGDefinePtr def);
@ -3032,6 +3042,17 @@ xmlRelaxNGCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def)
ctxt->am = xmlNewAutomata();
if (ctxt->am == NULL)
return (-1);
/*
* assume identical strings but not same pointer are different
* atoms, needed for non-determinism detection
* That way if 2 elements with the same name are in a choice
* branch the automata is found non-deterministic and
* we fallback to the normal validation which does the right
* thing of exploring both choices.
*/
xmlAutomataSetFlags(ctxt->am, 1);
ctxt->state = xmlAutomataGetInitState(ctxt->am);
while (list != NULL) {
xmlRelaxNGCompile(ctxt, list);
@ -3063,6 +3084,7 @@ xmlRelaxNGCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def)
ctxt->am = xmlNewAutomata();
if (ctxt->am == NULL)
return (-1);
xmlAutomataSetFlags(ctxt->am, 1);
ctxt->state = xmlAutomataGetInitState(ctxt->am);
while (list != NULL) {
xmlRelaxNGCompile(ctxt, list);
@ -3071,6 +3093,11 @@ xmlRelaxNGCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def)
xmlAutomataSetFinalState(ctxt->am, ctxt->state);
def->contModel = xmlAutomataCompile(ctxt->am);
if (!xmlRegexpIsDeterminist(def->contModel)) {
#ifdef DEBUG_COMPILE
xmlGenericError(xmlGenericErrorContext,
"Content model not determinist %s\n",
def->name);
#endif
/*
* we can only use the automata if it is determinist
*/
@ -3098,7 +3125,11 @@ xmlRelaxNGCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def)
case XML_RELAXNG_OPTIONAL:{
xmlAutomataStatePtr oldstate = ctxt->state;
xmlRelaxNGCompile(ctxt, def->content);
list = def->content;
while (list != NULL) {
xmlRelaxNGCompile(ctxt, list);
list = list->next;
}
xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
break;
}
@ -3440,6 +3471,9 @@ xmlRelaxNGGetDataTypeLibrary(xmlRelaxNGParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
{
xmlChar *ret, *escape;
if (node == NULL)
return(NULL);
if ((IS_RELAXNG(node, "data")) || (IS_RELAXNG(node, "value"))) {
ret = xmlGetProp(node, BAD_CAST "datatypeLibrary");
if (ret != NULL) {
@ -4615,6 +4649,72 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
return (ret);
}
/**
* xmlRelaxNGParseImportRef:
* @payload: the parser context
* @data: the current grammar
* @name: the reference name
*
* Import import one references into the current grammar
*/
static void
xmlRelaxNGParseImportRef(void *payload, void *data, xmlChar *name) {
xmlRelaxNGParserCtxtPtr ctxt = (xmlRelaxNGParserCtxtPtr) data;
xmlRelaxNGDefinePtr def = (xmlRelaxNGDefinePtr) payload;
int tmp;
def->dflags |= IS_EXTERNAL_REF;
tmp = xmlHashAddEntry(ctxt->grammar->refs, name, def);
if (tmp < 0) {
xmlRelaxNGDefinePtr prev;
prev = (xmlRelaxNGDefinePtr)
xmlHashLookup(ctxt->grammar->refs, def->name);
if (prev == NULL) {
if (def->name != NULL) {
xmlRngPErr(ctxt, NULL, XML_RNGP_REF_CREATE_FAILED,
"Error refs definitions '%s'\n",
def->name, NULL);
} else {
xmlRngPErr(ctxt, NULL, XML_RNGP_REF_CREATE_FAILED,
"Error refs definitions\n",
NULL, NULL);
}
} else {
def->nextHash = prev->nextHash;
prev->nextHash = def;
}
}
}
/**
* xmlRelaxNGParseImportRefs:
* @ctxt: the parser context
* @grammar: the sub grammar
*
* Import references from the subgrammar into the current grammar
*
* Returns 0 in case of success, -1 in case of failure
*/
static int
xmlRelaxNGParseImportRefs(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGGrammarPtr grammar) {
if ((ctxt == NULL) || (grammar == NULL) || (ctxt->grammar == NULL))
return(-1);
if (grammar->refs == NULL)
return(0);
if (ctxt->grammar->refs == NULL)
ctxt->grammar->refs = xmlHashCreate(10);
if (ctxt->grammar->refs == NULL) {
xmlRngPErr(ctxt, NULL, XML_RNGP_REF_CREATE_FAILED,
"Could not create references hash\n", NULL, NULL);
return(-1);
}
xmlHashScan(grammar->refs, xmlRelaxNGParseImportRef, ctxt);
return(0);
}
/**
* xmlRelaxNGProcessExternalRef:
* @ctxt: the parser context
@ -4683,6 +4783,8 @@ xmlRelaxNGProcessExternalRef(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
if ((docu->schema != NULL) &&
(docu->schema->topgrammar != NULL)) {
docu->content = docu->schema->topgrammar->start;
if (docu->schema->topgrammar->refs)
xmlRelaxNGParseImportRefs(ctxt, docu->schema->topgrammar);
}
/*
@ -5267,7 +5369,7 @@ xmlRelaxNGParseNameClass(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node,
} else {
xmlRngPErr(ctxt, node, XML_RNGP_CHOICE_CONTENT,
"expecting name, anyName, nsName or choice : got %s\n",
node->name, NULL);
(node == NULL ? "nothing" : node->name), NULL);
return (NULL);
}
if (ret != def) {
@ -5569,6 +5671,12 @@ xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref,
xmlRelaxNGGrammarPtr grammar;
xmlRelaxNGDefinePtr def, cur;
/*
* Those rules don't apply to imported ref from xmlRelaxNGParseImportRef
*/
if (ref->dflags & IS_EXTERNAL_REF)
return;
grammar = ctxt->grammar;
if (grammar == NULL) {
xmlRngPErr(ctxt, ref->node, XML_ERR_INTERNAL_ERROR,
@ -6133,7 +6241,7 @@ xmlRelaxNGCheckRules(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGDefinePtr cur, int flags,
xmlRelaxNGType ptype)
{
int nflags = flags;
int nflags;
xmlRelaxNGContentType ret, tmp, val = XML_RELAXNG_CONTENT_EMPTY;
while (cur != NULL) {
@ -6157,6 +6265,16 @@ xmlRelaxNGCheckRules(xmlRelaxNGParserCtxtPtr ctxt,
"Found forbidden pattern data/except//ref\n",
NULL, NULL);
}
if (cur->content == NULL) {
if (cur->type == XML_RELAXNG_PARENTREF)
xmlRngPErr(ctxt, cur->node, XML_RNGP_REF_NO_DEF,
"Internal found no define for parent refs\n",
NULL, NULL);
else
xmlRngPErr(ctxt, cur->node, XML_RNGP_REF_NO_DEF,
"Internal found no define for ref %s\n",
(cur->name ? cur->name: BAD_CAST "null"), NULL);
}
if (cur->depth > -4) {
cur->depth = -4;
ret = xmlRelaxNGCheckRules(ctxt, cur->content,
@ -6408,6 +6526,10 @@ xmlRelaxNGCheckRules(xmlRelaxNGParserCtxtPtr ctxt,
if (ptype == XML_RELAXNG_GROUP) {
val = xmlRelaxNGGroupContentType(val, ret);
} else if (ptype == XML_RELAXNG_INTERLEAVE) {
/*
* TODO: scan complain that tmp is never used, seems on purpose
* need double-checking
*/
tmp = xmlRelaxNGGroupContentType(val, ret);
if (tmp != XML_RELAXNG_CONTENT_ERROR)
tmp = xmlRelaxNGMaxContentType(val, ret);
@ -6495,6 +6617,7 @@ xmlRelaxNGParseGrammar(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes)
ctxt);
}
/* @@@@ */
ctxt->grammar = old;
@ -8345,7 +8468,7 @@ xmlRelaxNGValidateFullElement(xmlRelaxNGValidCtxtPtr ctxt,
ret = -1;
else
ret = 1;
xmlRelaxNGFreeValidState(ctxt, state);
xmlRelaxNGFreeValidState(ctxt, ctxt->state);
ctxt->state = NULL;
#ifdef DEBUG_PROGRESSIVE
if (ret < 0)
@ -8815,8 +8938,11 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt,
case XML_RELAXNG_REF:
case XML_RELAXNG_PARENTREF:
if (define->content == NULL) {
}
VALID_ERR(XML_RELAXNG_ERR_NODEFINE);
ret = -1;
} else {
ret = xmlRelaxNGValidateValue(ctxt, define->content);
}
break;
default:
TODO ret = -1;
@ -9323,6 +9449,7 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
oldstate =
ctxt->states->tabState[ctxt->states->nbState - 1];
ctxt->states->tabState[ctxt->states->nbState - 1] = NULL;
ctxt->states->nbState--;
}
}
for (j = 0; j < ctxt->states->nbState ; j++) {
@ -9331,7 +9458,11 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGFreeStates(ctxt, ctxt->states);
ctxt->states = NULL;
if (found == 0) {
if (cur == NULL) {
VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, "noname");
} else {
VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, cur->name);
}
ret = -1;
ctxt->state = oldstate;
goto done;
@ -9878,8 +10009,8 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
}
for (i = 0; i < ctxt->states->nbState; i++) {
xmlRelaxNGFreeValidState(ctxt,
ctxt->states->
tabState[i]);
ctxt->states->tabState[i]);
ctxt->states->tabState[i] = NULL;
}
xmlRelaxNGFreeStates(ctxt, ctxt->states);
ctxt->flags = oldflags;
@ -10002,10 +10133,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
for (j = 0; j < ctxt->states->nbState; j++) {
xmlRelaxNGAddStates(ctxt, res,
xmlRelaxNGCopyValidState(ctxt,
ctxt->
states->
tabState
[j]));
ctxt->states->tabState[j]));
}
}
oldflags = ctxt->flags;
@ -10034,10 +10162,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
j++) {
tmp =
xmlRelaxNGAddStates(ctxt, res,
ctxt->
states->
tabState
[j]);
ctxt->states->tabState[j]);
if (tmp == 1)
progress = 1;
}
@ -10071,9 +10196,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
} else if (ctxt->states != NULL) {
for (j = 0; j < ctxt->states->nbState; j++) {
tmp = xmlRelaxNGAddStates(ctxt, res,
ctxt->
states->
tabState[j]);
ctxt->states->tabState[j]);
if (tmp == 1)
progress = 1;
}
@ -10111,8 +10234,7 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
for (i = base; i < res->nbState; i++)
xmlRelaxNGAddStates(ctxt, states,
xmlRelaxNGCopyValidState
(ctxt,
res->tabState[i]));
(ctxt, res->tabState[i]));
ctxt->states = states;
}
}
@ -10634,6 +10756,60 @@ xmlRelaxNGValidateDocument(xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc)
return (ret);
}
/**
* xmlRelaxNGCleanPSVI:
* @node: an input element or document
*
* Call this routine to speed up XPath computation on static documents.
* This stamps all the element nodes with the document order
* Like for line information, the order is kept in the element->content
* field, the value stored is actually - the node number (starting at -1)
* to be able to differentiate from line numbers.
*
* Returns the number of elements found in the document or -1 in case
* of error.
*/
static void
xmlRelaxNGCleanPSVI(xmlNodePtr node) {
xmlNodePtr cur;
if ((node == NULL) ||
((node->type != XML_ELEMENT_NODE) &&
(node->type != XML_DOCUMENT_NODE) &&
(node->type != XML_HTML_DOCUMENT_NODE)))
return;
if (node->type == XML_ELEMENT_NODE)
node->psvi = NULL;
cur = node->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
cur->psvi = NULL;
if (cur->children != NULL) {
cur = cur->children;
continue;
}
}
if (cur->next != NULL) {
cur = cur->next;
continue;
}
do {
cur = cur->parent;
if (cur == NULL)
break;
if (cur == node) {
cur = NULL;
break;
}
if (cur->next != NULL) {
cur = cur->next;
break;
}
} while (cur != NULL);
}
return;
}
/************************************************************************
* *
* Validation interfaces *
@ -10807,6 +10983,11 @@ xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc)
ctxt->doc = doc;
ret = xmlRelaxNGValidateDocument(ctxt, doc);
/*
* Remove all left PSVI
*/
xmlRelaxNGCleanPSVI((xmlNodePtr) doc);
/*
* TODO: build error codes
*/

View file

@ -1704,9 +1704,11 @@ saxParseTest(const char *filename, const char *result,
if (compareFiles(temp, result)) {
fprintf(stderr, "Got a difference for %s\n", filename);
ret = 1;
} else
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
/* switch back to structured error handling */
xmlSetGenericErrorFunc(NULL, NULL);
@ -1779,8 +1781,10 @@ oldParseTest(const char *filename, const char *result,
}
xmlFreeDoc(doc);
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(res);
}
@ -1980,8 +1984,10 @@ noentParseTest(const char *filename, const char *result,
}
xmlFreeDoc(doc);
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(res);
}
@ -2120,8 +2126,10 @@ streamProcessTest(const char *filename, const char *result, const char *err,
testErrorHandler(NULL, "Relax-NG schema %s failed to compile\n",
rng);
fclose(t);
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(0);
}
}
@ -2147,8 +2155,10 @@ streamProcessTest(const char *filename, const char *result, const char *err,
if (t != NULL) {
fclose(t);
ret = compareFiles(temp, result);
if (temp != NULL) {
unlink(temp);
free(temp);
}
if (ret) {
fprintf(stderr, "Result for %s failed\n", filename);
return(-1);
@ -2357,8 +2367,10 @@ xpathCommonTest(const char *filename, const char *result,
}
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(ret);
}
@ -2527,8 +2539,10 @@ xmlidDocTest(const char *filename,
}
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
xmlFreeDoc(xpathDocument);
if (err != NULL) {
@ -2614,8 +2628,10 @@ uriCommonTest(const char *filename,
if (f == NULL) {
fprintf(stderr, "failed to open input file %s\n", filename);
fclose(o);
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(-1);
}
@ -2658,8 +2674,10 @@ uriCommonTest(const char *filename,
}
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(res);
}
@ -2933,8 +2951,10 @@ schemasOneTest(const char *sch,
ret = 1;
}
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
if ((validResult != 0) && (err != NULL)) {
if (compareFileMem(err, testErrors, testErrorsSize)) {
@ -3100,14 +3120,17 @@ rngOneTest(const char *sch,
filename);
}
fclose(schemasOutput);
ret = 0;
if (result) {
if (compareFiles(temp, result)) {
fprintf(stderr, "Result for %s on %s failed\n", filename, sch);
ret = 1;
}
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
if (err != NULL) {
if (compareFileMem(err, testErrors, testErrorsSize)) {
@ -3207,7 +3230,7 @@ rngTest(const char *filename,
globfree(&globbuf);
xmlRelaxNGFree(schemas);
return(res);
return(ret);
}
#ifdef LIBXML_READER_ENABLED
@ -3257,7 +3280,8 @@ rngStreamTest(const char *filename,
* hack is also done in the Makefile
*/
if ((!strcmp(prefix, "tutor10_1")) || (!strcmp(prefix, "tutor10_2")) ||
(!strcmp(prefix, "tutor3_2")) || (!strcmp(prefix, "307377")))
(!strcmp(prefix, "tutor3_2")) || (!strcmp(prefix, "307377")) ||
(!strcmp(prefix, "tutor8_2")))
disable_err = 1;
snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix);
@ -3463,7 +3487,7 @@ patternTest(const char *filename,
namespaces[j++] = ns->prefix;
}
namespaces[j++] = NULL;
namespaces[j++] = NULL;
namespaces[j] = NULL;
patternc = xmlPatterncompile((const xmlChar *) str, doc->dict,
0, &namespaces[0]);
@ -3511,8 +3535,10 @@ patternTest(const char *filename,
fprintf(stderr, "Result for %s failed\n", filename);
ret = 1;
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
return(ret);
}
#endif /* READER */
@ -3642,7 +3668,6 @@ parse_list(xmlChar *str) {
if((str[0] == '\'') && (str[len - 1] == '\'')) {
str[len - 1] = '\0';
str++;
len -= 2;
}
/*
* allocate an translation buffer.
@ -3671,7 +3696,7 @@ parse_list(xmlChar *str) {
}
static int
c14nRunTest(const char* xml_filename, int with_comments, int exclusive,
c14nRunTest(const char* xml_filename, int with_comments, int mode,
const char* xpath_filename, const char *ns_filename,
const char* result_file) {
xmlDocPtr doc;
@ -3733,12 +3758,13 @@ c14nRunTest(const char* xml_filename, int with_comments, int exclusive,
/* fprintf(stderr,"File \"%s\" loaded: start canonization\n", xml_filename); */
ret = xmlC14NDocDumpMemory(doc,
(xpath) ? xpath->nodesetval : NULL,
exclusive, inclusive_namespaces,
mode, inclusive_namespaces,
with_comments, &result);
if (ret >= 0) {
if(result != NULL) {
if (compareFileMem(result_file, (const char *) result, ret)) {
fprintf(stderr, "Result mismatch for %s\n", xml_filename);
fprintf(stderr, "RESULT:\n%s\n", (const char*)result);
ret = -1;
}
}
@ -3760,7 +3786,7 @@ c14nRunTest(const char* xml_filename, int with_comments, int exclusive,
}
static int
c14nCommonTest(const char *filename, int with_comments, int exclusive,
c14nCommonTest(const char *filename, int with_comments, int mode,
const char *subdir) {
char buf[500];
char prefix[500];
@ -3793,7 +3819,7 @@ c14nCommonTest(const char *filename, int with_comments, int exclusive,
}
nb_tests++;
if (c14nRunTest(filename, with_comments, exclusive,
if (c14nRunTest(filename, with_comments, mode,
xpath, ns, result) < 0)
ret = 1;
@ -3808,21 +3834,28 @@ c14nWithCommentTest(const char *filename,
const char *resul ATTRIBUTE_UNUSED,
const char *err ATTRIBUTE_UNUSED,
int options ATTRIBUTE_UNUSED) {
return(c14nCommonTest(filename, 1, 0, "with-comments"));
return(c14nCommonTest(filename, 1, XML_C14N_1_0, "with-comments"));
}
static int
c14nWithoutCommentTest(const char *filename,
const char *resul ATTRIBUTE_UNUSED,
const char *err ATTRIBUTE_UNUSED,
int options ATTRIBUTE_UNUSED) {
return(c14nCommonTest(filename, 0, 0, "without-comments"));
return(c14nCommonTest(filename, 0, XML_C14N_1_0, "without-comments"));
}
static int
c14nExcWithoutCommentTest(const char *filename,
const char *resul ATTRIBUTE_UNUSED,
const char *err ATTRIBUTE_UNUSED,
int options ATTRIBUTE_UNUSED) {
return(c14nCommonTest(filename, 0, 1, "exc-without-comments"));
return(c14nCommonTest(filename, 0, XML_C14N_EXCLUSIVE_1_0, "exc-without-comments"));
}
static int
c14n11WithoutCommentTest(const char *filename,
const char *resul ATTRIBUTE_UNUSED,
const char *err ATTRIBUTE_UNUSED,
int options ATTRIBUTE_UNUSED) {
return(c14nCommonTest(filename, 0, XML_C14N_1_1, "1-1-without-comments"));
}
#endif
#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined (LIBXML_SAX1_ENABLED)
@ -3903,7 +3936,7 @@ thread_specific_data(void *private_data)
return ((void *) Okay);
}
#if defined(linux) || defined(solaris) || defined(__APPLE_CC__)
#if defined(linux) || defined(__sun) || defined(__APPLE_CC__)
#include <pthread.h>
@ -4257,6 +4290,9 @@ testDesc testDescriptions[] = {
{ "C14N exclusive without comments regression tests" ,
c14nExcWithoutCommentTest, "./test/c14n/exc-without-comments/*.xml", NULL, NULL, NULL,
0 },
{ "C14N 1.1 without comments regression tests" ,
c14n11WithoutCommentTest, "./test/c14n/1-1-without-comments/*.xml", NULL, NULL, NULL,
0 },
#endif
#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_SAX1_ENABLED)
{ "Catalog and Threads regression tests" ,

View file

@ -1425,7 +1425,7 @@ xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt,
(pattern == NULL)?NULL:((const char *) pattern->name),
(const char *) path,
(const char *) report, 0, 0,
msg);
"%s", msg);
} else {
xmlSchematronReportOutput(ctxt, cur, &msg[0]);
}

View file

@ -32,13 +32,17 @@ static void usage(const char *name) {
name);
fprintf(stderr, "where <mode> is one of following:\n");
fprintf(stderr,
"--with-comments \t XML file canonization w comments\n");
"--with-comments \t XML file canonicalization v1.0 w comments \n");
fprintf(stderr,
"--without-comments \t XML file canonization w/o comments\n");
"--without-comments \t XML file canonicalization v1.0 w/o comments\n");
fprintf(stderr,
"--exc-with-comments \t Exclusive XML file canonization w comments\n");
"--1-1-with-comments \t XML file canonicalization v1.1 w comments\n");
fprintf(stderr,
"--exc-without-comments\t Exclusive XML file canonization w/o comments\n");
"--1-1-without-comments \t XML file canonicalization v1.1 w/o comments\n");
fprintf(stderr,
"--exc-with-comments \t Exclusive XML file canonicalization v1.0 w comments\n");
fprintf(stderr,
"--exc-without-comments\t Exclusive XML file canonicalization v1.0 w/o comments\n");
}
static xmlXPathObjectPtr
@ -49,7 +53,7 @@ static xmlChar **parse_list(xmlChar *str);
/* static void print_xpath_nodes(xmlNodeSetPtr nodes); */
static int
test_c14n(const char* xml_filename, int with_comments, int exclusive,
test_c14n(const char* xml_filename, int with_comments, int mode,
const char* xpath_filename, xmlChar **inclusive_namespaces) {
xmlDocPtr doc;
xmlXPathObjectPtr xpath = NULL;
@ -96,7 +100,7 @@ test_c14n(const char* xml_filename, int with_comments, int exclusive,
/* fprintf(stderr,"File \"%s\" loaded: start canonization\n", xml_filename); */
ret = xmlC14NDocDumpMemory(doc,
(xpath) ? xpath->nodesetval : NULL,
exclusive, inclusive_namespaces,
mode, inclusive_namespaces,
with_comments, &result);
if(ret >= 0) {
if(result != NULL) {
@ -135,22 +139,26 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error: wrong number of arguments.\n");
usage(argv[0]);
} else if(strcmp(argv[1], "--with-comments") == 0) {
ret = test_c14n(argv[2], 1, 0, (argc > 3) ? argv[3] : NULL, NULL);
ret = test_c14n(argv[2], 1, XML_C14N_1_0, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--without-comments") == 0) {
ret = test_c14n(argv[2], 0, 0, (argc > 3) ? argv[3] : NULL, NULL);
ret = test_c14n(argv[2], 0, XML_C14N_1_0, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--1-1-with-comments") == 0) {
ret = test_c14n(argv[2], 1, XML_C14N_1_1, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--1-1-without-comments") == 0) {
ret = test_c14n(argv[2], 0, XML_C14N_1_1, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--exc-with-comments") == 0) {
xmlChar **list;
/* load exclusive namespace from command line */
list = (argc > 4) ? parse_list((xmlChar *)argv[4]) : NULL;
ret = test_c14n(argv[2], 1, 1, (argc > 3) ? argv[3] : NULL, list);
ret = test_c14n(argv[2], 1, XML_C14N_EXCLUSIVE_1_0, (argc > 3) ? argv[3] : NULL, list);
if(list != NULL) xmlFree(list);
} else if(strcmp(argv[1], "--exc-without-comments") == 0) {
xmlChar **list;
/* load exclusive namespace from command line */
list = (argc > 4) ? parse_list((xmlChar *)argv[4]) : NULL;
ret = test_c14n(argv[2], 0, 1, (argc > 3) ? argv[3] : NULL, list);
ret = test_c14n(argv[2], 0, XML_C14N_EXCLUSIVE_1_0, (argc > 3) ? argv[3] : NULL, list);
if(list != NULL) xmlFree(list);
} else {
fprintf(stderr, "Error: bad option.\n");
@ -194,7 +202,6 @@ parse_list(xmlChar *str) {
if((str[0] == '\'') && (str[len - 1] == '\'')) {
str[len - 1] = '\0';
str++;
len -= 2;
}
/*
* allocate an translation buffer.

View file

@ -991,6 +991,13 @@ static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeIn
static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
}
#define gen_nb_void_ptr_ptr 1
static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
/************************************************************************
* *
* WARNING: end of the manually maintained part of the test code *
@ -5345,8 +5352,8 @@ test_xmlC14NDocDumpMemory(void) {
int n_doc;
xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
int n_nodes;
int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
int n_exclusive;
int mode; /* the c14n mode (see @xmlC14NMode) */
int n_mode;
xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
int n_inclusive_ns_prefixes;
int with_comments; /* include comments in the result (!=0) or not (==0) */
@ -5356,24 +5363,24 @@ test_xmlC14NDocDumpMemory(void) {
for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
mem_base = xmlMemBlocks();
doc = gen_xmlDocPtr(n_doc, 0);
nodes = gen_xmlNodeSetPtr(n_nodes, 1);
exclusive = gen_int(n_exclusive, 2);
mode = gen_int(n_mode, 2);
inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
with_comments = gen_int(n_with_comments, 4);
doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
ret_val = xmlC14NDocDumpMemory(doc, nodes, mode, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
desret_int(ret_val);
call_tests++;
des_xmlDocPtr(n_doc, doc, 0);
des_xmlNodeSetPtr(n_nodes, nodes, 1);
des_int(n_exclusive, exclusive, 2);
des_int(n_mode, mode, 2);
des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
des_int(n_with_comments, with_comments, 4);
des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
@ -5384,7 +5391,7 @@ test_xmlC14NDocDumpMemory(void) {
test_ret++;
printf(" %d", n_doc);
printf(" %d", n_nodes);
printf(" %d", n_exclusive);
printf(" %d", n_mode);
printf(" %d", n_inclusive_ns_prefixes);
printf(" %d", n_with_comments);
printf(" %d", n_doc_txt_ptr);
@ -5414,8 +5421,8 @@ test_xmlC14NDocSave(void) {
int n_doc;
xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
int n_nodes;
int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
int n_exclusive;
int mode; /* the c14n mode (see @xmlC14NMode) */
int n_mode;
xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
int n_inclusive_ns_prefixes;
int with_comments; /* include comments in the result (!=0) or not (==0) */
@ -5427,7 +5434,7 @@ test_xmlC14NDocSave(void) {
for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
@ -5435,18 +5442,18 @@ test_xmlC14NDocSave(void) {
mem_base = xmlMemBlocks();
doc = gen_xmlDocPtr(n_doc, 0);
nodes = gen_xmlNodeSetPtr(n_nodes, 1);
exclusive = gen_int(n_exclusive, 2);
mode = gen_int(n_mode, 2);
inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
with_comments = gen_int(n_with_comments, 4);
filename = gen_fileoutput(n_filename, 5);
compression = gen_int(n_compression, 6);
ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
ret_val = xmlC14NDocSave(doc, nodes, mode, inclusive_ns_prefixes, with_comments, filename, compression);
desret_int(ret_val);
call_tests++;
des_xmlDocPtr(n_doc, doc, 0);
des_xmlNodeSetPtr(n_nodes, nodes, 1);
des_int(n_exclusive, exclusive, 2);
des_int(n_mode, mode, 2);
des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
des_int(n_with_comments, with_comments, 4);
des_fileoutput(n_filename, filename, 5);
@ -5458,7 +5465,7 @@ test_xmlC14NDocSave(void) {
test_ret++;
printf(" %d", n_doc);
printf(" %d", n_nodes);
printf(" %d", n_exclusive);
printf(" %d", n_mode);
printf(" %d", n_inclusive_ns_prefixes);
printf(" %d", n_with_comments);
printf(" %d", n_filename);
@ -5490,8 +5497,8 @@ test_xmlC14NDocSaveTo(void) {
int n_doc;
xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
int n_nodes;
int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
int n_exclusive;
int mode; /* the c14n mode (see @xmlC14NMode) */
int n_mode;
xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
int n_inclusive_ns_prefixes;
int with_comments; /* include comments in the result (!=0) or not (==0) */
@ -5501,24 +5508,24 @@ test_xmlC14NDocSaveTo(void) {
for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
mem_base = xmlMemBlocks();
doc = gen_xmlDocPtr(n_doc, 0);
nodes = gen_xmlNodeSetPtr(n_nodes, 1);
exclusive = gen_int(n_exclusive, 2);
mode = gen_int(n_mode, 2);
inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
with_comments = gen_int(n_with_comments, 4);
buf = gen_xmlOutputBufferPtr(n_buf, 5);
ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
ret_val = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf);
desret_int(ret_val);
call_tests++;
des_xmlDocPtr(n_doc, doc, 0);
des_xmlNodeSetPtr(n_nodes, nodes, 1);
des_int(n_exclusive, exclusive, 2);
des_int(n_mode, mode, 2);
des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
des_int(n_with_comments, with_comments, 4);
des_xmlOutputBufferPtr(n_buf, buf, 5);
@ -5529,7 +5536,7 @@ test_xmlC14NDocSaveTo(void) {
test_ret++;
printf(" %d", n_doc);
printf(" %d", n_nodes);
printf(" %d", n_exclusive);
printf(" %d", n_mode);
printf(" %d", n_inclusive_ns_prefixes);
printf(" %d", n_with_comments);
printf(" %d", n_buf);
@ -14618,14 +14625,14 @@ test_xmlRecoverDoc(void) {
xmlChar * cur; /* a pointer to an array of xmlChar */
int n_cur;
for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
mem_base = xmlMemBlocks();
cur = gen_xmlChar_ptr(n_cur, 0);
cur = gen_const_xmlChar_ptr(n_cur, 0);
ret_val = xmlRecoverDoc(cur);
ret_val = xmlRecoverDoc((const xmlChar *)cur);
desret_xmlDocPtr(ret_val);
call_tests++;
des_xmlChar_ptr(n_cur, cur, 0);
des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlRecoverDoc",
@ -17371,16 +17378,6 @@ static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRe
}
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_void_ptr_ptr 1
static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif
static int
test_xmlRelaxNGGetParserErrors(void) {
@ -27385,6 +27382,54 @@ test_xmlXIncludeProcessTreeFlags(void) {
}
static int
test_xmlXIncludeProcessTreeFlagsData(void) {
int test_ret = 0;
#if defined(LIBXML_XINCLUDE_ENABLED)
int mem_base;
int ret_val;
xmlNodePtr tree; /* an XML node */
int n_tree;
int flags; /* a set of xmlParserOption used for parsing XML includes */
int n_flags;
void * data; /* application data that will be passed to the parser context in the _private field of the parser context(s) */
int n_data;
for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
mem_base = xmlMemBlocks();
tree = gen_xmlNodePtr(n_tree, 0);
flags = gen_int(n_flags, 1);
data = gen_userdata(n_data, 2);
ret_val = xmlXIncludeProcessTreeFlagsData(tree, flags, data);
desret_int(ret_val);
call_tests++;
des_xmlNodePtr(n_tree, tree, 0);
des_int(n_flags, flags, 1);
des_userdata(n_data, data, 2);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlagsData",
xmlMemBlocks() - mem_base);
test_ret++;
printf(" %d", n_tree);
printf(" %d", n_flags);
printf(" %d", n_data);
printf("\n");
}
}
}
}
function_tests++;
#endif
return(test_ret);
}
static int
test_xmlXIncludeSetFlags(void) {
int test_ret = 0;
@ -27429,7 +27474,7 @@ static int
test_xinclude(void) {
int test_ret = 0;
if (quiet == 0) printf("Testing xinclude : 7 of 9 functions ...\n");
if (quiet == 0) printf("Testing xinclude : 8 of 10 functions ...\n");
test_ret += test_xmlXIncludeNewContext();
test_ret += test_xmlXIncludeProcess();
test_ret += test_xmlXIncludeProcessFlags();
@ -27437,6 +27482,7 @@ test_xinclude(void) {
test_ret += test_xmlXIncludeProcessNode();
test_ret += test_xmlXIncludeProcessTree();
test_ret += test_xmlXIncludeProcessTreeFlags();
test_ret += test_xmlXIncludeProcessTreeFlagsData();
test_ret += test_xmlXIncludeSetFlags();
if (test_ret != 0)
@ -36166,16 +36212,16 @@ test_xmlStrcasestr(void) {
int n_val;
for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
mem_base = xmlMemBlocks();
str = gen_const_xmlChar_ptr(n_str, 0);
val = gen_xmlChar_ptr(n_val, 1);
val = gen_const_xmlChar_ptr(n_val, 1);
ret_val = xmlStrcasestr((const xmlChar *)str, val);
ret_val = xmlStrcasestr((const xmlChar *)str, (const xmlChar *)val);
desret_const_xmlChar_ptr(ret_val);
call_tests++;
des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
des_xmlChar_ptr(n_val, val, 1);
des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlStrcasestr",
@ -49648,7 +49694,7 @@ test_xmlXPathRegisterNs(void) {
int ret_val;
xmlXPathContextPtr ctxt; /* the XPath context */
int n_ctxt;
xmlChar * prefix; /* the namespace prefix */
xmlChar * prefix; /* the namespace prefix cannot be NULL or empty string */
int n_prefix;
xmlChar * ns_uri; /* the namespace name */
int n_ns_uri;

View file

@ -26,9 +26,7 @@
#endif
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
#ifdef HAVE_WIN32_THREADS
#elif defined HAVE_WIN32_THREADS
#include <windows.h>
#ifndef HAVE_COMPILER_TLS
#include <process.h>
@ -412,7 +410,7 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
if (tok->held == 0) {
if (tok->waiters)
pthread_cond_signal(&tok->cv);
tok->tid = 0;
memset(&tok->tid, 0, sizeof(tok->tid));
}
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
@ -457,7 +455,7 @@ __xmlGlobalInitMutexLock(void)
/* Swap it into the global_init_lock */
#ifdef InterlockedCompareExchangePointer
(void)InterlockedCompareExchangePointer(&global_init_lock, cs, NULL);
InterlockedCompareExchangePointer(&global_init_lock, cs, NULL);
#else /* Use older void* version */
InterlockedCompareExchange((void **) &global_init_lock,
(void *) cs, NULL);
@ -529,7 +527,8 @@ __xmlGlobalInitMutexUnlock(void)
void
__xmlGlobalInitMutexDestroy(void)
{
#if defined HAVE_WIN32_THREADS
#ifdef HAVE_PTHREAD_H
#elif defined HAVE_WIN32_THREADS
if (global_init_lock != NULL) {
DeleteCriticalSection(global_init_lock);
free(global_init_lock);
@ -593,8 +592,8 @@ xmlNewGlobalState(void)
}
#endif /* LIBXML_THREAD_ENABLED */
#ifdef HAVE_WIN32_THREADS
#ifdef HAVE_PTHREAD_H
#elif defined HAVE_WIN32_THREADS
#if !defined(HAVE_COMPILER_TLS)
#if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
typedef struct _xmlGlobalStateCleanupHelperParams {
@ -758,6 +757,8 @@ xmlGetGlobalState(void)
* xmlGetThreadId:
*
* xmlGetThreadId() find the current thread ID number
* Note that this is likely to be broken on some platforms using pthreads
* as the specification doesn't mandate pthread_t to be an integer type
*
* Returns the current thread ID number
*/
@ -765,9 +766,15 @@ int
xmlGetThreadId(void)
{
#ifdef HAVE_PTHREAD_H
pthread_t id;
int ret;
if (libxml_is_threaded == 0)
return (0);
return ((int) pthread_self());
id = pthread_self();
/* horrible but preserves compat, see warning above */
memcpy(&ret, &id, sizeof(ret));
return (ret);
#elif defined HAVE_WIN32_THREADS
return GetCurrentThreadId();
#elif defined HAVE_BEOS_THREADS
@ -803,7 +810,7 @@ xmlIsMainThread(void)
xmlGenericError(xmlGenericErrorContext, "xmlIsMainThread()\n");
#endif
#ifdef HAVE_PTHREAD_H
return (mainthread == pthread_self());
return (pthread_equal(mainthread,pthread_self()));
#elif defined HAVE_WIN32_THREADS
return (mainthread == GetCurrentThreadId());
#elif defined HAVE_BEOS_THREADS
@ -852,12 +859,6 @@ xmlUnlockLibrary(void)
void
xmlInitThreads(void)
{
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext, "xmlInitThreads()\n");
#endif
#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
InitializeCriticalSection(&cleanup_helpers_cs);
#endif
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded == -1) {
if ((pthread_once != NULL) &&
@ -884,6 +885,8 @@ xmlInitThreads(void)
libxml_is_threaded = 0;
}
}
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
InitializeCriticalSection(&cleanup_helpers_cs);
#endif
}
@ -892,6 +895,14 @@ xmlInitThreads(void)
*
* xmlCleanupThreads() is used to to cleanup all the thread related
* data of the libxml2 library once processing has ended.
*
* WARNING: if your application is multithreaded or has plugin support
* calling this may crash the application if another thread or
* a plugin is still using libxml2. It's sometimes very hard to
* guess if libxml2 is in use in the application, some libraries
* or plugins may use it without notice. In case of doubt abstain
* from calling this function or do it just before calling exit()
* to avoid leak reports from valgrind !
*/
void
xmlCleanupThreads(void)
@ -899,7 +910,10 @@ xmlCleanupThreads(void)
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n");
#endif
#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#ifdef HAVE_PTHREAD_H
if ((libxml_is_threaded) && (pthread_key_delete != NULL))
pthread_key_delete(globalkey);
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
if (globalkey != TLS_OUT_OF_INDEXES) {
xmlGlobalStateCleanupHelperParams *p;
@ -918,9 +932,6 @@ xmlCleanupThreads(void)
globalkey = TLS_OUT_OF_INDEXES;
}
DeleteCriticalSection(&cleanup_helpers_cs);
#elif defined HAVE_PTHREAD_H
if ((libxml_is_threaded) && (pthread_key_delete != NULL))
pthread_key_delete(globalkey);
#endif
}
@ -941,11 +952,9 @@ xmlOnceInit(void)
#ifdef HAVE_PTHREAD_H
(void) pthread_key_create(&globalkey, xmlFreeGlobalState);
mainthread = pthread_self();
#endif
#if defined(HAVE_WIN32_THREADS)
#elif defined(HAVE_WIN32_THREADS)
if (!run_once.done) {
if (InterlockedIncrement((PLONG)&run_once.control) == 1) {
if (InterlockedIncrement(&run_once.control) == 1) {
#if !defined(HAVE_COMPILER_TLS)
globalkey = TlsAlloc();
#endif
@ -958,9 +967,7 @@ xmlOnceInit(void)
Sleep(0);
}
}
#endif
#ifdef HAVE_BEOS_THREADS
#elif defined HAVE_BEOS_THREADS
if (atomic_add(&run_once_init, 1) == 0) {
globalkey = tls_allocate();
tls_set(globalkey, NULL);
@ -982,7 +989,8 @@ xmlOnceInit(void)
*
* Returns TRUE always
*/
#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#ifdef HAVE_PTHREAD_H
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
BOOL XMLCALL
xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)

View file

@ -49,7 +49,8 @@ int __xmlRegisterCallbacks = 0;
* *
************************************************************************/
xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
static xmlNsPtr
xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
static xmlChar* xmlGetPropNodeValueInternal(xmlAttrPtr prop);
@ -1420,9 +1421,9 @@ xmlStringLenGetNodeList(xmlDocPtr doc, const xmlChar *value, int len) {
node = xmlNewDocTextLen(doc, q, cur - q);
if (node == NULL) return(ret);
if (last == NULL) {
last = ret = node;
ret = node;
} else {
last = xmlAddNextSibling(last, node);
xmlAddNextSibling(last, node);
}
}
}
@ -1589,8 +1590,6 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) {
last = xmlAddNextSibling(last, node);
}
}
charval = 0;
}
} else
cur++;
@ -1800,7 +1799,7 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
cur = (xmlAttrPtr) xmlMalloc(sizeof(xmlAttr));
if (cur == NULL) {
if ((eatname == 1) &&
((node->doc == NULL) ||
((node == NULL) || (node->doc == NULL) ||
(!(xmlDictOwns(node->doc->dict, name)))))
xmlFree((xmlChar *) name);
xmlTreeErrMemory("building attribute");
@ -1860,7 +1859,8 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
}
}
if (xmlIsID((node == NULL) ? NULL : node->doc, node, cur) == 1)
if ((value != NULL) && (node != NULL) &&
(xmlIsID(node->doc, node, cur) == 1))
xmlAddID(NULL, node->doc, value, cur);
if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
@ -3103,6 +3103,14 @@ xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem) {
return(NULL);
}
if (cur == elem) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
"xmlAddSibling : cur == elem\n");
#endif
return(NULL);
}
/*
* Constant time is we can rely on the ->parent->last to find
* the last sibling.
@ -4160,7 +4168,8 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
if (!extended)
goto out;
if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL))
if (((node->type == XML_ELEMENT_NODE) ||
(node->type == XML_XINCLUDE_START)) && (node->nsDef != NULL))
ret->nsDef = xmlCopyNamespaceList(node->nsDef);
if (node->ns != NULL) {
@ -4187,7 +4196,8 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
ret->ns = ns;
}
}
if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL))
if (((node->type == XML_ELEMENT_NODE) ||
(node->type == XML_XINCLUDE_START)) && (node->properties != NULL))
ret->properties = xmlCopyPropList(ret, node->properties);
if (node->type == XML_ENTITY_REF_NODE) {
if ((doc == NULL) || (node->doc != doc)) {
@ -6045,7 +6055,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
* @tree or on one of its ancestors then a new prefix is generated.
* Returns the (new) namespace definition or NULL in case of error
*/
xmlNsPtr
static xmlNsPtr
xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
xmlNsPtr def;
xmlChar prefix[50];
@ -7064,8 +7074,10 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
/*
* Windows has a BIG problem on realloc timing, so we try to double
* the buffer size (if that's enough) (bug 146697)
* Apparently BSD too, and it's probably best for linux too
* On an embedded system this may be something to change
*/
#ifdef WIN32
#if 1
if (buf->size > len)
size = buf->size * 2;
else
@ -7765,9 +7777,12 @@ xmlDOMWrapStoreNs(xmlDocPtr doc,
}
}
/* Create. */
if (ns != NULL) {
ns->next = xmlNewNs(NULL, nsName, prefix);
return (ns->next);
}
return(NULL);
}
/*
* xmlDOMWrapNewCtxt:

View file

@ -1,6 +1,6 @@
/*************************************************************************
*
* $Id: trio.c 3600 2007-04-17 12:44:58Z veillard $
* $Id$
*
* Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
*
@ -733,7 +733,7 @@ typedef struct _trio_userdef_t {
*
*************************************************************************/
static TRIO_CONST char rcsid[] = "@(#)$Id: trio.c 3600 2007-04-17 12:44:58Z veillard $";
static TRIO_CONST char rcsid[] = "@(#)$Id$";
/*
* Need this to workaround a parser bug in HP C/iX compiler that fails

View file

@ -1,6 +1,6 @@
/*************************************************************************
*
* $Id: trio.h 1886 2003-04-03 15:28:28Z veillard $
* $Id$
*
* Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
*
@ -29,7 +29,7 @@
* HAVE_CONFIG_H as a compiler option themselves.
*/
#if defined(HAVE_CONFIG_H)
# include <config.h>
# include "config.h"
#endif
#include "triodef.h"

View file

@ -1,6 +1,6 @@
/*************************************************************************
*
* $Id: triodef.h 3473 2006-05-31 13:35:28Z veillard $
* $Id$
*
* Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
*

View file

@ -1,6 +1,6 @@
/*************************************************************************
*
* $Id: trionan.c 3790 2008-09-01 13:08:57Z veillard $
* $Id$
*
* Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
*
@ -57,9 +57,6 @@
# include <fp_class.h>
# endif
#endif
/* Small ReactOS hack */
#undef fpclassify
#define fpclassify _fpclass
#include <assert.h>
#if defined(TRIO_DOCUMENTATION)
@ -115,7 +112,7 @@
* Constants
*/
static TRIO_CONST char rcsid[] = "@(#)$Id: trionan.c 3790 2008-09-01 13:08:57Z veillard $";
static TRIO_CONST char rcsid[] = "@(#)$Id$";
#if defined(USE_IEEE_754)
@ -214,7 +211,6 @@ TRIO_ARGS2((number, has_mantissa),
return is_special_quantity;
}
#if 0
/*
* trio_is_negative
*/
@ -232,7 +228,6 @@ TRIO_ARGS1((number),
}
return is_negative;
}
#endif
#endif /* USE_IEEE_754 */

View file

@ -1,6 +1,6 @@
/*************************************************************************
*
* $Id: trionan.h 2026 2003-08-06 04:43:55Z wbrack $
* $Id$
*
* Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
*

View file

@ -1,6 +1,6 @@
/*************************************************************************
*
* $Id: triop.h 1886 2003-04-03 15:28:28Z veillard $
* $Id$
*
* Copyright (C) 2000 Bjorn Reese and Daniel Stenberg.
*

View file

@ -1,6 +1,6 @@
/*************************************************************************
*
* $Id: triostr.c 3600 2007-04-17 12:44:58Z veillard $
* $Id$
*
* Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
*
@ -101,7 +101,7 @@ struct _trio_string_t
*/
#if !defined(TRIO_MINIMAL)
static TRIO_CONST char rcsid[] = "@(#)$Id: triostr.c 3600 2007-04-17 12:44:58Z veillard $";
static TRIO_CONST char rcsid[] = "@(#)$Id$";
#endif
/*************************************************************************

View file

@ -1,6 +1,6 @@
/*************************************************************************
*
* $Id: triostr.h 3600 2007-04-17 12:44:58Z veillard $
* $Id$
*
* Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
*

View file

@ -558,10 +558,14 @@ xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
if (*str != cur) {
if (uri->cleanup & 2)
uri->path = STRNDUP(*str, cur - *str);
else
uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
} else {
uri->path = NULL;
}
}
*str = cur;
return (0);
@ -600,10 +604,14 @@ xmlParse3986PathAbsolute(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
if (cur != *str) {
if (uri->cleanup & 2)
uri->path = STRNDUP(*str, cur - *str);
else
uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
} else {
uri->path = NULL;
}
}
*str = cur;
return (0);
@ -638,10 +646,14 @@ xmlParse3986PathRootless(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
if (cur != *str) {
if (uri->cleanup & 2)
uri->path = STRNDUP(*str, cur - *str);
else
uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
} else {
uri->path = NULL;
}
}
*str = cur;
return (0);
@ -676,10 +688,14 @@ xmlParse3986PathNoScheme(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
if (cur != *str) {
if (uri->cleanup & 2)
uri->path = STRNDUP(*str, cur - *str);
else
uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
} else {
uri->path = NULL;
}
}
*str = cur;
return (0);
@ -1373,7 +1389,7 @@ xmlSaveUri(xmlURIPtr uri) {
}
ret = temp;
}
ret[len++] = 0;
ret[len] = 0;
return(ret);
}
@ -2453,6 +2469,7 @@ xmlCanonicPath(const xmlChar *path)
*/
#if defined(_WIN32) && !defined(__CYGWIN__)
int len = 0;
int i = 0;
xmlChar *p = NULL;
#endif
xmlURIPtr uri;
@ -2521,7 +2538,7 @@ path_processing:
len = xmlStrlen(path);
if ((len > 2) && IS_WINDOWS_PATH(path)) {
/* make the scheme 'file' */
uri->scheme = (char*)xmlStrdup(BAD_CAST "file");
uri->scheme = xmlStrdup(BAD_CAST "file");
/* allocate space for leading '/' + path + string terminator */
uri->path = xmlMallocAtomic(len + 2);
if (uri->path == NULL) {
@ -2530,15 +2547,15 @@ path_processing:
}
/* Put in leading '/' plus path */
uri->path[0] = '/';
p = (xmlChar *)uri->path + 1;
strncpy((char *)p, (const char *)path, len + 1);
p = uri->path + 1;
strncpy(p, path, len + 1);
} else {
uri->path = (char*)xmlStrdup(path);
uri->path = xmlStrdup(path);
if (uri->path == NULL) {
xmlFreeURI(uri);
return(NULL);
}
p = (xmlChar *)uri->path;
p = uri->path;
}
/* Now change all occurences of '\' to '/' */
while (*p != '\0') {

View file

@ -122,7 +122,7 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
__xmlRaiseError(NULL, channel, data,
pctxt, NULL, XML_FROM_VALID, error,
XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, 0, 0,
msg);
"%s", msg);
}
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
@ -637,8 +637,6 @@ xmlValidStateDebug(xmlValidCtxtPtr ctxt) {
else if ((doc->intSubset == NULL) && \
(doc->extSubset == NULL)) return(0)
xmlAttributePtr xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem);
#ifdef LIBXML_REGEXP_ENABLED
/************************************************************************
@ -1832,53 +1830,6 @@ xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) {
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
/**
* xmlScanAttributeDeclCallback:
* @attr: the attribute decl
* @list: the list to update
*
* Callback called by xmlScanAttributeDecl when a new attribute
* has to be entered in the list.
*/
static void
xmlScanAttributeDeclCallback(xmlAttributePtr attr, xmlAttributePtr *list,
const xmlChar* name ATTRIBUTE_UNUSED) {
attr->nexth = *list;
*list = attr;
}
/**
* xmlScanAttributeDecl:
* @dtd: pointer to the DTD
* @elem: the element name
*
* When inserting a new element scan the DtD for existing attributes
* for that element and initialize the Attribute chain
*
* Returns the pointer to the first attribute decl in the chain,
* possibly NULL.
*/
xmlAttributePtr
xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem) {
xmlAttributePtr ret = NULL;
xmlAttributeTablePtr table;
if (dtd == NULL) {
return(NULL);
}
if (elem == NULL) {
return(NULL);
}
table = (xmlAttributeTablePtr) dtd->attributes;
if (table == NULL)
return(NULL);
/* WRONG !!! */
xmlHashScan3(table, NULL, NULL, elem,
(xmlHashScanner) xmlScanAttributeDeclCallback, &ret);
return(ret);
}
/**
* xmlScanIDAttributeDecl:
* @ctxt: the validation context
@ -3399,7 +3350,8 @@ int
xmlValidateNotationUse(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
const xmlChar *notationName) {
xmlNotationPtr notaDecl;
if ((doc == NULL) || (doc->intSubset == NULL)) return(-1);
if ((doc == NULL) || (doc->intSubset == NULL) ||
(notationName == NULL)) return(-1);
notaDecl = xmlGetDtdNotationDesc(doc->intSubset, notationName);
if ((notaDecl == NULL) && (doc->extSubset != NULL))
@ -4104,9 +4056,6 @@ xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50);
if (fullname == NULL)
return(NULL);
attrDecl = xmlGetDtdAttrDesc(doc->intSubset, fullname, name);
if ((attrDecl == NULL) && (doc->extSubset != NULL))
attrDecl = xmlGetDtdAttrDesc(doc->extSubset, fullname, name);
if ((fullname != fn) && (fullname != elem->name))
xmlFree(fullname);
}
@ -4305,15 +4254,15 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
while (next != NULL) {
if (next->type == XML_ELEMENT_CONTENT_ELEMENT) {
if ((xmlStrEqual(next->name, name)) &&
(xmlStrEqual(next->prefix, cur->prefix))) {
if (cur->prefix == NULL) {
(xmlStrEqual(next->prefix, cur->c1->prefix))) {
if (cur->c1->prefix == NULL) {
xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
"Definition of %s has duplicate references of %s\n",
elem->name, name, NULL);
} else {
xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
"Definition of %s has duplicate references of %s:%s\n",
elem->name, cur->prefix, name);
elem->name, cur->c1->prefix, name);
}
ret = 0;
}
@ -4322,15 +4271,15 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if (next->c1 == NULL) break;
if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break;
if ((xmlStrEqual(next->c1->name, name)) &&
(xmlStrEqual(next->c1->prefix, cur->prefix))) {
if (cur->prefix == NULL) {
(xmlStrEqual(next->c1->prefix, cur->c1->prefix))) {
if (cur->c1->prefix == NULL) {
xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
"Definition of %s has duplicate references to %s\n",
elem->name, name, NULL);
} else {
xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
"Definition of %s has duplicate references to %s:%s\n",
elem->name, cur->prefix, name);
elem->name, cur->c1->prefix, name);
}
ret = 0;
}

View file

@ -438,8 +438,8 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) {
* try to ensure that new documents included are actually
* built with the same dictionary as the including document.
*/
if ((ctxt->doc != NULL) && (ctxt->doc->dict != NULL) &&
(pctxt->dict != NULL)) {
if ((ctxt->doc != NULL) && (ctxt->doc->dict != NULL)) {
if (pctxt->dict != NULL)
xmlDictFree(pctxt->dict);
pctxt->dict = ctxt->doc->dict;
xmlDictReference(pctxt->dict);
@ -798,6 +798,10 @@ xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) {
* *
************************************************************************/
static xmlNodePtr
xmlXIncludeCopyNodeList(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
xmlDocPtr source, xmlNodePtr elem);
/**
* xmlXIncludeCopyNode:
* @ctxt: the XInclude context
@ -818,6 +822,9 @@ xmlXIncludeCopyNode(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
return(NULL);
if (elem->type == XML_DTD_NODE)
return(NULL);
if (elem->type == XML_DOCUMENT_NODE)
result = xmlXIncludeCopyNodeList(ctxt, target, source, elem->children);
else
result = xmlDocCopyNode(elem, target, 1);
return(result);
}
@ -967,7 +974,6 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
if ((cur == start) && (index1 > 1)) {
content += (index1 - 1);
len -= (index1 - 1);
index1 = 0;
} else {
len = index2;
}
@ -2424,6 +2430,41 @@ xmlXIncludeSetFlags(xmlXIncludeCtxtPtr ctxt, int flags) {
return(0);
}
/**
* xmlXIncludeProcessTreeFlagsData:
* @tree: an XML node
* @flags: a set of xmlParserOption used for parsing XML includes
* @data: application data that will be passed to the parser context
* in the _private field of the parser context(s)
*
* Implement the XInclude substitution on the XML node @tree
*
* Returns 0 if no substitution were done, -1 if some processing failed
* or the number of substitutions done.
*/
int
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, int flags, void *data) {
xmlXIncludeCtxtPtr ctxt;
int ret = 0;
if ((tree == NULL) || (tree->doc == NULL))
return(-1);
ctxt = xmlXIncludeNewContext(tree->doc);
if (ctxt == NULL)
return(-1);
ctxt->_private = data;
ctxt->base = xmlStrdup((xmlChar *)tree->doc->URL);
xmlXIncludeSetFlags(ctxt, flags);
ret = xmlXIncludeDoProcess(ctxt, tree->doc, tree);
if ((ret >= 0) && (ctxt->nbErrors > 0))
ret = -1;
xmlXIncludeFreeContext(ctxt);
return(ret);
}
/**
* xmlXIncludeProcessFlagsData:
* @doc: an XML document
@ -2440,25 +2481,13 @@ int
xmlXIncludeProcessFlagsData(xmlDocPtr doc, int flags, void *data) {
xmlXIncludeCtxtPtr ctxt;
xmlNodePtr tree;
int ret = 0;
if (doc == NULL)
return(-1);
tree = xmlDocGetRootElement(doc);
if (tree == NULL)
return(-1);
ctxt = xmlXIncludeNewContext(doc);
if (ctxt == NULL)
return(-1);
ctxt->_private = data;
ctxt->base = xmlStrdup((xmlChar *)doc->URL);
xmlXIncludeSetFlags(ctxt, flags);
ret = xmlXIncludeDoProcess(ctxt, doc, tree);
if ((ret >= 0) && (ctxt->nbErrors > 0))
ret = -1;
xmlXIncludeFreeContext(ctxt);
return(ret);
return(xmlXIncludeProcessTreeFlagsData(tree, flags, data));
}
/**

View file

@ -613,6 +613,34 @@ xmlWrapOpenUtf8(const char *path,int mode)
return fd;
}
#ifdef HAVE_ZLIB_H
static gzFile
xmlWrapGzOpenUtf8(const char *path, const char *mode)
{
gzFile fd;
wchar_t *wPath;
fd = gzopen (path, mode);
if (fd)
return fd;
wPath = __xmlIOWin32UTF8ToWChar(path);
if(wPath)
{
int d, m = (strstr(mode, "r") ? O_RDONLY : O_RDWR);
#ifdef _O_BINARY
m |= (strstr(mode, "b") ? _O_BINARY : 0);
#endif
d = _wopen(wPath, m);
if (d >= 0)
fd = gzdopen(d, mode);
xmlFree(wPath);
}
return fd;
}
#endif
/**
* xmlWrapStatUtf8:
* @path: the path in utf-8 encoding
@ -679,7 +707,10 @@ typedef int (* xmlWrapStatFunc) (const char *f, struct stat *s);
static xmlWrapStatFunc xmlWrapStat = xmlWrapStatNative;
typedef FILE* (* xmlWrapOpenFunc)(const char *f,int mode);
static xmlWrapOpenFunc xmlWrapOpen = xmlWrapOpenNative;
#ifdef HAVE_ZLIB_H
typedef gzFile (* xmlWrapGzOpenFunc) (const char *f, const char *mode);
static xmlWrapGzOpenFunc xmlWrapGzOpen = gzopen;
#endif
/**
* xmlInitPlatformSpecificIo:
*
@ -699,9 +730,15 @@ xmlInitPlatformSpecificIo(void)
if(GetVersionEx(&osvi) && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) {
xmlWrapStat = xmlWrapStatUtf8;
xmlWrapOpen = xmlWrapOpenUtf8;
#ifdef HAVE_ZLIB_H
xmlWrapGzOpen = xmlWrapGzOpenUtf8;
#endif
} else {
xmlWrapStat = xmlWrapStatNative;
xmlWrapOpen = xmlWrapOpenNative;
#ifdef HAVE_ZLIB_H
xmlWrapGzOpen = gzopen;
#endif
}
xmlPlatformIoInitialized = 1;
@ -1132,7 +1169,11 @@ xmlGzfileOpen_real (const char *filename) {
if (!xmlCheckFilename(path))
return(NULL);
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
fd = xmlWrapGzOpen(path, "rb");
#else
fd = gzopen(path, "rb");
#endif
return((void *) fd);
}
@ -1200,7 +1241,11 @@ xmlGzfileOpenW (const char *filename, int compression) {
if (path == NULL)
return(NULL);
#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
fd = xmlWrapGzOpen(path, mode);
#else
fd = gzopen(path, mode);
#endif
return((void *) fd);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@ -2104,7 +2149,7 @@ int
xmlRegisterOutputCallbacks(xmlOutputMatchCallback matchFunc,
xmlOutputOpenCallback openFunc, xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc) {
if (xmlOutputCallbackNr >= MAX_INPUT_CALLBACK) {
if (xmlOutputCallbackNr >= MAX_OUTPUT_CALLBACK) {
return(-1);
}
xmlOutputCallbackTable[xmlOutputCallbackNr].matchcallback = matchFunc;
@ -2278,6 +2323,10 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
return(NULL);
}
/* try to avoid a performance problem with Windows realloc() */
if (ret->buffer->alloc == XML_BUFFER_ALLOC_EXACT)
ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT;
ret->encoder = encoder;
if (encoder != NULL) {
ret->conv = xmlBufferCreateSize(4000);

View file

@ -124,7 +124,6 @@ static void usershell(void) {
free(cmdline);
continue;
}
nbargs++;
/*
* Parse the argument string
@ -138,8 +137,6 @@ static void usershell(void) {
arg[i++] = *cur++;
}
arg[i] = 0;
if (i != 0)
nbargs++;
/*
* Parse the arguments

View file

@ -184,6 +184,7 @@ static int nocatalogs = 0;
#endif
#ifdef LIBXML_C14N_ENABLED
static int canonical = 0;
static int canonical_11 = 0;
static int exc_canonical = 0;
#endif
#ifdef LIBXML_READER_ENABLED
@ -1756,8 +1757,13 @@ static void processNode(xmlTextReaderPtr reader) {
match = xmlPatternMatch(patternc, xmlTextReaderCurrentNode(reader));
if (match) {
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
path = xmlGetNodePath(xmlTextReaderCurrentNode(reader));
printf("Node %s matches pattern %s\n", path, pattern);
#else
printf("Node %s matches pattern %s\n",
xmlTextReaderConstName(reader), pattern);
#endif
}
}
if (patstream != NULL) {
@ -1772,18 +1778,22 @@ static void processNode(xmlTextReaderPtr reader) {
xmlFreeStreamCtxt(patstream);
patstream = NULL;
} else if (ret != match) {
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
if (path == NULL) {
path = xmlGetNodePath(
xmlTextReaderCurrentNode(reader));
}
#endif
fprintf(stderr,
"xmlPatternMatch and xmlStreamPush disagree\n");
fprintf(stderr,
" pattern %s node %s\n",
if (path != NULL)
fprintf(stderr, " pattern %s node %s\n",
pattern, path);
else
fprintf(stderr, " pattern %s node %s\n",
pattern, xmlTextReaderConstName(reader));
}
}
if ((type == XML_READER_TYPE_END_ELEMENT) ||
((type == XML_READER_TYPE_ELEMENT) && (empty))) {
@ -1980,7 +1990,7 @@ static void walkDoc(xmlDocPtr doc) {
namespaces[i++] = ns->prefix;
}
namespaces[i++] = NULL;
namespaces[i++] = NULL;
namespaces[i] = NULL;
if (pattern != NULL) {
patternc = xmlPatterncompile((const xmlChar *) pattern, doc->dict,
@ -2165,6 +2175,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
doc = NULL;
}
}
if (f != stdin)
fclose(f);
}
} else
#endif /* LIBXML_PUSH_ENABLED */
@ -2429,7 +2441,19 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
xmlChar *result = NULL;
int size;
size = xmlC14NDocDumpMemory(doc, NULL, 0, NULL, 1, &result);
size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_0, NULL, 1, &result);
if (size >= 0) {
write(1, result, size);
xmlFree(result);
} else {
fprintf(stderr, "Failed to canonicalize\n");
progresult = XMLLINT_ERR_OUT;
}
} else if (canonical) {
xmlChar *result = NULL;
int size;
size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_1_1, NULL, 1, &result);
if (size >= 0) {
write(1, result, size);
xmlFree(result);
@ -2442,7 +2466,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
xmlChar *result = NULL;
int size;
size = xmlC14NDocDumpMemory(doc, NULL, 1, NULL, 1, &result);
size = xmlC14NDocDumpMemory(doc, NULL, XML_C14N_EXCLUSIVE_1_0, NULL, 1, &result);
if (size >= 0) {
write(1, result, size);
xmlFree(result);
@ -2527,6 +2551,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if (format)
saveOpts |= XML_SAVE_FORMAT;
if (xmlout)
saveOpts |= XML_SAVE_AS_XML;
if (output == NULL)
ctxt = xmlSaveToFd(1, encoding, saveOpts);
@ -2878,7 +2904,8 @@ static void usage(const char *name) {
printf("\t--encode encoding : output in the given encoding\n");
printf("\t--dropdtd : remove the DOCTYPE of the input docs\n");
#endif /* LIBXML_OUTPUT_ENABLED */
printf("\t--c14n : save in W3C canonical format (with comments)\n");
printf("\t--c14n : save in W3C canonical format v1.0 (with comments)\n");
printf("\t--c14n11 : save in W3C canonical format v1.1 (with comments)\n");
printf("\t--exc-c14n : save in W3C exclusive canonical format (with comments)\n");
#ifdef LIBXML_C14N_ENABLED
#endif /* LIBXML_C14N_ENABLED */
@ -3141,6 +3168,11 @@ main(int argc, char **argv) {
canonical++;
options |= XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_DTDLOAD;
}
else if ((!strcmp(argv[i], "-c14n11")) ||
(!strcmp(argv[i], "--c14n11"))) {
canonical_11++;
options |= XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_DTDLOAD;
}
else if ((!strcmp(argv[i], "-exc-c14n")) ||
(!strcmp(argv[i], "--exc-c14n"))) {
exc_canonical++;
@ -3203,6 +3235,7 @@ main(int argc, char **argv) {
else if ((!strcmp(argv[i], "-sax1")) ||
(!strcmp(argv[i], "--sax1"))) {
sax1++;
options |= XML_PARSE_SAX1;
}
#endif /* LIBXML_SAX1_ENABLED */
else if ((!strcmp(argv[i], "-sax")) ||

View file

@ -205,7 +205,7 @@ xmlMallocLoc(size_t size, const char * file, int line)
if (xmlMemTraceBlockAt == ret) {
xmlGenericError(xmlGenericErrorContext,
"%p : Malloc(%d) Ok\n", xmlMemTraceBlockAt, size);
"%p : Malloc(%ld) Ok\n", xmlMemTraceBlockAt, size);
xmlMallocBreakpoint();
}
@ -273,7 +273,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
if (xmlMemTraceBlockAt == ret) {
xmlGenericError(xmlGenericErrorContext,
"%p : Malloc(%d) Ok\n", xmlMemTraceBlockAt, size);
"%p : Malloc(%ld) Ok\n", xmlMemTraceBlockAt, size);
xmlMallocBreakpoint();
}
@ -348,7 +348,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
}
if (xmlMemTraceBlockAt == ptr) {
xmlGenericError(xmlGenericErrorContext,
"%p : Realloced(%d -> %d) Ok\n",
"%p : Realloced(%ld -> %ld) Ok\n",
xmlMemTraceBlockAt, p->mh_size, size);
xmlMallocBreakpoint();
}

View file

@ -1436,7 +1436,7 @@ get_next_node:
/*
* Cleanup of the old node
*/
if ((reader->preserves == 0) &&
if ((oldnode != NULL) && (reader->preserves == 0) &&
#ifdef LIBXML_XINCLUDE_ENABLED
(reader->in_xinclude == 0) &&
#endif
@ -2214,6 +2214,9 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
xmlFree(reader->patternTab);
}
#endif
if (reader->faketext != NULL) {
xmlFreeNode(reader->faketext);
}
if (reader->ctxt != NULL) {
if (reader->dict == reader->ctxt->dict)
reader->dict = NULL;
@ -2235,9 +2238,6 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
xmlFree(reader->sax);
if ((reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT))
xmlFreeParserInputBuffer(reader->input);
if (reader->faketext != NULL) {
xmlFreeNode(reader->faketext);
}
if (reader->buffer != NULL)
xmlBufferFree(reader->buffer);
if (reader->entTab != NULL)
@ -3064,7 +3064,8 @@ xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader) {
*
* The local name of the node.
*
* Returns the local name or NULL if not available
* Returns the local name or NULL if not available,
* if non NULL it need to be freed by the caller.
*/
xmlChar *
xmlTextReaderLocalName(xmlTextReaderPtr reader) {
@ -3125,7 +3126,8 @@ xmlTextReaderConstLocalName(xmlTextReaderPtr reader) {
*
* The qualified name of the node, equal to Prefix :LocalName.
*
* Returns the local name or NULL if not available
* Returns the local name or NULL if not available,
* if non NULL it need to be freed by the caller.
*/
xmlChar *
xmlTextReaderName(xmlTextReaderPtr reader) {
@ -3268,7 +3270,8 @@ xmlTextReaderConstName(xmlTextReaderPtr reader) {
*
* A shorthand reference to the namespace associated with the node.
*
* Returns the prefix or NULL if not available
* Returns the prefix or NULL if not available,
* if non NULL it need to be freed by the caller.
*/
xmlChar *
xmlTextReaderPrefix(xmlTextReaderPtr reader) {
@ -3331,7 +3334,8 @@ xmlTextReaderConstPrefix(xmlTextReaderPtr reader) {
*
* The URI defining the namespace associated with the node.
*
* Returns the namespace URI or NULL if not available
* Returns the namespace URI or NULL if not available,
* if non NULL it need to be freed by the caller.
*/
xmlChar *
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader) {
@ -3386,7 +3390,8 @@ xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader) {
*
* The base URI of the node.
*
* Returns the base URI or NULL if not available
* Returns the base URI or NULL if not available,
* if non NULL it need to be freed by the caller.
*/
xmlChar *
xmlTextReaderBaseUri(xmlTextReaderPtr reader) {
@ -3644,7 +3649,8 @@ xmlTextReaderQuoteChar(xmlTextReaderPtr reader) {
*
* The xml:lang scope within which the node resides.
*
* Returns the xml:lang value or NULL if none exists.
* Returns the xml:lang value or NULL if none exists.,
* if non NULL it need to be freed by the caller.
*/
xmlChar *
xmlTextReaderXmlLang(xmlTextReaderPtr reader) {
@ -3905,7 +3911,7 @@ xmlTextReaderPreserve(xmlTextReaderPtr reader) {
}
reader->preserves++;
parent = cur->parent;
parent = cur->parent;;
while (parent != NULL) {
if (parent->type == XML_ELEMENT_NODE)
parent->extra |= NODE_IS_PRESERVED;
@ -3993,9 +3999,7 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
}
#ifdef LIBXML_SCHEMAS_ENABLED
static char *
xmlTextReaderBuildMessage(const char *msg, va_list ap);
static char *xmlTextReaderBuildMessage(const char *msg, va_list ap);
static void XMLCDECL
xmlTextReaderValidityError(void *ctxt, const char *msg, ...);
@ -4003,10 +4007,13 @@ xmlTextReaderValidityError(void *ctxt, const char *msg, ...);
static void XMLCDECL
xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...);
static void XMLCDECL xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...)
static void XMLCDECL
xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...)
{
xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
char *str;
va_list ap;
va_start(ap, msg);
@ -4014,17 +4021,22 @@ static void XMLCDECL xmlTextReaderValidityErrorRelay(void *ctx, const char *msg,
if (!reader->errorFunc) {
xmlTextReaderValidityError(ctx, "%s", str);
} else {
reader->errorFunc(reader->errorFuncArg, str, XML_PARSER_SEVERITY_VALIDITY_ERROR, NULL /* locator */);
reader->errorFunc(reader->errorFuncArg, str,
XML_PARSER_SEVERITY_VALIDITY_ERROR,
NULL /* locator */ );
}
if (str != NULL)
xmlFree(str);
va_end(ap);
}
static void XMLCDECL xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...)
static void XMLCDECL
xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...)
{
xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
char *str;
va_list ap;
va_start(ap, msg);
@ -4032,7 +4044,9 @@ static void XMLCDECL xmlTextReaderValidityWarningRelay(void *ctx, const char *ms
if (!reader->errorFunc) {
xmlTextReaderValidityWarning(ctx, "%s", str);
} else {
reader->errorFunc(reader->errorFuncArg, str, XML_PARSER_SEVERITY_VALIDITY_WARNING, NULL /* locator */);
reader->errorFunc(reader->errorFuncArg, str,
XML_PARSER_SEVERITY_VALIDITY_WARNING,
NULL /* locator */ );
}
if (str != NULL)
xmlFree(str);
@ -4042,7 +4056,8 @@ static void XMLCDECL xmlTextReaderValidityWarningRelay(void *ctx, const char *ms
static void
xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error);
static void xmlTextReaderValidityStructuredRelay(void * userData, xmlErrorPtr error)
static void
xmlTextReaderValidityStructuredRelay(void *userData, xmlErrorPtr error)
{
xmlTextReaderPtr reader = (xmlTextReaderPtr) userData;
@ -4052,7 +4067,6 @@ static void xmlTextReaderValidityStructuredRelay(void * userData, xmlErrorPtr er
xmlTextReaderStructuredError(reader, error);
}
}
/**
* xmlTextReaderRelaxNGSetSchema:
* @reader: the xmlTextReaderPtr used
@ -4597,7 +4611,8 @@ xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator) {
*
* Obtain the base URI for the given locator.
*
* Returns the base URI or NULL in case of error.
* Returns the base URI or NULL in case of error,
* if non NULL it need to be freed by the caller.
*/
xmlChar *
xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) {
@ -4628,33 +4643,36 @@ xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) {
}
static void
xmlTextReaderGenericError(void *ctxt, xmlParserSeverities severity, char *str) {
xmlTextReaderGenericError(void *ctxt, xmlParserSeverities severity,
char *str)
{
xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt;
xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private;
if (str != NULL) {
if (reader->errorFunc)
reader->errorFunc(reader->errorFuncArg,
str,
severity,
reader->errorFunc(reader->errorFuncArg, str, severity,
(xmlTextReaderLocatorPtr) ctx);
xmlFree(str);
}
}
static void
xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error) {
xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error)
{
xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt;
xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private;
if (error && reader->sErrorFunc) {
reader->sErrorFunc(reader->errorFuncArg,
(xmlErrorPtr) error);
reader->sErrorFunc(reader->errorFuncArg, (xmlErrorPtr) error);
}
}
static void XMLCDECL
xmlTextReaderError(void *ctxt, const char *msg, ...) {
xmlTextReaderError(void *ctxt, const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
@ -4666,7 +4684,8 @@ xmlTextReaderError(void *ctxt, const char *msg, ...) {
}
static void XMLCDECL
xmlTextReaderWarning(void *ctxt, const char *msg, ...) {
xmlTextReaderWarning(void *ctxt, const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
@ -4677,8 +4696,10 @@ xmlTextReaderWarning(void *ctxt, const char *msg, ...) {
}
static void XMLCDECL
xmlTextReaderValidityError(void *ctxt, const char *msg, ...) {
xmlTextReaderValidityError(void *ctxt, const char *msg, ...)
{
va_list ap;
int len = xmlStrlen((const xmlChar *) msg);
if ((len > 1) && (msg[len - 2] != ':')) {
@ -4695,8 +4716,10 @@ xmlTextReaderValidityError(void *ctxt, const char *msg, ...) {
}
static void XMLCDECL
xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) {
xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...)
{
va_list ap;
int len = xmlStrlen((const xmlChar *) msg);
if ((len != 0) && (msg[len - 1] != ':')) {
@ -4724,8 +4747,8 @@ xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) {
*/
void
xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc f,
void *arg) {
xmlTextReaderErrorFunc f, void *arg)
{
if (f != NULL) {
reader->ctxt->sax->error = xmlTextReaderError;
reader->ctxt->sax->serror = NULL;
@ -4741,18 +4764,19 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderValidityErrorRelay,
xmlTextReaderValidityWarningRelay,
reader);
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader);
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
reader);
}
if (reader->xsdValidCtxt) {
xmlSchemaSetValidErrors(reader->xsdValidCtxt,
xmlTextReaderValidityErrorRelay,
xmlTextReaderValidityWarningRelay,
reader);
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader);
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
reader);
}
#endif
}
else {
} else {
/* restore defaults */
reader->ctxt->sax->error = xmlParserError;
reader->ctxt->vctxt.error = xmlParserValidityError;
@ -4763,12 +4787,16 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
reader->errorFuncArg = NULL;
#ifdef LIBXML_SCHEMAS_ENABLED
if (reader->rngValidCtxt) {
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader);
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader);
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
reader);
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
reader);
}
if (reader->xsdValidCtxt) {
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader);
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader);
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
reader);
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
reader);
}
#endif
}
@ -4786,8 +4814,8 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
*/
void
xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
xmlStructuredErrorFunc f,
void *arg) {
xmlStructuredErrorFunc f, void *arg)
{
if (f != NULL) {
reader->ctxt->sax->error = NULL;
reader->ctxt->sax->serror = xmlTextReaderStructuredError;
@ -4799,20 +4827,21 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
reader->errorFuncArg = arg;
#ifdef LIBXML_SCHEMAS_ENABLED
if (reader->rngValidCtxt) {
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader);
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
reader);
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
xmlTextReaderValidityStructuredRelay,
reader);
}
if (reader->xsdValidCtxt) {
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader);
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
reader);
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
xmlTextReaderValidityStructuredRelay,
reader);
}
#endif
}
else {
} else {
/* restore defaults */
reader->ctxt->sax->error = xmlParserError;
reader->ctxt->sax->serror = NULL;
@ -4824,12 +4853,16 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
reader->errorFuncArg = NULL;
#ifdef LIBXML_SCHEMAS_ENABLED
if (reader->rngValidCtxt) {
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader);
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader);
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
reader);
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
reader);
}
if (reader->xsdValidCtxt) {
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader);
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader);
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
reader);
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
reader);
}
#endif
}
@ -4844,8 +4877,10 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
* Returns the flag value 1 if valid, 0 if no, and -1 in case of error
*/
int
xmlTextReaderIsValid(xmlTextReaderPtr reader) {
if (reader == NULL) return(-1);
xmlTextReaderIsValid(xmlTextReaderPtr reader)
{
if (reader == NULL)
return (-1);
#ifdef LIBXML_SCHEMAS_ENABLED
if (reader->validate == XML_TEXTREADER_VALIDATE_RNG)
return (reader->rngValidErrors == 0);
@ -4867,13 +4902,13 @@ xmlTextReaderIsValid(xmlTextReaderPtr reader) {
*/
void
xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc *f,
void **arg) {
if (f != NULL) *f = reader->errorFunc;
if (arg != NULL) *arg = reader->errorFuncArg;
xmlTextReaderErrorFunc * f, void **arg)
{
if (f != NULL)
*f = reader->errorFunc;
if (arg != NULL)
*arg = reader->errorFuncArg;
}
/************************************************************************
* *
* New set (2.6.0) of simpler and more flexible APIs *
@ -5520,6 +5555,7 @@ xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread,
* *
************************************************************************/
#ifdef NOT_USED_YET
/**
* xmlBase64Decode:
* @in: the input buffer
@ -5535,18 +5571,30 @@ xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread,
*/
static int
xmlBase64Decode(const unsigned char *in, unsigned long *inlen,
unsigned char *to, unsigned long *tolen) {
unsigned char *to, unsigned long *tolen)
{
unsigned long incur; /* current index in in[] */
unsigned long inblk; /* last block index in in[] */
unsigned long outcur; /* current index in out[] */
unsigned long inmax; /* size of in[] */
unsigned long outmax; /* size of out[] */
unsigned char cur; /* the current value read from in[] */
unsigned char intmp[4], outtmp[4]; /* temporary buffers for the convert */
int nbintmp; /* number of byte in intmp[] */
int is_ignore; /* cur should be ignored */
int is_end = 0; /* the end of the base64 was found */
int retval = 1;
int i;
if ((in == NULL) || (inlen == NULL) || (to == NULL) || (tolen == NULL))
@ -5586,6 +5634,7 @@ xmlBase64Decode(const unsigned char *in, unsigned long *inlen,
if (!is_ignore) {
int nbouttmp = 3;
int is_break = 0;
if (is_end) {
@ -5635,14 +5684,23 @@ xmlBase64Decode(const unsigned char *in, unsigned long *inlen,
* Test routine for the xmlBase64Decode function
*/
#if 0
int main(int argc, char **argv) {
int
main(int argc, char **argv)
{
char *input = " VW4 gcGV0 \n aXQgdGVzdCAuCg== ";
char output[100];
char output2[100];
char output3[100];
unsigned long inlen = strlen(input);
unsigned long outlen = 100;
int ret;
unsigned long cons, tmp, tmp2, prod;
/*
@ -5651,7 +5709,9 @@ int main(int argc, char **argv) {
ret = xmlBase64Decode(input, &inlen, output, &outlen);
output[outlen] = 0;
printf("ret: %d, inlen: %ld , outlen: %ld, output: '%s'\n", ret, inlen, outlen, output);
printf("ret: %d, inlen: %ld , outlen: %ld, output: '%s'\n", ret, inlen,
outlen, output)indent: Standard input:179: Error:Unmatched #endif
;
/*
* output chunking
@ -5669,7 +5729,8 @@ int main(int argc, char **argv) {
printf("%ld %ld\n", cons, prod);
}
output2[outlen] = 0;
printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons, prod, output2);
printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons,
prod, output2);
/*
* input chunking
@ -5689,7 +5750,8 @@ int main(int argc, char **argv) {
printf("%ld %ld\n", cons, prod);
}
output3[outlen] = 0;
printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons, prod, output3);
printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons,
prod, output3);
return (0);
}

View file

@ -233,6 +233,8 @@ struct _xmlAutomataState {
typedef struct _xmlAutomata xmlRegParserCtxt;
typedef xmlRegParserCtxt *xmlRegParserCtxtPtr;
#define AM_AUTOMATA_RNG 1
struct _xmlAutomata {
xmlChar *string;
xmlChar *cur;
@ -260,6 +262,7 @@ struct _xmlAutomata {
int determinist;
int negs;
int flags;
};
struct _xmlRegexp {
@ -271,6 +274,7 @@ struct _xmlRegexp {
int nbCounters;
xmlRegCounter *counters;
int determinist;
int flags;
/*
* That's the compact form for determinists automatas
*/
@ -353,6 +357,8 @@ static int xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint);
static int xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint,
int neg, int start, int end, const xmlChar *blockName);
void xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
/************************************************************************
* *
* Regexp memory error handler *
@ -434,6 +440,7 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) {
ret->nbCounters = ctxt->nbCounters;
ret->counters = ctxt->counters;
ret->determinist = ctxt->determinist;
ret->flags = ctxt->flags;
if (ret->determinist == -1) {
xmlRegexpIsDeterminist(ret);
}
@ -1569,8 +1576,13 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
* 1. set transition from atom start to new state
* 2. set transition from atom end to this state.
*/
if (to == NULL) {
xmlFAGenerateEpsilonTransition(ctxt, atom->start, 0);
xmlFAGenerateEpsilonTransition(ctxt, atom->stop, ctxt->state);
xmlFAGenerateEpsilonTransition(ctxt, atom->stop,
ctxt->state);
} else {
xmlFAGenerateEpsilonTransition(ctxt, atom->start, to);
}
break;
case XML_REGEXP_QUANT_MULT:
atom->quant = XML_REGEXP_QUANT_ONCE;
@ -2083,12 +2095,13 @@ xmlFACompareRanges(xmlRegRangePtr range1, xmlRegRangePtr range2) {
(range2->type == XML_REGEXP_EPSILON)) {
return(0);
} else if (range1->type == range2->type) {
if ((range1->type != XML_REGEXP_CHARVAL) ||
(range1->end < range2->start) ||
(range2->end < range1->start))
if (range1->type != XML_REGEXP_CHARVAL)
ret = 1;
else
else if ((range1->end < range2->start) ||
(range2->end < range1->start))
ret = 0;
else
ret = 1;
} else if (range1->type == XML_REGEXP_CHARVAL) {
int codepoint;
int neg = 0;
@ -2215,7 +2228,7 @@ xmlFACompareRanges(xmlRegRangePtr range1, xmlRegRangePtr range2) {
if (((range1->neg == 0) && (range2->neg != 0)) ||
((range1->neg != 0) && (range2->neg == 0)))
ret = !ret;
return(1);
return(ret);
}
/**
@ -2423,6 +2436,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) {
* xmlFAEqualAtoms:
* @atom1: an atom
* @atom2: an atom
* @deep: if not set only compare string pointers
*
* Compares two atoms to check whether they are the same exactly
* this is used to remove equivalent transitions
@ -2430,7 +2444,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) {
* Returns 1 if same and 0 otherwise
*/
static int
xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2, int deep) {
int ret = 0;
if (atom1 == atom2)
@ -2445,6 +2459,9 @@ xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
ret = 0;
break;
case XML_REGEXP_STRING:
if (!deep)
ret = (atom1->valuep == atom2->valuep);
else
ret = xmlStrEqual((xmlChar *)atom1->valuep,
(xmlChar *)atom2->valuep);
break;
@ -2464,6 +2481,7 @@ xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
* xmlFACompareAtoms:
* @atom1: an atom
* @atom2: an atom
* @deep: if not set only compare string pointers
*
* Compares two atoms to check whether they intersect in some ways,
* this is used by xmlFAComputesDeterminism and xmlFARecurseDeterminism only
@ -2471,7 +2489,7 @@ xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
* Returns 1 if yes and 0 otherwise
*/
static int
xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2, int deep) {
int ret = 1;
if (atom1 == atom2)
@ -2497,6 +2515,9 @@ xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
}
switch (atom1->type) {
case XML_REGEXP_STRING:
if (!deep)
ret = (atom1->valuep != atom2->valuep);
else
ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep,
(xmlChar *)atom2->valuep);
break;
@ -2561,9 +2582,14 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
int res;
int transnr, nbTrans;
xmlRegTransPtr t1;
int deep = 1;
if (state == NULL)
return(ret);
if (ctxt->flags & AM_AUTOMATA_RNG)
deep = 0;
/*
* don't recurse on transitions potentially added in the course of
* the elimination.
@ -2587,7 +2613,7 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
}
if (t1->to != to)
continue;
if (xmlFACompareAtoms(t1->atom, atom)) {
if (xmlFACompareAtoms(t1->atom, atom, deep)) {
ret = 0;
/* mark the transition as non-deterministic */
t1->nd = 1;
@ -2611,6 +2637,7 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
xmlRegTransPtr t1, t2, last;
int i;
int ret = 1;
int deep = 1;
#ifdef DEBUG_REGEXP_GRAPH
printf("xmlFAComputesDeterminism\n");
@ -2619,6 +2646,9 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
if (ctxt->determinist != -1)
return(ctxt->determinist);
if (ctxt->flags & AM_AUTOMATA_RNG)
deep = 0;
/*
* First cleanup the automata removing cancelled transitions
*/
@ -2646,7 +2676,13 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
continue;
if (t2->atom != NULL) {
if (t1->to == t2->to) {
if (xmlFAEqualAtoms(t1->atom, t2->atom))
/*
* Here we use deep because we want to keep the
* transitions which indicate a conflict
*/
if (xmlFAEqualAtoms(t1->atom, t2->atom, deep) &&
(t1->counter == t2->counter) &&
(t1->count == t2->count))
t2->to = -1; /* eliminated */
}
}
@ -2681,8 +2717,11 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) {
if (t2->to == -1) /* eliminated */
continue;
if (t2->atom != NULL) {
/* not determinist ! */
if (xmlFACompareAtoms(t1->atom, t2->atom)) {
/*
* But here we don't use deep because we want to
* find transitions which indicate a conflict
*/
if (xmlFACompareAtoms(t1->atom, t2->atom, 1)) {
ret = 0;
/* mark the transitions as non-deterministic ones */
t1->nd = 1;
@ -5470,10 +5509,12 @@ xmlRegexpIsDeterminist(xmlRegexpPtr comp) {
am->nbStates = comp->nbStates;
am->states = comp->states;
am->determinist = -1;
am->flags = comp->flags;
ret = xmlFAComputesDeterminism(am);
am->atoms = NULL;
am->states = NULL;
xmlFreeAutomata(am);
comp->determinist = ret;
return(ret);
}
@ -5551,6 +5592,7 @@ xmlNewAutomata(void) {
xmlFreeAutomata(ctxt);
return(NULL);
}
ctxt->flags = 0;
return(ctxt);
}
@ -5568,6 +5610,20 @@ xmlFreeAutomata(xmlAutomataPtr am) {
xmlRegFreeParserCtxt(am);
}
/**
* xmlAutomataSetFlags:
* @am: an automata
* @flags: a set of internal flags
*
* Set some flags on the automata
*/
void
xmlAutomataSetFlags(xmlAutomataPtr am, int flags) {
if (am == NULL)
return;
am->flags |= flags;
}
/**
* xmlAutomataGetInitState:
* @am: an automata
@ -6254,6 +6310,7 @@ struct _xmlExpCtxt {
int size;
int nbElems;
int nb_nodes;
int maxNodes;
const char *expr;
const char *cur;
int nb_cons;
@ -6283,6 +6340,7 @@ xmlExpNewCtxt(int maxNodes, xmlDictPtr dict) {
memset(ret, 0, sizeof(xmlExpCtxt));
ret->size = size;
ret->nbElems = 0;
ret->maxNodes = maxNodes;
ret->table = xmlMalloc(size * sizeof(xmlExpNodePtr));
if (ret->table == NULL) {
xmlFree(ret);
@ -6868,7 +6926,7 @@ tail:
return(0);
if (nb >= len)
return(-2);
list[nb++] = exp->exp_str;
list[nb] = exp->exp_str;
return(1);
case XML_EXP_COUNT:
exp = exp->exp_left;
@ -6923,7 +6981,7 @@ tail:
return(0);
if (nb >= len)
return(-2);
list[nb++] = exp->exp_str;
list[nb] = exp->exp_str;
return(1);
case XML_EXP_COUNT:
exp = exp->exp_left;

View file

@ -690,8 +690,8 @@ htmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
xmlInitParser();
doc = cur->doc; {
if (doc != NULL)
doc = cur->doc;
if (doc != NULL) {
oldenc = doc->encoding;
if (ctxt->encoding != NULL) {
doc->encoding = BAD_CAST ctxt->encoding;
@ -976,7 +976,6 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) {
cur->encoding = oldenc;
return(-1);
}
switched_encoding = 1;
}
if (ctxt->options & XML_SAVE_FORMAT)
htmlDocContentDumpFormatOutput(buf, cur,

View file

@ -4274,7 +4274,7 @@ xmlSchemaContentModelDump(xmlSchemaParticlePtr particle, FILE * output, int dept
for (i = 0;((i < depth) && (i < 25));i++)
shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0;
fprintf(output, shift);
fprintf(output, "%s", shift);
if (particle->children == NULL) {
fprintf(output, "MISSING particle term\n");
return;
@ -6797,7 +6797,7 @@ xmlSchemaParseWildcardNs(xmlSchemaParserCtxtPtr ctxt,
tmp->next = NULL;
if (wildc->nsSet == NULL)
wildc->nsSet = tmp;
else
else if (lastNs != NULL)
lastNs->next = tmp;
lastNs = tmp;
}
@ -10343,21 +10343,32 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt,
/* Did we already fetch the doc? */
if (bkt != NULL) {
/* TODO: The following nasty cases will produce an error. */
if ((WXS_IS_BUCKET_IMPMAIN(type)) && (! bkt->imported)) {
/* We included/redefined and then try to import a schema. */
/*
* We included/redefined and then try to import a schema,
* but the new location provided for import was different.
*/
if (schemaLocation == NULL)
schemaLocation = BAD_CAST "in_memory_buffer";
if (!xmlStrEqual(schemaLocation,
bkt->schemaLocation)) {
xmlSchemaCustomErr(ACTXT_CAST pctxt, err,
invokingNode, NULL,
"The schema document '%s' cannot be imported, since "
"it was already included or redefined",
schemaLocation, NULL);
goto exit;
}
} else if ((! WXS_IS_BUCKET_IMPMAIN(type)) && (bkt->imported)) {
/* We imported and then try to include/redefine a schema. */
/*
* We imported and then try to include/redefine a schema,
* but the new location provided for the include/redefine
* was different.
*/
if (schemaLocation == NULL)
schemaLocation = BAD_CAST "in_memory_buffer";
if (!xmlStrEqual(schemaLocation,
bkt->schemaLocation)) {
xmlSchemaCustomErr(ACTXT_CAST pctxt, err,
invokingNode, NULL,
"The schema document '%s' cannot be included or "
@ -10366,6 +10377,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt,
goto exit;
}
}
}
if (WXS_IS_BUCKET_IMPMAIN(type)) {
/*
@ -10519,9 +10531,9 @@ doc_load:
/* Parse from memory buffer. */
doc = xmlCtxtReadMemory(parserCtxt, schemaBuffer, schemaBufferLen,
NULL, NULL, SCHEMAS_PARSE_OPTIONS);
schemaLocation = xmlStrdup(BAD_CAST "in_memory_buffer");
schemaLocation = BAD_CAST "in_memory_buffer";
if (doc != NULL)
doc->URL = schemaLocation;
doc->URL = xmlStrdup(schemaLocation);
}
/*
* For <import>:
@ -11027,14 +11039,15 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt,
*/
isChameleon = 1;
if (bucket->parsed &&
(bucket->targetNamespace != pctxt->targetNamespace)) {
/*
* This is a sanity check, I dunno yet if this can happen.
*/
PERROR_INT("xmlSchemaParseIncludeOrRedefine",
"trying to use an already parsed schema for a "
"different targetNamespace");
return(-1);
bucket->origTargetNamespace != NULL) {
xmlSchemaCustomErr(ACTXT_CAST pctxt,
XML_SCHEMAP_SRC_INCLUDE,
node, NULL,
"The target namespace of the included/redefined schema "
"'%s' has to be absent or the same as the "
"including/redefining schema's target namespace",
schemaLocation, NULL);
goto exit_error;
}
bucket->targetNamespace = pctxt->targetNamespace;
}
@ -12512,7 +12525,12 @@ xmlSchemaFreeParserCtxt(xmlSchemaParserCtxtPtr ctxt)
* *
************************************************************************/
static void
/**
* xmlSchemaBuildContentModelForSubstGroup:
*
* Returns 1 if nillable, 0 otherwise
*/
static int
xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt,
xmlSchemaParticlePtr particle, int counter, xmlAutomataStatePtr end)
{
@ -12520,6 +12538,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt,
xmlSchemaElementPtr elemDecl, member;
xmlSchemaSubstGroupPtr substGroup;
int i;
int ret = 0;
elemDecl = (xmlSchemaElementPtr) particle->children;
/*
@ -12535,7 +12554,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt,
"Internal error: xmlSchemaBuildContentModelForSubstGroup, "
"declaration is marked having a subst. group but none "
"available.\n", elemDecl->name, NULL);
return;
return(0);
}
if (counter >= 0) {
/*
@ -12615,21 +12634,31 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt,
xmlAutomataNewCountedTrans(pctxt->am, hop, start, counter);
xmlAutomataNewCounterTrans(pctxt->am, hop, end, counter);
}
if (particle->minOccurs == 0)
if (particle->minOccurs == 0) {
xmlAutomataNewEpsilon(pctxt->am, start, end);
ret = 1;
}
pctxt->state = end;
return(ret);
}
static void
/**
* xmlSchemaBuildContentModelForElement:
*
* Returns 1 if nillable, 0 otherwise
*/
static int
xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt,
xmlSchemaParticlePtr particle)
{
int ret = 0;
if (((xmlSchemaElementPtr) particle->children)->flags &
XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD) {
/*
* Substitution groups.
*/
xmlSchemaBuildContentModelForSubstGroup(ctxt, particle, -1, NULL);
ret = xmlSchemaBuildContentModelForSubstGroup(ctxt, particle, -1, NULL);
} else {
xmlSchemaElementPtr elemDecl;
xmlAutomataStatePtr start;
@ -12637,7 +12666,7 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt,
elemDecl = (xmlSchemaElementPtr) particle->children;
if (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT)
return;
return(0);
if (particle->maxOccurs == 1) {
start = ctxt->state;
ctxt->state = xmlAutomataNewTransition2(ctxt->am, start, NULL,
@ -12665,10 +12694,13 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt,
ctxt->state = xmlAutomataNewCounterTrans(ctxt->am, ctxt->state,
NULL, counter);
}
if (particle->minOccurs == 0)
if (particle->minOccurs == 0) {
xmlAutomataNewEpsilon(ctxt->am, start, ctxt->state);
ret = 1;
}
}
return(ret);
}
/**
* xmlSchemaBuildAContentModel:
@ -12678,21 +12710,24 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt,
*
* Create the automaton for the {content type} of a complex type.
*
* Returns 1 if the content is nillable, 0 otherwise
*/
static void
static int
xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
xmlSchemaParticlePtr particle)
{
int ret = 0, tmp2;
if (particle == NULL) {
PERROR_INT("xmlSchemaBuildAContentModel", "particle is NULL");
return;
return(1);
}
if (particle->children == NULL) {
/*
* Just return in this case. A missing "term" of the particle
* might arise due to an invalid "term" component.
*/
return;
return(1);
}
switch (particle->children->type) {
@ -12744,7 +12779,8 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
int counter;
xmlAutomataStatePtr hop;
int maxOccurs =
particle->maxOccurs == UNBOUNDED ? UNBOUNDED : particle->maxOccurs - 1;
particle->maxOccurs == UNBOUNDED ? UNBOUNDED :
particle->maxOccurs - 1;
int minOccurs =
particle->minOccurs < 1 ? 0 : particle->minOccurs - 1;
@ -12779,25 +12815,29 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
}
if (particle->minOccurs == 0) {
xmlAutomataNewEpsilon(pctxt->am, start, end);
ret = 1;
}
pctxt->state = end;
break;
}
case XML_SCHEMA_TYPE_ELEMENT:
xmlSchemaBuildContentModelForElement(pctxt, particle);
ret = xmlSchemaBuildContentModelForElement(pctxt, particle);
break;
case XML_SCHEMA_TYPE_SEQUENCE:{
xmlSchemaTreeItemPtr sub;
ret = 1;
/*
* If max and min occurances are default (1) then
* simply iterate over the particles of the <sequence>.
*/
if ((particle->minOccurs == 1) && (particle->maxOccurs == 1)) {
sub = particle->children->children;
while (sub != NULL) {
xmlSchemaBuildAContentModel(pctxt,
tmp2 = xmlSchemaBuildAContentModel(pctxt,
(xmlSchemaParticlePtr) sub);
if (tmp2 != 1) ret = 0;
sub = sub->next;
}
} else {
@ -12817,8 +12857,9 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
sub = particle->children->children;
while (sub != NULL) {
xmlSchemaBuildAContentModel(pctxt,
tmp2 = xmlSchemaBuildAContentModel(pctxt,
(xmlSchemaParticlePtr) sub);
if (tmp2 != 1) ret = 0;
sub = sub->next;
}
tmp = pctxt->state;
@ -12827,6 +12868,9 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
pctxt->state =
xmlAutomataNewCounterTrans(pctxt->am, tmp,
NULL, counter);
if (ret == 1)
xmlAutomataNewEpsilon(pctxt->am,
oldstate, pctxt->state);
} else {
pctxt->state = xmlAutomataNewEpsilon(pctxt->am,
@ -12835,8 +12879,9 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
sub = particle->children->children;
while (sub != NULL) {
xmlSchemaBuildAContentModel(pctxt,
tmp2 = xmlSchemaBuildAContentModel(pctxt,
(xmlSchemaParticlePtr) sub);
if (tmp2 != 1) ret = 0;
sub = sub->next;
}
xmlAutomataNewEpsilon(pctxt->am, pctxt->state,
@ -12851,6 +12896,7 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
if (particle->minOccurs == 0) {
xmlAutomataNewEpsilon(pctxt->am,
oldstate, pctxt->state);
ret = 1;
}
}
} else if ((particle->maxOccurs > 1)
@ -12868,8 +12914,9 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
sub = particle->children->children;
while (sub != NULL) {
xmlSchemaBuildAContentModel(pctxt,
tmp2 = xmlSchemaBuildAContentModel(pctxt,
(xmlSchemaParticlePtr) sub);
if (tmp2 != 1) ret = 0;
sub = sub->next;
}
tmp = pctxt->state;
@ -12878,20 +12925,23 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
pctxt->state =
xmlAutomataNewCounterTrans(pctxt->am, tmp, NULL,
counter);
if (particle->minOccurs == 0) {
if ((particle->minOccurs == 0) || (ret == 1)) {
xmlAutomataNewEpsilon(pctxt->am,
oldstate, pctxt->state);
ret = 1;
}
} else {
sub = particle->children->children;
while (sub != NULL) {
xmlSchemaBuildAContentModel(pctxt,
tmp2 = xmlSchemaBuildAContentModel(pctxt,
(xmlSchemaParticlePtr) sub);
if (tmp2 != 1) ret = 0;
sub = sub->next;
}
if (particle->minOccurs == 0) {
xmlAutomataNewEpsilon(pctxt->am, oldstate,
pctxt->state);
ret = 1;
}
}
}
@ -12901,6 +12951,7 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
xmlSchemaTreeItemPtr sub;
xmlAutomataStatePtr start, end;
ret = 0;
start = pctxt->state;
end = xmlAutomataNewState(pctxt->am);
@ -12912,8 +12963,9 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
sub = particle->children->children;
while (sub != NULL) {
pctxt->state = start;
xmlSchemaBuildAContentModel(pctxt,
tmp2 = xmlSchemaBuildAContentModel(pctxt,
(xmlSchemaParticlePtr) sub);
if (tmp2 == 1) ret = 1;
xmlAutomataNewEpsilon(pctxt->am, pctxt->state, end);
sub = sub->next;
}
@ -12937,39 +12989,50 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
sub = particle->children->children;
while (sub != NULL) {
pctxt->state = base;
xmlSchemaBuildAContentModel(pctxt,
tmp2 = xmlSchemaBuildAContentModel(pctxt,
(xmlSchemaParticlePtr) sub);
if (tmp2 == 1) ret = 1;
xmlAutomataNewEpsilon(pctxt->am, pctxt->state, hop);
sub = sub->next;
}
xmlAutomataNewEpsilon(pctxt->am, start, base);
xmlAutomataNewCountedTrans(pctxt->am, hop, base, counter);
xmlAutomataNewCounterTrans(pctxt->am, hop, end, counter);
if (ret == 1)
xmlAutomataNewEpsilon(pctxt->am, base, end);
}
if (particle->minOccurs == 0) {
xmlAutomataNewEpsilon(pctxt->am, start, end);
ret = 1;
}
pctxt->state = end;
break;
}
case XML_SCHEMA_TYPE_ALL:{
xmlAutomataStatePtr start;
xmlAutomataStatePtr start, tmp;
xmlSchemaParticlePtr sub;
xmlSchemaElementPtr elemDecl;
int lax;
ret = 1;
sub = (xmlSchemaParticlePtr) particle->children->children;
if (sub == NULL)
break;
ret = 0;
start = pctxt->state;
tmp = xmlAutomataNewState(pctxt->am);
xmlAutomataNewEpsilon(pctxt->am, pctxt->state, tmp);
pctxt->state = tmp;
while (sub != NULL) {
pctxt->state = start;
pctxt->state = tmp;
elemDecl = (xmlSchemaElementPtr) sub->children;
if (elemDecl == NULL) {
PERROR_INT("xmlSchemaBuildAContentModel",
"<element> particle has no term");
return;
return(ret);
};
/*
* NOTE: The {max occurs} of all the particles in the
@ -13011,9 +13074,12 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
}
sub = (xmlSchemaParticlePtr) sub->next;
}
lax = particle->minOccurs == 0;
pctxt->state =
xmlAutomataNewAllTrans(pctxt->am, pctxt->state, NULL, lax);
xmlAutomataNewAllTrans(pctxt->am, pctxt->state, NULL, 0);
if (particle->minOccurs == 0) {
xmlAutomataNewEpsilon(pctxt->am, start, pctxt->state);
ret = 1;
}
break;
}
case XML_SCHEMA_TYPE_GROUP:
@ -13024,14 +13090,16 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
* TODO: But the group should be substituted and not occur at
* all in the content model at this point. Fix this.
*/
ret = 1;
break;
default:
xmlSchemaInternalErr2(ACTXT_CAST pctxt,
"xmlSchemaBuildAContentModel",
"found unexpected term of type '%s' in content model",
WXS_ITEM_TYPE_NAME(particle->children), NULL);
return;
return(ret);
}
return(ret);
}
/**
@ -15567,6 +15635,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt,
return (XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3);
}
member = member->next;
if (baseMember != NULL)
baseMember = baseMember->next;
}
}
@ -17289,7 +17358,7 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt,
flength = bflength;
if (flength) {
if (! fminlen)
flength = bflength;
fminlen = bfminlen;
if (fminlen) {
/* (1.1) length >= minLength */
res = xmlSchemaCompareValues(flength->val, fminlen->val);
@ -20087,7 +20156,7 @@ xmlSchemaResolveAttrUseReferences(xmlSchemaAttributeUsePtr ause,
WXS_BASIC_CAST ause, ause->node,
"ref", ref->name, ref->targetNamespace,
XML_SCHEMA_TYPE_ATTRIBUTE, NULL);
return(ctxt->err);
return(ctxt->err);;
}
}
return(0);
@ -23653,6 +23722,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt)
parBind->dupls = bind->dupls;
bind->dupls = NULL;
}
if (parTable != NULL) {
if (*parTable == NULL)
*parTable = parBind;
else {
@ -23660,6 +23730,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt)
*parTable = parBind;
}
}
}
next_binding:
bind = bind->next;
@ -24461,10 +24532,10 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt,
/* ws = xmlSchemaGetWhiteSpaceFacetValue(type); */
if (valNeeded)
ret = xmlSchemaValPredefTypeNodeNoNorm(biType,
value, &val, NULL);
value, &val, node);
else
ret = xmlSchemaValPredefTypeNodeNoNorm(biType,
value, NULL, NULL);
value, NULL, node);
break;
}
} else if (actxt->type == XML_SCHEMA_CTXT_PARSER) {
@ -25222,7 +25293,6 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt)
if (vctxt->nbAttrInfos == 0)
return (0);
nbUses = vctxt->nbAttrInfos;
/*
* Validate against the wildcard.
*/
@ -25313,6 +25383,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt)
* whose {attribute declaration}'s {type definition}
* is or is derived from ID."
*/
if (attrUseList != NULL) {
for (j = 0; j < attrUseList->nbItems; j++) {
if (xmlSchemaIsDerivedFromBuiltInType(
WXS_ATTRUSE_TYPEDEF(attrUseList->items[j]),
@ -25324,6 +25395,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt)
}
}
}
}
} else if (type->attributeWildcard->processContents ==
XML_SCHEMAS_ANY_LAX) {
iattr->state = XML_SCHEMAS_ATTR_WILD_LAX_NO_DECL;
@ -28596,7 +28668,7 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
#endif
pctxt->linenumbers = 1;
inputStream = xmlNewIOInputStream(pctxt, input, enc);
inputStream = xmlNewIOInputStream(pctxt, input, enc);;
if (inputStream == NULL) {
ret = -1;
goto done;

View file

@ -2899,12 +2899,23 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
case XML_SCHEMAS_ANYURI:{
if (*value != 0) {
xmlURIPtr uri;
xmlChar *tmpval, *cur;
if (normOnTheFly) {
norm = xmlSchemaCollapseString(value);
if (norm != NULL)
value = norm;
}
uri = xmlParseURI((const char *) value);
tmpval = xmlStrdup(value);
for (cur = tmpval; *cur; ++cur) {
if (*cur < 32 || *cur >= 127 || *cur == ' ' ||
*cur == '<' || *cur == '>' || *cur == '"' ||
*cur == '{' || *cur == '}' || *cur == '|' ||
*cur == '\\' || *cur == '^' || *cur == '`' ||
*cur == '\'')
*cur = '_';
}
uri = xmlParseURI((const char *) tmpval);
xmlFree(tmpval);
if (uri == NULL)
goto return1;
xmlFreeURI(uri);

View file

@ -366,7 +366,7 @@ xmlStrstr(const xmlChar *str, const xmlChar *val) {
*/
const xmlChar *
xmlStrcasestr(const xmlChar *str, xmlChar *val) {
xmlStrcasestr(const xmlChar *str, const xmlChar *val) {
int n;
if (str == NULL) return(NULL);

View file

@ -129,10 +129,10 @@ xmlWriterErrMsg(xmlTextWriterPtr ctxt, xmlParserErrors error,
if (ctxt != NULL) {
__xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt,
NULL, XML_FROM_WRITER, error, XML_ERR_FATAL,
NULL, 0, NULL, NULL, NULL, 0, 0, msg);
NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg);
} else {
__xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error,
XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg);
XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg);
}
}
@ -242,8 +242,8 @@ xmlNewTextWriterFilename(const char *uri, int compression)
out = xmlOutputBufferCreateFilename(uri, NULL, compression);
if (out == NULL) {
xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
"xmlNewTextWriterFilename : out of memory!\n");
xmlWriterErrMsg(NULL, XML_IO_EIO,
"xmlNewTextWriterFilename : cannot open uri\n");
return NULL;
}
@ -389,6 +389,8 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression)
ret = xmlNewTextWriterPushParser(ctxt, compression);
if (ret == NULL) {
xmlFreeDoc(ctxt->myDoc);
xmlFreeParserCtxt(ctxt);
xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR,
"xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n");
return NULL;
@ -898,8 +900,8 @@ xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
}
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteComment(writer, buf);
@ -1323,8 +1325,8 @@ xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteRaw(writer, buf);
@ -1452,8 +1454,8 @@ xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteString(writer, buf);
@ -1510,12 +1512,13 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
if (buf != NULL) {
count = xmlTextWriterWriteRaw(writer, buf);
if (count < 0)
return -1;
sum += count;
if (buf != content) /* buf was allocated by us, so free it */
xmlFree(buf);
if (count < 0)
return -1;
sum += count;
}
return sum;
@ -1997,8 +2000,8 @@ xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteAttribute(writer, name, buf);
@ -2099,8 +2102,8 @@ xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI,
buf);
@ -2200,8 +2203,8 @@ xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteElement(writer, name, buf);
@ -2302,8 +2305,8 @@ xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI,
buf);
@ -2551,8 +2554,8 @@ xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWritePI(writer, target, buf);
@ -2764,8 +2767,8 @@ xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteCDATA(writer, buf);
@ -3082,8 +3085,8 @@ xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteDTD(writer, name, pubid, sysid, buf);
@ -3320,8 +3323,8 @@ xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteDTDElement(writer, name, buf);
@ -3557,8 +3560,8 @@ xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteDTDAttlist(writer, name, buf);
@ -3819,8 +3822,8 @@ xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
if (buf == 0)
return 0;
if (buf == NULL)
return -1;
rc = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, buf);

View file

@ -334,7 +334,7 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error)
error + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK,
XML_ERR_ERROR, NULL, 0,
NULL, NULL, NULL, 0, 0,
xmlXPathErrorMessages[error]);
"%s", xmlXPathErrorMessages[error]);
return;
}
ctxt->error = error;
@ -345,7 +345,7 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error)
XML_ERR_ERROR, NULL, 0,
(const char *) ctxt->base, NULL, NULL,
ctxt->cur - ctxt->base, 0,
xmlXPathErrorMessages[error]);
"%s", xmlXPathErrorMessages[error]);
return;
}
@ -369,7 +369,7 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error)
XML_ERR_ERROR, NULL, 0,
(const char *) ctxt->base, NULL, NULL,
ctxt->cur - ctxt->base, 0,
xmlXPathErrorMessages[error]);
"%s", xmlXPathErrorMessages[error]);
}
}
@ -879,7 +879,7 @@ xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0;
if (cur == NULL) {
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "Node is NULL !\n");
return;
@ -887,7 +887,7 @@ xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
if ((cur->type == XML_DOCUMENT_NODE) ||
(cur->type == XML_HTML_DOCUMENT_NODE)) {
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, " /\n");
} else if (cur->type == XML_ATTRIBUTE_NODE)
xmlDebugDumpAttr(output, (xmlAttrPtr)cur, depth);
@ -904,7 +904,7 @@ xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0;
if (cur == NULL) {
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "Node is NULL !\n");
return;
@ -927,7 +927,7 @@ xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = 0;
if (cur == NULL) {
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "NodeSet is NULL !\n");
return;
@ -936,7 +936,7 @@ xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
if (cur != NULL) {
fprintf(output, "Set contains %d nodes:\n", cur->nodeNr);
for (i = 0;i < cur->nodeNr;i++) {
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "%d", i + 1);
xmlXPathDebugDumpNode(output, cur->nodeTab[i], depth + 1);
}
@ -953,13 +953,13 @@ xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = 0;
if ((cur == NULL) || (cur->nodeNr == 0) || (cur->nodeTab[0] == NULL)) {
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "Value Tree is NULL !\n");
return;
}
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "%d", i + 1);
xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1);
}
@ -974,14 +974,14 @@ xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = 0;
if (cur == NULL) {
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "LocationSet is NULL !\n");
return;
}
for (i = 0;i < cur->locNr;i++) {
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "%d : ", i + 1);
xmlXPathDebugDumpObject(output, cur->locTab[i], depth + 1);
}
@ -1008,7 +1008,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = 0;
fprintf(output, shift);
fprintf(output, "%s", shift);
if (cur == NULL) {
fprintf(output, "Object is empty (NULL)\n");
@ -1063,7 +1063,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
if ((cur->user2 == NULL) ||
((cur->user2 == cur->user) && (cur->index == cur->index2))) {
fprintf(output, "Object is a collapsed range :\n");
fprintf(output, shift);
fprintf(output, "%s", shift);
if (cur->index >= 0)
fprintf(output, "index %d in ", cur->index);
fprintf(output, "node\n");
@ -1071,14 +1071,14 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
depth + 1);
} else {
fprintf(output, "Object is a range :\n");
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "From ");
if (cur->index >= 0)
fprintf(output, "index %d in ", cur->index);
fprintf(output, "node\n");
xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user,
depth + 1);
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "To ");
if (cur->index2 >= 0)
fprintf(output, "index %d in ", cur->index2);
@ -1111,7 +1111,7 @@ xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0;
fprintf(output, shift);
fprintf(output, "%s", shift);
if (op == NULL) {
fprintf(output, "Step is NULL\n");
return;
@ -1298,7 +1298,7 @@ xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0;
fprintf(output, shift);
fprintf(output, "%s", shift);
fprintf(output, "Compiled Expression : %d elements\n",
comp->nbStep);
@ -5003,7 +5003,7 @@ xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt) {
/**
* xmlXPathRegisterNs:
* @ctxt: the XPath context
* @prefix: the namespace prefix
* @prefix: the namespace prefix cannot be NULL or empty string
* @ns_uri: the namespace name
*
* Register a new namespace. If @ns_uri is NULL it unregisters
@ -5018,6 +5018,8 @@ xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix,
return(-1);
if (prefix == NULL)
return(-1);
if (prefix[0] == 0)
return(-1);
if (ctxt->nsHash == NULL)
ctxt->nsHash = xmlHashCreate(10);
@ -9020,7 +9022,7 @@ xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) {
* the index is NaN, the length is NaN, or both
* arguments are infinity (relying on Inf + -Inf = NaN)
*/
if (!xmlXPathIsNaN(in + le) && !xmlXPathIsInf(in)) {
if (!xmlXPathIsInf(in) && !xmlXPathIsNaN(in + le)) {
/*
* To meet the requirements of the spec, the arguments
* must be converted to integer format before
@ -10866,7 +10868,6 @@ xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort) {
xmlXPathCompAndExpr(ctxt);
CHECK_ERROR;
PUSH_BINARY_EXPR(XPATH_OP_OR, op1, ctxt->comp->last, 0, 0);
op1 = ctxt->comp->nbStep;
SKIP_BLANKS;
}
if ((sort) && (ctxt->comp->steps[ctxt->comp->last].op != XPATH_OP_VALUE)) {
@ -11979,7 +11980,6 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
* avoid a duplicate-aware merge, if the axis to be traversed is e.g.
* the descendant-or-self axis.
*/
addNode = xmlXPathNodeSetAdd;
mergeAndClear = xmlXPathNodeSetMergeAndClear;
switch (axis) {
case AXIS_ANCESTOR:
@ -14503,7 +14503,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
namespaces[i++] = ns->prefix;
}
namespaces[i++] = NULL;
namespaces[i++] = NULL;
namespaces[i] = NULL;
}
}

View file

@ -1152,10 +1152,12 @@ xmlXPtrEvalFullXPtr(xmlXPathParserContextPtr ctxt, xmlChar *name) {
if (name == NULL)
XP_ERROR(XPATH_EXPR_ERROR);
while (name != NULL) {
ctxt->error = XPATH_EXPRESSION_OK;
xmlXPtrEvalXPtrPart(ctxt, name);
/* in case of syntax error, break here */
if (ctxt->error != XPATH_EXPRESSION_OK)
if ((ctxt->error != XPATH_EXPRESSION_OK) &&
(ctxt->error != XML_XPTR_UNKNOWN_SCHEME))
return;
/*
@ -1299,12 +1301,19 @@ xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) {
* *
************************************************************************/
static
void xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs);
static
void xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs);
static
void xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs);
static
void xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs);
static
void xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs);
static
void xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs);
static
void xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs);
/**
@ -1732,7 +1741,7 @@ xmlXPtrNbLocChildren(xmlNodePtr node) {
* Function implementing here() operation
* as described in 5.4.3
*/
void
static void
xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
CHECK_ARITY(0);
@ -1750,7 +1759,7 @@ xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
* Function implementing origin() operation
* as described in 5.4.3
*/
void
static void
xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) {
CHECK_ARITY(0);
@ -1783,7 +1792,7 @@ xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) {
* ----------------
*
*/
void
static void
xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr tmp, obj, point;
xmlLocationSetPtr newset = NULL;
@ -1877,7 +1886,7 @@ xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
* syntax error.
* ----------------------------
*/
void
static void
xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr tmp, obj, point;
xmlLocationSetPtr newset = NULL;
@ -2022,7 +2031,7 @@ xmlXPtrCoveringRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
* location-set, a range location representing the covering range of
* x is added to the result location-set.
*/
void
static void
xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
int i;
xmlXPathObjectPtr set;
@ -2168,7 +2177,7 @@ xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
* location children of x.
*
*/
void
static void
xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) {
int i;
xmlXPathObjectPtr set;
@ -2628,7 +2637,6 @@ xmlXPtrGetLastChar(xmlNodePtr *node, int *indx) {
(cur->type == XML_HTML_DOCUMENT_NODE)) {
if (pos > 0) {
cur = xmlXPtrGetNthChild(cur, pos);
pos = 0;
}
}
while (cur != NULL) {
@ -2757,7 +2765,7 @@ xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) {
* all be character points.
* ------------------------------
*/
void
static void
xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
int i, startindex, endindex = 0, fendindex;
xmlNodePtr start, end = 0, fend;