Add CodeQL for GitHub code scanning (#1548)

* Create codeql.yml

* Addressing codeql findings
This commit is contained in:
LordGrey
2022-12-27 08:36:10 +01:00
committed by GitHub
parent 1189f86c1a
commit 6fa7bab6f7
83 changed files with 1984 additions and 2094 deletions

View File

@@ -82,7 +82,6 @@ const char API_PROP_BRIGHT[] = "bright";
// List of Result Information
const char API_RESULT_ID[] = "id";
const char API_RESULT[] = "result";
//const char API_RESULT_OK[] = "OK";
// List of Error Information
const char API_ERROR[] = "error";
@@ -383,8 +382,6 @@ bool YeelightLight::streamCommand( const QJsonDocument &command )
{
log ( 2, "Info:", "Skip write. Device is in error");
}
//log (2,"streamCommand() rc","%d, isON[%d], isInMusicMode[%d]", rc, _isOn, _isInMusicMode );
return rc;
}
@@ -392,8 +389,6 @@ YeelightResponse YeelightLight::handleResponse(int correlationID, QByteArray con
{
log (3,"handleResponse()","" );
//std::cout << _name.toStdString() <<"| Response: [" << response.toStdString() << "]" << std::endl << std::flush;
YeelightResponse yeeResponse;
QString errorReason;
@@ -446,8 +441,6 @@ YeelightResponse YeelightLight::handleResponse(int correlationID, QByteArray con
else
{
int id = jsonObj[API_RESULT_ID].toInt();
//log ( 3, "Correlation ID:", "%d", id );
if ( id != correlationID && TEST_CORRELATION_IDS)
{
errorReason = QString ("%1| API is out of sync, received ID [%2], expected [%3]").
@@ -528,9 +521,6 @@ QJsonObject YeelightLight::getProperties()
log (3,"getProperties()","" );
QJsonObject properties;
//Selected properties
//QJsonArray propertyList = { API_PROP_NAME, API_PROP_MODEL, API_PROP_POWER, API_PROP_RGB, API_PROP_BRIGHT, API_PROP_CT, API_PROP_FWVER };
//All properties
QJsonArray propertyList = {"power","bright","ct","rgb","hue","sat","color_mode","flowing","delayoff","music_on","name","bg_power","bg_flowing","bg_ct","bg_bright","bg_hue","bg_sat","bg_rgb","nl_br","active_mode" };
@@ -579,9 +569,6 @@ bool YeelightLight::identify()
*/
QJsonArray colorflowParams = { API_PROP_COLORFLOW, 6, 0, "500,1,100,100,500,1,16711696,10"};
//Blink White
//QJsonArray colorflowParams = { API_PROP_COLORFLOW, 6, 0, "500,2,4000,1,500,2,4000,50"};
QJsonDocument command = getCommand( API_METHOD_SETSCENE, colorflowParams );
if ( writeCommand( command ) < 0 )
@@ -819,7 +806,6 @@ bool YeelightLight::setColorRGB(const ColorRgb &color)
rc = false;
}
}
//log (2,"setColorRGB() rc","%d, isON[%d], isInMusicMode[%d]", rc, _isOn, _isInMusicMode );
return rc;
}
@@ -914,7 +900,7 @@ bool YeelightLight::setColorHSV(const ColorRgb &colorRGB)
}
else
{
//log ( 3, "setColorHSV", "Skip update. Same Color as before");
// Skip update. Same Color as before
}
log( 3,
"setColorHSV() rc",
@@ -1471,7 +1457,6 @@ void LedDeviceYeelight::identify(const QJsonObject& params)
int LedDeviceYeelight::write(const std::vector<ColorRgb> & ledValues)
{
//DebugIf(verbose, _log, "enabled [%d], _isDeviceReady [%d]", _isEnabled, _isDeviceReady);
int rc = -1;
//Update on all Yeelights by iterating through lights and set colors.
@@ -1545,8 +1530,5 @@ int LedDeviceYeelight::write(const std::vector<ColorRgb> & ledValues)
// Minimum one Yeelight device is working, continue updating devices
rc = 0;
}
//DebugIf(verbose, _log, "rc [%d]", rc );
return rc;
}