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)
{
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) ||

View File

@ -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;

View File

@ -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)
{

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
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);

View File

@ -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:

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)
enableMapping(event, mode);

View File

@ -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;

View File

@ -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)
{
}

View File

@ -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),

View File

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

View File

@ -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),

View File

@ -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),

View File

@ -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;

View File

@ -50,7 +50,7 @@ std::map<string, Variant> 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<string, Variant> 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<string, Variant> KeyValueRepositoryConfigfile::load()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyValueRepositoryConfigfile::save(const std::map<string, Variant>& values)
{
ofstream out(myFilename);
ofstream out(myFilename);
if(!out || !out.is_open()) {
Logger::error("ERROR: Couldn't save to settings file " + myFilename);

View File

@ -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);
}

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
RewindManager& r = myOSystem.state().rewindManager();

View File

@ -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.

View File

@ -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

View File

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

View File

@ -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),

View File

@ -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:

View File

@ -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;
}
/**

View File

@ -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<uInt16>(0x1F80U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
access.directPeekBase = &myProgramImage[myBankOffset + (addr & 0x0FFF)];

View File

@ -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<uInt16>(0x1FE0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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
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)
{
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.
*/
void setOnAnalogPinUpdateCallback(onAnalogPinUpdateCallback callback) {
myOnAnalogPinUpdateCallback = std::move(callback);
void setOnAnalogPinUpdateCallback(const onAnalogPinUpdateCallback& 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();
throw runtime_error(message);

View File

@ -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:
/**

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
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.
*/
void addPhysicalJoystick(PhysicalJoystickPtr stick);
void addPhysicalJoystick(const PhysicalJoystickPtr& stick);
/**
Remove physical joystick at the current index.

View File

@ -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;
}

View File

@ -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.

View File

@ -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),

View File

@ -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<uInt8, FLASH_SIZE> myData;

View File

@ -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);

View File

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

View File

@ -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<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,
const string& eepromfile, onMessageCallback callback)
const string& eepromfile, const onMessageCallback& callback)
: 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
*/
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;

View File

@ -218,7 +218,7 @@ Settings::Settings()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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;

View File

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

View File

@ -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<AudioQueue> queue)
void TIA::setAudioQueue(const shared_ptr<AudioQueue>& queue)
{
myAudio.setAudioQueue(queue);
}

View File

@ -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> audioQueue);
void setAudioQueue(const shared_ptr<AudioQueue>& audioQueue);
/**
Clear the configured frame manager and deteach the lifecycle callbacks.

View File

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

View File

@ -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
);
/**

View File

@ -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();
}

View File

@ -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();

View File

@ -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);

View File

@ -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));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

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