Skip to content

Commit 1ad9337

Browse files
committed
Fix clang-tidy modernize-use-auto warnings
1 parent 89ebb6f commit 1ad9337

File tree

10 files changed

+18
-19
lines changed

10 files changed

+18
-19
lines changed

src/csma-layout/examples/csma-star.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ main(int argc, char* argv[])
4949
//
5050
uint32_t nSpokes = 7;
5151
uint32_t useIpv6 = 0;
52-
Ipv6Address ipv6AddressBase = Ipv6Address("2001::");
53-
Ipv6Prefix ipv6AddressPrefix = Ipv6Prefix(64);
52+
auto ipv6AddressBase = Ipv6Address("2001::");
53+
auto ipv6AddressPrefix = Ipv6Prefix(64);
5454

5555
CommandLine cmd(__FILE__);
5656
cmd.AddValue("nSpokes", "Number of spoke nodes to place in the star", nSpokes);

src/internet-apps/model/ping.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,7 @@ Ping::StartApplication()
585585
}
586586
else if (Ipv6Address::IsMatchingType(m_interfaceAddress))
587587
{
588-
Inet6SocketAddress senderInet =
589-
Inet6SocketAddress(Ipv6Address::ConvertFrom(m_interfaceAddress));
588+
auto senderInet = Inet6SocketAddress(Ipv6Address::ConvertFrom(m_interfaceAddress));
590589
int status = m_socket->Bind(senderInet);
591590
NS_ASSERT_MSG(status == 0, "Failed to bind IPv6 socket");
592591
}

src/internet/helper/ipv6-address-helper.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Ipv6AddressHelper::NewAddress()
140140
addrBuf[i] = netBuf[i] | hostBuf[i];
141141
}
142142

143-
Ipv6Address addr = Ipv6Address(addrBuf);
143+
auto addr = Ipv6Address(addrBuf);
144144

145145
// Remember: hostBuf[15] is the Least Significant Byte.
146146
uint16_t sum;

src/internet/model/ipv6-address-generator.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ Ipv6AddressGeneratorImpl::NextAddress(const Ipv6Prefix prefix)
421421
{
422422
ad[j] |= m_netTable[index].addr[j];
423423
}
424-
Ipv6Address addr = Ipv6Address(ad);
424+
auto addr = Ipv6Address(ad);
425425

