Do not copy data when it is not needed

update_coverity_image
Andrei Kortunov 2 years ago
parent 16922f8000
commit e3ad30a517

@ -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;

@ -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]));

@ -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)

@ -117,7 +117,7 @@ namespace fx
int swaps = 0;
for (auto name : mPassKeys)
for (auto& name : mPassKeys)
{
auto it = mPassMap.find(name);

@ -57,7 +57,6 @@ namespace LuaUtil
{
std::vector<icu::Formattable> args;
std::vector<icu::UnicodeString> argNames;
for (auto elem : table)
for (auto& [key, value] : table)
{
// Argument values

@ -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<unsigned>();
return a;
};
util["bitAnd"] = [](unsigned a, sol::variadic_args va)
{
for (auto v : va)
for (const auto& v : va)
a &= v.as<unsigned>();
return a;
};
util["bitXor"] = [](unsigned a, sol::variadic_args va)
{
for (auto v : va)
for (const auto& v : va)
a ^= v.as<unsigned>();
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> result;
for (auto [sdl, mygui] : map)
for (auto& [sdl, mygui] : map)
result[mygui] = sdl;
return result;
}

@ -434,7 +434,7 @@ namespace Shader
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));
for (auto [name, idx] : src->getUniformBlockBindingList())
for (auto& [name, idx] : src->getUniformBlockBindingList())
program->addBindUniformBlock(name, idx);
return program;
}

Loading…
Cancel
Save