diff options
author | Mike Krus <mike.krus@kdab.com> | 2017-05-01 14:00:48 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2017-05-02 08:46:49 +0000 |
commit | cb7dbc2e40f8258e92a79e8ac46d99a3b65c2a8c (patch) | |
tree | 53eeee700df4324e2a33b2f82ba64eabef3bb829 | |
parent | 1cf81a67af6540d496439deeb43dab4028ff4bfb (diff) |
Add missing reference in range-for with non trivial type (clazy reports)
Change-Id: Ib014b4ad7adc6604e600afc489e3dafaf0e299c1
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r-- | src/animation/backend/animationclip_p.h | 2 | ||||
-rw-r--r-- | src/animation/backend/animationutils.cpp | 2 | ||||
-rw-r--r-- | src/animation/backend/fcurve_p.h | 2 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfimporter.cpp | 4 | ||||
-rw-r--r-- | src/plugins/sceneparsers/gltfexport/gltfexporter.cpp | 34 | ||||
-rw-r--r-- | src/render/backend/renderviewbuilder.cpp | 18 | ||||
-rw-r--r-- | src/render/framegraph/rendercapture.cpp | 2 | ||||
-rw-r--r-- | src/render/frontend/qrenderaspect.cpp | 2 |
8 files changed, 33 insertions, 33 deletions
diff --git a/src/animation/backend/animationclip_p.h b/src/animation/backend/animationclip_p.h index 286ec38c0..7ff79c01a 100644 --- a/src/animation/backend/animationclip_p.h +++ b/src/animation/backend/animationclip_p.h @@ -127,7 +127,7 @@ inline QDebug operator<<(QDebug dbg, const AnimationClip &animationClip) << "Channels:" << endl; const QVector<Channel> channels = animationClip.channels(); - for (const auto channel : channels) { + for (const auto &channel : channels) { dbg << channel; } diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index c9c7c29d4..1f675f271 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -197,7 +197,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) const QVector<Channel> &channels = clip->channels(); int i = 0; for (const Channel &channel : channels) { - for (const auto channelComponent : qAsConst(channel.channelComponents)) + for (const auto &channelComponent : qAsConst(channel.channelComponents)) channelResults[i++] = channelComponent.fcurve.evaluateAtTime(localTime); } return channelResults; diff --git a/src/animation/backend/fcurve_p.h b/src/animation/backend/fcurve_p.h index 7bc6ccccb..7ab1593d1 100644 --- a/src/animation/backend/fcurve_p.h +++ b/src/animation/backend/fcurve_p.h @@ -146,7 +146,7 @@ inline QDebug operator<<(QDebug dbg, const Channel &channel) dbg << "Channel Name: " << channel.name << endl << "Channels:" << channel.channelComponents.size() << endl; - for (const auto channelComponent : qAsConst(channel.channelComponents)) { + for (const auto &channelComponent : qAsConst(channel.channelComponents)) { dbg << channelComponent; } return dbg; diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp index 916589ffa..5c209aa8a 100644 --- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp +++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp @@ -1072,7 +1072,7 @@ void GLTFImporter::cleanup() m_shaderPaths.clear(); delete_if_without_parent(m_programs); m_programs.clear(); - for (auto params : m_techniqueParameters.values()) + for (const auto ¶ms : m_techniqueParameters.values()) delete_if_without_parent(params); m_techniqueParameters.clear(); delete_if_without_parent(m_techniques); @@ -1546,7 +1546,7 @@ void GLTFImporter::processJSONExtensions(const QString &id, const QJsonObject &j // level GLTF item. if (id == KEY_COMMON_MAT) { const auto lights = jsonObject.value(KEY_LIGHTS).toObject(); - for (auto lightKey : lights.keys()) { + for (const auto &lightKey : lights.keys()) { const auto light = lights.value(lightKey).toObject(); auto lightType = light.value(KEY_TYPE).toString(); const auto lightValues = light.value(lightType).toObject(); diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp index b2fd9ce5b..373bdf4f4 100644 --- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp +++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp @@ -370,7 +370,7 @@ bool GLTFExporter::exportScene(QEntity *sceneRoot, const QString &outDir, QFile::Permissions targetPermissions = gltfFile.permissions(); // Copy exported scene to actual export directory - for (auto sourceFileStr : m_exportedFiles) { + for (const auto &sourceFileStr : m_exportedFiles) { QFileInfo fiSource(m_exportDir + sourceFileStr); QFileInfo fiDestination(finalExportDir + sourceFileStr); if (fiDestination.exists()) { @@ -524,7 +524,7 @@ void GLTFExporter::copyTextures() void GLTFExporter::createShaders() { qCDebug(GLTFExporterLog, "Creating shaders..."); - for (auto si : m_shaderInfo) { + for (const auto &si : m_shaderInfo) { const QString fileName = m_exportDir + si.uri; QFile f(fileName); if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { @@ -940,11 +940,11 @@ void GLTFExporter::parseMeshes() qCDebug(GLTFExporterLog, " Vertex buffer size (bytes): %i", vertexBuf.size()); qCDebug(GLTFExporterLog, " Index buffer size (bytes): %i", indexBuf.size()); QStringList sl; - for (auto bv : meshInfo.views) + for (const auto &bv : meshInfo.views) sl << bv.name; qCDebug(GLTFExporterLog) << " buffer views:" << sl; sl.clear(); - for (auto acc : meshInfo.accessors) + for (const auto &acc : meshInfo.accessors) sl << acc.name; qCDebug(GLTFExporterLog) << " accessors:" << sl; qCDebug(GLTFExporterLog, " material: '%ls'", @@ -1129,7 +1129,7 @@ QString GLTFExporter::addShaderInfo(QShaderProgram::ShaderType type, QByteArray if (code.isEmpty()) return QString(); - for (auto si : m_shaderInfo) { + for (const auto &si : m_shaderInfo) { if (si.type == QShaderProgram::Vertex && code == si.code) return si.name; } @@ -1153,10 +1153,10 @@ bool GLTFExporter::saveScene() QVector<MeshInfo::BufferView> bvList; QVector<MeshInfo::Accessor> accList; - for (auto mi : m_meshInfo.values()) { - for (auto v : mi.views) + for (auto &mi : m_meshInfo.values()) { + for (auto &v : mi.views) bvList << v; - for (auto acc : mi.accessors) + for (auto &acc : mi.accessors) accList << acc; } @@ -1193,7 +1193,7 @@ bool GLTFExporter::saveScene() m_obj["buffers"] = buffers; QJsonObject bufferViews; - for (auto bv : bvList) { + for (const auto &bv : bvList) { QJsonObject bufferView; bufferView["buffer"] = QStringLiteral("buf"); bufferView["byteLength"] = int(bv.length); @@ -1206,7 +1206,7 @@ bool GLTFExporter::saveScene() m_obj["bufferViews"] = bufferViews; QJsonObject accessors; - for (auto acc : accList) { + for (const auto &acc : accList) { QJsonObject accessor; accessor["bufferView"] = acc.bufferView; accessor["byteOffset"] = int(acc.offset); @@ -1220,7 +1220,7 @@ bool GLTFExporter::saveScene() m_obj["accessors"] = accessors; QJsonObject meshes; - for (auto meshInfo : m_meshInfo.values()) { + for (const auto &meshInfo : m_meshInfo.values()) { QJsonObject mesh; mesh["name"] = meshInfo.originalName; if (meshInfo.meshType != TypeNone) { @@ -1234,7 +1234,7 @@ bool GLTFExporter::saveScene() QJsonObject prim; prim["mode"] = 4; // triangles QJsonObject attrs; - for (auto acc : meshInfo.accessors) { + for (const auto &acc : meshInfo.accessors) { if (acc.usage != QStringLiteral("INDEX")) attrs[acc.usage] = acc.name; else @@ -1251,7 +1251,7 @@ bool GLTFExporter::saveScene() m_obj["meshes"] = meshes; QJsonObject cameras; - for (auto camInfo : m_cameraInfo.values()) { + for (const auto &camInfo : m_cameraInfo.values()) { QJsonObject camera; QJsonObject proj; proj["znear"] = camInfo.znear; @@ -1305,7 +1305,7 @@ bool GLTFExporter::saveScene() // Lights must be declared as extensions to the top-level glTF object QJsonObject lights; - for (auto lightInfo : m_lightInfo.values()) { + for (const auto &lightInfo : m_lightInfo.values()) { QJsonObject light; QJsonObject lightDetails; QString type; @@ -1406,7 +1406,7 @@ bool GLTFExporter::saveScene() if (!gFilter->vendor().isEmpty()) graphicsApiFilterObj["vendor"] = gFilter->vendor(); QJsonArray extensions; - for (auto extName : gFilter->extensions()) + for (const auto &extName : gFilter->extensions()) extensions << extName; if (!extensions.isEmpty()) graphicsApiFilterObj["extensions"] = extensions; @@ -1485,7 +1485,7 @@ bool GLTFExporter::saveScene() // Save shaders for custom materials QJsonObject shaders; - for (auto si : m_shaderInfo) { + for (const auto &si : m_shaderInfo) { QJsonObject shaderObj; shaderObj["uri"] = si.uri; shaders[si.name] = shaderObj; @@ -1572,7 +1572,7 @@ bool GLTFExporter::saveScene() QByteArray pre = "<RCC><qresource prefix=\"/gltf_res\">\n"; QByteArray post = "</qresource></RCC>\n"; f.write(pre); - for (auto file : m_exportedFiles) { + for (const auto &file : m_exportedFiles) { QString line = QString(QStringLiteral(" <file>%1</file>\n")).arg(file); f.write(line.toUtf8()); } diff --git a/src/render/backend/renderviewbuilder.cpp b/src/render/backend/renderviewbuilder.cpp index f1355d27e..0aab31b86 100644 --- a/src/render/backend/renderviewbuilder.cpp +++ b/src/render/backend/renderviewbuilder.cpp @@ -66,14 +66,14 @@ public: RenderView *rv = m_renderViewJob->renderView(); int totalCommandCount = 0; - for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) + for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) totalCommandCount += renderViewCommandBuilder->commands().size(); QVector<RenderCommand *> commands; commands.reserve(totalCommandCount); // Reduction - for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) + for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) commands += std::move(renderViewCommandBuilder->commands()); rv->setCommands(commands); @@ -139,13 +139,13 @@ public: m_filterEntityByLayerJob->setLayers(rv->layerFilter()); // Material Parameter building - for (const auto materialGatherer : qAsConst(m_materialGathererJobs)) { + for (const auto &materialGatherer : qAsConst(m_materialGathererJobs)) { materialGatherer->setRenderPassFilter(const_cast<RenderPassFilter *>(rv->renderPassFilter())); materialGatherer->setTechniqueFilter(const_cast<TechniqueFilter *>(rv->techniqueFilter())); } // Command builders - for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) + for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) renderViewCommandBuilder->setRenderView(rv); // Set whether frustum culling is enabled or not @@ -225,7 +225,7 @@ public: // Reduction QHash<Qt3DCore::QNodeId, QVector<RenderPassParameterData>> params; - for (const auto materialGatherer : qAsConst(m_materialGathererJobs)) + for (const auto &materialGatherer : qAsConst(m_materialGathererJobs)) params.unite(materialGatherer->materialToPassAndParameter()); // Set all required data on the RenderView for final processing rv->setMaterialParameterTable(std::move(params)); @@ -425,7 +425,7 @@ QVector<Qt3DCore::QAspectJobPtr> RenderViewBuilder::buildJobHierachy() const m_filterEntityByLayerJob->addDependency(m_renderer->updateTreeEnabledJob()); m_syncRenderCommandBuildingJob->addDependency(m_syncRenderViewInitializationJob); - for (const auto materialGatherer : qAsConst(m_materialGathererJobs)) { + for (const auto &materialGatherer : qAsConst(m_materialGathererJobs)) { materialGatherer->addDependency(m_syncRenderViewInitializationJob); materialGatherer->addDependency(m_renderer->filterCompatibleTechniqueJob()); m_syncRenderCommandBuildingJob->addDependency(materialGatherer); @@ -436,7 +436,7 @@ QVector<Qt3DCore::QAspectJobPtr> RenderViewBuilder::buildJobHierachy() const m_syncRenderCommandBuildingJob->addDependency(m_lightGathererJob); m_syncRenderCommandBuildingJob->addDependency(m_frustumCullingJob); - for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) { + for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) { renderViewCommandBuilder->addDependency(m_syncRenderCommandBuildingJob); m_syncRenderViewCommandBuildersJob->addDependency(renderViewCommandBuilder); } @@ -458,13 +458,13 @@ QVector<Qt3DCore::QAspectJobPtr> RenderViewBuilder::buildJobHierachy() const jobs.push_back(m_filterEntityByLayerJob); // Step 3 jobs.push_back(m_setClearDrawBufferIndexJob); // Step 3 - for (const auto materialGatherer : qAsConst(m_materialGathererJobs)) // Step3 + for (const auto &materialGatherer : qAsConst(m_materialGathererJobs)) // Step3 jobs.push_back(materialGatherer); jobs.push_back(m_frustumCullingJob); // Step 4 jobs.push_back(m_syncRenderCommandBuildingJob); // Step 4 - for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) // Step 5 + for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) // Step 5 jobs.push_back(renderViewCommandBuilder); jobs.push_back(m_syncRenderViewCommandBuildersJob); // Step 6 diff --git a/src/render/framegraph/rendercapture.cpp b/src/render/framegraph/rendercapture.cpp index 1d3117c0d..dea1cf565 100644 --- a/src/render/framegraph/rendercapture.cpp +++ b/src/render/framegraph/rendercapture.cpp @@ -92,7 +92,7 @@ void RenderCapture::sendRenderCaptures() { QMutexLocker lock(&m_mutex); - for (const RenderCaptureDataPtr data : qAsConst(m_renderCaptureData)) { + for (const RenderCaptureDataPtr &data : qAsConst(m_renderCaptureData)) { auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId()); e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); e->setPropertyName("renderCaptureData"); diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index a135c34e4..ca79f6fde 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -255,7 +255,7 @@ void QRenderAspectPrivate::registerBackendTypes() q->registerBackendType<QObjectPicker>(QSharedPointer<Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager> >::create(m_renderer)); // Plugins - for (QString plugin : m_pluginConfig) + for (const QString &plugin : m_pluginConfig) loadRenderPlugin(plugin); } |