From e103d6d8104f8d35c636247b9042baf13ca5dee9 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Mon, 29 May 2023 15:18:41 +0100 Subject: [PATCH] core, dsr: Fix clang-tidy warnings --- src/core/model/names.cc | 2 +- src/dsr/model/dsr-option-header.cc | 27 +++++++++------------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/core/model/names.cc b/src/core/model/names.cc index d39b3f24b..6a0976073 100644 --- a/src/core/model/names.cc +++ b/src/core/model/names.cc @@ -307,7 +307,7 @@ NamesPriv::Clear() ++i) { delete i->second; - i->second = 0; + i->second = nullptr; } m_objectMap.clear(); diff --git a/src/dsr/model/dsr-option-header.cc b/src/dsr/model/dsr-option-header.cc index 7d1e95aba..3d2619f0d 100644 --- a/src/dsr/model/dsr-option-header.cc +++ b/src/dsr/model/dsr-option-header.cc @@ -417,14 +417,11 @@ DsrOptionRreqHeader::Deserialize(Buffer::Iterator start) m_identification = i.ReadNtohU16(); ReadFrom(i, m_target); - uint8_t index = 0; - for (std::vector::iterator it = m_ipv4Address.begin(); it != m_ipv4Address.end(); - it++) + for (std::size_t index = 0; index < m_ipv4Address.size(); index++) { i.Read(buff, 4); - m_address = it->Deserialize(buff); - SetNodeAddress(index, m_address); - ++index; + m_address = Ipv4Address::Deserialize(buff); + SetNodeAddress(static_cast(index), m_address); } return GetSerializedSize(); @@ -555,14 +552,11 @@ DsrOptionRrepHeader::Deserialize(Buffer::Iterator start) i.ReadU8(); i.ReadU8(); - uint8_t index = 0; - for (std::vector::iterator it = m_ipv4Address.begin(); it != m_ipv4Address.end(); - it++) + for (std::size_t index = 0; index < m_ipv4Address.size(); index++) { i.Read(buff, 4); - m_address = it->Deserialize(buff); - SetNodeAddress(index, m_address); - ++index; + m_address = Ipv4Address::Deserialize(buff); + SetNodeAddress(static_cast(index), m_address); } return GetSerializedSize(); @@ -718,14 +712,11 @@ DsrOptionSRHeader::Deserialize(Buffer::Iterator start) m_salvage = i.ReadU8(); m_segmentsLeft = i.ReadU8(); - uint8_t index = 0; - for (std::vector::iterator it = m_ipv4Address.begin(); it != m_ipv4Address.end(); - it++) + for (std::size_t index = 0; index < m_ipv4Address.size(); index++) { i.Read(buff, 4); - m_address = it->Deserialize(buff); - SetNodeAddress(index, m_address); - ++index; + m_address = Ipv4Address::Deserialize(buff); + SetNodeAddress(static_cast(index), m_address); } return GetSerializedSize();