Index: dll/3rdparty/libxslt/attributes.c =================================================================== --- dll/3rdparty/libxslt/attributes.c (revision 58297) +++ dll/3rdparty/libxslt/attributes.c (working copy) @@ -293,7 +293,7 @@ xmlNodePtr child; xsltAttrElemPtr attrItems; - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; value = xmlGetNsProp(cur, (const xmlChar *)"name", NULL); @@ -656,7 +656,8 @@ xmlNsPtr ns = NULL; xmlAttrPtr attr; - if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) + if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) || + (inst->type != XML_ELEMENT_NODE) ) return; /* @@ -749,31 +750,19 @@ "valid QName.\n", prop); /* we fall through to catch any further errors, if possible */ } - name = xsltSplitQName(ctxt->dict, prop, &prefix); - xmlFree(prop); /* - * Reject a prefix of "xmlns". + * Reject a name of "xmlns". */ - if ((prefix != NULL) && - (!xmlStrncasecmp(prefix, (xmlChar *) "xmlns", 5))) - { -#ifdef WITH_XSLT_DEBUG_PARSING - xsltGenericDebug(xsltGenericDebugContext, - "xsltAttribute: xmlns prefix forbidden\n"); -#endif - /* - * SPEC XSLT 1.0: - * "It is an error if the string that results from instantiating - * the attribute value template is not a QName or is the string - * xmlns. An XSLT processor may signal the error; if it does not - * signal the error, it must recover by not adding the attribute - * to the result tree." - * TODO: Decide which way to go here. - */ + if (xmlStrEqual(prop, BAD_CAST "xmlns")) { + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: The effective name 'xmlns' is not allowed.\n"); + xmlFree(prop); goto error; } + name = xsltSplitQName(ctxt->dict, prop, &prefix); + xmlFree(prop); } else { /* * The "name" value was static. @@ -821,7 +810,19 @@ if ((tmpNsName != NULL) && (tmpNsName[0] != 0)) nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1); xmlFree(tmpNsName); - }; + } + + if (xmlStrEqual(nsName, BAD_CAST "http://www.w3.org/2000/xmlns/")) { + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: Namespace http://www.w3.org/2000/xmlns/ " + "forbidden.\n"); + goto error; + } + if (xmlStrEqual(nsName, XML_XML_NAMESPACE)) { + prefix = BAD_CAST "xml"; + } else if (xmlStrEqual(prefix, BAD_CAST "xml")) { + prefix = NULL; + } } else if (prefix != NULL) { /* * SPEC XSLT 1.0: @@ -896,11 +897,10 @@ * xsl:attribute can produce a scenario where the prefix is NULL, * so generate a prefix. */ - if (prefix == NULL) { + if ((prefix == NULL) || xmlStrEqual(prefix, BAD_CAST "xmlns")) { xmlChar *pref = xmlStrdup(BAD_CAST "ns_1"); - ns = xsltGetSpecialNamespace(ctxt, inst, nsName, BAD_CAST pref, - targetElem); + ns = xsltGetSpecialNamespace(ctxt, inst, nsName, pref, targetElem); xmlFree(pref); } else { Index: dll/3rdparty/libxslt/AUTHORS =================================================================== --- dll/3rdparty/libxslt/AUTHORS (revision 58293) +++ dll/3rdparty/libxslt/AUTHORS (working copy) @@ -5,7 +5,7 @@ Used to work at W3C, now Red Hat co-chair of W3C XML Linking WG invited expert on the W3C XML Core WG - Author of libxml upon which this library is based. + Author of libxml2 upon which this library is based. Bjorn Reese: breese@users.sourceforge.net @@ -18,3 +18,46 @@ Thomas Broyer Igor Zlatkovic for the Windows port + +Patches gently provided by a multitude of people : + +Abhishek Arya +Ben Walton +Bjorn Reese +C. M. Sperberg-McQueen +Colin Walters +Daniel Mustieles +Daniel Richard G +Darin Adler +ÉRDI Gergo +Fatih Demir +Federico Mena Quintero +Frederic Crozat +Hao Hu +Havoc Pennington +IlyaS +jacob berkman +Jason Viers +Jérôme Carretero +Joachim Breitner +Johan Dahlin +John Fleck +Jose Maria Celorio +Julio M. Merino Vidal +Kasimier T. Buchcik +Kjartan Maraas +Laurence Rowe +Malcolm Purvis +Martin +Michael Bonfils +Mike Hommey +money_seshu Dronamraju +Nick Wellnhofer +Nix +Pedro F. Giffuni +Peter Williams +Rob Richards +Roumen Petrov +Stefan Kost +Tomasz KÅ‚oczko +Chris Evans Index: dll/3rdparty/libxslt/extensions.c =================================================================== --- dll/3rdparty/libxslt/extensions.c (revision 58297) +++ dll/3rdparty/libxslt/extensions.c (working copy) @@ -2289,6 +2289,7 @@ xmlFreeMutex(xsltExtMutex); xsltExtMutex = NULL; + xsltFreeLocales(); xsltUninit(); } Index: dll/3rdparty/libxslt/extra.c =================================================================== --- dll/3rdparty/libxslt/extra.c (revision 58297) +++ dll/3rdparty/libxslt/extra.c (working copy) @@ -243,8 +243,11 @@ * Calling localtime() has the side-effect of setting timezone. * After we know the timezone, we can adjust for it */ +#if !defined(__FreeBSD__) lmt = gmt - timezone; - +#else /* FreeBSD DOESN'T have such side-ffect */ + lmt = gmt - local_tm->tm_gmtoff; +#endif /* * FIXME: it's been too long since I did manual memory management. * (I swore never to do it again.) Does this introduce a memory leak? Index: dll/3rdparty/libxslt/functions.c =================================================================== --- dll/3rdparty/libxslt/functions.c (revision 58297) +++ dll/3rdparty/libxslt/functions.c (working copy) @@ -260,7 +260,7 @@ obj = valuePop(ctxt); ret = xmlXPathNewNodeSet(NULL); - if (obj->nodesetval) { + if ((obj != NULL) && obj->nodesetval) { for (i = 0; i < obj->nodesetval->nodeNr; i++) { valuePush(ctxt, xmlXPathNewNodeSet(obj->nodesetval->nodeTab[i])); @@ -280,7 +280,8 @@ } } - xmlXPathFreeObject(obj); + if (obj != NULL) + xmlXPathFreeObject(obj); if (obj2 != NULL) xmlXPathFreeObject(obj2); valuePush(ctxt, ret); @@ -302,6 +303,8 @@ if (obj->stringval == NULL) { valuePush(ctxt, xmlXPathNewNodeSet(NULL)); } else { + xsltTransformContextPtr tctxt; + tctxt = xsltXPathGetTransformContext(ctxt); if ((obj2 != NULL) && (obj2->nodesetval != NULL) && (obj2->nodesetval->nodeNr > 0) && IS_XSLT_REAL_NODE(obj2->nodesetval->nodeTab[0])) { @@ -314,9 +317,6 @@ } base = xmlNodeGetBase(target->doc, target); } else { - xsltTransformContextPtr tctxt; - - tctxt = xsltXPathGetTransformContext(ctxt); if ((tctxt != NULL) && (tctxt->inst != NULL)) { base = xmlNodeGetBase(tctxt->inst->doc, tctxt->inst); } else if ((tctxt != NULL) && (tctxt->style != NULL) && @@ -329,7 +329,14 @@ if (base != NULL) xmlFree(base); if (URI == NULL) { - valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + if ((tctxt != NULL) && (tctxt->style != NULL) && + (tctxt->style->doc != NULL) && + (xmlStrEqual(URI, tctxt->style->doc->URL))) { + /* This selects the stylesheet's doc itself. */ + valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) tctxt->style->doc)); + } else { + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + } } else { xsltDocumentFunctionLoadDocument( ctxt, URI ); xmlFree(URI); @@ -653,14 +660,16 @@ */ void xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ + static char base_address; xmlNodePtr cur = NULL; - unsigned long val; - xmlChar str[20]; + xmlXPathObjectPtr obj = NULL; + long val; + xmlChar str[30]; + xmlDocPtr doc; if (nargs == 0) { cur = ctxt->context->node; } else if (nargs == 1) { - xmlXPathObjectPtr obj; xmlNodeSetPtr nodelist; int i, ret; @@ -683,7 +692,6 @@ if (ret == -1) cur = nodelist->nodeTab[i]; } - xmlXPathFreeObject(obj); } else { xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, "generate-id() : invalid number of args %d\n", nargs); @@ -694,9 +702,27 @@ * Okay this is ugly but should work, use the NodePtr address * to forge the ID */ - val = (unsigned long)((char *)cur - (char *)0); - val /= sizeof(xmlNode); - sprintf((char *)str, "id%ld", val); + if (cur->type != XML_NAMESPACE_DECL) + doc = cur->doc; + else { + xmlNsPtr ns = (xmlNsPtr) cur; + + if (ns->context != NULL) + doc = ns->context; + else + doc = ctxt->context->doc; + + } + + if (obj) + xmlXPathFreeObject(obj); + + val = (long)((char *)cur - (char *)&base_address); + if (val >= 0) { + sprintf((char *)str, "idp%ld", val); + } else { + sprintf((char *)str, "idm%ld", -val); + } valuePush(ctxt, xmlXPathNewString(str)); } @@ -783,7 +809,9 @@ } else { valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); } - } + } else { + valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); + } if (name != NULL) xmlFree(name); if (prefix != NULL) Index: dll/3rdparty/libxslt/keys.c =================================================================== --- dll/3rdparty/libxslt/keys.c (revision 58297) +++ dll/3rdparty/libxslt/keys.c (working copy) @@ -21,6 +21,7 @@ #include #include #include +#include #include "xslt.h" #include "xsltInternals.h" #include "xsltutils.h" @@ -311,7 +312,7 @@ end = skipPredicate(match, end); if (end <= 0) { xsltTransformError(NULL, style, inst, - "key pattern is malformed: %s", + "xsl:key : 'match' pattern is malformed: %s", key->match); if (style != NULL) style->errors++; goto error; @@ -321,7 +322,7 @@ } if (current == end) { xsltTransformError(NULL, style, inst, - "key pattern is empty\n"); + "xsl:key : 'match' pattern is empty\n"); if (style != NULL) style->errors++; goto error; } @@ -344,6 +345,12 @@ } current = end; } + if (pattern == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:key : 'match' pattern is empty\n"); + if (style != NULL) style->errors++; + goto error; + } #ifdef WITH_XSLT_DEBUG_KEYS xsltGenericDebug(xsltGenericDebugContext, " resulting pattern %s\n", pattern); @@ -356,17 +363,25 @@ * Maybe a search for "$", if it occurs outside of quotation * marks, could be sufficient. */ +#ifdef XML_XPATH_NOVAR + key->comp = xsltXPathCompileFlags(style, pattern, XML_XPATH_NOVAR); +#else key->comp = xsltXPathCompile(style, pattern); +#endif if (key->comp == NULL) { xsltTransformError(NULL, style, inst, - "xsl:key : XPath pattern compilation failed '%s'\n", + "xsl:key : 'match' pattern compilation failed '%s'\n", pattern); if (style != NULL) style->errors++; } +#ifdef XML_XPATH_NOVAR + key->usecomp = xsltXPathCompileFlags(style, use, XML_XPATH_NOVAR); +#else key->usecomp = xsltXPathCompile(style, use); +#endif if (key->usecomp == NULL) { xsltTransformError(NULL, style, inst, - "xsl:key : XPath pattern compilation failed '%s'\n", + "xsl:key : 'use' expression compilation failed '%s'\n", use); if (style != NULL) style->errors++; } Index: dll/3rdparty/libxslt/Makefile.am =================================================================== --- dll/3rdparty/libxslt/Makefile.am (revision 58293) +++ dll/3rdparty/libxslt/Makefile.am (working copy) @@ -1,5 +1,7 @@ -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt $(LIBXML_CFLAGS) +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt +AM_CFLAGS = $(LIBXML_CFLAGS) + lib_LTLIBRARIES = libxslt.la xsltincdir = $(includedir)/libxslt @@ -58,11 +60,11 @@ LIBXSLT_VERSION_SCRIPT = endif -libxslt_la_LIBADD = $(EXTRA_LIBS) +libxslt_la_LIBADD = $(LIBXML_LIBS) $(EXTRA_LIBS) libxslt_la_LDFLAGS = \ $(WIN32_EXTRA_LDFLAGS) \ $(LIBXSLT_VERSION_SCRIPT) \ - -version-info @LIBXSLT_VERSION_INFO@ + -version-info $(LIBXSLT_VERSION_INFO) man_MANS = libxslt.3 @@ -72,4 +74,4 @@ @(cd ../xsltproc ; $(MAKE)) install-exec-hook: - $(mkinstalldirs) "$(DESTDIR)$(libdir)/libxslt-plugins" + $(MKDIR_P) "$(DESTDIR)$(libdir)/libxslt-plugins" Index: dll/3rdparty/libxslt/Makefile.in =================================================================== --- dll/3rdparty/libxslt/Makefile.in (revision 58293) +++ dll/3rdparty/libxslt/Makefile.in (working copy) @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,6 +17,23 @@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -68,17 +85,26 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man3dir)" \ "$(DESTDIR)$(xsltincdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = -libxslt_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +libxslt_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libxslt_la_OBJECTS = attrvt.lo xslt.lo xsltlocale.lo xsltutils.lo \ pattern.lo templates.lo variables.lo keys.lo numbers.lo \ extensions.lo extra.lo functions.lo namespaces.lo imports.lo \ attributes.lo documents.lo preproc.lo transform.lo security.lo libxslt_la_OBJECTS = $(am_libxslt_la_OBJECTS) -libxslt_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +libxslt_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libxslt_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) @@ -87,15 +113,33 @@ am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libxslt_la_SOURCES) DIST_SOURCES = $(libxslt_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac man3dir = $(mandir)/man3 NROFF = nroff MANS = $(man_MANS) @@ -105,6 +149,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -171,6 +216,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MV = @MV@ M_LIBS = @M_LIBS@ @@ -185,12 +231,14 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PYTHON = @PYTHON@ PYTHONSODV = @PYTHONSODV@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@ PYTHON_SUBDIR = @PYTHON_SUBDIR@ PYTHON_VERSION = @PYTHON_VERSION@ @@ -200,7 +248,6 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -STATIC_BINARIES = @STATIC_BINARIES@ STRIP = @STRIP@ TAR = @TAR@ THREAD_LIBS = @THREAD_LIBS@ @@ -227,6 +274,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -259,7 +307,6 @@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -276,7 +323,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt $(LIBXML_CFLAGS) +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt +AM_CFLAGS = $(LIBXML_CFLAGS) lib_LTLIBRARIES = libxslt.la xsltincdir = $(includedir)/libxslt xsltinc_HEADERS = \ @@ -329,11 +377,11 @@ @USE_VERSION_SCRIPT_FALSE@LIBXSLT_VERSION_SCRIPT = @USE_VERSION_SCRIPT_TRUE@LIBXSLT_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxslt.syms -libxslt_la_LIBADD = $(EXTRA_LIBS) +libxslt_la_LIBADD = $(LIBXML_LIBS) $(EXTRA_LIBS) libxslt_la_LDFLAGS = \ $(WIN32_EXTRA_LDFLAGS) \ $(LIBXSLT_VERSION_SCRIPT) \ - -version-info @LIBXSLT_VERSION_INFO@ + -version-info $(LIBXSLT_VERSION_INFO) man_MANS = libxslt.3 EXTRA_DIST = $(man_MANS) trio.h triodef.h libxslt.syms @@ -377,7 +425,6 @@ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ @@ -385,6 +432,8 @@ else :; fi; \ done; \ test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } @@ -406,8 +455,8 @@ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libxslt.la: $(libxslt_la_OBJECTS) $(libxslt_la_DEPENDENCIES) - $(libxslt_la_LINK) -rpath $(libdir) $(libxslt_la_OBJECTS) $(libxslt_la_LIBADD) $(LIBS) +libxslt.la: $(libxslt_la_OBJECTS) $(libxslt_la_DEPENDENCIES) $(EXTRA_libxslt_la_DEPENDENCIES) + $(AM_V_CCLD)$(libxslt_la_LINK) -rpath $(libdir) $(libxslt_la_OBJECTS) $(libxslt_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -436,25 +485,25 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsltutils.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -463,11 +512,18 @@ -rm -rf .libs _libs install-man3: $(man_MANS) @$(NORMAL_INSTALL) - test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" - @list=''; test -n "$(man3dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man3dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.3[a-z]*$$/p'; \ + fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -496,13 +552,14 @@ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - test -z "$$files" || { \ - echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } + dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) install-xsltincHEADERS: $(xsltinc_HEADERS) @$(NORMAL_INSTALL) - test -z "$(xsltincdir)" || $(MKDIR_P) "$(DESTDIR)$(xsltincdir)" @list='$(xsltinc_HEADERS)'; test -n "$(xsltincdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(xsltincdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(xsltincdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -516,9 +573,7 @@ @$(NORMAL_UNINSTALL) @list='$(xsltinc_HEADERS)'; test -n "$(xsltincdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(xsltincdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(xsltincdir)" && rm -f $$files + dir='$(DESTDIR)$(xsltincdir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -632,10 +687,15 @@ installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -745,7 +805,7 @@ @(cd ../xsltproc ; $(MAKE)) install-exec-hook: - $(mkinstalldirs) "$(DESTDIR)$(libdir)/libxslt-plugins" + $(MKDIR_P) "$(DESTDIR)$(libdir)/libxslt-plugins" # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. Index: dll/3rdparty/libxslt/namespaces.c =================================================================== --- dll/3rdparty/libxslt/namespaces.c (revision 58297) +++ dll/3rdparty/libxslt/namespaces.c (working copy) @@ -585,7 +585,7 @@ int counter = 1; if (nsPrefix == NULL) { - nsPrefix = "ns"; + nsPrefix = BAD_CAST "ns"; } do { Index: dll/3rdparty/libxslt/NEWS =================================================================== --- dll/3rdparty/libxslt/NEWS (revision 58293) +++ dll/3rdparty/libxslt/NEWS (working copy) @@ -4,13 +4,165 @@ Note that this is automatically generated from the news webpage at: http://xmlsoft.org/XSLT/news.html -The change log at -ChangeLog.html - describes the recents commits -to the SVN at -http://svn.gnome.org/viewcvs/libxslt/trunk/ - code base.Those are the public releases made: -1.1.24: May 13 20088: +See the git page at +http://git.gnome.org/browse/libxslt/ + +to get a description of the recent commits.Those are the public releases made: +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 Index: dll/3rdparty/libxslt/numbers.c =================================================================== --- dll/3rdparty/libxslt/numbers.c (revision 58297) +++ dll/3rdparty/libxslt/numbers.c (working copy) @@ -534,8 +534,8 @@ static int xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context, xmlNodePtr node, - const xmlChar *count, - const xmlChar *from, + xsltCompMatchPtr countPat, + xsltCompMatchPtr fromPat, double *array, xmlDocPtr doc, xmlNodePtr elem) @@ -543,14 +543,7 @@ int amount = 0; int cnt = 0; xmlNodePtr cur; - xsltCompMatchPtr countPat = NULL; - xsltCompMatchPtr fromPat = NULL; - if (count != NULL) - countPat = xsltCompilePattern(count, doc, elem, NULL, context); - if (from != NULL) - fromPat = xsltCompilePattern(from, doc, elem, NULL, context); - /* select the starting node */ switch (node->type) { case XML_ELEMENT_NODE: @@ -571,7 +564,7 @@ while (cur != NULL) { /* process current node */ - if (count == NULL) { + if (countPat == NULL) { if ((node->type == cur->type) && /* FIXME: must use expanded-name instead of local name */ xmlStrEqual(node->name, cur->name)) { @@ -586,7 +579,7 @@ if (xsltTestCompMatchList(context, cur, countPat)) cnt++; } - if ((from != NULL) && + if ((fromPat != NULL) && xsltTestCompMatchList(context, cur, fromPat)) { break; /* while */ } @@ -613,18 +606,14 @@ array[amount++] = (double) cnt; - if (countPat != NULL) - xsltFreeCompMatchList(countPat); - if (fromPat != NULL) - xsltFreeCompMatchList(fromPat); return(amount); } static int xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context, xmlNodePtr node, - const xmlChar *count, - const xmlChar *from, + xsltCompMatchPtr countPat, + xsltCompMatchPtr fromPat, double *array, int max, xmlDocPtr doc, @@ -635,17 +624,7 @@ xmlNodePtr ancestor; xmlNodePtr preceding; xmlXPathParserContextPtr parser; - xsltCompMatchPtr countPat; - xsltCompMatchPtr fromPat; - if (count != NULL) - countPat = xsltCompilePattern(count, doc, elem, NULL, context); - else - countPat = NULL; - if (from != NULL) - fromPat = xsltCompilePattern(from, doc, elem, NULL, context); - else - fromPat = NULL; context->xpathCtxt->node = node; parser = xmlXPathNewParserContext(NULL, context->xpathCtxt); if (parser) { @@ -654,11 +633,11 @@ (ancestor != NULL) && (ancestor->type != XML_DOCUMENT_NODE); ancestor = xmlXPathNextAncestor(parser, ancestor)) { - if ((from != NULL) && + if ((fromPat != NULL) && xsltTestCompMatchList(context, ancestor, fromPat)) break; /* for */ - if ((count == NULL && node->type == ancestor->type && + if ((countPat == NULL && node->type == ancestor->type && xmlStrEqual(node->name, ancestor->name)) || xsltTestCompMatchList(context, ancestor, countPat)) { /* count(preceding-sibling::*) */ @@ -667,7 +646,7 @@ preceding != NULL; preceding = xmlXPathNextPrecedingSibling(parser, preceding)) { - if (count == NULL) { + if (countPat == NULL) { if ((preceding->type == ancestor->type) && xmlStrEqual(preceding->name, ancestor->name)){ if ((preceding->ns == ancestor->ns) || @@ -690,8 +669,6 @@ } xmlXPathFreeParserContext(parser); } - xsltFreeCompMatchList(countPat); - xsltFreeCompMatchList(fromPat); return amount; } @@ -779,8 +756,8 @@ if (xmlStrEqual(data->level, (const xmlChar *) "single")) { amount = xsltNumberFormatGetMultipleLevel(ctxt, node, - data->count, - data->from, + data->countPat, + data->fromPat, &number, 1, data->doc, @@ -797,8 +774,8 @@ int max = sizeof(numarray)/sizeof(numarray[0]); amount = xsltNumberFormatGetMultipleLevel(ctxt, node, - data->count, - data->from, + data->countPat, + data->fromPat, numarray, max, data->doc, @@ -813,8 +790,8 @@ } else if (xmlStrEqual(data->level, (const xmlChar *) "any")) { amount = xsltNumberFormatGetAnyLevel(ctxt, node, - data->count, - data->from, + data->countPat, + data->fromPat, &number, data->doc, data->node); Index: dll/3rdparty/libxslt/pattern.c =================================================================== --- dll/3rdparty/libxslt/pattern.c (revision 58297) +++ dll/3rdparty/libxslt/pattern.c (working copy) @@ -25,6 +25,7 @@ #include #include #include +#include #include "xslt.h" #include "xsltInternals.h" #include "xsltutils.h" @@ -303,6 +304,10 @@ "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; @@ -546,13 +551,15 @@ xmlNodePtr parent = node->parent; xmlDocPtr olddoc; xmlNodePtr oldnode; - int oldNsNr; + int oldNsNr, oldContextSize, oldProximityPosition; xmlNsPtr *oldNamespaces; oldnode = ctxt->xpathCtxt->node; olddoc = ctxt->xpathCtxt->doc; oldNsNr = ctxt->xpathCtxt->nsNr; oldNamespaces = ctxt->xpathCtxt->namespaces; + oldContextSize = ctxt->xpathCtxt->contextSize; + oldProximityPosition = ctxt->xpathCtxt->proximityPosition; ctxt->xpathCtxt->node = node; ctxt->xpathCtxt->doc = doc; ctxt->xpathCtxt->namespaces = nsList; @@ -562,6 +569,8 @@ ctxt->xpathCtxt->doc = olddoc; ctxt->xpathCtxt->namespaces = oldNamespaces; ctxt->xpathCtxt->nsNr = oldNsNr; + ctxt->xpathCtxt->contextSize = oldContextSize; + ctxt->xpathCtxt->proximityPosition = oldProximityPosition; if (newlist == NULL) return(-1); if (newlist->type != XPATH_NODESET) { @@ -884,11 +893,10 @@ (node->type == XML_ELEMENT_NODE) && (node->parent != NULL)) { xmlNodePtr previous; - int ix, nocache = 0; + int nocache = 0; previous = (xmlNodePtr) XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr); - ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival); if ((previous != NULL) && (previous->parent == node->parent)) { /* @@ -900,7 +908,7 @@ while (sibling != NULL) { if (sibling == previous) break; - if ((previous->type == XML_ELEMENT_NODE) && + if ((sibling->type == XML_ELEMENT_NODE) && (previous->name != NULL) && (sibling->name != NULL) && (previous->name[0] == sibling->name[0]) && @@ -921,7 +929,7 @@ while (sibling != NULL) { if (sibling == previous) break; - if ((previous->type == XML_ELEMENT_NODE) && + if ((sibling->type == XML_ELEMENT_NODE) && (previous->name != NULL) && (sibling->name != NULL) && (previous->name[0] == sibling->name[0]) && @@ -939,7 +947,8 @@ } } if (sibling != NULL) { - pos = ix + indx; + pos = XSLT_RUNTIME_EXTRA(ctxt, + sel->indexExtra, ival) + indx; /* * If the node is in a Value Tree we need to * save len, but cannot cache the node! @@ -955,7 +964,6 @@ sel->indexExtra, ival) = pos; } } - ix = pos; } else pos = 0; } else { @@ -1016,11 +1024,10 @@ } else if ((sel != NULL) && (sel->op == XSLT_OP_ALL) && (node->type == XML_ELEMENT_NODE)) { xmlNodePtr previous; - int ix, nocache = 0; + int nocache = 0; previous = (xmlNodePtr) XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr); - ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival); if ((previous != NULL) && (previous->parent == node->parent)) { /* @@ -1049,7 +1056,8 @@ } } if (sibling != NULL) { - pos = ix + indx; + pos = XSLT_RUNTIME_EXTRA(ctxt, + sel->indexExtra, ival) + indx; /* * If the node is in a Value Tree we cannot * cache it ! @@ -1381,17 +1389,22 @@ NEXT; SKIP_BLANKS; lit = xsltScanLiteral(ctxt); - if (ctxt->error) + if (ctxt->error) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : Literal expected\n"); return; + } SKIP_BLANKS; if (CUR != ')') { xsltTransformError(NULL, NULL, NULL, "xsltCompileIdKeyPattern : ) expected\n"); + xmlFree(lit); ctxt->error = 1; return; } NEXT; PUSH(XSLT_OP_ID, lit, NULL, novar); + lit = NULL; } else if ((aid) && (xmlStrEqual(name, (const xmlChar *)"key"))) { if (axis != 0) { xsltTransformError(NULL, NULL, NULL, @@ -1402,8 +1415,11 @@ NEXT; SKIP_BLANKS; lit = xsltScanLiteral(ctxt); - if (ctxt->error) + if (ctxt->error) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : Literal expected\n"); return; + } SKIP_BLANKS; if (CUR != ',') { xsltTransformError(NULL, NULL, NULL, @@ -1414,25 +1430,36 @@ NEXT; SKIP_BLANKS; lit2 = xsltScanLiteral(ctxt); - if (ctxt->error) + if (ctxt->error) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : Literal expected\n"); + xmlFree(lit); return; + } SKIP_BLANKS; if (CUR != ')') { xsltTransformError(NULL, NULL, NULL, "xsltCompileIdKeyPattern : ) expected\n"); + xmlFree(lit); + xmlFree(lit2); ctxt->error = 1; return; } NEXT; /* URGENT TODO: support namespace in keys */ PUSH(XSLT_OP_KEY, lit, lit2, novar); + lit = NULL; + lit2 = NULL; } else if (xmlStrEqual(name, (const xmlChar *)"processing-instruction")) { NEXT; SKIP_BLANKS; if (CUR != ')') { lit = xsltScanLiteral(ctxt); - if (ctxt->error) + if (ctxt->error) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : Literal expected\n"); return; + } SKIP_BLANKS; if (CUR != ')') { xsltTransformError(NULL, NULL, NULL, @@ -1443,6 +1470,7 @@ } NEXT; PUSH(XSLT_OP_PI, lit, NULL, novar); + lit = NULL; } else if (xmlStrEqual(name, (const xmlChar *)"text")) { NEXT; SKIP_BLANKS; @@ -1493,8 +1521,7 @@ return; } error: - if (name != NULL) - xmlFree(name); + return; } /** @@ -1557,6 +1584,8 @@ SKIP_BLANKS; if (CUR == '(') { xsltCompileIdKeyPattern(ctxt, token, 0, novar, axis); + xmlFree(token); + token = NULL; if (ctxt->error) goto error; } else if (CUR == ':') { @@ -1575,20 +1604,24 @@ "xsltCompileStepPattern : no namespace bound to prefix %s\n", prefix); xmlFree(prefix); + prefix=NULL; ctxt->error = 1; goto error; } else { URL = xmlStrdup(ns->href); } xmlFree(prefix); + prefix=NULL; if (token == NULL) { if (CUR == '*') { NEXT; if (axis == AXIS_ATTRIBUTE) { PUSH(XSLT_OP_ATTR, NULL, URL, novar); + URL = NULL; } else { PUSH(XSLT_OP_NS, URL, NULL, novar); + URL = NULL; } } else { xsltTransformError(NULL, NULL, NULL, @@ -1599,9 +1632,13 @@ } else { if (axis == AXIS_ATTRIBUTE) { PUSH(XSLT_OP_ATTR, token, URL, novar); + token = NULL; + URL = NULL; } else { PUSH(XSLT_OP_ELEM, token, URL, novar); + token = NULL; + URL = NULL; } } } else { @@ -1623,6 +1660,7 @@ goto error; } xmlFree(token); + token = NULL; SKIP_BLANKS; token = xsltScanNCName(ctxt); goto parse_node_test; @@ -1637,9 +1675,13 @@ URL = xmlStrdup(URI); if (axis == AXIS_ATTRIBUTE) { PUSH(XSLT_OP_ATTR, token, URL, novar); + token = NULL; + URL = NULL; } else { PUSH(XSLT_OP_ELEM, token, URL, novar); + token = NULL; + URL = NULL; } } parse_predicate: @@ -1679,6 +1721,7 @@ } ret = xmlStrndup(q, CUR_PTR - q); PUSH(XSLT_OP_PREDICATE, ret, NULL, novar); + ret = NULL; /* push the predicate lower than local test */ SWAP(); NEXT; @@ -1787,6 +1830,8 @@ SKIP_BLANKS; if ((CUR == '(') && !xmlXPathIsNodeType(name)) { xsltCompileIdKeyPattern(ctxt, name, 1, novar, 0); + xmlFree(name); + name = NULL; if ((CUR == '/') && (NXT(1) == '/')) { PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar); NEXT; @@ -1864,6 +1909,8 @@ while ((pattern[end] != 0) && (pattern[end] != '"')) end++; } + if (pattern[end] == 0) + break; end++; } if (current == end) { Index: dll/3rdparty/libxslt/preproc.c =================================================================== --- dll/3rdparty/libxslt/preproc.c (revision 58297) +++ dll/3rdparty/libxslt/preproc.c (working copy) @@ -39,6 +39,7 @@ #include "extra.h" #include "imports.h" #include "extensions.h" +#include "pattern.h" #ifdef WITH_XSLT_DEBUG #define WITH_XSLT_DEBUG_PREPROC @@ -419,7 +420,13 @@ xmlXPathFreeCompExpr(item->comp); } break; - case XSLT_FUNC_NUMBER: + case XSLT_FUNC_NUMBER: { + xsltStyleItemNumberPtr item = (xsltStyleItemNumberPtr) comp; + if (item->numdata.countPat != NULL) + xsltFreeCompMatchList(item->numdata.countPat); + if (item->numdata.fromPat != NULL) + xsltFreeCompMatchList(item->numdata.fromPat); + } break; case XSLT_FUNC_APPLYIMPORTS: break; @@ -493,6 +500,10 @@ xsltFreeLocale(comp->locale); if (comp->comp != NULL) xmlXPathFreeCompExpr(comp->comp); + if (comp->numdata.countPat != NULL) + xsltFreeCompMatchList(comp->numdata.countPat); + if (comp->numdata.fromPat != NULL) + xsltFreeCompMatchList(comp->numdata.fromPat); if (comp->nsList != NULL) xmlFree(comp->nsList); #endif @@ -669,7 +680,7 @@ #else xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -777,7 +788,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED comp = (xsltStyleItemCopyPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPY); @@ -821,7 +832,7 @@ #endif const xmlChar *prop; - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -874,7 +885,7 @@ * * */ - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -991,7 +1002,7 @@ * * */ - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1037,6 +1048,10 @@ "xsl:attribute: The value '%s' of the attribute 'name' is " "not a valid QName.\n", comp->name); style->errors++; + } else if (xmlStrEqual(comp->name, BAD_CAST "xmlns")) { + xsltTransformError(NULL, style, inst, + "xsl:attribute: The attribute name 'xmlns' is not allowed.\n"); + style->errors++; } else { const xmlChar *prefix = NULL, *name; @@ -1070,27 +1085,6 @@ style->errors++; } } - if (!xmlStrncasecmp(prefix, (xmlChar *) "xmlns", 5)) { - /* - * SPEC XSLT 1.0: - * "It is an error if the string that results from - * instantiating the attribute value template is not a - * QName or is the string xmlns. An XSLT processor may - * signal the error; if it does not signal the error, - * it must recover by not adding the attribute to the - * result tree." - * - * Reject a prefix of "xmlns". Mark to be skipped. - */ - comp->has_name = 0; - -#ifdef WITH_XSLT_DEBUG_PARSING - xsltGenericDebug(xsltGenericDebugContext, - "xsltAttribute: xmlns prefix forbidden\n"); -#endif - return; - } - } } } @@ -1111,7 +1105,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1141,7 +1135,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1175,7 +1169,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1222,7 +1216,7 @@ #endif const xmlChar *prop; - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1347,7 +1341,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1406,7 +1400,7 @@ #endif const xmlChar *prop; - if ((style == NULL) || (cur == NULL)) + if ((style == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1437,10 +1431,22 @@ } comp->numdata.count = xsltGetCNsProp(style, cur, (const xmlChar *)"count", - XSLT_NAMESPACE); + XSLT_NAMESPACE); comp->numdata.from = xsltGetCNsProp(style, cur, (const xmlChar *)"from", - XSLT_NAMESPACE); + XSLT_NAMESPACE); + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"count", XSLT_NAMESPACE); + if (prop != NULL) { + comp->numdata.countPat = xsltCompilePattern(prop, cur->doc, cur, style, + NULL); + } + + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"from", XSLT_NAMESPACE); + if (prop != NULL) { + comp->numdata.fromPat = xsltCompilePattern(prop, cur->doc, cur, style, + NULL); + } + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"level", XSLT_NAMESPACE); if (prop != NULL) { if (xmlStrEqual(prop, BAD_CAST("single")) || @@ -1520,7 +1526,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1550,7 +1556,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1589,7 +1595,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1641,7 +1647,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1672,7 +1678,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1718,7 +1724,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1764,7 +1770,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1812,7 +1818,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1844,6 +1850,9 @@ comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select", XSLT_NAMESPACE); if (comp->select != NULL) { +#ifndef XSLT_REFACTORED + xmlNodePtr cur; +#endif comp->comp = xsltXPathCompile(style, comp->select); if (comp->comp == NULL) { xsltTransformError(NULL, style, inst, @@ -1851,12 +1860,25 @@ comp->select); style->errors++; } +#ifdef XSLT_REFACTORED if (inst->children != NULL) { xsltTransformError(NULL, style, inst, - "XSLT-variable: The must be no child nodes, since the " + "XSLT-variable: There must be no child nodes, since the " "attribute 'select' was specified.\n"); style->errors++; } +#else + for (cur = inst->children; cur != NULL; cur = cur->next) { + if (cur->type != XML_COMMENT_NODE && + (cur->type != XML_TEXT_NODE || !xsltIsBlank(cur->content))) + { + xsltTransformError(NULL, style, inst, + "XSLT-variable: There must be no child nodes, since the " + "attribute 'select' was specified.\n"); + style->errors++; + } + } +#endif } } @@ -1875,7 +1897,7 @@ xsltStylePreCompPtr comp; #endif - if ((style == NULL) || (inst == NULL)) + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -1967,7 +1989,7 @@ * the parsing mechanism for all elements in the XSLT namespace. */ if (style == NULL) { - if (node != NULL) + if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) node->psvi = NULL; return; } @@ -2182,7 +2204,8 @@ * namespace- and local-name of the node, but can evaluate this * using cctxt->style->inode->category; */ - if (inst->psvi != NULL) + if ((inst == NULL) || (inst->type != XML_ELEMENT_NODE) || + (inst->psvi != NULL)) return; if (IS_XSLT_ELEM(inst)) { Index: dll/3rdparty/libxslt/README =================================================================== --- dll/3rdparty/libxslt/README (revision 58293) +++ dll/3rdparty/libxslt/README (working copy) @@ -21,4 +21,4 @@ Daniel Veillard -$Id: README,v 1.7 2003/02/04 17:20:01 veillard Exp $ +$Id$ Index: dll/3rdparty/libxslt/security.c =================================================================== --- dll/3rdparty/libxslt/security.c (revision 58297) +++ dll/3rdparty/libxslt/security.c (working copy) @@ -35,7 +35,7 @@ #endif #if defined(WIN32) && !defined(__CYGWIN__) -//#include +#include #ifndef INVALID_FILE_ATTRIBUTES #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #endif Index: dll/3rdparty/libxslt/templates.c =================================================================== --- dll/3rdparty/libxslt/templates.c (revision 58297) +++ dll/3rdparty/libxslt/templates.c (working copy) @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include "xslt.h" @@ -198,7 +199,8 @@ xmlNodePtr oldInsert, insert = NULL; xmlChar *ret; - if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) + if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) || + (inst->type != XML_ELEMENT_NODE)) return(NULL); if (inst->children == NULL) @@ -279,7 +281,17 @@ ret = xmlStrncat(ret, str, cur - str); str = cur; cur++; - while ((*cur != 0) && (*cur != '}')) cur++; + while ((*cur != 0) && (*cur != '}')) { + /* Need to check for literal (bug539741) */ + if ((*cur == '\'') || (*cur == '"')) { + char delim = *(cur++); + while ((*cur != 0) && (*cur != delim)) + cur++; + if (*cur != 0) + cur++; /* skip the ending delimiter */ + } else + cur++; + } if (*cur == 0) { xsltTransformError(ctxt, NULL, inst, "xsltAttrTemplateValueProcessNode: unmatched '{'\n"); @@ -380,7 +392,8 @@ xmlChar *ret; xmlChar *expr; - if ((ctxt == NULL) || (inst == NULL) || (name == NULL)) + if ((ctxt == NULL) || (inst == NULL) || (name == NULL) || + (inst->type != XML_ELEMENT_NODE)) return(NULL); expr = xsltGetNsProp(inst, name, ns); @@ -424,7 +437,8 @@ const xmlChar *ret; xmlChar *expr; - if ((style == NULL) || (inst == NULL) || (name == NULL)) + if ((style == NULL) || (inst == NULL) || (name == NULL) || + (inst->type != XML_ELEMENT_NODE)) return(NULL); expr = xsltGetNsProp(inst, name, ns); @@ -465,7 +479,8 @@ const xmlChar *value; xmlAttrPtr ret; - if ((ctxt == NULL) || (attr == NULL) || (target == NULL)) + if ((ctxt == NULL) || (attr == NULL) || (target == NULL) || + (target->type != XML_ELEMENT_NODE)) return(NULL); if (attr->type != XML_ATTRIBUTE_NODE) @@ -572,7 +587,8 @@ } } else if ((ctxt->internalized) && (target != NULL) && (target->doc != NULL) && - (target->doc->dict == ctxt->dict)) { + (target->doc->dict == ctxt->dict) && + xmlDictOwns(ctxt->dict, value)) { text->content = (xmlChar *) value; } else { text->content = xmlStrdup(value); @@ -622,7 +638,8 @@ const xmlChar *value; xmlChar *valueAVT; - if ((ctxt == NULL) || (target == NULL) || (attrs == NULL)) + if ((ctxt == NULL) || (target == NULL) || (attrs == NULL) || + (target->type != XML_ELEMENT_NODE)) return(NULL); oldInsert = ctxt->insert; @@ -757,7 +774,8 @@ } } else if ((ctxt->internalized) && (target->doc != NULL) && - (target->doc->dict == ctxt->dict)) + (target->doc->dict == ctxt->dict) && + xmlDictOwns(ctxt->dict, value)) { text->content = (xmlChar *) value; } else { Index: dll/3rdparty/libxslt/transform.c =================================================================== --- dll/3rdparty/libxslt/transform.c (revision 58293) +++ dll/3rdparty/libxslt/transform.c (working copy) @@ -20,6 +20,7 @@ #include "libxslt.h" #include +#include #include #include @@ -64,6 +65,7 @@ #endif int xsltMaxDepth = 3000; +int xsltMaxVars = 15000; /* * Useful macros @@ -125,7 +127,7 @@ return (0); } } - if (ctxt->templNr >= ctxt->templMax) { + else if (ctxt->templNr >= ctxt->templMax) { ctxt->templMax *= 2; ctxt->templTab = (xsltTemplatePtr *) xmlRealloc(ctxt->templTab, @@ -249,7 +251,7 @@ return (0); } } - if (ctxt->profNr >= ctxt->profMax) { + else if (ctxt->profNr >= ctxt->profMax) { ctxt->profMax *= 2; ctxt->profTab = (long *) xmlRealloc(ctxt->profTab, @@ -288,6 +290,54 @@ return (ret); } +static void +profCallgraphAdd(xsltTemplatePtr templ, xsltTemplatePtr parent) +{ + int i; + + if (templ->templMax == 0) { + templ->templMax = 4; + templ->templCalledTab = + (xsltTemplatePtr *) xmlMalloc(templ->templMax * + sizeof(templ->templCalledTab[0])); + templ->templCountTab = + (int *) xmlMalloc(templ->templMax * + sizeof(templ->templCountTab[0])); + if (templ->templCalledTab == NULL || templ->templCountTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); + return; + } + } + else if (templ->templNr >= templ->templMax) { + templ->templMax *= 2; + templ->templCalledTab = + (xsltTemplatePtr *) xmlRealloc(templ->templCalledTab, + templ->templMax * + sizeof(templ->templCalledTab[0])); + templ->templCountTab = + (int *) xmlRealloc(templ->templCountTab, + templ->templMax * + sizeof(templ->templCountTab[0])); + if (templ->templCalledTab == NULL || templ->templCountTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + return; + } + } + + for (i = 0; i < templ->templNr; i++) { + if (templ->templCalledTab[i] == parent) { + templ->templCountTab[i]++; + break; + } + } + if (i == templ->templNr) { + /* not found, add new one */ + templ->templCalledTab[templ->templNr] = parent; + templ->templCountTab[templ->templNr] = 1; + templ->templNr++; + } +} + /************************************************************************ * * * XInclude default settings * @@ -456,6 +506,7 @@ cur->templNr = 0; cur->templMax = 5; cur->templ = NULL; + cur->maxTemplateDepth = xsltMaxDepth; /* * initialize the variables stack @@ -471,6 +522,7 @@ cur->varsMax = 10; cur->vars = NULL; cur->varsBase = 0; + cur->maxTemplateVars = xsltMaxVars; /* * the profiling stack is not initialized by default @@ -726,7 +778,7 @@ #endif /* - * Play save and reset the merging mechanism for every new + * Play safe and reset the merging mechanism for every new * target node. */ if ((target == NULL) || (target->children == NULL)) { @@ -2935,8 +2987,7 @@ * Check for infinite recursion: stop if the maximum of nested templates * is excceeded. Adjust xsltMaxDepth if you need more. */ - if (((ctxt->templNr >= xsltMaxDepth) || - (ctxt->varsNr >= 5 * xsltMaxDepth))) + if (ctxt->templNr >= ctxt->maxTemplateDepth) { xsltTransformError(ctxt, NULL, list, "xsltApplyXSLTTemplate: A potential infinite template recursion " @@ -2944,11 +2995,23 @@ "You can adjust xsltMaxDepth (--maxdepth) in order to " "raise the maximum number of nested template calls and " "variables/params (currently set to %d).\n", - xsltMaxDepth); + ctxt->maxTemplateDepth); xsltDebug(ctxt, contextNode, list, NULL); return; } + if (ctxt->varsNr >= ctxt->maxTemplateVars) + { + xsltTransformError(ctxt, NULL, list, + "xsltApplyXSLTTemplate: A potential infinite template recursion " + "was detected.\n" + "You can adjust maxTemplateVars (--maxvars) in order to " + "raise the maximum number of variables/params (currently set to %d).\n", + ctxt->maxTemplateVars); + xsltDebug(ctxt, contextNode, list, NULL); + return; + } + oldUserFragmentTop = ctxt->tmpRVT; ctxt->tmpRVT = NULL; oldLocalFragmentTop = ctxt->localRVT; @@ -2964,6 +3027,7 @@ templ->nbCalls++; start = xsltTimestamp(); profPush(ctxt, 0); + profCallgraphAdd(templ, ctxt->templ); } /* * Push the xsl:template declaration onto the stack. @@ -3230,6 +3294,7 @@ const xmlChar *doctypeSystem; const xmlChar *version; const xmlChar *encoding; + int redirect_write_append = 0; if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL)) return; @@ -3645,10 +3710,38 @@ } /* - * Save the result + * Calls to redirect:write also take an optional attribute append. + * Attribute append="true|yes" which will attempt to simply append + * to an existing file instead of always opening a new file. The + * default behavior of always overwriting the file still happens + * if we do not specify append. + * Note that append use will forbid use of remote URI target. */ - ret = xsltSaveResultToFilename((const char *) filename, - res, style, 0); + prop = xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *)"append", + NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *) "true") || + xmlStrEqual(prop, (const xmlChar *) "yes")) { + style->omitXmlDeclaration = 1; + redirect_write_append = 1; + } else + style->omitXmlDeclaration = 0; + xmlFree(prop); + } + + if (redirect_write_append) { + FILE *f; + + f = fopen((const char *) filename, "ab"); + if (f == NULL) { + ret = -1; + } else { + ret = xsltSaveResultToFile(f, res, style); + fclose(f); + } + } else { + ret = xsltSaveResultToFilename((const char *) filename, res, style, 0); + } if (ret < 0) { xsltTransformError(ctxt, NULL, inst, "xsltDocumentElem: unable to save to %s\n", @@ -3915,14 +4008,6 @@ } name = xsltSplitQName(ctxt->dict, prop, &prefix); xmlFree(prop); - if ((prefix != NULL) && - (!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3))) - { - /* - * TODO: Should we really disallow an "xml" prefix? - */ - goto error; - } } else { /* * The "name" value was static. @@ -3977,7 +4062,19 @@ if ((tmpNsName != NULL) && (tmpNsName[0] != 0)) nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1); xmlFree(tmpNsName); - }; + } + + if (xmlStrEqual(nsName, BAD_CAST "http://www.w3.org/2000/xmlns/")) { + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: Namespace http://www.w3.org/2000/xmlns/ " + "forbidden.\n"); + goto error; + } + if (xmlStrEqual(nsName, XML_XML_NAMESPACE)) { + prefix = BAD_CAST "xml"; + } else if (xmlStrEqual(prefix, BAD_CAST "xml")) { + prefix = NULL; + } } else { xmlNsPtr ns; /* @@ -3993,13 +4090,13 @@ * TODO: Check this in the compilation layer in case it's a * static value. */ - if (prefix != NULL) { - xsltTransformError(ctxt, NULL, inst, - "xsl:element: The QName '%s:%s' has no " - "namespace binding in scope in the stylesheet; " - "this is an error, since the namespace was not " - "specified by the instruction itself.\n", prefix, name); - } + if (prefix != NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:element: The QName '%s:%s' has no " + "namespace binding in scope in the stylesheet; " + "this is an error, since the namespace was not " + "specified by the instruction itself.\n", prefix, name); + } } else nsName = ns->href; } @@ -4007,7 +4104,17 @@ * Find/create a matching ns-decl in the result tree. */ if (nsName != NULL) { - copy->ns = xsltGetSpecialNamespace(ctxt, inst, nsName, prefix, copy); + if (xmlStrEqual(prefix, BAD_CAST "xmlns")) { + /* Don't use a prefix of "xmlns" */ + xmlChar *pref = xmlStrdup(BAD_CAST "ns_1"); + + copy->ns = xsltGetSpecialNamespace(ctxt, inst, nsName, pref, copy); + + xmlFree(pref); + } else { + copy->ns = xsltGetSpecialNamespace(ctxt, inst, nsName, prefix, + copy); + } } else if ((copy->parent != NULL) && (copy->parent->type == XML_ELEMENT_NODE) && (copy->parent->ns != NULL)) @@ -4364,7 +4471,6 @@ xsltStylePreCompPtr comp = castedComp; #endif xmlXPathObjectPtr res = NULL; - xmlNodePtr copy = NULL; xmlChar *value = NULL; xmlDocPtr oldXPContextDoc; xmlNsPtr *oldXPNamespaces; @@ -4437,8 +4543,7 @@ goto error; } if (value[0] != 0) { - copy = xsltCopyTextString(ctxt, - ctxt->insert, value, comp->noescape); + xsltCopyTextString(ctxt, ctxt->insert, value, comp->noescape); } } else { xsltTransformError(ctxt, NULL, inst, @@ -4832,7 +4937,10 @@ list = xmlXPathNodeSetCreate(NULL); if (list == NULL) goto error; - cur = node->children; + if (node->type != XML_NAMESPACE_DECL) + cur = node->children; + else + cur = NULL; while (cur != NULL) { switch (cur->type) { case XML_TEXT_NODE: @@ -4881,6 +4989,8 @@ if (cur->prev != NULL) cur->prev->next = cur->next; break; + case XML_NAMESPACE_DECL: + break; default: #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, Index: dll/3rdparty/libxslt/variables.c =================================================================== --- dll/3rdparty/libxslt/variables.c (revision 58297) +++ dll/3rdparty/libxslt/variables.c (working copy) @@ -675,6 +675,9 @@ return(NULL); } +#ifdef XSLT_REFACTORED +#else + /** * xsltCheckStackElem: * @ctxt: xn XSLT transformation context @@ -710,6 +713,8 @@ return(1); } +#endif /* XSLT_REFACTORED */ + /** * xsltAddStackElem: * @ctxt: xn XSLT transformation context @@ -1045,7 +1050,11 @@ #endif oldInst = ctxt->inst; +#ifdef XSLT_REFACTORED + comp = (xsltStyleBasicItemVariablePtr) elem->comp; +#else comp = elem->comp; +#endif oldVarName = elem->name; elem->name = xsltComputingGlobalVarMarker; /* @@ -1926,7 +1935,7 @@ the instruction itself. */ xsltStackElemPtr param = NULL; - if ((ctxt == NULL) || (inst == NULL)) + if ((ctxt == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return(NULL); #ifdef XSLT_REFACTORED @@ -1985,7 +1994,7 @@ xsltStylePreCompPtr comp; #endif - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -2047,7 +2056,7 @@ xsltStylePreCompPtr comp; #endif - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED @@ -2110,7 +2119,7 @@ xsltStylePreCompPtr comp; #endif - if ((inst == NULL) || (ctxt == NULL)) + if ((inst == NULL) || (ctxt == NULL) || (inst->type != XML_ELEMENT_NODE)) return; comp = inst->psvi; @@ -2152,7 +2161,7 @@ xsltStylePreCompPtr comp; #endif - if ((cur == NULL) || (ctxt == NULL)) + if ((cur == NULL) || (ctxt == NULL) || (cur->type != XML_ELEMENT_NODE)) return; comp = cur->psvi; Index: dll/3rdparty/libxslt/win32config.h =================================================================== --- dll/3rdparty/libxslt/win32config.h (revision 58297) +++ dll/3rdparty/libxslt/win32config.h (working copy) @@ -95,5 +95,9 @@ #define ATTRIBUTE_UNUSED #endif +#ifndef __REACTOS__ +#define _WINSOCKAPI_ +#endif + #endif /* __LIBXSLT_WIN32_CONFIG__ */ Index: dll/3rdparty/libxslt/xslt.c =================================================================== --- dll/3rdparty/libxslt/xslt.c (revision 58297) +++ dll/3rdparty/libxslt/xslt.c (working copy) @@ -243,6 +243,10 @@ */ void xsltUninit (void) { +#ifdef XSLT_LOCALE_WINAPI + xmlFreeRMutex(xsltLocaleMutex); + xsltLocaleMutex = NULL; +#endif initialized = 0; } @@ -417,6 +421,11 @@ if (template->modeURI) xmlFree(template->modeURI); */ if (template->inheritedNs) xmlFree(template->inheritedNs); + + /* free profiling data */ + if (template->templCalledTab) xmlFree(template->templCalledTab); + if (template->templCountTab) xmlFree(template->templCountTab); + memset(template, -1, sizeof(xsltTemplate)); xmlFree(template); } @@ -749,6 +758,7 @@ ret->extrasNr = 0; ret->internalized = 1; ret->literal_result = 0; + ret->forwards_compatible = 0; ret->dict = xmlDictCreate(); #ifdef WITH_XSLT_DEBUG xsltGenericDebug(xsltGenericDebugContext, @@ -1153,7 +1163,7 @@ xmlChar *element, *end; - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; prop = xmlGetNsProp(cur, (const xmlChar *) "version", NULL); @@ -1369,7 +1379,7 @@ xsltDecimalFormatPtr format; xsltDecimalFormatPtr iter; - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; format = style->decimalFormat; @@ -1475,7 +1485,7 @@ xmlChar *elements; xmlChar *element, *end; - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL); @@ -1549,7 +1559,7 @@ xmlChar *prefixes; xmlChar *prefix, *end; - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; if (isXsltElem) { @@ -1614,7 +1624,7 @@ xmlChar *elements; xmlChar *element, *end; - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL); @@ -1687,7 +1697,7 @@ xmlChar *prefixes; xmlChar *prefix, *end; - if ((cur == NULL) || (style == NULL)) + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return(0); if (isXsltElem) @@ -2432,13 +2442,13 @@ "xsltCompilerNodePop: Depth mismatch.\n"); goto mismatch; } + cctxt->depth--; /* * Pop information of variables. */ if ((cctxt->ivar) && (cctxt->ivar->depth > cctxt->depth)) xsltCompilerVarInfoPop(cctxt); - cctxt->depth--; cctxt->inode = cctxt->inode->prev; if (cctxt->inode != NULL) cctxt->inode->curChildType = 0; @@ -4278,7 +4288,7 @@ xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { - if ((cctxt == NULL) || (node == NULL)) + if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) return(-1); /* @@ -4375,7 +4385,7 @@ if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) { cctxt->inode->extContentHandled = 1; } - if (cur == NULL) + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return; /* * This is the content reffered to as a "template". @@ -4780,7 +4790,8 @@ */ void xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { - if ((style == NULL) || (templ == NULL)) + if ((style == NULL) || (templ == NULL) || + (templ->type == XML_NAMESPACE_DECL)) return; /* @@ -4829,6 +4840,10 @@ void xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { xmlNodePtr cur, delete; + + if ((style == NULL) || (templ == NULL) || + (templ->type == XML_NAMESPACE_DECL)) return; + /* * This content comes from the stylesheet * For stylesheets, the set of whitespace-preserving @@ -5048,7 +5063,7 @@ xmlChar *name = NULL; xmlChar *nameURI = NULL; - if ((style == NULL) || (key == NULL)) + if ((style == NULL) || (key == NULL) || (key->type != XML_ELEMENT_NODE)) return; /* @@ -5138,7 +5153,8 @@ xmlChar *prop; double priority; - if ((cctxt == NULL) || (templNode == NULL)) + if ((cctxt == NULL) || (templNode == NULL) || + (templNode->type != XML_ELEMENT_NODE)) return; /* @@ -5167,7 +5183,7 @@ /* * TODO: We need a standardized function for extraction * of namespace names and local names from QNames. - * Don't use xsltGetQNameURI() as it cannot channeö + * Don't use xsltGetQNameURI() as it cannot channe� * reports through the context. */ modeURI = xsltGetQNameURI(templNode, &prop); @@ -5299,7 +5315,8 @@ xmlChar *modeURI = NULL; double priority; - if (template == NULL) + if ((style == NULL) || (template == NULL) || + (template->type != XML_ELEMENT_NODE)) return; /* @@ -5431,7 +5448,7 @@ xsltCompileXSLTIncludeElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { xsltStyleItemIncludePtr item; - if ((cctxt == NULL) || (node == NULL)) + if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) return(NULL); node->psvi = NULL; @@ -5951,7 +5968,7 @@ { xmlNodePtr cur, start; - if ((cctxt == NULL) || (node == NULL)) + if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) return(-1); if (node->children == NULL) @@ -6039,7 +6056,7 @@ int templates = 0; #endif - if (top == NULL) + if ((top == NULL) || (top->type != XML_ELEMENT_NODE)) return; prop = xmlGetNsProp(top, (const xmlChar *)"version", NULL); @@ -6052,8 +6069,10 @@ (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) { xsltTransformError(NULL, style, top, "xsl:version: only 1.0 features are supported\n"); - /* TODO set up compatibility when not XSLT 1.0 */ - if (style != NULL) style->warnings++; + if (style != NULL) { + style->forwards_compatible = 1; + style->warnings++; + } } xmlFree(prop); } @@ -6147,12 +6166,7 @@ } else if (IS_XSLT_NAME(cur, "namespace-alias")) { xsltNamespaceAlias(style, cur); } else { - /* - * BUG TODO: The version of the *doc* is irrelevant for - * the forwards-compatible mode. - */ - if ((style != NULL) && (style->doc->version != NULL) && - (!strncmp((const char *) style->doc->version, "1.0", 3))) { + if ((style != NULL) && (style->forwards_compatible == 0)) { xsltTransformError(NULL, style, cur, "xsltParseStylesheetTop: unknown %s element\n", cur->name); Index: dll/3rdparty/libxslt/xsltlocale.c =================================================================== --- dll/3rdparty/libxslt/xsltlocale.c (revision 58297) +++ dll/3rdparty/libxslt/xsltlocale.c (working copy) @@ -26,9 +26,9 @@ #define LC_COLLATE_MASK (1 << LC_COLLATE) #endif -#define ISALPHA(c) ((c & 0xc0) == 0x40 && (unsigned)((c & 0x1f) - 1) < 26) #define TOUPPER(c) (c & ~0x20) #define TOLOWER(c) (c | 0x20) +#define ISALPHA(c) ((unsigned)(TOUPPER(c) - 'A') < 26) /*without terminating null character*/ #define XSLTMAX_ISO639LANGLEN 8 @@ -67,6 +67,21 @@ #endif /** + * xsltFreeLocales: + * + * Cleanup function for the locale support on shutdown + */ +void +xsltFreeLocales(void) { +#ifdef XSLT_LOCALE_WINAPI + xmlRMutexLock(xsltLocaleMutex); + xmlFree(xsltLocaleList); + xsltLocaleList = NULL; + xmlRMutexUnlock(xsltLocaleMutex); +#endif +} + +/** * xsltNewLocale: * @languageTag: RFC 3066 language tag * @@ -97,11 +112,11 @@ return(NULL); llen = i; - *q++ = '_'; if (*p) { if (*p++ != '-') return(NULL); + *q++ = '_'; for (i=0; i +#include #ifdef HAVE_SYS_TIME_H #include #endif @@ -90,10 +91,15 @@ if ((node == NULL) || (style == NULL) || (style->dict == NULL)) return(NULL); - prop = node->properties; - if (nameSpace == NULL) { + if (nameSpace == NULL) return xmlGetProp(node, name); - } + + if (node->type == XML_NAMESPACE_DECL) + return(NULL); + if (node->type == XML_ELEMENT_NODE) + prop = node->properties; + else + prop = NULL; while (prop != NULL) { /* * One need to have @@ -172,7 +178,15 @@ if (node == NULL) return(NULL); - prop = node->properties; + if (nameSpace == NULL) + return xmlGetProp(node, name); + + if (node->type == XML_NAMESPACE_DECL) + return(NULL); + if (node->type == XML_ELEMENT_NODE) + prop = node->properties; + else + prop = NULL; /* * TODO: Substitute xmlGetProp() for xmlGetNsProp(), since the former * is not namespace-aware and will return an attribute with equal @@ -182,8 +196,6 @@ * So this would return "myName" even if an attribute @name * in the XSLT was requested. */ - if (nameSpace == NULL) - return(xmlGetProp(node, name)); while (prop != NULL) { /* * One need to have @@ -1537,9 +1549,11 @@ if (omitXmlDecl != 1) { xmlOutputBufferWriteString(buf, "version != NULL) - xmlBufferWriteQuotedString(buf->buffer, result->version); - else + if (result->version != NULL) { + xmlOutputBufferWriteString(buf, "\""); + xmlOutputBufferWriteString(buf, (const char *)result->version); + xmlOutputBufferWriteString(buf, "\""); + } else xmlOutputBufferWriteString(buf, "\"1.0\""); if (encoding == NULL) { if (result->encoding != NULL) @@ -1551,7 +1565,9 @@ } if (encoding != NULL) { xmlOutputBufferWriteString(buf, " encoding="); - xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding); + xmlOutputBufferWriteString(buf, "\""); + xmlOutputBufferWriteString(buf, (const char *) encoding); + xmlOutputBufferWriteString(buf, "\""); } switch (standalone) { case 0: @@ -1571,13 +1587,14 @@ while (child != NULL) { xmlNodeDumpOutput(buf, result, child, 0, (indent == 1), (const char *) encoding); - if ((child->type == XML_DTD_NODE) || + if (indent && ((child->type == XML_DTD_NODE) || ((child->type == XML_COMMENT_NODE) && - (child->next != NULL))) + (child->next != NULL)))) xmlOutputBufferWriteString(buf, "\n"); child = child->next; } - xmlOutputBufferWriteString(buf, "\n"); + if (indent) + xmlOutputBufferWriteString(buf, "\n"); } xmlOutputBufferFlush(buf); } @@ -1754,13 +1771,23 @@ if (buf == NULL) return(-1); xsltSaveResultTo(buf, result, style); +#ifdef LIBXML2_NEW_BUFFER if (buf->conv != NULL) { + *doc_txt_len = xmlBufUse(buf->conv); + *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->conv), *doc_txt_len); + } else { + *doc_txt_len = xmlBufUse(buf->buffer); + *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->buffer), *doc_txt_len); + } +#else + if (buf->conv != NULL) { *doc_txt_len = buf->conv->use; *doc_txt_ptr = xmlStrndup(buf->conv->content, *doc_txt_len); } else { *doc_txt_len = buf->buffer->use; *doc_txt_ptr = xmlStrndup(buf->buffer->content, *doc_txt_len); } +#endif (void)xmlOutputBufferClose(buf); return 0; } @@ -1840,7 +1867,35 @@ return (long) (seconds * XSLT_TIMESTAMP_TICS_PER_SEC); #else /* XSLT_WIN32_PERFORMANCE_COUNTER */ -#ifdef HAVE_GETTIMEOFDAY +#ifdef HAVE_CLOCK_GETTIME +# if defined(CLOCK_MONOTONIC) +# define XSLT_CLOCK CLOCK_MONOTONIC +# elif defined(CLOCK_HIGHRES) +# define XSLT_CLOCK CLOCK_HIGHRES +# else +# define XSLT_CLOCK CLOCK_REALTIME +# endif + static struct timespec startup; + struct timespec cur; + long tics; + + if (calibration < 0) { + clock_gettime(XSLT_CLOCK, &startup); + calibration = 0; + calibration = xsltCalibrateTimestamps(); + clock_gettime(XSLT_CLOCK, &startup); + return (0); + } + + clock_gettime(XSLT_CLOCK, &cur); + tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC; + tics += (cur.tv_nsec - startup.tv_nsec) / + (1000000000l / XSLT_TIMESTAMP_TICS_PER_SEC); + + tics -= calibration; + return(tics); + +#elif HAVE_GETTIMEOFDAY static struct timeval startup; struct timeval cur; long tics; @@ -1870,6 +1925,30 @@ #endif /* XSLT_WIN32_PERFORMANCE_COUNTER */ } +static char * +pretty_templ_match(xsltTemplatePtr templ) { + static char dst[1001]; + char *src = (char *)templ->match; + int i=0,j; + + /* strip white spaces */ + for (j=0; i<1000 && src[j]; i++,j++) { + for(;src[j]==' ';j++); + dst[i]=src[j]; + } + if(i<998 && templ->mode) { + /* append [mode] */ + dst[i++]='['; + src=(char *)templ->mode; + for (j=0; i<999 && src[j]; i++,j++) { + dst[i]=src[j]; + } + dst[i++]=']'; + } + dst[i]='\0'; + return dst; +} + #define MAX_TEMPLATES 10000 /** @@ -1881,13 +1960,14 @@ */ void xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) { - int nb, i,j; + int nb, i,j,k,l; int max; int total; long totalt; xsltTemplatePtr *templates; xsltStylesheetPtr style; - xsltTemplatePtr template; + xsltTemplatePtr templ1,templ2; + int *childt; if ((output == NULL) || (ctxt == NULL)) return; @@ -1902,14 +1982,14 @@ style = ctxt->style; while (style != NULL) { - template = style->templates; - while (template != NULL) { + templ1 = style->templates; + while (templ1 != NULL) { if (nb >= max) break; - if (template->nbCalls > 0) - templates[nb++] = template; - template = template->next; + if (templ1->nbCalls > 0) + templates[nb++] = templ1; + templ1 = templ1->next; } style = xsltNextImport(style); @@ -1920,51 +2000,154 @@ if ((templates[i]->time <= templates[j]->time) || ((templates[i]->time == templates[j]->time) && (templates[i]->nbCalls <= templates[j]->nbCalls))) { - template = templates[j]; + templ1 = templates[j]; templates[j] = templates[i]; - templates[i] = template; + templates[i] = templ1; } } } + + /* print flat profile */ + fprintf(output, "%6s%20s%20s%10s Calls Tot 100us Avg\n\n", "number", "match", "name", "mode"); total = 0; totalt = 0; for (i = 0;i < nb;i++) { + templ1 = templates[i]; fprintf(output, "%5d ", i); - if (templates[i]->match != NULL) { - if (xmlStrlen(templates[i]->match) > 20) - fprintf(output, "%s\n%26s", templates[i]->match, ""); + if (templ1->match != NULL) { + if (xmlStrlen(templ1->match) > 20) + fprintf(output, "%s\n%26s", templ1->match, ""); else - fprintf(output, "%20s", templates[i]->match); + fprintf(output, "%20s", templ1->match); } else { fprintf(output, "%20s", ""); } - if (templates[i]->name != NULL) { - if (xmlStrlen(templates[i]->name) > 20) - fprintf(output, "%s\n%46s", templates[i]->name, ""); + if (templ1->name != NULL) { + if (xmlStrlen(templ1->name) > 20) + fprintf(output, "%s\n%46s", templ1->name, ""); else - fprintf(output, "%20s", templates[i]->name); + fprintf(output, "%20s", templ1->name); } else { fprintf(output, "%20s", ""); } - if (templates[i]->mode != NULL) { - if (xmlStrlen(templates[i]->mode) > 10) - fprintf(output, "%s\n%56s", templates[i]->mode, ""); + if (templ1->mode != NULL) { + if (xmlStrlen(templ1->mode) > 10) + fprintf(output, "%s\n%56s", templ1->mode, ""); else - fprintf(output, "%10s", templates[i]->mode); + fprintf(output, "%10s", templ1->mode); } else { fprintf(output, "%10s", ""); } - fprintf(output, " %6d", templates[i]->nbCalls); - fprintf(output, " %6ld %6ld\n", templates[i]->time, - templates[i]->time / templates[i]->nbCalls); - total += templates[i]->nbCalls; - totalt += templates[i]->time; + fprintf(output, " %6d", templ1->nbCalls); + fprintf(output, " %6ld %6ld\n", templ1->time, + templ1->time / templ1->nbCalls); + total += templ1->nbCalls; + totalt += templ1->time; } fprintf(output, "\n%30s%26s %6d %6ld\n", "Total", "", total, totalt); + + /* print call graph */ + + childt = xmlMalloc((nb + 1) * sizeof(int)); + if (childt == NULL) + return; + + /* precalculate children times */ + for (i = 0; i < nb; i++) { + templ1 = templates[i]; + + childt[i] = 0; + for (k = 0; k < nb; k++) { + templ2 = templates[k]; + for (l = 0; l < templ2->templNr; l++) { + if (templ2->templCalledTab[l] == templ1) { + childt[i] +=templ2->time; + } + } + } + } + childt[i] = 0; + + fprintf(output, "\nindex %% time self children called name\n"); + + for (i = 0; i < nb; i++) { + char ix_str[20], timep_str[20], times_str[20], timec_str[20], called_str[20]; + int t; + + templ1 = templates[i]; + /* callers */ + for (j = 0; j < templ1->templNr; j++) { + templ2 = templ1->templCalledTab[j]; + for (k = 0; k < nb; k++) { + if (templates[k] == templ2) + break; + } + t=templ2?templ2->time:totalt; + sprintf(times_str,"%8.3f",(float)t/XSLT_TIMESTAMP_TICS_PER_SEC); + sprintf(timec_str,"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC); + sprintf(called_str,"%6d/%d", + templ1->templCountTab[j], /* number of times caller calls 'this' */ + templ1->nbCalls); /* total number of calls to 'this' */ + + fprintf(output, " %-8s %-8s %-12s %s [%d]\n", + times_str,timec_str,called_str, + (templ2?(templ2->name?(char *)templ2->name:pretty_templ_match(templ2)):"-"),k); + } + /* this */ + sprintf(ix_str,"[%d]",i); + sprintf(timep_str,"%6.2f",(float)templ1->time*100.0/totalt); + sprintf(times_str,"%8.3f",(float)templ1->time/XSLT_TIMESTAMP_TICS_PER_SEC); + sprintf(timec_str,"%8.3f",(float)childt[i]/XSLT_TIMESTAMP_TICS_PER_SEC); + fprintf(output, "%-5s %-6s %-8s %-8s %6d %s [%d]\n", + ix_str, timep_str,times_str,timec_str, + templ1->nbCalls, + templ1->name?(char *)templ1->name:pretty_templ_match(templ1),i); + /* callees + * - go over templates[0..nb] and their templCalledTab[] + * - print those where we in the the call-stack + */ + total = 0; + for (k = 0; k < nb; k++) { + templ2 = templates[k]; + for (l = 0; l < templ2->templNr; l++) { + if (templ2->templCalledTab[l] == templ1) { + total+=templ2->templCountTab[l]; + } + } + } + for (k = 0; k < nb; k++) { + templ2 = templates[k]; + for (l = 0; l < templ2->templNr; l++) { + if (templ2->templCalledTab[l] == templ1) { + sprintf(times_str,"%8.3f",(float)templ2->time/XSLT_TIMESTAMP_TICS_PER_SEC); + sprintf(timec_str,"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC); + sprintf(called_str,"%6d/%d", + templ2->templCountTab[l], /* number of times 'this' calls callee */ + total); /* total number of calls from 'this' */ + fprintf(output, " %-8s %-8s %-12s %s [%d]\n", + times_str,timec_str,called_str, + templ2->name?(char *)templ2->name:pretty_templ_match(templ2),k); + } + } + } + fprintf(output, "-----------------------------------------------\n"); + } + + fprintf(output, "\f\nIndex by function name\n"); + for (i = 0; i < nb; i++) { + templ1 = templates[i]; + fprintf(output, "[%d] %s (%s:%d)\n", + i, templ1->name?(char *)templ1->name:pretty_templ_match(templ1), + templ1->style->doc->URL,templ1->elem->line); + } + + fprintf(output, "\f\n"); + xmlFree(childt); + xmlFree(templates); } @@ -2090,9 +2273,10 @@ ************************************************************************/ /** - * xsltXPathCompile: + * xsltXPathCompileFlags: * @style: the stylesheet * @str: the XPath expression + * @flags: extra compilation flags to pass down to libxml2 XPath * * Compile an XPath expression * @@ -2100,7 +2284,7 @@ * the caller has to free the object. */ xmlXPathCompExprPtr -xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) { +xsltXPathCompileFlags(xsltStylesheetPtr style, const xmlChar *str, int flags) { xmlXPathContextPtr xpathCtxt; xmlXPathCompExprPtr ret; @@ -2132,6 +2316,8 @@ if (xpathCtxt == NULL) return NULL; } + xpathCtxt->flags = flags; + /* * Compile the expression. */ @@ -2152,6 +2338,21 @@ return(ret); } +/** + * xsltXPathCompile: + * @style: the stylesheet + * @str: the XPath expression + * + * Compile an XPath expression + * + * Returns the xmlXPathCompExprPtr resulting from the compilation or NULL. + * the caller has to free the object. + */ +xmlXPathCompExprPtr +xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) { + return(xsltXPathCompileFlags(style, str, 0)); +} + /************************************************************************ * * * Hooks for the debugger * Index: dll/3rdparty/libxslt/xsltwin32config.h =================================================================== --- dll/3rdparty/libxslt/xsltwin32config.h (revision 58293) +++ dll/3rdparty/libxslt/xsltwin32config.h (working copy) @@ -23,21 +23,21 @@ * * the version string like "1.2.3" */ -#define LIBXSLT_DOTTED_VERSION "1.1.26" +#define LIBXSLT_DOTTED_VERSION "1.1.28" /** * LIBXSLT_VERSION: * * the version number: 1.2.3 value is 1002003 */ -#define LIBXSLT_VERSION 10126 +#define LIBXSLT_VERSION 10128 /** * LIBXSLT_VERSION_STRING: * * the version number string, 1.2.3 value is "1002003" */ -#define LIBXSLT_VERSION_STRING "10126" +#define LIBXSLT_VERSION_STRING "10128" /** * LIBXSLT_VERSION_EXTRA: Index: include/reactos/libs/libxslt/numbersInternals.h =================================================================== --- include/reactos/libs/libxslt/numbersInternals.h (revision 58297) +++ include/reactos/libs/libxslt/numbersInternals.h (working copy) @@ -17,6 +17,8 @@ extern "C" { #endif +struct _xsltCompMatch; + /** * xsltNumberData: * @@ -37,6 +39,8 @@ int groupingCharacterLen; xmlDocPtr doc; xmlNodePtr node; + struct _xsltCompMatch *countPat; + struct _xsltCompMatch *fromPat; /* * accelerators Index: include/reactos/libs/libxslt/xsltconfig.h =================================================================== --- include/reactos/libs/libxslt/xsltconfig.h (revision 58296) +++ include/reactos/libs/libxslt/xsltconfig.h (working copy) @@ -20,28 +20,28 @@ * * the version string like "1.2.3" */ -#define LIBXSLT_DOTTED_VERSION "1.1.26" +#define LIBXSLT_DOTTED_VERSION "1.1.28" /** * LIBXSLT_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXSLT_VERSION 10126 +#define LIBXSLT_VERSION 10128 /** * LIBXSLT_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXSLT_VERSION_STRING "10126" +#define LIBXSLT_VERSION_STRING "10128" /** * LIBXSLT_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXSLT_VERSION_EXTRA "-GITv1.1.26" +#define LIBXSLT_VERSION_EXTRA "-GITv1.1.27-16-g9382efe" /** * WITH_XSLT_DEBUG: Index: include/reactos/libs/libxslt/xsltInternals.h =================================================================== --- include/reactos/libs/libxslt/xsltInternals.h (revision 58297) +++ include/reactos/libs/libxslt/xsltInternals.h (working copy) @@ -294,6 +294,11 @@ int nbCalls; /* the number of time the template was called */ unsigned long time; /* the time spent in this template */ void *params; /* xsl:param instructions */ + + int templNr; /* Nb of templates in the stack */ + int templMax; /* Size of the templtes stack */ + xsltTemplatePtr *templCalledTab; /* templates called */ + int *templCountTab; /* .. and how often */ }; /** @@ -1630,6 +1635,10 @@ xsltPrincipalStylesheetDataPtr principalData; #endif + /* + * Forwards-compatible processing + */ + int forwards_compatible; }; typedef struct _xsltTransformCache xsltTransformCache; @@ -1775,6 +1784,8 @@ xmlDocPtr localRVTBase; int keyInitLevel; /* Needed to catch recursive keys issues */ int funcLevel; /* Needed to catch recursive functions issues */ + int maxTemplateDepth; + int maxTemplateVars; }; /** @@ -1898,14 +1909,6 @@ XSLTPUBFUN void XSLTCALL xsltReleaseRVT (xsltTransformContextPtr ctxt, xmlDocPtr RVT); -XSLTPUBFUN int XSLTCALL - xsltTransStorageAdd (xsltTransformContextPtr ctxt, - void *id, - void *data); -XSLTPUBFUN void * XSLTCALL - xsltTransStorageRemove (xsltTransformContextPtr ctxt, - void *id); - /* * Extra functions for Attribute Value Templates */ Index: include/reactos/libs/libxslt/xsltlocale.h =================================================================== --- include/reactos/libs/libxslt/xsltlocale.h (revision 58296) +++ include/reactos/libs/libxslt/xsltlocale.h (working copy) @@ -28,11 +28,7 @@ #elif defined(XSLT_LOCALE_WINAPI) -//#include - -#define WIN32_NO_STATUS -#include -#include +#include #include typedef LCID xsltLocale; @@ -57,5 +53,6 @@ void xsltFreeLocale(xsltLocale locale); xsltLocaleChar *xsltStrxfrm(xsltLocale locale, const xmlChar *string); int xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocaleChar *str2); +void xsltFreeLocales(void); #endif /* __XML_XSLTLOCALE_H__ */ Index: include/reactos/libs/libxslt/xsltutils.h =================================================================== --- include/reactos/libs/libxslt/xsltutils.h (revision 58297) +++ include/reactos/libs/libxslt/xsltutils.h (working copy) @@ -52,8 +52,8 @@ * Checks that the element pertains to XSLT namespace. */ #define IS_XSLT_ELEM(n) \ - (((n) != NULL) && ((n)->ns != NULL) && \ - (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) + (((n) != NULL) && ((n)->type == XML_ELEMENT_NODE) && \ + ((n)->ns != NULL) && (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) /** * IS_XSLT_NAME: @@ -242,6 +242,10 @@ XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL xsltXPathCompile (xsltStylesheetPtr style, const xmlChar *str); +XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL + xsltXPathCompileFlags (xsltStylesheetPtr style, + const xmlChar *str, + int flags); /* * Profiling.