summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2017-12-27 15:28:00 +0000
committerSean Harmer <sean.harmer@kdab.com>2018-01-13 16:15:22 +0000
commite5c16bb630345e819e8eeaf1733eeca694afe6ae (patch)
treec98fb6926fbb70eef0fb5018217fe66f37fb9c18 /src
parentc3b7cbd713c2434e91f0a2e306e6092037b5035f (diff)
Iterate on references to avoid copies
Found by Clazy clazy-range-loop Change-Id: Ib2d7f4073cbe7b5b2280518d5dc92981b56541cc Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/animation/backend/gltfimporter.cpp2
-rw-r--r--src/core/services/qdownloadnetworkworker.cpp2
-rw-r--r--src/plugins/sceneparsers/assimp/assimpimporter.cpp2
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.cpp2
-rw-r--r--src/render/geometry/gltfskeletonloader.cpp2
-rw-r--r--src/render/geometry/qmesh.cpp2
6 files changed, 6 insertions, 6 deletions
diff --git a/src/animation/backend/gltfimporter.cpp b/src/animation/backend/gltfimporter.cpp
index 8d9b5bb60..4111c2e3c 100644
--- a/src/animation/backend/gltfimporter.cpp
+++ b/src/animation/backend/gltfimporter.cpp
@@ -94,7 +94,7 @@ void jsonArrayToSqt(const QJsonArray &jsonArray, Qt3DCore::Sqt &sqt)
QMatrix4x4 m;
float *data = m.data();
int i = 0;
- for (const auto element : jsonArray)
+ for (const auto &element : jsonArray)
*(data + i++) = static_cast<float>(element.toDouble());
decomposeQMatrix4x4(m, sqt);
diff --git a/src/core/services/qdownloadnetworkworker.cpp b/src/core/services/qdownloadnetworkworker.cpp
index c728a1779..e1f806e92 100644
--- a/src/core/services/qdownloadnetworkworker.cpp
+++ b/src/core/services/qdownloadnetworkworker.cpp
@@ -91,7 +91,7 @@ void QDownloadNetworkWorker::onRequestCancelled(const QDownloadRequestPtr &reque
void QDownloadNetworkWorker::onAllRequestsCancelled()
{
QMutexLocker l(&m_mutex);
- for (auto e: qAsConst(m_requests)) {
+ for (auto &e: qAsConst(m_requests)) {
e.first->m_cancelled = true;
e.second->abort();
}
diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.cpp b/src/plugins/sceneparsers/assimp/assimpimporter.cpp
index 3f110e1e0..5af2104c5 100644
--- a/src/plugins/sceneparsers/assimp/assimpimporter.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpimporter.cpp
@@ -380,7 +380,7 @@ AssimpImporter::~AssimpImporter()
*/
bool AssimpImporter::areAssimpExtensions(const QStringList &extensions)
{
- for (const auto ext : qAsConst(extensions))
+ for (const auto &ext : qAsConst(extensions))
if (AssimpImporter::assimpSupportedFormatsList.contains(ext.toLower()))
return true;
return false;
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
index 4419bd708..426194746 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
@@ -1107,7 +1107,7 @@ void GLTFImporter::cleanup()
m_shaderPaths.clear();
delete_if_without_parent(m_programs);
m_programs.clear();
- for (auto params : qAsConst(m_techniqueParameters))
+ for (const auto &params : qAsConst(m_techniqueParameters))
delete_if_without_parent(params);
m_techniqueParameters.clear();
delete_if_without_parent(m_techniques);
diff --git a/src/render/geometry/gltfskeletonloader.cpp b/src/render/geometry/gltfskeletonloader.cpp
index 76601836a..b4e33babb 100644
--- a/src/render/geometry/gltfskeletonloader.cpp
+++ b/src/render/geometry/gltfskeletonloader.cpp
@@ -59,7 +59,7 @@ void jsonArrayToSqt(const QJsonArray &jsonArray, Qt3DCore::Sqt &sqt)
QMatrix4x4 m;
float *data = m.data();
int i = 0;
- for (const auto element : jsonArray)
+ for (const auto &element : jsonArray)
*(data + i++) = static_cast<float>(element.toDouble());
decomposeQMatrix4x4(m, sqt);
diff --git a/src/render/geometry/qmesh.cpp b/src/render/geometry/qmesh.cpp
index 9a1f10bc5..834284547 100644
--- a/src/render/geometry/qmesh.cpp
+++ b/src/render/geometry/qmesh.cpp
@@ -286,7 +286,7 @@ QGeometry *MeshLoaderFunctor::operator()()
}
QScopedPointer<QGeometryLoaderInterface> loader;
- for (QString e: qAsConst(ext)) {
+ for (const QString &e: qAsConst(ext)) {
loader.reset(qLoadPlugin<QGeometryLoaderInterface, QGeometryLoaderFactory>(geometryLoader(), e));
if (loader)
break;