aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2024-02-22 15:57:27 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2024-02-23 12:26:54 +0100
commit213ad8bc621d38d9a615bf2cfb98dbccc6332a8c (patch)
tree80041ded453fb095b7e83c33cf5330a233bbf6a5
parent81cd88dbbe2adab24cb78cfe313486fcd6e57171 (diff)
Fix warnings about using deprecated libxml2 API
Remove the call to xmlSubstituteEntitiesDefault(int) and use the new xmlRead*() functions with the replacment option. Change-Id: Id71aac645bb5c92c2d5fb9d77934ed74a5cc8479 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
-rw-r--r--sources/shiboken6/ApiExtractor/docparser.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp7
2 files changed, 6 insertions, 9 deletions
diff --git a/sources/shiboken6/ApiExtractor/docparser.cpp b/sources/shiboken6/ApiExtractor/docparser.cpp
index f275c4eee..468fe1098 100644
--- a/sources/shiboken6/ApiExtractor/docparser.cpp
+++ b/sources/shiboken6/ApiExtractor/docparser.cpp
@@ -51,13 +51,7 @@ static void removeNonXpathDocModifications(DocModificationList *l)
l->erase(std::remove_if(l->begin(), l->end(), isNotXpathDocModification), l->end());
}
-DocParser::DocParser()
-{
-#ifdef HAVE_LIBXSLT
- xmlSubstituteEntitiesDefault(1);
-#endif
-}
-
+DocParser::DocParser() = default;
DocParser::~DocParser() = default;
void DocParser::fillGlobalFunctionDocumentation(const AbstractMetaFunctionPtr &)
diff --git a/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp b/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
index 4ea93b929..5a9a26913 100644
--- a/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
+++ b/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
@@ -139,7 +139,8 @@ QString LibXmlXQuery::doEvaluate(const QString &xPathExpression, QString *errorM
std::shared_ptr<XQuery> libXml_createXQuery(const QString &focus, QString *errorMessage)
{
- XmlDocUniquePtr doc(xmlParseFile(QFile::encodeName(focus).constData()));
+ XmlDocUniquePtr doc(xmlReadFile(QFile::encodeName(focus).constData(),
+ "utf-8", XML_PARSE_NOENT));
if (!doc) {
*errorMessage = u"libxml2: Cannot set focus to "_s + QDir::toNativeSeparators(focus);
return {};
@@ -167,7 +168,9 @@ QString libXslt_transform(const QString &xml, QString xsl, QString *errorMessage
xsl.append(u"</xsl:transform>"_s);
}
const QByteArray xmlData = xml.toUtf8();
- XmlDocUniquePtr xmlDoc(xmlParseMemory(xmlData.constData(), xmlData.size()));
+
+ XmlDocUniquePtr xmlDoc(xmlReadMemory(xmlData.constData(), int(xmlData.size()),
+ "", "utf-8", XML_PARSE_NOENT));
if (!xmlDoc) {
*errorMessage = u"xmlParseMemory() failed for XML."_s;
return xml;