Some cleanups suggested by clang-tidy.

This commit is contained in:
Stephen Anthony 2019-12-21 22:38:01 -03:30
parent 7d17df05dd
commit fdee5ba642
9 changed files with 20 additions and 61 deletions

View File

@ -52,11 +52,11 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
{
// Add case sensitive compare for user labels
// TODO - should user labels be case insensitive too?
auto usrCmp = [](const string& a, const string& b) { return a < b; };
const auto usrCmp = [](const string& a, const string& b) { return a < b; };
myUserAddresses = LabelToAddr(usrCmp);
// Add case insensitive compare for system labels
auto sysCmp = [](const string& a, const string& b) {
const auto sysCmp = [](const string& a, const string& b) {
return BSPF::compareIgnoreCase(a, b) < 0;
};
mySystemAddresses = LabelToAddr(sysCmp);

View File

@ -39,10 +39,11 @@ class SerialPort
@param device The name of the port
@return False on any errors, else true
*/
virtual bool openPort(const string& device) { return false; }
virtual bool openPort(const string& device) = 0;
/**
Read a byte from the serial port.
NOTE: This is for potential future use; no class currently uses this.
@param data Destination for the byte read from the port
@return True if a byte was read, else false
@ -55,13 +56,7 @@ class SerialPort
@param data The byte to write to the port
@return True if a byte was written, else false
*/
virtual bool writeByte(uInt8 data) { return false; }
private:
/**
Close a previously opened serial port.
*/
virtual void closePort() { }
virtual bool writeByte(uInt8 data) = 0;
private:
// Following constructors and assignment operators not supported

View File

@ -68,7 +68,6 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font
_max_h(0)
{
setTitle(title);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -157,8 +156,6 @@ void Dialog::setTitle(const string& title)
else
_th = _font.getLineHeight() + 4;
_h += _th;
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -37,7 +37,11 @@ SerialPortMACOS::SerialPortMACOS()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SerialPortMACOS::~SerialPortMACOS()
{
closePort();
if(myHandle)
{
close(myHandle);
myHandle = 0;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -60,16 +64,6 @@ bool SerialPortMACOS::openPort(const string& device)
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SerialPortMACOS::closePort()
{
if(myHandle)
{
close(myHandle);
myHandle = 0;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortMACOS::writeByte(uInt8 data)
{

View File

@ -40,11 +40,6 @@ class SerialPortMACOS : public SerialPort
*/
bool openPort(const string& device) override;
/**
Close a previously opened serial port.
*/
void closePort() override;
/**
Write a byte to the serial port.

View File

@ -36,7 +36,11 @@ SerialPortUNIX::SerialPortUNIX()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SerialPortUNIX::~SerialPortUNIX()
{
closePort();
if(myHandle)
{
close(myHandle);
myHandle = 0;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -58,16 +62,6 @@ bool SerialPortUNIX::openPort(const string& device)
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SerialPortUNIX::closePort()
{
if(myHandle)
{
close(myHandle);
myHandle = 0;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortUNIX::writeByte(uInt8 data)
{

View File

@ -40,11 +40,6 @@ class SerialPortUNIX : public SerialPort
*/
bool openPort(const string& device) override;
/**
Close a previously opened serial port.
*/
void closePort() override;
/**
Write a byte to the serial port.

View File

@ -29,7 +29,11 @@ SerialPortWINDOWS::SerialPortWINDOWS()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SerialPortWINDOWS::~SerialPortWINDOWS()
{
closePort();
if(myHandle)
{
CloseHandle(myHandle);
myHandle = 0;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -65,16 +69,6 @@ bool SerialPortWINDOWS::openPort(const string& device)
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SerialPortWINDOWS::closePort()
{
if(myHandle)
{
CloseHandle(myHandle);
myHandle = 0;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortWINDOWS::writeByte(uInt8 data)
{

View File

@ -39,11 +39,6 @@ class SerialPortWINDOWS : public SerialPort
*/
bool openPort(const string& device) override;
/**
Close a previously opened serial port.
*/
void closePort() override;
/**
Write a byte to the serial port.