Skip to content

Commit 6f67e7e

Browse files
committed
Remove deprecated QLinkedList and QString::sprintf
- Build with QT 5.15.0 - Remove QLinkedList and change to std::list - Remove QString::sprintf and change to QString::arg
1 parent 7e2af9b commit 6f67e7e

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

src/qtsoap.cpp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,9 +2448,14 @@ bool QtSoapMessage::setContent(const QByteArray &buffer)
24482448
if (!doc.setContent(buffer, true, &errorMsg,
24492449
&errorLine, &errorColumn)) {
24502450
QString s;
2451-
s.sprintf("%s at line %i, column %i", errorMsg.toLatin1().constData(),
2452-
errorLine, errorColumn);
2453-
setFaultCode(VersionMismatch);
2451+
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
2452+
s.sprintf("%s at line %i, column %i", errorMsg.toLatin1().constData(),
2453+
errorLine, errorColumn);
2454+
#else
2455+
s = "%1 at line %2, column %3";
2456+
s = s.arg(errorMsg.toLatin1().constData()).arg(errorLine).arg(errorColumn);
2457+
#endif
2458+
setFaultCode(VersionMismatch);
24542459
setFaultString("XML parse error");
24552460
addFaultDetail(new QtSoapSimpleType(QtSoapQName("ParseError"), s));
24562461
return false;
@@ -2902,11 +2907,23 @@ void QtSoapMessage::addMethodArgument(const QString &name, const QString &uri, i
29022907
QtSoapTypeFactory::QtSoapTypeFactory()
29032908
{
29042909
QtSoapTypeConstructor<QtSoapStruct> *structConstructor = new QtSoapTypeConstructor<QtSoapStruct>();
2910+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
29052911
deleteList.append(structConstructor);
2912+
#else
2913+
deleteList.push_back(structConstructor);
2914+
#endif
29062915
QtSoapTypeConstructor<QtSoapArray> *arrayConstructor = new QtSoapTypeConstructor<QtSoapArray>();
2916+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
29072917
deleteList.append(arrayConstructor);
2918+
#else
2919+
deleteList.push_back(arrayConstructor);
2920+
#endif
29082921
QtSoapTypeConstructor<QtSoapSimpleType> *basicTypeConstructor = new QtSoapTypeConstructor<QtSoapSimpleType>();
2922+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
29092923
deleteList.append(basicTypeConstructor);
2924+
#else
2925+
deleteList.push_back(basicTypeConstructor);
2926+
#endif
29102927

29112928
registerHandler("struct", structConstructor);
29122929
registerHandler("array", arrayConstructor);
@@ -2947,7 +2964,11 @@ QtSoapTypeFactory::QtSoapTypeFactory()
29472964
*/
29482965
QtSoapTypeFactory::~QtSoapTypeFactory()
29492966
{
2950-
QLinkedList<QtSoapTypeConstructorBase*>::ConstIterator it = deleteList.begin();
2967+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
2968+
QLinkedList<QtSoapTypeConstructorBase *>::ConstIterator it = deleteList.begin();
2969+
#else
2970+
std::list<QtSoapTypeConstructorBase *>::const_iterator it = deleteList.begin();
2971+
#endif
29512972
while (it != deleteList.end()) {
29522973
delete *it;
29532974
++it;

src/qtsoap.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545
#include <QtNetwork/QNetworkAccessManager>
4646
#include <QtCore/QUrl>
4747
#include <QtCore/QHash>
48-
#include <QtCore/QLinkedList>
48+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
49+
# include <QtCore/QLinkedList>
50+
#else
51+
# include <list>
52+
#endif
4953
#include <QtCore/QPointer>
5054

5155
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
@@ -556,7 +560,11 @@ class QT_QTSOAP_EXPORT QtSoapTypeFactory
556560
private:
557561
mutable QString errorStr;
558562
QHash<QString, QtSoapTypeConstructorBase *> typeHandlers;
563+
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
559564
QLinkedList<QtSoapTypeConstructorBase*> deleteList;
565+
#else
566+
std::list<QtSoapTypeConstructorBase *> deleteList;
567+
#endif
560568
};
561569

562570
class QT_QTSOAP_EXPORT QtSoapNamespaces

0 commit comments

Comments
 (0)