diff --git a/examples/stats/wifi-example-sim.cc b/examples/stats/wifi-example-sim.cc index 400ad97f2..a8bb6e8a3 100644 --- a/examples/stats/wifi-example-sim.cc +++ b/examples/stats/wifi-example-sim.cc @@ -315,7 +315,9 @@ int main (int argc, char *argv[]) { // Finally, have that writer interrogate the DataCollector and save // the results. if (output) - output->Output (data); + { + output->Output (data); + } // Free any memory here at the end of this example. Simulator::Destroy (); diff --git a/src/aodv/examples/aodv.cc b/src/aodv/examples/aodv.cc index 5ec225f2b..d22c21701 100644 --- a/src/aodv/examples/aodv.cc +++ b/src/aodv/examples/aodv.cc @@ -105,7 +105,9 @@ int main (int argc, char **argv) { AodvExample test; if (!test.Configure (argc, argv)) - NS_FATAL_ERROR ("Configuration failed. Aborted."); + { + NS_FATAL_ERROR ("Configuration failed. Aborted."); + } test.Run (); test.Report (std::cout); diff --git a/src/buildings/examples/outdoor-group-mobility-example.cc b/src/buildings/examples/outdoor-group-mobility-example.cc index 4815ade63..162d62385 100644 --- a/src/buildings/examples/outdoor-group-mobility-example.cc +++ b/src/buildings/examples/outdoor-group-mobility-example.cc @@ -81,9 +81,15 @@ std::ofstream g_timeSeries; void PrintPosition (Ptr node) { - if (!node) return; + if (!node) + { + return; + } Ptr model = node->GetObject (); - if (!model) return; + if (!model) + { + return; + } NS_LOG_LOGIC ("Node: " << node->GetId () << " Position: " << model->GetPosition ()); g_timeSeries << Simulator::Now ().GetSeconds () << " " << node->GetId () << " " << model->GetPosition () << std::endl; } diff --git a/src/core/model/attribute-container.h b/src/core/model/attribute-container.h index 1aad1a3b6..bd6040653 100644 --- a/src/core/model/attribute-container.h +++ b/src/core/model/attribute-container.h @@ -411,16 +411,25 @@ bool AttributeContainerValue::DeserializeFromString (std::string value, Ptr checker) { auto acchecker = DynamicCast (checker); - if (!acchecker) return false; + if (!acchecker) + { + return false; + } std::istringstream iss (value); // copies value while (std::getline (iss, value, m_sep)) { auto avalue = acchecker->GetItemChecker ()->CreateValidValue (StringValue (value)); - if (!avalue) return false; + if (!avalue) + { + return false; + } auto attr = DynamicCast (avalue); - if (!attr) return false; + if (!attr) + { + return false; + } // TODO(jared): make insertion more generic? m_container.push_back (attr); @@ -436,7 +445,10 @@ AttributeContainerValue::SerializeToString (Ptr ch bool first = true; for (auto attr: *this) { - if (!first) oss << m_sep; + if (!first) + { + oss << m_sep; + } oss << attr->SerializeToString (checker); first = false; } @@ -448,8 +460,10 @@ typename AttributeContainerValue::result_type AttributeContainerValue::Get () const { result_type c; - for (const value_type& a: *this) - c.insert (c.end (), a->Get ()); + for (const value_type& a : *this) + { + c.insert (c.end (), a->Get ()); + } return c; } diff --git a/src/core/model/length.cc b/src/core/model/length.cc index 5cf77b918..1875072b5 100644 --- a/src/core/model/length.cc +++ b/src/core/model/length.cc @@ -714,8 +714,10 @@ ParseLengthString (const std::string& input) } //skip any whitespace between value and symbol - while (pos < input.size () && std::isspace(input[pos])) + while (pos < input.size () && std::isspace (input[pos])) + { ++pos; + } if (pos < input.size ()) { diff --git a/src/core/model/pair.h b/src/core/model/pair.h index 270157953..27d8f2c19 100644 --- a/src/core/model/pair.h +++ b/src/core/model/pair.h @@ -282,8 +282,10 @@ PairValue::Copy () const auto p = Create > (); // deep copy if non-null if (m_value.first) - p->m_value = std::make_pair (DynamicCast (m_value.first->Copy ()), - DynamicCast (m_value.second->Copy ())); + { + p->m_value = std::make_pair (DynamicCast (m_value.first->Copy ()), + DynamicCast (m_value.second->Copy ())); + } return p; } @@ -292,22 +294,37 @@ bool PairValue::DeserializeFromString (std::string value, Ptr checker) { auto pchecker = DynamicCast (checker); - if (!pchecker) return false; + if (!pchecker) + { + return false; + } std::istringstream iss (value); // copies value iss >> value; auto first = pchecker->GetCheckers ().first->CreateValidValue (StringValue (value)); - if (!first) return false; + if (!first) + { + return false; + } auto firstattr = DynamicCast (first); - if (!firstattr) return false; + if (!firstattr) + { + return false; + } iss >> value; auto second = pchecker->GetCheckers ().second->CreateValidValue (StringValue (value)); - if (!second) return false; + if (!second) + { + return false; + } auto secondattr = DynamicCast (second); - if (!secondattr) return false; + if (!secondattr) + { + return false; + } m_value = std::make_pair (firstattr, secondattr); return true; diff --git a/src/core/test/attribute-container-test-suite.cc b/src/core/test/attribute-container-test-suite.cc index 9827834d7..710182d4f 100644 --- a/src/core/test/attribute-container-test-suite.cc +++ b/src/core/test/attribute-container-test-suite.cc @@ -164,7 +164,10 @@ operator << (std::ostream &os, const AttributeContainerObject &obj) bool first = true; for (auto d: obj.m_doublelist) { - if (!first) os << ", "; + if (!first) + { + os << ", "; + } os << d; first = false; } @@ -474,7 +477,10 @@ AttributeContainerSetGetTestCase::DoRun () // could possibly make custom assignment operator to make assignment statement work std::map mapstrint; auto lst = value.Get (); - for (auto l: lst) mapstrint[l.first] = l.second; + for (auto l : lst) + { + mapstrint[l.first] = l.second; + } NS_TEST_ASSERT_MSG_EQ (map.size (), mapstrint.size (), "mapstrint wrong size"); auto iter = map.begin (); diff --git a/src/flow-monitor/model/flow-classifier.h b/src/flow-monitor/model/flow-classifier.h index 13eb0baaa..5b208c339 100644 --- a/src/flow-monitor/model/flow-classifier.h +++ b/src/flow-monitor/model/flow-classifier.h @@ -85,7 +85,10 @@ protected: inline void FlowClassifier::Indent (std::ostream &os, uint16_t level) const { - for (uint16_t __xpto = 0; __xpto < level; __xpto++) os << ' '; + for (uint16_t __xpto = 0; __xpto < level; __xpto++) + { + os << ' '; + } } diff --git a/src/internet-apps/model/radvd.cc b/src/internet-apps/model/radvd.cc index 91b34b414..9ff7d6648 100644 --- a/src/internet-apps/model/radvd.cc +++ b/src/internet-apps/model/radvd.cc @@ -273,7 +273,9 @@ void Radvd::Send (Ptr config, Ipv6Address dst, bool reschedule) if (config->IsInitialRtrAdv ()) { if (delay > MAX_INITIAL_RTR_ADVERT_INTERVAL) - delay = MAX_INITIAL_RTR_ADVERT_INTERVAL; + { + delay = MAX_INITIAL_RTR_ADVERT_INTERVAL; + } } NS_LOG_INFO ("Reschedule in " << delay << " milliseconds"); diff --git a/src/internet-apps/model/v4ping.cc b/src/internet-apps/model/v4ping.cc index 08fada3cb..f74b8e613 100644 --- a/src/internet-apps/model/v4ping.cc +++ b/src/internet-apps/model/v4ping.cc @@ -212,7 +212,10 @@ V4Ping::Send () // be too surprised when you see that this is a little endian convention. // uint8_t* data = new uint8_t[m_size]; - for (uint32_t i = 0; i < m_size; ++i) data[i] = 0; + for (uint32_t i = 0; i < m_size; ++i) + { + data[i] = 0; + } NS_ASSERT (m_size >= 16); uint32_t tmp = GetNode ()->GetId (); @@ -287,9 +290,10 @@ V4Ping::StopApplication () << "time " << (Simulator::Now () - m_started).As (Time::MS) << "\n"; if (m_avgRtt.Count () > 0) - os << "rtt min/avg/max/mdev = " << m_avgRtt.Min () << "/" << m_avgRtt.Avg () << "/" - << m_avgRtt.Max () << "/" << m_avgRtt.Stddev () - << " ms\n"; + { + os << "rtt min/avg/max/mdev = " << m_avgRtt.Min () << "/" << m_avgRtt.Avg () << "/" + << m_avgRtt.Max () << "/" << m_avgRtt.Stddev () << " ms\n"; + } std::cout << os.str (); } } diff --git a/src/internet/helper/ipv4-routing-helper.h b/src/internet/helper/ipv4-routing-helper.h index da7f50d8f..2fe6f2429 100644 --- a/src/internet/helper/ipv4-routing-helper.h +++ b/src/internet/helper/ipv4-routing-helper.h @@ -278,7 +278,9 @@ Ptr Ipv4RoutingHelper::GetRouting (Ptr protocol) int16_t priority; ret = GetRouting (lrp->GetRoutingProtocol (i, priority)); // potential recursion, if inside ListRouting is ListRouting if (ret) - break; + { + break; + } } } } diff --git a/src/internet/helper/ipv6-routing-helper.h b/src/internet/helper/ipv6-routing-helper.h index ef109abf8..4aa1484c1 100644 --- a/src/internet/helper/ipv6-routing-helper.h +++ b/src/internet/helper/ipv6-routing-helper.h @@ -278,7 +278,9 @@ Ptr Ipv6RoutingHelper::GetRouting (Ptr protocol) int16_t priority; ret = GetRouting (lrp->GetRoutingProtocol (i, priority)); // potential recursion, if inside ListRouting is ListRouting if (ret) - break; + { + break; + } } } } diff --git a/src/internet/model/global-route-manager-impl.cc b/src/internet/model/global-route-manager-impl.cc index d1a67f37a..4018f092d 100644 --- a/src/internet/model/global-route-manager-impl.cc +++ b/src/internet/model/global-route-manager-impl.cc @@ -159,7 +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 == nullptr) continue; + if (p == nullptr) + { + continue; + } NS_LOG_LOGIC ("Parent vertex-" << m_vertexId << " deleting its child vertex-" << p->GetVertexId ()); delete p; p = nullptr; @@ -884,8 +887,11 @@ GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate) w->GetDistanceFromRoot ()); } else - NS_ASSERT_MSG (0, "SPFNexthopCalculation never " - << "return false, but it does now!"); + { + NS_ASSERT_MSG (0, + "SPFNexthopCalculation never " + << "return false, but it does now!"); + } } else if (w_lsa->GetStatus () == GlobalRoutingLSA::LSA_SPF_CANDIDATE) { @@ -2197,7 +2203,10 @@ GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v) { SPFVertex* parent; // check if all parents of vertex v - if ((parent = v->GetParent (i++)) == nullptr) break; + if ((parent = v->GetParent (i++)) == nullptr) + { + break; + } parent->AddChild (v); } } diff --git a/src/internet/model/ipv4-end-point-demux.cc b/src/internet/model/ipv4-end-point-demux.cc index 2dbfdc943..4ea02e67f 100644 --- a/src/internet/model/ipv4-end-point-demux.cc +++ b/src/internet/model/ipv4-end-point-demux.cc @@ -285,7 +285,9 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, // if no match here, keep looking if (!localAddressIsSubnetAny) - continue; + { + continue; + } } bool remotePortMatchesExact = endP->GetPeerPort () == sport; @@ -296,9 +298,13 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, // If remote does not match either with exact or wildcard, // skip this one if (!(remotePortMatchesExact || remotePortMatchesWildCard)) - continue; + { + continue; + } if (!(remoteAddressMatchesExact || remoteAddressMatchesWildCard)) - continue; + { + continue; + } bool localAddressMatchesWildCard = localAddressIsAny || localAddressIsSubnetAny; @@ -326,10 +332,22 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport, // Here we find the most exact match EndPoints retval; - if (!retval4.empty ()) retval = retval4; - else if (!retval3.empty ()) retval = retval3; - else if (!retval2.empty ()) retval = retval2; - else retval = retval1; + if (!retval4.empty ()) + { + retval = retval4; + } + else if (!retval3.empty ()) + { + retval = retval3; + } + else if (!retval2.empty ()) + { + retval = retval2; + } + else + { + retval = retval1; + } NS_ABORT_MSG_IF (retval.size () > 1, "Too many endpoints - perhaps you created too many sockets without binding them to different NetDevices."); return retval; // might be empty if no matches diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc index f0358b7c0..f7213aa1b 100644 --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -544,7 +544,10 @@ Ipv4L3Protocol::IsDestinationAddress (Ipv4Address address, uint32_t iif) const { for (uint32_t j = 0; j < GetNInterfaces (); j++) { - if (j == uint32_t (iif)) continue; + if (j == uint32_t (iif)) + { + continue; + } for (uint32_t i = 0; i < GetNAddresses (j); i++) { Ipv4InterfaceAddress iaddr = GetAddress (j, i); @@ -962,9 +965,7 @@ Ipv4L3Protocol::BuildHeader ( } void -Ipv4L3Protocol::SendRealOut (Ptr route, - Ptr packet, - Ipv4Header const &ipHeader) +Ipv4L3Protocol::SendRealOut (Ptr route, Ptr packet, const Ipv4Header& ipHeader) { NS_LOG_FUNCTION (this << route << packet << &ipHeader); if (!route) @@ -1090,7 +1091,7 @@ Ipv4L3Protocol::IpForward (Ptr rtentry, Ptr p, const Ip } void -Ipv4L3Protocol::LocalDeliver (Ptr packet, Ipv4Header const&ip, uint32_t iif) +Ipv4L3Protocol::LocalDeliver (Ptr packet, const Ipv4Header& ip, uint32_t iif) { NS_LOG_FUNCTION (this << packet << &ip << iif); Ptr p = packet->Copy (); // need to pass a non-const packet up @@ -1264,8 +1265,14 @@ Ipv4L3Protocol::SelectSourceAddress (Ptr device, for (uint32_t j = 0; j < GetNAddresses (i); j++) { iaddr = GetAddress (i, j); - if (iaddr.IsSecondary ()) continue; - if (iaddr.GetScope () > scope) continue; + if (iaddr.IsSecondary ()) + { + continue; + } + if (iaddr.GetScope () > scope) + { + continue; + } if (dst.CombineMask (iaddr.GetMask ()) == iaddr.GetLocal ().CombineMask (iaddr.GetMask ()) ) { return iaddr.GetLocal (); @@ -1288,7 +1295,10 @@ Ipv4L3Protocol::SelectSourceAddress (Ptr device, for (uint32_t j = 0; j < GetNAddresses (i); j++) { iaddr = GetAddress (i, j); - if (iaddr.IsSecondary ()) continue; + if (iaddr.IsSecondary ()) + { + continue; + } if (iaddr.GetScope () != Ipv4InterfaceAddress::LINK && iaddr.GetScope () <= scope) { diff --git a/src/internet/model/ipv6-end-point-demux.cc b/src/internet/model/ipv6-end-point-demux.cc index ce717e888..a6b09b60c 100644 --- a/src/internet/model/ipv6-end-point-demux.cc +++ b/src/internet/model/ipv6-end-point-demux.cc @@ -279,10 +279,22 @@ Ipv6EndPointDemux::EndPoints Ipv6EndPointDemux::Lookup (Ipv6Address daddr, uint1 // Here we find the most exact match EndPoints retval; - if (!retval4.empty ()) retval = retval4; - else if (!retval3.empty ()) retval = retval3; - else if (!retval2.empty ()) retval = retval2; - else retval = retval1; + if (!retval4.empty ()) + { + retval = retval4; + } + else if (!retval3.empty ()) + { + retval = retval3; + } + else if (!retval2.empty ()) + { + retval = retval2; + } + else + { + retval = retval1; + } NS_ABORT_MSG_IF (retval.size () > 1, "Too many endpoints - perhaps you created too many sockets without binding them to different NetDevices."); return retval; // might be empty if no matches diff --git a/src/internet/model/pending-data.cc b/src/internet/model/pending-data.cc index 1704cb0b2..8776253d1 100644 --- a/src/internet/model/pending-data.cc +++ b/src/internet/model/pending-data.cc @@ -125,7 +125,10 @@ uint32_t PendingData::SizeFromOffset (uint32_t offset) { // Find out how much data is available from offset NS_LOG_FUNCTION (this << offset); /// \todo should this return zero, or error out? - if (offset > size) return 0; // No data at requested offset + if (offset > size) + { + return 0; // No data at requested offset + } return size - offset; // Available data after offset } diff --git a/src/internet/model/tcp-rx-buffer.cc b/src/internet/model/tcp-rx-buffer.cc index cbfad69c5..c9a424cc9 100644 --- a/src/internet/model/tcp-rx-buffer.cc +++ b/src/internet/model/tcp-rx-buffer.cc @@ -127,7 +127,10 @@ TcpRxBuffer::SetFinSequence (const SequenceNumber32& s) m_gotFin = true; m_finSeq = s; - if (m_nextRxSeq == m_finSeq) ++m_nextRxSeq; + if (m_nextRxSeq == m_finSeq) + { + ++m_nextRxSeq; + } } bool @@ -137,7 +140,7 @@ TcpRxBuffer::Finished () } bool -TcpRxBuffer::Add (Ptr p, TcpHeader const& tcph) +TcpRxBuffer::Add (Ptr p, const TcpHeader& tcph) { NS_LOG_FUNCTION (this << p << tcph); @@ -148,12 +151,21 @@ TcpRxBuffer::Add (Ptr p, TcpHeader const& tcph) << ", when NextRxSeq=" << m_nextRxSeq << ", buffsize=" << m_size); // Trim packet to fit Rx window specification - if (headSeq < m_nextRxSeq) headSeq = m_nextRxSeq; + if (headSeq < m_nextRxSeq) + { + headSeq = m_nextRxSeq; + } if (m_data.size ()) { SequenceNumber32 maxSeq = m_data.begin ()->first + SequenceNumber32 (m_maxBuffer); - if (maxSeq < tailSeq) tailSeq = maxSeq; - if (tailSeq < headSeq) headSeq = tailSeq; + if (maxSeq < tailSeq) + { + tailSeq = maxSeq; + } + if (tailSeq < headSeq) + { + headSeq = tailSeq; + } } // Remove overlapped bytes from packet BufIterator i = m_data.begin (); @@ -367,7 +379,10 @@ TcpRxBuffer::Extract (uint32_t maxSize) uint32_t extractSize = std::min (maxSize, m_availBytes); NS_LOG_LOGIC ("Requested to extract " << extractSize << " bytes from TcpRxBuffer of size=" << m_size); - if (extractSize == 0) return nullptr; // No contiguous block to return + if (extractSize == 0) + { + return nullptr; // No contiguous block to return + } NS_ASSERT (m_data.size ()); // At least we have something to extract Ptr outPkt = Create (); // The packet that contains all the data to return BufIterator i; diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index b04e073c6..3e2dbdf61 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -3575,7 +3575,7 @@ TcpSocketBase::EstimateRtt (const TcpHeader& tcpHeader) // when the three-way handshake completed. This cancels retransmission timer // and advances Tx window void -TcpSocketBase::NewAck (SequenceNumber32 const& ack, bool resetRTO) +TcpSocketBase::NewAck (const SequenceNumber32& ack, bool resetRTO) { NS_LOG_FUNCTION (this << ack); @@ -4488,7 +4488,10 @@ TcpSocketBase::UpdatePacingRate () // Similar to Linux, do not update pacing rate here if the // congestion control implements TcpCongestionOps::CongControl () - if (m_congestionControl->HasCongControl () || !m_tcb->m_pacing) return; + if (m_congestionControl->HasCongControl () || !m_tcb->m_pacing) + { + return; + } double factor; if (m_tcb->m_cWnd < m_tcb->m_ssThresh/2) diff --git a/src/internet/model/tcp-tx-buffer.cc b/src/internet/model/tcp-tx-buffer.cc index 4d3ab491a..73494a7b5 100644 --- a/src/internet/model/tcp-tx-buffer.cc +++ b/src/internet/model/tcp-tx-buffer.cc @@ -1198,7 +1198,9 @@ TcpTxBuffer::IsLostRFC (const SequenceNumber32 &seq, const PacketList::const_ite if (beginOfCurrentPacket >= m_highestSack.second) { if (item->m_lost && !item->m_retrans) - return true; + { + return true; + } NS_LOG_INFO ("seq=" << seq << " is not lost because there are no sacked segment ahead"); return false; @@ -1462,15 +1464,15 @@ TcpTxBuffer::ConsistencyCheck () const " stored retrans: " << m_retrans); } -std::ostream & -operator<< (std::ostream & os, TcpTxItem const & item) +std::ostream& +operator<< (std::ostream& os, const TcpTxItem& item) { item.Print (os); return os; } -std::ostream & -operator<< (std::ostream & os, TcpTxBuffer const & tcpTxBuf) +std::ostream& +operator<< (std::ostream& os, const TcpTxBuffer& tcpTxBuf) { TcpTxBuffer::PacketList::const_iterator it; std::stringstream ss; diff --git a/src/internet/model/udp-socket-impl.cc b/src/internet/model/udp-socket-impl.cc index a3622ab79..fef0ef902 100644 --- a/src/internet/model/udp-socket-impl.cc +++ b/src/internet/model/udp-socket-impl.cc @@ -585,12 +585,16 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port, uint8_t Ipv4InterfaceAddress iaddr = ipv4->GetAddress (i, 0); Ipv4Address addri = iaddr.GetLocal (); if (addri == Ipv4Address ("127.0.0.1")) - continue; + { + continue; + } // Check if interface-bound socket if (m_boundnetdevice) { if (ipv4->GetNetDevice (i) != m_boundnetdevice) - continue; + { + continue; + } } NS_LOG_LOGIC ("Sending one copy from " << addri << " to " << dest); m_udp->Send (p->Copy (), addri, dest, diff --git a/src/internet/test/tcp-close-test.cc b/src/internet/test/tcp-close-test.cc index a4298ff98..f8e008a81 100644 --- a/src/internet/test/tcp-close-test.cc +++ b/src/internet/test/tcp-close-test.cc @@ -50,9 +50,13 @@ protected: void NormalClose (SocketWho who) override { if (who == SENDER) - m_sendClose = true; + { + m_sendClose = true; + } else - m_recvClose = true; + { + m_recvClose = true; + } } /** diff --git a/src/internet/test/tcp-datasentcb-test.cc b/src/internet/test/tcp-datasentcb-test.cc index 81bf85916..5ad5e857a 100644 --- a/src/internet/test/tcp-datasentcb-test.cc +++ b/src/internet/test/tcp-datasentcb-test.cc @@ -79,7 +79,9 @@ TcpSocketHalfAck::ReceivedData (Ptr packet, const TcpHeader &tcpHeader) Ptr halved = packet->Copy (); if (times % 2 == 0) - halved->RemoveAtEnd (packet->GetSize () / 2); + { + halved->RemoveAtEnd (packet->GetSize () / 2); + } times++; diff --git a/src/internet/test/tcp-tx-buffer-test.cc b/src/internet/test/tcp-tx-buffer-test.cc index c21b71ba3..28332581f 100644 --- a/src/internet/test/tcp-tx-buffer-test.cc +++ b/src/internet/test/tcp-tx-buffer-test.cc @@ -119,26 +119,37 @@ TcpTxBufferTestCase::TestIsLost () txBuf->Add(Create (10000)); - for (uint8_t i = 0; i <10 ; ++i) - txBuf->CopyFromSequence (1000, SequenceNumber32((i*1000)+1)); + for (uint8_t i = 0; i < 10; ++i) + { + txBuf->CopyFromSequence (1000, SequenceNumber32 ((i * 1000) + 1)); + } - for (uint8_t i = 0; i < 10 ; ++i) - NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost(SequenceNumber32((i*1000)+1)), false, - "Lost is true, but it's not"); + for (uint8_t i = 0; i < 10; ++i) + { + NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost (SequenceNumber32 ((i * 1000) + 1)), + false, + "Lost is true, but it's not"); + } sack->AddSackBlock (TcpOptionSack::SackBlock (SequenceNumber32 (1001), SequenceNumber32 (2001))); txBuf->Update(sack->GetSackList()); - for (uint8_t i = 0; i < 10 ; ++i) - NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost(SequenceNumber32((i*1000)+1)), false, - "Lost is true, but it's not"); + for (uint8_t i = 0; i < 10; ++i) + { + NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost (SequenceNumber32 ((i * 1000) + 1)), + false, + "Lost is true, but it's not"); + } sack->AddSackBlock (TcpOptionSack::SackBlock (SequenceNumber32 (2001), SequenceNumber32 (3001))); txBuf->Update(sack->GetSackList()); - for (uint8_t i = 0; i < 10 ; ++i) - NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost(SequenceNumber32((i*1000)+1)), false, - "Lost is true, but it's not"); + for (uint8_t i = 0; i < 10; ++i) + { + NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost (SequenceNumber32 ((i * 1000) + 1)), + false, + "Lost is true, but it's not"); + } sack->AddSackBlock (TcpOptionSack::SackBlock (SequenceNumber32 (3001), SequenceNumber32 (4001))); txBuf->Update(sack->GetSackList()); @@ -146,11 +157,12 @@ TcpTxBufferTestCase::TestIsLost () NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost(SequenceNumber32(1)), true, "Lost is true, but it's not"); - for (uint8_t i = 1; i < 10 ; ++i) - NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost(SequenceNumber32((i*1000)+1)), false, - "Lost is true, but it's not"); - - + for (uint8_t i = 1; i < 10; ++i) + { + NS_TEST_ASSERT_MSG_EQ (txBuf->IsLost (SequenceNumber32 ((i * 1000) + 1)), + false, + "Lost is true, but it's not"); + } } uint32_t diff --git a/src/lte/model/cqa-ff-mac-scheduler.cc b/src/lte/model/cqa-ff-mac-scheduler.cc index cf98355d8..87f84be44 100644 --- a/src/lte/model/cqa-ff-mac-scheduler.cc +++ b/src/lte/model/cqa-ff-mac-scheduler.cc @@ -1096,8 +1096,10 @@ CqaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche std::map ::iterator itRlcBufferReq = m_rlcBufferReq.find (itLogicalChannels->first); - if (itRlcBufferReq==m_rlcBufferReq.end ()) - continue; + if (itRlcBufferReq == m_rlcBufferReq.end ()) + { + continue; + } int group = -1; int delay = 0; @@ -1337,7 +1339,9 @@ CqaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche itStats = m_flowStatsDl.find (flowId.m_rnti); double tbr_weight = (*itStats).second.targetThroughput / (*itStats).second.lastAveragedThroughput; if (tbr_weight < 1.0) - tbr_weight = 1.0; + { + tbr_weight = 1.0; + } if (itRntiCQIsMap != m_a30CqiRxed.end ()) { @@ -1346,10 +1350,14 @@ CqaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche try { int val = (itRntiCQIsMap->second.m_higherLayerSelected.at (*it).m_sbCqi.at (0)); - if (val==0) - val=1; //if no info, use minimum + if (val == 0) + { + val = 1; // if no info, use minimum + } if (*it == currentRB) - cqi_value = val; + { + cqi_value = val; + } coita_sum+=val; } @@ -1378,7 +1386,9 @@ CqaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche { qos_rb_and_CQI_assigned_to_lc e = itRBG->second; if (e.cqi_value_for_lc < worstCQIAmongRBGsAllocatedForThisUser) - worstCQIAmongRBGsAllocatedForThisUser=e.cqi_value_for_lc; + { + worstCQIAmongRBGsAllocatedForThisUser = e.cqi_value_for_lc; + } } if (cqi_value < worstCQIAmongRBGsAllocatedForThisUser) @@ -1424,8 +1434,10 @@ CqaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche int hol = UEtoHOL.find (flowId)->second; - if (hol==0) - hol=1; + if (hol == 0) + { + hol = 1; + } if ( m_CqaMetric.compare ("CqaFf") == 0) { @@ -1509,8 +1521,10 @@ CqaFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche newDci.m_rnti = (*itMap).first; newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first); uint16_t lcActives = LcActivePerFlow (itMap->first); - if (lcActives==0) // if there is still no buffer report information on any flow - lcActives = 1; + if (lcActives == 0) + { // if there is still no buffer report information on any flow + lcActives = 1; + } // NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives); uint16_t RgbPerRnti = (*itMap).second.size (); double doubleRBgPerRnti = RgbPerRnti; diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index e944a4616..d43abff7b 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -920,7 +920,9 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it++) { if ((m_ffrSapProvider->IsDlRbgAvailableForUe (i, (*it).first)) == false) - continue; + { + continue; + } std::set ::iterator itRnti = rntiAllocated.find ((*it).first); if ((itRnti != rntiAllocated.end ())||(!HarqProcessAvailability ((*it).first))) diff --git a/src/lte/model/pss-ff-mac-scheduler.cc b/src/lte/model/pss-ff-mac-scheduler.cc index 6200819e8..8b98c5331 100644 --- a/src/lte/model/pss-ff-mac-scheduler.cc +++ b/src/lte/model/pss-ff-mac-scheduler.cc @@ -1056,8 +1056,10 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche // select UE set for frequency domain scheduler uint32_t nMux; - if ( m_nMux > 0) - nMux = m_nMux; + if (m_nMux > 0) + { + nMux = m_nMux; + } else { // select half number of UE @@ -1083,7 +1085,9 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche } if (nMux == 0) - break; + { + break; + } for (itSet = ueSet2.begin (); itSet != ueSet2.end () && nMux != 0; itSet++) { @@ -1094,7 +1098,9 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche } if (nMux == 0) - break; + { + break; + } } // end of m_flowStatsDl @@ -1162,19 +1168,25 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche for (int i = 0; i < rbgNum; i++) { if (rbgMap.at (i) == true) - continue; + { + continue; + } std::map ::iterator itMax = tdUeSet.end (); double metricMax = 0.0; for (it = tdUeSet.begin (); it != tdUeSet.end (); it++) { if ((m_ffrSapProvider->IsDlRbgAvailableForUe (i, (*it).first)) == false) - continue; + { + continue; + } // calculate PF weight double weight = (*it).second.targetThroughput / (*it).second.lastAveragedThroughput; if (weight < 1.0) - weight = 1.0; + { + weight = 1.0; + } std::map < uint16_t, uint8_t>::iterator itSbCqiSum; itSbCqiSum = sbCqiSum.find((*it).first); @@ -1229,9 +1241,13 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche double metric = 0.0; if (colMetric != 0) - metric= weight * colMetric; + { + metric = weight * colMetric; + } else - metric = 1; + { + metric = 1; + } if (metric > metricMax ) { @@ -1260,18 +1276,24 @@ PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sche for (int i = 0; i < rbgNum; i++) { if (rbgMap.at (i) == true) - continue; + { + continue; + } std::map ::iterator itMax = tdUeSet.end (); double metricMax = 0.0; for (it = tdUeSet.begin (); it != tdUeSet.end (); it++) { if ((m_ffrSapProvider->IsDlRbgAvailableForUe (i, (*it).first)) == false) - continue; + { + continue; + } // calculate PF weight double weight = (*it).second.targetThroughput / (*it).second.lastAveragedThroughput; if (weight < 1.0) - weight = 1.0; + { + weight = 1.0; + } std::map ::iterator itCqi; itCqi = m_a30CqiRxed.find ((*it).first); diff --git a/src/lte/model/tdtbfq-ff-mac-scheduler.cc b/src/lte/model/tdtbfq-ff-mac-scheduler.cc index c51e42ae9..0791640bc 100644 --- a/src/lte/model/tdtbfq-ff-mac-scheduler.cc +++ b/src/lte/model/tdtbfq-ff-mac-scheduler.cc @@ -1059,11 +1059,15 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S std::vector tempMap; for (int i = 0; i < rbgNum; i++) { - if ( rbgMap.at (i) == true) // this RBG is allocated in RACH procedure - continue; + if (rbgMap.at (i) == true) + { // this RBG is allocated in RACH procedure + continue; + } if ((m_ffrSapProvider->IsDlRbgAvailableForUe (i, (*itMax).first)) == false) - continue; + { + continue; + } tempMap.push_back (i); rbgMap.at (i) = true; @@ -1238,10 +1242,14 @@ TdTbfqFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::S { (*itMax).second.counter = (*itMax).second.counter - ( bytesTxed - (*itMax).second.tokenPoolSize ); (*itMax).second.tokenPoolSize = 0; - if (bankSize <= ( bytesTxed - (*itMax).second.tokenPoolSize )) - bankSize = 0; + if (bankSize <= (bytesTxed - (*itMax).second.tokenPoolSize)) + { + bankSize = 0; + } else - bankSize = bankSize - ( bytesTxed - (*itMax).second.tokenPoolSize ); + { + bankSize = bankSize - (bytesTxed - (*itMax).second.tokenPoolSize); + } } diff --git a/src/lte/test/lte-test-carrier-aggregation.cc b/src/lte/test/lte-test-carrier-aggregation.cc index d62574275..9b811e5b6 100644 --- a/src/lte/test/lte-test-carrier-aggregation.cc +++ b/src/lte/test/lte-test-carrier-aggregation.cc @@ -98,7 +98,9 @@ TestCarrierAggregationSuite::TestCarrierAggregationSuite () } if (abort) - return; + { + return; + } AddTestCase (new CarrierAggregationTestCase (1,0, 100, 100, 1), TestCase::QUICK); AddTestCase (new CarrierAggregationTestCase (3,0, 100, 100, 1), TestCase::QUICK); @@ -422,7 +424,9 @@ CarrierAggregationTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ (testUplinkShare, true , " Uplink traffic not split equally between carriers"); if (s_writeResults) - WriteResultToFile (); + { + WriteResultToFile (); + } Simulator::Destroy (); } diff --git a/src/lte/test/lte-test-fdmt-ff-mac-scheduler.cc b/src/lte/test/lte-test-fdmt-ff-mac-scheduler.cc index 2909a9464..32a1ffe7e 100644 --- a/src/lte/test/lte-test-fdmt-ff-mac-scheduler.cc +++ b/src/lte/test/lte-test-fdmt-ff-mac-scheduler.cc @@ -298,7 +298,9 @@ LenaFdMtFfMacSchedulerTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ_TOL (0, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!"); } else - NS_TEST_ASSERT_MSG_EQ_TOL (throughput, 0, 0, " Unfair Throughput!"); + { + NS_TEST_ASSERT_MSG_EQ_TOL (throughput, 0, 0, " Unfair Throughput!"); + } } /** diff --git a/src/lte/test/lte-test-tdmt-ff-mac-scheduler.cc b/src/lte/test/lte-test-tdmt-ff-mac-scheduler.cc index 3110c0980..e2c9ea992 100644 --- a/src/lte/test/lte-test-tdmt-ff-mac-scheduler.cc +++ b/src/lte/test/lte-test-tdmt-ff-mac-scheduler.cc @@ -300,7 +300,9 @@ LenaTdMtFfMacSchedulerTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ_TOL (0, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!"); } else - NS_TEST_ASSERT_MSG_EQ_TOL (throughput, 0, 0, " Unfair Throughput!"); + { + NS_TEST_ASSERT_MSG_EQ_TOL (throughput, 0, 0, " Unfair Throughput!"); + } } /** diff --git a/src/lte/test/lte-test-tta-ff-mac-scheduler.cc b/src/lte/test/lte-test-tta-ff-mac-scheduler.cc index a4ce53475..07e139fe1 100644 --- a/src/lte/test/lte-test-tta-ff-mac-scheduler.cc +++ b/src/lte/test/lte-test-tta-ff-mac-scheduler.cc @@ -303,7 +303,9 @@ LenaTtaFfMacSchedulerTestCase::DoRun () NS_TEST_ASSERT_MSG_EQ_TOL (0, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!"); } else - NS_TEST_ASSERT_MSG_EQ_TOL (throughput, 0, 0, " Unfair Throughput!"); + { + NS_TEST_ASSERT_MSG_EQ_TOL (throughput, 0, 0, " Unfair Throughput!"); + } } /** diff --git a/src/mesh/examples/mesh.cc b/src/mesh/examples/mesh.cc index d5e45b51f..a0eabf438 100644 --- a/src/mesh/examples/mesh.cc +++ b/src/mesh/examples/mesh.cc @@ -265,7 +265,9 @@ MeshTest::CreateNodes () mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (nodes); if (m_pcap) - wifiPhy.EnablePcapAll (std::string ("mp")); + { + wifiPhy.EnablePcapAll (std::string ("mp")); + } if (m_ascii) { AsciiTraceHelper ascii; diff --git a/src/mesh/model/dot11s/peer-link-frame.cc b/src/mesh/model/dot11s/peer-link-frame.cc index ecdf70923..7c0a78c37 100644 --- a/src/mesh/model/dot11s/peer-link-frame.cc +++ b/src/mesh/model/dot11s/peer-link-frame.cc @@ -83,7 +83,10 @@ PeerLinkOpenStart::GetSerializedSize () const uint32_t size =0; //Peering protocol size += 2; //capability size += m_rates.GetSerializedSize (); - if (m_rates.GetNRates () > 8) size += m_rates.extended->GetSerializedSize (); + if (m_rates.GetNRates () > 8) + { + size += m_rates.extended->GetSerializedSize (); + } size += m_meshId.GetInformationFieldSize () + 2; size += m_config.GetInformationFieldSize () + 2; return size; @@ -95,7 +98,10 @@ PeerLinkOpenStart::Serialize (Buffer::Iterator start) const i.WriteHtolsbU16 (m_capability); i = m_rates.Serialize (i); - if (m_rates.GetNRates () > 8) i = m_rates.extended->Serialize (i); + if (m_rates.GetNRates () > 8) + { + i = m_rates.extended->Serialize (i); + } i = m_meshId.Serialize (i); i = m_config.Serialize (i); } @@ -262,7 +268,10 @@ PeerLinkConfirmStart::GetSerializedSize () const size += 2; //capability size += 2; //AID of remote peer size += m_rates.GetSerializedSize (); - if (m_rates.GetNRates () > 8) size += m_rates.extended->GetSerializedSize (); + if (m_rates.GetNRates () > 8) + { + size += m_rates.extended->GetSerializedSize (); + } size += m_config.GetInformationFieldSize () + 2; return size; } @@ -274,7 +283,10 @@ PeerLinkConfirmStart::Serialize (Buffer::Iterator start) const i.WriteHtolsbU16 (m_capability); i.WriteHtolsbU16 (m_aid); i = m_rates.Serialize (i); - if (m_rates.GetNRates () > 8) i = m_rates.extended->Serialize (i); + if (m_rates.GetNRates () > 8) + { + i = m_rates.extended->Serialize (i); + } i = m_config.Serialize (i); } uint32_t diff --git a/src/mesh/model/dot11s/peer-management-protocol.cc b/src/mesh/model/dot11s/peer-management-protocol.cc index a1284e200..808b2d3a0 100644 --- a/src/mesh/model/dot11s/peer-management-protocol.cc +++ b/src/mesh/model/dot11s/peer-management-protocol.cc @@ -346,9 +346,14 @@ PeerManagementProtocol::GetPeerLinks () const for (PeerLinksMap::const_iterator iface = m_peerLinks.begin (); iface != m_peerLinks.end (); ++iface) { for (PeerLinksOnInterface::const_iterator i = iface->second.begin (); - i != iface->second.end (); i++) - if ((*i)->LinkIsEstab ()) - links.push_back (*i); + i != iface->second.end (); + i++) + { + if ((*i)->LinkIsEstab ()) + { + links.push_back (*i); + } + } } return links; } diff --git a/src/mobility/examples/reference-point-group-mobility-example.cc b/src/mobility/examples/reference-point-group-mobility-example.cc index d6276d149..661d5faac 100644 --- a/src/mobility/examples/reference-point-group-mobility-example.cc +++ b/src/mobility/examples/reference-point-group-mobility-example.cc @@ -77,9 +77,15 @@ std::ofstream g_timeSeries; void PrintPosition (Ptr node) { - if (!node) return; + if (!node) + { + return; + } Ptr model = node->GetObject (); - if (!model) return; + if (!model) + { + return; + } NS_LOG_LOGIC ("Node: " << node->GetId () << " Position: " << model->GetPosition ()); g_timeSeries << Simulator::Now ().GetSeconds () << " " << node->GetId () << " " << model->GetPosition () << std::endl; diff --git a/src/mobility/helper/ns2-mobility-helper.cc b/src/mobility/helper/ns2-mobility-helper.cc index 7e2fc3d2c..fd445d43f 100644 --- a/src/mobility/helper/ns2-mobility-helper.cc +++ b/src/mobility/helper/ns2-mobility-helper.cc @@ -225,7 +225,11 @@ Ns2MobilityHelper::Ns2MobilityHelper (std::string filename) : m_filename (filename) { std::ifstream file (m_filename.c_str (), std::ios::in); - if (!(file.is_open ())) NS_FATAL_ERROR("Could not open trace file " << m_filename.c_str() << " for reading, aborting here \n"); + if (!(file.is_open ())) + { + NS_FATAL_ERROR ("Could not open trace file " << m_filename.c_str () + << " for reading, aborting here \n"); + } } Ptr diff --git a/src/mobility/model/gauss-markov-mobility-model.cc b/src/mobility/model/gauss-markov-mobility-model.cc index f2695eb18..076da0a31 100644 --- a/src/mobility/model/gauss-markov-mobility-model.cc +++ b/src/mobility/model/gauss-markov-mobility-model.cc @@ -155,7 +155,10 @@ GaussMarkovMobilityModel::DoWalk (Time delayLeft) nextPosition.x += speed.x * delayLeft.GetSeconds (); nextPosition.y += speed.y * delayLeft.GetSeconds (); nextPosition.z += speed.z * delayLeft.GetSeconds (); - if (delayLeft.GetSeconds () < 0.0) delayLeft = Seconds (1.0); + if (delayLeft.GetSeconds () < 0.0) + { + delayLeft = Seconds (1.0); + } // Make sure that the position by the next time step is still within the boundary. // If out of bounds, then alter the velocity vector and average direction to keep the position in bounds diff --git a/src/mobility/model/geographic-positions.cc b/src/mobility/model/geographic-positions.cc index e3f0865af..93b08aada 100644 --- a/src/mobility/model/geographic-positions.cc +++ b/src/mobility/model/geographic-positions.cc @@ -147,7 +147,10 @@ GeographicPositions::CartesianToGeographicCoordinates (Vector pos, EarthSpheroid lla.x = -180 - lla.x; lla.y += lla.y < 0 ? 180 : -180; } - if (lla.y == 180.0) lla.y = -180; + if (lla.y == 180.0) + { + lla.y = -180; + } // make sure lat/lon in the right range to double check canonicalization // and conversion routine @@ -226,7 +229,9 @@ GeographicPositions::RandCartesianPointsAroundGeographicPoint (double originLati //flip / mirror point if it has phi in quadrant II or III (wasn't //resolved correctly by arcsin) across longitude 0 if (phi > (M_PI_2) && phi <= (3 * M_PI_2)) - intermedLong = -intermedLong; + { + intermedLong = -intermedLong; + } // shift longitude to be referenced to origin double randPointLongitude = intermedLong + originLongitudeRadians; diff --git a/src/netanim/examples/colors-link-description.cc b/src/netanim/examples/colors-link-description.cc index 5765c230a..654eac797 100644 --- a/src/netanim/examples/colors-link-description.cc +++ b/src/netanim/examples/colors-link-description.cc @@ -68,16 +68,20 @@ void modify () static uint32_t index = 0; index++; if (index == 3) - index = 0; + { + index = 0; + } struct rgb color = colors[index]; for (uint32_t nodeId = 4; nodeId < 12; ++nodeId) - pAnim->UpdateNodeColor (nodeId, color.r, color.g, color.b); - - - if (Simulator::Now ().GetSeconds () < 10) // This is important or the simulation - // will run endlessly - Simulator::Schedule (Seconds (1), modify); + { + pAnim->UpdateNodeColor (nodeId, color.r, color.g, color.b); + } + if (Simulator::Now ().GetSeconds () < 10) + { // This is important or the simulation + // will run endlessly + Simulator::Schedule (Seconds (1), modify); + } } int main (int argc, char *argv[]) diff --git a/src/netanim/examples/resources-counters.cc b/src/netanim/examples/resources-counters.cc index 68dc10743..7b2b893df 100644 --- a/src/netanim/examples/resources-counters.cc +++ b/src/netanim/examples/resources-counters.cc @@ -75,21 +75,31 @@ void modify () pAnim->UpdateNodeImage (3, currentResourceId); size *= 1.1; if (size > 20) - size = 1; + { + size = 1; + } pAnim->UpdateNodeSize (3, 10, 10); if (currentResourceId == resourceId1) - currentResourceId = resourceId2; + { + currentResourceId = resourceId2; + } else - currentResourceId = resourceId1; + { + currentResourceId = resourceId1; + } // Every update change the color for node 4 static uint32_t index = 0; index++; if (index == 3) - index = 0; + { + index = 0; + } struct rgb color = colors[index]; for (uint32_t nodeId = 4; nodeId < 12; ++nodeId) - pAnim->UpdateNodeColor (nodeId, color.r, color.g, color.b); + { + pAnim->UpdateNodeColor (nodeId, color.r, color.g, color.b); + } // Update Node Counter for node 0 and node 5, use some random number between 0 to 1000 for value Ptr rv = CreateObject (); @@ -100,10 +110,11 @@ void modify () pAnim->UpdateNodeCounter (nodeCounterIdDouble1, 5, rv->GetValue (100.0, 200.0)); pAnim->UpdateNodeCounter (nodeCounterIdDouble2, 5, rv->GetValue (300.0, 400.0)); - if (Simulator::Now ().GetSeconds () < 10) // This is important or the simulation - // will run endlessly - Simulator::Schedule (Seconds (0.1), modify); - + if (Simulator::Now ().GetSeconds () < 10) + { // This is important or the simulation + // will run endlessly + Simulator::Schedule (Seconds (0.1), modify); + } } int main (int argc, char *argv[]) diff --git a/src/network/model/buffer.cc b/src/network/model/buffer.cc index 76fe48aa6..6d52a1fcc 100644 --- a/src/network/model/buffer.cc +++ b/src/network/model/buffer.cc @@ -255,8 +255,8 @@ Buffer::Initialize (uint32_t zeroSize) NS_ASSERT (CheckInternalState ()); } -Buffer & -Buffer::operator = (Buffer const&o) +Buffer& +Buffer::operator= (const Buffer& o) { NS_ASSERT (CheckInternalState ()); if (m_data != o.m_data) @@ -705,8 +705,7 @@ Buffer::TransformIntoRealBuffer () const NS_ASSERT (CheckInternalState ()); } - -uint8_t const* +const uint8_t* Buffer::PeekData () const { NS_LOG_FUNCTION (this); @@ -783,9 +782,8 @@ Buffer::CopyData (uint8_t *buffer, uint32_t size) const * The buffer iterator below. ******************************************************/ - uint32_t -Buffer::Iterator::GetDistanceFrom (Iterator const &o) const +Buffer::Iterator::GetDistanceFrom (const Iterator& o) const { NS_LOG_FUNCTION (this << &o); NS_ASSERT (m_data == o.m_data); @@ -950,8 +948,9 @@ Buffer::Iterator::WriteHtonU64 (uint64_t data) WriteU8 ((data >> 8) & 0xff); WriteU8 ((data >> 0) & 0xff); } + void -Buffer::Iterator::Write (uint8_t const*buffer, uint32_t size) +Buffer::Iterator::Write (const uint8_t* buffer, uint32_t size) { NS_LOG_FUNCTION (this << &buffer << size); NS_ASSERT_MSG (CheckNoZero (m_current, size), @@ -1144,14 +1143,20 @@ Buffer::Iterator::CalculateIpChecksum (uint16_t size, uint32_t initialChecksum) /* see RFC 1071 to understand this code. */ uint32_t sum = initialChecksum; - for (int j = 0; j < size/2; j++) - sum += ReadU16 (); + for (int j = 0; j < size / 2; j++) + { + sum += ReadU16 (); + } if (size & 1) - sum += ReadU8 (); + { + sum += ReadU8 (); + } while (sum >> 16) - sum = (sum & 0xffff) + (sum >> 16); + { + sum = (sum & 0xffff) + (sum >> 16); + } return ~sum; } diff --git a/src/network/test/buffer-test.cc b/src/network/test/buffer-test.cc index cbcb40570..119b651e1 100644 --- a/src/network/test/buffer-test.cc +++ b/src/network/test/buffer-test.cc @@ -60,7 +60,7 @@ BufferTest::EnsureWrittenBytes (Buffer b, uint32_t n, uint8_t array[]) { bool success = true; uint8_t *expected = array; - uint8_t const*got; + const uint8_t* got; got = b.PeekData (); for (uint32_t j = 0; j < n; j++) { @@ -304,7 +304,9 @@ BufferTest::DoRun () { Buffer::Iterator iter = inputBuffer.Begin (); for (uint32_t i = 0; i < actualSize; i++) - iter.WriteU8 (static_cast (bytesRng->GetValue ())); + { + iter.WriteU8 (static_cast (bytesRng->GetValue ())); + } } outputBuffer.AddAtEnd (chunkSize); @@ -355,7 +357,7 @@ BufferTest::DoRun () i.Write ((const uint8_t*)ct.c_str (), ct.size ()); uint32_t sizeBuffer = buffer.GetSize (); NS_TEST_ASSERT_MSG_EQ (sizeBuffer, ct.size(), "Buffer bad size"); - uint8_t const* evilBuffer = buffer.PeekData (); + const uint8_t* evilBuffer = buffer.PeekData (); NS_TEST_ASSERT_MSG_NE( evilBuffer, 0, "Buffer PeekData failed"); uint8_t *cBuf = (uint8_t*) malloc ( sizeBuffer ); uint32_t copyLen = buffer.CopyData (cBuf, sizeBuffer); diff --git a/src/network/test/packet-test-suite.cc b/src/network/test/packet-test-suite.cc index d5c2ad9f3..db321c4a4 100644 --- a/src/network/test/packet-test-suite.cc +++ b/src/network/test/packet-test-suite.cc @@ -1115,7 +1115,10 @@ PacketTagListTest::DoRun () const int nIterations = 100; for (int i = 0; i < nIterations; ++i) { int now = AddRemoveTime (); - if (now < flm) flm = now; + if (now < flm) + { + flm = now; + } } std::cout << GetName () << "min add+remove time: " << std::setw (8) << flm << " ticks" @@ -1137,7 +1140,10 @@ PacketTagListTest::DoRun () case 1: now = RemoveTime (ref, t1); break; } // switch - if (now < rmn[j]) rmn[j] = now; + if (now < rmn[j]) + { + rmn[j] = now; + } } // for tag j } // for iteration i for (int j = tagLast; j > 0; --j) { diff --git a/src/network/test/pcap-file-test-suite.cc b/src/network/test/pcap-file-test-suite.cc index 05615458c..eb83ec593 100644 --- a/src/network/test/pcap-file-test-suite.cc +++ b/src/network/test/pcap-file-test-suite.cc @@ -521,37 +521,58 @@ FileHeaderTestCase::DoRun () size_t result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() magic number"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 0xa1b2c3d4, "Magic number written incorrectly"); result = std::fread (&val16, sizeof(val16), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() version major"); - if (bigEndian) val16 = Swap (val16); + if (bigEndian) + { + val16 = Swap (val16); + } NS_TEST_ASSERT_MSG_EQ (val16, 2, "Version major written incorrectly"); result = std::fread (&val16, sizeof(val16), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() version minor"); - if (bigEndian) val16 = Swap (val16); + if (bigEndian) + { + val16 = Swap (val16); + } NS_TEST_ASSERT_MSG_EQ (val16, 4, "Version minor written incorrectly"); result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() time zone correction"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 7, "Version minor written incorrectly"); result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() sig figs"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 0, "Sig figs written incorrectly"); result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() snap length"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 5678, "Snap length written incorrectly"); result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() data link type"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 1234, "Data length type written incorrectly"); std::fclose (p); @@ -797,22 +818,34 @@ RecordHeaderTestCase::DoRun () size_t result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() seconds timestamp"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 1234, "Seconds timestamp written incorrectly"); result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() microseconds timestamp"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 5678, "Microseconds timestamp written incorrectly"); result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() included length"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 43, "Included length written incorrectly"); result = std::fread (&val32, sizeof(val32), 1, p); NS_TEST_ASSERT_MSG_EQ (result, 1, "Unable to fread() actual length"); - if (bigEndian) val32 = Swap (val32); + if (bigEndian) + { + val32 = Swap (val32); + } NS_TEST_ASSERT_MSG_EQ (val32, 128, "Actual length written incorrectly"); // @@ -1065,7 +1098,7 @@ ReadFileTestCase::DoRun () for (uint32_t i = 0; i < N_KNOWN_PACKETS; ++i) { - PacketEntry const & p = knownPackets[i]; + const PacketEntry& p = knownPackets[i]; f.Read (data, sizeof(data), tsSec, tsUsec, inclLen, origLen, readLen); NS_TEST_ASSERT_MSG_EQ (f.Fail (), false, "Read() of known good pcap file returns error"); @@ -1130,9 +1163,9 @@ DiffTestCase::DoRun () for (uint32_t i = 0; i < N_KNOWN_PACKETS; ++i) { - PacketEntry const & p = knownPackets[i]; + const PacketEntry& p = knownPackets[i]; - f.Write (p.tsSec, p.tsUsec, (uint8_t const *)p.data, p.origLen); + f.Write (p.tsSec, p.tsUsec, (const uint8_t*)p.data, p.origLen); NS_TEST_EXPECT_MSG_EQ (f.Fail (), false, "Write must not fail"); } f.Close (); diff --git a/src/network/utils/ipv6-address.cc b/src/network/utils/ipv6-address.cc index faf233bb4..809f63717 100644 --- a/src/network/utils/ipv6-address.cc +++ b/src/network/utils/ipv6-address.cc @@ -206,7 +206,9 @@ static bool AsciiToIpv6Host (const char *address, uint8_t addr[16]) if (!seen_xdigits) { if (colonp) - return (0); + { + return (0); + } colonp = tp; continue; } @@ -285,21 +287,21 @@ Ipv6Address::Ipv6Address () m_initialized = false; } -Ipv6Address::Ipv6Address (Ipv6Address const& addr) +Ipv6Address::Ipv6Address (const Ipv6Address& addr) { // Do not add function logging here, to avoid stack overflow memcpy (m_address, addr.m_address, 16); m_initialized = true; } -Ipv6Address::Ipv6Address (Ipv6Address const* addr) +Ipv6Address::Ipv6Address (const Ipv6Address* addr) { // Do not add function logging here, to avoid stack overflow memcpy (m_address, addr->m_address, 16); m_initialized = true; } -Ipv6Address::Ipv6Address (char const* address) +Ipv6Address::Ipv6Address (const char* address) { NS_LOG_FUNCTION (this << address); AsciiToIpv6Host (address, m_address); @@ -320,7 +322,8 @@ Ipv6Address::~Ipv6Address () NS_LOG_FUNCTION (this); } -void Ipv6Address::Set (char const* address) +void +Ipv6Address::Set (const char* address) { NS_LOG_FUNCTION (this << address); AsciiToIpv6Host (address, m_address); @@ -743,7 +746,8 @@ bool Ipv6Address::IsIpv4MappedAddress () const return (false); } -Ipv6Address Ipv6Address::CombinePrefix (Ipv6Prefix const& prefix) const +Ipv6Address +Ipv6Address::CombinePrefix (const Ipv6Prefix& prefix) const { NS_LOG_FUNCTION (this << prefix); Ipv6Address ipv6; @@ -813,7 +817,8 @@ bool Ipv6Address::IsDocumentation () const return false; } -bool Ipv6Address::HasPrefix (Ipv6Prefix const& prefix) const +bool +Ipv6Address::HasPrefix (const Ipv6Prefix& prefix) const { NS_LOG_FUNCTION (this << prefix); @@ -931,7 +936,8 @@ bool Ipv6Address::IsInitialized () const return (m_initialized); } -std::ostream& operator << (std::ostream& os, Ipv6Address const& address) +std::ostream& +operator<< (std::ostream& os, const Ipv6Address& address) { address.Print (os); return os; @@ -952,7 +958,7 @@ Ipv6Prefix::Ipv6Prefix () m_prefixLength = 64; } -Ipv6Prefix::Ipv6Prefix (char const* prefix) +Ipv6Prefix::Ipv6Prefix (const char* prefix) { NS_LOG_FUNCTION (this << prefix); AsciiToIpv6Host (prefix, m_prefix); @@ -966,7 +972,7 @@ Ipv6Prefix::Ipv6Prefix (uint8_t prefix[16]) m_prefixLength = GetMinimumPrefixLength (); } -Ipv6Prefix::Ipv6Prefix (char const* prefix, uint8_t prefixLength) +Ipv6Prefix::Ipv6Prefix (const char* prefix, uint8_t prefixLength) { NS_LOG_FUNCTION (this << prefix); AsciiToIpv6Host (prefix, m_prefix); @@ -1024,13 +1030,13 @@ Ipv6Prefix::Ipv6Prefix (uint8_t prefix) } } -Ipv6Prefix::Ipv6Prefix (Ipv6Prefix const& prefix) +Ipv6Prefix::Ipv6Prefix (const Ipv6Prefix& prefix) { memcpy (m_prefix, prefix.m_prefix, 16); m_prefixLength = prefix.m_prefixLength; } -Ipv6Prefix::Ipv6Prefix (Ipv6Prefix const* prefix) +Ipv6Prefix::Ipv6Prefix (const Ipv6Prefix* prefix) { memcpy (m_prefix, prefix->m_prefix, 16); m_prefixLength = prefix->m_prefixLength; @@ -1146,7 +1152,8 @@ uint8_t Ipv6Prefix::GetMinimumPrefixLength () const return 128 - prefixLength; } -std::ostream& operator << (std::ostream& os, Ipv6Prefix const& prefix) +std::ostream& +operator<< (std::ostream& os, const Ipv6Prefix& prefix) { prefix.Print (os); return os; @@ -1160,7 +1167,8 @@ std::istream& operator >> (std::istream& is, Ipv6Prefix& prefix) return is; } -size_t Ipv6AddressHash::operator () (Ipv6Address const &x) const +size_t +Ipv6AddressHash::operator() (const Ipv6Address& x) const { uint8_t buf[16]; diff --git a/src/network/utils/output-stream-wrapper.cc b/src/network/utils/output-stream-wrapper.cc index 712ed8003..751e79bad 100644 --- a/src/network/utils/output-stream-wrapper.cc +++ b/src/network/utils/output-stream-wrapper.cc @@ -50,7 +50,10 @@ OutputStreamWrapper::~OutputStreamWrapper () { NS_LOG_FUNCTION (this); FatalImpl::UnregisterStream (m_ostream); - if (m_destroyable) delete m_ostream; + if (m_destroyable) + { + delete m_ostream; + } m_ostream = nullptr; } diff --git a/src/network/utils/packetbb.cc b/src/network/utils/packetbb.cc index 1de83336f..9ccb2ce36 100644 --- a/src/network/utils/packetbb.cc +++ b/src/network/utils/packetbb.cc @@ -986,7 +986,9 @@ PbbPacket::operator== (const PbbPacket &other) const if (HasSequenceNumber ()) { if (GetSequenceNumber () != other.GetSequenceNumber ()) - return false; + { + return false; + } } if (m_tlvList != other.m_tlvList) diff --git a/src/nix-vector-routing/examples/nms-p2p-nix.cc b/src/nix-vector-routing/examples/nms-p2p-nix.cc index af2ec7316..c9ea74cfc 100644 --- a/src/nix-vector-routing/examples/nms-p2p-nix.cc +++ b/src/nix-vector-routing/examples/nms-p2p-nix.cc @@ -77,13 +77,17 @@ public: p (new T*[x]), m_xMax (x) { for (size_t i = 0; i < m_xMax; i++) - p[i] = new T[y]; + { + p[i] = new T[y]; + } } ~Array2D () { for (size_t i = 0; i < m_xMax; i++) - delete[] p[i]; + { + delete[] p[i]; + } delete[] p; p = nullptr; } @@ -119,7 +123,9 @@ public: Array3D (const size_t x, const size_t y, const size_t z) : p (new Array2D*[x]), m_xMax (x) { for (size_t i = 0; i < m_xMax; i++) - p[i] = new Array2D (y, z); + { + p[i] = new Array2D (y, z); + } } ~Array3D () diff --git a/src/point-to-point-layout/model/point-to-point-grid.cc b/src/point-to-point-layout/model/point-to-point-grid.cc index 4527488e8..9aa30a359 100644 --- a/src/point-to-point-layout/model/point-to-point-grid.cc +++ b/src/point-to-point-layout/model/point-to-point-grid.cc @@ -73,7 +73,9 @@ PointToPointGridHelper::PointToPointGridHelper (uint32_t nRows, m_rowDevices.push_back (rowDevices); if (y > 0) - m_colDevices.push_back (colDevices); + { + m_colDevices.push_back (colDevices); + } } } diff --git a/src/propagation/test/three-gpp-propagation-loss-model-test-suite.cc b/src/propagation/test/three-gpp-propagation-loss-model-test-suite.cc index 373dcd9b2..e591b0594 100644 --- a/src/propagation/test/three-gpp-propagation-loss-model-test-suite.cc +++ b/src/propagation/test/three-gpp-propagation-loss-model-test-suite.cc @@ -1094,9 +1094,23 @@ ThreeGppShadowingTestCase::RunTest (uint16_t testNum, std::string propagationLos for (int i = 0; i < 200; i++) { if (i % 2 == 0) - Simulator::Schedule (MilliSeconds (1000 * i), &ThreeGppShadowingTestCase::EvaluateLoss, this, a, b, testNum); + { + Simulator::Schedule (MilliSeconds (1000 * i), + &ThreeGppShadowingTestCase::EvaluateLoss, + this, + a, + b, + testNum); + } else - Simulator::Schedule (MilliSeconds (1000 * i), &ThreeGppShadowingTestCase::EvaluateLoss, this, b, a, testNum); + { + Simulator::Schedule (MilliSeconds (1000 * i), + &ThreeGppShadowingTestCase::EvaluateLoss, + this, + b, + a, + testNum); + } } Simulator::Run (); diff --git a/src/spectrum/helper/tv-spectrum-transmitter-helper.cc b/src/spectrum/helper/tv-spectrum-transmitter-helper.cc index c8a048a9e..a5808ca02 100644 --- a/src/spectrum/helper/tv-spectrum-transmitter-helper.cc +++ b/src/spectrum/helper/tv-spectrum-transmitter-helper.cc @@ -398,7 +398,10 @@ TvSpectrumTransmitterHelper::GenerateRegionalTransmitterIndices (const double st { double element = startFrequencies[i]; //add all non-zero frequencies to vector (0 means unused channel) - if (element != 0) startFreqVector.push_back(element); + if (element != 0) + { + startFreqVector.push_back (element); + } } //randomly generate number of transmitters to create based on density diff --git a/src/stats/model/average.h b/src/stats/model/average.h index ccdc3a769..14f690200 100644 --- a/src/stats/model/average.h +++ b/src/stats/model/average.h @@ -160,12 +160,17 @@ private: * \return the ouput stream. */ template -std::ostream & operator<< (std::ostream & os, Average const & x) +std::ostream& +operator<< (std::ostream& os, const Average& x) { if (x.Count () != 0) - os << x.Avg () << " (" << x.Stddev () << ") [" << x.Min () << ", " << x.Max () << "]"; + { + os << x.Avg () << " (" << x.Stddev () << ") [" << x.Min () << ", " << x.Max () << "]"; + } else - os << "NA"; // not available + { + os << "NA"; // not available + } return os; } } diff --git a/src/stats/model/gnuplot.cc b/src/stats/model/gnuplot.cc index 6b6f13bc8..d6498d126 100644 --- a/src/stats/model/gnuplot.cc +++ b/src/stats/model/gnuplot.cc @@ -121,7 +121,9 @@ GnuplotDataset::GnuplotDataset (const GnuplotDataset& original) GnuplotDataset::~GnuplotDataset() { if (--m_data->m_references == 0) - delete m_data; + { + delete m_data; + } } GnuplotDataset& GnuplotDataset::operator= (const GnuplotDataset& original) @@ -129,7 +131,9 @@ GnuplotDataset& GnuplotDataset::operator= (const GnuplotDataset& original) if (this != &original) { if (--m_data->m_references == 0) - delete m_data; + { + delete m_data; + } m_data = original.m_data; ++m_data->m_references; @@ -216,7 +220,9 @@ Gnuplot2dDataset::Data2d::PrintExpression (std::ostream &os, } if (m_title.size ()) - os << " title \"" << m_title << "\""; + { + os << " title \"" << m_title << "\""; + } switch (m_style) { case LINES: @@ -274,7 +280,9 @@ Gnuplot2dDataset::Data2d::PrintExpression (std::ostream &os, } if (m_extra.size ()) - os << " " << m_extra; + { + os << " " << m_extra; + } } void @@ -459,10 +467,14 @@ Gnuplot2dFunction::Function2d::PrintExpression (std::ostream &os, os << m_function; if (m_title.size ()) - os << " title \"" << m_title << "\""; + { + os << " title \"" << m_title << "\""; + } if (m_extra.size ()) - os << " " << m_extra; + { + os << " " << m_extra; + } } void @@ -540,13 +552,19 @@ Gnuplot3dDataset::Data3d::PrintExpression (std::ostream &os, os << "\"-\" "; if (m_style.size ()) - os << " " << m_style; + { + os << " " << m_style; + } if (m_title.size ()) - os << " title \"" << m_title << "\""; + { + os << " title \"" << m_title << "\""; + } if (m_extra.size ()) - os << " " << m_extra; + { + os << " " << m_extra; + } } void @@ -661,10 +679,14 @@ Gnuplot3dFunction::Function3d::PrintExpression (std::ostream &os, os << m_function; if (m_title.size ()) - os << " title \"" << m_title << "\""; + { + os << " title \"" << m_title << "\""; + } if (m_extra.size ()) - os << " " << m_extra; + { + os << " " << m_extra; + } } void @@ -710,7 +732,10 @@ void Gnuplot::SetOutputFilename (const std::string& outputFilename) std::string Gnuplot::DetectTerminal (const std::string& filename) { std::string::size_type dotpos = filename.rfind ('.'); - if (dotpos == std::string::npos) return ""; + if (dotpos == std::string::npos) + { + return ""; + } if (filename.substr (dotpos) == ".png") { return "png"; @@ -777,25 +802,39 @@ Gnuplot::GenerateOutput (std::ostream &osControl, std::string dataFileName) { if (m_terminal.size ()) - osControl << "set terminal " << m_terminal << std::endl; + { + osControl << "set terminal " << m_terminal << std::endl; + } if (m_outputFilename.size ()) - osControl << "set output \"" << m_outputFilename << "\"" << std::endl; + { + osControl << "set output \"" << m_outputFilename << "\"" << std::endl; + } if (m_title.size ()) - osControl << "set title \"" << m_title << "\"" << std::endl; + { + osControl << "set title \"" << m_title << "\"" << std::endl; + } if (m_xLegend.size ()) - osControl << "set xlabel \"" << m_xLegend << "\"" << std::endl; + { + osControl << "set xlabel \"" << m_xLegend << "\"" << std::endl; + } if (m_yLegend.size ()) - osControl << "set ylabel \"" << m_yLegend << "\"" << std::endl; + { + osControl << "set ylabel \"" << m_yLegend << "\"" << std::endl; + } if (m_extra.size ()) - osControl << m_extra << std::endl; + { + osControl << m_extra << std::endl; + } if (m_datasets.empty ()) - return; + { + return; + } // Determine the GetCommand() values of all datasets included. Check that all // are equal and print the command. @@ -876,9 +915,13 @@ Gnuplot& GnuplotCollection::GetPlot (unsigned int id) { if (id >= m_plots.size ()) - throw(std::range_error ("Gnuplot id is out of range")); + { + throw (std::range_error ("Gnuplot id is out of range")); + } else - return m_plots[id]; + { + return m_plots[id]; + } } void @@ -888,10 +931,14 @@ GnuplotCollection::GenerateOutput (std::ostream &os) // single output file is being generated. if (m_terminal.size ()) - os << "set terminal " << m_terminal << std::endl; + { + os << "set terminal " << m_terminal << std::endl; + } if (m_outputFilename.size ()) - os << "set output \"" << m_outputFilename << "\"" << std::endl; + { + os << "set output \"" << m_outputFilename << "\"" << std::endl; + } for (Plots::iterator i = m_plots.begin (); i != m_plots.end (); ++i) { @@ -907,10 +954,14 @@ std::string dataFileName) // separate output and date files are being generated. if (m_terminal.size ()) - osControl << "set terminal " << m_terminal << std::endl; + { + osControl << "set terminal " << m_terminal << std::endl; + } if (m_outputFilename.size ()) - osControl << "set output \"" << m_outputFilename << "\"" << std::endl; + { + osControl << "set output \"" << m_outputFilename << "\"" << std::endl; + } for (Plots::iterator i = m_plots.begin (); i != m_plots.end (); ++i) { diff --git a/src/stats/model/omnet-data-output.cc b/src/stats/model/omnet-data-output.cc index 867b49774..a20ed3a02 100644 --- a/src/stats/model/omnet-data-output.cc +++ b/src/stats/model/omnet-data-output.cc @@ -75,18 +75,26 @@ inline bool isNumeric (const std::string& s) { for (std::string::const_iterator it = s.begin (); it != s.end (); it++) { if ((*it == '.') && (decimalPtSeen)) - return false; + { + return false; + } else if (*it == '.') - decimalPtSeen = true; + { + decimalPtSeen = true; + } else if ((*it == 'e') && exponentSeen) - return false; + { + return false; + } else if (*it == 'e') { exponentSeen = true; decimalPtSeen = false; } else if (*it == '-' && it != s.begin () && last != 'e') - return false; + { + return false; + } last = *it; } @@ -162,24 +170,42 @@ OmnetDataOutput::OmnetOutputCallback::OutputStatistic (std::string context, NS_LOG_FUNCTION (this << context << name << statSum); if (context == "") - context = "."; + { + context = "."; + } if (name == "") - name = "\"\""; + { + name = "\"\""; + } (*m_scalar) << "statistic " << context << " " << name << std::endl; if (!isNaN (statSum->getCount ())) - (*m_scalar) << "field count " << statSum->getCount () << std::endl; + { + (*m_scalar) << "field count " << statSum->getCount () << std::endl; + } if (!isNaN (statSum->getSum ())) - (*m_scalar) << "field sum " << statSum->getSum () << std::endl; + { + (*m_scalar) << "field sum " << statSum->getSum () << std::endl; + } if (!isNaN (statSum->getMean ())) - (*m_scalar) << "field mean " << statSum->getMean () << std::endl; + { + (*m_scalar) << "field mean " << statSum->getMean () << std::endl; + } if (!isNaN (statSum->getMin ())) - (*m_scalar) << "field min " << statSum->getMin () << std::endl; + { + (*m_scalar) << "field min " << statSum->getMin () << std::endl; + } if (!isNaN (statSum->getMax ())) - (*m_scalar) << "field max " << statSum->getMax () << std::endl; + { + (*m_scalar) << "field max " << statSum->getMax () << std::endl; + } if (!isNaN (statSum->getSqrSum ())) - (*m_scalar) << "field sqrsum " << statSum->getSqrSum () << std::endl; + { + (*m_scalar) << "field sqrsum " << statSum->getSqrSum () << std::endl; + } if (!isNaN (statSum->getStddev ())) - (*m_scalar) << "field stddev " << statSum->getStddev () << std::endl; + { + (*m_scalar) << "field stddev " << statSum->getStddev () << std::endl; + } } void @@ -190,9 +216,13 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, NS_LOG_FUNCTION (this << context << name << val); if (context == "") - context = "."; + { + context = "."; + } if (name == "") - name = "\"\""; + { + name = "\"\""; + } (*m_scalar) << "scalar " << context << " " << name << " " << val << std::endl; // end OmnetDataOutput::OmnetOutputCallback::OutputSingleton } @@ -205,9 +235,13 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, NS_LOG_FUNCTION (this << context << name << val); if (context == "") - context = "."; + { + context = "."; + } if (name == "") - name = "\"\""; + { + name = "\"\""; + } (*m_scalar) << "scalar " << context << " " << name << " " << val << std::endl; // end OmnetDataOutput::OmnetOutputCallback::OutputSingleton } @@ -220,9 +254,13 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, NS_LOG_FUNCTION (this << context << name << val); if (context == "") - context = "."; + { + context = "."; + } if (name == "") - name = "\"\""; + { + name = "\"\""; + } (*m_scalar) << "scalar " << context << " " << name << " " << val << std::endl; // end OmnetDataOutput::OmnetOutputCallback::OutputSingleton } @@ -235,9 +273,13 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, NS_LOG_FUNCTION (this << context << name << val); if (context == "") - context = "."; + { + context = "."; + } if (name == "") - name = "\"\""; + { + name = "\"\""; + } (*m_scalar) << "scalar " << context << " " << name << " " << val << std::endl; // end OmnetDataOutput::OmnetOutputCallback::OutputSingleton } @@ -250,9 +292,13 @@ OmnetDataOutput::OmnetOutputCallback::OutputSingleton (std::string context, NS_LOG_FUNCTION (this << context << name << val); if (context == "") - context = "."; + { + context = "."; + } if (name == "") - name = "\"\""; + { + name = "\"\""; + } (*m_scalar) << "scalar " << context << " " << name << " " << val.GetTimeStep () << std::endl; // end OmnetDataOutput::OmnetOutputCallback::OutputSingleton } diff --git a/src/stats/model/time-data-calculators.cc b/src/stats/model/time-data-calculators.cc index 09bb12ff2..e19527fd5 100644 --- a/src/stats/model/time-data-calculators.cc +++ b/src/stats/model/time-data-calculators.cc @@ -69,11 +69,14 @@ TimeMinMaxAvgTotalCalculator::Update (const Time i) m_total += i; if (i < m_min) - m_min = i; + { + m_min = i; + } if (i > m_max) - m_max = i; - + { + m_max = i; + } } else { m_min = i; m_max = i; diff --git a/src/uan/examples/uan-rc-example.cc b/src/uan/examples/uan-rc-example.cc index 1f20ec86f..701131b1d 100644 --- a/src/uan/examples/uan-rc-example.cc +++ b/src/uan/examples/uan-rc-example.cc @@ -107,11 +107,14 @@ Experiment::CreateMode (uint32_t kass, uint32_t rate = m_totalRate/(m_numRates+1)* (kass); uint32_t bw = kass * m_totalRate / (m_numRates+1); uint32_t fcmode; - if(upperblock) - fcmode = (m_totalRate - bw)/2 + fc; + if (upperblock) + { + fcmode = (m_totalRate - bw) / 2 + fc; + } else - fcmode = (uint32_t)((-((double) m_totalRate ) + (double) bw)/2.0 + (double) fc); - + { + fcmode = (uint32_t)((-((double)m_totalRate) + (double)bw) / 2.0 + (double)fc); + } uint32_t phyrate = m_totalRate; diff --git a/src/uan/model/uan-header-common.cc b/src/uan/model/uan-header-common.cc index a0002dbbb..41621dbbd 100644 --- a/src/uan/model/uan-header-common.cc +++ b/src/uan/model/uan-header-common.cc @@ -84,15 +84,25 @@ void UanHeaderCommon::SetProtocolNumber (uint16_t protocolNumber) { if (protocolNumber == 0) - m_uanProtocolBits.m_protocolNumber = 0; + { + m_uanProtocolBits.m_protocolNumber = 0; + } else if (protocolNumber == IPV4_PROT_NUMBER) - m_uanProtocolBits.m_protocolNumber = 1; + { + m_uanProtocolBits.m_protocolNumber = 1; + } else if (protocolNumber == ARP_PROT_NUMBER) - m_uanProtocolBits.m_protocolNumber = 2; + { + m_uanProtocolBits.m_protocolNumber = 2; + } else if (protocolNumber == IPV6_PROT_NUMBER) - m_uanProtocolBits.m_protocolNumber = 3; + { + m_uanProtocolBits.m_protocolNumber = 3; + } else - NS_ASSERT_MSG (false, "UanHeaderCommon::SetProtocolNumber(): Protocol not supported"); + { + NS_ASSERT_MSG (false, "UanHeaderCommon::SetProtocolNumber(): Protocol not supported"); + } } Mac8Address @@ -115,11 +125,17 @@ uint16_t UanHeaderCommon::GetProtocolNumber () const { if (m_uanProtocolBits.m_protocolNumber == 1) - return IPV4_PROT_NUMBER; + { + return IPV4_PROT_NUMBER; + } if (m_uanProtocolBits.m_protocolNumber == 2) - return ARP_PROT_NUMBER; + { + return ARP_PROT_NUMBER; + } if (m_uanProtocolBits.m_protocolNumber == 3) - return IPV6_PROT_NUMBER; + { + return IPV6_PROT_NUMBER; + } return 0; } diff --git a/src/uan/model/uan-mac-aloha.cc b/src/uan/model/uan-mac-aloha.cc index 1b30ee3af..79577863c 100644 --- a/src/uan/model/uan-mac-aloha.cc +++ b/src/uan/model/uan-mac-aloha.cc @@ -97,7 +97,9 @@ UanMacAloha::Enqueue (Ptr packet, uint16_t protocolNumber, const Address return true; } else - return false; + { + return false; + } } void diff --git a/src/uan/model/uan-prop-model.cc b/src/uan/model/uan-prop-model.cc index 8a731d92d..7fbdb5274 100644 --- a/src/uan/model/uan-prop-model.cc +++ b/src/uan/model/uan-prop-model.cc @@ -204,7 +204,10 @@ UanPdp::SumTapsFromMaxC (Time delay, Time duration) const NS_ASSERT_MSG (GetNTaps () == 1, "Attempted to sum taps over time interval in " "UanPdp with resolution 0 and multiple taps"); - if (delay.IsZero ()) return m_taps[0].GetAmp (); + if (delay.IsZero ()) + { + return m_taps[0].GetAmp (); + } return std::complex (0.0, 0.0); } @@ -237,7 +240,10 @@ UanPdp::SumTapsFromMaxNc (Time delay, Time duration) const NS_ASSERT_MSG (GetNTaps () == 1, "Attempted to sum taps over time interval in " "UanPdp with resolution 0 and multiple taps"); - if (delay.IsZero ()) return std::abs (m_taps[0].GetAmp ()); + if (delay.IsZero ()) + { + return std::abs (m_taps[0].GetAmp ()); + } return 0; } diff --git a/src/wifi/model/eht/multi-link-element.cc b/src/wifi/model/eht/multi-link-element.cc index 99ffb3c36..c358be702 100644 --- a/src/wifi/model/eht/multi-link-element.cc +++ b/src/wifi/model/eht/multi-link-element.cc @@ -259,7 +259,10 @@ MultiLinkElement::SetMediumSyncDelayTimer (Time delay) delayUs /= 32; auto& mediumSyncDelayInfo = std::get (m_commonInfo).m_mediumSyncDelayInfo; - if (!mediumSyncDelayInfo.has_value ()) mediumSyncDelayInfo = CommonInfoBasicMle::MediumSyncDelayInfo {}; + if (!mediumSyncDelayInfo.has_value ()) + { + mediumSyncDelayInfo = CommonInfoBasicMle::MediumSyncDelayInfo{}; + } mediumSyncDelayInfo.value ().mediumSyncDuration = (delayUs & 0xff); } @@ -276,7 +279,10 @@ MultiLinkElement::SetMediumSyncOfdmEdThreshold (int8_t threshold) uint8_t value = 72 + threshold; auto& mediumSyncDelayInfo = std::get (m_commonInfo).m_mediumSyncDelayInfo; - if (!mediumSyncDelayInfo.has_value ()) mediumSyncDelayInfo = CommonInfoBasicMle::MediumSyncDelayInfo {}; + if (!mediumSyncDelayInfo.has_value ()) + { + mediumSyncDelayInfo = CommonInfoBasicMle::MediumSyncDelayInfo{}; + } mediumSyncDelayInfo.value ().mediumSyncOfdmEdThreshold = value; } @@ -293,7 +299,10 @@ MultiLinkElement::SetMediumSyncMaxNTxops (uint8_t nTxops) nTxops--; auto& mediumSyncDelayInfo = std::get (m_commonInfo).m_mediumSyncDelayInfo; - if (!mediumSyncDelayInfo.has_value ()) mediumSyncDelayInfo = CommonInfoBasicMle::MediumSyncDelayInfo {}; + if (!mediumSyncDelayInfo.has_value ()) + { + mediumSyncDelayInfo = CommonInfoBasicMle::MediumSyncDelayInfo{}; + } mediumSyncDelayInfo.value ().mediumSyncMaxNTxops = (nTxops & 0x0f); } @@ -570,7 +579,10 @@ MultiLinkElement::PerStaProfileSubelement::DeserializeInformationField (Buffer:: // TODO add other subfields of the STA Info field - if (count >= length) return count; + if (count >= length) + { + return count; + } if (m_frameType == WIFI_MAC_MGT_ASSOCIATION_REQUEST) { diff --git a/src/wifi/model/interference-helper.cc b/src/wifi/model/interference-helper.cc index 3b83f6b35..513cb8fdc 100644 --- a/src/wifi/model/interference-helper.cc +++ b/src/wifi/model/interference-helper.cc @@ -301,7 +301,7 @@ void InterferenceHelper::AppendEvent (Ptr event, bool isStartOfdmaRxing) { NS_LOG_FUNCTION (this << event << isStartOfdmaRxing); - for (auto const& it : event->GetRxPowerWPerBand ()) + for (const auto& it : event->GetRxPowerWPerBand ()) { WifiSpectrumBand band = it.first; auto niIt = m_niChangesPerBand.find (band); @@ -338,7 +338,7 @@ InterferenceHelper::UpdateEvent (Ptr event, const RxPowerWattPerChannelBa { NS_LOG_FUNCTION (this << event); //This is called for UL MU events, in order to scale power as long as UL MU PPDUs arrive - for (auto const& it : rxPower) + for (const auto& it : rxPower) { WifiSpectrumBand band = it.first; auto niIt = m_niChangesPerBand.find (band); @@ -395,7 +395,10 @@ InterferenceHelper::CalculateNoiseInterferenceW (Ptr event, NiChangesPerB } it = niIt->second.find (event->GetStartTime ()); NS_ASSERT (it != niIt->second.end ()); - for (; it != niIt->second.end () && it->second.GetEvent () != event; ++it); + for (; it != niIt->second.end () && it->second.GetEvent () != event; ++it) + { + ; + } NiChanges ni; ni.emplace (event->GetStartTime (), NiChange (0, event)); while (++it != niIt->second.end () && it->second.GetEvent () != event) diff --git a/src/wifi/model/mgt-headers.cc b/src/wifi/model/mgt-headers.cc index f8908aacf..a69106425 100644 --- a/src/wifi/model/mgt-headers.cc +++ b/src/wifi/model/mgt-headers.cc @@ -168,12 +168,30 @@ MgtProbeRequestHeader::GetSerializedSize () const uint32_t size = 0; size += m_ssid.GetSerializedSize (); size += m_rates.GetSerializedSize (); - if (m_rates.GetNRates () > 8) size += m_rates.extended->GetSerializedSize (); - if (m_extendedCapability.has_value ()) size += m_extendedCapability->GetSerializedSize (); - if (m_htCapability.has_value ()) size += m_htCapability->GetSerializedSize (); - if (m_vhtCapability.has_value ()) size += m_vhtCapability->GetSerializedSize (); - if (m_heCapability.has_value ()) size += m_heCapability->GetSerializedSize (); - if (m_ehtCapability.has_value ()) size += m_ehtCapability->GetSerializedSize (); + if (m_rates.GetNRates () > 8) + { + size += m_rates.extended->GetSerializedSize (); + } + if (m_extendedCapability.has_value ()) + { + size += m_extendedCapability->GetSerializedSize (); + } + if (m_htCapability.has_value ()) + { + size += m_htCapability->GetSerializedSize (); + } + if (m_vhtCapability.has_value ()) + { + size += m_vhtCapability->GetSerializedSize (); + } + if (m_heCapability.has_value ()) + { + size += m_heCapability->GetSerializedSize (); + } + if (m_ehtCapability.has_value ()) + { + size += m_ehtCapability->GetSerializedSize (); + } return size; } @@ -199,11 +217,26 @@ MgtProbeRequestHeader::Print (std::ostream &os) const { os << "ssid=" << m_ssid << ", " << "rates=" << m_rates << ", "; - if (m_extendedCapability.has_value ()) os << "Extended Capabilities=" << *m_extendedCapability << " , "; - if (m_htCapability.has_value ()) os << "HT Capabilities=" << *m_htCapability << " , "; - if (m_vhtCapability.has_value ()) os << "VHT Capabilities=" << *m_vhtCapability << " , "; - if (m_heCapability.has_value ()) os << "HE Capabilities=" << *m_heCapability << " , "; - if (m_ehtCapability.has_value ()) os << "EHT Capabilities=" << *m_ehtCapability; + if (m_extendedCapability.has_value ()) + { + os << "Extended Capabilities=" << *m_extendedCapability << " , "; + } + if (m_htCapability.has_value ()) + { + os << "HT Capabilities=" << *m_htCapability << " , "; + } + if (m_vhtCapability.has_value ()) + { + os << "VHT Capabilities=" << *m_vhtCapability << " , "; + } + if (m_heCapability.has_value ()) + { + os << "HE Capabilities=" << *m_heCapability << " , "; + } + if (m_ehtCapability.has_value ()) + { + os << "EHT Capabilities=" << *m_ehtCapability; + } } void @@ -212,12 +245,30 @@ MgtProbeRequestHeader::Serialize (Buffer::Iterator start) const Buffer::Iterator i = start; i = m_ssid.Serialize (i); i = m_rates.Serialize (i); - if (m_rates.GetNRates () > 8) i = m_rates.extended->Serialize (i); - if (m_extendedCapability.has_value ()) i = m_extendedCapability->Serialize (i); - if (m_htCapability.has_value ()) i = m_htCapability->Serialize (i); - if (m_vhtCapability.has_value ()) i = m_vhtCapability->Serialize (i); - if (m_heCapability.has_value ()) i = m_heCapability->Serialize (i); - if (m_ehtCapability.has_value ()) i = m_ehtCapability->Serialize (i); + if (m_rates.GetNRates () > 8) + { + i = m_rates.extended->Serialize (i); + } + if (m_extendedCapability.has_value ()) + { + i = m_extendedCapability->Serialize (i); + } + if (m_htCapability.has_value ()) + { + i = m_htCapability->Serialize (i); + } + if (m_vhtCapability.has_value ()) + { + i = m_vhtCapability->Serialize (i); + } + if (m_heCapability.has_value ()) + { + i = m_heCapability->Serialize (i); + } + if (m_ehtCapability.has_value ()) + { + i = m_ehtCapability->Serialize (i); + } } uint32_t @@ -600,21 +651,66 @@ MgtProbeResponseHeader::GetSerializedSize () const size += m_capability.GetSerializedSize (); size += m_ssid.GetSerializedSize (); size += m_rates.GetSerializedSize (); - if (m_dsssParameterSet.has_value ()) size += m_dsssParameterSet->GetSerializedSize (); - if (m_erpInformation.has_value ()) size += m_erpInformation->GetSerializedSize (); - if (m_rates.GetNRates () > 8) size += m_rates.extended->GetSerializedSize (); - if (m_edcaParameterSet.has_value ()) size += m_edcaParameterSet->GetSerializedSize (); - if (m_extendedCapability.has_value ()) size += m_extendedCapability->GetSerializedSize (); - if (m_htCapability.has_value ()) size += m_htCapability->GetSerializedSize (); - if (m_htOperation.has_value ()) size += m_htOperation->GetSerializedSize (); - if (m_vhtCapability.has_value ()) size += m_vhtCapability->GetSerializedSize (); - if (m_vhtOperation.has_value ()) size += m_vhtOperation->GetSerializedSize (); - if (m_reducedNeighborReport.has_value ()) size += m_reducedNeighborReport->GetSerializedSize (); - if (m_heCapability.has_value ()) size += m_heCapability->GetSerializedSize (); - if (m_heOperation.has_value ()) size += m_heOperation->GetSerializedSize (); - if (m_muEdcaParameterSet.has_value ()) size += m_muEdcaParameterSet->GetSerializedSize (); - if (m_multiLinkElement.has_value ()) size += m_multiLinkElement->GetSerializedSize (); - if (m_ehtCapability.has_value ()) size += m_ehtCapability->GetSerializedSize (); + if (m_dsssParameterSet.has_value ()) + { + size += m_dsssParameterSet->GetSerializedSize (); + } + if (m_erpInformation.has_value ()) + { + size += m_erpInformation->GetSerializedSize (); + } + if (m_rates.GetNRates () > 8) + { + size += m_rates.extended->GetSerializedSize (); + } + if (m_edcaParameterSet.has_value ()) + { + size += m_edcaParameterSet->GetSerializedSize (); + } + if (m_extendedCapability.has_value ()) + { + size += m_extendedCapability->GetSerializedSize (); + } + if (m_htCapability.has_value ()) + { + size += m_htCapability->GetSerializedSize (); + } + if (m_htOperation.has_value ()) + { + size += m_htOperation->GetSerializedSize (); + } + if (m_vhtCapability.has_value ()) + { + size += m_vhtCapability->GetSerializedSize (); + } + if (m_vhtOperation.has_value ()) + { + size += m_vhtOperation->GetSerializedSize (); + } + if (m_reducedNeighborReport.has_value ()) + { + size += m_reducedNeighborReport->GetSerializedSize (); + } + if (m_heCapability.has_value ()) + { + size += m_heCapability->GetSerializedSize (); + } + if (m_heOperation.has_value ()) + { + size += m_heOperation->GetSerializedSize (); + } + if (m_muEdcaParameterSet.has_value ()) + { + size += m_muEdcaParameterSet->GetSerializedSize (); + } + if (m_multiLinkElement.has_value ()) + { + size += m_multiLinkElement->GetSerializedSize (); + } + if (m_ehtCapability.has_value ()) + { + size += m_ehtCapability->GetSerializedSize (); + } return size; } @@ -623,15 +719,42 @@ MgtProbeResponseHeader::Print (std::ostream &os) const { os << "ssid=" << m_ssid << ", " << "rates=" << m_rates << ", "; - if (m_erpInformation.has_value ()) os << "ERP information=" << *m_erpInformation << ", "; - if (m_extendedCapability.has_value ()) os << "Extended Capabilities=" << *m_extendedCapability << " , "; - if (m_htCapability.has_value ()) os << "HT Capabilities=" << *m_htCapability << " , "; - if (m_htOperation.has_value ()) os << "HT Operation=" << *m_htOperation << " , "; - if (m_vhtCapability.has_value ()) os << "VHT Capabilities=" << *m_vhtCapability << " , "; - if (m_vhtOperation.has_value ()) os << "VHT Operation=" << *m_vhtOperation << " , "; - if (m_heCapability.has_value ()) os << "HE Capabilities=" << *m_heCapability << " , "; - if (m_heOperation.has_value ()) os << "HE Operation=" << *m_heOperation << " , "; - if (m_ehtCapability.has_value ()) os << "EHT Capabilities=" << *m_ehtCapability; + if (m_erpInformation.has_value ()) + { + os << "ERP information=" << *m_erpInformation << ", "; + } + if (m_extendedCapability.has_value ()) + { + os << "Extended Capabilities=" << *m_extendedCapability << " , "; + } + if (m_htCapability.has_value ()) + { + os << "HT Capabilities=" << *m_htCapability << " , "; + } + if (m_htOperation.has_value ()) + { + os << "HT Operation=" << *m_htOperation << " , "; + } + if (m_vhtCapability.has_value ()) + { + os << "VHT Capabilities=" << *m_vhtCapability << " , "; + } + if (m_vhtOperation.has_value ()) + { + os << "VHT Operation=" << *m_vhtOperation << " , "; + } + if (m_heCapability.has_value ()) + { + os << "HE Capabilities=" << *m_heCapability << " , "; + } + if (m_heOperation.has_value ()) + { + os << "HE Operation=" << *m_heOperation << " , "; + } + if (m_ehtCapability.has_value ()) + { + os << "EHT Capabilities=" << *m_ehtCapability; + } } void @@ -643,21 +766,66 @@ MgtProbeResponseHeader::Serialize (Buffer::Iterator start) const i = m_capability.Serialize (i); i = m_ssid.Serialize (i); i = m_rates.Serialize (i); - if (m_dsssParameterSet.has_value ()) i = m_dsssParameterSet->Serialize (i); - if (m_erpInformation.has_value ()) i = m_erpInformation->Serialize (i); - if (m_rates.GetNRates () > 8) i = m_rates.extended->Serialize (i); - if (m_edcaParameterSet.has_value ()) i = m_edcaParameterSet->Serialize (i); - if (m_extendedCapability.has_value ()) i = m_extendedCapability->Serialize (i); - if (m_htCapability.has_value ()) i = m_htCapability->Serialize (i); - if (m_htOperation.has_value ()) i = m_htOperation->Serialize (i); - if (m_vhtCapability.has_value ()) i = m_vhtCapability->Serialize (i); - if (m_vhtOperation.has_value ()) i = m_vhtOperation->Serialize (i); - if (m_reducedNeighborReport.has_value ()) i = m_reducedNeighborReport->Serialize (i); - if (m_heCapability.has_value ()) i = m_heCapability->Serialize (i); - if (m_heOperation.has_value ()) i = m_heOperation->Serialize (i); - if (m_muEdcaParameterSet.has_value ()) i = m_muEdcaParameterSet->Serialize (i); - if (m_multiLinkElement.has_value ()) i = m_multiLinkElement->Serialize (i); - if (m_ehtCapability.has_value ()) i = m_ehtCapability->Serialize (i); + if (m_dsssParameterSet.has_value ()) + { + i = m_dsssParameterSet->Serialize (i); + } + if (m_erpInformation.has_value ()) + { + i = m_erpInformation->Serialize (i); + } + if (m_rates.GetNRates () > 8) + { + i = m_rates.extended->Serialize (i); + } + if (m_edcaParameterSet.has_value ()) + { + i = m_edcaParameterSet->Serialize (i); + } + if (m_extendedCapability.has_value ()) + { + i = m_extendedCapability->Serialize (i); + } + if (m_htCapability.has_value ()) + { + i = m_htCapability->Serialize (i); + } + if (m_htOperation.has_value ()) + { + i = m_htOperation->Serialize (i); + } + if (m_vhtCapability.has_value ()) + { + i = m_vhtCapability->Serialize (i); + } + if (m_vhtOperation.has_value ()) + { + i = m_vhtOperation->Serialize (i); + } + if (m_reducedNeighborReport.has_value ()) + { + i = m_reducedNeighborReport->Serialize (i); + } + if (m_heCapability.has_value ()) + { + i = m_heCapability->Serialize (i); + } + if (m_heOperation.has_value ()) + { + i = m_heOperation->Serialize (i); + } + if (m_muEdcaParameterSet.has_value ()) + { + i = m_muEdcaParameterSet->Serialize (i); + } + if (m_multiLinkElement.has_value ()) + { + i = m_multiLinkElement->Serialize (i); + } + if (m_ehtCapability.has_value ()) + { + i = m_ehtCapability->Serialize (i); + } } uint32_t @@ -923,13 +1091,34 @@ MgtAssocRequestHeader::GetSerializedSize () const size += 2; size += m_ssid.GetSerializedSize (); size += m_rates.GetSerializedSize (); - if (m_rates.GetNRates () > 8) size += m_rates.extended->GetSerializedSize (); - if (m_extendedCapability.has_value ()) size += m_extendedCapability->GetSerializedSize (); - if (m_htCapability.has_value ()) size += m_htCapability->GetSerializedSize (); - if (m_vhtCapability.has_value ()) size += m_vhtCapability->GetSerializedSize (); - if (m_heCapability.has_value ()) size += m_heCapability->GetSerializedSize (); - if (m_multiLinkElement.has_value ()) size += m_multiLinkElement->GetSerializedSize (); - if (m_ehtCapability.has_value ()) size += m_ehtCapability->GetSerializedSize (); + if (m_rates.GetNRates () > 8) + { + size += m_rates.extended->GetSerializedSize (); + } + if (m_extendedCapability.has_value ()) + { + size += m_extendedCapability->GetSerializedSize (); + } + if (m_htCapability.has_value ()) + { + size += m_htCapability->GetSerializedSize (); + } + if (m_vhtCapability.has_value ()) + { + size += m_vhtCapability->GetSerializedSize (); + } + if (m_heCapability.has_value ()) + { + size += m_heCapability->GetSerializedSize (); + } + if (m_multiLinkElement.has_value ()) + { + size += m_multiLinkElement->GetSerializedSize (); + } + if (m_ehtCapability.has_value ()) + { + size += m_ehtCapability->GetSerializedSize (); + } return size; } @@ -938,11 +1127,26 @@ MgtAssocRequestHeader::Print (std::ostream &os) const { os << "ssid=" << m_ssid << ", " << "rates=" << m_rates << ", "; - if (m_extendedCapability.has_value ()) os << "Extended Capabilities=" << *m_extendedCapability << " , "; - if (m_htCapability.has_value ()) os << "HT Capabilities=" << *m_htCapability << " , "; - if (m_vhtCapability.has_value ()) os << "VHT Capabilities=" << *m_vhtCapability << " , "; - if (m_heCapability.has_value ()) os << "HE Capabilities=" << *m_heCapability << " , "; - if (m_ehtCapability.has_value ()) os << "EHT Capabilities=" << *m_ehtCapability; + if (m_extendedCapability.has_value ()) + { + os << "Extended Capabilities=" << *m_extendedCapability << " , "; + } + if (m_htCapability.has_value ()) + { + os << "HT Capabilities=" << *m_htCapability << " , "; + } + if (m_vhtCapability.has_value ()) + { + os << "VHT Capabilities=" << *m_vhtCapability << " , "; + } + if (m_heCapability.has_value ()) + { + os << "HE Capabilities=" << *m_heCapability << " , "; + } + if (m_ehtCapability.has_value ()) + { + os << "EHT Capabilities=" << *m_ehtCapability; + } } void @@ -953,13 +1157,34 @@ MgtAssocRequestHeader::Serialize (Buffer::Iterator start) const i.WriteHtolsbU16 (m_listenInterval); i = m_ssid.Serialize (i); i = m_rates.Serialize (i); - if (m_rates.GetNRates () > 8) i = m_rates.extended->Serialize (i); - if (m_extendedCapability.has_value ()) i = m_extendedCapability->Serialize (i); - if (m_htCapability.has_value ()) i = m_htCapability->Serialize (i); - if (m_vhtCapability.has_value ()) i = m_vhtCapability->Serialize (i); - if (m_heCapability.has_value ()) i = m_heCapability->Serialize (i); - if (m_multiLinkElement.has_value ()) i = m_multiLinkElement->Serialize (i); - if (m_ehtCapability.has_value ()) i = m_ehtCapability->Serialize (i); + if (m_rates.GetNRates () > 8) + { + i = m_rates.extended->Serialize (i); + } + if (m_extendedCapability.has_value ()) + { + i = m_extendedCapability->Serialize (i); + } + if (m_htCapability.has_value ()) + { + i = m_htCapability->Serialize (i); + } + if (m_vhtCapability.has_value ()) + { + i = m_vhtCapability->Serialize (i); + } + if (m_heCapability.has_value ()) + { + i = m_heCapability->Serialize (i); + } + if (m_multiLinkElement.has_value ()) + { + i = m_multiLinkElement->Serialize (i); + } + if (m_ehtCapability.has_value ()) + { + i = m_ehtCapability->Serialize (i); + } } uint32_t @@ -1203,13 +1428,34 @@ MgtReassocRequestHeader::GetSerializedSize () const size += 6; //current AP address size += m_ssid.GetSerializedSize (); size += m_rates.GetSerializedSize (); - if (m_rates.GetNRates () > 8) size += m_rates.extended->GetSerializedSize (); - if (m_extendedCapability.has_value ()) size += m_extendedCapability->GetSerializedSize (); - if (m_htCapability.has_value ()) size += m_htCapability->GetSerializedSize (); - if (m_vhtCapability.has_value ()) size += m_vhtCapability->GetSerializedSize (); - if (m_heCapability.has_value ()) size += m_heCapability->GetSerializedSize (); - if (m_multiLinkElement.has_value ()) size += m_multiLinkElement->GetSerializedSize (); - if (m_ehtCapability.has_value ()) size += m_ehtCapability->GetSerializedSize (); + if (m_rates.GetNRates () > 8) + { + size += m_rates.extended->GetSerializedSize (); + } + if (m_extendedCapability.has_value ()) + { + size += m_extendedCapability->GetSerializedSize (); + } + if (m_htCapability.has_value ()) + { + size += m_htCapability->GetSerializedSize (); + } + if (m_vhtCapability.has_value ()) + { + size += m_vhtCapability->GetSerializedSize (); + } + if (m_heCapability.has_value ()) + { + size += m_heCapability->GetSerializedSize (); + } + if (m_multiLinkElement.has_value ()) + { + size += m_multiLinkElement->GetSerializedSize (); + } + if (m_ehtCapability.has_value ()) + { + size += m_ehtCapability->GetSerializedSize (); + } return size; } @@ -1219,11 +1465,26 @@ MgtReassocRequestHeader::Print (std::ostream &os) const os << "current AP address=" << m_currentApAddr << ", " << "ssid=" << m_ssid << ", " << "rates=" << m_rates << ", "; - if (m_extendedCapability.has_value ()) os << "Extended Capabilities=" << *m_extendedCapability << " , "; - if (m_htCapability.has_value ()) os << "HT Capabilities=" << *m_htCapability << " , "; - if (m_vhtCapability.has_value ()) os << "VHT Capabilities=" << *m_vhtCapability << " , "; - if (m_heCapability.has_value ()) os << "HE Capabilities=" << *m_heCapability << " , "; - if (m_ehtCapability.has_value ()) os << "EHT Capabilities=" << *m_ehtCapability; + if (m_extendedCapability.has_value ()) + { + os << "Extended Capabilities=" << *m_extendedCapability << " , "; + } + if (m_htCapability.has_value ()) + { + os << "HT Capabilities=" << *m_htCapability << " , "; + } + if (m_vhtCapability.has_value ()) + { + os << "VHT Capabilities=" << *m_vhtCapability << " , "; + } + if (m_heCapability.has_value ()) + { + os << "HE Capabilities=" << *m_heCapability << " , "; + } + if (m_ehtCapability.has_value ()) + { + os << "EHT Capabilities=" << *m_ehtCapability; + } } void @@ -1235,13 +1496,34 @@ MgtReassocRequestHeader::Serialize (Buffer::Iterator start) const WriteTo (i, m_currentApAddr); i = m_ssid.Serialize (i); i = m_rates.Serialize (i); - if (m_rates.GetNRates () > 8) i = m_rates.extended->Serialize (i); - if (m_extendedCapability.has_value ()) i = m_extendedCapability->Serialize (i); - if (m_htCapability.has_value ()) i = m_htCapability->Serialize (i); - if (m_vhtCapability.has_value ()) i = m_vhtCapability->Serialize (i); - if (m_heCapability.has_value ()) i = m_heCapability->Serialize (i); - if (m_multiLinkElement.has_value ()) i = m_multiLinkElement->Serialize (i); - if (m_ehtCapability.has_value ()) i = m_ehtCapability->Serialize (i); + if (m_rates.GetNRates () > 8) + { + i = m_rates.extended->Serialize (i); + } + if (m_extendedCapability.has_value ()) + { + i = m_extendedCapability->Serialize (i); + } + if (m_htCapability.has_value ()) + { + i = m_htCapability->Serialize (i); + } + if (m_vhtCapability.has_value ()) + { + i = m_vhtCapability->Serialize (i); + } + if (m_heCapability.has_value ()) + { + i = m_heCapability->Serialize (i); + } + if (m_multiLinkElement.has_value ()) + { + i = m_multiLinkElement->Serialize (i); + } + if (m_ehtCapability.has_value ()) + { + i = m_ehtCapability->Serialize (i); + } } uint32_t @@ -1581,19 +1863,58 @@ MgtAssocResponseHeader::GetSerializedSize () const size += m_code.GetSerializedSize (); size += 2; //aid size += m_rates.GetSerializedSize (); - if (m_erpInformation.has_value ()) size += m_erpInformation->GetSerializedSize (); - if (m_rates.GetNRates () > 8) size += m_rates.extended->GetSerializedSize (); - if (m_edcaParameterSet.has_value ()) size += m_edcaParameterSet->GetSerializedSize (); - if (m_extendedCapability.has_value ()) size += m_extendedCapability->GetSerializedSize (); - if (m_htCapability.has_value ()) size += m_htCapability->GetSerializedSize (); - if (m_htOperation.has_value ()) size += m_htOperation->GetSerializedSize (); - if (m_vhtCapability.has_value ()) size += m_vhtCapability->GetSerializedSize (); - if (m_vhtOperation.has_value ()) size += m_vhtOperation->GetSerializedSize (); - if (m_heCapability.has_value ()) size += m_heCapability->GetSerializedSize (); - if (m_heOperation.has_value ()) size += m_heOperation->GetSerializedSize (); - if (m_muEdcaParameterSet.has_value ()) size += m_muEdcaParameterSet->GetSerializedSize (); - if (m_multiLinkElement.has_value ()) size += m_multiLinkElement->GetSerializedSize (); - if (m_ehtCapability.has_value ()) size += m_ehtCapability->GetSerializedSize (); + if (m_erpInformation.has_value ()) + { + size += m_erpInformation->GetSerializedSize (); + } + if (m_rates.GetNRates () > 8) + { + size += m_rates.extended->GetSerializedSize (); + } + if (m_edcaParameterSet.has_value ()) + { + size += m_edcaParameterSet->GetSerializedSize (); + } + if (m_extendedCapability.has_value ()) + { + size += m_extendedCapability->GetSerializedSize (); + } + if (m_htCapability.has_value ()) + { + size += m_htCapability->GetSerializedSize (); + } + if (m_htOperation.has_value ()) + { + size += m_htOperation->GetSerializedSize (); + } + if (m_vhtCapability.has_value ()) + { + size += m_vhtCapability->GetSerializedSize (); + } + if (m_vhtOperation.has_value ()) + { + size += m_vhtOperation->GetSerializedSize (); + } + if (m_heCapability.has_value ()) + { + size += m_heCapability->GetSerializedSize (); + } + if (m_heOperation.has_value ()) + { + size += m_heOperation->GetSerializedSize (); + } + if (m_muEdcaParameterSet.has_value ()) + { + size += m_muEdcaParameterSet->GetSerializedSize (); + } + if (m_multiLinkElement.has_value ()) + { + size += m_multiLinkElement->GetSerializedSize (); + } + if (m_ehtCapability.has_value ()) + { + size += m_ehtCapability->GetSerializedSize (); + } return size; } @@ -1603,15 +1924,42 @@ MgtAssocResponseHeader::Print (std::ostream &os) const os << "status code=" << m_code << ", " << "aid=" << m_aid << ", " << "rates=" << m_rates << ", "; - if (m_erpInformation.has_value ()) os << "ERP information=" << *m_erpInformation << ", "; - if (m_extendedCapability.has_value ()) os << "Extended Capabilities=" << *m_extendedCapability << " , "; - if (m_htCapability.has_value ()) os << "HT Capabilities=" << *m_htCapability << " , "; - if (m_htOperation.has_value ()) os << "HT Operation=" << *m_htOperation << " , "; - if (m_vhtCapability.has_value ()) os << "VHT Capabilities=" << *m_vhtCapability << " , "; - if (m_vhtOperation.has_value ()) os << "VHT Operation=" << *m_vhtOperation << " , "; - if (m_heCapability.has_value ()) os << "HE Capabilities=" << *m_heCapability << " , "; - if (m_heOperation.has_value ()) os << "HE Operation=" << *m_heOperation << " , "; - if (m_ehtCapability.has_value ()) os << "EHT Capabilities=" << *m_ehtCapability; + if (m_erpInformation.has_value ()) + { + os << "ERP information=" << *m_erpInformation << ", "; + } + if (m_extendedCapability.has_value ()) + { + os << "Extended Capabilities=" << *m_extendedCapability << " , "; + } + if (m_htCapability.has_value ()) + { + os << "HT Capabilities=" << *m_htCapability << " , "; + } + if (m_htOperation.has_value ()) + { + os << "HT Operation=" << *m_htOperation << " , "; + } + if (m_vhtCapability.has_value ()) + { + os << "VHT Capabilities=" << *m_vhtCapability << " , "; + } + if (m_vhtOperation.has_value ()) + { + os << "VHT Operation=" << *m_vhtOperation << " , "; + } + if (m_heCapability.has_value ()) + { + os << "HE Capabilities=" << *m_heCapability << " , "; + } + if (m_heOperation.has_value ()) + { + os << "HE Operation=" << *m_heOperation << " , "; + } + if (m_ehtCapability.has_value ()) + { + os << "EHT Capabilities=" << *m_ehtCapability; + } } void @@ -1622,19 +1970,58 @@ MgtAssocResponseHeader::Serialize (Buffer::Iterator start) const i = m_code.Serialize (i); i.WriteHtolsbU16 (m_aid); i = m_rates.Serialize (i); - if (m_erpInformation.has_value ()) i = m_erpInformation->Serialize (i); - if (m_rates.GetNRates () > 8) i = m_rates.extended->Serialize (i); - if (m_edcaParameterSet.has_value ()) i = m_edcaParameterSet->Serialize (i); - if (m_extendedCapability.has_value ()) i = m_extendedCapability->Serialize (i); - if (m_htCapability.has_value ()) i = m_htCapability->Serialize (i); - if (m_htOperation.has_value ()) i = m_htOperation->Serialize (i); - if (m_vhtCapability.has_value ()) i = m_vhtCapability->Serialize (i); - if (m_vhtOperation.has_value ()) i = m_vhtOperation->Serialize (i); - if (m_heCapability.has_value ()) i = m_heCapability->Serialize (i); - if (m_heOperation.has_value ()) i = m_heOperation->Serialize (i); - if (m_muEdcaParameterSet.has_value ()) i = m_muEdcaParameterSet->Serialize (i); - if (m_multiLinkElement.has_value ()) i = m_multiLinkElement->Serialize (i); - if (m_ehtCapability.has_value ()) i = m_ehtCapability->Serialize (i); + if (m_erpInformation.has_value ()) + { + i = m_erpInformation->Serialize (i); + } + if (m_rates.GetNRates () > 8) + { + i = m_rates.extended->Serialize (i); + } + if (m_edcaParameterSet.has_value ()) + { + i = m_edcaParameterSet->Serialize (i); + } + if (m_extendedCapability.has_value ()) + { + i = m_extendedCapability->Serialize (i); + } + if (m_htCapability.has_value ()) + { + i = m_htCapability->Serialize (i); + } + if (m_htOperation.has_value ()) + { + i = m_htOperation->Serialize (i); + } + if (m_vhtCapability.has_value ()) + { + i = m_vhtCapability->Serialize (i); + } + if (m_vhtOperation.has_value ()) + { + i = m_vhtOperation->Serialize (i); + } + if (m_heCapability.has_value ()) + { + i = m_heCapability->Serialize (i); + } + if (m_heOperation.has_value ()) + { + i = m_heOperation->Serialize (i); + } + if (m_muEdcaParameterSet.has_value ()) + { + i = m_muEdcaParameterSet->Serialize (i); + } + if (m_multiLinkElement.has_value ()) + { + i = m_multiLinkElement->Serialize (i); + } + if (m_ehtCapability.has_value ()) + { + i = m_ehtCapability->Serialize (i); + } } uint32_t diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index 53047c0c4..f97ea7b8d 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -1172,7 +1172,10 @@ StaWifiMac::UpdateApInfo (const MgtFrameType& frame, const Mac48Address& apAddr, GetWifiRemoteStationManager (linkId)->SetShortPreambleEnabled (isShortPreambleEnabled); GetWifiRemoteStationManager (linkId)->SetShortSlotTimeEnabled (capabilities.IsShortSlotTime ()); - if (!GetQosSupported ()) return; + if (!GetQosSupported ()) + { + return; + } /* QoS station */ bool qosSupported = false; const auto& edcaParameters = frame.GetEdcaParameterSet (); @@ -1187,7 +1190,10 @@ StaWifiMac::UpdateApInfo (const MgtFrameType& frame, const Mac48Address& apAddr, } GetWifiRemoteStationManager (linkId)->SetQosSupport (apAddr, qosSupported); - if (!GetHtSupported ()) return; + if (!GetHtSupported ()) + { + return; + } /* HT station */ if (const auto& htCapabilities = frame.GetHtCapabilities (); htCapabilities.has_value ()) { @@ -1223,7 +1229,10 @@ StaWifiMac::UpdateApInfo (const MgtFrameType& frame, const Mac48Address& apAddr, } } - if (!GetHeSupported ()) return; + if (!GetHeSupported ()) + { + return; + } /* HE station */ const auto& heCapabilities = frame.GetHeCapabilities (); if (heCapabilities.has_value () && heCapabilities->GetSupportedMcsAndNss () != 0) @@ -1255,7 +1264,10 @@ StaWifiMac::UpdateApInfo (const MgtFrameType& frame, const Mac48Address& apAddr, muEdcaParameters->GetMuAifsn (AC_VO), muEdcaParameters->GetMuEdcaTimer (AC_VO)); } - if (!GetEhtSupported ()) return; + if (!GetEhtSupported ()) + { + return; + } /* EHT station */ const auto& ehtCapabilities = frame.GetEhtCapabilities (); //TODO: once we support non constant rate managers, we should add checks here whether EHT is supported by the peer diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index 2b2c4972a..c3a866f4e 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -324,7 +324,10 @@ WifiRemoteStationManager::AddSupportedMode (Mac48Address address, WifiMode mode) auto state = LookupState (address); for (const auto& i : state->m_operationalRateSet) { - if (i == mode) return; // already in + if (i == mode) + { + return; // already in + } } if ((mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS) || (mode.GetModulationClass () == WIFI_MOD_CLASS_HR_DSSS)) { @@ -387,7 +390,10 @@ WifiRemoteStationManager::AddSupportedMcs (Mac48Address address, WifiMode mcs) auto state = LookupState (address); for (const auto& i : state->m_operationalMcsSet) { - if (i == mcs) return; //already in + if (i == mcs) + { + return; // already in + } } state->m_operationalMcsSet.push_back (mcs); } diff --git a/src/wifi/test/wifi-eht-info-elems-test.cc b/src/wifi/test/wifi-eht-info-elems-test.cc index cc26d24bf..fb3af1031 100644 --- a/src/wifi/test/wifi-eht-info-elems-test.cc +++ b/src/wifi/test/wifi-eht-info-elems-test.cc @@ -308,9 +308,18 @@ ReducedNeighborReportTest::DoRun () TestHeaderSerialization (GetReducedNeighborReport (channel2_4It, channel5It, channel6It)); // advance all channel iterators - if (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend ()) channel2_4It++; - if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend ()) channel5It++; - if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend ()) channel6It++; + if (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend ()) + { + channel2_4It++; + } + if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend ()) + { + channel5It++; + } + if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend ()) + { + channel6It++; + } } } diff --git a/src/wifi/test/wifi-ie-fragment-test.cc b/src/wifi/test/wifi-ie-fragment-test.cc index 178cb7632..ee5cdf9b0 100644 --- a/src/wifi/test/wifi-ie-fragment-test.cc +++ b/src/wifi/test/wifi-ie-fragment-test.cc @@ -399,7 +399,10 @@ WifiIeFragmentationTest::DoRun () { Buffer buffer = SerializeIntoBuffer (testIe); CheckSerializedByte (buffer, 1, 255); // element length is the maximum length - if (m_extended) CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + if (m_extended) + { + CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + } CheckSerializedByte (buffer, (m_extended ? 3 : 2), TestWifiSubElement ().ElementId ()); CheckSerializedByte (buffer, (m_extended ? 3 : 2) + 1, sub01Size - 2); // subelement 1 Length CheckSerializedByte (buffer, (m_extended ? 3 : 2) + sub01Size, TestWifiSubElement ().ElementId ()); @@ -429,7 +432,10 @@ WifiIeFragmentationTest::DoRun () { Buffer buffer = SerializeIntoBuffer (testIe); CheckSerializedByte (buffer, 1, 255); // maximum length for first element fragment - if (m_extended) CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + if (m_extended) + { + CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + } CheckSerializedByte (buffer, (m_extended ? 3 : 2), TestWifiSubElement ().ElementId ()); CheckSerializedByte (buffer, (m_extended ? 3 : 2) + 1, sub01Size - 2); // subelement 1 Length CheckSerializedByte (buffer, (m_extended ? 3 : 2) + sub01Size, TestWifiSubElement ().ElementId ()); @@ -465,7 +471,10 @@ WifiIeFragmentationTest::DoRun () { Buffer buffer = SerializeIntoBuffer (testIe); CheckSerializedByte (buffer, 1, 255); // maximum length for first element fragment - if (m_extended) CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + if (m_extended) + { + CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + } CheckSerializedByte (buffer, (m_extended ? 3 : 2), TestWifiSubElement ().ElementId ()); CheckSerializedByte (buffer, (m_extended ? 3 : 2) + 1, sub01Size - 2); // subelement 1 Length CheckSerializedByte (buffer, (m_extended ? 3 : 2) + sub01Size, TestWifiSubElement ().ElementId ()); @@ -501,7 +510,10 @@ WifiIeFragmentationTest::DoRun () { Buffer buffer = SerializeIntoBuffer (testIe); CheckSerializedByte (buffer, 1, 255); // maximum length for first element fragment - if (m_extended) CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + if (m_extended) + { + CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + } CheckSerializedByte (buffer, (m_extended ? 3 : 2), TestWifiSubElement ().ElementId ()); CheckSerializedByte (buffer, (m_extended ? 3 : 2) + 1, sub01Size - 2); // subelement 1 Length CheckSerializedByte (buffer, (m_extended ? 3 : 2) + sub01Size, TestWifiSubElement ().ElementId ()); @@ -536,7 +548,10 @@ WifiIeFragmentationTest::DoRun () { Buffer buffer = SerializeIntoBuffer (testIe); CheckSerializedByte (buffer, 1, 255); // maximum length for first element fragment - if (m_extended) CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + if (m_extended) + { + CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + } CheckSerializedByte (buffer, (m_extended ? 3 : 2), TestWifiSubElement ().ElementId ()); CheckSerializedByte (buffer, (m_extended ? 3 : 2) + 1, sub01Size - 2); // subelement 1 Length CheckSerializedByte (buffer, 2 + 255, IE_FRAGMENT); // Fragment ID @@ -564,7 +579,10 @@ WifiIeFragmentationTest::DoRun () { Buffer buffer = SerializeIntoBuffer (testIe); CheckSerializedByte (buffer, 1, 255); // maximum length for first element fragment - if (m_extended) CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + if (m_extended) + { + CheckSerializedByte (buffer, 2, testIe.ElementIdExt ()); + } CheckSerializedByte (buffer, (m_extended ? 3 : 2), TestWifiSubElement ().ElementId ()); CheckSerializedByte (buffer, (m_extended ? 3 : 2) + 1, 255); // first subelement fragment Length CheckSerializedByte (buffer, 2 + 255, IE_FRAGMENT); // Fragment ID for second element fragment diff --git a/src/wifi/test/wifi-primary-channels-test.cc b/src/wifi/test/wifi-primary-channels-test.cc index 01981d9b5..0fc59b16b 100644 --- a/src/wifi/test/wifi-primary-channels-test.cc +++ b/src/wifi/test/wifi-primary-channels-test.cc @@ -1084,7 +1084,10 @@ Wifi20MHzChannelIndicesTest::RunOne (uint8_t primary20, { std::stringstream ss; ss << "{"; - for (const auto& index : s) ss << +index << " "; + for (const auto& index : s) + { + ss << +index << " "; + } ss << "}"; return ss.str (); };