diff --git a/src/core/model/des-metrics.cc b/src/core/model/des-metrics.cc index 3f6ad07bb..ae75a53bc 100644 --- a/src/core/model/des-metrics.cc +++ b/src/core/model/des-metrics.cc @@ -41,7 +41,7 @@ DesMetrics::Initialize(std::vector args, std::string outDir /* = "" std::string model_name("desTraceFile"); if (!args.empty()) { - std::string arg0 = args[0]; + const std::string& arg0 = args[0]; model_name = SystemPath::Split(arg0).back(); } std::string jsonFile = model_name + ".json"; diff --git a/src/core/model/system-path.cc b/src/core/model/system-path.cc index 67ebcd19b..93a468605 100644 --- a/src/core/model/system-path.cc +++ b/src/core/model/system-path.cc @@ -351,7 +351,7 @@ Exists(const std::string path) // Check if the file itself exists auto tokens = Split(path); - std::string file = tokens.back(); + const std::string& file = tokens.back(); if (file.empty()) { diff --git a/src/internet/model/ipv4-interface.cc b/src/internet/model/ipv4-interface.cc index f7748a476..1814acba9 100644 --- a/src/internet/model/ipv4-interface.cc +++ b/src/internet/model/ipv4-interface.cc @@ -357,7 +357,7 @@ Ipv4Interface::RemoveAddress(uint32_t index) { if (tmp == index) { - Ipv4InterfaceAddress addr = *i; + const Ipv4InterfaceAddress& addr = *i; m_ifaddrs.erase(i); if (!m_removeAddressCallback.IsNull()) { @@ -388,7 +388,7 @@ Ipv4Interface::RemoveAddress(Ipv4Address address) { if ((*it).GetLocal() == address) { - Ipv4InterfaceAddress ifAddr = *it; + const Ipv4InterfaceAddress& ifAddr = *it; m_ifaddrs.erase(it); if (!m_removeAddressCallback.IsNull()) { diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index bc030d281..1728b0dde 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -2520,7 +2520,7 @@ AnimationInterface::WriteXmlRp(uint32_t nodeId, element.AddAttribute("c", rpElements.size()); for (auto i = rpElements.begin(); i != rpElements.end(); ++i) { - Ipv4RoutePathElement rpElement = *i; + const Ipv4RoutePathElement& rpElement = *i; AnimXmlElement rpeElement("rpe"); rpeElement.AddAttribute("n", rpElement.nodeId); rpeElement.AddAttribute("nH", rpElement.nextHop.c_str()); diff --git a/src/network/test/packet-test-suite.cc b/src/network/test/packet-test-suite.cc index 29b8eb68f..d3cafb25c 100644 --- a/src/network/test/packet-test-suite.cc +++ b/src/network/test/packet-test-suite.cc @@ -642,7 +642,7 @@ PacketTest::DoRun() { Packet c0 = *copy; - Packet c1 = *copy; + Packet c1 = *copy; // NOLINT(performance-unnecessary-copy-initialization) c0 = c1; CHECK(&c0, 1, E(1, 0, 1000)); CHECK(&c1, 1, E(1, 0, 1000)); diff --git a/src/stats/model/omnet-data-output.cc b/src/stats/model/omnet-data-output.cc index d77fa09e1..31395b11b 100644 --- a/src/stats/model/omnet-data-output.cc +++ b/src/stats/model/omnet-data-output.cc @@ -104,7 +104,7 @@ OmnetDataOutput::Output(DataCollector& dc) for (auto i = dc.MetadataBegin(); i != dc.MetadataEnd(); i++) { - std::pair blob = (*i); + const auto& blob = (*i); scalarFile << "attr \"" << blob.first << "\" \"" << blob.second << "\"" << std::endl; } @@ -115,7 +115,7 @@ OmnetDataOutput::Output(DataCollector& dc) } for (auto i = dc.MetadataBegin(); i != dc.MetadataEnd(); i++) { - std::pair blob = (*i); + const auto& blob = (*i); if (isNumeric(blob.second)) { scalarFile << "scalar . \"" << blob.first << "\" \"" << blob.second << "\"" diff --git a/src/stats/model/sqlite-data-output.cc b/src/stats/model/sqlite-data-output.cc index 847bcd09f..24662e5c4 100644 --- a/src/stats/model/sqlite-data-output.cc +++ b/src/stats/model/sqlite-data-output.cc @@ -107,7 +107,7 @@ SqliteDataOutput::Output(DataCollector& dc) for (auto i = dc.MetadataBegin(); i != dc.MetadataEnd(); i++) { - std::pair blob = (*i); + const auto& blob = (*i); SQLiteOutput::SpinReset(stmt); m_sqliteOut->Bind(stmt, 1, run); m_sqliteOut->Bind(stmt, 2, blob.first); diff --git a/src/wifi/helper/wifi-phy-rx-trace-helper.cc b/src/wifi/helper/wifi-phy-rx-trace-helper.cc index 933d94232..46d544e35 100644 --- a/src/wifi/helper/wifi-phy-rx-trace-helper.cc +++ b/src/wifi/helper/wifi-phy-rx-trace-helper.cc @@ -957,7 +957,7 @@ WifiPhyRxTraceSink::CountStatistics(uint32_t nodeId, uint32_t deviceId, uint8_t auto mapOfDevices = m_completedRecords.at(nodeId); if (mapOfDevices.contains(deviceId)) { - auto mapOfLinks = mapOfDevices.at(deviceId); + const auto& mapOfLinks = mapOfDevices.at(deviceId); if (mapOfLinks.contains(linkId)) { auto vectorOfRecords = mapOfLinks.at(linkId); diff --git a/src/wimax/model/bs-net-device.cc b/src/wimax/model/bs-net-device.cc index f34231abd..d46f422d9 100644 --- a/src/wimax/model/bs-net-device.cc +++ b/src/wimax/model/bs-net-device.cc @@ -1180,7 +1180,7 @@ BaseStationNetDevice::MarkUplinkAllocations() std::list uplinkAllocations = m_uplinkScheduler->GetUplinkAllocations(); for (auto iter = uplinkAllocations.begin(); iter != uplinkAllocations.end(); ++iter) { - OfdmUlMapIe uplinkAllocation = *iter; + const OfdmUlMapIe& uplinkAllocation = *iter; if (uplinkAllocation.GetUiuc() == OfdmUlBurstProfile::UIUC_END_OF_MAP) { diff --git a/src/wimax/model/ss-net-device.cc b/src/wimax/model/ss-net-device.cc index 3876dccad..143864d21 100644 --- a/src/wimax/model/ss-net-device.cc +++ b/src/wimax/model/ss-net-device.cc @@ -1166,7 +1166,7 @@ SubscriberStationNetDevice::ProcessUlMap(const UlMap& ulmap) for (auto iter = ulMapElements.begin(); iter != ulMapElements.end(); ++iter) { - OfdmUlMapIe ulMapIe = *iter; + const OfdmUlMapIe& ulMapIe = *iter; if (ulMapIe.GetUiuc() == OfdmUlBurstProfile::UIUC_END_OF_MAP) { @@ -1267,7 +1267,7 @@ SubscriberStationNetDevice::ProcessDcd(const Dcd& dcd) for (auto iter = dlBurstProfiles.begin(); iter != dlBurstProfiles.end(); ++iter) { - OfdmDlBurstProfile brstProfile = *iter; + const OfdmDlBurstProfile& brstProfile = *iter; /*NS-2 does this, may be not correct, assumes DIUC/UIUC to modulation type mapping in DCD/UCD may change over time*/ @@ -1302,7 +1302,7 @@ SubscriberStationNetDevice::ProcessUcd(const Ucd& ucd) for (auto iter = ulBurstProfiles.begin(); iter != ulBurstProfiles.end(); ++iter) { - OfdmUlBurstProfile brstProfile = *iter; + const OfdmUlBurstProfile& brstProfile = *iter; /*NS-2 does this, may be not correct, assumes DIUC/UIUC to modulation type mapping in DCD/UCD may change over time*/