mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
lint warnings
This commit is contained in:
@@ -220,7 +220,7 @@ const char * Command::return_code_string(const uint8_t return_code) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
static char s[4];
|
||||
static char s[4]; // static to avoid allocation on each call and loosing scope
|
||||
return Helpers::smallitoa(s, return_code);
|
||||
}
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ void EMSdevice::add_device_value(int8_t tag, // to b
|
||||
if ((entityCustomization.product_id == product_id()) && (entityCustomization.device_id == device_id())) {
|
||||
char entity[70];
|
||||
if (tag < DeviceValueTAG::TAG_HC1) {
|
||||
strncpy(entity, short_name, sizeof(entity));
|
||||
strncpy(entity, short_name, sizeof(entity)-1);
|
||||
} else {
|
||||
snprintf(entity, sizeof(entity), "%s/%s", tag_to_mqtt(tag), short_name);
|
||||
}
|
||||
@@ -1201,7 +1201,7 @@ void EMSdevice::setCustomizationEntity(const std::string & entity_id) {
|
||||
for (auto & dv : devicevalues_) {
|
||||
char entity_name[70];
|
||||
if (dv.tag < DeviceValueTAG::TAG_HC1) {
|
||||
strncpy(entity_name, dv.short_name, sizeof(entity_name));
|
||||
strncpy(entity_name, dv.short_name, sizeof(entity_name)-1);
|
||||
} else {
|
||||
snprintf(entity_name, sizeof(entity_name), "%s/%s", tag_to_mqtt(dv.tag), dv.short_name);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ class EMSdevice {
|
||||
}
|
||||
|
||||
void has_update(char * value, const char * newvalue, size_t len) {
|
||||
if (strcmp(value, newvalue) != 0) {
|
||||
if (value && strcmp(value, newvalue) != 0) {
|
||||
strlcpy(value, newvalue, len);
|
||||
has_update_ = true;
|
||||
publish_value(value);
|
||||
|
||||
Reference in New Issue
Block a user