Skip to content

Commit

Permalink
fix(net_monitor): fix cppcheck warnings (#7573)
Browse files Browse the repository at this point in the history
* fix unusedVariable warning

Signed-off-by: Ryuta Kambe <[email protected]>

* fix unusedVariable warning

Signed-off-by: Ryuta Kambe <[email protected]>

* fix variableScope warning

Signed-off-by: Ryuta Kambe <[email protected]>

* fix unreadVariable warning

Signed-off-by: Ryuta Kambe <[email protected]>

* fix

Signed-off-by: Ryuta Kambe <[email protected]>

---------

Signed-off-by: Ryuta Kambe <[email protected]>
  • Loading branch information
veqcc authored and KhalilSelyan committed Jul 22, 2024
1 parent 28c2a90 commit 87fdcff
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions system/system_monitor/src/net_monitor/net_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ void NetMonitor::check_usage(diagnostic_updater::DiagnosticStatusWrapper & statu

int level = DiagStatus::OK;
int index = 0;
std::string error_str;
std::vector<std::string> interface_names;

for (const auto & network : network_list_) {
// Skip if network is not supported
Expand Down Expand Up @@ -282,14 +280,14 @@ void NetMonitor::check_reassembles_failed(diagnostic_updater::DiagnosticStatusWr
int whole_level = DiagStatus::OK;
std::string error_message;
uint64_t total_reassembles_failed = 0;
uint64_t unit_reassembles_failed = 0;

if (get_reassembles_failed(total_reassembles_failed)) {
reassembles_failed_queue_.push_back(total_reassembles_failed - last_reassembles_failed_);
while (reassembles_failed_queue_.size() > reassembles_failed_check_duration_) {
reassembles_failed_queue_.pop_front();
}

uint64_t unit_reassembles_failed = 0;
for (auto reassembles_failed : reassembles_failed_queue_) {
unit_reassembles_failed += reassembles_failed;
}
Expand Down Expand Up @@ -452,9 +450,9 @@ void NetMonitor::update_network_capacity(NetworkInfomation & network, int socket

// NOLINTNEXTLINE [cppcoreguidelines-pro-type-union-access]
strncpy(request.ifr_name, network.interface_name.c_str(), IFNAMSIZ - 1);
ether_request.cmd = ETHTOOL_GSET;
request.ifr_data = (caddr_t)&ether_request; // NOLINT [cppcoreguidelines-pro-type-cstyle-cast]

ether_request.cmd = ETHTOOL_GSET;
if (ioctl(socket, SIOCETHTOOL, &request) >= 0) {
network.speed = ether_request.speed;
return;
Expand Down

0 comments on commit 87fdcff

Please sign in to comment.