Fix some Coverity Scan complaints

ini_importer_tests
Andrei Kortunov 11 months ago
parent 2114f84939
commit 225e834b88

@ -584,7 +584,7 @@ void MwIniImporter::importGameFiles(
reader.close(); reader.close();
} }
auto sortedFiles = dependencySort(unsortedFiles); auto sortedFiles = dependencySort(std::move(unsortedFiles));
// hard-coded dependency Morrowind - Tribunal - Bloodmoon // hard-coded dependency Morrowind - Tribunal - Bloodmoon
if (findString(sortedFiles, "Morrowind.esm") != sortedFiles.end()) if (findString(sortedFiles, "Morrowind.esm") != sortedFiles.end())

@ -126,7 +126,7 @@ namespace
MWGui::BookPage::ClickCallback callback = [this](intptr_t linkId) { notifyTopicClicked(linkId); }; MWGui::BookPage::ClickCallback callback = [this](intptr_t linkId) { notifyTopicClicked(linkId); };
getPage(LeftBookPage)->adviseLinkClicked(callback); getPage(LeftBookPage)->adviseLinkClicked(callback);
getPage(RightBookPage)->adviseLinkClicked(callback); getPage(RightBookPage)->adviseLinkClicked(std::move(callback));
getPage(LeftBookPage)->eventMouseWheel getPage(LeftBookPage)->eventMouseWheel
+= MyGUI::newDelegate(this, &JournalWindowImpl::notifyMouseWheel); += MyGUI::newDelegate(this, &JournalWindowImpl::notifyMouseWheel);
@ -140,7 +140,7 @@ namespace
getPage(LeftTopicIndex)->adviseLinkClicked(callback); getPage(LeftTopicIndex)->adviseLinkClicked(callback);
getPage(CenterTopicIndex)->adviseLinkClicked(callback); getPage(CenterTopicIndex)->adviseLinkClicked(callback);
getPage(RightTopicIndex)->adviseLinkClicked(callback); getPage(RightTopicIndex)->adviseLinkClicked(std::move(callback));
} }
adjustButton(PrevPageBTN); adjustButton(PrevPageBTN);
@ -376,7 +376,7 @@ namespace
setVisible(PageTwoNum, relPages > 1); setVisible(PageTwoNum, relPages > 1);
getPage(LeftBookPage)->showPage((relPages > 0) ? book : Book(), page + 0); getPage(LeftBookPage)->showPage((relPages > 0) ? book : Book(), page + 0);
getPage(RightBookPage)->showPage((relPages > 0) ? book : Book(), page + 1); getPage(RightBookPage)->showPage((relPages > 0) ? std::move(book) : Book(), page + 1);
setText(PageOneNum, page + 1); setText(PageOneNum, page + 1);
setText(PageTwoNum, page + 2); setText(PageTwoNum, page + 2);

@ -119,7 +119,7 @@ namespace MWLua
if (asTable) if (asTable)
{ {
AnimationPriorities priorities = AnimationPriorities(Priority::Priority_Default); AnimationPriorities priorities = AnimationPriorities(Priority::Priority_Default);
for (auto entry : asTable.value()) for (const auto& entry : asTable.value())
{ {
if (!entry.first.is<BoneGroup>() || !entry.second.is<Priority>()) if (!entry.first.is<BoneGroup>() || !entry.second.is<Priority>())
throw std::runtime_error("Priority table must consist of BoneGroup-Priority pairs only"); throw std::runtime_error("Priority table must consist of BoneGroup-Priority pairs only");

@ -711,7 +711,7 @@ namespace MWMechanics
mMovementAnimationHasMovement = true; mMovementAnimationHasMovement = true;
clearStateAnimation(mCurrentMovement); clearStateAnimation(mCurrentMovement);
mCurrentMovement = movementAnimName; mCurrentMovement = std::move(movementAnimName);
// For non-flying creatures, MW uses the Walk animation to calculate the animation velocity // For non-flying creatures, MW uses the Walk animation to calculate the animation velocity
// even if we are running. This must be replicated, otherwise the observed speed would differ drastically. // even if we are running. This must be replicated, otherwise the observed speed would differ drastically.

@ -844,7 +844,7 @@ namespace MWRender
} }
} }
} }
SceneUtil::ForceControllerSourcesVisitor assignVisitor(src); SceneUtil::ForceControllerSourcesVisitor assignVisitor(std::move(src));
node->accept(assignVisitor); node->accept(assignVisitor);
} }
else else

