From bba2c131a172d6a209e9a96b827e670723deb0af Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 31 Jan 2024 15:41:34 -0800 Subject: [PATCH] Qt: Shut coverity up a bit more --- src/platform/qt/PlacementControl.cpp | 2 +- src/platform/qt/ShortcutController.cpp | 2 +- src/platform/qt/VideoView.h | 2 +- src/platform/qt/Window.cpp | 6 +++--- src/platform/qt/scripting/ScriptingController.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/platform/qt/PlacementControl.cpp b/src/platform/qt/PlacementControl.cpp index fc031d019..0011dff5f 100644 --- a/src/platform/qt/PlacementControl.cpp +++ b/src/platform/qt/PlacementControl.cpp @@ -15,7 +15,7 @@ using namespace QGBA; PlacementControl::PlacementControl(std::shared_ptr controller, QWidget* parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) - , m_controller(controller) + , m_controller(std::move(controller)) { m_ui.setupUi(this); diff --git a/src/platform/qt/ShortcutController.cpp b/src/platform/qt/ShortcutController.cpp index 0ed445cd2..d1165a9ba 100644 --- a/src/platform/qt/ShortcutController.cpp +++ b/src/platform/qt/ShortcutController.cpp @@ -326,7 +326,7 @@ void ShortcutController::loadProfile(const QString& profile) { m_profileName = profile; m_profile = InputProfile::findProfile(profile); onSubitems({}, [this](std::shared_ptr item) { - loadGamepadShortcuts(item); + loadGamepadShortcuts(std::move(item)); }); } diff --git a/src/platform/qt/VideoView.h b/src/platform/qt/VideoView.h index 23b5ef034..9e3ab5ca2 100644 --- a/src/platform/qt/VideoView.h +++ b/src/platform/qt/VideoView.h @@ -75,7 +75,7 @@ private: QSize dims; Preset() {} - Preset(QString container, QString vcodec, QString acodec, int vbr, int abr, QSize dims = QSize()) + Preset(const QString& container, const QString& vcodec, const QString& acodec, int vbr, int abr, QSize dims = QSize()) : container(container) , vcodec(vcodec) , acodec(acodec) diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index d394ae45b..6b77a1ef3 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -1612,7 +1612,7 @@ void Window::setupMenu(QMenuBar* menubar) { double nativeGB = double(GBA_ARM7TDMI_FREQUENCY) / double(VIDEO_TOTAL_LENGTH); fpsTargets[nativeGB] = fpsTargetOption->addValue(tr("Native (59.7275)"), nativeGB, &m_actions, "target"); - fpsTargetOption->connect([this, fpsTargets](const QVariant& value) { + fpsTargetOption->connect([this, fpsTargets = std::move(fpsTargets)](const QVariant& value) { reloadConfig(); for (auto iter = fpsTargets.begin(); iter != fpsTargets.end(); ++iter) { bool enableSignals = iter.value()->blockSignals(true); @@ -1982,7 +1982,7 @@ void Window::updateMRU() { } std::shared_ptr Window::addGameAction(const QString& visibleName, const QString& name, Action::Function function, const QString& menu, const QKeySequence& shortcut) { - auto action = m_actions.addAction(visibleName, name, [this, function]() { + auto action = m_actions.addAction(visibleName, name, [this, function = std::move(function)]() { if (m_controller) { function(); } @@ -2006,7 +2006,7 @@ std::shared_ptr Window::addGameAction(const QString& visibleName, const } std::shared_ptr Window::addGameAction(const QString& visibleName, const QString& name, Action::BooleanFunction function, const QString& menu, const QKeySequence& shortcut) { - auto action = m_actions.addBooleanAction(visibleName, name, [this, function](bool value) { + auto action = m_actions.addBooleanAction(visibleName, name, [this, function = std::move(function)](bool value) { if (m_controller) { function(value); } diff --git a/src/platform/qt/scripting/ScriptingController.cpp b/src/platform/qt/scripting/ScriptingController.cpp index 95180d1de..065754bf1 100644 --- a/src/platform/qt/scripting/ScriptingController.cpp +++ b/src/platform/qt/scripting/ScriptingController.cpp @@ -73,7 +73,7 @@ void ScriptingController::setController(std::shared_ptr controll if (!controller) { return; } - m_controller = controller; + m_controller = std::move(controller); CoreController::Interrupter interrupter(m_controller); m_controller->thread()->scriptContext = &m_scriptContext; if (m_controller->hasStarted()) {