[graphics/digikam] core: cppcheck++: constify

Gilles Caulier <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit db9a2209e90b893323daf7987f8c0c2b34fe18ff by Gilles Caulier.
Committed on 09/08/2026 at 22:36.
Pushed by cgilles into branch 'master'.

cppcheck++: constify

M  +1    -0    core/libs/database/engine/dbenginebackend.cpp
M  +5    -1    core/utilities/geolocation/engine/geodata/data/GeoDataContainer.cpp
M  +1    -0    core/utilities/geolocation/engine/geodata/data/GeoDataDocument.cpp
M  +17   -1    core/utilities/geolocation/engine/geodata/data/GeoDataMultiGeometry.cpp
M  +10   -7    core/utilities/geolocation/geoiface/reversegeocoding/rgtagmodel.cpp

https://invent.kde.org/graphics/digikam/-/commit/db9a2209e90b893323daf7987f8c0c2b34fe18ff

diff --git a/core/libs/database/engine/dbenginebackend.cpp b/core/libs/database/engine/dbenginebackend.cpp
index 632161098b..bb7fcd7bbf 100644
--- a/core/libs/database/engine/dbenginebackend.cpp
+++ b/core/libs/database/engine/dbenginebackend.cpp
@@ -2023,6 +2023,7 @@ int BdEngineBackend::maximumBoundValues() const
 
 void BdEngineBackend::setForeignKeyChecks(bool check)
 {
+    // cppcheck-suppress constVariablePointer
     Q_D(BdEngineBackend);
 
     if (d->parameters.isMySQL())
diff --git a/core/utilities/geolocation/engine/geodata/data/GeoDataContainer.cpp b/core/utilities/geolocation/engine/geodata/data/GeoDataContainer.cpp
index ae16c9c548..010f68ddc7 100644
--- a/core/utilities/geolocation/engine/geodata/data/GeoDataContainer.cpp
+++ b/core/utilities/geolocation/engine/geodata/data/GeoDataContainer.cpp
@@ -193,21 +193,25 @@ QVector<GeoDataPlacemark*> GeoDataContainer::placemarkList() const
 QVector<GeoDataFeature*> GeoDataContainer::featureList() const
 {
     Q_D(const GeoDataContainer);
+
     return d->m_vector;
 }
 
 /**
- * @brief  returns the requested child item
+ * @brief returns the requested child item
  */
 GeoDataFeature* GeoDataContainer::child(int i)
 {
+    // cppcheck-suppress constVariablePointer
     Q_D(GeoDataContainer);
+
     return d->m_vector.at(i);
 }
 
 const GeoDataFeature* GeoDataContainer::child(int i) const
 {
     Q_D(const GeoDataContainer);
+
     return d->m_vector.at(i);
 }
 
diff --git a/core/utilities/geolocation/engine/geodata/data/GeoDataDocument.cpp b/core/utilities/geolocation/engine/geodata/data/GeoDataDocument.cpp
index 2d8b3bef70..c1945af9c4 100644
--- a/core/utilities/geolocation/engine/geodata/data/GeoDataDocument.cpp
+++ b/core/utilities/geolocation/engine/geodata/data/GeoDataDocument.cpp
@@ -249,6 +249,7 @@ QList<GeoDataStyle::ConstPtr> GeoDataDocument::styles() const
 
 QList<GeoDataStyle::Ptr> GeoDataDocument::styles()
 {
+    // cppcheck-suppress constVariablePointer
     Q_D(GeoDataDocument);
 
     return d->m_styleHash.values();
diff --git a/core/utilities/geolocation/engine/geodata/data/GeoDataMultiGeometry.cpp b/core/utilities/geolocation/engine/geodata/data/GeoDataMultiGeometry.cpp
index 3b65501913..9400a6cf7b 100644
--- a/core/utilities/geolocation/engine/geodata/data/GeoDataMultiGeometry.cpp
+++ b/core/utilities/geolocation/engine/geodata/data/GeoDataMultiGeometry.cpp
@@ -113,6 +113,7 @@ const GeoDataLatLonAltBox& GeoDataMultiGeometry::latLonAltBox() const
 int GeoDataMultiGeometry::size() const
 {
     Q_D(const GeoDataMultiGeometry);
+
     return d->m_vector.size();
 }
 
@@ -129,12 +130,14 @@ GeoDataGeometry& GeoDataMultiGeometry::at(int pos)
     detach();
 
     Q_D(GeoDataMultiGeometry);
+
     return *(d->m_vector[pos]);
 }
 
 const GeoDataGeometry& GeoDataMultiGeometry::at(int pos) const
 {
     Q_D(const GeoDataMultiGeometry);
+
     return *(d->m_vector.at(pos));
 }
 
@@ -143,12 +146,14 @@ GeoDataGeometry& GeoDataMultiGeometry::operator[](int pos)
     detach();
 
     Q_D(GeoDataMultiGeometry);
+
     return *(d->m_vector[pos]);
 }
 
 const GeoDataGeometry& GeoDataMultiGeometry::operator[](int pos) const
 {
     Q_D(const GeoDataMultiGeometry);
+
     return *(d->m_vector[pos]);
 }
 
