[libxml2] Restore context size and position after XPATH_OP_ARG



commit 07def30fa7d5c5aa73e9d522a2e17bfa7a272df8
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Fri Mar 21 19:38:08 2014 +0100

    Restore context size and position after XPATH_OP_ARG
    
    Fixes a bug with predicates:
    https://mail.gnome.org/archives/xml/2014-March/msg00014.html

 xpath.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/xpath.c b/xpath.c
index 89eaba8..dc41ce6 100644
--- a/xpath.c
+++ b/xpath.c
@@ -13594,17 +13594,20 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
            bak = ctxt->context->node;
            pp = ctxt->context->proximityPosition;
            cs = ctxt->context->contextSize;
-            if (op->ch1 != -1)
+            if (op->ch1 != -1) {
                 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
-           ctxt->context->contextSize = cs;
-           ctxt->context->proximityPosition = pp;
-           ctxt->context->node = bak;
-           ctxt->context->doc = bakd;
-           CHECK_ERROR0;
+                ctxt->context->contextSize = cs;
+                ctxt->context->proximityPosition = pp;
+                ctxt->context->node = bak;
+                ctxt->context->doc = bakd;
+               CHECK_ERROR0;
+            }
             if (op->ch2 != -1) {
                 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
-               ctxt->context->doc = bakd;
-               ctxt->context->node = bak;
+                ctxt->context->contextSize = cs;
+                ctxt->context->proximityPosition = pp;
+                ctxt->context->node = bak;
+                ctxt->context->doc = bakd;
                CHECK_ERROR0;
            }
             return (total);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]