summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Solodovnikov <hellyeahdominate@gmail.com>2017-05-30 22:37:46 +0300
committerBrad King <brad.king@kitware.com>2017-06-01 14:19:51 -0400
commit8b6f439ef20cf882b4f3deba48f34a01a98963d9 (patch)
tree9e42c3ee7dcbfc7f3d99af79a982735339993af5
parent389ed56f63653e89b3d640cf7aebdc8ebe7ca643 (diff)
downloadcmake-8b6f439ef20cf882b4f3deba48f34a01a98963d9.tar.gz
Access string npos without instance
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx4
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx13
-rw-r--r--Source/CTest/cmCTestGIT.cxx4
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx4
-rw-r--r--Source/CTest/cmCTestRunTest.cxx3
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx12
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.cxx34
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx78
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx4
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx2
-rw-r--r--Source/cmAddCustomCommandCommand.cxx2
-rw-r--r--Source/cmAddCustomTargetCommand.cxx4
-rw-r--r--Source/cmCTest.cxx18
-rw-r--r--Source/cmCacheManager.cxx4
-rw-r--r--Source/cmComputeLinkInformation.cxx4
-rw-r--r--Source/cmCoreTryCompile.cxx2
-rw-r--r--Source/cmDependsC.cxx4
-rw-r--r--Source/cmExportFileGenerator.cxx21
-rw-r--r--Source/cmExportInstallFileGenerator.cxx3
-rw-r--r--Source/cmFindCommon.cxx2
-rw-r--r--Source/cmFindLibraryCommand.cxx2
-rw-r--r--Source/cmFindPackageCommand.cxx3
-rw-r--r--Source/cmFindPathCommand.cxx4
-rw-r--r--Source/cmGeneratorExpression.cxx6
-rw-r--r--Source/cmGeneratorTarget.cxx6
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx6
-rw-r--r--Source/cmGlobalGenerator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx2
-rw-r--r--Source/cmInstallCommand.cxx10
-rw-r--r--Source/cmLocalGenerator.cxx8
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx21
-rw-r--r--Source/cmMSVC60LinkLineComputer.cxx2
-rw-r--r--Source/cmMakefile.cxx9
-rw-r--r--Source/cmMakefileTargetGenerator.cxx4
-rw-r--r--Source/cmQtAutoGeneratorCommon.cxx2
-rw-r--r--Source/cmRST.cxx10
-rw-r--r--Source/cmRulePlaceholderExpander.cxx10
-rw-r--r--Source/cmSystemTools.cxx3
-rw-r--r--Source/cmTarget.cxx2
-rw-r--r--Source/cmXCodeObject.cxx4
-rw-r--r--Source/cmakexbuild.cxx5
-rw-r--r--Source/cmcmd.cxx26
44 files changed, 199 insertions, 184 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index b6075c90c0..18ef05c67f 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -596,10 +596,10 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
// At this point we need to make this->SourceFile relative to
// the source root of the project, so cvs links will work
cmSystemTools::ConvertToUnixSlashes(cm->SourceFile);
- if (cm->SourceFile.find("/.../") != cm->SourceFile.npos) {
+ if (cm->SourceFile.find("/.../") != std::string::npos) {
cmSystemTools::ReplaceString(cm->SourceFile, "/.../", "");
std::string::size_type p = cm->SourceFile.find('/');
- if (p != cm->SourceFile.npos) {
+ if (p != std::string::npos) {
cm->SourceFile =
cm->SourceFile.substr(p + 1, cm->SourceFile.size() - p);
}
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 87c532c48c..877cd2445b 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -103,6 +103,7 @@ public:
return this->PipeState;
}
int GetProcessState() { return this->PipeState; }
+
private:
int PipeState;
cmsysProcess* Process;
@@ -896,7 +897,7 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage(
cmsys::ifstream in(files[fileEntry].c_str());
cmSystemTools::GetLineFromStream(in, line);
cmSystemTools::GetLineFromStream(in, line);
- if (line.find("node-jscoverage") != line.npos) {
+ if (line.find("node-jscoverage") != std::string::npos) {
blanketFiles.push_back(files[fileEntry]);
}
}
@@ -1222,7 +1223,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
if (vec[lineIdx] < 0) {
- if (cov > 0 || prefix.find('#') != prefix.npos) {
+ if (cov > 0 || prefix.find('#') != std::string::npos) {
vec[lineIdx] = 0;
}
}
@@ -1524,7 +1525,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
if (vec[lineIdx] < 0) {
- if (cov > 0 || prefix.find('#') != prefix.npos) {
+ if (cov > 0 || prefix.find('#') != std::string::npos) {
vec[lineIdx] = 0;
}
}
@@ -2127,7 +2128,7 @@ bool cmCTestCoverageHandler::GetNextInt(std::string const& inputLine,
std::string::size_type start = pos;
pos = inputLine.find(',', start);
value = atoi(inputLine.substr(start, pos).c_str());
- if (pos == inputLine.npos) {
+ if (pos == std::string::npos) {
return true;
}
pos++;
@@ -2141,7 +2142,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
{
// find the first comma
std::string::size_type pos = inputLine.find(',');
- if (pos == inputLine.npos) {
+ if (pos == std::string::npos) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Error parsing string : " << inputLine << "\n");
return false;
@@ -2168,7 +2169,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
return false;
}
// should be at the end now
- if (pos != inputLine.npos) {
+ if (pos != std::string::npos) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing input : "
<< inputLine << " last pos not npos = " << pos << "\n");
}
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 17f822daf2..230aedf3b3 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -191,9 +191,9 @@ bool cmCTestGIT::UpdateByFetchAndReset()
std::string line;
while (sha1.empty() && cmSystemTools::GetLineFromStream(fin, line)) {
this->Log << "FETCH_HEAD> " << line << "\n";
- if (line.find("\tnot-for-merge\t") == line.npos) {
+ if (line.find("\tnot-for-merge\t") == std::string::npos) {
std::string::size_type pos = line.find('\t');
- if (pos != line.npos) {
+ if (pos != std::string::npos) {
sha1 = line.substr(0, pos);
}
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index fc4980badc..c35f0bc708 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -801,7 +801,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
bool unlimitedOutput = false;
- if (str.find("CTEST_FULL_OUTPUT") != str.npos ||
+ if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
this->CustomMaximumFailedTestOutputSize == 0) {
unlimitedOutput = true;
}
@@ -953,7 +953,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
std::string& theLine = lines[cc];
// check for command line arguments that are not escaped
// correctly by BC
- if (theLine.find("TargetArgs=") != theLine.npos) {
+ if (theLine.find("TargetArgs=") != std::string::npos) {
// skip this because BC gets it wrong and we can't parse it
} else if (!parser.ParseChunk(theLine.c_str(), theLine.size())) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index fe2307581f..0c4269e3d6 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -596,8 +596,7 @@ void cmCTestRunTest::ComputeArguments()
void cmCTestRunTest::DartProcessing()
{
if (!this->ProcessOutput.empty() &&
- this->ProcessOutput.find("<DartMeasurement") !=
- this->ProcessOutput.npos) {
+ this->ProcessOutput.find("<DartMeasurement") != std::string::npos) {
if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) {
this->TestResult.DartString = this->TestHandler->DartStuff.match(1);
// keep searching and replacing until none are left
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 4aceddbc7c..8d62fa1564 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -595,7 +595,7 @@ void cmCTestSubmitHandler::ParseResponse(
std::string output;
output.append(chunk.begin(), chunk.end());
- if (output.find("<cdash") != output.npos) {
+ if (output.find("<cdash") != std::string::npos) {
ResponseParser parser;
parser.Parse(output.c_str());
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index da3ae2f866..674be60526 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -225,7 +225,7 @@ public:
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
- */
+ */
bool InitialPass(std::vector<std::string> const& /*args*/,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
@@ -247,7 +247,7 @@ inline int GetNextNumber(std::string const& in, int& val,
std::string::size_type& pos2)
{
pos2 = in.find(',', pos);
- if (pos2 != in.npos) {
+ if (pos2 != std::string::npos) {
if (pos2 - pos == 0) {
val = -1;
} else {
@@ -273,7 +273,7 @@ inline int GetNextRealNumber(std::string const& in, double& val,
std::string::size_type& pos2)
{
pos2 = in.find(',', pos);
- if (pos2 != in.npos) {
+ if (pos2 != std::string::npos) {
if (pos2 - pos == 0) {
val = -1;
} else {
@@ -1823,7 +1823,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
std::string::size_type pos;
while (cmSystemTools::GetLineFromStream(ifs, line)) {
pos = line.find(':', 0);
- if (pos == line.npos) {
+ if (pos == std::string::npos) {
continue;
}
@@ -2027,7 +2027,7 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
{
if (!length || length >= output.size() ||
- output.find("CTEST_FULL_OUTPUT") != output.npos) {
+ output.find("CTEST_FULL_OUTPUT") != std::string::npos) {
return true;
}
@@ -2175,7 +2175,7 @@ bool cmCTestTestHandler::SetTestsProperties(
}
if (key == "MEASUREMENT") {
size_t pos = val.find_first_of('=');
- if (pos != val.npos) {
+ if (pos != std::string::npos) {
std::string mKey = val.substr(0, pos);
const char* mVal = val.c_str() + pos + 1;
rtit->Measurements[mKey] = mVal;
diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx
index e5d8a23b86..f7f3e4123a 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.cxx
+++ b/Source/CTest/cmParseBlanketJSCoverage.cxx
@@ -35,7 +35,7 @@ public:
line.substr(begIndex + 3, endIndex - (begIndex + 4));
return foundFileName;
}
- return line.substr(begIndex, line.npos);
+ return line.substr(begIndex, std::string::npos);
}
bool ParseFile(std::string const& file)
{
@@ -51,13 +51,13 @@ public:
return false;
}
while (cmSystemTools::GetLineFromStream(in, line)) {
- if (line.find("filename") != line.npos) {
+ if (line.find("filename") != std::string::npos) {
if (foundFile) {
/*
- * Upon finding a second file name, generate a
- * vector within the total coverage to capture the
- * information in the local vector
- */
+ * Upon finding a second file name, generate a
+ * vector within the total coverage to capture the
+ * information in the local vector
+ */
FileLinesType& CoverageVector =
this->Coverage.TotalCoverage[filename];
CoverageVector = localCoverageVector;
@@ -66,19 +66,19 @@ public:
foundFile = true;
inSource = false;
filename = getValue(line, 0);
- } else if ((line.find("coverage") != line.npos) && foundFile &&
+ } else if ((line.find("coverage") != std::string::npos) && foundFile &&
inSource) {
/*
- * two types of "coverage" in the JSON structure
- *
- * The coverage result over the file or set of files
- * and the coverage for each individual line
- *
- * FoundFile and foundSource ensure that
- * only the value of the line coverage is captured
- */
+ * two types of "coverage" in the JSON structure
+ *
+ * The coverage result over the file or set of files
+ * and the coverage for each individual line
+ *
+ * FoundFile and foundSource ensure that
+ * only the value of the line coverage is captured
+ */
std::string result = getValue(line, 1);
- result = result.substr(2, result.npos);
+ result = result.substr(2, std::string::npos);
if (result == "\"\"") {
// Empty quotation marks indicate that the
// line is not executable
@@ -87,7 +87,7 @@ public:
// Else, it contains the number of time executed
localCoverageVector.push_back(atoi(result.c_str()));
}
- } else if (line.find("source") != line.npos) {
+ } else if (line.find("source") != std::string::npos) {
inSource = true;
}
}
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index 9cdd50b699..4b781a6dbd 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -42,18 +42,20 @@ public:
size_t beginPos = line.find("begin");
// Check that the begin is the first non-space string on the line
- if ((beginPos == line.find_first_not_of(' ')) && beginPos != line.npos) {
+ if ((beginPos == line.find_first_not_of(' ')) &&
+ beginPos != std::string::npos) {
beginSet.push_back("begin");
coverageVector.push_back(-1);
continue;
}
- if (line.find('{') != line.npos) {
+ if (line.find('{') != std::string::npos) {
blockComFlag = true;
- } else if (line.find('}') != line.npos) {
+ } else if (line.find('}') != std::string::npos) {
blockComFlag = false;
coverageVector.push_back(-1);
continue;
- } else if ((line.find("end;") != line.npos) && !beginSet.empty()) {
+ } else if ((line.find("end;") != std::string::npos) &&
+ !beginSet.empty()) {
beginSet.pop_back();
coverageVector.push_back(-1);
continue;
@@ -62,7 +64,7 @@ public:
// This checks for comments after lines of code, finding the
// comment symbol after the ending semicolon.
comPos = line.find("//");
- if (comPos != line.npos) {
+ if (comPos != std::string::npos) {
semiPos = line.find(';');
if (comPos < semiPos) {
lineComFlag = true;
@@ -91,20 +93,20 @@ public:
size_t pos = 0;
/*
- * This first 'while' section goes through the found HTML
- * file name and attempts to capture the source file name
- * which is set as part of the HTML file name: the name of
- * the file is found in parenthesis '()'
- *
- * See test HTML file name: UTCovTest(UTCovTest.pas).html.
- *
- * Find the text inside each pair of parenthesis and check
- * to see if it ends in '.pas'. If it can't be found,
- * exit the function.
- */
+ * This first 'while' section goes through the found HTML
+ * file name and attempts to capture the source file name
+ * which is set as part of the HTML file name: the name of
+ * the file is found in parenthesis '()'
+ *
+ * See test HTML file name: UTCovTest(UTCovTest.pas).html.
+ *
+ * Find the text inside each pair of parenthesis and check
+ * to see if it ends in '.pas'. If it can't be found,
+ * exit the function.
+ */
while (true) {
lastoffset = line.find('(', pos);
- if (lastoffset == line.npos) {
+ if (lastoffset == std::string::npos) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, endnamepos
<< "File not found " << lastoffset << std::endl,
this->Coverage.Quiet);
@@ -112,7 +114,7 @@ public:
}
endnamepos = line.find(')', lastoffset);
filename = line.substr(lastoffset + 1, (endnamepos - 1) - lastoffset);
- if (filename.find(".pas") != filename.npos) {
+ if (filename.find(".pas") != std::string::npos) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Coverage found for file: " << filename
<< std::endl,
@@ -122,9 +124,9 @@ public:
pos = lastoffset + 1;
}
/*
- * Glob through the source directory for the
- * file found above
- */
+ * Glob through the source directory for the
+ * file found above
+ */
cmsys::Glob gl;
gl.RecurseOn();
gl.RecurseThroughSymlinksOff();
@@ -133,9 +135,9 @@ public:
std::vector<std::string> const& files = gl.GetFiles();
if (files.empty()) {
/*
- * If that doesn't find any matching files
- * return a failure.
- */
+ * If that doesn't find any matching files
+ * return a failure.
+ */
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Unable to find file matching" << glob << std::endl,
this->Coverage.Quiet);
@@ -144,9 +146,9 @@ public:
FileLinesType& coverageVector = this->Coverage.TotalCoverage[files[0]];
/*
- * Initialize the file to have all code between 'begin' and
- * 'end' tags marked as executable
- */
+ * Initialize the file to have all code between 'begin' and
+ * 'end' tags marked as executable
+ */
this->initializeDelphiFile(files[0], coverageVector);
@@ -156,19 +158,19 @@ public:
}
/*
- * Now read the HTML file, looking for the lines that have an
- * "inline" in it. Then parse out the "class" value of that
- * line to determine if the line is executed or not.
- *
- * Sample HTML line:
- *
- * <tr class="covered"><td>47</td><td><pre style="display:inline;">
- * &nbsp;CheckEquals(1,2-1);</pre></td></tr>
- *
- */
+ * Now read the HTML file, looking for the lines that have an
+ * "inline" in it. Then parse out the "class" value of that
+ * line to determine if the line is executed or not.
+ *
+ * Sample HTML line:
+ *
+ * <tr class="covered"><td>47</td><td><pre style="display:inline;">
+ * &nbsp;CheckEquals(1,2-1);</pre></td></tr>
+ *
+ */
while (cmSystemTools::GetLineFromStream(in, line)) {
- if (line.find("inline") == line.npos) {
+ if (line.find("inline") == std::string::npos) {
continue;
}
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index 15ef059200..e4ee699c46 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -56,7 +56,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
int lastoffset = 0;
while (cmSystemTools::GetLineFromStream(in, line)) {
// only look at lines that have coverage data
- if (line.find("^ZZCOVERAGE") == line.npos) {
+ if (line.find("^ZZCOVERAGE") == std::string::npos) {
continue;
}
std::string filepath;
@@ -199,7 +199,7 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line,
// now parse the right hand side of the =
pos = line.find('=');
// no = found, this is an error
- if (pos == line.npos) {
+ if (pos == std::string::npos) {
return false;
}
pos++; // move past =
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 0fa7aa5d66..026320a1fb 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -1050,7 +1050,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
const char* curField = lbl->GetValue();
if (curField) {
std::string cfld = cmSystemTools::LowerCase(curField);
- if (cfld.find(str) != cfld.npos && findex != start_index) {
+ if (cfld.find(str) != std::string::npos && findex != start_index) {
break;
}
}
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index a100617275..b5e7c9ea9d 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -369,7 +369,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
// Make sure the output file name has no invalid characters.
std::string::size_type pos = o->find_first_of("#<>");
- if (pos != o->npos) {
+ if (pos != std::string::npos) {
std::ostringstream msg;
msg << "called with OUTPUT containing a \"" << (*o)[pos]
<< "\". This character is not allowed.";
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 5db6e0962d..87e1147804 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -27,7 +27,7 @@ bool cmAddCustomTargetCommand::InitialPass(
std::string const& targetName = args[0];
// Check the target name.
- if (targetName.find_first_of("/\\") != targetName.npos) {
+ if (targetName.find_first_of("/\\") != std::string::npos) {
std::ostringstream e;
e << "called with invalid target name \"" << targetName
<< "\". Target names may not contain a slash. "
@@ -144,7 +144,7 @@ bool cmAddCustomTargetCommand::InitialPass(
}
std::string::size_type pos = targetName.find_first_of("#<>");
- if (pos != targetName.npos) {
+ if (pos != std::string::npos) {
std::ostringstream msg;
msg << "called with target name containing a \"" << targetName[pos]
<< "\". This character is not allowed.";
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index f4699981fa..70257478fc 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -119,10 +119,10 @@ std::string cmCTest::CleanString(const std::string& str)
{
std::string::size_type spos = str.find_first_not_of(" \n\t\r\f\v");
std::string::size_type epos = str.find_last_not_of(" \n\t\r\f\v");
- if (spos == str.npos) {
+ if (spos == std::string::npos) {
return std::string();
}
- if (epos != str.npos) {
+ if (epos != std::string::npos) {
epos = epos - spos + 1;
}
return str.substr(spos, epos);
@@ -669,12 +669,12 @@ bool cmCTest::UpdateCTestConfiguration()
continue;
}
std::string::size_type cpos = line.find_first_of(':');
- if (cpos == line.npos) {
+ if (cpos == std::string::npos) {
continue;
}
std::string key = line.substr(0, cpos);
std::string value =
- cmCTest::CleanString(line.substr(cpos + 1, line.npos));
+ cmCTest::CleanString(line.substr(cpos + 1, std::string::npos));
this->CTestConfiguration[key] = value;
}
fin.close();
@@ -1241,7 +1241,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value)
//
const char* disallowed = "\\:*?\"<>|\n\r\t\f\v";
- if (safevalue.find_first_of(disallowed) != value.npos) {
+ if (safevalue.find_first_of(disallowed) != std::string::npos) {
std::string::size_type i = 0;
std::string::size_type n = strlen(disallowed);
char replace[2];
@@ -2349,8 +2349,8 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
cmSystemTools::RelativePath(buildDir.c_str(), fname.c_str());
// If any contains "." it is not parent directory
- bool inSrc = srcRelpath.find("..") == srcRelpath.npos;
- bool inBld = bldRelpath.find("..") == bldRelpath.npos;
+ bool inSrc = srcRelpath.find("..") == std::string::npos;
+ bool inBld = bldRelpath.find("..") == std::string::npos;
// TODO: Handle files with .. in their name
std::string* res = CM_NULLPTR;
@@ -2509,7 +2509,7 @@ void cmCTest::AddSubmitFile(Part part, const char* name)
void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
{
size_t epos = overStr.find('=');
- if (epos == overStr.npos) {
+ if (epos == std::string::npos) {
cmCTestLog(this, ERROR_MESSAGE,
"CTest configuration overwrite specified in the wrong format."
<< std::endl
@@ -2518,7 +2518,7 @@ void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
return;
}
std::string key = overStr.substr(0, epos);
- std::string value = overStr.substr(epos + 1, overStr.npos);
+ std::string value = overStr.substr(epos + 1, std::string::npos);
this->CTestConfigurationOverwrites[key] = value;
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index f7fefca6b6..224cf473b4 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -387,7 +387,7 @@ void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key)
{
// support : in key name by double quoting
const char* q =
- (key.find(':') != key.npos || key.find("//") == 0) ? "\"" : "";
+ (key.find(':') != std::string::npos || key.find("//") == 0) ? "\"" : "";
fout << q << key << q;
}
@@ -490,7 +490,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
e.Type = type;
// make sure we only use unix style paths
if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
- if (e.Value.find(';') != e.Value.npos) {
+ if (e.Value.find(';') != std::string::npos) {
std::vector<std::string> paths;
cmSystemTools::ExpandListArgument(e.Value, paths);
const char* sep = "";
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index c2ada43c85..b2deaaa853 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1033,8 +1033,8 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// See documentation of CMP0008.
std::string generator = this->GlobalGenerator->GetName();
if (this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
- (generator.find("Visual Studio") != generator.npos ||
- generator.find("Xcode") != generator.npos)) {
+ (generator.find("Visual Studio") != std::string::npos ||
+ generator.find("Xcode") != std::string::npos)) {
std::string file = cmSystemTools::GetFilenameName(item);
if (!this->ExtractAnyLibraryName.find(file.c_str())) {
this->HandleBadFullItem(item, file);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index d8ddf459c0..c46173908c 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -672,7 +672,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fprintf(fout, " \"%s\"", si->c_str());
// Add dependencies on any non-temporary sources.
- if (si->find("CMakeTmp") == si->npos) {
+ if (si->find("CMakeTmp") == std::string::npos) {
this->Makefile->AddCMakeDependFile(*si);
}
}
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 3b8451660c..a404ae861d 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -449,11 +449,11 @@ void cmDependsC::ParseTransform(std::string const& xform)
// A transform rule is of the form SOME_MACRO(%)=value-with-%
// We can simply separate with "(%)=".
std::string::size_type pos = xform.find("(%)=");
- if (pos == xform.npos || pos == 0) {
+ if (pos == std::string::npos || pos == 0) {
return;
}
std::string name = xform.substr(0, pos);
- std::string value = xform.substr(pos + 4, xform.npos);
+ std::string value = xform.substr(pos + 4, std::string::npos);
this->TransformRules[name] = value;
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index ae3ec3bc4d..565b84d0ec 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -590,16 +590,17 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
- while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos) {
+ while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) !=
+ std::string::npos) {
std::string::size_type nameStartPos =
pos + sizeof("$<TARGET_PROPERTY:") - 1;
std::string::size_type closePos = input.find('>', nameStartPos);
std::string::size_type commaPos = input.find(',', nameStartPos);
std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
- if (commaPos == input.npos // Implied 'this' target
- || closePos == input.npos // Imcomplete expression.
- || closePos < commaPos // Implied 'this' target
- || nextOpenPos < commaPos) // Non-literal
+ if (commaPos == std::string::npos // Implied 'this' target
+ || closePos == std::string::npos // Imcomplete expression.
+ || closePos < commaPos // Implied 'this' target
+ || nextOpenPos < commaPos) // Non-literal
{
lastPos = nameStartPos;
continue;
@@ -617,15 +618,15 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
std::string errorString;
pos = 0;
lastPos = pos;
- while ((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos) {
+ while ((pos = input.find("$<TARGET_NAME:", lastPos)) != std::string::npos) {
std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
std::string::size_type endPos = input.find('>', nameStartPos);
- if (endPos == input.npos) {
+ if (endPos == std::string::npos) {
errorString = "$<TARGET_NAME:...> expression incomplete";
break;
}
std::string targetName = input.substr(nameStartPos, endPos - nameStartPos);
- if (targetName.find("$<") != input.npos) {
+ if (targetName.find("$<") != std::string::npos) {
errorString = "$<TARGET_NAME:...> requires its parameter to be a "
"literal.";
break;
@@ -642,10 +643,10 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
pos = 0;
lastPos = pos;
while (errorString.empty() &&
- (pos = input.find("$<LINK_ONLY:", lastPos)) != input.npos) {
+ (pos = input.find("$<LINK_ONLY:", lastPos)) != std::string::npos) {
std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1;
std::string::size_type endPos = input.find('>', nameStartPos);
- if (endPos == input.npos) {
+ if (endPos == std::string::npos) {
errorString = "$<LINK_ONLY:...> expression incomplete";
break;
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 16bd5e84ec..664a342764 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -255,7 +255,8 @@ void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
- while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) != input.npos) {
+ while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) !=
+ std::string::npos) {
std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}");
lastPos = endPos;
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index e8ae20f010..b07a26a1ea 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -311,7 +311,7 @@ void cmFindCommon::AddPathSuffix(std::string const& arg)
return;
}
if (suffix[0] == '/') {
- suffix = suffix.substr(1, suffix.npos);
+ suffix = suffix.substr(1, std::string::npos);
}
if (suffix.empty()) {
return;
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 562a9fc51e..a6b1a2155c 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -303,7 +303,7 @@ bool cmFindLibraryHelper::HasValidSuffix(std::string const& name)
// Check if a valid library suffix is somewhere in the name,
// this may happen e.g. for versioned shared libraries: libfoo.so.2
suffix += ".";
- if (name.find(suffix) != name.npos) {
+ if (name.find(suffix) != std::string::npos) {
return true;
}
}
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index f67f353384..21ca347216 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -326,7 +326,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
} else if (doing == DoingPathSuffixes) {
this->AddPathSuffix(args[i]);
} else if (doing == DoingConfigs) {
- if (args[i].find_first_of(":/\\") != args[i].npos ||
+ if (args[i].find_first_of(":/\\") != std::string::npos ||
cmSystemTools::GetFilenameLastExtension(args[i]) != ".cmake") {
std::ostringstream e;
e << "given CONFIGS option followed by invalid file name \"" << args[i]
@@ -1593,6 +1593,7 @@ class cmFileListGeneratorBase
{
public:
virtual ~cmFileListGeneratorBase() {}
+
protected:
bool Consider(std::string const& fullPath, cmFileList& listing);
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 644b025fe1..d3541ca947 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -76,14 +76,14 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
// if there is a / in the name try to find the header as a framework
// For example bar/foo.h would look for:
// bar.framework/Headers/foo.h
- if (pos != fileName.npos) {
+ if (pos != std::string::npos) {
// remove the name from the slash;
fileName = fileName.substr(pos + 1);
frameWorkName = file;
frameWorkName =
frameWorkName.substr(0, frameWorkName.size() - fileName.size() - 1);
// if the framework has a path in it then just use the filename
- if (frameWorkName.find('/') != frameWorkName.npos) {
+ if (frameWorkName.find('/') != std::string::npos) {
fileName = file;
frameWorkName = "";
}
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 570aa6ed5b..00b5ff4eff 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -126,7 +126,7 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
std::string cmGeneratorExpression::StripEmptyListElements(
const std::string& input)
{
- if (input.find(';') == input.npos) {
+ if (input.find(';') == std::string::npos) {
return input;
}
std::string result;
@@ -161,7 +161,7 @@ static std::string stripAllGeneratorExpressions(const std::string& input)
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
int nestingLevel = 0;
- while ((pos = input.find("$<", lastPos)) != input.npos) {
+ while ((pos = input.find("$<", lastPos)) != std::string::npos) {
result += input.substr(lastPos, pos - lastPos);
pos += 2;
nestingLevel = 1;
@@ -290,7 +290,7 @@ void cmGeneratorExpression::Split(const std::string& input,
{
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
- while ((pos = input.find("$<", lastPos)) != input.npos) {
+ while ((pos = input.find("$<", lastPos)) != std::string::npos) {
std::string part = input.substr(lastPos, pos - lastPos);
std::string preGenex;
if (!part.empty()) {
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 073bde2c0c..6233ec6fa0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5148,11 +5148,11 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
// do the expansion but users link to libraries like " ${VAR} ".
std::string lib = item;
std::string::size_type pos = lib.find_first_not_of(" \t\r\n");
- if (pos != lib.npos) {
- lib = lib.substr(pos, lib.npos);
+ if (pos != std::string::npos) {
+ lib = lib.substr(pos, std::string::npos);
}
pos = lib.find_last_not_of(" \t\r\n");
- if (pos != lib.npos) {
+ if (pos != std::string::npos) {
lib = lib.substr(0, pos + 1);
}
if (lib != item) {
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 5915a67fab..c23684c221 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -28,7 +28,7 @@ bool cmGetFilenameComponentCommand::InitialPass(
std::string result;
std::string filename = args[1];
- if (filename.find("[HKEY") != filename.npos) {
+ if (filename.find("[HKEY") != std::string::npos) {
// Check the registry as the target application would view it.
cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32;
cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64;
@@ -37,10 +37,10 @@ bool cmGetFilenameComponentCommand::InitialPass(
other_view = cmSystemTools::KeyWOW64_32;
}
cmSystemTools::ExpandRegistryValues(filename, view);
- if (filename.find("/registry") != filename.npos) {
+ if (filename.find("/registry") != std::string::npos) {
std::string other = args[1];
cmSystemTools::ExpandRegistryValues(other, other_view);
- if (other.find("/registry") == other.npos) {
+ if (other.find("/registry") == std::string::npos) {
filename = other;
}
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f3eb249401..19597fdd5b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -306,7 +306,7 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
// if there are spaces in the make program use short path
// but do not short path the actual program name, as
// this can cause trouble with VSExpress
- if (makeProgram.find(' ') != makeProgram.npos) {
+ if (makeProgram.find(' ') != std::string::npos) {
std::string dir;
std::string file;
cmSystemTools::SplitProgramPath(makeProgram, dir, file);
@@ -2730,7 +2730,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
}
// Get the filename.
- fname = line.substr(33, line.npos);
+ fname = line.substr(33, std::string::npos);
// Look for a hash for this file's rule.
std::map<std::string, RuleHash>::const_iterator rhi =
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 84740cae1b..64616ad933 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -170,7 +170,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
std::string::size_type pos;
if (cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, 0,
0, 0, cmSystemTools::OUTPUT_NONE) &&
- (pos = out.find(".app/"), pos != out.npos)) {
+ (pos = out.find(".app/"), pos != std::string::npos)) {
versionFile = out.substr(0, pos + 5) + "Contents/version.plist";
}
}
@@ -244,7 +244,7 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{
- if (ts.find_first_of(",=") != ts.npos) {
+ if (ts.find_first_of(",=") != std::string::npos) {
std::ostringstream e;
/* clang-format off */
e <<
@@ -1400,7 +1400,7 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
std::string retFlag;
std::string::size_type lastOccurancePos = flags.rfind(flag);
bool saved = false;
- while (lastOccurancePos != flags.npos) {
+ while (lastOccurancePos != std::string::npos) {
// increment pos, we use lastOccurancePos to reduce search space on next
// inc
std::string::size_type pos = lastOccurancePos;
@@ -3423,7 +3423,7 @@ std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p)
std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)
{
- if (p.find(' ') != p.npos) {
+ if (p.find(' ') != std::string::npos) {
std::string t = "\"";
t += p;
t += "\"";
@@ -3511,7 +3511,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags,
// Check if the flag needs quoting.
bool quoteFlag =
- flag.find_first_of("`~!@#$%^&*()+={}[]|:;\"'<>,.? ") != flag.npos;
+ flag.find_first_of("`~!@#$%^&*()+={}[]|:;\"'<>,.? ") != std::string::npos;
// We escape a flag as follows:
// - Place each flag in single quotes ''
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index cdb0279724..b81f7cb2d1 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -113,7 +113,7 @@ void cmIncludeDirectoryCommand::NormalizeInclude(std::string& inc)
{
std::string::size_type b = inc.find_first_not_of(" \r");
std::string::size_type e = inc.find_last_not_of(" \r");
- if ((b != inc.npos) && (e != inc.npos)) {
+ if ((b != std::string::npos) && (e != std::string::npos)) {
inc.assign(inc, b, 1 + e - b); // copy the remaining substring
} else {
inc = "";
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 93e467cd11..f49992434b 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1210,7 +1210,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode(
// Check the file name.
std::string fname = filename.GetString();
- if (fname.find_first_of(":/\\") != fname.npos) {
+ if (fname.find_first_of(":/\\") != std::string::npos) {
std::ostringstream e;
e << args[0] << " given invalid export file name \"" << fname << "\". "
<< "The FILE argument may not contain a path. "
@@ -1228,7 +1228,7 @@ bool cmInstallCommand::HandleExportAndroidMKMode(
this->SetError(e.str());
return false;
}
- if (fname.find_first_of(":/\\") != fname.npos) {
+ if (fname.find_first_of(":/\\") != std::string::npos) {
std::ostringstream e;
e << args[0] << " given export name \"" << exp.GetString() << "\". "
<< "This name cannot be safely converted to a file name. "
@@ -1302,7 +1302,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
// Check the file name.
std::string fname = filename.GetString();
- if (fname.find_first_of(":/\\") != fname.npos) {
+ if (fname.find_first_of(":/\\") != std::string::npos) {
std::ostringstream e;
e << args[0] << " given invalid export file name \"" << fname << "\". "
<< "The FILE argument may not contain a path. "
@@ -1326,7 +1326,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
fname = exp.GetString();
fname += ".cmake";
- if (fname.find_first_of(":/\\") != fname.npos) {
+ if (fname.find_first_of(":/\\") != std::string::npos) {
std::ostringstream e;
e << args[0] << " given export name \"" << exp.GetString() << "\". "
<< "This name cannot be safely converted to a file name. "
@@ -1391,7 +1391,7 @@ bool cmInstallCommand::MakeFilesFullPath(
}
// Make sure the file is not a directory.
- if (gpos == file.npos && cmSystemTools::FileIsDirectory(file)) {
+ if (gpos == std::string::npos && cmSystemTools::FileIsDirectory(file)) {
std::ostringstream e;
e << modeName << " given directory \"" << (*fileIt) << "\" to install.";
this->SetError(e.str());
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index e48378d2c9..04185216b3 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -140,7 +140,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
for (const char* const* replaceIter = cmArrayBegin(ruleReplaceVars);
replaceIter != cmArrayEnd(ruleReplaceVars); ++replaceIter) {
std::string actualReplace = *replaceIter;
- if (actualReplace.find("${LANG}") != actualReplace.npos) {
+ if (actualReplace.find("${LANG}") != std::string::npos) {
cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
}
@@ -1932,7 +1932,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
// -DNAME="value" instead of -D"NAME=value" for historical reasons.
std::string::size_type eq = defineIt->find("=");
def += defineIt->substr(0, eq);
- if (eq != defineIt->npos) {
+ if (eq != std::string::npos) {
def += "=";
def += this->EscapeForShell(defineIt->c_str() + eq + 1, true);
}
@@ -2109,7 +2109,7 @@ static bool cmLocalGeneratorShortenObjectName(std::string& objName,
// its own md5 sum.
std::string::size_type pos =
objName.find('/', objName.size() - max_len + 32);
- if (pos != objName.npos) {
+ if (pos != std::string::npos) {
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
std::string md5name = md5.HashString(objName.substr(0, pos));
md5name += objName.substr(pos);
@@ -2460,7 +2460,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
}
// Many compilers do not support # in the value so we disable it.
- if (define.find_first_of('#') != define.npos) {
+ if (define.find_first_of('#') != std::string::npos) {
std::ostringstream e;
/* clang-format off */
e << "WARNING: Preprocessor definitions containing '#' may not be "
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 8d3edb8c35..146cfd0593 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -606,7 +606,7 @@ std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand(
std::string const& cmd)
{
if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
- cmd.find_first_of("( )") != cmd.npos) {
+ cmd.find_first_of("( )") != std::string::npos) {
// On Watcom WMake use the windows short path for the command
// name. This is needed to avoid funny quoting problems on
// lines with shell redirection operators.
@@ -852,7 +852,7 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
{
if (this->IsWatcomWMake() && !newFlags.empty()) {
std::string newf = newFlags;
- if (newf.find("\\\"") != newf.npos) {
+ if (newf.find("\\\"") != std::string::npos) {
cmSystemTools::ReplaceString(newf, "\\\"", "\"");
this->cmLocalGenerator::AppendFlags(flags, newf);
return;
@@ -978,11 +978,11 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
cmSystemTools::ReplaceString(cmd, "/./", "/");
// Convert the command to a relative path only if the current
// working directory will be the start-output directory.
- bool had_slash = cmd.find('/') != cmd.npos;
+ bool had_slash = cmd.find('/') != std::string::npos;
if (workingDir.empty()) {
cmd = this->MaybeConvertToRelativePath(currentBinDir, cmd);
}
- bool has_slash = cmd.find('/') != cmd.npos;
+ bool has_slash = cmd.find('/') != std::string::npos;
if (had_slash && !has_slash) {
// This command was specified as a path to a file in the
// current directory. Add a leading "./" so it can run
@@ -1039,9 +1039,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// curly braces are removed. The hack can be skipped if the
// first curly brace is the last character.
std::string::size_type lcurly = cmd.find('{');
- if (lcurly != cmd.npos && lcurly < (cmd.size() - 1)) {
+ if (lcurly != std::string::npos && lcurly < (cmd.size() - 1)) {
std::string::size_type rcurly = cmd.find('}');
- if (rcurly == cmd.npos || rcurly > lcurly) {
+ if (rcurly == std::string::npos || rcurly > lcurly) {
// The first curly is a left curly. Use the hack.
std::string hack_cmd = cmd.substr(0, lcurly);
hack_cmd += "{{}";
@@ -1207,9 +1207,12 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
// if there is no restriction on the length of make variables
// and there are no "." characters in the string, then return the
// unmodified combination.
- if ((!this->MakefileVariableSize && unmodified.find('.') == s.npos) &&
- (!this->MakefileVariableSize && unmodified.find('+') == s.npos) &&
- (!this->MakefileVariableSize && unmodified.find('-') == s.npos)) {
+ if ((!this->MakefileVariableSize &&
+ unmodified.find('.') == std::string::npos) &&
+ (!this->MakefileVariableSize &&
+ unmodified.find('+') == std::string::npos) &&
+ (!this->MakefileVariableSize &&
+ unmodified.find('-') == std::string::npos)) {
return unmodified;
}
diff --git a/Source/cmMSVC60LinkLineComputer.cxx b/Source/cmMSVC60LinkLineComputer.cxx
index d761e7ba0d..b5e8511a5f 100644
--- a/Source/cmMSVC60LinkLineComputer.cxx
+++ b/Source/cmMSVC60LinkLineComputer.cxx
@@ -24,7 +24,7 @@ std::string cmMSVC60LinkLineComputer::ConvertToLinkReference(
// Work-ardound command line parsing limitations in MSVC 6.0
// Search for the last space.
std::string::size_type pos = lib.rfind(' ');
- if (pos != lib.npos) {
+ if (pos != std::string::npos) {
// Find the slash after the last space, if any.
pos = lib.find('/', pos);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5af0084556..51d8980679 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -316,6 +316,7 @@ public:
bool noPolicyScope);
~IncludeScope();
void Quiet() { this->ReportError = false; }
+
private:
cmMakefile* Makefile;
bool NoPolicyScope;
@@ -480,6 +481,7 @@ public:
}
void Quiet() { this->ReportError = false; }
+
private:
cmMakefile* Makefile;
bool ReportError;
@@ -625,7 +627,7 @@ struct file_not_persistent
{
bool operator()(const std::string& path) const
{
- return !(path.find("CMakeTmp") == path.npos &&
+ return !(path.find("CMakeTmp") == std::string::npos &&
cmSystemTools::FileExists(path.c_str()));
}
};
@@ -1347,6 +1349,7 @@ public:
}
void Quiet() { this->ReportError = false; }
+
private:
cmMakefile* Makefile;
cmGlobalGenerator* GG;
@@ -1893,7 +1896,7 @@ cmSourceFile* cmMakefile::LinearGetSourceFileWithOutput(
out = *o;
std::string::size_type pos = out.rfind(name);
// If the output matches exactly
- if (pos != out.npos && pos == out.size() - name.size() &&
+ if (pos != std::string::npos && pos == out.size() - name.size() &&
(pos == 0 || out[pos - 1] == '/')) {
return *i;
}
@@ -2406,7 +2409,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld(
bool removeEmpty, bool replaceAt) const
{
// Fast path strings without any special characters.
- if (source.find_first_of("$@\\") == source.npos) {
+ if (source.find_first_of("$@\\") == std::string::npos) {
return cmake::LOG;
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 9c0520ef4b..1aeeb7d714 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1287,6 +1287,7 @@ public:
this->CurrentString += this->NextObject;
}
void Done() { this->Strings.push_back(this->CurrentString); }
+
private:
std::string MaybeConvertToRelativePath(std::string const& obj)
{
@@ -1596,7 +1597,8 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
frameworkPath, linkPath);
linkLibs = frameworkPath + linkPath + linkLibs;
- if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {
+ if (useResponseFile &&
+ linkLibs.find_first_not_of(' ') != std::string::npos) {
// Lookup the response file reference flag.
std::string responseFlagVar = "CMAKE_";
responseFlagVar +=
diff --git a/Source/cmQtAutoGeneratorCommon.cxx b/Source/cmQtAutoGeneratorCommon.cxx
index 18075147ca..3e1b58caa2 100644
--- a/Source/cmQtAutoGeneratorCommon.cxx
+++ b/Source/cmQtAutoGeneratorCommon.cxx
@@ -16,7 +16,7 @@ static std::string utilStripCR(std::string const& line)
{
// Strip CR characters rcc may have printed (possibly more than one!).
std::string::size_type cr = line.find('\r');
- if (cr != line.npos) {
+ if (cr != std::string::npos) {
return line.substr(0, cr);
}
return line;
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 938cad93c4..12bbaf6379 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -80,7 +80,7 @@ void cmRST::ProcessModule(std::istream& is)
if (!rst.empty() && rst != "#") {
// Bracket mode: check for end bracket
std::string::size_type pos = line.find(rst);
- if (pos == line.npos) {
+ if (pos == std::string::npos) {
this->ProcessLine(line);
} else {
if (line[0] != '#') {
@@ -98,7 +98,7 @@ void cmRST::ProcessModule(std::istream& is)
continue;
}
if (line.substr(0, 2) == "# ") {
- this->ProcessLine(line.substr(2, line.npos));
+ this->ProcessLine(line.substr(2, std::string::npos));
continue;
}
rst = "";
@@ -156,8 +156,8 @@ void cmRST::ProcessLine(std::string const& line)
isspace(line[2]))) {
this->Reset();
this->Markup =
- (line.find_first_not_of(" \t", 2) == line.npos ? MarkupEmpty
- : MarkupNormal);
+ (line.find_first_not_of(" \t", 2) == std::string::npos ? MarkupEmpty
+ : MarkupNormal);
if (this->CMakeDirective.find(line)) {
// Output cmake domain directives and their content normally.
this->NormalLine(line);
@@ -252,7 +252,7 @@ void cmRST::OutputLine(std::string const& line_in, bool inlineMarkup)
// no explicit "(...)" then add "()" to the text.
if (this->CMakeRole.match(2) == "command" &&
this->CMakeRole.match(5).empty() &&
- text.find_first_of("()") == text.npos) {
+ text.find_first_of("()") == std::string::npos) {
text += "()";
}
this->OS << "``" << text << "``";
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index d5d2f6752e..a71861af76 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -155,7 +155,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
// Strip the last extension off the target name.
std::string targetBase = replaceValues.Target;
std::string::size_type pos = targetBase.rfind('.');
- if (pos != targetBase.npos) {
+ if (pos != std::string::npos) {
return targetBase.substr(0, pos);
}
return targetBase;
@@ -270,7 +270,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
std::map<std::string, std::string>::iterator mapIt =
this->VariableMappings.find(variable);
if (mapIt != this->VariableMappings.end()) {
- if (variable.find("_FLAG") == variable.npos) {
+ if (variable.find("_FLAG") == std::string::npos) {
return outputConverter->ConvertToOutputForExisting(mapIt->second);
}
return mapIt->second;
@@ -284,15 +284,15 @@ void cmRulePlaceholderExpander::ExpandRuleVariables(
{
std::string::size_type start = s.find('<');
// no variables to expand
- if (start == s.npos) {
+ if (start == std::string::npos) {
return;
}
std::string::size_type pos = 0;
std::string expandedInput;
- while (start != s.npos && start < s.size() - 2) {
+ while (start != std::string::npos && start < s.size() - 2) {
std::string::size_type end = s.find('>', start);
// if we find a < with no > we are done
- if (end == s.npos) {
+ if (end == std::string::npos) {
return;
}
char c = s[start + 1];
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index dc7034e1b5..54ec6b0a2e 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -134,6 +134,7 @@ public:
operator bool() const { return this->handle_ != INVALID_HANDLE_VALUE; }
bool operator!() const { return this->handle_ == INVALID_HANDLE_VALUE; }
operator HANDLE() const { return this->handle_; }
+
private:
HANDLE handle_;
};
@@ -2372,7 +2373,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
rp[rp_count].Value += newRPath;
rp[rp_count].Value +=
- se[i]->Value.substr(pos + oldRPath.length(), oldRPath.npos);
+ se[i]->Value.substr(pos + oldRPath.length(), std::string::npos);
if (!rp[rp_count].Value.empty()) {
remove_rpath = false;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index f6758339d7..c95a3ca2ca 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1476,7 +1476,7 @@ bool cmTarget::CheckImportedLibName(std::string const& prop,
return false;
}
std::string::size_type bad = value.find_first_of(":/\\;");
- if (bad != value.npos) {
+ if (bad != std::string::npos) {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR, prop + " property value\n " + value +
"\nmay not contain '" + value.substr(bad, 1) + "'.");
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 3689ac4c28..0def8c321c 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -224,11 +224,11 @@ void cmXCodeObject::PrintString(std::ostream& os, std::string String)
{
// The string needs to be quoted if it contains any characters
// considered special by the Xcode project file parser.
- bool needQuote = (String.empty() || String.find("//") != String.npos ||
+ bool needQuote = (String.empty() || String.find("//") != std::string::npos ||
String.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
- "$_./") != String.npos);
+ "$_./") != std::string::npos);
const char* quote = needQuote ? "\"" : "";
// Print the string, quoted and escaped as necessary.
diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx
index f1f4bbb817..72da456d43 100644
--- a/Source/cmakexbuild.cxx
+++ b/Source/cmakexbuild.cxx
@@ -29,7 +29,8 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
std::string line;
int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err);
while (pipe != cmsysProcess_Pipe_None) {
- if (line.find("/bin/sh: bad interpreter: Text file busy") != line.npos) {
+ if (line.find("/bin/sh: bad interpreter: Text file busy") !=
+ std::string::npos) {
hitbug = true;
std::cerr << "Hit xcodebuild bug : " << line << "\n";
}
@@ -37,7 +38,7 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
// because it may contain bogus errors
// also remove all output with setenv in it to tone down
// the verbosity of xcodebuild
- if (!hitbug && (line.find("setenv") == line.npos)) {
+ if (!hitbug && (line.find("setenv") == std::string::npos)) {
if (pipe == cmsysProcess_Pipe_STDERR) {
std::cerr << line << "\n";
} else if (pipe == cmsysProcess_Pipe_STDOUT) {
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 9f2e8b7c21..d5b0861743 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -351,8 +351,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
// Warn if iwyu reported anything.
- if (stdErr.find("should remove these lines:") != stdErr.npos ||
- stdErr.find("should add these lines:") != stdErr.npos) {
+ if (stdErr.find("should remove these lines:") != std::string::npos ||
+ stdErr.find("should add these lines:") != std::string::npos) {
std::cerr << "Warning: include-what-you-use reported diagnostics:\n"
<< stdErr << "\n";
}
@@ -412,7 +412,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Output the stdout from ldd -r -u to stderr
// Warn if lwyu reported anything.
- if (stdOut.find("Unused direct dependencies:") != stdOut.npos) {
+ if (stdOut.find("Unused direct dependencies:") != std::string::npos) {
std::cerr << "Warning: " << stdOut;
}
}
@@ -480,7 +480,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::cerr << "cmake -E env: unknown option '" << a << "'"
<< std::endl;
return 1;
- } else if (a.find('=') != a.npos) {
+ } else if (a.find('=') != std::string::npos) {
// Set environment variable.
cmSystemTools::PutEnv(a);
} else {
@@ -924,15 +924,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmSystemTools::TarCompressNone;
bool verbose = false;
int nCompress = 0;
- if (flags.find_first_of('j') != flags.npos) {
+ if (flags.find_first_of('j') != std::string::npos) {
compress = cmSystemTools::TarCompressBZip2;
++nCompress;
}
- if (flags.find_first_of('J') != flags.npos) {
+ if (flags.find_first_of('J') != std::string::npos) {
compress = cmSystemTools::TarCompressXZ;
++nCompress;
}
- if (flags.find_first_of('z') != flags.npos) {
+ if (flags.find_first_of('z') != std::string::npos) {
compress = cmSystemTools::TarCompressGZip;
++nCompress;
}
@@ -946,22 +946,22 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
"at most one flag of z, j, or J may be used");
return 1;
}
- if (flags.find_first_of('v') != flags.npos) {
+ if (flags.find_first_of('v') != std::string::npos) {
verbose = true;
}
- if (flags.find_first_of('t') != flags.npos) {
+ if (flags.find_first_of('t') != std::string::npos) {
if (!cmSystemTools::ListTar(outFile.c_str(), verbose)) {
cmSystemTools::Error("Problem listing tar: ", outFile.c_str());
return 1;
}
- } else if (flags.find_first_of('c') != flags.npos) {
+ } else if (flags.find_first_of('c') != std::string::npos) {
if (!cmSystemTools::CreateTar(outFile.c_str(), files, compress,
verbose, mtime, format)) {
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
return 1;
}
- } else if (flags.find_first_of('x') != flags.npos) {
+ } else if (flags.find_first_of('x') != std::string::npos) {
if (!cmSystemTools::ExtractTar(outFile.c_str(), verbose)) {
cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
return 1;
@@ -1272,7 +1272,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
int result = 0;
while (result == 0 && cmSystemTools::GetLineFromStream(fin, command)) {
// Skip empty command lines.
- if (command.find_first_not_of(" \t") == command.npos) {
+ if (command.find_first_not_of(" \t") == std::string::npos) {
continue;
}
@@ -1420,7 +1420,7 @@ static bool RunCommand(const char* comment, std::vector<std::string>& command,
// it is the dumb rc command banner, but if the command
// returned an error code then print the output anyway as
// the banner may be mixed with some other important information.
- if (output.find("Resource Compiler Version") == output.npos || !res ||
+ if (output.find("Resource Compiler Version") == std::string::npos || !res ||
retCode) {
std::cout << output;
}