Skip to content

Commit 0a2f1e3

Browse files
authored
fix(net_monitor): fix cppcheck warnings (#7573)
* fix unusedVariable warning Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * fix unusedVariable warning Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * fix variableScope warning Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * fix unreadVariable warning Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> * fix Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp> --------- Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>
1 parent 4da27a8 commit 0a2f1e3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

system/system_monitor/src/net_monitor/net_monitor.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ void NetMonitor::check_usage(diagnostic_updater::DiagnosticStatusWrapper & statu
156156

157157
int level = DiagStatus::OK;
158158
int index = 0;
159-
std::string error_str;
160-
std::vector<std::string> interface_names;
161159

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

287284
if (get_reassembles_failed(total_reassembles_failed)) {
288285
reassembles_failed_queue_.push_back(total_reassembles_failed - last_reassembles_failed_);
289286
while (reassembles_failed_queue_.size() > reassembles_failed_check_duration_) {
290287
reassembles_failed_queue_.pop_front();
291288
}
292289

290+
uint64_t unit_reassembles_failed = 0;
293291
for (auto reassembles_failed : reassembles_failed_queue_) {
294292
unit_reassembles_failed += reassembles_failed;
295293
}
@@ -452,9 +450,9 @@ void NetMonitor::update_network_capacity(NetworkInfomation & network, int socket
452450

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

457-
ether_request.cmd = ETHTOOL_GSET;
458456
if (ioctl(socket, SIOCETHTOOL, &request) >= 0) {
459457
network.speed = ether_request.speed;
460458
return;

0 commit comments

Comments
 (0)