diff --git a/src/cheat/CheatManager.cxx b/src/cheat/CheatManager.cxx index 80bd13613..c01c133f6 100644 --- a/src/cheat/CheatManager.cxx +++ b/src/cheat/CheatManager.cxx @@ -147,8 +147,8 @@ shared_ptr CheatManager::createCheat(const string& name, const string& co void CheatManager::parse(const string& cheats) { StringList s; - string::size_type lastPos = cheats.find_first_not_of(",", 0); - string::size_type pos = cheats.find_first_of(",", lastPos); + string::size_type lastPos = cheats.find_first_not_of(',', 0); + string::size_type pos = cheats.find_first_of(',', lastPos); string cheat, name, code; // Split string by comma, getting each cheat @@ -158,13 +158,13 @@ void CheatManager::parse(const string& cheats) cheat = cheats.substr(lastPos, pos - lastPos); // Split cheat by colon, separating each part - string::size_type lastColonPos = cheat.find_first_not_of(":", 0); - string::size_type colonPos = cheat.find_first_of(":", lastColonPos); + string::size_type lastColonPos = cheat.find_first_not_of(':', 0); + string::size_type colonPos = cheat.find_first_of(':', lastColonPos); while(string::npos != colonPos || string::npos != lastColonPos) { s.push_back(cheat.substr(lastColonPos, colonPos - lastColonPos)); - lastColonPos = cheat.find_first_not_of(":", colonPos); - colonPos = cheat.find_first_of(":", lastColonPos); + lastColonPos = cheat.find_first_not_of(':', colonPos); + colonPos = cheat.find_first_of(':', lastColonPos); } // Account for variable number of items specified for cheat @@ -190,8 +190,8 @@ void CheatManager::parse(const string& cheats) } s.clear(); - lastPos = cheats.find_first_not_of(",", pos); - pos = cheats.find_first_of(",", lastPos); + lastPos = cheats.find_first_not_of(',', pos); + pos = cheats.find_first_of(',', lastPos); } } @@ -228,10 +228,10 @@ void CheatManager::loadCheatDatabase() if(line.length() == 0) continue; - one = line.find("\"", 0); - two = line.find("\"", one + 1); - three = line.find("\"", two + 1); - four = line.find("\"", three + 1); + one = line.find('\"', 0); + two = line.find('\"', one + 1); + three = line.find('\"', two + 1); + four = line.find('\"', three + 1); // Invalid line if it doesn't contain 4 quotes if((one == string::npos) || (two == string::npos) || diff --git a/src/common/FSNodeZIP.cxx b/src/common/FSNodeZIP.cxx index 72d8ab5c7..abab6ce0e 100644 --- a/src/common/FSNodeZIP.cxx +++ b/src/common/FSNodeZIP.cxx @@ -106,7 +106,7 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNodeZIP::FilesystemNodeZIP( const string& zipfile, const string& virtualpath, - AbstractFSNodePtr realnode, bool isdir) + const AbstractFSNodePtr& realnode, bool isdir) : _error(zip_error::NONE), _numFiles(0), _isDirectory(isdir), @@ -118,7 +118,7 @@ FilesystemNodeZIP::FilesystemNodeZIP( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FilesystemNodeZIP::setFlags(const string& zipfile, const string& virtualpath, - AbstractFSNodePtr realnode) + const AbstractFSNodePtr& realnode) { _zipFile = zipfile; _virtualPath = virtualpath; diff --git a/src/common/FSNodeZIP.hxx b/src/common/FSNodeZIP.hxx index 70d1c0cd2..951f85a2d 100644 --- a/src/common/FSNodeZIP.hxx +++ b/src/common/FSNodeZIP.hxx @@ -71,10 +71,10 @@ class FilesystemNodeZIP : public AbstractFSNode private: FilesystemNodeZIP(const string& zipfile, const string& virtualpath, - AbstractFSNodePtr realnode, bool isdir); + const AbstractFSNodePtr& realnode, bool isdir); void setFlags(const string& zipfile, const string& virtualpath, - AbstractFSNodePtr realnode); + const AbstractFSNodePtr& realnode); friend ostream& operator<<(ostream& os, const FilesystemNodeZIP& node) { diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index 88e3eff6d..954294099 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -58,7 +58,7 @@ PhysicalJoystickHandler::PhysicalJoystickHandler( } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int PhysicalJoystickHandler::add(PhysicalJoystickPtr stick) +int PhysicalJoystickHandler::add(const PhysicalJoystickPtr& stick) { // Skip if we couldn't open it for any reason if(stick->ID < 0) @@ -416,7 +416,7 @@ void PhysicalJoystickHandler::enableCommonMappings() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PhysicalJoystickHandler::enableMappings(const Event::EventSet events, EventMode mode) +void PhysicalJoystickHandler::enableMappings(const Event::EventSet& events, EventMode mode) { for (const auto& event : events) enableMapping(event, mode); diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx index a9f54a124..21cdaf464 100644 --- a/src/common/PJoystickHandler.hxx +++ b/src/common/PJoystickHandler.hxx @@ -49,7 +49,7 @@ class PhysicalJoystickHandler struct StickInfo { StickInfo(const string& map = EmptyString, PhysicalJoystickPtr stick = nullptr) - : mapping(map), joy(stick) {} + : mapping(map), joy(std::move(stick)) {} string mapping; PhysicalJoystickPtr joy; @@ -64,7 +64,7 @@ class PhysicalJoystickHandler PhysicalJoystickHandler(OSystem& system, EventHandler& handler); /** Return stick ID on success, -1 on failure. */ - int add(PhysicalJoystickPtr stick); + int add(const PhysicalJoystickPtr& stick); bool remove(int id); bool remove(const string& name); void mapStelladaptors(const string& saport); @@ -161,7 +161,7 @@ class PhysicalJoystickHandler void enableCommonMappings(); - void enableMappings(const Event::EventSet events, EventMode mode); + void enableMappings(const Event::EventSet& events, EventMode mode); void enableMapping(const Event::Type event, EventMode mode); private: diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index 5c53e7a7d..b5b2568cf 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -237,7 +237,7 @@ void PhysicalKeyboardHandler::enableCommonMappings() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PhysicalKeyboardHandler::enableMappings(const Event::EventSet events, EventMode mode) +void PhysicalKeyboardHandler::enableMappings(const Event::EventSet& events, EventMode mode) { for (const auto& event : events) enableMapping(event, mode); diff --git a/src/common/PKeyboardHandler.hxx b/src/common/PKeyboardHandler.hxx index 8c9aab5f1..dbfd3158b 100644 --- a/src/common/PKeyboardHandler.hxx +++ b/src/common/PKeyboardHandler.hxx @@ -100,7 +100,7 @@ class PhysicalKeyboardHandler void enableCommonMappings(); - void enableMappings(const Event::EventSet events, EventMode mode); + void enableMappings(const Event::EventSet& events, EventMode mode); void enableMapping(const Event::Type event, EventMode mode); OSystem& myOSystem; diff --git a/src/common/TimerManager.cxx b/src/common/TimerManager.cxx index a5e734a46..748f5b826 100644 --- a/src/common/TimerManager.cxx +++ b/src/common/TimerManager.cxx @@ -64,7 +64,7 @@ TimerManager::TimerId TimerManager::addTimer( // Assign an ID and insert it into function storage auto id = nextId++; auto iter = active.emplace(id, Timer(id, Clock::now() + Duration(msDelay), - Duration(msPeriod), std::move(func))); + Duration(msPeriod), func)); // Insert a reference to the Timer into ordering queue Queue::iterator place = queue.emplace(iter.first->second); @@ -240,11 +240,11 @@ TimerManager::Timer::Timer(TimerId tid) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TimerManager::Timer::Timer(Timer&& r) noexcept - : id(std::move(r.id)), - next(std::move(r.next)), - period(std::move(r.period)), + : id(r.id), + next(r.next), + period(r.period), handler(std::move(r.handler)), - running(std::move(r.running)) + running(r.running) { } @@ -254,7 +254,7 @@ TimerManager::Timer::Timer(TimerId tid, Timestamp tnext, Duration tperiod, : id(tid), next(tnext), period(tperiod), - handler(std::move(func)), + handler(func), running(false) { } diff --git a/src/common/audio/LanczosResampler.cxx b/src/common/audio/LanczosResampler.cxx index 02c760c51..91e8eb934 100644 --- a/src/common/audio/LanczosResampler.cxx +++ b/src/common/audio/LanczosResampler.cxx @@ -56,7 +56,7 @@ namespace { LanczosResampler::LanczosResampler( Resampler::Format formatFrom, Resampler::Format formatTo, - Resampler::NextFragmentCallback nextFragmentCallback, + const Resampler::NextFragmentCallback& nextFragmentCallback, uInt32 kernelParameter) : Resampler(formatFrom, formatTo, nextFragmentCallback), diff --git a/src/common/audio/LanczosResampler.hxx b/src/common/audio/LanczosResampler.hxx index 2570f0fc6..eeba17f2a 100644 --- a/src/common/audio/LanczosResampler.hxx +++ b/src/common/audio/LanczosResampler.hxx @@ -29,7 +29,7 @@ class LanczosResampler : public Resampler LanczosResampler( Resampler::Format formatFrom, Resampler::Format formatTo, - Resampler::NextFragmentCallback nextFragmentCallback, + const Resampler::NextFragmentCallback& nextFragmentCallback, uInt32 kernelParameter ); diff --git a/src/common/audio/Resampler.hxx b/src/common/audio/Resampler.hxx index 2c8bd3fcf..f8a065b6e 100644 --- a/src/common/audio/Resampler.hxx +++ b/src/common/audio/Resampler.hxx @@ -50,7 +50,8 @@ class Resampler { public: - Resampler(Format formatFrom, Format formatTo, NextFragmentCallback nextFragmentCallback) : + Resampler(Format formatFrom, Format formatTo, + const NextFragmentCallback& nextFragmentCallback) : myFormatFrom(formatFrom), myFormatTo(formatTo), myNextFragmentCallback(nextFragmentCallback), diff --git a/src/common/audio/SimpleResampler.cxx b/src/common/audio/SimpleResampler.cxx index 48ba246e0..ecaec92d5 100644 --- a/src/common/audio/SimpleResampler.cxx +++ b/src/common/audio/SimpleResampler.cxx @@ -21,7 +21,7 @@ SimpleResampler::SimpleResampler( Resampler::Format formatFrom, Resampler::Format formatTo, - Resampler::NextFragmentCallback nextFragmentCallback) + const Resampler::NextFragmentCallback& nextFragmentCallback) : Resampler(formatFrom, formatTo, nextFragmentCallback), myCurrentFragment(nullptr), myTimeIndex(0), diff --git a/src/common/audio/SimpleResampler.hxx b/src/common/audio/SimpleResampler.hxx index c847d20b4..e76be209f 100644 --- a/src/common/audio/SimpleResampler.hxx +++ b/src/common/audio/SimpleResampler.hxx @@ -27,7 +27,7 @@ class SimpleResampler : public Resampler SimpleResampler( Resampler::Format formatFrom, Resampler::Format formatTo, - Resampler::NextFragmentCallback NextFragmentCallback + const Resampler::NextFragmentCallback& NextFragmentCallback ); void fillFragment(float* fragment, uInt32 length) override; diff --git a/src/common/repository/KeyValueRepositoryConfigfile.cxx b/src/common/repository/KeyValueRepositoryConfigfile.cxx index b492d94f1..459f3e58e 100644 --- a/src/common/repository/KeyValueRepositoryConfigfile.cxx +++ b/src/common/repository/KeyValueRepositoryConfigfile.cxx @@ -50,7 +50,7 @@ std::map KeyValueRepositoryConfigfile::load() while(getline(in, line)) { // Strip all whitespace and tabs from the line - while((garbage = line.find("\t")) != string::npos) + while((garbage = line.find('\t')) != string::npos) line.erase(garbage, 1); // Ignore commented and empty lines @@ -58,7 +58,7 @@ std::map KeyValueRepositoryConfigfile::load() continue; // Search for the equal sign and discard the line if its not found - if((equalPos = line.find("=")) == string::npos) + if((equalPos = line.find('=')) == string::npos) continue; // Split the line into key/value pairs and trim any whitespace @@ -78,7 +78,7 @@ std::map KeyValueRepositoryConfigfile::load() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void KeyValueRepositoryConfigfile::save(const std::map& values) { -ofstream out(myFilename); + ofstream out(myFilename); if(!out || !out.is_open()) { Logger::error("ERROR: Couldn't save to settings file " + myFilename); diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index cd0286482..2d29b6488 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -214,7 +214,7 @@ string CartDebug::toString() curraddr = state.rport[i]; buf << Base::HEX2 << (curraddr & 0x00ff) << ": "; - for(uInt8 j = 0; j < bytesPerLine; ++j) + for(uInt32 j = 0; j < bytesPerLine; ++j) { buf << myDebugger.invIfChanged(state.ram[i+j], oldstate.ram[i+j]) << " "; @@ -794,12 +794,12 @@ string CartDebug::loadSymbolFile() if (iter == myUserLabels.end() || !BSPF::equalsIgnoreCase(label, iter->second)) { // Check for period, and strip leading number - string::size_type pos = label.find_first_of(".", 0); + string::size_type pos = label.find_first_of('.', 0); if(pos != string::npos) addLabel(label.substr(pos), value); else { - pos = label.find_last_of("$"); + pos = label.find_last_of('$'); if (pos == string::npos || pos != label.length() - 1) addLabel(label, value); } diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 26396a037..1645d6d42 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -661,7 +661,7 @@ void Debugger::saveOldState(bool clearDirtyPages) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::addState(string rewindMsg) +void Debugger::addState(const string& rewindMsg) { // Add another rewind level to the Time Machine buffer RewindManager& r = myOSystem.state().rewindManager(); diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 7eda40551..92d08d0b3 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -293,7 +293,7 @@ class Debugger : public DialogContainer /** Saves a rewind state with the given message. */ - void addState(string rewindMsg); + void addState(const string& rewindMsg); /** Set initial state before entering the debugger. diff --git a/src/debugger/gui/DelayQueueWidget.hxx b/src/debugger/gui/DelayQueueWidget.hxx index a48c80fd7..47722eda6 100644 --- a/src/debugger/gui/DelayQueueWidget.hxx +++ b/src/debugger/gui/DelayQueueWidget.hxx @@ -44,8 +44,8 @@ class DelayQueueWidget : public Widget DelayQueueWidget() = delete; DelayQueueWidget(const DelayQueueWidget&) = delete; DelayQueueWidget(DelayQueueWidget&&) = delete; - DelayQueueWidget& operator=(const DelayQueueWidget&); - DelayQueueWidget& operator=(DelayQueueWidget&&); + DelayQueueWidget& operator=(const DelayQueueWidget&) = delete; + DelayQueueWidget& operator=(DelayQueueWidget&&) = delete; }; #endif // DELAY_QUEUE_WIDGET_HXX diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index d9babbad0..4189c353a 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -810,6 +810,7 @@ void PromptWidget::updateScrollBuffer() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// TODO: rewrite this (cert-dcl50-cpp) int PromptWidget::printf(const char* format, ...) { va_list argptr; diff --git a/src/emucore/AtariVox.cxx b/src/emucore/AtariVox.cxx index 9587bd54b..e877817bf 100644 --- a/src/emucore/AtariVox.cxx +++ b/src/emucore/AtariVox.cxx @@ -23,7 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AtariVox::AtariVox(Jack jack, const Event& event, const System& system, const string& portname, const string& eepromfile, - onMessageCallback callback) + const onMessageCallback& callback) : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox), myShiftCount(0), myShiftRegister(0), diff --git a/src/emucore/AtariVox.hxx b/src/emucore/AtariVox.hxx index 87e59440f..1dc4a840c 100644 --- a/src/emucore/AtariVox.hxx +++ b/src/emucore/AtariVox.hxx @@ -48,7 +48,7 @@ class AtariVox : public SaveKey */ AtariVox(Jack jack, const Event& event, const System& system, const string& portname, const string& eepromfile, - onMessageCallback callback); + const onMessageCallback& callback); virtual ~AtariVox() = default; public: diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index f3afbe7a2..d9203449a 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -91,8 +91,8 @@ class Cartridge : public Device Set the function to use when we want to query the 'Cartridge.StartBank' ROM property. */ - void setStartBankFromPropsFunc(StartBankFromPropsFunc func) { - myStartBankFromPropsFunc = std::move(func); + void setStartBankFromPropsFunc(const StartBankFromPropsFunc& func) { + myStartBankFromPropsFunc = func; } /** diff --git a/src/emucore/CartBF.cxx b/src/emucore/CartBF.cxx index 07334fe52..7ac9df7fc 100644 --- a/src/emucore/CartBF.cxx +++ b/src/emucore/CartBF.cxx @@ -94,7 +94,7 @@ bool CartridgeBF::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1000; addr < (0x1F80U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1000; addr < static_cast(0x1F80U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartBFSC.cxx b/src/emucore/CartBFSC.cxx index 92332d436..010e9fcf0 100644 --- a/src/emucore/CartBFSC.cxx +++ b/src/emucore/CartBFSC.cxx @@ -133,7 +133,7 @@ bool CartridgeBFSC::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1100; addr < (0x1F80U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1100; addr < static_cast(0x1F80U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartDF.cxx b/src/emucore/CartDF.cxx index 283ba62eb..5114cda5f 100644 --- a/src/emucore/CartDF.cxx +++ b/src/emucore/CartDF.cxx @@ -90,7 +90,7 @@ bool CartridgeDF::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1000; addr < (0x1FC0U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1000; addr < static_cast(0x1FC0U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartDFSC.cxx b/src/emucore/CartDFSC.cxx index 18df1cbd0..8978aa6a7 100644 --- a/src/emucore/CartDFSC.cxx +++ b/src/emucore/CartDFSC.cxx @@ -133,7 +133,7 @@ bool CartridgeDFSC::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1100; addr < (0x1FC0U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1100; addr < static_cast(0x1FC0U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index 759f24324..dc266df23 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -394,7 +394,7 @@ bool CartridgeDPC::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1080; addr < (0x1FF8U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1080; addr < static_cast(0x1FF8U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myProgramImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartE0.cxx b/src/emucore/CartE0.cxx index d9ea44902..2a39edbe9 100644 --- a/src/emucore/CartE0.cxx +++ b/src/emucore/CartE0.cxx @@ -57,7 +57,7 @@ void CartridgeE0::install(System& system) System::PageAccess access(this, System::PageAccessType::READ); // Set the page acessing methods for the first part of the last segment - for(uInt16 addr = 0x1C00; addr < (0x1FE0U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1C00; addr < static_cast(0x1FE0U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[0x1C00 + (addr & 0x03FF)]; diff --git a/src/emucore/CartEF.cxx b/src/emucore/CartEF.cxx index b8807e430..521e754c1 100644 --- a/src/emucore/CartEF.cxx +++ b/src/emucore/CartEF.cxx @@ -90,7 +90,7 @@ bool CartridgeEF::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1000; addr < (0x1FE0U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1000; addr < static_cast(0x1FE0U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index c630c79f3..370beed68 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -133,7 +133,7 @@ bool CartridgeEFSC::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1100; addr < (0x1FE0U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1100; addr < static_cast(0x1FE0U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartF0.cxx b/src/emucore/CartF0.cxx index 25e886652..3677fa131 100644 --- a/src/emucore/CartF0.cxx +++ b/src/emucore/CartF0.cxx @@ -97,7 +97,7 @@ bool CartridgeF0::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1000; addr < (0x1FF0U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1000; addr < static_cast(0x1FF0U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartF4.cxx b/src/emucore/CartF4.cxx index 8e57359da..f24b19b91 100644 --- a/src/emucore/CartF4.cxx +++ b/src/emucore/CartF4.cxx @@ -94,7 +94,7 @@ bool CartridgeF4::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1000; addr < (0x1FF4U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1000; addr < static_cast(0x1FF4U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index 8d075302a..42265636c 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -133,7 +133,7 @@ bool CartridgeF4SC::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1100; addr < (0x1FF4U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1100; addr < static_cast(0x1FF4U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartF6.cxx b/src/emucore/CartF6.cxx index 9ff62dda9..133f58a1d 100644 --- a/src/emucore/CartF6.cxx +++ b/src/emucore/CartF6.cxx @@ -134,7 +134,7 @@ bool CartridgeF6::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1000; addr < (0x1FF6U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1000; addr < static_cast(0x1FF6U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index f5d64517e..05832809c 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -173,7 +173,7 @@ bool CartridgeF6SC::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1100; addr < (0x1FF6U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1100; addr < static_cast(0x1FF6U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartF8.cxx b/src/emucore/CartF8.cxx index 5b660e2e4..bfe4253c1 100644 --- a/src/emucore/CartF8.cxx +++ b/src/emucore/CartF8.cxx @@ -115,7 +115,7 @@ bool CartridgeF8::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1000; addr < (0x1FF8U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1000; addr < static_cast(0x1FF8U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index 60299169a..0d148ed65 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -153,7 +153,7 @@ bool CartridgeF8SC::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1100; addr < (0x1FF8U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1100; addr < static_cast(0x1FF8U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index f5a3c9230..e62fea198 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -163,7 +163,7 @@ bool CartridgeFA::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1200; addr < (0x1FF8U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1200; addr < static_cast(0x1FF8U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index 5b701a628..c901f7e75 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -230,7 +230,7 @@ bool CartridgeFA2::bank(uInt16 bank) } // Setup the page access methods for the current bank - for(uInt16 addr = 0x1200; addr < (0x1FF4U & ~System::PAGE_MASK); + for(uInt16 addr = 0x1200; addr < static_cast(0x1FF4U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/CartFC.cxx b/src/emucore/CartFC.cxx index 75082ff36..eb11f9813 100644 --- a/src/emucore/CartFC.cxx +++ b/src/emucore/CartFC.cxx @@ -126,7 +126,7 @@ bool CartridgeFC::bank(uInt16 bank) } // Setup the page access methods for the current bank - for (uInt16 addr = 0x1000; addr < (0x1FF8U & ~System::PAGE_MASK); + for (uInt16 addr = 0x1000; addr < static_cast(0x1FF8U & ~System::PAGE_MASK); addr += System::PAGE_SIZE) { access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index 1903a3ce2..8b26f8588 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -252,8 +252,8 @@ class Controller : public Serializable /** Inject a callback to be notified on analog pin updates. */ - void setOnAnalogPinUpdateCallback(onAnalogPinUpdateCallback callback) { - myOnAnalogPinUpdateCallback = std::move(callback); + void setOnAnalogPinUpdateCallback(const onAnalogPinUpdateCallback& callback) { + myOnAnalogPinUpdateCallback = callback; } /** diff --git a/src/emucore/EmulationWorker.cxx b/src/emucore/EmulationWorker.cxx index 39721e209..9d55b8ba0 100644 --- a/src/emucore/EmulationWorker.cxx +++ b/src/emucore/EmulationWorker.cxx @@ -336,7 +336,7 @@ void EmulationWorker::waitUntilPendingSignalHasProcessed() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EmulationWorker::fatal(string message) +void EmulationWorker::fatal(const string& message) { (cerr << "FATAL in emulation worker: " << message << std::endl).flush(); throw runtime_error(message); diff --git a/src/emucore/EmulationWorker.hxx b/src/emucore/EmulationWorker.hxx index b5315fbbb..ba116d88e 100644 --- a/src/emucore/EmulationWorker.hxx +++ b/src/emucore/EmulationWorker.hxx @@ -128,7 +128,7 @@ class EmulationWorker /** Log a fatal error to cerr and throw a runtime exception. */ - [[noreturn]] void fatal(string message); + [[noreturn]] void fatal(const string& message); private: /** diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 760e005c7..e2f817f33 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -147,7 +147,7 @@ void EventHandler::reset(EventHandlerState state) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::addPhysicalJoystick(PhysicalJoystickPtr joy) +void EventHandler::addPhysicalJoystick(const PhysicalJoystickPtr& joy) { #ifdef JOYSTICK_SUPPORT int ID = myPJoyHandler->add(joy); diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 0e7586dff..a33d08ba3 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -380,7 +380,7 @@ class EventHandler /** Add the given joystick to the list of physical joysticks available to the handler. */ - void addPhysicalJoystick(PhysicalJoystickPtr stick); + void addPhysicalJoystick(const PhysicalJoystickPtr& stick); /** Remove physical joystick at the current index. diff --git a/src/emucore/FSNode.cxx b/src/emucore/FSNode.cxx index e12dc51f8..64ca0845b 100644 --- a/src/emucore/FSNode.cxx +++ b/src/emucore/FSNode.cxx @@ -28,7 +28,7 @@ FilesystemNode::FilesystemNode() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNode::FilesystemNode(AbstractFSNodePtr realNode) - : _realNode(realNode) + : _realNode(std::move(realNode)) { } @@ -145,7 +145,7 @@ string FilesystemNode::getNameWithExt(const string& ext) const string s = pos == string::npos ? _realNode->getName() : _realNode->getName().substr(pos+1); - pos = s.find_last_of("."); + pos = s.find_last_of('.'); return (pos != string::npos) ? s.replace(pos, string::npos, ext) : s + ext; } @@ -157,7 +157,7 @@ string FilesystemNode::getPathWithExt(const string& ext) const string s = _realNode->getPath(); - size_t pos = s.find_last_of("."); + size_t pos = s.find_last_of('.'); return (pos != string::npos) ? s.replace(pos, string::npos, ext) : s + ext; } diff --git a/src/emucore/M6502.hxx b/src/emucore/M6502.hxx index 10df4a13a..06472adcc 100644 --- a/src/emucore/M6502.hxx +++ b/src/emucore/M6502.hxx @@ -94,7 +94,9 @@ class M6502 : public Serializable /** Set the callback for handling a halt condition */ - void setOnHaltCallback(onHaltCallback callback) { myOnHaltCallback = callback; } + void setOnHaltCallback(const onHaltCallback& callback) { + myOnHaltCallback = callback; + } /** RDY pulled low --- halt on next read. diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx index ce1ca257f..4c9cef8b9 100644 --- a/src/emucore/MT24LC256.cxx +++ b/src/emucore/MT24LC256.cxx @@ -44,7 +44,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MT24LC256::MT24LC256(const string& filename, const System& system, - Controller::onMessageCallback callback) + const Controller::onMessageCallback& callback) : mySystem(system), myCallback(callback), mySDA(false), diff --git a/src/emucore/MT24LC256.hxx b/src/emucore/MT24LC256.hxx index 5f7e6c3a4..1fb659632 100644 --- a/src/emucore/MT24LC256.hxx +++ b/src/emucore/MT24LC256.hxx @@ -41,7 +41,7 @@ class MT24LC256 @param callback Called to pass messages back to the parent controller */ MT24LC256(const string& filename, const System& system, - Controller::onMessageCallback callback); + const Controller::onMessageCallback& callback); ~MT24LC256(); public: @@ -89,7 +89,7 @@ class MT24LC256 // Sends messages back to the parent class // Currently used for indicating read/write access - Controller::onMessageCallback myCallback; + const Controller::onMessageCallback myCallback; // The EEPROM data std::array myData; diff --git a/src/emucore/ProfilingRunner.cxx b/src/emucore/ProfilingRunner.cxx index 9935872a6..f2bd97c0c 100644 --- a/src/emucore/ProfilingRunner.cxx +++ b/src/emucore/ProfilingRunner.cxx @@ -63,7 +63,7 @@ ProfilingRunner::ProfilingRunner(int argc, char* argv[]) ProfilingRun& run(profilingRuns[i-2]); string arg = argv[i]; - size_t splitPoint = arg.find_first_of(":"); + size_t splitPoint = arg.find_first_of(':'); run.romFile = splitPoint == string::npos ? arg : arg.substr(0, splitPoint); @@ -92,7 +92,7 @@ bool ProfilingRunner::run() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool ProfilingRunner::runOne(const ProfilingRun run) +bool ProfilingRunner::runOne(const ProfilingRun& run) { FilesystemNode imageFile(run.romFile); diff --git a/src/emucore/ProfilingRunner.hxx b/src/emucore/ProfilingRunner.hxx index 6c63de49a..48dbe9e08 100644 --- a/src/emucore/ProfilingRunner.hxx +++ b/src/emucore/ProfilingRunner.hxx @@ -52,7 +52,7 @@ class ProfilingRunner { private: - bool runOne(const ProfilingRun run); + bool runOne(const ProfilingRun& run); private: diff --git a/src/emucore/SaveKey.cxx b/src/emucore/SaveKey.cxx index 45734fff7..b9546b5cc 100644 --- a/src/emucore/SaveKey.cxx +++ b/src/emucore/SaveKey.cxx @@ -22,7 +22,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SaveKey::SaveKey(Jack jack, const Event& event, const System& system, - const string& eepromfile, onMessageCallback callback, Type type) + const string& eepromfile, const onMessageCallback& callback, + Type type) : Controller(jack, event, system, type) { myEEPROM = make_unique(eepromfile, system, callback); @@ -33,7 +34,7 @@ SaveKey::SaveKey(Jack jack, const Event& event, const System& system, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SaveKey::SaveKey(Jack jack, const Event& event, const System& system, - const string& eepromfile, onMessageCallback callback) + const string& eepromfile, const onMessageCallback& callback) : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::SaveKey) { } diff --git a/src/emucore/SaveKey.hxx b/src/emucore/SaveKey.hxx index cb483b18a..89fa6c8a5 100644 --- a/src/emucore/SaveKey.hxx +++ b/src/emucore/SaveKey.hxx @@ -45,7 +45,7 @@ class SaveKey : public Controller @param callback Called to pass messages back to the parent controller */ SaveKey(Jack jack, const Event& event, const System& system, - const string& eepromfile, onMessageCallback callback); + const string& eepromfile, const onMessageCallback& callback); virtual ~SaveKey(); protected: @@ -54,7 +54,7 @@ class SaveKey : public Controller that inherit from SaveKey (currently, AtariVox) */ SaveKey(Jack jack, const Event& event, const System& system, - const string& eepromfile, onMessageCallback callback, Type type); + const string& eepromfile, const onMessageCallback& callback, Type type); public: using Controller::read; diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index c53654584..4d1287bd8 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -218,7 +218,7 @@ Settings::Settings() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Settings::setRepository(shared_ptr repository) { - myRespository = repository; + myRespository = std::move(repository); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/Audio.cxx b/src/emucore/tia/Audio.cxx index ca8943522..84b53295b 100644 --- a/src/emucore/tia/Audio.cxx +++ b/src/emucore/tia/Audio.cxx @@ -55,7 +55,7 @@ void Audio::reset() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Audio::setAudioQueue(shared_ptr queue) +void Audio::setAudioQueue(const shared_ptr& queue) { myAudioQueue = queue; diff --git a/src/emucore/tia/Audio.hxx b/src/emucore/tia/Audio.hxx index 761b22080..8494c7934 100644 --- a/src/emucore/tia/Audio.hxx +++ b/src/emucore/tia/Audio.hxx @@ -31,7 +31,7 @@ class Audio : public Serializable void reset(); - void setAudioQueue(shared_ptr queue); + void setAudioQueue(const shared_ptr& queue); void tick(); diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 698ae2bc0..dd5f901ee 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -66,7 +66,8 @@ enum ResxCounter: uInt8 { static constexpr uInt8 resxLateHblankThreshold = TIAConstants::H_CYCLES - 3; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TIA::TIA(ConsoleIO& console, ConsoleTimingProvider timingProvider, Settings& settings) +TIA::TIA(ConsoleIO& console, const ConsoleTimingProvider& timingProvider, + Settings& settings) : myConsole(console), myTimingProvider(timingProvider), mySettings(settings), @@ -112,7 +113,7 @@ void TIA::setFrameManager(AbstractFrameManager* frameManager) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIA::setAudioQueue(shared_ptr queue) +void TIA::setAudioQueue(const shared_ptr& queue) { myAudio.setAudioQueue(queue); } diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 74cde1f36..e6d79faeb 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -115,8 +115,8 @@ class TIA : public Device @param console The console the TIA is associated with @param settings The settings object for this TIA device */ - TIA(ConsoleIO& console, ConsoleTimingProvider timingProvider, Settings& settings); - + TIA(ConsoleIO& console, const ConsoleTimingProvider& timingProvider, + Settings& settings); virtual ~TIA() = default; public: @@ -129,7 +129,7 @@ class TIA : public Device Set the audio queue. This needs to be dynamic as the queue is created after the timing has been determined. */ - void setAudioQueue(shared_ptr audioQueue); + void setAudioQueue(const shared_ptr& audioQueue); /** Clear the configured frame manager and deteach the lifecycle callbacks. diff --git a/src/emucore/tia/frame-manager/AbstractFrameManager.cxx b/src/emucore/tia/frame-manager/AbstractFrameManager.cxx index 6ba5295c6..9f322173c 100644 --- a/src/emucore/tia/frame-manager/AbstractFrameManager.cxx +++ b/src/emucore/tia/frame-manager/AbstractFrameManager.cxx @@ -53,9 +53,10 @@ void AbstractFrameManager::nextLine() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void AbstractFrameManager::setHandlers( - callback frameStartCallback, - callback frameCompletionCallback -) { + const callback& frameStartCallback, + const callback& frameCompletionCallback +) +{ myOnFrameStart = frameStartCallback; myOnFrameComplete = frameCompletionCallback; } diff --git a/src/emucore/tia/frame-manager/AbstractFrameManager.hxx b/src/emucore/tia/frame-manager/AbstractFrameManager.hxx index 7a20b7033..e37aa5488 100644 --- a/src/emucore/tia/frame-manager/AbstractFrameManager.hxx +++ b/src/emucore/tia/frame-manager/AbstractFrameManager.hxx @@ -40,8 +40,8 @@ class AbstractFrameManager : public Serializable * Configure the various handler callbacks. */ void setHandlers( - callback frameStartCallback, - callback frameCompletionCallback + const callback& frameStartCallback, + const callback& frameCompletionCallback ); /** diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index 28d50d5a4..95555035c 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -763,7 +763,6 @@ void DeveloperDialog::getWidgetStates(SettingsSet set) myTimeMachine[set] = myTimeMachineWidget->getState(); myStateSize[set] = myStateSizeWidget->getValue(); myUncompressed[set] = myUncompressedWidget->getValue(); - myStateInterval[set] = myStateIntervalWidget->getSelected(); myStateInterval[set] = myStateIntervalWidget->getSelectedTag().toString(); myStateHorizon[set] = myStateHorizonWidget->getSelectedTag().toString(); } diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx index ac21298fe..a49b77939 100644 --- a/src/gui/FileListWidget.cxx +++ b/src/gui/FileListWidget.cxx @@ -58,7 +58,7 @@ void FileListWidget::setDirectory(const FilesystemNode& node, string select) if(name.back() == '/' || name.back() == '\\') name.pop_back(); if(!BSPF::startsWithIgnoreCase(name, " [")) - name = " [" + name + "]"; + name = " [" + name.append("]"); _history.push(name); tmp = tmp.getParent(); diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index 4acadc345..ddd27bde2 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -425,7 +425,7 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props) } else { - string startBank = props.get(PropType::Cart_StartBank); + const string& startBank = props.get(PropType::Cart_StartBank); VarList::push_back(items, startBank, startBank); myStartBank->setEnabled(false); diff --git a/src/gui/RomAuditDialog.cxx b/src/gui/RomAuditDialog.cxx index c62176f0f..5e07e8cfd 100644 --- a/src/gui/RomAuditDialog.cxx +++ b/src/gui/RomAuditDialog.cxx @@ -127,7 +127,7 @@ void RomAuditDialog::auditRoms() progress.setRange(0, int(files.size()) - 1, 5); Properties props; - int renamed = 0, notfound = 0; + uInt32 renamed = 0, notfound = 0; for(uInt32 idx = 0; idx < files.size(); ++idx) { string extension; @@ -162,8 +162,8 @@ void RomAuditDialog::auditRoms() } progress.close(); - myResults1->setText(Variant(renamed).toString()); - myResults2->setText(Variant(notfound).toString()); + myResults1->setText(std::to_string(renamed)); + myResults2->setText(std::to_string(notfound)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/RomInfoWidget.hxx b/src/gui/RomInfoWidget.hxx index 88639130f..ff893266f 100644 --- a/src/gui/RomInfoWidget.hxx +++ b/src/gui/RomInfoWidget.hxx @@ -20,7 +20,7 @@ class FBSurface; class Properties; -namespace GUI { +namespace Common { struct Size; }