@@ -157,6 +162,7 @@ GeoDataGeometry& GeoDataMultiGeometry::last()
     detach();
 
     Q_D(GeoDataMultiGeometry);
+
     return *(d->m_vector.last());
 }
 
@@ -165,18 +171,21 @@ GeoDataGeometry& GeoDataMultiGeometry::first()
     detach();
 
     Q_D(GeoDataMultiGeometry);
+
     return *(d->m_vector.first());
 }
 
 const GeoDataGeometry& GeoDataMultiGeometry::last() const
 {
     Q_D(const GeoDataMultiGeometry);
+
     return *(d->m_vector.last());
 }
 
 const GeoDataGeometry& GeoDataMultiGeometry::first() const
 {
     Q_D(const GeoDataMultiGeometry);
+
     return *(d->m_vector.first());
 }
 
@@ -185,6 +194,7 @@ QVector<GeoDataGeometry*>::Iterator GeoDataMultiGeometry::begin()
     detach();
 
     Q_D(GeoDataMultiGeometry);
+
     return d->m_vector.begin();
 }
 
@@ -193,18 +203,21 @@ QVector<GeoDataGeometry*>::Iterator GeoDataMultiGeometry::end()
     detach();
 
     Q_D(GeoDataMultiGeometry);
+
     return d->m_vector.end();
 }
 
 QVector<GeoDataGeometry*>::ConstIterator GeoDataMultiGeometry::constBegin() const
 {
     Q_D(const GeoDataMultiGeometry);
+
     return d->m_vector.constBegin();
 }
 
 QVector<GeoDataGeometry*>::ConstIterator GeoDataMultiGeometry::constEnd() const
 {
     Q_D(const GeoDataMultiGeometry);
+
     return d->m_vector.constEnd();
 }
 
@@ -215,13 +228,16 @@ GeoDataGeometry* GeoDataMultiGeometry::child(int i)
 {
     detach();
 
+    // cppcheck-suppress constVariablePointer
     Q_D(GeoDataMultiGeometry);
+
     return d->m_vector.at(i);
 }
 
 const GeoDataGeometry* GeoDataMultiGeometry::child(int i) const
 {
     Q_D(const GeoDataMultiGeometry);
+
     return d->m_vector.at(i);
 }
 
@@ -232,7 +248,7 @@ int GeoDataMultiGeometry::childPosition(const GeoDataGeometry* object) const
 {
     Q_D(const GeoDataMultiGeometry);
 
-    for (int i = 0; i < d->m_vector.size(); ++i)
+    for (int i = 0 ; i < d->m_vector.size() ; ++i)
     {
         if (d->m_vector.at(i) == object)
         {
diff --git a/core/utilities/geolocation/geoiface/reversegeocoding/rgtagmodel.cpp b/core/utilities/geolocation/geoiface/reversegeocoding/rgtagmodel.cpp
index 0b9a50f30b..52aa81cd97 100644
--- a/core/utilities/geolocation/geoiface/reversegeocoding/rgtagmodel.cpp
+++ b/core/utilities/geolocation/geoiface/reversegeocoding/rgtagmodel.cpp
@@ -636,10 +636,10 @@ int RGTagModel::rowCount(const QModelIndex& parent) const
 /*
     parent.isValid() ? static_cast<TreeBranch*>(parent.internalPointer()) : d->rootTag;
 */
-    TreeBranch* const parentBranch = branchFromIndex(parent);
-    int myRowCount                 = parentBranch->spacerChildren.count() + parentBranch->newChildren.count();
+    const TreeBranch* const parentBranch = branchFromIndex(parent);
+    int myRowCount                       = parentBranch->spacerChildren.count() + parentBranch->newChildren.count();
 
-    // TODO: we don't know whether the oldChildren have been set up, therefore query the source model
+    // @todo we don't know whether the oldChildren have been set up, therefore query the source model
 
     if (parentBranch->type == TypeChild)
     {
@@ -744,10 +744,13 @@ void RGTagModel::slotModelReset()
 
 void RGTagModel::slotRowsAboutToBeInserted(const QModelIndex& parent, int start, int end)
 {
-    TreeBranch* const parentBranch = parent.isValid() ? static_cast<TreeBranch*>(fromSourceIndex(parent).internalPointer()) : d->rootTag;
-    d->parent                      = fromSourceIndex(parent);
-    d->startInsert                 = start;
-    d->endInsert                   = end;
+    const TreeBranch* const parentBranch = (
+                                            parent.isValid() ? static_cast<TreeBranch*>(fromSourceIndex(parent).internalPointer())
+                                                             : d->rootTag
+                                           );
+    d->parent                            = fromSourceIndex(parent);
+    d->startInsert                       = start;
+    d->endInsert                         = end;
 
     beginInsertRows(d->parent,
                     start + parentBranch->newChildren.count() + parentBranch->spacerChildren.count(),
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.