From 9284d6b6462b4a6ce2d0b49995dffbfa2d405597 Mon Sep 17 00:00:00 2001 From: Jonathan Brady Date: Mon, 16 Jun 2025 13:14:25 +0100 Subject: [PATCH 1/2] Replace deprecated functions. --- schema/parser.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/schema/parser.cpp b/schema/parser.cpp index f569815..2f67fcd 100644 --- a/schema/parser.cpp +++ b/schema/parser.cpp @@ -1131,6 +1131,7 @@ void Parser::importSchema(ParserContext *context, const QString &location) } QDomDocument doc(QLatin1String("kwsdl")); +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) QString errorMsg; int errorLine, errorColumn; bool ok = doc.setContent(&file, false, &errorMsg, &errorLine, &errorColumn); @@ -1138,6 +1139,12 @@ void Parser::importSchema(ParserContext *context, const QString &location) qDebug("Error[%d:%d] %s", errorLine, errorColumn, qPrintable(errorMsg)); return; } +#else + if (auto result = doc.setContent(&file); !result) { + qDebug("Error[%lld:%lld] %s", result.errorLine, result.errorColumn, qPrintable(result.errorMessage)); + return; + } +#endif QDomElement node = doc.documentElement(); @@ -1172,6 +1179,7 @@ void Parser::includeSchema(ParserContext *context, const QString &location) } QDomDocument doc(QLatin1String("kwsdl")); +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) QString errorMsg; int errorLine, errorColumn; bool ok = doc.setContent(&file, false, &errorMsg, &errorLine, &errorColumn); @@ -1179,6 +1187,12 @@ void Parser::includeSchema(ParserContext *context, const QString &location) qDebug("Error[%d:%d] %s", errorLine, errorColumn, qPrintable(errorMsg)); return; } +#else + if (auto result = doc.setContent(&file); !result) { + qDebug("Error[%lld:%lld] %s", result.errorLine, result.errorColumn, qPrintable(result.errorMessage)); + return; + } +#endif QDomElement node = doc.documentElement(); NSManager namespaceManager(context, node); @@ -1400,13 +1414,20 @@ bool Parser::parse(ParserContext *context, QIODevice *sourceDevice) { QDomDocument document(QLatin1String("KWSDL")); + QDomDocument doc; +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) QString errorMsg; int errorLine, errorCol; - QDomDocument doc; if (!doc.setContent(sourceDevice, false, &errorMsg, &errorLine, &errorCol)) { qDebug("%s at (%d,%d)", qPrintable(errorMsg), errorLine, errorCol); return false; } +#else + if (auto result = doc.setContent(sourceDevice); !result) { + qDebug("%s at (%lld,%lld)", qPrintable(result.errorMessage), result.errorLine, result.errorColumn); + return false; + } +#endif QDomElement element = doc.documentElement(); const QName name = element.tagName(); From 9f49e921494ea8dc1d81d27cbf042eb3ac003b05 Mon Sep 17 00:00:00 2001 From: Jonathan Brady Date: Mon, 16 Jun 2025 19:07:30 +0100 Subject: [PATCH 2/2] Formatting. --- schema/parser.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/schema/parser.cpp b/schema/parser.cpp index 2f67fcd..c843bde 100644 --- a/schema/parser.cpp +++ b/schema/parser.cpp @@ -1141,7 +1141,8 @@ void Parser::importSchema(ParserContext *context, const QString &location) } #else if (auto result = doc.setContent(&file); !result) { - qDebug("Error[%lld:%lld] %s", result.errorLine, result.errorColumn, qPrintable(result.errorMessage)); + qDebug("Error[%lld:%lld] %s", result.errorLine, result.errorColumn, + qPrintable(result.errorMessage)); return; } #endif @@ -1189,7 +1190,8 @@ void Parser::includeSchema(ParserContext *context, const QString &location) } #else if (auto result = doc.setContent(&file); !result) { - qDebug("Error[%lld:%lld] %s", result.errorLine, result.errorColumn, qPrintable(result.errorMessage)); + qDebug("Error[%lld:%lld] %s", result.errorLine, result.errorColumn, + qPrintable(result.errorMessage)); return; } #endif @@ -1424,7 +1426,8 @@ bool Parser::parse(ParserContext *context, QIODevice *sourceDevice) } #else if (auto result = doc.setContent(sourceDevice); !result) { - qDebug("%s at (%lld,%lld)", qPrintable(result.errorMessage), result.errorLine, result.errorColumn); + qDebug("%s at (%lld,%lld)", qPrintable(result.errorMessage), result.errorLine, + result.errorColumn); return false; } #endif