Commit 8b6f439e authored by Pavel Solodovnikov's avatar Pavel Solodovnikov Committed by Brad King

Access string npos without instance

parent 389ed56f
......@@ -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);
}
......
......@@ -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");
}
......
......@@ -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);
}
}
......
......@@ -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,
......
......@@ -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
......
......@@ -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());
......
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -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;
}
......
......@@ -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 =
......
......@@ -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;
}
}
......
......@@ -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.";
......
......@@ -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.";
......
......@@ -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;
}
......
......@@ -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 = "";
......
......@@ -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);
......
......@@ -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);
}
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -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);
......
......@@ -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 = "";
}
......