Merge pull request #1913 from MichaelDvP/dev

fix sonar complains
This commit is contained in:
Proddy
2024-08-02 09:13:30 +02:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -286,7 +286,7 @@ const char * Command::parse_command_string(const char * command, int8_t & id) {
// check if command contains an attribute // check if command contains an attribute
const char * Command::get_attribute(const char * cmd) { const char * Command::get_attribute(const char * cmd) {
char * breakp = strchr(cmd, '/'); char * breakp = (char *)strchr(cmd, '/');
if (breakp) { if (breakp) {
*breakp = '\0'; *breakp = '\0';
return breakp + 1; return breakp + 1;

View File

@@ -1315,7 +1315,7 @@ bool System::get_value_info(JsonObject output, const char * cmd) {
if (p.value().is<JsonObject>()) { if (p.value().is<JsonObject>()) {
// String prefix = p.key().c_str(); // String prefix = p.key().c_str();
for (JsonPair p1 : p.value().as<JsonObject>()) { for (JsonPair p1 : p.value().as<JsonObject>()) {
JsonObject entity = output[String(p.key().c_str()) + '.' + p1.key().c_str()].to<JsonObject>(); JsonObject entity = output[std::string(p.key().c_str()) + "." + p1.key().c_str()].to<JsonObject>();
get_value_json(entity, p.key().c_str(), p1.key().c_str(), p1.value()); get_value_json(entity, p.key().c_str(), p1.key().c_str(), p1.value());
} }
} // else { // we don't have pairs in json root object } // else { // we don't have pairs in json root object
@@ -1325,12 +1325,12 @@ bool System::get_value_info(JsonObject output, const char * cmd) {
return true; return true;
} }
char * val = strstr(cmd, "/value"); char * val = (char *)strstr(cmd, "/value");
if (val) { if (val) {
*val = '\0'; *val = '\0';
} }
char * slash = strchr(cmd, '/'); char * slash = (char *)strchr(cmd, '/');
if (slash) { if (slash) {
*slash = '\0'; *slash = '\0';
slash++; slash++;