diff --git a/examples/matrix-topology/matrix-topology.cc b/examples/matrix-topology/matrix-topology.cc index cb79d138d..10c2ac097 100644 --- a/examples/matrix-topology/matrix-topology.cc +++ b/examples/matrix-topology/matrix-topology.cc @@ -88,7 +88,7 @@ int main (int argc, char *argv[]) // DropTailQueue::MaxPackets affects the # of dropped packets, default value:100 // Config::SetDefault ("ns3::DropTailQueue::MaxPackets", UintegerValue (1000)); - srand ( (unsigned)time ( NULL ) ); // generate different seed each time + srand ( (unsigned)time ( nullptr ) ); // generate different seed each time std::string tr_name ("n-node-ppp.tr"); std::string pcap_name ("n-node-ppp"); diff --git a/examples/routing/simple-routing-ping6.cc b/examples/routing/simple-routing-ping6.cc index df73338d3..e70cfb4c8 100644 --- a/examples/routing/simple-routing-ping6.cc +++ b/examples/routing/simple-routing-ping6.cc @@ -67,7 +67,7 @@ public: */ inline void PrintRoutingTable (Ptr& n) { - Ptr routing = 0; + Ptr routing = nullptr; Ipv6StaticRoutingHelper routingHelper; Ptr ipv6 = n->GetObject (); uint32_t nbRoutes = 0; diff --git a/examples/socket/socket-bound-static-routing.cc b/examples/socket/socket-bound-static-routing.cc index 55e00585a..971fefa67 100644 --- a/examples/socket/socket-bound-static-routing.cc +++ b/examples/socket/socket-bound-static-routing.cc @@ -161,7 +161,7 @@ main (int argc, char *argv[]) Simulator::Schedule (Seconds (2.0),&BindSock, srcSocket, SrcToRtr2); Simulator::Schedule (Seconds (2.1),&SendStuff, srcSocket, dstaddr, dstport); // Fourth again as normal (goes via Rtr1) - Simulator::Schedule (Seconds (3.0),&BindSock, srcSocket, Ptr(0)); + Simulator::Schedule (Seconds (3.0),&BindSock, srcSocket, Ptr(nullptr)); Simulator::Schedule (Seconds (3.1),&SendStuff, srcSocket, dstaddr, dstport); // If you uncomment what's below, it results in ASSERT failing since you can't // bind to a socket not existing on a node diff --git a/examples/socket/socket-bound-tcp-static-routing.cc b/examples/socket/socket-bound-tcp-static-routing.cc index 9a52189f4..5ce7b081f 100644 --- a/examples/socket/socket-bound-tcp-static-routing.cc +++ b/examples/socket/socket-bound-tcp-static-routing.cc @@ -178,7 +178,7 @@ main (int argc, char *argv[]) Simulator::Schedule (Seconds (2.0),&BindSock, srcSocket3, SrcToRtr2); Simulator::Schedule (Seconds (2.1),&StartFlow, srcSocket3, dstaddr, dstport); // Fourth again as normal (goes via Rtr1) - Simulator::Schedule (Seconds (3.0),&BindSock, srcSocket4, Ptr(0)); + Simulator::Schedule (Seconds (3.0),&BindSock, srcSocket4, Ptr(nullptr)); Simulator::Schedule (Seconds (3.1),&StartFlow, srcSocket4, dstaddr, dstport); // If you uncomment what's below, it results in ASSERT failing since you can't // bind to a socket not existing on a node diff --git a/examples/stats/wifi-example-apps.cc b/examples/stats/wifi-example-apps.cc index cb2d0a33a..c4ba9dd2b 100644 --- a/examples/stats/wifi-example-apps.cc +++ b/examples/stats/wifi-example-apps.cc @@ -77,7 +77,7 @@ Sender::Sender() { NS_LOG_FUNCTION_NOARGS (); m_interval = CreateObject (); - m_socket = 0; + m_socket = nullptr; } Sender::~Sender() @@ -90,7 +90,7 @@ Sender::DoDispose () { NS_LOG_FUNCTION_NOARGS (); - m_socket = 0; + m_socket = nullptr; // chain up Application::DoDispose (); } @@ -169,11 +169,11 @@ Receiver::GetTypeId () } Receiver::Receiver() : - m_calc (0), - m_delay (0) + m_calc (nullptr), + m_delay (nullptr) { NS_LOG_FUNCTION_NOARGS (); - m_socket = 0; + m_socket = nullptr; } Receiver::~Receiver() @@ -186,7 +186,7 @@ Receiver::DoDispose () { NS_LOG_FUNCTION_NOARGS (); - m_socket = 0; + m_socket = nullptr; // chain up Application::DoDispose (); } diff --git a/examples/stats/wifi-example-sim.cc b/examples/stats/wifi-example-sim.cc index 482a1a471..400ad97f2 100644 --- a/examples/stats/wifi-example-sim.cc +++ b/examples/stats/wifi-example-sim.cc @@ -75,7 +75,7 @@ int main (int argc, char *argv[]) { { std::stringstream sstr; - sstr << "run-" << time (NULL); + sstr << "run-" << time (nullptr); runID = sstr.str (); } @@ -299,7 +299,7 @@ int main (int argc, char *argv[]) { //-------------------------------------------- // Pick an output writer based in the requested format. - Ptr output = 0; + Ptr output = nullptr; if (format == "omnet") { NS_LOG_INFO ("Creating omnet formatted data output."); output = CreateObject(); diff --git a/examples/tutorial/tutorial-app.cc b/examples/tutorial/tutorial-app.cc index 89bfcfcbc..c7e86544e 100644 --- a/examples/tutorial/tutorial-app.cc +++ b/examples/tutorial/tutorial-app.cc @@ -20,7 +20,7 @@ using namespace ns3; TutorialApp::TutorialApp () - : m_socket (0), + : m_socket (nullptr), m_peer (), m_packetSize (0), m_nPackets (0), @@ -33,7 +33,7 @@ TutorialApp::TutorialApp () TutorialApp::~TutorialApp () { - m_socket = 0; + m_socket = nullptr; } /* static */ diff --git a/src/aodv/model/aodv-neighbor.cc b/src/aodv/model/aodv-neighbor.cc index 76abf5ce2..c7c7348e8 100644 --- a/src/aodv/model/aodv-neighbor.cc +++ b/src/aodv/model/aodv-neighbor.cc @@ -166,7 +166,7 @@ Neighbors::LookupMacAddress (Ipv4Address addr) i != m_arp.end (); ++i) { ArpCache::Entry * entry = (*i)->Lookup (addr); - if (entry != 0 && (entry->IsAlive () || entry->IsPermanent ()) && !entry->IsExpired ()) + if (entry != nullptr && (entry->IsAlive () || entry->IsPermanent ()) && !entry->IsExpired ()) { hwaddr = Mac48Address::ConvertFrom (entry->GetMacAddress ()); break; diff --git a/src/aodv/model/aodv-routing-protocol.cc b/src/aodv/model/aodv-routing-protocol.cc index 0583da209..e140bbb5c 100644 --- a/src/aodv/model/aodv-routing-protocol.cc +++ b/src/aodv/model/aodv-routing-protocol.cc @@ -320,7 +320,7 @@ RoutingProtocol::~RoutingProtocol () void RoutingProtocol::DoDispose () { - m_ipv4 = 0; + m_ipv4 = nullptr; for (std::map, Ipv4InterfaceAddress>::iterator iter = m_socketAddresses.begin (); iter != m_socketAddresses.end (); iter++) { @@ -1040,7 +1040,7 @@ RoutingProtocol::SendRequest (Ipv4Address dst) else { rreqHeader.SetUnknownSeqno (true); - Ptr dev = 0; + Ptr dev = nullptr; RoutingTableEntry newEntry (/*dev=*/ dev, /*dst=*/ dst, /*vSeqNo=*/ false, diff --git a/src/aodv/model/aodv-rqueue.h b/src/aodv/model/aodv-rqueue.h index 9160210d3..f954f71de 100644 --- a/src/aodv/model/aodv-rqueue.h +++ b/src/aodv/model/aodv-rqueue.h @@ -56,7 +56,7 @@ public: * \param ecb the ErrorCallback function * \param exp the expiration time */ - QueueEntry (Ptr pa = 0, Ipv4Header const & h = Ipv4Header (), + QueueEntry (Ptr pa = nullptr, Ipv4Header const & h = Ipv4Header (), UnicastForwardCallback ucb = UnicastForwardCallback (), ErrorCallback ecb = ErrorCallback (), Time exp = Simulator::Now ()) : m_packet (pa), diff --git a/src/aodv/model/aodv-rtable.h b/src/aodv/model/aodv-rtable.h index f72884d31..6cd4734c5 100644 --- a/src/aodv/model/aodv-rtable.h +++ b/src/aodv/model/aodv-rtable.h @@ -71,7 +71,7 @@ public: * \param nextHop the IP address of the next hop * \param lifetime the lifetime of the entry */ - RoutingTableEntry (Ptr dev = 0,Ipv4Address dst = Ipv4Address (), bool vSeqNo = false, uint32_t seqNo = 0, + RoutingTableEntry (Ptr dev = nullptr,Ipv4Address dst = Ipv4Address (), bool vSeqNo = false, uint32_t seqNo = 0, Ipv4InterfaceAddress iface = Ipv4InterfaceAddress (), uint16_t hops = 0, Ipv4Address nextHop = Ipv4Address (), Time lifetime = Simulator::Now ()); diff --git a/src/aodv/test/aodv-regression.cc b/src/aodv/test/aodv-regression.cc index dc44e21f6..5e1e4d4ff 100644 --- a/src/aodv/test/aodv-regression.cc +++ b/src/aodv/test/aodv-regression.cc @@ -72,7 +72,7 @@ public: */ ChainRegressionTest::ChainRegressionTest (const char * const prefix, Time t, uint32_t size, Time arpAliveTimeout) : TestCase ("AODV chain regression test"), - m_nodes (0), + m_nodes (nullptr), m_prefix (prefix), m_time (t), m_size (size), @@ -137,7 +137,7 @@ ChainRegressionTest::DoRun () CheckResults (); - delete m_nodes, m_nodes = 0; + delete m_nodes, m_nodes = nullptr; } void diff --git a/src/aodv/test/aodv-test-suite.cc b/src/aodv/test/aodv-test-suite.cc index aaca3b070..09906552a 100644 --- a/src/aodv/test/aodv-test-suite.cc +++ b/src/aodv/test/aodv-test-suite.cc @@ -36,7 +36,7 @@ namespace aodv { struct NeighborTest : public TestCase { NeighborTest () : TestCase ("Neighbor"), - neighbor (0) + neighbor (nullptr) { } void DoRun () override; diff --git a/src/aodv/test/bug-772.cc b/src/aodv/test/bug-772.cc index 7ca390c96..f3b8d4eb7 100644 --- a/src/aodv/test/bug-772.cc +++ b/src/aodv/test/bug-772.cc @@ -48,7 +48,7 @@ using namespace ns3; //----------------------------------------------------------------------------- Bug772ChainTest::Bug772ChainTest (const char * const prefix, const char * const proto, Time t, uint32_t size) : TestCase ("Bug 772 UDP and TCP chain regression test"), - m_nodes (0), + m_nodes (nullptr), m_prefix (prefix), m_proto (proto), m_time (t), @@ -99,7 +99,7 @@ Bug772ChainTest::DoRun () CheckResults (); - delete m_nodes, m_nodes = 0; + delete m_nodes, m_nodes = nullptr; } void diff --git a/src/applications/model/application-packet-probe.cc b/src/applications/model/application-packet-probe.cc index 2475b89cf..4f50bc674 100644 --- a/src/applications/model/application-packet-probe.cc +++ b/src/applications/model/application-packet-probe.cc @@ -57,7 +57,7 @@ ApplicationPacketProbe::GetTypeId () ApplicationPacketProbe::ApplicationPacketProbe () { NS_LOG_FUNCTION (this); - m_packet = 0; + m_packet = nullptr; } ApplicationPacketProbe::~ApplicationPacketProbe () diff --git a/src/applications/model/bulk-send-application.cc b/src/applications/model/bulk-send-application.cc index 685db05e0..6505aed96 100644 --- a/src/applications/model/bulk-send-application.cc +++ b/src/applications/model/bulk-send-application.cc @@ -87,10 +87,10 @@ BulkSendApplication::GetTypeId () BulkSendApplication::BulkSendApplication () - : m_socket (0), + : m_socket (nullptr), m_connected (false), m_totBytes (0), - m_unsentPacket (0) + m_unsentPacket (nullptr) { NS_LOG_FUNCTION (this); } @@ -119,8 +119,8 @@ BulkSendApplication::DoDispose () { NS_LOG_FUNCTION (this); - m_socket = 0; - m_unsentPacket = 0; + m_socket = nullptr; + m_unsentPacket = nullptr; // chain up Application::DoDispose (); } @@ -249,7 +249,7 @@ void BulkSendApplication::SendData (const Address &from, const Address &to) { m_totBytes += actual; m_txTrace (packet); - m_unsentPacket = 0; + m_unsentPacket = nullptr; } else if (actual == -1) { diff --git a/src/applications/model/onoff-application.cc b/src/applications/model/onoff-application.cc index 668882c65..006706f5b 100644 --- a/src/applications/model/onoff-application.cc +++ b/src/applications/model/onoff-application.cc @@ -114,12 +114,12 @@ OnOffApplication::GetTypeId () OnOffApplication::OnOffApplication () - : m_socket (0), + : m_socket (nullptr), m_connected (false), m_residualBits (0), m_lastStartTime (Seconds (0)), m_totBytes (0), - m_unsentPacket (0) + m_unsentPacket (nullptr) { NS_LOG_FUNCTION (this); } @@ -158,8 +158,8 @@ OnOffApplication::DoDispose () NS_LOG_FUNCTION (this); CancelEvents (); - m_socket = 0; - m_unsentPacket = 0; + m_socket = nullptr; + m_unsentPacket = nullptr; // chain up Application::DoDispose (); } @@ -258,7 +258,7 @@ void OnOffApplication::CancelEvents () { NS_LOG_DEBUG ("Discarding cached packet upon CancelEvents ()"); } - m_unsentPacket = 0; + m_unsentPacket = nullptr; } // Event handlers @@ -354,7 +354,7 @@ void OnOffApplication::SendPacket () { m_txTrace (packet); m_totBytes += m_pktSize; - m_unsentPacket = 0; + m_unsentPacket = nullptr; Address localAddress; m_socket->GetSockName (localAddress); if (InetSocketAddress::IsMatchingType (m_peer)) diff --git a/src/applications/model/packet-loss-counter.cc b/src/applications/model/packet-loss-counter.cc index 4b09a41ef..5a94d0028 100644 --- a/src/applications/model/packet-loss-counter.cc +++ b/src/applications/model/packet-loss-counter.cc @@ -32,7 +32,7 @@ PacketLossCounter::PacketLossCounter (uint8_t bitmapSize) : m_lost (0), m_bitMapSize (0), m_lastMaxSeqNum (0), - m_receiveBitMap (0) + m_receiveBitMap (nullptr) { NS_LOG_FUNCTION (this << bitmapSize); SetBitMapSize (bitmapSize); @@ -58,7 +58,7 @@ PacketLossCounter::SetBitMapSize (uint16_t winSize) NS_ASSERT_MSG (winSize%8==0,"The packet window size should be a multiple of 8"); m_bitMapSize = winSize/8; - if (m_receiveBitMap!=0) + if (m_receiveBitMap!=nullptr) { delete [] m_receiveBitMap; } diff --git a/src/applications/model/packet-sink.cc b/src/applications/model/packet-sink.cc index a46482d55..dd2a418a5 100644 --- a/src/applications/model/packet-sink.cc +++ b/src/applications/model/packet-sink.cc @@ -81,7 +81,7 @@ PacketSink::GetTypeId () PacketSink::PacketSink () { NS_LOG_FUNCTION (this); - m_socket = 0; + m_socket = nullptr; m_totalRx = 0; } @@ -113,7 +113,7 @@ PacketSink::GetAcceptedSockets () const void PacketSink::DoDispose () { NS_LOG_FUNCTION (this); - m_socket = 0; + m_socket = nullptr; m_socketList.clear (); // chain up diff --git a/src/applications/model/three-gpp-http-client.cc b/src/applications/model/three-gpp-http-client.cc index 54d83a8b4..97a491445 100644 --- a/src/applications/model/three-gpp-http-client.cc +++ b/src/applications/model/three-gpp-http-client.cc @@ -45,7 +45,7 @@ NS_OBJECT_ENSURE_REGISTERED (ThreeGppHttpClient); ThreeGppHttpClient::ThreeGppHttpClient () : m_state (NOT_STARTED), - m_socket (0), + m_socket (nullptr), m_objectBytesToBeReceived (0), m_objectClientTs (MilliSeconds (0)), m_objectServerTs (MilliSeconds (0)), @@ -714,7 +714,7 @@ ThreeGppHttpClient::Receive (Ptr packet) << " (" << m_objectBytesToBeReceived << " bytes)."); // Stop expecting any more packet of this object. m_objectBytesToBeReceived = 0; - m_constructedPacket = NULL; + m_constructedPacket = nullptr; } else { diff --git a/src/applications/model/three-gpp-http-server.cc b/src/applications/model/three-gpp-http-server.cc index 1a5263948..b4316cbb8 100644 --- a/src/applications/model/three-gpp-http-server.cc +++ b/src/applications/model/three-gpp-http-server.cc @@ -50,7 +50,7 @@ NS_OBJECT_ENSURE_REGISTERED (ThreeGppHttpServer); ThreeGppHttpServer::ThreeGppHttpServer () : m_state (NOT_STARTED), - m_initialSocket (0), + m_initialSocket (nullptr), m_txBuffer (Create ()), m_httpVariables (CreateObject ()) { diff --git a/src/applications/model/udp-client.cc b/src/applications/model/udp-client.cc index e972aa1bb..63c143d0b 100644 --- a/src/applications/model/udp-client.cc +++ b/src/applications/model/udp-client.cc @@ -78,7 +78,7 @@ UdpClient::UdpClient () NS_LOG_FUNCTION (this); m_sent = 0; m_totalTx = 0; - m_socket = 0; + m_socket = nullptr; m_sendEvent = EventId (); } diff --git a/src/applications/model/udp-echo-client.cc b/src/applications/model/udp-echo-client.cc index 52755a316..39eb9851f 100644 --- a/src/applications/model/udp-echo-client.cc +++ b/src/applications/model/udp-echo-client.cc @@ -87,19 +87,19 @@ UdpEchoClient::UdpEchoClient () { NS_LOG_FUNCTION (this); m_sent = 0; - m_socket = 0; + m_socket = nullptr; m_sendEvent = EventId (); - m_data = 0; + m_data = nullptr; m_dataSize = 0; } UdpEchoClient::~UdpEchoClient() { NS_LOG_FUNCTION (this); - m_socket = 0; + m_socket = nullptr; delete [] m_data; - m_data = 0; + m_data = nullptr; m_dataSize = 0; } @@ -186,7 +186,7 @@ UdpEchoClient::StopApplication () { m_socket->Close (); m_socket->SetRecvCallback (MakeNullCallback > ()); - m_socket = 0; + m_socket = nullptr; } Simulator::Cancel (m_sendEvent); @@ -203,7 +203,7 @@ UdpEchoClient::SetDataSize (uint32_t dataSize) // neither will we. // delete [] m_data; - m_data = 0; + m_data = nullptr; m_dataSize = 0; m_size = dataSize; } diff --git a/src/applications/model/udp-echo-server.cc b/src/applications/model/udp-echo-server.cc index 6c2439f10..4d00c15ee 100644 --- a/src/applications/model/udp-echo-server.cc +++ b/src/applications/model/udp-echo-server.cc @@ -67,8 +67,8 @@ UdpEchoServer::UdpEchoServer () UdpEchoServer::~UdpEchoServer() { NS_LOG_FUNCTION (this); - m_socket = 0; - m_socket6 = 0; + m_socket = nullptr; + m_socket6 = nullptr; } void diff --git a/src/applications/model/udp-trace-client.cc b/src/applications/model/udp-trace-client.cc index 25483e7dc..8aa94f3d7 100644 --- a/src/applications/model/udp-trace-client.cc +++ b/src/applications/model/udp-trace-client.cc @@ -99,7 +99,7 @@ UdpTraceClient::UdpTraceClient () { NS_LOG_FUNCTION (this); m_sent = 0; - m_socket = 0; + m_socket = nullptr; m_sendEvent = EventId (); m_maxPacketSize = 1400; } @@ -109,13 +109,13 @@ UdpTraceClient::UdpTraceClient (Ipv4Address ip, uint16_t port, { NS_LOG_FUNCTION (this); m_sent = 0; - m_socket = 0; + m_socket = nullptr; m_sendEvent = EventId (); m_peerAddress = ip; m_peerPort = port; m_currentEntry = 0; m_maxPacketSize = 1400; - if (traceFile != NULL) + if (traceFile != nullptr) { SetTraceFile (traceFile); } diff --git a/src/bridge/model/bridge-channel.cc b/src/bridge/model/bridge-channel.cc index 1d3a099aa..3135f61fb 100644 --- a/src/bridge/model/bridge-channel.cc +++ b/src/bridge/model/bridge-channel.cc @@ -55,7 +55,7 @@ BridgeChannel::~BridgeChannel () for (std::vector< Ptr >::iterator iter = m_bridgedChannels.begin (); iter != m_bridgedChannels.end (); iter++) { - *iter = 0; + *iter = nullptr; } m_bridgedChannels.clear (); } @@ -93,7 +93,7 @@ BridgeChannel::GetDevice (std::size_t i) const } ndevices += (*iter)->GetNDevices (); } - return NULL; + return nullptr; } diff --git a/src/bridge/model/bridge-net-device.cc b/src/bridge/model/bridge-net-device.cc index 72bf714a9..cdc965cbc 100644 --- a/src/bridge/model/bridge-net-device.cc +++ b/src/bridge/model/bridge-net-device.cc @@ -65,7 +65,7 @@ BridgeNetDevice::GetTypeId () BridgeNetDevice::BridgeNetDevice () - : m_node (0), + : m_node (nullptr), m_ifIndex (0) { NS_LOG_FUNCTION_NOARGS (); @@ -83,11 +83,11 @@ BridgeNetDevice::DoDispose () NS_LOG_FUNCTION_NOARGS (); for (std::vector< Ptr >::iterator iter = m_ports.begin (); iter != m_ports.end (); iter++) { - *iter = 0; + *iter = nullptr; } m_ports.clear (); - m_channel = 0; - m_node = 0; + m_channel = nullptr; + m_node = nullptr; NetDevice::DoDispose (); } @@ -228,7 +228,7 @@ Ptr BridgeNetDevice::GetLearnedState (Mac48Address source) } } } - return NULL; + return nullptr; } uint32_t diff --git a/src/buildings/model/building-list.cc b/src/buildings/model/building-list.cc index d7292c9a3..424b2c723 100644 --- a/src/buildings/model/building-list.cc +++ b/src/buildings/model/building-list.cc @@ -124,7 +124,7 @@ BuildingListPriv::Get () Ptr * BuildingListPriv::DoGet () { - static Ptr ptr = 0; + static Ptr ptr = nullptr; if (!ptr) { ptr = CreateObject (); @@ -138,7 +138,7 @@ BuildingListPriv::Delete () { NS_LOG_FUNCTION_NOARGS (); Config::UnregisterRootNamespaceObject (Get ()); - (*DoGet ()) = 0; + (*DoGet ()) = nullptr; } @@ -158,7 +158,7 @@ BuildingListPriv::DoDispose () { Ptr building = *i; building->Dispose (); - *i = 0; + *i = nullptr; } m_buildings.erase (m_buildings.begin (), m_buildings.end ()); Object::DoDispose (); diff --git a/src/buildings/test/buildings-pathloss-test.cc b/src/buildings/test/buildings-pathloss-test.cc index 44f2eaba3..c225f4fef 100644 --- a/src/buildings/test/buildings-pathloss-test.cc +++ b/src/buildings/test/buildings-pathloss-test.cc @@ -258,7 +258,7 @@ BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index) break; default: - mm = 0; + mm = nullptr; break; } Ptr buildingInfo = CreateObject (); diff --git a/src/buildings/test/buildings-shadowing-test.cc b/src/buildings/test/buildings-shadowing-test.cc index e52530c34..ba9a9c6ad 100644 --- a/src/buildings/test/buildings-shadowing-test.cc +++ b/src/buildings/test/buildings-shadowing-test.cc @@ -218,7 +218,7 @@ BuildingsShadowingTestCase::CreateMobilityModel (uint16_t index) break; default: - mm = 0; + mm = nullptr; break; } Ptr buildingInfo = CreateObject (); diff --git a/src/config-store/model/attribute-iterator.cc b/src/config-store/model/attribute-iterator.cc index adc9b2e26..e695abe72 100644 --- a/src/config-store/model/attribute-iterator.cc +++ b/src/config-store/model/attribute-iterator.cc @@ -204,7 +204,7 @@ AttributeIterator::DoIterate (Ptr object) { struct TypeId::AttributeInformation info = tid.GetAttribute(i); const PointerChecker *ptrChecker = dynamic_cast (PeekPointer (info.checker)); - if (ptrChecker != 0) + if (ptrChecker != nullptr) { NS_LOG_DEBUG ("pointer attribute " << info.name); PointerValue ptr; @@ -223,7 +223,7 @@ AttributeIterator::DoIterate (Ptr object) } // attempt to cast to an object container const ObjectPtrContainerChecker *vectorChecker = dynamic_cast (PeekPointer (info.checker)); - if (vectorChecker != 0) + if (vectorChecker != nullptr) { NS_LOG_DEBUG ("ObjectPtrContainer attribute " << info.name); ObjectPtrContainerValue vector; diff --git a/src/config-store/model/config-store.cc b/src/config-store/model/config-store.cc index f14c38e8d..3c74726da 100644 --- a/src/config-store/model/config-store.cc +++ b/src/config-store/model/config-store.cc @@ -146,7 +146,7 @@ ConfigStore::~ConfigStore () { NS_LOG_FUNCTION (this); delete m_file; - m_file = 0; + m_file = nullptr; } void diff --git a/src/config-store/model/raw-text-config.cc b/src/config-store/model/raw-text-config.cc index a5d15be42..9c2a9de61 100644 --- a/src/config-store/model/raw-text-config.cc +++ b/src/config-store/model/raw-text-config.cc @@ -36,19 +36,19 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("RawTextConfig"); RawTextConfigSave::RawTextConfigSave () - : m_os (0) + : m_os (nullptr) { NS_LOG_FUNCTION (this); } RawTextConfigSave::~RawTextConfigSave () { NS_LOG_FUNCTION (this); - if (m_os != 0) + if (m_os != nullptr) { m_os->close (); } delete m_os; - m_os = 0; + m_os = nullptr; } void RawTextConfigSave::SetFilename (std::string filename) @@ -183,18 +183,18 @@ private: } RawTextConfigLoad::RawTextConfigLoad () - : m_is (0) + : m_is (nullptr) { NS_LOG_FUNCTION (this); } RawTextConfigLoad::~RawTextConfigLoad () { NS_LOG_FUNCTION (this); - if (m_is != 0) + if (m_is != nullptr) { m_is->close (); delete m_is; - m_is = 0; + m_is = nullptr; } } void diff --git a/src/config-store/model/xml-config.cc b/src/config-store/model/xml-config.cc index c94401fd1..f9a56d5db 100644 --- a/src/config-store/model/xml-config.cc +++ b/src/config-store/model/xml-config.cc @@ -34,7 +34,7 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("XmlConfig"); XmlConfigSave::XmlConfigSave () - : m_writer (0) + : m_writer (nullptr) { NS_LOG_FUNCTION (this); } @@ -50,7 +50,7 @@ XmlConfigSave::SetFilename (std::string filename) /* Create a new XmlWriter for uri, with no compression. */ m_writer = xmlNewTextWriterFilename (filename.c_str (), 0); - if (m_writer == NULL) + if (m_writer == nullptr) { NS_FATAL_ERROR ("Error creating the XML writer"); } @@ -62,7 +62,7 @@ XmlConfigSave::SetFilename (std::string filename) /* Start the document with the XML default for the version, * encoding utf-8 and the default for the standalone * declaration. */ - rc = xmlTextWriterStartDocument (m_writer, NULL, "utf-8", NULL); + rc = xmlTextWriterStartDocument (m_writer, nullptr, "utf-8", nullptr); if (rc < 0) { NS_FATAL_ERROR ("Error at xmlTextWriterStartDocument"); @@ -79,7 +79,7 @@ XmlConfigSave::SetFilename (std::string filename) XmlConfigSave::~XmlConfigSave () { NS_LOG_FUNCTION (this); - if (m_writer == 0) + if (m_writer == nullptr) { return; } @@ -95,7 +95,7 @@ XmlConfigSave::~XmlConfigSave () } xmlFreeTextWriter (m_writer); - m_writer = 0; + m_writer = nullptr; } void XmlConfigSave::Default () @@ -303,7 +303,7 @@ void XmlConfigLoad::Default () { xmlTextReaderPtr reader = xmlNewTextReaderFilename (m_filename.c_str ()); - if (reader == NULL) + if (reader == nullptr) { NS_FATAL_ERROR ("Error at xmlReaderForFile"); } @@ -312,19 +312,19 @@ XmlConfigLoad::Default () while (rc > 0) { const xmlChar *type = xmlTextReaderConstName (reader); - if (type == 0) + if (type == nullptr) { NS_FATAL_ERROR ("Invalid value"); } if (std::string ((char*)type) == "default") { xmlChar *name = xmlTextReaderGetAttribute (reader, BAD_CAST "name"); - if (name == 0) + if (name == nullptr) { NS_FATAL_ERROR ("Error getting attribute 'name'"); } xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value"); - if (value == 0) + if (value == nullptr) { NS_FATAL_ERROR ("Error getting attribute 'value'"); } @@ -341,7 +341,7 @@ void XmlConfigLoad::Global () { xmlTextReaderPtr reader = xmlNewTextReaderFilename (m_filename.c_str ()); - if (reader == NULL) + if (reader == nullptr) { NS_FATAL_ERROR ("Error at xmlReaderForFile"); } @@ -350,19 +350,19 @@ XmlConfigLoad::Global () while (rc > 0) { const xmlChar *type = xmlTextReaderConstName (reader); - if (type == 0) + if (type == nullptr) { NS_FATAL_ERROR ("Invalid value"); } if (std::string ((char*)type) == "global") { xmlChar *name = xmlTextReaderGetAttribute (reader, BAD_CAST "name"); - if (name == 0) + if (name == nullptr) { NS_FATAL_ERROR ("Error getting attribute 'name'"); } xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value"); - if (value == 0) + if (value == nullptr) { NS_FATAL_ERROR ("Error getting attribute 'value'"); } @@ -379,7 +379,7 @@ void XmlConfigLoad::Attributes () { xmlTextReaderPtr reader = xmlNewTextReaderFilename (m_filename.c_str ()); - if (reader == NULL) + if (reader == nullptr) { NS_FATAL_ERROR ("Error at xmlReaderForFile"); } @@ -388,19 +388,19 @@ XmlConfigLoad::Attributes () while (rc > 0) { const xmlChar *type = xmlTextReaderConstName (reader); - if (type == 0) + if (type == nullptr) { NS_FATAL_ERROR ("Invalid value"); } if (std::string ((char*)type) == "value") { xmlChar *path = xmlTextReaderGetAttribute (reader, BAD_CAST "path"); - if (path == 0) + if (path == nullptr) { NS_FATAL_ERROR ("Error getting attribute 'path'"); } xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value"); - if (value == 0) + if (value == nullptr) { NS_FATAL_ERROR ("Error getting attribute 'value'"); } diff --git a/src/core/examples/main-ptr.cc b/src/core/examples/main-ptr.cc index 7cd41c36e..8d73a940d 100644 --- a/src/core/examples/main-ptr.cc +++ b/src/core/examples/main-ptr.cc @@ -62,7 +62,7 @@ PtrExample::Method () /** * Example Ptr global variable. */ -static Ptr g_ptr = 0; +static Ptr g_ptr = nullptr; /** * Example Ptr manipulations. @@ -86,7 +86,7 @@ StorePtr (Ptr p) static void ClearPtr () { - g_ptr = 0; + g_ptr = nullptr; } @@ -116,7 +116,7 @@ int main (int argc, char *argv[]) ClearPtr (); // get the raw pointer and release it. PtrExample *raw = GetPointer (prev); - prev = 0; + prev = nullptr; raw->Method (); raw->Unref (); } diff --git a/src/core/model/attribute-accessor-helper.h b/src/core/model/attribute-accessor-helper.h index ac344fe03..2848c0ad8 100644 --- a/src/core/model/attribute-accessor-helper.h +++ b/src/core/model/attribute-accessor-helper.h @@ -178,12 +178,12 @@ public: bool Set (ObjectBase * object, const AttributeValue & val) const override { const U *value = dynamic_cast (&val); - if (value == 0) + if (value == nullptr) { return false; } T *obj = dynamic_cast (object); - if (obj == 0) + if (obj == nullptr) { return false; } @@ -205,12 +205,12 @@ public: bool Get (const ObjectBase * object, AttributeValue &val) const override { U *value = dynamic_cast (&val); - if (value == 0) + if (value == nullptr) { return false; } const T *obj = dynamic_cast (object); - if (obj == 0) + if (obj == nullptr) { return false; } diff --git a/src/core/model/attribute-construction-list.cc b/src/core/model/attribute-construction-list.cc index 6d546d013..2c68b8ff6 100644 --- a/src/core/model/attribute-construction-list.cc +++ b/src/core/model/attribute-construction-list.cc @@ -70,7 +70,7 @@ AttributeConstructionList::Find (Ptr checker) const return k->value; } } - return 0; + return nullptr; } AttributeConstructionList::CIterator diff --git a/src/core/model/attribute-container.h b/src/core/model/attribute-container.h index 285753584..1aad1a3b6 100644 --- a/src/core/model/attribute-container.h +++ b/src/core/model/attribute-container.h @@ -303,7 +303,7 @@ private: template class C> AttributeContainerChecker::AttributeContainerChecker () - : m_itemchecker (0) + : m_itemchecker (nullptr) {} template class C> diff --git a/src/core/model/attribute-helper.h b/src/core/model/attribute-helper.h index 17899fadd..830709498 100644 --- a/src/core/model/attribute-helper.h +++ b/src/core/model/attribute-helper.h @@ -105,7 +105,7 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) { bool Check (const AttributeValue &value) const override { - return dynamic_cast (&value) != 0; + return dynamic_cast (&value) != nullptr; } std::string GetValueTypeName () const override { @@ -127,7 +127,7 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) { const T *src = dynamic_cast (&source); T *dst = dynamic_cast (&destination); - if (src == 0 || dst == 0) + if (src == nullptr || dst == nullptr) { return false; } diff --git a/src/core/model/attribute.cc b/src/core/model/attribute.cc index d22b5a5f5..3c9f78f93 100644 --- a/src/core/model/attribute.cc +++ b/src/core/model/attribute.cc @@ -60,21 +60,21 @@ AttributeChecker::CreateValidValue (const AttributeValue &value) const } // attempt to convert to string. const StringValue *str = dynamic_cast (&value); - if (str == 0) + if (str == nullptr) { - return 0; + return nullptr; } // attempt to convert back to value. Ptr v = Create (); bool ok = v->DeserializeFromString (str->Get (), this); if (!ok) { - return 0; + return nullptr; } ok = Check (*v); if (!ok) { - return 0; + return nullptr; } return v; } diff --git a/src/core/model/calendar-scheduler.cc b/src/core/model/calendar-scheduler.cc index 403bcb56a..374cf2fe0 100644 --- a/src/core/model/calendar-scheduler.cc +++ b/src/core/model/calendar-scheduler.cc @@ -68,7 +68,7 @@ CalendarScheduler::~CalendarScheduler () { NS_LOG_FUNCTION (this); delete [] m_buckets; - m_buckets = 0; + m_buckets = nullptr; } void CalendarScheduler::SetReverse (bool reverse) @@ -185,7 +185,7 @@ CalendarScheduler::PeekNext () const uint32_t i = m_lastBucket; uint64_t bucketTop = m_bucketTop; Scheduler::Event minEvent; - minEvent.impl = 0; + minEvent.impl = nullptr; minEvent.key.m_ts = UINT64_MAX; minEvent.key.m_uid = UINT32_MAX; minEvent.key.m_context = 0; diff --git a/src/core/model/callback.cc b/src/core/model/callback.cc index 00faa4d58..6ee6296a8 100644 --- a/src/core/model/callback.cc +++ b/src/core/model/callback.cc @@ -90,7 +90,7 @@ CallbackImplBase::Demangle (const std::string& mangled) int status; char* demangled = abi::__cxa_demangle (mangled.c_str (), - NULL, NULL, &status); + nullptr, nullptr, &status); std::string ret; if (status == 0) diff --git a/src/core/model/callback.h b/src/core/model/callback.h index 79f587364..ac5243b9d 100644 --- a/src/core/model/callback.h +++ b/src/core/model/callback.h @@ -278,7 +278,7 @@ public: CallbackImpl const *otherDerived = dynamic_cast const *> (PeekPointer (other)); - if (otherDerived == 0) + if (otherDerived == nullptr) { return false; } @@ -531,12 +531,12 @@ public: */ bool IsNull () const { - return (DoPeekImpl () == 0); + return (DoPeekImpl () == nullptr); } /** Discard the implementation, set it to null */ void Nullify () { - m_impl = 0; + m_impl = nullptr; } /** @@ -606,7 +606,7 @@ private: bool DoCheckType (Ptr other) const { if (other && - dynamic_cast *> (PeekPointer (other)) != 0) + dynamic_cast *> (PeekPointer (other)) != nullptr) { return true; } diff --git a/src/core/model/command-line.cc b/src/core/model/command-line.cc index f63e59e84..6b611f740 100644 --- a/src/core/model/command-line.cc +++ b/src/core/model/command-line.cc @@ -410,7 +410,7 @@ CommandLine::PrintDoxygenUsage () const NS_LOG_FUNCTION (this); const char * envVar = std::getenv ("NS_COMMANDLINE_INTROSPECTION"); - if (envVar == 0 || std::strlen (envVar) == 0) + if (envVar == nullptr || std::strlen (envVar) == 0) { return; } @@ -796,7 +796,7 @@ CommandLine::GetExtraNonOption (std::size_t i) const if (m_nonOptions.size () >= i + m_NNonOptions) { auto ip = dynamic_cast (m_nonOptions[i + m_NNonOptions]); - if (ip != NULL) + if (ip != nullptr) { value = ip->m_value; } diff --git a/src/core/model/config.cc b/src/core/model/config.cc index 21394d5a8..07e472f04 100644 --- a/src/core/model/config.cc +++ b/src/core/model/config.cc @@ -534,7 +534,7 @@ Resolver::DoResolve (std::string path, Ptr root) } // attempt to cast to a pointer checker. const PointerChecker *pChecker = dynamic_cast (PeekPointer (info.checker)); - if (pChecker != 0) + if (pChecker != nullptr) { NS_LOG_DEBUG ("GetAttribute(ptr)=" << info.name << " on path=" << GetResolvedPath ()); PointerValue pValue; @@ -555,7 +555,7 @@ Resolver::DoResolve (std::string path, Ptr root) // attempt to cast to an object vector. const ObjectPtrContainerChecker *vectorChecker = dynamic_cast (PeekPointer (info.checker)); - if (vectorChecker != 0) + if (vectorChecker != nullptr) { NS_LOG_DEBUG ("GetAttribute(vector)=" << info.name << " on path=" << GetResolvedPath () << pathLeft); foundMatch = true; @@ -776,7 +776,7 @@ public: // the root pointer zeroed indicates to the resolver that it should start // looking at the root of the "/Names" namespace during this go. // - resolver.Resolve (0); + resolver.Resolve (nullptr); return MatchContainer (resolver.m_objects, resolver.m_contexts, path); } diff --git a/src/core/model/default-simulator-impl.cc b/src/core/model/default-simulator-impl.cc index 283a5aa6f..d99b615ca 100644 --- a/src/core/model/default-simulator-impl.cc +++ b/src/core/model/default-simulator-impl.cc @@ -84,7 +84,7 @@ DefaultSimulatorImpl::DoDispose () Scheduler::Event next = m_events->RemoveNext (); next.impl->Unref (); } - m_events = 0; + m_events = nullptr; SimulatorImpl::DoDispose (); } void @@ -362,7 +362,7 @@ DefaultSimulatorImpl::IsExpired (const EventId &id) const { if (id.GetUid () == EventId::UID::DESTROY) { - if (id.PeekEventImpl () == 0 + if (id.PeekEventImpl () == nullptr || id.PeekEventImpl ()->IsCancelled ()) { return true; @@ -377,7 +377,7 @@ DefaultSimulatorImpl::IsExpired (const EventId &id) const } return true; } - if (id.PeekEventImpl () == 0 + if (id.PeekEventImpl () == nullptr || id.GetTs () < m_currentTs || (id.GetTs () == m_currentTs && id.GetUid () <= m_currentUid) || id.PeekEventImpl ()->IsCancelled ()) diff --git a/src/core/model/double.cc b/src/core/model/double.cc index f7264d94d..71fe4b060 100644 --- a/src/core/model/double.cc +++ b/src/core/model/double.cc @@ -61,7 +61,7 @@ Ptr MakeDoubleChecker (double min, double max, std::stri { NS_LOG_FUNCTION (&value); const DoubleValue *v = dynamic_cast (&value); - if (v == 0) + if (v == nullptr) { return false; } @@ -94,7 +94,7 @@ Ptr MakeDoubleChecker (double min, double max, std::stri NS_LOG_FUNCTION (&source << &destination); const DoubleValue *src = dynamic_cast (&source); DoubleValue *dst = dynamic_cast (&destination); - if (src == 0 || dst == 0) + if (src == nullptr || dst == nullptr) { return false; } diff --git a/src/core/model/enum.cc b/src/core/model/enum.cc index 5341f9e3c..c21e652a5 100644 --- a/src/core/model/enum.cc +++ b/src/core/model/enum.cc @@ -67,7 +67,7 @@ EnumValue::SerializeToString (Ptr checker) const { NS_LOG_FUNCTION (this << checker); const EnumChecker *p = dynamic_cast (PeekPointer (checker)); - NS_ASSERT (p != 0); + NS_ASSERT (p != nullptr); std::string name = p->GetName (m_value); return name; } @@ -76,7 +76,7 @@ EnumValue::DeserializeFromString (std::string value, Ptr { NS_LOG_FUNCTION (this << value << checker); const EnumChecker *p = dynamic_cast (PeekPointer (checker)); - NS_ASSERT (p != 0); + NS_ASSERT (p != nullptr); m_value = p->GetValue (value); return true; } @@ -131,7 +131,7 @@ EnumChecker::Check (const AttributeValue &value) const { NS_LOG_FUNCTION (this << &value); const EnumValue *p = dynamic_cast (&value); - if (p == 0) + if (p == nullptr) { return false; } @@ -178,7 +178,7 @@ EnumChecker::Copy (const AttributeValue &source, AttributeValue &destination) co NS_LOG_FUNCTION (this << &source << &destination); const EnumValue *src = dynamic_cast (&source); EnumValue *dst = dynamic_cast (&destination); - if (src == 0 || dst == 0) + if (src == nullptr || dst == nullptr) { return false; } diff --git a/src/core/model/event-id.cc b/src/core/model/event-id.cc index 23d701546..a5a432e77 100644 --- a/src/core/model/event-id.cc +++ b/src/core/model/event-id.cc @@ -33,7 +33,7 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("EventId"); EventId::EventId () - : m_eventImpl (0), + : m_eventImpl (nullptr), m_ts (0), m_context (0), m_uid (0) diff --git a/src/core/model/example-as-test.cc b/src/core/model/example-as-test.cc index ed992c5cc..349e1e62b 100644 --- a/src/core/model/example-as-test.cc +++ b/src/core/model/example-as-test.cc @@ -125,7 +125,7 @@ ExampleAsTestCase::DoRun () // Check that we're not just introspecting the command-line const char * envVar = std::getenv ("NS_COMMANDLINE_INTROSPECTION"); - if (envVar != 0 && std::strlen (envVar) != 0) + if (envVar != nullptr && std::strlen (envVar) != 0) { return; } diff --git a/src/core/model/fatal-impl.cc b/src/core/model/fatal-impl.cc index f84c31746..f7026f0c2 100644 --- a/src/core/model/fatal-impl.cc +++ b/src/core/model/fatal-impl.cc @@ -73,7 +73,7 @@ namespace { std::list ** PeekStreamList () { NS_LOG_FUNCTION_NOARGS (); - static std::list *streams = 0; + static std::list *streams = nullptr; return &streams; } @@ -87,7 +87,7 @@ std::list * GetStreamList () { NS_LOG_FUNCTION_NOARGS (); std::list **pstreams = PeekStreamList (); - if (*pstreams == 0) + if (*pstreams == nullptr) { *pstreams = new std::list (); } @@ -108,7 +108,7 @@ UnregisterStream (std::ostream* stream) { NS_LOG_FUNCTION (stream); std::list **pl = PeekStreamList (); - if (*pl == 0) + if (*pl == nullptr) { return; } @@ -116,7 +116,7 @@ UnregisterStream (std::ostream* stream) if ((*pl)->empty ()) { delete *pl; - *pl = 0; + *pl = nullptr; } } @@ -150,7 +150,7 @@ FlushStreams () { NS_LOG_FUNCTION_NOARGS (); std::list **pl = PeekStreamList (); - if (*pl == 0) + if (*pl == nullptr) { return; } @@ -162,7 +162,7 @@ FlushStreams () * duration of this function. */ struct sigaction hdl; hdl.sa_handler = sigHandler; - sigaction (SIGSEGV, &hdl, 0); + sigaction (SIGSEGV, &hdl, nullptr); std::list *l = *pl; @@ -176,10 +176,10 @@ FlushStreams () /* Restore default SIGSEGV handler (Not that it matters anyway) */ hdl.sa_handler = SIG_DFL; - sigaction (SIGSEGV, &hdl, 0); + sigaction (SIGSEGV, &hdl, nullptr); /* Flush all opened FILE* */ - std::fflush (0); + std::fflush (nullptr); /* Flush stdandard streams - shouldn't be required (except for clog) */ std::cout.flush (); @@ -187,7 +187,7 @@ FlushStreams () std::clog.flush (); delete l; - *pl = 0; + *pl = nullptr; } } // namespace FatalImpl diff --git a/src/core/model/global-value.cc b/src/core/model/global-value.cc index 40c1e9b8f..0b2e58251 100644 --- a/src/core/model/global-value.cc +++ b/src/core/model/global-value.cc @@ -45,8 +45,8 @@ GlobalValue::GlobalValue (std::string name, std::string help, Ptr checker) : m_name (name), m_help (help), - m_initialValue (0), - m_currentValue (0), + m_initialValue (nullptr), + m_currentValue (nullptr), m_checker (checker) { NS_LOG_FUNCTION (name << help << &initialValue << checker); @@ -70,7 +70,7 @@ GlobalValue::InitializeFromEnv () NS_LOG_FUNCTION (this); const char *envVar = getenv ("NS_GLOBAL_VALUE"); - if (envVar == 0 || std::strlen (envVar) == 0) + if (envVar == nullptr || std::strlen (envVar) == 0) { return; } @@ -123,7 +123,7 @@ GlobalValue::GetValue (AttributeValue &value) const return; } StringValue *str = dynamic_cast (&value); - if (str == 0) + if (str == nullptr) { NS_FATAL_ERROR ("GlobalValue name=" << m_name << ": input value is not a string"); } diff --git a/src/core/model/heap-scheduler.cc b/src/core/model/heap-scheduler.cc index bab7ca9f8..74ff0a213 100644 --- a/src/core/model/heap-scheduler.cc +++ b/src/core/model/heap-scheduler.cc @@ -54,7 +54,7 @@ HeapScheduler::HeapScheduler () // we purposely waste an item at the start of // the array to make sure the indexes in the // array start at one. - Scheduler::Event empty = { 0,{ 0,0}}; + Scheduler::Event empty = { nullptr,{ 0,0}}; m_heap.push_back (empty); } diff --git a/src/core/model/integer.cc b/src/core/model/integer.cc index bdbb4dcf8..88616c1b2 100644 --- a/src/core/model/integer.cc +++ b/src/core/model/integer.cc @@ -60,7 +60,7 @@ MakeIntegerChecker (int64_t min, int64_t max, std::string name) { NS_LOG_FUNCTION (&value); const IntegerValue *v = dynamic_cast (&value); - if (v == 0) + if (v == nullptr) { return false; } @@ -93,7 +93,7 @@ MakeIntegerChecker (int64_t min, int64_t max, std::string name) NS_LOG_FUNCTION (&src << &dst); const IntegerValue *source = dynamic_cast (&src); IntegerValue *destination = dynamic_cast (&dst); - if (source == 0 || destination == 0) + if (source == nullptr || destination == nullptr) { return false; } diff --git a/src/core/model/log.cc b/src/core/model/log.cc index ed1d4129a..460ecb987 100644 --- a/src/core/model/log.cc +++ b/src/core/model/log.cc @@ -44,12 +44,12 @@ namespace ns3 { * The Log TimePrinter. * This is private to the logging implementation. */ -static TimePrinter g_logTimePrinter = 0; +static TimePrinter g_logTimePrinter = nullptr; /** * \ingroup logging * The Log NodePrinter. */ -static NodePrinter g_logNodePrinter = 0; +static NodePrinter g_logNodePrinter = nullptr; /** * \ingroup logging @@ -82,7 +82,7 @@ LogComponent::GetComponentList () PrintList::PrintList () { const char *envVar = std::getenv ("NS_LOG"); - if (envVar == 0 || std::strlen (envVar) == 0) + if (envVar == nullptr || std::strlen (envVar) == 0) { return; } @@ -145,7 +145,7 @@ void LogComponent::EnvVarCheck () { const char *envVar = std::getenv ("NS_LOG"); - if (envVar == 0 || std::strlen (envVar) == 0) + if (envVar == nullptr || std::strlen (envVar) == 0) { return; } @@ -528,7 +528,7 @@ static bool ComponentExists (std::string componentName) static void CheckEnvironmentVariables () { const char *envVar = std::getenv ("NS_LOG"); - if (envVar == 0 || std::strlen (envVar) == 0) + if (envVar == nullptr || std::strlen (envVar) == 0) { return; } diff --git a/src/core/model/names.cc b/src/core/model/names.cc index 76e64eaff..0b5d84bb7 100644 --- a/src/core/model/names.cc +++ b/src/core/model/names.cc @@ -80,7 +80,7 @@ public: }; NameNode::NameNode () - : m_parent (0), m_name (""), m_object (0) + : m_parent (nullptr), m_name (""), m_object (nullptr) {} NameNode::NameNode (const NameNode &nameNode) @@ -277,9 +277,9 @@ NamesPriv::NamesPriv () { NS_LOG_FUNCTION (this); - m_root.m_parent = 0; + m_root.m_parent = nullptr; m_root.m_name = "Names"; - m_root.m_object = 0; + m_root.m_object = nullptr; } NamesPriv::~NamesPriv () @@ -305,9 +305,9 @@ NamesPriv::Clear () m_objectMap.clear (); - m_root.m_parent = 0; + m_root.m_parent = nullptr; m_root.m_name = "Names"; - m_root.m_object = 0; + m_root.m_object = nullptr; m_root.m_nameMap.clear (); } @@ -379,7 +379,7 @@ NamesPriv::Add (std::string path, std::string name, Ptr object) NS_LOG_FUNCTION (this << path << name << object); if (path == "/Names") { - return Add (Ptr (0, false), name, object); + return Add (Ptr (nullptr, false), name, object); } return Add (Find (path), name, object); } @@ -395,7 +395,7 @@ NamesPriv::Add (Ptr context, std::string name, Ptr object) return false; } - NameNode *node = 0; + NameNode *node = nullptr; if (context) { node = IsNamed (context); @@ -489,7 +489,7 @@ NamesPriv::Rename (std::string path, std::string oldname, std::string newname) NS_LOG_FUNCTION (this << path << oldname << newname); if (path == "/Names") { - return Rename (Ptr (0, false), oldname, newname); + return Rename (Ptr (nullptr, false), oldname, newname); } return Rename (Find (path), oldname, newname); } @@ -499,7 +499,7 @@ NamesPriv::Rename (Ptr context, std::string oldname, std::string newname { NS_LOG_FUNCTION (this << context << oldname << newname); - NameNode *node = 0; + NameNode *node = nullptr; if (context) { node = IsNamed (context); @@ -581,7 +581,7 @@ NamesPriv::FindPath (Ptr object) path = "/" + p->m_name + path; NS_LOG_LOGIC ("path is " << path); } - while ((p = p->m_parent) != 0); + while ((p = p->m_parent) != nullptr); return path; } @@ -644,7 +644,7 @@ NamesPriv::Find (std::string path) if (i == node->m_nameMap.end ()) { NS_LOG_LOGIC ("Name does not exist in name map"); - return 0; + return nullptr; } else { @@ -665,7 +665,7 @@ NamesPriv::Find (std::string path) if (i == node->m_nameMap.end ()) { NS_LOG_LOGIC ("Name does not exist in name map"); - return 0; + return nullptr; } else { @@ -678,7 +678,7 @@ NamesPriv::Find (std::string path) } NS_ASSERT_MSG (node, "NamesPriv::Find(): Internal error: this can't happen"); - return 0; + return nullptr; } Ptr @@ -688,7 +688,7 @@ NamesPriv::Find (std::string path, std::string name) if (path == "/Names") { - return Find (Ptr (0, false), name); + return Find (Ptr (nullptr, false), name); } return Find (Find (path), name); } @@ -698,7 +698,7 @@ NamesPriv::Find (Ptr context, std::string name) { NS_LOG_FUNCTION (this << context << name); - NameNode *node = 0; + NameNode *node = nullptr; if (!context) { @@ -708,10 +708,10 @@ NamesPriv::Find (Ptr context, std::string name) else { node = IsNamed (context); - if (node == 0) + if (node == nullptr) { NS_LOG_LOGIC ("Context does not point to a previously named node"); - return 0; + return nullptr; } } @@ -719,7 +719,7 @@ NamesPriv::Find (Ptr context, std::string name) if (i == node->m_nameMap.end ()) { NS_LOG_LOGIC ("Name does not exist in name map"); - return 0; + return nullptr; } else { @@ -737,7 +737,7 @@ NamesPriv::IsNamed (Ptr object) if (i == m_objectMap.end ()) { NS_LOG_LOGIC ("Object does not exist in object map, returning NameNode 0"); - return 0; + return nullptr; } else { diff --git a/src/core/model/names.h b/src/core/model/names.h index 47f70d5e8..038af22fe 100644 --- a/src/core/model/names.h +++ b/src/core/model/names.h @@ -462,7 +462,7 @@ Names::Find (std::string path) } else { - return 0; + return nullptr; } } @@ -478,7 +478,7 @@ Names::Find (std::string path, std::string name) } else { - return 0; + return nullptr; } } @@ -494,7 +494,7 @@ Names::Find (Ptr context, std::string name) } else { - return 0; + return nullptr; } } diff --git a/src/core/model/object-base.cc b/src/core/model/object-base.cc index a5a891ac9..658407bda 100644 --- a/src/core/model/object-base.cc +++ b/src/core/model/object-base.cc @@ -57,7 +57,7 @@ EnvDictionary (std::string key) if (dict.size () == 0) { const char *envVar = getenv ("NS_ATTRIBUTE_DEFAULT"); - if (envVar != 0 && std::strlen (envVar) > 0) + if (envVar != nullptr && std::strlen (envVar) > 0) { std::string env = envVar; std::string::size_type cur = 0; @@ -311,7 +311,7 @@ ObjectBase::GetAttribute (std::string name, AttributeValue &value) const return; } StringValue *str = dynamic_cast (&value); - if (str == 0) + if (str == nullptr) { NS_FATAL_ERROR ("Attribute name=" << name << " tid=" << tid.GetName () << ": input value is not a string"); } @@ -346,7 +346,7 @@ ObjectBase::GetAttributeFailSafe (std::string name, AttributeValue &value) const return true; } StringValue *str = dynamic_cast (&value); - if (str == 0) + if (str == nullptr) { return false; } diff --git a/src/core/model/object-factory.cc b/src/core/model/object-factory.cc index 92c412612..a780bff92 100644 --- a/src/core/model/object-factory.cc +++ b/src/core/model/object-factory.cc @@ -95,7 +95,7 @@ ObjectFactory::Create () const Callback cb = m_tid.GetConstructor (); ObjectBase *base = cb (); Object *derived = dynamic_cast (base); - NS_ASSERT (derived != 0); + NS_ASSERT (derived != nullptr); derived->SetTypeId (m_tid); derived->Construct (m_parameters); Ptr object = Ptr (derived, false); diff --git a/src/core/model/object-map.h b/src/core/model/object-map.h index d5e372f5f..35d9849f5 100644 --- a/src/core/model/object-map.h +++ b/src/core/model/object-map.h @@ -84,7 +84,7 @@ MakeObjectMapAccessor (U T::*memberVector) bool DoGetN (const ObjectBase *object, std::size_t *n) const override { const T *obj = dynamic_cast (object); - if (obj == 0) + if (obj == nullptr) { return false; } @@ -108,7 +108,7 @@ MakeObjectMapAccessor (U T::*memberVector) } NS_ASSERT (false); // quiet compiler. - return 0; + return nullptr; } U T::*m_memberVector; } *spec = new MemberStdContainer (); diff --git a/src/core/model/object-ptr-container.cc b/src/core/model/object-ptr-container.cc index b0a2f1875..7c5c777be 100644 --- a/src/core/model/object-ptr-container.cc +++ b/src/core/model/object-ptr-container.cc @@ -58,7 +58,7 @@ ObjectPtrContainerValue::Get (std::size_t i) const { NS_LOG_FUNCTION (this << i); Iterator it = m_objects.find (i); - Ptr value = 0; + Ptr value = nullptr; if ( it != m_objects.end () ) { value = m_objects.find (i)->second; @@ -108,7 +108,7 @@ ObjectPtrContainerAccessor::Get (const ObjectBase * object, AttributeValue &valu { NS_LOG_FUNCTION (this << object << &value); ObjectPtrContainerValue *v = dynamic_cast (&value); - if (v == 0) + if (v == nullptr) { return false; } diff --git a/src/core/model/object-ptr-container.h b/src/core/model/object-ptr-container.h index 9643a5dab..58d73e5d7 100644 --- a/src/core/model/object-ptr-container.h +++ b/src/core/model/object-ptr-container.h @@ -183,7 +183,7 @@ public: } bool Check (const AttributeValue &value) const override { - return dynamic_cast (&value) != 0; + return dynamic_cast (&value) != nullptr; } std::string GetValueTypeName () const override { @@ -205,7 +205,7 @@ public: { const ObjectPtrContainerValue *src = dynamic_cast (&source); ObjectPtrContainerValue *dst = dynamic_cast (&destination); - if (src == 0 || dst == 0) + if (src == nullptr || dst == nullptr) { return false; } @@ -259,7 +259,7 @@ MakeObjectPtrContainerAccessor (Ptr (T::*get)(INDEX) const, bool DoGetN (const ObjectBase *object, std::size_t *n) const override { const T *obj = dynamic_cast (object); - if (obj == 0) + if (obj == nullptr) { return false; } diff --git a/src/core/model/object-vector.h b/src/core/model/object-vector.h index b9938596a..1b9bac0a2 100644 --- a/src/core/model/object-vector.h +++ b/src/core/model/object-vector.h @@ -85,7 +85,7 @@ MakeObjectVectorAccessor (U T::*memberVector) bool DoGetN (const ObjectBase *object, std::size_t *n) const override { const T *obj = dynamic_cast (object); - if (obj == 0) + if (obj == nullptr) { return false; } @@ -109,7 +109,7 @@ MakeObjectVectorAccessor (U T::*memberVector) } NS_ASSERT (false); // quiet compiler. - return 0; + return nullptr; } U T::*m_memberVector; } *spec = new MemberStdContainer (); diff --git a/src/core/model/object.cc b/src/core/model/object.cc index d253c3cb8..63298be08 100644 --- a/src/core/model/object.cc +++ b/src/core/model/object.cc @@ -47,7 +47,7 @@ NS_LOG_COMPONENT_DEFINE ("Object"); NS_OBJECT_ENSURE_REGISTERED (Object); Object::AggregateIterator::AggregateIterator () - : m_object (0), + : m_object (nullptr), m_current (0) { NS_LOG_FUNCTION (this); @@ -126,7 +126,7 @@ Object::~Object () { std::free (m_aggregates); } - m_aggregates = 0; + m_aggregates = nullptr; } Object::Object (const Object &o) : m_tid (o.m_tid), @@ -177,7 +177,7 @@ Object::DoGetObject (TypeId tid) const return const_cast (current); } } - return 0; + return nullptr; } void Object::Initialize () diff --git a/src/core/model/object.h b/src/core/model/object.h index b19a1187b..737e55873 100644 --- a/src/core/model/object.h +++ b/src/core/model/object.h @@ -472,7 +472,7 @@ Object::GetObject () const // This is an optimization: if the cast works (which is likely), // things will be pretty fast. T *result = dynamic_cast (m_aggregates->buffer[0]); - if (result != 0) + if (result != nullptr) { return Ptr (result); } @@ -482,7 +482,7 @@ Object::GetObject () const { return Ptr (static_cast (PeekPointer (found))); } - return 0; + return nullptr; } /** @@ -508,7 +508,7 @@ Object::GetObject (TypeId tid) const { return Ptr (static_cast (PeekPointer (found))); } - return 0; + return nullptr; } /** diff --git a/src/core/model/pair.h b/src/core/model/pair.h index 1c30db179..270157953 100644 --- a/src/core/model/pair.h +++ b/src/core/model/pair.h @@ -196,8 +196,8 @@ private: template PairChecker::PairChecker () - : m_firstchecker (0), - m_secondchecker (0) + : m_firstchecker (nullptr), + m_secondchecker (nullptr) {} template diff --git a/src/core/model/pointer.h b/src/core/model/pointer.h index 53ca7b5c1..36ed549a2 100644 --- a/src/core/model/pointer.h +++ b/src/core/model/pointer.h @@ -132,7 +132,7 @@ class PointerChecker : public ns3::PointerChecker bool Check (const AttributeValue &val) const override { const PointerValue *value = dynamic_cast (&val); - if (value == 0) + if (value == nullptr) { return false; } @@ -141,7 +141,7 @@ class PointerChecker : public ns3::PointerChecker return true; } T *ptr = dynamic_cast (PeekPointer (value->GetObject ())); - if (ptr == 0) + if (ptr == nullptr) { return false; } @@ -168,7 +168,7 @@ class PointerChecker : public ns3::PointerChecker { const PointerValue *src = dynamic_cast (&source); PointerValue *dst = dynamic_cast (&destination); - if (src == 0 || dst == 0) + if (src == nullptr || dst == nullptr) { return false; } diff --git a/src/core/model/ptr.h b/src/core/model/ptr.h index 16bdc166b..e753d274c 100644 --- a/src/core/model/ptr.h +++ b/src/core/model/ptr.h @@ -662,7 +662,7 @@ template void Ptr::Acquire () const { - if (m_ptr != 0) + if (m_ptr != nullptr) { m_ptr->Ref (); } @@ -670,7 +670,7 @@ Ptr::Acquire () const template Ptr::Ptr () - : m_ptr (0) + : m_ptr (nullptr) {} template @@ -695,7 +695,7 @@ Ptr::Ptr (Ptr const&o) : m_ptr (nullptr) { T* ptr = PeekPointer (o); - if (ptr != 0) + if (ptr != nullptr) { m_ptr = ptr; Acquire (); @@ -712,7 +712,7 @@ Ptr::Ptr (Ptr const &o) template Ptr::~Ptr () { - if (m_ptr != 0) + if (m_ptr != nullptr) { m_ptr->Unref (); } @@ -726,7 +726,7 @@ Ptr::operator = (Ptr const& o) { return *this; } - if (m_ptr != 0) + if (m_ptr != nullptr) { m_ptr->Unref (); } @@ -781,7 +781,7 @@ Ptr::operator Tester * () const // NS_DEPRECATED_3_37 template Ptr::operator bool() const { - return m_ptr != 0; + return m_ptr != nullptr; } diff --git a/src/core/model/random-variable-stream.cc b/src/core/model/random-variable-stream.cc index 5d9d827c2..ff88c7a57 100644 --- a/src/core/model/random-variable-stream.cc +++ b/src/core/model/random-variable-stream.cc @@ -73,7 +73,7 @@ RandomVariableStream::GetTypeId () } RandomVariableStream::RandomVariableStream () - : m_rng (0) + : m_rng (nullptr) { NS_LOG_FUNCTION (this); } @@ -1460,7 +1460,7 @@ DeterministicRandomVariable::DeterministicRandomVariable () : m_count (0), m_next (0), - m_data (0) + m_data (nullptr) { NS_LOG_FUNCTION (this); } @@ -1468,7 +1468,7 @@ DeterministicRandomVariable::~DeterministicRandomVariable () { // Delete any values currently set. NS_LOG_FUNCTION (this); - if (m_data != 0) + if (m_data != nullptr) { delete[] m_data; } @@ -1479,7 +1479,7 @@ DeterministicRandomVariable::SetValueArray (double* values, std::size_t length) { NS_LOG_FUNCTION (this << values << length); // Delete any values currently set. - if (m_data != 0) + if (m_data != nullptr) { delete[] m_data; } diff --git a/src/core/model/realtime-simulator-impl.cc b/src/core/model/realtime-simulator-impl.cc index 77217d260..450ada92d 100644 --- a/src/core/model/realtime-simulator-impl.cc +++ b/src/core/model/realtime-simulator-impl.cc @@ -107,8 +107,8 @@ RealtimeSimulatorImpl::DoDispose () Scheduler::Event next = m_events->RemoveNext (); next.impl->Unref (); } - m_events = 0; - m_synchronizer = 0; + m_events = nullptr; + m_synchronizer = nullptr; SimulatorImpl::DoDispose (); } @@ -747,7 +747,7 @@ RealtimeSimulatorImpl::IsExpired (const EventId &id) const { if (id.GetUid () == EventId::UID::DESTROY) { - if (id.PeekEventImpl () == 0 + if (id.PeekEventImpl () == nullptr || id.PeekEventImpl ()->IsCancelled ()) { return true; @@ -772,7 +772,7 @@ RealtimeSimulatorImpl::IsExpired (const EventId &id) const // // The same is true for the next line involving the m_currentUid. // - if (id.PeekEventImpl () == 0 + if (id.PeekEventImpl () == nullptr || id.GetTs () < m_currentTs || (id.GetTs () == m_currentTs && id.GetUid () <= m_currentUid) || id.PeekEventImpl ()->IsCancelled ()) diff --git a/src/core/model/simulation-singleton.h b/src/core/model/simulation-singleton.h index 3a5d8e060..11f81e71c 100644 --- a/src/core/model/simulation-singleton.h +++ b/src/core/model/simulation-singleton.h @@ -98,8 +98,8 @@ template T ** SimulationSingleton::GetObject () { - static T *pobject = 0; - if (pobject == 0) + static T *pobject = nullptr; + if (pobject == nullptr) { pobject = new T (); Simulator::ScheduleDestroy (&SimulationSingleton::DeleteObject); @@ -113,7 +113,7 @@ SimulationSingleton::DeleteObject () { T **ppobject = GetObject (); delete (*ppobject); - *ppobject = 0; + *ppobject = nullptr; } } // namespace ns3 diff --git a/src/core/model/simulator.cc b/src/core/model/simulator.cc index b438ff130..184b5e4eb 100644 --- a/src/core/model/simulator.cc +++ b/src/core/model/simulator.cc @@ -85,7 +85,7 @@ static GlobalValue g_schedTypeImpl = GlobalValue ("SchedulerType", */ static SimulatorImpl ** PeekImpl () { - static SimulatorImpl *impl = 0; + static SimulatorImpl *impl = nullptr; return &impl; } @@ -101,7 +101,7 @@ static SimulatorImpl * GetImpl () /* Please, don't include any calls to logging macros in this function * or pay the price, that is, stack explosions. */ - if (*pimpl == 0) + if (*pimpl == nullptr) { { ObjectFactory factory; @@ -138,7 +138,7 @@ Simulator::Destroy () NS_LOG_FUNCTION_NOARGS (); SimulatorImpl **pimpl = PeekImpl (); - if (*pimpl == 0) + if (*pimpl == nullptr) { return; } @@ -147,11 +147,11 @@ Simulator::Destroy () * legal), Simulator::GetImpl will trigger again an infinite recursion until * the stack explodes. */ - LogSetTimePrinter (0); - LogSetNodePrinter (0); + LogSetTimePrinter (nullptr); + LogSetNodePrinter (nullptr); (*pimpl)->Destroy (); (*pimpl)->Unref (); - *pimpl = 0; + *pimpl = nullptr; } void @@ -257,7 +257,7 @@ Simulator::DoScheduleDestroy (EventImpl *impl) void Simulator::Remove (const EventId &id) { - if (*PeekImpl () == 0) + if (*PeekImpl () == nullptr) { return; } @@ -267,7 +267,7 @@ Simulator::Remove (const EventId &id) void Simulator::Cancel (const EventId &id) { - if (*PeekImpl () == 0) + if (*PeekImpl () == nullptr) { return; } @@ -277,7 +277,7 @@ Simulator::Cancel (const EventId &id) bool Simulator::IsExpired (const EventId &id) { - if (*PeekImpl () == 0) + if (*PeekImpl () == nullptr) { return true; } @@ -313,7 +313,7 @@ Simulator::GetSystemId () { NS_LOG_FUNCTION_NOARGS (); - if (*PeekImpl () != 0) + if (*PeekImpl () != nullptr) { return GetImpl ()->GetSystemId (); } @@ -327,7 +327,7 @@ void Simulator::SetImplementation (Ptr impl) { NS_LOG_FUNCTION (impl); - if (*PeekImpl () != 0) + if (*PeekImpl () != nullptr) { NS_FATAL_ERROR ("It is not possible to set the implementation after calling any Simulator:: function. Call Simulator::SetImplementation earlier or after Simulator::Destroy."); } diff --git a/src/core/model/system-path.cc b/src/core/model/system-path.cc index 506c438f0..f6c84c0f2 100644 --- a/src/core/model/system-path.cc +++ b/src/core/model/system-path.cc @@ -307,13 +307,13 @@ std::string MakeTemporaryDirectoryName () { NS_LOG_FUNCTION_NOARGS (); - char *path = NULL; + char *path = nullptr; path = std::getenv ("TMP"); - if (path == NULL || std::strlen (path) == 0) + if (path == nullptr || std::strlen (path) == 0) { path = std::getenv ("TEMP"); - if (path == NULL || std::strlen (path) == 0) + if (path == nullptr || std::strlen (path) == 0) { path = const_cast ("/tmp"); } @@ -323,13 +323,13 @@ MakeTemporaryDirectoryName () // Just in case the user wants to go back and find the output, we give // a hint as to which dir we created by including a time hint. // - time_t now = time (NULL); + time_t now = time (nullptr); struct tm *tm_now = localtime (&now); // // But we also randomize the name in case there are multiple users doing // this at the same time // - srand (time (0)); + srand (time (nullptr)); long int n = rand (); // diff --git a/src/core/model/system-wall-clock-ms.cc b/src/core/model/system-wall-clock-ms.cc index 6647c4a20..f71f0acea 100644 --- a/src/core/model/system-wall-clock-ms.cc +++ b/src/core/model/system-wall-clock-ms.cc @@ -141,7 +141,7 @@ SystemWallClockMs::~SystemWallClockMs () { NS_LOG_FUNCTION (this); delete m_priv; - m_priv = 0; + m_priv = nullptr; } void diff --git a/src/core/model/system-wall-clock-timestamp.cc b/src/core/model/system-wall-clock-timestamp.cc index b1454c050..817c1ee92 100644 --- a/src/core/model/system-wall-clock-timestamp.cc +++ b/src/core/model/system-wall-clock-timestamp.cc @@ -38,7 +38,7 @@ SystemWallClockTimestamp::SystemWallClockTimestamp () void SystemWallClockTimestamp::Stamp () { - std::time_t seconds = std::time (NULL); + std::time_t seconds = std::time (nullptr); m_diff = seconds - m_last; m_last = seconds; } diff --git a/src/core/model/test.cc b/src/core/model/test.cc index a41d96eb8..424036bae 100644 --- a/src/core/model/test.cc +++ b/src/core/model/test.cc @@ -272,10 +272,10 @@ TestCase::Result::Result () TestCase::TestCase (std::string name) - : m_parent (0), + : m_parent (nullptr), m_dataDir (""), - m_runner (0), - m_result (0), + m_runner (nullptr), + m_result (nullptr), m_name (name), m_duration (TestCase::QUICK) { @@ -285,8 +285,8 @@ TestCase::TestCase (std::string name) TestCase::~TestCase () { NS_LOG_FUNCTION (this); - NS_ASSERT (m_runner == 0); - m_parent = 0; + NS_ASSERT (m_runner == nullptr); + m_parent = nullptr; delete m_result; for (std::vector::const_iterator i = m_children.begin (); i != m_children.end (); ++i) { @@ -364,7 +364,7 @@ TestCase::Run (TestRunnerImpl *runner) out: m_result->clock.End (); DoTeardown (); - m_runner = 0; + m_runner = nullptr; } std::string TestCase::GetName () const @@ -388,7 +388,7 @@ TestCase::ReportTestFailure (std::string cond, std::string actual, message, file, line)); // set childrenFailed flag on parents. TestCase *current = m_parent; - while (current != 0) + while (current != nullptr) { current->m_result->childrenFailed = true; current = current->m_parent; @@ -413,11 +413,11 @@ TestCase::CreateDataDirFilename (std::string filename) { NS_LOG_FUNCTION (this << filename); const TestCase *current = this; - while (current != 0 && current->m_dataDir == "") + while (current != nullptr && current->m_dataDir == "") { current = current->m_parent; } - if (current == 0) + if (current == nullptr) { NS_FATAL_ERROR ("No one called SetDataDir prior to calling this function"); } @@ -438,7 +438,7 @@ TestCase::CreateTempDirFilename (std::string filename) { std::list names; const TestCase *current = this; - while (current != 0) + while (current != nullptr) { names.push_front (current->m_name); current = current->m_parent; @@ -665,7 +665,7 @@ void TestRunnerImpl::PrintReport (TestCase *test, std::ostream *os, bool xml, int level) { NS_LOG_FUNCTION (this << test << os << xml << level); - if (test->m_result == 0) + if (test->m_result == nullptr) { // Do not print reports for tests that were not run. return; @@ -788,7 +788,7 @@ TestRunnerImpl::PrintTestNameList (std::list::const_iterator begin, for (std::list::const_iterator i = begin; i != end; ++i) { TestSuite * test = dynamic_cast (*i); - NS_ASSERT (test != 0); + NS_ASSERT (test != nullptr); if (printTestType) { std::cout << label[test->GetTestType ()]; @@ -881,7 +881,7 @@ TestRunnerImpl::Run (int argc, char *argv[]) char ** argi = argv; ++argi; - while (*argi != 0) + while (*argi != nullptr) { char *arg = *argi; diff --git a/src/core/model/time.cc b/src/core/model/time.cc index bd5c83c56..9c91cf028 100644 --- a/src/core/model/time.cc +++ b/src/core/model/time.cc @@ -86,7 +86,7 @@ namespace { // The set of marked times // static -Time::MarkedTimes * Time::g_markingTimes = 0; +Time::MarkedTimes * Time::g_markingTimes = nullptr; /// The static mutex for critical sections around modification of Time::g_markingTimes. static std::mutex g_markingMutex; @@ -307,7 +307,7 @@ Time::ClearMarkedTimes () { NS_LOG_LOGIC ("clearing MarkedTimes"); g_markingTimes->erase (g_markingTimes->begin (), g_markingTimes->end ()); - g_markingTimes = 0; + g_markingTimes = nullptr; } } // Time::ClearMarkedTimes @@ -319,7 +319,7 @@ Time::Mark (Time * const time) std::unique_lock lock {g_markingMutex}; NS_LOG_FUNCTION (time); - NS_ASSERT (time != 0); + NS_ASSERT (time != nullptr); // Repeat the g_markingTimes test here inside the CriticalSection, // since earlier test was outside and might be stale. @@ -345,7 +345,7 @@ Time::Clear (Time * const time) std::unique_lock lock {g_markingMutex}; NS_LOG_FUNCTION (time); - NS_ASSERT (time != 0); + NS_ASSERT (time != nullptr); if (g_markingTimes) { @@ -376,7 +376,7 @@ Time::ConvertTimes (const enum Unit unit) NS_LOG_FUNCTION_NOARGS (); - NS_ASSERT_MSG (g_markingTimes != 0, + NS_ASSERT_MSG (g_markingTimes != nullptr, "No MarkedTimes registry. " "Time::SetResolution () called more than once?"); @@ -400,7 +400,7 @@ Time::ConvertTimes (const enum Unit unit) // Assert above already guarantees g_markingTimes != 0 NS_LOG_LOGIC ("clearing MarkedTimes"); g_markingTimes->erase (g_markingTimes->begin (), g_markingTimes->end ()); - g_markingTimes = 0; + g_markingTimes = nullptr; } // Time::ConvertTimes () @@ -531,7 +531,7 @@ MakeTimeChecker (const Time min, const Time max) { NS_LOG_FUNCTION (&value); const TimeValue *v = dynamic_cast (&value); - if (v == 0) + if (v == nullptr) { return false; } @@ -564,7 +564,7 @@ MakeTimeChecker (const Time min, const Time max) NS_LOG_FUNCTION (&source << &destination); const TimeValue *src = dynamic_cast (&source); TimeValue *dst = dynamic_cast (&destination); - if (src == 0 || dst == 0) + if (src == nullptr || dst == nullptr) { return false; } diff --git a/src/core/model/timer-impl.h b/src/core/model/timer-impl.h index c9afff958..686edf2bb 100644 --- a/src/core/model/timer-impl.h +++ b/src/core/model/timer-impl.h @@ -962,7 +962,7 @@ TimerImpl::SetArgs (T1 a1) typename TimerTraits::ParameterType > TimerImplBase; TimerImplBase *impl = dynamic_cast (this); - if (impl == 0) + if (impl == nullptr) { NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function."); return; @@ -979,7 +979,7 @@ TimerImpl::SetArgs (T1 a1, T2 a2) typename TimerTraits::ParameterType > TimerImplBase; TimerImplBase *impl = dynamic_cast (this); - if (impl == 0) + if (impl == nullptr) { NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function."); return; @@ -997,7 +997,7 @@ TimerImpl::SetArgs (T1 a1, T2 a2, T3 a3) typename TimerTraits::ParameterType > TimerImplBase; TimerImplBase *impl = dynamic_cast (this); - if (impl == 0) + if (impl == nullptr) { NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function."); return; @@ -1016,7 +1016,7 @@ TimerImpl::SetArgs (T1 a1, T2 a2, T3 a3, T4 a4) typename TimerTraits::ParameterType > TimerImplBase; TimerImplBase *impl = dynamic_cast (this); - if (impl == 0) + if (impl == nullptr) { NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function."); return; @@ -1036,7 +1036,7 @@ TimerImpl::SetArgs (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) typename TimerTraits::ParameterType > TimerImplBase; TimerImplBase *impl = dynamic_cast (this); - if (impl == 0) + if (impl == nullptr) { NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function."); return; diff --git a/src/core/model/timer.cc b/src/core/model/timer.cc index ffc172bbc..186948f5b 100644 --- a/src/core/model/timer.cc +++ b/src/core/model/timer.cc @@ -36,7 +36,7 @@ Timer::Timer () : m_flags (CHECK_ON_DESTROY), m_delay (FemtoSeconds (0)), m_event (), - m_impl (0) + m_impl (nullptr) { NS_LOG_FUNCTION (this); } @@ -45,7 +45,7 @@ Timer::Timer (enum DestroyPolicy destroyPolicy) : m_flags (destroyPolicy), m_delay (FemtoSeconds (0)), m_event (), - m_impl (0) + m_impl (nullptr) { NS_LOG_FUNCTION (this << destroyPolicy); } @@ -165,7 +165,7 @@ void Timer::Schedule (Time delay) { NS_LOG_FUNCTION (this << delay); - NS_ASSERT (m_impl != 0); + NS_ASSERT (m_impl != nullptr); if (m_event.IsRunning ()) { NS_FATAL_ERROR ("Event is still running while re-scheduling."); diff --git a/src/core/model/timer.h b/src/core/model/timer.h index 65df8e48d..5d8827f1d 100644 --- a/src/core/model/timer.h +++ b/src/core/model/timer.h @@ -292,7 +292,7 @@ template void Timer::SetArguments (Ts... args) { - if (m_impl == 0) + if (m_impl == nullptr) { NS_FATAL_ERROR ("You cannot set the arguments of a Timer before setting its function."); return; diff --git a/src/core/model/trace-source-accessor.h b/src/core/model/trace-source-accessor.h index d0f5729c9..8e6235b98 100644 --- a/src/core/model/trace-source-accessor.h +++ b/src/core/model/trace-source-accessor.h @@ -125,7 +125,7 @@ Ptr MakeTraceSourceAccessor (T a); static inline Ptr MakeEmptyTraceSourceAccessor () { - return Ptr (0); + return Ptr (nullptr); } } // namespace ns3 @@ -155,7 +155,7 @@ DoMakeTraceSourceAccessor (SOURCE T::*a) bool ConnectWithoutContext (ObjectBase *obj, const CallbackBase &cb) const override { T *p = dynamic_cast (obj); - if (p == 0) + if (p == nullptr) { return false; } @@ -165,7 +165,7 @@ DoMakeTraceSourceAccessor (SOURCE T::*a) bool Connect (ObjectBase *obj, std::string context, const CallbackBase &cb) const override { T *p = dynamic_cast (obj); - if (p == 0) + if (p == nullptr) { return false; } @@ -175,7 +175,7 @@ DoMakeTraceSourceAccessor (SOURCE T::*a) bool DisconnectWithoutContext (ObjectBase *obj, const CallbackBase &cb) const override { T *p = dynamic_cast (obj); - if (p == 0) + if (p == nullptr) { return false; } @@ -185,7 +185,7 @@ DoMakeTraceSourceAccessor (SOURCE T::*a) bool Disconnect (ObjectBase *obj, std::string context, const CallbackBase &cb) const override { T *p = dynamic_cast (obj); - if (p == 0) + if (p == nullptr) { return false; } diff --git a/src/core/model/trickle-timer.cc b/src/core/model/trickle-timer.cc index a1aebb6bb..4a2e90562 100644 --- a/src/core/model/trickle-timer.cc +++ b/src/core/model/trickle-timer.cc @@ -28,7 +28,7 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("TrickleTimer"); TrickleTimer::TrickleTimer () - : m_impl (0), + : m_impl (nullptr), m_timerExpiration (), m_intervalExpiration (), m_currentInterval (Time(0)), @@ -44,7 +44,7 @@ TrickleTimer::TrickleTimer () } TrickleTimer::TrickleTimer (Time minInterval, uint8_t doublings, uint16_t redundancy) - : m_impl (0), + : m_impl (nullptr), m_timerExpiration (), m_intervalExpiration (), m_currentInterval (Time(0)), diff --git a/src/core/model/trickle-timer.h b/src/core/model/trickle-timer.h index 42bdf7dd9..92a7a7d38 100644 --- a/src/core/model/trickle-timer.h +++ b/src/core/model/trickle-timer.h @@ -282,7 +282,7 @@ template void TrickleTimer::SetArguments (Ts&&... args) { - if (m_impl == 0) + if (m_impl == nullptr) { NS_FATAL_ERROR ("You cannot set the arguments of a TrickleTimer before setting its function."); return; diff --git a/src/core/model/tuple.h b/src/core/model/tuple.h index 3cb8ae71e..8c31cda55 100644 --- a/src/core/model/tuple.h +++ b/src/core/model/tuple.h @@ -411,7 +411,7 @@ public: { const TupleValue *src = dynamic_cast *> (&source); TupleValue *dst = dynamic_cast *> (&destination); - if (src == 0 || dst == 0) + if (src == nullptr || dst == nullptr) { return false; } diff --git a/src/core/model/type-id.cc b/src/core/model/type-id.cc index 0c87ff8a4..b81d6e07d 100644 --- a/src/core/model/type-id.cc +++ b/src/core/model/type-id.cc @@ -1170,7 +1170,7 @@ TypeId::LookupTraceSourceByName (std::string name, nextTid = tid.GetParent (); } while (nextTid != tid); - return 0; + return nullptr; } Ptr diff --git a/src/core/model/uinteger.cc b/src/core/model/uinteger.cc index 531fa6a87..4a5bf75ca 100644 --- a/src/core/model/uinteger.cc +++ b/src/core/model/uinteger.cc @@ -59,7 +59,7 @@ Ptr MakeUintegerChecker (uint64_t min, uint64_t max, std { NS_LOG_FUNCTION (&value); const UintegerValue *v = dynamic_cast (&value); - if (v == 0) + if (v == nullptr) { return false; } @@ -92,7 +92,7 @@ Ptr MakeUintegerChecker (uint64_t min, uint64_t max, std NS_LOG_FUNCTION (&source << &destination); const UintegerValue *src = dynamic_cast (&source); UintegerValue *dst = dynamic_cast (&destination); - if (src == 0 || dst == 0) + if (src == nullptr || dst == nullptr) { return false; } diff --git a/src/core/model/unix-fd-reader.cc b/src/core/model/unix-fd-reader.cc index e3695ab10..961a59d18 100644 --- a/src/core/model/unix-fd-reader.cc +++ b/src/core/model/unix-fd-reader.cc @@ -177,7 +177,7 @@ void FdReader::Run () int r; fd_set readfds = rfds; - r = select (nfds, &readfds, NULL, NULL, NULL); + r = select (nfds, &readfds, nullptr, nullptr, nullptr); if (r == -1 && errno != EINTR) { NS_FATAL_ERROR ("select() failed: " << std::strerror (errno)); diff --git a/src/core/model/unix-fd-reader.h b/src/core/model/unix-fd-reader.h index 934b76604..8ac23f6d6 100644 --- a/src/core/model/unix-fd-reader.h +++ b/src/core/model/unix-fd-reader.h @@ -76,7 +76,7 @@ protected: struct Data { /** Default constructor, with null buffer and zero length. */ - Data () : m_buf (0), m_len (0) + Data () : m_buf (nullptr), m_len (0) {} /** * Construct from a buffer of a given length. diff --git a/src/core/model/watchdog.cc b/src/core/model/watchdog.cc index de54ca570..e76def6b4 100644 --- a/src/core/model/watchdog.cc +++ b/src/core/model/watchdog.cc @@ -32,7 +32,7 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("Watchdog"); Watchdog::Watchdog () - : m_impl (0), + : m_impl (nullptr), m_event (), m_end (MicroSeconds (0)) { diff --git a/src/core/model/watchdog.h b/src/core/model/watchdog.h index 5efb73790..6792bfc4a 100644 --- a/src/core/model/watchdog.h +++ b/src/core/model/watchdog.h @@ -154,7 +154,7 @@ template void Watchdog::SetArguments (Ts&&... args) { - if (m_impl == 0) + if (m_impl == nullptr) { NS_FATAL_ERROR ("You cannot set the arguments of a Watchdog before setting its function."); return; diff --git a/src/core/test/callback-test-suite.cc b/src/core/test/callback-test-suite.cc index d7002733c..e1cf9a803 100644 --- a/src/core/test/callback-test-suite.cc +++ b/src/core/test/callback-test-suite.cc @@ -590,8 +590,8 @@ void MakeBoundCallbackTestCase::DoSetup () { gMakeBoundCallbackTest1 = 0; - gMakeBoundCallbackTest2 = 0; - gMakeBoundCallbackTest3a = 0; + gMakeBoundCallbackTest2 = nullptr; + gMakeBoundCallbackTest3a = nullptr; gMakeBoundCallbackTest3b = 0; gMakeBoundCallbackTest4a = 0; gMakeBoundCallbackTest4b = 0; diff --git a/src/core/test/command-line-test-suite.cc b/src/core/test/command-line-test-suite.cc index d53af621f..6dc6fd8e9 100644 --- a/src/core/test/command-line-test-suite.cc +++ b/src/core/test/command-line-test-suite.cc @@ -91,7 +91,7 @@ CommandLineTestCaseBase::Parse (CommandLine &cmd, int n, ...) int argc = n + 1; // test name will go in argv[0], other n to follow char ** argv = new char* [argc + 1]; // extra entry for final null - argv[argc] = 0; + argv[argc] = nullptr; argv[0] = new char [strlen (ss.str ().c_str ()) + 1]; strcpy (argv[0], ss.str ().c_str ()); diff --git a/src/core/test/event-garbage-collector-test-suite.cc b/src/core/test/event-garbage-collector-test-suite.cc index a92c5d5d2..daf6f16ac 100644 --- a/src/core/test/event-garbage-collector-test-suite.cc +++ b/src/core/test/event-garbage-collector-test-suite.cc @@ -61,7 +61,7 @@ public: }; EventGarbageCollectorTestCase::EventGarbageCollectorTestCase () - : TestCase ("EventGarbageCollector"), m_counter (0), m_events (0) + : TestCase ("EventGarbageCollector"), m_counter (0), m_events (nullptr) {} EventGarbageCollectorTestCase::~EventGarbageCollectorTestCase () @@ -75,7 +75,7 @@ EventGarbageCollectorTestCase::EventGarbageCollectorCallback () { // this should cause the remaining (50) events to be cancelled delete m_events; - m_events = 0; + m_events = nullptr; } } diff --git a/src/core/test/names-test-suite.cc b/src/core/test/names-test-suite.cc index fd7e213b4..515af5b22 100644 --- a/src/core/test/names-test-suite.cc +++ b/src/core/test/names-test-suite.cc @@ -130,10 +130,10 @@ BasicAddTestCase::DoRun () std::string found; Ptr objectOne = CreateObject (); - Names::Add (Ptr (0, false), "Name One", objectOne); + Names::Add (Ptr (nullptr, false), "Name One", objectOne); Ptr objectTwo = CreateObject (); - Names::Add (Ptr (0, false), "Name Two", objectTwo); + Names::Add (Ptr (nullptr, false), "Name Two", objectTwo); Ptr childOfObjectOne = CreateObject (); Names::Add (objectOne, "Child", childOfObjectOne); @@ -395,7 +395,7 @@ BasicRenameTestCase::DoRun () std::string found; Ptr objectOne = CreateObject (); - Names::Add (Ptr (0, false), "Name", objectOne); + Names::Add (Ptr (nullptr, false), "Name", objectOne); Ptr childOfObjectOne = CreateObject (); Names::Add (objectOne, "Child", childOfObjectOne); @@ -403,7 +403,7 @@ BasicRenameTestCase::DoRun () found = Names::FindName (objectOne); NS_TEST_ASSERT_MSG_EQ (found, "Name", "Could not Names::Add and Names::FindName an Object"); - Names::Rename (Ptr (0, false), "Name", "New Name"); + Names::Rename (Ptr (nullptr, false), "Name", "New Name"); found = Names::FindName (objectOne); NS_TEST_ASSERT_MSG_EQ (found, "New Name", "Could not Names::Rename an Object"); @@ -709,10 +709,10 @@ BasicFindTestCase::DoRun () Ptr childOfObjectTwo = CreateObject (); Names::Add ("Name Two/Child", childOfObjectTwo); - found = Names::Find (Ptr (0, false), "Name One"); + found = Names::Find (Ptr (nullptr, false), "Name One"); NS_TEST_ASSERT_MSG_EQ (found, objectOne, "Could not find a previously named Object via object context"); - found = Names::Find (Ptr (0, false), "Name Two"); + found = Names::Find (Ptr (nullptr, false), "Name Two"); NS_TEST_ASSERT_MSG_EQ (found, objectTwo, "Could not find a previously named Object via object context"); found = Names::Find (objectOne, "Child"); diff --git a/src/core/test/object-test-suite.cc b/src/core/test/object-test-suite.cc index 3185750a4..d9b57c6a9 100644 --- a/src/core/test/object-test-suite.cc +++ b/src/core/test/object-test-suite.cc @@ -396,7 +396,7 @@ AggregateObjectTestCase::DoRun () NS_TEST_ASSERT_MSG_NE (baseB, nullptr, "Unable to CreateObject"); baseA->AggregateObject (baseB); - baseA = 0; + baseA = nullptr; baseA = baseB->GetObject (); NS_TEST_ASSERT_MSG_NE (baseA, nullptr, "Unable to GetObject on released object"); diff --git a/src/core/test/ptr-test-suite.cc b/src/core/test/ptr-test-suite.cc index 4b9d66959..5c250675a 100644 --- a/src/core/test/ptr-test-suite.cc +++ b/src/core/test/ptr-test-suite.cc @@ -300,7 +300,7 @@ PtrTestCase::DoRun () Ptr p1 = p; } raw = GetPointer (p); - p = 0; + p = nullptr; } NS_TEST_EXPECT_MSG_EQ (m_nDestroyed, 0, "012"); delete raw; diff --git a/src/csma/model/csma-net-device.cc b/src/csma/model/csma-net-device.cc index 48bb6ea6b..f3c3a89c0 100644 --- a/src/csma/model/csma-net-device.cc +++ b/src/csma/model/csma-net-device.cc @@ -189,7 +189,7 @@ CsmaNetDevice::CsmaNetDevice () NS_LOG_FUNCTION (this); m_txMachineState = READY; m_tInterframeGap = Seconds (0); - m_channel = 0; + m_channel = nullptr; // // We would like to let the attribute system take care of initializing the @@ -208,16 +208,16 @@ CsmaNetDevice::CsmaNetDevice () CsmaNetDevice::~CsmaNetDevice() { NS_LOG_FUNCTION_NOARGS (); - m_queue = 0; + m_queue = nullptr; } void CsmaNetDevice::DoDispose () { NS_LOG_FUNCTION_NOARGS (); - m_channel = 0; - m_node = 0; - m_queue = 0; + m_channel = nullptr; + m_node = nullptr; + m_queue = nullptr; NetDevice::DoDispose (); } @@ -456,7 +456,7 @@ CsmaNetDevice::TransmitStart () if (IsSendEnabled () == false) { m_phyTxDropTrace (m_currentPkt); - m_currentPkt = 0; + m_currentPkt = nullptr; return; } @@ -510,7 +510,7 @@ CsmaNetDevice::TransmitStart () { NS_LOG_WARN ("Channel TransmitStart returns an error"); m_phyTxDropTrace (m_currentPkt); - m_currentPkt = 0; + m_currentPkt = nullptr; m_txMachineState = READY; } else @@ -543,7 +543,7 @@ CsmaNetDevice::TransmitAbort () NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")"); m_phyTxDropTrace (m_currentPkt); - m_currentPkt = 0; + m_currentPkt = nullptr; NS_ASSERT_MSG (m_txMachineState == BACKOFF, "Must be in BACKOFF state to abort. Tx state is: " << m_txMachineState); @@ -599,7 +599,7 @@ CsmaNetDevice::TransmitCompleteEvent () m_channel->TransmitEnd (); m_phyTxEndTrace (m_currentPkt); - m_currentPkt = 0; + m_currentPkt = nullptr; NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.As (Time::S)); diff --git a/src/dsdv/model/dsdv-packet-queue.h b/src/dsdv/model/dsdv-packet-queue.h index 24730938d..2b79f6e10 100644 --- a/src/dsdv/model/dsdv-packet-queue.h +++ b/src/dsdv/model/dsdv-packet-queue.h @@ -57,7 +57,7 @@ public: * \param ucb the UnicastForwardCallback function * \param ecb the ErrorCallback function */ - QueueEntry (Ptr pa = 0, Ipv4Header const & h = Ipv4Header (), + QueueEntry (Ptr pa = nullptr, Ipv4Header const & h = Ipv4Header (), UnicastForwardCallback ucb = UnicastForwardCallback (), ErrorCallback ecb = ErrorCallback ()) : m_packet (pa), diff --git a/src/dsdv/model/dsdv-routing-protocol.cc b/src/dsdv/model/dsdv-routing-protocol.cc index eb4268013..80baf79d1 100644 --- a/src/dsdv/model/dsdv-routing-protocol.cc +++ b/src/dsdv/model/dsdv-routing-protocol.cc @@ -237,7 +237,7 @@ RoutingProtocol::~RoutingProtocol () void RoutingProtocol::DoDispose () { - m_ipv4 = 0; + m_ipv4 = nullptr; for (std::map, Ipv4InterfaceAddress>::iterator iter = m_socketAddresses.begin (); iter != m_socketAddresses.end (); iter++) { diff --git a/src/dsdv/model/dsdv-rtable.h b/src/dsdv/model/dsdv-rtable.h index 1f8bd3ed5..28eecd9d8 100644 --- a/src/dsdv/model/dsdv-rtable.h +++ b/src/dsdv/model/dsdv-rtable.h @@ -69,7 +69,7 @@ public: * \param settlingTime the settling time * \param changedEntries flag for changed entries */ - RoutingTableEntry (Ptr dev = 0, Ipv4Address dst = Ipv4Address (), uint32_t seqNo = 0, + RoutingTableEntry (Ptr dev = nullptr, Ipv4Address dst = Ipv4Address (), uint32_t seqNo = 0, Ipv4InterfaceAddress iface = Ipv4InterfaceAddress (), uint32_t hops = 0, Ipv4Address nextHop = Ipv4Address (), Time lifetime = Simulator::Now (), Time settlingTime = Simulator::Now (), bool changedEntries = false); diff --git a/src/dsr/helper/dsr-main-helper.cc b/src/dsr/helper/dsr-main-helper.cc index a5cefe4f2..fa10bc861 100644 --- a/src/dsr/helper/dsr-main-helper.cc +++ b/src/dsr/helper/dsr-main-helper.cc @@ -45,7 +45,7 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("DsrMainHelper"); DsrMainHelper::DsrMainHelper () - : m_dsrHelper (0) + : m_dsrHelper (nullptr) { NS_LOG_FUNCTION (this); } diff --git a/src/dsr/model/dsr-errorbuff.h b/src/dsr/model/dsr-errorbuff.h index 4f53e05f8..eb366f722 100644 --- a/src/dsr/model/dsr-errorbuff.h +++ b/src/dsr/model/dsr-errorbuff.h @@ -55,7 +55,7 @@ public: * \param exp expiration time * \param p protocol number */ - DsrErrorBuffEntry (Ptr pa = 0, Ipv4Address d = Ipv4Address (), Ipv4Address s = Ipv4Address (), + DsrErrorBuffEntry (Ptr pa = nullptr, Ipv4Address d = Ipv4Address (), Ipv4Address s = Ipv4Address (), Ipv4Address n = Ipv4Address (), Time exp = Simulator::Now (), uint8_t p = 0) : m_packet (pa), m_dst (d), diff --git a/src/dsr/model/dsr-network-queue.h b/src/dsr/model/dsr-network-queue.h index 8690eb425..271eace86 100644 --- a/src/dsr/model/dsr-network-queue.h +++ b/src/dsr/model/dsr-network-queue.h @@ -62,8 +62,8 @@ public: * \param exp expiration time * \param r Route */ - DsrNetworkQueueEntry (Ptr pa = 0, Ipv4Address s = Ipv4Address (), Ipv4Address n = Ipv4Address (), - Time exp = Simulator::Now (), Ptr r = 0) + DsrNetworkQueueEntry (Ptr pa = nullptr, Ipv4Address s = Ipv4Address (), Ipv4Address n = Ipv4Address (), + Time exp = Simulator::Now (), Ptr r = nullptr) : m_packet (pa), m_srcAddr (s), m_nextHopAddr (n), diff --git a/src/dsr/model/dsr-options.cc b/src/dsr/model/dsr-options.cc index e07937682..302fbb6ab 100644 --- a/src/dsr/model/dsr-options.cc +++ b/src/dsr/model/dsr-options.cc @@ -373,7 +373,7 @@ Ptr DsrOptions::GetNodeWithAddress (Ipv4Address ipv4Address) return node; } } - return 0; + return nullptr; } NS_OBJECT_ENSURE_REGISTERED (DsrOptionPad1); diff --git a/src/dsr/model/dsr-passive-buff.h b/src/dsr/model/dsr-passive-buff.h index f0f40afb4..a0b268776 100644 --- a/src/dsr/model/dsr-passive-buff.h +++ b/src/dsr/model/dsr-passive-buff.h @@ -58,7 +58,7 @@ public: * \param exp expiration time * \param p protocol number */ - DsrPassiveBuffEntry (Ptr pa = 0, Ipv4Address d = Ipv4Address (), Ipv4Address s = Ipv4Address (), + DsrPassiveBuffEntry (Ptr pa = nullptr, Ipv4Address d = Ipv4Address (), Ipv4Address s = Ipv4Address (), Ipv4Address n = Ipv4Address (), uint16_t i = 0, uint16_t f = 0, uint8_t seg = 0, Time exp = Simulator::Now (), uint8_t p = 0) : m_packet (pa), diff --git a/src/dsr/model/dsr-rcache.cc b/src/dsr/model/dsr-rcache.cc index f943544f5..38a4d06c7 100644 --- a/src/dsr/model/dsr-rcache.cc +++ b/src/dsr/model/dsr-rcache.cc @@ -1228,7 +1228,7 @@ DsrRouteCache::LookupMacAddress (Ipv4Address addr) i != m_arp.end (); ++i) { ArpCache::Entry * entry = (*i)->Lookup (addr); - if (entry != 0 && (entry->IsAlive () || entry->IsPermanent ()) && !entry->IsExpired ()) + if (entry != nullptr && (entry->IsAlive () || entry->IsPermanent ()) && !entry->IsExpired ()) { hwaddr = Mac48Address::ConvertFrom (entry->GetMacAddress ()); break; diff --git a/src/dsr/model/dsr-rcache.h b/src/dsr/model/dsr-rcache.h index bfa7f3377..bcfef5872 100644 --- a/src/dsr/model/dsr-rcache.h +++ b/src/dsr/model/dsr-rcache.h @@ -343,7 +343,7 @@ public: /* * Verify if neither the entry are not 0 and they equal to each other */ - if (((*i) == 0) || ((*j) == 0)) + if (((*i) == nullptr) || ((*j) == nullptr)) { return false; } diff --git a/src/dsr/model/dsr-routing.cc b/src/dsr/model/dsr-routing.cc index 429bda071..dc164c6aa 100644 --- a/src/dsr/model/dsr-routing.cc +++ b/src/dsr/model/dsr-routing.cc @@ -114,20 +114,20 @@ TypeId DsrRouting::GetTypeId () .AddAttribute ("RouteCache", "The route cache for saving routes from " "route discovery process.", - PointerValue (0), + PointerValue (nullptr), MakePointerAccessor (&DsrRouting::SetRouteCache, &DsrRouting::GetRouteCache), MakePointerChecker ()) .AddAttribute ("RreqTable", "The request table to manage route requests.", - PointerValue (0), + PointerValue (nullptr), MakePointerAccessor (&DsrRouting::SetRequestTable, &DsrRouting::GetRequestTable), MakePointerChecker ()) .AddAttribute ("PassiveBuffer", "The passive buffer to manage " "promisucously received passive ack.", - PointerValue (0), + PointerValue (nullptr), MakePointerAccessor (&DsrRouting::SetPassiveBuffer, &DsrRouting::GetPassiveBuffer), MakePointerChecker ()) @@ -549,7 +549,7 @@ void DsrRouting::DoDispose () { NS_LOG_FUNCTION_NOARGS (); - m_node = 0; + m_node = nullptr; for (uint32_t i = 0; i < m_ipv4->GetNInterfaces (); i++) { // Disable layer 2 link state monitoring (if possible) @@ -640,7 +640,7 @@ DsrRouting::GetNodeWithAddress (Ipv4Address ipv4Address) return node; } } - return 0; + return nullptr; } bool DsrRouting::IsLinkCache () @@ -704,7 +704,7 @@ DsrRouting::GetIPfromMAC (Mac48Address address) return ipv4->GetAddress (1, 0).GetLocal (); } } - return 0; + return nullptr; } void DsrRouting::PrintVector (std::vector& vec) @@ -2867,7 +2867,7 @@ DsrRouting::SendErrorRequest (DsrOptionRerrUnreachHeader &rerr, uint8_t protocol Ptr packet = Create (); Ipv4Address originalDst = rerr.GetOriginalDst (); // Create an empty route ptr - Ptr route = 0; + Ptr route = nullptr; /* * Construct the route request option header */ @@ -3130,7 +3130,7 @@ DsrRouting::SendRequest (Ptr packet, //m_downTarget (packet, source, m_broadcast, GetProtocolNumber (), 0); /// \todo New DsrNetworkQueueEntry - DsrNetworkQueueEntry newEntry (packet, source, m_broadcast, Simulator::Now (), 0); + DsrNetworkQueueEntry newEntry (packet, source, m_broadcast, Simulator::Now (), nullptr); if (dsrNetworkQueue->Enqueue (newEntry)) { Scheduler (priority); @@ -3560,7 +3560,7 @@ Ptr DsrRouting::GetOption (int optionNumber) return *i; } } - return 0; + return nullptr; } } /* namespace dsr */ } /* namespace ns3 */ diff --git a/src/dsr/model/dsr-rreq-table.cc b/src/dsr/model/dsr-rreq-table.cc index 666b29f57..8a12c1223 100644 --- a/src/dsr/model/dsr-rreq-table.cc +++ b/src/dsr/model/dsr-rreq-table.cc @@ -220,7 +220,7 @@ DsrRreqTable::FindUnidirectional (Ipv4Address neighbor) return &(*i); } } - return NULL; + return nullptr; } bool diff --git a/src/dsr/model/dsr-rsendbuff.h b/src/dsr/model/dsr-rsendbuff.h index 4376d2a1d..3d74a21a0 100644 --- a/src/dsr/model/dsr-rsendbuff.h +++ b/src/dsr/model/dsr-rsendbuff.h @@ -53,7 +53,7 @@ public: * \param exp expiration time * \param p protocol number */ - DsrSendBuffEntry (Ptr pa = 0, Ipv4Address d = Ipv4Address (), + DsrSendBuffEntry (Ptr pa = nullptr, Ipv4Address d = Ipv4Address (), Time exp = Simulator::Now (), uint8_t p = 0) : m_packet (pa), m_dst (d), diff --git a/src/energy/model/energy-source.cc b/src/energy/model/energy-source.cc index 83d4a9a4e..5eb2b8191 100644 --- a/src/energy/model/energy-source.cc +++ b/src/energy/model/energy-source.cc @@ -230,7 +230,7 @@ EnergySource::BreakDeviceEnergyModelRefCycle () NS_LOG_FUNCTION (this); m_models.Clear (); m_harvesters.clear (); - m_node = NULL; + m_node = nullptr; } } // namespace ns3 diff --git a/src/energy/model/simple-device-energy-model.cc b/src/energy/model/simple-device-energy-model.cc index e07a226fe..9ec38d341 100644 --- a/src/energy/model/simple-device-energy-model.cc +++ b/src/energy/model/simple-device-energy-model.cc @@ -50,7 +50,7 @@ SimpleDeviceEnergyModel::SimpleDeviceEnergyModel () NS_LOG_FUNCTION (this); m_lastUpdateTime = Seconds (0.0); m_actualCurrentA = 0.0; - m_source = 0; + m_source = nullptr; } SimpleDeviceEnergyModel::~SimpleDeviceEnergyModel () @@ -120,7 +120,7 @@ void SimpleDeviceEnergyModel::DoDispose () { NS_LOG_FUNCTION (this); - m_source = 0; + m_source = nullptr; } double diff --git a/src/energy/test/li-ion-energy-source-test.cc b/src/energy/test/li-ion-energy-source-test.cc index a98fc128c..e85e7296b 100644 --- a/src/energy/test/li-ion-energy-source-test.cc +++ b/src/energy/test/li-ion-energy-source-test.cc @@ -53,7 +53,7 @@ LiIonEnergyTestCase::LiIonEnergyTestCase () LiIonEnergyTestCase::~LiIonEnergyTestCase () { - m_node = 0; + m_node = nullptr; } void diff --git a/src/fd-net-device/helper/creator-utils.cc b/src/fd-net-device/helper/creator-utils.cc index 81b21a2c0..8b6450789 100644 --- a/src/fd-net-device/helper/creator-utils.cc +++ b/src/fd-net-device/helper/creator-utils.cc @@ -128,7 +128,7 @@ SendSocket (const char *path, int fd, const int magic_number) // for. // struct msghdr msg; - msg.msg_name = 0; + msg.msg_name = nullptr; msg.msg_namelen = 0; msg.msg_iov = &iov; msg.msg_iovlen = 1; diff --git a/src/fd-net-device/helper/emu-fd-net-device-helper.cc b/src/fd-net-device/helper/emu-fd-net-device-helper.cc index d80c54905..15d02881d 100644 --- a/src/fd-net-device/helper/emu-fd-net-device-helper.cc +++ b/src/fd-net-device/helper/emu-fd-net-device-helper.cc @@ -298,7 +298,7 @@ EmuFdNetDeviceHelper::CreateFileDescriptor () const status = ::execlp (RAW_SOCK_CREATOR, RAW_SOCK_CREATOR, // argv[0] (filename) oss.str ().c_str (), // argv[1] (-pcmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) diff --git a/src/fd-net-device/helper/raw-sock-creator.cc b/src/fd-net-device/helper/raw-sock-creator.cc index b72b75bef..9ff1b93c3 100644 --- a/src/fd-net-device/helper/raw-sock-creator.cc +++ b/src/fd-net-device/helper/raw-sock-creator.cc @@ -43,7 +43,7 @@ int main (int argc, char *argv[]) { int c; - char *path = NULL; + char *path = nullptr; opterr = 0; @@ -71,7 +71,7 @@ main (int argc, char *argv[]) // us. We see it here as the "path" string. We can't do anything useful // unless we have that string. // - ABORT_IF (path == NULL, "path is a required argument", 0); + ABORT_IF (path == nullptr, "path is a required argument", 0); LOG ("Provided path is \"" << path << "\""); // // The whole reason for all of the hoops we went through to call out to this diff --git a/src/fd-net-device/helper/tap-device-creator.cc b/src/fd-net-device/helper/tap-device-creator.cc index 008adf5f1..be5e869d1 100644 --- a/src/fd-net-device/helper/tap-device-creator.cc +++ b/src/fd-net-device/helper/tap-device-creator.cc @@ -292,12 +292,12 @@ int main (int argc, char *argv[]) { int c; - char *dev = NULL; - char *ip4 = NULL; - char *ip6 = NULL; - char *mac = NULL; - char *netmask = NULL; - char *path = NULL; + char *dev = nullptr; + char *ip4 = nullptr; + char *ip6 = nullptr; + char *mac = nullptr; + char *netmask = nullptr; + char *path = nullptr; int tap = false; int pi = false; int prefix = -1; @@ -352,10 +352,10 @@ main (int argc, char *argv[]) // allocating. This address is allocated in the simulation and assigned to // the tap bridge. This address is given in ip. // - ABORT_IF (ip4 == NULL && ip6 == NULL, "IP Address is a required argument", 0); + ABORT_IF (ip4 == nullptr && ip6 == nullptr, "IP Address is a required argument", 0); if (ip4) { - ABORT_IF (netmask == NULL, "Net mask is a required argument", 0); + ABORT_IF (netmask == nullptr, "Net mask is a required argument", 0); LOG ("Provided IP v4 Address is \"" << ip4 << "\""); LOG ("Provided IP v4 Net Mask is \"" << netmask << "\""); } @@ -372,7 +372,7 @@ main (int argc, char *argv[]) // the bridged device. This allows packets addressed to the bridged device // to appear in the Linux host as if they were received there. // - ABORT_IF (mac == NULL, "MAC Address is a required argument", 0); + ABORT_IF (mac == nullptr, "MAC Address is a required argument", 0); LOG ("Provided MAC Address is \"" << mac << "\""); // @@ -406,7 +406,7 @@ main (int argc, char *argv[]) // us. We see it here as the "path" string. We can't do anything useful // unless we have that string. // - ABORT_IF (path == NULL, "path is a required argument", 0); + ABORT_IF (path == nullptr, "path is a required argument", 0); LOG ("Provided path is \"" << path << "\""); // diff --git a/src/fd-net-device/helper/tap-fd-net-device-helper.cc b/src/fd-net-device/helper/tap-fd-net-device-helper.cc index 3cc4fbd38..404e72162 100644 --- a/src/fd-net-device/helper/tap-fd-net-device-helper.cc +++ b/src/fd-net-device/helper/tap-fd-net-device-helper.cc @@ -273,7 +273,7 @@ TapFdNetDeviceHelper::CreateFileDescriptor () const ossMode.str ().c_str (), // argv[7] (-t ) ossPI.str ().c_str (), // argv[8] (-h ) ossPath.str ().c_str (), // argv[9] (-p) - (char *)NULL); + (char *)nullptr); // // If the execlp successfully completes, it never returns. If it returns it failed or the OS is @@ -353,7 +353,7 @@ TapFdNetDeviceHelper::CreateFileDescriptor () const // data we expect to receive and point it to buffer. // struct msghdr msg; - msg.msg_name = 0; + msg.msg_name = nullptr; msg.msg_namelen = 0; msg.msg_iov = &iov; msg.msg_iovlen = 1; @@ -374,7 +374,7 @@ TapFdNetDeviceHelper::CreateFileDescriptor () const // one we're interested in. // struct cmsghdr *cmsg; - for (cmsg = CMSG_FIRSTHDR (&msg); cmsg != NULL; cmsg = CMSG_NXTHDR (&msg, cmsg)) + for (cmsg = CMSG_FIRSTHDR (&msg); cmsg != nullptr; cmsg = CMSG_NXTHDR (&msg, cmsg)) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) diff --git a/src/fd-net-device/model/fd-net-device.cc b/src/fd-net-device/model/fd-net-device.cc index 3be52939b..a9269de03 100644 --- a/src/fd-net-device/model/fd-net-device.cc +++ b/src/fd-net-device/model/fd-net-device.cc @@ -61,14 +61,14 @@ FdReader::Data FdNetDeviceFdReader::DoRead () NS_LOG_FUNCTION (this); uint8_t *buf = (uint8_t *)malloc (m_bufferSize); - NS_ABORT_MSG_IF (buf == 0, "malloc() failed"); + NS_ABORT_MSG_IF (buf == nullptr, "malloc() failed"); NS_LOG_LOGIC ("Calling read on fd " << m_fd); ssize_t len = read (m_fd, buf, m_bufferSize); if (len <= 0) { free (buf); - buf = 0; + buf = nullptr; len = 0; } NS_LOG_LOGIC ("Read " << len << " bytes on fd " << m_fd); @@ -166,12 +166,12 @@ FdNetDevice::GetTypeId () } FdNetDevice::FdNetDevice () - : m_node (0), + : m_node (nullptr), m_ifIndex (0), // Defaults to Ethernet v2 MTU m_mtu (1500), m_fd (-1), - m_fdReader (0), + m_fdReader (nullptr), m_isBroadcast (true), m_isMulticast (false), m_startEvent (), @@ -287,7 +287,7 @@ FdNetDevice::StopDevice () if (m_fdReader) { m_fdReader->Stop (); - m_fdReader = 0; + m_fdReader = nullptr; } if (m_fd != -1) @@ -330,7 +330,7 @@ FdNetDevice::ReceiveCallback (uint8_t *buf, ssize_t len) struct timespec time = { 0, 100000000L }; // 100 ms - nanosleep (&time, NULL); + nanosleep (&time, nullptr); } else { @@ -419,7 +419,7 @@ FdNetDevice::ForwardUp () { NS_LOG_FUNCTION (this); - uint8_t *buf = 0; + uint8_t *buf = nullptr; ssize_t len = 0; if (m_pendingQueue.empty()) @@ -450,7 +450,7 @@ FdNetDevice::ForwardUp () // Ptr packet = Create (reinterpret_cast (buf), len); FreeBuffer (buf); - buf = 0; + buf = nullptr; // // Trace sinks will expect complete packets, not packets without some of the @@ -703,7 +703,7 @@ FdNetDevice::GetIfIndex () const Ptr FdNetDevice::GetChannel () const { - return NULL; + return nullptr; } bool diff --git a/src/flow-monitor/helper/flow-monitor-helper.cc b/src/flow-monitor/helper/flow-monitor-helper.cc index 9f66f625c..2efaef356 100644 --- a/src/flow-monitor/helper/flow-monitor-helper.cc +++ b/src/flow-monitor/helper/flow-monitor-helper.cc @@ -43,9 +43,9 @@ FlowMonitorHelper::~FlowMonitorHelper () if (m_flowMonitor) { m_flowMonitor->Dispose (); - m_flowMonitor = 0; - m_flowClassifier4 = 0; - m_flowClassifier6 = 0; + m_flowMonitor = nullptr; + m_flowClassifier4 = nullptr; + m_flowClassifier6 = nullptr; } } diff --git a/src/flow-monitor/model/flow-monitor.cc b/src/flow-monitor/model/flow-monitor.cc index c089832fb..3a7a2e62e 100644 --- a/src/flow-monitor/model/flow-monitor.cc +++ b/src/flow-monitor/model/flow-monitor.cc @@ -95,12 +95,12 @@ FlowMonitor::DoDispose () iter != m_classifiers.end (); iter ++) { - *iter = 0; + *iter = nullptr; } for (uint32_t i = 0; i < m_flowProbes.size (); i++) { m_flowProbes[i]->Dispose (); - m_flowProbes[i] = 0; + m_flowProbes[i] = nullptr; } Object::DoDispose (); } diff --git a/src/flow-monitor/model/flow-probe.cc b/src/flow-monitor/model/flow-probe.cc index 9651a5d5e..ddb32515b 100644 --- a/src/flow-monitor/model/flow-probe.cc +++ b/src/flow-monitor/model/flow-probe.cc @@ -49,7 +49,7 @@ FlowProbe::FlowProbe (Ptr flowMonitor) void FlowProbe::DoDispose () { - m_flowMonitor = 0; + m_flowMonitor = nullptr; Object::DoDispose (); } diff --git a/src/flow-monitor/model/ipv4-flow-probe.cc b/src/flow-monitor/model/ipv4-flow-probe.cc index 4d7475d24..9a13ce541 100644 --- a/src/flow-monitor/model/ipv4-flow-probe.cc +++ b/src/flow-monitor/model/ipv4-flow-probe.cc @@ -282,8 +282,8 @@ Ipv4FlowProbe::GetTypeId () void Ipv4FlowProbe::DoDispose () { - m_ipv4 = 0; - m_classifier = 0; + m_ipv4 = nullptr; + m_classifier = nullptr; FlowProbe::DoDispose (); } diff --git a/src/internet-apps/model/dhcp-client.cc b/src/internet-apps/model/dhcp-client.cc index 0b84a1ea0..8f1a8951f 100644 --- a/src/internet-apps/model/dhcp-client.cc +++ b/src/internet-apps/model/dhcp-client.cc @@ -77,7 +77,7 @@ DhcpClient::DhcpClient () { NS_LOG_FUNCTION (this); m_server = Ipv4Address::GetAny (); - m_socket = 0; + m_socket = nullptr; m_refreshEvent = EventId (); m_requestEvent = EventId (); m_discoverEvent = EventId (); @@ -93,7 +93,7 @@ DhcpClient::DhcpClient (Ptr netDevice) NS_LOG_FUNCTION (this << netDevice); m_device = netDevice; m_server = Ipv4Address::GetAny (); - m_socket = 0; + m_socket = nullptr; m_refreshEvent = EventId (); m_requestEvent = EventId (); m_discoverEvent = EventId (); @@ -130,7 +130,7 @@ DhcpClient::DoDispose () { NS_LOG_FUNCTION (this); - m_device = 0; + m_device = nullptr; // Stop all the timers m_refreshEvent.Cancel (); diff --git a/src/internet-apps/model/dhcp-server.cc b/src/internet-apps/model/dhcp-server.cc index e21a46f72..a9773ed9f 100644 --- a/src/internet-apps/model/dhcp-server.cc +++ b/src/internet-apps/model/dhcp-server.cc @@ -211,7 +211,7 @@ void DhcpServer::NetHandler (Ptr socket) NS_LOG_FUNCTION (this << socket); DhcpHeader header; - Ptr packet = 0; + Ptr packet = nullptr; Address from; packet = m_socket->RecvFrom (from); @@ -246,7 +246,7 @@ void DhcpServer::SendOffer (Ptr iDev, DhcpHeader header, InetSocketAd DhcpHeader newDhcpHeader; Address sourceChaddr = header.GetChaddr (); uint32_t tran = header.GetTran (); - Ptr packet = 0; + Ptr packet = nullptr; Ipv4Address offeredAddress; NS_LOG_INFO ("DHCP DISCOVER from: " << from.GetIpv4 () << " source port: " << from.GetPort ()); @@ -330,7 +330,7 @@ void DhcpServer::SendAck (Ptr iDev, DhcpHeader header, InetSocketAddr DhcpHeader newDhcpHeader; Address sourceChaddr = header.GetChaddr (); uint32_t tran = header.GetTran (); - Ptr packet = 0; + Ptr packet = nullptr; Ipv4Address address = header.GetReq (); NS_LOG_INFO ("DHCP REQUEST from: " << from.GetIpv4 () << diff --git a/src/internet-apps/model/ping6.cc b/src/internet-apps/model/ping6.cc index ff6291d9f..a8078c35c 100644 --- a/src/internet-apps/model/ping6.cc +++ b/src/internet-apps/model/ping6.cc @@ -79,7 +79,7 @@ Ping6::Ping6 () { NS_LOG_FUNCTION (this); m_sent = 0; - m_socket = 0; + m_socket = nullptr; m_seq = 0; m_ipInterfaceIndex = 0; m_ifIndex = 0; @@ -89,7 +89,7 @@ Ping6::Ping6 () Ping6::~Ping6 () { NS_LOG_FUNCTION (this); - m_socket = 0; + m_socket = nullptr; } void Ping6::DoDispose () @@ -250,7 +250,7 @@ void Ping6::HandleRead (Ptr socket) { NS_LOG_FUNCTION (this << socket); - Ptr packet=0; + Ptr packet=nullptr; Address from; while ((packet = socket->RecvFrom (from))) { diff --git a/src/internet-apps/model/radvd-interface.cc b/src/internet-apps/model/radvd-interface.cc index b92acc0eb..c2c8fea33 100644 --- a/src/internet-apps/model/radvd-interface.cc +++ b/src/internet-apps/model/radvd-interface.cc @@ -86,7 +86,7 @@ RadvdInterface::~RadvdInterface () /* clear prefixes */ for (RadvdPrefixListI it = m_prefixes.begin (); it != m_prefixes.end (); ++it) { - (*it) = 0; + (*it) = nullptr; } m_prefixes.clear (); } diff --git a/src/internet-apps/model/radvd.cc b/src/internet-apps/model/radvd.cc index 5fc095db7..91b34b414 100644 --- a/src/internet-apps/model/radvd.cc +++ b/src/internet-apps/model/radvd.cc @@ -75,10 +75,10 @@ Radvd::~Radvd () NS_LOG_FUNCTION (this); for (RadvdInterfaceListI it = m_configurations.begin (); it != m_configurations.end (); ++it) { - *it = 0; + *it = nullptr; } m_configurations.clear (); - m_recvSocket = 0; + m_recvSocket = nullptr; } void Radvd::DoDispose () @@ -86,12 +86,12 @@ void Radvd::DoDispose () NS_LOG_FUNCTION (this); m_recvSocket->Close (); - m_recvSocket = 0; + m_recvSocket = nullptr; for (SocketMapI it = m_sendSockets.begin (); it != m_sendSockets.end (); ++it) { it->second->Close (); - it->second = 0; + it->second = nullptr; } Application::DoDispose (); @@ -285,7 +285,7 @@ void Radvd::Send (Ptr config, Ipv6Address dst, bool reschedule) void Radvd::HandleRead (Ptr socket) { NS_LOG_FUNCTION (this << socket); - Ptr packet = 0; + Ptr packet = nullptr; Address from; while ((packet = socket->RecvFrom (from))) diff --git a/src/internet-apps/model/v4ping.cc b/src/internet-apps/model/v4ping.cc index 3f15c9584..08fada3cb 100644 --- a/src/internet-apps/model/v4ping.cc +++ b/src/internet-apps/model/v4ping.cc @@ -68,7 +68,7 @@ V4Ping::GetTypeId () V4Ping::V4Ping () : m_interval (Seconds (1)), m_size (56), - m_socket (0), + m_socket (nullptr), m_seq (0), m_verbose (false), m_recv (0) @@ -90,7 +90,7 @@ V4Ping::DoDispose () StopApplication (); } - m_socket = 0; + m_socket = nullptr; Application::DoDispose (); } diff --git a/src/internet-apps/model/v4traceroute.cc b/src/internet-apps/model/v4traceroute.cc index 8cfd15680..5334a52c9 100644 --- a/src/internet-apps/model/v4traceroute.cc +++ b/src/internet-apps/model/v4traceroute.cc @@ -88,7 +88,7 @@ V4TraceRoute::GetTypeId () V4TraceRoute::V4TraceRoute () : m_interval (Seconds (0)), m_size (56), - m_socket (0), + m_socket (nullptr), m_seq (0), m_verbose (true), m_probeCount (0), @@ -193,7 +193,7 @@ V4TraceRoute::DoDispose () StopApplication (); } - m_socket = 0; + m_socket = nullptr; Application::DoDispose (); } diff --git a/src/internet/helper/internet-stack-helper.cc b/src/internet/helper/internet-stack-helper.cc index 8d9f4a666..ef20c096b 100644 --- a/src/internet/helper/internet-stack-helper.cc +++ b/src/internet/helper/internet-stack-helper.cc @@ -104,8 +104,8 @@ static InterfaceFileMapIpv6 g_interfaceFileMapIpv6; //!< A mapping of Ipv6/inter static InterfaceStreamMapIpv6 g_interfaceStreamMapIpv6; //!< A mapping of Ipv6/interface pairs to pcap files InternetStackHelper::InternetStackHelper () - : m_routing (0), - m_routingv6 (0), + : m_routing (nullptr), + m_routingv6 (nullptr), m_ipv4Enabled (true), m_ipv6Enabled (true), m_ipv4ArpJitterEnabled (true), @@ -163,9 +163,9 @@ void InternetStackHelper::Reset () { delete m_routing; - m_routing = 0; + m_routing = nullptr; delete m_routingv6; - m_routingv6 = 0; + m_routingv6 = nullptr; m_ipv4Enabled = true; m_ipv6Enabled = true; m_ipv4ArpJitterEnabled = true; diff --git a/src/internet/helper/ipv4-static-routing-helper.cc b/src/internet/helper/ipv4-static-routing-helper.cc index 9a849b5ac..b342f5616 100644 --- a/src/internet/helper/ipv4-static-routing-helper.cc +++ b/src/internet/helper/ipv4-static-routing-helper.cc @@ -81,7 +81,7 @@ Ipv4StaticRoutingHelper::GetStaticRouting (Ptr ipv4) const } } NS_LOG_LOGIC ("Static routing not found"); - return 0; + return nullptr; } void diff --git a/src/internet/helper/ipv6-interface-container.cc b/src/internet/helper/ipv6-interface-container.cc index bdc4ccee2..217a81913 100644 --- a/src/internet/helper/ipv6-interface-container.cc +++ b/src/internet/helper/ipv6-interface-container.cc @@ -104,7 +104,7 @@ void Ipv6InterfaceContainer::SetDefaultRouteInAllNodes (uint32_t router) { if (other != router) { - Ptr routing = 0; + Ptr routing = nullptr; Ipv6StaticRoutingHelper routingHelper; ipv6 = m_interfaces[other].first; @@ -143,7 +143,7 @@ void Ipv6InterfaceContainer::SetDefaultRouteInAllNodes (Ipv6Address routerAddres { if (other != routerIndex) { - Ptr routing = 0; + Ptr routing = nullptr; Ipv6StaticRoutingHelper routingHelper; Ptr ipv6 = m_interfaces[other].first; @@ -164,7 +164,7 @@ void Ipv6InterfaceContainer::SetDefaultRoute (uint32_t i, uint32_t router) Ipv6Address routerAddress = GetLinkLocalAddress (router); NS_ASSERT_MSG (routerAddress != Ipv6Address::GetAny (), "No link-local address found on router, aborting"); - Ptr routing = 0; + Ptr routing = nullptr; Ipv6StaticRoutingHelper routingHelper; routing = routingHelper.GetStaticRouting (ipv6); @@ -201,7 +201,7 @@ void Ipv6InterfaceContainer::SetDefaultRoute (uint32_t i, Ipv6Address routerAddr Ptr ipv6 = m_interfaces[i].first; Ipv6Address routerLinkLocalAddress = GetLinkLocalAddress (routerIndex); - Ptr routing = 0; + Ptr routing = nullptr; Ipv6StaticRoutingHelper routingHelper; routing = routingHelper.GetStaticRouting (ipv6); diff --git a/src/internet/helper/ipv6-static-routing-helper.cc b/src/internet/helper/ipv6-static-routing-helper.cc index 4fb70b7aa..0e970873e 100644 --- a/src/internet/helper/ipv6-static-routing-helper.cc +++ b/src/internet/helper/ipv6-static-routing-helper.cc @@ -82,7 +82,7 @@ Ipv6StaticRoutingHelper::GetStaticRouting (Ptr ipv6) const } } NS_LOG_LOGIC ("Static routing not found"); - return 0; + return nullptr; } void diff --git a/src/internet/model/arp-cache.cc b/src/internet/model/arp-cache.cc index da1e88467..d0631e424 100644 --- a/src/internet/model/arp-cache.cc +++ b/src/internet/model/arp-cache.cc @@ -85,8 +85,8 @@ ArpCache::GetTypeId () } ArpCache::ArpCache () - : m_device (0), - m_interface (0) + : m_device (nullptr), + m_interface (nullptr) { NS_LOG_FUNCTION (this); } @@ -101,8 +101,8 @@ ArpCache::DoDispose () { NS_LOG_FUNCTION (this); Flush (); - m_device = 0; - m_interface = 0; + m_device = nullptr; + m_interface = nullptr; if (!m_waitReplyTimer.IsRunning ()) { m_waitReplyTimer.Cancel (); @@ -200,7 +200,7 @@ ArpCache::HandleWaitReplyTimeout () for (CacheI i = m_arpCache.begin (); i != m_arpCache.end (); i++) { entry = (*i).second; - if (entry != 0 && entry->IsWaitReply ()) + if (entry != nullptr && entry->IsWaitReply ()) { if (entry->GetRetries () < m_maxRetries) { @@ -344,7 +344,7 @@ ArpCache::Lookup (Ipv4Address to) { return it->second; } - return 0; + return nullptr; } ArpCache::Entry * @@ -550,7 +550,7 @@ ArpCache::Entry::DequeuePending () if (m_pending.empty ()) { Ipv4Header h; - return Ipv4PayloadHeaderPair (0, h); + return Ipv4PayloadHeaderPair (nullptr, h); } else { diff --git a/src/internet/model/arp-l3-protocol.cc b/src/internet/model/arp-l3-protocol.cc index a555b58ff..584d4985b 100644 --- a/src/internet/model/arp-l3-protocol.cc +++ b/src/internet/model/arp-l3-protocol.cc @@ -73,7 +73,7 @@ ArpL3Protocol::GetTypeId () } ArpL3Protocol::ArpL3Protocol () - : m_tc (0) + : m_tc (nullptr) { NS_LOG_FUNCTION (this); } @@ -136,8 +136,8 @@ ArpL3Protocol::DoDispose () cache->Dispose (); } m_cacheList.clear (); - m_node = 0; - m_tc = 0; + m_node = nullptr; + m_tc = nullptr; Object::DoDispose (); } @@ -168,7 +168,7 @@ ArpL3Protocol::FindCache (Ptr device) } NS_ASSERT (false); // quiet compiler - return 0; + return nullptr; } void @@ -234,7 +234,7 @@ ArpL3Protocol::Receive (Ptr device, Ptr p, uint16_t pro found = true; Ipv4Address from = arp.GetSourceIpv4Address (); ArpCache::Entry *entry = cache->Lookup (from); - if (entry != 0) + if (entry != nullptr) { if (entry->IsWaitReply ()) { @@ -285,7 +285,7 @@ ArpL3Protocol::Lookup (Ptr packet, const Ipv4Header & ipHeader, Ipv4Addr { NS_LOG_FUNCTION (this << packet << destination << device << cache << hardwareDestination); ArpCache::Entry *entry = cache->Lookup (destination); - if (entry != 0) + if (entry != nullptr) { if (entry->IsExpired ()) { diff --git a/src/internet/model/candidate-queue.cc b/src/internet/model/candidate-queue.cc index 2df308e9c..dd624b869 100644 --- a/src/internet/model/candidate-queue.cc +++ b/src/internet/model/candidate-queue.cc @@ -85,7 +85,7 @@ CandidateQueue::Clear () { SPFVertex *p = Pop (); delete p; - p = 0; + p = nullptr; } } @@ -107,7 +107,7 @@ CandidateQueue::Pop () NS_LOG_FUNCTION (this); if (m_candidates.empty ()) { - return 0; + return nullptr; } SPFVertex *v = m_candidates.front (); @@ -121,7 +121,7 @@ CandidateQueue::Top () const NS_LOG_FUNCTION (this); if (m_candidates.empty ()) { - return 0; + return nullptr; } return m_candidates.front (); @@ -156,7 +156,7 @@ CandidateQueue::Find (const Ipv4Address addr) const } } - return 0; + return nullptr; } void diff --git a/src/internet/model/global-route-manager-impl.cc b/src/internet/model/global-route-manager-impl.cc index b18aadf82..5cff55c14 100644 --- a/src/internet/model/global-route-manager-impl.cc +++ b/src/internet/model/global-route-manager-impl.cc @@ -87,7 +87,7 @@ operator<< (std::ostream& os, const SPFVertex::ListOfSPFVertex_t& vs) SPFVertex::SPFVertex () : m_vertexType (VertexUnknown), m_vertexId ("255.255.255.255"), - m_lsa (0), + m_lsa (nullptr), m_distanceFromRoot (SPF_INFINITY), m_rootOif (SPF_INFINITY), m_nextHop ("0.0.0.0"), @@ -159,10 +159,10 @@ SPFVertex::~SPFVertex () // p is removed from the children list when p is deleted SPFVertex* p = m_children.front (); // 'p' == 0, this child is already deleted by its other parent - if (p == 0) continue; + if (p == nullptr) continue; NS_LOG_LOGIC ("Parent vertex-" << m_vertexId << " deleting its child vertex-" << p->GetVertexId ()); delete p; - p = 0; + p = nullptr; } m_children.clear (); // delete parents @@ -248,7 +248,7 @@ SPFVertex::GetParent (uint32_t i) const if (m_parents.size () <= i) { NS_LOG_LOGIC ("Index to SPFVertex's parent is out-of-range."); - return 0; + return nullptr; } ListOfSPFVertex_t::const_iterator iter = m_parents.begin (); while (i-- > 0) @@ -377,7 +377,7 @@ SPFVertex::GetChild (uint32_t n) const } } NS_ASSERT_MSG (false, "Index out of range."); - return 0; + return nullptr; } uint32_t @@ -502,7 +502,7 @@ GlobalRouteManagerLSDB::GetLSA (Ipv4Address addr) const return i->second; } } - return 0; + return nullptr; } GlobalRoutingLSA* @@ -527,7 +527,7 @@ GlobalRouteManagerLSDB::GetLSAByLinkData (Ipv4Address addr) const } } } - return 0; + return nullptr; } // --------------------------------------------------------------------------- @@ -538,7 +538,7 @@ GlobalRouteManagerLSDB::GetLSAByLinkData (Ipv4Address addr) const GlobalRouteManagerImpl::GlobalRouteManagerImpl () : - m_spfroot (0) + m_spfroot (nullptr) { NS_LOG_FUNCTION (this); m_lsdb = new GlobalRouteManagerLSDB (); @@ -747,9 +747,9 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) { NS_LOG_FUNCTION (this << v << &candidate); - SPFVertex* w = 0; - GlobalRoutingLSA* w_lsa = 0; - GlobalRoutingLinkRecord *l = 0; + SPFVertex* w = nullptr; + GlobalRoutingLSA* w_lsa = nullptr; + GlobalRoutingLinkRecord *l = nullptr; uint32_t distance = 0; uint32_t numRecordsInVertex = 0; // @@ -779,7 +779,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // shortest path calculation. // l = v->GetLSA ()->GetLinkRecord (i); - NS_ASSERT (l != 0); + NS_ASSERT (l != nullptr); if (l->GetLinkType () == GlobalRoutingLinkRecord::StubNetwork) { NS_LOG_LOGIC ("Found a Stub record to " << l->GetLinkId ()); @@ -849,7 +849,7 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) // if (v->GetLSA ()->GetLSType () == GlobalRoutingLSA::RouterLSA) { - NS_ASSERT (l != 0); + NS_ASSERT (l != nullptr); distance = v->GetDistanceFromRoot () + l->GetMetric (); } else @@ -1042,7 +1042,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( // SPFGetLink. // NS_ASSERT (l); - GlobalRoutingLinkRecord *linkRemote = 0; + GlobalRoutingLinkRecord *linkRemote = nullptr; linkRemote = SPFGetNextLink (w, v, linkRemote); // // At this point, is the Global Router Link Record describing the point- @@ -1103,7 +1103,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation ( // router. The list of next hops is then determined by // examining the destination's router-LSA... NS_ASSERT (w->GetVertexType () == SPFVertex::VertexRouter); - GlobalRoutingLinkRecord *linkRemote = 0; + GlobalRoutingLinkRecord *linkRemote = nullptr; while ((linkRemote = SPFGetNextLink (w, v, linkRemote))) { /* ...For each link in the router-LSA that points back to the @@ -1179,7 +1179,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( // If prev_link is 0, we are really looking for the first link, not the next // link. // - if (prev_link == 0) + if (prev_link == nullptr) { skip = false; found_prev_link = true; @@ -1236,7 +1236,7 @@ GlobalRouteManagerImpl::SPFGetNextLink ( } } } - return 0; + return nullptr; } // @@ -1262,7 +1262,7 @@ GlobalRouteManagerImpl::CheckForStubNode (Ipv4Address root) GlobalRoutingLSA *rlsa = m_lsdb->GetLSA (root); Ipv4Address myRouterId = rlsa->GetLinkStateId (); int transits = 0; - GlobalRoutingLinkRecord *transitLink = 0; + GlobalRoutingLinkRecord *transitLink = nullptr; for (uint32_t i = 0; i < rlsa->GetNLinkRecords (); i++) { GlobalRoutingLinkRecord *l = rlsa->GetLinkRecord (i); @@ -1500,7 +1500,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root) // possibly do it again for the next router. // delete m_spfroot; - m_spfroot = 0; + m_spfroot = nullptr; } void @@ -2197,7 +2197,7 @@ GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v) { SPFVertex* parent; // check if all parents of vertex v - if ((parent = v->GetParent (i++)) == 0) break; + if ((parent = v->GetParent (i++)) == nullptr) break; parent->AddChild (v); } } diff --git a/src/internet/model/global-router-interface.cc b/src/internet/model/global-router-interface.cc index 9e63879df..1863022e0 100644 --- a/src/internet/model/global-router-interface.cc +++ b/src/internet/model/global-router-interface.cc @@ -211,7 +211,7 @@ GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa) pDst->SetMetric (pSrc->GetMetric ()); m_linkRecords.push_back (pDst); - pDst = 0; + pDst = nullptr; } m_attachedRouters = lsa.m_attachedRouters; @@ -235,7 +235,7 @@ GlobalRoutingLSA::ClearLinkRecords () GlobalRoutingLinkRecord *p = *i; delete p; - p = 0; + p = nullptr; *i = 0; } @@ -273,7 +273,7 @@ GlobalRoutingLSA::GetLinkRecord (uint32_t n) const } } NS_ASSERT_MSG (false, "GlobalRoutingLSA::GetLinkRecord (): invalid index"); - return 0; + return nullptr; } bool @@ -546,7 +546,7 @@ void GlobalRouter::DoDispose () { NS_LOG_FUNCTION (this); - m_routingProtocol = 0; + m_routingProtocol = nullptr; for (InjectedRoutesI k = m_injectedRoutes.begin (); k != m_injectedRoutes.end (); k = m_injectedRoutes.erase (k)) @@ -568,7 +568,7 @@ GlobalRouter::ClearLSAs () GlobalRoutingLSA *p = *i; delete p; - p = 0; + p = nullptr; *i = 0; } @@ -698,7 +698,7 @@ GlobalRouter::DiscoverLSAs () NS_LOG_LOGIC ("========== LSA for node " << node->GetId () << " =========="); NS_LOG_LOGIC (*pLSA); m_LSAs.push_back (pLSA); - pLSA = 0; + pLSA = nullptr; // // Now, determine whether we need to build a NetworkLSA. This is the case if @@ -751,7 +751,7 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr nd, GlobalRoutingLSA *p NS_LOG_FUNCTION (this << nd << pLSA << &c); GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord; - NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessSingleBroadcastLink(): Can't alloc link record"); + NS_ABORT_MSG_IF (plr == nullptr, "GlobalRouter::ProcessSingleBroadcastLink(): Can't alloc link record"); // // We have some preliminaries to do to get enough information to proceed. @@ -806,7 +806,7 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr nd, GlobalRoutingLSA *p plr->SetLinkData (maskLocalAddr); plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); - plr = 0; + plr = nullptr; } else { @@ -853,7 +853,7 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr nd, GlobalRoutingLSA *p plr->SetLinkData (addrLocal); plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); - plr = 0; + plr = nullptr; } } @@ -1119,24 +1119,24 @@ GlobalRouter::ProcessPointToPointLink (Ptr ndLocal, GlobalRoutingLSA NS_LOG_LOGIC ("Remote side interface " << interfaceRemote << " is up-- add a type 1 link"); plr = new GlobalRoutingLinkRecord; - NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record"); + NS_ABORT_MSG_IF (plr == nullptr, "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record"); plr->SetLinkType (GlobalRoutingLinkRecord::PointToPoint); plr->SetLinkId (rtrIdRemote); plr->SetLinkData (addrLocal); plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); - plr = 0; + plr = nullptr; } // Regardless of state of peer, add a type 3 link (RFC 2328: 12.4.1.1) plr = new GlobalRoutingLinkRecord; - NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record"); + NS_ABORT_MSG_IF (plr == nullptr, "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record"); plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); plr->SetLinkId (addrRemote); plr->SetLinkData (Ipv4Address (maskRemote.Get ())); // Frown plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); - plr = 0; + plr = nullptr; } void @@ -1170,7 +1170,7 @@ GlobalRouter::BuildNetworkLSAs (NetDeviceContainer c) Ipv4Mask maskLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetMask (); GlobalRoutingLSA *pLSA = new GlobalRoutingLSA; - NS_ABORT_MSG_IF (pLSA == 0, "GlobalRouter::BuildNetworkLSAs(): Can't alloc link record"); + NS_ABORT_MSG_IF (pLSA == nullptr, "GlobalRouter::BuildNetworkLSAs(): Can't alloc link record"); pLSA->SetLSType (GlobalRoutingLSA::NetworkLSA); pLSA->SetLinkStateId (addrLocal); @@ -1247,7 +1247,7 @@ GlobalRouter::BuildNetworkLSAs (NetDeviceContainer c) m_LSAs.push_back (pLSA); NS_LOG_LOGIC ("========== LSA for node " << node->GetId () << " =========="); NS_LOG_LOGIC (*pLSA); - pLSA = 0; + pLSA = nullptr; } } @@ -1622,7 +1622,7 @@ GlobalRouter::GetInjectedRoute (uint32_t index) } NS_ASSERT (false); // quiet compiler. - return 0; + return nullptr; } uint32_t @@ -1700,7 +1700,7 @@ GlobalRouter::GetAdjacent (Ptr nd, Ptr ch) const { NS_ASSERT_MSG (false, "GlobalRouter::GetAdjacent (): Wrong or confused channel?"); - return 0; + return nullptr; } } @@ -1744,7 +1744,7 @@ GlobalRouter::NetDeviceIsBridged (Ptr nd) const } } NS_LOG_LOGIC ("Net device " << nd << " is not bridged"); - return 0; + return nullptr; } // diff --git a/src/internet/model/icmpv4-l4-protocol.cc b/src/internet/model/icmpv4-l4-protocol.cc index 7213af55f..a439af27e 100644 --- a/src/internet/model/icmpv4-l4-protocol.cc +++ b/src/internet/model/icmpv4-l4-protocol.cc @@ -51,7 +51,7 @@ Icmpv4L4Protocol::GetTypeId () } Icmpv4L4Protocol::Icmpv4L4Protocol () - : m_node (0) + : m_node (nullptr) { NS_LOG_FUNCTION (this); } @@ -120,7 +120,7 @@ Icmpv4L4Protocol::SendMessage (Ptr packet, Ipv4Address dest, uint8_t typ header.SetProtocol (PROT_NUMBER); Socket::SocketErrno errno_; Ptr route; - Ptr oif (0); //specify non-zero if bound to a source address + Ptr oif (nullptr); //specify non-zero if bound to a source address route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_); if (route) { @@ -209,7 +209,7 @@ Icmpv4L4Protocol::HandleEcho (Ptr p, Icmpv4Echo echo; p->RemoveHeader (echo); reply->AddHeader (echo); - SendMessage (reply, destination, source, Icmpv4Header::ICMPV4_ECHO_REPLY, 0, 0); + SendMessage (reply, destination, source, Icmpv4Header::ICMPV4_ECHO_REPLY, 0, nullptr); } void Icmpv4L4Protocol::Forward (Ipv4Address source, Icmpv4Header icmp, @@ -295,7 +295,7 @@ void Icmpv4L4Protocol::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; + m_node = nullptr; m_downTarget.Nullify (); IpL4Protocol::DoDispose (); } diff --git a/src/internet/model/icmpv4.cc b/src/internet/model/icmpv4.cc index f73f67b5c..2bc1ebdf8 100644 --- a/src/internet/model/icmpv4.cc +++ b/src/internet/model/icmpv4.cc @@ -220,7 +220,7 @@ Icmpv4Echo::~Icmpv4Echo () { NS_LOG_FUNCTION (this); delete [] m_data; - m_data = 0; + m_data = nullptr; m_dataSize = 0; } TypeId diff --git a/src/internet/model/icmpv6-header.cc b/src/internet/model/icmpv6-header.cc index 35ab9648d..a9dabe99e 100644 --- a/src/internet/model/icmpv6-header.cc +++ b/src/internet/model/icmpv6-header.cc @@ -1058,7 +1058,7 @@ TypeId Icmpv6DestinationUnreachable::GetInstanceTypeId () const } Icmpv6DestinationUnreachable::Icmpv6DestinationUnreachable () - : m_packet (0) + : m_packet (nullptr) { NS_LOG_FUNCTION (this); SetType (ICMPV6_ERROR_DESTINATION_UNREACHABLE); @@ -1152,7 +1152,7 @@ TypeId Icmpv6TooBig::GetInstanceTypeId () const } Icmpv6TooBig::Icmpv6TooBig () - : m_packet (0), + : m_packet (nullptr), m_mtu (0) { NS_LOG_FUNCTION (this); @@ -1259,7 +1259,7 @@ TypeId Icmpv6TimeExceeded::GetInstanceTypeId () const } Icmpv6TimeExceeded::Icmpv6TimeExceeded () - : m_packet (0) + : m_packet (nullptr) { NS_LOG_FUNCTION (this); SetType (ICMPV6_ERROR_TIME_EXCEEDED); @@ -1354,7 +1354,7 @@ TypeId Icmpv6ParameterError::GetInstanceTypeId () const } Icmpv6ParameterError::Icmpv6ParameterError () - : m_packet (0), + : m_packet (nullptr), m_ptr (0) { NS_LOG_FUNCTION (this); @@ -1920,7 +1920,7 @@ TypeId Icmpv6OptionRedirected::GetInstanceTypeId () const } Icmpv6OptionRedirected::Icmpv6OptionRedirected () - : m_packet (0) + : m_packet (nullptr) { NS_LOG_FUNCTION (this); SetType (Icmpv6Header::ICMPV6_OPT_REDIRECTED); @@ -1929,7 +1929,7 @@ Icmpv6OptionRedirected::Icmpv6OptionRedirected () Icmpv6OptionRedirected::~Icmpv6OptionRedirected () { NS_LOG_FUNCTION (this); - m_packet = 0; + m_packet = nullptr; } void Icmpv6OptionRedirected::SetPacket (Ptr packet) diff --git a/src/internet/model/icmpv6-l4-protocol.cc b/src/internet/model/icmpv6-l4-protocol.cc index ba784ce3d..42264b899 100644 --- a/src/internet/model/icmpv6-l4-protocol.cc +++ b/src/internet/model/icmpv6-l4-protocol.cc @@ -134,7 +134,7 @@ TypeId Icmpv6L4Protocol::GetInstanceTypeId () const } Icmpv6L4Protocol::Icmpv6L4Protocol () - : m_node (0) + : m_node (nullptr) { NS_LOG_FUNCTION (this); } @@ -151,12 +151,12 @@ void Icmpv6L4Protocol::DoDispose () { Ptr cache = *it; cache->Dispose (); - cache = 0; + cache = nullptr; } m_cacheList.clear (); m_downTarget.Nullify (); - m_node = 0; + m_node = nullptr; IpL4Protocol::DoDispose (); } @@ -423,7 +423,7 @@ void Icmpv6L4Protocol::ReceiveLLA (Icmpv6OptionLinkLayerAddress lla, Ipv6Address { NS_LOG_FUNCTION (this << lla << src << dst << interface); Address hardwareAddress; - NdiscCache::Entry* entry = 0; + NdiscCache::Entry* entry = nullptr; Ptr cache = FindCache (interface->GetDevice ()); /* check if we have this address in our cache */ @@ -528,7 +528,7 @@ void Icmpv6L4Protocol::HandleRS (Ptr packet, Ipv6Address const &src, Ipv packet->RemoveHeader (rsHeader); Address hardwareAddress; Icmpv6OptionLinkLayerAddress lla (1); - NdiscCache::Entry* entry = 0; + NdiscCache::Entry* entry = nullptr; Ptr cache = FindCache (interface->GetDevice ()); if (src != Ipv6Address::GetAny ()) @@ -596,7 +596,7 @@ void Icmpv6L4Protocol::HandleNS (Ptr packet, Ipv6Address const &src, Ipv return; } - NdiscCache::Entry* entry = 0; + NdiscCache::Entry* entry = nullptr; Ptr cache = FindCache (interface->GetDevice ()); uint8_t flags = 0; @@ -747,7 +747,7 @@ void Icmpv6L4Protocol::HandleNA (Ptr packet, Ipv6Address const &src, Ipv Ipv6Address target = naHeader.GetIpv6Target (); Address hardwareAddress; - NdiscCache::Entry* entry = 0; + NdiscCache::Entry* entry = nullptr; Ptr cache = FindCache (interface->GetDevice ()); std::list waiting; @@ -940,7 +940,7 @@ void Icmpv6L4Protocol::HandleRedirection (Ptr packet, Ipv6Address const if (hasLla) { /* update the cache if needed */ - NdiscCache::Entry* entry = 0; + NdiscCache::Entry* entry = nullptr; Ptr cache = FindCache (interface->GetDevice ()); entry = cache->Lookup (redirTarget); @@ -1070,7 +1070,7 @@ void Icmpv6L4Protocol::SendMessage (Ptr packet, Ipv6Address src, Ipv6Add tag.SetHopLimit (ttl); packet->AddPacketTag (tag); - m_downTarget (packet, src, dst, PROT_NUMBER, 0); + m_downTarget (packet, src, dst, PROT_NUMBER, nullptr); } void Icmpv6L4Protocol::DelayedSendMessage (Ptr packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl) @@ -1088,7 +1088,7 @@ void Icmpv6L4Protocol::SendMessage (Ptr packet, Ipv6Address dst, Icmpv6H SocketIpv6HopLimitTag tag; Socket::SocketErrno err; Ptr route; - Ptr oif (0); //specify non-zero if bound to a source address + Ptr oif (nullptr); //specify non-zero if bound to a source address header.SetDestination (dst); route = ipv6->GetRoutingProtocol ()->RouteOutput (packet, header, oif, err); @@ -1486,7 +1486,7 @@ Ptr Icmpv6L4Protocol::FindCache (Ptr device) NS_ASSERT_MSG (false, "Icmpv6L4Protocol can not find a NDIS Cache for device " << device); /* quiet compiler */ - return 0; + return nullptr; } Ptr Icmpv6L4Protocol::CreateCache (Ptr device, Ptr interface) diff --git a/src/internet/model/ipv4-end-point-demux.cc b/src/internet/model/ipv4-end-point-demux.cc index 1da374c05..2dbfdc943 100644 --- a/src/internet/model/ipv4-end-point-demux.cc +++ b/src/internet/model/ipv4-end-point-demux.cc @@ -83,7 +83,7 @@ Ipv4EndPointDemux::Allocate () if (port == 0) { NS_LOG_WARN ("Ephemeral port allocation failed."); - return 0; + return nullptr; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (Ipv4Address::GetAny (), port); m_endPoints.push_back (endPoint); @@ -99,7 +99,7 @@ Ipv4EndPointDemux::Allocate (Ipv4Address address) if (port == 0) { NS_LOG_WARN ("Ephemeral port allocation failed."); - return 0; + return nullptr; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (address, port); m_endPoints.push_back (endPoint); @@ -119,10 +119,10 @@ Ipv4EndPoint * Ipv4EndPointDemux::Allocate (Ptr boundNetDevice, Ipv4Address address, uint16_t port) { NS_LOG_FUNCTION (this << address << port << boundNetDevice); - if (LookupLocal (boundNetDevice, address, port) || LookupLocal (0, address, port)) + if (LookupLocal (boundNetDevice, address, port) || LookupLocal (nullptr, address, port)) { NS_LOG_WARN ("Duplicated endpoint."); - return 0; + return nullptr; } Ipv4EndPoint *endPoint = new Ipv4EndPoint (address, port); m_endPoints.push_back (endPoint); @@ -145,7 +145,7 @@ Ipv4EndPointDemux::Allocate (Ptr boundNetDevice, ((*i)->GetBoundNetDevice () == boundNetDevice || !(*i)->GetBoundNetDevice ())) { NS_LOG_WARN ("Duplicated endpoint."); - return 0; + return nullptr; } } Ipv4EndPoint *endPoint = new Ipv4EndPoint (localAddress, localPort); @@ -346,7 +346,7 @@ Ipv4EndPointDemux::SimpleLookup (Ipv4Address daddr, // this code is a copy/paste version of an old BSD ip stack lookup // function. uint32_t genericity = 3; - Ipv4EndPoint *generic = 0; + Ipv4EndPoint *generic = nullptr; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { if ((*i)->GetLocalPort () != dport) diff --git a/src/internet/model/ipv4-global-routing.cc b/src/internet/model/ipv4-global-routing.cc index 8d9f609ca..b839d0a16 100644 --- a/src/internet/model/ipv4-global-routing.cc +++ b/src/internet/model/ipv4-global-routing.cc @@ -141,7 +141,7 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest, Ptr oif) { NS_LOG_FUNCTION (this << dest << oif); NS_LOG_LOGIC ("Looking for route for destination " << dest); - Ptr rtentry = 0; + Ptr rtentry = nullptr; // store all available routes that bring packets to their destination typedef std::vector RouteVec_t; RouteVec_t allRoutes; @@ -241,7 +241,7 @@ Ipv4GlobalRouting::LookupGlobal (Ipv4Address dest, Ptr oif) } else { - return 0; + return nullptr; } } @@ -303,7 +303,7 @@ Ipv4GlobalRouting::GetRoute (uint32_t index) const } NS_ASSERT (false); // quiet compiler. - return 0; + return nullptr; } void Ipv4GlobalRouting::RemoveRoute (uint32_t index) @@ -469,7 +469,7 @@ Ipv4GlobalRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr LookupGlobal (Ipv4Address dest, Ptr oif = 0); + Ptr LookupGlobal (Ipv4Address dest, Ptr oif = nullptr); HostRoutes m_hostRoutes; //!< Routes to hosts NetworkRoutes m_networkRoutes; //!< Routes to networks diff --git a/src/internet/model/ipv4-interface.cc b/src/internet/model/ipv4-interface.cc index 461f0c854..a01712fcf 100644 --- a/src/internet/model/ipv4-interface.cc +++ b/src/internet/model/ipv4-interface.cc @@ -46,7 +46,7 @@ Ipv4Interface::GetTypeId () .SetGroupName ("Internet") .AddAttribute ("ArpCache", "The arp cache for this ipv4 interface", - PointerValue (0), + PointerValue (nullptr), MakePointerAccessor (&Ipv4Interface::SetArpCache, &Ipv4Interface::GetArpCache), MakePointerChecker ()) @@ -64,10 +64,10 @@ Ipv4Interface::Ipv4Interface () : m_ifup (false), m_forwarding (true), m_metric (1), - m_node (0), - m_device (0), - m_tc (0), - m_cache (0) + m_node (nullptr), + m_device (nullptr), + m_tc (nullptr), + m_cache (nullptr) { NS_LOG_FUNCTION (this); } @@ -81,10 +81,10 @@ void Ipv4Interface::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; - m_device = 0; - m_tc = 0; - m_cache = 0; + m_node = nullptr; + m_device = nullptr; + m_tc = nullptr; + m_cache = nullptr; Object::DoDispose (); } diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc index abda2f295..f0358b7c0 100644 --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -231,7 +231,7 @@ Ipv4L3Protocol::GetProtocol (int protocolNumber, int32_t interfaceIndex) const return i->second; } - return 0; + return nullptr; } void @@ -308,24 +308,24 @@ Ipv4L3Protocol::DoDispose () NS_LOG_FUNCTION (this); for (L4List_t::iterator i = m_protocols.begin (); i != m_protocols.end (); ++i) { - i->second = 0; + i->second = nullptr; } m_protocols.clear (); for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i) { - *i = 0; + *i = nullptr; } m_interfaces.clear (); m_reverseInterfacesContainer.clear (); m_sockets.clear (); - m_node = 0; - m_routingProtocol = 0; + m_node = nullptr; + m_routingProtocol = nullptr; for (MapFragments_t::iterator it = m_fragments.begin (); it != m_fragments.end (); it++) { - it->second = 0; + it->second = nullptr; } m_fragments.clear (); @@ -350,7 +350,7 @@ Ipv4L3Protocol::SetupLoopback () NS_LOG_FUNCTION (this); Ptr interface = CreateObject (); - Ptr device = 0; + Ptr device = nullptr; // First check whether an existing LoopbackNetDevice exists on the node for (uint32_t i = 0; i < m_node->GetNDevices (); i++) { @@ -432,7 +432,7 @@ Ipv4L3Protocol::GetInterface (uint32_t index) const { return m_interfaces[index]; } - return 0; + return nullptr; } uint32_t @@ -683,7 +683,7 @@ Ipv4L3Protocol::GetIcmp () const } else { - return 0; + return nullptr; } } @@ -879,7 +879,7 @@ Ipv4L3Protocol::Send (Ptr packet, // 4) packet is not broadcast, and route is NULL (e.g., a raw socket call) NS_LOG_LOGIC ("Ipv4L3Protocol::Send case 4: not broadcast and passed in with no route " << destination); Socket::SocketErrno errno_; - Ptr oif (0); // unused for now + Ptr oif (nullptr); // unused for now Ptr newRoute; if (m_routingProtocol) { @@ -1557,7 +1557,7 @@ Ipv4L3Protocol::ProcessFragment (Ptr& packet, Ipv4Header& ipHeader, uint { packet = fragments->GetPacket (); m_timeoutEventList.erase (fragments->GetTimeoutIter ()); - fragments = 0; + fragments = nullptr; m_fragments.erase (key); ret = true; } @@ -1727,7 +1727,7 @@ Ipv4L3Protocol::HandleFragmentsTimeout (FragmentKey_t key, Ipv4Header & ipHeader m_dropTrace (ipHeader, packet, DROP_FRAGMENT_TIMEOUT, this, iif); // clear the buffers - it->second = 0; + it->second = nullptr; m_fragments.erase (key); } diff --git a/src/internet/model/ipv4-list-routing.cc b/src/internet/model/ipv4-list-routing.cc index 5fdb84966..73e7867f2 100644 --- a/src/internet/model/ipv4-list-routing.cc +++ b/src/internet/model/ipv4-list-routing.cc @@ -43,7 +43,7 @@ Ipv4ListRouting::GetTypeId () Ipv4ListRouting::Ipv4ListRouting () - : m_ipv4 (0) + : m_ipv4 (nullptr) { NS_LOG_FUNCTION (this); } @@ -63,10 +63,10 @@ Ipv4ListRouting::DoDispose () // Note: Calling dispose on these protocols causes memory leak // The routing protocols should not maintain a pointer to // this object, so Dispose() shouldn't be necessary. - (*rprotoIter).second = 0; + (*rprotoIter).second = nullptr; } m_routingProtocols.clear (); - m_ipv4 = 0; + m_ipv4 = nullptr; } void @@ -121,7 +121,7 @@ Ipv4ListRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr Ipv4StaticRouting::LookupStatic (Ipv4Address dest, Ptr oif) { NS_LOG_FUNCTION (this << dest << " " << oif); - Ptr rtentry = 0; + Ptr rtentry = nullptr; uint16_t longest_mask = 0; uint32_t shortest_metric = 0xffffffff; /* when sending on local multicast, there have to be interface specified */ @@ -337,7 +337,7 @@ Ipv4StaticRouting::LookupStatic ( uint32_t interface) { NS_LOG_FUNCTION (this << origin << " " << group << " " << interface); - Ptr mrtentry = 0; + Ptr mrtentry = nullptr; for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); @@ -396,7 +396,7 @@ Ipv4StaticRouting::GetDefaultRoute () // Basically a repeat of LookupStatic, retained for backward compatibility Ipv4Address dest ("0.0.0.0"); uint32_t shortest_metric = 0xffffffff; - Ipv4RoutingTableEntry *result = 0; + Ipv4RoutingTableEntry *result = nullptr; for (NetworkRoutesI i = m_networkRoutes.begin (); i != m_networkRoutes.end (); i++) @@ -443,7 +443,7 @@ Ipv4StaticRouting::GetRoute (uint32_t index) const } NS_ASSERT (false); // quiet compiler. - return 0; + return nullptr; } uint32_t @@ -490,7 +490,7 @@ Ipv4StaticRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr rtentry = 0; + Ptr rtentry = nullptr; // Multicast goes here if (destination.IsMulticast ()) @@ -610,7 +610,7 @@ Ipv4StaticRouting::DoDispose () { delete (*i); } - m_ipv4 = 0; + m_ipv4 = nullptr; Ipv4RoutingProtocol::DoDispose (); } diff --git a/src/internet/model/ipv4-static-routing.h b/src/internet/model/ipv4-static-routing.h index a7233db1b..d2868ef59 100644 --- a/src/internet/model/ipv4-static-routing.h +++ b/src/internet/model/ipv4-static-routing.h @@ -390,7 +390,7 @@ private: * \param oif output interface if any (put 0 otherwise) * \return Ipv4Route to route the packet to reach dest address */ - Ptr LookupStatic (Ipv4Address dest, Ptr oif = 0); + Ptr LookupStatic (Ipv4Address dest, Ptr oif = nullptr); /** * \brief Lookup in the multicast forwarding table for destination. diff --git a/src/internet/model/ipv6-end-point-demux.cc b/src/internet/model/ipv6-end-point-demux.cc index 06da09880..ce717e888 100644 --- a/src/internet/model/ipv6-end-point-demux.cc +++ b/src/internet/model/ipv6-end-point-demux.cc @@ -80,7 +80,7 @@ Ipv6EndPoint* Ipv6EndPointDemux::Allocate () if (port == 0) { NS_LOG_WARN ("Ephemeral port allocation failed."); - return 0; + return nullptr; } Ipv6EndPoint *endPoint = new Ipv6EndPoint (Ipv6Address::GetAny (), port); m_endPoints.push_back (endPoint); @@ -95,7 +95,7 @@ Ipv6EndPoint* Ipv6EndPointDemux::Allocate (Ipv6Address address) if (port == 0) { NS_LOG_WARN ("Ephemeral port allocation failed."); - return 0; + return nullptr; } Ipv6EndPoint *endPoint = new Ipv6EndPoint (address, port); m_endPoints.push_back (endPoint); @@ -113,10 +113,10 @@ Ipv6EndPoint* Ipv6EndPointDemux::Allocate (Ptr boundNetDevice, uint16 Ipv6EndPoint* Ipv6EndPointDemux::Allocate (Ptr boundNetDevice, Ipv6Address address, uint16_t port) { NS_LOG_FUNCTION (this << boundNetDevice << address << port); - if (LookupLocal (boundNetDevice, address, port) || LookupLocal (0, address, port)) + if (LookupLocal (boundNetDevice, address, port) || LookupLocal (nullptr, address, port)) { NS_LOG_WARN ("Duplicated endpoint."); - return 0; + return nullptr; } Ipv6EndPoint *endPoint = new Ipv6EndPoint (address, port); m_endPoints.push_back (endPoint); @@ -138,7 +138,7 @@ Ipv6EndPoint* Ipv6EndPointDemux::Allocate (Ptr boundNetDevice, ((*i)->GetBoundNetDevice () == boundNetDevice || !(*i)->GetBoundNetDevice ())) { NS_LOG_WARN ("Duplicated endpoint."); - return 0; + return nullptr; } } Ipv6EndPoint *endPoint = new Ipv6EndPoint (localAddress, localPort); @@ -291,7 +291,7 @@ Ipv6EndPointDemux::EndPoints Ipv6EndPointDemux::Lookup (Ipv6Address daddr, uint1 Ipv6EndPoint* Ipv6EndPointDemux::SimpleLookup (Ipv6Address dst, uint16_t dport, Ipv6Address src, uint16_t sport) { uint32_t genericity = 3; - Ipv6EndPoint *generic = 0; + Ipv6EndPoint *generic = nullptr; for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) { diff --git a/src/internet/model/ipv6-extension-demux.cc b/src/internet/model/ipv6-extension-demux.cc index f07c19d6e..e7dd7ae62 100644 --- a/src/internet/model/ipv6-extension-demux.cc +++ b/src/internet/model/ipv6-extension-demux.cc @@ -56,10 +56,10 @@ void Ipv6ExtensionDemux::DoDispose () for (Ipv6ExtensionList_t::iterator it = m_extensions.begin (); it != m_extensions.end (); it++) { (*it)->Dispose (); - *it = 0; + *it = nullptr; } m_extensions.clear (); - m_node = 0; + m_node = nullptr; Object::DoDispose (); } @@ -82,7 +82,7 @@ Ptr Ipv6ExtensionDemux::GetExtension (uint8_t extensionNumber) return *i; } } - return 0; + return nullptr; } void Ipv6ExtensionDemux::Remove (Ptr extension) diff --git a/src/internet/model/ipv6-extension.cc b/src/internet/model/ipv6-extension.cc index 7e0334148..ae7171aeb 100644 --- a/src/internet/model/ipv6-extension.cc +++ b/src/internet/model/ipv6-extension.cc @@ -326,7 +326,7 @@ void Ipv6ExtensionFragment::DoDispose () for (MapFragments_t::iterator it = m_fragments.begin (); it != m_fragments.end (); it++) { - it->second = 0; + it->second = nullptr; } m_fragments.clear (); @@ -552,21 +552,21 @@ void Ipv6ExtensionFragment::GetFragments (Ptr packet, Ipv6Header ipv6Hea { Ipv6ExtensionHopByHopHeader * p = dynamic_cast (it->first); - NS_ASSERT (p != 0); + NS_ASSERT (p != nullptr); fragment->AddHeader (*p); } else if (it->second == Ipv6Header::IPV6_EXT_ROUTING) { Ipv6ExtensionLooseRoutingHeader * p = dynamic_cast (it->first); - NS_ASSERT (p != 0); + NS_ASSERT (p != nullptr); fragment->AddHeader (*p); } else if (it->second == Ipv6Header::IPV6_EXT_DESTINATION) { Ipv6ExtensionDestinationHeader * p = dynamic_cast (it->first); - NS_ASSERT (p != 0); + NS_ASSERT (p != nullptr); fragment->AddHeader (*p); } } @@ -861,7 +861,7 @@ uint8_t Ipv6ExtensionRouting::Process (Ptr& packet, return routingLength; } - return ipv6ExtensionRouting->Process (packet, offset, ipv6Header, dst, (uint8_t *)0, stopProcessing, isDropped, dropReason); + return ipv6ExtensionRouting->Process (packet, offset, ipv6Header, dst, (uint8_t *)nullptr, stopProcessing, isDropped, dropReason); } @@ -894,10 +894,10 @@ void Ipv6ExtensionRoutingDemux::DoDispose () for (Ipv6ExtensionRoutingList_t::iterator it = m_extensionsRouting.begin (); it != m_extensionsRouting.end (); it++) { (*it)->Dispose (); - *it = 0; + *it = nullptr; } m_extensionsRouting.clear (); - m_node = 0; + m_node = nullptr; Object::DoDispose (); } @@ -922,7 +922,7 @@ Ptr Ipv6ExtensionRoutingDemux::GetExtensionRouting (uint8_ return *i; } } - return 0; + return nullptr; } void Ipv6ExtensionRoutingDemux::Remove (Ptr extensionRouting) @@ -1073,7 +1073,7 @@ uint8_t Ipv6ExtensionLooseRouting::Process (Ptr& packet, Socket::SocketErrno err; NS_ASSERT (ipv6rp); - Ptr rtentry = ipv6rp->RouteOutput (p, ipv6header, 0, err); + Ptr rtentry = ipv6rp->RouteOutput (p, ipv6header, nullptr, err); if (rtentry) { diff --git a/src/internet/model/ipv6-interface.cc b/src/internet/model/ipv6-interface.cc index 634b8c9bf..e9d3fd9bd 100644 --- a/src/internet/model/ipv6-interface.cc +++ b/src/internet/model/ipv6-interface.cc @@ -54,10 +54,10 @@ Ipv6Interface::Ipv6Interface () : m_ifup (false), m_forwarding (true), m_metric (1), - m_node (0), - m_device (0), - m_tc (0), - m_ndCache (0), + m_node (nullptr), + m_device (nullptr), + m_tc (nullptr), + m_ndCache (nullptr), m_curHopLimit (0), m_baseReachableTime (0), m_reachableTime (0), @@ -73,10 +73,10 @@ Ipv6Interface::~Ipv6Interface () void Ipv6Interface::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; - m_device = 0; - m_tc = 0; - m_ndCache = 0; + m_node = nullptr; + m_device = nullptr; + m_tc = nullptr; + m_ndCache = nullptr; Object::DoDispose (); } diff --git a/src/internet/model/ipv6-l3-protocol.cc b/src/internet/model/ipv6-l3-protocol.cc index a1f0622cd..e8a0269d0 100644 --- a/src/internet/model/ipv6-l3-protocol.cc +++ b/src/internet/model/ipv6-l3-protocol.cc @@ -145,14 +145,14 @@ void Ipv6L3Protocol::DoDispose () /* clear protocol and interface list */ for (L4List_t::iterator it = m_protocols.begin (); it != m_protocols.end (); ++it) { - it->second = 0; + it->second = nullptr; } m_protocols.clear (); /* remove interfaces */ for (Ipv6InterfaceList::iterator it = m_interfaces.begin (); it != m_interfaces.end (); ++it) { - *it = 0; + *it = nullptr; } m_interfaces.clear (); m_reverseInterfacesContainer.clear (); @@ -160,7 +160,7 @@ void Ipv6L3Protocol::DoDispose () /* remove raw sockets */ for (SocketList::iterator it = m_sockets.begin (); it != m_sockets.end (); ++it) { - *it = 0; + *it = nullptr; } m_sockets.clear (); @@ -169,13 +169,13 @@ void Ipv6L3Protocol::DoDispose () { (*it)->StopValidTimer (); (*it)->StopPreferredTimer (); - (*it) = 0; + (*it) = nullptr; } m_prefixes.clear (); - m_node = 0; - m_routingProtocol = 0; - m_pmtuCache = 0; + m_node = nullptr; + m_routingProtocol = nullptr; + m_pmtuCache = nullptr; Object::DoDispose (); } @@ -233,7 +233,7 @@ Ptr Ipv6L3Protocol::GetInterface (uint32_t index) const { return m_interfaces[index]; } - return 0; + return nullptr; } uint32_t Ipv6L3Protocol::GetNInterfaces () const @@ -379,7 +379,7 @@ void Ipv6L3Protocol::RemoveAutoconfiguredAddress (uint32_t interface, Ipv6Addres { if ((*it)->GetInterface () == interface && (*it)->GetPrefix () == network && (*it)->GetMask () == mask) { - *it = 0; + *it = nullptr; m_prefixes.erase (it); break; } @@ -547,7 +547,7 @@ void Ipv6L3Protocol::SetupLoopback () { NS_LOG_FUNCTION (this); Ptr interface = CreateObject (); - Ptr device = 0; + Ptr device = nullptr; uint32_t i = 0; /* see if we have already an loopback NetDevice */ @@ -795,7 +795,7 @@ Ptr Ipv6L3Protocol::GetProtocol (int protocolNumber, int32_t inter return i->second; } - return 0; + return nullptr; } Ptr Ipv6L3Protocol::CreateRawSocket () @@ -832,7 +832,7 @@ Ptr Ipv6L3Protocol::GetIcmpv6 () const } else { - return 0; + return nullptr; } } @@ -901,8 +901,8 @@ void Ipv6L3Protocol::Send (Ptr packet, Ipv6Address source, Ipv6Address d /* 3) */ NS_LOG_LOGIC ("Ipv6L3Protocol::Send case 3: passed in with no route " << destination); Socket::SocketErrno err; - Ptr oif (0); - Ptr newRoute = 0; + Ptr oif (nullptr); + Ptr newRoute = nullptr; hdr = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, tclass); @@ -998,7 +998,7 @@ void Ipv6L3Protocol::Receive (Ptr device, Ptr p, uint16 } Ptr ipv6ExtensionDemux = m_node->GetObject (); - Ptr ipv6Extension = 0; + Ptr ipv6Extension = nullptr; uint8_t nextHeader = hdr.GetNextHeader (); bool stopProcessing = false; bool isDropped = false; @@ -1010,7 +1010,7 @@ void Ipv6L3Protocol::Receive (Ptr device, Ptr p, uint16 if (ipv6Extension) { - ipv6Extension->Process (packet, 0, hdr, hdr.GetDestination (), (uint8_t *)0, stopProcessing, isDropped, dropReason); + ipv6Extension->Process (packet, 0, hdr, hdr.GetDestination (), (uint8_t *)nullptr, stopProcessing, isDropped, dropReason); } if (isDropped) @@ -1161,7 +1161,7 @@ void Ipv6L3Protocol::SendRealOut (Ptr route, Ptr packet, Ipv6 // To get specific method GetFragments from Ipv6ExtensionFragmentation Ipv6ExtensionFragment *ipv6Fragment = dynamic_cast (PeekPointer (ipv6ExtensionDemux->GetExtension (Ipv6Header::IPV6_EXT_FRAGMENTATION))); - NS_ASSERT (ipv6Fragment != 0); + NS_ASSERT (ipv6Fragment != nullptr); ipv6Fragment->GetFragments (packet, ipHeader, targetMtu, fragments); } @@ -1290,7 +1290,7 @@ void Ipv6L3Protocol::IpForward (Ptr idev, Ptr rtentr copy->AddHeader (header); Ipv6Address linkLocal = GetInterface (GetInterfaceForDevice (rtentry->GetOutputDevice ()))->GetLinkLocalAddress ().GetAddress (); - if (icmpv6->Lookup (target, rtentry->GetOutputDevice (), 0, &hardwareTarget)) + if (icmpv6->Lookup (target, rtentry->GetOutputDevice (), nullptr, &hardwareTarget)) { icmpv6->SendRedirection (copy, linkLocal, src, target, dst, hardwareTarget); } @@ -1342,9 +1342,9 @@ void Ipv6L3Protocol::LocalDeliver (Ptr packet, Ipv6Header const& i { NS_LOG_FUNCTION (this << packet << ip << iif); Ptr p = packet->Copy (); - Ptr protocol = 0; + Ptr protocol = nullptr; Ptr ipv6ExtensionDemux = m_node->GetObject (); - Ptr ipv6Extension = 0; + Ptr ipv6Extension = nullptr; Ipv6Address src = ip.GetSource (); Ipv6Address dst = ip.GetDestination (); uint8_t nextHeader = ip.GetNextHeader (); diff --git a/src/internet/model/ipv6-list-routing.cc b/src/internet/model/ipv6-list-routing.cc index 73efc97a6..a30735f0c 100644 --- a/src/internet/model/ipv6-list-routing.cc +++ b/src/internet/model/ipv6-list-routing.cc @@ -44,7 +44,7 @@ Ipv6ListRouting::GetTypeId () Ipv6ListRouting::Ipv6ListRouting () - : m_ipv6 (0) + : m_ipv6 (nullptr) { NS_LOG_FUNCTION (this); } @@ -64,10 +64,10 @@ Ipv6ListRouting::DoDispose () // Note: Calling dispose on these protocols causes memory leak // The routing protocols should not maintain a pointer to // this object, so Dispose () shouldn't be necessary. - (*rprotoIter).second = 0; + (*rprotoIter).second = nullptr; } m_routingProtocols.clear (); - m_ipv6 = 0; + m_ipv6 = nullptr; } Ptr @@ -92,7 +92,7 @@ Ipv6ListRouting::RouteOutput (Ptr p, const Ipv6Header &header, PtrDispose (); - *it = 0; + *it = nullptr; } m_options.clear (); - m_node = 0; + m_node = nullptr; Object::DoDispose (); } @@ -82,7 +82,7 @@ Ptr Ipv6OptionDemux::GetOption (int optionNumber) return *i; } } - return 0; + return nullptr; } void Ipv6OptionDemux::Remove (Ptr option) diff --git a/src/internet/model/ipv6-packet-probe.cc b/src/internet/model/ipv6-packet-probe.cc index 5c5e3d677..5259706c3 100644 --- a/src/internet/model/ipv6-packet-probe.cc +++ b/src/internet/model/ipv6-packet-probe.cc @@ -58,9 +58,9 @@ Ipv6PacketProbe::GetTypeId () Ipv6PacketProbe::Ipv6PacketProbe () { NS_LOG_FUNCTION (this); - m_packet = 0; + m_packet = nullptr; m_packetSizeOld = 0; - m_ipv6 = 0; + m_ipv6 = nullptr; m_interface = 0; } diff --git a/src/internet/model/ipv6-raw-socket-impl.cc b/src/internet/model/ipv6-raw-socket-impl.cc index 2b1d4f90b..c34f8dffe 100644 --- a/src/internet/model/ipv6-raw-socket-impl.cc +++ b/src/internet/model/ipv6-raw-socket-impl.cc @@ -59,7 +59,7 @@ Ipv6RawSocketImpl::Ipv6RawSocketImpl () { NS_LOG_FUNCTION (this); m_err = Socket::ERROR_NOTERROR; - m_node = 0; + m_node = nullptr; m_src = Ipv6Address::GetAny (); m_dst = Ipv6Address::GetAny (); m_protocol = 0; @@ -75,7 +75,7 @@ Ipv6RawSocketImpl::~Ipv6RawSocketImpl () void Ipv6RawSocketImpl::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; + m_node = nullptr; Socket::DoDispose (); } @@ -246,7 +246,7 @@ int Ipv6RawSocketImpl::SendTo (Ptr p, uint32_t flags, const Address& toA Ipv6Header hdr; hdr.SetDestination (dst); SocketErrno err = ERROR_NOTERROR; - Ptr route = 0; + Ptr route = nullptr; Ptr oif = m_boundnetdevice; //specify non-zero if bound to a specific device if (!m_src.IsAny ()) @@ -312,7 +312,7 @@ Ptr Ipv6RawSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags, Addre if (m_data.empty ()) { - return 0; + return nullptr; } /* get packet */ diff --git a/src/internet/model/ipv6-static-routing.cc b/src/internet/model/ipv6-static-routing.cc index bb6b6f0e8..eeb1f949c 100644 --- a/src/internet/model/ipv6-static-routing.cc +++ b/src/internet/model/ipv6-static-routing.cc @@ -47,7 +47,7 @@ TypeId Ipv6StaticRouting::GetTypeId () } Ipv6StaticRouting::Ipv6StaticRouting () - : m_ipv6 (0) + : m_ipv6 (nullptr) { NS_LOG_FUNCTION (this); } @@ -241,7 +241,7 @@ Ipv6MulticastRoutingTableEntry Ipv6StaticRouting::GetMulticastRoute (uint32_t in tmp++; } } - return 0; + return nullptr; } bool Ipv6StaticRouting::RemoveMulticastRoute (Ipv6Address origin, Ipv6Address group, uint32_t inputInterface) @@ -322,7 +322,7 @@ bool Ipv6StaticRouting::LookupRoute (const Ipv6RoutingTableEntry &route, uint32_ Ptr Ipv6StaticRouting::LookupStatic (Ipv6Address dst, Ptr interface) { NS_LOG_FUNCTION (this << dst << interface); - Ptr rtentry = 0; + Ptr rtentry = nullptr; uint16_t longestMask = 0; uint32_t shortestMetric = 0xffffffff; @@ -425,14 +425,14 @@ void Ipv6StaticRouting::DoDispose () } m_multicastRoutes.clear (); - m_ipv6 = 0; + m_ipv6 = nullptr; Ipv6RoutingProtocol::DoDispose (); } Ptr Ipv6StaticRouting::LookupStatic (Ipv6Address origin, Ipv6Address group, uint32_t interface) { NS_LOG_FUNCTION (this << origin << group << interface); - Ptr mrtentry = 0; + Ptr mrtentry = nullptr; for (MulticastRoutesI i = m_multicastRoutes.begin (); i != m_multicastRoutes.end (); i++) { @@ -488,7 +488,7 @@ Ipv6RoutingTableEntry Ipv6StaticRouting::GetDefaultRoute () NS_LOG_FUNCTION (this); Ipv6Address dst ("::"); uint32_t shortestMetric = 0xffffffff; - Ipv6RoutingTableEntry* result = 0; + Ipv6RoutingTableEntry* result = nullptr; for (NetworkRoutesI it = m_networkRoutes.begin (); it != m_networkRoutes.end (); it++) { @@ -536,7 +536,7 @@ Ipv6RoutingTableEntry Ipv6StaticRouting::GetRoute (uint32_t index) const } NS_ASSERT (false); // quiet compiler. - return 0; + return nullptr; } uint32_t Ipv6StaticRouting::GetMetric (uint32_t index) const @@ -596,7 +596,7 @@ Ptr Ipv6StaticRouting::RouteOutput (Ptr p, const Ipv6Header & { NS_LOG_FUNCTION (this << header << oif); Ipv6Address destination = header.GetDestination (); - Ptr rtentry = 0; + Ptr rtentry = nullptr; if (destination.IsMulticast ()) { diff --git a/src/internet/model/ipv6-static-routing.h b/src/internet/model/ipv6-static-routing.h index 7b7dbfb87..cb7a5d42b 100644 --- a/src/internet/model/ipv6-static-routing.h +++ b/src/internet/model/ipv6-static-routing.h @@ -278,7 +278,7 @@ private: * \param interface output interface if any (put 0 otherwise) * \return Ipv6Route to route the packet to reach dest address */ - Ptr LookupStatic (Ipv6Address dest, Ptr = 0); + Ptr LookupStatic (Ipv6Address dest, Ptr = nullptr); /** * \brief Lookup in the multicast forwarding table for destination. diff --git a/src/internet/model/loopback-net-device.cc b/src/internet/model/loopback-net-device.cc index 27ece7eb7..c8dc9a0cb 100644 --- a/src/internet/model/loopback-net-device.cc +++ b/src/internet/model/loopback-net-device.cc @@ -42,7 +42,7 @@ LoopbackNetDevice::GetTypeId () } LoopbackNetDevice::LoopbackNetDevice () - : m_node (0), + : m_node (nullptr), m_mtu (0xffff), m_ifIndex (0), m_address (Mac48Address ("00:00:00:00:00:00")) @@ -94,7 +94,7 @@ LoopbackNetDevice::GetIfIndex () const Ptr LoopbackNetDevice::GetChannel () const { - return 0; + return nullptr; } void @@ -224,7 +224,7 @@ LoopbackNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) void LoopbackNetDevice::DoDispose () { - m_node = 0; + m_node = nullptr; NetDevice::DoDispose (); } diff --git a/src/internet/model/ndisc-cache.cc b/src/internet/model/ndisc-cache.cc index 744cbf766..a6d2d79b0 100644 --- a/src/internet/model/ndisc-cache.cc +++ b/src/internet/model/ndisc-cache.cc @@ -64,9 +64,9 @@ void NdiscCache::DoDispose () { NS_LOG_FUNCTION (this); Flush (); - m_device = 0; - m_interface = 0; - m_icmpv6 = 0; + m_device = nullptr; + m_interface = nullptr; + m_icmpv6 = nullptr; Object::DoDispose (); } @@ -102,7 +102,7 @@ NdiscCache::Entry* NdiscCache::Lookup (Ipv6Address dst) return entry; } NS_LOG_LOGIC ("Nothing found"); - return 0; + return nullptr; } std::list NdiscCache::LookupInverse (Address dst) diff --git a/src/internet/model/pending-data.cc b/src/internet/model/pending-data.cc index 951ac0698..1704cb0b2 100644 --- a/src/internet/model/pending-data.cc +++ b/src/internet/model/pending-data.cc @@ -84,7 +84,7 @@ PendingData* PendingData::Copy () const PendingData* PendingData::CopyS (uint32_t s) { // Copy, but with new size (assumes no associated data); NS_LOG_FUNCTION (this << s); - return new PendingData (s, 0, msgSize, responseSize); + return new PendingData (s, nullptr, msgSize, responseSize); } PendingData* PendingData::CopySD (uint32_t s, uint8_t* d) diff --git a/src/internet/model/pending-data.h b/src/internet/model/pending-data.h index 0579a4f82..a795d0876 100644 --- a/src/internet/model/pending-data.h +++ b/src/internet/model/pending-data.h @@ -48,7 +48,7 @@ public: * \param msg message size * \param resp response size */ - PendingData (uint32_t s, uint8_t* d = NULL, uint32_t msg = 0, uint32_t resp = 0); + PendingData (uint32_t s, uint8_t* d = nullptr, uint32_t msg = 0, uint32_t resp = 0); /** * Constructor from string * \param s string @@ -78,7 +78,7 @@ public: * \param s the data size. * \param d the data to store. */ - virtual void Add (uint32_t s, const uint8_t* d = 0); // + virtual void Add (uint32_t s, const uint8_t* d = nullptr); // /** * \brief Add some data to end * \param p packet containing the data. diff --git a/src/internet/model/rip.cc b/src/internet/model/rip.cc index 80d0bea5c..878a830fb 100644 --- a/src/internet/model/rip.cc +++ b/src/internet/model/rip.cc @@ -44,7 +44,7 @@ NS_LOG_COMPONENT_DEFINE ("Rip"); NS_OBJECT_ENSURE_REGISTERED (Rip); Rip::Rip () - : m_ipv4 (0), m_splitHorizonStrategy (Rip::POISON_REVERSE), m_initialized (false) + : m_ipv4 (nullptr), m_splitHorizonStrategy (Rip::POISON_REVERSE), m_initialized (false) { m_rng = CreateObject (); } @@ -191,7 +191,7 @@ Ptr Rip::RouteOutput (Ptr p, const Ipv4Header &header, Ptr rtentry = 0; + Ptr rtentry = nullptr; if (destination.IsMulticast ()) { @@ -574,9 +574,9 @@ void Rip::DoDispose () m_unicastSocketList.clear (); m_multicastRecvSocket->Close (); - m_multicastRecvSocket = 0; + m_multicastRecvSocket = nullptr; - m_ipv4 = 0; + m_ipv4 = nullptr; Ipv4RoutingProtocol::DoDispose (); } @@ -585,7 +585,7 @@ Ptr Rip::Lookup (Ipv4Address dst, bool setSource, Ptr inte { NS_LOG_FUNCTION (this << dst << interface); - Ptr rtentry = 0; + Ptr rtentry = nullptr; uint16_t longestMask = 0; /* when sending on local multicast, there have to be interface specified */ diff --git a/src/internet/model/rip.h b/src/internet/model/rip.h index 7313b295a..11076707e 100644 --- a/src/internet/model/rip.h +++ b/src/internet/model/rip.h @@ -309,7 +309,7 @@ private: * \param interface output interface if any (put 0 otherwise) * \return Ipv4Route to route the packet to reach dest address */ - Ptr Lookup (Ipv4Address dest, bool setSource, Ptr = 0); + Ptr Lookup (Ipv4Address dest, bool setSource, Ptr = nullptr); /** * Receive and process unicast packet diff --git a/src/internet/model/ripng.cc b/src/internet/model/ripng.cc index f49a0487d..3e11f96ec 100644 --- a/src/internet/model/ripng.cc +++ b/src/internet/model/ripng.cc @@ -44,7 +44,7 @@ NS_LOG_COMPONENT_DEFINE ("RipNg"); NS_OBJECT_ENSURE_REGISTERED (RipNg); RipNg::RipNg () - : m_ipv6 (0), m_splitHorizonStrategy (RipNg::POISON_REVERSE), m_initialized (false) + : m_ipv6 (nullptr), m_splitHorizonStrategy (RipNg::POISON_REVERSE), m_initialized (false) { m_rng = CreateObject (); } @@ -183,7 +183,7 @@ Ptr RipNg::RouteOutput (Ptr p, const Ipv6Header &header, Ptr< NS_LOG_FUNCTION (this << header << oif); Ipv6Address destination = header.GetDestination (); - Ptr rtentry = 0; + Ptr rtentry = nullptr; if (destination.IsMulticast ()) { @@ -547,9 +547,9 @@ void RipNg::DoDispose () m_unicastSocketList.clear (); m_multicastRecvSocket->Close (); - m_multicastRecvSocket = 0; + m_multicastRecvSocket = nullptr; - m_ipv6 = 0; + m_ipv6 = nullptr; Ipv6RoutingProtocol::DoDispose (); } @@ -558,7 +558,7 @@ Ptr RipNg::Lookup (Ipv6Address dst, bool setSource, Ptr in { NS_LOG_FUNCTION (this << dst << interface); - Ptr rtentry = 0; + Ptr rtentry = nullptr; uint16_t longestMask = 0; /* when sending on link-local multicast, there have to be interface specified */ diff --git a/src/internet/model/ripng.h b/src/internet/model/ripng.h index fbb7ee490..9641aec27 100644 --- a/src/internet/model/ripng.h +++ b/src/internet/model/ripng.h @@ -314,7 +314,7 @@ private: * \param interface output interface if any (put 0 otherwise) * \return Ipv6Route to route the packet to reach dest address */ - Ptr Lookup (Ipv6Address dest, bool setSource, Ptr = 0); + Ptr Lookup (Ipv6Address dest, bool setSource, Ptr = nullptr); /** * Receive and process unicast packet diff --git a/src/internet/model/tcp-header.cc b/src/internet/model/tcp-header.cc index 0f0b75197..9f59214d3 100644 --- a/src/internet/model/tcp-header.cc +++ b/src/internet/model/tcp-header.cc @@ -504,7 +504,7 @@ TcpHeader::GetOption(uint8_t kind) const } } - return 0; + return nullptr; } bool diff --git a/src/internet/model/tcp-l4-protocol.cc b/src/internet/model/tcp-l4-protocol.cc index 352bfe7d7..cf9c3fa8d 100644 --- a/src/internet/model/tcp-l4-protocol.cc +++ b/src/internet/model/tcp-l4-protocol.cc @@ -163,19 +163,19 @@ TcpL4Protocol::DoDispose () NS_LOG_FUNCTION (this); m_sockets.clear (); - if (m_endPoints != 0) + if (m_endPoints != nullptr) { delete m_endPoints; - m_endPoints = 0; + m_endPoints = nullptr; } - if (m_endPoints6 != 0) + if (m_endPoints6 != nullptr) { delete m_endPoints6; - m_endPoints6 = 0; + m_endPoints6 = nullptr; } - m_node = 0; + m_node = nullptr; m_downTarget.Nullify (); m_downTarget6.Nullify (); IpL4Protocol::DoDispose (); @@ -326,7 +326,7 @@ TcpL4Protocol::ReceiveIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, dst |= payload[3]; Ipv4EndPoint *endPoint = m_endPoints->SimpleLookup (payloadSource, src, payloadDestination, dst); - if (endPoint != 0) + if (endPoint != nullptr) { endPoint->ForwardIcmp (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo); } @@ -353,7 +353,7 @@ TcpL4Protocol::ReceiveIcmp (Ipv6Address icmpSource, uint8_t icmpTtl, dst |= payload[3]; Ipv6EndPoint *endPoint = m_endPoints6->SimpleLookup (payloadSource, src, payloadDestination, dst); - if (endPoint != 0) + if (endPoint != nullptr) { endPoint->ForwardIcmp (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo); } @@ -593,7 +593,7 @@ TcpL4Protocol::SendPacketV4 (Ptr packet, const TcpHeader &outgoing, else { NS_LOG_ERROR ("No IPV4 Routing Protocol"); - route = 0; + route = nullptr; } m_downTarget (packet, saddr, daddr, PROT_NUMBER, route); } @@ -647,7 +647,7 @@ TcpL4Protocol::SendPacketV6 (Ptr packet, const TcpHeader &outgoing, else { NS_LOG_ERROR ("No IPV6 Routing Protocol"); - route = 0; + route = nullptr; } m_downTarget6 (packet, saddr, daddr, PROT_NUMBER, route); } diff --git a/src/internet/model/tcp-l4-protocol.h b/src/internet/model/tcp-l4-protocol.h index 05be21bbe..94da4921c 100644 --- a/src/internet/model/tcp-l4-protocol.h +++ b/src/internet/model/tcp-l4-protocol.h @@ -220,7 +220,7 @@ public: */ void SendPacket (Ptr pkt, const TcpHeader &outgoing, const Address &saddr, const Address &daddr, - Ptr oif = 0) const; + Ptr oif = nullptr) const; /** * \brief Make a socket fully operational @@ -339,7 +339,7 @@ private: */ void SendPacketV4 (Ptr pkt, const TcpHeader &outgoing, const Ipv4Address &saddr, const Ipv4Address &daddr, - Ptr oif = 0) const; + Ptr oif = nullptr) const; /** * \brief Send a packet via TCP (IPv6) @@ -352,7 +352,7 @@ private: */ void SendPacketV6 (Ptr pkt, const TcpHeader &outgoing, const Ipv6Address &saddr, const Ipv6Address &daddr, - Ptr oif = 0) const; + Ptr oif = nullptr) const; }; } // namespace ns3 diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index f3cddeb34..b3034e6db 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -465,7 +465,7 @@ TcpSocketBase::~TcpSocketBase () m_tcp->DeAllocate (m_endPoint6); NS_ASSERT (m_endPoint6 == nullptr); } - m_tcp = 0; + m_tcp = nullptr; CancelAllTimers (); } @@ -517,7 +517,7 @@ TcpSocketBase::Bind () { NS_LOG_FUNCTION (this); m_endPoint = m_tcp->Allocate (); - if (0 == m_endPoint) + if (nullptr == m_endPoint) { m_errno = ERROR_ADDRNOTAVAIL; return -1; @@ -533,7 +533,7 @@ TcpSocketBase::Bind6 () { NS_LOG_FUNCTION (this); m_endPoint6 = m_tcp->Allocate6 (); - if (0 == m_endPoint6) + if (nullptr == m_endPoint6) { m_errno = ERROR_ADDRNOTAVAIL; return -1; @@ -571,7 +571,7 @@ TcpSocketBase::Bind (const Address &address) { m_endPoint = m_tcp->Allocate (GetBoundNetDevice (), ipv4, port); } - if (0 == m_endPoint) + if (nullptr == m_endPoint) { m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL; return -1; @@ -598,7 +598,7 @@ TcpSocketBase::Bind (const Address &address) { m_endPoint6 = m_tcp->Allocate6 (GetBoundNetDevice (), ipv6, port); } - if (0 == m_endPoint6) + if (nullptr == m_endPoint6) { m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL; return -1; diff --git a/src/internet/model/tcp-socket-factory-impl.cc b/src/internet/model/tcp-socket-factory-impl.cc index 022639671..05292fbf4 100644 --- a/src/internet/model/tcp-socket-factory-impl.cc +++ b/src/internet/model/tcp-socket-factory-impl.cc @@ -25,7 +25,7 @@ namespace ns3 { TcpSocketFactoryImpl::TcpSocketFactoryImpl () - : m_tcp (0) + : m_tcp (nullptr) { } TcpSocketFactoryImpl::~TcpSocketFactoryImpl () @@ -48,7 +48,7 @@ TcpSocketFactoryImpl::CreateSocket () void TcpSocketFactoryImpl::DoDispose () { - m_tcp = 0; + m_tcp = nullptr; TcpSocketFactory::DoDispose (); } diff --git a/src/internet/model/udp-l4-protocol.cc b/src/internet/model/udp-l4-protocol.cc index bf6cf5958..9c6fbb10b 100644 --- a/src/internet/model/udp-l4-protocol.cc +++ b/src/internet/model/udp-l4-protocol.cc @@ -136,21 +136,21 @@ UdpL4Protocol::DoDispose () NS_LOG_FUNCTION (this); for (std::vector >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++) { - *i = 0; + *i = nullptr; } m_sockets.clear (); - if (m_endPoints != 0) + if (m_endPoints != nullptr) { delete m_endPoints; - m_endPoints = 0; + m_endPoints = nullptr; } - if (m_endPoints6 != 0) + if (m_endPoints6 != nullptr) { delete m_endPoints6; - m_endPoints6 = 0; + m_endPoints6 = nullptr; } - m_node = 0; + m_node = nullptr; m_downTarget.Nullify (); m_downTarget6.Nullify (); /* @@ -275,7 +275,7 @@ UdpL4Protocol::ReceiveIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, dst |= payload[3]; Ipv4EndPoint *endPoint = m_endPoints->SimpleLookup (payloadSource, src, payloadDestination, dst); - if (endPoint != 0) + if (endPoint != nullptr) { endPoint->ForwardIcmp (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo); } @@ -302,7 +302,7 @@ UdpL4Protocol::ReceiveIcmp (Ipv6Address icmpSource, uint8_t icmpTtl, dst |= payload[3]; Ipv6EndPoint *endPoint = m_endPoints6->SimpleLookup (payloadSource, src, payloadDestination, dst); - if (endPoint != 0) + if (endPoint != nullptr) { endPoint->ForwardIcmp (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo); } @@ -432,7 +432,7 @@ UdpL4Protocol::Send (Ptr packet, packet->AddHeader (udpHeader); - m_downTarget (packet, saddr, daddr, PROT_NUMBER, 0); + m_downTarget (packet, saddr, daddr, PROT_NUMBER, nullptr); } void @@ -478,7 +478,7 @@ UdpL4Protocol::Send (Ptr packet, packet->AddHeader (udpHeader); - m_downTarget6 (packet, saddr, daddr, PROT_NUMBER, 0); + m_downTarget6 (packet, saddr, daddr, PROT_NUMBER, nullptr); } void diff --git a/src/internet/model/udp-socket-factory-impl.cc b/src/internet/model/udp-socket-factory-impl.cc index 9e6cda805..1c1c3ebdf 100644 --- a/src/internet/model/udp-socket-factory-impl.cc +++ b/src/internet/model/udp-socket-factory-impl.cc @@ -25,7 +25,7 @@ namespace ns3 { UdpSocketFactoryImpl::UdpSocketFactoryImpl () - : m_udp (0) + : m_udp (nullptr) { } UdpSocketFactoryImpl::~UdpSocketFactoryImpl () @@ -48,7 +48,7 @@ UdpSocketFactoryImpl::CreateSocket () void UdpSocketFactoryImpl::DoDispose () { - m_udp = 0; + m_udp = nullptr; UdpSocketFactory::DoDispose (); } diff --git a/src/internet/model/udp-socket-impl.cc b/src/internet/model/udp-socket-impl.cc index 28af874b3..2a3a73694 100644 --- a/src/internet/model/udp-socket-impl.cc +++ b/src/internet/model/udp-socket-impl.cc @@ -76,10 +76,10 @@ UdpSocketImpl::GetTypeId () } UdpSocketImpl::UdpSocketImpl () - : m_endPoint (0), - m_endPoint6 (0), - m_node (0), - m_udp (0), + : m_endPoint (nullptr), + m_endPoint6 (nullptr), + m_node (nullptr), + m_udp (nullptr), m_errno (ERROR_NOTERROR), m_shutdownSend (false), m_shutdownRecv (false), @@ -95,13 +95,13 @@ UdpSocketImpl::~UdpSocketImpl () NS_LOG_FUNCTION (this); /// \todo leave any multicast groups that have been joined - m_node = 0; + m_node = nullptr; /** * Note: actually this function is called AFTER * UdpSocketImpl::Destroy or UdpSocketImpl::Destroy6 * so the code below is unnecessary in normal operations */ - if (m_endPoint != 0) + if (m_endPoint != nullptr) { NS_ASSERT (m_udp); /** @@ -112,11 +112,11 @@ UdpSocketImpl::~UdpSocketImpl () * in turn a call to the method UdpSocketImpl::Destroy below * will will zero the m_endPoint field. */ - NS_ASSERT (m_endPoint != 0); + NS_ASSERT (m_endPoint != nullptr); m_udp->DeAllocate (m_endPoint); - NS_ASSERT (m_endPoint == 0); + NS_ASSERT (m_endPoint == nullptr); } - if (m_endPoint6 != 0) + if (m_endPoint6 != nullptr) { NS_ASSERT (m_udp); /** @@ -127,11 +127,11 @@ UdpSocketImpl::~UdpSocketImpl () * in turn a call to the method UdpSocketImpl::Destroy below * will will zero the m_endPoint field. */ - NS_ASSERT (m_endPoint6 != 0); + NS_ASSERT (m_endPoint6 != nullptr); m_udp->DeAllocate (m_endPoint6); - NS_ASSERT (m_endPoint6 == 0); + NS_ASSERT (m_endPoint6 == nullptr); } - m_udp = 0; + m_udp = nullptr; } void @@ -173,31 +173,31 @@ void UdpSocketImpl::Destroy () { NS_LOG_FUNCTION (this); - m_endPoint = 0; + m_endPoint = nullptr; } void UdpSocketImpl::Destroy6 () { NS_LOG_FUNCTION (this); - m_endPoint6 = 0; + m_endPoint6 = nullptr; } /* Deallocate the end point and cancel all the timers */ void UdpSocketImpl::DeallocateEndPoint () { - if (m_endPoint != 0) + if (m_endPoint != nullptr) { m_endPoint->SetDestroyCallback (MakeNullCallback ()); m_udp->DeAllocate (m_endPoint); - m_endPoint = 0; + m_endPoint = nullptr; } - if (m_endPoint6 != 0) + if (m_endPoint6 != nullptr) { m_endPoint6->SetDestroyCallback (MakeNullCallback ()); m_udp->DeAllocate (m_endPoint6); - m_endPoint6 = 0; + m_endPoint6 = nullptr; } } @@ -207,14 +207,14 @@ UdpSocketImpl::FinishBind () { NS_LOG_FUNCTION (this); bool done = false; - if (m_endPoint != 0) + if (m_endPoint != nullptr) { m_endPoint->SetRxCallback (MakeCallback (&UdpSocketImpl::ForwardUp, Ptr (this))); m_endPoint->SetIcmpCallback (MakeCallback (&UdpSocketImpl::ForwardIcmp, Ptr (this))); m_endPoint->SetDestroyCallback (MakeCallback (&UdpSocketImpl::Destroy, Ptr (this))); done = true; } - if (m_endPoint6 != 0) + if (m_endPoint6 != nullptr) { m_endPoint6->SetRxCallback (MakeCallback (&UdpSocketImpl::ForwardUp6, Ptr (this))); m_endPoint6->SetIcmpCallback (MakeCallback (&UdpSocketImpl::ForwardIcmp6, Ptr (this))); @@ -259,7 +259,7 @@ UdpSocketImpl::Bind (const Address &address) if (InetSocketAddress::IsMatchingType (address)) { - NS_ASSERT_MSG (m_endPoint == 0, "Endpoint already allocated."); + NS_ASSERT_MSG (m_endPoint == nullptr, "Endpoint already allocated."); InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); Ipv4Address ipv4 = transport.GetIpv4 (); @@ -281,7 +281,7 @@ UdpSocketImpl::Bind (const Address &address) { m_endPoint = m_udp->Allocate (GetBoundNetDevice (), ipv4, port); } - if (0 == m_endPoint) + if (nullptr == m_endPoint) { m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL; return -1; @@ -294,7 +294,7 @@ UdpSocketImpl::Bind (const Address &address) } else if (Inet6SocketAddress::IsMatchingType (address)) { - NS_ASSERT_MSG (m_endPoint == 0, "Endpoint already allocated."); + NS_ASSERT_MSG (m_endPoint == nullptr, "Endpoint already allocated."); Inet6SocketAddress transport = Inet6SocketAddress::ConvertFrom (address); Ipv6Address ipv6 = transport.GetIpv6 (); @@ -315,7 +315,7 @@ UdpSocketImpl::Bind (const Address &address) { m_endPoint6 = m_udp->Allocate6 (GetBoundNetDevice (), ipv6, port); } - if (0 == m_endPoint6) + if (nullptr == m_endPoint6) { m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL; return -1; @@ -447,23 +447,23 @@ int UdpSocketImpl::DoSend (Ptr p) { NS_LOG_FUNCTION (this << p); - if ((m_endPoint == 0) && (Ipv4Address::IsMatchingType(m_defaultAddress) == true)) + if ((m_endPoint == nullptr) && (Ipv4Address::IsMatchingType(m_defaultAddress) == true)) { if (Bind () == -1) { - NS_ASSERT (m_endPoint == 0); + NS_ASSERT (m_endPoint == nullptr); return -1; } - NS_ASSERT (m_endPoint != 0); + NS_ASSERT (m_endPoint != nullptr); } - else if ((m_endPoint6 == 0) && (Ipv6Address::IsMatchingType(m_defaultAddress) == true)) + else if ((m_endPoint6 == nullptr) && (Ipv6Address::IsMatchingType(m_defaultAddress) == true)) { if (Bind6 () == -1) { - NS_ASSERT (m_endPoint6 == 0); + NS_ASSERT (m_endPoint6 == nullptr); return -1; } - NS_ASSERT (m_endPoint6 != 0); + NS_ASSERT (m_endPoint6 != nullptr); } if (m_shutdownSend) { @@ -492,14 +492,14 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port, uint8_t { NS_LOG_LOGIC ("Bound interface number " << m_boundnetdevice->GetIfIndex ()); } - if (m_endPoint == 0) + if (m_endPoint == nullptr) { if (Bind () == -1) { - NS_ASSERT (m_endPoint == 0); + NS_ASSERT (m_endPoint == nullptr); return -1; } - NS_ASSERT (m_endPoint != 0); + NS_ASSERT (m_endPoint != nullptr); } if (m_shutdownSend) { @@ -604,7 +604,7 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port, uint8_t else if (m_endPoint->GetLocalAddress () != Ipv4Address::GetAny ()) { m_udp->Send (p->Copy (), m_endPoint->GetLocalAddress (), dest, - m_endPoint->GetLocalPort (), port, 0); + m_endPoint->GetLocalPort (), port, nullptr); NotifyDataSent (p->GetSize ()); NotifySend (GetTxAvailable ()); return p->GetSize (); @@ -675,14 +675,14 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv6Address dest, uint16_t port) { NS_LOG_LOGIC ("Bound interface number " << m_boundnetdevice->GetIfIndex ()); } - if (m_endPoint6 == 0) + if (m_endPoint6 == nullptr) { if (Bind6 () == -1) { - NS_ASSERT (m_endPoint6 == 0); + NS_ASSERT (m_endPoint6 == nullptr); return -1; } - NS_ASSERT (m_endPoint6 != 0); + NS_ASSERT (m_endPoint6 != nullptr); } if (m_shutdownSend) { @@ -742,7 +742,7 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv6Address dest, uint16_t port) if (m_endPoint6->GetLocalAddress () != Ipv6Address::GetAny ()) { m_udp->Send (p->Copy (), m_endPoint6->GetLocalAddress (), dest, - m_endPoint6->GetLocalPort (), port, 0); + m_endPoint6->GetLocalPort (), port, nullptr); NotifyDataSent (p->GetSize ()); NotifySend (GetTxAvailable ()); return p->GetSize (); @@ -847,7 +847,7 @@ UdpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags, if (m_deliveryQueue.empty () ) { m_errno = ERROR_AGAIN; - return 0; + return nullptr; } Ptr p = m_deliveryQueue.front ().first; fromAddress = m_deliveryQueue.front ().second; @@ -859,7 +859,7 @@ UdpSocketImpl::RecvFrom (uint32_t maxSize, uint32_t flags, } else { - p = 0; + p = nullptr; } return p; } @@ -868,11 +868,11 @@ int UdpSocketImpl::GetSockName (Address &address) const { NS_LOG_FUNCTION (this << address); - if (m_endPoint != 0) + if (m_endPoint != nullptr) { address = InetSocketAddress (m_endPoint->GetLocalAddress (), m_endPoint->GetLocalPort ()); } - else if (m_endPoint6 != 0) + else if (m_endPoint6 != nullptr) { address = Inet6SocketAddress (m_endPoint6->GetLocalAddress (), m_endPoint6->GetLocalPort ()); } @@ -952,12 +952,12 @@ UdpSocketImpl::BindToNetDevice (Ptr netdevice) Ptr oldBoundNetDevice = m_boundnetdevice; Socket::BindToNetDevice (netdevice); // Includes sanity check - if (m_endPoint != 0) + if (m_endPoint != nullptr) { m_endPoint->BindToNetDevice (netdevice); } - if (m_endPoint6 != 0) + if (m_endPoint6 != nullptr) { m_endPoint6->BindToNetDevice (netdevice); diff --git a/src/internet/test/global-route-manager-impl-test-suite.cc b/src/internet/test/global-route-manager-impl-test-suite.cc index 7b7cb9ae3..91a7cba85 100644 --- a/src/internet/test/global-route-manager-impl-test-suite.cc +++ b/src/internet/test/global-route-manager-impl-test-suite.cc @@ -69,7 +69,7 @@ GlobalRouteManagerImplTestCase::DoRun () { SPFVertex *v = candidate.Pop (); delete v; - v = 0; + v = nullptr; } // Build fake link state database; four routers (0-3), 3 point-to-point diff --git a/src/internet/test/ipv4-forwarding-test.cc b/src/internet/test/ipv4-forwarding-test.cc index 879f2dfd8..b408ead5f 100644 --- a/src/internet/test/ipv4-forwarding-test.cc +++ b/src/internet/test/ipv4-forwarding-test.cc @@ -206,7 +206,7 @@ Ipv4ForwardingTest::DoRun () NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 123, "IPv4 Forwarding on"); m_receivedPacket->RemoveAllByteTags (); - m_receivedPacket = 0; + m_receivedPacket = nullptr; Ptr ipv4 = fwNode->GetObject (); ipv4->SetAttribute("IpForward", BooleanValue (false)); diff --git a/src/internet/test/ipv4-fragmentation-test.cc b/src/internet/test/ipv4-fragmentation-test.cc index 0b1c5e4d0..47f6875c1 100644 --- a/src/internet/test/ipv4-fragmentation-test.cc +++ b/src/internet/test/ipv4-fragmentation-test.cc @@ -176,8 +176,8 @@ Ipv4FragmentationTest::Ipv4FragmentationTest (bool broadcast) : TestCase (std::string ("Verify the IPv4 layer 3 protocol fragmentation and reassembly: ") + (broadcast? "broadcast": "unicast")) { - m_socketServer = 0; - m_data = 0; + m_socketServer = nullptr; + m_data = nullptr; m_dataSize = 0; m_size = 0; m_icmpType = 0; @@ -190,7 +190,7 @@ Ipv4FragmentationTest::~Ipv4FragmentationTest () { delete[] m_data; } - m_data = 0; + m_data = nullptr; m_dataSize = 0; } diff --git a/src/internet/test/ipv4-global-routing-test-suite.cc b/src/internet/test/ipv4-global-routing-test-suite.cc index 12b46d30e..f99303e8b 100644 --- a/src/internet/test/ipv4-global-routing-test-suite.cc +++ b/src/internet/test/ipv4-global-routing-test-suite.cc @@ -613,7 +613,7 @@ BridgeTest::DoRun () Ptr globalRouting4 = routing4->GetObject (); NS_TEST_ASSERT_MSG_NE (globalRouting4, nullptr, "Error-- no Ipv4GlobalRouting object"); - Ipv4RoutingTableEntry* route = 0; + Ipv4RoutingTableEntry* route = nullptr; // n0 // Test that the right number of routes found uint32_t nRoutes0 = globalRouting0->GetNRoutes (); @@ -633,7 +633,7 @@ BridgeTest::DoRun () // n1 // Test that the right number of routes found - route = 0; + route = nullptr; uint32_t nRoutes1 = globalRouting1->GetNRoutes (); NS_LOG_DEBUG ("BridgeTest nRoutes1 " << nRoutes1); NS_TEST_ASSERT_MSG_EQ (nRoutes1, 3, "Error-- not three entries"); @@ -653,7 +653,7 @@ BridgeTest::DoRun () NS_LOG_DEBUG ("BridgeTest skip print out of n2 and n3, go next to node n4"); // n4 - route = 0; + route = nullptr; // Test that the right number of routes found uint32_t nRoutes4 = globalRouting4->GetNRoutes (); NS_LOG_DEBUG ("BridgeTest nRoutes4 " << nRoutes4); @@ -782,7 +782,7 @@ TwoBridgeTest::DoRun () Ptr globalRouting4 = routing4->GetObject (); NS_TEST_ASSERT_MSG_NE (globalRouting4, nullptr, "Error-- no Ipv4GlobalRouting object"); - Ipv4RoutingTableEntry* route = 0; + Ipv4RoutingTableEntry* route = nullptr; // n0 // Test that the right number of routes found uint32_t nRoutes0 = globalRouting0->GetNRoutes (); @@ -804,7 +804,7 @@ TwoBridgeTest::DoRun () // n4 // Test that the right number of routes found - route = 0; + route = nullptr; uint32_t nRoutes4 = globalRouting4->GetNRoutes (); NS_LOG_DEBUG ("BridgeTest nRoutes4 " << nRoutes4); NS_TEST_ASSERT_MSG_EQ (nRoutes4, 2, "Error-- not two entries"); @@ -883,7 +883,7 @@ Ipv4DynamicGlobalRoutingTestCase::~Ipv4DynamicGlobalRoutingTestCase () { iter->second = false; iter->first->Close (); - iter->first = 0; + iter->first = nullptr; } } } @@ -937,7 +937,7 @@ Ipv4DynamicGlobalRoutingTestCase::ShutDownSock (uint8_t index) { m_sendSocks[index].second = false; m_sendSocks[index].first->Close (); - m_sendSocks[index].first = 0; + m_sendSocks[index].first = nullptr; } // Test derived from examples/routing/dynamic-global-routing.cc diff --git a/src/internet/test/ipv4-header-test.cc b/src/internet/test/ipv4-header-test.cc index 4fa1e67e8..97694c5cd 100644 --- a/src/internet/test/ipv4-header-test.cc +++ b/src/internet/test/ipv4-header-test.cc @@ -240,7 +240,7 @@ Ipv4HeaderTest::DoRun () m_receivedHeader.Print (std::cout); std::cout << std::endl; m_receivedPacket->RemoveAllByteTags (); - m_receivedPacket = 0; + m_receivedPacket = nullptr; } // Ecn tests @@ -259,7 +259,7 @@ Ipv4HeaderTest::DoRun () m_receivedHeader.Print (std::cout); std::cout << std::endl; m_receivedPacket->RemoveAllByteTags (); - m_receivedPacket = 0; + m_receivedPacket = nullptr; } Simulator::Destroy (); diff --git a/src/internet/test/ipv4-list-routing-test-suite.cc b/src/internet/test/ipv4-list-routing-test-suite.cc index 7a2830164..b9699c987 100644 --- a/src/internet/test/ipv4-list-routing-test-suite.cc +++ b/src/internet/test/ipv4-list-routing-test-suite.cc @@ -31,7 +31,7 @@ using namespace ns3; */ class Ipv4ARouting : public Ipv4RoutingProtocol { public: - Ptr RouteOutput (Ptr p, const Ipv4Header &header, Ptr oif, Socket::SocketErrno &sockerr) override { return 0; } + Ptr RouteOutput (Ptr p, const Ipv4Header &header, Ptr oif, Socket::SocketErrno &sockerr) override { return nullptr; } bool RouteInput (Ptr p, const Ipv4Header &header, Ptr idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) override { return false; } @@ -51,7 +51,7 @@ public: */ class Ipv4BRouting : public Ipv4RoutingProtocol { public: - Ptr RouteOutput (Ptr p, const Ipv4Header &header, Ptr oif, Socket::SocketErrno &sockerr) override { return 0; } + Ptr RouteOutput (Ptr p, const Ipv4Header &header, Ptr oif, Socket::SocketErrno &sockerr) override { return nullptr; } bool RouteInput (Ptr p, const Ipv4Header &header, Ptr idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) override { return false; } diff --git a/src/internet/test/ipv4-raw-test.cc b/src/internet/test/ipv4-raw-test.cc index 910bd0b39..c72eb0d94 100644 --- a/src/internet/test/ipv4-raw-test.cc +++ b/src/internet/test/ipv4-raw-test.cc @@ -319,8 +319,8 @@ Ipv4RawSocketImplTest::DoRun () NS_TEST_EXPECT_MSG_EQ (m_receivedPacket2->GetSize (), 143, "recv: 255.255.255.255"); #endif - m_receivedPacket = 0; - m_receivedPacket2 = 0; + m_receivedPacket = nullptr; + m_receivedPacket2 = nullptr; // Simple getpeername tests diff --git a/src/internet/test/ipv6-forwarding-test.cc b/src/internet/test/ipv6-forwarding-test.cc index 8d883c422..e0075b05e 100644 --- a/src/internet/test/ipv6-forwarding-test.cc +++ b/src/internet/test/ipv6-forwarding-test.cc @@ -196,7 +196,7 @@ Ipv6ForwardingTest::DoRun () NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 0, "IPv6 Forwarding off"); m_receivedPacket->RemoveAllByteTags (); - m_receivedPacket = 0; + m_receivedPacket = nullptr; ipv6 = fwNode->GetObject (); ipv6->SetAttribute("IpForward", BooleanValue (true)); diff --git a/src/internet/test/ipv6-fragmentation-test.cc b/src/internet/test/ipv6-fragmentation-test.cc index df2e50840..9e735f6b1 100644 --- a/src/internet/test/ipv6-fragmentation-test.cc +++ b/src/internet/test/ipv6-fragmentation-test.cc @@ -202,8 +202,8 @@ public: Ipv6FragmentationTest::Ipv6FragmentationTest () : TestCase ("Verify the IPv6 layer 3 protocol fragmentation and reassembly") { - m_socketServer = 0; - m_data = 0; + m_socketServer = nullptr; + m_data = nullptr; m_dataSize = 0; m_size = 0; m_icmpType = 0; @@ -216,7 +216,7 @@ Ipv6FragmentationTest::~Ipv6FragmentationTest () { delete[] m_data; } - m_data = 0; + m_data = nullptr; m_dataSize = 0; } diff --git a/src/internet/test/ipv6-list-routing-test-suite.cc b/src/internet/test/ipv6-list-routing-test-suite.cc index 5bc9116bb..1d68ae512 100644 --- a/src/internet/test/ipv6-list-routing-test-suite.cc +++ b/src/internet/test/ipv6-list-routing-test-suite.cc @@ -32,7 +32,7 @@ using namespace ns3; */ class Ipv6ARouting : public Ipv6RoutingProtocol { public: - Ptr RouteOutput (Ptr p, const Ipv6Header &header, Ptr oif, Socket::SocketErrno &sockerr) override { return 0; } + Ptr RouteOutput (Ptr p, const Ipv6Header &header, Ptr oif, Socket::SocketErrno &sockerr) override { return nullptr; } bool RouteInput (Ptr p, const Ipv6Header &header, Ptr idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) override { return false; } @@ -55,7 +55,7 @@ public: */ class Ipv6BRouting : public Ipv6RoutingProtocol { public: - Ptr RouteOutput (Ptr p, const Ipv6Header &header, Ptr oif, Socket::SocketErrno &sockerr) override { return 0; } + Ptr RouteOutput (Ptr p, const Ipv6Header &header, Ptr oif, Socket::SocketErrno &sockerr) override { return nullptr; } bool RouteInput (Ptr p, const Ipv6Header &header, Ptr idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) override { return false; } diff --git a/src/internet/test/ipv6-raw-test.cc b/src/internet/test/ipv6-raw-test.cc index 6abca8068..5312600a4 100644 --- a/src/internet/test/ipv6-raw-test.cc +++ b/src/internet/test/ipv6-raw-test.cc @@ -273,8 +273,8 @@ Ipv6RawSocketImplTest::DoRun () NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 163, "recv: ff02::1"); NS_TEST_EXPECT_MSG_EQ (m_receivedPacket2->GetSize (), 163, "recv: ff02::1"); - m_receivedPacket = 0; - m_receivedPacket2 = 0; + m_receivedPacket = nullptr; + m_receivedPacket2 = nullptr; // Simple getpeername tests diff --git a/src/internet/test/tcp-fast-retr-test.cc b/src/internet/test/tcp-fast-retr-test.cc index bec8dfa03..e56204f71 100644 --- a/src/internet/test/tcp-fast-retr-test.cc +++ b/src/internet/test/tcp-fast-retr-test.cc @@ -128,7 +128,7 @@ TcpFastRetrTest::ConfigureEnvironment () Ptr TcpFastRetrTest::CreateSenderErrorModel () { - return 0; + return nullptr; } Ptr diff --git a/src/internet/test/udp-test.cc b/src/internet/test/udp-test.cc index b19bc8672..ac90f9e4d 100644 --- a/src/internet/test/udp-test.cc +++ b/src/internet/test/udp-test.cc @@ -411,8 +411,8 @@ UdpSocketImplTest::DoRun () NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 0, "first socket should not receive it (it is bound specifically to the first interface's address"); NS_TEST_EXPECT_MSG_EQ (m_receivedPacket2->GetSize (), 123, "trivial"); - m_receivedPacket = 0; - m_receivedPacket2 = 0; + m_receivedPacket = nullptr; + m_receivedPacket2 = nullptr; // Simple Link-local multicast test diff --git a/src/lr-wpan/helper/lr-wpan-helper.cc b/src/lr-wpan/helper/lr-wpan-helper.cc index b439d397a..1aceabc37 100644 --- a/src/lr-wpan/helper/lr-wpan-helper.cc +++ b/src/lr-wpan/helper/lr-wpan-helper.cc @@ -94,7 +94,7 @@ LrWpanHelper::LrWpanHelper (bool useMultiModelSpectrumChannel) LrWpanHelper::~LrWpanHelper () { m_channel->Dispose (); - m_channel = 0; + m_channel = nullptr; } void diff --git a/src/lr-wpan/model/lr-wpan-csmaca.cc b/src/lr-wpan/model/lr-wpan-csmaca.cc index 97591f7b1..057334a71 100644 --- a/src/lr-wpan/model/lr-wpan-csmaca.cc +++ b/src/lr-wpan/model/lr-wpan-csmaca.cc @@ -69,7 +69,7 @@ LrWpanCsmaCa::LrWpanCsmaCa () LrWpanCsmaCa::~LrWpanCsmaCa () { - m_mac = 0; + m_mac = nullptr; } void @@ -79,7 +79,7 @@ LrWpanCsmaCa::DoDispose () m_lrWpanMacTransCostCallback = MakeNullCallback (); Cancel (); - m_mac = 0; + m_mac = nullptr; } void diff --git a/src/lr-wpan/model/lr-wpan-interference-helper.cc b/src/lr-wpan/model/lr-wpan-interference-helper.cc index f9c0aa9e8..c3d5ab17a 100644 --- a/src/lr-wpan/model/lr-wpan-interference-helper.cc +++ b/src/lr-wpan/model/lr-wpan-interference-helper.cc @@ -36,8 +36,8 @@ LrWpanInterferenceHelper::LrWpanInterferenceHelper (Ptr spe LrWpanInterferenceHelper::~LrWpanInterferenceHelper () { - m_spectrumModel = 0; - m_signal = 0; + m_spectrumModel = nullptr; + m_signal = nullptr; m_signals.clear (); } diff --git a/src/lr-wpan/model/lr-wpan-mac.cc b/src/lr-wpan/model/lr-wpan-mac.cc index 48aa7bf2f..6bbcf1568 100644 --- a/src/lr-wpan/model/lr-wpan-mac.cc +++ b/src/lr-wpan/model/lr-wpan-mac.cc @@ -2622,7 +2622,7 @@ LrWpanMac::RemovePendTxQElement (Ptr p) } } - p = 0; + p = nullptr; } void diff --git a/src/lr-wpan/model/lr-wpan-net-device.cc b/src/lr-wpan/model/lr-wpan-net-device.cc index a95da3fd3..d9bbb2047 100644 --- a/src/lr-wpan/model/lr-wpan-net-device.cc +++ b/src/lr-wpan/model/lr-wpan-net-device.cc @@ -96,10 +96,10 @@ LrWpanNetDevice::DoDispose () m_mac->Dispose (); m_phy->Dispose (); m_csmaca->Dispose (); - m_phy = 0; - m_mac = 0; - m_csmaca = 0; - m_node = 0; + m_phy = nullptr; + m_mac = nullptr; + m_csmaca = nullptr; + m_node = nullptr; // chain up. NetDevice::DoDispose (); diff --git a/src/lr-wpan/model/lr-wpan-phy.cc b/src/lr-wpan/model/lr-wpan-phy.cc index cf3b77cf3..d22ca5e26 100644 --- a/src/lr-wpan/model/lr-wpan-phy.cc +++ b/src/lr-wpan/model/lr-wpan-phy.cc @@ -270,7 +270,7 @@ LrWpanPhy::GetRxSpectrumModel () const } else { - return 0; + return nullptr; } } @@ -507,7 +507,7 @@ LrWpanPhy::EndRx (Ptr par) // The packet was destroyed, drop it. m_phyRxDropTrace (currentPacket); } - Ptr none = 0; + Ptr none = nullptr; m_currentRxPacket = std::make_pair (none, true); if (!m_isRxCanceled) @@ -988,7 +988,7 @@ LrWpanPhy::PlmeSetAttributeRequest (LrWpanPibAttributeIdentifier id, { m_currentTxPacket.second = true; m_pdDataRequest.Cancel (); - m_currentTxPacket.first = 0; + m_currentTxPacket.first = nullptr; if (!m_pdDataConfirmCallback.IsNull ()) { m_pdDataConfirmCallback (IEEE_802_15_4_PHY_TRX_OFF); @@ -1161,7 +1161,7 @@ LrWpanPhy::PlmeSetAttributeRequest (LrWpanPibAttributeIdentifier id, { m_currentTxPacket.second = true; m_pdDataRequest.Cancel (); - m_currentTxPacket.first = 0; + m_currentTxPacket.first = nullptr; if (!m_pdDataConfirmCallback.IsNull ()) { m_pdDataConfirmCallback (IEEE_802_15_4_PHY_TRX_OFF); @@ -1462,7 +1462,7 @@ LrWpanPhy::EndTx () m_pdDataConfirmCallback (m_trxState); } } - m_currentTxPacket.first = 0; + m_currentTxPacket.first = nullptr; m_currentTxPacket.second = false; @@ -1654,11 +1654,11 @@ LrWpanPhy::SetPhyOption (LrWpanPhyOption phyOption) m_noise = psdHelper.CreateNoisePowerSpectralDensity (m_phyPIBAttributes.phyCurrentChannel); m_signal = Create (m_noise->GetSpectrumModel ()); m_rxLastUpdate = Seconds (0); - Ptr none_packet = 0; - Ptr none_params = 0; + Ptr none_packet = nullptr; + Ptr none_params = nullptr; m_currentRxPacket = std::make_pair (none_params, true); m_currentTxPacket = std::make_pair (none_packet, true); - m_errorModel = 0; + m_errorModel = nullptr; } diff --git a/src/lr-wpan/test/lr-wpan-ack-test.cc b/src/lr-wpan/test/lr-wpan-ack-test.cc index 9deddc59f..189d0892b 100644 --- a/src/lr-wpan/test/lr-wpan-ack-test.cc +++ b/src/lr-wpan/test/lr-wpan-ack-test.cc @@ -306,8 +306,8 @@ LrWpanAckTestCase::DoRun () NS_TEST_EXPECT_MSG_LT (m_replySentTime, m_replyArrivalTime, "The reply was sent before the reply arrived (as expected)"); NS_TEST_EXPECT_MSG_EQ (ackCounter, expectedAckCount, "The right amount of ACKs have been seen on the channel (as expected)"); - m_dev0 = 0; - m_dev1 = 0; + m_dev0 = nullptr; + m_dev1 = nullptr; Simulator::Destroy (); } diff --git a/src/lte/examples/lena-dual-stripe.cc b/src/lte/examples/lena-dual-stripe.cc index c472ca1b2..649a594ed 100644 --- a/src/lte/examples/lena-dual-stripe.cc +++ b/src/lte/examples/lena-dual-stripe.cc @@ -963,7 +963,7 @@ main (int argc, char *argv[]) //GtkConfigStore config; //config.ConfigureAttributes (); - lteHelper = 0; + lteHelper = nullptr; Simulator::Destroy (); return 0; } diff --git a/src/lte/examples/lena-rem-sector-antenna.cc b/src/lte/examples/lena-rem-sector-antenna.cc index b0ad16868..aca78b5b1 100644 --- a/src/lte/examples/lena-rem-sector-antenna.cc +++ b/src/lte/examples/lena-rem-sector-antenna.cc @@ -221,7 +221,7 @@ main (int argc, char *argv[]) // GtkConfigStore config; // config.ConfigureAttributes (); - lteHelper = 0; + lteHelper = nullptr; Simulator::Destroy (); return 0; } diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index ff327ccb0..9b27446b6 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -202,8 +202,8 @@ void LteHelper::DoDispose () { NS_LOG_FUNCTION (this); - m_downlinkChannel = 0; - m_uplinkChannel = 0; + m_downlinkChannel = nullptr; + m_uplinkChannel = nullptr; m_componentCarrierPhyParams.clear(); Object::DoDispose (); } diff --git a/src/lte/helper/no-backhaul-epc-helper.cc b/src/lte/helper/no-backhaul-epc-helper.cc index 384e891cf..df1408d90 100644 --- a/src/lte/helper/no-backhaul-epc-helper.cc +++ b/src/lte/helper/no-backhaul-epc-helper.cc @@ -296,12 +296,12 @@ NoBackhaulEpcHelper::DoDispose () { NS_LOG_FUNCTION (this); m_tunDevice->SetSendCallback (MakeNullCallback, const Address&, const Address&, uint16_t> ()); - m_tunDevice = 0; - m_sgwApp = 0; + m_tunDevice = nullptr; + m_sgwApp = nullptr; m_sgw->Dispose (); - m_pgwApp = 0; + m_pgwApp = nullptr; m_pgw->Dispose (); - m_mmeApp = 0; + m_mmeApp = nullptr; m_mme->Dispose (); } diff --git a/src/lte/model/a2-a4-rsrq-handover-algorithm.cc b/src/lte/model/a2-a4-rsrq-handover-algorithm.cc index 2dbae0cf7..73e94a1d2 100644 --- a/src/lte/model/a2-a4-rsrq-handover-algorithm.cc +++ b/src/lte/model/a2-a4-rsrq-handover-algorithm.cc @@ -45,7 +45,7 @@ NS_OBJECT_ENSURE_REGISTERED (A2A4RsrqHandoverAlgorithm); A2A4RsrqHandoverAlgorithm::A2A4RsrqHandoverAlgorithm () : m_servingCellThreshold (30), m_neighbourCellOffset (1), - m_handoverManagementSapUser (0) + m_handoverManagementSapUser (nullptr) { NS_LOG_FUNCTION (this); m_handoverManagementSapProvider = new MemberLteHandoverManagementSapProvider (this); diff --git a/src/lte/model/a3-rsrp-handover-algorithm.cc b/src/lte/model/a3-rsrp-handover-algorithm.cc index 64988001d..85fec7f9d 100644 --- a/src/lte/model/a3-rsrp-handover-algorithm.cc +++ b/src/lte/model/a3-rsrp-handover-algorithm.cc @@ -34,7 +34,7 @@ NS_OBJECT_ENSURE_REGISTERED (A3RsrpHandoverAlgorithm); A3RsrpHandoverAlgorithm::A3RsrpHandoverAlgorithm () - : m_handoverManagementSapUser (0) + : m_handoverManagementSapUser (nullptr) { NS_LOG_FUNCTION (this); m_handoverManagementSapProvider = new MemberLteHandoverManagementSapProvider (this); diff --git a/src/lte/model/component-carrier-enb.cc b/src/lte/model/component-carrier-enb.cc index 61f81aaad..7ad10c306 100644 --- a/src/lte/model/component-carrier-enb.cc +++ b/src/lte/model/component-carrier-enb.cc @@ -82,22 +82,22 @@ ComponentCarrierEnb::DoDispose () if (m_phy) { m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; } if (m_mac) { m_mac->Dispose (); - m_mac = 0; + m_mac = nullptr; } if (m_scheduler) { m_scheduler->Dispose (); - m_scheduler = 0; + m_scheduler = nullptr; } if (m_ffrAlgorithm) { m_ffrAlgorithm->Dispose (); - m_ffrAlgorithm = 0; + m_ffrAlgorithm = nullptr; } Object::DoDispose (); diff --git a/src/lte/model/component-carrier-ue.cc b/src/lte/model/component-carrier-ue.cc index f13e09c55..25dedf674 100644 --- a/src/lte/model/component-carrier-ue.cc +++ b/src/lte/model/component-carrier-ue.cc @@ -69,9 +69,9 @@ ComponentCarrierUe::DoDispose () { NS_LOG_FUNCTION (this); m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; m_mac->Dispose (); - m_mac = 0; + m_mac = nullptr; Object::DoDispose (); } diff --git a/src/lte/model/cqa-ff-mac-scheduler.cc b/src/lte/model/cqa-ff-mac-scheduler.cc index 0ae01748d..cf98355d8 100644 --- a/src/lte/model/cqa-ff-mac-scheduler.cc +++ b/src/lte/model/cqa-ff-mac-scheduler.cc @@ -128,15 +128,15 @@ bool CqaKeyDescComparator (uint16_t key1, uint16_t key2) CqaFfMacScheduler::CqaFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_timeWindow (99.0), m_nextRntiUl (0) { m_amc = CreateObject (); m_cschedSapProvider = new MemberCschedSapProvider (this); m_schedSapProvider = new MemberSchedSapProvider (this); - m_ffrSapProvider = 0; + m_ffrSapProvider = nullptr; m_ffrSapUser = new MemberLteFfrSapUser (this); } diff --git a/src/lte/model/epc-enb-application.cc b/src/lte/model/epc-enb-application.cc index b832e3e13..ebe43853b 100644 --- a/src/lte/model/epc-enb-application.cc +++ b/src/lte/model/epc-enb-application.cc @@ -80,9 +80,9 @@ void EpcEnbApplication::DoDispose () { NS_LOG_FUNCTION (this); - m_lteSocket = 0; - m_lteSocket6 = 0; - m_s1uSocket = 0; + m_lteSocket = nullptr; + m_lteSocket6 = nullptr; + m_s1uSocket = nullptr; delete m_s1SapProvider; delete m_s1apSapEnb; } @@ -91,8 +91,8 @@ EpcEnbApplication::EpcEnbApplication (Ptr lteSocket, Ptr lteSock : m_lteSocket (lteSocket), m_lteSocket6 (lteSocket6), m_gtpuUdpPort (2152), // fixed by the standard - m_s1SapUser (0), - m_s1apSapMme (0), + m_s1SapUser (nullptr), + m_s1apSapMme (nullptr), m_cellId (cellId) { NS_LOG_FUNCTION (this << lteSocket << lteSocket6 << cellId); diff --git a/src/lte/model/epc-pgw-application.cc b/src/lte/model/epc-pgw-application.cc index 78ca91dca..4e6aac3c8 100644 --- a/src/lte/model/epc-pgw-application.cc +++ b/src/lte/model/epc-pgw-application.cc @@ -135,9 +135,9 @@ EpcPgwApplication::DoDispose () { NS_LOG_FUNCTION (this); m_s5uSocket->SetRecvCallback (MakeNullCallback > ()); - m_s5uSocket = 0; + m_s5uSocket = nullptr; m_s5cSocket->SetRecvCallback (MakeNullCallback > ()); - m_s5cSocket = 0; + m_s5cSocket = nullptr; } EpcPgwApplication::EpcPgwApplication (const Ptr tunDevice, Ipv4Address s5Addr, diff --git a/src/lte/model/epc-sgw-application.cc b/src/lte/model/epc-sgw-application.cc index 07cf5e592..4369ed6d0 100644 --- a/src/lte/model/epc-sgw-application.cc +++ b/src/lte/model/epc-sgw-application.cc @@ -54,11 +54,11 @@ EpcSgwApplication::DoDispose () { NS_LOG_FUNCTION (this); m_s1uSocket->SetRecvCallback (MakeNullCallback > ()); - m_s1uSocket = 0; + m_s1uSocket = nullptr; m_s5uSocket->SetRecvCallback (MakeNullCallback > ()); - m_s5uSocket = 0; + m_s5uSocket = nullptr; m_s5cSocket->SetRecvCallback (MakeNullCallback > ()); - m_s5cSocket = 0; + m_s5cSocket = nullptr; } TypeId diff --git a/src/lte/model/epc-ue-nas.cc b/src/lte/model/epc-ue-nas.cc index a92fb4884..e60fa84ef 100644 --- a/src/lte/model/epc-ue-nas.cc +++ b/src/lte/model/epc-ue-nas.cc @@ -60,7 +60,7 @@ NS_OBJECT_ENSURE_REGISTERED (EpcUeNas); EpcUeNas::EpcUeNas () : m_state (OFF), m_csgId (0), - m_asSapProvider (0), + m_asSapProvider (nullptr), m_bidCounter (0) { NS_LOG_FUNCTION (this); diff --git a/src/lte/model/epc-x2.cc b/src/lte/model/epc-x2.cc index bf8348ddc..e43590220 100644 --- a/src/lte/model/epc-x2.cc +++ b/src/lte/model/epc-x2.cc @@ -40,8 +40,8 @@ X2IfaceInfo::X2IfaceInfo (Ipv4Address remoteIpAddr, Ptr localCtrlPlaneSo X2IfaceInfo::~X2IfaceInfo () { - m_localCtrlPlaneSocket = 0; - m_localUserPlaneSocket = 0; + m_localCtrlPlaneSocket = nullptr; + m_localUserPlaneSocket = nullptr; } X2IfaceInfo& diff --git a/src/lte/model/fdbet-ff-mac-scheduler.cc b/src/lte/model/fdbet-ff-mac-scheduler.cc index b7f4d46b7..6487963a7 100644 --- a/src/lte/model/fdbet-ff-mac-scheduler.cc +++ b/src/lte/model/fdbet-ff-mac-scheduler.cc @@ -49,8 +49,8 @@ NS_OBJECT_ENSURE_REGISTERED (FdBetFfMacScheduler); FdBetFfMacScheduler::FdBetFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_timeWindow (99.0), m_nextRntiUl (0) { diff --git a/src/lte/model/fdmt-ff-mac-scheduler.cc b/src/lte/model/fdmt-ff-mac-scheduler.cc index 2639e7aff..ba4a8d495 100644 --- a/src/lte/model/fdmt-ff-mac-scheduler.cc +++ b/src/lte/model/fdmt-ff-mac-scheduler.cc @@ -49,8 +49,8 @@ NS_OBJECT_ENSURE_REGISTERED (FdMtFfMacScheduler); FdMtFfMacScheduler::FdMtFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_nextRntiUl (0) { m_amc = CreateObject (); diff --git a/src/lte/model/fdtbfq-ff-mac-scheduler.cc b/src/lte/model/fdtbfq-ff-mac-scheduler.cc index c7495928e..d4abaa264 100644 --- a/src/lte/model/fdtbfq-ff-mac-scheduler.cc +++ b/src/lte/model/fdtbfq-ff-mac-scheduler.cc @@ -50,15 +50,15 @@ NS_OBJECT_ENSURE_REGISTERED (FdTbfqFfMacScheduler); FdTbfqFfMacScheduler::FdTbfqFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_nextRntiUl (0), bankSize (0) { m_amc = CreateObject (); m_cschedSapProvider = new MemberCschedSapProvider (this); m_schedSapProvider = new MemberSchedSapProvider (this); - m_ffrSapProvider = 0; + m_ffrSapProvider = nullptr; m_ffrSapUser = new MemberLteFfrSapUser (this); } diff --git a/src/lte/model/lte-anr.cc b/src/lte/model/lte-anr.cc index 23a933c6c..5e681ceda 100644 --- a/src/lte/model/lte-anr.cc +++ b/src/lte/model/lte-anr.cc @@ -37,7 +37,7 @@ NS_OBJECT_ENSURE_REGISTERED (LteAnr); LteAnr::LteAnr (uint16_t servingCellId) - : m_anrSapUser (0), + : m_anrSapUser (nullptr), m_threshold (0), m_measId (0), m_servingCellId (servingCellId) diff --git a/src/lte/model/lte-chunk-processor.cc b/src/lte/model/lte-chunk-processor.cc index 18436cc4d..85cd99325 100644 --- a/src/lte/model/lte-chunk-processor.cc +++ b/src/lte/model/lte-chunk-processor.cc @@ -50,7 +50,7 @@ void LteChunkProcessor::Start () { NS_LOG_FUNCTION (this); - m_sumValues = 0; + m_sumValues = nullptr; m_totDuration = MicroSeconds (0); } diff --git a/src/lte/model/lte-enb-mac.cc b/src/lte/model/lte-enb-mac.cc index f0272f62c..7a5622680 100644 --- a/src/lte/model/lte-enb-mac.cc +++ b/src/lte/model/lte-enb-mac.cc @@ -380,7 +380,7 @@ LteEnbMac::GetTypeId () LteEnbMac::LteEnbMac (): -m_ccmMacSapUser (0) +m_ccmMacSapUser (nullptr) { NS_LOG_FUNCTION (this); m_macSapProvider = new EnbMacMemberLteMacSapProvider (this); diff --git a/src/lte/model/lte-enb-net-device.cc b/src/lte/model/lte-enb-net-device.cc index b973e4fb1..5cdc4b36b 100644 --- a/src/lte/model/lte-enb-net-device.cc +++ b/src/lte/model/lte-enb-net-device.cc @@ -142,8 +142,8 @@ TypeId LteEnbNetDevice::GetTypeId () LteEnbNetDevice::LteEnbNetDevice () : m_isConstructed (false), m_isConfigured (false), - m_anr (0), - m_componentCarrierManager(0) + m_anr (nullptr), + m_componentCarrierManager(nullptr) { NS_LOG_FUNCTION (this); } @@ -159,24 +159,24 @@ LteEnbNetDevice::DoDispose () NS_LOG_FUNCTION (this); m_rrc->Dispose (); - m_rrc = 0; + m_rrc = nullptr; m_handoverAlgorithm->Dispose (); - m_handoverAlgorithm = 0; + m_handoverAlgorithm = nullptr; if (m_anr) { m_anr->Dispose (); - m_anr = 0; + m_anr = nullptr; } m_componentCarrierManager->Dispose(); - m_componentCarrierManager = 0; + m_componentCarrierManager = nullptr; // ComponentCarrierEnb::DoDispose() will call DoDispose // of its PHY, MAC, FFR and scheduler instance for (uint32_t i = 0; i < m_ccMap.size (); i++) { m_ccMap.at (i)->Dispose (); - m_ccMap.at (i) = 0; + m_ccMap.at (i) = nullptr; } LteNetDevice::DoDispose (); diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 8ea50849c..6de3ae6fd 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -151,8 +151,8 @@ LteEnbPhy::LteEnbPhy () LteEnbPhy::LteEnbPhy (Ptr dlPhy, Ptr ulPhy) : LtePhy (dlPhy, ulPhy), - m_enbPhySapUser (0), - m_enbCphySapUser (0), + m_enbPhySapUser (nullptr), + m_enbCphySapUser (nullptr), m_nrFrames (0), m_nrSubFrames (0), m_srsPeriodicity (0), diff --git a/src/lte/model/lte-enb-rrc.cc b/src/lte/model/lte-enb-rrc.cc index 5e181d3f9..71ce30383 100644 --- a/src/lte/model/lte-enb-rrc.cc +++ b/src/lte/model/lte-enb-rrc.cc @@ -588,7 +588,7 @@ UeManager::RecvIdealUeContextRemoveRequest (uint16_t rnti) NS_LOG_FUNCTION (this << m_rnti); //release the bearer info for the UE at SGW/PGW - if (m_rrc->m_s1SapProvider != 0) //if EPC is enabled + if (m_rrc->m_s1SapProvider != nullptr) //if EPC is enabled { for (const auto &it:m_drbMap) { @@ -1140,7 +1140,7 @@ UeManager::RecvRrcConnectionSetupCompleted (LteRrcSap::RrcConnectionSetupComplet m_pendingStartDataRadioBearers = true; } - if (m_rrc->m_s1SapProvider != 0) + if (m_rrc->m_s1SapProvider != nullptr) { m_rrc->m_s1SapProvider->InitialUeMessage (m_imsi, m_rnti); SwitchToState (ATTACH_REQUEST); @@ -1294,7 +1294,7 @@ UeManager::RecvMeasurementReport (LteRrcSap::MeasurementReport msg) << " RSRQ " << (it->haveRsrqResult ? (uint16_t) it->rsrqResult : 255)); } - if ((m_rrc->m_handoverManagementSapProvider != 0) + if ((m_rrc->m_handoverManagementSapProvider != nullptr) && (m_rrc->m_handoverMeasIds.find (measId) != m_rrc->m_handoverMeasIds.end ())) { // this measurement was requested by the handover algorithm @@ -1302,7 +1302,7 @@ UeManager::RecvMeasurementReport (LteRrcSap::MeasurementReport msg) msg.measResults); } - if ((m_rrc->m_ccmRrcSapProvider != 0) + if ((m_rrc->m_ccmRrcSapProvider != nullptr) && (m_rrc->m_componentCarrierMeasIds.find (measId) != m_rrc->m_componentCarrierMeasIds.end ())) { // this measurement was requested by the handover algorithm @@ -1310,7 +1310,7 @@ UeManager::RecvMeasurementReport (LteRrcSap::MeasurementReport msg) msg.measResults); } - if ((m_rrc->m_anrSapProvider != 0) + if ((m_rrc->m_anrSapProvider != nullptr) && (m_rrc->m_anrMeasIds.find (measId) != m_rrc->m_anrMeasIds.end ())) { // this measurement was requested by the ANR function @@ -1751,15 +1751,15 @@ UeManager::BuildNonCriticalExtensionConfigurationCa () NS_OBJECT_ENSURE_REGISTERED (LteEnbRrc); LteEnbRrc::LteEnbRrc () - : m_x2SapProvider (0), + : m_x2SapProvider (nullptr), m_cmacSapProvider (0), - m_handoverManagementSapProvider (0), - m_ccmRrcSapProvider (0), - m_anrSapProvider (0), + m_handoverManagementSapProvider (nullptr), + m_ccmRrcSapProvider (nullptr), + m_anrSapProvider (nullptr), m_ffrRrcSapProvider (0), - m_rrcSapUser (0), - m_macSapProvider (0), - m_s1SapProvider (0), + m_rrcSapUser (nullptr), + m_macSapProvider (nullptr), + m_s1SapProvider (nullptr), m_cphySapProvider (0), m_configured (false), m_lastAllocatedRnti (0), @@ -3010,7 +3010,7 @@ LteEnbRrc::DoTriggerHandover (uint16_t rnti, uint16_t targetCellId) Ptr ueManager = GetUeManager (rnti); NS_ASSERT_MSG (ueManager, "Cannot find UE context with RNTI " << rnti); - if (m_anrSapProvider != 0 && !HasCellId (targetCellId)) + if (m_anrSapProvider != nullptr && !HasCellId (targetCellId)) { // ensure that proper neighbour relationship exists between source and target cells bool noHo = m_anrSapProvider->GetNoHo (targetCellId); @@ -3123,7 +3123,7 @@ LteEnbRrc::RemoveUe (uint16_t rnti) m_cmacSapProvider.at (i)->RemoveUe (rnti); m_cphySapProvider.at (i)->RemoveUe (rnti); } - if (m_s1SapProvider != 0) + if (m_s1SapProvider != nullptr) { m_s1SapProvider->UeContextRelease (rnti); } @@ -3177,7 +3177,7 @@ LteEnbRrc::AddX2Neighbour (uint16_t cellId) { NS_LOG_FUNCTION (this << cellId); - if (m_anrSapProvider != 0) + if (m_anrSapProvider != nullptr) { m_anrSapProvider->AddNeighbourRelation (cellId); } diff --git a/src/lte/model/lte-ffr-distributed-algorithm.cc b/src/lte/model/lte-ffr-distributed-algorithm.cc index 1eaabef8e..38d51fecb 100644 --- a/src/lte/model/lte-ffr-distributed-algorithm.cc +++ b/src/lte/model/lte-ffr-distributed-algorithm.cc @@ -30,8 +30,8 @@ NS_OBJECT_ENSURE_REGISTERED (LteFfrDistributedAlgorithm); LteFfrDistributedAlgorithm::LteFfrDistributedAlgorithm () - : m_ffrSapUser (0), - m_ffrRrcSapUser (0) + : m_ffrSapUser (nullptr), + m_ffrRrcSapUser (nullptr) { NS_LOG_FUNCTION (this); m_ffrSapProvider = new MemberLteFfrSapProvider (this); @@ -515,8 +515,8 @@ LteFfrDistributedAlgorithm::Calculate () continue; } - servingCellMeasures = 0; - neighbourCellMeasures = 0; + servingCellMeasures = nullptr; + neighbourCellMeasures = nullptr; it2 = it1->second.find (m_cellId); if (it2 != it1->second.end ()) diff --git a/src/lte/model/lte-ffr-enhanced-algorithm.cc b/src/lte/model/lte-ffr-enhanced-algorithm.cc index 7571e449d..11de81cd5 100644 --- a/src/lte/model/lte-ffr-enhanced-algorithm.cc +++ b/src/lte/model/lte-ffr-enhanced-algorithm.cc @@ -95,8 +95,8 @@ const uint16_t NUM_UPLINK_CONFS (sizeof (g_ffrEnhancedUplinkDefaultConfiguration LteFfrEnhancedAlgorithm::LteFfrEnhancedAlgorithm () - : m_ffrSapUser (0), - m_ffrRrcSapUser (0), + : m_ffrSapUser (nullptr), + m_ffrRrcSapUser (nullptr), m_measId (0) { NS_LOG_FUNCTION (this); diff --git a/src/lte/model/lte-ffr-soft-algorithm.cc b/src/lte/model/lte-ffr-soft-algorithm.cc index d0fba7b7d..9a4d4edd4 100644 --- a/src/lte/model/lte-ffr-soft-algorithm.cc +++ b/src/lte/model/lte-ffr-soft-algorithm.cc @@ -88,8 +88,8 @@ const uint16_t NUM_UPLINK_CONFS (sizeof (g_ffrSoftUplinkDefaultConfiguration) / LteFfrSoftAlgorithm::LteFfrSoftAlgorithm () - : m_ffrSapUser (0), - m_ffrRrcSapUser (0), + : m_ffrSapUser (nullptr), + m_ffrRrcSapUser (nullptr), m_dlEdgeSubBandOffset (0), m_dlEdgeSubBandwidth (0), m_ulEdgeSubBandOffset (0), diff --git a/src/lte/model/lte-fr-hard-algorithm.cc b/src/lte/model/lte-fr-hard-algorithm.cc index d2f8e3f3e..09a31882a 100644 --- a/src/lte/model/lte-fr-hard-algorithm.cc +++ b/src/lte/model/lte-fr-hard-algorithm.cc @@ -84,8 +84,8 @@ const uint16_t NUM_DOWNLINK_CONFS (sizeof (g_frHardDownlinkDefaultConfiguration) const uint16_t NUM_UPLINK_CONFS (sizeof (g_frHardUplinkDefaultConfiguration) / sizeof (FrHardUplinkDefaultConfiguration)); LteFrHardAlgorithm::LteFrHardAlgorithm () - : m_ffrSapUser (0), - m_ffrRrcSapUser (0), + : m_ffrSapUser (nullptr), + m_ffrRrcSapUser (nullptr), m_dlOffset (0), m_dlSubBand (0), m_ulOffset (0), diff --git a/src/lte/model/lte-fr-no-op-algorithm.cc b/src/lte/model/lte-fr-no-op-algorithm.cc index c471d90ee..4a30a29a9 100644 --- a/src/lte/model/lte-fr-no-op-algorithm.cc +++ b/src/lte/model/lte-fr-no-op-algorithm.cc @@ -30,7 +30,7 @@ NS_OBJECT_ENSURE_REGISTERED (LteFrNoOpAlgorithm); LteFrNoOpAlgorithm::LteFrNoOpAlgorithm () - : m_ffrSapUser (0), m_ffrRrcSapUser (0) + : m_ffrSapUser (nullptr), m_ffrRrcSapUser (nullptr) { NS_LOG_FUNCTION (this); m_ffrSapProvider = new MemberLteFfrSapProvider (this); diff --git a/src/lte/model/lte-fr-soft-algorithm.cc b/src/lte/model/lte-fr-soft-algorithm.cc index 8502a5b44..2e1caa432 100644 --- a/src/lte/model/lte-fr-soft-algorithm.cc +++ b/src/lte/model/lte-fr-soft-algorithm.cc @@ -86,8 +86,8 @@ const uint16_t NUM_UPLINK_CONFS (sizeof (g_frSoftUplinkDefaultConfiguration) / s LteFrSoftAlgorithm::LteFrSoftAlgorithm () - : m_ffrSapUser (0), - m_ffrRrcSapUser (0), + : m_ffrSapUser (nullptr), + m_ffrRrcSapUser (nullptr), m_dlEdgeSubBandOffset (0), m_dlEdgeSubBandwidth (0), m_ulEdgeSubBandOffset (0), diff --git a/src/lte/model/lte-fr-strict-algorithm.cc b/src/lte/model/lte-fr-strict-algorithm.cc index 9997e94ae..dd4a9dfdd 100644 --- a/src/lte/model/lte-fr-strict-algorithm.cc +++ b/src/lte/model/lte-fr-strict-algorithm.cc @@ -88,8 +88,8 @@ const uint16_t NUM_UPLINK_CONFS (sizeof (g_frStrictUplinkDefaultConfiguration) / LteFrStrictAlgorithm::LteFrStrictAlgorithm () - : m_ffrSapUser (0), - m_ffrRrcSapUser (0), + : m_ffrSapUser (nullptr), + m_ffrRrcSapUser (nullptr), m_dlEdgeSubBandOffset (0), m_dlEdgeSubBandwidth (0), m_ulEdgeSubBandOffset (0), diff --git a/src/lte/model/lte-interference.cc b/src/lte/model/lte-interference.cc index 2867a55a7..c176b7799 100644 --- a/src/lte/model/lte-interference.cc +++ b/src/lte/model/lte-interference.cc @@ -50,9 +50,9 @@ LteInterference::DoDispose () m_rsPowerChunkProcessorList.clear (); m_sinrChunkProcessorList.clear (); m_interfChunkProcessorList.clear (); - m_rxSignal = 0; - m_allSignals = 0; - m_noise = 0; + m_rxSignal = nullptr; + m_allSignals = nullptr; + m_noise = nullptr; Object::DoDispose (); } diff --git a/src/lte/model/lte-net-device.cc b/src/lte/model/lte-net-device.cc index ae52e0603..c7768e616 100644 --- a/src/lte/model/lte-net-device.cc +++ b/src/lte/model/lte-net-device.cc @@ -79,7 +79,7 @@ LteNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; + m_node = nullptr; NetDevice::DoDispose (); } @@ -89,7 +89,7 @@ LteNetDevice::GetChannel () const { NS_LOG_FUNCTION (this); // we can't return a meaningful channel here, because LTE devices using FDD have actually two channels. - return 0; + return nullptr; } diff --git a/src/lte/model/lte-pdcp.cc b/src/lte/model/lte-pdcp.cc index 4e03e7cdd..8c0770ea2 100644 --- a/src/lte/model/lte-pdcp.cc +++ b/src/lte/model/lte-pdcp.cc @@ -69,8 +69,8 @@ LtePdcpSpecificLteRlcSapUser::ReceivePdcpPdu (Ptr p) NS_OBJECT_ENSURE_REGISTERED (LtePdcp); LtePdcp::LtePdcp () - : m_pdcpSapUser (0), - m_rlcSapProvider (0), + : m_pdcpSapUser (nullptr), + m_rlcSapProvider (nullptr), m_rnti (0), m_lcid (0), m_txSequenceNumber (0), diff --git a/src/lte/model/lte-phy.cc b/src/lte/model/lte-phy.cc index f423a961f..9b54f9121 100644 --- a/src/lte/model/lte-phy.cc +++ b/src/lte/model/lte-phy.cc @@ -81,10 +81,10 @@ LtePhy::DoDispose () m_packetBurstQueue.clear (); m_controlMessagesQueue.clear (); m_downlinkSpectrumPhy->Dispose (); - m_downlinkSpectrumPhy = 0; + m_downlinkSpectrumPhy = nullptr; m_uplinkSpectrumPhy->Dispose (); - m_uplinkSpectrumPhy = 0; - m_netDevice = 0; + m_uplinkSpectrumPhy = nullptr; + m_netDevice = nullptr; Object::DoDispose (); } @@ -208,7 +208,7 @@ LtePhy::GetPacketBurst () { m_packetBurstQueue.erase (m_packetBurstQueue.begin ()); m_packetBurstQueue.push_back (CreateObject ()); - return (0); + return (nullptr); } } diff --git a/src/lte/model/lte-rlc-am.cc b/src/lte/model/lte-rlc-am.cc index 25b817aba..a0e6233ec 100644 --- a/src/lte/model/lte-rlc-am.cc +++ b/src/lte/model/lte-rlc-am.cc @@ -146,8 +146,8 @@ LteRlcAm::DoDispose () m_retxBufferSize = 0; m_rxonBuffer.clear (); m_sdusBuffer.clear (); - m_keepS0 = 0; - m_controlPduBuffer = 0; + m_keepS0 = nullptr; + m_controlPduBuffer = nullptr; LteRlc::DoDispose (); } @@ -385,7 +385,7 @@ LteRlcAm::DoNotifyTxOpportunity (LteMacSapUser::TxOpportunityParameters txOpPara m_txedBufferSize += m_txedBuffer.at (seqNumberValue).m_pdu->GetSize (); m_retxBufferSize -= m_retxBuffer.at (seqNumberValue).m_pdu->GetSize (); - m_retxBuffer.at (seqNumberValue).m_pdu = 0; + m_retxBuffer.at (seqNumberValue).m_pdu = nullptr; m_retxBuffer.at (seqNumberValue).m_retxCount = 0; m_retxBuffer.at (seqNumberValue).m_waitingSince = MilliSeconds (0); @@ -532,7 +532,7 @@ LteRlcAm::DoNotifyTxOpportunity (LteMacSapUser::TxOpportunityParameters txOpPara } // Segment is completely taken or // the remaining segment is given back to the transmission buffer - firstSegment = 0; + firstSegment = nullptr; // Put status tag once it has been adjusted newSegment->AddPacketTag (newTag); @@ -540,7 +540,7 @@ LteRlcAm::DoNotifyTxOpportunity (LteMacSapUser::TxOpportunityParameters txOpPara // Add Segment to Data field dataFieldAddedSize = newSegment->GetSize (); dataField.push_back (newSegment); - newSegment = 0; + newSegment = nullptr; // ExtensionBit (Next_Segment - 1) = 0 rlcAmHeader.PushExtensionBit (LteRlcAmHeader::DATA_FIELD_FOLLOWS); @@ -562,7 +562,7 @@ LteRlcAm::DoNotifyTxOpportunity (LteMacSapUser::TxOpportunityParameters txOpPara // Add txBuffer.FirstBuffer to DataField dataFieldAddedSize = firstSegment->GetSize (); dataField.push_back (firstSegment); - firstSegment = 0; + firstSegment = nullptr; // ExtensionBit (Next_Segment - 1) = 0 rlcAmHeader.PushExtensionBit (LteRlcAmHeader::DATA_FIELD_FOLLOWS); @@ -1072,7 +1072,7 @@ LteRlcAm::DoReceivePdu (LteMacSapUser::ReceivePduParameters rxPduParams) m_retxBufferSize += m_retxBuffer.at (seqNumberValue).m_pdu->GetSize (); m_txedBufferSize -= m_txedBuffer.at (seqNumberValue).m_pdu->GetSize (); - m_txedBuffer.at (seqNumberValue).m_pdu = 0; + m_txedBuffer.at (seqNumberValue).m_pdu = nullptr; m_txedBuffer.at (seqNumberValue).m_retxCount = 0; m_txedBuffer.at (seqNumberValue).m_waitingSince = MilliSeconds (0); } @@ -1089,7 +1089,7 @@ LteRlcAm::DoReceivePdu (LteMacSapUser::ReceivePduParameters rxPduParams) NS_LOG_INFO ("ACKed SN = " << seqNumberValue << " from txedBuffer"); // NS_LOG_INFO ("m_txedBuffer( " << m_vtA << " )->GetSize = " << m_txedBuffer.at (m_vtA.GetValue ())->GetSize ()); m_txedBufferSize -= m_txedBuffer.at (seqNumberValue).m_pdu->GetSize (); - m_txedBuffer.at (seqNumberValue).m_pdu = 0; + m_txedBuffer.at (seqNumberValue).m_pdu = nullptr; m_txedBuffer.at (seqNumberValue).m_waitingSince = MilliSeconds (0); NS_ASSERT (!m_retxBuffer.at (seqNumberValue).m_pdu); } @@ -1098,7 +1098,7 @@ LteRlcAm::DoReceivePdu (LteMacSapUser::ReceivePduParameters rxPduParams) { NS_LOG_INFO ("ACKed SN = " << seqNumberValue << " from retxBuffer"); m_retxBufferSize -= m_retxBuffer.at (seqNumberValue).m_pdu->GetSize (); - m_retxBuffer.at (seqNumberValue).m_pdu = 0; + m_retxBuffer.at (seqNumberValue).m_pdu = nullptr; m_retxBuffer.at (seqNumberValue).m_retxCount = 0; m_retxBuffer.at (seqNumberValue).m_waitingSince = MilliSeconds (0); } @@ -1466,7 +1466,7 @@ LteRlcAm::ReassembleAndDeliver (Ptr packet) /** * Discard S0 */ - m_keepS0 = 0; + m_keepS0 = nullptr; /** * Deliver one or multiple PDUs @@ -1484,7 +1484,7 @@ LteRlcAm::ReassembleAndDeliver (Ptr packet) /** * Discard S0 */ - m_keepS0 = 0; + m_keepS0 = nullptr; /** * Deliver zero, one or multiple PDUs @@ -1509,7 +1509,7 @@ LteRlcAm::ReassembleAndDeliver (Ptr packet) /** * Discard S0 */ - m_keepS0 = 0; + m_keepS0 = nullptr; /** * Discard SI or SN @@ -1539,7 +1539,7 @@ LteRlcAm::ReassembleAndDeliver (Ptr packet) /** * Discard S0 */ - m_keepS0 = 0; + m_keepS0 = nullptr; /** * Discard SI or SN @@ -1729,7 +1729,7 @@ LteRlcAm::ExpirePollRetransmitTimer () m_retxBufferSize += m_retxBuffer.at (snValue).m_pdu->GetSize (); m_txedBufferSize -= m_txedBuffer.at (snValue).m_pdu->GetSize (); - m_txedBuffer.at (snValue).m_pdu = 0; + m_txedBuffer.at (snValue).m_pdu = nullptr; m_txedBuffer.at (snValue).m_retxCount = 0; m_txedBuffer.at (snValue).m_waitingSince = MilliSeconds (0); } diff --git a/src/lte/model/lte-rlc-um.cc b/src/lte/model/lte-rlc-um.cc index 0e06b1c67..b52dde020 100644 --- a/src/lte/model/lte-rlc-um.cc +++ b/src/lte/model/lte-rlc-um.cc @@ -233,7 +233,7 @@ LteRlcUm::DoNotifyTxOpportunity (LteMacSapUser::TxOpportunityParameters txOpPara } // Segment is completely taken or // the remaining segment is given back to the transmission buffer - firstSegment = 0; + firstSegment = nullptr; // Put status tag once it has been adjusted newSegment->AddPacketTag (newTag); @@ -241,7 +241,7 @@ LteRlcUm::DoNotifyTxOpportunity (LteMacSapUser::TxOpportunityParameters txOpPara // Add Segment to Data field dataFieldAddedSize = newSegment->GetSize (); dataField.push_back (newSegment); - newSegment = 0; + newSegment = nullptr; // ExtensionBit (Next_Segment - 1) = 0 rlcHeader.PushExtensionBit (LteRlcHeader::DATA_FIELD_FOLLOWS); @@ -262,7 +262,7 @@ LteRlcUm::DoNotifyTxOpportunity (LteMacSapUser::TxOpportunityParameters txOpPara // Add txBuffer.FirstBuffer to DataField dataFieldAddedSize = firstSegment->GetSize (); dataField.push_back (firstSegment); - firstSegment = 0; + firstSegment = nullptr; // ExtensionBit (Next_Segment - 1) = 0 rlcHeader.PushExtensionBit (LteRlcHeader::DATA_FIELD_FOLLOWS); @@ -462,7 +462,7 @@ LteRlcUm::DoReceivePdu (LteMacSapUser::ReceivePduParameters rxPduParams) ) { NS_LOG_LOGIC ("PDU discarded"); - rxPduParams.p = 0; + rxPduParams.p = nullptr; return; } else @@ -943,7 +943,7 @@ LteRlcUm::ReassembleAndDeliver (Ptr packet) /** * Discard S0 */ - m_keepS0 = 0; + m_keepS0 = nullptr; /** * Deliver one or multiple PDUs @@ -961,7 +961,7 @@ LteRlcUm::ReassembleAndDeliver (Ptr packet) /** * Discard S0 */ - m_keepS0 = 0; + m_keepS0 = nullptr; /** * Deliver zero, one or multiple PDUs @@ -986,7 +986,7 @@ LteRlcUm::ReassembleAndDeliver (Ptr packet) /** * Discard S0 */ - m_keepS0 = 0; + m_keepS0 = nullptr; /** * Discard SI or SN @@ -1016,7 +1016,7 @@ LteRlcUm::ReassembleAndDeliver (Ptr packet) /** * Discard S0 */ - m_keepS0 = 0; + m_keepS0 = nullptr; /** * Discard SI or SN diff --git a/src/lte/model/lte-rlc.cc b/src/lte/model/lte-rlc.cc index ad7bb314f..971179628 100644 --- a/src/lte/model/lte-rlc.cc +++ b/src/lte/model/lte-rlc.cc @@ -84,8 +84,8 @@ LteRlcSpecificLteMacSapUser::ReceivePdu (LteMacSapUser::ReceivePduParameters par NS_OBJECT_ENSURE_REGISTERED (LteRlc); LteRlc::LteRlc () - : m_rlcSapUser (0), - m_macSapProvider (0), + : m_rlcSapUser (nullptr), + m_macSapProvider (nullptr), m_rnti (0), m_lcid (0) { diff --git a/src/lte/model/lte-rrc-protocol-ideal.cc b/src/lte/model/lte-rrc-protocol-ideal.cc index e3747f389..a1b60b46f 100644 --- a/src/lte/model/lte-rrc-protocol-ideal.cc +++ b/src/lte/model/lte-rrc-protocol-ideal.cc @@ -46,8 +46,8 @@ static const Time RRC_IDEAL_MSG_DELAY = MilliSeconds (0); NS_OBJECT_ENSURE_REGISTERED (LteUeRrcProtocolIdeal); LteUeRrcProtocolIdeal::LteUeRrcProtocolIdeal () - : m_ueRrcSapProvider (0), - m_enbRrcSapProvider (0) + : m_ueRrcSapProvider (nullptr), + m_enbRrcSapProvider (nullptr) { m_ueRrcSapUser = new MemberLteUeRrcSapUser (this); } @@ -61,7 +61,7 @@ LteUeRrcProtocolIdeal::DoDispose () { NS_LOG_FUNCTION (this); delete m_ueRrcSapUser; - m_rrc = 0; + m_rrc = nullptr; } TypeId @@ -238,7 +238,7 @@ LteUeRrcProtocolIdeal::SetEnbRrcSapProvider () NS_OBJECT_ENSURE_REGISTERED (LteEnbRrcProtocolIdeal); LteEnbRrcProtocolIdeal::LteEnbRrcProtocolIdeal () - : m_enbRrcSapProvider (0) + : m_enbRrcSapProvider (nullptr) { NS_LOG_FUNCTION (this); m_enbRrcSapUser = new MemberLteEnbRrcSapUser (this); @@ -344,7 +344,7 @@ LteEnbRrcProtocolIdeal::DoSetupUe (uint16_t rnti, LteEnbRrcSapUser::SetupUeParam // just create empty entry, the UeRrcSapProvider will be set by the // ue upon connection request or connection reconfiguration // completed - m_enbRrcSapProviderMap[rnti] = 0; + m_enbRrcSapProviderMap[rnti] = nullptr; } diff --git a/src/lte/model/lte-rrc-protocol-real.cc b/src/lte/model/lte-rrc-protocol-real.cc index 9898ffe94..a95d158ba 100644 --- a/src/lte/model/lte-rrc-protocol-real.cc +++ b/src/lte/model/lte-rrc-protocol-real.cc @@ -42,8 +42,8 @@ const Time RRC_REAL_MSG_DELAY = MilliSeconds (0); NS_OBJECT_ENSURE_REGISTERED (LteUeRrcProtocolReal); LteUeRrcProtocolReal::LteUeRrcProtocolReal () - : m_ueRrcSapProvider (0), - m_enbRrcSapProvider (0) + : m_ueRrcSapProvider (nullptr), + m_enbRrcSapProvider (nullptr) { m_ueRrcSapUser = new MemberLteUeRrcSapUser (this); m_completeSetupParameters.srb0SapUser = new LteRlcSpecificLteRlcSapUser (this); @@ -61,7 +61,7 @@ LteUeRrcProtocolReal::DoDispose () delete m_ueRrcSapUser; delete m_completeSetupParameters.srb0SapUser; delete m_completeSetupParameters.srb1SapUser; - m_rrc = 0; + m_rrc = nullptr; } TypeId @@ -378,7 +378,7 @@ LteUeRrcProtocolReal::DoReceivePdcpSdu (LtePdcpSapUser::ReceivePdcpSduParameters NS_OBJECT_ENSURE_REGISTERED (LteEnbRrcProtocolReal); LteEnbRrcProtocolReal::LteEnbRrcProtocolReal () - : m_enbRrcSapProvider (0) + : m_enbRrcSapProvider (nullptr) { NS_LOG_FUNCTION (this); m_enbRrcSapUser = new MemberLteEnbRrcSapUser (this); @@ -492,7 +492,7 @@ LteEnbRrcProtocolReal::DoSetupUe (uint16_t rnti, LteEnbRrcSapUser::SetupUeParame // just create empty entry, the UeRrcSapProvider will be set by the // ue upon connection request or connection reconfiguration // completed - m_enbRrcSapProviderMap[rnti] = 0; + m_enbRrcSapProviderMap[rnti] = nullptr; // Store SetupUeParameters m_setupUeParametersMap[rnti] = params; diff --git a/src/lte/model/lte-spectrum-phy.cc b/src/lte/model/lte-spectrum-phy.cc index d1dd88418..9967e91fe 100644 --- a/src/lte/model/lte-spectrum-phy.cc +++ b/src/lte/model/lte-spectrum-phy.cc @@ -155,13 +155,13 @@ LteSpectrumPhy::~LteSpectrumPhy () void LteSpectrumPhy::DoDispose () { NS_LOG_FUNCTION (this); - m_channel = 0; - m_mobility = 0; - m_device = 0; + m_channel = nullptr; + m_mobility = nullptr; + m_device = nullptr; m_interferenceData->Dispose (); - m_interferenceData = 0; + m_interferenceData = nullptr; m_interferenceCtrl->Dispose (); - m_interferenceCtrl = 0; + m_interferenceCtrl = nullptr; m_ltePhyRxDataEndErrorCallback = MakeNullCallback< void > (); m_ltePhyRxDataEndOkCallback = MakeNullCallback< void, Ptr > (); m_ltePhyRxCtrlEndOkCallback = MakeNullCallback< void, std::list > > (); @@ -346,8 +346,8 @@ LteSpectrumPhy::Reset () m_expectedTbs.clear (); m_txControlMessageList.clear (); m_rxPacketBurstList.clear (); - m_txPacketBurst = 0; - m_rxSpectrumModel = 0; + m_txPacketBurst = nullptr; + m_rxSpectrumModel = nullptr; // Detach from the channel, because receiving any signal without // spectrum model is an error. @@ -629,7 +629,7 @@ LteSpectrumPhy::EndTxData () NS_ASSERT (m_state == TX_DATA); m_phyTxEndTrace (m_txPacketBurst); - m_txPacketBurst = 0; + m_txPacketBurst = nullptr; ChangeState (IDLE); } diff --git a/src/lte/model/lte-ue-component-carrier-manager.cc b/src/lte/model/lte-ue-component-carrier-manager.cc index c0f47ce8f..e9b3b6b8b 100644 --- a/src/lte/model/lte-ue-component-carrier-manager.cc +++ b/src/lte/model/lte-ue-component-carrier-manager.cc @@ -28,7 +28,7 @@ NS_LOG_COMPONENT_DEFINE ("LteUeComponentCarrierManager"); NS_OBJECT_ENSURE_REGISTERED (LteUeComponentCarrierManager); LteUeComponentCarrierManager::LteUeComponentCarrierManager () -: m_ccmRrcSapUser (0), m_ccmRrcSapProvider (0), m_noOfComponentCarriers(0) +: m_ccmRrcSapUser (nullptr), m_ccmRrcSapProvider (nullptr), m_noOfComponentCarriers(0) { NS_LOG_FUNCTION (this); } diff --git a/src/lte/model/lte-ue-net-device.cc b/src/lte/model/lte-ue-net-device.cc index 62329c7c8..4f2c0e147 100644 --- a/src/lte/model/lte-ue-net-device.cc +++ b/src/lte/model/lte-ue-net-device.cc @@ -128,13 +128,13 @@ void LteUeNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_targetEnb = 0; + m_targetEnb = nullptr; m_rrc->Dispose (); - m_rrc = 0; + m_rrc = nullptr; m_nas->Dispose (); - m_nas = 0; + m_nas = nullptr; for (uint32_t i = 0; i < m_ccMap.size (); i++) { m_ccMap.at (i)->Dispose (); diff --git a/src/lte/model/lte-ue-phy.cc b/src/lte/model/lte-ue-phy.cc index f55a5b98a..2765b6c9b 100644 --- a/src/lte/model/lte-ue-phy.cc +++ b/src/lte/model/lte-ue-phy.cc @@ -154,8 +154,8 @@ LteUePhy::LteUePhy () LteUePhy::LteUePhy (Ptr dlPhy, Ptr ulPhy) : LtePhy (dlPhy, ulPhy), - m_uePhySapUser (0), - m_ueCphySapUser (0), + m_uePhySapUser (nullptr), + m_ueCphySapUser (nullptr), m_state (CELL_SEARCH), m_subframeNo (0), m_rsReceivedPowerUpdated (false), diff --git a/src/lte/model/lte-ue-rrc.cc b/src/lte/model/lte-ue-rrc.cc index 714cd6c62..bc027f4a7 100644 --- a/src/lte/model/lte-ue-rrc.cc +++ b/src/lte/model/lte-ue-rrc.cc @@ -124,10 +124,10 @@ NS_OBJECT_ENSURE_REGISTERED (LteUeRrc); LteUeRrc::LteUeRrc () : m_cmacSapProvider (0), - m_rrcSapUser (0), - m_macSapProvider (0), - m_asSapUser (0), - m_ccmRrcSapProvider (0), + m_rrcSapUser (nullptr), + m_macSapProvider (nullptr), + m_asSapUser (nullptr), + m_ccmRrcSapProvider (nullptr), m_state (IDLE_START), m_imsi (0), m_rnti (0), @@ -148,8 +148,8 @@ LteUeRrc::LteUeRrc () NS_LOG_FUNCTION (this); m_cphySapUser.push_back (new MemberLteUeCphySapUser (this)); m_cmacSapUser.push_back (new UeMemberLteUeCmacSapUser (this)); - m_cphySapProvider.push_back (0); - m_cmacSapProvider.push_back (0); + m_cphySapProvider.push_back (nullptr); + m_cmacSapProvider.push_back (nullptr); m_rrcSapProvider = new MemberLteUeRrcSapProvider (this); m_drbPdcpSapUser = new LtePdcpSpecificLtePdcpSapUser (this); m_asSapProvider = new MemberLteAsSapProvider (this); @@ -545,7 +545,7 @@ LteUeRrc::DoInitialize () m_srb0->m_srbIdentity = 0; LteUeRrcSapUser::SetupParameters ueParams; ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider (); - ueParams.srb1SapProvider = 0; + ueParams.srb1SapProvider = nullptr; m_rrcSapUser->Setup (ueParams); // CCCH (LCID 0) is pre-configured, here is the hardcoded configuration: @@ -575,8 +575,8 @@ LteUeRrc::InitializeSap () { m_cphySapUser.push_back (new MemberLteUeCphySapUser (this)); m_cmacSapUser.push_back (new UeMemberLteUeCmacSapUser (this)); - m_cphySapProvider.push_back (0); - m_cmacSapProvider.push_back (0); + m_cphySapProvider.push_back (nullptr); + m_cmacSapProvider.push_back (nullptr); } } } @@ -1109,7 +1109,7 @@ LteUeRrc::DoRecvRrcConnectionReconfiguration (LteRrcSap::RrcConnectionReconfigur // if we did so. Hence we schedule it for later disposal m_srb1Old = m_srb1; Simulator::ScheduleNow (&LteUeRrc::DisposeOldSrb1, this); - m_srb1 = 0; // new instance will be be created within ApplyRadioResourceConfigDedicated + m_srb1 = nullptr; // new instance will be be created within ApplyRadioResourceConfigDedicated m_drbMap.clear (); // dispose all DRBs ApplyRadioResourceConfigDedicated (msg.radioResourceConfigDedicated); @@ -3208,7 +3208,7 @@ void LteUeRrc::DisposeOldSrb1 () { NS_LOG_FUNCTION (this); - m_srb1Old = 0; + m_srb1Old = nullptr; } uint8_t diff --git a/src/lte/model/no-op-component-carrier-manager.cc b/src/lte/model/no-op-component-carrier-manager.cc index d71d1655b..c06f474f1 100644 --- a/src/lte/model/no-op-component-carrier-manager.cc +++ b/src/lte/model/no-op-component-carrier-manager.cc @@ -36,7 +36,7 @@ NoOpComponentCarrierManager::NoOpComponentCarrierManager () m_ccmRrcSapProvider = new MemberLteCcmRrcSapProvider (this); m_ccmMacSapUser = new MemberLteCcmMacSapUser (this); m_macSapProvider = new EnbMacMemberLteMacSapProvider (this); - m_ccmRrcSapUser = 0; + m_ccmRrcSapUser = nullptr; } NoOpComponentCarrierManager::~NoOpComponentCarrierManager () diff --git a/src/lte/model/no-op-handover-algorithm.cc b/src/lte/model/no-op-handover-algorithm.cc index 2083b533e..22a5c73bc 100644 --- a/src/lte/model/no-op-handover-algorithm.cc +++ b/src/lte/model/no-op-handover-algorithm.cc @@ -30,7 +30,7 @@ NS_OBJECT_ENSURE_REGISTERED (NoOpHandoverAlgorithm); NoOpHandoverAlgorithm::NoOpHandoverAlgorithm () - : m_handoverManagementSapUser (0) + : m_handoverManagementSapUser (nullptr) { NS_LOG_FUNCTION (this); m_handoverManagementSapProvider = new MemberLteHandoverManagementSapProvider (this); diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index 5fa0f7852..e944a4616 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -49,15 +49,15 @@ NS_OBJECT_ENSURE_REGISTERED (PfFfMacScheduler); PfFfMacScheduler::PfFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_timeWindow (99.0), m_nextRntiUl (0) { m_amc = CreateObject (); m_cschedSapProvider = new MemberCschedSapProvider (this); m_schedSapProvider = new MemberSchedSapProvider (this); - m_ffrSapProvider = 0; + m_ffrSapProvider = nullptr; m_ffrSapUser = new MemberLteFfrSapUser (this); } diff --git a/src/lte/model/pss-ff-mac-scheduler.cc b/src/lte/model/pss-ff-mac-scheduler.cc index 3d7ed53ae..4ed08a6ec 100644 --- a/src/lte/model/pss-ff-mac-scheduler.cc +++ b/src/lte/model/pss-ff-mac-scheduler.cc @@ -52,15 +52,15 @@ NS_OBJECT_ENSURE_REGISTERED (PssFfMacScheduler); PssFfMacScheduler::PssFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_timeWindow (99.0), m_nextRntiUl (0) { m_amc = CreateObject (); m_cschedSapProvider = new MemberCschedSapProvider (this); m_schedSapProvider = new MemberSchedSapProvider (this); - m_ffrSapProvider = 0; + m_ffrSapProvider = nullptr; m_ffrSapUser = new MemberLteFfrSapUser (this); } diff --git a/src/lte/model/rem-spectrum-phy.cc b/src/lte/model/rem-spectrum-phy.cc index abf480f30..2c8f23d5b 100644 --- a/src/lte/model/rem-spectrum-phy.cc +++ b/src/lte/model/rem-spectrum-phy.cc @@ -38,7 +38,7 @@ NS_LOG_COMPONENT_DEFINE ("RemSpectrumPhy"); NS_OBJECT_ENSURE_REGISTERED (RemSpectrumPhy); RemSpectrumPhy::RemSpectrumPhy () - : m_mobility (0), + : m_mobility (nullptr), m_referenceSignalPower (0), m_sumPower (0), m_active (true), @@ -59,7 +59,7 @@ void RemSpectrumPhy::DoDispose () { NS_LOG_FUNCTION (this); - m_mobility = 0; + m_mobility = nullptr; SpectrumPhy::DoDispose (); } @@ -105,7 +105,7 @@ RemSpectrumPhy::GetMobility () const Ptr RemSpectrumPhy::GetDevice () const { - return 0; + return nullptr; } Ptr @@ -117,7 +117,7 @@ RemSpectrumPhy::GetRxSpectrumModel () const Ptr RemSpectrumPhy::GetAntenna () const { - return 0; + return nullptr; } diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 80e7bda03..5deae3f06 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -51,8 +51,8 @@ NS_OBJECT_ENSURE_REGISTERED (RrFfMacScheduler); RrFfMacScheduler::RrFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_nextRntiDl (0), m_nextRntiUl (0) { diff --git a/src/lte/model/tdbet-ff-mac-scheduler.cc b/src/lte/model/tdbet-ff-mac-scheduler.cc index e300051d4..268877f13 100644 --- a/src/lte/model/tdbet-ff-mac-scheduler.cc +++ b/src/lte/model/tdbet-ff-mac-scheduler.cc @@ -49,8 +49,8 @@ NS_OBJECT_ENSURE_REGISTERED (TdBetFfMacScheduler); TdBetFfMacScheduler::TdBetFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_timeWindow (99.0), m_nextRntiUl (0) { diff --git a/src/lte/model/tdmt-ff-mac-scheduler.cc b/src/lte/model/tdmt-ff-mac-scheduler.cc index 92a55fd1a..afeabe095 100644 --- a/src/lte/model/tdmt-ff-mac-scheduler.cc +++ b/src/lte/model/tdmt-ff-mac-scheduler.cc @@ -49,8 +49,8 @@ NS_OBJECT_ENSURE_REGISTERED (TdMtFfMacScheduler); TdMtFfMacScheduler::TdMtFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_nextRntiUl (0) { m_amc = CreateObject (); diff --git a/src/lte/model/tdtbfq-ff-mac-scheduler.cc b/src/lte/model/tdtbfq-ff-mac-scheduler.cc index 808f2a591..c51e42ae9 100644 --- a/src/lte/model/tdtbfq-ff-mac-scheduler.cc +++ b/src/lte/model/tdtbfq-ff-mac-scheduler.cc @@ -50,15 +50,15 @@ NS_OBJECT_ENSURE_REGISTERED (TdTbfqFfMacScheduler); TdTbfqFfMacScheduler::TdTbfqFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_nextRntiUl (0), bankSize (0) { m_amc = CreateObject (); m_cschedSapProvider = new MemberCschedSapProvider (this); m_schedSapProvider = new MemberSchedSapProvider (this); - m_ffrSapProvider = 0; + m_ffrSapProvider = nullptr; m_ffrSapUser = new MemberLteFfrSapUser (this); } diff --git a/src/lte/model/tta-ff-mac-scheduler.cc b/src/lte/model/tta-ff-mac-scheduler.cc index 954fe4a41..32bb03409 100644 --- a/src/lte/model/tta-ff-mac-scheduler.cc +++ b/src/lte/model/tta-ff-mac-scheduler.cc @@ -49,8 +49,8 @@ NS_OBJECT_ENSURE_REGISTERED (TtaFfMacScheduler); TtaFfMacScheduler::TtaFfMacScheduler () - : m_cschedSapUser (0), - m_schedSapUser (0), + : m_cschedSapUser (nullptr), + m_schedSapUser (nullptr), m_nextRntiUl (0) { m_amc = CreateObject (); diff --git a/src/lte/test/epc-test-s1u-uplink.cc b/src/lte/test/epc-test-s1u-uplink.cc index 23b65534c..a19008bdf 100644 --- a/src/lte/test/epc-test-s1u-uplink.cc +++ b/src/lte/test/epc-test-s1u-uplink.cc @@ -163,7 +163,7 @@ EpsBearerTagUdpClient::EpsBearerTagUdpClient () { NS_LOG_FUNCTION_NOARGS (); m_sent = 0; - m_socket = 0; + m_socket = nullptr; m_sendEvent = EventId (); } @@ -173,7 +173,7 @@ EpsBearerTagUdpClient::EpsBearerTagUdpClient (uint16_t rnti, uint8_t bid) { NS_LOG_FUNCTION_NOARGS (); m_sent = 0; - m_socket = 0; + m_socket = nullptr; m_sendEvent = EventId (); } diff --git a/src/lte/test/lte-ffr-simple.cc b/src/lte/test/lte-ffr-simple.cc index fceaeb11a..1e083293b 100644 --- a/src/lte/test/lte-ffr-simple.cc +++ b/src/lte/test/lte-ffr-simple.cc @@ -31,8 +31,8 @@ NS_OBJECT_ENSURE_REGISTERED (LteFfrSimple); LteFfrSimple::LteFfrSimple () - : m_ffrSapUser (0), - m_ffrRrcSapUser (0), + : m_ffrSapUser (nullptr), + m_ffrRrcSapUser (nullptr), m_dlOffset (0), m_dlSubBand (0), m_ulOffset (0), diff --git a/src/lte/test/lte-simple-helper.cc b/src/lte/test/lte-simple-helper.cc index b5a103148..3968cecb1 100644 --- a/src/lte/test/lte-simple-helper.cc +++ b/src/lte/test/lte-simple-helper.cc @@ -79,12 +79,12 @@ void LteSimpleHelper::DoDispose () { NS_LOG_FUNCTION (this); - m_phyChannel = 0; + m_phyChannel = nullptr; m_enbMac->Dispose (); - m_enbMac = 0; + m_enbMac = nullptr; m_ueMac->Dispose (); - m_ueMac = 0; + m_ueMac = nullptr; Object::DoDispose (); } diff --git a/src/lte/test/lte-simple-spectrum-phy.cc b/src/lte/test/lte-simple-spectrum-phy.cc index 3f49a1662..c57fce643 100644 --- a/src/lte/test/lte-simple-spectrum-phy.cc +++ b/src/lte/test/lte-simple-spectrum-phy.cc @@ -50,9 +50,9 @@ LteSimpleSpectrumPhy::~LteSimpleSpectrumPhy () void LteSimpleSpectrumPhy::DoDispose () { NS_LOG_FUNCTION (this); - m_channel = 0; - m_mobility = 0; - m_device = 0; + m_channel = nullptr; + m_mobility = nullptr; + m_device = nullptr; SpectrumPhy::DoDispose (); } diff --git a/src/lte/test/lte-test-downlink-sinr.cc b/src/lte/test/lte-test-downlink-sinr.cc index b719e99be..61a3f14c3 100644 --- a/src/lte/test/lte-test-downlink-sinr.cc +++ b/src/lte/test/lte-test-downlink-sinr.cc @@ -221,7 +221,7 @@ LteDownlinkDataSinrTestCase::DoRun () // eNB sends data to 2 UEs through 2 subcarriers Ptr sp1 = Create (); sp1->psd = m_sv; - sp1->txPhy = 0; + sp1->txPhy = nullptr; sp1->duration = ds; sp1->packetBurst = packetBursts[0]; sp1->cellId = pbCellId[0]; @@ -230,7 +230,7 @@ LteDownlinkDataSinrTestCase::DoRun () Ptr ip1 = Create (); ip1->psd = i1; - ip1->txPhy = 0; + ip1->txPhy = nullptr; ip1->duration = di1; ip1->packetBurst = packetBursts[1]; ip1->cellId = pbCellId[1]; @@ -238,7 +238,7 @@ LteDownlinkDataSinrTestCase::DoRun () Ptr ip2 = Create (); ip2->psd = i2; - ip2->txPhy = 0; + ip2->txPhy = nullptr; ip2->duration = di2; ip2->packetBurst = packetBursts[2]; ip2->cellId = pbCellId[2]; @@ -246,7 +246,7 @@ LteDownlinkDataSinrTestCase::DoRun () Ptr ip3 = Create (); ip3->psd = i3; - ip3->txPhy = 0; + ip3->txPhy = nullptr; ip3->duration = di3; ip3->packetBurst = packetBursts[3]; ip3->cellId = pbCellId[3]; @@ -254,7 +254,7 @@ LteDownlinkDataSinrTestCase::DoRun () Ptr ip4 = Create (); ip4->psd = i4; - ip4->txPhy = 0; + ip4->txPhy = nullptr; ip4->duration = di4; ip4->packetBurst = packetBursts[4]; ip4->cellId = pbCellId[4]; @@ -384,7 +384,7 @@ LteDownlinkCtrlSinrTestCase::DoRun () // eNB sends data to 2 UEs through 2 subcarriers Ptr sp1 = Create (); sp1->psd = m_sv; - sp1->txPhy = 0; + sp1->txPhy = nullptr; sp1->duration = ds; sp1->ctrlMsgList = ctrlMsgList[0]; sp1->cellId = pbCellId[0]; @@ -394,7 +394,7 @@ LteDownlinkCtrlSinrTestCase::DoRun () Ptr ip1 = Create (); ip1->psd = i1; - ip1->txPhy = 0; + ip1->txPhy = nullptr; ip1->duration = di1; ip1->ctrlMsgList = ctrlMsgList[1]; ip1->cellId = pbCellId[1]; @@ -403,7 +403,7 @@ LteDownlinkCtrlSinrTestCase::DoRun () Ptr ip2 = Create (); ip2->psd = i2; - ip2->txPhy = 0; + ip2->txPhy = nullptr; ip2->duration = di2; ip2->ctrlMsgList = ctrlMsgList[2]; ip2->cellId = pbCellId[2]; @@ -412,7 +412,7 @@ LteDownlinkCtrlSinrTestCase::DoRun () Ptr ip3 = Create (); ip3->psd = i3; - ip3->txPhy = 0; + ip3->txPhy = nullptr; ip3->duration = di3; ip3->ctrlMsgList = ctrlMsgList[3]; ip3->cellId = pbCellId[3]; @@ -421,7 +421,7 @@ LteDownlinkCtrlSinrTestCase::DoRun () Ptr ip4 = Create (); ip4->psd = i4; - ip4->txPhy = 0; + ip4->txPhy = nullptr; ip4->duration = di4; ip4->ctrlMsgList = ctrlMsgList[4]; ip4->cellId = pbCellId[4]; diff --git a/src/lte/test/lte-test-entities.cc b/src/lte/test/lte-test-entities.cc index f3a75ca26..e3fa7bf77 100644 --- a/src/lte/test/lte-test-entities.cc +++ b/src/lte/test/lte-test-entities.cc @@ -370,10 +370,10 @@ LteTestMac::GetTypeId () LteTestMac::LteTestMac () { NS_LOG_FUNCTION (this); - m_device = 0; + m_device = nullptr; m_macSapProvider = new EnbMacMemberLteMacSapProvider (this); - m_macSapUser = 0; - m_macLoopback = 0; + m_macSapUser = nullptr; + m_macLoopback = nullptr; m_pdcpHeaderPresent = false; m_rlcHeaderType = UM_RLC_HEADER; m_txOpportunityMode = MANUAL_MODE; @@ -406,7 +406,7 @@ LteTestMac::DoDispose () // delete m_cschedSapUser; // delete m_enbPhySapUser; - m_device = 0; + m_device = nullptr; } void @@ -682,7 +682,7 @@ LteTestMac::Receive (Ptr nd, Ptr p, uint16_t protocol, NS_OBJECT_ENSURE_REGISTERED (EpcTestRrc); EpcTestRrc::EpcTestRrc () - : m_s1SapProvider (0) + : m_s1SapProvider (nullptr) { NS_LOG_FUNCTION (this); m_s1SapUser = new MemberEpcEnbS1SapUser (this); diff --git a/src/lte/test/lte-test-uplink-sinr.cc b/src/lte/test/lte-test-uplink-sinr.cc index 8f1f452fe..507ebd162 100644 --- a/src/lte/test/lte-test-uplink-sinr.cc +++ b/src/lte/test/lte-test-uplink-sinr.cc @@ -247,7 +247,7 @@ LteUplinkDataSinrTestCase::DoRun () // 2 UEs send data to the eNB through 2 subcarriers Ptr sp1 = Create (); sp1->psd = m_sv1; - sp1->txPhy = 0; + sp1->txPhy = nullptr; sp1->duration = ds; sp1->packetBurst = packetBursts[0]; sp1->cellId = pbCellId[0]; @@ -255,7 +255,7 @@ LteUplinkDataSinrTestCase::DoRun () Ptr sp2 = Create (); sp2->psd = m_sv2; - sp2->txPhy = 0; + sp2->txPhy = nullptr; sp2->duration = ds; sp2->packetBurst = packetBursts[1]; sp2->cellId = pbCellId[1]; @@ -264,7 +264,7 @@ LteUplinkDataSinrTestCase::DoRun () Ptr ip1 = Create (); ip1->psd = i1; - ip1->txPhy = 0; + ip1->txPhy = nullptr; ip1->duration = di1; ip1->packetBurst = packetBursts[2]; ip1->cellId = pbCellId[2]; @@ -272,7 +272,7 @@ LteUplinkDataSinrTestCase::DoRun () Ptr ip2 = Create (); ip2->psd = i2; - ip2->txPhy = 0; + ip2->txPhy = nullptr; ip2->duration = di2; ip2->packetBurst = packetBursts[3]; ip2->cellId = pbCellId[3]; @@ -280,7 +280,7 @@ LteUplinkDataSinrTestCase::DoRun () Ptr ip3 = Create (); ip3->psd = i3; - ip3->txPhy = 0; + ip3->txPhy = nullptr; ip3->duration = di3; ip3->packetBurst = packetBursts[4]; ip3->cellId = pbCellId[4]; @@ -288,7 +288,7 @@ LteUplinkDataSinrTestCase::DoRun () Ptr ip4 = Create (); ip4->psd = i4; - ip4->txPhy = 0; + ip4->txPhy = nullptr; ip4->duration = di4; ip4->packetBurst = packetBursts[5]; ip4->cellId = pbCellId[5]; @@ -426,14 +426,14 @@ LteUplinkSrsSinrTestCase::DoRun () // 2 UEs send data to the eNB through 2 subcarriers Ptr sp1 = Create (); sp1->psd = m_sv1; - sp1->txPhy = 0; + sp1->txPhy = nullptr; sp1->duration = ds; sp1->cellId = pbCellId[0]; Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp1); Ptr sp2 = Create (); sp2->psd = m_sv2; - sp2->txPhy = 0; + sp2->txPhy = nullptr; sp2->duration = ds; sp2->cellId = pbCellId[1]; Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp2); @@ -441,28 +441,28 @@ LteUplinkSrsSinrTestCase::DoRun () Ptr ip1 = Create (); ip1->psd = i1; - ip1->txPhy = 0; + ip1->txPhy = nullptr; ip1->duration = di1; ip1->cellId = pbCellId[2]; Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, ulPhy, ip1); Ptr ip2 = Create (); ip2->psd = i2; - ip2->txPhy = 0; + ip2->txPhy = nullptr; ip2->duration = di2; ip2->cellId = pbCellId[3]; Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, ulPhy, ip2); Ptr ip3 = Create (); ip3->psd = i3; - ip3->txPhy = 0; + ip3->txPhy = nullptr; ip3->duration = di3; ip3->cellId = pbCellId[4]; Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, ulPhy, ip3); Ptr ip4 = Create (); ip4->psd = i4; - ip4->txPhy = 0; + ip4->txPhy = nullptr; ip4->duration = di4; ip4->cellId = pbCellId[5]; Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, ulPhy, ip4); diff --git a/src/lte/test/test-asn1-encoding.cc b/src/lte/test/test-asn1-encoding.cc index 7a9065af1..bbe16bd9f 100644 --- a/src/lte/test/test-asn1-encoding.cc +++ b/src/lte/test/test-asn1-encoding.cc @@ -340,7 +340,7 @@ RrcConnectionRequestTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ (source.GetMmec (),destination.GetMmec (), "Different m_mmec!"); NS_TEST_ASSERT_MSG_EQ (source.GetMtmsi (),destination.GetMtmsi (), "Different m_mTmsi!"); - packet = 0; + packet = nullptr; } /** @@ -394,7 +394,7 @@ RrcConnectionSetupTestCase::DoRun () AssertEqualRadioResourceConfigDedicated (source.GetRadioResourceConfigDedicated (),destination.GetRadioResourceConfigDedicated ()); - packet = 0; + packet = nullptr; } /** @@ -445,7 +445,7 @@ RrcConnectionSetupCompleteTestCase::DoRun () // Check that the destination and source headers contain the same values NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (),destination.GetRrcTransactionIdentifier (), "RrcTransactionIdentifier"); - packet = 0; + packet = nullptr; } /** @@ -497,7 +497,7 @@ RrcConnectionReconfigurationCompleteTestCase::DoRun () // Check that the destination and source headers contain the same values NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (),destination.GetRrcTransactionIdentifier (), "RrcTransactionIdentifier"); - packet = 0; + packet = nullptr; } /** @@ -707,7 +707,7 @@ RrcConnectionReconfigurationTestCase::DoRun () AssertEqualRadioResourceConfigDedicated (source.GetRadioResourceConfigDedicated (), destination.GetRadioResourceConfigDedicated ()); } - packet = 0; + packet = nullptr; } /** @@ -786,7 +786,7 @@ HandoverPreparationInfoTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIdentity, destination.GetAsConfig ().sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIdentity, "csgIdentity"); NS_TEST_ASSERT_MSG_EQ (source.GetAsConfig ().sourceDlCarrierFreq, destination.GetAsConfig ().sourceDlCarrierFreq, "sourceDlCarrierFreq"); - packet = 0; + packet = nullptr; } /** @@ -841,7 +841,7 @@ RrcConnectionReestablishmentRequestTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ (source.GetUeIdentity ().physCellId, destination.GetUeIdentity ().physCellId, "physCellId"); NS_TEST_ASSERT_MSG_EQ (source.GetReestablishmentCause (),destination.GetReestablishmentCause (), "ReestablishmentCause"); - packet = 0; + packet = nullptr; } /** @@ -894,7 +894,7 @@ RrcConnectionReestablishmentTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (), destination.GetRrcTransactionIdentifier (), "rrcTransactionIdentifier"); AssertEqualRadioResourceConfigDedicated (source.GetRadioResourceConfigDedicated (),destination.GetRadioResourceConfigDedicated ()); - packet = 0; + packet = nullptr; } /** @@ -945,7 +945,7 @@ RrcConnectionReestablishmentCompleteTestCase::DoRun () // Check that the destination and source headers contain the same values NS_TEST_ASSERT_MSG_EQ (source.GetRrcTransactionIdentifier (), destination.GetRrcTransactionIdentifier (), "rrcTransactionIdentifier"); - packet = 0; + packet = nullptr; } /** @@ -996,7 +996,7 @@ RrcConnectionRejectTestCase::DoRun () // Check that the destination and source headers contain the same values NS_TEST_ASSERT_MSG_EQ (source.GetMessage ().waitTime, destination.GetMessage ().waitTime, "Different waitTime!"); - packet = 0; + packet = nullptr; } /** @@ -1112,7 +1112,7 @@ MeasurementReportTestCase::DoRun () } } - packet = 0; + packet = nullptr; } /** diff --git a/src/lte/test/test-lte-handover-target.cc b/src/lte/test/test-lte-handover-target.cc index a061604b8..2165015a2 100644 --- a/src/lte/test/test-lte-handover-target.cc +++ b/src/lte/test/test-lte-handover-target.cc @@ -155,7 +155,7 @@ LteHandoverTargetTestCase::LteHandoverTargetTestCase (std::string name, Vector u m_sourceCellId (sourceCellId), m_targetCellId (targetCellId), m_handoverAlgorithmType (handoverAlgorithmType), - m_sourceEnbDev (0), + m_sourceEnbDev (nullptr), m_hasHandoverOccurred (false) { NS_LOG_INFO (this << " name=" << name); diff --git a/src/mesh/helper/mesh-helper.cc b/src/mesh/helper/mesh-helper.cc index 5fe3c0787..09a289495 100644 --- a/src/mesh/helper/mesh-helper.cc +++ b/src/mesh/helper/mesh-helper.cc @@ -37,13 +37,13 @@ namespace ns3 MeshHelper::MeshHelper () : m_nInterfaces (1), m_spreadChannelPolicy (ZERO_CHANNEL), - m_stack (0), + m_stack (nullptr), m_standard (WIFI_STANDARD_80211a) { } MeshHelper::~MeshHelper () { - m_stack = 0; + m_stack = nullptr; } void MeshHelper::SetSpreadInterfaceChannels (enum ChannelPolicy policy) diff --git a/src/mesh/model/dot11s/hwmp-protocol.cc b/src/mesh/model/dot11s/hwmp-protocol.cc index 93e0232f6..6b4268022 100644 --- a/src/mesh/model/dot11s/hwmp-protocol.cc +++ b/src/mesh/model/dot11s/hwmp-protocol.cc @@ -237,8 +237,8 @@ HwmpProtocol::DoDispose () m_hwmpSeqnoMetricDatabase.clear (); m_interfaces.clear (); m_rqueue.clear (); - m_rtable = 0; - m_mp = 0; + m_rtable = nullptr; + m_mp = nullptr; } bool @@ -998,7 +998,7 @@ HwmpProtocol::DequeueFirstPacketByDst (Mac48Address dst) { NS_LOG_FUNCTION (this << dst); QueuedPacket retval; - retval.pkt = 0; + retval.pkt = nullptr; for (std::vector::iterator i = m_rqueue.begin (); i != m_rqueue.end (); i++) { if ((*i).dst == dst) @@ -1016,7 +1016,7 @@ HwmpProtocol::DequeueFirstPacket () { NS_LOG_FUNCTION (this); QueuedPacket retval; - retval.pkt = 0; + retval.pkt = nullptr; if (m_rqueue.size () != 0) { retval = m_rqueue[0]; @@ -1304,7 +1304,7 @@ HwmpProtocol::GetRoutingTable () const } HwmpProtocol::QueuedPacket::QueuedPacket () : - pkt (0), + pkt (nullptr), protocol (0), inInterface (0) { diff --git a/src/mesh/model/dot11s/ie-dot11s-beacon-timing.cc b/src/mesh/model/dot11s/ie-dot11s-beacon-timing.cc index c15427aed..402d44a1c 100644 --- a/src/mesh/model/dot11s/ie-dot11s-beacon-timing.cc +++ b/src/mesh/model/dot11s/ie-dot11s-beacon-timing.cc @@ -118,7 +118,7 @@ IeBeaconTiming::ClearTimingElement () { for (NeighboursTimingUnitsList::iterator j = m_neighbours.begin (); j != m_neighbours.end (); j++) { - (*j) = 0; + (*j) = nullptr; } m_neighbours.clear (); } diff --git a/src/mesh/model/dot11s/ie-dot11s-preq.cc b/src/mesh/model/dot11s/ie-dot11s-preq.cc index d28d71ba5..2fa3d6a45 100644 --- a/src/mesh/model/dot11s/ie-dot11s-preq.cc +++ b/src/mesh/model/dot11s/ie-dot11s-preq.cc @@ -375,7 +375,7 @@ IePreq::ClearDestinationAddressElements () for (std::vector >::iterator j = m_destinations.begin (); j != m_destinations.end (); j++) { - (*j) = 0; + (*j) = nullptr; } m_destinations.clear (); m_destCount = 0; diff --git a/src/mesh/model/dot11s/peer-management-protocol.cc b/src/mesh/model/dot11s/peer-management-protocol.cc index 604ad010e..a1284e200 100644 --- a/src/mesh/model/dot11s/peer-management-protocol.cc +++ b/src/mesh/model/dot11s/peer-management-protocol.cc @@ -95,7 +95,7 @@ PeerManagementProtocol::PeerManagementProtocol () : } PeerManagementProtocol::~PeerManagementProtocol () { - m_meshId = 0; + m_meshId = nullptr; } void PeerManagementProtocol::DoDispose () @@ -106,7 +106,7 @@ PeerManagementProtocol::DoDispose () { for (PeerLinksOnInterface::iterator i = j->second.begin (); i != j->second.end (); i++) { - (*i) = 0; + (*i) = nullptr; } j->second.clear (); } @@ -147,7 +147,7 @@ PeerManagementProtocol::GetBeaconTimingElement (uint32_t interface) { if (!GetBeaconCollisionAvoidance ()) { - return 0; + return nullptr; } Ptr retval = Create (); PeerLinksMap::iterator iface = m_peerLinks.find (interface); @@ -303,9 +303,9 @@ PeerManagementProtocol::FindPeerLink (uint32_t interface, Mac48Address peerAddre { if ((*i)->LinkIsIdle ()) { - (*i) = 0; + (*i) = nullptr; (iface->second).erase (i); - return 0; + return nullptr; } else { @@ -313,7 +313,7 @@ PeerManagementProtocol::FindPeerLink (uint32_t interface, Mac48Address peerAddre } } } - return 0; + return nullptr; } void PeerManagementProtocol::SetPeerLinkStatusCallback ( diff --git a/src/mesh/model/flame/flame-protocol-mac.cc b/src/mesh/model/flame/flame-protocol-mac.cc index 398bf6815..f28d73339 100644 --- a/src/mesh/model/flame/flame-protocol-mac.cc +++ b/src/mesh/model/flame/flame-protocol-mac.cc @@ -36,8 +36,8 @@ FlameProtocolMac::FlameProtocolMac (Ptr protocol) : } FlameProtocolMac::~FlameProtocolMac () { - m_protocol = 0; - m_parent = 0; + m_protocol = nullptr; + m_parent = nullptr; } void FlameProtocolMac::SetParent (Ptr parent) diff --git a/src/mesh/model/flame/flame-protocol.cc b/src/mesh/model/flame/flame-protocol.cc index 4a0a7f1bc..a04c3debe 100644 --- a/src/mesh/model/flame/flame-protocol.cc +++ b/src/mesh/model/flame/flame-protocol.cc @@ -144,8 +144,8 @@ void FlameProtocol::DoDispose () { m_interfaces.clear (); - m_rtable = 0; - m_mp = 0; + m_rtable = nullptr; + m_mp = nullptr; } bool FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, diff --git a/src/mesh/model/mesh-l2-routing-protocol.cc b/src/mesh/model/mesh-l2-routing-protocol.cc index 1e9ac20aa..b5cdb545b 100644 --- a/src/mesh/model/mesh-l2-routing-protocol.cc +++ b/src/mesh/model/mesh-l2-routing-protocol.cc @@ -41,7 +41,7 @@ MeshL2RoutingProtocol::GetTypeId () MeshL2RoutingProtocol::~MeshL2RoutingProtocol () { - m_mp = 0; + m_mp = nullptr; } void diff --git a/src/mesh/model/mesh-point-device.cc b/src/mesh/model/mesh-point-device.cc index df590960a..638af881f 100644 --- a/src/mesh/model/mesh-point-device.cc +++ b/src/mesh/model/mesh-point-device.cc @@ -71,9 +71,9 @@ MeshPointDevice::MeshPointDevice () : MeshPointDevice::~MeshPointDevice () { NS_LOG_FUNCTION (this); - m_node = 0; - m_channel = 0; - m_routingProtocol = 0; + m_node = nullptr; + m_channel = nullptr; + m_routingProtocol = nullptr; } void @@ -82,12 +82,12 @@ MeshPointDevice::DoDispose () NS_LOG_FUNCTION (this); for (std::vector >::iterator iter = m_ifaces.begin (); iter != m_ifaces.end (); iter++) { - *iter = 0; + *iter = nullptr; } m_ifaces.clear (); - m_node = 0; - m_channel = 0; - m_routingProtocol = 0; + m_node = nullptr; + m_channel = nullptr; + m_routingProtocol = nullptr; NetDevice::DoDispose (); } @@ -360,7 +360,7 @@ MeshPointDevice::GetInterface (uint32_t n) const } } NS_FATAL_ERROR ("Mesh point interface is not found by index"); - return 0; + return nullptr; } std::vector > MeshPointDevice::GetInterfaces () const diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression.cc b/src/mesh/test/dot11s/hwmp-proactive-regression.cc index 029a6fbed..5dc9d4d7a 100644 --- a/src/mesh/test/dot11s/hwmp-proactive-regression.cc +++ b/src/mesh/test/dot11s/hwmp-proactive-regression.cc @@ -43,7 +43,7 @@ const char * const PREFIX = "hwmp-proactive-regression-test"; HwmpProactiveRegressionTest::HwmpProactiveRegressionTest () : TestCase ("HWMP proactive regression test"), - m_nodes (0), + m_nodes (nullptr), m_time (Seconds (5)), m_sentPktsCounter (0) { @@ -68,7 +68,7 @@ HwmpProactiveRegressionTest::DoRun () CheckResults (); - delete m_nodes, m_nodes = 0; + delete m_nodes, m_nodes = nullptr; } void HwmpProactiveRegressionTest::CreateNodes () diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression.cc b/src/mesh/test/dot11s/hwmp-reactive-regression.cc index 84550208a..23e5efd5c 100644 --- a/src/mesh/test/dot11s/hwmp-reactive-regression.cc +++ b/src/mesh/test/dot11s/hwmp-reactive-regression.cc @@ -40,7 +40,7 @@ const char * const PREFIX = "hwmp-reactive-regression-test"; HwmpReactiveRegressionTest::HwmpReactiveRegressionTest () : TestCase ("HWMP on-demand regression test"), - m_nodes (0), + m_nodes (nullptr), m_time (Seconds (10)), m_sentPktsCounter (0) { @@ -63,7 +63,7 @@ HwmpReactiveRegressionTest::DoRun () Simulator::Destroy (); CheckResults (); - delete m_nodes, m_nodes = 0; + delete m_nodes, m_nodes = nullptr; } void HwmpReactiveRegressionTest::CreateNodes () diff --git a/src/mesh/test/dot11s/hwmp-simplest-regression.cc b/src/mesh/test/dot11s/hwmp-simplest-regression.cc index 4a11d21a0..b124f59ff 100644 --- a/src/mesh/test/dot11s/hwmp-simplest-regression.cc +++ b/src/mesh/test/dot11s/hwmp-simplest-regression.cc @@ -42,7 +42,7 @@ const char * const PREFIX = "hwmp-simplest-regression-test"; HwmpSimplestRegressionTest::HwmpSimplestRegressionTest () : TestCase ("Simplest HWMP regression test"), - m_nodes (0), + m_nodes (nullptr), m_time (Seconds (15)), m_sentPktsCounter (0) { @@ -67,7 +67,7 @@ HwmpSimplestRegressionTest::DoRun () CheckResults (); - delete m_nodes, m_nodes = 0; + delete m_nodes, m_nodes = nullptr; } void HwmpSimplestRegressionTest::CreateNodes () diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc index 7ec9f3c46..d75cea20e 100644 --- a/src/mesh/test/dot11s/hwmp-target-flags-regression.cc +++ b/src/mesh/test/dot11s/hwmp-target-flags-regression.cc @@ -43,7 +43,7 @@ const char * const PREFIX = "hwmp-target-flags-regression-test"; HwmpDoRfRegressionTest::HwmpDoRfRegressionTest () : TestCase ("HWMP target flags regression test"), - m_nodes (0), + m_nodes (nullptr), m_time (Seconds (5)), m_sentPktsCounterA (0), m_sentPktsCounterB (0), @@ -71,7 +71,7 @@ HwmpDoRfRegressionTest::DoRun () CheckResults (); - delete m_nodes, m_nodes = 0; + delete m_nodes, m_nodes = nullptr; } void diff --git a/src/mesh/test/dot11s/pmp-regression.cc b/src/mesh/test/dot11s/pmp-regression.cc index b966b1690..004fc1339 100644 --- a/src/mesh/test/dot11s/pmp-regression.cc +++ b/src/mesh/test/dot11s/pmp-regression.cc @@ -40,7 +40,7 @@ using namespace ns3; const char * const PREFIX = "pmp-regression-test"; PeerManagementProtocolRegressionTest::PeerManagementProtocolRegressionTest () : TestCase ("PMP regression test"), - m_nodes (0), + m_nodes (nullptr), m_time (Seconds (1)) { } @@ -64,7 +64,7 @@ PeerManagementProtocolRegressionTest::DoRun () CheckResults (); - delete m_nodes, m_nodes = 0; + delete m_nodes, m_nodes = nullptr; } void diff --git a/src/mesh/test/flame/flame-regression.cc b/src/mesh/test/flame/flame-regression.cc index f98d0f147..9adc06046 100644 --- a/src/mesh/test/flame/flame-regression.cc +++ b/src/mesh/test/flame/flame-regression.cc @@ -42,7 +42,7 @@ const char * const PREFIX = "flame-regression-test"; FlameRegressionTest::FlameRegressionTest () : TestCase ("FLAME regression test"), - m_nodes (0), + m_nodes (nullptr), m_time (Seconds (10)), m_sentPktsCounter (0) { @@ -68,7 +68,7 @@ FlameRegressionTest::DoRun () CheckResults (); - delete m_nodes, m_nodes = 0; + delete m_nodes, m_nodes = nullptr; } void diff --git a/src/mobility/helper/ns2-mobility-helper.cc b/src/mobility/helper/ns2-mobility-helper.cc index 86082cb63..7e2fc3d2c 100644 --- a/src/mobility/helper/ns2-mobility-helper.cc +++ b/src/mobility/helper/ns2-mobility-helper.cc @@ -238,7 +238,7 @@ Ns2MobilityHelper::GetMobilityModel (std::string idString, const ObjectStore &st Ptr object = store.Get (id); if (!object) { - return 0; + return nullptr; } Ptr model = object->GetObject (); if (!model) diff --git a/src/mobility/helper/ns2-mobility-helper.h b/src/mobility/helper/ns2-mobility-helper.h index ecdb5a888..1fd977988 100644 --- a/src/mobility/helper/ns2-mobility-helper.h +++ b/src/mobility/helper/ns2-mobility-helper.h @@ -153,7 +153,7 @@ public: iterator += i; if (iterator >= m_end) { - return 0; + return nullptr; } return *iterator; } diff --git a/src/mobility/model/hierarchical-mobility-model.cc b/src/mobility/model/hierarchical-mobility-model.cc index 196a9b5ec..91751a2d1 100644 --- a/src/mobility/model/hierarchical-mobility-model.cc +++ b/src/mobility/model/hierarchical-mobility-model.cc @@ -50,8 +50,8 @@ HierarchicalMobilityModel::GetTypeId () } HierarchicalMobilityModel::HierarchicalMobilityModel () - : m_child (0), - m_parent (0) + : m_child (nullptr), + m_parent (nullptr) { NS_LOG_FUNCTION (this); } diff --git a/src/mobility/test/ns2-mobility-helper-test-suite.cc b/src/mobility/test/ns2-mobility-helper-test-suite.cc index da63067c4..ae4ea37d3 100644 --- a/src/mobility/test/ns2-mobility-helper-test-suite.cc +++ b/src/mobility/test/ns2-mobility-helper-test-suite.cc @@ -307,7 +307,7 @@ public: // to be used as temporary variable for test cases. // Note that test suite takes care of deleting all test cases. - Ns2MobilityHelperTest * t (0); + Ns2MobilityHelperTest * t (nullptr); // Initial position t = new Ns2MobilityHelperTest ("initial position", Seconds (1)); diff --git a/src/mobility/test/waypoint-mobility-model-test.cc b/src/mobility/test/waypoint-mobility-model-test.cc index d2f9b3b58..98cbf6d85 100644 --- a/src/mobility/test/waypoint-mobility-model-test.cc +++ b/src/mobility/test/waypoint-mobility-model-test.cc @@ -197,7 +197,7 @@ private: void WaypointMobilityModelAddWaypointTest::DoTeardown () { - m_mobilityModel = 0; + m_mobilityModel = nullptr; } void diff --git a/src/netanim/examples/colors-link-description.cc b/src/netanim/examples/colors-link-description.cc index aa17b4009..5765c230a 100644 --- a/src/netanim/examples/colors-link-description.cc +++ b/src/netanim/examples/colors-link-description.cc @@ -28,7 +28,7 @@ using namespace ns3; -AnimationInterface * pAnim = 0; +AnimationInterface * pAnim = nullptr; /// RGB structure struct rgb { diff --git a/src/netanim/examples/resources-counters.cc b/src/netanim/examples/resources-counters.cc index a1e964d58..68dc10743 100644 --- a/src/netanim/examples/resources-counters.cc +++ b/src/netanim/examples/resources-counters.cc @@ -28,7 +28,7 @@ using namespace ns3; -AnimationInterface * pAnim = 0; +AnimationInterface * pAnim = nullptr; /// RGB struture struct rgb { diff --git a/src/netanim/examples/uan-animation.cc b/src/netanim/examples/uan-animation.cc index b3ca3c62d..86eccb790 100644 --- a/src/netanim/examples/uan-animation.cc +++ b/src/netanim/examples/uan-animation.cc @@ -117,7 +117,7 @@ NetAnimExperiment::ReceivePacket (Ptr socket) { m_bytesTotal += packet->GetSize (); } - packet = 0; + packet = nullptr; } void @@ -222,27 +222,27 @@ NetAnimExperiment::Run (UanHelper &uan) AnimationInterface anim(traceFileName.c_str ()); Simulator::Run (); - sinkNode = 0; - sinkSocket = 0; - pos = 0; - channel = 0; - prop = 0; + sinkNode = nullptr; + sinkSocket = nullptr; + pos = nullptr; + channel = nullptr; + prop = nullptr; for (uint32_t i=0; i < nc.GetN (); i++) { - nc.Get (i) = 0; + nc.Get (i) = nullptr; } for (uint32_t i=0; i < sink.GetN (); i++) { - sink.Get (i) = 0; + sink.Get (i) = nullptr; } for (uint32_t i=0; i < devices.GetN (); i++) { - devices.Get (i) = 0; + devices.Get (i) = nullptr; } for (uint32_t i=0; i < sinkdev.GetN (); i++) { - sinkdev.Get (i) = 0; + sinkdev.Get (i) = nullptr; } Simulator::Destroy (); @@ -297,8 +297,8 @@ main (int argc, char **argv) exp.Run (uan); - per = 0; - sinr = 0; + per = nullptr; + sinr = nullptr; } diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index 9abdef86c..38b36db46 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -78,12 +78,12 @@ static bool initialized = false; //!< Initialization flag // Public methods AnimationInterface::AnimationInterface (const std::string fn) - : m_f (0), - m_routingF (0), + : m_f (nullptr), + m_routingF (nullptr), m_mobilityPollInterval (Seconds (0.25)), m_outputFileName (fn), gAnimUid (0), - m_writeCallback (0), + m_writeCallback (nullptr), m_started (false), m_enablePacketMetadata (false), m_startTime (Seconds (0)), @@ -311,7 +311,7 @@ AnimationInterface::SetAnimWriteCallback (AnimWriteCallback cb) void AnimationInterface::ResetAnimWriteCallback () { - m_writeCallback = 0; + m_writeCallback = nullptr; } void @@ -963,7 +963,7 @@ AnimationInterface::WifiPhyRxBeginTrace (std::string context, Ptr } Ptr txNode = NodeList::GetNode (m_macToNodeIdMap[oss.str ()]); UpdatePosition (txNode); - AnimPacketInfo pktInfo (0, Simulator::Now (), m_macToNodeIdMap[oss.str ()]); + AnimPacketInfo pktInfo (nullptr, Simulator::Now (), m_macToNodeIdMap[oss.str ()]); AddPendingPacket (AnimationInterface::WIFI, animUid, pktInfo); NS_LOG_WARN ("WifiPhyRxBegin: unknown Uid, but we are adding a wifi packet"); } @@ -1088,7 +1088,7 @@ AnimationInterface::WavePhyRxBeginTrace (std::string context, Ptr } Ptr txNode = NodeList::GetNode (m_macToNodeIdMap[oss.str ()]); UpdatePosition (txNode); - AnimPacketInfo pktInfo (0, Simulator::Now (), m_macToNodeIdMap[oss.str ()]); + AnimPacketInfo pktInfo (nullptr, Simulator::Now (), m_macToNodeIdMap[oss.str ()]); AddPendingPacket (AnimationInterface::WAVE, animUid, pktInfo); NS_LOG_WARN ("WavePhyRxBegin: unknown Uid, but we are adding a wave packet"); } @@ -1365,7 +1365,7 @@ AnimationInterface::PurgePendingPackets (AnimationInterface::ProtocolType protoc AnimationInterface::AnimUidPacketInfoMap * AnimationInterface::ProtocolTypeToPendingPackets (AnimationInterface::ProtocolType protocolType) { - AnimUidPacketInfoMap * pendingPackets = 0; + AnimUidPacketInfoMap * pendingPackets = nullptr; switch (protocolType) { case AnimationInterface::WIFI: @@ -1502,7 +1502,7 @@ AnimationInterface::StopAnimation (bool onlyAnimation) // Terminate the anim element WriteXmlClose ("anim"); std::fclose (m_f); - m_f = 0; + m_f = nullptr; } if (onlyAnimation) { @@ -1512,7 +1512,7 @@ AnimationInterface::StopAnimation (bool onlyAnimation) { WriteXmlClose ("anim", true); std::fclose (m_routingF); - m_routingF = 0; + m_routingF = nullptr; } } @@ -2143,7 +2143,7 @@ AnimationInterface::SetOutputFile (const std::string& fn, bool routing) } NS_LOG_INFO ("Creating new trace file:" << fn.c_str ()); - FILE * f = 0; + FILE * f = nullptr; f = std::fopen (fn.c_str (), "w"); if (!f) { @@ -2295,7 +2295,7 @@ AnimationInterface::TrackIpv4RoutePaths () Ipv4Header header; header.SetDestination (Ipv4Address (trackElement.destination.c_str ())); Socket::SocketErrno sockerr; - Ptr rt = rp->RouteOutput (pkt, header, 0, sockerr); + Ptr rt = rp->RouteOutput (pkt, header, nullptr, sockerr); Ipv4RoutePathElements rpElements; if (!rt) { @@ -2423,7 +2423,7 @@ AnimationInterface::RecursiveIpv4RoutePathSearch (std::string from, std::string Ipv4Header header; header.SetDestination (Ipv4Address (to.c_str ())); Socket::SocketErrno sockerr; - Ptr rt = rp->RouteOutput (pkt, header, 0, sockerr); + Ptr rt = rp->RouteOutput (pkt, header, nullptr, sockerr); if (!rt) { return; @@ -2935,7 +2935,7 @@ AnimByteTag::Get () const } AnimationInterface::AnimPacketInfo::AnimPacketInfo () - : m_txnd (0), + : m_txnd (nullptr), m_txNodeId (0), m_fbTx (0), m_lbTx (0), diff --git a/src/netanim/test/netanim-test.cc b/src/netanim/test/netanim-test.cc index 2f8e5b059..993a5ccaf 100644 --- a/src/netanim/test/netanim-test.cc +++ b/src/netanim/test/netanim-test.cc @@ -80,7 +80,7 @@ private: }; AbstractAnimationInterfaceTestCase::AbstractAnimationInterfaceTestCase (std::string name) : - TestCase (name), m_anim (NULL), m_traceFileName ("netanim-test.xml") + TestCase (name), m_anim (nullptr), m_traceFileName ("netanim-test.xml") { } diff --git a/src/network/model/address.cc b/src/network/model/address.cc index 966f8af49..e4d994158 100644 --- a/src/network/model/address.cc +++ b/src/network/model/address.cc @@ -258,8 +258,8 @@ std::istream& operator>> (std::istream& is, Address & address) std::string type = v.substr (0, firstDash-0); std::string len = v.substr (firstDash+1, secondDash-(firstDash+1)); - address.m_type = strtoul (type.c_str(), 0, 16); - address.m_len = strtoul (len.c_str(), 0, 16); + address.m_type = strtoul (type.c_str(), nullptr, 16); + address.m_len = strtoul (len.c_str(), nullptr, 16); NS_ASSERT (address.m_len <= Address::MAX_SIZE); std::string::size_type col = secondDash + 1; @@ -271,13 +271,13 @@ std::istream& operator>> (std::istream& is, Address & address) if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); - address.m_data[i] = strtoul (tmp.c_str(), 0, 16); + address.m_data[i] = strtoul (tmp.c_str(), nullptr, 16); break; } else { tmp = v.substr (col, next-col); - address.m_data[i] = strtoul (tmp.c_str(), 0, 16); + address.m_data[i] = strtoul (tmp.c_str(), nullptr, 16); col = next + 1; } } diff --git a/src/network/model/application.cc b/src/network/model/application.cc index cf851656b..45606cbfe 100644 --- a/src/network/model/application.cc +++ b/src/network/model/application.cc @@ -83,7 +83,7 @@ void Application::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; + m_node = nullptr; m_startEvent.Cancel (); m_stopEvent.Cancel (); Object::DoDispose (); diff --git a/src/network/model/buffer.cc b/src/network/model/buffer.cc index 67a77fd9d..76fe48aa6 100644 --- a/src/network/model/buffer.cc +++ b/src/network/model/buffer.cc @@ -76,7 +76,7 @@ uint32_t Buffer::g_recommendedStart = 0; #define DESTROYED ((Buffer::FreeList*)MAGIC_DESTROYED) #define UNINITIALIZED ((Buffer::FreeList*)0) uint32_t Buffer::g_maxSize = 0; -Buffer::FreeList *Buffer::g_freeList = 0; +Buffer::FreeList *Buffer::g_freeList = nullptr; struct Buffer::LocalStaticDestructor Buffer::g_localStaticDestructor; Buffer::LocalStaticDestructor::~LocalStaticDestructor() diff --git a/src/network/model/buffer.h b/src/network/model/buffer.h index 236b91331..863ca0aea 100644 --- a/src/network/model/buffer.h +++ b/src/network/model/buffer.h @@ -817,7 +817,7 @@ Buffer::Iterator::Iterator () m_dataStart (0), m_dataEnd (0), m_current (0), - m_data (0) + m_data (nullptr) { } Buffer::Iterator::Iterator (Buffer const*buffer) diff --git a/src/network/model/byte-tag-list.cc b/src/network/model/byte-tag-list.cc index 94f5ca86a..58383192f 100644 --- a/src/network/model/byte-tag-list.cc +++ b/src/network/model/byte-tag-list.cc @@ -143,7 +143,7 @@ ByteTagList::ByteTagList () m_maxEnd (INT32_MIN), m_adjustment (0), m_used (0), - m_data (0) + m_data (nullptr) { NS_LOG_FUNCTION (this); } @@ -155,7 +155,7 @@ ByteTagList::ByteTagList (const ByteTagList &o) m_data (o.m_data) { NS_LOG_FUNCTION (this << &o); - if (m_data != 0) + if (m_data != nullptr) { m_data->count++; } @@ -174,7 +174,7 @@ ByteTagList::operator = (const ByteTagList &o) m_adjustment = o.m_adjustment; m_data = o.m_data; m_used = o.m_used; - if (m_data != 0) + if (m_data != nullptr) { m_data->count++; } @@ -184,7 +184,7 @@ ByteTagList::~ByteTagList () { NS_LOG_FUNCTION (this); Deallocate (m_data); - m_data = 0; + m_data = nullptr; m_used = 0; } @@ -194,7 +194,7 @@ ByteTagList::Add (TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) NS_LOG_FUNCTION (this << tid << bufferSize << start << end); uint32_t spaceNeeded = m_used + bufferSize + 4 + 4 + 4 + 4; NS_ASSERT (m_used <= spaceNeeded); - if (m_data == 0) + if (m_data == nullptr) { m_data = Allocate (spaceNeeded); m_used = 0; @@ -247,7 +247,7 @@ ByteTagList::RemoveAll () m_minStart = INT32_MAX; m_maxEnd = INT32_MIN; m_adjustment = 0; - m_data = 0; + m_data = nullptr; m_used = 0; } @@ -264,9 +264,9 @@ ByteTagList::Iterator ByteTagList::Begin (int32_t offsetStart, int32_t offsetEnd) const { NS_LOG_FUNCTION (this << offsetStart << offsetEnd); - if (m_data == 0) + if (m_data == nullptr) { - return Iterator (0, 0, offsetStart, offsetEnd, 0); + return Iterator (nullptr, nullptr, offsetStart, offsetEnd, 0); } else { @@ -349,7 +349,7 @@ ByteTagList::Allocate (uint32_t size) { struct ByteTagListData *data = g_freeList.back (); g_freeList.pop_back (); - NS_ASSERT (data != 0); + NS_ASSERT (data != nullptr); if (data->size >= size) { data->count = 1; @@ -371,7 +371,7 @@ void ByteTagList::Deallocate (struct ByteTagListData *data) { NS_LOG_FUNCTION (this << data); - if (data == 0) + if (data == nullptr) { return; } @@ -461,7 +461,7 @@ ByteTagList::Serialize (uint32_t* buffer, uint32_t maxSize) const uint32_t* p = buffer; uint32_t size = 0; - uint32_t* numberOfTags = 0; + uint32_t* numberOfTags = nullptr; if (size + 4 <= maxSize) { diff --git a/src/network/model/channel-list.cc b/src/network/model/channel-list.cc index 3e9d207a8..3af92a135 100644 --- a/src/network/model/channel-list.cc +++ b/src/network/model/channel-list.cc @@ -128,7 +128,7 @@ Ptr * ChannelListPriv::DoGet () { NS_LOG_FUNCTION_NOARGS (); - static Ptr ptr = 0; + static Ptr ptr = nullptr; if (!ptr) { ptr = CreateObject (); @@ -143,7 +143,7 @@ ChannelListPriv::Delete () { NS_LOG_FUNCTION_NOARGS (); Config::UnregisterRootNamespaceObject (Get ()); - (*DoGet ()) = 0; + (*DoGet ()) = nullptr; } ChannelListPriv::ChannelListPriv () @@ -164,7 +164,7 @@ ChannelListPriv::DoDispose () { Ptr channel = *i; channel->Dispose (); - *i = 0; + *i = nullptr; } m_channels.erase (m_channels.begin (), m_channels.end ()); Object::DoDispose (); diff --git a/src/network/model/node-list.cc b/src/network/model/node-list.cc index 3c48bf497..55ef15151 100644 --- a/src/network/model/node-list.cc +++ b/src/network/model/node-list.cc @@ -130,7 +130,7 @@ Ptr * NodeListPriv::DoGet () { NS_LOG_FUNCTION_NOARGS (); - static Ptr ptr = 0; + static Ptr ptr = nullptr; if (!ptr) { ptr = CreateObject (); @@ -144,7 +144,7 @@ NodeListPriv::Delete () { NS_LOG_FUNCTION_NOARGS (); Config::UnregisterRootNamespaceObject (Get ()); - (*DoGet ()) = 0; + (*DoGet ()) = nullptr; } @@ -165,7 +165,7 @@ NodeListPriv::DoDispose () { Ptr node = *i; node->Dispose (); - *i = 0; + *i = nullptr; } m_nodes.erase (m_nodes.begin (), m_nodes.end ()); Object::DoDispose (); diff --git a/src/network/model/node.cc b/src/network/model/node.cc index 96927f5ef..cc8615f60 100644 --- a/src/network/model/node.cc +++ b/src/network/model/node.cc @@ -192,7 +192,7 @@ Node::DoDispose () { Ptr device = *i; device->Dispose (); - *i = 0; + *i = nullptr; } m_devices.clear (); for (std::vector >::iterator i = m_applications.begin (); @@ -200,7 +200,7 @@ Node::DoDispose () { Ptr application = *i; application->Dispose (); - *i = 0; + *i = nullptr; } m_applications.clear (); Object::DoDispose (); diff --git a/src/network/model/packet-metadata.cc b/src/network/model/packet-metadata.cc index 4029977b8..458618bc7 100644 --- a/src/network/model/packet-metadata.cc +++ b/src/network/model/packet-metadata.cc @@ -99,7 +99,7 @@ void PacketMetadata::Reserve (uint32_t size) { NS_LOG_FUNCTION (this << size); - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); if (m_data->m_size >= m_used + size && (m_head == 0xffff || m_data->m_count == 1 || @@ -374,7 +374,7 @@ uint16_t PacketMetadata::AddSmall (const struct PacketMetadata::SmallItem *item) { NS_LOG_FUNCTION (this << item->next << item->prev << item->typeUid << item->size << item->chunkUid); - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); NS_ASSERT (m_used != item->prev && m_used != item->next); uint32_t typeUidSize = GetUleb128Size (item->typeUid); uint32_t sizeSize = GetUleb128Size (item->size); @@ -407,7 +407,7 @@ PacketMetadata::AddBig (uint32_t next, uint32_t prev, NS_LOG_FUNCTION (this << next << prev << item->next << item->prev << item->typeUid << item->size << item->chunkUid << extraItem->fragmentStart << extraItem->fragmentEnd << extraItem->packetUid); - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); uint32_t typeUid = ((item->typeUid & 0x1) == 0x1) ? item->typeUid : item->typeUid+1; NS_ASSERT (m_used != prev && m_used != next); @@ -456,7 +456,7 @@ PacketMetadata::ReplaceTail (PacketMetadata::SmallItem *item, extraItem->fragmentStart << extraItem->fragmentEnd << extraItem->packetUid << available); - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); /* If the tail we want to replace is located at the end of the data array, * and if there is extra room at the end of this array, then, * we can try to use that extra space to avoid falling in the slow @@ -895,7 +895,7 @@ PacketMetadata::RemoveAtStart (uint32_t start) m_metadataSkipped = true; return; } - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); uint32_t leftToRemove = start; uint16_t current = m_head; while (current != 0xffff && leftToRemove > 0) @@ -958,7 +958,7 @@ PacketMetadata::RemoveAtEnd (uint32_t end) m_metadataSkipped = true; return; } - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); uint32_t leftToRemove = end; uint16_t current = m_tail; @@ -1181,7 +1181,7 @@ PacketMetadata::Serialize (uint8_t* buffer, uint32_t maxSize) const uint8_t* start = buffer; buffer = AddToRawU64 (m_packetUid, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } @@ -1205,13 +1205,13 @@ PacketMetadata::Serialize (uint8_t* buffer, uint32_t maxSize) const std::string uidString = tid.GetName (); uint32_t uidStringSize = uidString.size (); buffer = AddToRawU32 (uidStringSize, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } buffer = AddToRaw (reinterpret_cast (uidString.c_str ()), uidStringSize, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } @@ -1219,7 +1219,7 @@ PacketMetadata::Serialize (uint8_t* buffer, uint32_t maxSize) const else { buffer = AddToRawU32 (0, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } @@ -1227,37 +1227,37 @@ PacketMetadata::Serialize (uint8_t* buffer, uint32_t maxSize) const uint8_t isBig = item.typeUid & 0x1; buffer = AddToRawU8 (isBig, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } buffer = AddToRawU32 (item.size, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } buffer = AddToRawU16 (item.chunkUid, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } buffer = AddToRawU32 (extraItem.fragmentStart, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } buffer = AddToRawU32 (extraItem.fragmentEnd, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } buffer = AddToRawU64 (extraItem.packetUid, start, buffer, maxSize); - if (buffer == 0) + if (buffer == nullptr) { return 0; } @@ -1346,7 +1346,7 @@ PacketMetadata::AddToRawU8 (const uint8_t& data, // First check buffer overflow if (static_cast ((current + sizeof (uint8_t) - start)) > maxSize) { - return 0; + return nullptr; } memcpy (current, &data, sizeof (uint8_t)); return current + sizeof (uint8_t); @@ -1362,7 +1362,7 @@ PacketMetadata::AddToRawU16 (const uint16_t& data, // First check buffer overflow if (static_cast ((current + sizeof (uint16_t) - start)) > maxSize) { - return 0; + return nullptr; } memcpy (current, &data, sizeof (uint16_t)); return current + sizeof (uint16_t); @@ -1378,7 +1378,7 @@ PacketMetadata::AddToRawU32 (const uint32_t& data, // First check buffer overflow if (static_cast ((current + sizeof (uint32_t) - start)) > maxSize) { - return 0; + return nullptr; } memcpy (current, &data, sizeof (uint32_t)); return current + sizeof (uint32_t); @@ -1394,7 +1394,7 @@ PacketMetadata::AddToRawU64 (const uint64_t& data, // First check buffer overflow if (static_cast ((current + sizeof (uint64_t) - start)) > maxSize) { - return 0; + return nullptr; } memcpy (current, &data, sizeof (uint64_t)); return current + sizeof (uint64_t); @@ -1411,7 +1411,7 @@ PacketMetadata::AddToRaw (const uint8_t* data, // First check buffer overflow if (static_cast ((current + dataSize - start)) > maxSize) { - return 0; + return nullptr; } memcpy (current, data, dataSize); return current + dataSize; @@ -1427,7 +1427,7 @@ PacketMetadata::ReadFromRawU8 (uint8_t& data, // First check buffer underflow if (static_cast ((current + sizeof (uint8_t) - start)) > maxSize) { - return 0; + return nullptr; } memcpy (&data, current, sizeof (uint8_t)); return const_cast (current) + sizeof (uint8_t); @@ -1443,7 +1443,7 @@ PacketMetadata::ReadFromRawU16 (uint16_t& data, // First check buffer underflow if (static_cast ((current + sizeof (uint16_t) - start)) > maxSize) { - return 0; + return nullptr; } memcpy (&data, current, sizeof (uint16_t)); return const_cast (current) + sizeof (uint16_t); @@ -1459,7 +1459,7 @@ PacketMetadata::ReadFromRawU32 (uint32_t& data, // First check buffer underflow if (static_cast ((current + sizeof (uint32_t) - start)) > maxSize) { - return 0; + return nullptr; } memcpy (&data, current, sizeof (uint32_t)); return const_cast (current) + sizeof (uint32_t); @@ -1475,7 +1475,7 @@ PacketMetadata::ReadFromRawU64 (uint64_t& data, // First check buffer underflow if ((uint32_t)((current + sizeof (uint64_t) - start)) > maxSize) { - return 0; + return nullptr; } memcpy (&data, current, sizeof (uint64_t)); return const_cast (current) + sizeof (uint64_t); diff --git a/src/network/model/packet-metadata.h b/src/network/model/packet-metadata.h index 37b6de04a..882141165 100644 --- a/src/network/model/packet-metadata.h +++ b/src/network/model/packet-metadata.h @@ -712,7 +712,7 @@ PacketMetadata::PacketMetadata (PacketMetadata const &o) m_used (o.m_used), m_packetUid (o.m_packetUid) { - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); NS_ASSERT (m_data->m_count < std::numeric_limits::max()); m_data->m_count++; } @@ -722,14 +722,14 @@ PacketMetadata::operator = (PacketMetadata const& o) if (m_data != o.m_data) { // not self assignment - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); m_data->m_count--; if (m_data->m_count == 0) { PacketMetadata::Recycle (m_data); } m_data = o.m_data; - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); m_data->m_count++; } m_head = o.m_head; @@ -740,7 +740,7 @@ PacketMetadata::operator = (PacketMetadata const& o) } PacketMetadata::~PacketMetadata () { - NS_ASSERT (m_data != 0); + NS_ASSERT (m_data != nullptr); m_data->m_count--; if (m_data->m_count == 0) { diff --git a/src/network/model/packet-tag-list.cc b/src/network/model/packet-tag-list.cc index ebbe1b7e1..67686f852 100644 --- a/src/network/model/packet-tag-list.cc +++ b/src/network/model/packet-tag-list.cc @@ -59,7 +59,7 @@ PacketTagList::COWTraverse (Tag & tag, PacketTagList::COWWriter Writer) NS_LOG_INFO ("looking for " << tid); // trivial case when list is empty - if (m_next == 0) + if (m_next == nullptr) { return false; } @@ -68,10 +68,10 @@ PacketTagList::COWTraverse (Tag & tag, PacketTagList::COWWriter Writer) struct TagData ** prevNext = &m_next; // previous node's next pointer struct TagData * cur = m_next; // cursor to current node - struct TagData * it = 0; // utility + struct TagData * it = nullptr; // utility // Search from the head of the list until we find tid or a merge - while (cur != 0) + while (cur != nullptr) { if (cur->count > 1) { @@ -94,7 +94,7 @@ PacketTagList::COWTraverse (Tag & tag, PacketTagList::COWWriter Writer) } // while !found && !cow // did we find it or run out of tags? - if (cur == 0 || found) + if (cur == nullptr || found) { NS_LOG_INFO ("returning after header with found: " << found); return found; @@ -104,14 +104,14 @@ PacketTagList::COWTraverse (Tag & tag, PacketTagList::COWWriter Writer) // until we find tid, then link past it // Before we do all that work, let's make sure tid really exists - for (it = cur; it != 0; it = it->next) + for (it = cur; it != nullptr; it = it->next) { if (it->tid == tid) { break; } } - if (it == 0) + if (it == nullptr) { // got to end of list without finding tid NS_LOG_INFO ("tid not found after first merge"); @@ -119,7 +119,7 @@ PacketTagList::COWTraverse (Tag & tag, PacketTagList::COWWriter Writer) } // At this point cur is a merge, but untested for tid - NS_ASSERT (cur != 0); + NS_ASSERT (cur != nullptr); NS_ASSERT (cur->count > 1); /* @@ -147,7 +147,7 @@ PacketTagList::COWTraverse (Tag & tag, PacketTagList::COWWriter Writer) // but since we know tid exists, we'll skip this test while ( /* cur && */ cur->tid != tid) { - NS_ASSERT (cur != 0); + NS_ASSERT (cur != nullptr); NS_ASSERT (cur->count > 1); cur->count--; // unmerge cur struct TagData * copy = CreateTagData (cur->size); @@ -162,7 +162,7 @@ PacketTagList::COWTraverse (Tag & tag, PacketTagList::COWWriter Writer) cur = copy->next; } // Sanity check: - NS_ASSERT (cur != 0); // cur should be non-zero + NS_ASSERT (cur != nullptr); // cur should be non-zero NS_ASSERT (cur->tid == tid); // cur->tid should be tid NS_ASSERT (cur->count > 1); // cur should be a merge @@ -202,7 +202,7 @@ PacketTagList::RemoveWriter (Tag & tag, bool preMerge, // cur is always a merge at this point // unmerge cur, since we linked around it already cur->count--; - if (cur->next != 0) + if (cur->next != nullptr) { // there's a next, so make it a merge cur->next->count++; @@ -247,7 +247,7 @@ PacketTagList::ReplaceWriter (Tag & tag, bool preMerge, copy->count = 1; tag.Serialize (TagBuffer (copy->data, copy->data + copy->size)); copy->next = cur->next; // merge into tail - if (copy->next != 0) + if (copy->next != nullptr) { copy->next->count++; // mark new merge } @@ -261,14 +261,14 @@ PacketTagList::Add (const Tag &tag) const { NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ()); // ensure this id was not yet added - for (struct TagData *cur = m_next; cur != 0; cur = cur->next) + for (struct TagData *cur = m_next; cur != nullptr; cur = cur->next) { NS_ASSERT_MSG (cur->tid != tag.GetInstanceTypeId (), "Error: cannot add the same kind of tag twice."); } struct TagData * head = CreateTagData (tag.GetSerializedSize ()); head->count = 1; - head->next = 0; + head->next = nullptr; head->tid = tag.GetInstanceTypeId (); head->next = m_next; tag.Serialize (TagBuffer (head->data, head->data + head->size)); @@ -281,7 +281,7 @@ PacketTagList::Peek (Tag &tag) const { NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ()); TypeId tid = tag.GetInstanceTypeId (); - for (struct TagData *cur = m_next; cur != 0; cur = cur->next) + for (struct TagData *cur = m_next; cur != nullptr; cur = cur->next) { if (cur->tid == tid) { @@ -309,7 +309,7 @@ PacketTagList::GetSerializedSize () const size = 4; // numberOfTags - for (struct TagData *cur = m_next; cur != 0; cur = cur->next) + for (struct TagData *cur = m_next; cur != nullptr; cur = cur->next) { size += 4; // TagData -> size @@ -333,7 +333,7 @@ PacketTagList::Serialize (uint32_t* buffer, uint32_t maxSize) const uint32_t* p = buffer; uint32_t size = 0; - uint32_t* numberOfTags = 0; + uint32_t* numberOfTags = nullptr; if (size + 4 <= maxSize) { @@ -346,7 +346,7 @@ PacketTagList::Serialize (uint32_t* buffer, uint32_t maxSize) const return 0; } - for (struct TagData *cur = m_next; cur != 0; cur = cur->next) + for (struct TagData *cur = m_next; cur != nullptr; cur = cur->next) { if (size + 4 <= maxSize) { @@ -407,7 +407,7 @@ PacketTagList::Deserialize (const uint32_t* buffer, uint32_t size) NS_LOG_INFO("Deserializing number of tags " << numberOfTags); - struct TagData * prevTag = 0; + struct TagData * prevTag = nullptr; for (uint32_t i = 0; i < numberOfTags; ++i) { NS_ASSERT (sizeCheck >= 4); @@ -427,7 +427,7 @@ PacketTagList::Deserialize (const uint32_t* buffer, uint32_t size) struct TagData * newTag = CreateTagData (tagSize); newTag->count = 1; - newTag->next = 0; + newTag->next = nullptr; newTag->tid = tid; NS_ASSERT (sizeCheck >= tagSize); diff --git a/src/network/model/packet-tag-list.h b/src/network/model/packet-tag-list.h index 848cd6546..abc9e5f89 100644 --- a/src/network/model/packet-tag-list.h +++ b/src/network/model/packet-tag-list.h @@ -324,7 +324,7 @@ PacketTagList::PacketTagList () PacketTagList::PacketTagList (PacketTagList const &o) : m_next (o.m_next) { - if (m_next != 0) + if (m_next != nullptr) { m_next->count++; } @@ -340,7 +340,7 @@ PacketTagList::operator = (PacketTagList const &o) } RemoveAll (); m_next = o.m_next; - if (m_next != 0) + if (m_next != nullptr) { m_next->count++; } @@ -355,27 +355,27 @@ PacketTagList::~PacketTagList () void PacketTagList::RemoveAll () { - struct TagData *prev = 0; - for (struct TagData *cur = m_next; cur != 0; cur = cur->next) + struct TagData *prev = nullptr; + for (struct TagData *cur = m_next; cur != nullptr; cur = cur->next) { cur->count--; if (cur->count > 0) { break; } - if (prev != 0) + if (prev != nullptr) { prev->~TagData (); std::free (prev); } prev = cur; } - if (prev != 0) + if (prev != nullptr) { prev->~TagData (); std::free (prev); } - m_next = 0; + m_next = nullptr; } } // namespace ns3 diff --git a/src/network/model/packet.cc b/src/network/model/packet.cc index 7b7625170..d2af83c10 100644 --- a/src/network/model/packet.cc +++ b/src/network/model/packet.cc @@ -88,7 +88,7 @@ PacketTagIterator::PacketTagIterator (const struct PacketTagList::TagData *head) bool PacketTagIterator::HasNext () const { - return m_current != 0; + return m_current != nullptr; } PacketTagIterator::Item PacketTagIterator::Next () @@ -137,7 +137,7 @@ Packet::Packet () * global UID */ m_metadata (static_cast (Simulator::GetSystemId ()) << 32 | m_globalUid, 0), - m_nixVector (0) + m_nixVector (nullptr) { m_globalUid++; } @@ -149,7 +149,7 @@ Packet::Packet (const Packet &o) m_metadata (o.m_metadata) { o.m_nixVector ? m_nixVector = o.m_nixVector->Copy () - : m_nixVector = 0; + : m_nixVector = nullptr; } Packet & @@ -164,7 +164,7 @@ Packet::operator = (const Packet &o) m_packetTagList = o.m_packetTagList; m_metadata = o.m_metadata; o.m_nixVector ? m_nixVector = o.m_nixVector->Copy () - : m_nixVector = 0; + : m_nixVector = nullptr; return *this; } @@ -179,7 +179,7 @@ Packet::Packet (uint32_t size) * global UID */ m_metadata (static_cast (Simulator::GetSystemId ()) << 32 | m_globalUid, size), - m_nixVector (0) + m_nixVector (nullptr) { m_globalUid++; } @@ -188,7 +188,7 @@ Packet::Packet (uint8_t const *buffer, uint32_t size, bool magic) m_byteTagList (), m_packetTagList (), m_metadata (0,0), - m_nixVector (0) + m_nixVector (nullptr) { NS_ASSERT (magic); Deserialize (buffer, size); @@ -205,7 +205,7 @@ Packet::Packet (uint8_t const*buffer, uint32_t size) * global UID */ m_metadata (static_cast (Simulator::GetSystemId ()) << 32 | m_globalUid, size), - m_nixVector (0) + m_nixVector (nullptr) { m_globalUid++; m_buffer.AddAtStart (size); @@ -219,7 +219,7 @@ Packet::Packet (const Buffer &buffer, const ByteTagList &byteTagList, m_byteTagList (byteTagList), m_packetTagList (packetTagList), m_metadata (metadata), - m_nixVector (0) + m_nixVector (nullptr) { } @@ -410,7 +410,7 @@ Packet::PrintByteTags (std::ostream &os) const continue; } Tag *tag = dynamic_cast (constructor ()); - NS_ASSERT (tag != 0); + NS_ASSERT (tag != nullptr); os << " "; item.GetTag (*tag); tag->Print (os); @@ -465,9 +465,9 @@ Packet::Print (std::ostream &os) const Callback constructor = item.tid.GetConstructor (); NS_ASSERT (!constructor.IsNull ()); ObjectBase *instance = constructor (); - NS_ASSERT (instance != 0); + NS_ASSERT (instance != nullptr); Chunk *chunk = dynamic_cast (instance); - NS_ASSERT (chunk != 0); + NS_ASSERT (chunk != nullptr); if (item.type == PacketMetadata::Item::HEADER) { Buffer::Iterator end = item.current; @@ -999,7 +999,7 @@ Packet::PrintPacketTags (std::ostream &os) const NS_ASSERT (!constructor.IsNull ()); ObjectBase *instance = constructor (); Tag *tag = dynamic_cast (instance); - NS_ASSERT (tag != 0); + NS_ASSERT (tag != nullptr); item.GetTag (*tag); tag->Print (os); delete tag; diff --git a/src/network/model/socket.cc b/src/network/model/socket.cc index 6a6658fb1..42188c620 100644 --- a/src/network/model/socket.cc +++ b/src/network/model/socket.cc @@ -52,7 +52,7 @@ Socket::Socket () m_ipv6RecvHopLimit (false) { NS_LOG_FUNCTION_NOARGS (); - m_boundnetdevice = 0; + m_boundnetdevice = nullptr; m_recvPktInfo = false; m_priority = 0; diff --git a/src/network/test/packet-metadata-test.cc b/src/network/test/packet-metadata-test.cc index 6f14d6fe6..8dbe65590 100644 --- a/src/network/test/packet-metadata-test.cc +++ b/src/network/test/packet-metadata-test.cc @@ -373,7 +373,7 @@ PacketMetadataTest::CheckHistory (Ptr p, uint32_t n, ...) { Callback constructor = item.tid.GetConstructor (); HistoryHeaderBase *header = dynamic_cast (constructor ()); - if (header == 0) + if (header == nullptr) { goto error; } @@ -389,7 +389,7 @@ PacketMetadataTest::CheckHistory (Ptr p, uint32_t n, ...) { Callback constructor = item.tid.GetConstructor (); HistoryTrailerBase *trailer = dynamic_cast (constructor ()); - if (trailer == 0) + if (trailer == nullptr) { goto error; } diff --git a/src/network/test/packet-test-suite.cc b/src/network/test/packet-test-suite.cc index 29064dda6..9a58a8c94 100644 --- a/src/network/test/packet-test-suite.cc +++ b/src/network/test/packet-test-suite.cc @@ -605,7 +605,7 @@ PacketTest::DoRun () // force caching a buffer of the right size. frag0 = Create (1000); frag0->AddHeader (ATestHeader<10> ()); - frag0 = 0; + frag0 = nullptr; p = Create (1000); p->AddByteTag (ATestTag<20> ()); @@ -613,7 +613,7 @@ PacketTest::DoRun () frag0 = p->CreateFragment (10, 90); CHECK (p, 1, E (20, 0, 1000)); CHECK (frag0, 1, E (20, 0, 90)); - p = 0; + p = nullptr; frag0->AddHeader (ATestHeader<10> ()); CHECK (frag0, 1, E (20, 10, 100)); @@ -900,7 +900,7 @@ private: */ int RemoveTime (const PacketTagList & ref, ATestTagBase & t, - const char * msg = 0); + const char * msg = nullptr); /** * Prints the remove time diff --git a/src/network/test/pcap-file-test-suite.cc b/src/network/test/pcap-file-test-suite.cc index 1355359d7..05615458c 100644 --- a/src/network/test/pcap-file-test-suite.cc +++ b/src/network/test/pcap-file-test-suite.cc @@ -50,7 +50,7 @@ static bool CheckFileExists (std::string filename) { FILE * p = std::fopen (filename.c_str (), "rb"); - if (p == 0) + if (p == nullptr) { return false; } @@ -64,7 +64,7 @@ static bool CheckFileLength (std::string filename, uint64_t sizeExpected) { FILE * p = std::fopen (filename.c_str (), "rb"); - if (p == 0) + if (p == nullptr) { return false; } @@ -555,7 +555,7 @@ FileHeaderTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ (val32, 1234, "Data length type written incorrectly"); std::fclose (p); - p = 0; + p = nullptr; // // We wrote a little-endian file out correctly, now let's see if we can read @@ -634,7 +634,7 @@ FileHeaderTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ (val32, Swap (uint32_t (1234)), "Data length type written incorrectly"); std::fclose (p); - p = 0; + p = nullptr; // // We wrote an opposite-endian file out correctly, now let's see if we can read @@ -830,7 +830,7 @@ RecordHeaderTestCase::DoRun () } std::fclose (p); - p = 0; + p = nullptr; // // Let's see if the PcapFile object can figure out how to do the same thing and @@ -940,7 +940,7 @@ RecordHeaderTestCase::DoRun () } std::fclose (p); - p = 0; + p = nullptr; // // Let's see if the PcapFile object can figure out how to do the same thing and diff --git a/src/network/utils/ipv6-address.cc b/src/network/utils/ipv6-address.cc index 349c3758a..faf233bb4 100644 --- a/src/network/utils/ipv6-address.cc +++ b/src/network/utils/ipv6-address.cc @@ -155,8 +155,8 @@ static bool AsciiToIpv6Host (const char *address, uint8_t addr[16]) unsigned char tmp[16]; unsigned char* tp = tmp; unsigned char* const endp = tp + 16; - unsigned char* colonp = 0; - const char* xdigits = 0; + unsigned char* colonp = nullptr; + const char* xdigits = nullptr; #if 0 const char* curtok = 0; #endif @@ -179,14 +179,14 @@ static bool AsciiToIpv6Host (const char *address, uint8_t addr[16]) #endif while ((ch = *address++) != '\0') { - const char *pch = 0; + const char *pch = nullptr; - if ((pch = strchr ((xdigits = xdigits_l), ch)) == 0) + if ((pch = strchr ((xdigits = xdigits_l), ch)) == nullptr) { pch = strchr ((xdigits = xdigits_u), ch); } - if (pch != 0) + if (pch != nullptr) { val <<= 4; val |= (pch - xdigits); @@ -246,7 +246,7 @@ static bool AsciiToIpv6Host (const char *address, uint8_t addr[16]) *tp++ = (unsigned char) val & 0xff; } - if (colonp != 0) + if (colonp != nullptr) { /* * Since some memmove ()'s erroneously fail to handle diff --git a/src/network/utils/mac16-address.cc b/src/network/utils/mac16-address.cc index 677e18763..ca4525f9a 100644 --- a/src/network/utils/mac16-address.cc +++ b/src/network/utils/mac16-address.cc @@ -255,13 +255,13 @@ std::istream& operator>> (std::istream& is, Mac16Address & address) if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); - address.m_address[i] = strtoul (tmp.c_str(), 0, 16); + address.m_address[i] = strtoul (tmp.c_str(), nullptr, 16); break; } else { tmp = v.substr (col, next-col); - address.m_address[i] = strtoul (tmp.c_str(), 0, 16); + address.m_address[i] = strtoul (tmp.c_str(), nullptr, 16); col = next + 1; } } diff --git a/src/network/utils/mac48-address.cc b/src/network/utils/mac48-address.cc index f2fecb38a..518afc4c7 100644 --- a/src/network/utils/mac48-address.cc +++ b/src/network/utils/mac48-address.cc @@ -293,13 +293,13 @@ std::istream& operator>> (std::istream& is, Mac48Address & address) if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); - address.m_address[i] = strtoul (tmp.c_str(), 0, 16); + address.m_address[i] = strtoul (tmp.c_str(), nullptr, 16); break; } else { tmp = v.substr (col, next-col); - address.m_address[i] = strtoul (tmp.c_str(), 0, 16); + address.m_address[i] = strtoul (tmp.c_str(), nullptr, 16); col = next + 1; } } diff --git a/src/network/utils/mac64-address.cc b/src/network/utils/mac64-address.cc index b997ad8c6..79a3a815b 100644 --- a/src/network/utils/mac64-address.cc +++ b/src/network/utils/mac64-address.cc @@ -205,13 +205,13 @@ std::istream& operator>> (std::istream& is, Mac64Address & address) if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); - address.m_address[i] = strtoul (tmp.c_str(), 0, 16); + address.m_address[i] = strtoul (tmp.c_str(), nullptr, 16); break; } else { tmp = v.substr (col, next-col); - address.m_address[i] = strtoul (tmp.c_str(), 0, 16); + address.m_address[i] = strtoul (tmp.c_str(), nullptr, 16); col = next + 1; } } diff --git a/src/network/utils/net-device-queue-interface.cc b/src/network/utils/net-device-queue-interface.cc index cc40cb57f..40bd9eafd 100644 --- a/src/network/utils/net-device-queue-interface.cc +++ b/src/network/utils/net-device-queue-interface.cc @@ -52,9 +52,9 @@ NetDeviceQueue::~NetDeviceQueue () { NS_LOG_FUNCTION (this); - m_queueLimits = 0; + m_queueLimits = nullptr; m_wakeCallback.Nullify (); - m_device = 0; + m_device = nullptr; } bool diff --git a/src/network/utils/output-stream-wrapper.cc b/src/network/utils/output-stream-wrapper.cc index b608f69c8..712ed8003 100644 --- a/src/network/utils/output-stream-wrapper.cc +++ b/src/network/utils/output-stream-wrapper.cc @@ -51,7 +51,7 @@ OutputStreamWrapper::~OutputStreamWrapper () NS_LOG_FUNCTION (this); FatalImpl::UnregisterStream (m_ostream); if (m_destroyable) delete m_ostream; - m_ostream = 0; + m_ostream = nullptr; } std::ostream * diff --git a/src/network/utils/packet-probe.cc b/src/network/utils/packet-probe.cc index cb6122bce..e1891840a 100644 --- a/src/network/utils/packet-probe.cc +++ b/src/network/utils/packet-probe.cc @@ -56,7 +56,7 @@ PacketProbe::GetTypeId () PacketProbe::PacketProbe () { NS_LOG_FUNCTION (this); - m_packet = 0; + m_packet = nullptr; } PacketProbe::~PacketProbe () diff --git a/src/network/utils/packet-socket-client.cc b/src/network/utils/packet-socket-client.cc index 8cb02c1da..5d8166c4a 100644 --- a/src/network/utils/packet-socket-client.cc +++ b/src/network/utils/packet-socket-client.cc @@ -77,7 +77,7 @@ PacketSocketClient::PacketSocketClient () { NS_LOG_FUNCTION (this); m_sent = 0; - m_socket = 0; + m_socket = nullptr; m_sendEvent = EventId (); m_peerAddressSet = false; } diff --git a/src/network/utils/packet-socket-server.cc b/src/network/utils/packet-socket-server.cc index efe51e322..8a8ac6cd5 100644 --- a/src/network/utils/packet-socket-server.cc +++ b/src/network/utils/packet-socket-server.cc @@ -58,7 +58,7 @@ PacketSocketServer::PacketSocketServer () NS_LOG_FUNCTION (this); m_pktRx = 0; m_bytesRx = 0; - m_socket = 0; + m_socket = nullptr; m_localAddressSet = false; } diff --git a/src/network/utils/packet-socket.cc b/src/network/utils/packet-socket.cc index edd01804c..333981bf4 100644 --- a/src/network/utils/packet-socket.cc +++ b/src/network/utils/packet-socket.cc @@ -157,7 +157,7 @@ PacketSocket::DoBind (const PacketSocketAddress &address) } else { - dev = 0; + dev = nullptr; } m_node->RegisterProtocolHandler (MakeCallback (&PacketSocket::ForwardUp, this), address.GetProtocol (), dev); @@ -454,7 +454,7 @@ PacketSocket::RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress) if (m_deliveryQueue.empty () ) { - return 0; + return nullptr; } Ptr p = m_deliveryQueue.front ().first; fromAddress = m_deliveryQueue.front ().second; @@ -466,7 +466,7 @@ PacketSocket::RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress) } else { - p = 0; + p = nullptr; } return p; } diff --git a/src/network/utils/packetbb.cc b/src/network/utils/packetbb.cc index 7b4366aad..1de83336f 100644 --- a/src/network/utils/packetbb.cc +++ b/src/network/utils/packetbb.cc @@ -182,7 +182,7 @@ PbbTlvBlock::Clear () NS_LOG_FUNCTION (this); for (Iterator iter = Begin (); iter != End (); iter++) { - *iter = 0; + *iter = nullptr; } m_tlvList.clear (); } @@ -422,7 +422,7 @@ PbbAddressTlvBlock::Clear () NS_LOG_FUNCTION (this); for (Iterator iter = Begin (); iter != End (); iter++) { - *iter = 0; + *iter = nullptr; } m_tlvList.clear (); } @@ -826,7 +826,7 @@ PbbPacket::MessageClear () NS_LOG_FUNCTION (this); for (MessageIterator iter = MessageBegin (); iter != MessageEnd (); iter++) { - *iter = 0; + *iter = nullptr; } m_messageList.clear (); } @@ -1394,7 +1394,7 @@ PbbMessage::AddressBlockClear () iter != AddressBlockEnd (); iter++) { - *iter = 0; + *iter = nullptr; } return m_addressBlockList.clear (); } @@ -1521,7 +1521,7 @@ PbbMessage::DeserializeMessage (Buffer::Iterator &start) newmsg = Create (); break; default: - return 0; + return nullptr; break; } newmsg->Deserialize (start); diff --git a/src/network/utils/pcap-file-wrapper.cc b/src/network/utils/pcap-file-wrapper.cc index 0170cc71a..47600a3e0 100644 --- a/src/network/utils/pcap-file-wrapper.cc +++ b/src/network/utils/pcap-file-wrapper.cc @@ -190,7 +190,7 @@ PcapFileWrapper::Read (Time &t) if (m_file.Fail()) { - return 0; + return nullptr; } if (m_file.IsNanoSecMode()) diff --git a/src/network/utils/pcap-file.cc b/src/network/utils/pcap-file.cc index 57e064de9..9fbaeeb1e 100644 --- a/src/network/utils/pcap-file.cc +++ b/src/network/utils/pcap-file.cc @@ -218,7 +218,7 @@ PcapFile::WriteFileHeader () // the pointer headerOut selects either the swapped or non-swapped version of // the pcap file header. // - PcapFileHeader *headerOut = 0; + PcapFileHeader *headerOut = nullptr; if (m_swapMode == false) { diff --git a/src/network/utils/queue-item.cc b/src/network/utils/queue-item.cc index a15aeb9e2..d0d2e18f5 100644 --- a/src/network/utils/queue-item.cc +++ b/src/network/utils/queue-item.cc @@ -35,7 +35,7 @@ QueueItem::QueueItem (Ptr p) QueueItem::~QueueItem () { NS_LOG_FUNCTION (this); - m_packet = 0; + m_packet = nullptr; } Ptr diff --git a/src/network/utils/queue.h b/src/network/utils/queue.h index 455879258..5cc8c8ec0 100644 --- a/src/network/utils/queue.h +++ b/src/network/utils/queue.h @@ -542,7 +542,7 @@ Queue::DoDequeue (ConstIterator pos) if (m_nPackets.Get () == 0) { NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } Ptr item = MakeGetItem::GetItem (m_packets, pos); @@ -571,7 +571,7 @@ Queue::DoRemove (ConstIterator pos) if (m_nPackets.Get () == 0) { NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } Ptr item = MakeGetItem::GetItem (m_packets, pos); @@ -623,7 +623,7 @@ Queue::DoPeek (ConstIterator pos) const if (m_nPackets.Get () == 0) { NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } return MakeGetItem::GetItem (m_packets, pos); diff --git a/src/network/utils/simple-net-device.cc b/src/network/utils/simple-net-device.cc index 5009aefad..847e77992 100644 --- a/src/network/utils/simple-net-device.cc +++ b/src/network/utils/simple-net-device.cc @@ -220,8 +220,8 @@ SimpleNetDevice::GetTypeId () } SimpleNetDevice::SimpleNetDevice () - : m_channel (0), - m_node (0), + : m_channel (nullptr), + m_node (nullptr), m_mtu (0xffff), m_ifIndex (0), m_linkUp (false) @@ -534,9 +534,9 @@ void SimpleNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_channel = 0; - m_node = 0; - m_receiveErrorModel = 0; + m_channel = nullptr; + m_node = nullptr; + m_receiveErrorModel = nullptr; m_queue->Dispose (); if (FinishTransmissionEvent.IsRunning ()) { diff --git a/src/nix-vector-routing/examples/nms-p2p-nix.cc b/src/nix-vector-routing/examples/nms-p2p-nix.cc index 44678c1e3..af2ec7316 100644 --- a/src/nix-vector-routing/examples/nms-p2p-nix.cc +++ b/src/nix-vector-routing/examples/nms-p2p-nix.cc @@ -85,7 +85,7 @@ public: for (size_t i = 0; i < m_xMax; i++) delete[] p[i]; delete[] p; - p = 0; + p = nullptr; } /** @@ -127,10 +127,10 @@ public: for (size_t i = 0; i < m_xMax; i++) { delete p[i]; - p[i] = 0; + p[i] = nullptr; } delete[] p; - p = 0; + p = nullptr; } /** diff --git a/src/nix-vector-routing/model/nix-vector-routing.cc b/src/nix-vector-routing/model/nix-vector-routing.cc index ad7cb343f..59b898cd3 100644 --- a/src/nix-vector-routing/model/nix-vector-routing.cc +++ b/src/nix-vector-routing/model/nix-vector-routing.cc @@ -130,8 +130,8 @@ NixVectorRouting::DoDispose () { NS_LOG_FUNCTION_NOARGS (); - m_node = 0; - m_ip = 0; + m_node = nullptr; + m_ip = nullptr; T::DoDispose (); } @@ -203,7 +203,7 @@ NixVectorRouting::GetNixVector (Ptr source, IpAddress dest, Ptr::GetNixVector (Ptr source, IpAddress dest, Ptr::GetNixVector (Ptr source, IpAddress dest, Ptr::GetNixVectorInCache (const IpAddress &address, bool &foundI // not in cache foundInCache = false; - return 0; + return nullptr; } template @@ -278,7 +278,7 @@ NixVectorRouting::GetIpRouteInCache (IpAddress address) } // not in cache - return 0; + return nullptr; } template @@ -519,7 +519,7 @@ NixVectorRouting::GetNodeByIp (IpAddress dest) const if(iter == g_ipAddressToNodeMap.end ()) { NS_LOG_ERROR ("Couldn't find dest node given the IP" << dest); - destNode = 0; + destNode = nullptr; } else { @@ -546,7 +546,7 @@ NixVectorRouting::GetInterfaceByNetDevice (Ptr netDevice) const if(iter == g_netdeviceToIpInterfaceMap.end ()) { NS_LOG_ERROR ("Couldn't find IpInterface node given the NetDevice" << netDevice); - ipInterface = 0; + ipInterface = nullptr; } else { @@ -628,7 +628,7 @@ NixVectorRouting::NetDeviceIsBridged (Ptr nd) const } } NS_LOG_LOGIC ("Net device " << nd << " is not bridged"); - return 0; + return nullptr; } template @@ -913,7 +913,7 @@ NixVectorRouting::RouteInput (Ptr p, const IpHeader &header, Pt { NS_LOG_LOGIC ("NixVector epoch mismatch (" << nixVector->GetEpoch () << " Vs " << g_epoch << ") - rebuilding it"); - nixVector = GetNixVector (m_node, destAddress, 0); + nixVector = GetNixVector (m_node, destAddress, nullptr); p->SetNixVector (nixVector); } @@ -1091,7 +1091,7 @@ NixVectorRouting::BFS (uint32_t numberOfNodes, Ptr source, std::queue< Ptr > greyNodeList; // discovered nodes with unexplored children // reset the parent vector - parentVector.assign (numberOfNodes, 0); // initialize to 0 + parentVector.assign (numberOfNodes, nullptr); // initialize to 0 // Add the source node to the queue, set its parent to itself greyNodeList.push (source); diff --git a/src/olsr/model/olsr-routing-protocol.cc b/src/olsr/model/olsr-routing-protocol.cc index eb9cb5b92..9281d75a3 100644 --- a/src/olsr/model/olsr-routing-protocol.cc +++ b/src/olsr/model/olsr-routing-protocol.cc @@ -198,8 +198,8 @@ RoutingProtocol::GetTypeId () RoutingProtocol::RoutingProtocol () - : m_routingTableAssociation (0), - m_ipv4 (0), + : m_routingTableAssociation (nullptr), + m_ipv4 (nullptr), m_helloTimer (Timer::CANCEL_ON_DESTROY), m_tcTimer (Timer::CANCEL_ON_DESTROY), m_midTimer (Timer::CANCEL_ON_DESTROY), @@ -246,14 +246,14 @@ RoutingProtocol::GetIpv4 () const void RoutingProtocol::DoDispose () { - m_ipv4 = 0; - m_hnaRoutingTable = 0; - m_routingTableAssociation = 0; + m_ipv4 = nullptr; + m_hnaRoutingTable = nullptr; + m_routingTableAssociation = nullptr; if (m_recvSocket) { m_recvSocket->Close (); - m_recvSocket = 0; + m_recvSocket = nullptr; } for (std::map< Ptr, Ipv4InterfaceAddress >::iterator iter = m_sendSockets.begin (); @@ -528,7 +528,7 @@ RoutingProtocol::RecvOlsr (Ptr socket) // peerMainAddress = inetSourceAddr.GetIpv4 () ; // } - if (duplicated == NULL) + if (duplicated == nullptr) { switch (messageHeader.GetMessageType ()) { @@ -617,7 +617,7 @@ RoutingProtocol::Degree (NeighborTuple const &tuple) { const NeighborTuple *nb_tuple = m_state.FindNeighborTuple (nb2hop_tuple.neighborMainAddr); - if (nb_tuple == NULL) + if (nb_tuple == nullptr) { degree++; } @@ -888,7 +888,7 @@ RoutingProtocol::MprComputation () // reachability, select the node as MPR whose D(y) is // greater. Remove the nodes from N2 which are now covered // by a node in the MPR set. - NeighborTuple const *max = NULL; + NeighborTuple const *max = nullptr; int max_r = 0; for (std::set::iterator it = rs.begin (); it != rs.end (); it++) { @@ -901,7 +901,7 @@ RoutingProtocol::MprComputation () it2 != reachability[r].end (); it2++) { const NeighborTuple *nb_tuple = *it2; - if (max == NULL || nb_tuple->willingness > max->willingness) + if (max == nullptr || nb_tuple->willingness > max->willingness) { max = nb_tuple; max_r = r; @@ -925,7 +925,7 @@ RoutingProtocol::MprComputation () } } - if (max != NULL) + if (max != nullptr) { mprSet.insert (max->neighborMainAddr); CoverTwoHopNeighbors (max->neighborMainAddr, N2); @@ -962,7 +962,7 @@ RoutingProtocol::GetMainAddress (Ipv4Address iface_addr) const const IfaceAssocTuple *tuple = m_state.FindIfaceAssocTuple (iface_addr); - if (tuple != NULL) + if (tuple != nullptr) { return tuple->mainAddr; } @@ -992,7 +992,7 @@ RoutingProtocol::RoutingTableComputation () if (nb_tuple.status == NeighborTuple::STATUS_SYM) { bool nb_main_addr = false; - const LinkTuple *lt = NULL; + const LinkTuple *lt = nullptr; const LinkSet &linkSet = m_state.GetLinks (); for (LinkSet::const_iterator it2 = linkSet.begin (); it2 != linkSet.end (); it2++) @@ -1033,7 +1033,7 @@ RoutingProtocol::RoutingTableComputation () // R_dist = 1; // R_iface_addr = L_local_iface_addr of the // associated link tuple. - if (!nb_main_addr && lt != NULL) + if (!nb_main_addr && lt != nullptr) { NS_LOG_LOGIC ("no R_dest_addr is equal to the main address of the neighbor " "=> adding additional routing entry"); @@ -1353,7 +1353,7 @@ RoutingProtocol::ProcessTc (const olsr::MessageHeader &msg, // 1. If the sender interface of this message is not in the symmetric // 1-hop neighborhood of this node, the message MUST be discarded. const LinkTuple *link_tuple = m_state.FindSymLinkTuple (senderIface, now); - if (link_tuple == NULL) + if (link_tuple == nullptr) { return; } @@ -1365,7 +1365,7 @@ RoutingProtocol::ProcessTc (const olsr::MessageHeader &msg, // performed. const TopologyTuple *topologyTuple = m_state.FindNewerTopologyTuple (msg.GetOriginatorAddress (), tc.ansn); - if (topologyTuple != NULL) + if (topologyTuple != nullptr) { return; } @@ -1390,7 +1390,7 @@ RoutingProtocol::ProcessTc (const olsr::MessageHeader &msg, TopologyTuple *topologyTuple = m_state.FindTopologyTuple (addr, msg.GetOriginatorAddress ()); - if (topologyTuple != NULL) + if (topologyTuple != nullptr) { topologyTuple->expirationTime = now + msg.GetVTime (); } @@ -1444,7 +1444,7 @@ RoutingProtocol::ProcessMid (const olsr::MessageHeader &msg, // 1. If the sender interface of this message is not in the symmetric // 1-hop neighborhood of this node, the message MUST be discarded. const LinkTuple *linkTuple = m_state.FindSymLinkTuple (senderIface, now); - if (linkTuple == NULL) + if (linkTuple == nullptr) { NS_LOG_LOGIC ("Node " << m_mainAddress << ": the sender interface of this message is not in the " @@ -1514,7 +1514,7 @@ RoutingProtocol::ProcessHna (const olsr::MessageHeader &msg, // 1. If the sender interface of this message is not in the symmetric // 1-hop neighborhood of this node, the message MUST be discarded. const LinkTuple *link_tuple = m_state.FindSymLinkTuple (senderIface, now); - if (link_tuple == NULL) + if (link_tuple == nullptr) { return; } @@ -1533,7 +1533,7 @@ RoutingProtocol::ProcessHna (const olsr::MessageHeader &msg, // A_netmask == netmask // then the holding time for that tuple MUST be set to: // A_time = current time + validity time - if (tuple != NULL) + if (tuple != nullptr) { tuple->expirationTime = now + msg.GetVTime (); } @@ -1573,14 +1573,14 @@ RoutingProtocol::ForwardDefault (olsr::MessageHeader olsrMessage, // If the sender interface address is not in the symmetric // 1-hop neighborhood the message must not be forwarded const LinkTuple *linkTuple = m_state.FindSymLinkTuple (senderAddress, now); - if (linkTuple == NULL) + if (linkTuple == nullptr) { return; } // If the message has already been considered for forwarding, // it must not be retransmitted again - if (duplicated != NULL && duplicated->retransmitted) + if (duplicated != nullptr && duplicated->retransmitted) { NS_LOG_LOGIC (Simulator::Now () << "Node " << m_mainAddress << " does not forward a message received" " from " << olsrMessage.GetOriginatorAddress () << " because it is duplicated"); @@ -1595,7 +1595,7 @@ RoutingProtocol::ForwardDefault (olsr::MessageHeader olsrMessage, { const MprSelectorTuple *mprselTuple = m_state.FindMprSelectorTuple (GetMainAddress (senderAddress)); - if (mprselTuple != NULL) + if (mprselTuple != nullptr) { olsrMessage.SetTimeToLive (olsrMessage.GetTimeToLive () - 1); olsrMessage.SetHopCount (olsrMessage.GetHopCount () + 1); @@ -1607,7 +1607,7 @@ RoutingProtocol::ForwardDefault (olsr::MessageHeader olsrMessage, } // Update duplicate tuple... - if (duplicated != NULL) + if (duplicated != nullptr) { duplicated->expirationTime = now + OLSR_DUP_HOLD_TIME; duplicated->retransmitted = retransmitted; @@ -2009,7 +2009,7 @@ RoutingProtocol::LinkSensing (const olsr::MessageHeader &msg, NS_ASSERT (msg.GetVTime () > Seconds (0)); LinkTuple *link_tuple = m_state.FindLinkTuple (senderIface); - if (link_tuple == NULL) + if (link_tuple == nullptr) { LinkTuple newLinkTuple; // We have to create a new tuple @@ -2148,7 +2148,7 @@ RoutingProtocol::PopulateNeighborSet (const olsr::MessageHeader &msg, const olsr::MessageHeader::Hello &hello) { NeighborTuple *nb_tuple = m_state.FindNeighborTuple (msg.GetOriginatorAddress ()); - if (nb_tuple != NULL) + if (nb_tuple != nullptr) { nb_tuple->willingness = hello.willingness; } @@ -2221,7 +2221,7 @@ RoutingProtocol::PopulateTwoHopNeighborSet (const olsr::MessageHeader &msg, m_state.FindTwoHopNeighborTuple (msg.GetOriginatorAddress (), nb2hop_addr); NS_LOG_LOGIC ("Adding the 2-hop neighbor" << (nb2hop_tuple ? " (refreshing existing entry)" : "")); - if (nb2hop_tuple == NULL) + if (nb2hop_tuple == nullptr) { TwoHopNeighborTuple new_nb2hop_tuple; new_nb2hop_tuple.neighborMainAddr = msg.GetOriginatorAddress (); @@ -2291,7 +2291,7 @@ RoutingProtocol::PopulateMprSelectorSet (const olsr::MessageHeader &msg, // We must create a new entry into the mpr selector set MprSelectorTuple *existing_mprsel_tuple = m_state.FindMprSelectorTuple (msg.GetOriginatorAddress ()); - if (existing_mprsel_tuple == NULL) + if (existing_mprsel_tuple == nullptr) { MprSelectorTuple mprsel_tuple; @@ -2436,13 +2436,13 @@ RoutingProtocol::LinkTupleUpdated (const LinkTuple &tuple, uint8_t willingness) NeighborTuple *nb_tuple = m_state.FindNeighborTuple (GetMainAddress (tuple.neighborIfaceAddr)); - if (nb_tuple == NULL) + if (nb_tuple == nullptr) { LinkTupleAdded (tuple, willingness); nb_tuple = m_state.FindNeighborTuple (GetMainAddress (tuple.neighborIfaceAddr)); } - if (nb_tuple != NULL) + if (nb_tuple != nullptr) { int statusBefore = nb_tuple->status; @@ -2681,7 +2681,7 @@ RoutingProtocol::DupTupleTimerExpire (Ipv4Address address, uint16_t sequenceNumb { DuplicateTuple *tuple = m_state.FindDuplicateTuple (address, sequenceNumber); - if (tuple == NULL) + if (tuple == nullptr) { return; } @@ -2704,7 +2704,7 @@ RoutingProtocol::LinkTupleTimerExpire (Ipv4Address neighborIfaceAddr) // the tuple parameter may be a stale copy; get a newer version from m_state LinkTuple *tuple = m_state.FindLinkTuple (neighborIfaceAddr); - if (tuple == NULL) + if (tuple == nullptr) { return; } @@ -2740,7 +2740,7 @@ RoutingProtocol::Nb2hopTupleTimerExpire (Ipv4Address neighborMainAddr, Ipv4Addre { TwoHopNeighborTuple *tuple; tuple = m_state.FindTwoHopNeighborTuple (neighborMainAddr, twoHopNeighborAddr); - if (tuple == NULL) + if (tuple == nullptr) { return; } @@ -2760,7 +2760,7 @@ void RoutingProtocol::MprSelTupleTimerExpire (Ipv4Address mainAddr) { MprSelectorTuple *tuple = m_state.FindMprSelectorTuple (mainAddr); - if (tuple == NULL) + if (tuple == nullptr) { return; } @@ -2780,7 +2780,7 @@ void RoutingProtocol::TopologyTupleTimerExpire (Ipv4Address destAddr, Ipv4Address lastAddr) { TopologyTuple *tuple = m_state.FindTopologyTuple (destAddr, lastAddr); - if (tuple == NULL) + if (tuple == nullptr) { return; } @@ -2800,7 +2800,7 @@ void RoutingProtocol::IfaceAssocTupleTimerExpire (Ipv4Address ifaceAddr) { IfaceAssocTuple *tuple = m_state.FindIfaceAssocTuple (ifaceAddr); - if (tuple == NULL) + if (tuple == nullptr) { return; } @@ -2820,7 +2820,7 @@ void RoutingProtocol::AssociationTupleTimerExpire (Ipv4Address gatewayAddr, Ipv4Address networkAddr, Ipv4Mask netmask) { AssociationTuple *tuple = m_state.FindAssociationTuple (gatewayAddr, networkAddr, netmask); - if (tuple == NULL) + if (tuple == nullptr) { return; } diff --git a/src/olsr/model/olsr-state.cc b/src/olsr/model/olsr-state.cc index c6eb8c97b..a7aa29c41 100644 --- a/src/olsr/model/olsr-state.cc +++ b/src/olsr/model/olsr-state.cc @@ -45,7 +45,7 @@ OlsrState::FindMprSelectorTuple (Ipv4Address const &mainAddr) return &(*it); } } - return NULL; + return nullptr; } void @@ -119,7 +119,7 @@ OlsrState::FindNeighborTuple (Ipv4Address const &mainAddr) return &(*it); } } - return NULL; + return nullptr; } const NeighborTuple* @@ -133,7 +133,7 @@ OlsrState::FindSymNeighborTuple (Ipv4Address const &mainAddr) const return &(*it); } } - return NULL; + return nullptr; } NeighborTuple* @@ -147,7 +147,7 @@ OlsrState::FindNeighborTuple (Ipv4Address const &mainAddr, uint8_t willingness) return &(*it); } } - return NULL; + return nullptr; } void @@ -209,7 +209,7 @@ OlsrState::FindTwoHopNeighborTuple (Ipv4Address const &neighborMainAddr, return &(*it); } } - return NULL; + return nullptr; } void @@ -301,7 +301,7 @@ OlsrState::FindDuplicateTuple (Ipv4Address const &addr, uint16_t sequenceNumber) return &(*it); } } - return NULL; + return nullptr; } void @@ -337,7 +337,7 @@ OlsrState::FindLinkTuple (Ipv4Address const & ifaceAddr) return &(*it); } } - return NULL; + return nullptr; } LinkTuple* @@ -358,7 +358,7 @@ OlsrState::FindSymLinkTuple (Ipv4Address const &ifaceAddr, Time now) } } } - return NULL; + return nullptr; } void @@ -396,7 +396,7 @@ OlsrState::FindTopologyTuple (Ipv4Address const &destAddr, return &(*it); } } - return NULL; + return nullptr; } TopologyTuple* @@ -410,7 +410,7 @@ OlsrState::FindNewerTopologyTuple (Ipv4Address const & lastAddr, uint16_t ansn) return &(*it); } } - return NULL; + return nullptr; } void @@ -463,7 +463,7 @@ OlsrState::FindIfaceAssocTuple (Ipv4Address const &ifaceAddr) return &(*it); } } - return NULL; + return nullptr; } const IfaceAssocTuple* @@ -477,7 +477,7 @@ OlsrState::FindIfaceAssocTuple (Ipv4Address const &ifaceAddr) const return &(*it); } } - return NULL; + return nullptr; } void @@ -528,7 +528,7 @@ OlsrState::FindAssociationTuple (const Ipv4Address &gatewayAddr, const Ipv4Addre return &(*it); } } - return NULL; + return nullptr; } void diff --git a/src/olsr/test/hello-regression-test.cc b/src/olsr/test/hello-regression-test.cc index b6ac30490..6e37a41c2 100644 --- a/src/olsr/test/hello-regression-test.cc +++ b/src/olsr/test/hello-regression-test.cc @@ -60,8 +60,8 @@ HelloRegressionTest::DoRun () Simulator::Stop (m_time); Simulator::Run (); - m_rxSocketA = 0; - m_rxSocketB = 0; + m_rxSocketA = nullptr; + m_rxSocketB = nullptr; Simulator::Destroy (); } diff --git a/src/olsr/test/tc-regression-test.cc b/src/olsr/test/tc-regression-test.cc index f0f6f161f..a31e2a7b2 100644 --- a/src/olsr/test/tc-regression-test.cc +++ b/src/olsr/test/tc-regression-test.cc @@ -62,9 +62,9 @@ TcRegressionTest::DoRun () Simulator::Stop (m_time); Simulator::Run (); - m_rxSocketA = 0; - m_rxSocketB = 0; - m_rxSocketC = 0; + m_rxSocketA = nullptr; + m_rxSocketB = nullptr; + m_rxSocketC = nullptr; Simulator::Destroy (); } diff --git a/src/point-to-point/helper/point-to-point-helper.cc b/src/point-to-point/helper/point-to-point-helper.cc index 367b51734..4ed058e00 100644 --- a/src/point-to-point/helper/point-to-point-helper.cc +++ b/src/point-to-point/helper/point-to-point-helper.cc @@ -241,7 +241,7 @@ PointToPointHelper::Install (Ptr a, Ptr b) devB->AggregateObject (ndqiB); } - Ptr channel = 0; + Ptr channel = nullptr; // If MPI is enabled, we need to see if both nodes have the same system id // (rank), and the rank is the same as this instance. If both are true, diff --git a/src/point-to-point/model/point-to-point-channel.h b/src/point-to-point/model/point-to-point-channel.h index a2b752654..1019d0ec9 100644 --- a/src/point-to-point/model/point-to-point-channel.h +++ b/src/point-to-point/model/point-to-point-channel.h @@ -194,7 +194,7 @@ public: /** \brief Create the link, it will be in INITIALIZING state * */ - Link() : m_state (INITIALIZING), m_src (0), m_dst (0) {} + Link() : m_state (INITIALIZING), m_src (nullptr), m_dst (nullptr) {} WireState m_state; //!< State of the link Ptr m_src; //!< First NetDevice diff --git a/src/point-to-point/model/point-to-point-net-device.cc b/src/point-to-point/model/point-to-point-net-device.cc index 4f347b5fd..7d3a4af9e 100644 --- a/src/point-to-point/model/point-to-point-net-device.cc +++ b/src/point-to-point/model/point-to-point-net-device.cc @@ -175,9 +175,9 @@ PointToPointNetDevice::GetTypeId () PointToPointNetDevice::PointToPointNetDevice () : m_txMachineState (READY), - m_channel (0), + m_channel (nullptr), m_linkUp (false), - m_currentPkt (0) + m_currentPkt (nullptr) { NS_LOG_FUNCTION (this); } @@ -210,11 +210,11 @@ void PointToPointNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; - m_channel = 0; - m_receiveErrorModel = 0; - m_currentPkt = 0; - m_queue = 0; + m_node = nullptr; + m_channel = nullptr; + m_receiveErrorModel = nullptr; + m_currentPkt = nullptr; + m_queue = nullptr; NetDevice::DoDispose (); } @@ -279,7 +279,7 @@ PointToPointNetDevice::TransmitComplete () NS_ASSERT_MSG (m_currentPkt, "PointToPointNetDevice::TransmitComplete(): m_currentPkt zero"); m_phyTxEndTrace (m_currentPkt); - m_currentPkt = 0; + m_currentPkt = nullptr; Ptr p = m_queue->Dequeue (); if (!p) diff --git a/src/propagation/model/propagation-cache.h b/src/propagation/model/propagation-cache.h index fdd4a3879..668f3799d 100644 --- a/src/propagation/model/propagation-cache.h +++ b/src/propagation/model/propagation-cache.h @@ -51,7 +51,7 @@ public: typename PathCache::iterator it = m_pathCache.find (key); if (it == m_pathCache.end ()) { - return 0; + return nullptr; } return it->second; }; diff --git a/src/propagation/model/propagation-loss-model.cc b/src/propagation/model/propagation-loss-model.cc index 043b37307..9abe0da82 100644 --- a/src/propagation/model/propagation-loss-model.cc +++ b/src/propagation/model/propagation-loss-model.cc @@ -49,7 +49,7 @@ PropagationLossModel::GetTypeId () } PropagationLossModel::PropagationLossModel () - : m_next (0) + : m_next (nullptr) { } diff --git a/src/sixlowpan/model/sixlowpan-net-device.cc b/src/sixlowpan/model/sixlowpan-net-device.cc index aa0079e7d..4bcd481e8 100644 --- a/src/sixlowpan/model/sixlowpan-net-device.cc +++ b/src/sixlowpan/model/sixlowpan-net-device.cc @@ -125,12 +125,12 @@ TypeId SixLowPanNetDevice::GetTypeId () } SixLowPanNetDevice::SixLowPanNetDevice () - : m_node (0), - m_netDevice (0), + : m_node (nullptr), + m_netDevice (nullptr), m_ifIndex (0) { NS_LOG_FUNCTION (this); - m_netDevice = 0; + m_netDevice = nullptr; m_rng = CreateObject (); m_bc0Serial = 0; } @@ -170,8 +170,8 @@ void SixLowPanNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_netDevice = 0; - m_node = 0; + m_netDevice = nullptr; + m_node = nullptr; m_timeoutEventList.clear (); if (m_timeoutEvent.IsRunning ()) @@ -181,7 +181,7 @@ void SixLowPanNetDevice::DoDispose () for (MapFragmentsI_t iter = m_fragments.begin (); iter != m_fragments.end (); iter++) { - iter->second = 0; + iter->second = nullptr; } m_fragments.clear (); @@ -2401,7 +2401,7 @@ bool SixLowPanNetDevice::ProcessFragment (Ptr& packet, Address const &sr } m_timeoutEventList.erase (m_fragments[oldestKey]->GetTimeoutIter ()); - m_fragments[oldestKey] = 0; + m_fragments[oldestKey] = nullptr; m_fragments.erase (oldestKey); } @@ -2437,7 +2437,7 @@ bool SixLowPanNetDevice::ProcessFragment (Ptr& packet, Address const &sr NS_LOG_LOGIC ("Rebuilt packet. Size " << packet->GetSize () << " - " << *packet); m_timeoutEventList.erase (fragments->GetTimeoutIter ()); - fragments = 0; + fragments = nullptr; m_fragments.erase (key); return true; } @@ -2592,7 +2592,7 @@ void SixLowPanNetDevice::HandleFragmentsTimeout (FragmentKey_t key, uint32_t iif m_dropTrace (DROP_FRAGMENT_TIMEOUT, *fragIter, this, iif); } // clear the buffers - it->second = 0; + it->second = nullptr; m_fragments.erase (key); } diff --git a/src/sixlowpan/test/mock-net-device.cc b/src/sixlowpan/test/mock-net-device.cc index 86cc60ad7..e0d45106e 100644 --- a/src/sixlowpan/test/mock-net-device.cc +++ b/src/sixlowpan/test/mock-net-device.cc @@ -53,7 +53,7 @@ MockNetDevice::GetTypeId () } MockNetDevice::MockNetDevice () - : m_node (0), + : m_node (nullptr), m_mtu (0xffff), m_ifIndex (0), m_linkUp (true) @@ -96,7 +96,7 @@ Ptr MockNetDevice::GetChannel () const { NS_LOG_FUNCTION (this); - return 0; + return nullptr; } void @@ -316,7 +316,7 @@ void MockNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; + m_node = nullptr; m_rxCallback.Nullify (); m_promiscCallback.Nullify (); m_sendCallback.Nullify (); diff --git a/src/sixlowpan/test/sixlowpan-fragmentation-test.cc b/src/sixlowpan/test/sixlowpan-fragmentation-test.cc index e798ad58e..9d5a794c4 100644 --- a/src/sixlowpan/test/sixlowpan-fragmentation-test.cc +++ b/src/sixlowpan/test/sixlowpan-fragmentation-test.cc @@ -122,8 +122,8 @@ public: SixlowpanFragmentationTest::SixlowpanFragmentationTest () : TestCase ("Verify the 6LoWPAN protocol fragmentation and reassembly") { - m_socketServer = 0; - m_data = 0; + m_socketServer = nullptr; + m_data = nullptr; m_dataSize = 0; m_size = 0; m_icmpType = 0; @@ -136,7 +136,7 @@ SixlowpanFragmentationTest::~SixlowpanFragmentationTest () { delete[] m_data; } - m_data = 0; + m_data = nullptr; m_dataSize = 0; } diff --git a/src/spectrum/helper/tv-spectrum-transmitter-helper.cc b/src/spectrum/helper/tv-spectrum-transmitter-helper.cc index 04b09ffa2..c8a048a9e 100644 --- a/src/spectrum/helper/tv-spectrum-transmitter-helper.cc +++ b/src/spectrum/helper/tv-spectrum-transmitter-helper.cc @@ -96,7 +96,7 @@ const double japanEndFrequencies[63] = {0, 96e6, 102e6, 108e6, 176e6, 182e6, 764e6, 770e6}; TvSpectrumTransmitterHelper::TvSpectrumTransmitterHelper () - : m_channel (0), + : m_channel (nullptr), m_uniRand (CreateObject ()) { NS_LOG_FUNCTION (this); @@ -105,8 +105,8 @@ TvSpectrumTransmitterHelper::TvSpectrumTransmitterHelper () TvSpectrumTransmitterHelper::~TvSpectrumTransmitterHelper () { - m_channel = 0; - m_uniRand = 0; + m_channel = nullptr; + m_uniRand = nullptr; NS_LOG_FUNCTION (this); } diff --git a/src/spectrum/model/aloha-noack-net-device.cc b/src/spectrum/model/aloha-noack-net-device.cc index 8c98161ea..357811f26 100644 --- a/src/spectrum/model/aloha-noack-net-device.cc +++ b/src/spectrum/model/aloha-noack-net-device.cc @@ -125,18 +125,18 @@ AlohaNoackNetDevice::AlohaNoackNetDevice () AlohaNoackNetDevice::~AlohaNoackNetDevice () { NS_LOG_FUNCTION (this); - m_queue = 0; + m_queue = nullptr; } void AlohaNoackNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_queue = 0; - m_node = 0; - m_channel = 0; - m_currentPkt = 0; - m_phy = 0; + m_queue = nullptr; + m_node = nullptr; + m_channel = nullptr; + m_currentPkt = nullptr; + m_phy = nullptr; m_phyMacTxStartCallback = MakeNullCallback< bool, Ptr > (); NetDevice::DoDispose (); } diff --git a/src/spectrum/model/half-duplex-ideal-phy.cc b/src/spectrum/model/half-duplex-ideal-phy.cc index 2340c6dd7..19fb7ed7f 100644 --- a/src/spectrum/model/half-duplex-ideal-phy.cc +++ b/src/spectrum/model/half-duplex-ideal-phy.cc @@ -39,10 +39,10 @@ NS_LOG_COMPONENT_DEFINE ("HalfDuplexIdealPhy"); NS_OBJECT_ENSURE_REGISTERED (HalfDuplexIdealPhy); HalfDuplexIdealPhy::HalfDuplexIdealPhy () - : m_mobility (0), - m_netDevice (0), - m_channel (0), - m_txPsd (0), + : m_mobility (nullptr), + m_netDevice (nullptr), + m_channel (nullptr), + m_txPsd (nullptr), m_state (IDLE) { m_interference.SetErrorModel (CreateObject ()); @@ -57,13 +57,13 @@ void HalfDuplexIdealPhy::DoDispose () { NS_LOG_FUNCTION (this); - m_mobility = 0; - m_netDevice = 0; - m_channel = 0; - m_txPsd = 0; - m_rxPsd = 0; - m_txPacket = 0; - m_rxPacket = 0; + m_mobility = nullptr; + m_netDevice = nullptr; + m_channel = nullptr; + m_txPsd = nullptr; + m_rxPsd = nullptr; + m_txPacket = nullptr; + m_rxPacket = nullptr; m_phyMacTxEndCallback = MakeNullCallback< void, Ptr > (); m_phyMacRxStartCallback = MakeNullCallback< void > (); m_phyMacRxEndErrorCallback = MakeNullCallback< void > (); @@ -189,7 +189,7 @@ HalfDuplexIdealPhy::GetRxSpectrumModel () const } else { - return 0; + return nullptr; } } @@ -332,7 +332,7 @@ HalfDuplexIdealPhy::EndTx () m_phyMacTxEndCallback (m_txPacket); } - m_txPacket = 0; + m_txPacket = nullptr; ChangeState (IDLE); } @@ -412,7 +412,7 @@ HalfDuplexIdealPhy::AbortRx () m_interference.AbortRx (); m_phyRxAbortTrace (m_rxPacket); m_endRxEventId.Cancel (); - m_rxPacket = 0; + m_rxPacket = nullptr; ChangeState (IDLE); } @@ -455,8 +455,8 @@ HalfDuplexIdealPhy::EndRx () } ChangeState (IDLE); - m_rxPacket = 0; - m_rxPsd = 0; + m_rxPacket = nullptr; + m_rxPsd = nullptr; } diff --git a/src/spectrum/model/multi-model-spectrum-channel.cc b/src/spectrum/model/multi-model-spectrum-channel.cc index 1eefa158b..dee60b318 100644 --- a/src/spectrum/model/multi-model-spectrum-channel.cc +++ b/src/spectrum/model/multi-model-spectrum-channel.cc @@ -416,7 +416,7 @@ MultiModelSpectrumChannel::GetDevice (std::size_t i) const } } NS_FATAL_ERROR ("m_numDevices > actual number of devices"); - return 0; + return nullptr; } } // namespace ns3 diff --git a/src/spectrum/model/non-communicating-net-device.cc b/src/spectrum/model/non-communicating-net-device.cc index d391c85e9..36ece97a8 100644 --- a/src/spectrum/model/non-communicating-net-device.cc +++ b/src/spectrum/model/non-communicating-net-device.cc @@ -64,9 +64,9 @@ void NonCommunicatingNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; - m_channel = 0; - m_phy = 0; + m_node = nullptr; + m_channel = nullptr; + m_phy = nullptr; NetDevice::DoDispose (); } diff --git a/src/spectrum/model/phased-array-spectrum-propagation-loss-model.cc b/src/spectrum/model/phased-array-spectrum-propagation-loss-model.cc index c641c4bb2..a8c7a7566 100644 --- a/src/spectrum/model/phased-array-spectrum-propagation-loss-model.cc +++ b/src/spectrum/model/phased-array-spectrum-propagation-loss-model.cc @@ -30,7 +30,7 @@ NS_LOG_COMPONENT_DEFINE ("PhasedArraySpectrumPropagationLossModel"); NS_OBJECT_ENSURE_REGISTERED (PhasedArraySpectrumPropagationLossModel); PhasedArraySpectrumPropagationLossModel::PhasedArraySpectrumPropagationLossModel () - : m_next (0) + : m_next (nullptr) { } @@ -41,7 +41,7 @@ PhasedArraySpectrumPropagationLossModel::~PhasedArraySpectrumPropagationLossMode void PhasedArraySpectrumPropagationLossModel::DoDispose () { - m_next = 0; + m_next = nullptr; } TypeId diff --git a/src/spectrum/model/single-model-spectrum-channel.cc b/src/spectrum/model/single-model-spectrum-channel.cc index a63b6121b..5cae8ae71 100644 --- a/src/spectrum/model/single-model-spectrum-channel.cc +++ b/src/spectrum/model/single-model-spectrum-channel.cc @@ -55,7 +55,7 @@ SingleModelSpectrumChannel::DoDispose () { NS_LOG_FUNCTION (this); m_phyList.clear (); - m_spectrumModel = 0; + m_spectrumModel = nullptr; SpectrumChannel::DoDispose (); } diff --git a/src/spectrum/model/spectrum-analyzer.cc b/src/spectrum/model/spectrum-analyzer.cc index 1d186aa57..f66588424 100644 --- a/src/spectrum/model/spectrum-analyzer.cc +++ b/src/spectrum/model/spectrum-analyzer.cc @@ -35,11 +35,11 @@ NS_LOG_COMPONENT_DEFINE ("SpectrumAnalyzer"); NS_OBJECT_ENSURE_REGISTERED (SpectrumAnalyzer); SpectrumAnalyzer::SpectrumAnalyzer () - : m_mobility (0), - m_netDevice (0), - m_channel (0), - m_spectrumModel (0), - m_sumPowerSpectralDensity (0), + : m_mobility (nullptr), + m_netDevice (nullptr), + m_channel (nullptr), + m_spectrumModel (nullptr), + m_sumPowerSpectralDensity (nullptr), m_resolution (MilliSeconds (50)), m_active (false) { @@ -57,12 +57,12 @@ void SpectrumAnalyzer::DoDispose () { NS_LOG_FUNCTION (this); - m_mobility = 0; - m_netDevice = 0; - m_channel = 0; - m_spectrumModel = 0; - m_sumPowerSpectralDensity = 0; - m_energySpectralDensity = 0; + m_mobility = nullptr; + m_netDevice = nullptr; + m_channel = nullptr; + m_spectrumModel = nullptr; + m_sumPowerSpectralDensity = nullptr; + m_energySpectralDensity = nullptr; SpectrumPhy::DoDispose (); } diff --git a/src/spectrum/model/spectrum-channel.cc b/src/spectrum/model/spectrum-channel.cc index aefe47bc8..c8d5b5711 100644 --- a/src/spectrum/model/spectrum-channel.cc +++ b/src/spectrum/model/spectrum-channel.cc @@ -44,9 +44,9 @@ void SpectrumChannel::DoDispose () { NS_LOG_FUNCTION (this); - m_propagationLoss = 0; - m_propagationDelay = 0; - m_spectrumPropagationLoss = 0; + m_propagationLoss = nullptr; + m_propagationDelay = nullptr; + m_spectrumPropagationLoss = nullptr; } TypeId @@ -72,7 +72,7 @@ SpectrumChannel::GetTypeId () .AddAttribute ("PropagationLossModel", "A pointer to the propagation loss model attached to this channel.", - PointerValue (0), + PointerValue (nullptr), MakePointerAccessor (&SpectrumChannel::m_propagationLoss), MakePointerChecker ()) diff --git a/src/spectrum/model/spectrum-interference.cc b/src/spectrum/model/spectrum-interference.cc index 47f4b556c..94f7e6838 100644 --- a/src/spectrum/model/spectrum-interference.cc +++ b/src/spectrum/model/spectrum-interference.cc @@ -32,10 +32,10 @@ NS_LOG_COMPONENT_DEFINE ("SpectrumInterference"); SpectrumInterference::SpectrumInterference () : m_receiving (false), - m_rxSignal (0), - m_allSignals (0), - m_noise (0), - m_errorModel (0) + m_rxSignal (nullptr), + m_allSignals (nullptr), + m_noise (nullptr), + m_errorModel (nullptr) { NS_LOG_FUNCTION (this); } @@ -60,10 +60,10 @@ void SpectrumInterference::DoDispose () { NS_LOG_FUNCTION (this); - m_rxSignal = 0; - m_allSignals = 0; - m_noise = 0; - m_errorModel = 0; + m_rxSignal = nullptr; + m_allSignals = nullptr; + m_noise = nullptr; + m_errorModel = nullptr; Object::DoDispose (); } diff --git a/src/spectrum/model/spectrum-propagation-loss-model.cc b/src/spectrum/model/spectrum-propagation-loss-model.cc index c4a76857e..a2c9a85c1 100644 --- a/src/spectrum/model/spectrum-propagation-loss-model.cc +++ b/src/spectrum/model/spectrum-propagation-loss-model.cc @@ -30,7 +30,7 @@ NS_LOG_COMPONENT_DEFINE ("SpectrumPropagationLossModel"); NS_OBJECT_ENSURE_REGISTERED (SpectrumPropagationLossModel); SpectrumPropagationLossModel::SpectrumPropagationLossModel () - : m_next (0) + : m_next (nullptr) { } @@ -41,7 +41,7 @@ SpectrumPropagationLossModel::~SpectrumPropagationLossModel () void SpectrumPropagationLossModel::DoDispose () { - m_next = 0; + m_next = nullptr; } TypeId diff --git a/src/spectrum/model/trace-fading-loss-model.cc b/src/spectrum/model/trace-fading-loss-model.cc index 7da0fc92a..516f4456f 100644 --- a/src/spectrum/model/trace-fading-loss-model.cc +++ b/src/spectrum/model/trace-fading-loss-model.cc @@ -43,7 +43,7 @@ TraceFadingLossModel::TraceFadingLossModel () : m_streamsAssigned (false) { NS_LOG_FUNCTION (this); - SetNext (NULL); + SetNext (nullptr); } diff --git a/src/spectrum/model/tv-spectrum-transmitter.cc b/src/spectrum/model/tv-spectrum-transmitter.cc index 18347ab72..6de208add 100644 --- a/src/spectrum/model/tv-spectrum-transmitter.cc +++ b/src/spectrum/model/tv-spectrum-transmitter.cc @@ -38,15 +38,15 @@ NS_LOG_COMPONENT_DEFINE ("TvSpectrumTransmitter"); NS_OBJECT_ENSURE_REGISTERED (TvSpectrumTransmitter); TvSpectrumTransmitter::TvSpectrumTransmitter () - : m_mobility (0), + : m_mobility (nullptr), m_antenna (CreateObject ()), - m_netDevice (0), - m_channel (0), + m_netDevice (nullptr), + m_channel (nullptr), m_tvType (TVTYPE_8VSB), m_startFrequency (500e6), m_channelBandwidth (6e6), m_basePsd (20), - m_txPsd (0), + m_txPsd (nullptr), m_startingTime (Seconds (0)), m_transmitDuration (Seconds (0.2)), m_active (false) @@ -56,11 +56,11 @@ TvSpectrumTransmitter::TvSpectrumTransmitter () TvSpectrumTransmitter::~TvSpectrumTransmitter () { - m_mobility = 0; - m_antenna = 0; - m_netDevice = 0; - m_channel = 0; - m_txPsd = 0; + m_mobility = nullptr; + m_antenna = nullptr; + m_netDevice = nullptr; + m_channel = nullptr; + m_txPsd = nullptr; NS_LOG_FUNCTION (this); } @@ -161,7 +161,7 @@ Ptr TvSpectrumTransmitter::GetRxSpectrumModel () const { NS_LOG_FUNCTION (this); - return 0; + return nullptr; } Ptr diff --git a/src/spectrum/model/waveform-generator.cc b/src/spectrum/model/waveform-generator.cc index 8014bd5dd..ef709bcad 100644 --- a/src/spectrum/model/waveform-generator.cc +++ b/src/spectrum/model/waveform-generator.cc @@ -35,10 +35,10 @@ NS_LOG_COMPONENT_DEFINE ("WaveformGenerator"); NS_OBJECT_ENSURE_REGISTERED (WaveformGenerator); WaveformGenerator::WaveformGenerator () - : m_mobility (0), - m_netDevice (0), - m_channel (0), - m_txPowerSpectralDensity (0), + : m_mobility (nullptr), + m_netDevice (nullptr), + m_channel (nullptr), + m_txPowerSpectralDensity (nullptr), m_startTime (Seconds (0)) { @@ -55,9 +55,9 @@ void WaveformGenerator::DoDispose () { NS_LOG_FUNCTION (this); - m_channel = 0; - m_netDevice = 0; - m_mobility = 0; + m_channel = nullptr; + m_netDevice = nullptr; + m_mobility = nullptr; if (m_nextWave.IsRunning ()) { m_nextWave.Cancel (); @@ -115,7 +115,7 @@ Ptr WaveformGenerator::GetRxSpectrumModel () const { // this device is not interested in RX - return 0; + return nullptr; } void @@ -206,7 +206,7 @@ WaveformGenerator::GenerateWaveform () txParams->txAntenna = m_antenna; NS_LOG_LOGIC ("generating waveform : " << *m_txPowerSpectralDensity); - m_phyTxStartTrace (0); + m_phyTxStartTrace (nullptr); m_channel->StartTx (txParams); NS_LOG_LOGIC ("scheduling next waveform"); diff --git a/src/spectrum/model/wifi-spectrum-value-helper.cc b/src/spectrum/model/wifi-spectrum-value-helper.cc index 87a80acfb..55ebec15c 100644 --- a/src/spectrum/model/wifi-spectrum-value-helper.cc +++ b/src/spectrum/model/wifi-spectrum-value-helper.cc @@ -180,7 +180,7 @@ WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (uint32_t centerFreque break; default: NS_FATAL_ERROR ("Channel width " << channelWidth << " should be correctly set."); - return 0; + return nullptr; } Ptr c = Create (GetSpectrumModel (centerFrequency, channelWidth, bandBandwidth, guardBandwidth)); diff --git a/src/stats/helper/file-helper.cc b/src/stats/helper/file-helper.cc index f062eb673..2448dd97f 100644 --- a/src/stats/helper/file-helper.cc +++ b/src/stats/helper/file-helper.cc @@ -33,7 +33,7 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("FileHelper"); FileHelper::FileHelper () - : m_aggregator (0), + : m_aggregator (nullptr), m_fileProbeCount (0), m_fileType (FileAggregator::SPACE_SEPARATED), m_outputFileNameWithoutExtension ("file-helper"), @@ -47,7 +47,7 @@ FileHelper::FileHelper () FileHelper::FileHelper (const std::string &outputFileNameWithoutExtension, enum FileAggregator::FileType fileType) - : m_aggregator (0), + : m_aggregator (nullptr), m_fileProbeCount (0), m_fileType (fileType), m_outputFileNameWithoutExtension (outputFileNameWithoutExtension), diff --git a/src/stats/helper/gnuplot-helper.cc b/src/stats/helper/gnuplot-helper.cc index 2dec2ecde..1958d6e90 100644 --- a/src/stats/helper/gnuplot-helper.cc +++ b/src/stats/helper/gnuplot-helper.cc @@ -35,7 +35,7 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("GnuplotHelper"); GnuplotHelper::GnuplotHelper () - : m_aggregator (0), + : m_aggregator (nullptr), m_plotProbeCount (0), m_outputFileNameWithoutExtension ("gnuplot-helper"), m_title ("Gnuplot Helper Plot"), @@ -54,7 +54,7 @@ GnuplotHelper::GnuplotHelper (const std::string &outputFileNameWithoutExtension, const std::string &xLegend, const std::string &yLegend, const std::string &terminalType) - : m_aggregator (0), + : m_aggregator (nullptr), m_plotProbeCount (0), m_outputFileNameWithoutExtension (outputFileNameWithoutExtension), m_title (title), diff --git a/src/tap-bridge/model/tap-bridge.cc b/src/tap-bridge/model/tap-bridge.cc index 1e5a2f665..0f3b0e07b 100644 --- a/src/tap-bridge/model/tap-bridge.cc +++ b/src/tap-bridge/model/tap-bridge.cc @@ -56,7 +56,7 @@ FdReader::Data TapBridgeFdReader::DoRead () uint32_t bufferSize = 65536; uint8_t *buf = (uint8_t *)std::malloc (bufferSize); - NS_ABORT_MSG_IF (buf == 0, "malloc() failed"); + NS_ABORT_MSG_IF (buf == nullptr, "malloc() failed"); NS_LOG_LOGIC ("Calling read on tap device fd " << m_fd); ssize_t len = read (m_fd, buf, bufferSize); @@ -64,7 +64,7 @@ FdReader::Data TapBridgeFdReader::DoRead () { NS_LOG_INFO ("TapBridgeFdReader::DoRead(): done"); std::free (buf); - buf = 0; + buf = nullptr; len = 0; } @@ -142,12 +142,12 @@ TapBridge::GetTypeId () } TapBridge::TapBridge () - : m_node (0), + : m_node (nullptr), m_ifIndex (0), m_sock (-1), m_startEvent (), m_stopEvent (), - m_fdReader (0), + m_fdReader (nullptr), m_ns3AddressRewritten (false) { NS_LOG_FUNCTION (this); @@ -162,9 +162,9 @@ TapBridge::~TapBridge() StopTapDevice (); delete [] m_packetBuffer; - m_packetBuffer = 0; + m_packetBuffer = nullptr; - m_bridgedDevice = 0; + m_bridgedDevice = nullptr; } void @@ -247,7 +247,7 @@ TapBridge::StopTapDevice () if (m_fdReader) { m_fdReader->Stop (); - m_fdReader = 0; + m_fdReader = nullptr; } if (m_sock != -1) @@ -526,7 +526,7 @@ TapBridge::CreateTap () ossMode.str ().c_str (), // argv[6] (-o) ossPath.str ().c_str (), // argv[7] (-p) ossVerbose.str ().c_str (), // argv[8] (-v) - (char *)NULL); + (char *)nullptr); // // If the execlp successfully completes, it never returns. If it returns it failed or the OS is @@ -610,7 +610,7 @@ TapBridge::CreateTap () // data we expect to receive and point it to buffer. // struct msghdr msg; - msg.msg_name = 0; + msg.msg_name = nullptr; msg.msg_namelen = 0; msg.msg_iov = &iov; msg.msg_iovlen = 1; @@ -631,7 +631,7 @@ TapBridge::CreateTap () // one we're interested in. // struct cmsghdr *cmsg; - for (cmsg = CMSG_FIRSTHDR (&msg); cmsg != NULL; cmsg = CMSG_NXTHDR (&msg, cmsg)) + for (cmsg = CMSG_FIRSTHDR (&msg); cmsg != nullptr; cmsg = CMSG_NXTHDR (&msg, cmsg)) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) @@ -655,7 +655,7 @@ TapBridge::CreateTap () } } } - if (cmsg == NULL) + if (cmsg == nullptr) { NS_FATAL_ERROR ("Did not get the raw socket from the socket creator"); } @@ -697,7 +697,7 @@ TapBridge::ReadCallback (uint8_t *buf, ssize_t len) { NS_LOG_FUNCTION (this << buf << len); - NS_ASSERT_MSG (buf != 0, "invalid buf argument"); + NS_ASSERT_MSG (buf != nullptr, "invalid buf argument"); NS_ASSERT_MSG (len > 0, "invalid len argument"); // @@ -751,7 +751,7 @@ TapBridge::ForwardToBridgedDevice (uint8_t *buf, ssize_t len) // Ptr packet = Create (reinterpret_cast (buf), len); std::free (buf); - buf = 0; + buf = nullptr; // // Make sure the packet we received is reasonable enough for the rest of the @@ -860,7 +860,7 @@ TapBridge::Filter (Ptr p, Address *src, Address *dst, uint16_t *type) EthernetHeader header (false); if (pktSize < header.GetSerializedSize ()) { - return 0; + return nullptr; } uint32_t headerSize = p->PeekHeader (header); @@ -885,7 +885,7 @@ TapBridge::Filter (Ptr p, Address *src, Address *dst, uint16_t *type) LlcSnapHeader llc; if (pktSize < llc.GetSerializedSize ()) { - return 0; + return nullptr; } p->RemoveHeader (llc); @@ -1044,7 +1044,7 @@ Ptr TapBridge::GetChannel () const { NS_LOG_FUNCTION (this); - return 0; + return nullptr; } void diff --git a/src/tap-bridge/model/tap-creator.cc b/src/tap-bridge/model/tap-creator.cc index bcfa4225a..506521cd5 100644 --- a/src/tap-bridge/model/tap-creator.cc +++ b/src/tap-bridge/model/tap-creator.cc @@ -227,7 +227,7 @@ SendSocket (const char *path, int fd) // for. // struct msghdr msg; - msg.msg_name = 0; + msg.msg_name = nullptr; msg.msg_namelen = 0; msg.msg_iov = &iov; msg.msg_iovlen = 1; @@ -355,12 +355,12 @@ main (int argc, char *argv[]) { int c; char *dev = (char *)""; - char *gw = NULL; - char *ip = NULL; - char *mac = NULL; - char *netmask = NULL; - char *operatingMode = NULL; - char *path = NULL; + char *gw = nullptr; + char *ip = nullptr; + char *mac = nullptr; + char *netmask = nullptr; + char *operatingMode = nullptr; + char *path = nullptr; opterr = 0; @@ -408,7 +408,7 @@ main (int argc, char *argv[]) // so it can talk to the ns-3 network. This ip address is provided in // gw. // - ABORT_IF (gw == NULL, "Gateway Address is a required argument", 0); + ABORT_IF (gw == nullptr, "Gateway Address is a required argument", 0); LOG ("Provided Gateway Address is \"" << gw << "\""); // @@ -416,7 +416,7 @@ main (int argc, char *argv[]) // allocating. This address is allocated in the simulation and assigned to // the tap bridge. This address is given in ip. // - ABORT_IF (ip == NULL, "IP Address is a required argument", 0); + ABORT_IF (ip == nullptr, "IP Address is a required argument", 0); LOG ("Provided IP Address is \"" << ip << "\""); // @@ -425,7 +425,7 @@ main (int argc, char *argv[]) // the bridged device. This allows packets addressed to the bridged device // to appear in the Linux host as if they were received there. // - ABORT_IF (mac == NULL, "MAC Address is a required argument", 0); + ABORT_IF (mac == nullptr, "MAC Address is a required argument", 0); LOG ("Provided MAC Address is \"" << mac << "\""); // @@ -433,13 +433,13 @@ main (int argc, char *argv[]) // allocating. This mask is allocated in the simulation and given to // the bridged device. // - ABORT_IF (netmask == NULL, "Net Mask is a required argument", 0); + ABORT_IF (netmask == nullptr, "Net Mask is a required argument", 0); LOG ("Provided Net Mask is \"" << netmask << "\""); // // We have got to know whether or not to create the TAP. // - ABORT_IF (operatingMode == NULL, "Operating Mode is a required argument", 0); + ABORT_IF (operatingMode == nullptr, "Operating Mode is a required argument", 0); LOG ("Provided Operating Mode is \"" << operatingMode << "\""); // @@ -453,7 +453,7 @@ main (int argc, char *argv[]) // us. We see it here as the "path" string. We can't do anything useful // unless we have that string. // - ABORT_IF (path == NULL, "path is a required argument", 0); + ABORT_IF (path == nullptr, "path is a required argument", 0); LOG ("Provided path is \"" << path << "\""); // diff --git a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc index b8e63aca3..ce9084d2e 100644 --- a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc @@ -296,7 +296,7 @@ Ns3TcpLossTestCase::WriteUntilBufferFull (Ptr localSocket, uint32_t) std::clog << "Submitting " << toWrite << " bytes to TCP socket" << std::endl; } - int amountSent = localSocket->Send (0, toWrite, 0); + int amountSent = localSocket->Send (nullptr, toWrite, 0); NS_ASSERT (amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero m_currentTxBytes += amountSent; } diff --git a/src/test/ns3tcp/ns3tcp-socket-writer.cc b/src/test/ns3tcp/ns3tcp-socket-writer.cc index 4cb09fb7c..45f180fc8 100644 --- a/src/test/ns3tcp/ns3tcp-socket-writer.cc +++ b/src/test/ns3tcp/ns3tcp-socket-writer.cc @@ -23,14 +23,14 @@ namespace ns3 { -SocketWriter::SocketWriter () : m_node (0), m_socket (0), m_isSetup (false), m_isConnected (false) +SocketWriter::SocketWriter () : m_node (nullptr), m_socket (nullptr), m_isSetup (false), m_isConnected (false) { } SocketWriter::~SocketWriter () { - m_socket = 0; - m_node = 0; + m_socket = nullptr; + m_node = nullptr; } /* static */ diff --git a/src/test/ns3tcp/ns3tcp-state-test-suite.cc b/src/test/ns3tcp/ns3tcp-state-test-suite.cc index 629a103bb..478f27b8f 100644 --- a/src/test/ns3tcp/ns3tcp-state-test-suite.cc +++ b/src/test/ns3tcp/ns3tcp-state-test-suite.cc @@ -291,7 +291,7 @@ Ns3TcpStateTestCase::WriteUntilBufferFull (Ptr localSocket, uint32_t txS std::clog << "Submitting " << toWrite << " bytes to TCP socket" << std::endl; } - int amountSent = localSocket->Send (0, toWrite, 0); + int amountSent = localSocket->Send (nullptr, toWrite, 0); NS_ASSERT (amountSent > 0); // Given GetTxAvailable() non-zero, amountSent should not be zero m_currentTxBytes += amountSent; } diff --git a/src/topology-read/helper/topology-reader-helper.cc b/src/topology-read/helper/topology-reader-helper.cc index a8c7915d0..b5377f670 100644 --- a/src/topology-read/helper/topology-reader-helper.cc +++ b/src/topology-read/helper/topology-reader-helper.cc @@ -38,7 +38,7 @@ NS_LOG_COMPONENT_DEFINE ("TopologyReaderHelper"); TopologyReaderHelper::TopologyReaderHelper () { - m_inputModel = 0; + m_inputModel = nullptr; } void diff --git a/src/traffic-control/helper/traffic-control-helper.cc b/src/traffic-control/helper/traffic-control-helper.cc index 8f2f0bcaf..1992a6617 100644 --- a/src/traffic-control/helper/traffic-control-helper.cc +++ b/src/traffic-control/helper/traffic-control-helper.cc @@ -271,7 +271,7 @@ TrafficControlHelper::Uninstall (Ptr d) NS_ASSERT (ndqi); for (std::size_t i = 0; i < ndqi->GetNTxQueues (); i++) { - ndqi->GetTxQueue (i)->SetQueueLimits (0); + ndqi->GetTxQueue (i)->SetQueueLimits (nullptr); } } diff --git a/src/traffic-control/model/cobalt-queue-disc.cc b/src/traffic-control/model/cobalt-queue-disc.cc index a94051beb..fcb52d7df 100644 --- a/src/traffic-control/model/cobalt-queue-disc.cc +++ b/src/traffic-control/model/cobalt-queue-disc.cc @@ -270,7 +270,7 @@ void CobaltQueueDisc::DoDispose () { NS_LOG_FUNCTION (this); - m_uv = 0; + m_uv = nullptr; QueueDisc::DoDispose (); } @@ -281,7 +281,7 @@ CobaltQueueDisc::DoPeek () if (GetInternalQueue (0)->IsEmpty ()) { NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } Ptr item = GetInternalQueue (0)->Peek (); @@ -366,7 +366,7 @@ CobaltQueueDisc::DoDequeue () int64_t now = CoDelGetTime (); // Call this to update Blue's drop probability CobaltQueueEmpty (now); - return 0; + return nullptr; } int64_t now = CoDelGetTime (); diff --git a/src/traffic-control/model/codel-queue-disc.cc b/src/traffic-control/model/codel-queue-disc.cc index af8547987..c141fb077 100644 --- a/src/traffic-control/model/codel-queue-disc.cc +++ b/src/traffic-control/model/codel-queue-disc.cc @@ -242,7 +242,7 @@ CoDelQueueDisc::DoDequeue () // Leave dropping state when queue is empty m_dropping = false; NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } uint32_t ldelay = Time2CoDel (Simulator::Now () - item->GetTimeStamp ()); if (item && m_useL4s) diff --git a/src/traffic-control/model/fifo-queue-disc.cc b/src/traffic-control/model/fifo-queue-disc.cc index 003ab8d2c..36377c22e 100644 --- a/src/traffic-control/model/fifo-queue-disc.cc +++ b/src/traffic-control/model/fifo-queue-disc.cc @@ -89,7 +89,7 @@ FifoQueueDisc::DoDequeue () if (!item) { NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } return item; @@ -105,7 +105,7 @@ FifoQueueDisc::DoPeek () if (!item) { NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } return item; diff --git a/src/traffic-control/model/fq-cobalt-queue-disc.cc b/src/traffic-control/model/fq-cobalt-queue-disc.cc index 9fcadbd9a..5089768a4 100644 --- a/src/traffic-control/model/fq-cobalt-queue-disc.cc +++ b/src/traffic-control/model/fq-cobalt-queue-disc.cc @@ -387,7 +387,7 @@ FqCobaltQueueDisc::DoDequeue () if (!found) { NS_LOG_DEBUG ("No flow found to dequeue a packet"); - return 0; + return nullptr; } item = flow->GetQueueDisc ()->Dequeue (); diff --git a/src/traffic-control/model/fq-codel-queue-disc.cc b/src/traffic-control/model/fq-codel-queue-disc.cc index ad83fa988..6aa13c677 100644 --- a/src/traffic-control/model/fq-codel-queue-disc.cc +++ b/src/traffic-control/model/fq-codel-queue-disc.cc @@ -358,7 +358,7 @@ FqCoDelQueueDisc::DoDequeue () if (!found) { NS_LOG_DEBUG ("No flow found to dequeue a packet"); - return 0; + return nullptr; } item = flow->GetQueueDisc ()->Dequeue (); diff --git a/src/traffic-control/model/fq-pie-queue-disc.cc b/src/traffic-control/model/fq-pie-queue-disc.cc index 834dcf1a5..a974e3823 100644 --- a/src/traffic-control/model/fq-pie-queue-disc.cc +++ b/src/traffic-control/model/fq-pie-queue-disc.cc @@ -416,7 +416,7 @@ FqPieQueueDisc::DoDequeue () if (!found) { NS_LOG_DEBUG ("No flow found to dequeue a packet"); - return 0; + return nullptr; } item = flow->GetQueueDisc ()->Dequeue (); diff --git a/src/traffic-control/model/pie-queue-disc.cc b/src/traffic-control/model/pie-queue-disc.cc index d864a0327..7c426203f 100644 --- a/src/traffic-control/model/pie-queue-disc.cc +++ b/src/traffic-control/model/pie-queue-disc.cc @@ -154,7 +154,7 @@ void PieQueueDisc::DoDispose () { NS_LOG_FUNCTION (this); - m_uv = 0; + m_uv = nullptr; m_rtrsEvent.Cancel (); QueueDisc::DoDispose (); } @@ -475,7 +475,7 @@ PieQueueDisc::DoDequeue () if (GetInternalQueue (0)->IsEmpty ()) { NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } Ptr item = GetInternalQueue (0)->Dequeue (); diff --git a/src/traffic-control/model/queue-disc.cc b/src/traffic-control/model/queue-disc.cc index 0818b8f14..af3197436 100644 --- a/src/traffic-control/model/queue-disc.cc +++ b/src/traffic-control/model/queue-disc.cc @@ -64,7 +64,7 @@ void QueueDiscClass::DoDispose () { NS_LOG_FUNCTION (this); - m_queueDisc = 0; + m_queueDisc = nullptr; Object::DoDispose (); } @@ -385,9 +385,9 @@ QueueDisc::DoDispose () m_queues.clear (); m_filters.clear (); m_classes.clear (); - m_devQueueIface = 0; + m_devQueueIface = nullptr; m_send = nullptr; - m_requeued = 0; + m_requeued = nullptr; m_internalQueueDbeFunctor = nullptr; m_internalQueueDadFunctor = nullptr; m_childQueueDiscDbeFunctor = nullptr; @@ -902,7 +902,7 @@ QueueDisc::Dequeue () if (item) { - m_requeued = 0; + m_requeued = nullptr; if (m_peeked) { // If the packet was requeued because a peek operation was requested @@ -1020,7 +1020,7 @@ QueueDisc::DequeuePacket () if (!m_devQueueIface || !m_devQueueIface->GetTxQueue (m_requeued->GetTxQueueIndex ())->IsStopped ()) { item = m_requeued; - m_requeued = 0; + m_requeued = nullptr; if (m_peeked) { // If the packet was requeued because a peek operation was requested diff --git a/src/traffic-control/model/red-queue-disc.cc b/src/traffic-control/model/red-queue-disc.cc index c551beb70..2de137b7d 100644 --- a/src/traffic-control/model/red-queue-disc.cc +++ b/src/traffic-control/model/red-queue-disc.cc @@ -239,7 +239,7 @@ void RedQueueDisc::DoDispose () { NS_LOG_FUNCTION (this); - m_uv = 0; + m_uv = nullptr; QueueDisc::DoDispose (); } @@ -818,7 +818,7 @@ RedQueueDisc::DoDequeue () m_idle = 1; m_idleTime = Simulator::Now (); - return 0; + return nullptr; } else { @@ -841,7 +841,7 @@ RedQueueDisc::DoPeek () if (GetInternalQueue (0)->IsEmpty ()) { NS_LOG_LOGIC ("Queue empty"); - return 0; + return nullptr; } Ptr item = GetInternalQueue (0)->Peek (); diff --git a/src/traffic-control/model/tbf-queue-disc.cc b/src/traffic-control/model/tbf-queue-disc.cc index 0740596b6..74252dd96 100644 --- a/src/traffic-control/model/tbf-queue-disc.cc +++ b/src/traffic-control/model/tbf-queue-disc.cc @@ -288,7 +288,7 @@ TbfQueueDisc::DoDequeue () NS_LOG_LOGIC("Waking Event Scheduled in " << requiredDelayTime.As (Time::S)); } } - return 0; + return nullptr; } bool diff --git a/src/traffic-control/model/traffic-control-layer.cc b/src/traffic-control/model/traffic-control-layer.cc index 644d9806f..c06e2cdef 100644 --- a/src/traffic-control/model/traffic-control-layer.cc +++ b/src/traffic-control/model/traffic-control-layer.cc @@ -75,7 +75,7 @@ void TrafficControlLayer::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; + m_node = nullptr; m_handlers.clear (); m_netDevices.clear (); Object::DoDispose (); @@ -235,7 +235,7 @@ TrafficControlLayer::GetRootQueueDiscOnDevice (Ptr device) const if (ndi == m_netDevices.end ()) { - return 0; + return nullptr; } return ndi->second.m_rootQueueDisc; } @@ -258,7 +258,7 @@ TrafficControlLayer::DeleteRootQueueDiscOnDevice (Ptr device) "No root queue disc installed on device " << device); // remove the root queue disc - ndi->second.m_rootQueueDisc = 0; + ndi->second.m_rootQueueDisc = nullptr; for (auto& q : ndi->second.m_queueDiscsToWake) { q->SetNetDeviceQueueInterface (nullptr); diff --git a/src/uan/examples/uan-cw-example.cc b/src/uan/examples/uan-cw-example.cc index b51243c9a..4fbc289d7 100644 --- a/src/uan/examples/uan-cw-example.cc +++ b/src/uan/examples/uan-cw-example.cc @@ -125,7 +125,7 @@ Experiment::ReceivePacket (Ptr socket) { m_bytesTotal += packet->GetSize (); } - packet = 0; + packet = nullptr; } Gnuplot2dDataset @@ -234,27 +234,27 @@ Experiment::Run (UanHelper &uan) uan.EnableAsciiAll (ascii); Simulator::Run (); - sinkNode = 0; - sinkSocket = 0; - pos = 0; - channel = 0; - prop = 0; + sinkNode = nullptr; + sinkSocket = nullptr; + pos = nullptr; + channel = nullptr; + prop = nullptr; for (uint32_t i=0; i < nc.GetN (); i++) { - nc.Get (i) = 0; + nc.Get (i) = nullptr; } for (uint32_t i=0; i < sink.GetN (); i++) { - sink.Get (i) = 0; + sink.Get (i) = nullptr; } for (uint32_t i=0; i < devices.GetN (); i++) { - devices.Get (i) = 0; + devices.Get (i) = nullptr; } for (uint32_t i=0; i < sinkdev.GetN (); i++) { - sinkdev.Get (i) = 0; + sinkdev.Get (i) = nullptr; } Simulator::Destroy (); @@ -327,8 +327,8 @@ main (int argc, char **argv) } gp.GenerateOutput (of); - per = 0; - sinr = 0; + per = nullptr; + sinr = nullptr; } diff --git a/src/uan/model/acoustic-modem-energy-model.cc b/src/uan/model/acoustic-modem-energy-model.cc index 567044c9f..4afba38a9 100644 --- a/src/uan/model/acoustic-modem-energy-model.cc +++ b/src/uan/model/acoustic-modem-energy-model.cc @@ -77,8 +77,8 @@ AcousticModemEnergyModel::AcousticModemEnergyModel () m_currentState = UanPhy::IDLE; // initially IDLE m_lastUpdateTime = Seconds (0.0); m_energyDepletionCallback.Nullify (); - m_node = 0; - m_source = 0; + m_node = nullptr; + m_source = nullptr; } AcousticModemEnergyModel::~AcousticModemEnergyModel () @@ -304,8 +304,8 @@ void AcousticModemEnergyModel::DoDispose () { NS_LOG_FUNCTION (this); - m_node = 0; - m_source = 0; + m_node = nullptr; + m_source = nullptr; m_energyDepletionCallback.Nullify (); } diff --git a/src/uan/model/uan-channel.cc b/src/uan/model/uan-channel.cc index 3d93e6f6b..47a3ee38a 100644 --- a/src/uan/model/uan-channel.cc +++ b/src/uan/model/uan-channel.cc @@ -66,7 +66,7 @@ UanChannel::GetTypeId () UanChannel::UanChannel () : Channel (), - m_prop (0), + m_prop (nullptr), m_cleared (false) { } @@ -89,24 +89,24 @@ UanChannel::Clear () if (it->first) { it->first->Clear (); - it->first = 0; + it->first = nullptr; } if (it->second) { it->second->Clear (); - it->second = 0; + it->second = nullptr; } } m_devList.clear (); if (m_prop) { m_prop->Clear (); - m_prop = 0; + m_prop = nullptr; } if (m_noise) { m_noise->Clear (); - m_noise = 0; + m_noise = nullptr; } } @@ -147,7 +147,7 @@ void UanChannel::TxPacket (Ptr src, Ptr packet, double txPowerDb, UanTxMode txMode) { - Ptr senderMobility = 0; + Ptr senderMobility = nullptr; NS_LOG_DEBUG ("Channel scheduling"); for (UanDeviceList::const_iterator i = m_devList.begin (); i diff --git a/src/uan/model/uan-mac-aloha.cc b/src/uan/model/uan-mac-aloha.cc index 7404f10b4..1b30ee3af 100644 --- a/src/uan/model/uan-mac-aloha.cc +++ b/src/uan/model/uan-mac-aloha.cc @@ -54,7 +54,7 @@ UanMacAloha::Clear () if (m_phy) { m_phy->Clear (); - m_phy = 0; + m_phy = nullptr; } } diff --git a/src/uan/model/uan-mac-cw.cc b/src/uan/model/uan-mac-cw.cc index 4c9f2eb75..4de74cf76 100644 --- a/src/uan/model/uan-mac-cw.cc +++ b/src/uan/model/uan-mac-cw.cc @@ -35,8 +35,8 @@ NS_OBJECT_ENSURE_REGISTERED (UanMacCw); UanMacCw::UanMacCw () : UanMac (), - m_phy (0), - m_pktTx (0), + m_phy (nullptr), + m_pktTx (nullptr), m_txOngoing (false), m_state (IDLE), m_cleared (false) @@ -57,11 +57,11 @@ UanMacCw::Clear () return; } m_cleared = true; - m_pktTx = 0; + m_pktTx = nullptr; if (m_phy) { m_phy->Clear (); - m_phy = 0; + m_phy = nullptr; } m_sendEvent.Cancel (); m_txOngoing = false; @@ -374,7 +374,7 @@ UanMacCw::SendPacket () NS_ASSERT (m_state == RUNNING); m_state = TX; m_phy->SendPacket (m_pktTx,m_pktTxProt); - m_pktTx = 0; + m_pktTx = nullptr; m_sendTime = Seconds (0); m_savedDelayS = Seconds (0); } diff --git a/src/uan/model/uan-mac-rc-gw.cc b/src/uan/model/uan-mac-rc-gw.cc index 99c98b9eb..a5a0aee0d 100644 --- a/src/uan/model/uan-mac-rc-gw.cc +++ b/src/uan/model/uan-mac-rc-gw.cc @@ -80,7 +80,7 @@ UanMacRcGw::Clear () if (m_phy) { m_phy->Clear (); - m_phy = 0; + m_phy = nullptr; } m_propDelay.clear (); std::map::iterator it = m_ackData.begin (); diff --git a/src/uan/model/uan-mac-rc.cc b/src/uan/model/uan-mac-rc.cc index 123e297c3..eae2c0fb5 100644 --- a/src/uan/model/uan-mac-rc.cc +++ b/src/uan/model/uan-mac-rc.cc @@ -78,7 +78,7 @@ Reservation::~Reservation () std::list, Mac8Address > >::iterator it; for (it = m_pktList.begin (); it != m_pktList.end (); it++) { - it->first = Ptr ((Packet *) 0); + it->first = Ptr ((Packet *) nullptr); } m_pktList.clear (); m_timestamp.clear (); @@ -184,12 +184,12 @@ UanMacRc::Clear () if (m_phy) { m_phy->Clear (); - m_phy = 0; + m_phy = nullptr; } std::list, Mac8Address > >::iterator it; for (it = m_pktQueue.begin (); it != m_pktQueue.end (); it++) { - it->first = 0; + it->first = nullptr; } m_pktQueue.clear (); m_resList.clear (); diff --git a/src/uan/model/uan-net-device.cc b/src/uan/model/uan-net-device.cc index 6d3440e07..4fc266c9f 100644 --- a/src/uan/model/uan-net-device.cc +++ b/src/uan/model/uan-net-device.cc @@ -55,26 +55,26 @@ UanNetDevice::Clear () return; } m_cleared = true; - m_node = 0; + m_node = nullptr; if (m_channel) { m_channel->Clear (); - m_channel = 0; + m_channel = nullptr; } if (m_mac) { m_mac->Clear (); - m_mac = 0; + m_mac = nullptr; } if (m_phy) { m_phy->Clear (); - m_phy = 0; + m_phy = nullptr; } if (m_trans) { m_trans->Clear (); - m_trans = 0; + m_trans = nullptr; } } diff --git a/src/uan/model/uan-phy-dual.cc b/src/uan/model/uan-phy-dual.cc index a6b5274a2..e58b889d3 100644 --- a/src/uan/model/uan-phy-dual.cc +++ b/src/uan/model/uan-phy-dual.cc @@ -140,12 +140,12 @@ UanPhyDual::Clear () if (m_phy1) { m_phy1->Clear (); - m_phy1 = 0; + m_phy1 = nullptr; } if (m_phy2) { m_phy2->Clear (); - m_phy2 = 0; + m_phy2 = nullptr; } } void diff --git a/src/uan/model/uan-phy-gen.cc b/src/uan/model/uan-phy-gen.cc index 11b566eee..6ed2ceb0d 100644 --- a/src/uan/model/uan-phy-gen.cc +++ b/src/uan/model/uan-phy-gen.cc @@ -494,15 +494,15 @@ UanPhyPerUmodem::CalcPer (Ptr pkt, double sinr, UanTxMode mode) UanPhyGen::UanPhyGen () : UanPhy (), m_state (IDLE), - m_channel (0), - m_transducer (0), - m_device (0), - m_mac (0), + m_channel (nullptr), + m_transducer (nullptr), + m_device (nullptr), + m_mac (nullptr), m_txPwrDb (0), m_rxThreshDb (0), m_ccaThreshDb (0), - m_pktRx (0), - m_pktTx (0), + m_pktRx (nullptr), + m_pktTx (nullptr), m_cleared (false) { m_pg = CreateObject (); @@ -527,34 +527,34 @@ UanPhyGen::Clear () if (m_channel) { m_channel->Clear (); - m_channel = 0; + m_channel = nullptr; } if (m_transducer) { m_transducer->Clear (); - m_transducer = 0; + m_transducer = nullptr; } if (m_device) { m_device->Clear (); - m_device = 0; + m_device = nullptr; } if (m_mac) { m_mac->Clear (); - m_mac = 0; + m_mac = nullptr; } if (m_per) { m_per->Clear (); - m_per = 0; + m_per = nullptr; } if (m_sinr) { m_sinr->Clear (); - m_sinr = 0; + m_sinr = nullptr; } - m_pktRx = 0; + m_pktRx = nullptr; } void @@ -664,13 +664,13 @@ UanPhyGen::EnergyDepletionHandler () { Simulator::Cancel (m_txEndEvent); NotifyTxDrop (m_pktTx); - m_pktTx = 0; + m_pktTx = nullptr; } if (m_rxEndEvent.IsRunning ()) { Simulator::Cancel (m_rxEndEvent); NotifyRxDrop (m_pktRx); - m_pktRx = 0; + m_pktRx = nullptr; } } @@ -710,7 +710,7 @@ UanPhyGen::SendPacket (Ptr pkt, uint32_t modeNum) if (m_pktRx) { m_minRxSinrDb = -1e30; - m_pktRx = 0; + m_pktRx = nullptr; } m_transducer->Transmit (Ptr (this), pkt, m_txPwrDb, txMode); @@ -734,7 +734,7 @@ UanPhyGen::TxEndEvent () } NS_ASSERT (m_state == TX); - if (GetInterferenceDb ( (Ptr) 0) > m_ccaThreshDb) + if (GetInterferenceDb ( (Ptr) nullptr) > m_ccaThreshDb) { m_state = CCABUSY; NotifyListenersCcaStart (); @@ -825,7 +825,7 @@ UanPhyGen::StartRxPacket (Ptr pkt, double rxPowerDb, UanTxMode txMode, U break; } - if (m_state == IDLE && GetInterferenceDb ( (Ptr) 0) > m_ccaThreshDb) + if (m_state == IDLE && GetInterferenceDb ( (Ptr) nullptr) > m_ccaThreshDb) { m_state = CCABUSY; NotifyListenersCcaStart (); @@ -844,13 +844,13 @@ UanPhyGen::RxEndEvent (Ptr pkt, [[maybe_unused]] double rxPowerDb, UanTx if (m_state == DISABLED || m_state == SLEEP) { NS_LOG_DEBUG ("Sleep mode or dead. Dropping packet"); - m_pktRx = 0; + m_pktRx = nullptr; NotifyRxDrop (pkt); // traced source netanim return; } NotifyRxEnd (pkt); // traced source netanim - if (GetInterferenceDb ( (Ptr) 0) > m_ccaThreshDb) + if (GetInterferenceDb ( (Ptr) nullptr) > m_ccaThreshDb) { m_state = CCABUSY; NotifyListenersCcaStart (); @@ -881,7 +881,7 @@ UanPhyGen::RxEndEvent (Ptr pkt, [[maybe_unused]] double rxPowerDb, UanTx } } - m_pktRx = 0; + m_pktRx = nullptr; } void @@ -1017,7 +1017,7 @@ UanPhyGen::SetSleepMode (bool sleep ) } else if (m_state == SLEEP) { - if (GetInterferenceDb ((Ptr) 0) > m_ccaThreshDb) + if (GetInterferenceDb ((Ptr) nullptr) > m_ccaThreshDb) { m_state = CCABUSY; NotifyListenersCcaStart (); diff --git a/src/uan/model/uan-transducer-hd.cc b/src/uan/model/uan-transducer-hd.cc index b87856791..676b38c19 100644 --- a/src/uan/model/uan-transducer-hd.cc +++ b/src/uan/model/uan-transducer-hd.cc @@ -57,7 +57,7 @@ UanTransducerHd::Clear () if (m_channel) { m_channel->Clear (); - m_channel = 0; + m_channel = nullptr; } UanPhyList::iterator it = m_phyList.begin (); @@ -66,13 +66,13 @@ UanTransducerHd::Clear () if (*it) { (*it)->Clear (); - *it = 0; + *it = nullptr; } } ArrivalList::iterator ait = m_arrivalList.begin (); for (; ait != m_arrivalList.end (); ait++) { - ait->GetPacket () = 0; + ait->GetPacket () = nullptr; } m_phyList.clear (); m_arrivalList.clear (); diff --git a/src/uan/model/uan-transducer.h b/src/uan/model/uan-transducer.h index 7a5e9657e..ebbe20697 100644 --- a/src/uan/model/uan-transducer.h +++ b/src/uan/model/uan-transducer.h @@ -69,7 +69,7 @@ public: /** Destructor */ ~UanPacketArrival() { - m_packet = 0; + m_packet = nullptr; } /** diff --git a/src/uan/test/uan-energy-model-test.cc b/src/uan/test/uan-energy-model-test.cc index dfdac0b6b..2e9dd152b 100644 --- a/src/uan/test/uan-energy-model-test.cc +++ b/src/uan/test/uan-energy-model-test.cc @@ -94,8 +94,8 @@ AcousticModemEnergyTestCase::AcousticModemEnergyTestCase () AcousticModemEnergyTestCase::~AcousticModemEnergyTestCase () { - m_node = 0; - m_gateway = 0; + m_node = nullptr; + m_gateway = nullptr; } void @@ -253,7 +253,7 @@ AcousticModemEnergyDepletionTestCase::AcousticModemEnergyDepletionTestCase () AcousticModemEnergyDepletionTestCase::~AcousticModemEnergyDepletionTestCase () { - m_node = 0; + m_node = nullptr; } void diff --git a/src/virtual-net-device/model/virtual-net-device.cc b/src/virtual-net-device/model/virtual-net-device.cc index 716c3d006..e38fdb1de 100644 --- a/src/virtual-net-device/model/virtual-net-device.cc +++ b/src/virtual-net-device/model/virtual-net-device.cc @@ -132,7 +132,7 @@ VirtualNetDevice::~VirtualNetDevice() void VirtualNetDevice::DoDispose () { NS_LOG_FUNCTION_NOARGS (); - m_node = 0; + m_node = nullptr; NetDevice::DoDispose (); } diff --git a/src/wave/helper/wifi-80211p-helper.cc b/src/wave/helper/wifi-80211p-helper.cc index 08a14e4f7..b546ff90b 100644 --- a/src/wave/helper/wifi-80211p-helper.cc +++ b/src/wave/helper/wifi-80211p-helper.cc @@ -75,10 +75,10 @@ NetDeviceContainer Wifi80211pHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const { [[maybe_unused]] QosWaveMacHelper const * qosMac = dynamic_cast (&macHelper); - if (qosMac == 0) + if (qosMac == nullptr) { [[maybe_unused]] NqosWaveMacHelper const * nqosMac = dynamic_cast (&macHelper); - if (nqosMac == 0) + if (nqosMac == nullptr) { NS_FATAL_ERROR ("the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper" ", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper"); diff --git a/src/wave/model/bsm-application.cc b/src/wave/model/bsm-application.cc index f257e174a..cbaa328c1 100644 --- a/src/wave/model/bsm-application.cc +++ b/src/wave/model/bsm-application.cc @@ -48,16 +48,16 @@ BsmApplication::GetTypeId () } BsmApplication::BsmApplication () - : m_waveBsmStats (0), + : m_waveBsmStats (nullptr), m_txSafetyRangesSq (), m_TotalSimTime (Seconds (10)), m_wavePacketSize (200), m_numWavePackets (1), m_waveInterval (MilliSeconds (100)), m_gpsAccuracyNs (10000), - m_adhocTxInterfaces (0), - m_nodesMoving (0), - m_unirv (0), + m_adhocTxInterfaces (nullptr), + m_nodesMoving (nullptr), + m_unirv (nullptr), m_nodeId (0), m_chAccessMode (0), m_txMaxDelay (MilliSeconds (10)), diff --git a/src/wave/model/channel-scheduler.cc b/src/wave/model/channel-scheduler.cc index d49a16c15..547a065e2 100644 --- a/src/wave/model/channel-scheduler.cc +++ b/src/wave/model/channel-scheduler.cc @@ -164,7 +164,7 @@ void ChannelScheduler::DoDispose () { NS_LOG_FUNCTION (this); - m_device = 0; + m_device = nullptr; } } // namespace ns3 diff --git a/src/wave/model/default-channel-scheduler.cc b/src/wave/model/default-channel-scheduler.cc index 73977f6e1..7f2a33700 100644 --- a/src/wave/model/default-channel-scheduler.cc +++ b/src/wave/model/default-channel-scheduler.cc @@ -75,7 +75,7 @@ DefaultChannelScheduler::DefaultChannelScheduler () m_channelAccess (NoAccess), m_waitChannelNumber (0), m_waitExtend (0), - m_coordinationListener (0) + m_coordinationListener (nullptr) { NS_LOG_FUNCTION (this); } @@ -95,10 +95,10 @@ void DefaultChannelScheduler::DoDispose () { NS_LOG_FUNCTION (this); - m_coordinator = 0; + m_coordinator = nullptr; if (m_coordinationListener) { - m_coordinationListener = 0; + m_coordinationListener = nullptr; } if (!m_waitEvent.IsExpired ()) { @@ -108,7 +108,7 @@ DefaultChannelScheduler::DoDispose () { m_waitEvent.Cancel (); } - m_phy = 0; + m_phy = nullptr; ChannelScheduler::DoDispose (); } diff --git a/src/wave/model/vsa-manager.cc b/src/wave/model/vsa-manager.cc index afb770a82..bd7e776d7 100644 --- a/src/wave/model/vsa-manager.cc +++ b/src/wave/model/vsa-manager.cc @@ -46,7 +46,7 @@ VsaManager::GetTypeId () } VsaManager::VsaManager () - : m_device (0) + : m_device (nullptr) { m_vsaReceived = MakeNullCallback,const Address &, uint32_t, uint32_t> (); } @@ -61,7 +61,7 @@ VsaManager::DoDispose () { NS_LOG_FUNCTION (this); RemoveAll (); - m_device = 0; + m_device = nullptr; } void @@ -199,7 +199,7 @@ VsaManager::RemoveAll () { (*i)->repeat.Cancel (); } - (*i)->vsc = 0; + (*i)->vsc = nullptr; delete (*i); } m_vsas.clear (); @@ -218,7 +218,7 @@ VsaManager::RemoveByChannel (uint32_t channelNumber) { (*i)->repeat.Cancel (); } - (*i)->vsc = 0; + (*i)->vsc = nullptr; delete (*i); i = m_vsas.erase (i); } @@ -243,7 +243,7 @@ VsaManager::RemoveByOrganizationIdentifier (const OrganizationIdentifier &oi) { (*i)->repeat.Cancel (); } - (*i)->vsc = 0; + (*i)->vsc = nullptr; delete (*i); i = m_vsas.erase (i); } diff --git a/src/wave/model/wave-frame-exchange-manager.cc b/src/wave/model/wave-frame-exchange-manager.cc index a516ced2b..fa5d00d31 100644 --- a/src/wave/model/wave-frame-exchange-manager.cc +++ b/src/wave/model/wave-frame-exchange-manager.cc @@ -130,7 +130,7 @@ WaveFrameExchangeManager::StartTransmission (Ptr dcf, uint16_t allowedWidt { NS_LOG_DEBUG ("Queue empty"); m_dcf->NotifyChannelReleased (0); - m_dcf = 0; + m_dcf = nullptr; return false; } @@ -169,8 +169,8 @@ void WaveFrameExchangeManager::DoDispose () { NS_LOG_FUNCTION (this); - m_scheduler = 0; - m_coordinator = 0; + m_scheduler = nullptr; + m_coordinator = nullptr; FrameExchangeManager::DoDispose (); } diff --git a/src/wave/model/wave-net-device.cc b/src/wave/model/wave-net-device.cc index 400cb003f..c6039e7a8 100644 --- a/src/wave/model/wave-net-device.cc +++ b/src/wave/model/wave-net-device.cc @@ -84,7 +84,7 @@ WaveNetDevice::GetTypeId () } WaveNetDevice::WaveNetDevice () - : m_txProfile (0) + : m_txProfile (nullptr) { NS_LOG_FUNCTION (this); } @@ -98,10 +98,10 @@ void WaveNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - if (m_txProfile != 0) + if (m_txProfile != nullptr) { delete m_txProfile; - m_txProfile = 0; + m_txProfile = nullptr; } for (PhyEntitiesI i = m_phyEntities.begin (); i != m_phyEntities.end (); ++i) { @@ -122,10 +122,10 @@ WaveNetDevice::DoDispose () m_channelManager->Dispose (); m_channelScheduler->Dispose (); m_vsaManager->Dispose (); - m_channelCoordinator = 0; - m_channelManager = 0; - m_channelScheduler = 0; - m_vsaManager = 0; + m_channelCoordinator = nullptr; + m_channelManager = nullptr; + m_channelScheduler = nullptr; + m_vsaManager = nullptr; // chain up. WifiNetDevice::DoDispose (); } @@ -305,7 +305,7 @@ bool WaveNetDevice::RegisterTxProfile (const TxProfile & txprofile) { NS_LOG_FUNCTION (this << &txprofile); - if (m_txProfile != 0) + if (m_txProfile != nullptr) { return false; } @@ -354,7 +354,7 @@ WaveNetDevice::DeleteTxProfile (uint32_t channelNumber) { return false; } - if (m_txProfile == 0) + if (m_txProfile == nullptr) { return false; } @@ -364,7 +364,7 @@ WaveNetDevice::DeleteTxProfile (uint32_t channelNumber) } delete m_txProfile; - m_txProfile = 0; + m_txProfile = nullptr; return true; } @@ -599,7 +599,7 @@ bool WaveNetDevice::Send (Ptr packet, const Address& dest, uint16_t protocol) { NS_LOG_FUNCTION (this << packet << dest << protocol); - if (m_txProfile == 0) + if (m_txProfile == nullptr) { NS_LOG_DEBUG ("there is no tx profile registered for transmission"); return false; diff --git a/src/wifi/helper/athstats-helper.cc b/src/wifi/helper/athstats-helper.cc index 6613e41d5..9768c468e 100644 --- a/src/wifi/helper/athstats-helper.cc +++ b/src/wifi/helper/athstats-helper.cc @@ -125,7 +125,7 @@ AthstatsWifiTraceSink::AthstatsWifiTraceSink () m_phyRxOkCount (0), m_phyRxErrorCount (0), m_phyTxCount (0), - m_writer (0) + m_writer (nullptr) { Simulator::ScheduleNow (&AthstatsWifiTraceSink::WriteStats, this); } @@ -134,7 +134,7 @@ AthstatsWifiTraceSink::~AthstatsWifiTraceSink () { NS_LOG_FUNCTION (this); - if (m_writer != 0) + if (m_writer != nullptr) { NS_LOG_LOGIC ("m_writer nonzero " << m_writer); if (m_writer->is_open ()) @@ -147,7 +147,7 @@ AthstatsWifiTraceSink::~AthstatsWifiTraceSink () delete m_writer; NS_LOG_LOGIC ("m_writer = 0"); - m_writer = 0; + m_writer = nullptr; } else { @@ -241,7 +241,7 @@ void AthstatsWifiTraceSink::Open (std::string const &name) { NS_LOG_FUNCTION (this << name); - NS_ABORT_MSG_UNLESS (m_writer == 0, "AthstatsWifiTraceSink::Open (): m_writer already allocated (std::ofstream leak detected)"); + NS_ABORT_MSG_UNLESS (m_writer == nullptr, "AthstatsWifiTraceSink::Open (): m_writer already allocated (std::ofstream leak detected)"); m_writer = new std::ofstream (); NS_ABORT_MSG_UNLESS (m_writer, "AthstatsWifiTraceSink::Open (): Cannot allocate m_writer"); diff --git a/src/wifi/helper/yans-wifi-helper.cc b/src/wifi/helper/yans-wifi-helper.cc index dcb405d0f..dda72c1fe 100644 --- a/src/wifi/helper/yans-wifi-helper.cc +++ b/src/wifi/helper/yans-wifi-helper.cc @@ -52,7 +52,7 @@ Ptr YansWifiChannelHelper::Create () const { Ptr channel = CreateObject (); - Ptr prev = 0; + Ptr prev = nullptr; for (std::vector::const_iterator i = m_propagationLoss.begin (); i != m_propagationLoss.end (); ++i) { Ptr cur = (*i).Create (); @@ -79,7 +79,7 @@ YansWifiChannelHelper::AssignStreams (Ptr c, int64_t stream) YansWifiPhyHelper::YansWifiPhyHelper () : WifiPhyHelper (1), // YANS phy is not used for 11be devices - m_channel (0) + m_channel (nullptr) { m_phy.at (0).SetTypeId ("ns3::YansWifiPhy"); SetInterferenceHelper ("ns3::InterferenceHelper"); diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 4291534eb..0ff8dbe78 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -121,7 +121,7 @@ ApWifiMac::DoDispose () { NS_LOG_FUNCTION (this); m_beaconTxop->Dispose (); - m_beaconTxop = 0; + m_beaconTxop = nullptr; m_enableBeaconGeneration = false; WifiMac::DoDispose (); } @@ -1401,7 +1401,7 @@ ApWifiMac::Receive (Ptr mpdu, uint8_t linkId) { NS_LOG_DEBUG ("Received A-MSDU from=" << from << ", size=" << packet->GetSize ()); DeaggregateAmsduAndForward (mpdu); - packet = 0; + packet = nullptr; } else { diff --git a/src/wifi/model/channel-access-manager.cc b/src/wifi/model/channel-access-manager.cc index 7e23c11ea..cd91c03c7 100644 --- a/src/wifi/model/channel-access-manager.cc +++ b/src/wifi/model/channel-access-manager.cc @@ -112,7 +112,7 @@ ChannelAccessManager::ChannelAccessManager () m_lastSwitchingEnd (MicroSeconds (0)), m_sleeping (false), m_off (false), - m_phyListener (0), + m_phyListener (nullptr), m_linkId (0) { NS_LOG_FUNCTION (this); @@ -123,7 +123,7 @@ ChannelAccessManager::~ChannelAccessManager () { NS_LOG_FUNCTION (this); delete m_phyListener; - m_phyListener = 0; + m_phyListener = nullptr; } void @@ -133,17 +133,17 @@ ChannelAccessManager::DoDispose () for (Ptr i : m_txops) { i->Dispose (); - i = 0; + i = nullptr; } - m_phy = 0; - m_feManager = 0; + m_phy = nullptr; + m_feManager = nullptr; } void ChannelAccessManager::SetupPhyListener (Ptr phy) { NS_LOG_FUNCTION (this << phy); - NS_ASSERT (m_phyListener == 0); + NS_ASSERT (m_phyListener == nullptr); m_phyListener = new PhyListener (this); phy->RegisterListener (m_phyListener); m_phy = phy; @@ -154,12 +154,12 @@ void ChannelAccessManager::RemovePhyListener (Ptr phy) { NS_LOG_FUNCTION (this << phy); - if (m_phyListener != 0) + if (m_phyListener != nullptr) { phy->UnregisterListener (m_phyListener); delete m_phyListener; - m_phyListener = 0; - m_phy = 0; + m_phyListener = nullptr; + m_phy = nullptr; } } diff --git a/src/wifi/model/frame-exchange-manager.cc b/src/wifi/model/frame-exchange-manager.cc index 004861bf9..0bc43bc46 100644 --- a/src/wifi/model/frame-exchange-manager.cc +++ b/src/wifi/model/frame-exchange-manager.cc @@ -77,9 +77,9 @@ FrameExchangeManager::Reset () m_navResetEvent.Cancel (); } m_navEnd = Simulator::Now (); - m_mpdu = 0; + m_mpdu = nullptr; m_txParams.Clear (); - m_dcf = 0; + m_dcf = nullptr; } void @@ -87,19 +87,19 @@ FrameExchangeManager::DoDispose () { NS_LOG_FUNCTION (this); Reset (); - m_fragmentedPacket = 0; - m_mac = 0; - m_txMiddle = 0; - m_rxMiddle = 0; - m_channelAccessManager = 0; - m_protectionManager = 0; - m_ackManager = 0; + m_fragmentedPacket = nullptr; + m_mac = nullptr; + m_txMiddle = nullptr; + m_rxMiddle = nullptr; + m_channelAccessManager = nullptr; + m_protectionManager = nullptr; + m_ackManager = nullptr; if (m_phy) { m_phy->TraceDisconnectWithoutContext ("PhyRxPayloadBegin", MakeCallback (&FrameExchangeManager::RxStartIndication, this)); } - m_phy = 0; + m_phy = nullptr; Object::DoDispose (); } @@ -316,7 +316,7 @@ FrameExchangeManager::StartTransmission (Ptr dcf, uint16_t allowedWidth) { NS_LOG_DEBUG ("Queue empty"); m_dcf->NotifyChannelReleased (m_linkId); - m_dcf = 0; + m_dcf = nullptr; return false; } @@ -472,7 +472,7 @@ FrameExchangeManager::SendMpdu () if (m_txParams.m_acknowledgment->method == WifiAcknowledgment::NONE) { // we are done with frames that do not require acknowledgment - m_mpdu = 0; + m_mpdu = nullptr; } } @@ -798,7 +798,7 @@ FrameExchangeManager::TransmissionSucceeded () else { m_dcf->NotifyChannelReleased (m_linkId); - m_dcf = 0; + m_dcf = nullptr; } } @@ -808,7 +808,7 @@ FrameExchangeManager::TransmissionFailed () NS_LOG_FUNCTION (this); // A non-QoS station always releases the channel upon a transmission failure m_dcf->NotifyChannelReleased (m_linkId); - m_dcf = 0; + m_dcf = nullptr; } void @@ -835,7 +835,7 @@ FrameExchangeManager::NormalAckTimeout (Ptr mpdu, const WifiTxVector& m_dcf->UpdateFailedCw (m_linkId); } - m_mpdu = 0; + m_mpdu = nullptr; TransmissionFailed (); } @@ -1152,7 +1152,7 @@ FrameExchangeManager::ReceiveMpdu (Ptr mpdu, RxSignalInfo rxSign SnrTag tag; mpdu->GetPacket ()->PeekPacketTag (tag); ReceivedNormalAck (m_mpdu, m_txParams.m_txVector, txVector, rxSignalInfo, tag.Get ()); - m_mpdu = 0; + m_mpdu = nullptr; } } else if (hdr.IsMgt ()) diff --git a/src/wifi/model/he/he-frame-exchange-manager.cc b/src/wifi/model/he/he-frame-exchange-manager.cc index 21958cf15..50ae610d1 100644 --- a/src/wifi/model/he/he-frame-exchange-manager.cc +++ b/src/wifi/model/he/he-frame-exchange-manager.cc @@ -85,11 +85,11 @@ void HeFrameExchangeManager::DoDispose () { NS_LOG_FUNCTION (this); - m_apMac = 0; - m_staMac = 0; + m_apMac = nullptr; + m_staMac = nullptr; m_psduMap.clear (); m_txParams.Clear (); - m_muScheduler = 0; + m_muScheduler = nullptr; m_multiStaBaEvent.Cancel (); VhtFrameExchangeManager::DoDispose (); } diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index 8a9a2707a..159f0f6c1 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -52,7 +52,7 @@ HePpdu::HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, ui NS_LOG_FUNCTION (this << psdus << txVector << txCenterFreq << ppduDuration << band << uid << flag); //overwrite with map (since only first element used by OfdmPpdu) - m_psdus.begin ()->second = 0; + m_psdus.begin ()->second = nullptr; m_psdus.clear (); m_psdus = psdus; if (txVector.IsMu ()) diff --git a/src/wifi/model/he/multi-user-scheduler.cc b/src/wifi/model/he/multi-user-scheduler.cc index 017c23529..ae9fafaa7 100644 --- a/src/wifi/model/he/multi-user-scheduler.cc +++ b/src/wifi/model/he/multi-user-scheduler.cc @@ -85,9 +85,9 @@ void MultiUserScheduler::DoDispose () { NS_LOG_FUNCTION (this); - m_apMac = 0; - m_heFem = 0; - m_edca = 0; + m_apMac = nullptr; + m_heFem = nullptr; + m_edca = nullptr; m_dlInfo.psduMap.clear (); m_dlInfo.txParams.Clear (); m_ulInfo.txParams.Clear (); diff --git a/src/wifi/model/he/obss-pd-algorithm.cc b/src/wifi/model/he/obss-pd-algorithm.cc index d42306db0..348a4e6cc 100644 --- a/src/wifi/model/he/obss-pd-algorithm.cc +++ b/src/wifi/model/he/obss-pd-algorithm.cc @@ -74,7 +74,7 @@ void ObssPdAlgorithm::DoDispose () { NS_LOG_FUNCTION (this); - m_device = 0; + m_device = nullptr; } void diff --git a/src/wifi/model/ht/ht-frame-exchange-manager.cc b/src/wifi/model/ht/ht-frame-exchange-manager.cc index a01e2f2d4..cfe6ce8eb 100644 --- a/src/wifi/model/ht/ht-frame-exchange-manager.cc +++ b/src/wifi/model/ht/ht-frame-exchange-manager.cc @@ -69,9 +69,9 @@ HtFrameExchangeManager::DoDispose () m_agreements.clear (); m_pendingAgreements.clear (); m_pendingAddBaResp.clear (); - m_msduAggregator = 0; - m_mpduAggregator = 0; - m_psdu = 0; + m_msduAggregator = nullptr; + m_mpduAggregator = nullptr; + m_psdu = nullptr; m_txParams.Clear (); QosFrameExchangeManager::DoDispose (); } @@ -885,7 +885,7 @@ HtFrameExchangeManager::SendPsdu () if (m_txParams.m_acknowledgment->method == WifiAcknowledgment::NONE) { // we are done in case the A-MPDU does not require acknowledgment - m_psdu = 0; + m_psdu = nullptr; } } @@ -1161,7 +1161,7 @@ HtFrameExchangeManager::BlockAckTimeout (Ptr psdu, const WifiTxVector& m_edca->UpdateFailedCw (m_linkId); } - m_psdu = 0; + m_psdu = nullptr; TransmissionFailed (); } @@ -1366,7 +1366,7 @@ HtFrameExchangeManager::ReceiveMpdu (Ptr mpdu, RxSignalInfo rxSi // Reset the CW m_edca->ResetCw (m_linkId); - m_psdu = 0; + m_psdu = nullptr; TransmissionSucceeded (); } else if (hdr.IsBlockAckReq ()) diff --git a/src/wifi/model/interference-helper.cc b/src/wifi/model/interference-helper.cc index 1902cdae9..3b83f6b35 100644 --- a/src/wifi/model/interference-helper.cc +++ b/src/wifi/model/interference-helper.cc @@ -51,7 +51,7 @@ Event::Event (Ptr ppdu, const WifiTxVector& txVector, Time durat Event::~Event () { - m_ppdu = 0; + m_ppdu = nullptr; m_rxPowerW.clear (); } @@ -149,7 +149,7 @@ InterferenceHelper::NiChange::NiChange (double power, Ptr event) InterferenceHelper::NiChange::~NiChange () { - m_event = 0; + m_event = nullptr; } double @@ -176,7 +176,7 @@ InterferenceHelper::NiChange::GetEvent () const ****************************************************************/ InterferenceHelper::InterferenceHelper () - : m_errorRateModel (0), + : m_errorRateModel (nullptr), m_numRxAntennas (1), m_rxing (false) { @@ -204,7 +204,7 @@ InterferenceHelper::DoDispose () { NS_LOG_FUNCTION (this); RemoveBands (); - m_errorRateModel = 0; + m_errorRateModel = nullptr; } Ptr @@ -249,7 +249,7 @@ InterferenceHelper::AddBand (WifiSpectrumBand band) auto result = m_niChangesPerBand.insert ({band, niChanges}); NS_ASSERT (result.second); // Always have a zero power noise event in the list - AddNiChangeEvent (Time (0), NiChange (0.0, 0), result.first); + AddNiChangeEvent (Time (0), NiChange (0.0, nullptr), result.first); m_firstPowerPerBand.insert ({band, 0.0}); } @@ -625,7 +625,7 @@ InterferenceHelper::EraseEvents () { niIt->second.clear (); // Always have a zero power noise event in the list - AddNiChangeEvent (Time (0), NiChange (0.0, 0), niIt); + AddNiChangeEvent (Time (0), NiChange (0.0, nullptr), niIt); m_firstPowerPerBand.at (niIt->first) = 0.0; } m_rxing = false; diff --git a/src/wifi/model/mac-rx-middle.cc b/src/wifi/model/mac-rx-middle.cc index 81a35cef0..b23501183 100644 --- a/src/wifi/model/mac-rx-middle.cc +++ b/src/wifi/model/mac-rx-middle.cc @@ -200,7 +200,7 @@ MacRxMiddle::Lookup (const WifiMacHeader *hdr) { /* only for QoS data non-broadcast frames */ originator = m_qosOriginatorStatus[std::make_pair (source, hdr->GetQosTid ())]; - if (originator == 0) + if (originator == nullptr) { originator = new OriginatorRxStatus (); m_qosOriginatorStatus[std::make_pair (source, hdr->GetQosTid ())] = originator; @@ -214,7 +214,7 @@ MacRxMiddle::Lookup (const WifiMacHeader *hdr) * see section 7.1.3.4.1 */ originator = m_originatorStatus[source]; - if (originator == 0) + if (originator == nullptr) { originator = new OriginatorRxStatus (); m_originatorStatus[source] = originator; @@ -257,7 +257,7 @@ MacRxMiddle::HandleFragments (Ptr packet, const WifiMacHeader *hdr { NS_LOG_DEBUG ("non-ordered fragment"); } - return 0; + return nullptr; } else { @@ -273,7 +273,7 @@ MacRxMiddle::HandleFragments (Ptr packet, const WifiMacHeader *hdr else { NS_LOG_DEBUG ("non-ordered fragment"); - return 0; + return nullptr; } } } @@ -286,7 +286,7 @@ MacRxMiddle::HandleFragments (Ptr packet, const WifiMacHeader *hdr ", size=" << packet->GetSize ()); originator->AccumulateFirstFragment (packet); originator->SetSequenceControl (hdr->GetSequenceControl ()); - return 0; + return nullptr; } else { diff --git a/src/wifi/model/mpdu-aggregator.cc b/src/wifi/model/mpdu-aggregator.cc index 576b1b8c5..70c984472 100644 --- a/src/wifi/model/mpdu-aggregator.cc +++ b/src/wifi/model/mpdu-aggregator.cc @@ -66,7 +66,7 @@ MpduAggregator::~MpduAggregator () void MpduAggregator::DoDispose () { - m_mac = 0; + m_mac = nullptr; Object::DoDispose (); } @@ -223,7 +223,7 @@ MpduAggregator::GetNextAmpdu (Ptr mpdu, WifiTxParameters& txParams, // If allowed by the BA agreement, get the next MPDU auto peekedMpdu = qosTxop->PeekNextMpdu (SINGLE_LINK_OP_ID, tid, recipient, nextMpdu); - nextMpdu = 0; + nextMpdu = nullptr; if (peekedMpdu) { diff --git a/src/wifi/model/msdu-aggregator.cc b/src/wifi/model/msdu-aggregator.cc index f1695188d..3b397b9d9 100644 --- a/src/wifi/model/msdu-aggregator.cc +++ b/src/wifi/model/msdu-aggregator.cc @@ -60,8 +60,8 @@ MsduAggregator::~MsduAggregator () void MsduAggregator::DoDispose () { - m_mac = 0; - m_htFem = 0; + m_mac = nullptr; + m_htFem = nullptr; Object::DoDispose (); } diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index 00567febe..c0fa3a976 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -694,7 +694,7 @@ PhyEntity::DoEndReceivePayload (Ptr ppdu) NS_ASSERT (m_wifiPhy->GetLastRxEndTime () == Simulator::Now ()); NotifyInterferenceRxEndAndClear (false); //don't reset WifiPhy - m_wifiPhy->m_currentEvent = 0; + m_wifiPhy->m_currentEvent = nullptr; m_wifiPhy->m_currentPreambleEvents.clear (); m_endRxPayloadEvents.clear (); } @@ -910,7 +910,7 @@ PhyEntity::EndPreambleDetectionPeriod (Ptr event) //Do not erase events if there are still pending preamble events to be processed m_wifiPhy->m_interference->NotifyRxEnd (Simulator::Now ()); } - m_wifiPhy->m_currentEvent = 0; + m_wifiPhy->m_currentEvent = nullptr; //Cancel preamble reception m_wifiPhy->m_endPhyRxEvent.Cancel (); } @@ -1003,7 +1003,7 @@ PhyEntity::ResetReceive (Ptr event) m_wifiPhy->m_interference->NotifyRxEnd (Simulator::Now ()); NS_ASSERT (m_endRxPayloadEvents.size () == 1 && m_endRxPayloadEvents.front ().IsExpired ()); m_endRxPayloadEvents.clear (); - m_wifiPhy->m_currentEvent = 0; + m_wifiPhy->m_currentEvent = nullptr; m_wifiPhy->m_currentPreambleEvents.clear (); m_wifiPhy->SwitchMaybeToCcaBusy (event->GetPpdu ()); } diff --git a/src/wifi/model/qos-frame-exchange-manager.cc b/src/wifi/model/qos-frame-exchange-manager.cc index 9a8977137..5eab06c8d 100644 --- a/src/wifi/model/qos-frame-exchange-manager.cc +++ b/src/wifi/model/qos-frame-exchange-manager.cc @@ -72,8 +72,8 @@ void QosFrameExchangeManager::DoDispose () { NS_LOG_FUNCTION (this); - m_edca = 0; - m_edcaBackingOff = 0; + m_edca = nullptr; + m_edcaBackingOff = nullptr; m_pifsRecoveryEvent.Cancel (); FrameExchangeManager::DoDispose (); } @@ -110,7 +110,7 @@ QosFrameExchangeManager::SendCfEndIfNeeded () } m_edca->NotifyChannelReleased (m_linkId); - m_edca = 0; + m_edca = nullptr; return false; } @@ -126,7 +126,7 @@ QosFrameExchangeManager::PifsRecovery () > Simulator::Now () - m_phy->GetPifs ()) { m_edca->NotifyChannelReleased (m_linkId); - m_edca = 0; + m_edca = nullptr; } else { @@ -162,7 +162,7 @@ QosFrameExchangeManager::StartTransmission (Ptr edca, uint16_t allowedWidt // TODO This will become an assert once no Txop is installed on a QoS station if (!edca->IsQosTxop ()) { - m_edca = 0; + m_edca = nullptr; return FrameExchangeManager::StartTransmission (edca, allowedWidth); } @@ -202,7 +202,7 @@ QosFrameExchangeManager::StartTransmission (Ptr edca, Time txopDuration NS_ASSERT (!m_initialFrame); // clear the member variable - m_edcaBackingOff = 0; + m_edcaBackingOff = nullptr; } if (m_edca->GetTxopLimit (m_linkId).IsStrictlyPositive ()) @@ -228,7 +228,7 @@ QosFrameExchangeManager::StartTransmission (Ptr edca, Time txopDuration // TXOP not even started, return false NS_LOG_DEBUG ("No frame transmitted"); m_edca->NotifyChannelReleased (m_linkId); - m_edca = 0; + m_edca = nullptr; return false; } @@ -255,7 +255,7 @@ QosFrameExchangeManager::StartTransmission (Ptr edca, Time txopDuration NS_LOG_DEBUG ("No frame transmitted"); m_edca->NotifyChannelReleased (m_linkId); - m_edca = 0; + m_edca = nullptr; return false; } @@ -559,7 +559,7 @@ QosFrameExchangeManager::TransmissionSucceeded () else { m_edca->NotifyChannelReleased (m_linkId); - m_edca = 0; + m_edca = nullptr; } m_initialFrame = false; } @@ -582,7 +582,7 @@ QosFrameExchangeManager::TransmissionFailed () // of an MPDU in the initial PPDU of a TXOP fails (Sec. 10.22.2.2 of 802.11-2016) NS_LOG_DEBUG ("TX of the initial frame of a TXOP failed: terminate TXOP"); m_edca->NotifyChannelReleased (m_linkId); - m_edca = 0; + m_edca = nullptr; } else { @@ -608,7 +608,7 @@ QosFrameExchangeManager::TransmissionFailed () NS_LOG_DEBUG ("TX of a non-initial frame of a TXOP failed: invoke backoff"); m_edca->Txop::NotifyChannelReleased (m_linkId); m_edcaBackingOff = m_edca; - m_edca = 0; + m_edca = nullptr; } } m_initialFrame = false; diff --git a/src/wifi/model/qos-txop.cc b/src/wifi/model/qos-txop.cc index c964f638d..d02739ea3 100644 --- a/src/wifi/model/qos-txop.cc +++ b/src/wifi/model/qos-txop.cc @@ -116,8 +116,8 @@ QosTxop::DoDispose () { m_baManager->Dispose (); } - m_baManager = 0; - m_qosBlockedDestinations = 0; + m_baManager = nullptr; + m_qosBlockedDestinations = nullptr; Txop::DoDispose (); } diff --git a/src/wifi/model/recipient-block-ack-agreement.cc b/src/wifi/model/recipient-block-ack-agreement.cc index abb696bb0..b6b23584c 100644 --- a/src/wifi/model/recipient-block-ack-agreement.cc +++ b/src/wifi/model/recipient-block-ack-agreement.cc @@ -61,7 +61,7 @@ RecipientBlockAckAgreement::~RecipientBlockAckAgreement () { NS_LOG_FUNCTION_NOARGS (); m_bufferedMpdus.clear (); - m_rxMiddle = 0; + m_rxMiddle = nullptr; } void diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index 943ce13e4..6c62a25d6 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -91,10 +91,10 @@ void SpectrumWifiPhy::DoDispose () { NS_LOG_FUNCTION (this); - m_channel = 0; - m_wifiSpectrumPhyInterface = 0; - m_antenna = 0; - m_rxSpectrumModel = 0; + m_channel = nullptr; + m_wifiSpectrumPhyInterface = nullptr; + m_antenna = nullptr; + m_rxSpectrumModel = nullptr; m_ruBands.clear (); WifiPhy::DoDispose (); } @@ -128,7 +128,7 @@ SpectrumWifiPhy::GetRxSpectrumModel () if (GetFrequency () == 0) { NS_LOG_DEBUG ("Frequency is not set; returning 0"); - return 0; + return nullptr; } else { diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index 99e25ead6..53047c0c4 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -824,7 +824,7 @@ StaWifiMac::Receive (Ptr mpdu, uint8_t linkId) { NS_ASSERT (hdr->GetAddr3 () == GetBssid (0)); // TODO use appropriate linkId DeaggregateAmsduAndForward (mpdu); - packet = 0; + packet = nullptr; } else { diff --git a/src/wifi/model/table-based-error-rate-model.cc b/src/wifi/model/table-based-error-rate-model.cc index dde5e3e29..af6541286 100644 --- a/src/wifi/model/table-based-error-rate-model.cc +++ b/src/wifi/model/table-based-error-rate-model.cc @@ -69,7 +69,7 @@ TableBasedErrorRateModel::TableBasedErrorRateModel () TableBasedErrorRateModel::~TableBasedErrorRateModel () { NS_LOG_FUNCTION (this); - m_fallbackErrorModel = 0; + m_fallbackErrorModel = nullptr; } diff --git a/src/wifi/model/txop.cc b/src/wifi/model/txop.cc index e61fea080..2dded6595 100644 --- a/src/wifi/model/txop.cc +++ b/src/wifi/model/txop.cc @@ -142,10 +142,10 @@ void Txop::DoDispose () { NS_LOG_FUNCTION (this); - m_queue = 0; - m_mac = 0; - m_rng = 0; - m_txMiddle = 0; + m_queue = nullptr; + m_mac = nullptr; + m_rng = nullptr; + m_txMiddle = nullptr; m_links.clear (); } diff --git a/src/wifi/model/wifi-ack-manager.cc b/src/wifi/model/wifi-ack-manager.cc index 0b383fcdd..bc562187d 100644 --- a/src/wifi/model/wifi-ack-manager.cc +++ b/src/wifi/model/wifi-ack-manager.cc @@ -55,7 +55,7 @@ void WifiAckManager::DoDispose () { NS_LOG_FUNCTION (this); - m_mac = 0; + m_mac = nullptr; Object::DoDispose (); } diff --git a/src/wifi/model/wifi-information-element-vector.cc b/src/wifi/model/wifi-information-element-vector.cc index db4c70138..493bcfc78 100644 --- a/src/wifi/model/wifi-information-element-vector.cc +++ b/src/wifi/model/wifi-information-element-vector.cc @@ -33,7 +33,7 @@ WifiInformationElementVector::~WifiInformationElementVector () { for (IE_VECTOR::iterator i = m_elements.begin (); i != m_elements.end (); i++) { - *i = 0; + *i = nullptr; } m_elements.clear (); } @@ -164,7 +164,7 @@ WifiInformationElementVector::FindFirst (WifiInformationElementId id) const return (*i); } } - return 0; + return nullptr; } uint32_t diff --git a/src/wifi/model/wifi-mac.cc b/src/wifi/model/wifi-mac.cc index e73351dea..76453fec1 100644 --- a/src/wifi/model/wifi-mac.cc +++ b/src/wifi/model/wifi-mac.cc @@ -339,23 +339,23 @@ WifiMac::DoDispose () { NS_LOG_FUNCTION (this); - m_rxMiddle = 0; - m_txMiddle = 0; + m_rxMiddle = nullptr; + m_txMiddle = nullptr; m_links.clear (); if (m_txop) { m_txop->Dispose (); } - m_txop = 0; + m_txop = nullptr; for (auto it = m_edca.begin (); it != m_edca.end (); ++it) { it->second->Dispose (); - it->second = 0; + it->second = nullptr; } - m_device = 0; + m_device = nullptr; if (m_scheduler != nullptr) { m_scheduler->Dispose (); diff --git a/src/wifi/model/wifi-net-device.cc b/src/wifi/model/wifi-net-device.cc index 9eab8a7b1..6516fc7da 100644 --- a/src/wifi/model/wifi-net-device.cc +++ b/src/wifi/model/wifi-net-device.cc @@ -123,11 +123,11 @@ void WifiNetDevice::DoDispose () { NS_LOG_FUNCTION_NOARGS (); - m_node = 0; + m_node = nullptr; if (m_mac) { m_mac->Dispose (); - m_mac = 0; + m_mac = nullptr; } for (auto& phy : m_phys) { @@ -150,22 +150,22 @@ WifiNetDevice::DoDispose () if (m_htConfiguration) { m_htConfiguration->Dispose (); - m_htConfiguration = 0; + m_htConfiguration = nullptr; } if (m_vhtConfiguration) { m_vhtConfiguration->Dispose (); - m_vhtConfiguration = 0; + m_vhtConfiguration = nullptr; } if (m_heConfiguration) { m_heConfiguration->Dispose (); - m_heConfiguration = 0; + m_heConfiguration = nullptr; } if (m_ehtConfiguration) { m_ehtConfiguration->Dispose (); - m_ehtConfiguration = 0; + m_ehtConfiguration = nullptr; } NetDevice::DoDispose (); } diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 9a46ea2c9..ce570c62b 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -331,7 +331,7 @@ WifiPhy::WifiPhy () m_rxMpduReferenceNumber (0xffffffff), m_endPhyRxEvent (), m_endTxEvent (), - m_currentEvent (0), + m_currentEvent (nullptr), m_previouslyRxPpduUid (UINT64_MAX), m_standard (WIFI_STANDARD_UNSPECIFIED), m_band (WIFI_PHY_BAND_UNSPECIFIED), @@ -344,7 +344,7 @@ WifiPhy::WifiPhy () m_channelAccessRequested (false), m_txSpatialStreams (1), m_rxSpatialStreams (1), - m_wifiRadioEnergyModel (0), + m_wifiRadioEnergyModel (nullptr), m_timeLastPreambleDetected (Seconds (0)) { NS_LOG_FUNCTION (this); @@ -367,29 +367,29 @@ WifiPhy::DoDispose () { phyEntity.second->CancelAllEvents (); } - m_device = 0; - m_mobility = 0; - m_frameCaptureModel = 0; - m_preambleDetectionModel = 0; - m_wifiRadioEnergyModel = 0; - m_postReceptionErrorModel = 0; + m_device = nullptr; + m_mobility = nullptr; + m_frameCaptureModel = nullptr; + m_preambleDetectionModel = nullptr; + m_wifiRadioEnergyModel = nullptr; + m_postReceptionErrorModel = nullptr; if (m_interference) { m_interference->Dispose (); } - m_interference = 0; - m_random = 0; - m_state = 0; - m_currentEvent = 0; + m_interference = nullptr; + m_random = nullptr; + m_state = nullptr; + m_currentEvent = nullptr; for (auto & preambleEvent : m_currentPreambleEvents) { - preambleEvent.second = 0; + preambleEvent.second = nullptr; } m_currentPreambleEvents.clear (); for (auto & phyEntity : m_phyEntities) { - phyEntity.second = 0; + phyEntity.second = nullptr; } m_phyEntities.clear (); } @@ -1033,7 +1033,7 @@ WifiPhy::GetDelayUntilChannelSwitch () { m_powerRestricted = false; m_channelAccessRequested = false; - m_currentEvent = 0; + m_currentEvent = nullptr; m_currentPreambleEvents.clear (); if (!IsInitialized ()) { @@ -1674,7 +1674,7 @@ WifiPhy::Reset () { NS_LOG_FUNCTION (this); m_currentPreambleEvents.clear (); - m_currentEvent = 0; + m_currentEvent = nullptr; for (auto & phyEntity : m_phyEntities) { phyEntity.second->CancelAllEvents (); @@ -1962,7 +1962,7 @@ WifiPhy::AbortCurrentReception (WifiPhyRxfailureReason reason) break; } } - m_currentEvent = 0; + m_currentEvent = nullptr; } } diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index f939f23f3..21823a7a8 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -56,7 +56,7 @@ WifiPpdu::~WifiPpdu () { for (auto & psdu : m_psdus) { - psdu.second = 0; + psdu.second = nullptr; } m_psdus.clear (); } diff --git a/src/wifi/model/wifi-protection-manager.cc b/src/wifi/model/wifi-protection-manager.cc index 32915a892..5603b6702 100644 --- a/src/wifi/model/wifi-protection-manager.cc +++ b/src/wifi/model/wifi-protection-manager.cc @@ -54,7 +54,7 @@ void WifiProtectionManager::DoDispose () { NS_LOG_FUNCTION (this); - m_mac = 0; + m_mac = nullptr; Object::DoDispose (); } diff --git a/src/wifi/model/wifi-radio-energy-model.cc b/src/wifi/model/wifi-radio-energy-model.cc index dd19bd032..275a5ba62 100644 --- a/src/wifi/model/wifi-radio-energy-model.cc +++ b/src/wifi/model/wifi-radio-energy-model.cc @@ -87,7 +87,7 @@ WifiRadioEnergyModel::GetTypeId () } WifiRadioEnergyModel::WifiRadioEnergyModel () - : m_source (0), + : m_source (nullptr), m_currentState (WifiPhyState::IDLE), m_lastUpdateTime (Seconds (0.0)), m_nPendingChangeState (0) @@ -104,7 +104,7 @@ WifiRadioEnergyModel::WifiRadioEnergyModel () WifiRadioEnergyModel::~WifiRadioEnergyModel () { NS_LOG_FUNCTION (this); - m_txCurrentModel = 0; + m_txCurrentModel = nullptr; delete m_listener; } @@ -390,7 +390,7 @@ void WifiRadioEnergyModel::DoDispose () { NS_LOG_FUNCTION (this); - m_source = NULL; + m_source = nullptr; m_energyDepletionCallback.Nullify (); } diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index 6e046786b..2b2c4972a 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -1294,10 +1294,10 @@ WifiRemoteStationManager::LookupState (Mac48Address address) const state->m_dsssSupported = false; state->m_erpOfdmSupported = false; state->m_ofdmSupported = false; - state->m_htCapabilities = 0; - state->m_vhtCapabilities = 0; - state->m_heCapabilities = 0; - state->m_ehtCapabilities = 0; + state->m_htCapabilities = nullptr; + state->m_vhtCapabilities = nullptr; + state->m_heCapabilities = nullptr; + state->m_ehtCapabilities = nullptr; state->m_channelWidth = m_wifiPhy->GetChannelWidth (); state->m_guardInterval = GetGuardInterval (); state->m_ness = 0; diff --git a/src/wifi/model/wifi-spectrum-phy-interface.cc b/src/wifi/model/wifi-spectrum-phy-interface.cc index be298a991..8a4570066 100644 --- a/src/wifi/model/wifi-spectrum-phy-interface.cc +++ b/src/wifi/model/wifi-spectrum-phy-interface.cc @@ -49,9 +49,9 @@ void WifiSpectrumPhyInterface::DoDispose () { NS_LOG_FUNCTION (this); - m_spectrumWifiPhy = 0; - m_netDevice = 0; - m_channel = 0; + m_spectrumWifiPhy = nullptr; + m_netDevice = nullptr; + m_channel = nullptr; } void WifiSpectrumPhyInterface::SetSpectrumWifiPhy (const Ptr spectrumWifiPhy) diff --git a/src/wifi/model/wifi-tx-timer.cc b/src/wifi/model/wifi-tx-timer.cc index 47d27cd11..21cab45ec 100644 --- a/src/wifi/model/wifi-tx-timer.cc +++ b/src/wifi/model/wifi-tx-timer.cc @@ -40,7 +40,7 @@ WifiTxTimer::WifiTxTimer () WifiTxTimer::~WifiTxTimer () { m_timeoutEvent.Cancel (); - m_impl = 0; + m_impl = nullptr; } void @@ -128,7 +128,7 @@ WifiTxTimer::Cancel () { NS_LOG_FUNCTION (this << GetReasonString (m_reason)); m_timeoutEvent.Cancel (); - m_impl = 0; + m_impl = nullptr; } Time diff --git a/src/wifi/model/yans-wifi-phy.cc b/src/wifi/model/yans-wifi-phy.cc index 2637e7992..42ca68e13 100644 --- a/src/wifi/model/yans-wifi-phy.cc +++ b/src/wifi/model/yans-wifi-phy.cc @@ -67,7 +67,7 @@ void YansWifiPhy::DoDispose () { NS_LOG_FUNCTION (this); - m_channel = 0; + m_channel = nullptr; WifiPhy::DoDispose (); } diff --git a/src/wifi/test/channel-access-manager-test.cc b/src/wifi/test/channel-access-manager-test.cc index 08c21a739..871e0b96f 100644 --- a/src/wifi/test/channel-access-manager-test.cc +++ b/src/wifi/test/channel-access-manager-test.cc @@ -415,7 +415,7 @@ template void TxopTest::DoDispose () { - m_test = 0; + m_test = nullptr; TxopType::DoDispose (); } @@ -615,15 +615,15 @@ ChannelAccessManagerTest::EndTest () NS_TEST_EXPECT_MSG_EQ (state->m_expectedInternalCollision.empty (), true, "Have no internal collisions"); NS_TEST_EXPECT_MSG_EQ (state->m_expectedBackoff.empty (), true, "Have no expected backoffs"); state->Dispose (); - state = 0; + state = nullptr; } m_txop.clear (); m_ChannelAccessManager->RemovePhyListener (m_phy); m_phy->Dispose (); m_ChannelAccessManager->Dispose (); - m_ChannelAccessManager = 0; - m_feManager = 0; + m_ChannelAccessManager = nullptr; + m_feManager = nullptr; Simulator::Destroy (); } diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index c758b6f7f..61f936364 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -137,7 +137,7 @@ SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts) Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, GUARD_WIDTH); Ptr txParams = Create (); txParams->psd = txPowerSpectrum; - txParams->txPhy = 0; + txParams->txPhy = nullptr; txParams->duration = txDuration; txParams->ppdu = ppdu; @@ -190,7 +190,7 @@ void SpectrumWifiPhyBasicTest::DoTeardown () { m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; } // Test that the expected number of packet receptions occur. @@ -407,8 +407,8 @@ SpectrumWifiPhyFilterTest::SendPpdu () SpectrumWifiPhyFilterTest::~SpectrumWifiPhyFilterTest () { - m_txPhy = 0; - m_rxPhy = 0; + m_txPhy = nullptr; + m_rxPhy = nullptr; } void @@ -509,9 +509,9 @@ void SpectrumWifiPhyFilterTest::DoTeardown () { m_txPhy->Dispose (); - m_txPhy = 0; + m_txPhy = nullptr; m_rxPhy->Dispose (); - m_rxPhy = 0; + m_rxPhy = nullptr; } void diff --git a/src/wifi/test/wifi-aggregation-test.cc b/src/wifi/test/wifi-aggregation-test.cc index 0599835d0..888fb6abb 100644 --- a/src/wifi/test/wifi-aggregation-test.cc +++ b/src/wifi/test/wifi-aggregation-test.cc @@ -309,12 +309,12 @@ AmpduAggregationTest::DoRun () Simulator::Destroy (); m_manager->Dispose (); - m_manager = 0; + m_manager = nullptr; m_device->Dispose (); - m_device = 0; + m_device = nullptr; - htConfiguration = 0; + htConfiguration = nullptr; } /** @@ -543,8 +543,8 @@ TwoLevelAggregationTest::DoRun () Simulator::Destroy (); m_device->Dispose (); - m_device = 0; - htConfiguration = 0; + m_device = nullptr; + htConfiguration = nullptr; } /** @@ -710,14 +710,14 @@ HeAggregationTest::DoRunSubTest (uint16_t bufferSize) Simulator::Destroy (); m_manager->Dispose (); - m_manager = 0; + m_manager = nullptr; m_device->Dispose (); - m_device = 0; + m_device = nullptr; - htConfiguration = 0; - vhtConfiguration = 0; - heConfiguration = 0; + htConfiguration = nullptr; + vhtConfiguration = nullptr; + heConfiguration = nullptr; } void diff --git a/src/wifi/test/wifi-phy-cca-test.cc b/src/wifi/test/wifi-phy-cca-test.cc index 83afdb93d..9d73c2817 100644 --- a/src/wifi/test/wifi-phy-cca-test.cc +++ b/src/wifi/test/wifi-phy-cca-test.cc @@ -228,7 +228,7 @@ void WifiPhyCcaThresholdsTest::DoTeardown () { m_device->Dispose (); - m_device = 0; + m_device = nullptr; } void diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index e40b58b3e..aa55137a7 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -243,7 +243,7 @@ OfdmaSpectrumWifiPhy::DoInitialize () void OfdmaSpectrumWifiPhy::DoDispose () { - m_ofdmTestHePhy = 0; + m_ofdmTestHePhy = nullptr; SpectrumWifiPhy::DoDispose (); } @@ -739,15 +739,15 @@ void TestDlOfdmaPhyTransmission::DoTeardown () { m_phyAp->Dispose (); - m_phyAp = 0; + m_phyAp = nullptr; m_phySta1->Dispose (); - m_phySta1 = 0; + m_phySta1 = nullptr; m_phySta2->Dispose (); - m_phySta2 = 0; + m_phySta2 = nullptr; m_phySta3->Dispose (); - m_phySta3 = 0; + m_phySta3 = nullptr; m_phyInterferer->Dispose (); - m_phyInterferer = 0; + m_phyInterferer = nullptr; } void @@ -1340,13 +1340,13 @@ void TestDlOfdmaPhyPuncturing::DoTeardown () { m_phyAp->Dispose (); - m_phyAp = 0; + m_phyAp = nullptr; m_phySta1->Dispose (); - m_phySta1 = 0; + m_phySta1 = nullptr; m_phySta2->Dispose (); - m_phySta2 = 0; + m_phySta2 = nullptr; m_phyInterferer->Dispose (); - m_phyInterferer = 0; + m_phyInterferer = nullptr; } void @@ -1617,11 +1617,11 @@ void TestUlOfdmaPpduUid::DoTeardown () { m_phyAp->Dispose (); - m_phyAp = 0; + m_phyAp = nullptr; m_phySta1->Dispose (); - m_phySta1 = 0; + m_phySta1 = nullptr; m_phySta2->Dispose (); - m_phySta2 = 0; + m_phySta2 = nullptr; } void @@ -1997,7 +1997,7 @@ TestMultipleHeTbPreambles::RxHeTbPpdu (uint64_t uid, uint16_t staId, double txPo Ptr rxPsd = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFrequency, channelWidth, txPowerWatts, m_phy->GetGuardBandwidth (channelWidth)); Ptr rxParams = Create (); rxParams->psd = rxPsd; - rxParams->txPhy = 0; + rxParams->txPhy = nullptr; rxParams->duration = nonOfdmaDuration; rxParams->ppdu = ppdu; @@ -2016,7 +2016,7 @@ TestMultipleHeTbPreambles::RxHeTbPpdu (uint64_t uid, uint16_t staId, double txPo Ptr rxPsdOfdma = WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity (DEFAULT_FREQUENCY, DEFAULT_CHANNEL_WIDTH, txPowerWatts, DEFAULT_GUARD_WIDTH, band); Ptr rxParamsOfdma = Create (); rxParamsOfdma->psd = rxPsd; - rxParamsOfdma->txPhy = 0; + rxParamsOfdma->txPhy = nullptr; rxParamsOfdma->duration = ppduDuration - nonOfdmaDuration; rxParamsOfdma->ppdu = ppduOfdma; Simulator::Schedule (nonOfdmaDuration, &TestMultipleHeTbPreambles::RxHeTbPpduOfdmaPart, this, rxParamsOfdma); @@ -2067,7 +2067,7 @@ void TestMultipleHeTbPreambles::DoTeardown () { m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; } void @@ -3061,15 +3061,15 @@ void TestUlOfdmaPhyTransmission::DoTeardown () { m_phyAp->Dispose (); - m_phyAp = 0; + m_phyAp = nullptr; m_phySta1->Dispose (); - m_phySta1 = 0; + m_phySta1 = nullptr; m_phySta2->Dispose (); - m_phySta2 = 0; + m_phySta2 = nullptr; m_phySta3->Dispose (); - m_phySta3 = 0; + m_phySta3 = nullptr; m_phyInterferer->Dispose (); - m_phyInterferer = 0; + m_phyInterferer = nullptr; } void @@ -3986,13 +3986,13 @@ void TestPhyPaddingExclusion::DoTeardown () { m_phyAp->Dispose (); - m_phyAp = 0; + m_phyAp = nullptr; m_phySta1->Dispose (); - m_phySta1 = 0; + m_phySta1 = nullptr; m_phySta2->Dispose (); - m_phySta2 = 0; + m_phySta2 = nullptr; m_phyInterferer->Dispose (); - m_phyInterferer = 0; + m_phyInterferer = nullptr; } void @@ -4183,10 +4183,10 @@ TestUlOfdmaPowerControl::TestUlOfdmaPowerControl () TestUlOfdmaPowerControl::~TestUlOfdmaPowerControl () { - m_phyAp = 0; - m_apDev = 0; - m_sta1Dev = 0; - m_sta2Dev = 0; + m_phyAp = nullptr; + m_apDev = nullptr; + m_sta1Dev = nullptr; + m_sta2Dev = nullptr; } void @@ -4388,13 +4388,13 @@ void TestUlOfdmaPowerControl::DoTeardown () { m_phyAp->Dispose (); - m_phyAp = 0; + m_phyAp = nullptr; m_apDev->Dispose (); - m_apDev = 0; + m_apDev = nullptr; m_sta1Dev->Dispose (); - m_sta1Dev = 0; + m_sta1Dev = nullptr; m_sta2Dev->Dispose (); - m_sta2Dev = 0; + m_sta2Dev = nullptr; } void diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index 5874b1ef3..31c7932ee 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -148,7 +148,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket (double rxPowerDbm Ptr txParams = Create (); txParams->psd = txPowerSpectrum; - txParams->txPhy = 0; + txParams->txPhy = nullptr; txParams->duration = txDuration; txParams->ppdu = ppdu; @@ -198,7 +198,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::RxFailure (PtrDispose (); - m_phy = 0; + m_phy = nullptr; } void @@ -516,7 +516,7 @@ TestThresholdPreambleDetectionWithFrameCapture::SendPacket (double rxPowerDbm) Ptr txParams = Create (); txParams->psd = txPowerSpectrum; - txParams->txPhy = 0; + txParams->txPhy = nullptr; txParams->duration = txDuration; txParams->ppdu = ppdu; @@ -566,7 +566,7 @@ TestThresholdPreambleDetectionWithFrameCapture::RxFailure (Ptr p TestThresholdPreambleDetectionWithFrameCapture::~TestThresholdPreambleDetectionWithFrameCapture () { - m_phy = 0; + m_phy = nullptr; } void @@ -597,7 +597,7 @@ void TestThresholdPreambleDetectionWithFrameCapture::DoTeardown () { m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; } void @@ -1038,7 +1038,7 @@ TestSimpleFrameCaptureModel::SendPacket (double rxPowerDbm, uint32_t packetSize) Ptr txParams = Create (); txParams->psd = txPowerSpectrum; - txParams->txPhy = 0; + txParams->txPhy = nullptr; txParams->duration = txDuration; txParams->ppdu = ppdu; @@ -1109,7 +1109,7 @@ TestSimpleFrameCaptureModel::Expect1500BPacketDropped () TestSimpleFrameCaptureModel::~TestSimpleFrameCaptureModel () { - m_phy = 0; + m_phy = nullptr; } void @@ -1140,7 +1140,7 @@ void TestSimpleFrameCaptureModel::DoTeardown () { m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; } void @@ -1255,7 +1255,7 @@ TestPhyHeadersReception::SendPacket (double rxPowerDbm) Ptr txParams = Create (); txParams->psd = txPowerSpectrum; - txParams->txPhy = 0; + txParams->txPhy = nullptr; txParams->duration = txDuration; txParams->ppdu = ppdu; @@ -1283,7 +1283,7 @@ TestPhyHeadersReception::DoCheckPhyState (WifiPhyState expectedState) TestPhyHeadersReception::~TestPhyHeadersReception () { - m_phy = 0; + m_phy = nullptr; } void @@ -1302,7 +1302,7 @@ void TestPhyHeadersReception::DoTeardown () { m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; } void @@ -1567,7 +1567,7 @@ TestAmpduReception::TestAmpduReception () TestAmpduReception::~TestAmpduReception () { - m_phy = 0; + m_phy = nullptr; } void @@ -1776,7 +1776,7 @@ TestAmpduReception::SendAmpduWithThreeMpdus (double rxPowerDbm, uint32_t referen Ptr txParams = Create (); txParams->psd = txPowerSpectrum; - txParams->txPhy = 0; + txParams->txPhy = nullptr; txParams->duration = txDuration; txParams->ppdu = ppdu; @@ -1812,7 +1812,7 @@ void TestAmpduReception::DoTeardown () { m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; } void diff --git a/src/wifi/test/wifi-phy-thresholds-test.cc b/src/wifi/test/wifi-phy-thresholds-test.cc index 05765508e..8f52c6cb4 100644 --- a/src/wifi/test/wifi-phy-thresholds-test.cc +++ b/src/wifi/test/wifi-phy-thresholds-test.cc @@ -156,7 +156,7 @@ WifiPhyThresholdsTest::MakeWifiSignal (double txPowerWatts) Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH); Ptr txParams = Create (); txParams->psd = txPowerSpectrum; - txParams->txPhy = 0; + txParams->txPhy = nullptr; txParams->duration = txDuration; txParams->ppdu = ppdu; return txParams; @@ -168,7 +168,7 @@ WifiPhyThresholdsTest::MakeForeignSignal (double txPowerWatts) Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH); Ptr txParams = Create (); txParams->psd = txPowerSpectrum; - txParams->txPhy = 0; + txParams->txPhy = nullptr; txParams->duration = Seconds (0.5); return txParams; } @@ -247,7 +247,7 @@ void WifiPhyThresholdsTest::DoTeardown () { m_phy->Dispose (); - m_phy = 0; + m_phy = nullptr; } /** diff --git a/src/wimax/examples/wimax-ipv4.cc b/src/wimax/examples/wimax-ipv4.cc index 30db58194..eaafcf951 100644 --- a/src/wimax/examples/wimax-ipv4.cc +++ b/src/wimax/examples/wimax-ipv4.cc @@ -210,11 +210,11 @@ int main (int argc, char *argv[]) delete[] udpServer; for (int i = 0; i < nbSS; i++) { - ss[i] = 0; + ss[i] = nullptr; } delete[] ss; - bs = 0; + bs = nullptr; Simulator::Destroy (); NS_LOG_INFO ("Done."); diff --git a/src/wimax/examples/wimax-multicast.cc b/src/wimax/examples/wimax-multicast.cc index e146ed636..1f1496eed 100644 --- a/src/wimax/examples/wimax-multicast.cc +++ b/src/wimax/examples/wimax-multicast.cc @@ -302,12 +302,12 @@ int main (int argc, char *argv[]) for (int i = 0; i < nbSS; i++) { - ss[i] = 0; - SSPosition[i] = 0; - SSPosAllocator[i] = 0; + ss[i] = nullptr; + SSPosition[i] = nullptr; + SSPosAllocator[i] = nullptr; } - bs = 0; + bs = nullptr; Simulator::Destroy (); NS_LOG_INFO ("Done."); diff --git a/src/wimax/examples/wimax-simple.cc b/src/wimax/examples/wimax-simple.cc index 996f03aa9..e72be808f 100644 --- a/src/wimax/examples/wimax-simple.cc +++ b/src/wimax/examples/wimax-simple.cc @@ -192,9 +192,9 @@ int main (int argc, char *argv[]) NS_LOG_INFO ("Starting simulation....."); Simulator::Run (); - ss[0] = 0; - ss[1] = 0; - bs = 0; + ss[0] = nullptr; + ss[1] = nullptr; + bs = nullptr; Simulator::Destroy (); NS_LOG_INFO ("Done."); diff --git a/src/wimax/helper/wimax-helper.cc b/src/wimax/helper/wimax-helper.cc index a86bf7f49..7fbda4478 100644 --- a/src/wimax/helper/wimax-helper.cc +++ b/src/wimax/helper/wimax-helper.cc @@ -41,7 +41,7 @@ namespace ns3 { NS_LOG_COMPONENT_DEFINE ("WimaxHelper"); WimaxHelper::WimaxHelper () - : m_channel (0) + : m_channel (nullptr) { } diff --git a/src/wimax/model/bandwidth-manager.cc b/src/wimax/model/bandwidth-manager.cc index eee9df66e..358ee37d6 100644 --- a/src/wimax/model/bandwidth-manager.cc +++ b/src/wimax/model/bandwidth-manager.cc @@ -60,7 +60,7 @@ BandwidthManager::~BandwidthManager () void BandwidthManager::DoDispose () { - m_device = 0; + m_device = nullptr; } uint32_t @@ -127,7 +127,7 @@ ServiceFlow* BandwidthManager::SelectFlowForRequest (uint32_t &bytesToRequest) { Ptr packet; - ServiceFlow *serviceFlow = 0; + ServiceFlow *serviceFlow = nullptr; Ptr ss = m_device->GetObject (); std::vector serviceFlows = ss->GetServiceFlowManager ()->GetServiceFlows (ServiceFlow::SF_TYPE_ALL); diff --git a/src/wimax/model/bs-link-manager.cc b/src/wimax/model/bs-link-manager.cc index cdb393aeb..e32b7707c 100644 --- a/src/wimax/model/bs-link-manager.cc +++ b/src/wimax/model/bs-link-manager.cc @@ -56,7 +56,7 @@ BSLinkManager::BSLinkManager (Ptr bs) BSLinkManager::~BSLinkManager () { - m_bs = 0; + m_bs = nullptr; } uint8_t @@ -155,7 +155,7 @@ void BSLinkManager::PerformInitialRanging (Cid cid, RngReq *rngreq, RngRsp *rngrsp) { - SSRecord *ssRecord = 0; + SSRecord *ssRecord = nullptr; bool isOldSS = m_bs->GetSSManager ()->IsInRecord (rngreq->GetMacAddress ()); if (isOldSS) { diff --git a/src/wimax/model/bs-net-device.cc b/src/wimax/model/bs-net-device.cc index be7690274..0c4b298c4 100644 --- a/src/wimax/model/bs-net-device.cc +++ b/src/wimax/model/bs-net-device.cc @@ -262,15 +262,15 @@ BaseStationNetDevice::DoDispose () { delete m_cidFactory; - m_linkManager = 0; - m_ssManager = 0; - m_bsClassifier = 0; - m_serviceFlowManager = 0; - m_uplinkScheduler = 0; - m_cidFactory = 0; - m_ssManager = 0; - m_uplinkScheduler = 0; - m_scheduler = 0; + m_linkManager = nullptr; + m_ssManager = nullptr; + m_bsClassifier = nullptr; + m_serviceFlowManager = nullptr; + m_uplinkScheduler = nullptr; + m_cidFactory = nullptr; + m_ssManager = nullptr; + m_uplinkScheduler = nullptr; + m_scheduler = nullptr; WimaxNetDevice::DoDispose (); } @@ -613,7 +613,7 @@ BaseStationNetDevice::DoSend (Ptr packet, uint16_t protocolNumber) { Ptr burst = Create (); - ServiceFlow *serviceFlow = 0; + ServiceFlow *serviceFlow = nullptr; NS_LOG_INFO ("BS (" << source << "):"); NS_LOG_INFO ("\tSending packet..."); @@ -627,12 +627,12 @@ BaseStationNetDevice::DoSend (Ptr packet, serviceFlow = m_bsClassifier->Classify (packet, GetServiceFlowManager (), ServiceFlow::SF_DIRECTION_DOWN); } - if (protocolNumber != 2048 || serviceFlow == 0) + if (protocolNumber != 2048 || serviceFlow == nullptr) { serviceFlow = *GetServiceFlowManager ()->GetServiceFlows (ServiceFlow::SF_TYPE_ALL).begin (); } - if (serviceFlow == 0) + if (serviceFlow == nullptr) { NS_LOG_INFO ("No Service Flow!!"); m_bsTxDropTrace (packet); @@ -684,7 +684,7 @@ BaseStationNetDevice::DoReceive (Ptr packet) GrantManagementSubheader grantMgmntSubhdr; Mac48Address source; LlcSnapHeader llc; - Ptr connection = 0; + Ptr connection = nullptr; FragmentationSubheader fragSubhdr; bool fragmentation = false; // it becomes true when there is a fragmentation subheader @@ -976,7 +976,7 @@ BaseStationNetDevice::SendBursts () if (cid != GetInitialRangingConnection ()->GetCid () && cid != GetBroadcastConnection ()->GetCid ()) { - if (m_serviceFlowManager->GetServiceFlow (cid) != 0) + if (m_serviceFlowManager->GetServiceFlow (cid) != nullptr) { modulationType = GetBurstProfileManager ()->GetModulationType (diuc, WimaxNetDevice::DIRECTION_DOWNLINK); } @@ -1149,7 +1149,7 @@ BaseStationNetDevice::SetUlBurstProfiles (Ucd *ucd) Ptr BaseStationNetDevice::GetConnection (Cid cid) { - Ptr connection = 0; + Ptr connection = nullptr; if (cid.IsInitialRanging ()) { return GetInitialRangingConnection (); diff --git a/src/wimax/model/bs-scheduler-rtps.cc b/src/wimax/model/bs-scheduler-rtps.cc index 2c5599852..cec6d1764 100644 --- a/src/wimax/model/bs-scheduler-rtps.cc +++ b/src/wimax/model/bs-scheduler-rtps.cc @@ -56,7 +56,7 @@ BSSchedulerRtps::GetTypeId () BSSchedulerRtps::BSSchedulerRtps () : m_downlinkBursts (new std::list > > ()) { - SetBs (0); + SetBs (nullptr); } BSSchedulerRtps::BSSchedulerRtps (Ptr bs) @@ -75,13 +75,13 @@ BSSchedulerRtps::~BSSchedulerRtps () while (downlinkBursts->size ()) { pair = downlinkBursts->front (); - pair.second = 0; + pair.second = nullptr; delete pair.first; } - SetBs (0); + SetBs (nullptr); delete m_downlinkBursts; - m_downlinkBursts = 0; + m_downlinkBursts = nullptr; } std::list > >* diff --git a/src/wimax/model/bs-scheduler-simple.cc b/src/wimax/model/bs-scheduler-simple.cc index 343e32ee6..76d9e779f 100644 --- a/src/wimax/model/bs-scheduler-simple.cc +++ b/src/wimax/model/bs-scheduler-simple.cc @@ -54,7 +54,7 @@ TypeId BSSchedulerSimple::GetTypeId () BSSchedulerSimple::BSSchedulerSimple () : m_downlinkBursts (new std::list > > ()) { - SetBs (0); + SetBs (nullptr); } BSSchedulerSimple::BSSchedulerSimple (Ptr bs) @@ -72,12 +72,12 @@ BSSchedulerSimple::~BSSchedulerSimple () while (downlinkBursts->size ()) { pair = downlinkBursts->front (); - pair.second = 0; + pair.second = nullptr; delete pair.first; } - SetBs (0); + SetBs (nullptr); delete m_downlinkBursts; - m_downlinkBursts = 0; + m_downlinkBursts = nullptr; } std::list > >* @@ -220,7 +220,7 @@ void BSSchedulerSimple::Schedule () bool BSSchedulerSimple::SelectConnection (Ptr &connection) { - connection = 0; + connection = nullptr; Time currentTime = Simulator::Now (); std::vector >::const_iterator iter1; std::vector::iterator iter2; diff --git a/src/wimax/model/bs-scheduler.cc b/src/wimax/model/bs-scheduler.cc index cc43cd9ec..4717b6743 100644 --- a/src/wimax/model/bs-scheduler.cc +++ b/src/wimax/model/bs-scheduler.cc @@ -72,12 +72,12 @@ BSScheduler::~BSScheduler () while (downlinkBursts->size ()) { pair = downlinkBursts->front (); - pair.second = 0; + pair.second = nullptr; delete pair.first; } - SetBs (0); + SetBs (nullptr); delete m_downlinkBursts; - m_downlinkBursts = 0; + m_downlinkBursts = nullptr; } void diff --git a/src/wimax/model/bs-service-flow-manager.cc b/src/wimax/model/bs-service-flow-manager.cc index 3faadba41..c06264fad 100644 --- a/src/wimax/model/bs-service-flow-manager.cc +++ b/src/wimax/model/bs-service-flow-manager.cc @@ -132,7 +132,7 @@ BsServiceFlowManager::ScheduleDsaRsp (ServiceFlow *serviceFlow, Cid cid) Ptr bs = m_device->GetObject (); SSRecord *ssRecord = bs->GetSSManager ()->GetSSRecord (cid); - if (ssRecord == 0) + if (ssRecord == nullptr) { NS_LOG_INFO ("SS not registered with the BS CID:" << cid); return; @@ -232,7 +232,7 @@ BsServiceFlowManager::AddMulticastServiceFlow (ServiceFlow sf, enum WimaxPhy::M serviceFlow->SetType (ServiceFlow::SF_TYPE_ACTIVE); serviceFlow->SetIsMulticast (true); serviceFlow->SetModulation (modulation); - bs->GetUplinkScheduler ()->SetupServiceFlow (0, serviceFlow); + bs->GetUplinkScheduler ()->SetupServiceFlow (nullptr, serviceFlow); } void diff --git a/src/wimax/model/bs-uplink-scheduler-mbqos.cc b/src/wimax/model/bs-uplink-scheduler-mbqos.cc index 6695c4317..b149400f1 100644 --- a/src/wimax/model/bs-uplink-scheduler-mbqos.cc +++ b/src/wimax/model/bs-uplink-scheduler-mbqos.cc @@ -47,7 +47,7 @@ UplinkSchedulerMBQoS::UplinkSchedulerMBQoS (Time time) UplinkSchedulerMBQoS::~UplinkSchedulerMBQoS () { - SetBs (0); + SetBs (nullptr); m_uplinkAllocations.clear (); } diff --git a/src/wimax/model/bs-uplink-scheduler-rtps.cc b/src/wimax/model/bs-uplink-scheduler-rtps.cc index 5ac01d479..8e9fe02e1 100644 --- a/src/wimax/model/bs-uplink-scheduler-rtps.cc +++ b/src/wimax/model/bs-uplink-scheduler-rtps.cc @@ -42,7 +42,7 @@ NS_OBJECT_ENSURE_REGISTERED (UplinkSchedulerRtps); UplinkSchedulerRtps::UplinkSchedulerRtps () { - SetBs (0); + SetBs (nullptr); SetTimeStampIrInterval (Seconds (0)); SetNrIrOppsAllocated (0); SetIsIrIntrvlAllocated (false); @@ -64,7 +64,7 @@ UplinkSchedulerRtps::UplinkSchedulerRtps (Ptr bs) UplinkSchedulerRtps::~UplinkSchedulerRtps () { - SetBs (0); + SetBs (nullptr); m_uplinkAllocations.clear (); } diff --git a/src/wimax/model/bs-uplink-scheduler-simple.cc b/src/wimax/model/bs-uplink-scheduler-simple.cc index 0d4f2ec41..8c42ef949 100644 --- a/src/wimax/model/bs-uplink-scheduler-simple.cc +++ b/src/wimax/model/bs-uplink-scheduler-simple.cc @@ -40,7 +40,7 @@ NS_OBJECT_ENSURE_REGISTERED (UplinkSchedulerSimple); UplinkSchedulerSimple::UplinkSchedulerSimple () { - SetBs (0); + SetBs (nullptr); SetTimeStampIrInterval (Seconds (0)); SetNrIrOppsAllocated (0); SetIsIrIntrvlAllocated (false); @@ -62,7 +62,7 @@ UplinkSchedulerSimple::UplinkSchedulerSimple (Ptr bs) UplinkSchedulerSimple::~UplinkSchedulerSimple () { - SetBs (0); + SetBs (nullptr); m_uplinkAllocations.clear (); } diff --git a/src/wimax/model/bs-uplink-scheduler.cc b/src/wimax/model/bs-uplink-scheduler.cc index 413013203..6c446d8e2 100644 --- a/src/wimax/model/bs-uplink-scheduler.cc +++ b/src/wimax/model/bs-uplink-scheduler.cc @@ -39,7 +39,7 @@ NS_LOG_COMPONENT_DEFINE ("UplinkScheduler"); NS_OBJECT_ENSURE_REGISTERED (UplinkScheduler); UplinkScheduler::UplinkScheduler () - : m_bs (0), + : m_bs (nullptr), m_timeStampIrInterval (Seconds (0)), m_nrIrOppsAllocated (0), m_isIrIntrvlAllocated (false), @@ -62,7 +62,7 @@ UplinkScheduler::UplinkScheduler (Ptr bs) UplinkScheduler::~UplinkScheduler () { - m_bs = 0; + m_bs = nullptr; m_uplinkAllocations.clear (); } void diff --git a/src/wimax/model/burst-profile-manager.cc b/src/wimax/model/burst-profile-manager.cc index 2bda3dd63..593248b13 100644 --- a/src/wimax/model/burst-profile-manager.cc +++ b/src/wimax/model/burst-profile-manager.cc @@ -48,13 +48,13 @@ BurstProfileManager::BurstProfileManager (Ptr device) BurstProfileManager::~BurstProfileManager () { - m_device = 0; + m_device = nullptr; } void BurstProfileManager::DoDispose () { - m_device = 0; + m_device = nullptr; } diff --git a/src/wimax/model/connection-manager.cc b/src/wimax/model/connection-manager.cc index 0fb9d5008..9ae0e9679 100644 --- a/src/wimax/model/connection-manager.cc +++ b/src/wimax/model/connection-manager.cc @@ -46,7 +46,7 @@ TypeId ConnectionManager::GetTypeId () } ConnectionManager::ConnectionManager () - : m_cidFactory (0) + : m_cidFactory (nullptr) { } @@ -153,7 +153,7 @@ ConnectionManager::GetConnection (Cid cid) } } - return 0; + return nullptr; } std::vector > diff --git a/src/wimax/model/ipcs-classifier.cc b/src/wimax/model/ipcs-classifier.cc index 32cffb286..b2ae128b3 100644 --- a/src/wimax/model/ipcs-classifier.cc +++ b/src/wimax/model/ipcs-classifier.cc @@ -87,7 +87,7 @@ IpcsClassifier::Classify (Ptr packet, else { NS_LOG_INFO ("\t\t\tUnknown protocol: " << protocol); - return 0; + return nullptr; } NS_LOG_INFO ("Classifing packet: src_addr=" << source_address << " dst_addr=" diff --git a/src/wimax/model/service-flow-manager.cc b/src/wimax/model/service-flow-manager.cc index a6ec8ccbb..07d1d7375 100644 --- a/src/wimax/model/service-flow-manager.cc +++ b/src/wimax/model/service-flow-manager.cc @@ -97,7 +97,7 @@ ServiceFlow* ServiceFlowManager::DoClassify (Ipv4Address srcAddress, } } } - return 0; + return nullptr; } ServiceFlow* @@ -112,7 +112,7 @@ ServiceFlowManager::GetServiceFlow (uint32_t sfid) const } NS_LOG_DEBUG ("GetServiceFlow: service flow not found!"); - return 0; + return nullptr; } ServiceFlow* @@ -127,7 +127,7 @@ ServiceFlowManager::GetServiceFlow (Cid cid) const } NS_LOG_DEBUG ("GetServiceFlow: service flow not found!"); - return 0; + return nullptr; } std::vector @@ -180,7 +180,7 @@ ServiceFlowManager::GetNextServiceFlowToAllocate () return (*iter); } } - return 0; + return nullptr; } uint32_t diff --git a/src/wimax/model/service-flow.cc b/src/wimax/model/service-flow.cc index 306e0a645..32b7f1c90 100644 --- a/src/wimax/model/service-flow.cc +++ b/src/wimax/model/service-flow.cc @@ -34,7 +34,7 @@ ServiceFlow::ServiceFlow (Direction direction) m_type = SF_TYPE_PROVISIONED; m_record = new ServiceFlowRecord (); m_sfid = 0; - m_connection = 0; + m_connection = nullptr; m_isEnabled = false; m_isMulticast = false; m_modulationType = WimaxPhy::MODULATION_TYPE_QPSK_12; @@ -44,7 +44,7 @@ ServiceFlow::ServiceFlow () : m_sfid (0), m_direction (SF_DIRECTION_DOWN), m_type (SF_TYPE_PROVISIONED), - m_connection (0), + m_connection (nullptr), m_isEnabled (false), m_record (new ServiceFlowRecord ()) { @@ -71,7 +71,7 @@ ServiceFlow::ServiceFlow (uint32_t sfid, Direction direction, PtrGetQueue (); } @@ -766,7 +766,7 @@ ServiceFlow::operator = (ServiceFlow const& o) m_isEnabled = o.GetIsEnabled (); m_isMulticast = o.GetIsMulticast (); m_modulationType = o.GetModulation (); - if (m_record != 0) + if (m_record != nullptr) { delete m_record; } @@ -797,7 +797,7 @@ ServiceFlow::GetSchedulingTypeStr () const default: NS_FATAL_ERROR ("Invalid scheduling type"); } - return 0; + return nullptr; } Tlv diff --git a/src/wimax/model/simple-ofdm-wimax-channel.cc b/src/wimax/model/simple-ofdm-wimax-channel.cc index ecaf506ea..d0ceb586b 100644 --- a/src/wimax/model/simple-ofdm-wimax-channel.cc +++ b/src/wimax/model/simple-ofdm-wimax-channel.cc @@ -42,7 +42,7 @@ NS_LOG_COMPONENT_DEFINE ("simpleOfdmWimaxChannel"); SimpleOfdmWimaxChannel::SimpleOfdmWimaxChannel () { - m_loss = 0; + m_loss = nullptr; } SimpleOfdmWimaxChannel::~SimpleOfdmWimaxChannel () @@ -82,7 +82,7 @@ SimpleOfdmWimaxChannel::SimpleOfdmWimaxChannel (PropModel propModel) break; default: - m_loss = 0; + m_loss = nullptr; } } @@ -109,7 +109,7 @@ SimpleOfdmWimaxChannel::SetPropagationModel (PropModel propModel) break; default: - m_loss = 0; + m_loss = nullptr; } } @@ -141,7 +141,7 @@ SimpleOfdmWimaxChannel::DoGetDevice (std::size_t index) const } NS_FATAL_ERROR ("Unable to get device"); - return 0; + return nullptr; } void @@ -157,8 +157,8 @@ SimpleOfdmWimaxChannel::Send (Time BlockTime, Ptr burst) { double rxPowerDbm = 0; - Ptr senderMobility = 0; - Ptr receiverMobility = 0; + Ptr senderMobility = nullptr; + Ptr receiverMobility = nullptr; senderMobility = phy->GetDevice ()->GetNode ()->GetObject (); simpleOfdmSendParam * param; for (std::list >::iterator iter = m_phyList.begin (); iter != m_phyList.end (); ++iter) diff --git a/src/wimax/model/simple-ofdm-wimax-phy.cc b/src/wimax/model/simple-ofdm-wimax-phy.cc index 8d34b6f6c..26135fc7f 100644 --- a/src/wimax/model/simple-ofdm-wimax-phy.cc +++ b/src/wimax/model/simple-ofdm-wimax-phy.cc @@ -237,8 +237,8 @@ SimpleOfdmWimaxPhy::DoDispose () { delete m_receivedFecBlocks; delete m_fecBlocks; - m_receivedFecBlocks = 0; - m_fecBlocks = 0; + m_receivedFecBlocks = nullptr; + m_fecBlocks = nullptr; delete m_snrToBlockErrorRateManager; WimaxPhy::DoDispose (); } @@ -253,7 +253,7 @@ void SimpleOfdmWimaxPhy::Send (SendParams *params) { OfdmSendParams *o_params = dynamic_cast (params); - NS_ASSERT (o_params !=0); + NS_ASSERT (o_params !=nullptr); Send (o_params->GetBurst (), (WimaxPhy::ModulationType) o_params->GetModulationType (), o_params->GetDirection ()); @@ -297,7 +297,7 @@ SimpleOfdmWimaxPhy::StartSendDummyFecBlock (bool isFirstBlock, } SimpleOfdmWimaxChannel *channel = dynamic_cast (PeekPointer (GetChannel ())); - NS_ASSERT (channel != 0); + NS_ASSERT (channel != nullptr); if (m_nrRemainingBlocksToSend==1) { diff --git a/src/wimax/model/snr-to-block-error-rate-manager.cc b/src/wimax/model/snr-to-block-error-rate-manager.cc index 80dea6e2d..17a835d24 100644 --- a/src/wimax/model/snr-to-block-error-rate-manager.cc +++ b/src/wimax/model/snr-to-block-error-rate-manager.cc @@ -293,7 +293,7 @@ SNRToBlockErrorRateManager::GetBlockErrorRate (double SNR, uint8_t modulation) return 0; } - std::vector *record = 0; + std::vector *record = nullptr; record = m_recordModulation[modulation]; @@ -331,7 +331,7 @@ SNRToBlockErrorRateManager::GetSNRToBlockErrorRateRecord (double SNR, return new SNRToBlockErrorRateRecord (SNR, 0, 0, 0, 0, 0); } - std::vector *record = 0; + std::vector *record = nullptr; record = m_recordModulation[modulation]; if (SNR <= (record->at (0)->GetSNRValue ())) diff --git a/src/wimax/model/ss-link-manager.cc b/src/wimax/model/ss-link-manager.cc index 75b14b455..e65dec654 100644 --- a/src/wimax/model/ss-link-manager.cc +++ b/src/wimax/model/ss-link-manager.cc @@ -71,14 +71,14 @@ SSLinkManager::SSLinkManager (Ptr ss) SSLinkManager::~SSLinkManager () { - m_ss = 0; + m_ss = nullptr; } void SSLinkManager::DoDispose () { - m_ss = 0; + m_ss = nullptr; } void @@ -402,8 +402,8 @@ SSLinkManager::PerformRanging (Cid cid, // code to move to new channel/frequency goes here } // deassigning basic and primary CIDs - m_ss->SetBasicConnection (0); - m_ss->SetPrimaryConnection (0); + m_ss->SetBasicConnection (nullptr); + m_ss->SetPrimaryConnection (nullptr); m_ss->SetAreManagementConnectionsAllocated (false); } else diff --git a/src/wimax/model/ss-manager.cc b/src/wimax/model/ss-manager.cc index 6bb77ff62..a35ee0873 100644 --- a/src/wimax/model/ss-manager.cc +++ b/src/wimax/model/ss-manager.cc @@ -51,7 +51,7 @@ SSManager::~SSManager () delete *iter; } delete m_ssRecords; - m_ssRecords = 0; + m_ssRecords = nullptr; } SSRecord* @@ -74,7 +74,7 @@ SSManager::GetSSRecord (const Mac48Address &macAddress) const } NS_LOG_DEBUG ("GetSSRecord: SSRecord not found!"); - return 0; + return nullptr; } SSRecord* @@ -101,7 +101,7 @@ SSManager::GetSSRecord (Cid cid) const } NS_LOG_DEBUG ("GetSSRecord: SSRecord not found!"); - return 0; + return nullptr; } std::vector* @@ -127,7 +127,7 @@ bool SSManager::IsRegistered (const Mac48Address &macAddress) const { SSRecord *ssRecord = GetSSRecord (macAddress); - return ssRecord != 0 && ssRecord->GetRangingStatus () == WimaxNetDevice::RANGING_STATUS_SUCCESS; + return ssRecord != nullptr && ssRecord->GetRangingStatus () == WimaxNetDevice::RANGING_STATUS_SUCCESS; } void diff --git a/src/wimax/model/ss-net-device.cc b/src/wimax/model/ss-net-device.cc index bfc712122..e4dd8b89e 100644 --- a/src/wimax/model/ss-net-device.cc +++ b/src/wimax/model/ss-net-device.cc @@ -243,8 +243,8 @@ SubscriberStationNetDevice::InitSubscriberStationNetDevice () m_areManagementConnectionsAllocated = false; m_areServiceFlowsAllocated = false; - m_basicConnection = 0; - m_primaryConnection = 0; + m_basicConnection = nullptr; + m_primaryConnection = nullptr; m_dlBurstProfile = new OfdmDlBurstProfile (); m_ulBurstProfile = new OfdmUlBurstProfile (); @@ -270,15 +270,15 @@ SubscriberStationNetDevice::DoDispose () { delete m_dlBurstProfile; delete m_ulBurstProfile; - m_scheduler = 0; - m_serviceFlowManager = 0; - m_basicConnection = 0; - m_primaryConnection = 0; - m_classifier = 0; - m_dlBurstProfile = 0; - m_ulBurstProfile = 0; + m_scheduler = nullptr; + m_serviceFlowManager = nullptr; + m_basicConnection = nullptr; + m_primaryConnection = nullptr; + m_classifier = nullptr; + m_dlBurstProfile = nullptr; + m_ulBurstProfile = nullptr; - m_linkManager = 0; + m_linkManager = nullptr; m_asciiTxQueueEnqueueCb.Nullify (); m_asciiTxQueueDequeueCb.Nullify (); @@ -644,7 +644,7 @@ SubscriberStationNetDevice::DoSend (Ptr packet, NS_LOG_INFO ("\t\tPacket Size: " << packet->GetSize () ); NS_LOG_INFO ("\t\tProtocol: " << protocolNumber ); - ServiceFlow *serviceFlow = 0; + ServiceFlow *serviceFlow = nullptr; if (IsRegistered ()) { @@ -670,7 +670,7 @@ SubscriberStationNetDevice::DoSend (Ptr packet, serviceFlow = m_classifier->Classify (packet, GetServiceFlowManager (), ServiceFlow::SF_DIRECTION_UP); } - if ((protocolNumber != 2048) || (serviceFlow == NULL)) + if ((protocolNumber != 2048) || (serviceFlow == nullptr)) { serviceFlow = *GetServiceFlowManager ()->GetServiceFlows (ServiceFlow::SF_TYPE_ALL).begin (); NS_LOG_INFO ("\tNo service flows matches...using the default one."); @@ -1200,7 +1200,7 @@ SubscriberStationNetDevice::ProcessUlMap (const UlMap &ulmap) { - Ptr connection = NULL; + Ptr connection = nullptr; Simulator::Schedule (timeToAllocation, &SubscriberStationNetDevice::SendBurst, this, diff --git a/src/wimax/model/ss-record.cc b/src/wimax/model/ss-record.cc index e182113db..09dcf11e3 100644 --- a/src/wimax/model/ss-record.cc +++ b/src/wimax/model/ss-record.cc @@ -68,7 +68,7 @@ SSRecord::Initialize () SSRecord::~SSRecord () { delete m_serviceFlows; - m_serviceFlows = 0; + m_serviceFlows = nullptr; } void diff --git a/src/wimax/model/ss-scheduler.cc b/src/wimax/model/ss-scheduler.cc index 2e2f9dfa9..ea88a07d7 100644 --- a/src/wimax/model/ss-scheduler.cc +++ b/src/wimax/model/ss-scheduler.cc @@ -58,7 +58,7 @@ SSScheduler::~SSScheduler () void SSScheduler::DoDispose () { - m_ss = 0; + m_ss = nullptr; } void @@ -246,7 +246,7 @@ SSScheduler::SelectConnection () return m_ss->GetBroadcastConnection (); } NS_LOG_INFO ("NO connection is selected!"); - return 0; + return nullptr; } } // namespace ns3 diff --git a/src/wimax/model/ss-service-flow-manager.cc b/src/wimax/model/ss-service-flow-manager.cc index fc5496404..d639930a0 100644 --- a/src/wimax/model/ss-service-flow-manager.cc +++ b/src/wimax/model/ss-service-flow-manager.cc @@ -51,7 +51,7 @@ SsServiceFlowManager::SsServiceFlowManager (Ptr devi m_currentTransactionId (0), m_transactionIdIndex (1), m_dsaReqRetries (0), - m_pendingServiceFlow (0) + m_pendingServiceFlow (nullptr) { } @@ -120,7 +120,7 @@ void SsServiceFlowManager::InitiateServiceFlows () { ServiceFlow *serviceFlow = GetNextServiceFlowToAllocate (); - NS_ASSERT_MSG (serviceFlow != 0,"Error while initiating a new service flow: All service flows have been initiated"); + NS_ASSERT_MSG (serviceFlow != nullptr,"Error while initiating a new service flow: All service flows have been initiated"); m_pendingServiceFlow = serviceFlow; ScheduleDsaReq (m_pendingServiceFlow); } @@ -210,7 +210,7 @@ SsServiceFlowManager::ProcessDsaRsp (const DsaRsp &dsaRsp) m_device->Enqueue (dsaAck, MacHeaderType (), ss->GetPrimaryConnection ()); m_dsaReqRetries = 0; - if (m_pendingServiceFlow == NULL) + if (m_pendingServiceFlow == nullptr) { // May be the DSA-ACK was not received by the SS return; @@ -227,10 +227,10 @@ SsServiceFlowManager::ProcessDsaRsp (const DsaRsp &dsaRsp) ss->GetConnectionManager ()->AddConnection (transportConnection, Cid::TRANSPORT); m_pendingServiceFlow->SetIsEnabled (true); - m_pendingServiceFlow = 0; + m_pendingServiceFlow = nullptr; // check if all service flow have been initiated ServiceFlow * serviceFlow = GetNextServiceFlowToAllocate (); - if (serviceFlow == 0) + if (serviceFlow == nullptr) { ss->SetAreServiceFlowsAllocated (true); } diff --git a/src/wimax/model/wimax-connection.cc b/src/wimax/model/wimax-connection.cc index 3335cd6c0..f5f17ecba 100644 --- a/src/wimax/model/wimax-connection.cc +++ b/src/wimax/model/wimax-connection.cc @@ -68,7 +68,7 @@ WimaxConnection::WimaxConnection (Cid cid, enum Cid::Type type) : m_cid (cid), m_cidType (type), m_queue (CreateObject (1024)), - m_serviceFlow (0) + m_serviceFlow (nullptr) { } @@ -79,7 +79,7 @@ WimaxConnection::~WimaxConnection () void WimaxConnection::DoDispose () { - m_queue = 0; + m_queue = nullptr; // m_serviceFlow = 0; } diff --git a/src/wimax/model/wimax-mac-queue.cc b/src/wimax/model/wimax-mac-queue.cc index 34c65f355..386d82eaf 100644 --- a/src/wimax/model/wimax-mac-queue.cc +++ b/src/wimax/model/wimax-mac-queue.cc @@ -254,7 +254,7 @@ WimaxMacQueue::Dequeue (MacHeaderType::HeaderType packetType) return fragment; } } - return 0; + return nullptr; } Ptr @@ -323,7 +323,7 @@ WimaxMacQueue::Dequeue (MacHeaderType::HeaderType packetType, uint32_t available m_traceDequeue (fragment); return fragment; } - return 0; + return nullptr; } Ptr @@ -340,7 +340,7 @@ WimaxMacQueue::Peek (GenericMacHeader &hdr) const return packet; } - return 0; + return nullptr; } Ptr @@ -358,7 +358,7 @@ WimaxMacQueue::Peek (GenericMacHeader &hdr, Time &timeStamp) const return packet; } - return 0; + return nullptr; } Ptr @@ -379,7 +379,7 @@ WimaxMacQueue::Peek (MacHeaderType::HeaderType packetType) const return packet; } - return 0; + return nullptr; } Ptr @@ -402,7 +402,7 @@ WimaxMacQueue::Peek (MacHeaderType::HeaderType packetType, return packet; } - return 0; + return nullptr; } uint32_t diff --git a/src/wimax/model/wimax-net-device.cc b/src/wimax/model/wimax-net-device.cc index 2e63bdd0c..d5ddf11f1 100644 --- a/src/wimax/model/wimax-net-device.cc +++ b/src/wimax/model/wimax-net-device.cc @@ -159,15 +159,15 @@ WimaxNetDevice::DoDispose () { m_phy->Dispose (); - m_phy = 0; - m_node = 0; - m_initialRangingConnection = 0; - m_broadcastConnection = 0; - m_connectionManager = 0; - m_burstProfileManager = 0; - m_bandwidthManager = 0; - m_connectionManager = 0; - m_bandwidthManager = 0; + m_phy = nullptr; + m_node = nullptr; + m_initialRangingConnection = nullptr; + m_broadcastConnection = nullptr; + m_connectionManager = nullptr; + m_burstProfileManager = nullptr; + m_bandwidthManager = nullptr; + m_connectionManager = nullptr; + m_bandwidthManager = nullptr; NetDevice::DoDispose (); } diff --git a/src/wimax/model/wimax-phy.cc b/src/wimax/model/wimax-phy.cc index 2455b68a0..fc5342150 100644 --- a/src/wimax/model/wimax-phy.cc +++ b/src/wimax/model/wimax-phy.cc @@ -84,7 +84,7 @@ WimaxPhy::WimaxPhy () m_psPerFrame (0), m_symbolsPerFrame (0) { - m_mobility = 0; + m_mobility = nullptr; m_duplex = 0; m_txFrequency = 0; m_rxFrequency = 0; @@ -98,8 +98,8 @@ WimaxPhy::~WimaxPhy () void WimaxPhy::DoDispose () { - m_device = 0; - m_channel = 0; + m_device = nullptr; + m_channel = nullptr; } void diff --git a/src/wimax/model/wimax-tlv.cc b/src/wimax/model/wimax-tlv.cc index 9b2924cc6..9576ce7ab 100644 --- a/src/wimax/model/wimax-tlv.cc +++ b/src/wimax/model/wimax-tlv.cc @@ -60,15 +60,15 @@ Tlv::Tlv () { m_type = 0; m_length = 0; - m_value = 0; + m_value = nullptr; } Tlv::~Tlv () { - if (m_value != 0) + if (m_value != nullptr) { delete m_value; - m_value = 0; + m_value = nullptr; } } @@ -88,7 +88,7 @@ Tlv::Tlv (const Tlv & tlv) Tlv & Tlv::operator = (Tlv const& o) { - if (m_value != 0) + if (m_value != nullptr) { delete m_value; } @@ -953,11 +953,11 @@ ProtocolTlvValue::ProtocolTlvValue () } ProtocolTlvValue::~ProtocolTlvValue () { - if (m_protocol != 0) + if (m_protocol != nullptr) { m_protocol->clear (); delete m_protocol; - m_protocol = 0; + m_protocol = nullptr; } } @@ -1026,11 +1026,11 @@ Ipv4AddressTlvValue::Ipv4AddressTlvValue () Ipv4AddressTlvValue::~Ipv4AddressTlvValue () { - if (m_ipv4Addr != 0) + if (m_ipv4Addr != nullptr) { m_ipv4Addr->clear (); delete m_ipv4Addr; - m_ipv4Addr = 0; + m_ipv4Addr = nullptr; } } diff --git a/utils/bench-scheduler.cc b/utils/bench-scheduler.cc index 4a48190b7..479903f40 100644 --- a/utils/bench-scheduler.cc +++ b/utils/bench-scheduler.cc @@ -413,7 +413,7 @@ BenchSuite::Log () const Ptr GetRandomStream (std::string filename) { - Ptr stream = 0; + Ptr stream = nullptr; if (filename == "") { diff --git a/utils/perf/perf-io.cc b/utils/perf/perf-io.cc index a13a469d5..1a2da0227 100644 --- a/utils/perf/perf-io.cc +++ b/utils/perf/perf-io.cc @@ -134,7 +134,7 @@ main (int argc, char *argv[]) auto resultNs = std::chrono::duration_cast (end - start); resultNs = std::min (resultNs, minResultNs); fclose (file); - file = 0; + file = nullptr; std::cout << "."; std::cout.flush (); } std::cout << std::endl; diff --git a/utils/print-introspected-doxygen.cc b/utils/print-introspected-doxygen.cc index fa9903977..bb496886d 100644 --- a/utils/print-introspected-doxygen.cc +++ b/utils/print-introspected-doxygen.cc @@ -433,7 +433,7 @@ StaticInformation::DoGather (TypeId tid) { struct TypeId::AttributeInformation info = tid.GetAttribute(i); const PointerChecker *ptrChecker = dynamic_cast (PeekPointer (info.checker)); - if (ptrChecker != 0) + if (ptrChecker != nullptr) { TypeId pointee = ptrChecker->GetPointeeTypeId (); @@ -458,7 +458,7 @@ StaticInformation::DoGather (TypeId tid) } // attempt to cast to an object vector. const ObjectPtrContainerChecker *vectorChecker = dynamic_cast (PeekPointer (info.checker)); - if (vectorChecker != 0) + if (vectorChecker != nullptr) { TypeId item = vectorChecker->GetItemTypeId (); m_currentPath.push_back (info.name + "/[i]"); @@ -721,7 +721,7 @@ PrintAttributesTid (std::ostream &os, const TypeId tid) { const PointerChecker *ptrChecker = dynamic_cast (PeekPointer (info.checker)); - if (ptrChecker != 0) + if (ptrChecker != nullptr) { os << reference << "ns3::Ptr" << "< " << reference << ptrChecker->GetPointeeTypeId ().GetName () @@ -733,7 +733,7 @@ PrintAttributesTid (std::ostream &os, const TypeId tid) { const ObjectPtrContainerChecker * ptrChecker = dynamic_cast (PeekPointer (info.checker)); - if (ptrChecker != 0) + if (ptrChecker != nullptr) { os << reference << "ns3::Ptr" << "< " << reference << ptrChecker->GetItemTypeId ().GetName ()