@ -99,7 +99,7 @@ namespace MWWorld
global.load(reader, isDeleted); global.load(reader, isDeleted);
if (const auto iter = mVariables.find(global.mId); iter != mVariables.end()) if (const auto iter = mVariables.find(global.mId); iter != mVariables.end())
iter->second = global; iter->second = std::move(global);
return true; return true;
} }

@ -133,7 +133,7 @@ namespace MWWorld
continue; continue;
ESM::ActiveSpells::ActiveSpellParams params; ESM::ActiveSpells::ActiveSpellParams params;
params.mId = id; params.mId = id;
params.mDisplayName = name; params.mDisplayName = std::move(name);
params.mCasterActorId = creatureStats.mActorId; params.mCasterActorId = creatureStats.mActorId;
params.mType = ESM::ActiveSpells::Type_Enchantment; params.mType = ESM::ActiveSpells::Type_Enchantment;
params.mWorsenings = -1; params.mWorsenings = -1;

@ -115,20 +115,20 @@ namespace LuaUtil
std::string_view handlerName = cast<std::string_view>(key); std::string_view handlerName = cast<std::string_view>(key);
sol::function fn = cast<sol::function>(handler); sol::function fn = cast<sol::function>(handler);
if (handlerName == HANDLER_INIT) if (handlerName == HANDLER_INIT)
onInit = fn; onInit = std::move(fn);
else if (handlerName == HANDLER_LOAD) else if (handlerName == HANDLER_LOAD)
onLoad = fn; onLoad = std::move(fn);
else if (handlerName == HANDLER_SAVE) else if (handlerName == HANDLER_SAVE)
script.mOnSave = fn; script.mOnSave = std::move(fn);
else if (handlerName == HANDLER_INTERFACE_OVERRIDE) else if (handlerName == HANDLER_INTERFACE_OVERRIDE)
script.mOnOverride = fn; script.mOnOverride = std::move(fn);
else else
{ {
auto it = mEngineHandlers.find(handlerName); auto it = mEngineHandlers.find(handlerName);
if (it == mEngineHandlers.end()) if (it == mEngineHandlers.end())
Log(Debug::Error) << "Not supported handler '" << handlerName << "' in " << debugName; Log(Debug::Error) << "Not supported handler '" << handlerName << "' in " << debugName;
else else
insertHandler(it->second->mList, scriptId, fn); insertHandler(it->second->mList, scriptId, std::move(fn));
} }
} }
} }

@ -503,7 +503,7 @@ namespace Shader
{ {
break; break;
} }
shaderSource = source; shaderSource = std::move(source);
std::vector<std::string> linkedShaderNames; std::vector<std::string> linkedShaderNames;
if (!Manager.createSourceFromTemplate( if (!Manager.createSourceFromTemplate(
@ -554,7 +554,7 @@ namespace Shader
if (!addLineDirectivesAfterConditionalBlocks(source) if (!addLineDirectivesAfterConditionalBlocks(source)
|| !parseIncludes(mPath, source, templateName, fileNumber, {}, insertedPaths)) || !parseIncludes(mPath, source, templateName, fileNumber, {}, insertedPaths))
return nullptr; return nullptr;
mHotReloadManager->templateIncludedFiles[templateName] = insertedPaths; mHotReloadManager->templateIncludedFiles[templateName] = std::move(insertedPaths);
templateIt = mShaderTemplates.insert(std::make_pair(templateName, source)).first; templateIt = mShaderTemplates.insert(std::make_pair(templateName, source)).first;
} }
@ -597,7 +597,7 @@ namespace Shader
if (!vert || !frag) if (!vert || !frag)
throw std::runtime_error("failed initializing shader: " + templateName); throw std::runtime_error("failed initializing shader: " + templateName);
return getProgram(vert, frag, programTemplate); return getProgram(std::move(vert), std::move(frag), programTemplate);
} }
osg::ref_ptr<osg::Program> ShaderManager::getProgram(osg::ref_ptr<osg::Shader> vertexShader, osg::ref_ptr<osg::Program> ShaderManager::getProgram(osg::ref_ptr<osg::Shader> vertexShader,

Loading…
Cancel
Save