From afb0f160d44bb03bb45894304c9635c7a9ae90dd Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Thu, 6 Oct 2022 22:25:16 +0000 Subject: [PATCH] Fix clang-tidy performance-faster-string-find warnings --- examples/tcp/tcp-variants-comparison.cc | 4 +-- src/config-store/model/raw-text-config.cc | 4 +-- src/core/model/command-line.cc | 4 +-- src/core/model/config.cc | 28 +++++++++---------- src/core/model/global-value.cc | 4 +-- src/core/model/int64x64.cc | 8 +++--- src/core/model/log.cc | 14 +++++----- src/core/model/names.cc | 12 ++++---- src/core/model/object-base.cc | 4 +-- src/core/model/object-factory.cc | 8 +++--- src/dsr/model/dsr-routing.cc | 4 +-- .../helper/radio-bearer-stats-connector.cc | 10 +++---- src/mobility/helper/ns2-mobility-helper.cc | 10 +++---- src/netanim/model/animation-interface.cc | 4 +-- src/network/model/address.cc | 6 ++-- src/network/utils/mac16-address.cc | 2 +- src/network/utils/mac48-address.cc | 2 +- src/network/utils/mac64-address.cc | 2 +- src/stats/helper/file-helper.cc | 4 +-- src/stats/helper/gnuplot-helper.cc | 4 +-- src/stats/model/data-collection-object.cc | 2 +- src/stats/model/get-wildcard-matches.cc | 2 +- 22 files changed, 71 insertions(+), 71 deletions(-) diff --git a/examples/tcp/tcp-variants-comparison.cc b/examples/tcp/tcp-variants-comparison.cc index bfdb9d112..2dd078b3e 100644 --- a/examples/tcp/tcp-variants-comparison.cc +++ b/examples/tcp/tcp-variants-comparison.cc @@ -78,8 +78,8 @@ static std::map ssThreshValue; //!< SlowStart threshold val static uint32_t GetNodeIdFromContext (std::string context) { - std::size_t const n1 = context.find_first_of ("/", 1); - std::size_t const n2 = context.find_first_of ("/", n1 + 1); + std::size_t const n1 = context.find_first_of ('/', 1); + std::size_t const n2 = context.find_first_of ('/', n1 + 1); return std::stoul (context.substr (n1 + 1, n2 - n1 - 1)); } diff --git a/src/config-store/model/raw-text-config.cc b/src/config-store/model/raw-text-config.cc index 83bbea97d..820cab5d0 100644 --- a/src/config-store/model/raw-text-config.cc +++ b/src/config-store/model/raw-text-config.cc @@ -208,8 +208,8 @@ std::string RawTextConfigLoad::Strip (std::string value) { NS_LOG_FUNCTION (this << value); - std::string::size_type start = value.find ("\""); - std::string::size_type end = value.find ("\"", 1); + std::string::size_type start = value.find ('\"'); + std::string::size_type end = value.find ('\"', 1); NS_ABORT_MSG_IF (start != 0, "Ill-formed attribute value: " << value); NS_ABORT_MSG_IF (end != value.size () - 1, "Ill-formed attribute value: " << value); return value.substr (start+1, end-start-1); diff --git a/src/core/model/command-line.cc b/src/core/model/command-line.cc index 3b9b9691d..94a1a57fc 100644 --- a/src/core/model/command-line.cc +++ b/src/core/model/command-line.cc @@ -234,7 +234,7 @@ CommandLine::HandleOption (const std::string & param) const } else { - cur = arg.find ("-"); + cur = arg.find ('-'); if (cur == 0) { arg = arg.substr (1, arg.size () - 1); @@ -246,7 +246,7 @@ CommandLine::HandleOption (const std::string & param) const } } // find any value following '=' - cur = arg.find ("="); + cur = arg.find ('='); std::string name; std::string value; if (cur == std::string::npos) diff --git a/src/core/model/config.cc b/src/core/model/config.cc index aafcd7fba..93616a951 100644 --- a/src/core/model/config.cc +++ b/src/core/model/config.cc @@ -230,7 +230,7 @@ ArrayMatcher::Matches (std::size_t i) const return true; } std::string::size_type tmp; - tmp = m_element.find ("|"); + tmp = m_element.find ('|'); if (tmp != std::string::npos) { std::string left = m_element.substr (0, tmp - 0); @@ -250,9 +250,9 @@ ArrayMatcher::Matches (std::size_t i) const NS_LOG_DEBUG ("Array " << i << " does not match " << m_element); return false; } - std::string::size_type leftBracket = m_element.find ("["); - std::string::size_type rightBracket = m_element.find ("]"); - std::string::size_type dash = m_element.find ("-"); + std::string::size_type leftBracket = m_element.find ('['); + std::string::size_type rightBracket = m_element.find (']'); + std::string::size_type dash = m_element.find ('-'); if (leftBracket == 0 && rightBracket == m_element.size () - 1 && dash > leftBracket && dash < rightBracket) { @@ -380,13 +380,13 @@ Resolver::Canonicalize () NS_LOG_FUNCTION (this); // ensure that we start and end with a '/' - std::string::size_type tmp = m_path.find ("/"); + std::string::size_type tmp = m_path.find ('/'); if (tmp != 0) { // no slash at start m_path = "/" + m_path; } - tmp = m_path.find_last_of ("/"); + tmp = m_path.find_last_of ('/'); if (tmp != (m_path.size () - 1)) { // no slash at end @@ -428,8 +428,8 @@ void Resolver::DoResolve (std::string path, Ptr root) { NS_LOG_FUNCTION (this << path << root); - NS_ASSERT ((path.find ("/")) == 0); - std::string::size_type next = path.find ("/", 1); + NS_ASSERT ((path.find ('/')) == 0); + std::string::size_type next = path.find ('/', 1); if (next == std::string::npos) { @@ -496,7 +496,7 @@ Resolver::DoResolve (std::string path, Ptr root) { return; } - std::string::size_type dollarPos = item.find ("$"); + std::string::size_type dollarPos = item.find ('$'); if (dollarPos == 0) { // This is a call to GetObject @@ -586,8 +586,8 @@ Resolver::DoArrayResolve (std::string path, const ObjectPtrContainerValue &conta { NS_LOG_FUNCTION (this << path << &container); NS_ASSERT (path != ""); - NS_ASSERT ((path.find ("/")) == 0); - std::string::size_type next = path.find ("/", 1); + NS_ASSERT ((path.find ('/')) == 0); + std::string::size_type next = path.find ('/', 1); if (next == std::string::npos) { return; @@ -667,7 +667,7 @@ ConfigImpl::ParsePath (std::string path, std::string *root, std::string *leaf) c { NS_LOG_FUNCTION (this << path << root << leaf); - std::string::size_type slash = path.find_last_of ("/"); + std::string::size_type slash = path.find_last_of ('/'); NS_ASSERT (slash != std::string::npos); *root = path.substr (0, slash); *leaf = path.substr (slash + 1, path.size () - (slash + 1)); @@ -716,7 +716,7 @@ ConfigImpl::DisconnectWithoutContext (std::string path, const CallbackBase &cb) MatchContainer container = LookupMatches (root); if (container.GetN () == 0) { - std::size_t lastFwdSlash = root.rfind ("/"); + std::size_t lastFwdSlash = root.rfind ('/'); NS_LOG_WARN ("Failed to disconnect " << leaf << ", the Requested object name = " << root.substr (lastFwdSlash + 1) << " does not exits on path " << root.substr (0, lastFwdSlash)); @@ -745,7 +745,7 @@ ConfigImpl::Disconnect (std::string path, const CallbackBase &cb) MatchContainer container = LookupMatches (root); if (container.GetN () == 0) { - std::size_t lastFwdSlash = root.rfind ("/"); + std::size_t lastFwdSlash = root.rfind ('/'); NS_LOG_WARN ("Failed to disconnect " << leaf << ", the Requested object name = " << root.substr (lastFwdSlash + 1) << " does not exits on path " << root.substr (0, lastFwdSlash)); diff --git a/src/core/model/global-value.cc b/src/core/model/global-value.cc index 0b2e58251..6c0f2b7a5 100644 --- a/src/core/model/global-value.cc +++ b/src/core/model/global-value.cc @@ -79,9 +79,9 @@ GlobalValue::InitializeFromEnv () std::string::size_type next = 0; while (next != std::string::npos) { - next = env.find (";", cur); + next = env.find (';', cur); std::string tmp = std::string (env, cur, next - cur); - std::string::size_type equal = tmp.find ("="); + std::string::size_type equal = tmp.find ('='); if (equal != std::string::npos) { std::string name = tmp.substr (0, equal); diff --git a/src/core/model/int64x64.cc b/src/core/model/int64x64.cc index 94a711267..78b82c189 100644 --- a/src/core/model/int64x64.cc +++ b/src/core/model/int64x64.cc @@ -227,10 +227,10 @@ std::istream &operator >> (std::istream &is, int64x64_t &value) bool negative; // skip heading spaces std::string::size_type cur; - cur = str.find_first_not_of (" "); + cur = str.find_first_not_of (' '); std::string::size_type next; // first, remove the sign. - next = str.find ("-", cur); + next = str.find ('-', cur); if (next != std::string::npos) { negative = true; @@ -238,7 +238,7 @@ std::istream &operator >> (std::istream &is, int64x64_t &value) } else { - next = str.find ("+", cur); + next = str.find ('+', cur); if (next != std::string::npos) { next++; @@ -252,7 +252,7 @@ std::istream &operator >> (std::istream &is, int64x64_t &value) cur = next; int64_t hi; uint64_t lo; - next = str.find (".", cur); + next = str.find ('.', cur); if (next != std::string::npos) { hi = ReadHiDigits (str.substr (cur, next - cur)); diff --git a/src/core/model/log.cc b/src/core/model/log.cc index 3f4f372f2..793587e21 100644 --- a/src/core/model/log.cc +++ b/src/core/model/log.cc @@ -91,7 +91,7 @@ PrintList::PrintList () std::string::size_type next = 0; while (next != std::string::npos) { - next = env.find_first_of (":", cur); + next = env.find_first_of (':', cur); std::string tmp = std::string (env, cur, next - cur); if (tmp == "print-list") { @@ -155,9 +155,9 @@ LogComponent::EnvVarCheck () std::string::size_type next = 0; while (next != std::string::npos) { - next = env.find_first_of (":", cur); + next = env.find_first_of (':', cur); std::string tmp = std::string (env, cur, next - cur); - std::string::size_type equal = tmp.find ("="); + std::string::size_type equal = tmp.find ('='); std::string component; if (equal == std::string::npos) { @@ -181,7 +181,7 @@ LogComponent::EnvVarCheck () do { cur_lev = next_lev + 1; - next_lev = tmp.find ("|", cur_lev); + next_lev = tmp.find ('|', cur_lev); std::string lev = tmp.substr (cur_lev, next_lev - cur_lev); if (lev == "error") { @@ -539,9 +539,9 @@ static void CheckEnvironmentVariables () while (next != std::string::npos) { - next = env.find_first_of (":", cur); + next = env.find_first_of (':', cur); std::string tmp = std::string (env, cur, next - cur); - std::string::size_type equal = tmp.find ("="); + std::string::size_type equal = tmp.find ('='); std::string component; if (equal == std::string::npos) { @@ -568,7 +568,7 @@ static void CheckEnvironmentVariables () do { cur_lev = next_lev + 1; - next_lev = tmp.find ("|", cur_lev); + next_lev = tmp.find ('|', cur_lev); std::string lev = tmp.substr (cur_lev, next_lev - cur_lev); if (lev == "error" || lev == "warn" diff --git a/src/core/model/names.cc b/src/core/model/names.cc index 0b5d84bb7..d050aca0a 100644 --- a/src/core/model/names.cc +++ b/src/core/model/names.cc @@ -338,7 +338,7 @@ NamesPriv::Add (std::string name, Ptr object) // This must be a name that has the "/Names" namespace prefix omitted. // Do some reasonableness checking on the rest of the name. // - offset = name.find ("/"); + offset = name.find ('/'); if (offset == 0) { NS_ASSERT_MSG (false, "NamesPriv::Add(): Name begins with '/' but not \"/Names\""); @@ -355,7 +355,7 @@ NamesPriv::Add (std::string name, Ptr object) // separates the path from the final segment had better be there since // we just made sure that at least the namespace name was there. // - std::string::size_type i = name.rfind ("/"); + std::string::size_type i = name.rfind ('/'); NS_ASSERT_MSG (i != std::string::npos, "NamesPriv::Add(): Internal error. Can't find '/' in name"); // @@ -448,7 +448,7 @@ NamesPriv::Rename (std::string oldpath, std::string newname) // This must be a name that has the "/Names" namespace prefix omitted. // Do some reasonableness checking on the rest of the name. // - offset = oldpath.find ("/"); + offset = oldpath.find ('/'); if (offset == 0) { NS_ASSERT_MSG (false, "NamesPriv::Add(): Name begins with '/' but not \"/Names\""); @@ -465,7 +465,7 @@ NamesPriv::Rename (std::string oldpath, std::string newname) // separates the path from the final segment (name) had better be there since // we just made sure that at least the namespace name was there. // - std::string::size_type i = oldpath.rfind ("/"); + std::string::size_type i = oldpath.rfind ('/'); NS_ASSERT_MSG (i != std::string::npos, "NamesPriv::Add(): Internal error. Can't find '/' in name"); // @@ -633,7 +633,7 @@ NamesPriv::Find (std::string path) for (;;) { NS_LOG_LOGIC ("Looking for the object of name " << remaining); - offset = remaining.find ("/"); + offset = remaining.find ('/'); if (offset == std::string::npos) { // @@ -658,7 +658,7 @@ NamesPriv::Find (std::string path) // There are more slashes so this is an intermediate segment of the // specified name. We need to "recurse" when we find this segment. // - offset = remaining.find ("/"); + offset = remaining.find ('/'); std::string segment = remaining.substr (0, offset); std::map::iterator i = node->m_nameMap.find (segment); diff --git a/src/core/model/object-base.cc b/src/core/model/object-base.cc index 658407bda..8bc8b9434 100644 --- a/src/core/model/object-base.cc +++ b/src/core/model/object-base.cc @@ -64,9 +64,9 @@ EnvDictionary (std::string key) std::string::size_type next = 0; while (next != std::string::npos) { - next = env.find (";", cur); + next = env.find (';', cur); std::string tmp = std::string (env, cur, next - cur); - std::string::size_type equal = tmp.find ("="); + std::string::size_type equal = tmp.find ('='); if (equal != std::string::npos) { std::string name = tmp.substr (0, equal); diff --git a/src/core/model/object-factory.cc b/src/core/model/object-factory.cc index e2dfc09e4..c86e951ca 100644 --- a/src/core/model/object-factory.cc +++ b/src/core/model/object-factory.cc @@ -123,8 +123,8 @@ std::istream & operator >> (std::istream &is, ObjectFactory &factory) is >> v; std::string::size_type lbracket; std::string::size_type rbracket; - lbracket = v.find ("["); - rbracket = v.find ("]"); + lbracket = v.find ('['); + rbracket = v.find (']'); if (lbracket == std::string::npos && rbracket == std::string::npos) { factory.SetTypeId (v); @@ -143,7 +143,7 @@ std::istream & operator >> (std::istream &is, ObjectFactory &factory) cur = 0; while (cur != parameters.size ()) { - std::string::size_type equal = parameters.find ("=", cur); + std::string::size_type equal = parameters.find ('=', cur); if (equal == std::string::npos) { is.setstate (std::ios_base::failbit); @@ -160,7 +160,7 @@ std::istream & operator >> (std::istream &is, ObjectFactory &factory) } else { - std::string::size_type next = parameters.find ("|", cur); + std::string::size_type next = parameters.find ('|', cur); std::string value; if (next == std::string::npos) { diff --git a/src/dsr/model/dsr-routing.cc b/src/dsr/model/dsr-routing.cc index 9f8ed3fe2..f9b550681 100644 --- a/src/dsr/model/dsr-routing.cc +++ b/src/dsr/model/dsr-routing.cc @@ -538,8 +538,8 @@ DsrRouting::GetElementsFromContext (std::string context) size_t pos2; while (pos1 != context.npos) { - pos1 = context.find ("/",pos1); - pos2 = context.find ("/",pos1 + 1); + pos1 = context.find ('/',pos1); + pos2 = context.find ('/',pos1 + 1); elements.push_back (context.substr (pos1 + 1,pos2 - (pos1 + 1))); pos1 = pos2; } diff --git a/src/lte/helper/radio-bearer-stats-connector.cc b/src/lte/helper/radio-bearer-stats-connector.cc index f5f2c152c..4129b1f2b 100644 --- a/src/lte/helper/radio-bearer-stats-connector.cc +++ b/src/lte/helper/radio-bearer-stats-connector.cc @@ -163,7 +163,7 @@ RadioBearerStatsConnector::StoreUeManagerPath (std::string context, uint16_t cel { NS_LOG_FUNCTION (this << context << cellId << rnti); std::string ueManagerPath; - ueManagerPath = context.substr (0, context.rfind ("/")) + "/UeMap/" + std::to_string (rnti); + ueManagerPath = context.substr (0, context.rfind ('/')) + "/UeMap/" + std::to_string (rnti); NS_LOG_DEBUG ("ueManagerPath = " << ueManagerPath); CellIdRnti key; key.cellId = cellId; @@ -213,7 +213,7 @@ void RadioBearerStatsConnector::ConnectTracesSrb0 (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti) { NS_LOG_FUNCTION (this << context << imsi << cellId << rnti); - std::string ueRrcPath = context.substr (0, context.rfind ("/")); + std::string ueRrcPath = context.substr (0, context.rfind ('/')); NS_LOG_LOGIC ("ueRrcPath = " << ueRrcPath); CellIdRnti key; key.cellId = cellId; @@ -243,7 +243,7 @@ void RadioBearerStatsConnector::ConnectTracesSrb1 (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti) { NS_LOG_FUNCTION (this << context << imsi << cellId << rnti); - std::string ueRrcPath = context.substr (0, context.rfind ("/")); + std::string ueRrcPath = context.substr (0, context.rfind ('/')); NS_LOG_LOGIC ("ueRrcPath = " << ueRrcPath); CellIdRnti key; key.cellId = cellId; @@ -290,7 +290,7 @@ RadioBearerStatsConnector::ConnectTracesDrbEnb (std::string context, uint64_t im NS_LOG_FUNCTION (this << context << imsi << cellId << rnti << (uint16_t)lcid); NS_LOG_LOGIC ("expected context should match /NodeList/*/DeviceList/*/LteEnbRrc/"); std::string basePath; - basePath = context.substr (0, context.rfind ("/")) + "/DataRadioBearerMap/" + std::to_string (lcid - 2); + basePath = context.substr (0, context.rfind ('/')) + "/DataRadioBearerMap/" + std::to_string (lcid - 2); NS_LOG_LOGIC ("basePath = " << basePath); if (m_rlcStats) { @@ -326,7 +326,7 @@ RadioBearerStatsConnector::ConnectTracesDrbUe (std::string context, uint64_t ims NS_LOG_FUNCTION (this << context << imsi << cellId << rnti << (uint16_t)lcid); NS_LOG_LOGIC ("expected context should match /NodeList/*/DeviceList/*/LteUeRrc/"); std::string basePath; - basePath = context.substr (0, context.rfind ("/")) + "/DataRadioBearerMap/" + std::to_string (lcid); + basePath = context.substr (0, context.rfind ('/')) + "/DataRadioBearerMap/" + std::to_string (lcid); NS_LOG_LOGIC ("basePath = " << basePath); if (m_rlcStats) { diff --git a/src/mobility/helper/ns2-mobility-helper.cc b/src/mobility/helper/ns2-mobility-helper.cc index fd445d43f..84c9bb6c6 100644 --- a/src/mobility/helper/ns2-mobility-helper.cc +++ b/src/mobility/helper/ns2-mobility-helper.cc @@ -629,8 +629,8 @@ HasNodeIdNumber (std::string str) { // find brackets - std::string::size_type startNodeId = str.find_first_of ("("); // index of left bracket - std::string::size_type endNodeId = str.find_first_of (")"); // index of right bracket + std::string::size_type startNodeId = str.find_first_of ('('); // index of left bracket + std::string::size_type endNodeId = str.find_first_of (')'); // index of right bracket // Get de nodeId in a string and in a int value std::string nodeId; // node id @@ -644,7 +644,7 @@ HasNodeIdNumber (std::string str) nodeId = str.substr (startNodeId + 1, endNodeId - (startNodeId + 1)); // set node id // is number is integer is not negative - if (IsNumber (nodeId) && (nodeId.find_first_of (".") == std::string::npos) && (nodeId[0] != '-')) + if (IsNumber (nodeId) && (nodeId.find_first_of ('.') == std::string::npos) && (nodeId[0] != '-')) { return true; } @@ -661,8 +661,8 @@ GetNodeIdFromToken (std::string str) if (HasNodeIdNumber (str)) { // find brackets - std::string::size_type startNodeId = str.find_first_of ("("); // index of left bracket - std::string::size_type endNodeId = str.find_first_of (")"); // index of right bracket + std::string::size_type startNodeId = str.find_first_of ('('); // index of left bracket + std::string::size_type endNodeId = str.find_first_of (')'); // index of right bracket return str.substr (startNodeId + 1, endNodeId - (startNodeId + 1)); // set node id } diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index f6ce839da..36038993a 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -594,8 +594,8 @@ AnimationInterface::GetElementsFromContext (const std::string& context) const std::size_t pos2; while (pos1 != context.npos) { - pos1 = context.find ("/",pos1); - pos2 = context.find ("/",pos1 + 1); + pos1 = context.find ('/',pos1); + pos2 = context.find ('/',pos1 + 1); elements.push_back (context.substr (pos1 + 1,pos2 - (pos1 + 1))); pos1 = pos2; pos2 = context.npos; diff --git a/src/network/model/address.cc b/src/network/model/address.cc index 8c2e6bdb2..46b552d4c 100644 --- a/src/network/model/address.cc +++ b/src/network/model/address.cc @@ -254,8 +254,8 @@ std::istream& operator>> (std::istream& is, Address & address) is >> v; std::string::size_type firstDash; std::string::size_type secondDash; - firstDash = v.find ("-"); - secondDash = v.find ("-", firstDash+1); + firstDash = v.find ('-'); + secondDash = v.find ('-', firstDash+1); std::string type = v.substr (0, firstDash-0); std::string len = v.substr (firstDash+1, secondDash-(firstDash+1)); @@ -268,7 +268,7 @@ std::istream& operator>> (std::istream& is, Address & address) { std::string tmp; std::string::size_type next; - next = v.find (":", col); + next = v.find (':', col); if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); diff --git a/src/network/utils/mac16-address.cc b/src/network/utils/mac16-address.cc index ca4525f9a..9a1ee2fca 100644 --- a/src/network/utils/mac16-address.cc +++ b/src/network/utils/mac16-address.cc @@ -251,7 +251,7 @@ std::istream& operator>> (std::istream& is, Mac16Address & address) { std::string tmp; std::string::size_type next; - next = v.find (":", col); + next = v.find (':', col); if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); diff --git a/src/network/utils/mac48-address.cc b/src/network/utils/mac48-address.cc index 518afc4c7..224789583 100644 --- a/src/network/utils/mac48-address.cc +++ b/src/network/utils/mac48-address.cc @@ -289,7 +289,7 @@ std::istream& operator>> (std::istream& is, Mac48Address & address) { std::string tmp; std::string::size_type next; - next = v.find (":", col); + next = v.find (':', col); if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); diff --git a/src/network/utils/mac64-address.cc b/src/network/utils/mac64-address.cc index 79a3a815b..f24f7258f 100644 --- a/src/network/utils/mac64-address.cc +++ b/src/network/utils/mac64-address.cc @@ -201,7 +201,7 @@ std::istream& operator>> (std::istream& is, Mac64Address & address) { std::string tmp; std::string::size_type next; - next = v.find (":", col); + next = v.find (':', col); if (next == std::string::npos) { tmp = v.substr (col, v.size ()-col); diff --git a/src/stats/helper/file-helper.cc b/src/stats/helper/file-helper.cc index 2448dd97f..79550c1e6 100644 --- a/src/stats/helper/file-helper.cc +++ b/src/stats/helper/file-helper.cc @@ -97,10 +97,10 @@ FileHelper::WriteProbe (const std::string &typeId, std::string lastToken; // See if the path has any wildcards. - bool pathHasNoWildcards = path.find ("*") == std::string::npos; + bool pathHasNoWildcards = path.find ('*') == std::string::npos; // Remove the last token from the path. - size_t lastSlash = path.find_last_of ("/"); + size_t lastSlash = path.find_last_of ('/'); if (lastSlash == std::string::npos) { pathWithoutLastToken = path; diff --git a/src/stats/helper/gnuplot-helper.cc b/src/stats/helper/gnuplot-helper.cc index 1958d6e90..63f4d286a 100644 --- a/src/stats/helper/gnuplot-helper.cc +++ b/src/stats/helper/gnuplot-helper.cc @@ -126,11 +126,11 @@ GnuplotHelper::PlotProbe (const std::string &typeId, std::string lastToken; // See if the path has any wildcards. - bool pathHasNoWildcards = path.find ("*") == std::string::npos; + bool pathHasNoWildcards = path.find ('*') == std::string::npos; // Remove the last token from the path; this should correspond to the // trace source attribute. - size_t lastSlash = path.find_last_of ("/"); + size_t lastSlash = path.find_last_of ('/'); if (lastSlash == std::string::npos) { pathWithoutLastToken = path; diff --git a/src/stats/model/data-collection-object.cc b/src/stats/model/data-collection-object.cc index 19fa1a215..c4d173414 100644 --- a/src/stats/model/data-collection-object.cc +++ b/src/stats/model/data-collection-object.cc @@ -72,7 +72,7 @@ void DataCollectionObject::SetName (std::string name) { NS_LOG_FUNCTION (this << name); - for (size_t pos = name.find (" "); pos != std::string::npos; pos = name.find (" ", pos + 1, 1)) + for (size_t pos = name.find (' '); pos != std::string::npos; pos = name.find (" ", pos + 1, 1)) { name[pos] = '_'; } diff --git a/src/stats/model/get-wildcard-matches.cc b/src/stats/model/get-wildcard-matches.cc index 35739778e..589ff8163 100644 --- a/src/stats/model/get-wildcard-matches.cc +++ b/src/stats/model/get-wildcard-matches.cc @@ -49,7 +49,7 @@ GetWildcardMatches (const std::string &configPath, { // Find the non-wildcard token. tokenStart = asterisk + 1; - asterisk = configPath.find ("*", tokenStart); + asterisk = configPath.find ('*', tokenStart); // If a wildcard character was found, increment this counter. if (asterisk != std::string::npos)