From ba859a0d66fd2632e2c9be26ec06bc30ae835cdc Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Sat, 9 Sep 2023 17:28:41 +0100 Subject: [PATCH] Fix clang-tidy modernize-use-bool-literals warnings --- examples/matrix-topology/matrix-topology.cc | 2 +- examples/wireless/wifi-80211e-txop.cc | 4 +- examples/wireless/wifi-aggregation.cc | 6 +- examples/wireless/wifi-ht-network.cc | 10 +- examples/wireless/wifi-mixed-network.cc | 2 +- examples/wireless/wifi-multirate.cc | 6 +- .../wifi-simple-ht-hidden-stations.cc | 2 +- examples/wireless/wifi-txop-aggregation.cc | 6 +- examples/wireless/wifi-vht-network.cc | 10 +- src/applications/model/packet-loss-counter.cc | 6 +- src/core/examples/hash-example.cc | 4 +- src/core/model/global-value.cc | 2 +- src/core/model/log.cc | 2 +- src/core/model/random-variable-stream.cc | 14 +- src/core/test/ptr-test-suite.cc | 2 +- src/dsdv/model/dsdv-rtable.h | 2 +- .../examples/basic-energy-model-test.cc | 18 +-- src/fd-net-device/examples/fd2fd-onoff.cc | 2 +- .../helper/tap-device-creator.cc | 8 +- src/internet-apps/model/ping.cc | 2 +- src/internet-apps/model/ping6.cc | 4 +- src/internet/model/icmpv6-header.cc | 12 +- src/internet/model/icmpv6-l4-protocol.cc | 24 +-- src/internet/model/ipv4-l3-protocol.cc | 2 +- src/internet/model/ipv6-extension.cc | 4 +- src/internet/model/ipv6-raw-socket-impl.cc | 2 +- src/internet/model/tcp-socket-base.cc | 4 +- src/internet/test/icmp-test.cc | 4 +- src/lte/examples/lena-radio-link-failure.cc | 2 +- src/lte/model/lte-rrc-header.cc | 151 +++++++++--------- src/lte/model/lte-ue-phy.cc | 2 +- src/lte/model/lte-ue-phy.h | 2 +- src/lte/test/test-lte-rrc.cc | 2 +- src/lte/test/test-lte-x2-handover-measures.cc | 9 +- src/lte/test/test-lte-x2-handover.cc | 2 +- src/mpi/examples/nms-p2p-nix-distributed.cc | 2 +- src/network/utils/pcap-file.cc | 2 +- src/olsr/model/olsr-routing-protocol.cc | 2 +- .../model/channel-condition-model.h | 2 +- .../test/spectrum-interference-test.cc | 4 +- .../model/rocketfuel-topology-reader.cc | 13 +- .../model/cobalt-queue-disc.cc | 4 +- src/uan/model/uan-mac-rc-gw.cc | 2 +- src/uan/model/uan-mac-rc.cc | 2 +- src/wifi/examples/wifi-manager-example.cc | 2 +- src/wifi/model/ampdu-subframe-header.cc | 2 +- src/wifi/model/ht/ht-phy.cc | 6 +- src/wifi/model/mpdu-aggregator.cc | 2 +- .../rate-control/minstrel-ht-wifi-manager.cc | 2 +- .../model/rate-control/onoe-wifi-manager.cc | 3 +- src/wifi/model/wifi-remote-station-manager.cc | 4 +- src/wifi/test/tx-duration-test.cc | 8 +- src/wifi/test/wifi-phy-ofdma-test.cc | 4 +- src/wifi/test/wifi-transmit-mask-test.cc | 50 +++--- src/wimax/helper/wimax-helper.cc | 4 +- src/wimax/model/service-flow.cc | 2 +- src/wimax/model/simple-ofdm-send-param.cc | 2 +- src/wimax/model/simple-ofdm-wimax-phy.cc | 10 +- src/wimax/model/ss-record.cc | 2 +- src/wimax/model/wimax-phy.cc | 2 +- 60 files changed, 234 insertions(+), 240 deletions(-) diff --git a/examples/matrix-topology/matrix-topology.cc b/examples/matrix-topology/matrix-topology.cc index 9c1cf4f22..6203ec9b4 100644 --- a/examples/matrix-topology/matrix-topology.cc +++ b/examples/matrix-topology/matrix-topology.cc @@ -163,7 +163,7 @@ main(int argc, char* argv[]) { for (size_t j = 0; j < Adj_Matrix[i].size(); j++) { - if (Adj_Matrix[i][j] == 1) + if (Adj_Matrix[i][j]) { NodeContainer n_links = NodeContainer(nodes.Get(i), nodes.Get(j)); NetDeviceContainer n_devs = p2p.Install(n_links); diff --git a/examples/wireless/wifi-80211e-txop.cc b/examples/wireless/wifi-80211e-txop.cc index 08c1a243c..1656068af 100644 --- a/examples/wireless/wifi-80211e-txop.cc +++ b/examples/wireless/wifi-80211e-txop.cc @@ -96,8 +96,8 @@ main(int argc, char* argv[]) uint32_t payloadSize = 1472; // bytes double simulationTime = 10; // seconds double distance = 5; // meters - bool enablePcap = 0; - bool verifyResults = 0; // used for regression + bool enablePcap = false; + bool verifyResults = false; // used for regression Time txopLimit = MicroSeconds(4096); CommandLine cmd(__FILE__); diff --git a/examples/wireless/wifi-aggregation.cc b/examples/wireless/wifi-aggregation.cc index 73d58abae..3f33abd20 100644 --- a/examples/wireless/wifi-aggregation.cc +++ b/examples/wireless/wifi-aggregation.cc @@ -84,9 +84,9 @@ main(int argc, char* argv[]) uint32_t payloadSize = 1472; // bytes double simulationTime = 10; // seconds double distance = 5; // meters - bool enableRts = 0; - bool enablePcap = 0; - bool verifyResults = 0; // used for regression + bool enableRts = false; + bool enablePcap = false; + bool verifyResults = false; // used for regression CommandLine cmd(__FILE__); cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize); diff --git a/examples/wireless/wifi-ht-network.cc b/examples/wireless/wifi-ht-network.cc index e9008932f..d9fa8df55 100644 --- a/examples/wireless/wifi-ht-network.cc +++ b/examples/wireless/wifi-ht-network.cc @@ -118,7 +118,7 @@ main(int argc, char* argv[]) double previous = 0; for (int channelWidth = 20; channelWidth <= 40;) { - for (int sgi = 0; sgi < 2; sgi++) + for (auto sgi : {false, true}) { uint32_t payloadSize; // 1500 byte IP packet if (udp) @@ -283,11 +283,11 @@ main(int argc, char* argv[]) Simulator::Destroy(); - std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << sgi << "\t\t\t" - << throughput << " Mbit/s" << std::endl; + std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << std::boolalpha + << sgi << "\t\t\t" << throughput << " Mbit/s" << std::endl; // test first element - if (mcs == 0 && channelWidth == 20 && sgi == 0) + if (mcs == 0 && channelWidth == 20 && !sgi) { if (throughput < minExpectedThroughput) { @@ -295,7 +295,7 @@ main(int argc, char* argv[]) } } // test last element - if (mcs == 7 && channelWidth == 40 && sgi == 1) + if (mcs == 7 && channelWidth == 40 && sgi) { if (maxExpectedThroughput > 0 && throughput > maxExpectedThroughput) { diff --git a/examples/wireless/wifi-mixed-network.cc b/examples/wireless/wifi-mixed-network.cc index 22432c8ef..b079842f0 100644 --- a/examples/wireless/wifi-mixed-network.cc +++ b/examples/wireless/wifi-mixed-network.cc @@ -370,7 +370,7 @@ main(int argc, char* argv[]) params.payloadSize = 1472; // bytes params.simulationTime = 10; // seconds - bool verifyResults = 0; // used for regression + bool verifyResults = false; // used for regression CommandLine cmd(__FILE__); cmd.AddValue("payloadSize", "Payload size in bytes", params.payloadSize); diff --git a/examples/wireless/wifi-multirate.cc b/examples/wireless/wifi-multirate.cc index fd0a224a6..409c1cea2 100644 --- a/examples/wireless/wifi-multirate.cc +++ b/examples/wireless/wifi-multirate.cc @@ -116,7 +116,7 @@ class Experiment */ bool IsRouting() const { - return (m_enableRouting == 1) ? 1 : 0; + return m_enableRouting; } /** @@ -126,7 +126,7 @@ class Experiment */ bool IsMobility() const { - return (m_enableMobility == 1) ? 1 : 0; + return m_enableMobility; } /** @@ -239,7 +239,7 @@ class Experiment uint32_t m_gridSize; //!< Grid size. uint32_t m_nodeDistance; //!< Node distance. uint32_t m_port; //!< Listening port. - uint32_t m_scenario; //!< Scnario number. + uint32_t m_scenario; //!< Scenario number. bool m_enablePcap; //!< True if PCAP output is enabled. bool m_enableTracing; //!< True if tracing output is enabled. diff --git a/examples/wireless/wifi-simple-ht-hidden-stations.cc b/examples/wireless/wifi-simple-ht-hidden-stations.cc index a52169032..58f238080 100644 --- a/examples/wireless/wifi-simple-ht-hidden-stations.cc +++ b/examples/wireless/wifi-simple-ht-hidden-stations.cc @@ -59,7 +59,7 @@ main(int argc, char* argv[]) double simulationTime = 10; // seconds uint32_t nMpdus = 1; uint32_t maxAmpduSize = 0; - bool enableRts = 0; + bool enableRts = false; double minExpectedThroughput = 0; double maxExpectedThroughput = 0; diff --git a/examples/wireless/wifi-txop-aggregation.cc b/examples/wireless/wifi-txop-aggregation.cc index 0c2d6d6fd..385d1630a 100644 --- a/examples/wireless/wifi-txop-aggregation.cc +++ b/examples/wireless/wifi-txop-aggregation.cc @@ -111,9 +111,9 @@ main(int argc, char* argv[]) double simulationTime = 10; // seconds double txopLimit = 3520; // microseconds double distance = 5; // meters - bool enableRts = 0; - bool enablePcap = 0; - bool verifyResults = 0; // used for regression + bool enableRts = false; + bool enablePcap = false; + bool verifyResults = false; // used for regression CommandLine cmd(__FILE__); cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize); diff --git a/examples/wireless/wifi-vht-network.cc b/examples/wireless/wifi-vht-network.cc index b9acfc8a6..f8c679a49 100644 --- a/examples/wireless/wifi-vht-network.cc +++ b/examples/wireless/wifi-vht-network.cc @@ -117,7 +117,7 @@ main(int argc, char* argv[]) channelWidth *= 2; continue; } - for (int sgi = 0; sgi < 2; sgi++) + for (auto sgi : {false, true}) { uint32_t payloadSize; // 1500 byte IP packet if (udp) @@ -265,11 +265,11 @@ main(int argc, char* argv[]) Simulator::Destroy(); - std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << sgi << "\t\t\t" - << throughput << " Mbit/s" << std::endl; + std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << std::boolalpha + << sgi << "\t\t\t" << throughput << " Mbit/s" << std::endl; // test first element - if (mcs == 0 && channelWidth == 20 && sgi == 0) + if (mcs == 0 && channelWidth == 20 && !sgi) { if (throughput < minExpectedThroughput) { @@ -278,7 +278,7 @@ main(int argc, char* argv[]) } } // test last element - if (mcs == 9 && channelWidth == 160 && sgi == 1) + if (mcs == 9 && channelWidth == 160 && sgi) { if (maxExpectedThroughput > 0 && throughput > maxExpectedThroughput) { diff --git a/src/applications/model/packet-loss-counter.cc b/src/applications/model/packet-loss-counter.cc index 362986585..0f0574e2e 100644 --- a/src/applications/model/packet-loss-counter.cc +++ b/src/applications/model/packet-loss-counter.cc @@ -113,14 +113,14 @@ PacketLossCounter::NotifyReceived(uint32_t seqNum) NS_LOG_FUNCTION(this << seqNum); for (uint32_t i = m_lastMaxSeqNum + 1; i <= seqNum; i++) { - if (GetBit(i) != 1) + if (!GetBit(i)) { NS_LOG_INFO("Packet lost: " << i - (m_bitMapSize * 8)); m_lost++; } - SetBit(i, 0); + SetBit(i, false); } - SetBit(seqNum, 1); + SetBit(seqNum, true); if (seqNum > m_lastMaxSeqNum) { m_lastMaxSeqNum = seqNum; diff --git a/src/core/examples/hash-example.cc b/src/core/examples/hash-example.cc index 514e69197..68095de80 100644 --- a/src/core/examples/hash-example.cc +++ b/src/core/examples/hash-example.cc @@ -296,10 +296,10 @@ class Dictionary return; } - int newPhrases = 0; + bool newPhrases = false; for (auto& collider : m_hashes) { - newPhrases += collider.Add(phrase); + newPhrases |= collider.Add(phrase); } if (newPhrases) diff --git a/src/core/model/global-value.cc b/src/core/model/global-value.cc index aad86274a..61c70c8a8 100644 --- a/src/core/model/global-value.cc +++ b/src/core/model/global-value.cc @@ -127,7 +127,7 @@ GlobalValue::SetValue(const AttributeValue& value) Ptr v = m_checker->CreateValidValue(value); if (!v) { - return 0; + return false; } m_currentValue = v; return true; diff --git a/src/core/model/log.cc b/src/core/model/log.cc index e2f0507b3..bd4d8ba06 100644 --- a/src/core/model/log.cc +++ b/src/core/model/log.cc @@ -247,7 +247,7 @@ bool LogComponent::IsEnabled(const LogLevel level) const { // LogComponentEnableEnvVar (); - return (level & m_levels) ? 1 : 0; + return level & m_levels; } bool diff --git a/src/core/model/random-variable-stream.cc b/src/core/model/random-variable-stream.cc index cddb88b71..0ba6c7022 100644 --- a/src/core/model/random-variable-stream.cc +++ b/src/core/model/random-variable-stream.cc @@ -421,7 +421,7 @@ double ExponentialRandomVariable::GetValue(double mean, double bound) { NS_LOG_FUNCTION(this << mean << bound); - while (1) + while (true) { // Get a uniform random variable in [0,1]. double v = Peek()->RandU01(); @@ -520,7 +520,7 @@ ParetoRandomVariable::GetValue(double scale, double shape, double bound) // Calculate the scale parameter. NS_LOG_FUNCTION(this << scale << shape << bound); - while (1) + while (true) { // Get a uniform random variable in [0,1]. double v = Peek()->RandU01(); @@ -617,7 +617,7 @@ WeibullRandomVariable::GetValue(double scale, double shape, double bound) { NS_LOG_FUNCTION(this << scale << shape << bound); double exponent = 1.0 / shape; - while (1) + while (true) { // Get a uniform random variable in [0,1]. double v = Peek()->RandU01(); @@ -724,7 +724,7 @@ NormalRandomVariable::GetValue(double mean, double variance, double bound) return x2; } } - while (1) + while (true) { // See Simulation Modeling and Analysis p. 466 (Averill Law) // for algorithm; basically a Box-Muller transform: // http://en.wikipedia.org/wiki/Box-Muller_transform @@ -992,7 +992,7 @@ GammaRandomVariable::GetValue(double alpha, double beta) double d = alpha - 1.0 / 3.0; double c = (1.0 / 3.0) / std::sqrt(d); - while (1) + while (true) { do { @@ -1045,7 +1045,7 @@ GammaRandomVariable::GetNormalValue(double mean, double variance, double bound) return x2; } } - while (1) + while (true) { // See Simulation Modeling and Analysis p. 466 (Averill Law) // for algorithm; basically a Box-Muller transform: // http://en.wikipedia.org/wiki/Box-Muller_transform @@ -1173,7 +1173,7 @@ double ErlangRandomVariable::GetExponentialValue(double mean, double bound) { NS_LOG_FUNCTION(this << mean << bound); - while (1) + while (true) { // Get a uniform random variable in [0,1]. double v = Peek()->RandU01(); diff --git a/src/core/test/ptr-test-suite.cc b/src/core/test/ptr-test-suite.cc index 2e9b05cd4..a977ee0e1 100644 --- a/src/core/test/ptr-test-suite.cc +++ b/src/core/test/ptr-test-suite.cc @@ -178,7 +178,7 @@ PtrTestCase::CallTestConst(const Ptr p) void PtrTestCase::DoRun() { - m_nDestroyed = false; + m_nDestroyed = 0; { Ptr p = Create(this); } diff --git a/src/dsdv/model/dsdv-rtable.h b/src/dsdv/model/dsdv-rtable.h index 4046e2502..6ee6c63a1 100644 --- a/src/dsdv/model/dsdv-rtable.h +++ b/src/dsdv/model/dsdv-rtable.h @@ -317,7 +317,7 @@ class RoutingTableEntry /// A node does that in hope of receiving a better update. Time m_settlingTime; /// Flag to show if any of the routing table entries were changed with the routing update. - uint32_t m_entriesChanged; + bool m_entriesChanged; }; /** diff --git a/src/energy/examples/basic-energy-model-test.cc b/src/energy/examples/basic-energy-model-test.cc index 9763968e7..7221dfec5 100644 --- a/src/energy/examples/basic-energy-model-test.cc +++ b/src/energy/examples/basic-energy-model-test.cc @@ -91,35 +91,35 @@ BasicEnergyUpdateTest::DoRun() // run state switch tests if (StateSwitchTest(WifiPhyState::IDLE)) { - return 1; + return true; std::cerr << "Problem with state switch test (WifiPhy idle)." << std::endl; } if (StateSwitchTest(WifiPhyState::CCA_BUSY)) { - return 1; + return true; std::cerr << "Problem with state switch test (WifiPhy cca busy)." << std::endl; } if (StateSwitchTest(WifiPhyState::TX)) { - return 1; + return true; std::cerr << "Problem with state switch test (WifiPhy tx)." << std::endl; } if (StateSwitchTest(WifiPhyState::RX)) { - return 1; + return true; std::cerr << "Problem with state switch test (WifiPhy rx)." << std::endl; } if (StateSwitchTest(WifiPhyState::SWITCHING)) { - return 1; + return true; std::cerr << "Problem with state switch test (WifiPhy switching)." << std::endl; } if (StateSwitchTest(WifiPhyState::SLEEP)) { - return 1; + return true; std::cerr << "Problem with state switch test (WifiPhy sleep)." << std::endl; } - return 0; + return false; } bool @@ -302,7 +302,7 @@ BasicEnergyDepletionTest::DoRun() /* * Run simulation with different simulation time and update interval. */ - uint8_t ret = 0; + bool ret = false; for (double simTimeS = 0.0; simTimeS <= m_simTimeS; simTimeS += m_timeStepS) { @@ -311,7 +311,7 @@ BasicEnergyDepletionTest::DoRun() { if (DepletionTestCase(simTimeS, updateIntervalS)) { - ret = 1; + ret = true; std::cerr << "Depletion test case problem." << std::endl; } // reset callback count diff --git a/src/fd-net-device/examples/fd2fd-onoff.cc b/src/fd-net-device/examples/fd2fd-onoff.cc index a4e9dc59a..fbd222ef8 100644 --- a/src/fd-net-device/examples/fd2fd-onoff.cc +++ b/src/fd-net-device/examples/fd2fd-onoff.cc @@ -64,7 +64,7 @@ main(int argc, char* argv[]) cmd.Parse(argc, argv); std::string factory; - if (tcpMode == 1) + if (tcpMode) { factory = "ns3::TcpSocketFactory"; } diff --git a/src/fd-net-device/helper/tap-device-creator.cc b/src/fd-net-device/helper/tap-device-creator.cc index 165791427..fc4ff40f4 100644 --- a/src/fd-net-device/helper/tap-device-creator.cc +++ b/src/fd-net-device/helper/tap-device-creator.cc @@ -216,8 +216,8 @@ SetUp(char* deviceName) int CreateTap(char* deviceName, const char* mac, - const int ifftap, - const int iffpi, + bool ifftap, + bool iffpi, const char* ip4, const char* netmask, const char* ip6, @@ -293,8 +293,8 @@ main(int argc, char* argv[]) char* mac = nullptr; char* netmask = nullptr; char* path = nullptr; - int tap = false; - int pi = false; + bool tap = false; + bool pi = false; int prefix = -1; while ((c = getopt(argc, argv, "vd:i:m:n:I:P:thp:")) != -1) diff --git a/src/internet-apps/model/ping.cc b/src/internet-apps/model/ping.cc index 194afb24d..a241babbb 100644 --- a/src/internet-apps/model/ping.cc +++ b/src/internet-apps/model/ping.cc @@ -286,7 +286,7 @@ Ping::Receive(Ptr socket) switch (type) { case Icmpv6Header::ICMPV6_ECHO_REPLY: { - Icmpv6Echo echo(0); + Icmpv6Echo echo(false); packet->RemoveHeader(echo); if (echo.GetId() != PING_ID) diff --git a/src/internet-apps/model/ping6.cc b/src/internet-apps/model/ping6.cc index 9294df421..d6757c419 100644 --- a/src/internet-apps/model/ping6.cc +++ b/src/internet-apps/model/ping6.cc @@ -218,7 +218,7 @@ Ping6::Send() data[3] = 0xEF; Ptr p = Create(data, size); - Icmpv6Echo req(1); + Icmpv6Echo req(true); req.SetId(0xBEEF); req.SetSeq(m_seq); @@ -268,7 +268,7 @@ Ping6::HandleRead(Ptr socket) if (Inet6SocketAddress::IsMatchingType(from)) { Ipv6Header hdr; - Icmpv6Echo reply(0); + Icmpv6Echo reply(false); Icmpv6DestinationUnreachable destUnreach; Icmpv6TimeExceeded timeExceeded; Inet6SocketAddress address = Inet6SocketAddress::ConvertFrom(from); diff --git a/src/internet/model/icmpv6-header.cc b/src/internet/model/icmpv6-header.cc index e119d8eb9..9f01ac8f2 100644 --- a/src/internet/model/icmpv6-header.cc +++ b/src/internet/model/icmpv6-header.cc @@ -346,9 +346,9 @@ Icmpv6NA::Icmpv6NA() SetType(ICMPV6_ND_NEIGHBOR_ADVERTISEMENT); SetCode(0); SetReserved(0); - SetFlagR(0); - SetFlagS(0); - SetFlagO(0); + SetFlagR(false); + SetFlagS(false); + SetFlagO(false); m_checksum = 0; } @@ -545,9 +545,9 @@ Icmpv6RA::Icmpv6RA() NS_LOG_FUNCTION(this); SetType(ICMPV6_ND_ROUTER_ADVERTISEMENT); SetCode(0); - SetFlagM(0); - SetFlagO(0); - SetFlagH(0); + SetFlagM(false); + SetFlagO(false); + SetFlagH(false); SetCurHopLimit(0); SetLifeTime(0); SetRetransmissionTime(0); diff --git a/src/internet/model/icmpv6-l4-protocol.cc b/src/internet/model/icmpv6-l4-protocol.cc index 69277526b..d6d202a77 100644 --- a/src/internet/model/icmpv6-l4-protocol.cc +++ b/src/internet/model/icmpv6-l4-protocol.cc @@ -605,7 +605,7 @@ Icmpv6L4Protocol::HandleRS(Ptr packet, Icmpv6RS rsHeader; packet->RemoveHeader(rsHeader); Address hardwareAddress; - Icmpv6OptionLinkLayerAddress lla(1); + Icmpv6OptionLinkLayerAddress lla(true); NdiscCache::Entry* entry = nullptr; Ptr cache = FindCache(interface->GetDevice()); @@ -786,7 +786,7 @@ Icmpv6L4Protocol::ForgeRS(Ipv6Address src, Ipv6Address dst, Address hardwareAddr if (!src.IsAny()) { Icmpv6OptionLinkLayerAddress llOption( - 1, + true, hardwareAddress); /* we give our mac address in response */ p->AddHeader(llOption); } @@ -813,7 +813,7 @@ Icmpv6L4Protocol::ForgeEchoRequest(Ipv6Address src, NS_LOG_FUNCTION(this << src << dst << id << seq << data); Ptr p = data->Copy(); Ipv6Header ipHeader; - Icmpv6Echo req(1); + Icmpv6Echo req(true); req.SetId(id); req.SetSeq(seq); @@ -841,7 +841,7 @@ Icmpv6L4Protocol::HandleNA(Ptr packet, { NS_LOG_FUNCTION(this << packet << src << dst << interface); Icmpv6NA naHeader; - Icmpv6OptionLinkLayerAddress lla(1); + Icmpv6OptionLinkLayerAddress lla(true); packet->RemoveHeader(naHeader); Ipv6Address target = naHeader.GetIpv6Target(); @@ -1022,7 +1022,7 @@ Icmpv6L4Protocol::HandleRedirection(Ptr packet, NS_LOG_FUNCTION(this << packet << src << dst << interface); bool hasLla = false; Ptr p = packet->Copy(); - Icmpv6OptionLinkLayerAddress llOptionHeader(0); + Icmpv6OptionLinkLayerAddress llOptionHeader(false); Icmpv6Redirection redirectionHeader; p->RemoveHeader(redirectionHeader); @@ -1255,7 +1255,7 @@ Icmpv6L4Protocol::SendNA(Ipv6Address src, Ipv6Address dst, Address* hardwareAddr NS_LOG_FUNCTION(this << src << dst << hardwareAddress << static_cast(flags)); Ptr p = Create(); Icmpv6NA na; - Icmpv6OptionLinkLayerAddress llOption(0, *hardwareAddress); /* not a source link layer */ + Icmpv6OptionLinkLayerAddress llOption(false, *hardwareAddress); /* not a source link layer */ NS_LOG_LOGIC("Send NA ( from " << src << " to " << dst << " target " << src << ")"); na.SetIpv6Target(src); @@ -1289,7 +1289,7 @@ Icmpv6L4Protocol::SendEchoReply(Ipv6Address src, { NS_LOG_FUNCTION(this << src << dst << id << seq << data); Ptr p = data->Copy(); - Icmpv6Echo reply(0); /* echo reply */ + Icmpv6Echo reply(false); /* echo reply */ reply.SetId(id); reply.SetSeq(seq); @@ -1313,7 +1313,7 @@ Icmpv6L4Protocol::SendNS(Ipv6Address src, /* Ipv6Header ipHeader; */ Icmpv6NS ns(target); Icmpv6OptionLinkLayerAddress llOption( - 1, + true, hardwareAddress); /* we give our mac address in response */ /* if the source is unspec, multicast the NA to all-nodes multicast */ @@ -1356,7 +1356,7 @@ Icmpv6L4Protocol::SendRS(Ipv6Address src, Ipv6Address dst, Address hardwareAddre // unspecified address. Otherwise, it SHOULD be included on link layers that have addresses. if (!src.IsAny()) { - Icmpv6OptionLinkLayerAddress llOption(1, hardwareAddress); + Icmpv6OptionLinkLayerAddress llOption(true, hardwareAddress); p->AddHeader(llOption); } @@ -1548,7 +1548,7 @@ Icmpv6L4Protocol::SendRedirection(Ptr redirectedPacket, uint32_t llaSize = 0; Ptr p = Create(); uint32_t redirectedPacketSize = redirectedPacket->GetSize(); - Icmpv6OptionLinkLayerAddress llOption(0); + Icmpv6OptionLinkLayerAddress llOption(false); NS_LOG_LOGIC("Send Redirection ( to " << dst << " target " << redirTarget << " destination " << redirDestination << " )"); @@ -1606,7 +1606,7 @@ Icmpv6L4Protocol::ForgeNA(Ipv6Address src, Ipv6Address dst, Address* hardwareAdd Ipv6Header ipHeader; Icmpv6NA na; Icmpv6OptionLinkLayerAddress llOption( - 0, + false, *hardwareAddress); /* we give our mac address in response */ NS_LOG_LOGIC("Send NA ( from " << src << " to " << dst << ")"); @@ -1653,7 +1653,7 @@ Icmpv6L4Protocol::ForgeNS(Ipv6Address src, Ipv6Header ipHeader; Icmpv6NS ns(target); Icmpv6OptionLinkLayerAddress llOption( - 1, + true, hardwareAddress); /* we give our mac address in response */ NS_LOG_LOGIC("Send NS ( from " << src << " to " << dst << " target " << target << ")"); diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc index 489eb94bd..fd8fcbf4a 100644 --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -1609,7 +1609,7 @@ Ipv4L3Protocol::ProcessFragment(Ptr& packet, Ipv4Header& ipHeader, uint3 } Ipv4L3Protocol::Fragments::Fragments() - : m_moreFragment(0) + : m_moreFragment(false) { NS_LOG_FUNCTION(this); } diff --git a/src/internet/model/ipv6-extension.cc b/src/internet/model/ipv6-extension.cc index c8157a126..809562e1d 100644 --- a/src/internet/model/ipv6-extension.cc +++ b/src/internet/model/ipv6-extension.cc @@ -730,7 +730,7 @@ Ipv6ExtensionFragment::HandleTimeout() } Ipv6ExtensionFragment::Fragments::Fragments() - : m_moreFragment(0) + : m_moreFragment(false) { } @@ -1310,7 +1310,7 @@ Ipv6ExtensionAH::Process(Ptr& packet, /** \todo */ - return true; + return 1; } } /* namespace ns3 */ diff --git a/src/internet/model/ipv6-raw-socket-impl.cc b/src/internet/model/ipv6-raw-socket-impl.cc index 4ff166993..3908077c8 100644 --- a/src/internet/model/ipv6-raw-socket-impl.cc +++ b/src/internet/model/ipv6-raw-socket-impl.cc @@ -293,7 +293,7 @@ Ipv6RawSocketImpl::SendTo(Ptr p, uint32_t flags, const Address& toAddres p->CopyData(&type, sizeof(type)); if (type == Icmpv6Header::ICMPV6_ECHO_REQUEST) { - Icmpv6Echo hdr(1); + Icmpv6Echo hdr(true); p->RemoveHeader(hdr); hdr.CalculatePseudoHeaderChecksum(route->GetSource(), dst, diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index 49cba7a6e..4fc36b548 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -3291,13 +3291,13 @@ TcpSocketBase::SendPendingData(bool withAck) NS_LOG_FUNCTION(this << withAck); if (m_txBuffer->Size() == 0) { - return false; // Nothing to send + return 0; // Nothing to send } if (m_endPoint == nullptr && m_endPoint6 == nullptr) { NS_LOG_INFO( "TcpSocketBase::SendPendingData: No endpoint; m_shutdownSend=" << m_shutdownSend); - return false; // Is this the right way to handle this condition? + return 0; // Is this the right way to handle this condition? } uint32_t nPacketsSent = 0; diff --git a/src/internet/test/icmp-test.cc b/src/internet/test/icmp-test.cc index 037793790..964348056 100644 --- a/src/internet/test/icmp-test.cc +++ b/src/internet/test/icmp-test.cc @@ -399,7 +399,7 @@ void IcmpV6EchoReplyTestCase::SendData(Ptr socket, Ipv6Address dst) { Ptr p = Create(); - Icmpv6Echo echo(1); + Icmpv6Echo echo(true); echo.SetSeq(1); echo.SetId(0XB1ED); p->AddHeader(echo); @@ -537,7 +537,7 @@ void IcmpV6TimeExceedTestCase::SendData(Ptr socket, Ipv6Address dst) { Ptr p = Create(); - Icmpv6Echo echo(1); + Icmpv6Echo echo(true); echo.SetSeq(1); echo.SetId(0XB1ED); p->AddHeader(echo); diff --git a/src/lte/examples/lena-radio-link-failure.cc b/src/lte/examples/lena-radio-link-failure.cc index 5f73b87f9..f37853e9c 100644 --- a/src/lte/examples/lena-radio-link-failure.cc +++ b/src/lte/examples/lena-radio-link-failure.cc @@ -632,7 +632,7 @@ main(int argc, char* argv[]) Config::ConnectWithoutContext(oss.str(), MakeCallback(&ReceivePacket)); bool firstWrite = true; - std::string rrcType = useIdealRrc == 1 ? "ideal_rrc" : "real_rrc"; + std::string rrcType = useIdealRrc ? "ideal_rrc" : "real_rrc"; std::string fileName = "rlf_dl_thrput_" + std::to_string(enbNodes.GetN()) + "_eNB_" + rrcType; Time binSize = Seconds(0.2); Simulator::Schedule(Seconds(0.47), &Throughput, firstWrite, binSize, fileName); diff --git a/src/lte/model/lte-rrc-header.cc b/src/lte/model/lte-rrc-header.cc index 81add7473..4b28ff7c8 100644 --- a/src/lte/model/lte-rrc-header.cc +++ b/src/lte/model/lte-rrc-header.cc @@ -144,11 +144,11 @@ RrcAsn1Header::SerializeDrbToAddModList(std::list drbToA // Serialize DRB-ToAddMod sequence // 5 optional fields. Extension marker is present. std::bitset<5> drbToAddModListOptionalFieldsPresent = std::bitset<5>(); - drbToAddModListOptionalFieldsPresent.set(4, 1); // eps-BearerIdentity present - drbToAddModListOptionalFieldsPresent.set(3, 0); // pdcp-Config not present - drbToAddModListOptionalFieldsPresent.set(2, 1); // rlc-Config present - drbToAddModListOptionalFieldsPresent.set(1, 1); // logicalChannelIdentity present - drbToAddModListOptionalFieldsPresent.set(0, 1); // logicalChannelConfig present + drbToAddModListOptionalFieldsPresent.set(4, true); // eps-BearerIdentity present + drbToAddModListOptionalFieldsPresent.set(3, false); // pdcp-Config not present + drbToAddModListOptionalFieldsPresent.set(2, true); // rlc-Config present + drbToAddModListOptionalFieldsPresent.set(1, true); // logicalChannelIdentity present + drbToAddModListOptionalFieldsPresent.set(0, true); // logicalChannelConfig present SerializeSequence(drbToAddModListOptionalFieldsPresent, true); // Serialize eps-BearerIdentity::=INTEGER (0..15) @@ -232,8 +232,8 @@ RrcAsn1Header::SerializeSrbToAddModList(std::list srbToA // Serialize SRB-ToAddMod sequence // 2 optional fields. Extension marker is present. std::bitset<2> srbToAddModListOptionalFieldsPresent = std::bitset<2>(); - srbToAddModListOptionalFieldsPresent.set(1, 0); // rlc-Config not present - srbToAddModListOptionalFieldsPresent.set(0, 1); // logicalChannelConfig present + srbToAddModListOptionalFieldsPresent.set(1, false); // rlc-Config not present + srbToAddModListOptionalFieldsPresent.set(0, true); // logicalChannelConfig present SerializeSequence(srbToAddModListOptionalFieldsPresent, true); // Serialize srb-Identity ::= INTEGER (1..2) @@ -333,19 +333,19 @@ RrcAsn1Header::SerializePhysicalConfigDedicated( optionalFieldsPhysicalConfigDedicated.set( 9, physicalConfigDedicated.havePdschConfigDedicated); // pdsch-ConfigDedicated - optionalFieldsPhysicalConfigDedicated.set(8, 0); // pucch-ConfigDedicated not present - optionalFieldsPhysicalConfigDedicated.set(7, 0); // pusch-ConfigDedicated not present - optionalFieldsPhysicalConfigDedicated.set(6, 0); // uplinkPowerControlDedicated not present - optionalFieldsPhysicalConfigDedicated.set(5, 0); // tpc-PDCCH-ConfigPUCCH not present - optionalFieldsPhysicalConfigDedicated.set(4, 0); // tpc-PDCCH-ConfigPUSCH not present - optionalFieldsPhysicalConfigDedicated.set(3, 0); // cqi-ReportConfig not present + optionalFieldsPhysicalConfigDedicated.set(8, false); // pucch-ConfigDedicated not present + optionalFieldsPhysicalConfigDedicated.set(7, false); // pusch-ConfigDedicated not present + optionalFieldsPhysicalConfigDedicated.set(6, false); // uplinkPowerControlDedicated not present + optionalFieldsPhysicalConfigDedicated.set(5, false); // tpc-PDCCH-ConfigPUCCH not present + optionalFieldsPhysicalConfigDedicated.set(4, false); // tpc-PDCCH-ConfigPUSCH not present + optionalFieldsPhysicalConfigDedicated.set(3, false); // cqi-ReportConfig not present optionalFieldsPhysicalConfigDedicated.set( 2, physicalConfigDedicated.haveSoundingRsUlConfigDedicated); // soundingRS-UL-ConfigDedicated optionalFieldsPhysicalConfigDedicated.set( 1, physicalConfigDedicated.haveAntennaInfoDedicated); // antennaInfo - optionalFieldsPhysicalConfigDedicated.set(0, 0); // schedulingRequestConfig not present + optionalFieldsPhysicalConfigDedicated.set(0, false); // schedulingRequestConfig not present SerializeSequence(optionalFieldsPhysicalConfigDedicated, true); if (physicalConfigDedicated.havePdschConfigDedicated) @@ -443,10 +443,9 @@ RrcAsn1Header::SerializeRadioResourceConfigDedicated( optionalFieldsPresent.set(5, isSrbToAddModListPresent); // srb-ToAddModList present optionalFieldsPresent.set(4, isDrbToAddModListPresent); // drb-ToAddModList present optionalFieldsPresent.set(3, isDrbToReleaseListPresent); // drb-ToReleaseList present - optionalFieldsPresent.set(2, 0); // mac-MainConfig not present - optionalFieldsPresent.set(1, 0); // sps-Config not present - optionalFieldsPresent.set(0, - (radioResourceConfigDedicated.havePhysicalConfigDedicated) ? 1 : 0); + optionalFieldsPresent.set(2, false); // mac-MainConfig not present + optionalFieldsPresent.set(1, false); // sps-Config not present + optionalFieldsPresent.set(0, radioResourceConfigDedicated.havePhysicalConfigDedicated); SerializeSequence(optionalFieldsPresent, true); // Serialize srbToAddModList @@ -485,9 +484,9 @@ RrcAsn1Header::SerializeSystemInformationBlockType1( { // 3 optional fields, no extension marker. std::bitset<3> sysInfoBlk1Opts; - sysInfoBlk1Opts.set(2, 0); // p-Max absent - sysInfoBlk1Opts.set(1, 0); // tdd-Config absent - sysInfoBlk1Opts.set(0, 0); // nonCriticalExtension absent + sysInfoBlk1Opts.set(2, false); // p-Max absent + sysInfoBlk1Opts.set(1, false); // tdd-Config absent + sysInfoBlk1Opts.set(0, false); // nonCriticalExtension absent SerializeSequence(sysInfoBlk1Opts, false); // Serialize cellAccessRelatedInfo @@ -548,15 +547,15 @@ RrcAsn1Header::SerializeRadioResourceConfigCommon( { // 9 optional fields. Extension marker yes. std::bitset<9> rrCfgCmmOpts; - rrCfgCmmOpts.set(8, 1); // rach-ConfigCommon is present - rrCfgCmmOpts.set(7, 0); // pdsch-ConfigCommon not present - rrCfgCmmOpts.set(6, 0); // phich-Config not present - rrCfgCmmOpts.set(5, 0); // pucch-ConfigCommon not present - rrCfgCmmOpts.set(4, 0); // soundingRS-UL-ConfigCommon not present - rrCfgCmmOpts.set(3, 0); // uplinkPowerControlCommon not present - rrCfgCmmOpts.set(2, 0); // antennaInfoCommon not present - rrCfgCmmOpts.set(1, 0); // p-Max not present - rrCfgCmmOpts.set(0, 0); // tdd-Config not present + rrCfgCmmOpts.set(8, true); // rach-ConfigCommon is present + rrCfgCmmOpts.set(7, false); // pdsch-ConfigCommon not present + rrCfgCmmOpts.set(6, false); // phich-Config not present + rrCfgCmmOpts.set(5, false); // pucch-ConfigCommon not present + rrCfgCmmOpts.set(4, false); // soundingRS-UL-ConfigCommon not present + rrCfgCmmOpts.set(3, false); // uplinkPowerControlCommon not present + rrCfgCmmOpts.set(2, false); // antennaInfoCommon not present + rrCfgCmmOpts.set(1, false); // p-Max not present + rrCfgCmmOpts.set(0, false); // tdd-Config not present SerializeSequence(rrCfgCmmOpts, true); @@ -1573,7 +1572,7 @@ RrcAsn1Header::SerializeMeasConfig(LteRrcSap::MeasConfig measConfig) const // QuantityConfig sequence // 4 optional fields, only first (EUTRA) present. Extension marker yes. std::bitset<4> quantityConfigOpts(0); - quantityConfigOpts.set(3, 1); + quantityConfigOpts.set(3, true); SerializeSequence(quantityConfigOpts, true); SerializeSequence(std::bitset<0>(), false); @@ -1826,7 +1825,7 @@ RrcAsn1Header::SerializeNonCriticalExtensionConfiguration( !nonCriticalExtension.sCellToAddModList.empty()); // sCellToAddModList-r10 noncriticalExtension_v1020.set( 0, - 0); // No nonCriticalExtension RRCConnectionReconfiguration-v1130-IEs + false); // No nonCriticalExtension RRCConnectionReconfiguration-v1130-IEs SerializeSequence(noncriticalExtension_v1020, false); if (!nonCriticalExtension.sCellToReleaseList.empty()) @@ -1844,9 +1843,9 @@ RrcAsn1Header::SerializeNonCriticalExtensionConfiguration( for (auto& it : nonCriticalExtension.sCellToAddModList) { std::bitset<4> sCellToAddMod_r10; - sCellToAddMod_r10.set(3, 1); // sCellIndex - sCellToAddMod_r10.set(2, 1); // CellIdentification - sCellToAddMod_r10.set(1, 1); // RadioResourceConfigCommonSCell + sCellToAddMod_r10.set(3, true); // sCellIndex + sCellToAddMod_r10.set(2, true); // CellIdentification + sCellToAddMod_r10.set(1, true); // RadioResourceConfigCommonSCell sCellToAddMod_r10.set( 0, it.haveRadioResourceConfigDedicatedSCell); // No nonCriticalExtension RRC @@ -1855,8 +1854,8 @@ RrcAsn1Header::SerializeNonCriticalExtensionConfiguration( // Serialize CellIdentification std::bitset<2> cellIdentification_r10; - cellIdentification_r10.set(1, 1); // phyCellId-r10 - cellIdentification_r10.set(0, 1); // dl-CarrierFreq-r10 + cellIdentification_r10.set(1, true); // phyCellId-r10 + cellIdentification_r10.set(0, true); // dl-CarrierFreq-r10 SerializeSequence(cellIdentification_r10, false); SerializeInteger(it.cellIdentification.physCellId, 1, 65536); @@ -1888,23 +1887,23 @@ RrcAsn1Header::SerializeRadioResourceConfigCommonSCell( { // 5 optional fields. Extension marker not present. std::bitset<5> nonUlConfiguration_r10; - nonUlConfiguration_r10.set(4, 1); // Dl- bandwidth --> convert in enum - nonUlConfiguration_r10.set(3, 1); // AntennaInfoCommon-r10 - nonUlConfiguration_r10.set(2, 0); // phich-Config-r10 Not Implemented - nonUlConfiguration_r10.set(1, 1); // pdschConfigCommon - nonUlConfiguration_r10.set(0, 0); // Tdd-Config-r10 Not Implemented + nonUlConfiguration_r10.set(4, true); // Dl- bandwidth --> convert in enum + nonUlConfiguration_r10.set(3, true); // AntennaInfoCommon-r10 + nonUlConfiguration_r10.set(2, false); // phich-Config-r10 Not Implemented + nonUlConfiguration_r10.set(1, true); // pdschConfigCommon + nonUlConfiguration_r10.set(0, false); // Tdd-Config-r10 Not Implemented SerializeSequence(nonUlConfiguration_r10, false); SerializeInteger(rrccsc.nonUlConfiguration.dlBandwidth, 6, 100); std::bitset<1> antennaInfoCommon_r10; - antennaInfoCommon_r10.set(0, 1); + antennaInfoCommon_r10.set(0, true); SerializeSequence(antennaInfoCommon_r10, false); SerializeInteger(rrccsc.nonUlConfiguration.antennaInfoCommon.antennaPortsCount, 0, 65536); std::bitset<2> pdschConfigCommon_r10; - pdschConfigCommon_r10.set(1, 1); - pdschConfigCommon_r10.set(0, 1); + pdschConfigCommon_r10.set(1, true); + pdschConfigCommon_r10.set(0, true); SerializeSequence(pdschConfigCommon_r10, false); SerializeInteger(rrccsc.nonUlConfiguration.pdschConfigCommon.referenceSignalPower, -60, 50); @@ -1915,20 +1914,20 @@ RrcAsn1Header::SerializeRadioResourceConfigCommonSCell( // Serialize Ul Configuration // 7 optional fields. Extension marker present. std::bitset<7> UlConfiguration_r10; - UlConfiguration_r10.set(6, 1); // ul-Configuration-r10 - UlConfiguration_r10.set(5, 0); // p-Max-r10 Not Implemented - UlConfiguration_r10.set(4, 1); // uplinkPowerControlCommonSCell-r10 - UlConfiguration_r10.set(3, 0); // soundingRS-UL-ConfigCommon-r10 - UlConfiguration_r10.set(2, 0); // ul-CyclicPrefixLength-r10 - UlConfiguration_r10.set(1, 1); // prach-ConfigSCell-r10 - UlConfiguration_r10.set(0, 0); // pusch-ConfigCommon-r10 Not Implemented + UlConfiguration_r10.set(6, true); // ul-Configuration-r10 + UlConfiguration_r10.set(5, false); // p-Max-r10 Not Implemented + UlConfiguration_r10.set(4, true); // uplinkPowerControlCommonSCell-r10 + UlConfiguration_r10.set(3, false); // soundingRS-UL-ConfigCommon-r10 + UlConfiguration_r10.set(2, false); // ul-CyclicPrefixLength-r10 + UlConfiguration_r10.set(1, true); // prach-ConfigSCell-r10 + UlConfiguration_r10.set(0, false); // pusch-ConfigCommon-r10 Not Implemented SerializeSequence(UlConfiguration_r10, true); // Serialize ulFreqInfo std::bitset<3> FreqInfo_r10; - FreqInfo_r10.set(2, 1); // ulCarrierFreq - FreqInfo_r10.set(1, 1); // UlBandwidth - FreqInfo_r10.set(0, 0); // additionalSpectrumEmissionSCell-r10 Not Implemented + FreqInfo_r10.set(2, true); // ulCarrierFreq + FreqInfo_r10.set(1, true); // UlBandwidth + FreqInfo_r10.set(0, false); // additionalSpectrumEmissionSCell-r10 Not Implemented SerializeSequence(FreqInfo_r10, false); SerializeInteger(rrccsc.ulConfiguration.ulFreqInfo.ulCarrierFreq, 0, MAX_EARFCN); @@ -1936,8 +1935,8 @@ RrcAsn1Header::SerializeRadioResourceConfigCommonSCell( // Serialize UlPowerControlCommonSCell std::bitset<2> UlPowerControlCommonSCell_r10; - UlPowerControlCommonSCell_r10.set(1, 0); // p0-NominalPUSCH-r10 Not Implemented - UlPowerControlCommonSCell_r10.set(0, 1); // alpha + UlPowerControlCommonSCell_r10.set(1, false); // p0-NominalPUSCH-r10 Not Implemented + UlPowerControlCommonSCell_r10.set(0, true); // alpha SerializeSequence(UlPowerControlCommonSCell_r10, false); SerializeInteger(rrccsc.ulConfiguration.ulPowerControlCommonSCell.alpha, 0, 65536); @@ -1947,7 +1946,7 @@ RrcAsn1Header::SerializeRadioResourceConfigCommonSCell( // Serialize PrachConfigSCell std::bitset<1> prachConfigSCell_r10; - prachConfigSCell_r10.set(0, 1); + prachConfigSCell_r10.set(0, true); SerializeSequence(prachConfigSCell_r10, false); SerializeInteger(rrccsc.ulConfiguration.prachConfigSCell.index, 0, 256); } @@ -1959,7 +1958,7 @@ RrcAsn1Header::SerializeRadioResourceDedicatedSCell( { // Serialize RadioResourceConfigDedicatedSCell std::bitset<1> RadioResourceConfigDedicatedSCell_r10; - RadioResourceConfigDedicatedSCell_r10.set(0, 1); + RadioResourceConfigDedicatedSCell_r10.set(0, true); SerializeSequence(RadioResourceConfigDedicatedSCell_r10, false); LteRrcSap::PhysicalConfigDedicatedSCell pcdsc = rrcdsc.physicalConfigDedicatedSCell; @@ -1980,8 +1979,8 @@ RrcAsn1Header::SerializePhysicalConfigDedicatedSCell( // Serialize NonUl configuration std::bitset<4> nulOpt; nulOpt.set(3, pcdsc.haveAntennaInfoDedicated); - nulOpt.set(2, 0); // crossCarrierSchedulingConfig-r10 Not Implemented - nulOpt.set(1, 0); // csi-RS-Config-r10 Not Implemented + nulOpt.set(2, false); // crossCarrierSchedulingConfig-r10 Not Implemented + nulOpt.set(1, false); // csi-RS-Config-r10 Not Implemented nulOpt.set(0, pcdsc.havePdschConfigDedicated); // pdsch-ConfigDedicated-r10 SerializeSequence(nulOpt, false); @@ -2024,12 +2023,12 @@ RrcAsn1Header::SerializePhysicalConfigDedicatedSCell( // Serialize Ul Configuration std::bitset<7> ulOpt; ulOpt.set(6, pcdsc.haveAntennaInfoUlDedicated); // antennaInfoUL-r10 - ulOpt.set(5, 0); // pusch-ConfigDedicatedSCell-r10 not present - ulOpt.set(4, 0); // uplinkPowerControlDedicatedSCell-r10 not present - ulOpt.set(3, 0); // cqi-ReportConfigSCell-r10 not present + ulOpt.set(5, false); // pusch-ConfigDedicatedSCell-r10 not present + ulOpt.set(4, false); // uplinkPowerControlDedicatedSCell-r10 not present + ulOpt.set(3, false); // cqi-ReportConfigSCell-r10 not present ulOpt.set(2, pcdsc.haveSoundingRsUlConfigDedicated); // soundingRS-UL-ConfigDedicated-r10 - ulOpt.set(1, 0); // soundingRS-UL-ConfigDedicated-v1020 not present - ulOpt.set(0, 0); // soundingRS-UL-ConfigDedicatedAperiodic-r10 not present + ulOpt.set(1, false); // soundingRS-UL-ConfigDedicated-v1020 not present + ulOpt.set(0, false); // soundingRS-UL-ConfigDedicatedAperiodic-r10 not present SerializeSequence(ulOpt, false); if (pcdsc.haveAntennaInfoUlDedicated) @@ -5336,9 +5335,9 @@ RrcConnectionReconfigurationHeader::PreSerialize() const std::bitset<6> options; options.set(5, m_haveMeasConfig); options.set(4, m_haveMobilityControlInfo); - options.set(3, 0); // No dedicatedInfoNASList + options.set(3, false); // No dedicatedInfoNASList options.set(2, m_haveRadioResourceConfigDedicated); - options.set(1, 0); // No securityConfigHO + options.set(1, false); // No securityConfigHO options.set(0, m_haveNonCriticalExtension); // Implemented nonCriticalExtension because // compatibility with R10 - CA SerializeSequence(options, false); @@ -5356,7 +5355,7 @@ RrcConnectionReconfigurationHeader::PreSerialize() const std::bitset<4> mobCtrlIntoOptional; mobCtrlIntoOptional.set(3, m_mobilityControlInfo.haveCarrierFreq); mobCtrlIntoOptional.set(2, m_mobilityControlInfo.haveCarrierBandwidth); - mobCtrlIntoOptional.set(1, 0); // No additionalSpectrumEmission + mobCtrlIntoOptional.set(1, false); // No additionalSpectrumEmission mobCtrlIntoOptional.set(0, m_mobilityControlInfo.haveRachConfigDedicated); SerializeSequence(mobCtrlIntoOptional, true); @@ -5409,7 +5408,7 @@ RrcConnectionReconfigurationHeader::PreSerialize() const // Serialize NonCriticalExtension RRCConnectionReconfiguration-v890-IEs sequence: // 2 optional fields. Extension marker not present. std::bitset<2> noncriticalExtension_v890; - noncriticalExtension_v890.set(1, 0); // No lateNonCriticalExtension + noncriticalExtension_v890.set(1, false); // No lateNonCriticalExtension noncriticalExtension_v890.set( 0, m_haveNonCriticalExtension); // Implemented nonCriticalExtension because compatibility @@ -5420,8 +5419,8 @@ RrcConnectionReconfigurationHeader::PreSerialize() const // Serialize NonCriticalExtension RRCConnectionReconfiguration-v920-IEs sequence: // 3 optional fields. Extension marker not present. std::bitset<3> noncriticalExtension_v920; - noncriticalExtension_v920.set(1, 0); // No otherConfig-r9 - noncriticalExtension_v920.set(1, 0); // No fullConfig-r9 + noncriticalExtension_v920.set(1, false); // No otherConfig-r9 + noncriticalExtension_v920.set(1, false); // No fullConfig-r9 // Enable RRCCoonectionReconfiguration-v1020-IEs noncriticalExtension_v920.set( 0, @@ -6015,10 +6014,10 @@ HandoverPreparationInfoHeader::PreSerialize() const // Serialize HandoverPreparationInformation-r8-IEs sequence // 4 optional fields, no extension marker. std::bitset<4> handoverPrepInfoOpts; - handoverPrepInfoOpts.set(3, 1); // as-Config present - handoverPrepInfoOpts.set(2, 0); // rrm-Config not present - handoverPrepInfoOpts.set(1, 0); // as-Context not present - handoverPrepInfoOpts.set(0, 0); // nonCriticalExtension not present + handoverPrepInfoOpts.set(3, true); // as-Config present + handoverPrepInfoOpts.set(2, false); // rrm-Config not present + handoverPrepInfoOpts.set(1, false); // as-Context not present + handoverPrepInfoOpts.set(0, false); // nonCriticalExtension not present SerializeSequence(handoverPrepInfoOpts, false); // Serialize ue-RadioAccessCapabilityInfo diff --git a/src/lte/model/lte-ue-phy.cc b/src/lte/model/lte-ue-phy.cc index f7ef206e7..9aa484b99 100644 --- a/src/lte/model/lte-ue-phy.cc +++ b/src/lte/model/lte-ue-phy.cc @@ -968,7 +968,7 @@ LteUePhy::ReportUeMeasurements() (*it).first, avg_rsrp, avg_rsrq, - ((*it).first == m_cellId ? 1 : 0), + (*it).first == m_cellId, m_componentCarrierId); } diff --git a/src/lte/model/lte-ue-phy.h b/src/lte/model/lte-ue-phy.h index 81b5e7eda..3b16825da 100644 --- a/src/lte/model/lte-ue-phy.h +++ b/src/lte/model/lte-ue-phy.h @@ -698,7 +698,7 @@ class LteUePhy : public LtePhy uint16_t m_srsPeriodicity; ///< SRS periodicity uint16_t m_srsSubframeOffset; ///< SRS subframe offset - uint16_t m_srsConfigured; ///< SRS configured + bool m_srsConfigured; ///< SRS configured Time m_srsStartTime; ///< SRS start time double m_paLinear; ///< PA linear diff --git a/src/lte/test/test-lte-rrc.cc b/src/lte/test/test-lte-rrc.cc index 6210d4375..9b1441a97 100644 --- a/src/lte/test/test-lte-rrc.cc +++ b/src/lte/test/test-lte-rrc.cc @@ -782,7 +782,7 @@ LteRrcTestSuite::LteRrcTestSuite() NS_LOG_FUNCTION(this); - for (uint32_t useIdealRrc = 0; useIdealRrc <= 1; ++useIdealRrc) + for (auto useIdealRrc : {false, true}) { // <----- all times in ms -----------------> diff --git a/src/lte/test/test-lte-x2-handover-measures.cc b/src/lte/test/test-lte-x2-handover-measures.cc index cf32f7a95..80d2214f4 100644 --- a/src/lte/test/test-lte-x2-handover-measures.cc +++ b/src/lte/test/test-lte-x2-handover-measures.cc @@ -770,10 +770,9 @@ LteX2HandoverMeasuresTestSuite::LteX2HandoverMeasuresTestSuite() CheckPointEvent(Seconds(25), Seconds(37), checkInterval, 0, 3), }; - int32_t useIdealRrc; std::string sched = "ns3::PfFfMacScheduler"; std::string ho = "ns3::A2A4RsrqHandoverAlgorithm"; - for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc) + for (auto useIdealRrc : {true, false}) { // nEnbs, nUes, nDBearers, celist, name, useUdp, sched, ho, admitHo, idealRrc AddTestCase(new LteX2HandoverMeasuresTestCase(2, @@ -878,7 +877,7 @@ LteX2HandoverMeasuresTestSuite::LteX2HandoverMeasuresTestSuite() } sched = "ns3::RrFfMacScheduler"; - for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc) + for (auto useIdealRrc : {true, false}) { // nEnbs, nUes, nDBearers, celist, name, useUdp, sched, admitHo, idealRrc AddTestCase(new LteX2HandoverMeasuresTestCase(2, @@ -918,7 +917,7 @@ LteX2HandoverMeasuresTestSuite::LteX2HandoverMeasuresTestSuite() ho = "ns3::A3RsrpHandoverAlgorithm"; sched = "ns3::PfFfMacScheduler"; - for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc) + for (auto useIdealRrc : {true, false}) { // nEnbs, nUes, nDBearers, celist, name, useUdp, sched, admitHo, idealRrc AddTestCase(new LteX2HandoverMeasuresTestCase(2, @@ -957,7 +956,7 @@ LteX2HandoverMeasuresTestSuite::LteX2HandoverMeasuresTestSuite() } sched = "ns3::RrFfMacScheduler"; - for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc) + for (auto useIdealRrc : {true, false}) { // nEnbs, nUes, nDBearers, celist, name, useUdp, sched, admitHo, idealRrc AddTestCase(new LteX2HandoverMeasuresTestCase(2, diff --git a/src/lte/test/test-lte-x2-handover.cc b/src/lte/test/test-lte-x2-handover.cc index 7185b48c3..e056dd14e 100644 --- a/src/lte/test/test-lte-x2-handover.cc +++ b/src/lte/test/test-lte-x2-handover.cc @@ -763,7 +763,7 @@ LteX2HandoverTestSuite::LteX2HandoverTestSuite() schedIt != schedulers.end(); ++schedIt) { - for (int32_t useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc) + for (auto useIdealRrc : {true, false}) { // nUes, nDBearers, helist, name, sched, admitHo, idealRrc AddTestCase(new LteX2HandoverTestCase(1, diff --git a/src/mpi/examples/nms-p2p-nix-distributed.cc b/src/mpi/examples/nms-p2p-nix-distributed.cc index 24d42103e..65ede6d47 100644 --- a/src/mpi/examples/nms-p2p-nix-distributed.cc +++ b/src/mpi/examples/nms-p2p-nix-distributed.cc @@ -78,7 +78,7 @@ main(int argc, char* argv[]) uint32_t nCN = 2; uint32_t nLANClients = 10; - bool single = 0; + bool single = false; int nPackets = 10; // Packets sent by OnOff applications bool nix = true; Time stop = Seconds(100); diff --git a/src/network/utils/pcap-file.cc b/src/network/utils/pcap-file.cc index dd022f02c..78094ac15 100644 --- a/src/network/utils/pcap-file.cc +++ b/src/network/utils/pcap-file.cc @@ -404,7 +404,7 @@ PcapFile::Init(uint32_t dataLinkType, // // And set swap mode if requested or we are on a big-endian system. // - m_swapMode = swapMode | bigEndian; + m_swapMode = swapMode || bigEndian; WriteFileHeader(); } diff --git a/src/olsr/model/olsr-routing-protocol.cc b/src/olsr/model/olsr-routing-protocol.cc index 0c9e2dec3..d66472843 100644 --- a/src/olsr/model/olsr-routing-protocol.cc +++ b/src/olsr/model/olsr-routing-protocol.cc @@ -2925,7 +2925,7 @@ RoutingProtocol::RouteOutput(Ptr p, RoutingTableEntry entry2; bool found = false; - if (Lookup(header.GetDestination(), entry1) != 0) + if (Lookup(header.GetDestination(), entry1)) { bool foundSendEntry = FindSendEntry(entry1, entry2); if (!foundSendEntry) diff --git a/src/propagation/model/channel-condition-model.h b/src/propagation/model/channel-condition-model.h index a6ee23243..73865c075 100644 --- a/src/propagation/model/channel-condition-model.h +++ b/src/propagation/model/channel-condition-model.h @@ -572,7 +572,7 @@ class ThreeGppChannelConditionModel : public ChannelConditionModel 0}; //!< the threshold for determining what is the ratio of channels with O2I double m_o2iLowLossThreshold{0}; //!< the threshold for determining what is the ratio of low - //!< high O2I building penetration losses - double m_linkO2iConditionToAntennaHeight{ + bool m_linkO2iConditionToAntennaHeight{ false}; //!< the indicator that determines whether the O2I/O2O condition is determined based //!< on the UE height Ptr m_uniformVarO2i; //!< uniform random variable that is used for the diff --git a/src/spectrum/test/spectrum-interference-test.cc b/src/spectrum/test/spectrum-interference-test.cc index 6143a1d29..a151d18cb 100644 --- a/src/spectrum/test/spectrum-interference-test.cc +++ b/src/spectrum/test/spectrum-interference-test.cc @@ -44,7 +44,7 @@ class SpectrumInterferenceTestCase : public TestCase * Constructor * \param s Spectrum value * \param txBytes number of bytes to transmit - * \param rxCorrect extected Rx bytes + * \param rxCorrect expected Rx bytes * \param name test name */ SpectrumInterferenceTestCase(Ptr s, @@ -62,7 +62,7 @@ class SpectrumInterferenceTestCase : public TestCase private: Ptr m_s; //!< Spectrum value uint32_t m_txBytes; //!< number of bytes to transmit - uint32_t m_rxCorrectKnownOutcome; //!< expected Rx bytes + bool m_rxCorrectKnownOutcome; //!< expected Rx bytes Ptr m_mySpectrumModel; //!< Spectrum model pointer }; diff --git a/src/topology-read/model/rocketfuel-topology-reader.cc b/src/topology-read/model/rocketfuel-topology-reader.cc index fd28fefa6..90052c124 100644 --- a/src/topology-read/model/rocketfuel-topology-reader.cc +++ b/src/topology-read/model/rocketfuel-topology-reader.cc @@ -322,19 +322,15 @@ RocketfuelTopologyReader::GenerateFromWeightsFile(const std::vector RocketfuelTopologyReader::RF_FileType RocketfuelTopologyReader::GetFileType(const std::string& line) { - int ret; - // Check whether Maps file or not std::smatch matches; - ret = std::regex_match(line, matches, rocketfuel_maps_regex); - if (ret) + if (std::regex_match(line, matches, rocketfuel_maps_regex)) { return RF_MAPS; } // Check whether Weights file or not - ret = std::regex_match(line, matches, rocketfuel_weights_regex); - if (ret) + if (std::regex_match(line, matches, rocketfuel_weights_regex)) { return RF_WEIGHTS; } @@ -362,7 +358,6 @@ RocketfuelTopologyReader::Read() while (!topgen.eof()) { - int ret; std::vector argv; lineNumber++; @@ -385,7 +380,7 @@ RocketfuelTopologyReader::Read() if (ftype == RF_MAPS) { - ret = std::regex_match(line, matches, rocketfuel_maps_regex); + bool ret = std::regex_match(line, matches, rocketfuel_maps_regex); if (!ret || matches.empty()) { NS_LOG_WARN("match failed (maps file): %s" << line); @@ -394,7 +389,7 @@ RocketfuelTopologyReader::Read() } else if (ftype == RF_WEIGHTS) { - ret = std::regex_match(line, matches, rocketfuel_weights_regex); + bool ret = std::regex_match(line, matches, rocketfuel_weights_regex); if (!ret || matches.empty()) { NS_LOG_WARN("match failed (weights file): %s" << line); diff --git a/src/traffic-control/model/cobalt-queue-disc.cc b/src/traffic-control/model/cobalt-queue-disc.cc index 34f5feb52..c98ddfff0 100644 --- a/src/traffic-control/model/cobalt-queue-disc.cc +++ b/src/traffic-control/model/cobalt-queue-disc.cc @@ -359,7 +359,7 @@ CobaltQueueDisc::DoDequeue() { NS_LOG_FUNCTION(this); - while (1) + while (true) { Ptr item = GetInternalQueue(0)->Dequeue(); if (!item) @@ -542,7 +542,7 @@ CobaltQueueDisc::CobaltShouldDrop(Ptr item, int64_t now) if (m_pDrop) { double u = m_uv->GetValue(); - drop = drop | (u < m_pDrop); + drop = drop || (u < m_pDrop); } /* Overload the drop_next field as an activity timeout */ diff --git a/src/uan/model/uan-mac-rc-gw.cc b/src/uan/model/uan-mac-rc-gw.cc index e69cfd7a4..5bd9141bc 100644 --- a/src/uan/model/uan-mac-rc-gw.cc +++ b/src/uan/model/uan-mac-rc-gw.cc @@ -724,7 +724,7 @@ UanMacRcGw::FindOptA() { double tput = 0; uint32_t a = 1; - while (1) + while (true) { double newtput = ComputeExpS(a, m_frameSize); if (newtput < tput) diff --git a/src/uan/model/uan-mac-rc.cc b/src/uan/model/uan-mac-rc.cc index af1e0a8e8..4ef45b9eb 100644 --- a/src/uan/model/uan-mac-rc.cc +++ b/src/uan/model/uan-mac-rc.cc @@ -617,7 +617,7 @@ UanMacRc::Associate() m_resList.push_back(res); Ptr phyDual = m_phy->GetObject(); bool phy1ok = IsPhy1Ok(); - if (phy1ok && !phyDual->IsPhy2Tx() & !m_rtsBlocked) + if (phy1ok && !phyDual->IsPhy2Tx() && !m_rtsBlocked) { Ptr pkt = Create(0); pkt->AddHeader(CreateRtsHeader(res)); diff --git a/src/wifi/examples/wifi-manager-example.cc b/src/wifi/examples/wifi-manager-example.cc index 94ab19da0..04d880087 100644 --- a/src/wifi/examples/wifi-manager-example.cc +++ b/src/wifi/examples/wifi-manager-example.cc @@ -211,7 +211,7 @@ main(int argc, char* argv[]) double stepSize = 1; // dBm double stepTime = 1; // seconds uint32_t packetSize = 1024; // bytes - bool broadcast = 0; + bool broadcast = false; int ap1_x = 0; int ap1_y = 0; int sta1_x = 5; diff --git a/src/wifi/model/ampdu-subframe-header.cc b/src/wifi/model/ampdu-subframe-header.cc index 2a843599e..e9e91efe3 100644 --- a/src/wifi/model/ampdu-subframe-header.cc +++ b/src/wifi/model/ampdu-subframe-header.cc @@ -44,7 +44,7 @@ AmpduSubframeHeader::GetInstanceTypeId() const AmpduSubframeHeader::AmpduSubframeHeader() : m_length(0), - m_eof(0), + m_eof(false), m_signature(0x4E) // Per 802.11 standard, the unique pattern is set to the value 0x4E. { } diff --git a/src/wifi/model/ht/ht-phy.cc b/src/wifi/model/ht/ht-phy.cc index 8086debec..7624aa9dd 100644 --- a/src/wifi/model/ht/ht-phy.cc +++ b/src/wifi/model/ht/ht-phy.cc @@ -300,7 +300,7 @@ HtPhy::GetPayloadDuration(uint32_t size, case FIRST_MPDU_IN_AGGREGATE: { // First packet in an A-MPDU numSymbols = (stbc * (service + size * 8.0 + 6 * nes) / (stbc * numDataBitsPerSymbol)); - if (incFlag == 1) + if (incFlag) { totalAmpduSize += size; totalAmpduNumSymbols += numSymbols; @@ -310,7 +310,7 @@ HtPhy::GetPayloadDuration(uint32_t size, case MIDDLE_MPDU_IN_AGGREGATE: { // consecutive packets in an A-MPDU numSymbols = (stbc * size * 8.0) / (stbc * numDataBitsPerSymbol); - if (incFlag == 1) + if (incFlag) { totalAmpduSize += size; totalAmpduNumSymbols += numSymbols; @@ -324,7 +324,7 @@ HtPhy::GetPayloadDuration(uint32_t size, stbc * ceil((service + totalSize * 8.0 + 6 * nes) / (stbc * numDataBitsPerSymbol))); NS_ASSERT(totalAmpduNumSymbols <= numSymbols); numSymbols -= totalAmpduNumSymbols; - if (incFlag == 1) + if (incFlag) { totalAmpduSize = 0; totalAmpduNumSymbols = 0; diff --git a/src/wifi/model/mpdu-aggregator.cc b/src/wifi/model/mpdu-aggregator.cc index 7b5d5cf16..cd23c1fbf 100644 --- a/src/wifi/model/mpdu-aggregator.cc +++ b/src/wifi/model/mpdu-aggregator.cc @@ -195,7 +195,7 @@ MpduAggregator::GetAmpduSubframeHeader(uint16_t mpduSize, bool isSingle) hdr.SetLength(mpduSize); if (isSingle) { - hdr.SetEof(1); + hdr.SetEof(true); } return hdr; } diff --git a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc index ec6ed6d98..851765124 100644 --- a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc +++ b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc @@ -437,7 +437,7 @@ MinstrelHtWifiManager::CalculateMpduTxDuration(Ptr phy, txvector.SetGuardInterval(gi); txvector.SetChannelWidth(chWidth); txvector.SetNess(0); - txvector.SetStbc(0); + txvector.SetStbc(false); txvector.SetMode(mode); txvector.SetPreambleType(WIFI_PREAMBLE_HT_MF); return WifiPhy::CalculatePhyPreambleAndHeaderDuration(txvector) + diff --git a/src/wifi/model/rate-control/onoe-wifi-manager.cc b/src/wifi/model/rate-control/onoe-wifi-manager.cc index fe37cc0ef..11bfbff5e 100644 --- a/src/wifi/model/rate-control/onoe-wifi-manager.cc +++ b/src/wifi/model/rate-control/onoe-wifi-manager.cc @@ -222,9 +222,8 @@ OnoeWifiManager::UpdateMode(OnoeWifiRemoteStation* station) */ int dir = 0; - int enough; uint8_t nrate; - enough = (station->m_tx_ok + station->m_tx_err >= 10); + bool enough = (station->m_tx_ok + station->m_tx_err >= 10); /* no packet reached -> down */ if (station->m_tx_err > 0 && station->m_tx_ok == 0) diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index 7d15aface..5e1eef9d5 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -645,7 +645,7 @@ WifiRemoteStationManager::GetDataTxVector(const WifiMacHeader& header, uint16_t { txVector = DoGetDataTxVector(Lookup(address), allowedWidth); txVector.SetLdpc(txVector.GetMode().GetModulationClass() < WIFI_MOD_CLASS_HT - ? 0 + ? false : UseLdpcForDestination(address)); } Ptr heConfiguration = m_wifiPhy->GetDevice()->GetHeConfiguration(); @@ -1550,7 +1550,7 @@ WifiRemoteStationManager::AddStationHeCapabilities(Mac48Address from, HeCapabili state->m_channelWidth = 20; } } - if (heCapabilities.GetHeSuPpdu1xHeLtf800nsGi() == 1) + if (heCapabilities.GetHeSuPpdu1xHeLtf800nsGi()) { state->m_guardInterval = 800; } diff --git a/src/wifi/test/tx-duration-test.cc b/src/wifi/test/tx-duration-test.cc index 27fa63ee7..755f098f0 100644 --- a/src/wifi/test/tx-duration-test.cc +++ b/src/wifi/test/tx-duration-test.cc @@ -154,7 +154,7 @@ TxDurationTest::CheckPayloadDuration(uint32_t size, txVector.SetChannelWidth(channelWidth); txVector.SetGuardInterval(guardInterval); txVector.SetNss(1); - txVector.SetStbc(0); + txVector.SetStbc(false); txVector.SetNess(0); std::list testedBands; Ptr phy = CreateObject(); @@ -206,7 +206,7 @@ TxDurationTest::CheckTxDuration(uint32_t size, txVector.SetChannelWidth(channelWidth); txVector.SetGuardInterval(guardInterval); txVector.SetNss(1); - txVector.SetStbc(0); + txVector.SetStbc(false); txVector.SetNess(0); std::list testedBands; Ptr phy = CreateObject(); @@ -274,7 +274,7 @@ TxDurationTest::CheckMuTxDuration(std::list sizes, txVector.SetPreambleType(preamble); txVector.SetChannelWidth(channelWidth); txVector.SetGuardInterval(guardInterval); - txVector.SetStbc(0); + txVector.SetStbc(false); txVector.SetNess(0); if (IsEht(preamble)) { @@ -1378,7 +1378,7 @@ HeSigBDurationTest::BuildTxVector() const txVector.SetPreambleType(WIFI_PREAMBLE_HE_MU); txVector.SetChannelWidth(m_channelWidth); txVector.SetGuardInterval(3200); - txVector.SetStbc(0); + txVector.SetStbc(false); txVector.SetNess(0); std::list staIds; uint16_t staId = 1; diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index 7eab359ac..763c314ca 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -4888,7 +4888,7 @@ TestPhyPaddingExclusion::SendHeTbPpdu(uint16_t txStaId, DEFAULT_CHANNEL_WIDTH, false, false, - 1); + true); HeRu::RuSpec ru(HeRu::RU_106_TONE, index, false); txVector.SetRu(ru, txStaId); @@ -5184,7 +5184,7 @@ TestPhyPaddingExclusion::SetTrigVector(Time ppduDuration) DEFAULT_CHANNEL_WIDTH, false, false, - 1); + true); trigVector.SetRu(HeRu::RuSpec(HeRu::RU_106_TONE, 1, false), 1); trigVector.SetMode(HePhy::GetHeMcs7(), 1); trigVector.SetNss(1, 1); diff --git a/src/wifi/test/wifi-transmit-mask-test.cc b/src/wifi/test/wifi-transmit-mask-test.cc index 1b8ff5ae6..261d02340 100644 --- a/src/wifi/test/wifi-transmit-mask-test.cc +++ b/src/wifi/test/wifi-transmit-mask-test.cc @@ -994,7 +994,7 @@ WifiTransmitMaskTestSuite::WifiTransmitMaskTestSuite() maskSlopes, tol, prec, - {1, 0, 0, 0}), + {true, false, false, false}), TestCase::QUICK); // ============================================================================================ @@ -1038,7 +1038,7 @@ WifiTransmitMaskTestSuite::WifiTransmitMaskTestSuite() maskSlopes, tol, prec, - {0, 1, 0, 0}), + {false, true, false, false}), TestCase::QUICK); // ============================================================================================ @@ -1082,7 +1082,7 @@ WifiTransmitMaskTestSuite::WifiTransmitMaskTestSuite() maskSlopes, tol, prec, - {0, 0, 1, 0}), + {false, false, true, false}), TestCase::QUICK); // ============================================================================================ @@ -1122,7 +1122,7 @@ WifiTransmitMaskTestSuite::WifiTransmitMaskTestSuite() maskSlopes, tol, prec, - {0, 0, 0, 1}), + {false, false, false, true}), TestCase::QUICK); // ============================================================================================ @@ -1162,15 +1162,16 @@ WifiTransmitMaskTestSuite::WifiTransmitMaskTestSuite() std::make_pair(6144, -40.0), // Outer band right (stop) }; - AddTestCase(new WifiOfdmMaskSlopesTestCase("11ax_5GHz 160MHz first subchannels punctured", - WIFI_STANDARD_80211ax, - WIFI_PHY_BAND_5GHZ, - 160, - maskSlopes, - tol, - prec, - {1, 1, 0, 0, 0, 0, 0, 0}), - TestCase::QUICK); + AddTestCase( + new WifiOfdmMaskSlopesTestCase("11ax_5GHz 160MHz first subchannels punctured", + WIFI_STANDARD_80211ax, + WIFI_PHY_BAND_5GHZ, + 160, + maskSlopes, + tol, + prec, + {true, true, false, false, false, false, false, false}), + TestCase::QUICK); // ============================================================================================ // 11ax 160MHz @ 5GHz - third and fourth 20 MHz subchannels punctured @@ -1219,7 +1220,7 @@ WifiTransmitMaskTestSuite::WifiTransmitMaskTestSuite() maskSlopes, tol, prec, - {0, 0, 1, 1, 0, 0, 0, 0}), + {false, false, true, true, false, false, false, false}), TestCase::QUICK); // ============================================================================================ @@ -1269,7 +1270,7 @@ WifiTransmitMaskTestSuite::WifiTransmitMaskTestSuite() maskSlopes, tol, prec, - {0, 0, 0, 0, 1, 1, 0, 0}), + {false, false, false, false, true, true, false, false}), TestCase::QUICK); // ============================================================================================ @@ -1309,13 +1310,14 @@ WifiTransmitMaskTestSuite::WifiTransmitMaskTestSuite() std::make_pair(6144, -40.0), // Outer band right (stop) }; - AddTestCase(new WifiOfdmMaskSlopesTestCase("11ax_5GHz 160MHz last subchannels punctured", - WIFI_STANDARD_80211ax, - WIFI_PHY_BAND_5GHZ, - 160, - maskSlopes, - tol, - prec, - {0, 0, 0, 0, 0, 0, 1, 1}), - TestCase::QUICK); + AddTestCase( + new WifiOfdmMaskSlopesTestCase("11ax_5GHz 160MHz last subchannels punctured", + WIFI_STANDARD_80211ax, + WIFI_PHY_BAND_5GHZ, + 160, + maskSlopes, + tol, + prec, + {false, false, false, false, false, false, true, true}), + TestCase::QUICK); } diff --git a/src/wimax/helper/wimax-helper.cc b/src/wimax/helper/wimax-helper.cc index ff07abc3d..0f5408b1c 100644 --- a/src/wimax/helper/wimax-helper.cc +++ b/src/wimax/helper/wimax-helper.cc @@ -313,7 +313,7 @@ WimaxHelper::Install(NodeContainer c, { Ptr node = *i; - Ptr phy = CreatePhyWithoutChannel(phyType, (char*)"dummy", 0); + Ptr phy = CreatePhyWithoutChannel(phyType, (char*)"dummy", false); Ptr device; Ptr uplinkScheduler = CreateUplinkScheduler(schedulerType); Ptr bsScheduler = CreateBSScheduler(schedulerType); @@ -349,7 +349,7 @@ WimaxHelper::Install(Ptr node, SchedulerType schedulerType) { // Ptr phy = CreatePhyWithoutChannel (phyType); - Ptr phy = CreatePhyWithoutChannel(phyType, (char*)"dummy", 0); + Ptr phy = CreatePhyWithoutChannel(phyType, (char*)"dummy", false); Ptr device; Ptr uplinkScheduler = CreateUplinkScheduler(schedulerType); Ptr bsScheduler = CreateBSScheduler(schedulerType); diff --git a/src/wimax/model/service-flow.cc b/src/wimax/model/service-flow.cc index 33b7eb2f1..3af5f980e 100644 --- a/src/wimax/model/service-flow.cc +++ b/src/wimax/model/service-flow.cc @@ -73,7 +73,7 @@ ServiceFlow::ServiceFlow(Tlv tlv) { InitValues(); m_connection = nullptr; - m_isEnabled = 0; + m_isEnabled = false; m_record = new ServiceFlowRecord(); NS_ASSERT_MSG(tlv.GetType() == Tlv::UPLINK_SERVICE_FLOW || tlv.GetType() == Tlv::DOWNLINK_SERVICE_FLOW, diff --git a/src/wimax/model/simple-ofdm-send-param.cc b/src/wimax/model/simple-ofdm-send-param.cc index d712188da..7ebc662e3 100644 --- a/src/wimax/model/simple-ofdm-send-param.cc +++ b/src/wimax/model/simple-ofdm-send-param.cc @@ -29,7 +29,7 @@ SimpleOfdmSendParam::SimpleOfdmSendParam() { // m_fecBlock = 0; m_burstSize = 0; - m_isFirstBlock = 0; + m_isFirstBlock = false; m_frequency = 0; m_modulationType = WimaxPhy::MODULATION_TYPE_QPSK_12; m_direction = 0; diff --git a/src/wimax/model/simple-ofdm-wimax-phy.cc b/src/wimax/model/simple-ofdm-wimax-phy.cc index 282de8946..903257200 100644 --- a/src/wimax/model/simple-ofdm-wimax-phy.cc +++ b/src/wimax/model/simple-ofdm-wimax-phy.cc @@ -309,7 +309,7 @@ SimpleOfdmWimaxPhy::StartSendDummyFecBlock(bool isFirstBlock, uint8_t direction) { SetState(PHY_STATE_TX); - bool isLastFecBlock = 0; + bool isLastFecBlock = false; if (isFirstBlock) { m_blockTime = GetBlockTransmissionTime(modulationType); @@ -496,7 +496,7 @@ SimpleOfdmWimaxPhy::EndReceive(Ptr burst) Bvec SimpleOfdmWimaxPhy::ConvertBurstToBits(Ptr burst) { - Bvec buffer(burst->GetSize() * 8, 0); + Bvec buffer(burst->GetSize() * 8, false); std::list> packets = burst->GetPackets(); @@ -508,8 +508,8 @@ SimpleOfdmWimaxPhy::ConvertBurstToBits(Ptr burst) std::memset(pstart, 0, packet->GetSize()); packet->CopyData(pstart, packet->GetSize()); Bvec temp(8); - temp.resize(0, 0); - temp.resize(8, 0); + temp.resize(0, false); + temp.resize(8, false); for (uint32_t i = 0; i < packet->GetSize(); i++) { for (uint8_t l = 0; l < 8; l++) @@ -593,7 +593,7 @@ SimpleOfdmWimaxPhy::CreateFecBlocks(const Bvec& buffer, WimaxPhy::ModulationType if (j == 1 && m_paddingBits > 0) // last block can be smaller than block size { fecBlock = Bvec(buffer.begin() + i, buffer.end()); - fecBlock.resize(m_blockSize, 0); + fecBlock.resize(m_blockSize, false); } else { diff --git a/src/wimax/model/ss-record.cc b/src/wimax/model/ss-record.cc index 7835a16cb..3577d22ec 100644 --- a/src/wimax/model/ss-record.cc +++ b/src/wimax/model/ss-record.cc @@ -64,7 +64,7 @@ SSRecord::Initialize() m_serviceFlows = new std::vector(); m_dsaRsp = DsaRsp(); - m_broadcast = 0; + m_broadcast = false; } SSRecord::~SSRecord() diff --git a/src/wimax/model/wimax-phy.cc b/src/wimax/model/wimax-phy.cc index a63a88fd6..7394d4ad4 100644 --- a/src/wimax/model/wimax-phy.cc +++ b/src/wimax/model/wimax-phy.cc @@ -90,7 +90,7 @@ WimaxPhy::WimaxPhy() m_psPerFrame(0), m_symbolsPerFrame(0) { - m_duplex = 0; + m_duplex = false; m_txFrequency = 0; m_rxFrequency = 0; }