summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2022-11-03 20:37:38 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-11-30 13:48:51 +0000
commit82eff42b7ba6f75ac2a17e42f1756f645b529ddc (patch)
treeea342e642c77d681deb530e962afb0dd68c1da32 /src/xml
parenta5de12f0d7dfef64453b7b29c33dc760b3cacec4 (diff)
QDomDocument: use .value() instead of dereferencing an iterator
Do not assume that, given an iterator into an associative container, you can write `*it`. Use `it.value()` instead. This is done in preparation for the next commit. Also, drop the const-prefix from functions (find, begin) where they operate on a const container already. Change-Id: I2cafc884666d98c240c2fdc661c9068c4c7319e1 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/dom/qdom.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 6b86d3641c..e8e2e5902a 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -2523,7 +2523,7 @@ QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate* p)
auto it = map.constBegin();
for (; it != map.constEnd(); ++it) {
- QDomNodePrivate *new_node = (*it)->cloneNode();
+ QDomNodePrivate *new_node = it.value()->cloneNode();
new_node->setParent(p);
m->setNamedItem(new_node);
}
@@ -2539,16 +2539,16 @@ void QDomNamedNodeMapPrivate::clearMap()
if (!appendToParent) {
auto it = map.constBegin();
for (; it != map.constEnd(); ++it)
- if (!(*it)->ref.deref())
- delete *it;
+ if (!it.value()->ref.deref())
+ delete it.value();
}
map.clear();
}
QDomNodePrivate* QDomNamedNodeMapPrivate::namedItem(const QString& name) const
{
- auto it = map.constFind(name);
- return it == map.cend() ? nullptr : *it;
+ auto it = map.find(name);
+ return it == map.end() ? nullptr : it.value();
}
QDomNodePrivate* QDomNamedNodeMapPrivate::namedItemNS(const QString& nsURI, const QString& localName) const
@@ -2556,7 +2556,7 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::namedItemNS(const QString& nsURI, cons
auto it = map.constBegin();
QDomNodePrivate *n;
for (; it != map.constEnd(); ++it) {
- n = *it;
+ n = it.value();
if (!n->prefix.isNull()) {
// node has a namespace
if (n->namespaceURI == nsURI && n->name == localName)
@@ -2623,7 +2623,7 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::item(int index) const
{
if (index >= length() || index < 0)
return nullptr;
- return *std::next(map.cbegin(), index);
+ return std::next(map.begin(), index).value();
}
int QDomNamedNodeMapPrivate::length() const
@@ -3069,11 +3069,11 @@ void QDomDocumentTypePrivate::save(QTextStream& s, int, int indent) const
auto it2 = notations->map.constBegin();
for (; it2 != notations->map.constEnd(); ++it2)
- (*it2)->save(s, 0, indent);
+ it2.value()->save(s, 0, indent);
auto it = entities->map.constBegin();
for (; it != entities->map.constEnd(); ++it)
- (*it)->save(s, 0, indent);
+ it.value()->save(s, 0, indent);
s << ']';
}