426426
for (int32_t j = 15; j >= 0; j--)
427427
{
@@ -601,8 +601,8 @@ Ipv6AddressGeneratorImpl::IsNetworkAllocated(const Ipv6Address address, const Ip
601601
{
602602
NS_LOG_LOGIC("examine entry: " << Ipv6Address((*i).addrLow) << " to "
603603
<< Ipv6Address((*i).addrHigh));
604-
Ipv6Address low = Ipv6Address((*i).addrLow);
605-
Ipv6Address high = Ipv6Address((*i).addrHigh);
604+
auto low = Ipv6Address((*i).addrLow);
605+
auto high = Ipv6Address((*i).addrHigh);
606606

607607
if (address == low.CombinePrefix(prefix) || address == high.CombinePrefix(prefix))
608608
{

src/internet/model/ipv6-static-routing.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ Ipv6StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface)
254254
{
255255
NS_LOG_FUNCTION(this << outputInterface);
256256
auto route = new Ipv6RoutingTableEntry();
257-
Ipv6Address network = Ipv6Address("ff00::"); /* RFC 3513 */
258-
Ipv6Prefix networkMask = Ipv6Prefix(8);
257+
auto network = Ipv6Address("ff00::"); /* RFC 3513 */
258+
auto networkMask = Ipv6Prefix(8);
259259
*route = Ipv6RoutingTableEntry::CreateNetworkRouteTo(network, networkMask, outputInterface);
260260
m_networkRoutes.emplace_back(route, 0);
261261
}

src/internet/model/ripng.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ RipNg::HandleResponses(RipNgHeader hdr,
10461046

10471047
for (auto iter = rtes.begin(); iter != rtes.end(); iter++)
10481048
{
1049-
Ipv6Prefix rtePrefix = Ipv6Prefix(iter->GetPrefixLen());
1049+
auto rtePrefix = Ipv6Prefix(iter->GetPrefixLen());
10501050
Ipv6Address rteAddr = iter->GetPrefix().CombinePrefix(rtePrefix);
10511051

10521052
NS_LOG_LOGIC("Processing RTE " << *iter);

src/internet/test/tcp-test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,9 @@ TcpTestCase::SetupDefaultSim()
432432
void
433433
TcpTestCase::SetupDefaultSim6()
434434
{
435-
Ipv6Prefix prefix = Ipv6Prefix(64);
436-
Ipv6Address ipaddr0 = Ipv6Address("2001:0100:f00d:cafe::1");
437-
Ipv6Address ipaddr1 = Ipv6Address("2001:0100:f00d:cafe::2");
435+
auto prefix = Ipv6Prefix(64);
436+
auto ipaddr0 = Ipv6Address("2001:0100:f00d:cafe::1");
437+
auto ipaddr1 = Ipv6Address("2001:0100:f00d:cafe::2");
438438
Ptr<Node> node0 = CreateInternetNode6();
439439
Ptr<Node> node1 = CreateInternetNode6();
440440
Ptr<SimpleNetDevice> dev0 = AddSimpleNetDevice6(node0, ipaddr0, prefix);

src/netanim/examples/star-animation.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ main(int argc, char* argv[])
4343
uint32_t nSpokes = 8;
4444
std::string animFile = "star-animation.xml";
4545
uint8_t useIpv6 = 0;
46-
Ipv6Address ipv6AddressBase = Ipv6Address("2001::");
47-
Ipv6Prefix ipv6AddressPrefix = Ipv6Prefix(64);
46+
auto ipv6AddressBase = Ipv6Address("2001::");
47+
auto ipv6AddressPrefix = Ipv6Prefix(64);
4848

4949
CommandLine cmd(__FILE__);
5050
cmd.AddValue("nSpokes", "Number of spoke nodes to place in the star", nSpokes);

src/network/test/ipv6-address-test-suite.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Ipv6AddressTestCase::~Ipv6AddressTestCase()
3535
void
3636
Ipv6AddressTestCase::DoRun()
3737
{
38-
Ipv6Address ip = Ipv6Address("2001:db8::1");
38+
auto ip = Ipv6Address("2001:db8::1");
3939
uint8_t ipBytes[16];
4040
ip.Serialize(ipBytes);
4141
NS_TEST_ASSERT_MSG_EQ(ipBytes[0], 0x20, "Failed string conversion");

src/sixlowpan/model/sixlowpan-net-device.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ SixLowPanNetDevice::CompressLowPanIphc(Ptr<Packet> packet, const Address& src, c
10671067
iphcHeader.SetSac(false);
10681068
iphcHeader.SetDac(false);
10691069

1070-
Ipv6Address checker = Ipv6Address("fe80:0000:0000:0000:0000:00ff:fe00:1");
1070+
auto checker = Ipv6Address("fe80:0000:0000:0000:0000:00ff:fe00:1");
10711071
uint8_t unicastAddrCheckerBuf[16];
10721072
checker.GetBytes(unicastAddrCheckerBuf);
10731073
uint8_t addressBuf[16];
@@ -1292,7 +1292,7 @@ SixLowPanNetDevice::CompressLowPanIphc(Ptr<Packet> packet, const Address& src, c
12921292
// Stateless compression
12931293

12941294
uint8_t multicastAddrCheckerBuf[16];
1295-
Ipv6Address multicastCheckAddress = Ipv6Address("ff02::1");
1295+
auto multicastCheckAddress = Ipv6Address("ff02::1");
12961296
multicastCheckAddress.GetBytes(multicastAddrCheckerBuf);
12971297

12981298
// The address takes the form ff02::00XX.

0 commit comments

Comments
 (0)