Pass primitive types by value (#935)

This commit is contained in:
Murat Seker
2020-08-08 13:09:15 +02:00
committed by GitHub
parent 5758b19cbc
commit c00d8e62fb
146 changed files with 505 additions and 505 deletions

View File

@@ -151,7 +151,7 @@ bool LedDeviceWrapper::enabled()
return _enabled;
}
void LedDeviceWrapper::handleComponentState(const hyperion::Components component, const bool state)
void LedDeviceWrapper::handleComponentState(hyperion::Components component, bool state)
{
if(component == hyperion::COMP_LEDDEVICE)
{

View File

@@ -122,7 +122,7 @@ int ProviderHID::close()
return retval;
}
int ProviderHID::writeBytes(const unsigned size, const uint8_t * data)
int ProviderHID::writeBytes(unsigned size, const uint8_t * data)
{
if (_blockedForDelay) {
return 0;

View File

@@ -66,7 +66,7 @@ protected:
/// @param[in] data The data
/// @return Zero on success, else negative
///
int writeBytes(const unsigned size, const uint8_t *data);
int writeBytes(unsigned size, const uint8_t *data);
// HID VID and PID
unsigned short _VendorId;

View File

@@ -342,7 +342,7 @@ bool LedDeviceNanoleaf::initLedsConfiguration()
return isInitOK;
}
bool LedDeviceNanoleaf::initRestAPI(const QString &hostname, const int port, const QString &token )
bool LedDeviceNanoleaf::initRestAPI(const QString &hostname, int port, const QString &token )
{
bool isInitOK = false;

View File

@@ -135,7 +135,7 @@ private:
///
/// @return True, if success
///
bool initRestAPI(const QString &hostname, const int port, const QString &token );
bool initRestAPI(const QString &hostname, int port, const QString &token );
///
/// @brief Get Nanoleaf device details and configuration

View File

@@ -347,7 +347,7 @@ bool LedDevicePhilipsHueBridge::init(const QJsonObject &deviceConfig)
return isInitOK;
}
bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, const int port, const QString &token )
bool LedDevicePhilipsHueBridge::initRestAPI(const QString &hostname, int port, const QString &token )
{
bool isInitOK = false;
@@ -544,12 +544,12 @@ void LedDevicePhilipsHueBridge::setGroupMap(const QJsonDocument &doc)
}
}
const QMap<quint16,QJsonObject>& LedDevicePhilipsHueBridge::getLightMap(void)
const QMap<quint16,QJsonObject>& LedDevicePhilipsHueBridge::getLightMap()
{
return _lightsMap;
}
const QMap<quint16,QJsonObject>& LedDevicePhilipsHueBridge::getGroupMap(void)
const QMap<quint16,QJsonObject>& LedDevicePhilipsHueBridge::getGroupMap()
{
return _groupsMap;
}
@@ -642,13 +642,13 @@ QJsonDocument LedDevicePhilipsHueBridge::post(const QString& route, const QStrin
return response.getBody();
}
void LedDevicePhilipsHueBridge::setLightState(const unsigned int lightId, const QString &state)
void LedDevicePhilipsHueBridge::setLightState(unsigned int lightId, const QString &state)
{
DebugIf( verbose, _log, "SetLightState [%u]: %s", lightId, QSTRING_CSTR(state) );
post( QString("%1/%2/%3").arg( API_LIGHTS ).arg( lightId ).arg( API_STATE ), state );
}
QJsonDocument LedDevicePhilipsHueBridge::getGroupState(const unsigned int groupId)
QJsonDocument LedDevicePhilipsHueBridge::getGroupState(unsigned int groupId)
{
_restApi->setPath( QString("%1/%2").arg( API_GROUPS ).arg( groupId ) );
httpResponse response = _restApi->get();
@@ -656,7 +656,7 @@ QJsonDocument LedDevicePhilipsHueBridge::getGroupState(const unsigned int groupI
return response.getBody();
}
QJsonDocument LedDevicePhilipsHueBridge::setGroupState(const unsigned int groupId, bool state)
QJsonDocument LedDevicePhilipsHueBridge::setGroupState(unsigned int groupId, bool state)
{
QString active = state ? API_STREAM_ACTIVE_VALUE_TRUE : API_STREAM_ACTIVE_VALUE_FALSE;
return post( QString("%1/%2").arg( API_GROUPS ).arg( groupId ), QString("{\"%1\":{\"%2\":%3}}").arg( API_STREAM, API_STREAM_ACTIVE, active ) );

View File

@@ -197,7 +197,7 @@ public:
///
/// @return True, if success
///
bool initRestAPI(const QString &hostname, const int port, const QString &token );
bool initRestAPI(const QString &hostname, int port, const QString &token );
///
/// @param route the route of the POST request.
@@ -233,7 +233,7 @@ protected:
///
/// @return Zero on success (i.e. device is ready), else negative
///
virtual int open(void) override;
virtual int open() override;
///
/// @brief Closes the Hue-Bridge device and its SSL-connection

View File

@@ -44,7 +44,7 @@ bool LedDeviceUdpArtNet::init(const QJsonObject &deviceConfig)
}
// populates the headers
void LedDeviceUdpArtNet::prepare(const unsigned this_universe, const unsigned this_sequence, unsigned this_dmxChannelCount)
void LedDeviceUdpArtNet::prepare(unsigned this_universe, unsigned this_sequence, unsigned this_dmxChannelCount)
{
// WTF? why do the specs say:
// "This value should be an even number in the range 2 512. "

View File

@@ -80,7 +80,7 @@ private:
///
/// @brief Generate Art-Net communication header
///
void prepare(const unsigned this_universe, const unsigned this_sequence, const unsigned this_dmxChannelCount);
void prepare(unsigned this_universe, unsigned this_sequence, unsigned this_dmxChannelCount);
artnet_packet_t artnet_packet;
uint8_t _artnet_seq = 1;

View File

@@ -75,7 +75,7 @@ bool LedDeviceUdpE131::init(const QJsonObject &deviceConfig)
}
// populates the headers
void LedDeviceUdpE131::prepare(const unsigned this_universe, const unsigned this_dmxChannelCount)
void LedDeviceUdpE131::prepare(unsigned this_universe, unsigned this_dmxChannelCount)
{
memset(e131_packet.raw, 0, sizeof(e131_packet.raw));

View File

@@ -125,7 +125,7 @@ private:
///
/// @brief Generate E1.31 communication header
///
void prepare(const unsigned this_universe, const unsigned this_dmxChannelCount);
void prepare(unsigned this_universe, unsigned this_dmxChannelCount);
e131_packet_t e131_packet;
uint8_t _e131_seq = 0;

View File

@@ -111,7 +111,7 @@ bool LedDeviceWled::init(const QJsonObject &deviceConfig)
return isInitOK;
}
bool LedDeviceWled::initRestAPI(const QString &hostname, const int port )
bool LedDeviceWled::initRestAPI(const QString &hostname, int port )
{
Debug(_log, "");
bool isInitOK = false;

View File

@@ -112,7 +112,7 @@ private:
/// @param[in] port
/// @return True, if success
///
bool initRestAPI(const QString &hostname, const int port );
bool initRestAPI(const QString &hostname, int port );
///
/// @brief Get command to power WLED-device on or off

View File

@@ -947,7 +947,7 @@ bool YeelightLight::setMusicMode(bool on, const QHostAddress &hostAddress, int p
return rc;
}
void YeelightLight::log(const int logLevel, const char* msg, const char* type, ...)
void YeelightLight::log(int logLevel, const char* msg, const char* type, ...)
{
if ( logLevel <= _debugLevel)
{

View File

@@ -51,14 +51,14 @@ public:
explicit YeelightResponse() {}
API_REPLY error() { return _error;}
API_REPLY error() const { return _error;}
void setError(const YeelightResponse::API_REPLY replyType) { _error = replyType; }
QJsonArray getResult() const { return _resultArray; }
void setResult(const QJsonArray &result) { _resultArray = result; }
int getErrorCode() const { return _errorCode; }
void setErrorCode(const int &errorCode) { _errorCode = errorCode; _error = API_ERROR;}
void setErrorCode(int errorCode) { _errorCode = errorCode; _error = API_ERROR;}
QString getErrorReason() const { return _errorReason; }
void setErrorReason(const QString &errorReason) { _errorReason = errorReason; }
@@ -353,7 +353,7 @@ private:
/// @param[in] type log message text
/// @param[in] ... variable input to log message text
/// ///
void log(const int logLevel,const char* msg, const char* type, ...);
void log(int logLevel,const char* msg, const char* type, ...);
Logger* _log;
int _debugLevel;

View File

@@ -16,7 +16,7 @@ const QChar ONE_SLASH = '/';
} //End of constants
ProviderRestApi::ProviderRestApi(const QString &host, const int &port, const QString &basePath)
ProviderRestApi::ProviderRestApi(const QString &host, int port, const QString &basePath)
:_log(Logger::getInstance("LEDDEVICE"))
,_networkManager(nullptr)
,_scheme("http")
@@ -31,7 +31,7 @@ ProviderRestApi::ProviderRestApi(const QString &host, const int &port, const QSt
_basePath = basePath;
}
ProviderRestApi::ProviderRestApi(const QString &host, const int &port)
ProviderRestApi::ProviderRestApi(const QString &host, int port)
: ProviderRestApi(host, port, "") {}
ProviderRestApi::ProviderRestApi()

View File

@@ -19,8 +19,8 @@ public:
explicit httpResponse() {}
bool error() { return _hasError;}
void setError(const bool hasError) { _hasError = hasError; }
bool error() const { return _hasError;}
void setError(bool hasError) { _hasError = hasError; }
QJsonDocument getBody() const { return _responseBody; }
void setBody(const QJsonDocument &body) { _responseBody = body; }
@@ -29,7 +29,7 @@ public:
void setErrorReason(const QString &errorReason) { _errorReason = errorReason; }
int getHttpStatusCode() const { return _httpStatusCode; }
void setHttpStatusCode(const int httpStatusCode) { _httpStatusCode = httpStatusCode; }
void setHttpStatusCode(int httpStatusCode) { _httpStatusCode = httpStatusCode; }
QNetworkReply::NetworkError getNetworkReplyError() const { return _networkReplyError; }
void setNetworkReplyError (const QNetworkReply::NetworkError networkReplyError) { _networkReplyError = networkReplyError; }
@@ -78,7 +78,7 @@ public:
/// @param[in] host
/// @param[in] port
///
explicit ProviderRestApi(const QString &host, const int &port);
explicit ProviderRestApi(const QString &host, int port);
///
/// @brief Constructor of the REST-API wrapper
@@ -87,7 +87,7 @@ public:
/// @param[in] port
/// @param[in] API base-path
///
explicit ProviderRestApi(const QString &host, const int &port, const QString &basePath);
explicit ProviderRestApi(const QString &host, int port, const QString &basePath);
///
/// @brief Destructor of the REST-API wrapper

View File

@@ -129,7 +129,7 @@ int ProviderUdp::close()
return retval;
}
int ProviderUdp::writeBytes(const unsigned size, const uint8_t * data)
int ProviderUdp::writeBytes(unsigned size, const uint8_t * data)
{
qint64 retVal = _udpSocket->writeDatagram((const char *)data,size,_address,_port);

View File

@@ -61,7 +61,7 @@ protected:
///
/// @return Zero on success, else negative
///
int writeBytes(const unsigned size, const uint8_t *data);
int writeBytes(unsigned size, const uint8_t *data);
///
QUdpSocket * _udpSocket;

View File

@@ -457,7 +457,7 @@ void ProviderUdpSSL::freeSSLConnection()
}
}
void ProviderUdpSSL::writeBytes(const unsigned size, const unsigned char * data)
void ProviderUdpSSL::writeBytes(unsigned size, const unsigned char * data)
{
if( _stopConnection ) return;

View File

@@ -106,7 +106,7 @@ protected:
/// @param[in] size The length of the data
/// @param[in] data The data
///
void writeBytes(const unsigned size, const uint8_t *data);
void writeBytes(unsigned size, const uint8_t *data);
///
/// get ciphersuites list from mbedtls_ssl_list_ciphersuites

View File

@@ -109,7 +109,7 @@ bool ProviderRs232::powerOff()
return rc;
}
bool ProviderRs232::tryOpen(const int delayAfterConnect_ms)
bool ProviderRs232::tryOpen(int delayAfterConnect_ms)
{
if (_deviceName.isEmpty() || _rs232Port.portName().isEmpty())
{

View File

@@ -125,7 +125,7 @@ int ProviderSpi::close()
return retval;
}
int ProviderSpi::writeBytes(const unsigned size, const uint8_t * data)
int ProviderSpi::writeBytes(unsigned size, const uint8_t * data)
{
if (_fid < 0)
{

View File

@@ -53,7 +53,7 @@ protected:
///
/// @return Zero on success, else negative
///
int writeBytes(const unsigned size, const uint8_t *data);
int writeBytes(unsigned size, const uint8_t *data);
/// The name of the output device
QString _deviceName;