From 5923afe8fea146042befe365ab24c9c82a0500c6 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Mon, 19 Oct 2009 19:11:29 +0000 Subject: [PATCH] update libxslt to version 1.1.26 svn path=/trunk/; revision=43620 --- reactos/dll/3rdparty/libxslt/ChangeLog | 110 ++++ reactos/dll/3rdparty/libxslt/Makefile.am | 17 +- reactos/dll/3rdparty/libxslt/Makefile.in | 295 +++++---- reactos/dll/3rdparty/libxslt/attributes.c | 7 + reactos/dll/3rdparty/libxslt/attrvt.c | 12 +- reactos/dll/3rdparty/libxslt/extensions.c | 225 ++++++- reactos/dll/3rdparty/libxslt/extensions.h | 92 +-- reactos/dll/3rdparty/libxslt/extra.c | 3 +- reactos/dll/3rdparty/libxslt/functions.c | 2 + reactos/dll/3rdparty/libxslt/imports.c | 7 +- reactos/dll/3rdparty/libxslt/keys.c | 5 +- reactos/dll/3rdparty/libxslt/libxslt.h | 2 +- reactos/dll/3rdparty/libxslt/libxslt.rbuild | 1 + reactos/dll/3rdparty/libxslt/namespaces.c | 4 + reactos/dll/3rdparty/libxslt/pattern.c | 258 +++----- reactos/dll/3rdparty/libxslt/preproc.c | 12 +- reactos/dll/3rdparty/libxslt/security.c | 5 + reactos/dll/3rdparty/libxslt/templates.c | 15 +- reactos/dll/3rdparty/libxslt/transform.c | 586 +++++++++--------- reactos/dll/3rdparty/libxslt/transform.h | 66 +- reactos/dll/3rdparty/libxslt/trio.h | 2 +- reactos/dll/3rdparty/libxslt/triodef.h | 2 +- reactos/dll/3rdparty/libxslt/variables.c | 4 + reactos/dll/3rdparty/libxslt/xslt.c | 112 +++- reactos/dll/3rdparty/libxslt/xsltInternals.h | 11 +- reactos/dll/3rdparty/libxslt/xsltconfig.h | 23 +- reactos/dll/3rdparty/libxslt/xsltconfig.h.in | 13 + reactos/dll/3rdparty/libxslt/xsltlocale.c | 509 +++++++++++++++ reactos/dll/3rdparty/libxslt/xsltlocale.h | 57 ++ reactos/dll/3rdparty/libxslt/xsltutils.c | 16 + .../dll/3rdparty/libxslt/xsltwin32config.h | 6 +- 31 files changed, 1744 insertions(+), 735 deletions(-) create mode 100644 reactos/dll/3rdparty/libxslt/xsltlocale.c create mode 100644 reactos/dll/3rdparty/libxslt/xsltlocale.h diff --git a/reactos/dll/3rdparty/libxslt/ChangeLog b/reactos/dll/3rdparty/libxslt/ChangeLog index 175e5b449fa..7761eb34d10 100644 --- a/reactos/dll/3rdparty/libxslt/ChangeLog +++ b/reactos/dll/3rdparty/libxslt/ChangeLog @@ -1,3 +1,113 @@ +Fri Jul 24 10:16:24 CEST 2009 Daniel Veillard + + * libxslt/attributes.c: fix an IDness issue when building the tree + +Tue May 12 09:03:46 CEST 2009 Daniel Veillard + + * configure.in: adapt the extra version detection code to git + * libxslt.doap: adding RDF dope file + +Fri Jan 23 19:02:28 PST 2009 William Brack + + * libexslt/strings.c: Fixed indexing error reported by + Ron Burk on the mailing list. + +Fri Nov 14 15:06:55 CET 2008 Daniel Veillard + + * python/Makefile.am libxslt/Makefile.am configure.in + libexslt/Makefile.am: applied patch from Roumen Petrov for + mingw cross compilation problems raised by Rich Jones + +Tue Oct 28 11:55:27 CET 2008 Daniel Veillard + + * configure.in Makefile.am: patch from Richard Jones to build + shared libs with MinGW cross-compiler + +Tue Oct 7 18:16:08 CEST 2008 Daniel Veillard + + * libxslt/pattern.c: prevent some unchecked pointer accesses, patch + by Jake Goulding + +Wed Aug 6 20:10:08 HKT 2008 William Brack + + * Minor cleanup of "typo" and some compilation warnings: + tests/namespaces/tst7.xsl: fixed typo detected by new libxml2 code + libxslt/keys.c, libxslt/xsltlocale.c, libexslt/date.c: trivial + changes for gcc warnings. + +Fri Aug 1 10:16:48 CEST 2008 Daniel Veillard + + * libxslt/xsltconfig.h.in libxslt/xslt.c libxslt/extensions.c + libxslt/xsltlocale.c libxslt/preproc.c libxslt/xsltutils.c + libxslt/xsltlocale.h libxslt/win32config.h configure.in + config.h.in win32/configure.js: big patch from Roumen Petrov + finishing xsl:sort lang support with many portability issues + fixed and feedback from Nick Wellnhofer and Rob Richards + +Fri Aug 1 07:54:02 CEST 2008 Daniel Veillard + + * libexslt/crypto.c: fix for CVE-2008-2935 libexslt RC4 + encryption/decryption functions + +Mon Jul 28 14:46:27 CEST 2008 Daniel Veillard + + * configure.in: fix my static linking setup on x86_64 + +Sun Jul 27 13:52:10 CEST 2008 Daniel Veillard + + * libxslt/xslt.c: avoid a quadratic behaviour when hitting duplicates + exclude-result-prefixes declarations, should fix #544906 + +Sat Jul 26 12:43:18 PST 2008 William Brack + + *configure.in: fixed option --with-debugger with patch from + Arun Ragnavan #544829 + +Sat Jul 12 16:36:58 PST 2008 William Brack + + * libexslt/math.c: fixed incorrect argument popping in + exsltMathAtan2Function #541965 + +Thu Jul 10 10:04:28 PST 2008 William Brack + + * libxslt/functions.c: patch from Ron Burk to fix problem + with string check for element-available and + function-available #530891. + +Tue Jun 24 23:55:48 PST 2008 William Brack + + * libxslt/attrvt.c: added code to handle literal within an + AVT #539741. + * tests/docs/Makefile.am tests/docs/bug-168.xsl + * tests/general/Makefile.am tests/general/bug-168.* add a + test for this bug to the regression suite. + +Fri Jun 13 10:58:52 CEST 2008 Daniel Veillard + + * libxslt/libxslt.h libexslt/libexslt.h libexslt/exslt.h: patch + from Roumen Petrov fixing include path when compiling outside + source tree + +Thu Jun 12 11:23:23 CEST 2008 Daniel Veillard + + * libxslt/xsltconfig.h.in libxslt/xsltlocale.h configure.in + config.h.in win32/configure.js: patch from Nick Wellnhofer and + Roumen Petrov to fix some portability problems on the previous + xsl:sort locale patch + +Tue Jun 3 18:26:26 CEST 2008 Daniel Veillard + + * configure.in libxslt/extra.c libxslt/Makefile.am libxslt/preproc.c + libxslt/xsltInternals.h libxslt/xsltlocale.c libxslt/xsltlocale.h + libxslt/xsltutils.c win32/Makefile.mingw win32/Makefile.msvc: patch + from Nick Wellnhofer adding xsl:sort lang support using the locale + support from the C library. + +Tue Jun 3 18:14:55 CEST 2008 Daniel Veillard + + * libxslt/extensions.h: as Ralf Junker pointed out + xsltExtFunctionLookup was defined but never implemented, removing it + Tue May 13 17:51:05 CEST 2008 Daniel Veillard * configure.in doc/*: release of 1.1.24 diff --git a/reactos/dll/3rdparty/libxslt/Makefile.am b/reactos/dll/3rdparty/libxslt/Makefile.am index d5aff946b29..bead72ce44e 100644 --- a/reactos/dll/3rdparty/libxslt/Makefile.am +++ b/reactos/dll/3rdparty/libxslt/Makefile.am @@ -24,11 +24,13 @@ xsltinc_HEADERS = \ security.h \ xsltInternals.h \ xsltconfig.h \ - xsltexports.h + xsltexports.h \ + xsltlocale.h libxslt_la_SOURCES = \ attrvt.c \ xslt.c \ + xsltlocale.c \ xsltutils.c \ pattern.c \ templates.c \ @@ -50,12 +52,21 @@ libxslt_la_SOURCES = \ xsltwin32config.h.in \ libxslt.h +if USE_VERSION_SCRIPT +LIBXSLT_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxslt.syms +else +LIBXSLT_VERSION_SCRIPT = +endif + libxslt_la_LIBADD = $(EXTRA_LIBS) -libxslt_la_LDFLAGS = -version-info @LIBXSLT_VERSION_INFO@ +libxslt_la_LDFLAGS = \ + $(WIN32_EXTRA_LDFLAGS) \ + $(LIBXSLT_VERSION_SCRIPT) \ + -version-info @LIBXSLT_VERSION_INFO@ man_MANS = libxslt.3 -EXTRA_DIST = $(man_MANS) trio.h triodef.h +EXTRA_DIST = $(man_MANS) trio.h triodef.h libxslt.syms xsltproc: all @(cd ../xsltproc ; $(MAKE)) diff --git a/reactos/dll/3rdparty/libxslt/Makefile.in b/reactos/dll/3rdparty/libxslt/Makefile.in index 3a64996252a..8cba338c42e 100644 --- a/reactos/dll/3rdparty/libxslt/Makefile.in +++ b/reactos/dll/3rdparty/libxslt/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.10 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 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. @@ -17,8 +18,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 @@ -44,29 +46,45 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = xsltconfig.h xsltwin32config.h +CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 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)$(libdir)" "$(DESTDIR)$(man3dir)" \ "$(DESTDIR)$(xsltincdir)" -libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libxslt_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_libxslt_la_OBJECTS = attrvt.lo xslt.lo xsltutils.lo pattern.lo \ - templates.lo variables.lo keys.lo numbers.lo extensions.lo \ - extra.lo functions.lo namespaces.lo imports.lo attributes.lo \ - documents.lo preproc.lo transform.lo security.lo +am_libxslt_la_OBJECTS = attrvt.lo xslt.lo xsltlocale.lo xsltutils.lo \ + pattern.lo templates.lo variables.lo keys.lo numbers.lo \ + extensions.lo extra.lo functions.lo namespaces.lo imports.lo \ + attributes.lo documents.lo preproc.lo transform.lo security.lo libxslt_la_OBJECTS = $(am_libxslt_la_OBJECTS) libxslt_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libxslt_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles +am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ @@ -81,7 +99,6 @@ DIST_SOURCES = $(libxslt_la_SOURCES) man3dir = $(mandir)/man3 NROFF = nroff MANS = $(man_MANS) -xsltincHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(xsltinc_HEADERS) ETAGS = etags CTAGS = ctags @@ -89,6 +106,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -98,14 +116,12 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -ECHO = @ECHO@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -115,8 +131,7 @@ EXSLT_INCLUDEDIR = @EXSLT_INCLUDEDIR@ EXSLT_LIBDIR = @EXSLT_LIBDIR@ EXSLT_LIBS = @EXSLT_LIBS@ EXTRA_LIBS = @EXTRA_LIBS@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ GREP = @GREP@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ @@ -124,6 +139,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEXSLT_MAJOR_VERSION = @LIBEXSLT_MAJOR_VERSION@ LIBEXSLT_MICRO_VERSION = @LIBEXSLT_MICRO_VERSION@ @@ -151,13 +167,19 @@ LIBXSLT_VERSION = @LIBXSLT_VERSION@ LIBXSLT_VERSION_EXTRA = @LIBXSLT_VERSION_EXTRA@ LIBXSLT_VERSION_INFO = @LIBXSLT_VERSION_INFO@ LIBXSLT_VERSION_NUMBER = @LIBXSLT_VERSION_NUMBER@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ 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@ @@ -181,7 +203,9 @@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ STRIP = @STRIP@ TAR = @TAR@ +THREAD_LIBS = @THREAD_LIBS@ VERSION = @VERSION@ +VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_CRYPTO = @WITH_CRYPTO@ @@ -190,18 +214,21 @@ WITH_MEM_DEBUG = @WITH_MEM_DEBUG@ WITH_MODULES = @WITH_MODULES@ WITH_TRIO = @WITH_TRIO@ WITH_XSLT_DEBUG = @WITH_XSLT_DEBUG@ +XMLLINT = @XMLLINT@ XML_CONFIG = @XML_CONFIG@ +XSLTPROC = @XSLTPROC@ XSLTPROCDV = @XSLTPROCDV@ XSLT_INCLUDEDIR = @XSLT_INCLUDEDIR@ XSLT_LIBDIR = @XSLT_LIBDIR@ XSLT_LIBS = @XSLT_LIBS@ +XSLT_LOCALE_WINAPI = @XSLT_LOCALE_WINAPI@ +XSLT_LOCALE_XLOCALE = @XSLT_LOCALE_XLOCALE@ 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_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -232,6 +259,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -245,6 +273,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@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt $(LIBXML_CFLAGS) @@ -270,11 +299,13 @@ xsltinc_HEADERS = \ security.h \ xsltInternals.h \ xsltconfig.h \ - xsltexports.h + xsltexports.h \ + xsltlocale.h libxslt_la_SOURCES = \ attrvt.c \ xslt.c \ + xsltlocale.c \ xsltutils.c \ pattern.c \ templates.c \ @@ -296,10 +327,16 @@ libxslt_la_SOURCES = \ xsltwin32config.h.in \ libxslt.h +@USE_VERSION_SCRIPT_FALSE@LIBXSLT_VERSION_SCRIPT = +@USE_VERSION_SCRIPT_TRUE@LIBXSLT_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxslt.syms libxslt_la_LIBADD = $(EXTRA_LIBS) -libxslt_la_LDFLAGS = -version-info @LIBXSLT_VERSION_INFO@ +libxslt_la_LDFLAGS = \ + $(WIN32_EXTRA_LDFLAGS) \ + $(LIBXSLT_VERSION_SCRIPT) \ + -version-info @LIBXSLT_VERSION_INFO@ + man_MANS = libxslt.3 -EXTRA_DIST = $(man_MANS) trio.h triodef.h +EXTRA_DIST = $(man_MANS) trio.h triodef.h libxslt.syms all: all-am .SUFFIXES: @@ -308,14 +345,14 @@ $(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 libxslt/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libxslt/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libxslt/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu libxslt/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -333,6 +370,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): xsltconfig.h: $(top_builddir)/config.status $(srcdir)/xsltconfig.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ xsltwin32config.h: $(top_builddir)/config.status $(srcdir)/xsltwin32config.h.in @@ -340,20 +378,24 @@ xsltwin32config.h: $(top_builddir)/config.status $(srcdir)/xsltwin32config.h.in install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + list2="$$list2 $$p"; \ else :; fi; \ - done + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: @@ -390,25 +432,26 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transform.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/variables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xslt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsltlocale.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsltutils.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< @@ -418,118 +461,131 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -install-man3: $(man3_MANS) $(man_MANS) +install-man3: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" - @list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.3*) list="$$list $$i" ;; \ - esac; \ + @list=''; test -n "$(man3dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.3[a-z]*$$/p'; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ + fi; \ done; \ - for i in $$list; do \ - if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ - else file=$$i; fi; \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 3*) ;; \ - *) ext='3' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \ - done + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ + done; } + uninstall-man3: @$(NORMAL_UNINSTALL) - @list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.3*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 3*) ;; \ - *) ext='3' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \ - rm -f "$(DESTDIR)$(man3dir)/$$inst"; \ - done + @list=''; test -n "$(man3dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.3[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + test -z "$$files" || { \ + echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } install-xsltincHEADERS: $(xsltinc_HEADERS) @$(NORMAL_INSTALL) test -z "$(xsltincdir)" || $(MKDIR_P) "$(DESTDIR)$(xsltincdir)" - @list='$(xsltinc_HEADERS)'; for p in $$list; do \ + @list='$(xsltinc_HEADERS)'; test -n "$(xsltincdir)" || list=; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(xsltincHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(xsltincdir)/$$f'"; \ - $(xsltincHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(xsltincdir)/$$f"; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(xsltincdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(xsltincdir)" || exit $$?; \ done uninstall-xsltincHEADERS: @$(NORMAL_UNINSTALL) - @list='$(xsltinc_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(xsltincdir)/$$f'"; \ - rm -f "$(DESTDIR)$(xsltincdir)/$$f"; \ - done + @list='$(xsltinc_HEADERS)'; test -n "$(xsltincdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(xsltincdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(xsltincdir)" && 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; } \ - 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: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ 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; }'`; \ - 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; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: $(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) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -545,13 +601,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 @@ -582,6 +642,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" @@ -603,6 +664,8 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: @@ -611,20 +674,29 @@ install-data-am: install-man install-xsltincHEADERS install-dvi: install-dvi-am +install-dvi-am: + install-exec-am: install-libLTLIBRARIES @$(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-man3 install-pdf: install-pdf-am +install-pdf-am: + install-ps: install-ps-am +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -674,6 +746,7 @@ xsltproc: all install-exec-hook: $(mkinstalldirs) "$(DESTDIR)$(libdir)/libxslt-plugins" + # 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: diff --git a/reactos/dll/3rdparty/libxslt/attributes.c b/reactos/dll/3rdparty/libxslt/attributes.c index 168dae6a18e..ce47df775c6 100644 --- a/reactos/dll/3rdparty/libxslt/attributes.c +++ b/reactos/dll/3rdparty/libxslt/attributes.c @@ -978,6 +978,13 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, if (inst->children->name == xmlStringTextNoenc) copyTxt->name = xmlStringTextNoenc; + /* + * since we create the attribute without content IDness must be + * asserted as a second step + */ + if ((copyTxt->content != NULL) && + (xmlIsID(attr->doc, attr->parent, attr))) + xmlAddID(NULL, attr->doc, copyTxt->content, attr); } else { /* * The sequence constructor might be complex, so instantiate it. diff --git a/reactos/dll/3rdparty/libxslt/attrvt.c b/reactos/dll/3rdparty/libxslt/attrvt.c index b63b77bbe70..bda0910e0e6 100644 --- a/reactos/dll/3rdparty/libxslt/attrvt.c +++ b/reactos/dll/3rdparty/libxslt/attrvt.c @@ -244,7 +244,17 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { } cur++; - while ((*cur != 0) && (*cur != '}')) cur++; + while ((*cur != 0) && (*cur != '}')) { + /* Need to check for literal (bug539741) */ + if ((*cur == '\'') || (*cur == '"')) { + char delim = *(cur++); + while ((*cur != 0) && (*cur != delim)) + cur++; + if (*cur != 0) + cur++; /* skip the ending delimiter */ + } else + cur++; + } if (*cur == 0) { xsltTransformError(NULL, style, attr->parent, "Attribute '%s': The AVT has an unmatched '{'.\n", diff --git a/reactos/dll/3rdparty/libxslt/extensions.c b/reactos/dll/3rdparty/libxslt/extensions.c index 87eefb45729..6187b7afc47 100644 --- a/reactos/dll/3rdparty/libxslt/extensions.c +++ b/reactos/dll/3rdparty/libxslt/extensions.c @@ -86,6 +86,7 @@ static xmlHashTablePtr xsltFunctionsHash = NULL; static xmlHashTablePtr xsltElementsHash = NULL; static xmlHashTablePtr xsltTopLevelsHash = NULL; static xmlHashTablePtr xsltModuleHash = NULL; +static xmlMutexPtr xsltExtMutex = NULL; /************************************************************************ * * @@ -339,10 +340,14 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) return (-1); } + xmlMutexLock(xsltExtMutex); + /* have we attempted to register this module already? */ if (xmlHashLookup(xsltModuleHash, URI) != NULL) { + xmlMutexUnlock(xsltExtMutex); return (-1); } + xmlMutexUnlock(xsltExtMutex); /* transform extension namespace into a module name */ protocol = xmlStrstr(URI, BAD_CAST "://"); @@ -368,15 +373,16 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) /* determine module directory */ ext_directory = (xmlChar *) getenv("LIBXSLT_PLUGINS_PATH"); -#ifdef WITH_XSLT_DEBUG_EXTENSIONS - xsltGenericDebug(xsltGenericDebugContext, - "LIBXSLT_PLUGINS_PATH is %s\n", ext_directory); -#endif - - if (NULL == ext_directory) + if (NULL == ext_directory) { ext_directory = BAD_CAST LIBXSLT_DEFAULT_PLUGINS_PATH(); - if (NULL == ext_directory) - return (-1); + if (NULL == ext_directory) + return (-1); + } +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + else + xsltGenericDebug(xsltGenericDebugContext, + "LIBXSLT_PLUGINS_PATH is %s\n", ext_directory); +#endif /* build the module filename, and confirm the module exists */ xmlStrPrintf((xmlChar *) module_filename, sizeof(module_filename), @@ -429,7 +435,9 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) (*regfunc) (); /* register this module in our hash */ + xmlMutexLock(xsltExtMutex); xmlHashAddEntry(xsltModuleHash, URI, (void *) m); + xmlMutexUnlock(xsltExtMutex); } else { #ifdef WITH_XSLT_DEBUG_EXTENSIONS @@ -448,7 +456,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) } #else static int -xsltExtModuleRegisterDynamic(const xmlChar * ATTRIBUTE_UNUSED URI) +xsltExtModuleRegisterDynamic(const xmlChar * URI ATTRIBUTE_UNUSED) { return -1; } @@ -540,10 +548,14 @@ xsltRegisterExtPrefix(xsltStylesheetPtr style, if (xsltExtensionsHash != NULL) { xsltExtModulePtr module; + xmlMutexLock(xsltExtMutex); module = xmlHashLookup(xsltExtensionsHash, URI); + xmlMutexUnlock(xsltExtMutex); if (NULL == module) { if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); module = xmlHashLookup(xsltExtensionsHash, URI); + xmlMutexUnlock(xsltExtMutex); } } if (module != NULL) { @@ -575,6 +587,8 @@ int xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar * name, const xmlChar * URI, xmlXPathFunction function) { + int ret; + if ((ctxt == NULL) || (name == NULL) || (URI == NULL) || (function == NULL)) return (-1); @@ -585,8 +599,11 @@ xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar * name, ctxt->extFunctions = xmlHashCreate(10); if (ctxt->extFunctions == NULL) return (-1); - return (xmlHashAddEntry2 - (ctxt->extFunctions, name, URI, XML_CAST_FPTR(function))); + + ret = xmlHashAddEntry2(ctxt->extFunctions, name, URI, + XML_CAST_FPTR(function)); + + return(ret); } /** @@ -661,7 +678,12 @@ xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, return(NULL); } + xmlMutexLock(xsltExtMutex); + module = xmlHashLookup(xsltExtensionsHash, URI); + + xmlMutexUnlock(xsltExtMutex); + if (module == NULL) { #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, @@ -855,7 +877,12 @@ xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar * URI) void *extData; xsltExtModulePtr module; + xmlMutexLock(xsltExtMutex); + module = xmlHashLookup(xsltExtensionsHash, URI); + + xmlMutexUnlock(xsltExtMutex); + if (module == NULL) { #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, @@ -1235,18 +1262,27 @@ xsltRegisterExtModuleFull(const xmlChar * URI, if (xsltExtensionsHash == NULL) return (-1); + xmlMutexLock(xsltExtMutex); + module = xmlHashLookup(xsltExtensionsHash, URI); if (module != NULL) { if ((module->initFunc == initFunc) && (module->shutdownFunc == shutdownFunc)) - return (0); - return (-1); + ret = 0; + else + ret = -1; + goto done; } module = xsltNewExtModule(initFunc, shutdownFunc, styleInitFunc, styleShutdownFunc); - if (module == NULL) - return (-1); + if (module == NULL) { + ret = -1; + goto done; + } ret = xmlHashAddEntry(xsltExtensionsHash, URI, (void *) module); + +done: + xmlMutexUnlock(xsltExtMutex); return (ret); } @@ -1287,9 +1323,13 @@ xsltUnregisterExtModule(const xmlChar * URI) if (xsltExtensionsHash == NULL) return (-1); - ret = - xmlHashRemoveEntry(xsltExtensionsHash, URI, - (xmlHashDeallocator) xsltFreeExtModule); + xmlMutexLock(xsltExtMutex); + + ret = xmlHashRemoveEntry(xsltExtensionsHash, URI, + (xmlHashDeallocator) xsltFreeExtModule); + + xmlMutexUnlock(xsltExtMutex); + return (ret); } @@ -1304,9 +1344,13 @@ xsltUnregisterAllExtModules(void) if (xsltExtensionsHash == NULL) return; + xmlMutexLock(xsltExtMutex); + xmlHashFree(xsltExtensionsHash, (xmlHashDeallocator) xsltFreeExtModule); xsltExtensionsHash = NULL; + + xmlMutexUnlock(xsltExtMutex); } /** @@ -1351,9 +1395,13 @@ xsltRegisterExtModuleFunction(const xmlChar * name, const xmlChar * URI, if (xsltFunctionsHash == NULL) return (-1); + xmlMutexLock(xsltExtMutex); + xmlHashUpdateEntry2(xsltFunctionsHash, name, URI, XML_CAST_FPTR(function), NULL); + xmlMutexUnlock(xsltExtMutex); + return (0); } @@ -1374,13 +1422,21 @@ xsltExtModuleFunctionLookup(const xmlChar * name, const xmlChar * URI) if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL)) return (NULL); + xmlMutexLock(xsltExtMutex); + XML_CAST_FPTR(ret) = xmlHashLookup2(xsltFunctionsHash, name, URI); + xmlMutexUnlock(xsltExtMutex); + /* if lookup fails, attempt a dynamic load on supported platforms */ if (NULL == ret) { if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + XML_CAST_FPTR(ret) = xmlHashLookup2(xsltFunctionsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); } } @@ -1399,10 +1455,18 @@ xsltExtModuleFunctionLookup(const xmlChar * name, const xmlChar * URI) int xsltUnregisterExtModuleFunction(const xmlChar * name, const xmlChar * URI) { + int ret; + if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL)) return (-1); - return xmlHashRemoveEntry2(xsltFunctionsHash, name, URI, NULL); + xmlMutexLock(xsltExtMutex); + + ret = xmlHashRemoveEntry2(xsltFunctionsHash, name, URI, NULL); + + xmlMutexUnlock(xsltExtMutex); + + return(ret); } /** @@ -1413,8 +1477,12 @@ xsltUnregisterExtModuleFunction(const xmlChar * name, const xmlChar * URI) static void xsltUnregisterAllExtModuleFunction(void) { + xmlMutexLock(xsltExtMutex); + xmlHashFree(xsltFunctionsHash, NULL); xsltFunctionsHash = NULL; + + xmlMutexUnlock(xsltExtMutex); } @@ -1494,8 +1562,13 @@ xsltPreComputeExtModuleElement(xsltStylesheetPtr style, xmlNodePtr inst) (inst->type != XML_ELEMENT_NODE) || (inst->ns == NULL)) return (NULL); + xmlMutexLock(xsltExtMutex); + ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, inst->name, inst->ns->href); + + xmlMutexUnlock(xsltExtMutex); + /* * EXT TODO: Now what? */ @@ -1549,6 +1622,8 @@ xsltRegisterExtModuleElement(const xmlChar * name, const xmlChar * URI, xsltPreComputeFunction precomp, xsltTransformFunction transform) { + int ret; + xsltExtElementPtr ext; if ((name == NULL) || (URI == NULL) || (transform == NULL)) @@ -1559,13 +1634,20 @@ xsltRegisterExtModuleElement(const xmlChar * name, const xmlChar * URI, if (xsltElementsHash == NULL) return (-1); + xmlMutexLock(xsltExtMutex); + ext = xsltNewExtElement(precomp, transform); - if (ext == NULL) - return (-1); + if (ext == NULL) { + ret = -1; + goto done; + } xmlHashUpdateEntry2(xsltElementsHash, name, URI, (void *) ext, (xmlHashDeallocator) xsltFreeExtElement); +done: + xmlMutexUnlock(xsltExtMutex); + return (0); } @@ -1591,10 +1673,14 @@ xsltExtElementLookup(xsltTransformContextPtr ctxt, if ((ctxt != NULL) && (ctxt->extElements != NULL)) { XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->extElements, name, URI); - if (ret != NULL) - return (ret); + if (ret != NULL) { + return(ret); + } } - return xsltExtModuleElementLookup(name, URI); + + ret = xsltExtModuleElementLookup(name, URI); + + return (ret); } /** @@ -1614,14 +1700,24 @@ xsltExtModuleElementLookup(const xmlChar * name, const xmlChar * URI) if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL)) return (NULL); + xmlMutexLock(xsltExtMutex); + ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI); - /* if function lookup fails, attempt a dynamic load on supported platforms */ - ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI); + xmlMutexUnlock(xsltExtMutex); + + /* + * if function lookup fails, attempt a dynamic load on + * supported platforms + */ if (NULL == ext) { if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); } } @@ -1648,12 +1744,20 @@ xsltExtModuleElementPreComputeLookup(const xmlChar * name, if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL)) return (NULL); + xmlMutexLock(xsltExtMutex); + ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI); + xmlMutexUnlock(xsltExtMutex); + if (ext == NULL) { if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); } } @@ -1674,11 +1778,19 @@ xsltExtModuleElementPreComputeLookup(const xmlChar * name, int xsltUnregisterExtModuleElement(const xmlChar * name, const xmlChar * URI) { + int ret; + if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL)) return (-1); - return xmlHashRemoveEntry2(xsltElementsHash, name, URI, - (xmlHashDeallocator) xsltFreeExtElement); + xmlMutexLock(xsltExtMutex); + + ret = xmlHashRemoveEntry2(xsltElementsHash, name, URI, + (xmlHashDeallocator) xsltFreeExtElement); + + xmlMutexUnlock(xsltExtMutex); + + return(ret); } /** @@ -1689,8 +1801,12 @@ xsltUnregisterExtModuleElement(const xmlChar * name, const xmlChar * URI) static void xsltUnregisterAllExtModuleElement(void) { + xmlMutexLock(xsltExtMutex); + xmlHashFree(xsltElementsHash, (xmlHashDeallocator) xsltFreeExtElement); xsltElementsHash = NULL; + + xmlMutexUnlock(xsltExtMutex); } /** @@ -1715,9 +1831,13 @@ xsltRegisterExtModuleTopLevel(const xmlChar * name, const xmlChar * URI, if (xsltTopLevelsHash == NULL) return (-1); + xmlMutexLock(xsltExtMutex); + xmlHashUpdateEntry2(xsltTopLevelsHash, name, URI, XML_CAST_FPTR(function), NULL); + xmlMutexUnlock(xsltExtMutex); + return (0); } @@ -1738,12 +1858,20 @@ xsltExtModuleTopLevelLookup(const xmlChar * name, const xmlChar * URI) if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL)) return (NULL); + xmlMutexLock(xsltExtMutex); + XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI); + xmlMutexUnlock(xsltExtMutex); + /* if lookup fails, attempt a dynamic load on supported platforms */ if (NULL == ret) { if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); } } @@ -1762,10 +1890,18 @@ xsltExtModuleTopLevelLookup(const xmlChar * name, const xmlChar * URI) int xsltUnregisterExtModuleTopLevel(const xmlChar * name, const xmlChar * URI) { + int ret; + if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL)) return (-1); - return xmlHashRemoveEntry2(xsltTopLevelsHash, name, URI, NULL); + xmlMutexLock(xsltExtMutex); + + ret = xmlHashRemoveEntry2(xsltTopLevelsHash, name, URI, NULL); + + xmlMutexUnlock(xsltExtMutex); + + return(ret); } /** @@ -1776,8 +1912,12 @@ xsltUnregisterExtModuleTopLevel(const xmlChar * name, const xmlChar * URI) static void xsltUnregisterAllExtModuleTopLevel(void) { + xmlMutexLock(xsltExtMutex); + xmlHashFree(xsltTopLevelsHash, NULL); xsltTopLevelsHash = NULL; + + xmlMutexUnlock(xsltExtMutex); } /** @@ -2088,6 +2228,7 @@ xsltExtStyleShutdownTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, void xsltRegisterTestModule(void) { + xsltInitGlobals(); xsltRegisterExtModuleFull((const xmlChar *) XSLT_DEFAULT_URL, xsltExtInitTest, xsltExtShutdownTest, xsltExtStyleInitTest, @@ -2102,7 +2243,8 @@ xsltRegisterTestModule(void) } static void -xsltHashScannerModuleFree(void *payload, void *data ATTRIBUTE_UNUSED, +xsltHashScannerModuleFree(void *payload ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, xmlChar * name ATTRIBUTE_UNUSED) { #ifdef WITH_MODULES @@ -2110,6 +2252,19 @@ xsltHashScannerModuleFree(void *payload, void *data ATTRIBUTE_UNUSED, #endif } +/** + * xsltInitGlobals: + * + * Initialize the global variables for extensions + */ +void +xsltInitGlobals(void) +{ + if (xsltExtMutex == NULL) { + xsltExtMutex = xmlNewMutex(); + } +} + /** * xsltCleanupGlobals: * @@ -2123,13 +2278,17 @@ xsltCleanupGlobals(void) xsltUnregisterAllExtModuleElement(); xsltUnregisterAllExtModuleTopLevel(); + xmlMutexLock(xsltExtMutex); /* cleanup dynamic module hash */ if (NULL != xsltModuleHash) { xmlHashScan(xsltModuleHash, xsltHashScannerModuleFree, 0); xmlHashFree(xsltModuleHash, NULL); xsltModuleHash = NULL; } + xmlMutexUnlock(xsltExtMutex); + xmlFreeMutex(xsltExtMutex); + xsltExtMutex = NULL; xsltUninit(); } @@ -2172,25 +2331,31 @@ xsltDebugDumpExtensions(FILE * output) fprintf(output, "No registered extension functions\n"); else { fprintf(output, "Registered Extension Functions:\n"); + xmlMutexLock(xsltExtMutex); xmlHashScanFull(xsltFunctionsHash, (xmlHashScannerFull) xsltDebugDumpExtensionsCallback, output); + xmlMutexUnlock(xsltExtMutex); } if (!xsltElementsHash) fprintf(output, "\nNo registered extension elements\n"); else { fprintf(output, "\nRegistered Extension Elements:\n"); + xmlMutexLock(xsltExtMutex); xmlHashScanFull(xsltElementsHash, (xmlHashScannerFull) xsltDebugDumpExtensionsCallback, output); + xmlMutexUnlock(xsltExtMutex); } if (!xsltExtensionsHash) fprintf(output, "\nNo registered extension modules\n"); else { fprintf(output, "\nRegistered Extension Modules:\n"); + xmlMutexLock(xsltExtMutex); xmlHashScanFull(xsltExtensionsHash, (xmlHashScannerFull) xsltDebugDumpExtModulesCallback, output); + xmlMutexUnlock(xsltExtMutex); } } diff --git a/reactos/dll/3rdparty/libxslt/extensions.h b/reactos/dll/3rdparty/libxslt/extensions.h index 30b7d4c1cab..900779c34c0 100644 --- a/reactos/dll/3rdparty/libxslt/extensions.h +++ b/reactos/dll/3rdparty/libxslt/extensions.h @@ -23,6 +23,16 @@ extern "C" { * Extension Modules API. */ +/** + * xsltInitGlobals: + * + * Initialize the global variables for extensions + * + */ + +XSLTPUBFUN void XSLTCALL + xsltInitGlobals (void); + /** * xsltStyleExtInitFunction: * @ctxt: an XSLT stylesheet @@ -86,11 +96,11 @@ XSLTPUBFUN int XSLTCALL XSLTPUBFUN int XSLTCALL xsltUnregisterExtModule (const xmlChar * URI); -XSLTPUBFUN void * XSLTCALL +XSLTPUBFUN void * XSLTCALL xsltGetExtData (xsltTransformContextPtr ctxt, const xmlChar *URI); -XSLTPUBFUN void * XSLTCALL +XSLTPUBFUN void * XSLTCALL xsltStyleGetExtData (xsltStylesheetPtr style, const xmlChar *URI); #ifdef XSLT_REFACTORED @@ -99,33 +109,29 @@ XSLTPUBFUN void * XSLTCALL xsltStylesheetPtr style, const xmlChar * URI); #endif -XSLTPUBFUN void XSLTCALL - xsltShutdownCtxtExts (xsltTransformContextPtr ctxt); +XSLTPUBFUN void XSLTCALL + xsltShutdownCtxtExts (xsltTransformContextPtr ctxt); -XSLTPUBFUN void XSLTCALL - xsltShutdownExts (xsltStylesheetPtr style); +XSLTPUBFUN void XSLTCALL + xsltShutdownExts (xsltStylesheetPtr style); -XSLTPUBFUN xsltTransformContextPtr XSLTCALL - xsltXPathGetTransformContext +XSLTPUBFUN xsltTransformContextPtr XSLTCALL + xsltXPathGetTransformContext (xmlXPathParserContextPtr ctxt); /* * extension functions */ -XSLTPUBFUN int XSLTCALL - xsltRegisterExtModuleFunction +XSLTPUBFUN int XSLTCALL + xsltRegisterExtModuleFunction (const xmlChar *name, const xmlChar *URI, xmlXPathFunction function); -XSLTPUBFUN xmlXPathFunction XSLTCALL - xsltExtFunctionLookup (xsltTransformContextPtr ctxt, - const xmlChar *name, - const xmlChar *URI); XSLTPUBFUN xmlXPathFunction XSLTCALL xsltExtModuleFunctionLookup (const xmlChar *name, const xmlChar *URI); -XSLTPUBFUN int XSLTCALL - xsltUnregisterExtModuleFunction +XSLTPUBFUN int XSLTCALL + xsltUnregisterExtModuleFunction (const xmlChar *name, const xmlChar *URI); @@ -133,7 +139,7 @@ XSLTPUBFUN int XSLTCALL * extension elements */ typedef xsltElemPreCompPtr (*xsltPreComputeFunction) - (xsltStylesheetPtr style, + (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function); @@ -141,33 +147,33 @@ XSLTPUBFUN xsltElemPreCompPtr XSLTCALL xsltNewElemPreComp (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltInitElemPreComp (xsltElemPreCompPtr comp, xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function, xsltElemPreCompDeallocator freeFunc); -XSLTPUBFUN int XSLTCALL - xsltRegisterExtModuleElement +XSLTPUBFUN int XSLTCALL + xsltRegisterExtModuleElement (const xmlChar *name, const xmlChar *URI, xsltPreComputeFunction precomp, xsltTransformFunction transform); -XSLTPUBFUN xsltTransformFunction XSLTCALL +XSLTPUBFUN xsltTransformFunction XSLTCALL xsltExtElementLookup (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI); -XSLTPUBFUN xsltTransformFunction XSLTCALL +XSLTPUBFUN xsltTransformFunction XSLTCALL xsltExtModuleElementLookup (const xmlChar *name, const xmlChar *URI); -XSLTPUBFUN xsltPreComputeFunction XSLTCALL - xsltExtModuleElementPreComputeLookup +XSLTPUBFUN xsltPreComputeFunction XSLTCALL + xsltExtModuleElementPreComputeLookup (const xmlChar *name, const xmlChar *URI); -XSLTPUBFUN int XSLTCALL - xsltUnregisterExtModuleElement +XSLTPUBFUN int XSLTCALL + xsltUnregisterExtModuleElement (const xmlChar *name, const xmlChar *URI); @@ -177,28 +183,28 @@ XSLTPUBFUN int XSLTCALL typedef void (*xsltTopLevelFunction) (xsltStylesheetPtr style, xmlNodePtr inst); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRegisterExtModuleTopLevel (const xmlChar *name, const xmlChar *URI, xsltTopLevelFunction function); -XSLTPUBFUN xsltTopLevelFunction XSLTCALL - xsltExtModuleTopLevelLookup +XSLTPUBFUN xsltTopLevelFunction XSLTCALL + xsltExtModuleTopLevelLookup (const xmlChar *name, const xmlChar *URI); -XSLTPUBFUN int XSLTCALL - xsltUnregisterExtModuleTopLevel +XSLTPUBFUN int XSLTCALL + xsltUnregisterExtModuleTopLevel (const xmlChar *name, const xmlChar *URI); /* These 2 functions are deprecated for use within modules. */ -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRegisterExtFunction (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xmlXPathFunction function); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRegisterExtElement (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, @@ -209,24 +215,24 @@ XSLTPUBFUN int XSLTCALL * Those are used by the XSLT (pre)processor. */ -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRegisterExtPrefix (xsltStylesheetPtr style, const xmlChar *prefix, const xmlChar *URI); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltCheckExtPrefix (xsltStylesheetPtr style, const xmlChar *URI); XSLTPUBFUN int XSLTCALL xsltCheckExtURI (xsltStylesheetPtr style, const xmlChar *URI); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltInitCtxtExts (xsltTransformContextPtr ctxt); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeCtxtExts (xsltTransformContextPtr ctxt); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeExts (xsltStylesheetPtr style); -XSLTPUBFUN xsltElemPreCompPtr XSLTCALL +XSLTPUBFUN xsltElemPreCompPtr XSLTCALL xsltPreComputeExtModuleElement (xsltStylesheetPtr style, xmlNodePtr inst); @@ -235,16 +241,16 @@ XSLTPUBFUN xsltElemPreCompPtr XSLTCALL * Used by exslt initialisation */ -XSLTPUBFUN xmlHashTablePtr XSLTCALL - xsltGetExtInfo (xsltStylesheetPtr style, +XSLTPUBFUN xmlHashTablePtr XSLTCALL + xsltGetExtInfo (xsltStylesheetPtr style, const xmlChar *URI); /** * Test module http://xmlsoft.org/XSLT/ */ -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltRegisterTestModule (void); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltDebugDumpExtensions (FILE * output); diff --git a/reactos/dll/3rdparty/libxslt/extra.c b/reactos/dll/3rdparty/libxslt/extra.c index 9128ab4c655..3a0f547c05d 100644 --- a/reactos/dll/3rdparty/libxslt/extra.c +++ b/reactos/dll/3rdparty/libxslt/extra.c @@ -15,7 +15,6 @@ #include #ifdef HAVE_TIME_H -#define __USE_XOPEN #include #endif #ifdef HAVE_STDLIB_H @@ -199,7 +198,7 @@ xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) { str = (char *) obj->stringval; - /* str = "$Date: 2002-10-15 18:06:47 +0200 (Tue, 15 Oct 2002) $" */ + /* str = "$Date$" */ memset(digits, 0, sizeof(digits)); strncpy(digits, str+7, 4); field = strtol(digits, NULL, 10); diff --git a/reactos/dll/3rdparty/libxslt/functions.c b/reactos/dll/3rdparty/libxslt/functions.c index 7ae24999873..4720c7a34b2 100644 --- a/reactos/dll/3rdparty/libxslt/functions.c +++ b/reactos/dll/3rdparty/libxslt/functions.c @@ -813,6 +813,7 @@ xsltElementAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){ ctxt->error = XPATH_INVALID_ARITY; return; } + xmlXPathStringFunction(ctxt, 1); if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, "element-available() : invalid arg expecting a string\n"); @@ -878,6 +879,7 @@ xsltFunctionAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){ ctxt->error = XPATH_INVALID_ARITY; return; } + xmlXPathStringFunction(ctxt, 1); if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, "function-available() : invalid arg expecting a string\n"); diff --git a/reactos/dll/3rdparty/libxslt/imports.c b/reactos/dll/3rdparty/libxslt/imports.c index 8ff9f3d837f..23538abf51a 100644 --- a/reactos/dll/3rdparty/libxslt/imports.c +++ b/reactos/dll/3rdparty/libxslt/imports.c @@ -348,6 +348,11 @@ xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node) { if (node->ns != NULL) { val = (const xmlChar *) xmlHashLookup2(style->stripSpaces, node->name, node->ns->href); + if (val == NULL) { + val = (const xmlChar *) + xmlHashLookup2(style->stripSpaces, BAD_CAST "*", + node->ns->href); + } } else { val = (const xmlChar *) xmlHashLookup2(style->stripSpaces, node->name, NULL); @@ -357,7 +362,7 @@ xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node) { return(1); if (xmlStrEqual(val, (xmlChar *) "preserve")) return(0); - } + } if (style->stripAll == 1) return(1); if (style->stripAll == -1) diff --git a/reactos/dll/3rdparty/libxslt/keys.c b/reactos/dll/3rdparty/libxslt/keys.c index 583495d602d..d28aea67999 100644 --- a/reactos/dll/3rdparty/libxslt/keys.c +++ b/reactos/dll/3rdparty/libxslt/keys.c @@ -504,7 +504,7 @@ fprintf(stderr, "xsltInitDocKeyTable %s\n", name); XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, "xsltInitDocKeyTable: did not found %s\n", name)); #endif - xsltTransformError(ctxt, NULL, keyd->inst, + xsltTransformError(ctxt, NULL, keyd? keyd->inst : NULL, "Failed to find key definition for %s\n", name); ctxt->state = XSLT_STATE_STOPPED; return(-1); @@ -517,10 +517,13 @@ fprintf(stderr, "xsltInitDocKeyTable %s done\n", name); /** * xsltInitAllDocKeys: + * @ctxt: transformation context * * INTERNAL ROUTINE ONLY * * Check if any keys on the current document need to be computed + * + * Returns 0 in case of success, -1 in case of failure */ int xsltInitAllDocKeys(xsltTransformContextPtr ctxt) diff --git a/reactos/dll/3rdparty/libxslt/libxslt.h b/reactos/dll/3rdparty/libxslt/libxslt.h index 903f900c828..2b9f52a9fd5 100644 --- a/reactos/dll/3rdparty/libxslt/libxslt.h +++ b/reactos/dll/3rdparty/libxslt/libxslt.h @@ -16,7 +16,7 @@ #include "config.h" #endif -#include "xsltconfig.h" +#include #include #if !defined LIBXSLT_PUBLIC diff --git a/reactos/dll/3rdparty/libxslt/libxslt.rbuild b/reactos/dll/3rdparty/libxslt/libxslt.rbuild index 5d14e2121fd..e86b13ec2c4 100644 --- a/reactos/dll/3rdparty/libxslt/libxslt.rbuild +++ b/reactos/dll/3rdparty/libxslt/libxslt.rbuild @@ -30,5 +30,6 @@ transform.c variables.c xslt.c + xsltlocale.c xsltutils.c diff --git a/reactos/dll/3rdparty/libxslt/namespaces.c b/reactos/dll/3rdparty/libxslt/namespaces.c index b147df8f1df..3e3891fb2a2 100644 --- a/reactos/dll/3rdparty/libxslt/namespaces.c +++ b/reactos/dll/3rdparty/libxslt/namespaces.c @@ -584,6 +584,10 @@ declare_new_prefix: xmlChar pref[30]; int counter = 1; + if (nsPrefix == NULL) { + nsPrefix = "ns"; + } + do { snprintf((char *) pref, 30, "%s_%d", nsPrefix, counter++); ns = xmlSearchNs(target->doc, target, BAD_CAST pref); diff --git a/reactos/dll/3rdparty/libxslt/pattern.c b/reactos/dll/3rdparty/libxslt/pattern.c index 419fa3db5e6..8ce74e33cdb 100644 --- a/reactos/dll/3rdparty/libxslt/pattern.c +++ b/reactos/dll/3rdparty/libxslt/pattern.c @@ -46,7 +46,6 @@ typedef enum { XSLT_OP_END=0, XSLT_OP_ROOT, XSLT_OP_ELEM, - XSLT_OP_CHILD, XSLT_OP_ATTR, XSLT_OP_PARENT, XSLT_OP_ANCESTOR, @@ -61,6 +60,11 @@ typedef enum { XSLT_OP_PREDICATE } xsltOp; +typedef enum { + AXIS_CHILD=1, + AXIS_ATTRIBUTE +} xsltAxis; + typedef struct _xsltStepState xsltStepState; typedef xsltStepState *xsltStepStatePtr; struct _xsltStepState { @@ -697,32 +701,6 @@ restart: goto rollback; } continue; - case XSLT_OP_CHILD: { - xmlNodePtr lst; - - if ((node->type != XML_ELEMENT_NODE) && - (node->type != XML_DOCUMENT_NODE) && -#ifdef LIBXML_DOCB_ENABLED - (node->type != XML_DOCB_DOCUMENT_NODE) && -#endif - (node->type != XML_HTML_DOCUMENT_NODE)) - goto rollback; - - lst = node->children; - - if (step->value != NULL) { - while (lst != NULL) { - if ((lst->type == XML_ELEMENT_NODE) && - (step->value[0] == lst->name[0]) && - (xmlStrEqual(step->value, lst->name))) - break; - lst = lst->next; - } - if (lst != NULL) - continue; - } - goto rollback; - } case XSLT_OP_ATTR: if (node->type != XML_ATTRIBUTE_NODE) goto rollback; @@ -984,8 +962,10 @@ restart: /* * recompute the index */ - xmlNodePtr siblings = node->parent->children; xmlNodePtr parent = node->parent; + xmlNodePtr siblings = NULL; + + if (parent) siblings = parent->children; while (siblings != NULL) { if (siblings->type == XML_ELEMENT_NODE) { @@ -1088,8 +1068,10 @@ restart: /* * recompute the index */ - xmlNodePtr siblings = node->parent->children; xmlNodePtr parent = node->parent; + xmlNodePtr siblings = NULL; + + if (parent) siblings = parent->children; while (siblings != NULL) { if (siblings->type == XML_ELEMENT_NODE) { @@ -1325,46 +1307,6 @@ xsltScanLiteral(xsltParserContextPtr ctxt) { return(ret); } -/** - * xsltScanName: - * @ctxt: the XPath Parser context - * - * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | - * CombiningChar | Extender - * - * [5] Name ::= (Letter | '_' | ':') (NameChar)* - * - * [6] Names ::= Name (S Name)* - * - * Returns the Name parsed or NULL - */ - -static xmlChar * -xsltScanName(xsltParserContextPtr ctxt) { - const xmlChar *q, *cur; - xmlChar *ret = NULL; - int val, len; - - SKIP_BLANKS; - - cur = q = CUR_PTR; - val = xmlStringCurrentChar(NULL, cur, &len); - if (!IS_LETTER(val) && (val != '_') && (val != ':')) - return(NULL); - - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { - cur += len; - val = xmlStringCurrentChar(NULL, cur, &len); - } - ret = xmlStrndup(q, cur - q); - CUR_PTR = cur; - return(ret); -} - /** * xsltScanNCName: * @ctxt: the XPath Parser context @@ -1400,30 +1342,6 @@ xsltScanNCName(xsltParserContextPtr ctxt) { return(ret); } -/** - * xsltScanQName: - * @ctxt: the XPath Parser context - * @prefix: the place to store the prefix - * - * Parse a qualified name - * - * Returns the Name parsed or NULL - */ - -static xmlChar * -xsltScanQName(xsltParserContextPtr ctxt, xmlChar **prefix) { - xmlChar *ret = NULL; - - *prefix = NULL; - ret = xsltScanNCName(ctxt); - if (CUR == ':') { - *prefix = ret; - NEXT; - ret = xsltScanNCName(ctxt); - } - return(ret); -} - /* * xsltCompileIdKeyPattern: * @ctxt: the compilation context @@ -1443,7 +1361,7 @@ xsltScanQName(xsltParserContextPtr ctxt, xmlChar **prefix) { */ static void xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name, - int aid, int novar) { + int aid, int novar, xsltAxis axis) { xmlChar *lit = NULL; xmlChar *lit2 = NULL; @@ -1454,6 +1372,12 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name, return; } if ((aid) && (xmlStrEqual(name, (const xmlChar *)"id"))) { + if (axis != 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : NodeTest expected\n"); + ctxt->error = 1; + return; + } NEXT; SKIP_BLANKS; lit = xsltScanLiteral(ctxt); @@ -1469,6 +1393,12 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name, NEXT; PUSH(XSLT_OP_ID, lit, NULL, novar); } else if ((aid) && (xmlStrEqual(name, (const xmlChar *)"key"))) { + if (axis != 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : NodeTest expected\n"); + ctxt->error = 1; + return; + } NEXT; SKIP_BLANKS; lit = xsltScanLiteral(ctxt); @@ -1545,7 +1475,12 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name, return; } NEXT; - PUSH(XSLT_OP_NODE, NULL, NULL, novar); + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, NULL, NULL, novar); + } + else { + PUSH(XSLT_OP_NODE, NULL, NULL, novar); + } } else if (aid) { xsltTransformError(NULL, NULL, NULL, "xsltCompileIdKeyPattern : expecting 'key' or 'id' or node type\n"); @@ -1590,51 +1525,25 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { const xmlChar *URI = NULL; xmlChar *URL = NULL; int level; + xsltAxis axis = 0; SKIP_BLANKS; if ((token == NULL) && (CUR == '@')) { - xmlChar *prefix = NULL; - NEXT; - if (CUR == '*') { - NEXT; - PUSH(XSLT_OP_ATTR, NULL, NULL, novar); - goto parse_predicate; - } - token = xsltScanQName(ctxt, &prefix); - if (prefix != NULL) { - xmlNsPtr ns; - - ns = xmlSearchNs(ctxt->doc, ctxt->elem, prefix); - if (ns == NULL) { - xsltTransformError(NULL, NULL, NULL, - "xsltCompileStepPattern : no namespace bound to prefix %s\n", - prefix); - } else { - URL = xmlStrdup(ns->href); - } - xmlFree(prefix); - } - if (token == NULL) { - if (CUR == '*') { - NEXT; - PUSH(XSLT_OP_ATTR, NULL, URL, novar); - return; - } - xsltTransformError(NULL, NULL, NULL, - "xsltCompileStepPattern : Name expected\n"); - ctxt->error = 1; - goto error; - } - PUSH(XSLT_OP_ATTR, token, URL, novar); - goto parse_predicate; + axis = AXIS_ATTRIBUTE; } +parse_node_test: if (token == NULL) - token = xsltScanName(ctxt); + token = xsltScanNCName(ctxt); if (token == NULL) { if (CUR == '*') { NEXT; - PUSH(XSLT_OP_ALL, token, NULL, novar); + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, NULL, NULL, novar); + } + else { + PUSH(XSLT_OP_ALL, NULL, NULL, novar); + } goto parse_predicate; } else { xsltTransformError(NULL, NULL, NULL, @@ -1647,7 +1556,7 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { SKIP_BLANKS; if (CUR == '(') { - xsltCompileIdKeyPattern(ctxt, token, 0, novar); + xsltCompileIdKeyPattern(ctxt, token, 0, novar, axis); if (ctxt->error) goto error; } else if (CUR == ':') { @@ -1659,12 +1568,13 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { /* * This is a namespace match */ - token = xsltScanName(ctxt); + token = xsltScanNCName(ctxt); ns = xmlSearchNs(ctxt->doc, ctxt->elem, prefix); if (ns == NULL) { xsltTransformError(NULL, NULL, NULL, "xsltCompileStepPattern : no namespace bound to prefix %s\n", prefix); + xmlFree(prefix); ctxt->error = 1; goto error; } else { @@ -1674,7 +1584,12 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { if (token == NULL) { if (CUR == '*') { NEXT; - PUSH(XSLT_OP_NS, URL, NULL, novar); + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, NULL, URL, novar); + } + else { + PUSH(XSLT_OP_NS, URL, NULL, novar); + } } else { xsltTransformError(NULL, NULL, NULL, "xsltCompileStepPattern : Name expected\n"); @@ -1682,54 +1597,25 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { goto error; } } else { - PUSH(XSLT_OP_ELEM, token, URL, novar); + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, token, URL, novar); + } + else { + PUSH(XSLT_OP_ELEM, token, URL, novar); + } } } else { + if (axis != 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileStepPattern : NodeTest expected\n"); + ctxt->error = 1; + goto error; + } NEXT; if (xmlStrEqual(token, (const xmlChar *) "child")) { - xmlFree(token); - token = xsltScanName(ctxt); - if (token == NULL) { - if (CUR == '*') { - NEXT; - PUSH(XSLT_OP_ALL, token, NULL, novar); - goto parse_predicate; - } else { - xsltTransformError(NULL, NULL, NULL, - "xsltCompileStepPattern : QName expected\n"); - ctxt->error = 1; - goto error; - } - } - URI = xsltGetQNameURI(ctxt->elem, &token); - if (token == NULL) { - ctxt->error = 1; - goto error; - } else { - name = xmlStrdup(token); - if (URI != NULL) - URL = xmlStrdup(URI); - } - PUSH(XSLT_OP_CHILD, name, URL, novar); + axis = AXIS_CHILD; } else if (xmlStrEqual(token, (const xmlChar *) "attribute")) { - xmlFree(token); - token = xsltScanName(ctxt); - if (token == NULL) { - xsltTransformError(NULL, NULL, NULL, - "xsltCompileStepPattern : QName expected\n"); - ctxt->error = 1; - goto error; - } - URI = xsltGetQNameURI(ctxt->elem, &token); - if (token == NULL) { - ctxt->error = 1; - goto error; - } else { - name = xmlStrdup(token); - if (URI != NULL) - URL = xmlStrdup(URI); - } - PUSH(XSLT_OP_ATTR, name, URL, novar); + axis = AXIS_ATTRIBUTE; } else { xsltTransformError(NULL, NULL, NULL, "xsltCompileStepPattern : 'child' or 'attribute' expected\n"); @@ -1737,10 +1623,10 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { goto error; } xmlFree(token); + SKIP_BLANKS; + token = xsltScanNCName(ctxt); + goto parse_node_test; } - } else if (CUR == '*') { - NEXT; - PUSH(XSLT_OP_ALL, token, NULL, novar); } else { URI = xsltGetQNameURI(ctxt->elem, &token); if (token == NULL) { @@ -1749,7 +1635,12 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { } if (URI != NULL) URL = xmlStrdup(URI); - PUSH(XSLT_OP_ELEM, token, URL, novar); + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, token, URL, novar); + } + else { + PUSH(XSLT_OP_ELEM, token, URL, novar); + } } parse_predicate: SKIP_BLANKS; @@ -1886,7 +1777,7 @@ xsltCompileLocationPathPattern(xsltParserContextPtr ctxt, int novar) { xsltCompileRelativePathPattern(ctxt, NULL, novar); } else { xmlChar *name; - name = xsltScanName(ctxt); + name = xsltScanNCName(ctxt); if (name == NULL) { xsltTransformError(NULL, NULL, NULL, "xsltCompileLocationPathPattern : Name expected\n"); @@ -1895,7 +1786,7 @@ xsltCompileLocationPathPattern(xsltParserContextPtr ctxt, int novar) { } SKIP_BLANKS; if ((CUR == '(') && !xmlXPathIsNodeType(name)) { - xsltCompileIdKeyPattern(ctxt, name, 1, novar); + xsltCompileIdKeyPattern(ctxt, name, 1, novar, 0); if ((CUR == '/') && (NXT(1) == '/')) { PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar); NEXT; @@ -2173,7 +2064,6 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, else top = &(style->attrMatch); break; - case XSLT_OP_CHILD: case XSLT_OP_PARENT: case XSLT_OP_ANCESTOR: top = &(style->elemMatch); diff --git a/reactos/dll/3rdparty/libxslt/preproc.c b/reactos/dll/3rdparty/libxslt/preproc.c index 28423705024..b47d8099005 100644 --- a/reactos/dll/3rdparty/libxslt/preproc.c +++ b/reactos/dll/3rdparty/libxslt/preproc.c @@ -82,7 +82,7 @@ xsltCheckTopLevelElement(xsltStylesheetPtr style, xmlNodePtr inst, int err) { } return(0); } - if ((parent->ns == NULL) || + if ((parent->ns == NULL) || (parent->type != XML_ELEMENT_NODE) || ((parent->ns != inst->ns) && (!xmlStrEqual(parent->ns->href, inst->ns->href))) || ((!xmlStrEqual(parent->name, BAD_CAST "stylesheet")) && @@ -391,6 +391,8 @@ xsltFreeStylePreComp(xsltStylePreCompPtr comp) { break; case XSLT_FUNC_SORT: { xsltStyleItemSortPtr item = (xsltStyleItemSortPtr) comp; + if (item->locale != (xsltLocale)0) + xsltFreeLocale(item->locale); if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } @@ -487,6 +489,8 @@ xsltFreeStylePreComp(xsltStylePreCompPtr comp) { break; } #else + if (comp->locale != (xsltLocale)0) + xsltFreeLocale(comp->locale); if (comp->comp != NULL) xmlXPathFreeCompExpr(comp->comp); if (comp->nsList != NULL) @@ -728,6 +732,12 @@ xsltSortComp(xsltStylesheetPtr style, xmlNodePtr inst) { comp->lang = xsltEvalStaticAttrValueTemplate(style, inst, (const xmlChar *)"lang", NULL, &comp->has_lang); + if (comp->lang != NULL) { + comp->locale = xsltNewLocale(comp->lang); + } + else { + comp->locale = (xsltLocale)0; + } comp->select = xsltGetCNsProp(style, inst,(const xmlChar *)"select", XSLT_NAMESPACE); if (comp->select == NULL) { diff --git a/reactos/dll/3rdparty/libxslt/security.c b/reactos/dll/3rdparty/libxslt/security.c index 4130729e9de..b766cf7f979 100644 --- a/reactos/dll/3rdparty/libxslt/security.c +++ b/reactos/dll/3rdparty/libxslt/security.c @@ -58,6 +58,7 @@ #include "xslt.h" #include "xsltInternals.h" #include "xsltutils.h" +#include "extensions.h" #include "security.h" @@ -88,6 +89,8 @@ xsltSecurityPrefsPtr xsltNewSecurityPrefs(void) { xsltSecurityPrefsPtr ret; + xsltInitGlobals(); + ret = (xsltSecurityPrefsPtr) xmlMalloc(sizeof(xsltSecurityPrefs)); if (ret == NULL) { xsltTransformError(NULL, NULL, NULL, @@ -124,6 +127,7 @@ xsltFreeSecurityPrefs(xsltSecurityPrefsPtr sec) { int xsltSetSecurityPrefs(xsltSecurityPrefsPtr sec, xsltSecurityOption option, xsltSecurityCheck func) { + xsltInitGlobals(); if (sec == NULL) return(-1); switch (option) { @@ -177,6 +181,7 @@ xsltGetSecurityPrefs(xsltSecurityPrefsPtr sec, xsltSecurityOption option) { */ void xsltSetDefaultSecurityPrefs(xsltSecurityPrefsPtr sec) { + xsltDefaultSecurityPrefs = sec; } diff --git a/reactos/dll/3rdparty/libxslt/templates.c b/reactos/dll/3rdparty/libxslt/templates.c index 8d26a8a9922..c6250dc4e1f 100644 --- a/reactos/dll/3rdparty/libxslt/templates.c +++ b/reactos/dll/3rdparty/libxslt/templates.c @@ -637,7 +637,7 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, last = last->next; } else { last = NULL; - } + } attr = attrs; do { /* @@ -719,20 +719,20 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, copyNs = NULL; } copy->ns = copyNs; - + /* * Set the value. - */ + */ text = xmlNewText(NULL); if (text != NULL) { copy->last = copy->children = text; text->parent = (xmlNodePtr) copy; text->doc = copy->doc; - + if (attr->psvi != NULL) { /* * Evaluate the Attribute Value Template. - */ + */ valueAVT = xsltEvalAVT(ctxt, attr->psvi, attr->parent); if (valueAVT == NULL) { /* @@ -743,7 +743,7 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, xsltTransformError(ctxt, NULL, attr->parent, "Internal error: Failed to evaluate the AVT " "of attribute '{%s}%s'.\n", - attr->ns->href, attr->name); + attr->ns->href, attr->name); } else { xsltTransformError(ctxt, NULL, attr->parent, "Internal error: Failed to evaluate the AVT " @@ -763,6 +763,9 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, } else { text->content = xmlStrdup(value); } + if ((copy != NULL) && (text != NULL) && + (xmlIsID(copy->doc, copy->parent, copy))) + xmlAddID(NULL, copy->doc, text->content, copy); } next_attribute: diff --git a/reactos/dll/3rdparty/libxslt/transform.c b/reactos/dll/3rdparty/libxslt/transform.c index da375036391..a4ca41df380 100644 --- a/reactos/dll/3rdparty/libxslt/transform.c +++ b/reactos/dll/3rdparty/libxslt/transform.c @@ -190,7 +190,7 @@ xsltLocalVariablePop(xsltTransformContextPtr ctxt, int limitNr, int level) break; variable = ctxt->varsTab[ctxt->varsNr - 1]; if (variable->level <= level) - break; + break; if (variable->level >= 0) xsltFreeStackElemList(variable); ctxt->varsNr--; @@ -205,12 +205,12 @@ xsltLocalVariablePop(xsltTransformContextPtr ctxt, int limitNr, int level) * xsltTemplateParamsCleanup: * * Removes xsl:param and xsl:with-param items from the - * variable-stack. Only xsl:with-param items are not freed. + * variable-stack. Only xsl:with-param items are not freed. */ static void xsltTemplateParamsCleanup(xsltTransformContextPtr ctxt) { - xsltStackElemPtr param; + xsltStackElemPtr param; for (; ctxt->varsNr > ctxt->varsBase; ctxt->varsNr--) { param = ctxt->varsTab[ctxt->varsNr -1]; @@ -218,10 +218,10 @@ xsltTemplateParamsCleanup(xsltTransformContextPtr ctxt) * Free xsl:param items. * xsl:with-param items will have a level of -1 or -2. */ - if (param->level >= 0) { + if (param->level >= 0) { xsltFreeStackElemList(param); - } - } + } + } if (ctxt->varsNr > 0) ctxt->vars = ctxt->varsTab[ctxt->varsNr - 1]; else @@ -352,7 +352,7 @@ static xsltTransformCachePtr xsltTransformCacheCreate(void) { xsltTransformCachePtr ret; - + ret = (xsltTransformCachePtr) xmlMalloc(sizeof(xsltTransformCache)); if (ret == NULL) { xsltTransformError(NULL, NULL, NULL, @@ -365,9 +365,9 @@ xsltTransformCacheCreate(void) static void xsltTransformCacheFree(xsltTransformCachePtr cache) -{ +{ if (cache == NULL) - return; + return; /* * Free tree fragments. */ @@ -419,6 +419,8 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) { xsltDocumentPtr docu; int i; + xsltInitGlobals(); + cur = (xsltTransformContextPtr) xmlMalloc(sizeof(xsltTransformContext)); if (cur == NULL) { xsltTransformError(NULL, NULL, (xmlNodePtr)doc, @@ -496,7 +498,7 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) { */ if (style->extrasNr != 0) { cur->extrasMax = style->extrasNr + 20; - cur->extras = (xsltRuntimeExtraPtr) + cur->extras = (xsltRuntimeExtraPtr) xmlMalloc(cur->extrasMax * sizeof(xsltRuntimeExtra)); if (cur->extras == NULL) { xmlGenericError(xmlGenericErrorContext, @@ -617,6 +619,32 @@ xsltFreeTransformContext(xsltTransformContextPtr ctxt) { xmlNodePtr xsltCopyTree(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr insert, int literal); +/** + * xsltAddChild: + * @parent: the parent node + * @cur: the child node + * + * Wrapper version of xmlAddChild with a more consistent behaviour on + * error. One expect the use to be child = xsltAddChild(parent, child); + * and the routine will take care of not leaking on errors or node merge + * + * Returns the child is successfully attached or NULL if merged or freed + */ +static xmlNodePtr +xsltAddChild(xmlNodePtr parent, xmlNodePtr cur) { + xmlNodePtr ret; + + if ((cur == NULL) || (parent == NULL)) + return(NULL); + if (parent == NULL) { + xmlFreeNode(cur); + return(NULL); + } + ret = xmlAddChild(parent, cur); + + return(ret); +} + /** * xsltAddTextString: * @ctxt: a XSLT process context @@ -709,9 +737,9 @@ xsltCopyTextString(xsltTransformContextPtr ctxt, xmlNodePtr target, len = xmlStrlen(string); if ((ctxt->type == XSLT_OUTPUT_XML) && (ctxt->style->cdataSection != NULL) && - (target != NULL) && + (target != NULL) && (target->type == XML_ELEMENT_NODE) && - (((target->ns == NULL) && + (((target->ns == NULL) && (xmlHashLookup2(ctxt->style->cdataSection, target->name, NULL) != NULL)) || ((target->ns != NULL) && @@ -753,7 +781,7 @@ xsltCopyTextString(xsltTransformContextPtr ctxt, xmlNodePtr target, } if (copy != NULL) { if (target != NULL) - xmlAddChild(target, copy); + copy = xsltAddChild(target, copy); ctxt->lasttext = copy->content; ctxt->lasttsize = len; ctxt->lasttuse = len; @@ -786,7 +814,7 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, if ((cur->type != XML_TEXT_NODE) && (cur->type != XML_CDATA_SECTION_NODE)) return(NULL); - if (cur->content == NULL) + if (cur->content == NULL) return(NULL); #ifdef WITH_XSLT_DEBUG_PROCESS @@ -814,10 +842,10 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, } if ((ctxt->style->cdataSection != NULL) && - (ctxt->type == XSLT_OUTPUT_XML) && + (ctxt->type == XSLT_OUTPUT_XML) && (target != NULL) && (target->type == XML_ELEMENT_NODE) && - (((target->ns == NULL) && + (((target->ns == NULL) && (xmlHashLookup2(ctxt->style->cdataSection, target->name, NULL) != NULL)) || ((target->ns != NULL) && @@ -827,8 +855,8 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, /* * Process "cdata-section-elements". */ - /* - * OPTIMIZE TODO: xsltCopyText() is also used for attribute content. + /* + * OPTIMIZE TODO: xsltCopyText() is also used for attribute content. */ /* * TODO: Since this doesn't merge adjacent CDATA-section nodes, @@ -847,7 +875,7 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, } else { unsigned int len; - len = xmlStrlen(cur->content); + len = xmlStrlen(cur->content); copy = xmlNewCDataBlock(ctxt->output, cur->content, len); if (copy == NULL) goto exit; @@ -873,20 +901,20 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, } else if ((interned) && (target != NULL) && (target->doc != NULL) && (target->doc->dict == ctxt->dict)) - { + { /* * TODO: DO we want to use this also for "text" output? */ copy = xmlNewTextLen(NULL, 0); if (copy == NULL) - goto exit; + goto exit; if (cur->name == xmlStringTextNoenc) copy->name = xmlStringTextNoenc; - + /* * Must confirm that content is in dict (bug 302821) * TODO: This check should be not needed for text coming - * from the stylesheets + * from the stylesheets */ if (xmlDictOwns(ctxt->dict, cur->content)) copy->content = cur->content; @@ -919,7 +947,7 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, * to ensure that the optimized text-merging mechanism * won't interfere with normal node-merging in any case. */ - xmlAddChild(target, copy); + copy = xsltAddChild(target, copy); } } else { xsltTransformError(ctxt, NULL, target, @@ -966,7 +994,7 @@ xsltShallowCopyAttr(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, "Cannot add an attribute node to a non-element node.\n"); return(NULL); } - + if (target->children != NULL) { xsltTransformError(ctxt, NULL, invocNode, "Attribute nodes must be added before " @@ -976,7 +1004,7 @@ xsltShallowCopyAttr(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, value = xmlNodeListGetString(attr->doc, attr->children, 1); if (attr->ns != NULL) { - xmlNsPtr ns; + xmlNsPtr ns; ns = xsltGetSpecialNamespace(ctxt, invocNode, attr->ns->href, attr->ns->prefix, target); @@ -1055,9 +1083,9 @@ xsltCopyAttrListNoOverwrite(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, xmlNodePtr target, xmlAttrPtr attr) { - xmlAttrPtr last = NULL, copy; + xmlAttrPtr copy; xmlNsPtr origNs = NULL, copyNs = NULL; - xmlChar *value = NULL; + xmlChar *value; /* * Don't use xmlCopyProp() here, since it will try to @@ -1082,36 +1110,23 @@ xsltCopyAttrListNoOverwrite(xsltTransformContextPtr ctxt, * If attribute has a value, we need to copy it (watching out * for possible entities) */ - if (attr->children) - value = xmlNodeListGetString(attr->doc, attr->children, 0); - /* - * REVISIT: I think xmlNewDocProp() is the only attr function - * which does not eval if the attr is of type ID. This is good, - * since we don't need this. - */ - copy = xmlNewDocProp(target->doc, attr->name, BAD_CAST value); + if ((attr->children) && (attr->children->type == XML_TEXT_NODE) && + (attr->children->next == NULL)) { + copy = xmlNewNsProp(target, copyNs, attr->name, + attr->children->content); + } else if (attr->children != NULL) { + value = xmlNodeListGetString(attr->doc, attr->children, 1); + copy = xmlNewNsProp(target, copyNs, attr->name, BAD_CAST value); + xmlFree(value); + } else { + copy = xmlNewNsProp(target, copyNs, attr->name, NULL); + } + if (copy == NULL) return(-1); - copy->parent = target; - copy->ns = copyNs; - - if (last == NULL) { - target->properties = copy; - last = copy; - } else { - last->next = copy; - copy->prev = last; - last = copy; - } - /* - * OPTIMIZE TODO: How to avoid this intermediate string? - */ - if (value != NULL) { - xmlFree(value); - value = NULL; - } + attr = attr->next; - } + } return(0); } @@ -1154,7 +1169,7 @@ xsltShallowCopyElem(xsltTransformContextPtr ctxt, xmlNodePtr node, copy = xmlDocCopyNode(node, insert->doc, 0); if (copy != NULL) { copy->doc = ctxt->output; - xmlAddChild(insert, copy); + copy = xsltAddChild(insert, copy); if (node->type == XML_ELEMENT_NODE) { /* @@ -1189,7 +1204,7 @@ xsltShallowCopyElem(xsltTransformContextPtr ctxt, xmlNodePtr node, } else { copy->ns = xsltGetSpecialNamespace(ctxt, node, node->ns->href, node->ns->prefix, copy); - + } } else if ((insert->type == XML_ELEMENT_NODE) && (insert->ns != NULL)) @@ -1281,7 +1296,7 @@ xsltCopyNamespaceListInternal(xmlNodePtr elem, xmlNsPtr ns) { /* * Avoid duplicating namespace declarations on the tree. */ - if (elem != NULL) { + if (elem != NULL) { if ((elem->ns != NULL) && xmlStrEqual(elem->ns->prefix, ns->prefix) && xmlStrEqual(elem->ns->href, ns->href)) @@ -1295,7 +1310,7 @@ xsltCopyNamespaceListInternal(xmlNodePtr elem, xmlNsPtr ns) { ns = ns->next; continue; } - } + } q = xmlNewNs(elem, ns->href, ns->prefix); if (p == NULL) { ret = p = q; @@ -1303,7 +1318,7 @@ xsltCopyNamespaceListInternal(xmlNodePtr elem, xmlNsPtr ns) { p->next = q; p = q; } - ns = ns->next; + ns = ns->next; } while (ns != NULL); return(ret); } @@ -1326,35 +1341,34 @@ xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, xmlNsPtr ns) { /* - * TODO: Contrary to header comments, this is declared as int. + * TODO: Contrary to header comments, this is declared as int. * be modified to return a node pointer, or NULL if any error */ xmlNsPtr tmpns; if ((insert == NULL) || (insert->type != XML_ELEMENT_NODE)) return(NULL); - + if (insert->children != NULL) { xsltTransformError(ctxt, NULL, invocNode, "Namespace nodes must be added before " "any child nodes are added to an element.\n"); return(NULL); } - /* - * - * BIG NOTE: Xalan-J simply overwrites any ns-decls with - * an equal prefix. We definitively won't do that. - * - * MSXML 4.0 and the .NET ignores ns-decls for which an - * equal prefix is already in use. - * - * Saxon raises an error like: - * "net.sf.saxon.xpath.DynamicError: Cannot create two namespace - * nodes with the same name". - * - * NOTE: We'll currently follow MSXML here. - * REVISIT TODO: Check if it's better to follow Saxon here. - */ + /* + * BIG NOTE: Xalan-J simply overwrites any ns-decls with + * an equal prefix. We definitively won't do that. + * + * MSXML 4.0 and the .NET ignores ns-decls for which an + * equal prefix is already in use. + * + * Saxon raises an error like: + * "net.sf.saxon.xpath.DynamicError: Cannot create two namespace + * nodes with the same name". + * + * NOTE: We'll currently follow MSXML here. + * REVISIT TODO: Check if it's better to follow Saxon here. + */ if (ns->prefix == NULL) { /* * If we are adding ns-nodes to an element using e.g. @@ -1378,7 +1392,7 @@ xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, if (insert->nsDef != NULL) { tmpns = insert->nsDef; do { - if ((tmpns->prefix == NULL) == (ns->prefix == NULL)) { + if ((tmpns->prefix == NULL) == (ns->prefix == NULL)) { if ((tmpns->prefix == ns->prefix) || xmlStrEqual(tmpns->prefix, ns->prefix)) { @@ -1465,7 +1479,7 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt, case XML_NAMESPACE_DECL: return((xmlNodePtr) xsltShallowCopyNsNode(ctxt, invocNode, insert, (xmlNsPtr) node)); - + case XML_DOCUMENT_TYPE_NODE: case XML_DOCUMENT_FRAG_NODE: case XML_NOTATION_NODE: @@ -1476,7 +1490,7 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt, case XML_XINCLUDE_START: case XML_XINCLUDE_END: return(NULL); - } + } if (XSLT_IS_RES_TREE_FRAG(node)) { if (node->children != NULL) copy = xsltCopyTreeList(ctxt, invocNode, @@ -1488,7 +1502,7 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt, copy = xmlDocCopyNode(node, insert->doc, 0); if (copy != NULL) { copy->doc = ctxt->output; - xmlAddChild(insert, copy); + copy = xsltAddChild(insert, copy); /* * The node may have been coalesced into another text node. */ @@ -1496,7 +1510,7 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt, return(insert->last); copy->next = NULL; - if (node->type == XML_ELEMENT_NODE) { + if (node->type == XML_ELEMENT_NODE) { /* * Copy in-scope namespace nodes. * @@ -1515,7 +1529,7 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt, (node->parent->type != XML_HTML_DOCUMENT_NODE)) { xmlNsPtr *nsList, *curns, ns; - + /* * If this is a top-most element in a tree to be * copied, then we need to ensure that all in-scope @@ -1523,7 +1537,7 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt, * tree, it is sufficient to reconcile only the ns-decls * (node->nsDef entries). */ - + nsList = xmlGetNsList(node->doc, node); if (nsList != NULL) { curns = nsList; @@ -1534,7 +1548,7 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt, */ ns = xmlSearchNs(insert->doc, insert, (*curns)->prefix); - + if ((ns == NULL) || (! xmlStrEqual(ns->href, (*curns)->href))) { @@ -1567,9 +1581,9 @@ xsltCopyTreeInternal(xsltTransformContextPtr ctxt, } while (*curns != NULL); xmlFree(nsList); } - } else if (node->nsDef != NULL) { + } else if (node->nsDef != NULL) { /* - * Copy over all namespace declaration attributes. + * Copy over all namespace declaration attributes. */ if (node->nsDef != NULL) { if (isLRE) @@ -1642,7 +1656,7 @@ xsltCopyTree(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr insert, int literal) { return(xsltCopyTreeInternal(ctxt, node, node, insert, literal, 0)); - + } /************************************************************************ @@ -1667,7 +1681,7 @@ xsltApplyFallbacks(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr child; int ret = 0; - + if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (inst->children == NULL)) return(0); @@ -1695,8 +1709,6 @@ xsltApplyFallbacks(xsltTransformContextPtr ctxt, xmlNodePtr node, * * ************************************************************************/ -void xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node, - xsltStackElemPtr params); /** * xsltDefaultProcessOneNode: * @ctxt: a XSLT process context @@ -1968,7 +1980,7 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, { xsltTemplatePtr templ; xmlNodePtr oldNode; - + templ = xsltGetTemplate(ctxt, contextNode, NULL); /* * If no template is found, apply the default rule. @@ -1998,7 +2010,7 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, } if (contextNode->type == XML_ATTRIBUTE_NODE) { - xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; + xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; /* * Set the "current template rule". */ @@ -2013,7 +2025,7 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, ctxt->currentTemplateRule = oldCurTempRule; } else { - xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; + xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; /* * Set the "current template rule". */ @@ -2043,7 +2055,7 @@ xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt, xsltTemplatePtr templ, int *addCallResult) { - xmlNodePtr debugedNode = NULL; + xmlNodePtr debugedNode = NULL; if (ctxt->debugStatus != XSLT_DEBUG_NONE) { if (templ) { @@ -2126,7 +2138,7 @@ static void xsltReleaseLocalRVTs(xsltTransformContextPtr ctxt, xmlDocPtr base) { xmlDocPtr cur = ctxt->localRVT, tmp; - + while ((cur != NULL) && (cur != base)) { if (cur->psvi == (void *) ((long) 1)) { cur = (xmlDocPtr) cur->next; @@ -2162,7 +2174,7 @@ xsltReleaseLocalRVTs(xsltTransformContextPtr ctxt, xmlDocPtr base) * @templ: the compiled xsl:template (optional) * * Processes a sequence constructor. - * + * * NOTE: ctxt->currentTemplateRule was introduced to reflect the * semantics of "current template rule". I.e. the field ctxt->templ * is not intended to reflect this, thus always pushed onto the @@ -2190,7 +2202,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, if (ctxt == NULL) return; -#ifdef WITH_DEBUGGER +#ifdef WITH_DEBUGGER if (ctxt->debugStatus != XSLT_DEBUG_NONE) { debuggedNode = xsltDebuggerStartSequenceConstructor(ctxt, contextNode, @@ -2265,7 +2277,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, if (IS_XSLT_ELEM_FAST(cur) && IS_XSLT_NAME(cur, "message")) { xsltMessage(ctxt, contextNode, cur); goto skip_children; - } + } /* * Something really went wrong: */ @@ -2295,7 +2307,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, * OLD: if ((copy = xsltShallowCopyElem(ctxt, cur, insert)) * == NULL) * goto error; - */ + */ copy = xmlDocCopyNode(cur, insert->doc, 0); if (copy == NULL) { xsltTransformError(ctxt, NULL, cur, @@ -2308,7 +2320,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, * Add the element-node to the result tree. */ copy->doc = ctxt->output; - xmlAddChild(insert, copy); + copy = xsltAddChild(insert, copy); /* * Create effective namespaces declarations. * OLD: xsltCopyNamespaceList(ctxt, copy, cur->nsDef); @@ -2322,13 +2334,13 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, * Avoid generating redundant namespace * declarations; thus lookup if there is already * such a ns-decl in the result. - */ + */ ns = xmlSearchNs(copy->doc, copy, effNs->prefix); if ((ns != NULL) && (xmlStrEqual(ns->href, effNs->nsName))) { effNs = effNs->next; - continue; + continue; } ns = xmlNewNs(copy, effNs->nsName, effNs->prefix); if (ns == NULL) { @@ -2339,7 +2351,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, "declaration.\n"); goto error; } - + if (lastns == NULL) copy->nsDef = ns; else @@ -2348,7 +2360,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, effNs = effNs->next; } - + } /* * NOTE that we don't need to apply ns-alising: this was @@ -2359,9 +2371,9 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, * If there's no such ns-decl in the result tree, * then xsltGetSpecialNamespace() will * create a ns-decl on the copied node. - */ + */ copy->ns = xsltGetSpecialNamespace(ctxt, cur, - cur->ns->href, cur->ns->prefix, copy); + cur->ns->href, cur->ns->prefix, copy); } else { /* * Undeclare the default namespace if needed. @@ -2375,7 +2387,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, * REVISIT: This might result in massive * generation of ns-decls if nodes in a default * namespaces are mixed with nodes in no namespace. - * + * */ if (copy->nsDef || ((insert != NULL) && @@ -2406,14 +2418,14 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, /* * We hit an unknown XSLT element. * Try to apply one of the fallback cases. - */ + */ ctxt->insert = insert; if (!xsltApplyFallbacks(ctxt, contextNode, cur)) { xsltTransformError(ctxt, NULL, cur, "The is no fallback behaviour defined for " "the unknown XSLT element '%s'.\n", cur->name); - } + } ctxt->insert = oldInsert; } else if (info->func != NULL) { /* @@ -2431,11 +2443,11 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); ctxt->insert = oldInsert; - } else if (info->type == XSLT_FUNC_VARIABLE) { + } else if (info->type == XSLT_FUNC_VARIABLE) { xsltStackElemPtr tmpvar = ctxt->vars; - + xsltParseStylesheetVariable(ctxt, cur); - + if (tmpvar != ctxt->vars) { /* * TODO: Using a @tmpvar is an annoying workaround, but @@ -2452,7 +2464,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, xsltMessage(ctxt, contextNode, cur); } else { xsltTransformError(ctxt, NULL, cur, - "Unexpected XSLT element '%s'.\n", cur->name); + "Unexpected XSLT element '%s'.\n", cur->name); } goto skip_children; @@ -2461,7 +2473,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, /* * Extension intructions (elements) * -------------------------------------------------------- - */ + */ if (cur->psvi == xsltExtMarker) { /* * The xsltExtMarker was set during the compilation @@ -2475,7 +2487,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, xsltExtElementLookup(ctxt, cur->name, cur->ns->href); } else func = ((xsltElemPreCompPtr) cur->psvi)->func; - + if (func == NULL) { /* * No handler available. @@ -2492,8 +2504,8 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, xsltTransformError(ctxt, NULL, cur, "Unknown extension instruction '{%s}%s'.\n", cur->ns->href, cur->name); - } - ctxt->insert = oldInsert; + } + ctxt->insert = oldInsert; } else { /* * Execute the handler-callback. @@ -2502,7 +2514,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, "xsltApplySequenceConstructor: extension construct %s\n", cur->name)); -#endif +#endif ctxt->insert = insert; /* * We need the fragment base for extension instructions @@ -2544,7 +2556,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, } #endif if (xsltCopyText(ctxt, insert, cur, ctxt->internalized) == NULL) - goto error; + goto error; } #else /* XSLT_REFACTORED */ @@ -2558,7 +2570,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, if (info == NULL) { if (IS_XSLT_NAME(cur, "message")) { xsltMessage(ctxt, contextNode, cur); - } else { + } else { /* * That's an error try to apply one of the fallback cases */ @@ -2571,7 +2583,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, ctxt->insert = oldInsert; } goto skip_children; - } + } if (info->func != NULL) { oldCurInst = ctxt->inst; @@ -2596,14 +2608,14 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, if (IS_XSLT_NAME(cur, "variable")) { xsltStackElemPtr tmpvar = ctxt->vars; - + oldCurInst = ctxt->inst; ctxt->inst = cur; xsltParseStylesheetVariable(ctxt, cur); ctxt->inst = oldCurInst; - + if (tmpvar != ctxt->vars) { /* * TODO: Using a @tmpvar is an annoying workaround, but @@ -2727,11 +2739,11 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, ctxt->inst = cur; if ((copy = xsltShallowCopyElem(ctxt, cur, insert, 1)) == NULL) - goto error; + goto error; /* * Add extra namespaces inherited from the current template * if we are in the first level children and this is a - * "real" template. + * "real" template. */ if ((templ != NULL) && (oldInsert == insert) && (ctxt->templ != NULL) && (ctxt->templ->inheritedNs != NULL)) { @@ -2741,8 +2753,8 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, for (i = 0; i < ctxt->templ->inheritedNsNr; i++) { const xmlChar *URI = NULL; xsltStylesheetPtr style; - ns = ctxt->templ->inheritedNs[i]; - + ns = ctxt->templ->inheritedNs[i]; + /* Note that the XSLT namespace was already excluded * in xsltGetInheritedNsList(). */ @@ -2753,11 +2765,11 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, style = ctxt->style; while (style != NULL) { if (style->nsAliases != NULL) - URI = (const xmlChar *) + URI = (const xmlChar *) xmlHashLookup(style->nsAliases, ns->href); if (URI != NULL) break; - + style = xsltNextImport(style); } if (URI == UNDEFINED_DEFAULT_NS) @@ -2825,7 +2837,7 @@ skip_children: * Pop variables/params (xsl:variable and xsl:param). */ if ((ctxt->varsNr > oldVarsNr) && (ctxt->vars->level > level)) { - xsltLocalVariablePop(ctxt, oldVarsNr, level); + xsltLocalVariablePop(ctxt, oldVarsNr, level); } insert = insert->parent; @@ -2847,12 +2859,12 @@ error: * In case of errors: pop remaining variables. */ if (ctxt->varsNr > oldVarsNr) - xsltLocalVariablePop(ctxt, oldVarsNr, -1); + xsltLocalVariablePop(ctxt, oldVarsNr, -1); ctxt->node = oldContextNode; ctxt->inst = oldInst; ctxt->insert = oldInsert; - + #ifdef WITH_DEBUGGER if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) { xslDropCall(); @@ -2897,10 +2909,10 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, #ifdef WITH_DEBUGGER int addCallResult = 0; -#endif +#endif if (ctxt == NULL) - return; + return; if (templ == NULL) { xsltTransformError(ctxt, NULL, list, "xsltApplyXSLTTemplate: Bad arguments; @templ is mandatory.\n"); @@ -2936,17 +2948,17 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, xsltDebug(ctxt, contextNode, list, NULL); return; } - + oldUserFragmentTop = ctxt->tmpRVT; ctxt->tmpRVT = NULL; oldLocalFragmentTop = ctxt->localRVT; - + /* * Initiate a distinct scope of local params/variables. */ oldVarsBase = ctxt->varsBase; ctxt->varsBase = ctxt->varsNr; - + ctxt->node = contextNode; if (ctxt->profile) { templ->nbCalls++; @@ -2957,7 +2969,7 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, * Push the xsl:template declaration onto the stack. */ templPush(ctxt, templ); - + #ifdef WITH_XSLT_DEBUG_PROCESS if (templ->name != NULL) XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, @@ -2989,7 +3001,7 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, #else iparam = (xsltStylePreCompPtr) cur->psvi; #endif - + /* * Substitute xsl:param for a given xsl:with-param. * Since the XPath expression will reference the params/vars @@ -3007,7 +3019,7 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, { /* * Push the caller-parameter. - */ + */ xsltLocalVariablePush(ctxt, tmpParam, -1); break; } @@ -3025,20 +3037,20 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, xsltParseStylesheetParam(ctxt, cur); } cur = cur->next; - } while (cur != NULL); + } while (cur != NULL); /* * Process the sequence constructor. */ xsltApplySequenceConstructor(ctxt, contextNode, list, templ); - + /* * Remove remaining xsl:param and xsl:with-param items from * the stack. Don't free xsl:with-param items. */ if (ctxt->varsNr > ctxt->varsBase) - xsltTemplateParamsCleanup(ctxt); + xsltTemplateParamsCleanup(ctxt); ctxt->varsBase = oldVarsBase; - + /* * Clean up remaining local tree fragments. * This also frees fragments which are the result of @@ -3068,7 +3080,7 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, * Release user-created fragments stored in the scope * of xsl:template. Note that this mechanism is deprecated: * user code should now use xsltRegisterLocalRVT() instead - * of the obsolete xsltRegisterTmpRVT(). + * of the obsolete xsltRegisterTmpRVT(). */ if (ctxt->tmpRVT) { xmlDocPtr curdoc = ctxt->tmpRVT, tmp; @@ -3077,17 +3089,17 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, tmp = curdoc; curdoc = (xmlDocPtr) curdoc->next; xsltReleaseRVT(ctxt, tmp); - } + } } - ctxt->tmpRVT = oldUserFragmentTop; - + ctxt->tmpRVT = oldUserFragmentTop; + /* * Pop the xsl:template declaration from the stack. */ - templPop(ctxt); + templPop(ctxt); if (ctxt->profile) { long spent, child, total, end; - + end = xsltTimestamp(); child = profPop(ctxt); total = end - start; @@ -3100,12 +3112,12 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, xsltCalibrateAdjust(spent); spent = 0; } - + templ->time += spent; if (ctxt->profNr > 0) ctxt->profTab[ctxt->profNr - 1] += total; } - + #ifdef WITH_DEBUGGER if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) { xslDropCall(); @@ -3176,7 +3188,7 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, */ xsltLocalVariablePop(ctxt, oldVarsNr, -2); } else - xsltApplySequenceConstructor(ctxt, contextNode, list, templ); + xsltApplySequenceConstructor(ctxt, contextNode, list, templ); } /************************************************************************ @@ -3217,6 +3229,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, const xmlChar *doctypePublic; const xmlChar *doctypeSystem; const xmlChar *version; + const xmlChar *encoding; if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL)) return; @@ -3236,7 +3249,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, URL = xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *) "file", XSLT_SAXON_NAMESPACE); - + if (URL == NULL) URL = xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *) "href", @@ -3258,7 +3271,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, * Trying to handle bug #59212 * The value of the "select" attribute is an * XPath expression. - * (see http://xml.apache.org/xalan-j/extensionslib.html#redirect) + * (see http://xml.apache.org/xalan-j/extensionslib.html#redirect) */ cmp = xmlXPathCompile(URL); val = xsltEvalXPathString(ctxt, cmp); @@ -3506,6 +3519,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic) XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem) XSLT_GET_IMPORT_PTR(version, style, version) + XSLT_GET_IMPORT_PTR(encoding, style, encoding) if ((method != NULL) && (!xmlStrEqual(method, (const xmlChar *) "xml"))) { @@ -3565,8 +3579,8 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, #endif } res->charset = XML_CHAR_ENCODING_UTF8; - if (style->encoding != NULL) - res->encoding = xmlStrdup(style->encoding); + if (encoding != NULL) + res->encoding = xmlStrdup(encoding); ctxt->output = res; ctxt->insert = (xmlNodePtr) res; xsltApplySequenceConstructor(ctxt, node, inst->children, NULL); @@ -3710,7 +3724,7 @@ xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node, xsltStylePreCompPtr comp = castedComp; #endif xmlNodePtr copy, oldInsert; - + oldInsert = ctxt->insert; if (ctxt->insert != NULL) { switch (node->type) { @@ -3741,7 +3755,7 @@ xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node, * REMOVED: * if (xmlStrEqual(node->name, BAD_CAST " fake node libxslt")) * return; - */ + */ #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, @@ -3764,7 +3778,7 @@ xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node, * OPTIMIZE TODO: Can we set the value/children of the * attribute without an intermediate copy of the string value? */ - xsltShallowCopyAttr(ctxt, inst, ctxt->insert, (xmlAttrPtr) node); + xsltShallowCopyAttr(ctxt, inst, ctxt->insert, (xmlAttrPtr) node); break; } case XML_PI_NODE: @@ -3774,7 +3788,7 @@ xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node, #endif copy = xmlNewDocPI(ctxt->insert->doc, node->name, node->content); - xmlAddChild(ctxt->insert, copy); + copy = xsltAddChild(ctxt->insert, copy); break; case XML_COMMENT_NODE: #ifdef WITH_XSLT_DEBUG_PROCESS @@ -3782,14 +3796,14 @@ xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node, "xsltCopy: comment\n")); #endif copy = xmlNewComment(node->content); - xmlAddChild(ctxt->insert, copy); + copy = xsltAddChild(ctxt->insert, copy); break; case XML_NAMESPACE_DECL: #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, "xsltCopy: namespace declaration\n")); -#endif - xsltShallowCopyNsNode(ctxt, inst, ctxt->insert, (xmlNsPtr)node); +#endif + xsltShallowCopyNsNode(ctxt, inst, ctxt->insert, (xmlNsPtr)node); break; default: break; @@ -3841,7 +3855,7 @@ xsltText(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED, #endif copy->name = xmlStringTextNoenc; } - xmlAddChild(ctxt->insert, copy); + copy = xsltAddChild(ctxt->insert, copy); text = text->next; } } @@ -3865,14 +3879,14 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, xsltStylePreCompPtr comp = castedComp; #endif xmlChar *prop = NULL; - const xmlChar *name, *prefix = NULL, *nsName = NULL; + const xmlChar *name, *prefix = NULL, *nsName = NULL; xmlNodePtr copy; xmlNodePtr oldInsert; if (ctxt->insert == NULL) return; - /* + /* * A comp->has_name == 0 indicates that we need to skip this instruction, * since it was evaluated to be invalid already during compilation. */ @@ -3916,11 +3930,11 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, #ifdef XSLT_REFACTORED prefix = comp->nsPrefix; name = comp->name; -#else +#else name = xsltSplitQName(ctxt->dict, comp->name, &prefix); #endif } - + /* * Create the new element */ @@ -3934,13 +3948,13 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, "xsl:element : creation of %s failed\n", name); return; } - xmlAddChild(ctxt->insert, copy); + copy = xsltAddChild(ctxt->insert, copy); /* * Namespace * --------- */ - if (comp->has_ns) { + if (comp->has_ns) { if (comp->ns != NULL) { /* * No AVT; just plain text for the namespace name. @@ -3954,7 +3968,7 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, */ /* TODO: check attr acquisition wrt to the XSLT namespace */ tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst, - (const xmlChar *) "namespace", XSLT_NAMESPACE); + (const xmlChar *) "namespace", XSLT_NAMESPACE); /* * SPEC XSLT 1.0: * "If the string is empty, then the expanded-name of the @@ -3962,8 +3976,8 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, */ if ((tmpNsName != NULL) && (tmpNsName[0] != 0)) nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1); - xmlFree(tmpNsName); - }; + xmlFree(tmpNsName); + }; } else { xmlNsPtr ns; /* @@ -3972,7 +3986,7 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, * expanded into an expanded-name using the namespace declarations * in effect for the xsl:element element, including any default * namespace declaration. - */ + */ ns = xmlSearchNs(inst->doc, inst, prefix); if (ns == NULL) { /* @@ -3987,7 +4001,7 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, "specified by the instruction itself.\n", prefix, name); } } else - nsName = ns->href; + nsName = ns->href; } /* * Find/create a matching ns-decl in the result tree. @@ -4032,7 +4046,7 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, error: ctxt->insert = oldInsert; - return; + return; } @@ -4051,15 +4065,15 @@ xsltComment(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlChar *value = NULL; xmlNodePtr commentNode; int len; - + value = xsltEvalTemplateString(ctxt, node, inst); /* TODO: use or generate the compiled form */ len = xmlStrlen(value); if (len > 0) { - if ((value[len-1] == '-') || + if ((value[len-1] == '-') || (xmlStrstr(value, BAD_CAST "--"))) { xsltTransformError(ctxt, NULL, inst, - "xsl:comment : '--' or ending '-' not allowed in comment\n"); + "xsl:comment : '--' or ending '-' not allowed in comment\n"); /* fall through to try to catch further errors */ } } @@ -4074,7 +4088,7 @@ xsltComment(xsltTransformContextPtr ctxt, xmlNodePtr node, #endif commentNode = xmlNewComment(value); - xmlAddChild(ctxt->insert, commentNode); + commentNode = xsltAddChild(ctxt->insert, commentNode); if (value != NULL) xmlFree(value); @@ -4137,7 +4151,7 @@ xsltProcessingInstruction(xsltTransformContextPtr ctxt, xmlNodePtr node, #endif pi = xmlNewDocPI(ctxt->insert->doc, name, value); - xmlAddChild(ctxt->insert, pi); + pi = xsltAddChild(ctxt->insert, pi); error: if ((name != NULL) && (name != comp->name)) @@ -4150,7 +4164,7 @@ error: * xsltCopyOf: * @ctxt: an XSLT transformation context * @node: the current node in the source tree - * @inst: the element node of the XSLT copy-of instruction + * @inst: the element node of the XSLT copy-of instruction * @castedComp: precomputed information of the XSLT copy-of instruction * * Process the XSLT copy-of instruction. @@ -4213,7 +4227,7 @@ xsltCopyOf(xsltTransformContextPtr ctxt, xmlNodePtr node, oldXPContextSize = xpctxt->contextSize; oldXPNsNr = xpctxt->nsNr; oldXPNamespaces = xpctxt->namespaces; - + xpctxt->node = node; if (comp != NULL) { @@ -4239,7 +4253,7 @@ xsltCopyOf(xsltTransformContextPtr ctxt, xmlNodePtr node, xpctxt->doc = oldXPContextDoc; xpctxt->node = oldXPContextNode; xpctxt->contextSize = oldXPContextSize; - xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->nsNr = oldXPNsNr; xpctxt->namespaces = oldXPNamespaces; @@ -4288,7 +4302,7 @@ xsltCopyOf(xsltTransformContextPtr ctxt, xmlNodePtr node, #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext, "xsltCopyOf: result is a result tree fragment\n")); -#endif +#endif list = res->nodesetval; if ((list != NULL) && (list->nodeTab != NULL) && (list->nodeTab[0] != NULL) && @@ -4316,7 +4330,7 @@ xsltCopyOf(xsltTransformContextPtr ctxt, xmlNodePtr node, xsltCopyTextString(ctxt, ctxt->insert, value, 0); } xmlFree(value); - + #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext, "xsltCopyOf: result %s\n", res->stringval)); @@ -4380,7 +4394,7 @@ xsltValueOf(xsltTransformContextPtr ctxt, xmlNodePtr node, oldXPContextSize = xpctxt->contextSize; oldXPNsNr = xpctxt->nsNr; oldXPNamespaces = xpctxt->namespaces; - + xpctxt->node = node; if (comp != NULL) { @@ -4406,7 +4420,7 @@ xsltValueOf(xsltTransformContextPtr ctxt, xmlNodePtr node, xpctxt->doc = oldXPContextDoc; xpctxt->node = oldXPContextNode; xpctxt->contextSize = oldXPContextSize; - xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->nsNr = oldXPNsNr; xpctxt->namespaces = oldXPNamespaces; @@ -4427,14 +4441,14 @@ xsltValueOf(xsltTransformContextPtr ctxt, xmlNodePtr node, ctxt->insert, value, comp->noescape); } } else { - xsltTransformError(ctxt, NULL, inst, + xsltTransformError(ctxt, NULL, inst, "XPath evaluation returned no result.\n"); ctxt->state = XSLT_STATE_STOPPED; - goto error; + goto error; } #ifdef WITH_XSLT_DEBUG_PROCESS - if (value) { + if (value) { XSLT_TRACE(ctxt,XSLT_TRACE_VALUE_OF,xsltGenericDebug(xsltGenericDebugContext, "xsltValueOf: result '%s'\n", value)); } @@ -4476,7 +4490,7 @@ xsltNumber(xsltTransformContextPtr ctxt, xmlNodePtr node, comp->numdata.doc = inst->doc; comp->numdata.node = inst; - + xsltNumberFormat(ctxt, &comp->numdata, node); } @@ -4634,7 +4648,7 @@ xsltCallTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, } } /* - * Create a new frame using the params first + * Create a new frame using the params first */ xsltApplyXSLTTemplate(ctxt, node, comp->templ->content, comp->templ, withParams); @@ -4668,7 +4682,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, xsltStylePreCompPtr comp = castedComp; #endif int i; - xmlNodePtr cur, delNode = NULL, oldContextNode; + xmlNodePtr cur, delNode = NULL, oldContextNode; xmlNodeSetPtr list = NULL, oldList; xsltStackElemPtr withParams = NULL; int oldXPProximityPosition, oldXPContextSize, oldXPNsNr; @@ -4692,21 +4706,21 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, "xsltApplyTemplates: node: '%s'\n", node->name)); #endif - xpctxt = ctxt->xpathCtxt; + xpctxt = ctxt->xpathCtxt; /* * Save context states. */ oldContextNode = ctxt->node; oldMode = ctxt->mode; - oldModeURI = ctxt->modeURI; + oldModeURI = ctxt->modeURI; oldDocInfo = ctxt->document; - oldList = ctxt->nodeList; + oldList = ctxt->nodeList; /* * The xpath context size and proximity position, as * well as the xpath and context documents, may be changed * so we save their initial state and will restore on exit - */ + */ oldXPContextSize = xpctxt->contextSize; oldXPProximityPosition = xpctxt->proximityPosition; oldXPDoc = xpctxt->doc; @@ -4719,7 +4733,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, ctxt->mode = comp->mode; ctxt->modeURI = comp->modeURI; - if (comp->select != NULL) { + if (comp->select != NULL) { xmlXPathObjectPtr res = NULL; if (comp->comp == NULL) { @@ -4755,7 +4769,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, if (res != NULL) { if (res->type == XPATH_NODESET) { list = res->nodesetval; /* consume the node set */ - res->nodesetval = NULL; + res->nodesetval = NULL; } else { xsltTransformError(ctxt, NULL, inst, "The 'select' expression did not evaluate to a " @@ -4768,13 +4782,13 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, /* * Note: An xsl:apply-templates with a 'select' attribute, * can change the current source doc. - */ + */ } else { xsltTransformError(ctxt, NULL, inst, "Failed to evaluate the 'select' expression.\n"); ctxt->state = XSLT_STATE_STOPPED; goto error; - } + } if (list == NULL) { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, @@ -4783,7 +4797,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, goto exit; } /* - * + * * NOTE: Previously a document info (xsltDocument) was * created and attached to the Result Tree Fragment. * But such a document info is created on demand in @@ -4792,14 +4806,14 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, * In order to take care of potential keys we need to * do some extra work for the case when a Result Tree Fragment * is converted into a nodeset (e.g. exslt:node-set()) : - * We attach a "pseudo-doc" (xsltDocument) to _private. + * We attach a "pseudo-doc" (xsltDocument) to _private. * This xsltDocument, together with the keyset, will be freed * when the Result Tree Fragment is freed. - * + * */ #if 0 if ((ctxt->nbKeys > 0) && - (list->nodeNr != 0) && + (list->nodeNr != 0) && (list->nodeTab[0]->doc != NULL) && XSLT_IS_RES_TREE_FRAG(list->nodeTab[0]->doc)) { @@ -4902,7 +4916,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, * for xsltDoSortFunction(). */ ctxt->nodeList = list; - /* + /* * Process xsl:with-param and xsl:sort instructions. * (The code became so verbose just to avoid the * xmlNodePtr sorts[XSLT_MAX_SORT] if there's no xsl:sort) @@ -4924,7 +4938,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, if (cur->type == XML_TEXT_NODE) { cur = cur->next; continue; - } + } if (! IS_XSLT_ELEM(cur)) break; if (IS_XSLT_NAME(cur, "with-param")) { @@ -4938,24 +4952,24 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; int nbsorts = 0; - xmlNodePtr sorts[XSLT_MAX_SORT]; - + xmlNodePtr sorts[XSLT_MAX_SORT]; + sorts[nbsorts++] = cur; - + while (cur) { - + #ifdef WITH_DEBUGGER if (ctxt->debugStatus != XSLT_DEBUG_NONE) xslHandleDebugger(cur, node, NULL, ctxt); #endif if (ctxt->state == XSLT_STATE_STOPPED) break; - + if (cur->type == XML_TEXT_NODE) { cur = cur->next; continue; } - + if (! IS_XSLT_ELEM(cur)) break; if (IS_XSLT_NAME(cur, "with-param")) { @@ -4964,7 +4978,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, param->next = withParams; withParams = param; } - } + } if (IS_XSLT_NAME(cur, "sort")) { if (nbsorts >= XSLT_MAX_SORT) { xsltTransformError(ctxt, NULL, cur, @@ -4992,11 +5006,11 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, } cur = cur->next; } - } + } xpctxt->contextSize = list->nodeNr; /* * Apply templates for all selected source nodes. - */ + */ for (i = 0; i < list->nodeNr; i++) { cur = list->nodeTab[i]; /* @@ -5025,7 +5039,7 @@ error: if (withParams != NULL) xsltFreeStackElemList(withParams); if (list != NULL) - xmlXPathFreeNodeSet(list); + xmlXPathFreeNodeSet(list); /* * Restore context states. */ @@ -5060,8 +5074,8 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) return; - - /* + + /* * TODO: Content model checks should be done only at compilation * time. */ @@ -5086,13 +5100,13 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, { int testRes = 0, res = 0; - xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; + xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; xmlDocPtr oldXPContextDoc = xpctxt->doc; int oldXPProximityPosition = xpctxt->proximityPosition; int oldXPContextSize = xpctxt->contextSize; xmlNsPtr *oldXPNamespaces = xpctxt->namespaces; int oldXPNsNr = xpctxt->nsNr; - + #ifdef XSLT_REFACTORED xsltStyleItemWhenPtr wcomp = NULL; #else @@ -5102,9 +5116,9 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, /* * Process xsl:when --------------------------------------------------- */ - while (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "when")) { + while (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "when")) { wcomp = cur->psvi; - + if ((wcomp == NULL) || (wcomp->test == NULL) || (wcomp->comp == NULL)) { @@ -5113,11 +5127,11 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, "The XSLT 'when' instruction was not compiled.\n"); goto error; } - - + + #ifdef WITH_DEBUGGER if (xslDebugStatus != XSLT_DEBUG_NONE) { - /* + /* * TODO: Isn't comp->templ always NULL for xsl:choose? */ xslHandleDebugger(cur, contextNode, NULL, ctxt); @@ -5132,7 +5146,7 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xpctxt->doc = oldXPContextDoc; xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->contextSize = oldXPContextSize; - + #ifdef XSLT_REFACTORED if (wcomp->inScopeNs != NULL) { xpctxt->namespaces = wcomp->inScopeNs->list; @@ -5145,21 +5159,21 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xpctxt->namespaces = wcomp->nsList; xpctxt->nsNr = wcomp->nsNr; #endif - - + + #ifdef XSLT_FAST_IF res = xmlXPathCompiledEvalToBoolean(wcomp->comp, xpctxt); - + if (res == -1) { ctxt->state = XSLT_STATE_STOPPED; goto error; } - testRes = (res == 1) ? 1 : 0; - + testRes = (res == 1) ? 1 : 0; + #else /* XSLT_FAST_IF */ - + res = xmlXPathCompiledEval(wcomp->comp, xpctxt); - + if (res != NULL) { if (res->type != XPATH_BOOLEAN) res = xmlXPathConvertBoolean(res); @@ -5178,33 +5192,33 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, ctxt->state = XSLT_STATE_STOPPED; goto error; } - + #endif /* else of XSLT_FAST_IF */ - + #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext, "xsltChoose: test evaluate to %d\n", testRes)); #endif - if (testRes) + if (testRes) goto test_is_true; - + cur = cur->next; } - + /* * Process xsl:otherwise ---------------------------------------------- */ if (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "otherwise")) { - + #ifdef WITH_DEBUGGER if (xslDebugStatus != XSLT_DEBUG_NONE) xslHandleDebugger(cur, contextNode, NULL, ctxt); #endif - + #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext, "evaluating xsl:otherwise\n")); -#endif +#endif goto test_is_true; } xpctxt->node = contextNode; @@ -5227,7 +5241,7 @@ test_is_true: } process_sequence: - + /* * Instantiate the sequence constructor. */ @@ -5274,7 +5288,7 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, "xsltIf: test %s\n", comp->test)); #endif -#ifdef XSLT_FAST_IF +#ifdef XSLT_FAST_IF { xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; xmlDocPtr oldXPContextDoc = xpctxt->doc; @@ -5283,11 +5297,11 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, int oldXPProximityPosition = xpctxt->proximityPosition; int oldXPContextSize = xpctxt->contextSize; int oldXPNsNr = xpctxt->nsNr; - xmlDocPtr oldLocalFragmentTop = ctxt->localRVT; - + xmlDocPtr oldLocalFragmentTop = ctxt->localRVT; + xpctxt->node = contextNode; if (comp != NULL) { - + #ifdef XSLT_REFACTORED if (comp->inScopeNs != NULL) { xpctxt->namespaces = comp->inScopeNs->list; @@ -5306,7 +5320,7 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, } /* * This XPath function is optimized for boolean results. - */ + */ res = xmlXPathCompiledEvalToBoolean(comp->comp, xpctxt); /* @@ -5315,11 +5329,11 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, */ if (oldLocalFragmentTop != ctxt->localRVT) xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); - + xpctxt->doc = oldXPContextDoc; xpctxt->node = oldXPContextNode; xpctxt->contextSize = oldXPContextSize; - xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->nsNr = oldXPNsNr; xpctxt->namespaces = oldXPNamespaces; } @@ -5328,7 +5342,7 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext, "xsltIf: test evaluate to %d\n", res)); #endif - + if (res == -1) { ctxt->state = XSLT_STATE_STOPPED; goto error; @@ -5340,7 +5354,7 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xsltApplySequenceConstructor(ctxt, contextNode, inst->children, NULL); } - + #else /* XSLT_FAST_IF */ { xmlXPathObjectPtr xpobj = NULL; @@ -5354,11 +5368,11 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr oldXPContextNode = xpctxt->node; int oldXPProximityPosition = xpctxt->proximityPosition; int oldXPContextSize = xpctxt->contextSize; - int oldXPNsNr = xpctxt->nsNr; - + int oldXPNsNr = xpctxt->nsNr; + xpctxt->node = contextNode; if (comp != NULL) { - + #ifdef XSLT_REFACTORED if (comp->inScopeNs != NULL) { xpctxt->namespaces = comp->inScopeNs->list; @@ -5375,16 +5389,16 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xpctxt->namespaces = NULL; xpctxt->nsNr = 0; } - + /* * This XPath function is optimized for boolean results. - */ + */ xpobj = xmlXPathCompiledEval(comp->comp, xpctxt); - + xpctxt->doc = oldXPContextDoc; xpctxt->node = oldXPContextNode; xpctxt->contextSize = oldXPContextSize; - xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->nsNr = oldXPNsNr; xpctxt->namespaces = oldXPNamespaces; } @@ -5393,7 +5407,7 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xpobj = xmlXPathConvertBoolean(xpobj); if (xpobj->type == XPATH_BOOLEAN) { res = xpobj->boolval; - + #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext, "xsltIf: test evaluate to %d\n", res)); @@ -5425,7 +5439,7 @@ error: /** * xsltForEach: * @ctxt: an XSLT transformation context - * @contextNode: the "current node" in the source tree + * @contextNode: the "current node" in the source tree * @inst: the element node of the xsl:for-each instruction * @castedComp: the compiled information of the instruction * @@ -5444,16 +5458,16 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlXPathObjectPtr res = NULL; xmlNodePtr cur, curInst; xmlNodeSetPtr list = NULL; - xmlNodeSetPtr oldList; + xmlNodeSetPtr oldList; int oldXPProximityPosition, oldXPContextSize; xmlNodePtr oldContextNode; - xsltTemplatePtr oldCurTemplRule; + xsltTemplatePtr oldCurTemplRule; xmlDocPtr oldXPDoc; xsltDocumentPtr oldDocInfo; xmlXPathContextPtr xpctxt; if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) { - xsltGenericError(xsltGenericErrorContext, + xsltGenericError(xsltGenericErrorContext, "xsltForEach(): Bad arguments.\n"); return; } @@ -5471,7 +5485,7 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, "instruction was not compiled correctly.\n"); return; } - xpctxt = ctxt->xpathCtxt; + xpctxt = ctxt->xpathCtxt; #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_FOR_EACH,xsltGenericDebug(xsltGenericDebugContext, @@ -5482,7 +5496,7 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, * Save context states. */ oldDocInfo = ctxt->document; - oldList = ctxt->nodeList; + oldList = ctxt->nodeList; oldContextNode = ctxt->node; /* * The "current template rule" is cleared for the instantiation of @@ -5509,8 +5523,8 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, #else xpctxt->namespaces = comp->nsList; xpctxt->nsNr = comp->nsNr; -#endif - +#endif + /* * Evaluate the 'select' expression. */ @@ -5522,7 +5536,7 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, else { xsltTransformError(ctxt, NULL, inst, "The 'select' expression does not evaluate to a node set.\n"); - + #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_FOR_EACH,xsltGenericDebug(xsltGenericDebugContext, "xsltForEach: select didn't evaluate to a node list\n")); @@ -5550,12 +5564,12 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xpctxt->contextSize = oldXPContextSize; xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->node = contextNode; - + /* * Set the list; this has to be done already here for xsltDoSortFunction(). */ - ctxt->nodeList = list; - /* + ctxt->nodeList = list; + /* * Handle xsl:sort instructions and skip them for further processing. * BUG TODO: We are not using namespaced potentially defined on the * xsl:sort element; XPath expression might fail. @@ -5583,7 +5597,7 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, } else { sorts[nbsorts++] = curInst; } - + #ifdef WITH_DEBUGGER if (xslDebugStatus != XSLT_DEBUG_NONE) xslHandleDebugger(curInst, contextNode, NULL, ctxt); @@ -5591,11 +5605,11 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, curInst = curInst->next; } xsltDoSortFunction(ctxt, sorts, nbsorts); - } + } xpctxt->contextSize = list->nodeNr; /* * Instantiate the sequence constructor for each selected node. - */ + */ for (i = 0; i < list->nodeNr; i++) { cur = list->nodeTab[i]; /* @@ -5722,7 +5736,7 @@ xsltApplyStripSpaces(xsltTransformContextPtr ctxt, xmlNodePtr node) { while (cur != NULL) { if (IS_BLANK_NODE(cur)) delete = cur; - + cur = cur->next; if (delete != NULL) { xmlUnlinkNode(delete); @@ -5833,9 +5847,12 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, const xmlChar *doctypePublic; const xmlChar *doctypeSystem; const xmlChar *version; + const xmlChar *encoding; xsltStackElemPtr variables; xsltStackElemPtr vptr; + xsltInitGlobals(); + if ((style == NULL) || (doc == NULL)) return (NULL); @@ -5904,6 +5921,7 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic) XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem) XSLT_GET_IMPORT_PTR(version, style, version) + XSLT_GET_IMPORT_PTR(encoding, style, encoding) if ((method != NULL) && (!xmlStrEqual(method, (const xmlChar *) "xml"))) @@ -5915,7 +5933,7 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, } else { if (version == NULL) { xmlDtdPtr dtd; - + res = htmlNewDoc(NULL, NULL); /* * Make sure no DTD node is generated in this case @@ -5992,8 +6010,8 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, #endif } res->charset = XML_CHAR_ENCODING_UTF8; - if (style->encoding != NULL) - res->encoding = xmlStrdup(style->encoding); + if (encoding != NULL) + res->encoding = xmlStrdup(encoding); variables = style->variables; /* @@ -6001,14 +6019,14 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, * and start by processing the top node. */ if (xsltNeedElemSpaceHandling(ctxt)) - xsltApplyStripSpaces(ctxt, xmlDocGetRootElement(doc)); + xsltApplyStripSpaces(ctxt, xmlDocGetRootElement(doc)); /* * Evaluate global params and user-provided params. */ ctxt->node = (xmlNodePtr) doc; if (ctxt->globalVars == NULL) ctxt->globalVars = xmlHashCreate(20); - if (params != NULL) { + if (params != NULL) { xsltEvalUserParams(ctxt, params); } diff --git a/reactos/dll/3rdparty/libxslt/transform.h b/reactos/dll/3rdparty/libxslt/transform.h index 105ac2d98c9..2cfbec2e3da 100644 --- a/reactos/dll/3rdparty/libxslt/transform.h +++ b/reactos/dll/3rdparty/libxslt/transform.h @@ -24,51 +24,55 @@ extern "C" { /** * XInclude default processing. */ -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltSetXIncludeDefault (int xinclude); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltGetXIncludeDefault (void); /** * Export context to users. */ -XSLTPUBFUN xsltTransformContextPtr XSLTCALL +XSLTPUBFUN xsltTransformContextPtr XSLTCALL xsltNewTransformContext (xsltStylesheetPtr style, xmlDocPtr doc); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltFreeTransformContext(xsltTransformContextPtr ctxt); -XSLTPUBFUN xmlDocPtr XSLTCALL +XSLTPUBFUN xmlDocPtr XSLTCALL xsltApplyStylesheetUser (xsltStylesheetPtr style, xmlDocPtr doc, const char **params, const char *output, FILE * profile, xsltTransformContextPtr userCtxt); +XSLTPUBFUN void XSLTCALL + xsltProcessOneNode (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xsltStackElemPtr params); /** * Private Interfaces. */ -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltApplyStripSpaces (xsltTransformContextPtr ctxt, xmlNodePtr node); -XSLTPUBFUN xmlDocPtr XSLTCALL +XSLTPUBFUN xmlDocPtr XSLTCALL xsltApplyStylesheet (xsltStylesheetPtr style, xmlDocPtr doc, const char **params); -XSLTPUBFUN xmlDocPtr XSLTCALL +XSLTPUBFUN xmlDocPtr XSLTCALL xsltProfileStylesheet (xsltStylesheetPtr style, xmlDocPtr doc, const char **params, FILE * output); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRunStylesheet (xsltStylesheetPtr style, xmlDocPtr doc, const char **params, const char *output, xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf); -XSLTPUBFUN int XSLTCALL +XSLTPUBFUN int XSLTCALL xsltRunStylesheetUser (xsltStylesheetPtr style, xmlDocPtr doc, const char **params, @@ -77,101 +81,101 @@ XSLTPUBFUN int XSLTCALL xmlOutputBufferPtr IObuf, FILE * profile, xsltTransformContextPtr userCtxt); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltApplyOneTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr list, xsltTemplatePtr templ, xsltStackElemPtr params); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltDocumentElem (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltSort (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltCopy (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltText (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltElement (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltComment (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltAttribute (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltProcessingInstruction(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltCopyOf (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltValueOf (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltNumber (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltApplyImports (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltCallTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltApplyTemplates (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltChoose (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltIf (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltForEach (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr comp); -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xsltRegisterAllElement (xsltTransformContextPtr ctxt); -XSLTPUBFUN xmlNodePtr XSLTCALL +XSLTPUBFUN xmlNodePtr XSLTCALL xsltCopyTextString (xsltTransformContextPtr ctxt, xmlNodePtr target, const xmlChar *string, @@ -189,7 +193,7 @@ XSLTPUBFUN int XSLTCALL /* * Hook for the debugger if activated. */ -XSLTPUBFUN void XSLTCALL +XSLTPUBFUN void XSLTCALL xslHandleDebugger (xmlNodePtr cur, xmlNodePtr node, xsltTemplatePtr templ, diff --git a/reactos/dll/3rdparty/libxslt/trio.h b/reactos/dll/3rdparty/libxslt/trio.h index b788dc8076e..941bdd04559 100644 --- a/reactos/dll/3rdparty/libxslt/trio.h +++ b/reactos/dll/3rdparty/libxslt/trio.h @@ -1,6 +1,6 @@ /************************************************************************* * - * $Id: trio.h 897 2003-04-07 12:41:56Z veillard $ + * $Id$ * * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. * diff --git a/reactos/dll/3rdparty/libxslt/triodef.h b/reactos/dll/3rdparty/libxslt/triodef.h index 58c7fce14bc..0fd32fb7864 100644 --- a/reactos/dll/3rdparty/libxslt/triodef.h +++ b/reactos/dll/3rdparty/libxslt/triodef.h @@ -1,6 +1,6 @@ /************************************************************************* * - * $Id: triodef.h 912 2003-04-26 12:06:36Z veillard $ + * $Id$ * * Copyright (C) 2001 Bjorn Reese * diff --git a/reactos/dll/3rdparty/libxslt/variables.c b/reactos/dll/3rdparty/libxslt/variables.c index 1cdfa80c28d..43a61561e03 100644 --- a/reactos/dll/3rdparty/libxslt/variables.c +++ b/reactos/dll/3rdparty/libxslt/variables.c @@ -43,6 +43,10 @@ const xmlChar *xsltDocFragFake = (const xmlChar *) " fake node libxslt"; const xmlChar *xsltComputingGlobalVarMarker = (const xmlChar *) " var/param being computed"; +#define XSLT_VAR_GLOBAL 1<<0 +#define XSLT_VAR_IN_SELECT 1<<1 +#define XSLT_TCTXT_VARIABLE(c) ((xsltStackElemPtr) (c)->contextVariable) + /************************************************************************ * * * Result Value Tree (Result Tree Fragment) interfaces * diff --git a/reactos/dll/3rdparty/libxslt/xslt.c b/reactos/dll/3rdparty/libxslt/xslt.c index 6f76a33996b..55f505b4768 100644 --- a/reactos/dll/3rdparty/libxslt/xslt.c +++ b/reactos/dll/3rdparty/libxslt/xslt.c @@ -56,6 +56,10 @@ const int xsltLibxmlVersion = LIBXML_VERSION; const xmlChar *xsltConstNamespaceNameXSLT = (const xmlChar *) XSLT_NAMESPACE; +#define XSLT_ELEMENT_CATEGORY_XSLT 0 +#define XSLT_ELEMENT_CATEGORY_EXTENSION 1 +#define XSLT_ELEMENT_CATEGORY_LRE 2 + /* * xsltLiteralResultMarker: * Marker for Literal result elements, in order to avoid multiple attempts @@ -83,6 +87,9 @@ const xmlChar *xsltXSLTAttrMarker = (const xmlChar *) "LRE XSLT Attr"; #endif +#ifdef XSLT_LOCALE_WINAPI +extern xmlRMutexPtr xsltLocaleMutex; +#endif /* * Harmless but avoiding a problem when compiling against a * libxml <= 2.3.11 without LIBXML_DEBUG_ENABLED @@ -141,11 +148,14 @@ xsltParseContentError(xsltStylesheetPtr style, * * Push an excluded namespace name on the stack * - * Returns the new index in the stack or 0 in case of error + * Returns the new index in the stack or -1 if already present or + * in case of error */ static int exclPrefixPush(xsltStylesheetPtr style, xmlChar * value) { + int i; + if (style->exclPrefixMax == 0) { style->exclPrefixMax = 4; style->exclPrefixTab = @@ -153,9 +163,14 @@ exclPrefixPush(xsltStylesheetPtr style, xmlChar * value) sizeof(style->exclPrefixTab[0])); if (style->exclPrefixTab == NULL) { xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); - return (0); + return (-1); } } + /* do not push duplicates */ + for (i = 0;i < style->exclPrefixNr;i++) { + if (xmlStrEqual(style->exclPrefixTab[i], value)) + return(-1); + } if (style->exclPrefixNr >= style->exclPrefixMax) { style->exclPrefixMax *= 2; style->exclPrefixTab = @@ -164,7 +179,7 @@ exclPrefixPush(xsltStylesheetPtr style, xmlChar * value) sizeof(style->exclPrefixTab[0])); if (style->exclPrefixTab == NULL) { xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); - return (0); + return (-1); } } style->exclPrefixTab[style->exclPrefixNr] = value; @@ -214,6 +229,9 @@ void xsltInit (void) { if (initialized == 0) { initialized = 1; +#ifdef XSLT_LOCALE_WINAPI + xsltLocaleMutex = xmlNewRMutex(); +#endif xsltRegisterAllExtras(); } } @@ -1704,12 +1722,13 @@ xsltParseStylesheetExcludePrefix(xsltStylesheetPtr style, xmlNodePtr cur, prefix); if (style != NULL) style->warnings++; } else { + if (exclPrefixPush(style, (xmlChar *) ns->href) >= 0) { #ifdef WITH_XSLT_DEBUG_PARSING - xsltGenericDebug(xsltGenericDebugContext, - "exclude result prefix %s\n", prefix); + xsltGenericDebug(xsltGenericDebugContext, + "exclude result prefix %s\n", prefix); #endif - exclPrefixPush(style, (xmlChar *) ns->href); - nb++; + nb++; + } } xmlFree(prefix); } @@ -4921,13 +4940,14 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { * okay this is an extension element compile it too */ xsltStylePreCompute(style, cur); - } else { + } + else if (cur->type == XML_ELEMENT_NODE) + { /* * This is an element which will be output as part of the * template exectution, precompile AVT if found. */ - if ((cur->ns == NULL) && (style->defaultAlias != NULL) && - (cur->type == XML_ELEMENT_NODE)) { + if ((cur->ns == NULL) && (style->defaultAlias != NULL)) { cur->ns = xmlSearchNsByHref(cur->doc, cur, style->defaultAlias); } @@ -6233,6 +6253,15 @@ xsltParseSimplifiedStylesheetTree(xsltCompilerCtxtPtr cctxt, } #ifdef XSLT_REFACTORED_XSLT_NSCOMP +/** + * xsltRestoreDocumentNamespaces: + * @ns: map of namespaces + * @doc: the document + * + * Restore the namespaces for the document + * + * Returns 0 in case of success, -1 in case of failure + */ int xsltRestoreDocumentNamespaces(xsltNsMapPtr ns, xmlDocPtr doc) { @@ -6274,6 +6303,7 @@ xsltParseStylesheetProcess(xsltStylesheetPtr style, xmlDocPtr doc) xmlNodePtr cur; int oldIsSimplifiedStylesheet; + xsltInitGlobals(); if ((style == NULL) || (doc == NULL)) return(NULL); @@ -6326,10 +6356,25 @@ xsltParseStylesheetProcess(xsltStylesheetPtr style, xmlDocPtr doc) #else /* XSLT_REFACTORED */ +/** + * xsltParseStylesheetProcess: + * @ret: the XSLT stylesheet (the current stylesheet-level) + * @doc: and xmlDoc parsed XML + * + * Parses an XSLT stylesheet, adding the associated structures. + * Called by: + * xsltParseStylesheetImportedDoc() (xslt.c) + * xsltParseStylesheetInclude() (imports.c) + * + * Returns the value of the @style parameter if everything + * went right, NULL if something went amiss. + */ xsltStylesheetPtr xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { xmlNodePtr cur; + xsltInitGlobals(); + if (doc == NULL) return(NULL); if (ret == NULL) @@ -6616,6 +6661,8 @@ xsltStylesheetPtr xsltParseStylesheetDoc(xmlDocPtr doc) { xsltStylesheetPtr ret; + xsltInitGlobals(); + ret = xsltParseStylesheetImportedDoc(doc, NULL); if (ret == NULL) return(NULL); @@ -6650,6 +6697,7 @@ xsltParseStylesheetFile(const xmlChar* filename) { xsltStylesheetPtr ret; xmlDocPtr doc; + xsltInitGlobals(); if (filename == NULL) return(NULL); @@ -6811,6 +6859,8 @@ xsltLoadStylesheetPI(xmlDocPtr doc) { xmlChar *href = NULL; xmlURIPtr URI; + xsltInitGlobals(); + if (doc == NULL) return(NULL); @@ -6862,8 +6912,14 @@ xsltLoadStylesheetPI(xmlDocPtr doc) { "xml-stylesheet : no ID %s found\n", URI->fragment); } else { xmlDocPtr fake; - xmlNodePtr subtree; + xmlNodePtr subtree, newtree; + xmlNsPtr ns; +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "creating new document from %s for embedded stylesheet\n", + doc->URL); +#endif /* * move the subtree in a new document passed to * the stylesheet analyzer @@ -6871,20 +6927,38 @@ xsltLoadStylesheetPI(xmlDocPtr doc) { subtree = ID->parent; fake = xmlNewDoc(NULL); if (fake != NULL) { - /* - * the dictionary should be shared since nodes are - * moved over. - */ + /* + * Should the dictionary still be shared even though + * the nodes are being copied rather than moved? + */ fake->dict = doc->dict; xmlDictReference(doc->dict); #ifdef WITH_XSLT_DEBUG xsltGenericDebug(xsltGenericDebugContext, - "reusing dictionary from %s for stylesheet\n", - doc->URL); + "reusing dictionary from %s for embedded stylesheet\n", + doc->URL); #endif - xmlUnlinkNode(subtree); - xmlAddChild((xmlNodePtr) fake, subtree); + newtree = xmlDocCopyNode(subtree, fake, 1); + + fake->URL = xmlNodeGetBase(doc, subtree->parent); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "set base URI for embedded stylesheet as %s\n", + fake->URL); +#endif + + /* + * Add all namespaces in scope of embedded stylesheet to + * root element of newly created stylesheet document + */ + while ((subtree = subtree->parent) != (xmlNodePtr)doc) { + for (ns = subtree->ns; ns; ns = ns->next) { + xmlNewNs(newtree, ns->href, ns->prefix); + } + } + + xmlAddChild((xmlNodePtr)fake, newtree); ret = xsltParseStylesheetDoc(fake); if (ret == NULL) xmlFreeDoc(fake); diff --git a/reactos/dll/3rdparty/libxslt/xsltInternals.h b/reactos/dll/3rdparty/libxslt/xsltInternals.h index f176264ccb0..e991a93c901 100644 --- a/reactos/dll/3rdparty/libxslt/xsltInternals.h +++ b/reactos/dll/3rdparty/libxslt/xsltInternals.h @@ -21,6 +21,7 @@ #include #include #include "xsltexports.h" +#include "xsltlocale.h" #include "numbersInternals.h" #ifdef __cplusplus @@ -1045,6 +1046,7 @@ struct _xsltStyleItemSort { int descending; /* sort */ const xmlChar *lang; /* sort */ int has_lang; /* sort */ + xsltLocale locale; /* sort */ const xmlChar *case_order; /* sort */ int lower_first; /* sort */ @@ -1246,10 +1248,6 @@ struct _xsltVarInfo { const xmlChar *nsName; }; -#define XSLT_ELEMENT_CATEGORY_XSLT 0 -#define XSLT_ELEMENT_CATEGORY_EXTENSION 1 -#define XSLT_ELEMENT_CATEGORY_LRE 2 - /** * xsltCompilerNodeInfo: * @@ -1381,6 +1379,7 @@ struct _xsltStylePreComp { int descending; /* sort */ const xmlChar *lang; /* sort */ int has_lang; /* sort */ + xsltLocale locale; /* sort */ const xmlChar *case_order; /* sort */ int lower_first; /* sort */ @@ -1417,9 +1416,6 @@ struct _xsltStylePreComp { #endif /* XSLT_REFACTORED */ -#define XSLT_VAR_GLOBAL 1<<0 -#define XSLT_VAR_IN_SELECT 1<<1 -#define XSLT_TCTXT_VARIABLE(c) ((xsltStackElemPtr) (c)->contextVariable) /* * The in-memory structure corresponding to an XSLT Variable * or Param. @@ -1778,6 +1774,7 @@ struct _xsltTransformContext { exits */ xmlDocPtr localRVTBase; int keyInitLevel; /* Needed to catch recursive keys issues */ + int funcLevel; /* Needed to catch recursive functions issues */ }; /** diff --git a/reactos/dll/3rdparty/libxslt/xsltconfig.h b/reactos/dll/3rdparty/libxslt/xsltconfig.h index 777e3acf366..db20ebd1275 100644 --- a/reactos/dll/3rdparty/libxslt/xsltconfig.h +++ b/reactos/dll/3rdparty/libxslt/xsltconfig.h @@ -20,28 +20,28 @@ extern "C" { * * the version string like "1.2.3" */ -#define LIBXSLT_DOTTED_VERSION "1.1.24" +#define LIBXSLT_DOTTED_VERSION "1.1.26" /** * LIBXSLT_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXSLT_VERSION 10124 +#define LIBXSLT_VERSION 10126 /** * LIBXSLT_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXSLT_VERSION_STRING "10124" +#define LIBXSLT_VERSION_STRING "10126" /** * LIBXSLT_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXSLT_VERSION_EXTRA "-CVS1070" +#define LIBXSLT_VERSION_EXTRA "-GITv1.1.26" /** * WITH_XSLT_DEBUG: @@ -116,13 +116,26 @@ extern "C" { * Whether module support is configured into libxslt * Note: no default module path for win32 platforms */ -#if 0 +#if 1 #ifndef WITH_MODULES #define WITH_MODULES #endif #define LIBXSLT_DEFAULT_PLUGINS_PATH() "/usr/lib/libxslt-plugins" #endif +/** + * Locale support + */ +#if 1 +#ifndef XSLT_LOCALE_XLOCALE +#define XSLT_LOCALE_XLOCALE +#endif +#elif 0 +#ifndef XSLT_LOCALE_WINAPI +#define XSLT_LOCALE_WINAPI +#endif +#endif + /** * ATTRIBUTE_UNUSED: * diff --git a/reactos/dll/3rdparty/libxslt/xsltconfig.h.in b/reactos/dll/3rdparty/libxslt/xsltconfig.h.in index a8b5acfbfd0..b4cac6d3219 100644 --- a/reactos/dll/3rdparty/libxslt/xsltconfig.h.in +++ b/reactos/dll/3rdparty/libxslt/xsltconfig.h.in @@ -123,6 +123,19 @@ extern "C" { #define LIBXSLT_DEFAULT_PLUGINS_PATH() "@LIBXSLT_DEFAULT_PLUGINS_PATH@" #endif +/** + * Locale support + */ +#if @XSLT_LOCALE_XLOCALE@ +#ifndef XSLT_LOCALE_XLOCALE +#define XSLT_LOCALE_XLOCALE +#endif +#elif @XSLT_LOCALE_WINAPI@ +#ifndef XSLT_LOCALE_WINAPI +#define XSLT_LOCALE_WINAPI +#endif +#endif + /** * ATTRIBUTE_UNUSED: * diff --git a/reactos/dll/3rdparty/libxslt/xsltlocale.c b/reactos/dll/3rdparty/libxslt/xsltlocale.c new file mode 100644 index 00000000000..ec03cde0f5d --- /dev/null +++ b/reactos/dll/3rdparty/libxslt/xsltlocale.c @@ -0,0 +1,509 @@ +/* + * xsltlocale.c: locale handling + * + * Reference: + * RFC 3066: Tags for the Identification of Languages + * http://www.ietf.org/rfc/rfc3066.txt + * ISO 639-1, ISO 3166-1 + * + * Author: Nick Wellnhofer + * winapi port: Roumen Petrov + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#include + +#include "xsltlocale.h" +#include "xsltutils.h" + +#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 2 +#define newlocale __newlocale +#define freelocale __freelocale +#define strxfrm_l __strxfrm_l +#define LC_COLLATE_MASK (1 << LC_COLLATE) +#endif + +#define ISALPHA(c) ((c & 0xc0) == 0x40 && (unsigned)((c & 0x1f) - 1) < 26) +#define TOUPPER(c) (c & ~0x20) +#define TOLOWER(c) (c | 0x20) + +/*without terminating null character*/ +#define XSLTMAX_ISO639LANGLEN 8 +#define XSLTMAX_ISO3166CNTRYLEN 8 + /* - */ +#define XSLTMAX_LANGTAGLEN (XSLTMAX_ISO639LANGLEN+1+XSLTMAX_ISO3166CNTRYLEN) + +static const xmlChar* xsltDefaultRegion(const xmlChar *localeName); + +#ifdef XSLT_LOCALE_WINAPI +xmlRMutexPtr xsltLocaleMutex = NULL; + +struct xsltRFC1766Info_s { + /*note typedef unsigned char xmlChar !*/ + xmlChar tag[XSLTMAX_LANGTAGLEN+1]; + /*note typedef LCID xsltLocale !*/ + xsltLocale lcid; +}; +typedef struct xsltRFC1766Info_s xsltRFC1766Info; + +static int xsltLocaleListSize = 0; +static xsltRFC1766Info *xsltLocaleList = NULL; + + +static xsltLocale +xslt_locale_WINAPI(const xmlChar *languageTag) { + int k; + xsltRFC1766Info *p = xsltLocaleList; + + for (k=0; ktag, languageTag) == 0) return p->lcid; + return((xsltLocale)0); +} + +static void xsltEnumSupportedLocales(void); +#endif + +/** + * xsltNewLocale: + * @languageTag: RFC 3066 language tag + * + * Creates a new locale of an opaque system dependent type based on the + * language tag. + * + * Returns the locale or NULL on error or if no matching locale was found + */ +xsltLocale +xsltNewLocale(const xmlChar *languageTag) { +#ifdef XSLT_LOCALE_XLOCALE + xsltLocale locale; + char localeName[XSLTMAX_LANGTAGLEN+6]; /* 6 chars for ".utf8\0" */ + const xmlChar *p = languageTag; + const char *region = NULL; + char *q = localeName; + int i, llen; + + /* Convert something like "pt-br" to "pt_BR.utf8" */ + + if (languageTag == NULL) + return(NULL); + + for (i=0; i= xstrlen) { + xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : strxfrm failed\n"); + xmlFree(xstr); + return(NULL); + } + + return(xstr); +#endif /* XSLT_LOCALE_NONE */ +} + +/** + * xsltLocaleStrcmp: + * @locale: a locale identifier + * @str1: a string transformed with xsltStrxfrm + * @str2: a string transformed with xsltStrxfrm + * + * Compares two strings transformed with xsltStrxfrm + * + * Returns a value < 0 if str1 sorts before str2, + * a value > 0 if str1 sorts after str2, + * 0 if str1 and str2 are equal wrt sorting + */ +int +xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocaleChar *str2) { + (void)locale; +#ifdef XSLT_LOCALE_WINAPI +{ + int ret; + if (str1 == str2) return(0); + if (str1 == NULL) return(-1); + if (str2 == NULL) return(1); + ret = CompareStringW(locale, 0, str1, -1, str2, -1); + if (ret == 0) { + xsltTransformError(NULL, NULL, NULL, "xsltLocaleStrcmp : CompareStringW fail\n"); + return(0); + } + return(ret - 2); +} +#else + return(xmlStrcmp(str1, str2)); +#endif +} + +#ifdef XSLT_LOCALE_WINAPI +/** + * xsltCountSupportedLocales: + * @lcid: not used + * + * callback used to count locales + * + * Returns TRUE + */ +BOOL CALLBACK +xsltCountSupportedLocales(LPSTR lcid) { + (void) lcid; + ++xsltLocaleListSize; + return(TRUE); +} + +/** + * xsltIterateSupportedLocales: + * @lcid: not used + * + * callback used to track locales + * + * Returns TRUE if not at the end of the array + */ +BOOL CALLBACK +xsltIterateSupportedLocales(LPSTR lcid) { + static int count = 0; + xmlChar iso639lang [XSLTMAX_ISO639LANGLEN +1]; + xmlChar iso3136ctry[XSLTMAX_ISO3166CNTRYLEN+1]; + int k, l; + xsltRFC1766Info *p = xsltLocaleList + count; + + k = sscanf(lcid, "%lx", (long*)&p->lcid); + if (k < 1) goto end; + /*don't count terminating null character*/ + k = GetLocaleInfoA(p->lcid, LOCALE_SISO639LANGNAME , iso639lang , sizeof(iso639lang )); + if (--k < 1) goto end; + l = GetLocaleInfoA(p->lcid, LOCALE_SISO3166CTRYNAME, iso3136ctry, sizeof(iso3136ctry)); + if (--l < 1) goto end; + + { /*fill results*/ + xmlChar *q = p->tag; + memcpy(q, iso639lang, k); + q += k; + *q++ = '-'; + memcpy(q, iso3136ctry, l); + q += l; + *q = '\0'; + } + ++count; +end: + return((count < xsltLocaleListSize) ? TRUE : FALSE); +} + + +static void +xsltEnumSupportedLocales(void) { + xmlRMutexLock(xsltLocaleMutex); + if (xsltLocaleListSize <= 0) { + size_t len; + + EnumSystemLocalesA(xsltCountSupportedLocales, LCID_SUPPORTED); + + len = xsltLocaleListSize * sizeof(xsltRFC1766Info); + xsltLocaleList = xmlMalloc(len); + memset(xsltLocaleList, 0, len); + EnumSystemLocalesA(xsltIterateSupportedLocales, LCID_SUPPORTED); + } + xmlRMutexUnlock(xsltLocaleMutex); +} + +#endif /*def XSLT_LOCALE_WINAPI*/ diff --git a/reactos/dll/3rdparty/libxslt/xsltlocale.h b/reactos/dll/3rdparty/libxslt/xsltlocale.h new file mode 100644 index 00000000000..59343b0aa26 --- /dev/null +++ b/reactos/dll/3rdparty/libxslt/xsltlocale.h @@ -0,0 +1,57 @@ +/* + * Summary: Locale handling + * Description: Interfaces for locale handling. Needed for language dependent + * sorting. + * + * Copy: See Copyright for the status of this software. + * + * Author: Nick Wellnhofer + */ + +#ifndef __XML_XSLTLOCALE_H__ +#define __XML_XSLTLOCALE_H__ + +#include + +#ifdef XSLT_LOCALE_XLOCALE + +#include +#include + +#ifdef __GLIBC__ +/*locale_t is defined only if _GNU_SOURCE is defined*/ +typedef __locale_t xsltLocale; +#else +typedef locale_t xsltLocale; +#endif +typedef xmlChar xsltLocaleChar; + +#elif defined(XSLT_LOCALE_WINAPI) + +#include +#include + +typedef LCID xsltLocale; +typedef wchar_t xsltLocaleChar; + +#else + +/* + * XSLT_LOCALE_NONE: + * Macro indicating that locale are not supported + */ +#ifndef XSLT_LOCALE_NONE +#define XSLT_LOCALE_NONE +#endif + +typedef void *xsltLocale; +typedef xmlChar xsltLocaleChar; + +#endif + +xsltLocale xsltNewLocale(const xmlChar *langName); +void xsltFreeLocale(xsltLocale locale); +xsltLocaleChar *xsltStrxfrm(xsltLocale locale, const xmlChar *string); +int xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocaleChar *str2); + +#endif /* __XML_XSLTLOCALE_H__ */ diff --git a/reactos/dll/3rdparty/libxslt/xsltutils.c b/reactos/dll/3rdparty/libxslt/xsltutils.c index 603b22e18d9..9565e152fbf 100644 --- a/reactos/dll/3rdparty/libxslt/xsltutils.c +++ b/reactos/dll/3rdparty/libxslt/xsltutils.c @@ -1039,6 +1039,12 @@ xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort) { } } else { if (res->type == XPATH_STRING) { + if (comp->locale != (xsltLocale)0) { + xmlChar *str = res->stringval; + res->stringval = (xmlChar *) xsltStrxfrm(comp->locale, str); + xmlFree(str); + } + results[i] = res; } else { #ifdef WITH_XSLT_DEBUG_PROCESS @@ -1191,6 +1197,11 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, results[j + incr]->floatval) tst = 1; else tst = -1; + } else if(comp->locale != (xsltLocale)0) { + tst = xsltLocaleStrcmp( + comp->locale, + (xsltLocaleChar *) results[j]->stringval, + (xsltLocaleChar *) results[j + incr]->stringval); } else { tst = xmlStrcmp(results[j]->stringval, results[j + incr]->stringval); @@ -1245,6 +1256,11 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, res[j + incr]->floatval) tst = 1; else tst = -1; + } else if(comp->locale != (xsltLocale)0) { + tst = xsltLocaleStrcmp( + comp->locale, + (xsltLocaleChar *) res[j]->stringval, + (xsltLocaleChar *) res[j + incr]->stringval); } else { tst = xmlStrcmp(res[j]->stringval, res[j + incr]->stringval); diff --git a/reactos/dll/3rdparty/libxslt/xsltwin32config.h b/reactos/dll/3rdparty/libxslt/xsltwin32config.h index 1016c1e5b33..a2dfb0882de 100644 --- a/reactos/dll/3rdparty/libxslt/xsltwin32config.h +++ b/reactos/dll/3rdparty/libxslt/xsltwin32config.h @@ -23,21 +23,21 @@ extern "C" { * * the version string like "1.2.3" */ -#define LIBXSLT_DOTTED_VERSION "1.1.24" +#define LIBXSLT_DOTTED_VERSION "1.1.26" /** * LIBXSLT_VERSION: * * the version number: 1.2.3 value is 1002003 */ -#define LIBXSLT_VERSION 10124 +#define LIBXSLT_VERSION 10126 /** * LIBXSLT_VERSION_STRING: * * the version number string, 1.2.3 value is "1002003" */ -#define LIBXSLT_VERSION_STRING "10124" +#define LIBXSLT_VERSION_STRING "10126" /** * LIBXSLT_VERSION_EXTRA: