From a6e390dfc5a8e8fa3eaac75a2f258c3a4c7ac3c9 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 27 Jul 2015 21:59:09 -0400 Subject: [PATCH] Standardize always-true while loop condition to "true" --- src/base/stringUtils.cpp | 2 +- src/base/units.h | 2 +- src/base/xml.cpp | 14 +++++++------- src/oneD/MultiNewton.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/base/stringUtils.cpp b/src/base/stringUtils.cpp index ba4746fa1..04f5105be 100644 --- a/src/base/stringUtils.cpp +++ b/src/base/stringUtils.cpp @@ -341,7 +341,7 @@ void tokenizeString(const std::string& oval, std::string val(oval); std::string::size_type ibegin, iend; v.clear(); - while (1 > 0) { + while (true) { ibegin = findFirstNotOfWS(val); if (ibegin != std::string::npos) { val = val.substr(ibegin,val.size()); diff --git a/src/base/units.h b/src/base/units.h index c97502fa0..4abda07f8 100644 --- a/src/base/units.h +++ b/src/base/units.h @@ -81,7 +81,7 @@ public: std::string::size_type k; char action = '-'; - while (1 > 0) { + while (true) { // get token consisting of all characters up to the next // dash, slash, or the end of the string diff --git a/src/base/xml.cpp b/src/base/xml.cpp index 092e35f55..4eab88934 100644 --- a/src/base/xml.cpp +++ b/src/base/xml.cpp @@ -144,7 +144,7 @@ static string::size_type findUnbackslashed(const std::string& s, const char q, string::size_type iloc, icurrent, len; icurrent = istart; len = s.size(); - while (1) { + while (true) { iloc = s.find(q, icurrent); if (iloc == string::npos || iloc == 0) { return iloc; @@ -215,7 +215,7 @@ void XML_Reader::parseTag(const std::string& tag, std::string& name, } // get attributes - while (1) { + while (true) { iloc = s.find('='); if (iloc == string::npos) { break; @@ -245,13 +245,13 @@ std::string XML_Reader::readTag(std::map& attribs) string name, tag = ""; bool incomment = false; char ch = '-'; - while (1) { + while (true) { if (m_s.eof() || (getchr(ch), ch == '<')) { break; } } char ch1 = ' ', ch2 = ' '; - while (1) { + while (true) { if (m_s.eof()) { tag = "EOF"; break; @@ -292,7 +292,7 @@ std::string XML_Reader::readValue() char ch, lastch; ch = '\n'; bool front = true; - while (1) { + while (true) { if (m_s.eof()) { break; } @@ -923,7 +923,7 @@ XML_Node& XML_Node::child(const std::string& aloc) const string loc = aloc; std::multimap::const_iterator i; - while (1) { + while (true) { iloc = loc.find('/'); if (iloc != string::npos) { cname = loc.substr(0,iloc); @@ -984,7 +984,7 @@ void XML_Node::write_int(std::ostream& s, int level, int numRecursivesAllowed) c string vv = m_value; string::size_type ieol = vv.find('\n'); if (ieol != string::npos) { - while (1 > 0) { + while (true) { ieol = vv.find('\n'); if (ieol != string::npos) { if (ieol == 0) { diff --git a/src/oneD/MultiNewton.cpp b/src/oneD/MultiNewton.cpp index 0d946ffe5..5eb823371 100644 --- a/src/oneD/MultiNewton.cpp +++ b/src/oneD/MultiNewton.cpp @@ -338,7 +338,7 @@ int MultiNewton::solve(doublereal* x0, doublereal* x1, int j0 = jac.nEvals(); int nJacReeval = 0; - while (1 > 0) { + while (true) { // Check whether the Jacobian should be re-evaluated. if (jac.age() > m_maxAge) { writelog("\nMaximum Jacobian age reached ("+int2str(m_maxAge)+")\n", loglevel);