[libxslt] Fix for compiled XPath helpers
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Fix for compiled XPath helpers
- Date: Fri, 3 Oct 2014 16:20:26 +0000 (UTC)
commit de1fca613ed3a8ab57bb3c83ff71538bd8b347d0
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Fri Oct 3 17:57:46 2014 +0200
Fix for compiled XPath helpers
The helper functions added in commit c618db4 didn't restore context size
and position. Unfortunately, xmlXPathCompiledEval changes these values
in some rare cases.
libxslt/transform.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 07b4e5c..24f9eb2 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -353,10 +353,12 @@ xsltPreCompEval(xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlXPathContextPtr xpctxt;
xmlNodePtr oldXPContextNode;
xmlNsPtr *oldXPNamespaces;
- int oldXPNsNr;
+ int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
xpctxt = ctxt->xpathCtxt;
oldXPContextNode = xpctxt->node;
+ oldXPProximityPosition = xpctxt->proximityPosition;
+ oldXPContextSize = xpctxt->contextSize;
oldXPNsNr = xpctxt->nsNr;
oldXPNamespaces = xpctxt->namespaces;
@@ -377,6 +379,8 @@ xsltPreCompEval(xsltTransformContextPtr ctxt, xmlNodePtr node,
res = xmlXPathCompiledEval(comp->comp, xpctxt);
xpctxt->node = oldXPContextNode;
+ xpctxt->proximityPosition = oldXPProximityPosition;
+ xpctxt->contextSize = oldXPContextSize;
xpctxt->nsNr = oldXPNsNr;
xpctxt->namespaces = oldXPNamespaces;
@@ -398,10 +402,12 @@ xsltPreCompEvalToBoolean(xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlXPathContextPtr xpctxt;
xmlNodePtr oldXPContextNode;
xmlNsPtr *oldXPNamespaces;
- int oldXPNsNr;
+ int oldXPProximityPosition, oldXPContextSize, oldXPNsNr;
xpctxt = ctxt->xpathCtxt;
oldXPContextNode = xpctxt->node;
+ oldXPProximityPosition = xpctxt->proximityPosition;
+ oldXPContextSize = xpctxt->contextSize;
oldXPNsNr = xpctxt->nsNr;
oldXPNamespaces = xpctxt->namespaces;
@@ -422,6 +428,8 @@ xsltPreCompEvalToBoolean(xsltTransformContextPtr ctxt, xmlNodePtr node,
res = xmlXPathCompiledEvalToBoolean(comp->comp, xpctxt);
xpctxt->node = oldXPContextNode;
+ xpctxt->proximityPosition = oldXPProximityPosition;
+ xpctxt->contextSize = oldXPContextSize;
xpctxt->nsNr = oldXPNsNr;
xpctxt->namespaces = oldXPNamespaces;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]