Skip to content

Commit 1e5474b

Browse files
authored
Merge pull request OSGeo#13085 from rouault/xmlXPathValuePush
use libxml2 >= 2.14 function names xmlXPathValuePush/xmlXPathValuePop…
2 parents 7050519 + 1138f37 commit 1e5474b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

gcore/gdaljp2metadatagenerator.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
#include <libxml/xpath.h>
3636
#include <libxml/xpathInternals.h>
3737

38+
#if !(defined(LIBXML_VERSION) && LIBXML_VERSION >= 21400)
39+
// Cf https://gitlab.gnome.org/GNOME/libxml2/-/commit/92d7b0cd909beb61cd90d9746964f303eab36d78
40+
#define xmlXPathValuePush valuePush
41+
#define xmlXPathValuePop valuePop
42+
#endif
43+
3844
#ifdef __clang__
3945
#pragma clang diagnostic pop
4046
#endif
@@ -401,20 +407,20 @@ static void GDALGMLJP2XPathIf(xmlXPathParserContextPtr ctxt, int nargs)
401407
xmlXPathObjectPtr cond_val, then_val, else_val;
402408

403409
CHECK_ARITY(3);
404-
else_val = valuePop(ctxt);
405-
then_val = valuePop(ctxt);
410+
else_val = xmlXPathValuePop(ctxt);
411+
then_val = xmlXPathValuePop(ctxt);
406412
CAST_TO_BOOLEAN
407-
cond_val = valuePop(ctxt);
413+
cond_val = xmlXPathValuePop(ctxt);
408414

409415
if (cond_val->boolval)
410416
{
411417
xmlXPathFreeObject(else_val);
412-
valuePush(ctxt, then_val);
418+
xmlXPathValuePush(ctxt, then_val);
413419
}
414420
else
415421
{
416422
xmlXPathFreeObject(then_val);
417-
valuePush(ctxt, else_val);
423+
xmlXPathValuePush(ctxt, else_val);
418424
}
419425
xmlXPathFreeObject(cond_val);
420426
}
@@ -460,8 +466,8 @@ static void GDALGMLJP2XPathUUID(xmlXPathParserContextPtr ctxt, int nargs)
460466
osRet += GDALGMLJP2HexFormatter(fakeRand() & 0xFF);
461467
}
462468

463-
valuePush(ctxt, xmlXPathNewString(
464-
reinterpret_cast<const xmlChar *>(osRet.c_str())));
469+
xmlXPathValuePush(ctxt, xmlXPathNewString(reinterpret_cast<const xmlChar *>(
470+
osRet.c_str())));
465471
}
466472

467473
#endif // LIBXML2

0 commit comments

Comments
 (0)