aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppStanza.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2023-05-13 17:45:25 +0200
committerLinus Jahn <lnj@kaidan.im>2023-05-13 17:45:25 +0200
commitfbb96a37f1c118c14fd158173e0d691022183ee3 (patch)
tree24e4a988dec79941107e3221e0e29fae2714968c /src/base/QXmppStanza.cpp
parent9a0af523a8256484ae7c53bda923e6e44bafcb2e (diff)
downloadqxmpp-fbb96a37f1c118c14fd158173e0d691022183ee3.tar.gz
Replace some while loops over QDomElements
Diffstat (limited to 'src/base/QXmppStanza.cpp')
-rw-r--r--src/base/QXmppStanza.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/base/QXmppStanza.cpp b/src/base/QXmppStanza.cpp
index f8b627be..03261536 100644
--- a/src/base/QXmppStanza.cpp
+++ b/src/base/QXmppStanza.cpp
@@ -557,8 +557,9 @@ void QXmppStanza::Error::parse(const QDomElement &errorElement)
d->type = typeFromString(errorElement.attribute(QStringLiteral("type"))).value_or(NoType);
d->by = errorElement.attribute(QStringLiteral("by"));
- QDomElement element = errorElement.firstChildElement();
- while (!element.isNull()) {
+ for (auto element = errorElement.firstChildElement();
+ !element.isNull();
+ element = element.nextSiblingElement()) {
if (element.namespaceURI() == ns_stanza) {
if (element.tagName() == QStringLiteral("text")) {
d->text = element.text();
@@ -589,7 +590,6 @@ void QXmppStanza::Error::parse(const QDomElement &errorElement)
element.attribute(QStringLiteral("stamp")));
}
}
- element = element.nextSiblingElement();
}
}
@@ -1033,14 +1033,14 @@ void QXmppStanza::parse(const QDomElement &element)
}
// XEP-0033: Extended Stanza Addressing
- QDomElement addressElement = element.firstChildElement("addresses").firstChildElement("address");
- while (!addressElement.isNull()) {
+ for (auto addressElement = element.firstChildElement("addresses").firstChildElement("address");
+ !addressElement.isNull();
+ addressElement = addressElement.nextSiblingElement("address")) {
QXmppExtendedAddress address;
address.parse(addressElement);
if (address.isValid()) {
d->extendedAddresses << address;
}
- addressElement = addressElement.nextSiblingElement("address");
}
}