Minor updates for warnings from cppcheck.

This commit is contained in:
Stephen Anthony 2022-03-18 14:58:39 -02:30
parent 6d07ba4072
commit fee159ea81
38 changed files with 74 additions and 72 deletions

View File

@ -36,7 +36,7 @@ class DevSettingsHandler
numSets numSets
}; };
DevSettingsHandler(OSystem& osystem); explicit DevSettingsHandler(OSystem& osystem);
void loadSettings(SettingsSet set); void loadSettings(SettingsSet set);
void saveSettings(SettingsSet set); void saveSettings(SettingsSet set);

View File

@ -28,7 +28,7 @@
template<class T> template<class T>
class KeyValueRepositoryFile : public KeyValueRepository { class KeyValueRepositoryFile : public KeyValueRepository {
public: public:
KeyValueRepositoryFile(const FilesystemNode& node); explicit KeyValueRepositoryFile(const FilesystemNode& node);
std::map<string, Variant> load() override; std::map<string, Variant> load() override;

View File

@ -29,7 +29,7 @@ class KeyValueRepositoryJsonFile : public KeyValueRepositoryFile<KeyValueReposit
using KeyValueRepositoryFile<KeyValueRepositoryJsonFile>::load; using KeyValueRepositoryFile<KeyValueRepositoryJsonFile>::load;
using KeyValueRepositoryFile<KeyValueRepositoryJsonFile>::save; using KeyValueRepositoryFile<KeyValueRepositoryJsonFile>::save;
KeyValueRepositoryJsonFile(const FilesystemNode& node); explicit KeyValueRepositoryJsonFile(const FilesystemNode& node);
static std::map<string, Variant> load(istream& in); static std::map<string, Variant> load(istream& in);

View File

@ -29,7 +29,7 @@ class KeyValueRepositoryPropertyFile : public KeyValueRepositoryFile<KeyValueRep
using KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>::load; using KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>::load;
using KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>::save; using KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>::save;
KeyValueRepositoryPropertyFile(const FilesystemNode& node); explicit KeyValueRepositoryPropertyFile(const FilesystemNode& node);
static std::map<string, Variant> load(istream& in); static std::map<string, Variant> load(istream& in);

View File

@ -32,7 +32,7 @@ QisBlitter::~QisBlitter()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool QisBlitter::isSupported(FBBackendSDL2& fb) bool QisBlitter::isSupported(const FBBackendSDL2& fb)
{ {
if (!fb.isInitialized()) throw runtime_error("framebuffer not initialized"); if (!fb.isInitialized()) throw runtime_error("framebuffer not initialized");

View File

@ -29,7 +29,7 @@ class QisBlitter : public Blitter {
explicit QisBlitter(FBBackendSDL2& fb); explicit QisBlitter(FBBackendSDL2& fb);
static bool isSupported(FBBackendSDL2& fb); static bool isSupported(const FBBackendSDL2& fb);
~QisBlitter() override; ~QisBlitter() override;

View File

@ -763,7 +763,7 @@ void Debugger::setStartState()
lockSystem(); lockSystem();
// Save initial state and add it to the rewind list (except when in currently rewinding) // Save initial state and add it to the rewind list (except when in currently rewinding)
RewindManager& r = myOSystem.state().rewindManager(); const RewindManager& r = myOSystem.state().rewindManager();
// avoid invalidating future states when entering the debugger e.g. during rewind // avoid invalidating future states when entering the debugger e.g. during rewind
if(r.atLast() && (myOSystem.eventHandler().state() != EventHandlerState::TIMEMACHINE if(r.atLast() && (myOSystem.eventHandler().state() != EventHandlerState::TIMEMACHINE
|| myOSystem.state().mode() == StateManager::Mode::Off)) || myOSystem.state().mode() == StateManager::Mode::Off))

View File

@ -41,7 +41,7 @@ class RiotState : public DebuggerState
uInt8 TIM1T{0}, TIM8T{0}, TIM64T{0}, T1024T{0}, INTIM{0}, TIMINT{0}; uInt8 TIM1T{0}, TIM8T{0}, TIM64T{0}, T1024T{0}, INTIM{0}, TIMINT{0};
Int32 TIMCLKS{0}, INTIMCLKS{0}, TIMDIV{0}; Int32 TIMCLKS{0}, INTIMCLKS{0}, TIMDIV{0};
uInt16 timReadCycles; uInt16 timReadCycles{0};
// These are actually from the TIA, but are I/O related // These are actually from the TIA, but are I/O related
uInt8 INPT0{0}, INPT1{0}, INPT2{0}, INPT3{0}, INPT4{0}, INPT5{0}; uInt8 INPT0{0}, INPT1{0}, INPT2{0}, INPT3{0}, INPT4{0}, INPT5{0};

View File

@ -38,7 +38,7 @@ void AtariVoxWidget::eraseCurrent()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AtariVoxWidget::isPageUsed(uInt32 page) bool AtariVoxWidget::isPageUsed(uInt32 page)
{ {
AtariVox& avox = static_cast<AtariVox&>(controller()); const AtariVox& avox = static_cast<AtariVox&>(controller());
return avox.isPageUsed(page); return avox.isPageUsed(page);
} }

View File

@ -97,9 +97,9 @@ void AudioWidget::loadConfig()
{ {
IntArray alist; IntArray alist;
IntArray vlist; IntArray vlist;
BoolArray blist, changed, grNew, grOld; BoolArray changed;
Debugger& dbg = instance().debugger(); const Debugger& dbg = instance().debugger();
TIADebug& tia = dbg.tiaDebug(); TIADebug& tia = dbg.tiaDebug();
const TiaState& state = static_cast<const TiaState&>(tia.getState()); const TiaState& state = static_cast<const TiaState&>(tia.getState());
const TiaState& oldstate = static_cast<const TiaState&>(tia.getOldState()); const TiaState& oldstate = static_cast<const TiaState&>(tia.getOldState());

View File

@ -82,8 +82,7 @@ CartridgeARWidget::CartridgeARWidget(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARWidget::loadConfig() void CartridgeARWidget::loadConfig()
{ {
Debugger& dbg = instance().debugger(); CartDebug& cart = instance().debugger().cartDebug();
CartDebug& cart = dbg.cartDebug();
const CartState& state = static_cast<const CartState&>(cart.getState()); const CartState& state = static_cast<const CartState&>(cart.getState());
const CartState& oldstate = static_cast<const CartState&>(cart.getOldState()); const CartState& oldstate = static_cast<const CartState&>(cart.getOldState());

View File

@ -287,6 +287,6 @@ uInt8 CartridgeCMWidget::internalRamGetValue(int addr)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeCMWidget::internalRamLabel(int addr) string CartridgeCMWidget::internalRamLabel(int addr)
{ {
CartDebug& dbg = instance().debugger().cartDebug(); const CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0xF800, false); return dbg.getLabel(addr + 0xF800, false);
} }

View File

@ -157,6 +157,6 @@ uInt8 CartridgeCTYWidget::internalRamGetValue(int addr)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeCTYWidget::internalRamLabel(int addr) string CartridgeCTYWidget::internalRamLabel(int addr)
{ {
CartDebug& dbg = instance().debugger().cartDebug(); const CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + 0xF040, false); return dbg.getLabel(addr + 0xF040, false);
} }

View File

@ -455,6 +455,6 @@ uInt8 CartridgeEnhancedWidget::internalRamGetValue(int addr)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeEnhancedWidget::internalRamLabel(int addr) string CartridgeEnhancedWidget::internalRamLabel(int addr)
{ {
CartDebug& dbg = instance().debugger().cartDebug(); const CartDebug& dbg = instance().debugger().cartDebug();
return dbg.getLabel(addr + ADDR_BASE + myCart.myReadOffset, false, -1, true); return dbg.getLabel(addr + ADDR_BASE + myCart.myReadOffset, false, -1, true);
} }

View File

@ -296,8 +296,8 @@ void CpuWidget::loadConfig()
// We push the enumerated items as addresses, and deal with the real // We push the enumerated items as addresses, and deal with the real
// address in the callback (handleCommand) // address in the callback (handleCommand)
Debugger& dbg = instance().debugger(); const Debugger& dbg = instance().debugger();
CartDebug& cart = dbg.cartDebug(); const CartDebug& cart = dbg.cartDebug();
CpuDebug& cpu = dbg.cpuDebug(); CpuDebug& cpu = dbg.cpuDebug();
const CpuState& state = static_cast<const CpuState&>(cpu.getState()); const CpuState& state = static_cast<const CpuState&>(cpu.getState());
const CpuState& oldstate = static_cast<const CpuState&>(cpu.getOldState()); const CpuState& oldstate = static_cast<const CpuState&>(cpu.getOldState());

View File

@ -79,7 +79,6 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
} }
// Add filtering // Add filtering
EditableWidget::TextFilter f;
switch(base) switch(base)
{ {
case Common::Base::Fmt::_16: case Common::Base::Fmt::_16:

View File

@ -293,8 +293,7 @@ void RiotWidget::loadConfig()
// We push the enumerated items as addresses, and deal with the real // We push the enumerated items as addresses, and deal with the real
// address in the callback (handleCommand) // address in the callback (handleCommand)
Debugger& dbg = instance().debugger(); RiotDebug& riot = instance().debugger().riotDebug();
RiotDebug& riot = dbg.riotDebug();
const RiotState& state = static_cast<const RiotState&>(riot.getState()); const RiotState& state = static_cast<const RiotState&>(riot.getState());
const RiotState& oldstate = static_cast<const RiotState&>(riot.getOldState()); const RiotState& oldstate = static_cast<const RiotState&>(riot.getOldState());

View File

@ -60,7 +60,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomWidget::loadConfig() void RomWidget::loadConfig()
{ {
Debugger& dbg = instance().debugger(); const Debugger& dbg = instance().debugger();
CartDebug& cart = dbg.cartDebug(); CartDebug& cart = dbg.cartDebug();
const CartState& state = static_cast<const CartState&>(cart.getState()); const CartState& state = static_cast<const CartState&>(cart.getState());
const CartState& oldstate = static_cast<const CartState&>(cart.getOldState()); const CartState& oldstate = static_cast<const CartState&>(cart.getOldState());

View File

@ -37,7 +37,7 @@ void SaveKeyWidget::eraseCurrent()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SaveKeyWidget::isPageUsed(uInt32 page) bool SaveKeyWidget::isPageUsed(uInt32 page)
{ {
SaveKey& skey = static_cast<SaveKey&>(controller()); const SaveKey& skey = static_cast<SaveKey&>(controller());
return skey.isPageUsed(page); return skey.isPageUsed(page);
} }

View File

@ -156,7 +156,7 @@ void TiaInfoWidget::handleCommand(CommandSender* sender, int cmd, int data, int
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaInfoWidget::loadConfig() void TiaInfoWidget::loadConfig()
{ {
Debugger& dbg = instance().debugger(); const Debugger& dbg = instance().debugger();
TIADebug& tia = dbg.tiaDebug(); TIADebug& tia = dbg.tiaDebug();
const TiaState& oldTia = static_cast<const TiaState&>(tia.getOldState()); const TiaState& oldTia = static_cast<const TiaState&>(tia.getOldState());
RiotDebug& riot = dbg.riotDebug(); RiotDebug& riot = dbg.riotDebug();

View File

@ -674,8 +674,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{ {
Debugger& dbg = instance().debugger(); TIADebug& tia = instance().debugger().tiaDebug();
TIADebug& tia = dbg.tiaDebug();
switch(cmd) switch(cmd)
{ {
@ -974,10 +973,9 @@ void TiaWidget::loadConfig()
{ {
IntArray alist; IntArray alist;
IntArray vlist; IntArray vlist;
BoolArray blist, changed, grNew, grOld; BoolArray changed;
Debugger& dbg = instance().debugger(); TIADebug& tia = instance().debugger().tiaDebug();
TIADebug& tia = dbg.tiaDebug();
const TiaState& state = static_cast<const TiaState&>(tia.getState()); const TiaState& state = static_cast<const TiaState&>(tia.getState());
const TiaState& oldstate = static_cast<const TiaState&>(tia.getOldState()); const TiaState& oldstate = static_cast<const TiaState&>(tia.getOldState());

View File

@ -410,7 +410,7 @@ class Cartridge : public Device
uInt16 myRamWriteAccess{0}; uInt16 myRamWriteAccess{0};
// Total size of ROM access area (might include RAM too) // Total size of ROM access area (might include RAM too)
uInt32 myAccessSize; uInt32 myAccessSize{0};
// Callback to output messages // Callback to output messages
messageCallback myMsgCallback{nullptr}; messageCallback myMsgCallback{nullptr};

View File

@ -76,7 +76,7 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
Thumbulator::ConfigureFor::BUS, Thumbulator::ConfigureFor::BUS,
this); this);
setInitialState(); this->setInitialState();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -111,7 +111,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
thumulatorConfiguration(myCDFSubtype), thumulatorConfiguration(myCDFSubtype),
this); this);
setInitialState(); this->setInitialState();
myPlusROM = make_unique<PlusROM>(mySettings, *this); myPlusROM = make_unique<PlusROM>(mySettings, *this);
@ -786,10 +786,9 @@ void CartridgeCDF::setupVersion()
myFastFetcherOffset = 0; myFastFetcherOffset = 0;
myWaveformBase = 0x01b0; myWaveformBase = 0x01b0;
uInt32 cdfjValue;
for (int i=0; i<2048; i += 4) for (int i=0; i<2048; i += 4)
{ {
cdfjValue = getUInt32(myImage.get(), i); uInt32 cdfjValue = getUInt32(myImage.get(), i);
if (cdfjValue == 0x135200A2) if (cdfjValue == 0x135200A2)
myLDXenabled = true; myLDXenabled = true;
if (cdfjValue == 0x135200A0) if (cdfjValue == 0x135200A0)

View File

@ -102,7 +102,7 @@ inline void CartridgeDPC::updateMusicModeDataFetchers()
uInt32 wholeClocks = uInt32(clocks); uInt32 wholeClocks = uInt32(clocks);
myFractionalClocks = clocks - double(wholeClocks); myFractionalClocks = clocks - double(wholeClocks);
if(wholeClocks <= 0) if(wholeClocks == 0)
return; return;
// Let's update counters and flags of the music mode data fetchers // Let's update counters and flags of the music mode data fetchers

View File

@ -78,7 +78,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size,
myDriverMD5 == "8dd73b44fd11c488326ce507cbeb19d1" ) myDriverMD5 == "8dd73b44fd11c488326ce507cbeb19d1" )
myFractionalLowMask = 0x0F0000; myFractionalLowMask = 0x0F0000;
setInitialState(); this->setInitialState();
myPlusROM = make_unique<PlusROM>(mySettings, *this); myPlusROM = make_unique<PlusROM>(mySettings, *this);

View File

@ -1367,7 +1367,7 @@ void MovieCart::runStateMachine()
if(myLines == 22) if(myLines == 22)
myStream.blankPartialLines(true); myStream.blankPartialLines(true);
} }
} }
if(myLines >= 1) if(myLines >= 1)
{ {
@ -1571,13 +1571,11 @@ CartridgeMVC::CartridgeMVC(const string& path, size_t size,
const string& md5, const Settings& settings, const string& md5, const Settings& settings,
size_t bsSize) size_t bsSize)
: Cartridge(settings, md5), : Cartridge(settings, md5),
myImage{make_unique<uInt8[]>(bsSize)}, // not used
mySize{bsSize}, mySize{bsSize},
myMovie{make_unique<MovieCart>()},
myPath{path} myPath{path}
{ {
myMovie = make_unique<MovieCart>();
// not used
myImage = make_unique<uInt8[]>(mySize);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -34,7 +34,8 @@
class ControllerLowLevel class ControllerLowLevel
{ {
public: public:
ControllerLowLevel(Controller& controller) : myController(controller) { } explicit ControllerLowLevel(Controller& controller)
: myController(controller) { }
virtual ~ControllerLowLevel() = default; virtual ~ControllerLowLevel() = default;
inline bool setPin(Controller::DigitalPin pin, bool value) { inline bool setPin(Controller::DigitalPin pin, bool value) {

View File

@ -28,7 +28,7 @@
class GlobalKeyHandler class GlobalKeyHandler
{ {
public: public:
GlobalKeyHandler(OSystem& osystem); explicit GlobalKeyHandler(OSystem& osystem);
public: public:
enum class Setting enum class Setting

View File

@ -48,14 +48,14 @@ class PlusROMRequest {
public: public:
struct Destination { struct Destination {
Destination(string _host, string _path) : host(_host), path(_path) {} Destination(string _host, string _path) : host{_host}, path{_path} {}
string host; string host;
string path; string path;
}; };
struct PlusStoreId { struct PlusStoreId {
PlusStoreId(string _nick, string _id) : nick(_nick), id(_id) {} PlusStoreId(string _nick, string _id) : nick{_nick}, id{_id} {}
string nick; string nick;
string id; string id;
@ -70,10 +70,11 @@ class PlusROMRequest {
public: public:
PlusROMRequest(Destination destination, PlusStoreId id, const uInt8* request, uInt8 requestSize) PlusROMRequest(Destination destination, PlusStoreId id, const uInt8* request,
: myDestination(destination), myId(id), myRequestSize(requestSize) uInt8 requestSize)
: myState{State::created}, myDestination{destination},
myId{id}, myRequestSize{requestSize}
{ {
myState = State::created;
memcpy(myRequest.data(), request, myRequestSize); memcpy(myRequest.data(), request, myRequestSize);
} }
@ -152,7 +153,7 @@ class PlusROMRequest {
myState = State::done; myState = State::done;
} }
State getState() { State getState() const {
return myState; return myState;
} }
@ -177,13 +178,13 @@ class PlusROMRequest {
#endif #endif
private: private:
std::atomic<State> myState; std::atomic<State> myState{State::failed};
Destination myDestination; Destination myDestination;
PlusStoreId myId; PlusStoreId myId;
std::array<uInt8, 256> myRequest; std::array<uInt8, 256> myRequest;
uInt8 myRequestSize; uInt8 myRequestSize{0};
string myResponse; string myResponse;
@ -196,8 +197,8 @@ class PlusROMRequest {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PlusROM::PlusROM(const Settings& settings, const Cartridge& cart) PlusROM::PlusROM(const Settings& settings, const Cartridge& cart)
: mySettings(settings), : mySettings{settings},
myCart(cart) myCart{cart}
{ {
} }
@ -419,9 +420,10 @@ void PlusROM::send()
// We push to the back in order to avoid reverse_iterator in receive() // We push to the back in order to avoid reverse_iterator in receive()
myPendingRequests.push_back(request); myPendingRequests.push_back(request);
// The lambda will retain a copy of the shared_ptr that is alive as long as the // The lambda will retain a copy of the shared_ptr that is alive as long
// thread is running. Thus, the request can only be destructed once the thread has // as the thread is running. Thus, the request can only be destructed once
// finished, and we can safely evict it from the deque at any time. // the thread has finished, and we can safely evict it from the deque at
// any time.
std::thread thread([=]() { std::thread thread([=]() {
request->execute(); request->execute();
switch(request->getState()) switch(request->getState())

View File

@ -64,7 +64,8 @@ uInt8 AnalogReadout::inpt(uInt64 timestamp)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AnalogReadout::update(Connection connection, uInt64 timestamp, ConsoleTiming consoleTiming) void AnalogReadout::update(Connection connection, uInt64 timestamp,
ConsoleTiming consoleTiming)
{ {
if (consoleTiming != myConsoleTiming) { if (consoleTiming != myConsoleTiming) {
setConsoleTiming(consoleTiming); setConsoleTiming(consoleTiming);
@ -165,21 +166,25 @@ bool AnalogReadout::load(Serializer& in)
return true; return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AnalogReadout::Connection AnalogReadout::connectToGround(uInt32 resistance) AnalogReadout::Connection AnalogReadout::connectToGround(uInt32 resistance)
{ {
return Connection{ConnectionType::ground, resistance}; return Connection{ConnectionType::ground, resistance};
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AnalogReadout::Connection AnalogReadout::connectToVcc(uInt32 resistance) AnalogReadout::Connection AnalogReadout::connectToVcc(uInt32 resistance)
{ {
return Connection{ConnectionType::vcc, resistance}; return Connection{ConnectionType::vcc, resistance};
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AnalogReadout::Connection AnalogReadout::disconnect() AnalogReadout::Connection AnalogReadout::disconnect()
{ {
return Connection{ConnectionType::disconnected, 0}; return Connection{ConnectionType::disconnected, 0};
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AnalogReadout::Connection::save(Serializer& out) const bool AnalogReadout::Connection::save(Serializer& out) const
{ {
try try
@ -196,7 +201,8 @@ bool AnalogReadout::Connection::save(Serializer& out) const
return true; return true;
} }
bool AnalogReadout::Connection::load(Serializer& in) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AnalogReadout::Connection::load(const Serializer& in)
{ {
try try
{ {
@ -212,7 +218,9 @@ bool AnalogReadout::Connection::load(Serializer& in)
return true; return true;
} }
bool operator==(const AnalogReadout::Connection& c1, const AnalogReadout::Connection& c2) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool operator==(const AnalogReadout::Connection& c1,
const AnalogReadout::Connection& c2)
{ {
if (c1.type == AnalogReadout::ConnectionType::disconnected) if (c1.type == AnalogReadout::ConnectionType::disconnected)
return c2.type == AnalogReadout::ConnectionType::disconnected; return c2.type == AnalogReadout::ConnectionType::disconnected;
@ -220,7 +228,9 @@ bool operator==(const AnalogReadout::Connection& c1, const AnalogReadout::Connec
return c1.type == c2.type && c1.resistance == c2.resistance; return c1.type == c2.type && c1.resistance == c2.resistance;
} }
bool operator!=(const AnalogReadout::Connection& c1, const AnalogReadout::Connection& c2) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool operator!=(const AnalogReadout::Connection& c1,
const AnalogReadout::Connection& c2)
{ {
return !(c1 == c2); return !(c1 == c2);
} }

View File

@ -35,7 +35,7 @@ class AnalogReadout : public Serializable
uInt32 resistance; uInt32 resistance;
bool save(Serializer& out) const; bool save(Serializer& out) const;
bool load(Serializer& in); bool load(const Serializer& in);
friend bool operator==(const AnalogReadout::Connection& c1, const AnalogReadout::Connection& c2); friend bool operator==(const AnalogReadout::Connection& c1, const AnalogReadout::Connection& c2);
}; };

View File

@ -917,7 +917,7 @@ bool TIA::saveDisplay(Serializer& out) const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TIA::loadDisplay(Serializer& in) bool TIA::loadDisplay(const Serializer& in)
{ {
try try
{ {

View File

@ -208,7 +208,7 @@ class TIA : public Device
and eliminate having to save approx. 50K to normal state files. and eliminate having to save approx. 50K to normal state files.
*/ */
bool saveDisplay(Serializer& out) const; bool saveDisplay(Serializer& out) const;
bool loadDisplay(Serializer& in); bool loadDisplay(const Serializer& in);
/** /**
This method should be called at an interval corresponding to the This method should be called at an interval corresponding to the

View File

@ -13,9 +13,6 @@
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================ //============================================================================
#ifndef ICON_HXX #ifndef ICON_HXX
@ -31,15 +28,15 @@ struct IconDesc
int height{0}; int height{0};
explicit IconDesc(int _width, int _height) explicit IconDesc(int _width, int _height)
: width{_width}, height{_height} {} : width{_width}, height{_height} { }
}; };
class Icon class Icon
{ {
public: public:
explicit Icon(IconDesc desc, uIntArray bitmap) Icon(IconDesc desc, const uIntArray& bitmap)
: myIconDesc{desc}, myBitmap{bitmap} { } : myIconDesc{desc}, myBitmap{bitmap} { }
Icon(int width, int height, uIntArray bitmap) Icon(int width, int height, const uIntArray& bitmap)
: Icon(IconDesc(width, height), bitmap) { } : Icon(IconDesc(width, height), bitmap) { }
const IconDesc& desc() const { return myIconDesc; } const IconDesc& desc() const { return myIconDesc; }

View File

@ -308,7 +308,7 @@ void MinUICommandDialog::updateTVFormat()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MinUICommandDialog::updateWinds() void MinUICommandDialog::updateWinds()
{ {
RewindManager& r = instance().state().rewindManager(); const RewindManager& r = instance().state().rewindManager();
myRewindButton->setEnabled(!r.atFirst()); myRewindButton->setEnabled(!r.atFirst());
myUnwindButton->setEnabled(!r.atLast()); myUnwindButton->setEnabled(!r.atLast());

View File

@ -484,7 +484,7 @@ void TimeMachineDialog::handleCommand(CommandSender* sender, int cmd,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TimeMachineDialog::initBar() void TimeMachineDialog::initBar()
{ {
RewindManager& r = instance().state().rewindManager(); const RewindManager& r = instance().state().rewindManager();
IntArray cycles = r.cyclesList(); IntArray cycles = r.cyclesList();
// Set range and intervals for timeline // Set range and intervals for timeline

View File

@ -147,7 +147,7 @@ void StellaLIBRETRO::runFrame()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::updateInput() void StellaLIBRETRO::updateInput()
{ {
Console& console = myOSystem->console(); const Console& console = myOSystem->console();
console.leftController().update(); console.leftController().update();
console.rightController().update(); console.rightController().update();