mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
Merge branch 'coverity' into 'master'
Do not copy data when it is not needed See merge request OpenMW/openmw!2277
This commit is contained in:
commit
f42ab6a3e7
8 changed files with 10 additions and 11 deletions
|
@ -187,7 +187,7 @@ bool Config::GameSettings::writeFile(QTextStream &stream)
|
||||||
QString string = i.value();
|
QString string = i.value();
|
||||||
|
|
||||||
stream << delim;
|
stream << delim;
|
||||||
for (auto it : string)
|
for (auto& it : string)
|
||||||
{
|
{
|
||||||
if (it == delim || it == escape)
|
if (it == delim || it == escape)
|
||||||
stream << escape;
|
stream << escape;
|
||||||
|
@ -407,7 +407,7 @@ bool Config::GameSettings::writeFileWithComments(QFile &file)
|
||||||
QString string = it.value();
|
QString string = it.value();
|
||||||
|
|
||||||
settingLine += delim;
|
settingLine += delim;
|
||||||
for (auto iter : string)
|
for (auto& iter : string)
|
||||||
{
|
{
|
||||||
if (iter == delim || iter == escape)
|
if (iter == delim || iter == escape)
|
||||||
settingLine += escape;
|
settingLine += escape;
|
||||||
|
|
|
@ -131,7 +131,7 @@ namespace DetourNavigator
|
||||||
void NavigatorImpl::addPathgrid(const ESM::Cell& cell, const ESM::Pathgrid& pathgrid)
|
void NavigatorImpl::addPathgrid(const ESM::Cell& cell, const ESM::Pathgrid& pathgrid)
|
||||||
{
|
{
|
||||||
Misc::CoordinateConverter converter(&cell);
|
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 src = Misc::Convert::makeOsgVec3f(converter.toWorldPoint(pathgrid.mPoints[edge.mV0]));
|
||||||
const auto dst = Misc::Convert::makeOsgVec3f(converter.toWorldPoint(pathgrid.mPoints[edge.mV1]));
|
const auto dst = Misc::Convert::makeOsgVec3f(converter.toWorldPoint(pathgrid.mPoints[edge.mV1]));
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace
|
||||||
esm.writeHNT ("TIME", params.mNextWorsening);
|
esm.writeHNT ("TIME", params.mNextWorsening);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto effect : params.mEffects)
|
for (auto& effect : params.mEffects)
|
||||||
{
|
{
|
||||||
esm.writeHNT ("MGEF", effect.mEffectId);
|
esm.writeHNT ("MGEF", effect.mEffectId);
|
||||||
if (effect.mArg != -1)
|
if (effect.mArg != -1)
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace fx
|
||||||
|
|
||||||
int swaps = 0;
|
int swaps = 0;
|
||||||
|
|
||||||
for (auto name : mPassKeys)
|
for (auto& name : mPassKeys)
|
||||||
{
|
{
|
||||||
auto it = mPassMap.find(name);
|
auto it = mPassMap.find(name);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ namespace LuaUtil
|
||||||
{
|
{
|
||||||
std::vector<icu::Formattable> args;
|
std::vector<icu::Formattable> args;
|
||||||
std::vector<icu::UnicodeString> argNames;
|
std::vector<icu::UnicodeString> argNames;
|
||||||
for (auto elem : table)
|
|
||||||
for (auto& [key, value] : table)
|
for (auto& [key, value] : table)
|
||||||
{
|
{
|
||||||
// Argument values
|
// Argument values
|
||||||
|
|
|
@ -229,19 +229,19 @@ namespace LuaUtil
|
||||||
{
|
{
|
||||||
util["bitOr"] = [](unsigned a, sol::variadic_args va)
|
util["bitOr"] = [](unsigned a, sol::variadic_args va)
|
||||||
{
|
{
|
||||||
for (auto v : va)
|
for (const auto& v : va)
|
||||||
a |= v.as<unsigned>();
|
a |= v.as<unsigned>();
|
||||||
return a;
|
return a;
|
||||||
};
|
};
|
||||||
util["bitAnd"] = [](unsigned a, sol::variadic_args va)
|
util["bitAnd"] = [](unsigned a, sol::variadic_args va)
|
||||||
{
|
{
|
||||||
for (auto v : va)
|
for (const auto& v : va)
|
||||||
a &= v.as<unsigned>();
|
a &= v.as<unsigned>();
|
||||||
return a;
|
return a;
|
||||||
};
|
};
|
||||||
util["bitXor"] = [](unsigned a, sol::variadic_args va)
|
util["bitXor"] = [](unsigned a, sol::variadic_args va)
|
||||||
{
|
{
|
||||||
for (auto v : va)
|
for (const auto& v : va)
|
||||||
a ^= v.as<unsigned>();
|
a ^= v.as<unsigned>();
|
||||||
return a;
|
return a;
|
||||||
};
|
};
|
||||||
|
|
|
@ -219,7 +219,7 @@ namespace SDLUtil
|
||||||
std::map<MyGUI::KeyCode, SDL_Keycode> reverseKeyMap(const std::map<SDL_Keycode, MyGUI::KeyCode>& map)
|
std::map<MyGUI::KeyCode, SDL_Keycode> reverseKeyMap(const std::map<SDL_Keycode, MyGUI::KeyCode>& map)
|
||||||
{
|
{
|
||||||
std::map<MyGUI::KeyCode, SDL_Keycode> result;
|
std::map<MyGUI::KeyCode, SDL_Keycode> result;
|
||||||
for (auto [sdl, mygui] : map)
|
for (auto& [sdl, mygui] : map)
|
||||||
result[mygui] = sdl;
|
result[mygui] = sdl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ namespace Shader
|
||||||
osg::ref_ptr<osg::Program> ShaderManager::cloneProgram(const osg::Program* src)
|
osg::ref_ptr<osg::Program> ShaderManager::cloneProgram(const osg::Program* src)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Program> program = static_cast<osg::Program*>(src->clone(osg::CopyOp::SHALLOW_COPY));
|
osg::ref_ptr<osg::Program> program = static_cast<osg::Program*>(src->clone(osg::CopyOp::SHALLOW_COPY));
|
||||||
for (auto [name, idx] : src->getUniformBlockBindingList())
|
for (auto& [name, idx] : src->getUniformBlockBindingList())
|
||||||
program->addBindUniformBlock(name, idx);
|
program->addBindUniformBlock(name, idx);
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue