diff options
| author | David Faure <faure@kde.org> | 2020-10-09 09:44:52 +0200 |
|---|---|---|
| committer | LNJ <lnj@kaidan.im> | 2020-10-10 20:12:09 +0200 |
| commit | 2298886f4d75adbc351b448274b39edf54da38ee (patch) | |
| tree | 7bdc2c884b24a7f84807e43ab7eb92ce73cd042f /src/base | |
| parent | aaeeee0e85495d7c706b7a33267ce2cf27244caa (diff) | |
| download | qxmpp-2298886f4d75adbc351b448274b39edf54da38ee.tar.gz | |
Enable -DQURL_NO_CAST_FROM_STRING -DQT_NO_CAST_TO_ASCII
I have those always enabled, which is how I detected these issues. This
avoids QUrl/QString confusions, and QString/QByteArray confusions.
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/QXmppBookmarkSet.cpp | 2 | ||||
| -rw-r--r-- | src/base/QXmppRpcIq.cpp | 2 | ||||
| -rw-r--r-- | src/base/QXmppSasl.cpp | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/base/QXmppBookmarkSet.cpp b/src/base/QXmppBookmarkSet.cpp index f72dcf00..01f8a48e 100644 --- a/src/base/QXmppBookmarkSet.cpp +++ b/src/base/QXmppBookmarkSet.cpp @@ -196,7 +196,7 @@ void QXmppBookmarkSet::parse(const QDomElement &element) } else if (childElement.tagName() == QStringLiteral("url")) { QXmppBookmarkUrl url; url.setName(childElement.attribute(QStringLiteral("name"))); - url.setUrl(childElement.attribute(QStringLiteral("url"))); + url.setUrl(QUrl(childElement.attribute(QStringLiteral("url")))); m_urls << url; } childElement = childElement.nextSiblingElement(); diff --git a/src/base/QXmppRpcIq.cpp b/src/base/QXmppRpcIq.cpp index 40bd1fc6..ea3b9b7f 100644 --- a/src/base/QXmppRpcIq.cpp +++ b/src/base/QXmppRpcIq.cpp @@ -70,7 +70,7 @@ void QXmppRpcMarshaller::marshall(QXmlStreamWriter *writer, const QVariant &valu } case QVariant::Map: { writer->writeStartElement(QStringLiteral("struct")); - QMap<QString, QVariant> map = value.toMap(); + const QMap<QString, QVariant> map = value.toMap(); QMap<QString, QVariant>::ConstIterator index = map.begin(); while (index != map.end()) { writer->writeStartElement(QStringLiteral("member")); diff --git a/src/base/QXmppSasl.cpp b/src/base/QXmppSasl.cpp index 8d5217fb..b045c864 100644 --- a/src/base/QXmppSasl.cpp +++ b/src/base/QXmppSasl.cpp @@ -871,7 +871,7 @@ QMap<QByteArray, QByteArray> QXmppSaslDigestMd5::parseMessage(const QByteArray & QMap<QByteArray, QByteArray> map; int startIndex = 0; int pos = 0; - while ((pos = ba.indexOf(QStringLiteral("="), startIndex)) >= 0) { + while ((pos = ba.indexOf('=', startIndex)) >= 0) { // key get name and skip equals const QByteArray key = ba.mid(startIndex, pos - startIndex).trimmed(); pos++; @@ -927,8 +927,8 @@ QByteArray QXmppSaslDigestMd5::serializeMessage(const QMap<QByteArray, QByteArra if (quote) { value.replace(QByteArrayLiteral("\\"), QByteArrayLiteral("\\\\")); value.replace(QByteArrayLiteral("\""), QByteArrayLiteral("\\\"")); - ba.append(QStringLiteral("\"") + value + QStringLiteral("\"")); - } else + ba.append(QByteArrayLiteral("\"") + value + QByteArrayLiteral("\"")); + } else ba.append(value); } return ba; |
