mirror of https://github.com/mgba-emu/mgba.git
Qt: Shut up coverity some, despite this probably not doing anything
This commit is contained in:
parent
eff1785ce0
commit
7bd877dfbd
|
@ -14,7 +14,7 @@ Action::Action(QObject* parent)
|
|||
|
||||
Action::Action(Function&& function, const QString& name, const QString& visibleName, QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_function(function)
|
||||
, m_function(std::move(function))
|
||||
, m_name(name)
|
||||
, m_visibleName(visibleName)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ Action::Action(Function&& function, const QString& name, const QString& visibleN
|
|||
|
||||
Action::Action(Action::BooleanFunction&& function, const QString& name, const QString& visibleName, QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_booleanFunction(function)
|
||||
, m_booleanFunction(std::move(function))
|
||||
, m_name(name)
|
||||
, m_visibleName(visibleName)
|
||||
{
|
||||
|
@ -57,9 +57,9 @@ Action::Action(Action& other)
|
|||
{
|
||||
}
|
||||
|
||||
void Action::connect(Function func) {
|
||||
void Action::connect(Function&& func) {
|
||||
m_booleanFunction = {};
|
||||
m_function = func;
|
||||
m_function = std::move(func);
|
||||
}
|
||||
|
||||
void Action::trigger(bool active) {
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
return m_name == other.m_name;
|
||||
}
|
||||
|
||||
void connect(Function);
|
||||
void connect(Function&&);
|
||||
|
||||
bool isEnabled() const { return m_enabled; }
|
||||
bool isActive() const { return m_active; }
|
||||
|
|
|
@ -107,7 +107,7 @@ void ActionMapper::rebuildMenu(const QString& menu, QMenu* qmenu, QWidget* conte
|
|||
}
|
||||
});
|
||||
QObject::connect(action.get(), &Action::enabled, qaction, &QAction::setEnabled);
|
||||
QObject::connect(action.get(), &Action::activated, [qaction, weakAction](bool active) {
|
||||
QObject::connect(action.get(), &Action::activated, [qaction, weakAction = std::move(weakAction)](bool active) {
|
||||
std::shared_ptr<Action> action(weakAction.lock());
|
||||
if (qaction->isCheckable()) {
|
||||
qaction->setChecked(active);
|
||||
|
|
|
@ -199,7 +199,7 @@ bool AssetView::lookupObjGBA(int id, struct ObjInfo* info) {
|
|||
paletteSet = 2;
|
||||
bits = 4;
|
||||
}
|
||||
ObjInfo newInfo{
|
||||
*info = (ObjInfo) {
|
||||
tile,
|
||||
width / 8,
|
||||
height / 8,
|
||||
|
@ -218,16 +218,15 @@ bool AssetView::lookupObjGBA(int id, struct ObjInfo* info) {
|
|||
int matIndex = GBAObjAttributesBGetMatIndex(obj->b);
|
||||
const GBAOAMMatrix* mat = &gba->video.oam.mat[matIndex];
|
||||
QTransform invXform(mat->a / 256., mat->c / 256., mat->b / 256., mat->d / 256., 0, 0);
|
||||
newInfo.xform = invXform.inverted();
|
||||
info->xform = invXform.inverted();
|
||||
} else {
|
||||
newInfo.hflip = bool(GBAObjAttributesBIsHFlip(obj->b));
|
||||
newInfo.vflip = bool(GBAObjAttributesBIsVFlip(obj->b));
|
||||
info->hflip = bool(GBAObjAttributesBIsHFlip(obj->b));
|
||||
info->vflip = bool(GBAObjAttributesBIsVFlip(obj->b));
|
||||
}
|
||||
GBARegisterDISPCNT dispcnt = gba->memory.io[0]; // FIXME: Register name can't be imported due to namespacing issues
|
||||
if (!GBARegisterDISPCNTIsObjCharacterMapping(dispcnt)) {
|
||||
newInfo.stride = 0x20 >> (GBAObjAttributesAGet256Color(obj->a));
|
||||
info->stride = 0x20 >> (GBAObjAttributesAGet256Color(obj->a));
|
||||
};
|
||||
*info = newInfo;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -258,7 +257,7 @@ bool AssetView::lookupObjGB(int id, struct ObjInfo* info) {
|
|||
}
|
||||
palette += 8;
|
||||
|
||||
ObjInfo newInfo{
|
||||
*info = (ObjInfo) {
|
||||
tile,
|
||||
1,
|
||||
height / 8,
|
||||
|
@ -273,7 +272,6 @@ bool AssetView::lookupObjGB(int id, struct ObjInfo* info) {
|
|||
bool(GBObjAttributesIsXFlip(obj->attr)),
|
||||
bool(GBObjAttributesIsYFlip(obj->attr)),
|
||||
};
|
||||
*info = newInfo;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -60,11 +60,11 @@ void AudioProcessor::configure(ConfigController* config) {
|
|||
}
|
||||
|
||||
void AudioProcessor::setInput(std::shared_ptr<CoreController> input) {
|
||||
m_context = input;
|
||||
connect(input.get(), &CoreController::stopping, this, &AudioProcessor::stop);
|
||||
connect(input.get(), &CoreController::fastForwardChanged, this, &AudioProcessor::inputParametersChanged);
|
||||
connect(input.get(), &CoreController::paused, this, &AudioProcessor::pause);
|
||||
connect(input.get(), &CoreController::unpaused, this, &AudioProcessor::start);
|
||||
m_context = std::move(input);
|
||||
connect(m_context.get(), &CoreController::stopping, this, &AudioProcessor::stop);
|
||||
connect(m_context.get(), &CoreController::fastForwardChanged, this, &AudioProcessor::inputParametersChanged);
|
||||
connect(m_context.get(), &CoreController::paused, this, &AudioProcessor::pause);
|
||||
connect(m_context.get(), &CoreController::unpaused, this, &AudioProcessor::start);
|
||||
}
|
||||
|
||||
void AudioProcessor::stop() {
|
||||
|
|
|
@ -21,7 +21,7 @@ AudioProcessorQt::AudioProcessorQt(QObject* parent)
|
|||
}
|
||||
|
||||
void AudioProcessorQt::setInput(std::shared_ptr<CoreController> controller) {
|
||||
AudioProcessor::setInput(controller);
|
||||
AudioProcessor::setInput(std::move(controller));
|
||||
if (m_device) {
|
||||
m_device->setInput(input());
|
||||
if (m_audioOutput) {
|
||||
|
|
|
@ -17,7 +17,7 @@ AudioProcessorSDL::AudioProcessorSDL(QObject* parent)
|
|||
}
|
||||
|
||||
void AudioProcessorSDL::setInput(std::shared_ptr<CoreController> controller) {
|
||||
AudioProcessor::setInput(controller);
|
||||
AudioProcessor::setInput(std::move(controller));
|
||||
if (m_audio.core && input()->core != m_audio.core) {
|
||||
mSDLDeinitAudio(&m_audio);
|
||||
mSDLInitAudio(&m_audio, input());
|
||||
|
|
|
@ -118,8 +118,7 @@ void BattleChipModel::setFlavor(int flavor) {
|
|||
if (line.trimmed().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
QString name = QString::fromUtf8(line).trimmed();
|
||||
m_chipIdToName[id] = name;
|
||||
m_chipIdToName[id] = QString::fromUtf8(line).trimmed();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ using namespace QGBA;
|
|||
|
||||
BattleChipView::BattleChipView(std::shared_ptr<CoreController> controller, Window* window, QWidget* parent)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
|
||||
, m_controller(controller)
|
||||
, m_controller(std::move(controller))
|
||||
, m_window(window)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
|
|
@ -34,7 +34,7 @@ ConfigOption::ConfigOption(const QString& name, QObject* parent)
|
|||
}
|
||||
|
||||
void ConfigOption::connect(std::function<void(const QVariant&)> slot, QObject* parent) {
|
||||
m_slots[parent] = slot;
|
||||
m_slots[parent] = std::move(slot);
|
||||
QObject::connect(parent, &QObject::destroyed, this, [this, parent]() {
|
||||
m_slots.remove(parent);
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ std::shared_ptr<Action> ConfigOption::addValue(const QString& text, const QVaria
|
|||
}
|
||||
action->setExclusive();
|
||||
std::weak_ptr<Action> weakAction(action);
|
||||
QObject::connect(action.get(), &QObject::destroyed, this, [this, weakAction, value]() {
|
||||
QObject::connect(action.get(), &QObject::destroyed, this, [this, weakAction = std::move(weakAction), value]() {
|
||||
if (weakAction.expired()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -980,7 +980,7 @@ void CoreController::scanCard(const QString& path) {
|
|||
}
|
||||
}
|
||||
scanCards(lines);
|
||||
m_eReaderData = eReaderData;
|
||||
m_eReaderData = std::move(eReaderData);
|
||||
} else if (image.size() == QSize(989, 44) || image.size() == QSize(639, 44)) {
|
||||
const uchar* bits = image.constBits();
|
||||
size_t size;
|
||||
|
@ -1055,7 +1055,7 @@ void CoreController::attachPrinter() {
|
|||
colors.append(qRgb(0xA8, 0xA8, 0xA8));
|
||||
colors.append(qRgb(0x50, 0x50, 0x50));
|
||||
colors.append(qRgb(0x00, 0x00, 0x00));
|
||||
image.setColorTable(colors);
|
||||
image.setColorTable(std::move(colors));
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < GB_VIDEO_HORIZONTAL_PIXELS; x += 4) {
|
||||
uint8_t byte = data[(x + y * GB_VIDEO_HORIZONTAL_PIXELS) / 4];
|
||||
|
|
|
@ -167,7 +167,7 @@ void DebuggerConsoleController::historyLoad() {
|
|||
history.append(QString::fromUtf8(line));
|
||||
}
|
||||
QMutexLocker lock(&m_mutex);
|
||||
m_history = history;
|
||||
m_history = std::move(history);
|
||||
}
|
||||
|
||||
void DebuggerConsoleController::historySave() {
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual void setBackgroundImage(const QImage&) = 0;
|
||||
virtual QSize contentSize() const = 0;
|
||||
|
||||
virtual void setVideoProxy(std::shared_ptr<VideoProxy> proxy) { m_videoProxy = proxy; }
|
||||
virtual void setVideoProxy(std::shared_ptr<VideoProxy> proxy) { m_videoProxy = std::move(proxy); }
|
||||
std::shared_ptr<VideoProxy> videoProxy() { return m_videoProxy; }
|
||||
virtual VideoBackend* videoBackend();
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ void DisplayGL::startDrawing(std::shared_ptr<CoreController> controller) {
|
|||
m_isDrawing = true;
|
||||
m_painter->setContext(controller);
|
||||
m_painter->setMessagePainter(messagePainter());
|
||||
m_context = controller;
|
||||
m_context = std::move(controller);
|
||||
if (videoProxy()) {
|
||||
videoProxy()->moveToThread(&m_drawThread);
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ void DisplayGL::setVideoProxy(std::shared_ptr<VideoProxy> proxy) {
|
|||
if (proxy) {
|
||||
proxy->moveToThread(&m_drawThread);
|
||||
}
|
||||
m_painter->setVideoProxy(proxy);
|
||||
m_painter->setVideoProxy(std::move(proxy));
|
||||
}
|
||||
|
||||
void DisplayGL::updateContentSize() {
|
||||
|
@ -624,7 +624,7 @@ void PainterGL::destroy() {
|
|||
}
|
||||
|
||||
void PainterGL::setContext(std::shared_ptr<CoreController> context) {
|
||||
m_context = context;
|
||||
m_context = std::move(context);
|
||||
}
|
||||
|
||||
void PainterGL::resizeContext() {
|
||||
|
|
|
@ -43,7 +43,7 @@ void DisplayQt::startDrawing(std::shared_ptr<CoreController> controller) {
|
|||
m_height = size.height();
|
||||
m_oldBacking = QImage();
|
||||
m_isDrawing = true;
|
||||
m_context = controller;
|
||||
m_context = std::move(controller);
|
||||
emit drawingStarted();
|
||||
}
|
||||
|
||||
|
@ -241,9 +241,8 @@ void DisplayQt::setImage(struct VideoBackend* v, enum VideoLayer layer, const vo
|
|||
if (layer > self->m_layers.size()) {
|
||||
return;
|
||||
}
|
||||
QImage image = self->m_layers[layer];
|
||||
image = QImage(static_cast<const uchar*>(frame), image.width(), image.height(), QImage::Format_ARGB32).rgbSwapped();
|
||||
self->m_layers[layer] = image;
|
||||
QImage& image = self->m_layers[layer];
|
||||
self->m_layers[layer] = QImage(static_cast<const uchar*>(frame), image.width(), image.height(), QImage::Format_ARGB32).rgbSwapped();
|
||||
}
|
||||
|
||||
void DisplayQt::drawFrame(struct VideoBackend* v) {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
using namespace QGBA;
|
||||
|
||||
FrameView::FrameView(std::shared_ptr<CoreController> controller, QWidget* parent)
|
||||
: AssetView(controller, parent)
|
||||
: AssetView(std::move(controller), parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -315,7 +315,8 @@ bool GBAApp::waitOnJob(qint64 jobId, QObject* context, std::function<void ()>&&
|
|||
if (!context) {
|
||||
context = this;
|
||||
}
|
||||
QMetaObject::Connection connection = connect(this, &GBAApp::jobFinished, context, [jobId, callback](qint64 testedJobId) {
|
||||
QMetaObject::Connection connection = connect(this, &GBAApp::jobFinished, context,
|
||||
[jobId, callback = std::move(callback)](qint64 testedJobId) {
|
||||
if (jobId != testedJobId) {
|
||||
return;
|
||||
}
|
||||
|
@ -381,7 +382,7 @@ void GBAApp::restartForUpdate() {
|
|||
#ifndef Q_OS_WIN
|
||||
QFile(extractedPath).setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner);
|
||||
#endif
|
||||
m_invokeOnExit = extractedPath;
|
||||
m_invokeOnExit = std::move(extractedPath);
|
||||
}
|
||||
|
||||
for (auto& window : m_windows) {
|
||||
|
@ -398,7 +399,7 @@ void GBAApp::finishJob(qint64 jobId) {
|
|||
|
||||
GBAApp::WorkerJob::WorkerJob(qint64 id, std::function<void ()>&& job, GBAApp* owner)
|
||||
: m_id(id)
|
||||
, m_job(job)
|
||||
, m_job(std::move(job))
|
||||
, m_owner(owner)
|
||||
{
|
||||
setAutoDelete(true);
|
||||
|
|
|
@ -1025,7 +1025,7 @@ const QList<IOViewer::RegisterDescription>& IOViewer::registerDescriptions(mPlat
|
|||
regGBA.append({
|
||||
{ tr("Enable IRQs"), 0 },
|
||||
});
|
||||
s_registers[mPLATFORM_GBA] = regGBA;
|
||||
s_registers[mPLATFORM_GBA] = std::move(regGBA);
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
QList<IOViewer::RegisterDescription> regGB;
|
||||
|
@ -1555,7 +1555,7 @@ const QList<IOViewer::RegisterDescription>& IOViewer::registerDescriptions(mPlat
|
|||
{ tr("Serial"), 3 },
|
||||
{ tr("Joypad"), 4 },
|
||||
});
|
||||
s_registers[mPLATFORM_GB] = regGB;
|
||||
s_registers[mPLATFORM_GB] = std::move(regGB);
|
||||
#endif
|
||||
return s_registers[platform];
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
, size(size)
|
||||
, readonly(readonly)
|
||||
, description(description) {}
|
||||
RegisterItem(const QString& description, uint start, int size, QStringList items, bool readonly = false)
|
||||
RegisterItem(const QString& description, uint start, int size, const QStringList& items, bool readonly = false)
|
||||
: start(start)
|
||||
, size(size)
|
||||
, readonly(readonly)
|
||||
|
|
|
@ -16,7 +16,7 @@ using namespace QGBA;
|
|||
|
||||
MemoryAccessLogView::MemoryAccessLogView(std::shared_ptr<CoreController> controller, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_controller(controller)
|
||||
, m_controller(std::move(controller))
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace QGBA;
|
|||
|
||||
MemoryDump::MemoryDump(std::shared_ptr<CoreController> controller, QWidget* parent)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
|
||||
, m_controller(controller)
|
||||
, m_controller(std::move(controller))
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
|
@ -117,4 +117,4 @@ QByteArray MemoryDump::serialize() {
|
|||
}
|
||||
|
||||
return mem;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue