From cf3cd5c830dfcb6e09073b56f827a2f9e094ea2e Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sat, 6 Jan 2024 09:28:15 +0100 Subject: [PATCH] xslt: use xmlCtxtUseOptions instead of setting deprecated globals --- src/internfile/mh_xslt.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git src/internfile/mh_xslt.cpp src/internfile/mh_xslt.cpp index 1bd8f893..4783be76 100644 --- src/internfile/mh_xslt.cpp +++ src/internfile/mh_xslt.cpp @@ -66,7 +66,7 @@ public: xmlDocPtr getDoc() { int ret; if ((ret = xmlParseChunk(ctxt, nullptr, 0, 1))) { - xmlError *error = xmlGetLastError(); + const xmlError *error = xmlGetLastError(); LOGERR("FileScanXML: final xmlParseChunk failed with error " << ret << " error: " << (error ? error->message : @@ -82,6 +82,10 @@ public: LOGERR("FileScanXML: xmlCreatePushParserCtxt failed\n"); return false; } else { + // Replaces setting global variables through the following in the module init: + // xmlSubstituteEntitiesDefault(0); // No XML_PARSE_NOENT + // xmlLoadExtDtdDefaultValue = 0; // No XML_PARSE_DTDLOAD + xmlCtxtUseOptions(ctxt, 0); return true; } } @@ -95,7 +99,7 @@ public: } int ret; if ((ret = xmlParseChunk(ctxt, buf, cnt, 0))) { - xmlError *error = xmlGetLastError(); + const xmlError *error = xmlGetLastError(); LOGERR("FileScanXML: xmlParseChunk failed with error " << ret << " for [" << buf << "] error " << (error ? error->message : @@ -159,9 +163,6 @@ MimeHandlerXslt::MimeHandlerXslt(RclConfig *cnf, const std::string& id, LOGDEB("MimeHandlerXslt: params: " << stringsToString(params) << endl); m->filtersdir = path_cat(cnf->getDatadir(), "filters"); - xmlSubstituteEntitiesDefault(0); - xmlLoadExtDtdDefaultValue = 0; - // params can be "xslt stylesheetall" or // "xslt meta/body memberpath stylesheetnm [... ... ...] ... if (params.size() == 2) { -- 2.43.2