Skip to content

Commit

Permalink
fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Jan 26, 2025
1 parent 0608d84 commit 096f7e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/emsdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ int EMSdevice::get_modbus_value(uint8_t tag, const std::string & shortname, std:
return -5;
}

for (auto i = 0; i < register_length_s; i++) {
for (size_t i = 0; i < register_length_s; i++) {
auto hi = (uint8_t)value_s[2 * i];
auto lo = (uint8_t)(2 * i + 1 < length_s ? value_s[2 * i + 1] : 0);
result[i] = ((uint16_t)hi << 8) | lo;
Expand Down Expand Up @@ -2165,7 +2165,7 @@ int EMSdevice::modbus_value_to_json(uint8_t tag, const std::string & shortname,
}

uint32_t value = 0;
for (auto i = 0; i < modbus_data.size(); i++) {
for (size_t i = 0; i < modbus_data.size(); i++) {
value += (uint32_t)modbus_data[modbus_data.size() - i - 1] << (i * 8);
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/emsdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class EMSdevice {
}

void has_update(char * value, const char * newvalue, size_t len) {
if (value && strcmp(value, newvalue) != 0) {
if (value && newvalue && strcmp(value, newvalue) != 0) {
strlcpy(value, newvalue, len);
has_update_ = true;
publish_value(value);
Expand Down

0 comments on commit 096f7e1

Please sign in to comment.