From 87c9f395f11712470bcd6c134b79002d3d6031da Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 19 Jan 2024 16:01:48 +0400 Subject: [PATCH] Move local variables in components --- components/bsa/ba2dx10file.cpp | 2 +- components/config/gamesettings.cpp | 2 +- components/detournavigator/asyncnavmeshupdater.cpp | 2 +- components/esm3/inventorystate.cpp | 2 +- components/esm3/spellstate.cpp | 4 ++-- components/esm4/loadfurn.cpp | 2 +- components/esmterrain/storage.cpp | 6 +++--- components/files/configurationmanager.cpp | 2 +- components/lua/asyncpackage.cpp | 2 +- components/lua_ui/element.cpp | 2 +- components/lua_ui/scriptsettings.cpp | 2 +- components/nif/niffile.cpp | 2 +- components/settings/parser.cpp | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/components/bsa/ba2dx10file.cpp b/components/bsa/ba2dx10file.cpp index 945e8dd931..593ca64949 100644 --- a/components/bsa/ba2dx10file.cpp +++ b/components/bsa/ba2dx10file.cpp @@ -76,7 +76,7 @@ namespace Bsa fail("Corrupted BSA"); } - mFolders[dirHash][{ nameHash, extHash }] = file; + mFolders[dirHash][{ nameHash, extHash }] = std::move(file); FileStruct fileStruct{}; mFiles.push_back(fileStruct); diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index 42c11628df..ad7c73d3d9 100644 --- a/components/config/gamesettings.cpp +++ b/components/config/gamesettings.cpp @@ -371,7 +371,7 @@ bool Config::GameSettings::writeFileWithComments(QFile& file) { if ((keyMatch.captured(1) + "=" + keyMatch.captured(2)) == keyVal) { - *iter = settingLine; + *iter = std::move(settingLine); break; } } diff --git a/components/detournavigator/asyncnavmeshupdater.cpp b/components/detournavigator/asyncnavmeshupdater.cpp index 980281240d..ec6313d6f1 100644 --- a/components/detournavigator/asyncnavmeshupdater.cpp +++ b/components/detournavigator/asyncnavmeshupdater.cpp @@ -601,7 +601,7 @@ namespace DetourNavigator if (mSettings.get().mEnableRecastMeshFileNameRevision) recastMeshRevision = revision; if (mSettings.get().mEnableNavMeshFileNameRevision) - navMeshRevision = revision; + navMeshRevision = std::move(revision); } if (recastMesh && mSettings.get().mEnableWriteRecastMeshToFile) writeToFile(*recastMesh, diff --git a/components/esm3/inventorystate.cpp b/components/esm3/inventorystate.cpp index 1947be23e9..f3dce52f29 100644 --- a/components/esm3/inventorystate.cpp +++ b/components/esm3/inventorystate.cpp @@ -74,7 +74,7 @@ namespace ESM esm.getHNT(multiplier, "MULT"); params.emplace_back(rand, multiplier); } - mPermanentMagicEffectMagnitudes[id] = params; + mPermanentMagicEffectMagnitudes[id] = std::move(params); } while (esm.isNextSub("EQUI")) diff --git a/components/esm3/spellstate.cpp b/components/esm3/spellstate.cpp index 41591f56b7..39c98e7c0f 100644 --- a/components/esm3/spellstate.cpp +++ b/components/esm3/spellstate.cpp @@ -33,7 +33,7 @@ namespace ESM state.mPurgedEffects.insert(index); } - mSpellParams[id] = state; + mSpellParams[id] = std::move(state); mSpells.emplace_back(id); } } @@ -69,7 +69,7 @@ namespace ESM esm.getHNT(info.mMagnitude, "MAGN"); permEffectList.push_back(info); } - mPermanentSpellEffects[spellId] = permEffectList; + mPermanentSpellEffects[spellId] = std::move(permEffectList); } // Obsolete diff --git a/components/esm4/loadfurn.cpp b/components/esm4/loadfurn.cpp index 40ea04955e..41ddca07a2 100644 --- a/components/esm4/loadfurn.cpp +++ b/components/esm4/loadfurn.cpp @@ -50,7 +50,7 @@ void ESM4::Furniture::load(ESM4::Reader& reader) reader.getLocalizedString(name); // FIXME: subsequent FULL subrecords name object combinations (FO4) if (mFullName.empty()) - mFullName = name; + mFullName = std::move(name); break; } case ESM4::SUB_MODL: diff --git a/components/esmterrain/storage.cpp b/components/esmterrain/storage.cpp index d8cf964f71..a00cca0904 100644 --- a/components/esmterrain/storage.cpp +++ b/components/esmterrain/storage.cpp @@ -586,7 +586,7 @@ namespace ESMTerrain Misc::StringUtils::replaceLast(texture_, ".", mNormalHeightMapPattern + "."); if (mVFS->exists(texture_)) { - info.mNormalMap = texture_; + info.mNormalMap = std::move(texture_); info.mParallax = true; } else @@ -594,7 +594,7 @@ namespace ESMTerrain texture_ = texture; Misc::StringUtils::replaceLast(texture_, ".", mNormalMapPattern + "."); if (mVFS->exists(texture_)) - info.mNormalMap = texture_; + info.mNormalMap = std::move(texture_); } } @@ -604,7 +604,7 @@ namespace ESMTerrain Misc::StringUtils::replaceLast(texture_, ".", mSpecularMapPattern + "."); if (mVFS->exists(texture_)) { - info.mDiffuseMap = texture_; + info.mDiffuseMap = std::move(texture_); info.mSpecular = true; } } diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index ece30e5b3f..943f514676 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -309,7 +309,7 @@ namespace Files tempPath /= str.substr(pos + 1, str.length() - pos); } - path = tempPath; + path = std::move(tempPath); } else { diff --git a/components/lua/asyncpackage.cpp b/components/lua/asyncpackage.cpp index b60238de13..8316ab2cde 100644 --- a/components/lua/asyncpackage.cpp +++ b/components/lua/asyncpackage.cpp @@ -85,7 +85,7 @@ namespace LuaUtil auto initializer = [](sol::table hiddenData) { ScriptId id = hiddenData[ScriptsContainer::sScriptIdKey]; - return AsyncPackageId{ id.mContainer, id.mIndex, hiddenData }; + return AsyncPackageId{ id.mContainer, id.mIndex, std::move(hiddenData) }; }; return sol::make_object(lua, initializer); } diff --git a/components/lua_ui/element.cpp b/components/lua_ui/element.cpp index 84383f89e1..e993fba9fd 100644 --- a/components/lua_ui/element.cpp +++ b/components/lua_ui/element.cpp @@ -38,7 +38,7 @@ namespace LuaUi if (typeField != sol::nil && templateType != type) throw std::logic_error(std::string("Template layout type ") + type + std::string(" doesn't match template type ") + templateType); - type = templateType; + type = std::move(templateType); } return type; } diff --git a/components/lua_ui/scriptsettings.cpp b/components/lua_ui/scriptsettings.cpp index e92d1d8958..d552b7b3d6 100644 --- a/components/lua_ui/scriptsettings.cpp +++ b/components/lua_ui/scriptsettings.cpp @@ -21,7 +21,7 @@ namespace LuaUi Log(Debug::Warning) << "A script settings page has an empty name"; if (!element.get()) Log(Debug::Warning) << "A script settings page has no UI element assigned"; - return { std::move(name), std::move(searchHints), element }; + return { std::move(name), std::move(searchHints), std::move(element) }; } } diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index d6d063a254..7b20637c70 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -672,7 +672,7 @@ namespace Nif assert(r != nullptr); assert(r->recType != RC_MISSING); - r->recName = rec; + r->recName = std::move(rec); r->recIndex = i; r->read(&nif); mRecords[i] = std::move(r); diff --git a/components/settings/parser.cpp b/components/settings/parser.cpp index 5ec41c5f4b..ff6bc5ca48 100644 --- a/components/settings/parser.cpp +++ b/components/settings/parser.cpp @@ -77,7 +77,7 @@ void Settings::SettingsFileParser::loadSettingsFile( Misc::StringUtils::trim(value); if (overrideExisting) - settings[std::make_pair(currentCategory, setting)] = value; + settings[std::make_pair(currentCategory, setting)] = std::move(value); else if (settings.insert(std::make_pair(std::make_pair(currentCategory, setting), value)).second == false) fail(std::string("duplicate setting: [" + currentCategory + "] " + setting)); }