Changeset 42884 in vbox for trunk/src/libs
- Timestamp:
- Aug 20, 2012 1:35:06 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 80169
- Location:
- trunk/src/libs/libxml2-2.6.31
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/libxml2-2.6.31/include/libxml/xpath.h
r39915 r42884 69 69 XPATH_ENCODING_ERROR, 70 70 XPATH_INVALID_CHAR_ERROR, 71 XPATH_INVALID_CTXT 71 XPATH_INVALID_CTXT, 72 XPATH_STACK_ERROR 72 73 } xmlXPathError; 73 74 … … 378 379 int xptr; /* it this an XPointer expression */ 379 380 xmlNodePtr ancestor; /* used for walking preceding axis */ 381 382 int valueFrame; /* used to limit Pop on the stack */ 380 383 }; 381 384 -
trunk/src/libs/libxml2-2.6.31/xpath.c
r39921 r42884 253 253 "Char out of XML range\n", 254 254 "Invalid or incomplete context\n", 255 "Stack usage errror\n", 255 256 "?? Unknown error ??\n" /* Must be last in the list! */ 256 257 }; … … 2399 2400 2400 2401 /** 2402 * xmlXPathSetFrame: 2403 * @ctxt: an XPath parser context 2404 * 2405 * Set the callee evaluation frame 2406 * 2407 * Returns the previous frame value to be restored once done 2408 */ 2409 static int 2410 xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) { 2411 int ret; 2412 2413 if (ctxt == NULL) 2414 return(0); 2415 ret = ctxt->valueFrame; 2416 ctxt->valueFrame = ctxt->valueNr; 2417 return(ret); 2418 } 2419 2420 /** 2421 * xmlXPathPopFrame: 2422 * @ctxt: an XPath parser context 2423 * @frame: the previous frame value 2424 * 2425 * Remove the callee evaluation frame 2426 */ 2427 static void 2428 xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) { 2429 if (ctxt == NULL) 2430 return; 2431 if (ctxt->valueNr < ctxt->valueFrame) { 2432 xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR); 2433 } 2434 ctxt->valueFrame = frame; 2435 } 2436 2437 /** 2401 2438 * valuePop: 2402 2439 * @ctxt: an XPath evaluation context … … 2413 2450 if ((ctxt == NULL) || (ctxt->valueNr <= 0)) 2414 2451 return (NULL); 2452 2453 if (ctxt->valueNr <= ctxt->valueFrame) { 2454 xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR); 2455 return (NULL); 2456 } 2457 2415 2458 ctxt->valueNr--; 2416 2459 if (ctxt->valueNr > 0) … … 6137 6180 ret->valueMax = 10; 6138 6181 ret->value = NULL; 6182 ret->valueFrame = 0; 6139 6183 6140 6184 ret->context = ctxt; … … 11674 11718 xmlNodePtr oldContextNode, contextNode = NULL; 11675 11719 xmlXPathContextPtr xpctxt = ctxt->context; 11720 int frame; 11676 11721 11677 11722 #ifdef LIBXML_XPTR_ENABLED … … 11693 11738 exprOp = &ctxt->comp->steps[op->ch2]; 11694 11739 for (i = 0; i < set->nodeNr; i++) { 11740 xmlXPathObjectPtr tmp; 11741 11695 11742 if (set->nodeTab[i] == NULL) 11696 11743 continue; … … 11720 11767 contextNode); 11721 11768 11769 frame = xmlXPathSetFrame(ctxt); 11722 11770 valuePush(ctxt, contextObj); 11723 11771 res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); 11724 11772 tmp = valuePop(ctxt); 11773 xmlXPathPopFrame(ctxt, frame); 11774 11725 11775 if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { 11726 xmlXPathObjectPtr tmp; 11727 /* pop the result */ 11728 tmp = valuePop(ctxt); 11729 xmlXPathReleaseObject(xpctxt, tmp); 11730 /* then pop off contextObj, which will be freed later */ 11731 valuePop(ctxt); 11776 while (tmp != contextObj) { 11777 /* 11778 * Free up the result 11779 * then pop off contextObj, which will be freed later 11780 */ 11781 xmlXPathReleaseObject(xpctxt, tmp); 11782 tmp = valuePop(ctxt); 11783 } 11732 11784 goto evaluation_error; 11733 11785 } 11786 /* push the result back onto the stack */ 11787 valuePush(ctxt, tmp); 11734 11788 11735 11789 if (res) … … 13335 13389 const xmlChar *oldFunc, *oldFuncURI; 13336 13390 int i; 13337 13391 int frame; 13392 13393 frame = xmlXPathSetFrame(ctxt); 13338 13394 if (op->ch1 != -1) 13339 13395 total += … … 13343 13399 "xmlXPathCompOpEval: parameter error\n"); 13344 13400 ctxt->error = XPATH_INVALID_OPERAND; 13401 xmlXPathPopFrame(ctxt, frame); 13345 13402 return (total); 13346 13403 } 13347 for (i = 0; i < op->value; i++) 13404 for (i = 0; i < op->value; i++) { 13348 13405 if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) { 13349 13406 xmlGenericError(xmlGenericErrorContext, 13350 13407 "xmlXPathCompOpEval: parameter error\n"); 13351 13408 ctxt->error = XPATH_INVALID_OPERAND; 13409 xmlXPathPopFrame(ctxt, frame); 13352 13410 return (total); 13353 13411 } 13412 } 13354 13413 if (op->cache != NULL) 13355 13414 XML_CAST_FPTR(func) = op->cache; … … 13389 13448 ctxt->context->function = oldFunc; 13390 13449 ctxt->context->functionURI = oldFuncURI; 13450 xmlXPathPopFrame(ctxt, frame); 13391 13451 return (total); 13392 13452 } … … 14293 14353 ctxt->valueMax = 10; 14294 14354 ctxt->value = NULL; 14355 ctxt->valueFrame = 0; 14295 14356 } 14296 14357 #ifdef XPATH_STREAMING -
trunk/src/libs/libxml2-2.6.31/xpointer.c
r42883 r42884 1261 1261 ctxt->valueMax = 10; 1262 1262 ctxt->value = NULL; 1263 ctxt->valueFrame = 0; 1263 1264 } 1264 1265 SKIP_BLANKS;
Note:
See TracChangeset
for help on using the changeset viewer.