[libxslt] Don't use deprecated XPath macros



commit 5bd67fa13d8fb0a7818c3e3042e0bf9c1cdc273c
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Fri Aug 26 04:50:15 2022 +0200

    Don't use deprecated XPath macros

 libxslt/functions.c | 12 ++++++++----
 libxslt/pattern.c   |  1 -
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/libxslt/functions.c b/libxslt/functions.c
index fa8b6d93..ed2b0023 100644
--- a/libxslt/functions.c
+++ b/libxslt/functions.c
@@ -608,7 +608,8 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
 
     switch (nargs) {
     case 3:
-       CAST_TO_STRING;
+        if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING))
+            xmlXPathStringFunction(ctxt, 1);
        decimalObj = valuePop(ctxt);
         ncname = xsltSplitQName(sheet->dict, decimalObj->stringval, &prefix);
         if (prefix != NULL) {
@@ -634,13 +635,16 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
        }
        /* Intentional fall-through */
     case 2:
-       CAST_TO_STRING;
+        if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING))
+            xmlXPathStringFunction(ctxt, 1);
        formatObj = valuePop(ctxt);
-       CAST_TO_NUMBER;
+        if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER))
+            xmlXPathNumberFunction(ctxt, 1);
        numberObj = valuePop(ctxt);
        break;
     default:
-       XP_ERROR(XPATH_INVALID_ARITY);
+       xmlXPathErr(ctxt, XPATH_INVALID_ARITY);
+        return;
     }
 
     if (formatValues != NULL) {
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index 611bac30..da3444f2 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -1264,7 +1264,6 @@ xsltScanLiteral(xsltParserContextPtr ctxt) {
        cur += len;
        CUR_PTR = cur;
     } else {
-       /* XP_ERROR(XPATH_START_LITERAL_ERROR); */
        ctxt->error = 1;
        return(NULL);
     }


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