From a14525f63277bd877358a40495854842df2ed1af Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Fri, 21 Oct 2022 17:10:11 +0200 Subject: [PATCH] network: Fix ListErrorModel since UIDs are uint64_t values --- examples/error-model/simple-error-model.cc | 2 +- src/network/utils/error-model.cc | 6 +++--- src/network/utils/error-model.h | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/error-model/simple-error-model.cc b/examples/error-model/simple-error-model.cc index 1f260ab04..38c0c9402 100644 --- a/examples/error-model/simple-error-model.cc +++ b/examples/error-model/simple-error-model.cc @@ -158,7 +158,7 @@ main(int argc, char* argv[]) // Now, let's use the ListErrorModel and explicitly force a loss // of the packets with pkt-uids = 11 and 17 on node 2, device 0 - std::list sampleList; + std::list sampleList; sampleList.push_back(11); sampleList.push_back(17); // This time, we'll explicitly create the error model we want diff --git a/src/network/utils/error-model.cc b/src/network/utils/error-model.cc index 6b9ee1f84..11d8d12ab 100644 --- a/src/network/utils/error-model.cc +++ b/src/network/utils/error-model.cc @@ -445,7 +445,7 @@ ListErrorModel::~ListErrorModel() NS_LOG_FUNCTION(this); } -std::list +std::list ListErrorModel::GetList() const { NS_LOG_FUNCTION(this); @@ -453,7 +453,7 @@ ListErrorModel::GetList() const } void -ListErrorModel::SetList(const std::list& packetlist) +ListErrorModel::SetList(const std::list& packetlist) { NS_LOG_FUNCTION(this << &packetlist); m_packetList = packetlist; @@ -470,7 +470,7 @@ ListErrorModel::DoCorrupt(Ptr p) { return false; } - uint32_t uid = p->GetUid(); + auto uid = p->GetUid(); for (PacketListCI i = m_packetList.begin(); i != m_packetList.end(); i++) { if (uid == *i) diff --git a/src/network/utils/error-model.h b/src/network/utils/error-model.h index 857d4539c..e822b5f74 100644 --- a/src/network/utils/error-model.h +++ b/src/network/utils/error-model.h @@ -388,22 +388,22 @@ class ListErrorModel : public ErrorModel /** * \return a copy of the underlying list */ - std::list GetList() const; + std::list GetList() const; /** * \param packetlist The list of packet uids to error. * * This method overwrites any previously provided list. */ - void SetList(const std::list& packetlist); + void SetList(const std::list& packetlist); private: bool DoCorrupt(Ptr p) override; void DoReset() override; /// Typedef: packet Uid list - typedef std::list PacketList; + typedef std::list PacketList; /// Typedef: packet Uid list const iterator - typedef std::list::const_iterator PacketListCI; + typedef std::list::const_iterator PacketListCI; PacketList m_packetList; //!< container of Uid of packets to corrupt };