Eliminate conversion to pointer when it's not necessary.

This commit is contained in:
Stephen Anthony 2019-09-27 22:50:24 -02:30
parent ab9f060c04
commit 91148d299a
8 changed files with 14 additions and 14 deletions

View File

@ -107,7 +107,7 @@ void AtariVox::clockDataIn(bool value)
else
{
uInt8 data = ((myShiftRegister >> 1) & 0xff);
mySerialPort->writeByte(&data);
mySerialPort->writeByte(data);
}
myShiftRegister = 0;
}

View File

@ -47,7 +47,7 @@ class SerialPort
@param data Destination for the byte read from the port
@return True if a byte was read, else false
*/
virtual bool readByte(uInt8* data) { return false; }
virtual bool readByte(uInt8& data) { return false; }
/**
Write a byte to the serial port.
@ -55,7 +55,7 @@ class SerialPort
@param data The byte to write to the port
@return True if a byte was written, else false
*/
virtual bool writeByte(const uInt8* data) { return false; }
virtual bool writeByte(uInt8 data) { return false; }
private:
/**

View File

@ -71,12 +71,12 @@ void SerialPortMACOS::closePort()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortMACOS::writeByte(const uInt8* data)
bool SerialPortMACOS::writeByte(uInt8 data)
{
if(myHandle)
{
// cerr << "SerialPortMACOS::writeByte " << (int)(*data) << endl;
return write(myHandle, data, 1) == 1;
// cerr << "SerialPortMACOS::writeByte " << int(data) << endl;
return write(myHandle, &data, 1) == 1;
}
return false;
}

View File

@ -51,7 +51,7 @@ class SerialPortMACOS : public SerialPort
@param data The byte to write to the port
@return True if a byte was written, else false
*/
bool writeByte(const uInt8* data) override;
bool writeByte(uInt8 data) override;
private:
// File descriptor for serial connection

View File

@ -69,12 +69,12 @@ void SerialPortUNIX::closePort()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortUNIX::writeByte(const uInt8* data)
bool SerialPortUNIX::writeByte(uInt8 data)
{
if(myHandle)
{
// cerr << "SerialPortUNIX::writeByte " << (int)(*data) << endl;
return write(myHandle, data, 1) == 1;
// cerr << "SerialPortUNIX::writeByte " << int(data) << endl;
return write(myHandle, &data, 1) == 1;
}
return false;
}

View File

@ -51,7 +51,7 @@ class SerialPortUNIX : public SerialPort
@param data The byte to write to the port
@return True if a byte was written, else false
*/
bool writeByte(const uInt8* data) override;
bool writeByte(uInt8 data) override;
private:
// File descriptor for serial connection

View File

@ -76,12 +76,12 @@ void SerialPortWINDOWS::closePort()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SerialPortWINDOWS::writeByte(const uInt8* data)
bool SerialPortWINDOWS::writeByte(uInt8 data)
{
if(myHandle)
{
DWORD written;
return WriteFile(myHandle, data, 1, &written, 0) == TRUE;
return WriteFile(myHandle, &data, 1, &written, 0) == TRUE;
}
return false;
}

View File

@ -50,7 +50,7 @@ class SerialPortWINDOWS : public SerialPort
@param data The byte to write to the port
@return True if a byte was written, else false
*/
bool writeByte(const uInt8* data) override;
bool writeByte(uInt8 data) override;
private:
// Handle to serial port