From 79a014446b409b8c7ed5eaa09de89a13e43c7526 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 26 Nov 2025 16:37:40 +0200 Subject: [PATCH] [LIBXSLT] Update to release 1.1.42 (from Wine-10.0) --- dll/3rdparty/libxslt/CMakeLists.txt | 7 +- dll/3rdparty/libxslt/Makefile.am | 79 - dll/3rdparty/libxslt/NEWS | 1454 ----------------- dll/3rdparty/libxslt/attributes.c | 40 +- dll/3rdparty/libxslt/attributes.h | 1 + dll/3rdparty/libxslt/attrvt.c | 47 +- dll/3rdparty/libxslt/config.h | 3 - dll/3rdparty/libxslt/documents.c | 24 +- dll/3rdparty/libxslt/extensions.c | 91 +- dll/3rdparty/libxslt/extra.c | 20 +- dll/3rdparty/libxslt/functions.c | 247 ++- dll/3rdparty/libxslt/imports.c | 99 +- dll/3rdparty/libxslt/keys.c | 46 +- dll/3rdparty/libxslt/libxslt.3 | 31 - dll/3rdparty/libxslt/libxslt.spec | 242 +++ dll/3rdparty/libxslt/namespaces.c | 22 +- dll/3rdparty/libxslt/numbers.c | 115 +- dll/3rdparty/libxslt/pattern.c | 113 +- dll/3rdparty/libxslt/preproc.c | 36 +- dll/3rdparty/libxslt/security.c | 33 +- dll/3rdparty/libxslt/templates.c | 24 +- dll/3rdparty/libxslt/transform.c | 168 +- dll/3rdparty/libxslt/variables.c | 135 +- dll/3rdparty/libxslt/win32config.h | 2 +- dll/3rdparty/libxslt/xslt.c | 162 +- dll/3rdparty/libxslt/xsltconfig.h.in | 179 -- dll/3rdparty/libxslt/xsltlocale.c | 184 ++- dll/3rdparty/libxslt/xsltutils.c | 456 ++++-- sdk/include/reactos/libs/libxslt/libxslt.h | 10 +- sdk/include/reactos/libs/libxslt/variables.h | 6 +- .../reactos/libs/libxslt/xsltInternals.h | 22 +- sdk/include/reactos/libs/libxslt/xsltconfig.h | 14 +- sdk/include/reactos/libs/libxslt/xsltlocale.h | 78 +- sdk/include/reactos/libs/libxslt/xsltutils.h | 39 +- 34 files changed, 1779 insertions(+), 2450 deletions(-) delete mode 100644 dll/3rdparty/libxslt/Makefile.am delete mode 100644 dll/3rdparty/libxslt/NEWS delete mode 100644 dll/3rdparty/libxslt/config.h delete mode 100644 dll/3rdparty/libxslt/libxslt.3 create mode 100644 dll/3rdparty/libxslt/libxslt.spec delete mode 100644 dll/3rdparty/libxslt/xsltconfig.h.in diff --git a/dll/3rdparty/libxslt/CMakeLists.txt b/dll/3rdparty/libxslt/CMakeLists.txt index 86af9b2003e..6daf1cedab9 100644 --- a/dll/3rdparty/libxslt/CMakeLists.txt +++ b/dll/3rdparty/libxslt/CMakeLists.txt @@ -1,4 +1,6 @@ +spec2def(libxslt.dll libxslt.spec ADD_IMPORTLIB) + include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/libxslt ${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/libwin-iconv) @@ -7,7 +9,6 @@ add_definitions( -DWIN32 -D_WINDOWS -D_MBCS - -DHAVE_STAT -DHAVE_WIN32_THREADS -D_REENTRANT -DLIBXML_STATIC) @@ -41,6 +42,10 @@ add_importlibs(libxslt msvcrt ws2_32 kernel32) if(MSVC) add_importlibs(libxslt ntdll) + if (ARCH STREQUAL "amd64" OR ARCH STREQUAL "arm64") + # warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data + target_compile_options(libxslt PRIVATE /wd4267) + endif() endif() if(NOT MSVC) diff --git a/dll/3rdparty/libxslt/Makefile.am b/dll/3rdparty/libxslt/Makefile.am deleted file mode 100644 index a2d766f5653..00000000000 --- a/dll/3rdparty/libxslt/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = libxslt libexslt xsltproc doc tests -if WITH_PYTHON -SUBDIRS += python -endif - -DIST_SUBDIRS = libxslt libexslt xsltproc python doc tests - -confexecdir=$(libdir) -confexec_DATA = xsltConf.sh - -bin_SCRIPTS = xslt-config - -dist-hook: cleanup - touch $(distdir)/doc/*.xml - touch $(distdir)/doc/EXSLT/*.xml - touch $(distdir)/libxslt/*.syms - (cd $(srcdir) ; tar -cf - win32 vms examples) | (cd $(distdir); tar xf -) - -EXTRA_DIST = xsltConf.sh.in \ - FEATURES TODO Copyright \ - CMakeLists.txt config.h.cmake.in libxslt-config.cmake.in libxslt-config.cmake.cmake.in - -## We create xsltConf.sh here and not from configure because we want -## to get the paths expanded correctly. Macros like srcdir are given -## the value NONE in configure if the user doesn't specify them (this -## is an autoconf feature, not a bug). - -xsltConf.sh: xsltConf.sh.in Makefile -## Use sed and then mv to avoid problems if the user interrupts. - sed -e 's?\@XSLT_LIBDIR\@?$(XSLT_LIBDIR)?g' \ - -e 's?\@XSLT_INCLUDEDIR\@?$(XSLT_INCLUDEDIR)?g' \ - -e 's?\@VERSION\@?$(VERSION)?g' \ - -e 's?\@XSLT_LIBS\@?$(XSLT_LIBS) $(EXTRA_LIBS)?g' \ - -e 's?\@XSLT_PRIVATE_LIBS\@?$(XSLT_PRIVATE_LIBS)?g' \ - < $(srcdir)/xsltConf.sh.in > xsltConf.tmp \ - && mv xsltConf.tmp xsltConf.sh - -CLEANFILES = xsltConf.sh - -check-local: tests - -dummy: - -tests: dummy - @echo '## Running the regression test suite' - @(cd tests ; $(MAKE) -s tests) - @(cd xsltproc ; $(MAKE) -s tests) -if WITH_PYTHON - @cd python && $(MAKE) tests -endif - -valgrind: - @echo '## Running the regression tests under Valgrind' - @echo '## Go get a cup of coffee it is gonna take a while ...' - @(cd tests ; $(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests) - @(cd xsltproc ; $(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests) - -cleanup: - -@(find . -name .\#\* -exec rm {} \;) - -cleantar: - @(rm -f libxslt*.tar.gz) - -rpm: cleantar - @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz) - - -pkgconfigdir=$(libdir)/pkgconfig -pkgconfig_DATA = libxslt.pc libexslt.pc - -cmakedir = $(libdir)/cmake/libxslt -dist_cmake_DATA = FindGcrypt.cmake -cmake_DATA = libxslt-config.cmake - -m4datadir = $(datadir)/aclocal -dist_m4data_DATA = libxslt.m4 - diff --git a/dll/3rdparty/libxslt/NEWS b/dll/3rdparty/libxslt/NEWS deleted file mode 100644 index dc97c2ca621..00000000000 --- a/dll/3rdparty/libxslt/NEWS +++ /dev/null @@ -1,1454 +0,0 @@ -NEWS file for libxslt - -v1.1.37: Aug 29 2022 - -### Improvements - -- Don't use deprecated libxml2 macros -- Don't mess with xmlDefaultSAXHandler - -### Build system - -- Require automake-1.16.3 or later -- Remove generated files from distribution -- Add missing compile definition for static builds to Autotools (Mike Dalessio) - - -v1.1.36: Aug 17 2022 - -### Removals and deprecations - -- Remove SVN keyword anchors -- Remove CVS and SVN-related code -- Remove README.cvs-commits -- Remove ChangeLog -- Remove xsltwin32config.h - -### Improvements - -- Simplify xsltexports.h and exsltexports.h -- Don't overlink executables with gcrypt -- Fix quadratic behavior with variables and parameters -- Remove case labels with XPointer location types -- Add configure~ to .gitignore -- Stop calling deprecated libxml2 functions - -### Portability - -- Use portable python shebangs (David Seifert) -- Remove useless __CYGWIN__ checks -- Remove cruft from win32config.h -- crypto.c: Silence a compiler warning on Windows (Chun-wei Fan) - -### Build system - -- Add missing compile definition for static builds to CMake -- Avoid obsolescent `test -a` constructs (David Seifert) -- Only link libxml2 statically in purely static build -- Set AC_CONFIG_MACRO_DIR -- Allow AM_MAINTAINER_MODE to be disabled -- Streamline and fix documentation installation -- Don't try to recreate COPYING symlink -- Remove special configuration for certain maintainers -- configure.ac: produce tar.xz only (GNOME policy) (David Seifert) -- Detect libm using libtool's macros (David Seifert) -- configure.ac: disable static libraries by default (David Seifert) -- python/Makefile.am: nest python docs in $(docdir) (David Seifert) -- python/Makefile.am: rely on global AM_INIT_AUTOMAKE (David Seifert) -- configure.ac: remove useless AC_SUBST (David Seifert) -- Use AM_PATH_PYTHON/PKG_CHECK_MODULES for python bindings (David Seifert) -- Change libxml2 Python config -- Don't check for standard C89 library functions -- Don't check for standard C89 headers -- Remove --with-html-dir option -- Also check for glibtoolize in autogen.sh -- Rework documentation build system -- Remove old website -- CMake: Relax check for enabling crypto support on Windows (Chun-wei Fan) -- Remove obsolete AC_HEADER_STDC autoconf macro (Vadim Zeitlin) -- Remove special configuration for old maintainers - -### Test suite, CI - -- Remove test involving XPointer range-to function -- Test recursion in EXSLT dynamic functions -- Add CI job for static build - -### Documentation - -- Move tutorial images - - -v1.1.35: Feb 16 2022: - - Security: - [CVE-2021-30560] Fix use-after-free in xsltApplyTemplates - Fix memory leak in xsltDocumentElem (David King) - Fix memory leak in xsltCompileIdKeyPattern (David King) - Fix double-free with stylesheets containing entity nodes - - - Fixed regressions: - Fix performance regression with predicates in patterns - Fix regression in xsltComputeSortResult - - - Bug fixes: - Fix conflict resolution for templates with same priority - Fix xsl:number generating invalid UTF-8 - Support attribute value templates in xsl:sort lang attributes - Don't pass first in twice - Fix quadratic runtime with text and - Don't allow empty EXSLT durations - - - Improvements: - Add xsltproc --huge Argument via libxml XML_PARSE_HUGE (William N. Braswell, Jr.) - - - Tests, code quality, fuzzing: - Remove .travis.yml - Fix some misleading indentation (David King) - Use actual types for templates in struct _xsltStylesheet - Add CI for CMake on MSVC (Markus Rickert) - Check for null pointer before calling freelocale - Add CI test for Python 3 - Don't set maxDepth in XPath contexts - Transfer XPath limits to XPtr context - Stop using maxParserDepth XPath limit - Make long-to-double cast explicit in date.c - Disable LeakSanitizer - Run clang CI tests with -Wimplicit-int-conversion - Fix implicit-int-conversion warning in exslt/crypto.c - Fix clang -Wimplicit-int-conversion warning (David Kilzer) - Fix clang -Wconditional-uninitialized warning in libxslt/numbers.c (David Kilzer) - Fix -Wshadow warnings in libexslt/dynamic.c (David Kilzer) - Also search parent dir for source XML when fuzzing - - - Build system, portability: - Add CMake build files (Markus Rickert) - Initial support for Python 3 (Suleyman Poyraz) - Call ANSI versions of WinAPI functions explicitly - Remove redundant flags from pkg-config files - Suppress automake warning in tests/XSLTMark - Fix linking libexslt dynamic library when using MinGW (Vadim Zeitlin) - Added platform specific path separators (Dmitriy Korovkin) - win32: allow passing *FLAGS on command line - Fix export of xsltExtMarker on Windows (David Kilzer) - Fix redundant includes already in libexslt.h (David Kilzer) - Minor fixes to configure.js - Fix variable syntax in Python configuration - Add new EXSLT string tests to EXTRA_DIST - Fix xml2-config check in configure script - win32: Add configuration for profiler (Chun-wei Fan) - Check whether 'xml2-config --dynamic' is supported - - - Documentation: - Add Makefile rule to regenerate xsltproc.html - Update links - Remove MAINTAINERS - Upload documentation to GitLab Pages - Add documentation in devhelp format - Add --enable-rebuild-docs configure option - Fix libexslt header summaries - Fix validity of tutorial XML (David King) - Use DocBook URL for tutorial DTD (David King) - Update libxslt.doap - Add missing options to xsltproc man page - - - -v1.1.34: Oct 30 2019: - - Documentation: - Fix EXSLT web pages (Nick Wellnhofer), - Regenerate web pages (Nick Wellnhofer), - Fix Git link in news.html (Nick Wellnhofer), - Minor documentation fixes after recent changes (Nick Wellnhofer), - Fix typos (Jan Pokorný), - Regenerate symbols and API docs (Nick Wellnhofer), - Regenerate EXSLT website (Nick Wellnhofer) - - - Portability: - Remove stubs when compiling without debugger or profiler (Nick Wellnhofer), - configure.ac: Invoke PKG_CHECK_MODULES for building shared libraries (Hugh McMaster), - configure.ac: Conditionally determine whether xml2-config should pass shared libraries or static libraries (Hugh McMaster), - xslt-config.in: Fix broken --prefix=DIR support (Hugh McMaster), - libexslt.pc.in: Do not expose private library dependencies unless invoked (Hugh McMaster), - libxslt.pc.in: Do not expose private library dependencies unless invoked (Hugh McMaster), - Fix -Wformat-overflow warning (GCC 9) (Nick Wellnhofer), - Stop including ansidecl.h (Nick Wellnhofer), - Remove WIN32_EXTRA_* variables (Nick Wellnhofer), - Fix vsnprintf in Python bindings on Windows (Nick Wellnhofer), - Build without winsock (Nick Wellnhofer), - Stop redefining snprintf on MinGW (Nick Wellnhofer) - - - Bug Fixes: - xsl:template without name and match attributes should not be allowed (Nikolai Weibull), - Make sure that Python tests exit with error code (Nick Wellnhofer), - Improve handling of invalid UTF-8 in format-number (Nick Wellnhofer), - Fix dangling pointer in xsltCopyText (Nick Wellnhofer), - Fix memory leak in pattern compilation error path (Nick Wellnhofer), - Fix uninitialized read with UTF-8 grouping chars (Nick Wellnhofer), - Fix integer overflow in FORMAT_GYEAR (Nick Wellnhofer), - Fix performance regression with xsl:number (Nick Wellnhofer), - Backup XPath context node in xsltInitCtxtKey (Nick Wellnhofer), - Fix unsigned integer overflow in date.c (Nick Wellnhofer), - Fix insertion of xsl:fallback content (Nick Wellnhofer), - Avoid quadratic behavior in xsltSaveResultTo (Nick Wellnhofer), - Fix numbering in non-Latin scripts (Nick Wellnhofer), - Fix uninitialized read of xsl:number token (Nick Wellnhofer), - Fix integer overflow in _exsltDateDayInWeek (Nick Wellnhofer), - Rework xsltAttrVT allocation (Nick Wellnhofer), - Fix check of xsltTestCompMatch return value (Nick Wellnhofer), - Fix security framework bypass (Nick Wellnhofer), - Use xmlNewTextChild in EXSLT dyn:map (Nick Wellnhofer), - Fix float casts in exsltDateDuration (Nick Wellnhofer), - Always set context node before calling XPath iterators (Nick Wellnhofer), - Fix attribute precedence with xsl:use-attribute-sets (Nick Wellnhofer), - Backup context node in exsltFuncFunctionFunction (Nick Wellnhofer), - Initialize ctxt->output before evaluating global vars (Nick Wellnhofer), - Fix memory leak in EXSLT functions error path (Nick Wellnhofer) - - - Improvements: - Enable continuous integration via GitLab CI (Nick Wellnhofer), - Fix -Wimplicit-fallthrough warnings (Nick Wellnhofer), - Adjust number of API index pages (Nick Wellnhofer), - Make xsltCompileRelativePathPattern non-recursive (Nick Wellnhofer), - Check that crypto:rc4_decrypt produces valid UTF-8 (Nick Wellnhofer), - Avoid recursion in keys.c:skipPredicate (Nick Wellnhofer), - xslt-config.in: Simply handling of $all_flags (Hugh McMaster), - xslt-config.in: Add a --dynamic option to --libs (Hugh McMaster), - xslt-config.in: Simplify basic library handling (Hugh McMaster), - xslt-config.in: Remove unused variable (Hugh McMaster), - xslt-config: Simply handling of --cflags (Hugh McMaster), - Add Travis test with MemorySanitizer (Nick Wellnhofer), - Run Travis ASan tests under Xenial (Nick Wellnhofer), - Improve fuzzers (Nick Wellnhofer), - Always reuse XPath context (Nick Wellnhofer), - Compile with -Wextra (Nick Wellnhofer), - Make profiler support optional (Nick Wellnhofer), - Hide unused code when compiling without debugger (Nick Wellnhofer), - Reorganize fuzzing code (Nick Wellnhofer), - Simplify .gitignore (Nick Wellnhofer), - Optional operation limit (Nick Wellnhofer), - Improve seed corpus and dictionary (Nick Wellnhofer), - Reuse XPath context when compiling stylesheets (Nick Wellnhofer), - Reuse XPath context in dyn:map (Nick Wellnhofer), - Reuse XPath context in saxon:expression (Nick Wellnhofer), - Add libFuzzer targets (Nick Wellnhofer), - Adjust error message in expected test output (Nick Wellnhofer), - Change bug tracker URL (Nick Wellnhofer), - Change git repo URL (Nick Wellnhofer), - Regenerate NEWS (Nick Wellnhofer), - Fix misleading indentation in security.c (Nick Wellnhofer) - - - Cleanups: - Candidate release 1 of libxslt 1.1.34 * doc/xsltproc.xml: moved to new place for docbook stylesheet and work around a missing / inrewrite of docbook xsl catalog in Fedora 30 * tests/fuzz/Makefile.am: add fuzz.h to sources * python/Makefile.am: there is no more TODO * libxslt.spec.in: run make tests instead of check to avoid fuzz in that environment, and drop python TODO (Daniel Veillard), - Remove empty TODO file (Nick Wellnhofer), - Remove generated file libxsltclass.txt from version control (Nick Wellnhofer), - Rebuild docs (Nick Wellnhofer) - - - -v1.1.33: Jan 03 2019: - - Portability: - Variables need 'extern' in static lib on Cygwin (Nick Wellnhofer), - Really declare dllexport/dllimport for Cygwin (Michael Haubenwallner), - Fix callback signatures in Python bindings (Nick Wellnhofer), - Fix transform callback signatures (Nick Wellnhofer), - Fix extension callback signatures (Nick Wellnhofer), - Fix deallocator signatures (Nick Wellnhofer), - Fix XPath callback signatures (Nick Wellnhofer), - Fix hash callback signatures (Nick Wellnhofer) - - - Bug Fixes: - Don't cache direct evaluation of patterns with variables (Nick Wellnhofer), - Move function result RVTs to context variable (Nick Wellnhofer), - Fix EXSLT functions returning RVTs from outer scopes (Nick Wellnhofer), - Fix handling of RVTs returned from nested EXSLT functions (Nick Wellnhofer), - Fix typos (Nick Wellnhofer) - - - Improvements: - Run Travis ASan tests with "sudo: required" (Nick Wellnhofer) - - - Cleanups: - Remove doc/libxslt-decl.txt (Nick Wellnhofer), - Docs for 1.1.32 release (Daniel Veillard) - - - -1.1.32: Nov 02 2017: - - Portability: - Add missing limits.h include (Nick Wellnhofer), - Also run Windows tests with --maxdepth 200 (Nick Wellnhofer), - Disable some MSVC warnings (Nick Wellnhofer), - Fix deprecated Travis compiler flag (Nick Wellnhofer), - Run general tests with maxdepth=200 (Nick Wellnhofer), - Use _WIN32 macro instead of WIN32 (Nick Wellnhofer), - Fix xsltproc newlines on Windows (Nick Wellnhofer), - Fix Windows compiler warnings (Nick Wellnhofer), - Rework locale feature tests (Nick Wellnhofer) - - - Improvements: - Rebuild win32/libxslt.def.src (Nick Wellnhofer), - Fix compiler warnings in Python bindings (Nick Wellnhofer) - - - -v1.1.31: Oct 06 2017: - - Portability: - Fix win32/configure.js (Nick Wellnhofer) - - - Bug Fixes: - Fix pkg-config related regressions in configure script (Nick Wellnhofer) - - - Improvements: - Adjust expected error output for libxml2 changes (Nick Wellnhofer), - Misc autoconf updates (Nick Wellnhofer) - - - -v1.1.30: Sep 04 2017: - - Documentation: - Misc doc fixes (Nick Wellnhofer) - - - Portability: - Look for libxml2 via pkg-config first (Elliott Sales de Andrade), - Change default SOPREFIX on Windows to "bin" (Nick Wellnhofer), - Add WIN32_EXTRA_LDFLAGS to tests/plugins/Makefile.am (Michael Haubenwallner) - - - Bug Fixes: - Also fix memory hazards in exsltFuncResultElem (Nick Wellnhofer), - Fix NULL deref in xsltDefaultSortFunction (Nick Wellnhofer), - Fix memory hazards in exsltFuncFunctionFunction (Nick Wellnhofer), - Fix memory leaks in EXSLT error paths (Nick Wellnhofer), - Fix memory leak in str:concat with empty node-set (Nick Wellnhofer), - Fix memory leaks in error paths (Nick Wellnhofer), - Switch to xmlUTF8Strsize in numbers.c (Nick Wellnhofer), - Fix NULL pointer deref in xsltFormatNumberFunction (Nick Wellnhofer), - Fix UTF-8 check in str:padding (Nick Wellnhofer), - Fix xmlStrPrintf argument (Nick Wellnhofer), - Check for overflow in _exsltDateParseGYear (Nick Wellnhofer), - Fix double to int conversion (Nick Wellnhofer), - Check for overflow in exsltDateParseDuration (Nick Wellnhofer), - Change version of xsltMaxVars back to 1.0.24 (Nick Wellnhofer), - Disable xsltCopyTextString optimization for extensions (Nick Wellnhofer), - Create DOCTYPE for HTML version 5 (Nick Wellnhofer), - Make xsl:decimal-format work with namespaces (Nick Wellnhofer), - Remove norm:localTime extension function (Nick Wellnhofer), - Check for integer overflow in xsltAddTextString (Nick Wellnhofer), - Detect infinite recursion when evaluating function arguments (Nick Wellnhofer), - Fix memory leak in xsltElementAvailableFunction (Nick Wellnhofer), - Fix for pattern predicates calling functions (Nick Wellnhofer), - Fix cmd.exe invocations in Makefile.mingw (Nick Wellnhofer), - Don't try to install index.sgml (Nick Wellnhofer), - Fix symbols.xml (Nick Wellnhofer), - Fix heap overread in xsltFormatNumberConversion (Nick Wellnhofer), - Fix for non-element nodes (Nick Wellnhofer), - Fix unreachable code in xsltAddChild (mahendra.n), - Change version number in xsl:version warning (Nick Wellnhofer), - Avoid infinite recursion after failed param evaluation (Nick Wellnhofer), - Stop if potential recursion is detected (Nick Wellnhofer), - Consider built-in templates in apply-imports (Nick Wellnhofer), - Fix precedence with multiple attribute sets (Nick Wellnhofer), - Rework attribute set resolution (Nick Wellnhofer) - - - Improvements: - Add .travis.yml (Nick Wellnhofer), - Silence tests a little (Nick Wellnhofer), - Set LIBXML_SRC to absolute path (Nick Wellnhofer), - Add missing #include (Nick Wellnhofer), - Adjust expected error messages in tests (Nick Wellnhofer), - Make xsltDebug more quiet (Nick Wellnhofer), - New-line terminate error message that missed this convention (Jan Pokorný), - Use xmlBuffers in EXSLT string functions (Nick Wellnhofer), - Switch to xmlUTF8Strsize in EXSLT string functions (Nick Wellnhofer), - Check for return value of xmlUTF8Strlen (Nick Wellnhofer), - Avoid double/long round trip in FORMAT_ITEM (Nick Wellnhofer), - Separate date and duration structs (Nick Wellnhofer), - Check for overflow in _exsltDateDifference (Nick Wellnhofer), - Clamp seconds field of durations (Nick Wellnhofer), - Change _exsltDateAddDurCalc parameter types (Nick Wellnhofer), - Fix date:difference with time zones (Nick Wellnhofer), - Rework division/remainder arithmetic in date.c (Nick Wellnhofer), - Remove exsltDateCastDateToNumber (Nick Wellnhofer), - Change internal representation of years (Nick Wellnhofer), - Optimize IS_LEAP (Nick Wellnhofer), - Link libraries with libm (Jussi Kukkonen), - Rename xsltCopyTreeInternal to xsltCopyTree (Nick Wellnhofer), - Update linker version script (Nick Wellnhofer), - Add local wildcard to version script (Nick Wellnhofer), - Make some symbols static (Nick Wellnhofer), - Remove redundant NULL check in xsltNumberComp (mahendra.n), - Fix forwards compatibility for imported stylesheets (Nick Wellnhofer), - Reduce warnings in forwards-compatible mode (Nick Wellnhofer), - Precompute XSLT elements after preprocessing (Nick Wellnhofer), - Fix whitespace in xsltParseStylesheetTop (Nick Wellnhofer), - Consolidate recursion checks (Nick Wellnhofer), - Treat XSLT_STATE_STOPPED same as errors (Nick Wellnhofer), - Make sure that XSLT_STATE_STOPPED isn't overwritten (Nick Wellnhofer), - Add comment regarding built-in templates and params (Nick Wellnhofer), - Rewrite memory management of local RVTs (Nick Wellnhofer), - Validate QNames of attribute sets (Nick Wellnhofer), - Add xsl:attribute-set regression tests (Nick Wellnhofer), - Ignore imported stylesheets in xsltApplyAttributeSet (Nick Wellnhofer) - - - -1.1.29: May 24 2016: - - Security: - CVE-2015-7995 Fix for type confusion in preprocessing attributes (Daniel Veillard) - - - Documentation: - - - Portability: - Fix a portibility problem with previous commit (Eduard Sanou), - Fix MingW build (Nick Wellnhofer), - Correctly emulate snprintf on older MSVC versions (Nick Wellnhofer), - Add Python script to run some tests on Windows (Nick Wellnhofer), - Remove /OPT:NOWIN98 option (Nick Wellnhofer), - Visual Studio 14 CTP defines snprintf() (Daniel Veillard), - Use AC_PATH_TOOL to find libgcrypt-config and xml2-config (Micha¿ Górny), - Use $libdir for LIBXSLT_DEFAULT_PLUGINS_PATH (larryhaja), - Use mkdir macro also in case if mingw32. (Lars Kanis), - Add math library to executable link flags (Nick Wellnhofer), - Fix quoting of xlocale test program in configure.in (Nick Wellnhofer) - - - Bug Fixes: - Fix OOB heap read in xsltExtModuleRegisterDynamic (Nick Wellnhofer), - Remove CDATA markup from libxslt_tutorial.c (Nick Wellnhofer), - Remove generated headers from dist tarball (Nick Wellnhofer), - Mark XML file argument as repeatable (Nick Wellnhofer), - Keep timezone in date:add (Nick Wellnhofer), - Fix buffer overflow in exsltDateFormat (Nick Wellnhofer), - Fix saxon:line-number with namespace nodes (Nick Wellnhofer), - Fix dyn:map with namespace nodes (Nick Wellnhofer), - Fix error handling in Saxon extension functions (Nick Wellnhofer), - Fix double free in libexslt hash functions (Nick Wellnhofer), - Fix libxslt format warnings (David Kilzer), - Fix xsltNumberFormatGetMultipleLevel (Nick Wellnhofer), - Fix use-after-free in xsltDocumentFunctionLoadDocument (Nick Wellnhofer), - Always initialize EXSLT month and day to 1 (Nick Wellnhofer), - Fix possible NULL pointer deref in transform.c (mahendra.n), - Fix possible NULL pointer deref in xsltCopyTextString (Nick Wellnhofer), - Fix possible NULL pointer deref in libexslt/functions.c (Nick Wellnhofer), - Fix possible NULL pointer deref in xsltproc.c (mahendra.n), - Fix possible NULL pointer deref in preproc.c (mahendra.n), - Fix LIBXSLT_DEFAULT_PLUGINS_PATH in xsltconfig.h (Nick Wellnhofer), - Fix memory leak in xsltNumberFormat (Albert Astals Cid), - Error in doc/Makefile.am (Brice De Bruyne), - Detect attribute sets recursions in more cases (Daniel Veillard), - Check name vales for attribute-set elements (Daniel Veillard), - Fix hang with namespace-alias, fixes #700689 (Shaun McCance), - Fix str:align with UTF-8 strings (Nick Wellnhofer), - Fix for compiled XPath helpers (Nick Wellnhofer), - Check return value of exsltFuncNewFunctionData (Nick Wellnhofer), - Fix return value of xsltRegisterExtModuleElement (Nick Wellnhofer), - Call xmlNodeGetSpacePreserve with element node (Nick Wellnhofer), - Set namespaces before evaluating xsl:number (Nick Wellnhofer), - Make --maxvars option work (Per Hedeland), - Set correct context node when initializing xsl:keys (Nick Wellnhofer), - Fix for bug 436589 (Imran Azeezullah), - Memory leak in xsltCompileIdKeyPattern error path (Nick Wellnhofer), - Fix handling of UTF-8 strings in EXSLT crypto module (Nick Wellnhofer), - Fix certain patterns with predicates (Nick Wellnhofer), - Fix direct pattern matching (Nick Wellnhofer), - Fix str:padding to work with UTF-8 strings (Nick Wellnhofer), - EXSLT function str:replace() is broken as-is (Nick Wellnhofer), - Fix a couple of places where (f)printf parameters were broken (Daniel Veillard) - - - Improvements: - Add support timestamps from environment (Daniel Veillard), - Add missing tests to dist tarball (Nick Wellnhofer), - Improve error message in xsltAddTemplate and fix test (Nick Wellnhofer), - Allow REC tests with empty stdout (Nick Wellnhofer), - Fix GPL license in HTML files as well (Nick Wellnhofer), - Fix status message in EXSLT dynamic tests (Nick Wellnhofer), - Add public function macros to xsltlocale.h (Nick Wellnhofer), - Make valgrind tests work with libtool (Nick Wellnhofer), - Add a couple of xsl:number tests (Nick Wellnhofer), - Lower and upper bound for format token "i" (Nick Wellnhofer), - Lower bound for format token "a" (Nick Wellnhofer), - Handle negative xsl:number values (Nick Wellnhofer), - Round xsl:number values to nearest integer (Nick Wellnhofer), - Allow {URI}NCName syntax for user parameters (Nick Wellnhofer), - Fix endTimer parameter type (Nick Wellnhofer), - Fix error messages for unsupported methods (Nick Wellnhofer), - Replace sprintf with snprintf (David Kilzer), - Enforce two digit exponent under MSVC (Nick Wellnhofer), - Rework xsltNumberFormat to fix warning (Nick Wellnhofer), - Fix a couple of GPL licences found in the documentation (Daniel Veillard), - Use hash table to lookup named templates (Christian Ceelen), - Fix to reg tests post 737840 fix (Daniel Veillard), - Don't fail build the man page if xsltproc is not present (Daniel Veillard), - Re-adding xsltproc.1 (Daniel Veillard), - Fix time type in xsltSaveProfiling (Nick Wellnhofer), - Remove unused parameters (Nick Wellnhofer), - Suppress unused variable warning. (Nick Wellnhofer), - Remove unused variable in xsltGenerateIdFunction (Nick Wellnhofer), - Add test case for XPath function args in error case (Nick Wellnhofer), - Add comment about known-to-fail test (Nick Wellnhofer), - Adjust expected test output (Nick Wellnhofer), - Helper functions to evaluate compiled XPath expressions (Nick Wellnhofer), - Add tests for crypto:rc4 (Nick Wellnhofer), - Add first test case for EXSLT crypto module (Nick Wellnhofer), - Separate function for predicate matching in patterns (Nick Wellnhofer), - Initialize pseudo random number generator with current time or optional command line parameter (Nils Werner), - Adding doc update related to 1.1.28 (Daniel Veillard) - - - Cleanups: - Remove bogus test file (Nick Wellnhofer), - Add warning message to expected test output (Nick Wellnhofer) - - - -1.1.28: Nov 21 2012: - - Portability: - Fix python build by using libxsltmod_la_CPPFLAGS instead of AM_CPPFLAGS (Alexandre Rostovtsev), - configure should be more careful with linker script (Igor Pashev), - add gcrypt library in LIBADD, not LDFLAGS, as recommended (Roumen Petrov) - - - Bug fixes: - Fix generate-id() to avoid generating the same ID (Stewart Brodie), - Fix crash with empty xsl:key/@match attribute (Nick Wellnhofer), - Crash when passing an uninitialized variable to document() (Nick Wellnhofer), - Add missing test docs to EXTRA_DIST (Nick Wellnhofer), - Fix regression: Default namespace not correctly used (Nick Wellnhofer) - - - Cleanups: - Remove xsltTransStorageAdd and xsltTransStorageRemove from symbols.xml (Daniel Veillard), - autogen.sh cleanup (Daniel Richard), - consistent use of xslt processor (Roumen Petrov), - Add object files in tests/plugins to .gitignore (Nick Wellnhofer), - Fix error on bug-165 regression test (Daniel Veillard), - Remove xsltTransStorageAdd and xsltTransStorageRemove (Daniel Veillard), - - - -1.1.27: Sep 12 2012: - - Portability: - xincludestyle wasn't protected with LIBXML_XINCLUDE_ENABLED (Michael Bonfils), - Portability fix for testThreads.c (IlyaS), - FreeBSD portability fixes (Pedro F. Giffuni), - check for gmtime - on mingw* hosts will enable date-time function (Roumen Petrov), - use only native crypto-API for mingw* hosts (Roumen Petrov), - autogen: Only check for libtoolize (Colin Walters), - minimal mingw support (Roumen Petrov), - configure: acconfig.h is deprecated since autoconf-2.50 (Stefan Kost), - Fix a small out of tree compilation issue (Hao Hu), - Fix python generator to not use deprecated xmllib (Daniel Veillard), - link python module with python library (Frederic Crozat) - - - Documentation: - Tiny doc improvement (Daniel Veillard), - Various documentation fixes for docs on internals (C. M. Sperberg-McQueen) - - - Bug fixes: - Report errors on variable use in key (Daniel Veillard), - The XSLT namespace string is a constant one (Daniel Veillard), - Fix handling of names in xsl:attribute (Nick Wellnhofer), - Reserved namespaces in xsl:element and xsl:attribute (Nick Wellnhofer), - Null-terminate result string of cry:rc4_decrypt (Nick Wellnhofer), - EXSLT date normalization fix (James Muscat), - Exit after compilation of invalid func:result (Nick Wellnhofer), - Fix for EXSLT func:function (Nick Wellnhofer), - Rewrite EXSLT string:replace to be conformant (Nick Wellnhofer), - Avoid a heap use after free error (Chris Evans), - Fix a dictionary string usage (Chris Evans), - Output should not include extraneous newlines when indent is off (Laurence Rowe), - document('') fails to return stylesheets parsed from memory (Jason Viers), - xsltproc should return an error code if xinclude fails (Malcolm Purvis), - Forwards-compatible processing of unknown top level elements (Nick Wellnhofer), - Fix system-property with unknown namespace (Nick Wellnhofer), - Hardening of code checking node types in EXSLT (Daniel Veillard), - Hardening of code checking node types in various entry point (Daniel Veillard), - Cleanup of the pattern compilation code (Daniel Veillard), - Fix default template processing on namespace nodes (Daniel Veillard), - Fix a bug in selecting XSLT elements (Daniel Veillard), - Fixed bug #616839 (Daniel Mustieles), - Fix some case of pattern parsing errors (Abhishek Arya), - preproc: fix the build (Stefan Kost), - Fix a memory leak with xsl:number (Daniel Veillard), - Fix a problem with ESXLT date:add() with January (money_seshu Dronamraju), - Fix a memory leak if compiled with Windows locale support (Daniel Veillard), - Fix generate-id() to not expose object addresses (Daniel Veillard), - Fix curlies support in literals for non-compiled AVTs (Nick Wellnhofer), - Allow whitespace in xsl:variable with select (Nick Wellnhofer), - Small fixes to locale code (Nick Wellnhofer), - Fix bug 602515 (Nick Wellnhofer), - Fix popping of vars in xsltCompilerNodePop (Nick Wellnhofer), - Fix direct pattern matching bug (Nick Wellnhofer) - - - Improvements: - Add the saxon:systemId extension (Mike Hommey), - Add an append mode to document output (Daniel Veillard), - Add new tests to EXTRA_DIST (Nick Wellnhofer), - Test for bug #680920 (Nick Wellnhofer), - fix regresson in Various "make distcheck" and other fixes (Roumen Petrov), - Various "make distcheck" and other fixes (Daniel Richard G), - Fix portability to upcoming libxml2-2.9.0 (Daniel Veillard), - Adding --system flag support to autogen.sh (Daniel Veillard), - Allow per-context override of xsltMaxDepth, introduce xsltMaxVars (Jérôme Carretero), - autogen.sh: Honor NOCONFIGURE environment variable (Colin Walters), - configure: support silent automake rules if possible (Stefan Kost), - Precompile patterns in xsl:number (Nick Wellnhofer), - Fix some warnings in the refactored code (Nick Wellnhofer), - Adding new generated files (Daniel Veillard), - profiling: add callgraph report (Stefan Kost) - - - Cleanups: - Big space and tabs cleanup (Daniel Veillard), - Fix authors list (Daniel Veillard), - Cleanups some of the test makefiles (Daniel Richard), - Remove .cvsignore files which are not needed anymore (Daniel Veillard), - Cleanup some misplaced spaces and tabs (Daniel Veillard), - Augment list of ignored files (Daniel Veillard), - configure: remove checks for isinf and isnan as those are not used anyway (Stefan Kost), - Point to GIT for source code and a bit of cleanup (Daniel Veillard), - Get rid of specific build setup and STATIC_BINARIES (Daniel Veillard) - - - -1.1.26: Sep 24 2009: - - Improvement: - Add xsltProcessOneNode to exported symbols for lxml (Daniel Veillard) - - - Bug fixes: - Fix an idness generation problem (Daniel Veillard), - 595612 Try to fix some locking problems (Daniel Veillard), - Fix a crash on misformed imported stylesheets (Daniel Veillard) - - - -1.1.25: Sep 17 2009: - - Features: - Add API versioning and various cleanups (Daniel Veillard), - xsl:sort lang support using the locale (Nick Wellnhofer and Roumen Petrov) - - - Documentation: - Fix the download links for Solaris (Daniel Veillard), - Fix makefile and spec file to include doc in rpm (Daniel Veillard) - - - Portability: - Make sure testThreads is linked with pthreads (Daniel Veillard), - Fix potential crash on debug of extensions Solaris (Ben Walton), - applied patch from Roumen Petrov for mingw cross compilation problems (Roumen Petrov), - patch from Richard Jones to build shared libs with MinGW cross-compiler (Richard Jones), - fix include path when compiling with MinGW (Roumen Petrov), - portability fixes ( Nick Wellnhofer and Roumen Petrov) - - - Bug fixes: - Big fixes of pattern compilations (Nick Wellnhofer), - Fix uses of xmlAddChild for error handling (Daniel Veillard), - Detect deep recusion on function calls (Daniel Veillard), - Avoid an error in namespace generation (Martin), - Fix importing of encoding from included stylesheets (Nick Wellnhofer), - Fix problems with embedded stylesheets and namespaces (Martin), - QName parsing fix for patterns (Martin), - Crash compiling stylesheet with DTD (Martin), - Fix xsl:strip-space with namespace and wildcard (Nick Wellnhofer), - Fix a mutex deadlock on unregistered extensions (Nix), - 567192 xsltproc --output option ignore --xinclude (Joachim Breitner), - Fix redundant headers in list (Daniel Veillard), - 134754 Configure's --with-html-dir related fixes (Julio M. Merino Vidal), - 305913 a serious problem in extensions reentrancy (Daniel Veillard), - Fix an idness issue when building the tree (Daniel Veillard), - Fixed indexing error reported by Ron Burk on the mailing list. (William M. Brack), - prevent some unchecked pointer accesses (Jake Goulding), - fix for CVE-2008-2935 libexslt RC4 encryption/decryption functions Daniel (Daniel Veillard), - avoid a quadratic behaviour when hitting duplicates (Daniel Veillard), - 544829 fixed option --with-debugger (Arun Ragnavan), - 541965 fixed incorrect argument popping in exsltMathAtan2Function (William M. Brack), - fix problem with string check for element-available (Ron Burk), - 539741 added code to handle literal within an AVT (William M. Brack) - - - Improvements: - Allow use of EXSLT outside XSLT (Martin), - Support Esperanto locale (Nick Wellnhofer), - Change how attributes are copied for id and speed (Daniel Veillard), - Add API versioning and various cleanups (Daniel Veillard), - Adding a test program to check thread reentrancy (Daniel Veillard), - big patch from finishing xsl:sort lang support (Roumen Petrov), - add xsl:sort lang support using the locale (Nick Wellnhofer) - - - Cleanups: - Label xsltProcessOneNode as static (Daniel Veillard), - git setup (Daniel Veillard), - fixed typo detected by new libxml2 code (William M. Brack), - xsltExtFunctionLookup was defined but never implemented (Ralf Junker) - - - -1.1.24: May 13 2008: - - Documentation: man page fix (Vincent Lefevre). - - Bug fixes: pattern bug fix, key initialization problems, exclusion of - unknown namespaced element on top of stylesheets, python generator - syntactic cleanup (Martin) - - -1.1.23: Apr 8 2008: - - Documentation: fix links for Cygwin DocBook setup (Philippe Bourcier), - xsltParseStylesheetDoc doc fix (Jason Viers), fix manpage default - maxdepth value - - Bug fixes: python segfault (Daniel Gryniewicz), week-in-year bug fix - (Maurice van der Pot), fix python iterator problem (William Brack), - avoid garbage collection problems on str:tokenize and str:split - and function results (William Brack and Peter Pawlowski) - superfluous re-generation of keys (William Brack), remove superfluous - code in xsltExtInitTest (Tony Graham), func:result segfault fix - (William Brack), timezone offset problem (Peter Pawlowski), - - Portability fixes: old gcrypt support fix (Brent Cowgill), Python - portability patch (Stephane Bidoul), VS 2008 fix (Rob Richard) - - -1.1.22: Aug 23 2007: - - Bug fixes: RVT cleanup problems (William Brack), exclude-result-prefix - bug (William Brack), stylesheet compilation error handling (Rob Richards). - - - Portability fixes: improve build with VS2005 (Rob Richards), - fixing build on AIX (Bjorn Wiberg), fix the security file checks on - Windows (Roland Schwarz and Rob Richards). - - Improvement: add an --encoding option to xsltproc (Drazen Kacar). - - -1.1.21: Jun 12 2007: - - Bug fixes: out of memory allocation errors (William Brack), - namespace problem on compound predicates (William Brack), - python space/tab inconsistencies (Andreas Hanke), hook xsl:message - to per transformation error callbacks (Shaun McCance), - cached RVT problem (William Brack), XPath context maintainance - on choose (William Brack), memory leaks in the math module (William - Brack), exclude-result-prefix induced namespace problem (William - Brack) - - Build: configure setup for TRIO_REPLACE_STDIO (William Brack) - - - Documentation: updated after change from CVs to SVN (William Brack) - - -1.1.20: Jan 17 2007: - - Portability fixes: strict aliasing fix (Marcus Meissner), BSD portability - patches (Roland Illig) - - Bug fixes: Result Value Tree handling fix (William Brack), function - parameters fix (William), uninitialized variable (Kjartan Maraas), - empty text node handling (William), plugin support and test fixes (William), - fragment support fixes (William) - - Improvements: python stylesheet compare and transform context - access (Nic Ferrier), EXSLT string replace support (Joel Reed), - xsltproc better low level error handling (Mike Hommey and William) - - -1.1.19: Nov 29 2006: - - Bug fixes: entities within attributes (William Brack), Python detection - problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result - value tree caching bug (William Brack) - - -1.1.18: Oct 26 2006: - - portability and build fixes: DESTDIR problem, build paths in python - shared lib, compile when libxml2 doesn't support XInclude (Gary Coady). - - bug fixes: a number of namespace related bugs (Kasimier Buchcik), - parameters bugs (Kasimier Buchcik), proximity position in predicates - of match patterns (Kasimier), exslt-node-set troubles with strings - (Kasimier), CDATA serialization, Python floats and booleans XPath - conversions, XInclude support fixes, RVT cleanup problem (William Brack - and Kasimier), attribute checking in stylesheets (Kasimier), xsltForEach - context problem (Kasimier), security check should pass full URLs (Shane - Corgatelli), security cleanup patch (Mikhail Zabaluev), some python - accessor for stylesheet were broken, memory errors when compiling - stylesheets (Mike Hommey), EXSLT current date end-of-month problem - (William Brack). - - improvements: refactoring of namespace handling, value-of impleemntation - and template internal processing (Kasimier Buchcik), new xsltproc - flag to apply Xinclude to stylesheets. - - documentation: xsltproc man pages (Daniel Leidert), tests updates - (William Brack), various typo fixes (Daniel Leidert), comments on - versions macros (Peter Breitenlohner). - - -1.1.17: Jun 6 2006: - - portability fixes: python detection - - bug fixes: some regression tests, attribute/namespaces output (Kasimier - Buchcik), problem in mixed xsl:value-of and xsl:text uses (Kasimier) - - improvements: internal refactoring (Kasimier Buchcik), use of the XPath - object cache in libxml2-2.6.25 (Kasimier) - - -1.1.16: May 01 2006: - - portability fixes: EXSLT date/time on Solaris and IRIX (Albert Chin), - HP-UX build (Albert Chin), - - - build fixes: Python detection(Joseph Sacco), plugin configurei - (Joel Reed) - - bug fixes: pattern compilation fix(William Brack), EXSLT date/time - fix (Thomas Broyer), EXSLT function bug, potential loop on variable - eval, startup race (Christopher Palmer), debug statement left in python - (Nic Ferrier), various cleanup based on Coverity reports), error on - Out of memory condition (Charles Hardin), various namespace prefixes - fixes (Kasimier Buchcik), - - improvement: speed up sortingi, start of internals refactoring (Kasimier - Buchcik) - - documentation: man page fixes and updates (Daniel Leidert) - - - -1.1.15: Sep 04 2005: - - build fixes: Windows build cleanups and updates (Igor Zlatkovic), - remove jhbuild warnings - - bug fixes: negative number formatting (William Brack), number - formatting per mille definition (William Brack), XInclude default values - (William), text copy bugs (William), bug related to xmlXPathContext size, - reuse libxml2 memory management for text nodes, dictionary text bug, - forbid variables in match (needs libxml2-2.6.21) - - improvements: EXSLT dyn:map (Mark Vakoc), - - documentation: EXSLT date and time functions namespace in man (Jonathan - Wakely) - - -1.1.14: Apr 02 2005: - - bug fixes: text node on stylesheet document without a dictionary - (William Brack), more checking of XSLT syntax, calling xsltInit() - multiple times, mode values interning raised by Mark Vakoc, bug in - pattern matching with ancestors, bug in patterna matching with cascading - select, xinclude and document() problem, build outside of source tree - (Mike Castle) - - improvement: added a --nodict mode to xsltproc to check problems for - docuemtns without dictionaries - - -1.1.13: Mar 13 2005: - - build fixes: 64bits cleanup (William Brack), python 2.4 test (William), - LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles fixes (Joel - Reed), libgcrypt-devel requires for RPM spec. - - bug fixes: exslt day-of-week-in-month (Sal Paradise), xsl:call-template - should not change the current template rule (William Brack), evaluation - of global variables (William Brack), RVT's in XPath predicates (William), - namespace URI on template names (Mark Vakoc), stat() for Windows patch - (Aleksey Gurtovoy), pattern expression fixes (William Brack), out of - memory detection misses (William), parserOptions propagation (William), - exclude-result-prefixes fix (William), // patten fix (William). - - extensions: module support (Joel Reed), dictionary based speedups - trying to get rid of xmlStrEqual as much as possible. - - documentation: added Wiki (Joel Reed) - - -1.1.12: Oct 29 2004: - - build fixes: warnings removal (William). - - bug fixes: attribute document pointer fix (Mark Vakoc), exslt date - negative periods (William Brack), generated tree structure fixes, - namespace lookup fix, use reentrant gmtime_r (William Brack), - exslt:funtion namespace fix (William), potential NULL pointer reference - (Dennis Dams, William), force string interning on generated - documents. - - documentation: update of the second tutorial (Panagiotis Louridas), add - exslt doc in rpm packages, fix the xsltproc man page. - - -1.1.11: Sep 29 2004: - - bug fixes: xsl:include problems (William Brack), UTF8 number pattern - (William), date-time validation (William), namespace fix (William), - various Exslt date fixes (William), error callback fixes, leak with - namespaced global variable, attempt to fix a weird problem #153137 - - improvements: exslt:date-sum tests (Derek Poon) - - documentation: second tutorial by Panagiotis Lourida - - -1.1.10: Aug 31 2004: - - build fix: NUL in c file blocking compilation on Solaris, Windows build - (Igor Zlatkovic) - - fix: key initialization problem (William Brack) - - documentation: fixed missing man page description for --path - - -1.1.9: Aug 22 2004: - - build fixes: missing tests (William Brack), Python dependancies, Python - on 64bits boxes, --with-crypto flag (Rob Richards), - - fixes: RVT key handling (William), Python binding (William and Sitsofe - Wheeler), key and XPath troubles (William), template priority on imports - (William), str:tokenize with empty strings (William), #default namespace - alias behaviour (William), doc ordering missing for main document - (William), 64bit bug (Andreas Schwab) - - improvements: EXSLT date:sum added (Joel Reed), hook for document - loading for David Hyatt, xsltproc --nodtdattr to avoid defaulting DTD - attributes, extend xsltproc --version with CVS stamp (William). - - Documentation: web page problem reported by Oliver Stoeneberg - - -1.1.8: July 5 2004: - - build fixes: Windows runtime options (Oliver Stoeneberg), Windows - binary package layout (Igor Zlatkovic), libgcrypt version test and link - (William) - - documentation: fix libxslt namespace name in doc (William) - - bug fixes: undefined namespace message (William Brack), search engine - (William), multiple namespace fixups (William), namespace fix for key - evaluation (William), Python memory debug bindings, - - improvements: crypto extensions for exslt (Joel Reed, William) - - -1.1.7: May 17 2004: - - build fix: warning about localtime_r on Solaris - - bug fix: UTF8 string tokenize (William Brack), subtle memory - corruption, linefeed after comment at document level (William), - disable-output-escaping problem (William), pattern compilation in deep - imported stylesheets (William), namespace extension prefix bug, - libxslt.m4 bug (Edward Rudd), namespace lookup for attribute, namespaced - DOCTYPE name - - -1.1.6: Apr 18 2004: - - 2 bug fixes about keys fixed one by Mark Vakoc - - -1.1.5: Mar 23 2004: - - performance: use dictionary lookup for variables - - remove use of _private from source documents - - cleanup of "make tests" output - - bugfixes: AVT in local variables, use localtime_r to avoid thread - troubles (William), dictionary handling bug (William), limited number of - stubstitutions in AVT (William), tokenize fix for UTF-8 (William), - superfluous namespace (William), xsltproc error code on - halt, OpenVMS fix, dictionary reference counting - change. - - -1.1.4: Feb 23 2004: - - bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem with - Yelp, extension problem - - display extension modules (Steve Little) - - Windows compilation patch (Mark Vadoc), Mingw (Mikhail Grushinskiy) - - -1.1.3: Feb 16 2004: - - Rewrote the Attribute Value Template code, new XPath compilation - interfaces, dictionary reuses for XSLT with potential for serious - performance improvements. - - bug fixes: portability (William Brack), key() in node-set() results - (William), comment before doctype (William), math and node-set() problems - (William), cdata element and default namespace (William), behaviour on - unknown XSLT elements (Stefan Kost), priority of "//foo" patterns - (William), xsl:element and xsl:attribute QName check (William), comments - with -- (William), attribute namespace (William), check for ?> in PI - (William) - - Documentations: cleanup (John Fleck and William) - - Python: patch for OS-X (Gianni Ceccarelli), enums export (Stephane - bidoul) - - -1.1.2: Dec 24 2003: - - Documentation fixes (John Fleck, William Brack), EXSLT documentation - (William Brack) - - Windows compilation fixes for MSVC and Mingw (Igor Zlatkovic) - - Bug fixes: exslt:date returning NULL strings (William Brack), - namespaces output (William Brack), key and namespace definition problem, - passing options down to the document() parser, xsl:number fixes (William - Brack) - - -1.1.1: Dec 10 2003: - - code cleanup (William Brack) - - Windows: Makefile improvements (Igor Zlatkovic) - - documentation improvements: William Brack, libexslt man page (Jonathan - Wakely) - - param in EXSLT functions (Shaun McCance) - - XSLT debugging improvements (Mark Vakoc) - - bug fixes: number formatting (Bjorn Reese), exslt:tokenize (William - Brack), key selector parsing with | reported by Oleg Paraschenko, - xsl:element with computed namespaces (William Brack), xslt:import/include - recursion detection (William Brack), exslt:function used in keys (William - Brack), bug when CDATA_SECTION are foun in the tree (William Brack), - entities handling when using XInclude. - - -1.1.0: Nov 4 2003: - - Removed DocBook SGML broken support - - fix xsl:key to work with PIs - - Makefile and build improvement (Graham Wilson), build cleanup (William - Brack), macro fix (Justin Fletcher), build outside of source tree (Roumen - Petrov) - - xsltproc option display fix (Alexey Efimov), --load-trace (Crutcher - Dunnavant) - - Python: never use stdout for error - - extension memory error fix (Karl Eichwalder) - - header path fixes (Steve Ball) - - added saxon:line-number() to libexslt (Brett Kail) - - Fix some tortuous template problems when using predicates (William - Brack) - - Debugger status patch (Kasimier Buchcik) - - Use new libxml2-2.6.x APIs for faster processing - - Make sure xsl:sort is empty - - Fixed a bug in default processing of attributes - - Removes the deprecated breakpoint library - - detect invalid names on templates (William Brack) - - fix exslt:document (and similar) base handling problem - - -1.0.33: Sep 12 2003: -This is a bugfix only release - error message missing argument (William Brack) - - mode not cascaded in template fallbacks (William Brack) - - catch redefinition of parameter/variables (William Brack) - - multiple keys with same namespace name (William Brack) - - patch for compilation using MingW on Windows (Mikhail Grushinskiy) - - header export macros for Windows (Igor Zlatkovic) - - cdata-section-elements handling of namespaced names - - compilation without libxml2 XPointer support (Mark Vadoc) - - apply-templates crash (William Brack) - - bug with imported templates (William Brack) - - imported attribute-sets merging bug (DocBook) (William Brack) - - -1.0.32: Aug 9 2003: - - bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger), EXSLT - function (William Brack), RVT for globals (William Brack), EXSLT date - (William Brack), - speed of large text output, xsl:copy with attributes, strip-space and - namespaces prefix, fix for --path xsltproc option, EXST:tokenize (Shaun - McCance), EXSLT:seconds (William Brack), sort with multiple keys (William - Brack), checking of { and } for attribute value templates (William - Brack) - - - Python bindings for extension elements (Sean Treadway) - - EXSLT:split added (Shaun McCance) - - portability fixes for HP-UX/Solaris/IRIX (William Brack) - - doc cleanup - - -1.0.31: Jul 6 2003: - - bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix for - the debugger (Keith Isdale), output filename limitation, trio.h and - triodef.h added (Albert Chin), EXSLT node-set (Peter Breitenlohner), - xsltChoose and whitespace (Igor Zlatkovic), - stylesheet compilation (Igor Zlatkovic), NaN and sort (William Brack), - RVT bug introduced in 1.0.30 - - - avoid generating " (fix in libxml2-2.5.8) - - fix 64bit cleaness problem and compilation troubles introduced in - 1.0.30 - - Windows makefile generation (Igor Zlatkovic) - - HP-UX portability fix - - -1.0.30: May 4 2003: - - Fixes and new APIs to handle Result Value Trees and avoid leaks - - Fixes for: EXSLT math pow() function (Charles Bozeman), global - parameter and global variables mismatch, a segfault on pattern - compilation errors, namespace copy in xsl:copy-of, python generator - problem, OpenVMS trio update, premature call to xsltFreeStackElem (Igor), - current node when templates applies to attributes - - -1.0.29: Apr 1 2003: - - performance improvements especially for large flat documents - - bug fixes: Result Value Tree handling, XML IDs, keys(), extra namespace - declarations with xsl:elements. - - portability: python and trio fixes (Albert Chin), python on Solaris - (Ben Phillips) - - -1.0.28: Mar 24 2003: - - fixed node() in patterns semantic. - - fixed a memory access problem in format-number() - - fixed stack overflow in recursive global variable or params - - cleaned up Result Value Tree handling, and fixed a couple of old bugs - in the process - - -1.0.27: Feb 24 2003: - - bug fixes: spurious xmlns:nsX="" generation, serialization bug (in - libxml2), a namespace copy problem, errors in the RPM spec prereqs - - Windows path canonicalization and document cache fix (Igor) - - -1.0.26: Feb 10 2003: - - Fixed 3 serious bugs in document() and stylesheet compilation which - could lead to a crash - - -1.0.25: Feb 5 2003: - - Bug fix: double-free for standalone stylesheets introduced in 1.0.24, C - syntax pbm, 3 bugs reported by Eric van der Vlist - - Some XPath and XInclude related problems were actually fixed in - libxml2-2.5.2 - - Documentation: emphasize taht --docbook is not for XML docs. - - -1.0.24: Jan 14 2003: - - bug fixes: imported global varables, python bindings (Stéphane Bidoul), - EXSLT memory leak (Charles Bozeman), namespace generation on - xsl:attribute, space handling with imports (Daniel Stodden), - extension-element-prefixes (Josh Parsons), comments within xsl:text (Matt - Sergeant), superfluous xmlns generation, XInclude related bug for - numbering, EXSLT strings (Alexey Efimov), attribute-sets computation on - imports, extension module init and shutdown callbacks not called - - HP-UX portability (Alexey Efimov), Windows makefiles (Igor and Stephane - Bidoul), VMS makefile updates (Craig A. Berry) - - adds xsltGetProfileInformation() (Michael Rothwell) - - fix the API generation scripts - - API to provide the sorting routines (Richard Jinks) - - added XML description of the EXSLT API - - added ESXLT URI (un)escaping (Jörg Walter) - - Some memory leaks have been found and fixed - - document() now support fragment identifiers in URIs - - -1.0.23: Nov 17 2002: - - Windows build cleanup (Igor) - - Unix build and RPM packaging cleanup - - Improvement of the python bindings: extension functions and activating - EXSLT - - various bug fixes: number formatting, portability for bounded string - functions, CData nodes, key(), @*[...] patterns - - Documentation improvements (John Fleck) - - added libxslt.m4 (Thomas Schraitle) - - -1.0.22: Oct 18 2002: - - Updates on the Windows Makefiles - - Added a security module, and a related set of new options to - xsltproc - - Allowed per transformation error handler. - - Fixed a few bugs: node() semantic, URI escaping, media-type, attribute - lists - - -1.0.21: Sep 26 2002: - - Bug fixes: match="node()", date:difference() (Igor and Charlie - Bozeman), disable-output-escaping - - Python bindings: style.saveResultToString() from Ralf Mattes - - Logos from Marc Liyanage - - Mem leak fix from Nathan Myers - - Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64 (Mandrake), - Windows (Igor), Python detection - - Documentation improvements: John Fleck - - -1.0.20: Aug 23 2002: - - Windows makefile updates (Igor) and x86-64 (Frederic Crozat) - - fixed HTML meta tag saving for Mac/IE users - - possible leak patches from Nathan Myers - - try to handle document('') as best as possible depending in the - cases - - Fixed the DocBook stylesheets handling problem - - Fixed a few XSLT reported errors - - -1.0.19: July 6 2002: - - EXSLT: dynamic functions and date support bug fixes (Mark Vakoc) - - xsl:number fix: Richard Jinks - - xsl:format-numbers fix: Ken Neighbors - - document('') fix: bug pointed by Eric van der Vlist - - xsl:message with terminate="yes" fixes: William Brack - - xsl:sort order support added: Ken Neighbors - - a few other bug fixes, some of them requiring the latest version of - libxml2 - - -1.0.18: May 27 2002: - - a number of bug fixes: attributes, extra namespace declarations - (DocBook), xsl:include crash (Igor), documentation (Christian Cornelssen, - Charles Bozeman and Geert Kloosterman), element-available (Richard - Jinks) - - xsltproc can now list teh registered extensions thanks to Mark - Vakoc - - there is a new API to save directly to a string - xsltSaveResultToString() by Morus Walter - - specific error registration function for the python API - - -1.0.17: April 29 2002: - - cleanup in code, XSLT debugger support and Makefiles for Windows by - Igor - - a C++ portability fix by Mark Vakoc - - EXSLT date improvement and regression tests by Charles Bozeman - - attempt to fix a bug in xsltProcessUserParamInternal - - -1.0.16: April 15 2002: - - Bug fixes: strip-space, URL in HTML output, error when xsltproc can't - save - - portability fixes: OSF/1, IEEE on alphas, Windows, Python bindings - - -1.0.15: Mar 25 2002: - - Bugfixes: XPath, python Makefile, recursive attribute sets, @foo[..] - templates - - Debug of memory alocation with valgind - - serious profiling leading to significant improvement for DocBook - processing - - revamp of the Windows build - - -1.0.14: Mar 18 2002: - - Improvement in the XPath engine (libxml2-2.4.18) - - Nasty bug fix related to exslt:node-set - - Fixed the python Makefiles, cleanup of doc comments, Windows - portability fixes - - -1.0.13: Mar 8 2002: - - a number of bug fixes including "namespace node have no parents" - - Improvement of the Python bindings - - Charles Bozeman provided fixes and regression tests for exslt date - functions. - - -1.0.12: Feb 11 2002: - - Fixed the makefiles especially the python module ones - - half a dozen bugs fixes including 2 old ones - - -1.0.11: Feb 8 2002: - - Change of Licence to the MIT - Licence - - Added a beta version of the Python bindings, including support to - extend the engine with functions written in Python - - A number of bug fixes - - Charlie Bozeman provided more EXSLT functions - - Portability fixes - - -1.0.10: Jan 14 2002: - - Windows fixes for Win32 from Igor - - Fixed the Solaris compilation trouble (Albert) - - Documentation changes and updates: John Fleck - - Added a stringparam option to avoid escaping hell at the shell - level - - A few bug fixes - - -1.0.9: Dec 7 2001: - - Makefile patches from Peter Williams - - attempt to fix the compilation problem associated to prelinking - - obsoleted libxsltbreakpoint now deprecated and frozen to 1.0.8 API - - xsltproc return codes are now significant, John Fleck updated the - documentation - - patch to allow as much as 40 steps in patterns (Marc Tardif), should be - made dynamic really - - fixed a bug raised by Nik Clayton when using doctypes with HTML - output - - patches from Keith Isdale to interface with xsltdebugger - - -1.0.8: Nov 26 2001: - - fixed an annoying header problem, removed a few bugs and some code - cleanup - - patches for Windows and update of Windows Makefiles by Igor - - OpenVMS port instructions from John A Fotheringham - - fixed some Makefiles annoyance and libraries prelinking - information - - -1.0.7: Nov 10 2001: - - remove a compilation problem with LIBXSLT_PUBLIC - - Finishing the integration steps for Keith Isdale debugger - - fixes the handling of indent="no" on HTML output - - fixes on the configure script and RPM spec file - - -1.0.6: Oct 30 2001: - - bug fixes on number formatting (Thomas), date/time functions (Bruce - Miller) - - update of the Windows Makefiles (Igor) - - fixed DOCTYPE generation rules for HTML output (me) - - -1.0.5: Oct 10 2001: - - some portability fixes, including Windows makefile updates from - Igor - - fixed a dozen bugs on XSLT and EXSLT (me and Thomas Broyer) - - support for Saxon's evaluate and expressions extensions added (initial - contribution from Darren Graves) - - better handling of XPath evaluation errors - - -1.0.4: Sep 12 2001: - - Documentation updates from John fleck - - bug fixes (DocBook FO generation should be fixed) and portability - improvements - - Thomas Broyer improved the existing EXSLT support and added String, - Time and Date core functions support - - -1.0.3: Aug 23 2001: - - XML Catalog support see the doc - - New NaN/Infinity floating point code - - A few bug fixes - - -1.0.2: Aug 15 2001: - - lot of bug fixes, increased the testsuite - - a large chunk of EXSLT is implemented - - improvements on the extension framework - - documentation improvements - - Windows MSC projects files should be up-to-date - - handle attributes inherited from the DTD by default - - -1.0.1: July 24 2001: - - initial EXSLT framework - - better error reporting - - fixed the profiler on Windows - - bug fixes - - -1.0.0: July 10 2001: - - a lot of cleanup, a lot of regression tests added or fixed - - added a documentation for writing - extensions - - fixed some variable evaluation problems (with William) - - added profiling of stylesheet execution accessible as the xsltproc - --profile option - - fixed element-available() and the implementation of the various - chunking methods present, Norm Walsh provided a lot of feedback - - exclude-result-prefixes and namespaces output should now work as - expected - - added support of embedded stylesheet as described in section 2.7 of the - spec - - -0.14.0: July 5 2001: - - lot of bug fixes, and code cleanup - - completion of the little XSLT-1.0 features left unimplemented - - Added and implemented the extension API suggested by Thomas Broyer - - the Windows MSC environment should be complete - - tested and optimized with a really large document (DocBook Definitive - Guide) libxml/libxslt should really be faster on serious workloads - - -0.13.0: June 26 2001: - - lots of cleanups - - fixed a C++ compilation problem - - couple of fixes to xsltSaveTo() - - try to fix Docbook-xslt-1.4 and chunking, updated the regression test - with them - - fixed pattern compilation and priorities problems - - Patches for Windows and MSC project mostly contributed by Yon Derek - - update to the Tutorial by John Fleck - - William fixed bugs in templates and for-each functions - - added a new interface xsltRunStylesheet() for a more flexible output - (incomplete), added -o option to xsltproc - - -0.12.0: June 18 2001: - - fixed a dozen of bugs reported - - HTML generation should be quite better (requires libxml-2.3.11 upgrade - too) - - William fixed some problems with document() - - Fix namespace nodes selection and copy (requires libxml-2.3.11 upgrade - too) - - John Fleck added a - tutorial - - Fixes for namespace handling when evaluating variables - - XInclude global flag added to process XInclude on document() if - requested - - made xsltproc --version more detailed - - -0.11.0: June 1 2001: -Mostly a bug fix release. - integration of catalogs from xsltproc - - added --version to xsltproc for bug reporting - - fixed errors when handling ID in external parsed entities - - document() should hopefully work correctly but ... - - fixed bug with PI and comments processing - - William fixed the XPath string functions when using unicode - - -0.10.0: May 19 2001: - - cleanups to make stylesheet read-only (not 100% complete) - - fixed URI resolution in document() - - force all XPath expression to be compiled at stylesheet parsing time, - even if unused ... - - Fixed HTML default output detection - - Fixed double attribute generation #54446 - - Fixed {{ handling in attributes #54451 - - More tests and speedups for DocBook document transformations - - Fixed a really bad race like bug in xsltCopyTreeList() - - added a documentation on the libxslt internals - - William Brack and Bjorn Reese improved format-number() - - Fixed multiple sort, it should really work now - - added a --docbook option for SGML DocBook input (hackish) - - a number of other bug fixes and regression test added as people were - submitting them - - -0.9.0: May 3 2001: - - lot of various bugfixes, extended the regression suite - - xsltproc should work with multiple params - - added an option to use xsltproc with HTML input - - improved the stylesheet compilation, processing of complex stylesheets - should be faster - - using the same stylesheet for concurrent processing on multithreaded - programs should work now - - fixed another batch of namespace handling problems - - Implemented multiple level of sorting - - -0.8.0: Apr 22 2001: - - fixed ansidecl.h problem - - fixed unparsed-entity-uri() and generate-id() - - sort semantic fixes and priority prob from William M. Brack - - fixed namespace handling problems in XPath expression computations - (requires libxml-2.3.7) - - fixes to current() and key() - - other, smaller fixes, lots of testing with N Walsh DocBook HTML - stylesheets - - -0.7.0: Apr 10 2001: - - cleanup using stricter compiler flags - - command line parameter passing - - fix to xsltApplyTemplates from William M. Brack - - added the XSLTMark in the regression tests as well as document() - - -0.6.0: Mar 22 2001: - - another beta - - requires 2.3.5, which provide XPath expression compilation support - - document() extension should function properly - - fixed a number or reported bugs - - -0.5.0: Mar 10 2001: - - fifth beta - - some optimization work, for the moment 2 XSLT transform cannot use the - same stylesheet at the same time (to be fixed) - - fixed problems with handling of tree results - - fixed a reported strip-spaces problem - - added more reported/fixed bugs to the test suite - - incorporated William M. Brack fix for imports and global variables as - well as patch for with-param support in apply-templates - - a bug fix on for-each - - -0.4.0: Mar 1 2001: - - fourth beta test, released at the same time of libxml2-2.3.3 - - bug fixes - - some optimization - - started implement extension support, not finished - - implemented but not tested multiple file output - - -0.3.0: Feb 24 2001: - - third beta test, released at the same time of libxml2-2.3.2 - - lot of bug fixes - - some optimization - - added DocBook XSL based testsuite - - -0.2.0: Feb 15 2001: - - second beta version, released at the same time as libxml2-2.3.1 - - getting close to feature completion, lot of bug fixes, some in the HTML - and XPath support of libxml - - start becoming usable for real work. This version can now regenerate - the XML 2e HTML from the original XML sources and the associated - stylesheets (in section I of the XML - REC) - - Still misses extension element/function/prefixes support. Support of - key() and document() is not complete - - -0.1.0: Feb 8 2001: - - first beta version, released at the same time as libxml2-2.3.0 - - lots of bug fixes, first "testing" version, but incomplete - - -0.0.1: Jan 25 2001: - - first alpha version released at the same time as libxml2-2.2.12 - - Framework in place, should work on simple examples, but far from being - feature complete - -Daniel Veillard at -bugs.html diff --git a/dll/3rdparty/libxslt/attributes.c b/dll/3rdparty/libxslt/attributes.c index 4e00ae40988..4cc49d0d1a5 100644 --- a/dll/3rdparty/libxslt/attributes.c +++ b/dll/3rdparty/libxslt/attributes.c @@ -9,7 +9,26 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "attributes.h" +#include "namespaces.h" +#include "templates.h" +#include "imports.h" +#include "transform.h" +#include "preproc.h" #define WITH_XSLT_DEBUG_ATTRIBUTES #ifdef WITH_XSLT_DEBUG @@ -68,6 +87,7 @@ typedef xsltAttrSetContext *xsltAttrSetContextPtr; struct _xsltAttrSetContext { xsltStylesheetPtr topStyle; xsltStylesheetPtr style; + int error; }; static void @@ -255,7 +275,7 @@ xsltAddUseAttrSetList(xsltUseAttrSetPtr list, const xmlChar *ncname, * Returns the newly allocated xsltAttrSetPtr or NULL in case of error. */ static xsltAttrSetPtr -xsltNewAttrSet() { +xsltNewAttrSet(void) { xsltAttrSetPtr cur; cur = (xsltAttrSetPtr) xmlMalloc(sizeof(xsltAttrSet)); @@ -402,9 +422,12 @@ xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) { set = xmlHashLookup2(style->attributeSets, ncname, nsUri); if (set == NULL) { set = xsltNewAttrSet(); - if (set == NULL) + if ((set == NULL) || + (xmlHashAddEntry2(style->attributeSets, ncname, nsUri, set) < 0)) { + xsltGenericError(xsltGenericErrorContext, "memory error\n"); + xsltFreeAttrSet(set); return; - xmlHashAddEntry2(style->attributeSets, ncname, nsUri, set); + } } /* @@ -644,6 +667,12 @@ xsltResolveSASCallback(void *payload, void *data, xsltStylesheetPtr topStyle = asctx->topStyle; xsltStylesheetPtr style = asctx->style; + if (asctx->error) { + if (style != topStyle) + xsltFreeAttrSet(set); + return; + } + xsltResolveAttrSet(set, topStyle, style, name, ns, 1); /* Move attribute sets to top stylesheet. */ @@ -656,6 +685,8 @@ xsltResolveSASCallback(void *payload, void *data, xsltGenericError(xsltGenericErrorContext, "xsl:attribute-set : internal error, can't move imported " " attribute set %s\n", name); + asctx->error = 1; + xsltFreeAttrSet(set); } } } @@ -676,6 +707,7 @@ xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) { "Resolving attribute sets references\n"); #endif asctx.topStyle = style; + asctx.error = 0; cur = style; while (cur != NULL) { if (cur->attributeSets != NULL) { diff --git a/dll/3rdparty/libxslt/attributes.h b/dll/3rdparty/libxslt/attributes.h index 05b8a6e938e..d9b99a74aa1 100644 --- a/dll/3rdparty/libxslt/attributes.h +++ b/dll/3rdparty/libxslt/attributes.h @@ -13,6 +13,7 @@ #include #include "xsltexports.h" +#include "xsltInternals.h" #ifdef __cplusplus extern "C" { diff --git a/dll/3rdparty/libxslt/attrvt.c b/dll/3rdparty/libxslt/attrvt.c index 80927993153..9d74a81b49c 100644 --- a/dll/3rdparty/libxslt/attrvt.c +++ b/dll/3rdparty/libxslt/attrvt.c @@ -13,7 +13,19 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include "xslt.h" +#include "xsltutils.h" +#include "xsltInternals.h" +#include "templates.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_AVT @@ -142,12 +154,9 @@ xsltSetAttrVTsegment(xsltAttrVTPtr avt, void *val) { if (avt->nb_seg >= avt->max_seg) { size_t size = sizeof(xsltAttrVT) + (avt->max_seg + MAX_AVT_SEG) * sizeof(void *); - xsltAttrVTPtr tmp = (xsltAttrVTPtr) xmlRealloc(avt, size); - if (tmp == NULL) { - xsltFreeAttrVT(avt); + avt = (xsltAttrVTPtr) xmlRealloc(avt, size); + if (avt == NULL) return NULL; - } - avt = tmp; memset(&avt->segments[avt->nb_seg], 0, MAX_AVT_SEG*sizeof(void *)); avt->max_seg += MAX_AVT_SEG; } @@ -170,7 +179,8 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { const xmlChar *cur; xmlChar *ret = NULL; xmlChar *expr = NULL; - xsltAttrVTPtr avt; + xmlXPathCompExprPtr comp = NULL; + xsltAttrVTPtr avt, tmp; int i = 0, lastavt = 0; if ((style == NULL) || (attr == NULL) || (attr->children == NULL)) @@ -234,8 +244,9 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { str = cur; if (avt->nb_seg == 0) avt->strstart = 1; - if ((avt = xsltSetAttrVTsegment(avt, (void *) ret)) == NULL) + if ((tmp = xsltSetAttrVTsegment(avt, (void *) ret)) == NULL) goto error; + avt = tmp; ret = NULL; lastavt = 0; } @@ -268,8 +279,6 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { XSLT_TODO goto error; } else { - xmlXPathCompExprPtr comp; - comp = xsltXPathCompile(style, expr); if (comp == NULL) { xsltTransformError(NULL, style, attr->parent, @@ -281,14 +290,23 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { if (avt->nb_seg == 0) avt->strstart = 0; if (lastavt == 1) { - if ((avt = xsltSetAttrVTsegment(avt, NULL)) == NULL) + if ((tmp = xsltSetAttrVTsegment(avt, NULL)) == NULL) { + xsltTransformError(NULL, style, attr->parent, + "out of memory\n"); goto error; + } + avt = tmp; } - if ((avt = xsltSetAttrVTsegment(avt, (void *) comp)) == NULL) + if ((tmp = xsltSetAttrVTsegment(avt, (void *) comp)) == NULL) { + xsltTransformError(NULL, style, attr->parent, + "out of memory\n"); goto error; + } + avt = tmp; lastavt = 1; xmlFree(expr); expr = NULL; + comp = NULL; } cur++; str = cur; @@ -313,8 +331,9 @@ xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { str = cur; if (avt->nb_seg == 0) avt->strstart = 1; - if ((avt = xsltSetAttrVTsegment(avt, (void *) ret)) == NULL) + if ((tmp = xsltSetAttrVTsegment(avt, (void *) ret)) == NULL) goto error; + avt = tmp; ret = NULL; } @@ -338,6 +357,8 @@ error: xmlFree(ret); if (expr != NULL) xmlFree(expr); + if (comp != NULL) + xmlXPathFreeCompExpr(comp); } diff --git a/dll/3rdparty/libxslt/config.h b/dll/3rdparty/libxslt/config.h deleted file mode 100644 index 33bd0c15a47..00000000000 --- a/dll/3rdparty/libxslt/config.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include diff --git a/dll/3rdparty/libxslt/documents.c b/dll/3rdparty/libxslt/documents.c index b7afe3523fe..65394d8d669 100644 --- a/dll/3rdparty/libxslt/documents.c +++ b/dll/3rdparty/libxslt/documents.c @@ -6,7 +6,24 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "documents.h" +#include "transform.h" +#include "imports.h" +#include "keys.h" +#include "security.h" #ifdef LIBXML_XINCLUDE_ENABLED #include @@ -71,8 +88,6 @@ xsltDocDefaultLoaderFunc(const xmlChar * URI, xmlDictPtr dict, int options, return(NULL); } inputPush(pctxt, inputStream); - if (pctxt->directory == NULL) - pctxt->directory = xmlParserGetDirectory((const char *) URI); xmlParseDocument(pctxt); @@ -382,6 +397,8 @@ xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) { return(NULL); ret = xsltNewStyleDocument(style, doc); + if (ret == NULL) + xmlFreeDoc(doc); return(ret); } @@ -416,4 +433,3 @@ xsltFindDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc) { return(ctxt->document); return(NULL); } - diff --git a/dll/3rdparty/libxslt/extensions.c b/dll/3rdparty/libxslt/extensions.c index bbc4e115721..d3d615439eb 100644 --- a/dll/3rdparty/libxslt/extensions.c +++ b/dll/3rdparty/libxslt/extensions.c @@ -9,14 +9,34 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include #ifdef WITH_MODULES #include #endif #include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltlocale.h" +#include "xsltutils.h" +#include "imports.h" +#include "extensions.h" #ifdef _WIN32 +#include /* for _MAX_PATH */ #ifndef PATH_MAX #define PATH_MAX _MAX_PATH #endif @@ -395,6 +415,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) module_filename, URI); #endif +#if LIBXML_VERSION < 21300 if (1 != xmlCheckFilename(module_filename)) { #ifdef WITH_XSLT_DEBUG_EXTENSIONS @@ -405,6 +426,7 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI) xmlFree(ext_name); return (-1); } +#endif /* attempt to open the module */ m = xmlModuleOpen(module_filename, 0); @@ -721,8 +743,11 @@ xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, * Store the user-data in the context of the given stylesheet. */ dataContainer = xsltNewExtData(module, userData); - if (dataContainer == NULL) + if (dataContainer == NULL) { + if (module->styleShutdownFunc) + module->styleShutdownFunc(style, URI, userData); return (NULL); + } if (xmlHashAddEntry(style->extInfos, URI, (void *) dataContainer) < 0) @@ -788,17 +813,13 @@ xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI) * Old behaviour. */ tmpStyle = style; - while (tmpStyle != NULL) { - if (tmpStyle->extInfos != NULL) { - dataContainer = - (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI); - if (dataContainer != NULL) { - return(dataContainer->extData); - } - } - tmpStyle = xsltNextImport(tmpStyle); + if (tmpStyle->extInfos != NULL) { + dataContainer = + (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI); + if (dataContainer != NULL) { + return(dataContainer->extData); + } } - tmpStyle = style; #endif dataContainer = @@ -903,9 +924,8 @@ xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar * URI) return (NULL); data = xsltNewExtData(module, extData); - if (data == NULL) - return (NULL); - if (xmlHashAddEntry(ctxt->extInfos, URI, (void *) data) < 0) { + if ((data == NULL) || + (xmlHashAddEntry(ctxt->extInfos, URI, (void *) data) < 0)) { xsltTransformError(ctxt, NULL, NULL, "Failed to register module data: %s\n", URI); @@ -977,6 +997,8 @@ xsltInitCtxtExt(void *payload, void *data, const xmlChar * URI) } ctxtData = xsltNewExtData(module, extData); if (ctxtData == NULL) { + if (module->shutdownFunc) + module->shutdownFunc(ctxt->ctxt, URI, extData); ctxt->ret = -1; return; } @@ -984,6 +1006,9 @@ xsltInitCtxtExt(void *payload, void *data, const xmlChar * URI) if (ctxt->ctxt->extInfos == NULL) ctxt->ctxt->extInfos = xmlHashCreate(10); if (ctxt->ctxt->extInfos == NULL) { + if (module->shutdownFunc) + module->shutdownFunc(ctxt->ctxt, URI, extData); + xsltFreeExtData(ctxtData); ctxt->ret = -1; return; } @@ -2326,32 +2351,34 @@ xsltDebugDumpExtensions(FILE * output) output = stdout; fprintf(output, "Registered XSLT Extensions\n--------------------------\n"); - if (!xsltFunctionsHash) + xmlMutexLock(xsltExtMutex); + if (!xsltFunctionsHash) { fprintf(output, "No registered extension functions\n"); - else { - fprintf(output, "Registered Extension Functions:\n"); - xmlMutexLock(xsltExtMutex); + } else { + fprintf(output, "Registered extension functions:\n"); xmlHashScanFull(xsltFunctionsHash, xsltDebugDumpExtensionsCallback, output); - xmlMutexUnlock(xsltExtMutex); } - if (!xsltElementsHash) - fprintf(output, "\nNo registered extension elements\n"); - else { - fprintf(output, "\nRegistered Extension Elements:\n"); - xmlMutexLock(xsltExtMutex); + if (!xsltTopLevelsHash) { + fprintf(output, "\nNo registered top-level extension elements\n"); + } else { + fprintf(output, "\nRegistered top-level extension elements:\n"); + xmlHashScanFull(xsltTopLevelsHash, xsltDebugDumpExtensionsCallback, + output); + } + if (!xsltElementsHash) { + fprintf(output, "\nNo registered instruction extension elements\n"); + } else { + fprintf(output, "\nRegistered instruction extension elements:\n"); xmlHashScanFull(xsltElementsHash, xsltDebugDumpExtensionsCallback, output); - xmlMutexUnlock(xsltExtMutex); } - if (!xsltExtensionsHash) + if (!xsltExtensionsHash) { fprintf(output, "\nNo registered extension modules\n"); - else { - fprintf(output, "\nRegistered Extension Modules:\n"); - xmlMutexLock(xsltExtMutex); + } else { + fprintf(output, "\nRegistered extension modules:\n"); xmlHashScanFull(xsltExtensionsHash, xsltDebugDumpExtModulesCallback, output); - xmlMutexUnlock(xsltExtMutex); } - + xmlMutexUnlock(xsltExtMutex); } diff --git a/dll/3rdparty/libxslt/extra.c b/dll/3rdparty/libxslt/extra.c index 509fdb47c65..69f835d92c6 100644 --- a/dll/3rdparty/libxslt/extra.c +++ b/dll/3rdparty/libxslt/extra.c @@ -10,7 +10,25 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#include + +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "extensions.h" +#include "variables.h" +#include "transform.h" +#include "extra.h" +#include "preproc.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_EXTRA diff --git a/dll/3rdparty/libxslt/functions.c b/dll/3rdparty/libxslt/functions.c index 5cd1b7c285d..72a58dc4d65 100644 --- a/dll/3rdparty/libxslt/functions.c +++ b/dll/3rdparty/libxslt/functions.c @@ -10,9 +10,30 @@ * Bjorn Reese for number formatting */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "functions.h" +#include "extensions.h" +#include "numbersInternals.h" +#include "keys.h" +#include "documents.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_FUNCTION @@ -75,45 +96,25 @@ xsltXPathFunctionLookup (void *vctxt, ************************************************************************/ static void -xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) +xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, + const xmlChar* URI, const xmlChar *fragment) { xsltTransformContextPtr tctxt; - xmlURIPtr uri; - xmlChar *fragment; xsltDocumentPtr idoc; /* document info */ xmlDocPtr doc; xmlXPathContextPtr xptrctxt = NULL; xmlXPathObjectPtr resObj = NULL; + (void) xptrctxt; + tctxt = xsltXPathGetTransformContext(ctxt); if (tctxt == NULL) { xsltTransformError(NULL, NULL, NULL, "document() : internal error tctxt == NULL\n"); - valuePush(ctxt, xmlXPathNewNodeSet(NULL)); - return; + goto out_fragment; } - uri = xmlParseURI((const char *) URI); - if (uri == NULL) { - xsltTransformError(tctxt, NULL, NULL, - "document() : failed to parse URI\n"); - valuePush(ctxt, xmlXPathNewNodeSet(NULL)); - return; - } - - /* - * check for and remove fragment identifier - */ - fragment = (xmlChar *)uri->fragment; - if (fragment != NULL) { - xmlChar *newURI; - uri->fragment = NULL; - newURI = xmlSaveUri(uri); - idoc = xsltLoadDocument(tctxt, newURI); - xmlFree(newURI); - } else - idoc = xsltLoadDocument(tctxt, URI); - xmlFreeURI(uri); + idoc = xsltLoadDocument(tctxt, URI); if (idoc == NULL) { if ((URI == NULL) || @@ -126,12 +127,7 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) */ doc = tctxt->style->doc; } else { - valuePush(ctxt, xmlXPathNewNodeSet(NULL)); - - if (fragment != NULL) - xmlFree(fragment); - - return; + goto out_fragment; } } else doc = idoc->doc; @@ -143,7 +139,7 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) /* use XPointer of HTML location for fragment ID */ #ifdef LIBXML_XPTR_ENABLED - xptrctxt = xmlXPtrNewContext(doc, NULL, NULL); + xptrctxt = xmlXPathNewContext(doc); if (xptrctxt == NULL) { xsltTransformError(tctxt, NULL, NULL, "document() : internal error xptrctxt == NULL\n"); @@ -178,7 +174,6 @@ out_fragment: if (resObj == NULL) resObj = xmlXPathNewNodeSet(NULL); valuePush(ctxt, resObj); - xmlFree(fragment); } /** @@ -194,7 +189,8 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr obj, obj2 = NULL; xmlChar *base = NULL, *URI; - + xmlChar *newURI = NULL; + xmlChar *fragment = NULL; if ((nargs < 1) || (nargs > 2)) { xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, @@ -221,14 +217,14 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) obj2 = valuePop(ctxt); } - if (ctxt->value->type == XPATH_NODESET) { + if ((ctxt->value != NULL) && (ctxt->value->type == XPATH_NODESET)) { int i; xmlXPathObjectPtr newobj, ret; obj = valuePop(ctxt); ret = xmlXPathNewNodeSet(NULL); - if ((obj != NULL) && obj->nodesetval) { + if ((obj != NULL) && (obj->nodesetval != NULL) && (ret != NULL)) { for (i = 0; i < obj->nodesetval->nodeNr; i++) { valuePush(ctxt, xmlXPathNewNodeSet(obj->nodesetval->nodeTab[i])); @@ -240,11 +236,15 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) xmlXPathNewNodeSet(obj->nodesetval-> nodeTab[i])); } + if (ctxt->error) + break; xsltDocumentFunction(ctxt, 2); newobj = valuePop(ctxt); - ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval, - newobj->nodesetval); - xmlXPathFreeObject(newobj); + if (newobj != NULL) { + ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval, + newobj->nodesetval); + xmlXPathFreeObject(newobj); + } } } @@ -259,7 +259,7 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) * Make sure it's converted to a string */ xmlXPathStringFunction(ctxt, 1); - if (ctxt->value->type != XPATH_STRING) { + if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, "document() : invalid arg expecting a string\n"); ctxt->error = XPATH_INVALID_TYPE; @@ -272,7 +272,32 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) valuePush(ctxt, xmlXPathNewNodeSet(NULL)); } else { xsltTransformContextPtr tctxt; + xmlURIPtr uri; + const xmlChar *url; + tctxt = xsltXPathGetTransformContext(ctxt); + + url = obj->stringval; + + uri = xmlParseURI((const char *) url); + if (uri == NULL) { + xsltTransformError(tctxt, NULL, NULL, + "document() : failed to parse URI '%s'\n", url); + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + goto error; + } + + /* + * check for and remove fragment identifier + */ + fragment = (xmlChar *)uri->fragment; + if (fragment != NULL) { + uri->fragment = NULL; + newURI = xmlSaveUri(uri); + url = newURI; + } + xmlFreeURI(uri); + if ((obj2 != NULL) && (obj2->nodesetval != NULL) && (obj2->nodesetval->nodeNr > 0) && IS_XSLT_REAL_NODE(obj2->nodesetval->nodeTab[0])) { @@ -293,7 +318,8 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) (xmlNodePtr) tctxt->style->doc); } } - URI = xmlBuildURI(obj->stringval, base); + + URI = xmlBuildURI(url, base); if (base != NULL) xmlFree(base); if (URI == NULL) { @@ -306,10 +332,14 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) valuePush(ctxt, xmlXPathNewNodeSet(NULL)); } } else { - xsltDocumentFunctionLoadDocument( ctxt, URI ); + xsltDocumentFunctionLoadDocument(ctxt, URI, fragment); xmlFree(URI); } } + +error: + xmlFree(newURI); + xmlFree(fragment); xmlXPathFreeObject(obj); if (obj2 != NULL) xmlXPathFreeObject(obj2); @@ -358,6 +388,12 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ xmlXPathObjectPtr newobj, ret; ret = xmlXPathNewNodeSet(NULL); + if (ret == NULL) { + ctxt->error = XPATH_MEMORY_ERROR; + xmlXPathFreeObject(obj1); + xmlXPathFreeObject(obj2); + return; + } if (obj2->nodesetval != NULL) { for (i = 0; i < obj2->nodesetval->nodeNr; i++) { @@ -367,8 +403,9 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ xmlXPathStringFunction(ctxt, 1); xsltKeyFunction(ctxt, 2); newobj = valuePop(ctxt); - ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval, - newobj->nodesetval); + if (newobj != NULL) + ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval, + newobj->nodesetval); xmlXPathFreeObject(newobj); } } @@ -425,13 +462,13 @@ xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ */ valuePush(ctxt, obj2); xmlXPathStringFunction(ctxt, 1); - if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { + obj2 = valuePop(ctxt); + if ((obj2 == NULL) || (obj2->type != XPATH_STRING)) { xsltTransformError(tctxt, NULL, tctxt->inst, "key() : invalid arg expecting a string\n"); ctxt->error = XPATH_INVALID_TYPE; goto error; } - obj2 = valuePop(ctxt); value = obj2->stringval; /* @@ -534,6 +571,10 @@ xsltUnparsedEntityURIFunction(xmlXPathParserContextPtr ctxt, int nargs){ obj = valuePop(ctxt); if (obj->type != XPATH_STRING) { obj = xmlXPathConvertString(obj); + if (obj == NULL) { + xmlXPathErr(ctxt, XPATH_MEMORY_ERROR); + return; + } } str = obj->stringval; @@ -626,7 +667,8 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) return; } - if (formatValues != NULL) { + if ((ctxt->error == 0) && + (formatValues != NULL) && (formatObj != NULL) && (numberObj != NULL)) { if (xsltFormatNumberConversion(formatValues, formatObj->stringval, numberObj->floatval, @@ -651,11 +693,16 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) */ void xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ - static char base_address; + xsltTransformContextPtr tctxt; xmlNodePtr cur = NULL; xmlXPathObjectPtr obj = NULL; - long val; - xmlChar str[30]; + char *str; + const xmlChar *nsPrefix = NULL; + void **psviPtr; + unsigned long id; + size_t size, nsPrefixSize = 0; + + tctxt = xsltXPathGetTransformContext(ctxt); if (nargs == 0) { cur = ctxt->context->node; @@ -665,16 +712,15 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_NODESET)) { ctxt->error = XPATH_INVALID_TYPE; - xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + xsltTransformError(tctxt, NULL, NULL, "generate-id() : invalid arg expecting a node-set\n"); - return; + goto out; } obj = valuePop(ctxt); nodelist = obj->nodesetval; if ((nodelist == NULL) || (nodelist->nodeNr <= 0)) { - xmlXPathFreeObject(obj); valuePush(ctxt, xmlXPathNewCString("")); - return; + goto out; } cur = nodelist->nodeTab[0]; for (i = 1;i < nodelist->nodeNr;i++) { @@ -683,22 +729,93 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ cur = nodelist->nodeTab[i]; } } else { - xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + xsltTransformError(tctxt, NULL, NULL, "generate-id() : invalid number of args %d\n", nargs); ctxt->error = XPATH_INVALID_ARITY; - return; + goto out; } - if (obj) - xmlXPathFreeObject(obj); + size = 30; /* for "id%lu" */ - val = (long)((char *)cur - (char *)&base_address); - if (val >= 0) { - snprintf((char *)str, sizeof(str), "idp%ld", val); + if (cur->type == XML_NAMESPACE_DECL) { + xmlNsPtr ns = (xmlNsPtr) cur; + + nsPrefix = ns->prefix; + if (nsPrefix == NULL) + nsPrefix = BAD_CAST ""; + nsPrefixSize = xmlStrlen(nsPrefix); + /* For "ns" and hex-encoded string */ + size += nsPrefixSize * 2 + 2; + + /* Parent is stored in 'next'. */ + cur = (xmlNodePtr) ns->next; + } + + psviPtr = xsltGetPSVIPtr(cur); + if (psviPtr == NULL) { + xsltTransformError(tctxt, NULL, NULL, + "generate-id(): invalid node type %d\n", cur->type); + ctxt->error = XPATH_INVALID_TYPE; + goto out; + } + + if (xsltGetSourceNodeFlags(cur) & XSLT_SOURCE_NODE_HAS_ID) { + id = (unsigned long) (size_t) *psviPtr; } else { - snprintf((char *)str, sizeof(str), "idm%ld", -val); + if (cur->type == XML_TEXT_NODE && cur->line == USHRT_MAX) { + /* Text nodes store big line numbers in psvi. */ + cur->line = 0; + } else if (*psviPtr != NULL) { + xsltTransformError(tctxt, NULL, NULL, + "generate-id(): psvi already set\n"); + ctxt->error = XPATH_MEMORY_ERROR; + goto out; + } + + if (tctxt->currentId == ULONG_MAX) { + xsltTransformError(tctxt, NULL, NULL, + "generate-id(): id overflow\n"); + ctxt->error = XPATH_MEMORY_ERROR; + goto out; + } + + id = ++tctxt->currentId; + *psviPtr = (void *) (size_t) id; + xsltSetSourceNodeFlags(tctxt, cur, XSLT_SOURCE_NODE_HAS_ID); } - valuePush(ctxt, xmlXPathNewString(str)); + + str = xmlMalloc(size); + if (str == NULL) { + xsltTransformError(tctxt, NULL, NULL, + "generate-id(): out of memory\n"); + ctxt->error = XPATH_MEMORY_ERROR; + goto out; + } + if (nsPrefix == NULL) { + snprintf(str, size, "id%lu", id); + } else { + size_t i, j; + + snprintf(str, size, "id%luns", id); + + /* + * Only ASCII alphanumerics are allowed, so we hex-encode the prefix. + */ + j = strlen(str); + for (i = 0; i < nsPrefixSize; i++) { + int v; + + v = nsPrefix[i] >> 4; + str[j++] = v < 10 ? '0' + v : 'A' + (v - 10); + v = nsPrefix[i] & 15; + str[j++] = v < 10 ? '0' + v : 'A' + (v - 10); + } + str[j] = '\0'; + } + valuePush(ctxt, xmlXPathWrapString(BAD_CAST str)); + +out: + xmlXPathFreeObject(obj); } /** diff --git a/dll/3rdparty/libxslt/imports.c b/dll/3rdparty/libxslt/imports.c index f67d5dfb3dd..112c6e82714 100644 --- a/dll/3rdparty/libxslt/imports.c +++ b/dll/3rdparty/libxslt/imports.c @@ -9,7 +9,25 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "preproc.h" +#include "imports.h" +#include "documents.h" +#include "security.h" +#include "pattern.h" + /************************************************************************ * * @@ -35,6 +53,55 @@ static void xsltFixImportedCompSteps(xsltStylesheetPtr master, } } +#define XSLT_MAX_NESTING 40 + +static int +xsltCheckCycle(xsltStylesheetPtr style, xmlNodePtr cur, const xmlChar *URI) { + xsltStylesheetPtr ancestor; + xsltDocumentPtr docptr; + int depth; + + /* + * Check imported stylesheets. + */ + depth = 0; + ancestor = style; + while (ancestor != NULL) { + if (++depth >= XSLT_MAX_NESTING) { + xsltTransformError(NULL, style, cur, + "maximum nesting depth exceeded: %s\n", URI); + return(-1); + } + if (xmlStrEqual(ancestor->doc->URL, URI)) { + xsltTransformError(NULL, style, cur, + "recursion detected on imported URL %s\n", URI); + return(-1); + } + + /* + * Check included stylesheets. + */ + docptr = ancestor->includes; + while (docptr != NULL) { + if (++depth >= XSLT_MAX_NESTING) { + xsltTransformError(NULL, style, cur, + "maximum nesting depth exceeded: %s\n", URI); + return(-1); + } + if (xmlStrEqual(docptr->doc->URL, URI)) { + xsltTransformError(NULL, style, cur, + "recursion detected on included URL %s\n", URI); + return(-1); + } + docptr = docptr->includes; + } + + ancestor = ancestor->parent; + } + + return(0); +} + /** * xsltParseStylesheetImport: * @style: the XSLT stylesheet @@ -73,17 +140,8 @@ xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) { goto error; } - res = style; - while (res != NULL) { - if (res->doc == NULL) - break; - if (xmlStrEqual(res->doc->URL, URI)) { - xsltTransformError(NULL, style, cur, - "xsl:import : recursion detected on imported URL %s\n", URI); - goto error; - } - res = res->parent; - } + if (xsltCheckCycle(style, cur, URI) < 0) + goto error; /* * Security framework check @@ -152,7 +210,6 @@ xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) { xmlChar *URI = NULL; xsltStylesheetPtr result; xsltDocumentPtr include; - xsltDocumentPtr docptr; int oldNopreproc; if ((cur == NULL) || (style == NULL)) @@ -173,19 +230,8 @@ xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) { goto error; } - /* - * in order to detect recursion, we check all previously included - * stylesheets. - */ - docptr = style->includes; - while (docptr != NULL) { - if (xmlStrEqual(docptr->doc->URL, URI)) { - xsltTransformError(NULL, style, cur, - "xsl:include : recursion detected on included URL %s\n", URI); - goto error; - } - docptr = docptr->includes; - } + if (xsltCheckCycle(style, cur, URI) < 0) + goto error; include = xsltLoadStyleDocument(style, URI); if (include == NULL) { @@ -374,4 +420,3 @@ xsltFindTemplate(xsltTransformContextPtr ctxt, const xmlChar *name, } return(NULL); } - diff --git a/dll/3rdparty/libxslt/keys.c b/dll/3rdparty/libxslt/keys.c index 25adeb260f0..f23cc4e9fca 100644 --- a/dll/3rdparty/libxslt/keys.c +++ b/dll/3rdparty/libxslt/keys.c @@ -9,7 +9,25 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "imports.h" +#include "templates.h" +#include "keys.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_KEYS @@ -276,6 +294,8 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name, #endif key = xsltNewKeyDef(name, nameURI); + if (key == NULL) + return(-1); key->match = xmlStrdup(match); key->use = xmlStrdup(use); key->inst = inst; @@ -809,31 +829,17 @@ fprintf(stderr, "xsltInitCtxtKey %s : %d\n", keyDef->name, ctxt->keyInitLevel); keylist = xmlXPathNodeSetCreate(cur); if (keylist == NULL) goto error; - xmlHashAddEntry(table->keys, str, keylist); + if (xmlHashAddEntry(table->keys, str, keylist) < 0) { + xmlXPathFreeNodeSet(keylist); + goto error; + } } else { /* * TODO: How do we know if this function failed? */ xmlXPathNodeSetAdd(keylist, cur); } - switch (cur->type) { - case XML_ELEMENT_NODE: - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - case XML_PI_NODE: - case XML_COMMENT_NODE: - cur->psvi = keyDef; - break; - case XML_ATTRIBUTE_NODE: - ((xmlAttrPtr) cur)->psvi = keyDef; - break; - case XML_DOCUMENT_NODE: - case XML_HTML_DOCUMENT_NODE: - ((xmlDocPtr) cur)->psvi = keyDef; - break; - default: - break; - } + xsltSetSourceNodeFlags(ctxt, cur, XSLT_SOURCE_NODE_HAS_KEY); xmlFree(str); str = NULL; diff --git a/dll/3rdparty/libxslt/libxslt.3 b/dll/3rdparty/libxslt/libxslt.3 deleted file mode 100644 index f6f855db9aa..00000000000 --- a/dll/3rdparty/libxslt/libxslt.3 +++ /dev/null @@ -1,31 +0,0 @@ -.TH libxslt 3 "30 August 2001" -.SH NAME -libxslt \- library used to do XSL transformations on XML documents -.SH DESCRIPTION -The -.I libxslt -library is used to do XSL transformations on XML documents that -have been loaded into memory with functions from -.I libxml. -.LP -.SH FILES -.TP 2.2i -.B /usr/lib/libxslt_1.0.0/libxslt.a -static library -.TP -.B /usr/lib/libxslt_1.0.0/libxslt.so -sharable library -.TP -.B /usr/package/libxslt_1.0.0/bin/xsltproc -binary application to do XSL transformations on the command line -.SH AUTHORS -Daniel Veillard (daniel@veillard.com). -If you download and install this package look at instructions on the -Web site https://gitlab.gnome.org/GNOME/libxslt . -Manual page by Heiko W. Rupp (hwr@pilhuhn.de) -.SH SEE ALSO -.IR libexslt (3), -.IR libxml (3), -.IR xsltproc (1), -.IR xmllint (1) -.\" end of manual page diff --git a/dll/3rdparty/libxslt/libxslt.spec b/dll/3rdparty/libxslt/libxslt.spec new file mode 100644 index 00000000000..8e4b81c93ee --- /dev/null +++ b/dll/3rdparty/libxslt/libxslt.spec @@ -0,0 +1,242 @@ +@ cdecl xslDebugStatus() +@ cdecl xsltAddKey() +@ cdecl xsltAddStackElemList() +@ cdecl xsltAddTemplate() +@ cdecl xsltAllocateExtra() +@ cdecl xsltAllocateExtraCtxt() +@ cdecl xsltApplyAttributeSet() +@ cdecl xsltApplyImports() +@ cdecl xsltApplyOneTemplate() +@ cdecl xsltApplyStripSpaces() +@ cdecl xsltApplyStylesheet() +@ cdecl xsltApplyStylesheetUser() +@ cdecl xsltApplyTemplates() +@ cdecl xsltAttrListTemplateProcess() +@ cdecl xsltAttrTemplateProcess() +@ cdecl xsltAttrTemplateValueProcess() +@ cdecl xsltAttrTemplateValueProcessNode() +@ cdecl xsltAttribute() +@ cdecl xsltCallTemplate() +@ cdecl xsltCheckExtPrefix() +@ cdecl xsltCheckExtURI() +@ cdecl xsltCheckRead() +@ cdecl xsltCheckWrite() +@ cdecl xsltChoose() +@ cdecl xsltCleanupGlobals() +@ cdecl xsltCleanupTemplates() +@ cdecl xsltComment() +@ cdecl xsltCompMatchClearCache() +@ cdecl xsltCompileAttr() +@ cdecl xsltCompilePattern() +@ cdecl xsltComputeSortResult() +@ cdecl xsltCopy() +@ cdecl xsltCopyNamespace() +@ cdecl xsltCopyNamespaceList() +@ cdecl xsltCopyOf() +@ cdecl xsltCopyTextString() +@ cdecl xsltCreateRVT() +@ cdecl xsltDebug() +@ cdecl xsltDebugDumpExtensions() +@ cdecl xsltDebugGetDefaultTrace() +@ cdecl xsltDebugSetDefaultTrace() +@ cdecl xsltDecimalFormatGetByName() +@ cdecl xsltDecimalFormatGetByQName() +@ cdecl xsltDefaultSortFunction() +@ cdecl xsltDoSortFunction() +@ cdecl xsltDocDefaultLoader() +@ cdecl xsltDocumentComp() +@ cdecl xsltDocumentElem() +@ cdecl xsltDocumentFunction() +@ cdecl xsltDocumentSortFunction() +@ cdecl xsltElement() +@ cdecl xsltElementAvailableFunction() +@ cdecl xsltEngineVersion() +@ cdecl xsltEvalAVT() +@ cdecl xsltEvalAttrValueTemplate() +@ cdecl xsltEvalGlobalVariables() +@ cdecl xsltEvalOneUserParam() +@ cdecl xsltEvalStaticAttrValueTemplate() +@ cdecl xsltEvalTemplateString() +@ cdecl xsltEvalUserParams() +@ cdecl xsltEvalXPathPredicate() +@ cdecl xsltEvalXPathString() +@ cdecl xsltEvalXPathStringNs() +@ cdecl xsltExtElementLookup() +@ cdecl xsltExtMarker() +@ cdecl xsltExtModuleElementLookup() +@ cdecl xsltExtModuleElementPreComputeLookup() +@ cdecl xsltExtModuleFunctionLookup() +@ cdecl xsltExtModuleTopLevelLookup() +@ cdecl xsltExtensionInstructionResultFinalize() +@ cdecl xsltExtensionInstructionResultRegister() +@ cdecl xsltFindDocument() +@ cdecl xsltFindElemSpaceHandling() +@ cdecl xsltFindTemplate() +@ cdecl xsltFlagRVTs() +@ cdecl xsltForEach() +@ cdecl xsltFormatNumberConversion() +@ cdecl xsltFormatNumberFunction() +@ cdecl xsltFreeAVTList() +@ cdecl xsltFreeAttributeSetsHashes() +@ cdecl xsltFreeCompMatchList() +@ cdecl xsltFreeCtxtExts() +@ cdecl xsltFreeDocumentKeys() +@ cdecl xsltFreeDocuments() +@ cdecl xsltFreeExts() +@ cdecl xsltFreeGlobalVariables() +@ cdecl xsltFreeKeys() +@ cdecl xsltFreeLocale() +@ cdecl xsltFreeLocales() +@ cdecl xsltFreeNamespaceAliasHashes() +@ cdecl xsltFreeRVTs() +@ cdecl xsltFreeSecurityPrefs() +@ cdecl xsltFreeStackElemList() +@ cdecl xsltFreeStyleDocuments() +@ cdecl xsltFreeStylePreComps() +@ cdecl xsltFreeStylesheet() +@ cdecl xsltFreeTemplateHashes() +@ cdecl xsltFreeTransformContext() +@ cdecl xsltFunctionAvailableFunction() +@ cdecl xsltFunctionNodeSet() +@ cdecl xsltGenerateIdFunction() +@ cdecl xsltGenericDebug() +@ cdecl xsltGenericDebugContext() +@ cdecl xsltGenericError() +@ cdecl xsltGenericErrorContext() +@ cdecl xsltGetCNsProp() +@ cdecl xsltGetDebuggerStatus() +@ cdecl xsltGetDefaultSecurityPrefs() +@ cdecl xsltGetExtData() +@ cdecl xsltGetExtInfo() +@ cdecl xsltGetKey() +@ cdecl xsltGetNamespace() +@ cdecl xsltGetNsProp() +@ cdecl xsltGetPlainNamespace() +@ cdecl xsltGetQNameURI() +@ cdecl xsltGetQNameURI2() +@ cdecl xsltGetSecurityPrefs() +@ cdecl xsltGetSpecialNamespace() +@ cdecl xsltGetTemplate() +@ cdecl xsltGetUTF8Char() +@ cdecl xsltGetUTF8CharZ() +@ cdecl xsltGetXIncludeDefault() +@ cdecl xsltIf() +@ cdecl xsltInit() +@ cdecl xsltInitAllDocKeys() +@ cdecl xsltInitCtxtExts() +@ cdecl xsltInitCtxtKey() +@ cdecl xsltInitCtxtKeys() +@ cdecl xsltInitElemPreComp() +@ cdecl xsltInitGlobals() +@ cdecl xsltIsBlank() +@ cdecl xsltKeyFunction() +@ cdecl xsltLibxmlVersion() +@ cdecl xsltLibxsltVersion() +@ cdecl xsltLoadDocument() +@ cdecl xsltLoadStyleDocument() +@ cdecl xsltLoadStylesheetPI() +@ cdecl xsltLocalVariablePop() +@ cdecl xsltLocalVariablePush() +@ cdecl xsltLocaleStrcmp() +@ cdecl xsltMaxDepth() +@ cdecl xsltMaxVars() +@ cdecl xsltMessage() +@ cdecl xsltNamespaceAlias() +@ cdecl xsltNeedElemSpaceHandling() +@ cdecl xsltNewDocument() +@ cdecl xsltNewElemPreComp() +@ cdecl xsltNewLocale() +@ cdecl xsltNewSecurityPrefs() +@ cdecl xsltNewStyleDocument() +@ cdecl xsltNewStylesheet() +@ cdecl xsltNewTransformContext() +@ cdecl xsltNextImport() +@ cdecl xsltNormalizeCompSteps() +@ cdecl xsltNumber() +@ cdecl xsltNumberFormat() +@ cdecl xsltParseGlobalParam() +@ cdecl xsltParseGlobalVariable() +@ cdecl xsltParseStylesheetAttributeSet() +@ cdecl xsltParseStylesheetCallerParam() +@ cdecl xsltParseStylesheetDoc() +@ cdecl xsltParseStylesheetFile() +@ cdecl xsltParseStylesheetImport() +@ cdecl xsltParseStylesheetImportedDoc() +@ cdecl xsltParseStylesheetInclude() +@ cdecl xsltParseStylesheetOutput() +@ cdecl xsltParseStylesheetParam() +@ cdecl xsltParseStylesheetProcess() +@ cdecl xsltParseStylesheetUser() +@ cdecl xsltParseStylesheetVariable() +@ cdecl xsltParseTemplateContent() +@ cdecl xsltPreComputeExtModuleElement() +@ cdecl xsltPrintErrorContext() +@ cdecl xsltProcessOneNode() +@ cdecl xsltProcessingInstruction() +@ cdecl xsltProfileStylesheet() +@ cdecl xsltQuoteOneUserParam() +@ cdecl xsltQuoteUserParams() +@ cdecl xsltRegisterAllElement() +@ cdecl xsltRegisterAllExtras() +@ cdecl xsltRegisterAllFunctions() +@ cdecl xsltRegisterExtElement() +@ cdecl xsltRegisterExtFunction() +@ cdecl xsltRegisterExtModule() +@ cdecl xsltRegisterExtModuleElement() +@ cdecl xsltRegisterExtModuleFull() +@ cdecl xsltRegisterExtModuleFunction() +@ cdecl xsltRegisterExtModuleTopLevel() +@ cdecl xsltRegisterExtPrefix() +@ cdecl xsltRegisterExtras() +@ cdecl xsltRegisterLocalRVT() +@ cdecl xsltRegisterPersistRVT() +@ cdecl xsltRegisterTestModule() +@ cdecl xsltRegisterTmpRVT() +@ cdecl xsltReleaseRVT() +@ cdecl xsltResolveStylesheetAttributeSet() +@ cdecl xsltRunStylesheet() +@ cdecl xsltRunStylesheetUser() +@ cdecl xsltSaveResultTo() +@ cdecl xsltSaveResultToFd() +@ cdecl xsltSaveResultToFile() +@ cdecl xsltSaveResultToFilename() +@ cdecl xsltSaveResultToString() +@ cdecl xsltSecurityAllow() +@ cdecl xsltSecurityForbid() +@ cdecl xsltSetCtxtLocaleHandlers() +@ cdecl xsltSetCtxtParseOptions() +@ cdecl xsltSetCtxtSecurityPrefs() +@ cdecl xsltSetCtxtSortFunc() +@ cdecl xsltSetDefaultSecurityPrefs() +@ cdecl xsltSetGenericDebugFunc() +@ cdecl xsltSetGenericErrorFunc() +@ cdecl xsltSetLoaderFunc() +@ cdecl xsltSetSecurityPrefs() +@ cdecl xsltSetSortFunc() +@ cdecl xsltSetTransformErrorFunc() +@ cdecl xsltSetXIncludeDefault() +@ cdecl xsltShutdownCtxtExts() +@ cdecl xsltShutdownExts() +@ cdecl xsltSort() +@ cdecl xsltSplitQName() +@ cdecl xsltStrxfrm() +@ cdecl xsltStyleGetExtData() +@ cdecl xsltStylePreCompute() +@ cdecl xsltSystemPropertyFunction() +@ cdecl xsltTemplateProcess() +@ cdecl xsltTestCompMatchList() +@ cdecl xsltText() +@ cdecl xsltTransformError() +@ cdecl xsltUninit() +@ cdecl xsltUnparsedEntityURIFunction() +@ cdecl xsltUnregisterExtModule() +@ cdecl xsltUnregisterExtModuleElement() +@ cdecl xsltUnregisterExtModuleFunction() +@ cdecl xsltUnregisterExtModuleTopLevel() +@ cdecl xsltValueOf() +@ cdecl xsltVariableLookup() +@ cdecl xsltXPathCompile() +@ cdecl xsltXPathCompileFlags() +@ cdecl xsltXPathFunctionLookup() +@ cdecl xsltXPathGetTransformContext() +@ cdecl xsltXPathVariableLookup() diff --git a/dll/3rdparty/libxslt/namespaces.c b/dll/3rdparty/libxslt/namespaces.c index 1ee3b9f0cea..651c422ac49 100644 --- a/dll/3rdparty/libxslt/namespaces.c +++ b/dll/3rdparty/libxslt/namespaces.c @@ -9,7 +9,27 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#ifndef XSLT_NEED_TRIO +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "namespaces.h" +#include "imports.h" /************************************************************************ * * diff --git a/dll/3rdparty/libxslt/numbers.c b/dll/3rdparty/libxslt/numbers.c index d737221ec8c..3cd881e3c8d 100644 --- a/dll/3rdparty/libxslt/numbers.c +++ b/dll/3rdparty/libxslt/numbers.c @@ -10,7 +10,24 @@ * Bjorn Reese */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "xsltutils.h" +#include "pattern.h" +#include "templates.h" +#include "transform.h" +#include "numbersInternals.h" #ifndef FALSE # define FALSE (0 == 1) @@ -99,7 +116,7 @@ xsltIsLetterDigit(int val) { #define IS_DIGIT_ONE(x) xsltIsDigitZero((x)-1) static int -xsltIsDigitZero(unsigned int ch) +xsltIsDigitZero(int ch) { /* * Reference: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt @@ -166,7 +183,7 @@ xsltNumberFormatDecimal(xmlBufferPtr buffer, i = -1; break; } - *(--pointer) = (xmlChar)val; + *(--pointer) = val; } else { /* @@ -336,8 +353,7 @@ xsltNumberFormatTokenize(const xmlChar *format, * Insert initial non-alphanumeric token. * There is always such a token in the list, even if NULL */ - while (!xsltIsLetterDigit(val = xmlStringCurrentChar(NULL, format+ix, - &len))) { + while (!xsltIsLetterDigit(val = xsltGetUTF8CharZ(format+ix, &len))) { if (format[ix] == 0) /* if end of format string */ break; /* while */ ix += len; @@ -360,19 +376,19 @@ xsltNumberFormatTokenize(const xmlChar *format, tokens->end = NULL; } - val = xmlStringCurrentChar(NULL, format+ix, &len); + val = xsltGetUTF8CharZ(format+ix, &len); if (IS_DIGIT_ONE(val) || IS_DIGIT_ZERO(val)) { tokens->tokens[tokens->nTokens].width = 1; while (IS_DIGIT_ZERO(val)) { tokens->tokens[tokens->nTokens].width++; ix += len; - val = xmlStringCurrentChar(NULL, format+ix, &len); + val = xsltGetUTF8CharZ(format+ix, &len); } if (IS_DIGIT_ONE(val)) { tokens->tokens[tokens->nTokens].token = val - 1; ix += len; - val = xmlStringCurrentChar(NULL, format+ix, &len); + val = xsltGetUTF8CharZ(format+ix, &len); } else { tokens->tokens[tokens->nTokens].token = '0'; tokens->tokens[tokens->nTokens].width = 1; @@ -383,7 +399,7 @@ xsltNumberFormatTokenize(const xmlChar *format, (val == 'i') ) { tokens->tokens[tokens->nTokens].token = val; ix += len; - val = xmlStringCurrentChar(NULL, format+ix, &len); + val = xsltGetUTF8CharZ(format+ix, &len); } else { /* XSLT section 7.7 * "Any other format token indicates a numbering sequence @@ -405,7 +421,7 @@ xsltNumberFormatTokenize(const xmlChar *format, */ while (xsltIsLetterDigit(val)) { ix += len; - val = xmlStringCurrentChar(NULL, format+ix, &len); + val = xsltGetUTF8CharZ(format+ix, &len); } /* @@ -416,7 +432,7 @@ xsltNumberFormatTokenize(const xmlChar *format, if (val == 0) break; /* while */ ix += len; - val = xmlStringCurrentChar(NULL, format+ix, &len); + val = xsltGetUTF8CharZ(format+ix, &len); } if (ix > j) tokens->end = xmlStrndup(&format[j], ix - j); @@ -948,6 +964,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, xmlChar *the_format, *prefix = NULL, *suffix = NULL; xmlChar *nprefix, *nsuffix = NULL; int prefix_length, suffix_length = 0, nprefix_length, nsuffix_length; + int exp10; double scale; int j, len = 0; int self_grouping_len; @@ -968,32 +985,12 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, "Invalid format (0-length)\n"); } *result = NULL; - switch (xmlXPathIsInf(number)) { - case -1: - if (self->minusSign == NULL) - *result = xmlStrdup(BAD_CAST "-"); - else - *result = xmlStrdup(self->minusSign); - /* Intentional fall-through */ - case 1: - if ((self == NULL) || (self->infinity == NULL)) - *result = xmlStrcat(*result, BAD_CAST "Infinity"); - else - *result = xmlStrcat(*result, self->infinity); - return(status); - default: - if (xmlXPathIsNaN(number)) { - if ((self == NULL) || (self->noNumber == NULL)) - *result = xmlStrdup(BAD_CAST "NaN"); - else - *result = xmlStrdup(self->noNumber); - return(status); - } - } - - buffer = xmlBufferCreate(); - if (buffer == NULL) { - return XPATH_MEMORY_ERROR; + if (xmlXPathIsNaN(number)) { + if ((self == NULL) || (self->noNumber == NULL)) + *result = xmlStrdup(BAD_CAST "NaN"); + else + *result = xmlStrdup(self->noNumber); + return(status); } format_info.integer_hash = 0; @@ -1266,6 +1263,30 @@ OUTPUT_NUMBER: format_info.add_decimal = TRUE; } + /* Apply multiplier */ + number *= (double)format_info.multiplier; + switch (xmlXPathIsInf(number)) { + case -1: + if (self->minusSign == NULL) + *result = xmlStrdup(BAD_CAST "-"); + else + *result = xmlStrdup(self->minusSign); + /* Intentional fall-through */ + case 1: + if ((self == NULL) || (self->infinity == NULL)) + *result = xmlStrcat(*result, BAD_CAST "Infinity"); + else + *result = xmlStrcat(*result, self->infinity); + return(status); + default: + break; + } + + buffer = xmlBufferCreate(); + if (buffer == NULL) { + return XPATH_MEMORY_ERROR; + } + /* Ready to output our number. First see if "default sign" is required */ if (default_sign != 0) xmlBufferAdd(buffer, self->minusSign, xmlUTF8Strsize(self->minusSign, 1)); @@ -1280,10 +1301,24 @@ OUTPUT_NUMBER: j += len; } + /* Round to n digits */ + number = fabs(number); + exp10 = format_info.frac_digits + format_info.frac_hash; + /* DBL_MAX_10_EXP should be 308 on IEEE platforms. */ + if (exp10 > DBL_MAX_10_EXP) { + if (format_info.frac_digits > DBL_MAX_10_EXP) { + format_info.frac_digits = DBL_MAX_10_EXP; + format_info.frac_hash = 0; + } else { + format_info.frac_hash = DBL_MAX_10_EXP - format_info.frac_digits; + } + exp10 = DBL_MAX_10_EXP; + } + scale = pow(10.0, (double) exp10); + number += .5 / scale; + number -= fmod(number, 1 / scale); + /* Next do the integer part of the number */ - number = fabs(number) * (double)format_info.multiplier; - scale = pow(10.0, (double)(format_info.frac_digits + format_info.frac_hash)); - number = floor((scale * number + 0.5)) / scale; if ((self->grouping != NULL) && (self->grouping[0] != 0)) { int gchar; diff --git a/dll/3rdparty/libxslt/pattern.c b/dll/3rdparty/libxslt/pattern.c index 0faf1431b43..581f17919fe 100644 --- a/dll/3rdparty/libxslt/pattern.c +++ b/dll/3rdparty/libxslt/pattern.c @@ -14,7 +14,26 @@ * TODO: detect [number] at compilation, optimize accordingly */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "imports.h" +#include "templates.h" +#include "keys.h" +#include "pattern.h" +#include "documents.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_PATTERN @@ -292,10 +311,6 @@ xsltCompMatchAdd(xsltParserContextPtr ctxt, xsltCompMatchPtr comp, "xsltCompMatchAdd: memory re-allocation failure.\n"); if (ctxt->style != NULL) ctxt->style->errors++; - if (value) - xmlFree(value); - if (value2) - xmlFree(value2); return (-1); } comp->maxStep *= 2; @@ -464,16 +479,12 @@ xsltReverseCompMatch(xsltParserContextPtr ctxt, xsltCompMatchPtr comp) { static int xsltPatPushState(xsltTransformContextPtr ctxt, xsltStepStates *states, int step, xmlNodePtr node) { - if ((states->states == NULL) || (states->maxstates <= 0)) { - states->maxstates = 4; - states->nbstates = 0; - states->states = xmlMalloc(4 * sizeof(xsltStepState)); - } - else if (states->maxstates <= states->nbstates) { + if (states->maxstates <= states->nbstates) { xsltStepState *tmp; + int newMax = states->maxstates == 0 ? 4 : 2 * states->maxstates; tmp = (xsltStepStatePtr) xmlRealloc(states->states, - 2 * states->maxstates * sizeof(xsltStepState)); + newMax * sizeof(xsltStepState)); if (tmp == NULL) { xsltGenericError(xsltGenericErrorContext, "xsltPatPushState: memory re-allocation failure.\n"); @@ -481,7 +492,7 @@ xsltPatPushState(xsltTransformContextPtr ctxt, xsltStepStates *states, return(-1); } states->states = tmp; - states->maxstates *= 2; + states->maxstates = newMax; } states->states[states->nbstates].step = step; states->states[states->nbstates++].node = node; @@ -1215,10 +1226,10 @@ xsltScanLiteral(xsltParserContextPtr ctxt) { if (CUR == '"') { NEXT; cur = q = CUR_PTR; - val = xmlStringCurrentChar(NULL, cur, &len); + val = xsltGetUTF8CharZ(cur, &len); while ((xmlIsCharQ(val)) && (val != '"')) { cur += len; - val = xmlStringCurrentChar(NULL, cur, &len); + val = xsltGetUTF8CharZ(cur, &len); } if (!xmlIsCharQ(val)) { ctxt->error = 1; @@ -1231,10 +1242,10 @@ xsltScanLiteral(xsltParserContextPtr ctxt) { } else if (CUR == '\'') { NEXT; cur = q = CUR_PTR; - val = xmlStringCurrentChar(NULL, cur, &len); + val = xsltGetUTF8CharZ(cur, &len); while ((xmlIsCharQ(val)) && (val != '\'')) { cur += len; - val = xmlStringCurrentChar(NULL, cur, &len); + val = xsltGetUTF8CharZ(cur, &len); } if (!xmlIsCharQ(val)) { ctxt->error = 1; @@ -1269,7 +1280,7 @@ xsltScanNCName(xsltParserContextPtr ctxt) { SKIP_BLANKS; cur = q = CUR_PTR; - val = xmlStringCurrentChar(NULL, cur, &len); + val = xsltGetUTF8CharZ(cur, &len); if (!xmlIsBaseCharQ(val) && !xmlIsIdeographicQ(val) && (val != '_')) return(NULL); @@ -1280,7 +1291,7 @@ xsltScanNCName(xsltParserContextPtr ctxt) { xmlIsCombiningQ(val) || xmlIsExtenderQ(val)) { cur += len; - val = xmlStringCurrentChar(NULL, cur, &len); + val = xsltGetUTF8CharZ(cur, &len); } ret = xmlStrndup(q, cur - q); CUR_PTR = cur; @@ -1493,6 +1504,7 @@ xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { xmlChar *name = NULL; const xmlChar *URI = NULL; xmlChar *URL = NULL; + xmlChar *ret = NULL; int level; xsltAxis axis = 0; @@ -1569,7 +1581,6 @@ parse_node_test: xsltTransformError(NULL, NULL, NULL, "xsltCompileStepPattern : Name expected\n"); ctxt->error = 1; - xmlFree(URL); goto error; } } else { @@ -1632,7 +1643,6 @@ parse_predicate: level = 0; while (CUR == '[') { const xmlChar *q; - xmlChar *ret = NULL; level++; NEXT; @@ -1676,6 +1686,10 @@ error: xmlFree(token); if (name != NULL) xmlFree(name); + if (URL != NULL) + xmlFree(URL); + if (ret != NULL) + xmlFree(ret); } /** @@ -2068,6 +2082,8 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, if (pat == NULL) return(-1); while (pat) { + int success = 0; + next = pat->next; pat->next = NULL; name = NULL; @@ -2139,17 +2155,15 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, if (name != NULL) { if (style->templatesHash == NULL) { style->templatesHash = xmlHashCreate(1024); - if (style->templatesHash == NULL) { - xsltFreeCompMatch(pat); - return(-1); - } - xmlHashAddEntry3(style->templatesHash, name, mode, modeURI, pat); + success = (style->templatesHash != NULL) && + (xmlHashAddEntry3(style->templatesHash, name, mode, + modeURI, pat) >= 0); } else { list = (xsltCompMatchPtr) xmlHashLookup3(style->templatesHash, name, mode, modeURI); if (list == NULL) { - xmlHashAddEntry3(style->templatesHash, name, - mode, modeURI, pat); + success = (xmlHashAddEntry3(style->templatesHash, name, + mode, modeURI, pat) >= 0); } else { /* * Note '<=' since one must choose among the matching @@ -2169,6 +2183,7 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, pat->next = list->next; list->next = pat; } + success = 1; } } } else if (top != NULL) { @@ -2188,10 +2203,13 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, pat->next = list->next; list->next = pat; } - } else { + success = 1; + } + if (success == 0) { xsltTransformError(NULL, style, NULL, "xsltAddTemplate: invalid compiled pattern\n"); xsltFreeCompMatch(pat); + xsltFreeCompMatchList(next); return(-1); } #ifdef WITH_XSLT_DEBUG_PATTERN @@ -2264,7 +2282,6 @@ xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, const xmlChar *name = NULL; xsltCompMatchPtr list = NULL; float priority; - int keyed = 0; if ((ctxt == NULL) || (node == NULL)) return(NULL); @@ -2342,37 +2359,25 @@ xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, list = curstyle->rootMatch; else list = curstyle->elemMatch; - if (node->psvi != NULL) keyed = 1; break; case XML_ATTRIBUTE_NODE: { - xmlAttrPtr attr; - list = curstyle->attrMatch; - attr = (xmlAttrPtr) node; - if (attr->psvi != NULL) keyed = 1; break; } case XML_PI_NODE: list = curstyle->piMatch; - if (node->psvi != NULL) keyed = 1; break; case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: { - xmlDocPtr doc; - list = curstyle->rootMatch; - doc = (xmlDocPtr) node; - if (doc->psvi != NULL) keyed = 1; break; } case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: list = curstyle->textMatch; - if (node->psvi != NULL) keyed = 1; break; case XML_COMMENT_NODE: list = curstyle->commentMatch; - if (node->psvi != NULL) keyed = 1; break; case XML_ENTITY_REF_NODE: case XML_ENTITY_NODE: @@ -2442,7 +2447,7 @@ xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, } keyed_match: - if (keyed) { + if (xsltGetSourceNodeFlags(node) & XSLT_SOURCE_NODE_HAS_KEY) { list = curstyle->keyMatch; while ((list != NULL) && ((ret == NULL) || @@ -2470,27 +2475,7 @@ keyed_match: if (xsltComputeAllKeys(ctxt, node) == -1) goto error; - switch (node->type) { - case XML_ELEMENT_NODE: - if (node->psvi != NULL) keyed = 1; - break; - case XML_ATTRIBUTE_NODE: - if (((xmlAttrPtr) node)->psvi != NULL) keyed = 1; - break; - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - case XML_COMMENT_NODE: - case XML_PI_NODE: - if (node->psvi != NULL) keyed = 1; - break; - case XML_DOCUMENT_NODE: - case XML_HTML_DOCUMENT_NODE: - if (((xmlDocPtr) node)->psvi != NULL) keyed = 1; - break; - default: - break; - } - if (keyed) + if (xsltGetSourceNodeFlags(node) & XSLT_SOURCE_NODE_HAS_KEY) goto keyed_match; } if (ret != NULL) diff --git a/dll/3rdparty/libxslt/preproc.c b/dll/3rdparty/libxslt/preproc.c index 2cf135e4dbe..fae69a09d48 100644 --- a/dll/3rdparty/libxslt/preproc.c +++ b/dll/3rdparty/libxslt/preproc.c @@ -15,7 +15,31 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltutils.h" +#include "xsltInternals.h" +#include "transform.h" +#include "templates.h" +#include "variables.h" +#include "numbersInternals.h" +#include "preproc.h" +#include "extra.h" +#include "imports.h" +#include "extensions.h" +#include "pattern.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_PREPROC @@ -368,8 +392,6 @@ 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); } @@ -472,8 +494,6 @@ xsltFreeStylePreComp(xsltStylePreCompPtr comp) { break; } #else - if (comp->locale != (xsltLocale)0) - xsltFreeLocale(comp->locale); if (comp->comp != NULL) xmlXPathFreeCompExpr(comp->comp); if (comp->numdata.countPat != NULL) @@ -719,12 +739,6 @@ 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/dll/3rdparty/libxslt/security.c b/dll/3rdparty/libxslt/security.c index 798282fc78b..520f7de7ab8 100644 --- a/dll/3rdparty/libxslt/security.c +++ b/dll/3rdparty/libxslt/security.c @@ -6,13 +6,20 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif #ifdef HAVE_SYS_STAT_H #include #endif #if defined(_WIN32) +#include #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #endif @@ -29,6 +36,16 @@ # endif #endif +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "extensions.h" +#include "security.h" + + struct _xsltSecurityPrefs { xsltSecurityCheck readFile; xsltSecurityCheck createFile; @@ -405,6 +422,19 @@ xsltCheckRead(xsltSecurityPrefsPtr sec, xmlURIPtr uri; xsltSecurityCheck check; + if (xmlStrstr(URL, BAD_CAST "://") == NULL) { + check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_READ_FILE); + if (check != NULL) { + ret = check(sec, ctxt, (const char *) URL); + if (ret == 0) { + xsltTransformError(ctxt, NULL, NULL, + "Local file read for %s refused\n", URL); + return(0); + } + } + return(1); + } + uri = xmlParseURI((const char *)URL); if (uri == NULL) { xsltTransformError(ctxt, NULL, NULL, @@ -446,4 +476,3 @@ xsltCheckRead(xsltSecurityPrefsPtr sec, xmlFreeURI(uri); return(1); } - diff --git a/dll/3rdparty/libxslt/templates.c b/dll/3rdparty/libxslt/templates.c index 2d7a749e296..f08b9bda418 100644 --- a/dll/3rdparty/libxslt/templates.c +++ b/dll/3rdparty/libxslt/templates.c @@ -9,9 +9,27 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" +#include + +#include #include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "variables.h" +#include "functions.h" +#include "templates.h" +#include "transform.h" +#include "namespaces.h" +#include "attributes.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_TEMPLATES @@ -133,7 +151,7 @@ xsltEvalXPathStringNs(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp, if (res != NULL) { if (res->type != XPATH_STRING) res = xmlXPathConvertString(res); - if (res->type == XPATH_STRING) { + if ((res != NULL) && (res->type == XPATH_STRING)) { ret = res->stringval; res->stringval = NULL; } else { @@ -211,7 +229,7 @@ xsltEvalTemplateString(xsltTransformContextPtr ctxt, insert = xmlNewDocNode(ctxt->output, NULL, (const xmlChar *)"fake", NULL); if (insert == NULL) { - xsltTransformError(ctxt, NULL, contextNode, + xsltTransformError(ctxt, NULL, inst, "Failed to create temporary node\n"); return(NULL); } diff --git a/dll/3rdparty/libxslt/transform.c b/dll/3rdparty/libxslt/transform.c index 56391b43fa4..54ef821b501 100644 --- a/dll/3rdparty/libxslt/transform.c +++ b/dll/3rdparty/libxslt/transform.c @@ -16,9 +16,45 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "xsltlocale.h" +#include "pattern.h" +#include "transform.h" +#include "variables.h" +#include "numbersInternals.h" +#include "namespaces.h" +#include "attributes.h" +#include "templates.h" +#include "imports.h" +#include "keys.h" +#include "documents.h" +#include "extensions.h" +#include "extra.h" +#include "preproc.h" +#include "security.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_EXTRA @@ -84,26 +120,18 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, static int templPush(xsltTransformContextPtr ctxt, xsltTemplatePtr value) { - if (ctxt->templMax == 0) { - ctxt->templMax = 4; - ctxt->templTab = - (xsltTemplatePtr *) xmlMalloc(ctxt->templMax * - sizeof(ctxt->templTab[0])); - if (ctxt->templTab == NULL) { - xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); - return (0); - } - } - else if (ctxt->templNr >= ctxt->templMax) { - ctxt->templMax *= 2; - ctxt->templTab = - (xsltTemplatePtr *) xmlRealloc(ctxt->templTab, - ctxt->templMax * - sizeof(ctxt->templTab[0])); - if (ctxt->templTab == NULL) { + if (ctxt->templNr >= ctxt->templMax) { + xsltTemplatePtr *tmp; + int newMax = ctxt->templMax == 0 ? 4 : ctxt->templMax * 2; + + tmp = (xsltTemplatePtr *) xmlRealloc(ctxt->templTab, + newMax * sizeof(*tmp)); + if (tmp == NULL) { xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); return (0); } + ctxt->templTab = tmp; + ctxt->templMax = newMax; } ctxt->templTab[ctxt->templNr] = value; ctxt->templ = value; @@ -457,7 +485,7 @@ void xsltDebugSetDefaultTrace(xsltDebugTraceCodes val) { * * Returns the current default debug tracing level mask */ -xsltDebugTraceCodes xsltDebugGetDefaultTrace() { +xsltDebugTraceCodes xsltDebugGetDefaultTrace(void) { return xsltDefaultTrace; } @@ -671,6 +699,10 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) { cur->xinclude = xsltGetXIncludeDefault(); cur->keyInitLevel = 0; + cur->newLocale = xsltNewLocale; + cur->freeLocale = xsltFreeLocale; + cur->genSortKey = xsltStrxfrm; + return(cur); internal_err: @@ -681,7 +713,7 @@ internal_err: /** * xsltFreeTransformContext: - * @ctxt: an XSLT parser context + * @ctxt: an XSLT transform context * * Free up the memory allocated by @ctxt */ @@ -1055,8 +1087,10 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, if (xmlDictOwns(ctxt->dict, cur->content)) copy->content = cur->content; else { - if ((copy->content = xmlStrdup(cur->content)) == NULL) + if ((copy->content = xmlStrdup(cur->content)) == NULL) { + xmlFreeNode(copy); return NULL; + } } ctxt->lasttext = NULL; @@ -1958,7 +1992,21 @@ xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node, case XML_ELEMENT_NODE: ctxt->xpathCtxt->contextSize = nbchild; ctxt->xpathCtxt->proximityPosition = childno; + + if (ctxt->depth >= ctxt->maxTemplateDepth) { + xsltTransformError(ctxt, NULL, cur, + "xsltDefaultProcessOneNode: Maximum template depth " + "exceeded.\n" + "You can adjust xsltMaxDepth (--maxdepth) in order to " + "raise the maximum number of nested template calls and " + "variables/params (currently set to %d).\n", + ctxt->maxTemplateDepth); + ctxt->state = XSLT_STATE_STOPPED; + return; + } + ctxt->depth++; xsltProcessOneNode(ctxt, cur, params); + ctxt->depth--; break; case XML_CDATA_SECTION_NODE: template = xsltGetTemplate(ctxt, cur, NULL); @@ -2189,26 +2237,18 @@ xsltLocalVariablePush(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, int level) { - if (ctxt->varsMax == 0) { - ctxt->varsMax = 10; - ctxt->varsTab = - (xsltStackElemPtr *) xmlMalloc(ctxt->varsMax * - sizeof(ctxt->varsTab[0])); - if (ctxt->varsTab == NULL) { - xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); - return (-1); - } - } if (ctxt->varsNr >= ctxt->varsMax) { - ctxt->varsMax *= 2; - ctxt->varsTab = - (xsltStackElemPtr *) xmlRealloc(ctxt->varsTab, - ctxt->varsMax * - sizeof(ctxt->varsTab[0])); - if (ctxt->varsTab == NULL) { + xsltStackElemPtr *tmp; + int newMax = ctxt->varsMax == 0 ? 10 : 2 * ctxt->varsMax; + + tmp = (xsltStackElemPtr *) xmlRealloc(ctxt->varsTab, + newMax * sizeof(*tmp)); + if (tmp == NULL) { xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); return (-1); } + ctxt->varsTab = tmp; + ctxt->varsMax = newMax; } ctxt->varsTab[ctxt->varsNr++] = variable; ctxt->vars = variable; @@ -2240,17 +2280,17 @@ xsltReleaseLocalRVTs(xsltTransformContextPtr ctxt, xmlDocPtr base) do { tmp = cur; cur = (xmlDocPtr) cur->next; - if (tmp->psvi == XSLT_RVT_LOCAL) { + if (tmp->compression == XSLT_RVT_LOCAL) { xsltReleaseRVT(ctxt, tmp); - } else if (tmp->psvi == XSLT_RVT_GLOBAL) { + } else if (tmp->compression == XSLT_RVT_GLOBAL) { xsltRegisterPersistRVT(ctxt, tmp); - } else if (tmp->psvi == XSLT_RVT_FUNC_RESULT) { + } else if (tmp->compression == XSLT_RVT_FUNC_RESULT) { /* * This will either register the RVT again or move it to the * context variable. */ xsltRegisterLocalRVT(ctxt, tmp); - tmp->psvi = XSLT_RVT_FUNC_RESULT; + tmp->compression = XSLT_RVT_FUNC_RESULT; } else { xmlGenericError(xmlGenericErrorContext, "xsltReleaseLocalRVTs: Unexpected RVT flag %p\n", @@ -5711,6 +5751,49 @@ xsltCountKeys(xsltTransformContextPtr ctxt) return(ctxt->nbKeys); } +/** + * xsltCleanupSourceDoc: + * @doc: Document + * + * Resets source node flags and ids stored in 'psvi' member. + */ +static void +xsltCleanupSourceDoc(xmlDocPtr doc) { + xmlNodePtr cur = (xmlNodePtr) doc; + void **psviPtr; + + while (1) { + xsltClearSourceNodeFlags(cur, XSLT_SOURCE_NODE_MASK); + psviPtr = xsltGetPSVIPtr(cur); + if (psviPtr) + *psviPtr = NULL; + + if (cur->type == XML_ELEMENT_NODE) { + xmlAttrPtr prop = cur->properties; + + while (prop) { + prop->atype &= ~(XSLT_SOURCE_NODE_MASK << 27); + prop->psvi = NULL; + prop = prop->next; + } + } + + if (cur->children != NULL && cur->type != XML_ENTITY_REF_NODE) { + cur = cur->children; + } else { + if (cur == (xmlNodePtr) doc) + return; + while (cur->next == NULL) { + cur = cur->parent; + if (cur == (xmlNodePtr) doc) + return; + } + + cur = cur->next; + } + } +} + /** * xsltApplyStylesheetInternal: * @style: a parsed XSLT stylesheet @@ -6109,6 +6192,9 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, printf("# Reused variables : %d\n", ctxt->cache->dbgReusedVars); #endif + if (ctxt->sourceDocDirty) + xsltCleanupSourceDoc(doc); + if ((ctxt != NULL) && (userCtxt == NULL)) xsltFreeTransformContext(ctxt); diff --git a/dll/3rdparty/libxslt/variables.c b/dll/3rdparty/libxslt/variables.c index 390bb46ba4d..0e9091af67c 100644 --- a/dll/3rdparty/libxslt/variables.c +++ b/dll/3rdparty/libxslt/variables.c @@ -9,7 +9,28 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "variables.h" +#include "transform.h" +#include "imports.h" +#include "preproc.h" +#include "keys.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_VARIABLE @@ -102,7 +123,7 @@ xsltRegisterTmpRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) return(-1); RVT->prev = NULL; - RVT->psvi = XSLT_RVT_LOCAL; + RVT->compression = XSLT_RVT_LOCAL; /* * We'll restrict the lifetime of user-created fragments @@ -142,7 +163,7 @@ xsltRegisterLocalRVT(xsltTransformContextPtr ctxt, return(-1); RVT->prev = NULL; - RVT->psvi = XSLT_RVT_LOCAL; + RVT->compression = XSLT_RVT_LOCAL; /* * When evaluating "select" expressions of xsl:variable @@ -234,7 +255,7 @@ xsltExtensionInstructionResultRegister( * Returns 0 in case of success and -1 in case of error. */ int -xsltFlagRVTs(xsltTransformContextPtr ctxt, xmlXPathObjectPtr obj, void *val) { +xsltFlagRVTs(xsltTransformContextPtr ctxt, xmlXPathObjectPtr obj, int val) { int i; xmlNodePtr cur; xmlDocPtr doc; @@ -281,34 +302,36 @@ xsltFlagRVTs(xsltTransformContextPtr ctxt, xmlXPathObjectPtr obj, void *val) { return(-1); } if (doc->name && (doc->name[0] == ' ') && - doc->psvi != XSLT_RVT_GLOBAL) { + doc->compression != XSLT_RVT_GLOBAL) { /* * This is a result tree fragment. - * We store ownership information in the @psvi field. + * We store ownership information in the @compression field. * TODO: How do we know if this is a doc acquired via the * document() function? */ #ifdef WITH_XSLT_DEBUG_VARIABLE - XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, - "Flagging RVT %p: %p -> %p\n", doc, doc->psvi, val)); + XSLT_TRACE(ctxt, XSLT_TRACE_VARIABLES, + xsltGenericDebug(xsltGenericDebugContext, + "Flagging RVT %p: %d -> %d\n", + (void *) doc, doc->compression, val)); #endif if (val == XSLT_RVT_LOCAL) { - if (doc->psvi == XSLT_RVT_FUNC_RESULT) - doc->psvi = XSLT_RVT_LOCAL; + if (doc->compression == XSLT_RVT_FUNC_RESULT) + doc->compression = XSLT_RVT_LOCAL; } else if (val == XSLT_RVT_GLOBAL) { - if (doc->psvi != XSLT_RVT_LOCAL) { + if (doc->compression != XSLT_RVT_LOCAL) { xmlGenericError(xmlGenericErrorContext, - "xsltFlagRVTs: Invalid transition %p => GLOBAL\n", - doc->psvi); - doc->psvi = XSLT_RVT_GLOBAL; + "xsltFlagRVTs: Invalid transition %d => GLOBAL\n", + doc->compression); + doc->compression = XSLT_RVT_GLOBAL; return(-1); } /* Will be registered as persistant in xsltReleaseLocalRVTs. */ - doc->psvi = XSLT_RVT_GLOBAL; + doc->compression = XSLT_RVT_GLOBAL; } else if (val == XSLT_RVT_FUNC_RESULT) { - doc->psvi = val; + doc->compression = val; } } } @@ -356,7 +379,7 @@ xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) /* * Reset the ownership information. */ - RVT->psvi = NULL; + RVT->compression = 0; RVT->next = (xmlNodePtr) ctxt->cache->RVT; ctxt->cache->RVT = RVT; @@ -395,7 +418,7 @@ xsltRegisterPersistRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) { if ((ctxt == NULL) || (RVT == NULL)) return(-1); - RVT->psvi = XSLT_RVT_GLOBAL; + RVT->compression = XSLT_RVT_GLOBAL; RVT->prev = NULL; RVT->next = (xmlNodePtr) ctxt->persistRVT; if (ctxt->persistRVT != NULL) @@ -554,15 +577,15 @@ xsltFreeStackElem(xsltStackElemPtr elem) { cur = elem->fragment; elem->fragment = (xmlDocPtr) cur->next; - if (cur->psvi == XSLT_RVT_LOCAL) { + if (cur->compression == XSLT_RVT_LOCAL) { xsltReleaseRVT(elem->context, cur); - } else if (cur->psvi == XSLT_RVT_FUNC_RESULT) { + } else if (cur->compression == XSLT_RVT_FUNC_RESULT) { xsltRegisterLocalRVT(elem->context, cur); - cur->psvi = XSLT_RVT_FUNC_RESULT; + cur->compression = XSLT_RVT_FUNC_RESULT; } else { xmlGenericError(xmlGenericErrorContext, - "xsltFreeStackElem: Unexpected RVT flag %p\n", - cur->psvi); + "xsltFreeStackElem: Unexpected RVT flag %d\n", + cur->compression); } } } @@ -734,26 +757,18 @@ xsltAddStackElem(xsltTransformContextPtr ctxt, xsltStackElemPtr elem) return(-1); do { - if (ctxt->varsMax == 0) { - ctxt->varsMax = 10; - ctxt->varsTab = - (xsltStackElemPtr *) xmlMalloc(ctxt->varsMax * - sizeof(ctxt->varsTab[0])); - if (ctxt->varsTab == NULL) { - xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); - return (-1); - } - } if (ctxt->varsNr >= ctxt->varsMax) { - ctxt->varsMax *= 2; - ctxt->varsTab = - (xsltStackElemPtr *) xmlRealloc(ctxt->varsTab, - ctxt->varsMax * - sizeof(ctxt->varsTab[0])); - if (ctxt->varsTab == NULL) { - xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); - return (-1); - } + xsltStackElemPtr *tmp; + int newMax = ctxt->varsMax == 0 ? 10 : 2 * ctxt->varsMax; + + tmp = (xsltStackElemPtr *) xmlRealloc(ctxt->varsTab, + newMax * sizeof(*tmp)); + if (tmp == NULL) { + xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + return (-1); + } + ctxt->varsTab = tmp; + ctxt->varsMax = newMax; } ctxt->varsTab[ctxt->varsNr++] = elem; ctxt->vars = elem; @@ -965,7 +980,7 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, * the Result Tree Fragment. */ variable->fragment = container; - container->psvi = XSLT_RVT_LOCAL; + container->compression = XSLT_RVT_LOCAL; oldOutput = ctxt->output; oldInsert = ctxt->insert; @@ -995,10 +1010,10 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, if (result == NULL) { result = xmlXPathNewCString(""); } else { - /* - * Freeing is not handled there anymore. - * QUESTION TODO: What does the above comment mean? - */ + /* + * This stops older libxml2 versions from freeing the nodes + * in the tree. + */ result->boolval = 0; } #ifdef WITH_XSLT_DEBUG_VARIABLE @@ -1217,7 +1232,11 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) if (result == NULL) { result = xmlXPathNewCString(""); } else { - result->boolval = 0; /* Freeing is not handled there anymore */ + /* + * This stops older libxml2 versions from freeing the nodes + * in the tree. + */ + result->boolval = 0; } #ifdef WITH_XSLT_DEBUG_VARIABLE #ifdef LIBXML_DEBUG_ENABLED @@ -1295,8 +1314,13 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) { if (def == NULL) { def = xsltCopyStackElem(elem); - xmlHashAddEntry2(ctxt->globalVars, - elem->name, elem->nameURI, def); + if (xmlHashAddEntry2(ctxt->globalVars, + elem->name, elem->nameURI, def) < 0) { + xmlGenericError(xmlGenericErrorContext, + "hash update failed\n"); + xsltFreeStackElem(def); + return(-1); + } } else if ((elem->comp != NULL) && (elem->comp->type == XSLT_FUNC_VARIABLE)) { /* @@ -1660,7 +1684,7 @@ xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, int xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) { - int indx = 0; + size_t indx = 0; const xmlChar *name; const xmlChar *value; @@ -1690,7 +1714,7 @@ xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) { int xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) { - int indx = 0; + size_t indx = 0; const xmlChar *name; const xmlChar *value; @@ -1854,7 +1878,10 @@ xsltRegisterVariable(xsltTransformContextPtr ctxt, #endif /* else of XSLT_REFACTORED */ variable = xsltBuildVariable(ctxt, (xsltStylePreCompPtr) comp, tree); - xsltAddStackElem(ctxt, variable); + if (xsltAddStackElem(ctxt, variable) < 0) { + xsltFreeStackElem(variable); + return(-1); + } return(0); } @@ -2352,5 +2379,3 @@ local_variable_found: return(valueObj); } - - diff --git a/dll/3rdparty/libxslt/win32config.h b/dll/3rdparty/libxslt/win32config.h index 54b1822b4d9..ce7978ba886 100644 --- a/dll/3rdparty/libxslt/win32config.h +++ b/dll/3rdparty/libxslt/win32config.h @@ -45,7 +45,7 @@ __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) #endif /* defined(_MSC_VER) && _MSC_VER < 1900 */ #define HAVE_SYS_STAT_H -#define HAVE__STAT +#define HAVE_STAT #endif /* __LIBXSLT_WIN32_CONFIG__ */ diff --git a/dll/3rdparty/libxslt/xslt.c b/dll/3rdparty/libxslt/xslt.c index a99f0d62867..22fdb758569 100644 --- a/dll/3rdparty/libxslt/xslt.c +++ b/dll/3rdparty/libxslt/xslt.c @@ -13,7 +13,36 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "pattern.h" +#include "variables.h" +#include "namespaces.h" +#include "attributes.h" +#include "xsltutils.h" +#include "imports.h" +#include "keys.h" +#include "documents.h" +#include "extensions.h" +#include "preproc.h" +#include "extra.h" +#include "security.h" +#include "xsltlocale.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_PARSING @@ -62,13 +91,7 @@ const xmlChar *xsltXSLTAttrMarker = (const xmlChar *) "LRE XSLT Attr"; #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 - */ -#ifndef LIBXML_DEBUG_ENABLED -double xmlXPathStringEvalNumber(const xmlChar *str); -#endif + /* * Useful macros */ @@ -128,31 +151,23 @@ exclPrefixPush(xsltStylesheetPtr style, xmlChar * value) { int i; - if (style->exclPrefixMax == 0) { - style->exclPrefixMax = 4; - style->exclPrefixTab = - (xmlChar * *)xmlMalloc(style->exclPrefixMax * - sizeof(style->exclPrefixTab[0])); - if (style->exclPrefixTab == NULL) { - xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); - 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 = - (xmlChar * *)xmlRealloc(style->exclPrefixTab, - style->exclPrefixMax * - sizeof(style->exclPrefixTab[0])); - if (style->exclPrefixTab == NULL) { + xmlChar **tmp; + size_t max = style->exclPrefixMax ? style->exclPrefixMax * 2 : 4; + + tmp = xmlRealloc(style->exclPrefixTab, + max * sizeof(style->exclPrefixTab[0])); + if (tmp == NULL) { xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); return (-1); } + style->exclPrefixTab = tmp; + style->exclPrefixMax = max; } style->exclPrefixTab[style->exclPrefixNr] = value; style->exclPrefix = value; @@ -1088,9 +1103,9 @@ xsltGetInheritedNsList(xsltStylesheetPtr style, xmlNodePtr node) { xmlNsPtr cur; - xmlNsPtr *ret = NULL; + xmlNsPtr *ret = NULL, *tmp; int nbns = 0; - int maxns = 10; + int maxns = 0; int i; if ((style == NULL) || (template == NULL) || (node == NULL) || @@ -1115,17 +1130,6 @@ xsltGetInheritedNsList(xsltStylesheetPtr style, if (xmlStrEqual(cur->href, style->exclPrefixTab[i])) goto skip_ns; } - if (ret == NULL) { - ret = - (xmlNsPtr *) xmlMalloc((maxns + 1) * - sizeof(xmlNsPtr)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xsltGetInheritedNsList : out of memory!\n"); - return(0); - } - ret[nbns] = NULL; - } /* * Skip shadowed namespace bindings. */ @@ -1136,16 +1140,16 @@ xsltGetInheritedNsList(xsltStylesheetPtr style, } if (i >= nbns) { if (nbns >= maxns) { - maxns *= 2; - ret = (xmlNsPtr *) xmlRealloc(ret, - (maxns + - 1) * - sizeof(xmlNsPtr)); - if (ret == NULL) { + maxns = (maxns == 0) ? 10 : 2 * maxns; + tmp = (xmlNsPtr *) xmlRealloc(ret, + (maxns + 1) * sizeof(xmlNsPtr)); + if (tmp == NULL) { xmlGenericError(xmlGenericErrorContext, "xsltGetInheritedNsList : realloc failed!\n"); + xmlFree(ret); return(0); } + ret = tmp; } ret[nbns++] = cur; ret[nbns] = NULL; @@ -1301,8 +1305,10 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur) if (elements != NULL) { if (style->cdataSection == NULL) style->cdataSection = xmlHashCreate(10); - if (style->cdataSection == NULL) + if (style->cdataSection == NULL) { + xmlFree(elements); return; + } element = elements; while (*element != 0) { @@ -1540,8 +1546,10 @@ xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur) { if (style->stripSpaces == NULL) style->stripSpaces = xmlHashCreate(10); - if (style->stripSpaces == NULL) + if (style->stripSpaces == NULL) { + xmlFree(elements); return; + } element = elements; while (*element != 0) { @@ -1669,6 +1677,11 @@ xsltParseStylesheetStripSpace(xsltStylesheetPtr style, xmlNodePtr cur) { if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; + if (style->stripSpaces == NULL) + style->stripSpaces = xmlHashCreate(10); + if (style->stripSpaces == NULL) + return; + elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL); if (elements == NULL) { xsltTransformError(NULL, style, cur, @@ -1677,11 +1690,6 @@ xsltParseStylesheetStripSpace(xsltStylesheetPtr style, xmlNodePtr cur) { return; } - if (style->stripSpaces == NULL) - style->stripSpaces = xmlHashCreate(10); - if (style->stripSpaces == NULL) - return; - element = elements; while (*element != 0) { while (IS_BLANK(*element)) element++; @@ -4452,6 +4460,8 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) * NOTE that this content model does *not* allow xsl:param. */ while (cur != NULL) { + cctxt->style->principal->opCount += 1; + if (deleteNode != NULL) { #ifdef WITH_XSLT_DEBUG_BLANKS xsltGenericDebug(xsltGenericDebugContext, @@ -4492,7 +4502,11 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) * Leave the contained text-node in the tree. */ xmlUnlinkNode(tmp); - xmlAddPrevSibling(cur, tmp); + if (xmlAddPrevSibling(cur, tmp) == NULL) { + xsltTransformError(ctxt, NULL, NULL, + "out of memory\n"); + xmlFreeNode(tmp); + } } else { tmp = NULL; xsltTransformError(NULL, cctxt->style, cur, @@ -4846,6 +4860,8 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { * user-defined extension instruction if needed). */ do { + style->principal->opCount += 1; + if ((child->type == XML_ELEMENT_NODE) && IS_XSLT_ELEM_FAST(child) && IS_XSLT_NAME(child, "param")) @@ -4889,6 +4905,8 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { cur = templ->children; delete = NULL; while (cur != NULL) { + style->principal->opCount += 1; + if (delete != NULL) { #ifdef WITH_XSLT_DEBUG_BLANKS xsltGenericDebug(xsltGenericDebugContext, @@ -4978,7 +4996,11 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { next = text->next; xmlUnlinkNode(text); - xmlAddPrevSibling(cur, text); + if (xmlAddPrevSibling(cur, text) == NULL) { + xsltTransformError(NULL, style, NULL, + "out of memory\n"); + xmlFreeNode(text); + } text = next; } } @@ -5358,6 +5380,15 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) { (template->type != XML_ELEMENT_NODE)) return; + if (style->principal->opLimit > 0) { + if (style->principal->opCount > style->principal->opLimit) { + xsltTransformError(NULL, style, NULL, + "XSLT parser operation limit exceeded\n"); + style->errors++; + return; + } + } + /* * Create and link the structure */ @@ -5497,9 +5528,6 @@ xsltCompileXSLTIncludeElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { return(item); } -/** - * xsltParseFindTopLevelElem: - */ static int xsltParseFindTopLevelElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur, @@ -6085,6 +6113,15 @@ xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) { if ((top == NULL) || (top->type != XML_ELEMENT_NODE)) return; + if (style->principal->opLimit > 0) { + if (style->principal->opCount > style->principal->opLimit) { + xsltTransformError(NULL, style, NULL, + "XSLT parser operation limit exceeded\n"); + style->errors++; + return; + } + } + prop = xmlGetNsProp(top, (const xmlChar *)"version", NULL); if (prop == NULL) { xsltTransformError(NULL, style, top, @@ -6108,6 +6145,8 @@ xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) { */ cur = top->children; while (cur != NULL) { + style->principal->opCount += 1; + if (IS_BLANK_NODE(cur)) { cur = cur->next; continue; @@ -6124,6 +6163,8 @@ xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) { * process other top-level elements */ while (cur != NULL) { + style->principal->opCount += 1; + if (IS_BLANK_NODE(cur)) { cur = cur->next; continue; @@ -6658,6 +6699,9 @@ xsltParseStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc) { } #endif /* else of XSLT_REFACTORED */ + if (style->parent == NULL) + xsltResolveStylesheetAttributeSet(style); + if (style->errors != 0) { /* * Detach the doc from the stylesheet; otherwise the doc @@ -6672,15 +6716,12 @@ xsltParseStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc) { return(-1); } - if (style->parent == NULL) - xsltResolveStylesheetAttributeSet(style); - return(0); } /** * xsltParseStylesheetDoc: - * @doc: and xmlDoc parsed XML + * @doc: an xmlDoc parsed XML * * parse an XSLT stylesheet, building the associated structures. doc * is kept as a reference within the returned stylesheet, so changes @@ -6815,7 +6856,8 @@ xsltParseStylesheetPI(const xmlChar *value) { if (val == NULL) return(NULL); if ((xmlStrcasecmp(val, BAD_CAST "text/xml")) && - (xmlStrcasecmp(val, BAD_CAST "text/xsl"))) { + (xmlStrcasecmp(val, BAD_CAST "text/xsl")) && + (xmlStrcasecmp(val, BAD_CAST "application/xslt+xml"))) { xmlFree(val); break; } diff --git a/dll/3rdparty/libxslt/xsltconfig.h.in b/dll/3rdparty/libxslt/xsltconfig.h.in deleted file mode 100644 index e115e4963fb..00000000000 --- a/dll/3rdparty/libxslt/xsltconfig.h.in +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Summary: compile-time version information for the XSLT engine - * Description: compile-time version information for the XSLT engine - * this module is autogenerated. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XSLTCONFIG_H__ -#define __XML_XSLTCONFIG_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * LIBXSLT_DOTTED_VERSION: - * - * the version string like "1.2.3" - */ -#define LIBXSLT_DOTTED_VERSION "@VERSION@" - -/** - * LIBXSLT_VERSION: - * - * the version number: 1.2.3 value is 10203 - */ -#define LIBXSLT_VERSION @LIBXSLT_VERSION_NUMBER@ - -/** - * LIBXSLT_VERSION_STRING: - * - * the version number string, 1.2.3 value is "10203" - */ -#define LIBXSLT_VERSION_STRING "@LIBXSLT_VERSION_NUMBER@" - -/** - * LIBXSLT_VERSION_EXTRA: - * - * extra version information, used to show a Git commit description - */ -#define LIBXSLT_VERSION_EXTRA "@LIBXSLT_VERSION_EXTRA@" - -/** - * WITH_XSLT_DEBUG: - * - * Activate the compilation of the debug reporting. Speed penalty - * is insignifiant and being able to run xsltpoc -v is useful. On - * by default unless --without-debug is passed to configure - */ -#if @WITH_XSLT_DEBUG@ -#define WITH_XSLT_DEBUG -#endif - -#if @WITH_MEM_DEBUG@ -/** - * DEBUG_MEMORY: - * - * should be activated only when debugging libxslt. It replaces the - * allocator with a collect and debug shell to the libc allocator. - * Use configure --with-mem-debug to activate it on both library - */ -#define DEBUG_MEMORY - -/** - * DEBUG_MEMORY_LOCATION: - * - * should be activated only when debugging libxslt. - * DEBUG_MEMORY_LOCATION should be activated only when libxml has - * been configured with --with-debug-mem too - */ -#define DEBUG_MEMORY_LOCATION -#endif - -/** - * XSLT_NEED_TRIO: - * - * should be activated if the existing libc library lacks some of the - * string formatting function, in that case reuse the Trio ones already - * compiled in the libxml2 library. - */ - -#if @WITH_TRIO@ -#define XSLT_NEED_TRIO -#endif -#ifdef __VMS -#define HAVE_SYS_STAT_H 1 -#ifndef XSLT_NEED_TRIO -#define XSLT_NEED_TRIO -#endif -#endif - -#ifdef XSLT_NEED_TRIO -#define TRIO_REPLACE_STDIO -#endif - -/** - * WITH_XSLT_DEBUGGER: - * - * Activate the compilation of the debugger support. Speed penalty - * is insignifiant. - * On by default unless --without-debugger is passed to configure - */ -#if @WITH_DEBUGGER@ -#ifndef WITH_DEBUGGER -#define WITH_DEBUGGER -#endif -#endif - -/** - * WITH_PROFILER: - * - * Activate the compilation of the profiler. Speed penalty - * is insignifiant. - * On by default unless --without-profiler is passed to configure - */ -#if @WITH_PROFILER@ -#ifndef WITH_PROFILER -#define WITH_PROFILER -#endif -#endif - -/** - * WITH_MODULES: - * - * Whether module support is configured into libxslt - * Note: no default module path for win32 platforms - */ -#if @WITH_MODULES@ -#ifndef WITH_MODULES -#define WITH_MODULES -#endif -#define LIBXSLT_DEFAULT_PLUGINS_PATH() "@LIBXSLT_DEFAULT_PLUGINS_PATH@" -#endif - -/** - * ATTRIBUTE_UNUSED: - * - * This macro is used to flag unused function parameters to GCC - */ -#ifdef __GNUC__ -#ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif -#else -#define ATTRIBUTE_UNUSED -#endif - -/** - * LIBXSLT_ATTR_FORMAT: - * - * This macro is used to indicate to GCC the parameters are printf-like - */ -#ifdef __GNUC__ -#define LIBXSLT_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) -#else -#define LIBXSLT_ATTR_FORMAT(fmt,args) -#endif - -/** - * LIBXSLT_PUBLIC: - * - * This macro is used to declare PUBLIC variables for Cygwin and for MSC on Windows - */ -#if !defined LIBXSLT_PUBLIC -#if (defined(__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC -#define LIBXSLT_PUBLIC __declspec(dllimport) -#else -#define LIBXSLT_PUBLIC -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_XSLTCONFIG_H__ */ diff --git a/dll/3rdparty/libxslt/xsltlocale.c b/dll/3rdparty/libxslt/xsltlocale.c index 1a767809df9..1d7f253531a 100644 --- a/dll/3rdparty/libxslt/xsltlocale.c +++ b/dll/3rdparty/libxslt/xsltlocale.c @@ -10,9 +10,39 @@ * winapi port: Roumen Petrov */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#include +#include #include "xsltlocale.h" +#include "xsltutils.h" + +#ifdef HAVE_STRXFRM_L + + #define XSLT_LOCALE_POSIX + + #ifdef HAVE_LOCALE_H + #include + #endif + #ifdef HAVE_XLOCALE_H + #include + #endif + +#elif defined(_WIN32) + + #define XSLT_LOCALE_WINAPI + + #include + #include + +#else + + #define XSLT_LOCALE_NONE + +#endif #define TOUPPER(c) (c & ~0x20) #define TOLOWER(c) (c | 0x20) @@ -32,8 +62,7 @@ xmlRMutexPtr xsltLocaleMutex = NULL; struct xsltRFC1766Info_s { /*note typedef unsigned char xmlChar !*/ xmlChar tag[XSLTMAX_LANGTAGLEN+1]; - /*note typedef LCID xsltLocale !*/ - xsltLocale lcid; + LCID lcid; }; typedef struct xsltRFC1766Info_s xsltRFC1766Info; @@ -41,14 +70,15 @@ static int xsltLocaleListSize = 0; static xsltRFC1766Info *xsltLocaleList = NULL; -static xsltLocale +static void * xslt_locale_WINAPI(const xmlChar *languageTag) { int k; xsltRFC1766Info *p = xsltLocaleList; for (k=0; ktag, languageTag) == 0) return p->lcid; - return((xsltLocale)0); + if (xmlStrcmp(p->tag, languageTag) == 0) + return(&p->lcid); + return(NULL); } static void xsltEnumSupportedLocales(void); @@ -78,17 +108,17 @@ xsltFreeLocales(void) { * * Returns the locale or NULL on error or if no matching locale was found */ -xsltLocale -xsltNewLocale(const xmlChar *languageTag) { +void * +xsltNewLocale(const xmlChar *languageTag, int lowerFirst ATTRIBUTE_UNUSED) { #ifdef XSLT_LOCALE_POSIX - xsltLocale locale; - char localeName[XSLTMAX_LANGTAGLEN+6]; /* 6 chars for ".utf8\0" */ + locale_t locale; + char localeName[XSLTMAX_LANGTAGLEN+7]; /* 7 chars for ".UTF-8\0" */ const xmlChar *p = languageTag; const char *region = NULL; char *q = localeName; int i, llen; - /* Convert something like "pt-br" to "pt_BR.utf8" */ + /* Convert something like "pt-br" to "pt_BR.UTF-8" */ if (languageTag == NULL) return(NULL); @@ -112,8 +142,8 @@ xsltNewLocale(const xmlChar *languageTag) { if (i == 0 || *p) return(NULL); - memcpy(q, ".utf8", 6); - locale = newlocale(LC_COLLATE_MASK, localeName, NULL); + memcpy(q, ".UTF-8", 7); + locale = newlocale(LC_ALL_MASK, localeName, NULL); if (locale != NULL) return(locale); @@ -124,8 +154,8 @@ xsltNewLocale(const xmlChar *languageTag) { /* Try locale without territory, e.g. for Esperanto (eo) */ - memcpy(q, ".utf8", 6); - locale = newlocale(LC_COLLATE_MASK, localeName, NULL); + memcpy(q, ".UTF-8", 7); + locale = newlocale(LC_ALL_MASK, localeName, NULL); if (locale != NULL) return(locale); @@ -142,15 +172,15 @@ xsltNewLocale(const xmlChar *languageTag) { *q++ = '_'; *q++ = region[0]; *q++ = region[1]; - memcpy(q, ".utf8", 6); - locale = newlocale(LC_COLLATE_MASK, localeName, NULL); + memcpy(q, ".UTF-8", 7); + locale = newlocale(LC_ALL_MASK, localeName, NULL); return(locale); #endif #ifdef XSLT_LOCALE_WINAPI { - xsltLocale locale = (xsltLocale)0; + void *locale = NULL; xmlChar localeName[XSLTMAX_LANGTAGLEN+1]; xmlChar *q = localeName; const xmlChar *p = languageTag; @@ -339,10 +369,12 @@ xsltDefaultRegion(const xmlChar *localeName) { * Frees a locale created with xsltNewLocale */ void -xsltFreeLocale(xsltLocale locale) { +xsltFreeLocale(void *locale) { #ifdef XSLT_LOCALE_POSIX if (locale != NULL) freelocale(locale); +#else + (void) locale; #endif } @@ -351,57 +383,82 @@ xsltFreeLocale(xsltLocale locale) { * @locale: locale created with xsltNewLocale * @string: UTF-8 string to transform * - * Transforms a string according to locale. The transformed string must then be - * compared with xsltLocaleStrcmp and freed with xmlFree. + * Transforms a string according to locale. The transformed string must be + * freed with xmlFree. * * Returns the transformed string or NULL on error */ -xsltLocaleChar * -xsltStrxfrm(xsltLocale locale, const xmlChar *string) +xmlChar * +xsltStrxfrm(void *vlocale, const xmlChar *string) { #ifdef XSLT_LOCALE_NONE return(NULL); #else - size_t xstrlen, r; - xsltLocaleChar *xstr; + xmlChar *xstr; #ifdef XSLT_LOCALE_POSIX - xstrlen = strxfrm_l(NULL, (const char *)string, 0, locale) + 1; - xstr = (xsltLocaleChar *) xmlMalloc(xstrlen); + size_t xstrlen, r; + + xstrlen = strxfrm_l(NULL, (const char *)string, 0, vlocale) + 1; + xstr = (xmlChar *) xmlMalloc(xstrlen); if (xstr == NULL) { xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : out of memory error\n"); return(NULL); } - r = strxfrm_l((char *)xstr, (const char *)string, xstrlen, locale); -#endif - -#ifdef XSLT_LOCALE_WINAPI - xstrlen = MultiByteToWideChar(CP_UTF8, 0, (char *) string, -1, NULL, 0); - if (xstrlen == 0) { - xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : MultiByteToWideChar check failed\n"); - return(NULL); - } - xstr = (xsltLocaleChar*) xmlMalloc(xstrlen * sizeof(xsltLocaleChar)); - if (xstr == NULL) { - xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : out of memory\n"); - return(NULL); - } - r = MultiByteToWideChar(CP_UTF8, 0, (char *) string, -1, xstr, xstrlen); - if (r == 0) { - xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : MultiByteToWideChar failed\n"); - xmlFree(xstr); - return(NULL); - } - return(xstr); -#endif /* XSLT_LOCALE_WINAPI */ + r = strxfrm_l((char *)xstr, (const char *)string, xstrlen, vlocale); if (r >= xstrlen) { xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : strxfrm failed\n"); xmlFree(xstr); return(NULL); } +#endif + +#ifdef XSLT_LOCALE_WINAPI + int wstrlen, xstrlen, r; + wchar_t *wstr; + LCID *lcid = vlocale; + + wstrlen = MultiByteToWideChar(CP_UTF8, 0, (char *) string, -1, NULL, 0); + if (wstrlen == 0) { + xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : MultiByteToWideChar check failed\n"); + return(NULL); + } + wstr = (wchar_t *) xmlMalloc(wstrlen * sizeof(wchar_t)); + if (wstr == NULL) { + xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : out of memory\n"); + return(NULL); + } + r = MultiByteToWideChar(CP_UTF8, 0, (char *) string, -1, wstr, wstrlen); + if (r == 0) { + xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : MultiByteToWideChar failed\n"); + xmlFree(wstr); + return(NULL); + } + /* This returns the size in bytes. */ + xstrlen = LCMapStringW(*lcid, LCMAP_SORTKEY, wstr, wstrlen, NULL, 0); + if (xstrlen == 0) { + xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : LCMapStringW failed\n"); + xmlFree(wstr); + return(NULL); + } + xstr = (xmlChar*) xmlMalloc(xstrlen); + if (xstr == NULL) { + xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : out of memory\n"); + xmlFree(wstr); + return(NULL); + } + r = LCMapStringW(*lcid, LCMAP_SORTKEY, wstr, wstrlen, (wchar_t *) xstr, + xstrlen); + xmlFree(wstr); + if (r == 0) { + xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : LCMapStringW failed\n"); + xmlFree(xstr); + return(NULL); + } +#endif /* XSLT_LOCALE_WINAPI */ return(xstr); #endif /* XSLT_LOCALE_NONE */ @@ -409,35 +466,22 @@ xsltStrxfrm(xsltLocale locale, const xmlChar *string) /** * xsltLocaleStrcmp: - * @locale: a locale identifier + * @locale: unused * @str1: a string transformed with xsltStrxfrm * @str2: a string transformed with xsltStrxfrm * - * Compares two strings transformed with xsltStrxfrm + * DEPRECATED: Same as xmlStrcmp. + * + * 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) { +xsltLocaleStrcmp(void *locale, const xmlChar *str1, const xmlChar *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 @@ -449,7 +493,7 @@ xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocale * * Returns TRUE */ -BOOL CALLBACK +static BOOL CALLBACK xsltCountSupportedLocales(LPSTR lcid) { (void) lcid; ++xsltLocaleListSize; @@ -464,7 +508,7 @@ xsltCountSupportedLocales(LPSTR lcid) { * * Returns TRUE if not at the end of the array */ -BOOL CALLBACK +static BOOL CALLBACK xsltIterateSupportedLocales(LPSTR lcid) { static int count = 0; xmlChar iso639lang [XSLTMAX_ISO639LANGLEN +1]; @@ -472,7 +516,7 @@ xsltIterateSupportedLocales(LPSTR lcid) { int k, l; xsltRFC1766Info *p = xsltLocaleList + count; - k = sscanf(lcid, "%lx", (long*)&p->lcid); + k = sscanf(lcid, "%lx", (unsigned long*)&p->lcid); if (k < 1) goto end; /*don't count terminating null character*/ k = GetLocaleInfoA(p->lcid, LOCALE_SISO639LANGNAME, diff --git a/dll/3rdparty/libxslt/xsltutils.c b/dll/3rdparty/libxslt/xsltutils.c index 447366c3782..d392e239797 100644 --- a/dll/3rdparty/libxslt/xsltutils.c +++ b/dll/3rdparty/libxslt/xsltutils.c @@ -9,7 +9,19 @@ * daniel@veillard.com */ -#include "precomp.h" +#define IN_LIBXSLT +#include "libxslt.h" + +#ifndef XSLT_NEED_TRIO +#include +#else +#include +#endif + +#include +#include +#include +#include #ifdef HAVE_SYS_TIME_H #include @@ -18,7 +30,19 @@ #include #endif +#include +#include +#include +#include +#include +#include "xsltutils.h" +#include "templates.h" +#include "xsltInternals.h" +#include "imports.h" +#include "transform.h" + #if defined(_WIN32) +#include #define XSLT_WIN32_PERFORMANCE_COUNTER #endif @@ -281,6 +305,66 @@ error: return(-1); } +/** + * xsltGetUTF8CharZ: + * @utf: a sequence of UTF-8 encoded bytes + * @len: a pointer to @bytes len + * + * Read one UTF8 Char from a null-terminated string. + * + * Returns the char value or -1 in case of error and update @len with the + * number of bytes used + */ +int +xsltGetUTF8CharZ(const unsigned char *utf, int *len) { + unsigned int c; + + if (utf == NULL) + goto error; + if (len == NULL) + goto error; + + c = utf[0]; + if (c & 0x80) { + if ((utf[1] & 0xc0) != 0x80) + goto error; + if ((c & 0xe0) == 0xe0) { + if ((utf[2] & 0xc0) != 0x80) + goto error; + if ((c & 0xf0) == 0xf0) { + if ((c & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80) + goto error; + *len = 4; + /* 4-byte code */ + c = (utf[0] & 0x7) << 18; + c |= (utf[1] & 0x3f) << 12; + c |= (utf[2] & 0x3f) << 6; + c |= utf[3] & 0x3f; + } else { + /* 3-byte code */ + *len = 3; + c = (utf[0] & 0xf) << 12; + c |= (utf[1] & 0x3f) << 6; + c |= utf[2] & 0x3f; + } + } else { + /* 2-byte code */ + *len = 2; + c = (utf[0] & 0x1f) << 6; + c |= utf[1] & 0x3f; + } + } else { + /* 1-byte code */ + *len = 1; + } + return(c); + +error: + if (len != NULL) + *len = 0; + return(-1); +} + #ifdef XSLT_REFACTORED /** @@ -924,10 +1008,11 @@ xsltDocumentSortFunction(xmlNodeSetPtr list) { } /** - * xsltComputeSortResultiInternal: + * xsltComputeSortResultInternal: * @ctxt: a XSLT process context - * @sort: node list - * @xfrm: Transform strings according to locale + * @sort: xsl:sort node + * @number: data-type is number + * @locale: transform strings according to locale * * reorder the current node list accordingly to the set of sorting * requirement provided by the array of nodes. @@ -936,11 +1021,11 @@ xsltDocumentSortFunction(xmlNodeSetPtr list) { */ static xmlXPathObjectPtr * xsltComputeSortResultInternal(xsltTransformContextPtr ctxt, xmlNodePtr sort, - int xfrm) { + int number, void *locale) { #ifdef XSLT_REFACTORED xsltStyleItemSortPtr comp; #else - xsltStylePreCompPtr comp; + const xsltStylePreComp *comp; #endif xmlXPathObjectPtr *results = NULL; xmlNodeSetPtr list = NULL; @@ -1008,10 +1093,12 @@ xsltComputeSortResultInternal(xsltTransformContextPtr ctxt, xmlNodePtr sort, if (res != NULL) { if (res->type != XPATH_STRING) res = xmlXPathConvertString(res); - if (comp->number) + if (number) res = xmlXPathConvertNumber(res); + } + if (res != NULL) { res->index = i; /* Save original pos for dupl resolv */ - if (comp->number) { + if (number) { if (res->type == XPATH_NUMBER) { results[i] = res; } else { @@ -1023,10 +1110,17 @@ xsltComputeSortResultInternal(xsltTransformContextPtr ctxt, xmlNodePtr sort, } } else { if (res->type == XPATH_STRING) { - if ((xfrm) && (comp->locale != (xsltLocale)0)) { + if (locale != NULL) { xmlChar *str = res->stringval; - res->stringval = (xmlChar *) xsltStrxfrm(comp->locale, str); - xmlFree(str); + xmlChar *sortKey = ctxt->genSortKey(locale, str); + + if (sortKey == NULL) { + xsltTransformError(ctxt, NULL, sort, + "xsltComputeSortResult: sort key is null\n"); + } else { + res->stringval = sortKey; + xmlFree(str); + } } results[i] = res; @@ -1065,7 +1159,13 @@ xsltComputeSortResultInternal(xsltTransformContextPtr ctxt, xmlNodePtr sort, */ xmlXPathObjectPtr * xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort) { - return xsltComputeSortResultInternal(ctxt, sort, /* xfrm */ 0); + const xsltStylePreComp *comp = sort->psvi; + int number = 0; + + if (comp != NULL) + number = comp->number; + return xsltComputeSortResultInternal(ctxt, sort, number, + /* locale */ NULL); } /** @@ -1083,20 +1183,19 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, #ifdef XSLT_REFACTORED xsltStyleItemSortPtr comp; #else - xsltStylePreCompPtr comp; + const xsltStylePreComp *comp; #endif xmlXPathObjectPtr *resultsTab[XSLT_MAX_SORT]; xmlXPathObjectPtr *results = NULL, *res; xmlNodeSetPtr list = NULL; - int descending, number, desc, numb; int len = 0; int i, j, incr; int tst; int depth; xmlNodePtr node; xmlXPathObjectPtr tmp; - int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT], - templang[XSLT_MAX_SORT]; + int number[XSLT_MAX_SORT], desc[XSLT_MAX_SORT]; + void *locale[XSLT_MAX_SORT]; if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) || (nbsorts >= XSLT_MAX_SORT)) @@ -1112,72 +1211,74 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, return; /* nothing to do */ for (j = 0; j < nbsorts; j++) { + xmlChar *lang; + comp = sorts[j]->psvi; - tempstype[j] = 0; if ((comp->stype == NULL) && (comp->has_stype != 0)) { - comp->stype = + xmlChar *stype = xsltEvalAttrValueTemplate(ctxt, sorts[j], - (const xmlChar *) "data-type", - NULL); - if (comp->stype != NULL) { - tempstype[j] = 1; - if (xmlStrEqual(comp->stype, (const xmlChar *) "text")) - comp->number = 0; - else if (xmlStrEqual(comp->stype, (const xmlChar *) "number")) - comp->number = 1; + BAD_CAST "data-type", NULL); + number[j] = 0; + if (stype != NULL) { + if (xmlStrEqual(stype, (const xmlChar *) "text")) + ; + else if (xmlStrEqual(stype, (const xmlChar *) "number")) + number[j] = 1; else { xsltTransformError(ctxt, NULL, sorts[j], "xsltDoSortFunction: no support for data-type = %s\n", - comp->stype); - comp->number = 0; /* use default */ + stype); } + xmlFree(stype); } - } - temporder[j] = 0; + } else { + number[j] = comp->number; + } if ((comp->order == NULL) && (comp->has_order != 0)) { - comp->order = xsltEvalAttrValueTemplate(ctxt, sorts[j], - (const xmlChar *) "order", - NULL); - if (comp->order != NULL) { - temporder[j] = 1; - if (xmlStrEqual(comp->order, (const xmlChar *) "ascending")) - comp->descending = 0; - else if (xmlStrEqual(comp->order, - (const xmlChar *) "descending")) - comp->descending = 1; + xmlChar *order = xsltEvalAttrValueTemplate(ctxt, sorts[j], + BAD_CAST "order", NULL); + desc[j] = 0; + if (order != NULL) { + if (xmlStrEqual(order, (const xmlChar *) "ascending")) + ; + else if (xmlStrEqual(order, (const xmlChar *) "descending")) + desc[j] = 1; else { xsltTransformError(ctxt, NULL, sorts[j], "xsltDoSortFunction: invalid value %s for order\n", - comp->order); - comp->descending = 0; /* use default */ + order); } + xmlFree(order); } + } else { + desc[j] = comp->descending; } - templang[j] = 0; if ((comp->lang == NULL) && (comp->has_lang != 0)) { - xmlChar *lang = xsltEvalAttrValueTemplate(ctxt, sorts[j], + lang = xsltEvalAttrValueTemplate(ctxt, sorts[j], (xmlChar *) "lang", NULL); - if (lang != NULL) { - templang[j] = 1; - comp->locale = xsltNewLocale(lang); + } else { + lang = (xmlChar *) comp->lang; + } + if (lang != NULL) { + locale[j] = ctxt->newLocale(lang, comp->lower_first); + if (lang != comp->lang) xmlFree(lang); - } - } + } else { + locale[j] = NULL; + } } len = list->nodeNr; - resultsTab[0] = xsltComputeSortResultInternal(ctxt, sorts[0], - /* xfrm */ 1); + resultsTab[0] = xsltComputeSortResultInternal(ctxt, sorts[0], number[0], + locale[0]); for (i = 1;i < XSLT_MAX_SORT;i++) resultsTab[i] = NULL; results = resultsTab[0]; comp = sorts[0]->psvi; - descending = comp->descending; - number = comp->number; if (results == NULL) goto cleanup; @@ -1192,7 +1293,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, if (results[j] == NULL) tst = 1; else { - if (number) { + if (number[0]) { /* We make NaN smaller than number in accordance with XSLT spec */ if (xmlXPathIsNaN(results[j]->floatval)) { @@ -1209,16 +1310,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); } - if (descending) + if (desc[0]) tst = -tst; } if (tst == 0) { @@ -1232,8 +1328,6 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, comp = sorts[depth]->psvi; if (comp == NULL) break; - desc = comp->descending; - numb = comp->number; /* * Compute the result of the next level for the @@ -1243,7 +1337,8 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, resultsTab[depth] = xsltComputeSortResultInternal(ctxt, sorts[depth], - /* xfrm */ 1); + number[depth], + locale[depth]); res = resultsTab[depth]; if (res == NULL) break; @@ -1253,7 +1348,7 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, } else if (res[j+incr] == NULL) { tst = -1; } else { - if (numb) { + if (number[depth]) { /* We make NaN smaller than number in accordance with XSLT spec */ if (xmlXPathIsNaN(res[j]->floatval)) { @@ -1272,16 +1367,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); } - if (desc) + if (desc[depth]) tst = -tst; } @@ -1325,21 +1415,9 @@ xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, cleanup: for (j = 0; j < nbsorts; j++) { - comp = sorts[j]->psvi; - if (tempstype[j] == 1) { - /* The data-type needs to be recomputed each time */ - xmlFree((void *)(comp->stype)); - comp->stype = NULL; - } - if (temporder[j] == 1) { - /* The order needs to be recomputed each time */ - xmlFree((void *)(comp->order)); - comp->order = NULL; - } - if (templang[j] == 1) { - xsltFreeLocale(comp->locale); - comp->locale = (xsltLocale)0; - } + if (locale[j] != NULL) { + ctxt->freeLocale(locale[j]); + } if (resultsTab[j] != NULL) { for (i = 0;i < len;i++) xmlXPathFreeObject(resultsTab[j][i]); @@ -1379,6 +1457,8 @@ xsltDoSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr * sorts, * xsltSetSortFunc: * @handler: the new handler function * + * DEPRECATED: Use xsltSetCtxtLocaleHandlers. + * * Function to reset the global handler for XSLT sorting. * If the handler is NULL, the default sort function will be used. */ @@ -1395,6 +1475,8 @@ xsltSetSortFunc(xsltSortFunc handler) { * @ctxt: a XSLT process context * @handler: the new handler function * + * DEPRECATED: Use xsltSetCtxtLocaleHandlers. + * * Function to set the handler for XSLT sorting * for the specified context. * If the handler is NULL, then the global @@ -1405,6 +1487,28 @@ xsltSetCtxtSortFunc(xsltTransformContextPtr ctxt, xsltSortFunc handler) { ctxt->sortfunc = handler; } +/** + * xsltSetCtxtLocaleHandlers: + * @ctxt: an XSLT transform context + * @newLocale: locale constructor + * @freeLocale: locale destructor + * @genSortKey: sort key generator + * + * Set the locale handlers. + */ +void +xsltSetCtxtLocaleHandlers(xsltTransformContextPtr ctxt, + xsltNewLocaleFunc newLocale, + xsltFreeLocaleFunc freeLocale, + xsltGenSortKeyFunc genSortKey) { + if (ctxt == NULL) + return; + + ctxt->newLocale = newLocale; + ctxt->freeLocale = freeLocale; + ctxt->genSortKey = genSortKey; +} + /************************************************************************ * * * Parsing options * @@ -1646,13 +1750,12 @@ xsltSaveResultToFilename(const char *URL, xmlDocPtr result, XSLT_GET_IMPORT_PTR(encoding, style, encoding) if (encoding != NULL) { - xmlCharEncodingHandlerPtr encoder; + xmlCharEncodingHandlerPtr encoder = NULL; - encoder = xmlFindCharEncodingHandler((char *)encoding); - if ((encoder != NULL) && - (xmlStrEqual((const xmlChar *)encoder->name, - (const xmlChar *) "UTF-8"))) - encoder = NULL; + /* Don't use UTF-8 dummy encoder */ + if ((xmlStrcasecmp(encoding, BAD_CAST "UTF-8") != 0) && + (xmlStrcasecmp(encoding, BAD_CAST "UTF8") != 0)) + encoder = xmlFindCharEncodingHandler((char *) encoding); buf = xmlOutputBufferCreateFilename(URL, encoder, compression); } else { buf = xmlOutputBufferCreateFilename(URL, NULL, compression); @@ -1689,13 +1792,12 @@ xsltSaveResultToFile(FILE *file, xmlDocPtr result, xsltStylesheetPtr style) { XSLT_GET_IMPORT_PTR(encoding, style, encoding) if (encoding != NULL) { - xmlCharEncodingHandlerPtr encoder; + xmlCharEncodingHandlerPtr encoder = NULL; - encoder = xmlFindCharEncodingHandler((char *)encoding); - if ((encoder != NULL) && - (xmlStrEqual((const xmlChar *)encoder->name, - (const xmlChar *) "UTF-8"))) - encoder = NULL; + /* Don't use UTF-8 dummy encoder */ + if ((xmlStrcasecmp(encoding, BAD_CAST "UTF-8") != 0) && + (xmlStrcasecmp(encoding, BAD_CAST "UTF8") != 0)) + encoder = xmlFindCharEncodingHandler((char *) encoding); buf = xmlOutputBufferCreateFile(file, encoder); } else { buf = xmlOutputBufferCreateFile(file, NULL); @@ -1733,13 +1835,12 @@ xsltSaveResultToFd(int fd, xmlDocPtr result, xsltStylesheetPtr style) { XSLT_GET_IMPORT_PTR(encoding, style, encoding) if (encoding != NULL) { - xmlCharEncodingHandlerPtr encoder; + xmlCharEncodingHandlerPtr encoder = NULL; - encoder = xmlFindCharEncodingHandler((char *)encoding); - if ((encoder != NULL) && - (xmlStrEqual((const xmlChar *)encoder->name, - (const xmlChar *) "UTF-8"))) - encoder = NULL; + /* Don't use UTF-8 dummy encoder */ + if ((xmlStrcasecmp(encoding, BAD_CAST "UTF-8") != 0) && + (xmlStrcasecmp(encoding, BAD_CAST "UTF8") != 0)) + encoder = xmlFindCharEncodingHandler((char *) encoding); buf = xmlOutputBufferCreateFd(fd, encoder); } else { buf = xmlOutputBufferCreateFd(fd, NULL); @@ -1776,14 +1877,15 @@ xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, XSLT_GET_IMPORT_PTR(encoding, style, encoding) if (encoding != NULL) { - xmlCharEncodingHandlerPtr encoder; + xmlCharEncodingHandlerPtr encoder = NULL; - encoder = xmlFindCharEncodingHandler((char *)encoding); - if ((encoder != NULL) && - (xmlStrEqual((const xmlChar *)encoder->name, - (const xmlChar *) "UTF-8"))) - encoder = NULL; + /* Don't use UTF-8 dummy encoder */ + if ((xmlStrcasecmp(encoding, BAD_CAST "UTF-8") != 0) && + (xmlStrcasecmp(encoding, BAD_CAST "UTF8") != 0)) + encoder = xmlFindCharEncodingHandler((char *) encoding); buf = xmlAllocOutputBuffer(encoder); + if (buf == NULL) + xmlCharEncCloseFunc(encoder); } else { buf = xmlAllocOutputBuffer(NULL); } @@ -1811,6 +1913,141 @@ xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, return 0; } +/** + * xsltGetSourceNodeFlags: + * @node: Node from source document + * + * Returns the flags for a source node. + */ +int +xsltGetSourceNodeFlags(xmlNodePtr node) { + /* + * Squeeze the bit flags into the upper bits of + * + * - 'int properties' member in struct _xmlDoc + * - 'xmlAttributeType atype' member in struct _xmlAttr + * - 'unsigned short extra' member in struct _xmlNode + */ + switch (node->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + return ((xmlDocPtr) node)->properties >> 27; + + case XML_ATTRIBUTE_NODE: + return ((xmlAttrPtr) node)->atype >> 27; + + case XML_ELEMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + return node->extra >> 12; + + default: + return 0; + } +} + +/** + * xsltSetSourceNodeFlags: + * @node: Node from source document + * @flags: Flags + * + * Sets the specified flags to 1. + * + * Returns 0 on success, -1 on error. + */ +int +xsltSetSourceNodeFlags(xsltTransformContextPtr ctxt, xmlNodePtr node, + int flags) { + if (node->doc == ctxt->initialContextDoc) + ctxt->sourceDocDirty = 1; + + switch (node->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + ((xmlDocPtr) node)->properties |= flags << 27; + return 0; + + case XML_ATTRIBUTE_NODE: + ((xmlAttrPtr) node)->atype |= flags << 27; + return 0; + + case XML_ELEMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + node->extra |= flags << 12; + return 0; + + default: + return -1; + } +} + +/** + * xsltClearSourceNodeFlags: + * @node: Node from source document + * @flags: Flags + * + * Sets the specified flags to 0. + * + * Returns 0 on success, -1 on error. + */ +int +xsltClearSourceNodeFlags(xmlNodePtr node, int flags) { + switch (node->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + ((xmlDocPtr) node)->properties &= ~(flags << 27); + return 0; + + case XML_ATTRIBUTE_NODE: + ((xmlAttrPtr) node)->atype &= ~(flags << 27); + return 0; + + case XML_ELEMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + node->extra &= ~(flags << 12); + return 0; + + default: + return -1; + } +} + +/** + * xsltGetPSVIPtr: + * @cur: Node + * + * Returns a pointer to the psvi member of a node or NULL on error. + */ +void ** +xsltGetPSVIPtr(xmlNodePtr cur) { + switch (cur->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + return &((xmlDocPtr) cur)->psvi; + + case XML_ATTRIBUTE_NODE: + return &((xmlAttrPtr) cur)->psvi; + + case XML_ELEMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + return &cur->psvi; + + default: + return NULL; + } +} + #ifdef WITH_PROFILER /************************************************************************ @@ -2487,4 +2724,3 @@ xslDropCall(void) } #endif /* WITH_DEBUGGER */ - diff --git a/sdk/include/reactos/libs/libxslt/libxslt.h b/sdk/include/reactos/libs/libxslt/libxslt.h index 2b0c8b094f0..5e0d0a45511 100644 --- a/sdk/include/reactos/libs/libxslt/libxslt.h +++ b/sdk/include/reactos/libs/libxslt/libxslt.h @@ -10,7 +10,7 @@ #ifndef __XSLT_LIBXSLT_H__ #define __XSLT_LIBXSLT_H__ -#if defined(_WIN32) && !defined (__MINGW32__) +#ifdef _WIN32 #include #else #include "config.h" @@ -27,10 +27,16 @@ #endif #endif -#if defined(_MSC_VER) || defined(__MINGW32__) +#ifdef _WIN32 #include #include #define mkdir(p,m) _mkdir(p) #endif +#ifdef __GNUC__ +#define ATTRIBUTE_UNUSED __attribute__((unused)) +#else +#define ATTRIBUTE_UNUSED +#endif + #endif /* ! __XSLT_LIBXSLT_H__ */ diff --git a/sdk/include/reactos/libs/libxslt/variables.h b/sdk/include/reactos/libs/libxslt/variables.h index 039288fbd50..e2adee0f755 100644 --- a/sdk/include/reactos/libs/libxslt/variables.h +++ b/sdk/include/reactos/libs/libxslt/variables.h @@ -43,7 +43,7 @@ extern "C" { * * RVT is destroyed after the current instructions ends. */ -#define XSLT_RVT_LOCAL ((void *)1) +#define XSLT_RVT_LOCAL 1 /** * XSLT_RVT_FUNC_RESULT: @@ -52,14 +52,14 @@ extern "C" { * destroyed after exiting a template and will be reset to XSLT_RVT_LOCAL or * XSLT_RVT_VARIABLE in the template that receives the return value. */ -#define XSLT_RVT_FUNC_RESULT ((void *)2) +#define XSLT_RVT_FUNC_RESULT 2 /** * XSLT_RVT_GLOBAL: * * RVT is part of a global variable. */ -#define XSLT_RVT_GLOBAL ((void *)3) +#define XSLT_RVT_GLOBAL 3 /* * Interfaces for the variable module. diff --git a/sdk/include/reactos/libs/libxslt/xsltInternals.h b/sdk/include/reactos/libs/libxslt/xsltInternals.h index 14343d2751c..be50678c4b6 100644 --- a/sdk/include/reactos/libs/libxslt/xsltInternals.h +++ b/sdk/include/reactos/libs/libxslt/xsltInternals.h @@ -21,7 +21,6 @@ #include #include #include "xsltexports.h" -#include "xsltlocale.h" #include "numbersInternals.h" #ifdef __cplusplus @@ -1047,7 +1046,6 @@ 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 */ @@ -1377,7 +1375,6 @@ 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 */ @@ -1637,6 +1634,9 @@ struct _xsltStylesheet { xmlHashTablePtr namedTemplates; /* hash table of named templates */ xmlXPathContextPtr xpathCtxt; + + unsigned long opLimit; + unsigned long opCount; }; typedef struct _xsltTransformCache xsltTransformCache; @@ -1663,6 +1663,13 @@ typedef enum { XSLT_OUTPUT_TEXT } xsltOutputType; +typedef void * +(*xsltNewLocaleFunc)(const xmlChar *lang, int lowerFirst); +typedef void +(*xsltFreeLocaleFunc)(void *locale); +typedef xmlChar * +(*xsltGenSortKeyFunc)(void *locale, const xmlChar *lang); + typedef enum { XSLT_STATE_OK = 0, XSLT_STATE_ERROR, @@ -1786,6 +1793,12 @@ struct _xsltTransformContext { int maxTemplateVars; unsigned long opLimit; unsigned long opCount; + int sourceDocDirty; + unsigned long currentId; /* For generate-id() */ + + xsltNewLocaleFunc newLocale; + xsltFreeLocaleFunc freeLocale; + xsltGenSortKeyFunc genSortKey; }; /** @@ -1915,7 +1928,7 @@ XSLTPUBFUN int XSLTCALL xsltFlagRVTs( xsltTransformContextPtr ctxt, xmlXPathObjectPtr obj, - void *val); + int val); XSLTPUBFUN void XSLTCALL xsltFreeRVTs (xsltTransformContextPtr ctxt); XSLTPUBFUN void XSLTCALL @@ -1979,4 +1992,3 @@ XSLTPUBFUN int XSLTCALL #endif #endif /* __XML_XSLT_H__ */ - diff --git a/sdk/include/reactos/libs/libxslt/xsltconfig.h b/sdk/include/reactos/libs/libxslt/xsltconfig.h index d999422437c..941f0a963ca 100644 --- a/sdk/include/reactos/libs/libxslt/xsltconfig.h +++ b/sdk/include/reactos/libs/libxslt/xsltconfig.h @@ -20,21 +20,21 @@ extern "C" { * * the version string like "1.2.3" */ -#define LIBXSLT_DOTTED_VERSION "1.1.37" +#define LIBXSLT_DOTTED_VERSION "1.1.42" /** * LIBXSLT_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXSLT_VERSION 10137 +#define LIBXSLT_VERSION 10142 /** * LIBXSLT_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXSLT_VERSION_STRING "10137" +#define LIBXSLT_VERSION_STRING "10142" /** * LIBXSLT_VERSION_EXTRA: @@ -50,11 +50,11 @@ extern "C" { * is insignifiant and being able to run xsltpoc -v is useful. On * by default unless --without-debug is passed to configure */ -#if 1 +#if 0 #define WITH_XSLT_DEBUG #endif -#if 1 +#if 0 /** * DEBUG_MEMORY: * @@ -103,7 +103,7 @@ extern "C" { * is insignifiant. * On by default unless --without-debugger is passed to configure */ -#if 1 +#if 0 #ifndef WITH_DEBUGGER #define WITH_DEBUGGER #endif @@ -132,7 +132,7 @@ extern "C" { #ifndef WITH_MODULES #define WITH_MODULES #endif -#define LIBXSLT_DEFAULT_PLUGINS_PATH() "/usr/lib/libxslt-plugins" +#define LIBXSLT_DEFAULT_PLUGINS_PATH() "/usr/local/lib/libxslt-plugins" #endif /** diff --git a/sdk/include/reactos/libs/libxslt/xsltlocale.h b/sdk/include/reactos/libs/libxslt/xsltlocale.h index e16eff55f5a..c8be58d3dbe 100644 --- a/sdk/include/reactos/libs/libxslt/xsltlocale.h +++ b/sdk/include/reactos/libs/libxslt/xsltlocale.h @@ -14,69 +14,31 @@ #include #include "xsltexports.h" -#ifdef HAVE_STRXFRM_L - -/* - * XSLT_LOCALE_POSIX: - * Macro indicating to use POSIX locale extensions - */ -#define XSLT_LOCALE_POSIX - -#ifdef HAVE_LOCALE_H -#include -#endif -#ifdef HAVE_XLOCALE_H -#include +#ifdef __cplusplus +extern "C" { #endif -typedef locale_t xsltLocale; -typedef xmlChar xsltLocaleChar; - -#elif defined(_WIN32) - -/* - * XSLT_LOCALE_WINAPI: - * Macro indicating to use WinAPI for extended locale support - */ -#define XSLT_LOCALE_WINAPI - -#ifdef __REACTOS__ -#define WIN32_NO_STATUS -#include -#include -#else /* __REACTOS__ */ -#include -#endif /* __REACTOS__ */ -#include - -typedef LCID xsltLocale; -typedef wchar_t xsltLocaleChar; - -#else - -/* - * XSLT_LOCALE_NONE: - * Macro indicating that there's no extended locale support - */ -#define XSLT_LOCALE_NONE - -typedef void *xsltLocale; -typedef xmlChar xsltLocaleChar; - -#endif - -XSLTPUBFUN xsltLocale XSLTCALL - xsltNewLocale (const xmlChar *langName); +XSLTPUBFUN void * XSLTCALL + xsltNewLocale (const xmlChar *langName, + int lowerFirst); XSLTPUBFUN void XSLTCALL - xsltFreeLocale (xsltLocale locale); -XSLTPUBFUN xsltLocaleChar * XSLTCALL - xsltStrxfrm (xsltLocale locale, + xsltFreeLocale (void *locale); +XSLTPUBFUN xmlChar * XSLTCALL + xsltStrxfrm (void *locale, const xmlChar *string); -XSLTPUBFUN int XSLTCALL - xsltLocaleStrcmp (xsltLocale locale, - const xsltLocaleChar *str1, - const xsltLocaleChar *str2); XSLTPUBFUN void XSLTCALL xsltFreeLocales (void); +/* Backward compatibility */ +typedef void *xsltLocale; +typedef xmlChar xsltLocaleChar; +XSLTPUBFUN int XSLTCALL + xsltLocaleStrcmp (void *locale, + const xmlChar *str1, + const xmlChar *str2); + +#ifdef __cplusplus +} +#endif + #endif /* __XML_XSLTLOCALE_H__ */ diff --git a/sdk/include/reactos/libs/libxslt/xsltutils.h b/sdk/include/reactos/libs/libxslt/xsltutils.h index 12e4c75f5b9..c1751e4e249 100644 --- a/sdk/include/reactos/libs/libxslt/xsltutils.h +++ b/sdk/include/reactos/libs/libxslt/xsltutils.h @@ -91,6 +91,13 @@ XSLTPUBFUN const xmlChar * XSLTCALL XSLTPUBFUN int XSLTCALL xsltGetUTF8Char (const unsigned char *utf, int *len); +#ifdef IN_LIBXSLT +/** DOC_DISABLE */ +XSLTPUBFUN int XSLTCALL + xsltGetUTF8CharZ (const unsigned char *utf, + int *len); +/** DOC_ENABLE */ +#endif /* * XSLT Debug Tracing Tracing Types @@ -178,6 +185,11 @@ XSLTPUBFUN void XSLTCALL XSLTPUBFUN void XSLTCALL xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt, xsltSortFunc handler); +XSLTPUBFUN void XSLTCALL + xsltSetCtxtLocaleHandlers (xsltTransformContextPtr ctxt, + xsltNewLocaleFunc newLocale, + xsltFreeLocaleFunc freeLocale, + xsltGenSortKeyFunc genSortKey); XSLTPUBFUN void XSLTCALL xsltDefaultSortFunction (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, @@ -244,6 +256,24 @@ XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL const xmlChar *str, int flags); +#ifdef IN_LIBXSLT +/** DOC_DISABLE */ +#define XSLT_SOURCE_NODE_MASK 15u +#define XSLT_SOURCE_NODE_HAS_KEY 1u +#define XSLT_SOURCE_NODE_HAS_ID 2u +int +xsltGetSourceNodeFlags(xmlNodePtr node); +int +xsltSetSourceNodeFlags(xsltTransformContextPtr ctxt, xmlNodePtr node, + int flags); +int +xsltClearSourceNodeFlags(xmlNodePtr node, int flags); +void ** +xsltGetPSVIPtr(xmlNodePtr cur); +/** DOC_ENABLE */ +#endif + +#ifdef WITH_PROFILER /* * Profiling. */ @@ -257,6 +287,7 @@ XSLTPUBFUN long XSLTCALL xsltTimestamp (void); XSLTPUBFUN void XSLTCALL xsltCalibrateAdjust (long delta); +#endif /** * XSLT_TIMESTAMP_TICS_PER_SEC: @@ -289,10 +320,11 @@ typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node, typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source); typedef void (*xsltDropCallCallback) (void); -XSLTPUBFUN void XSLTCALL - xsltSetDebuggerStatus (int value); XSLTPUBFUN int XSLTCALL xsltGetDebuggerStatus (void); +#ifdef WITH_DEBUGGER +XSLTPUBFUN void XSLTCALL + xsltSetDebuggerStatus (int value); XSLTPUBFUN int XSLTCALL xsltSetDebuggerCallbacks (int no, void *block); XSLTPUBFUN int XSLTCALL @@ -300,11 +332,10 @@ XSLTPUBFUN int XSLTCALL xmlNodePtr source); XSLTPUBFUN void XSLTCALL xslDropCall (void); +#endif #ifdef __cplusplus } #endif #endif /* __XML_XSLTUTILS_H__ */ - -