From f0cb9162823ff5a2d95e7408d6fd16d5aa985fe6 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Tue, 22 Dec 2020 19:29:49 -0330 Subject: [PATCH] Few more fixes for suggestions from cppcheck. --- src/common/PJoystickHandler.hxx | 2 +- src/debugger/gui/RiotWidget.cxx | 3 +-- src/emucore/CartCM.hxx | 2 +- src/gui/DeveloperDialog.cxx | 14 +++++++------- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx index 6a23f923b..1e48f80e5 100644 --- a/src/common/PJoystickHandler.hxx +++ b/src/common/PJoystickHandler.hxx @@ -49,7 +49,7 @@ class PhysicalJoystickHandler private: struct StickInfo { - StickInfo(nlohmann::json map, PhysicalJoystickPtr stick = nullptr) + explicit StickInfo(nlohmann::json map, PhysicalJoystickPtr stick = nullptr) : mapping(map), joy{std::move(stick)} {} nlohmann::json mapping; diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 053ff1325..d6affaf3c 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -76,13 +76,12 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, bits->setTarget(this); \ bits->setID(bitsID); \ if(editable) addFocusWidget(bits); else bits->setEditable(false); \ - xpos += bits->getWidth() + 5; \ bits->setList(off, on); // SWCHA bits in 'poke' mode labels.clear(); CREATE_IO_REGS("SWCHA(W)", mySWCHAWriteBits, kSWCHABitsID, true) - col = xpos + 20; // remember this for adding widgets to the second column + col = xpos + mySWCHAWriteBits->getWidth() + 25; // remember this for adding widgets to the second column // SWACNT bits xpos = 10; ypos += lineHeight + 5; diff --git a/src/emucore/CartCM.hxx b/src/emucore/CartCM.hxx index 0c2ffd0ef..1c96561ed 100644 --- a/src/emucore/CartCM.hxx +++ b/src/emucore/CartCM.hxx @@ -232,7 +232,7 @@ class CartridgeCM : public Cartridge /** Inform the cartridge about the parent CompuMate controller */ - void setCompuMate(shared_ptr& cmate) { myCompuMate = cmate; } + void setCompuMate(const shared_ptr& cmate) { myCompuMate = cmate; } /** Get the current keyboard column diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index 31443e1bf..12e89b37a 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -725,21 +725,21 @@ void DeveloperDialog::saveSettings(SettingsSet set) instance().settings().setValue(prefix + "bankrandom", myRandomBank[set]); instance().settings().setValue(prefix + "ramrandom", myRandomizeRAM[set]); instance().settings().setValue(prefix + "cpurandom", myRandomizeCPU[set]); - // Undriven TIA pins + if(devSettings) - instance().settings().setValue("dev.tiadriven", myUndrivenPins[set]); -#ifdef DEBUGGER_SUPPORT - if (devSettings) { + // Undriven TIA pins + instance().settings().setValue("dev.tiadriven", myUndrivenPins[set]); + #ifdef DEBUGGER_SUPPORT // Read from write ports break instance().settings().setValue("dev.rwportbreak", myRWPortBreak[set]); // Write to read ports break instance().settings().setValue("dev.wrportbreak", myWRPortBreak[set]); - } -#endif - if(devSettings) + #endif // Thumb ARM emulation exception instance().settings().setValue("dev.thumb.trapfatal", myThumbException[set]); + } + // AtariVox/SaveKey EEPROM access instance().settings().setValue(prefix + "eepromaccess", myEEPROMAccess[set]);