Many more fixes for suggestions from clang-tidy.

This commit is contained in:
Stephen Anthony 2019-12-24 22:11:36 -03:30
parent 198ab08647
commit 730b2970c8
65 changed files with 112 additions and 106 deletions

View File

@ -147,8 +147,8 @@ shared_ptr<Cheat> CheatManager::createCheat(const string& name, const string& co
void CheatManager::parse(const string& cheats) void CheatManager::parse(const string& cheats)
{ {
StringList s; StringList s;
string::size_type lastPos = cheats.find_first_not_of(",", 0); string::size_type lastPos = cheats.find_first_not_of(',', 0);
string::size_type pos = cheats.find_first_of(",", lastPos); string::size_type pos = cheats.find_first_of(',', lastPos);
string cheat, name, code; string cheat, name, code;
// Split string by comma, getting each cheat // Split string by comma, getting each cheat
@ -158,13 +158,13 @@ void CheatManager::parse(const string& cheats)
cheat = cheats.substr(lastPos, pos - lastPos); cheat = cheats.substr(lastPos, pos - lastPos);
// Split cheat by colon, separating each part // Split cheat by colon, separating each part
string::size_type lastColonPos = cheat.find_first_not_of(":", 0); string::size_type lastColonPos = cheat.find_first_not_of(':', 0);
string::size_type colonPos = cheat.find_first_of(":", lastColonPos); string::size_type colonPos = cheat.find_first_of(':', lastColonPos);
while(string::npos != colonPos || string::npos != lastColonPos) while(string::npos != colonPos || string::npos != lastColonPos)
{ {
s.push_back(cheat.substr(lastColonPos, colonPos - lastColonPos)); s.push_back(cheat.substr(lastColonPos, colonPos - lastColonPos));
lastColonPos = cheat.find_first_not_of(":", colonPos); lastColonPos = cheat.find_first_not_of(':', colonPos);
colonPos = cheat.find_first_of(":", lastColonPos); colonPos = cheat.find_first_of(':', lastColonPos);
} }
// Account for variable number of items specified for cheat // Account for variable number of items specified for cheat
@ -190,8 +190,8 @@ void CheatManager::parse(const string& cheats)
} }
s.clear(); s.clear();
lastPos = cheats.find_first_not_of(",", pos); lastPos = cheats.find_first_not_of(',', pos);
pos = cheats.find_first_of(",", lastPos); pos = cheats.find_first_of(',', lastPos);
} }
} }
@ -228,10 +228,10 @@ void CheatManager::loadCheatDatabase()
if(line.length() == 0) if(line.length() == 0)
continue; continue;
one = line.find("\"", 0); one = line.find('\"', 0);
two = line.find("\"", one + 1); two = line.find('\"', one + 1);
three = line.find("\"", two + 1); three = line.find('\"', two + 1);
four = line.find("\"", three + 1); four = line.find('\"', three + 1);
// Invalid line if it doesn't contain 4 quotes // Invalid line if it doesn't contain 4 quotes
if((one == string::npos) || (two == string::npos) || if((one == string::npos) || (two == string::npos) ||

View File

@ -106,7 +106,7 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeZIP::FilesystemNodeZIP( FilesystemNodeZIP::FilesystemNodeZIP(
const string& zipfile, const string& virtualpath, const string& zipfile, const string& virtualpath,
AbstractFSNodePtr realnode, bool isdir) const AbstractFSNodePtr& realnode, bool isdir)
: _error(zip_error::NONE), : _error(zip_error::NONE),
_numFiles(0), _numFiles(0),
_isDirectory(isdir), _isDirectory(isdir),
@ -118,7 +118,7 @@ FilesystemNodeZIP::FilesystemNodeZIP(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FilesystemNodeZIP::setFlags(const string& zipfile, void FilesystemNodeZIP::setFlags(const string& zipfile,
const string& virtualpath, const string& virtualpath,
AbstractFSNodePtr realnode) const AbstractFSNodePtr& realnode)
{ {
_zipFile = zipfile; _zipFile = zipfile;
_virtualPath = virtualpath; _virtualPath = virtualpath;

View File

@ -71,10 +71,10 @@ class FilesystemNodeZIP : public AbstractFSNode
private: private:
FilesystemNodeZIP(const string& zipfile, const string& virtualpath, FilesystemNodeZIP(const string& zipfile, const string& virtualpath,
AbstractFSNodePtr realnode, bool isdir); const AbstractFSNodePtr& realnode, bool isdir);
void setFlags(const string& zipfile, const string& virtualpath, void setFlags(const string& zipfile, const string& virtualpath,
AbstractFSNodePtr realnode); const AbstractFSNodePtr& realnode);
friend ostream& operator<<(ostream& os, const FilesystemNodeZIP& node) friend ostream& operator<<(ostream& os, const FilesystemNodeZIP& node)
{ {

View File

@ -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 // Skip if we couldn't open it for any reason
if(stick->ID < 0) 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) for (const auto& event : events)
enableMapping(event, mode); enableMapping(event, mode);

View File

@ -49,7 +49,7 @@ class PhysicalJoystickHandler
struct StickInfo struct StickInfo
{ {
StickInfo(const string& map = EmptyString, PhysicalJoystickPtr stick = nullptr) StickInfo(const string& map = EmptyString, PhysicalJoystickPtr stick = nullptr)
: mapping(map), joy(stick) {} : mapping(map), joy(std::move(stick)) {}
string mapping; string mapping;
PhysicalJoystickPtr joy; PhysicalJoystickPtr joy;
@ -64,7 +64,7 @@ class PhysicalJoystickHandler
PhysicalJoystickHandler(OSystem& system, EventHandler& handler); PhysicalJoystickHandler(OSystem& system, EventHandler& handler);
/** Return stick ID on success, -1 on failure. */ /** Return stick ID on success, -1 on failure. */
int add(PhysicalJoystickPtr stick); int add(const PhysicalJoystickPtr& stick);
bool remove(int id); bool remove(int id);
bool remove(const string& name); bool remove(const string& name);
void mapStelladaptors(const string& saport); void mapStelladaptors(const string& saport);
@ -161,7 +161,7 @@ class PhysicalJoystickHandler
void enableCommonMappings(); 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); void enableMapping(const Event::Type event, EventMode mode);
private: private:

View File

@ -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) for (const auto& event : events)
enableMapping(event, mode); enableMapping(event, mode);

View File

@ -100,7 +100,7 @@ class PhysicalKeyboardHandler
void enableCommonMappings(); 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); void enableMapping(const Event::Type event, EventMode mode);
OSystem& myOSystem; OSystem& myOSystem;

View File

@ -64,7 +64,7 @@ TimerManager::TimerId TimerManager::addTimer(
// Assign an ID and insert it into function storage // Assign an ID and insert it into function storage
auto id = nextId++; auto id = nextId++;
auto iter = active.emplace(id, Timer(id, Clock::now() + Duration(msDelay), 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 // Insert a reference to the Timer into ordering queue
Queue::iterator place = queue.emplace(iter.first->second); Queue::iterator place = queue.emplace(iter.first->second);
@ -240,11 +240,11 @@ TimerManager::Timer::Timer(TimerId tid)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimerManager::Timer::Timer(Timer&& r) noexcept TimerManager::Timer::Timer(Timer&& r) noexcept
: id(std::move(r.id)), : id(r.id),
next(std::move(r.next)), next(r.next),
period(std::move(r.period)), period(r.period),
handler(std::move(r.handler)), 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), : id(tid),
next(tnext), next(tnext),
period(tperiod), period(tperiod),
handler(std::move(func)), handler(func),
running(false) running(false)
{ {
} }

View File

@ -56,7 +56,7 @@ namespace {
LanczosResampler::LanczosResampler( LanczosResampler::LanczosResampler(
Resampler::Format formatFrom, Resampler::Format formatFrom,
Resampler::Format formatTo, Resampler::Format formatTo,
Resampler::NextFragmentCallback nextFragmentCallback, const Resampler::NextFragmentCallback& nextFragmentCallback,
uInt32 kernelParameter) uInt32 kernelParameter)
: :
Resampler(formatFrom, formatTo, nextFragmentCallback), Resampler(formatFrom, formatTo, nextFragmentCallback),

View File

@ -29,7 +29,7 @@ class LanczosResampler : public Resampler
LanczosResampler( LanczosResampler(
Resampler::Format formatFrom, Resampler::Format formatFrom,
Resampler::Format formatTo, Resampler::Format formatTo,
Resampler::NextFragmentCallback nextFragmentCallback, const Resampler::NextFragmentCallback& nextFragmentCallback,
uInt32 kernelParameter uInt32 kernelParameter
); );

View File

@ -50,7 +50,8 @@ class Resampler {
public: public:
Resampler(Format formatFrom, Format formatTo, NextFragmentCallback nextFragmentCallback) : Resampler(Format formatFrom, Format formatTo,
const NextFragmentCallback& nextFragmentCallback) :
myFormatFrom(formatFrom), myFormatFrom(formatFrom),
myFormatTo(formatTo), myFormatTo(formatTo),
myNextFragmentCallback(nextFragmentCallback), myNextFragmentCallback(nextFragmentCallback),

View File

@ -21,7 +21,7 @@
SimpleResampler::SimpleResampler( SimpleResampler::SimpleResampler(
Resampler::Format formatFrom, Resampler::Format formatFrom,
Resampler::Format formatTo, Resampler::Format formatTo,
Resampler::NextFragmentCallback nextFragmentCallback) const Resampler::NextFragmentCallback& nextFragmentCallback)
: Resampler(formatFrom, formatTo, nextFragmentCallback), : Resampler(formatFrom, formatTo, nextFragmentCallback),
myCurrentFragment(nullptr), myCurrentFragment(nullptr),
myTimeIndex(0), myTimeIndex(0),

View File

@ -27,7 +27,7 @@ class SimpleResampler : public Resampler
SimpleResampler( SimpleResampler(
Resampler::Format formatFrom, Resampler::Format formatFrom,
Resampler::Format formatTo, Resampler::Format formatTo,
Resampler::NextFragmentCallback NextFragmentCallback const Resampler::NextFragmentCallback& NextFragmentCallback
); );
void fillFragment(float* fragment, uInt32 length) override; void fillFragment(float* fragment, uInt32 length) override;

View File

@ -50,7 +50,7 @@ std::map<string, Variant> KeyValueRepositoryConfigfile::load()
while(getline(in, line)) while(getline(in, line))
{ {
// Strip all whitespace and tabs from the 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); line.erase(garbage, 1);
// Ignore commented and empty lines // Ignore commented and empty lines
@ -58,7 +58,7 @@ std::map<string, Variant> KeyValueRepositoryConfigfile::load()
continue; continue;
// Search for the equal sign and discard the line if its not found // 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; continue;
// Split the line into key/value pairs and trim any whitespace // Split the line into key/value pairs and trim any whitespace
@ -78,7 +78,7 @@ std::map<string, Variant> KeyValueRepositoryConfigfile::load()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyValueRepositoryConfigfile::save(const std::map<string, Variant>& values) void KeyValueRepositoryConfigfile::save(const std::map<string, Variant>& values)
{ {
ofstream out(myFilename); ofstream out(myFilename);
if(!out || !out.is_open()) { if(!out || !out.is_open()) {
Logger::error("ERROR: Couldn't save to settings file " + myFilename); Logger::error("ERROR: Couldn't save to settings file " + myFilename);

View File

@ -214,7 +214,7 @@ string CartDebug::toString()
curraddr = state.rport[i]; curraddr = state.rport[i];
buf << Base::HEX2 << (curraddr & 0x00ff) << ": "; 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]) << " "; 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)) if (iter == myUserLabels.end() || !BSPF::equalsIgnoreCase(label, iter->second))
{ {
// Check for period, and strip leading number // 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) if(pos != string::npos)
addLabel(label.substr(pos), value); addLabel(label.substr(pos), value);
else else
{ {
pos = label.find_last_of("$"); pos = label.find_last_of('$');
if (pos == string::npos || pos != label.length() - 1) if (pos == string::npos || pos != label.length() - 1)
addLabel(label, value); addLabel(label, value);
} }

View File

@ -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 // Add another rewind level to the Time Machine buffer
RewindManager& r = myOSystem.state().rewindManager(); RewindManager& r = myOSystem.state().rewindManager();

View File

@ -293,7 +293,7 @@ class Debugger : public DialogContainer
/** /**
Saves a rewind state with the given message. Saves a rewind state with the given message.
*/ */
void addState(string rewindMsg); void addState(const string& rewindMsg);
/** /**
Set initial state before entering the debugger. Set initial state before entering the debugger.

View File

@ -44,8 +44,8 @@ class DelayQueueWidget : public Widget
DelayQueueWidget() = delete; DelayQueueWidget() = delete;
DelayQueueWidget(const DelayQueueWidget&) = delete; DelayQueueWidget(const DelayQueueWidget&) = delete;
DelayQueueWidget(DelayQueueWidget&&) = delete; DelayQueueWidget(DelayQueueWidget&&) = delete;
DelayQueueWidget& operator=(const DelayQueueWidget&); DelayQueueWidget& operator=(const DelayQueueWidget&) = delete;
DelayQueueWidget& operator=(DelayQueueWidget&&); DelayQueueWidget& operator=(DelayQueueWidget&&) = delete;
}; };
#endif // DELAY_QUEUE_WIDGET_HXX #endif // DELAY_QUEUE_WIDGET_HXX

View File

@ -810,6 +810,7 @@ void PromptWidget::updateScrollBuffer()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: rewrite this (cert-dcl50-cpp)
int PromptWidget::printf(const char* format, ...) int PromptWidget::printf(const char* format, ...)
{ {
va_list argptr; va_list argptr;

View File

@ -23,7 +23,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AtariVox::AtariVox(Jack jack, const Event& event, const System& system, AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
const string& portname, const string& eepromfile, const string& portname, const string& eepromfile,
onMessageCallback callback) const onMessageCallback& callback)
: SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox), : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox),
myShiftCount(0), myShiftCount(0),
myShiftRegister(0), myShiftRegister(0),

View File

@ -48,7 +48,7 @@ class AtariVox : public SaveKey
*/ */
AtariVox(Jack jack, const Event& event, const System& system, AtariVox(Jack jack, const Event& event, const System& system,
const string& portname, const string& eepromfile, const string& portname, const string& eepromfile,
onMessageCallback callback); const onMessageCallback& callback);
virtual ~AtariVox() = default; virtual ~AtariVox() = default;
public: public:

View File

@ -91,8 +91,8 @@ class Cartridge : public Device
Set the function to use when we want to query the 'Cartridge.StartBank' Set the function to use when we want to query the 'Cartridge.StartBank'
ROM property. ROM property.
*/ */
void setStartBankFromPropsFunc(StartBankFromPropsFunc func) { void setStartBankFromPropsFunc(const StartBankFromPropsFunc& func) {
myStartBankFromPropsFunc = std::move(func); myStartBankFromPropsFunc = func;
} }
/** /**

View File

@ -94,7 +94,7 @@ bool CartridgeBF::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1F80U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -133,7 +133,7 @@ bool CartridgeBFSC::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1F80U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -90,7 +90,7 @@ bool CartridgeDF::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FC0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -133,7 +133,7 @@ bool CartridgeDFSC::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FC0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -394,7 +394,7 @@ bool CartridgeDPC::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myProgramImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myProgramImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -57,7 +57,7 @@ void CartridgeE0::install(System& system)
System::PageAccess access(this, System::PageAccessType::READ); System::PageAccess access(this, System::PageAccessType::READ);
// Set the page acessing methods for the first part of the last segment // 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<uInt16>(0x1FE0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[0x1C00 + (addr & 0x03FF)]; access.directPeekBase = &myImage[0x1C00 + (addr & 0x03FF)];

View File

@ -90,7 +90,7 @@ bool CartridgeEF::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FE0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -133,7 +133,7 @@ bool CartridgeEFSC::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FE0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -97,7 +97,7 @@ bool CartridgeF0::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -94,7 +94,7 @@ bool CartridgeF4::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF4U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -133,7 +133,7 @@ bool CartridgeF4SC::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF4U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -134,7 +134,7 @@ bool CartridgeF6::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF6U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -173,7 +173,7 @@ bool CartridgeF6SC::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF6U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -115,7 +115,7 @@ bool CartridgeF8::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -153,7 +153,7 @@ bool CartridgeF8SC::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -163,7 +163,7 @@ bool CartridgeFA::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -230,7 +230,7 @@ bool CartridgeFA2::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF4U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -126,7 +126,7 @@ bool CartridgeFC::bank(uInt16 bank)
} }
// Setup the page access methods for the current 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<uInt16>(0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE) addr += System::PAGE_SIZE)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -252,8 +252,8 @@ class Controller : public Serializable
/** /**
Inject a callback to be notified on analog pin updates. Inject a callback to be notified on analog pin updates.
*/ */
void setOnAnalogPinUpdateCallback(onAnalogPinUpdateCallback callback) { void setOnAnalogPinUpdateCallback(const onAnalogPinUpdateCallback& callback) {
myOnAnalogPinUpdateCallback = std::move(callback); myOnAnalogPinUpdateCallback = callback;
} }
/** /**

View File

@ -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(); (cerr << "FATAL in emulation worker: " << message << std::endl).flush();
throw runtime_error(message); throw runtime_error(message);

View File

@ -128,7 +128,7 @@ class EmulationWorker
/** /**
Log a fatal error to cerr and throw a runtime exception. Log a fatal error to cerr and throw a runtime exception.
*/ */
[[noreturn]] void fatal(string message); [[noreturn]] void fatal(const string& message);
private: private:
/** /**

View File

@ -147,7 +147,7 @@ void EventHandler::reset(EventHandlerState state)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::addPhysicalJoystick(PhysicalJoystickPtr joy) void EventHandler::addPhysicalJoystick(const PhysicalJoystickPtr& joy)
{ {
#ifdef JOYSTICK_SUPPORT #ifdef JOYSTICK_SUPPORT
int ID = myPJoyHandler->add(joy); int ID = myPJoyHandler->add(joy);

View File

@ -380,7 +380,7 @@ class EventHandler
/** /**
Add the given joystick to the list of physical joysticks available to the handler. 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. Remove physical joystick at the current index.

View File

@ -28,7 +28,7 @@ FilesystemNode::FilesystemNode()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode::FilesystemNode(AbstractFSNodePtr realNode) 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() : string s = pos == string::npos ? _realNode->getName() :
_realNode->getName().substr(pos+1); _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; 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(); 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; return (pos != string::npos) ? s.replace(pos, string::npos, ext) : s + ext;
} }

View File

@ -94,7 +94,9 @@ class M6502 : public Serializable
/** /**
Set the callback for handling a halt condition 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. RDY pulled low --- halt on next read.

View File

@ -44,7 +44,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MT24LC256::MT24LC256(const string& filename, const System& system, MT24LC256::MT24LC256(const string& filename, const System& system,
Controller::onMessageCallback callback) const Controller::onMessageCallback& callback)
: mySystem(system), : mySystem(system),
myCallback(callback), myCallback(callback),
mySDA(false), mySDA(false),

View File

@ -41,7 +41,7 @@ class MT24LC256
@param callback Called to pass messages back to the parent controller @param callback Called to pass messages back to the parent controller
*/ */
MT24LC256(const string& filename, const System& system, MT24LC256(const string& filename, const System& system,
Controller::onMessageCallback callback); const Controller::onMessageCallback& callback);
~MT24LC256(); ~MT24LC256();
public: public:
@ -89,7 +89,7 @@ class MT24LC256
// Sends messages back to the parent class // Sends messages back to the parent class
// Currently used for indicating read/write access // Currently used for indicating read/write access
Controller::onMessageCallback myCallback; const Controller::onMessageCallback myCallback;
// The EEPROM data // The EEPROM data
std::array<uInt8, FLASH_SIZE> myData; std::array<uInt8, FLASH_SIZE> myData;

View File

@ -63,7 +63,7 @@ ProfilingRunner::ProfilingRunner(int argc, char* argv[])
ProfilingRun& run(profilingRuns[i-2]); ProfilingRun& run(profilingRuns[i-2]);
string arg = argv[i]; 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); 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); FilesystemNode imageFile(run.romFile);

View File

@ -52,7 +52,7 @@ class ProfilingRunner {
private: private:
bool runOne(const ProfilingRun run); bool runOne(const ProfilingRun& run);
private: private:

View File

@ -22,7 +22,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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, Type type) const string& eepromfile, const onMessageCallback& callback,
Type type)
: Controller(jack, event, system, type) : Controller(jack, event, system, type)
{ {
myEEPROM = make_unique<MT24LC256>(eepromfile, system, callback); myEEPROM = make_unique<MT24LC256>(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, 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) : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::SaveKey)
{ {
} }

View File

@ -45,7 +45,7 @@ class SaveKey : public Controller
@param callback Called to pass messages back to the parent controller @param callback Called to pass messages back to the parent controller
*/ */
SaveKey(Jack jack, const Event& event, const System& system, SaveKey(Jack jack, const Event& event, const System& system,
const string& eepromfile, onMessageCallback callback); const string& eepromfile, const onMessageCallback& callback);
virtual ~SaveKey(); virtual ~SaveKey();
protected: protected:
@ -54,7 +54,7 @@ class SaveKey : public Controller
that inherit from SaveKey (currently, AtariVox) that inherit from SaveKey (currently, AtariVox)
*/ */
SaveKey(Jack jack, const Event& event, const System& system, 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: public:
using Controller::read; using Controller::read;

View File

@ -218,7 +218,7 @@ Settings::Settings()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Settings::setRepository(shared_ptr<KeyValueRepository> repository) void Settings::setRepository(shared_ptr<KeyValueRepository> repository)
{ {
myRespository = repository; myRespository = std::move(repository);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -55,7 +55,7 @@ void Audio::reset()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Audio::setAudioQueue(shared_ptr<AudioQueue> queue) void Audio::setAudioQueue(const shared_ptr<AudioQueue>& queue)
{ {
myAudioQueue = queue; myAudioQueue = queue;

View File

@ -31,7 +31,7 @@ class Audio : public Serializable
void reset(); void reset();
void setAudioQueue(shared_ptr<AudioQueue> queue); void setAudioQueue(const shared_ptr<AudioQueue>& queue);
void tick(); void tick();

View File

@ -66,7 +66,8 @@ enum ResxCounter: uInt8 {
static constexpr uInt8 resxLateHblankThreshold = TIAConstants::H_CYCLES - 3; 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), : myConsole(console),
myTimingProvider(timingProvider), myTimingProvider(timingProvider),
mySettings(settings), mySettings(settings),
@ -112,7 +113,7 @@ void TIA::setFrameManager(AbstractFrameManager* frameManager)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::setAudioQueue(shared_ptr<AudioQueue> queue) void TIA::setAudioQueue(const shared_ptr<AudioQueue>& queue)
{ {
myAudio.setAudioQueue(queue); myAudio.setAudioQueue(queue);
} }

View File

@ -115,8 +115,8 @@ class TIA : public Device
@param console The console the TIA is associated with @param console The console the TIA is associated with
@param settings The settings object for this TIA device @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; virtual ~TIA() = default;
public: public:
@ -129,7 +129,7 @@ class TIA : public Device
Set the audio queue. This needs to be dynamic as the queue is created after Set the audio queue. This needs to be dynamic as the queue is created after
the timing has been determined. the timing has been determined.
*/ */
void setAudioQueue(shared_ptr<AudioQueue> audioQueue); void setAudioQueue(const shared_ptr<AudioQueue>& audioQueue);
/** /**
Clear the configured frame manager and deteach the lifecycle callbacks. Clear the configured frame manager and deteach the lifecycle callbacks.

View File

@ -53,9 +53,10 @@ void AbstractFrameManager::nextLine()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AbstractFrameManager::setHandlers( void AbstractFrameManager::setHandlers(
callback frameStartCallback, const callback& frameStartCallback,
callback frameCompletionCallback const callback& frameCompletionCallback
) { )
{
myOnFrameStart = frameStartCallback; myOnFrameStart = frameStartCallback;
myOnFrameComplete = frameCompletionCallback; myOnFrameComplete = frameCompletionCallback;
} }

View File

@ -40,8 +40,8 @@ class AbstractFrameManager : public Serializable
* Configure the various handler callbacks. * Configure the various handler callbacks.
*/ */
void setHandlers( void setHandlers(
callback frameStartCallback, const callback& frameStartCallback,
callback frameCompletionCallback const callback& frameCompletionCallback
); );
/** /**

View File

@ -763,7 +763,6 @@ void DeveloperDialog::getWidgetStates(SettingsSet set)
myTimeMachine[set] = myTimeMachineWidget->getState(); myTimeMachine[set] = myTimeMachineWidget->getState();
myStateSize[set] = myStateSizeWidget->getValue(); myStateSize[set] = myStateSizeWidget->getValue();
myUncompressed[set] = myUncompressedWidget->getValue(); myUncompressed[set] = myUncompressedWidget->getValue();
myStateInterval[set] = myStateIntervalWidget->getSelected();
myStateInterval[set] = myStateIntervalWidget->getSelectedTag().toString(); myStateInterval[set] = myStateIntervalWidget->getSelectedTag().toString();
myStateHorizon[set] = myStateHorizonWidget->getSelectedTag().toString(); myStateHorizon[set] = myStateHorizonWidget->getSelectedTag().toString();
} }

View File

@ -58,7 +58,7 @@ void FileListWidget::setDirectory(const FilesystemNode& node, string select)
if(name.back() == '/' || name.back() == '\\') if(name.back() == '/' || name.back() == '\\')
name.pop_back(); name.pop_back();
if(!BSPF::startsWithIgnoreCase(name, " [")) if(!BSPF::startsWithIgnoreCase(name, " ["))
name = " [" + name + "]"; name = " [" + name.append("]");
_history.push(name); _history.push(name);
tmp = tmp.getParent(); tmp = tmp.getParent();

View File

@ -425,7 +425,7 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
} }
else else
{ {
string startBank = props.get(PropType::Cart_StartBank); const string& startBank = props.get(PropType::Cart_StartBank);
VarList::push_back(items, startBank, startBank); VarList::push_back(items, startBank, startBank);
myStartBank->setEnabled(false); myStartBank->setEnabled(false);

View File

@ -127,7 +127,7 @@ void RomAuditDialog::auditRoms()
progress.setRange(0, int(files.size()) - 1, 5); progress.setRange(0, int(files.size()) - 1, 5);
Properties props; Properties props;
int renamed = 0, notfound = 0; uInt32 renamed = 0, notfound = 0;
for(uInt32 idx = 0; idx < files.size(); ++idx) for(uInt32 idx = 0; idx < files.size(); ++idx)
{ {
string extension; string extension;
@ -162,8 +162,8 @@ void RomAuditDialog::auditRoms()
} }
progress.close(); progress.close();
myResults1->setText(Variant(renamed).toString()); myResults1->setText(std::to_string(renamed));
myResults2->setText(Variant(notfound).toString()); myResults2->setText(std::to_string(notfound));
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -20,7 +20,7 @@
class FBSurface; class FBSurface;
class Properties; class Properties;
namespace GUI { namespace Common {
struct Size; struct Size;
} }