1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Merge branch 'coverity_lua' into 'master'

Do not copy objects twice where possible

See merge request OpenMW/openmw!3311
This commit is contained in:
psi29a 2023-08-03 07:14:45 +00:00
commit 9cd81c21eb
5 changed files with 8 additions and 8 deletions

View File

@ -532,7 +532,7 @@ namespace LuaUtil
t.mScriptId = scriptId;
t.mSerializable = true;
t.mTime = time;
t.mArg = callbackArg;
t.mArg = std::move(callbackArg);
t.mSerializedArg = serialize(t.mArg, mSerializer);
insertTimer(type == TimerType::GAME_TIME ? mGameTimersQueue : mSimulationTimersQueue, std::move(t));
}

View File

@ -25,7 +25,7 @@ namespace LuaUi
}
template <typename T, typename LuaT>
sol::optional<T> parseValue(sol::object table, std::string_view field, std::string_view errorPrefix)
sol::optional<T> parseValue(const sol::object& table, std::string_view field, std::string_view errorPrefix)
{
sol::object opt = LuaUtil::getFieldOrNil(table, field);
if (opt != sol::nil && !opt.is<LuaT>())
@ -51,7 +51,7 @@ namespace LuaUi
}
template <typename T>
sol::optional<T> parseValue(sol::object table, std::string_view field, std::string_view errorPrefix)
sol::optional<T> parseValue(const sol::object& table, std::string_view field, std::string_view errorPrefix)
{
if constexpr (isMyGuiVector<T>())
return parseValue<T, osg::Vec2f>(table, field, errorPrefix);

View File

@ -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 { name, searchHints, element };
return { std::move(name), std::move(searchHints), element };
}
}

View File

@ -266,7 +266,7 @@ namespace LuaUi
mOnCoordChange.value()(this, newCoord);
}
void WidgetExtension::setProperties(sol::object props)
void WidgetExtension::setProperties(const sol::object& props)
{
mProperties = props;
updateProperties();

View File

@ -44,10 +44,10 @@ namespace LuaUi
void setCallback(const std::string&, const LuaUtil::Callback&);
void clearCallbacks();
void setProperties(sol::object);
void setTemplateProperties(sol::object props) { mTemplateProperties = props; }
void setProperties(const sol::object& props);
void setTemplateProperties(const sol::object& props) { mTemplateProperties = props; }
void setExternal(sol::object external) { mExternal = external; }
void setExternal(const sol::object& external) { mExternal = external; }
MyGUI::IntCoord forcedCoord();
void forceCoord(const MyGUI::IntCoord& offset);