diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index 3598e739b5..b59c3435e0 100644 --- a/components/config/gamesettings.cpp +++ b/components/config/gamesettings.cpp @@ -187,7 +187,7 @@ bool Config::GameSettings::writeFile(QTextStream &stream) QString string = i.value(); stream << delim; - for (auto it : string) + for (auto& it : string) { if (it == delim || it == escape) stream << escape; @@ -407,7 +407,7 @@ bool Config::GameSettings::writeFileWithComments(QFile &file) QString string = it.value(); settingLine += delim; - for (auto iter : string) + for (auto& iter : string) { if (iter == delim || iter == escape) settingLine += escape; diff --git a/components/detournavigator/navigatorimpl.cpp b/components/detournavigator/navigatorimpl.cpp index e1b2df55ed..45f2f56d3d 100644 --- a/components/detournavigator/navigatorimpl.cpp +++ b/components/detournavigator/navigatorimpl.cpp @@ -131,7 +131,7 @@ namespace DetourNavigator void NavigatorImpl::addPathgrid(const ESM::Cell& cell, const ESM::Pathgrid& pathgrid) { Misc::CoordinateConverter converter(&cell); - for (auto edge : pathgrid.mEdges) + for (auto& edge : pathgrid.mEdges) { const auto src = Misc::Convert::makeOsgVec3f(converter.toWorldPoint(pathgrid.mPoints[edge.mV0])); const auto dst = Misc::Convert::makeOsgVec3f(converter.toWorldPoint(pathgrid.mPoints[edge.mV1])); diff --git a/components/esm3/activespells.cpp b/components/esm3/activespells.cpp index 014c5c2e77..fb41b5bf38 100644 --- a/components/esm3/activespells.cpp +++ b/components/esm3/activespells.cpp @@ -24,7 +24,7 @@ namespace esm.writeHNT ("TIME", params.mNextWorsening); } - for (auto effect : params.mEffects) + for (auto& effect : params.mEffects) { esm.writeHNT ("MGEF", effect.mEffectId); if (effect.mArg != -1) diff --git a/components/fx/technique.cpp b/components/fx/technique.cpp index 2b112e6151..20042bb9ae 100644 --- a/components/fx/technique.cpp +++ b/components/fx/technique.cpp @@ -117,7 +117,7 @@ namespace fx int swaps = 0; - for (auto name : mPassKeys) + for (auto& name : mPassKeys) { auto it = mPassMap.find(name); diff --git a/components/lua/l10n.cpp b/components/lua/l10n.cpp index 996b859157..469962d568 100644 --- a/components/lua/l10n.cpp +++ b/components/lua/l10n.cpp @@ -57,7 +57,6 @@ namespace LuaUtil { std::vector args; std::vector argNames; - for (auto elem : table) for (auto& [key, value] : table) { // Argument values diff --git a/components/lua/utilpackage.cpp b/components/lua/utilpackage.cpp index a9c5c40a7c..147738ca8e 100644 --- a/components/lua/utilpackage.cpp +++ b/components/lua/utilpackage.cpp @@ -229,19 +229,19 @@ namespace LuaUtil { util["bitOr"] = [](unsigned a, sol::variadic_args va) { - for (auto v : va) + for (const auto& v : va) a |= v.as(); return a; }; util["bitAnd"] = [](unsigned a, sol::variadic_args va) { - for (auto v : va) + for (const auto& v : va) a &= v.as(); return a; }; util["bitXor"] = [](unsigned a, sol::variadic_args va) { - for (auto v : va) + for (const auto& v : va) a ^= v.as(); return a; }; diff --git a/components/sdlutil/sdlmappings.cpp b/components/sdlutil/sdlmappings.cpp index 8306909ee5..d480262f82 100644 --- a/components/sdlutil/sdlmappings.cpp +++ b/components/sdlutil/sdlmappings.cpp @@ -219,7 +219,7 @@ namespace SDLUtil std::map reverseKeyMap(const std::map& map) { std::map result; - for (auto [sdl, mygui] : map) + for (auto& [sdl, mygui] : map) result[mygui] = sdl; return result; } diff --git a/components/shader/shadermanager.cpp b/components/shader/shadermanager.cpp index e0443edcc5..f63769934c 100644 --- a/components/shader/shadermanager.cpp +++ b/components/shader/shadermanager.cpp @@ -434,7 +434,7 @@ namespace Shader osg::ref_ptr ShaderManager::cloneProgram(const osg::Program* src) { osg::ref_ptr program = static_cast(src->clone(osg::CopyOp::SHALLOW_COPY)); - for (auto [name, idx] : src->getUniformBlockBindingList()) + for (auto& [name, idx] : src->getUniformBlockBindingList()) program->addBindUniformBlock(name, idx); return program; }