mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
Fix bug #76927 forgot to save some context when evaluating binary
* xpath.c: Fix bug #76927 forgot to save some context when evaluating binary expressions Daniel
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
Fri Mar 29 18:25:54 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xpath.c: Fix bug #76927 forgot to save some context
|
||||||
|
when evaluating binary expressions
|
||||||
|
|
||||||
Thu Mar 28 19:22:48 CET 2002 Daniel Veillard <daniel@veillard.com>
|
Thu Mar 28 19:22:48 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* configure.in: fixed configure for MPE/iX from Markus Henke
|
* configure.in: fixed configure for MPE/iX from Markus Henke
|
||||||
|
33
xpath.c
33
xpath.c
@ -9529,6 +9529,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
|||||||
int equal, ret;
|
int equal, ret;
|
||||||
xmlXPathCompExprPtr comp;
|
xmlXPathCompExprPtr comp;
|
||||||
xmlXPathObjectPtr arg1, arg2;
|
xmlXPathObjectPtr arg1, arg2;
|
||||||
|
xmlNodePtr bak;
|
||||||
|
xmlDocPtr bakd;
|
||||||
|
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
comp = ctxt->comp;
|
comp = ctxt->comp;
|
||||||
@ -9536,12 +9538,16 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
|||||||
case XPATH_OP_END:
|
case XPATH_OP_END:
|
||||||
return (0);
|
return (0);
|
||||||
case XPATH_OP_AND:
|
case XPATH_OP_AND:
|
||||||
|
bakd = ctxt->context->doc;
|
||||||
|
bak = ctxt->context->node;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
xmlXPathBooleanFunction(ctxt, 1);
|
xmlXPathBooleanFunction(ctxt, 1);
|
||||||
if ((ctxt->value == NULL) || (ctxt->value->boolval == 0))
|
if ((ctxt->value == NULL) || (ctxt->value->boolval == 0))
|
||||||
return (total);
|
return (total);
|
||||||
arg2 = valuePop(ctxt);
|
arg2 = valuePop(ctxt);
|
||||||
|
ctxt->context->doc = bakd;
|
||||||
|
ctxt->context->node = bak;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
||||||
if (ctxt->error) {
|
if (ctxt->error) {
|
||||||
xmlXPathFreeObject(arg2);
|
xmlXPathFreeObject(arg2);
|
||||||
@ -9554,12 +9560,16 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
|||||||
xmlXPathFreeObject(arg2);
|
xmlXPathFreeObject(arg2);
|
||||||
return (total);
|
return (total);
|
||||||
case XPATH_OP_OR:
|
case XPATH_OP_OR:
|
||||||
|
bakd = ctxt->context->doc;
|
||||||
|
bak = ctxt->context->node;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
xmlXPathBooleanFunction(ctxt, 1);
|
xmlXPathBooleanFunction(ctxt, 1);
|
||||||
if ((ctxt->value == NULL) || (ctxt->value->boolval == 1))
|
if ((ctxt->value == NULL) || (ctxt->value->boolval == 1))
|
||||||
return (total);
|
return (total);
|
||||||
arg2 = valuePop(ctxt);
|
arg2 = valuePop(ctxt);
|
||||||
|
ctxt->context->doc = bakd;
|
||||||
|
ctxt->context->node = bak;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
||||||
if (ctxt->error) {
|
if (ctxt->error) {
|
||||||
xmlXPathFreeObject(arg2);
|
xmlXPathFreeObject(arg2);
|
||||||
@ -9572,8 +9582,12 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
|||||||
xmlXPathFreeObject(arg2);
|
xmlXPathFreeObject(arg2);
|
||||||
return (total);
|
return (total);
|
||||||
case XPATH_OP_EQUAL:
|
case XPATH_OP_EQUAL:
|
||||||
|
bakd = ctxt->context->doc;
|
||||||
|
bak = ctxt->context->node;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
|
ctxt->context->doc = bakd;
|
||||||
|
ctxt->context->node = bak;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
equal = xmlXPathEqualValues(ctxt);
|
equal = xmlXPathEqualValues(ctxt);
|
||||||
@ -9583,18 +9597,27 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
|||||||
valuePush(ctxt, xmlXPathNewBoolean(!equal));
|
valuePush(ctxt, xmlXPathNewBoolean(!equal));
|
||||||
return (total);
|
return (total);
|
||||||
case XPATH_OP_CMP:
|
case XPATH_OP_CMP:
|
||||||
|
bakd = ctxt->context->doc;
|
||||||
|
bak = ctxt->context->node;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
|
ctxt->context->doc = bakd;
|
||||||
|
ctxt->context->node = bak;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
ret = xmlXPathCompareValues(ctxt, op->value, op->value2);
|
ret = xmlXPathCompareValues(ctxt, op->value, op->value2);
|
||||||
valuePush(ctxt, xmlXPathNewBoolean(ret));
|
valuePush(ctxt, xmlXPathNewBoolean(ret));
|
||||||
return (total);
|
return (total);
|
||||||
case XPATH_OP_PLUS:
|
case XPATH_OP_PLUS:
|
||||||
|
bakd = ctxt->context->doc;
|
||||||
|
bak = ctxt->context->node;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
if (op->ch2 != -1)
|
if (op->ch2 != -1) {
|
||||||
|
ctxt->context->doc = bakd;
|
||||||
|
ctxt->context->node = bak;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
||||||
|
}
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
if (op->value == 0)
|
if (op->value == 0)
|
||||||
xmlXPathSubValues(ctxt);
|
xmlXPathSubValues(ctxt);
|
||||||
@ -9608,8 +9631,12 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
|||||||
}
|
}
|
||||||
return (total);
|
return (total);
|
||||||
case XPATH_OP_MULT:
|
case XPATH_OP_MULT:
|
||||||
|
bakd = ctxt->context->doc;
|
||||||
|
bak = ctxt->context->node;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
|
ctxt->context->doc = bakd;
|
||||||
|
ctxt->context->node = bak;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
if (op->value == 0)
|
if (op->value == 0)
|
||||||
@ -9620,8 +9647,12 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
|||||||
xmlXPathModValues(ctxt);
|
xmlXPathModValues(ctxt);
|
||||||
return (total);
|
return (total);
|
||||||
case XPATH_OP_UNION:
|
case XPATH_OP_UNION:
|
||||||
|
bakd = ctxt->context->doc;
|
||||||
|
bak = ctxt->context->node;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
|
ctxt->context->doc = bakd;
|
||||||
|
ctxt->context->node = bak;
|
||||||
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
|
||||||
CHECK_ERROR0;
|
CHECK_ERROR0;
|
||||||
CHECK_TYPE0(XPATH_NODESET);
|
CHECK_TYPE0(XPATH_NODESET);
|
||||||
|
Reference in New Issue
Block a user