Remove second arg: npos in substr usages

This commit is contained in:
Pavel Solodovnikov 2017-05-30 22:46:05 +03:00 committed by Brad King
parent 8b6f439ef2
commit db2d46e2dd
11 changed files with 15 additions and 17 deletions

View File

@ -811,8 +811,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
for (fit = result.begin(); fit != diff; ++fit) {
localFileName =
cmSystemTools::RelativePath(InstallPrefix, fit->c_str());
localFileName = localFileName.substr(
localFileName.find_first_not_of('/'), std::string::npos);
localFileName =
localFileName.substr(localFileName.find_first_not_of('/'));
Components[installComponent].Files.push_back(localFileName);
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <"
<< localFileName << "> to component <"

View File

@ -76,7 +76,7 @@ int cmCPackNSISGenerator::PackageFiles()
}
// Strip off the component part of the path.
fileN = fileN.substr(pos + 1, std::string::npos);
fileN = fileN.substr(pos + 1);
}
std::replace(fileN.begin(), fileN.end(), '/', '\\');
@ -106,7 +106,7 @@ int cmCPackNSISGenerator::PackageFiles()
componentName = fileN.substr(0, slash);
// Strip off the component part of the path.
fileN = fileN.substr(slash + 1, std::string::npos);
fileN = fileN.substr(slash + 1);
}
}
std::replace(fileN.begin(), fileN.end(), '/', '\\');

View File

@ -35,7 +35,7 @@ public:
line.substr(begIndex + 3, endIndex - (begIndex + 4));
return foundFileName;
}
return line.substr(begIndex, std::string::npos);
return line.substr(begIndex);
}
bool ParseFile(std::string const& file)
{
@ -78,7 +78,7 @@ public:
* only the value of the line coverage is captured
*/
std::string result = getValue(line, 1);
result = result.substr(2, std::string::npos);
result = result.substr(2);
if (result == "\"\"") {
// Empty quotation marks indicate that the
// line is not executable

View File

@ -673,8 +673,7 @@ bool cmCTest::UpdateCTestConfiguration()
continue;
}
std::string key = line.substr(0, cpos);
std::string value =
cmCTest::CleanString(line.substr(cpos + 1, std::string::npos));
std::string value = cmCTest::CleanString(line.substr(cpos + 1));
this->CTestConfiguration[key] = value;
}
fin.close();
@ -2518,7 +2517,7 @@ void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
return;
}
std::string key = overStr.substr(0, epos);
std::string value = overStr.substr(epos + 1, std::string::npos);
std::string value = overStr.substr(epos + 1);
this->CTestConfigurationOverwrites[key] = value;
}

View File

@ -453,7 +453,7 @@ void cmDependsC::ParseTransform(std::string const& xform)
return;
}
std::string name = xform.substr(0, pos);
std::string value = xform.substr(pos + 4, std::string::npos);
std::string value = xform.substr(pos + 4);
this->TransformRules[name] = value;
}

View File

@ -311,7 +311,7 @@ void cmFindCommon::AddPathSuffix(std::string const& arg)
return;
}
if (suffix[0] == '/') {
suffix = suffix.substr(1, std::string::npos);
suffix = suffix.substr(1);
}
if (suffix.empty()) {
return;

View File

@ -5149,7 +5149,7 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
std::string lib = item;
std::string::size_type pos = lib.find_first_not_of(" \t\r\n");
if (pos != std::string::npos) {
lib = lib.substr(pos, std::string::npos);
lib = lib.substr(pos);
}
pos = lib.find_last_not_of(" \t\r\n");
if (pos != std::string::npos) {

View File

@ -2730,7 +2730,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
}
// Get the filename.
fname = line.substr(33, std::string::npos);
fname = line.substr(33);
// Look for a hash for this file's rule.
std::map<std::string, RuleHash>::const_iterator rhi =

View File

@ -79,7 +79,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
std::string::size_type dot_pos = in.rfind('.');
if (dot_pos != std::string::npos) {
// Remove the extension first in case &base == &in.
ext = in.substr(dot_pos, std::string::npos);
ext = in.substr(dot_pos);
base = in.substr(0, dot_pos);
} else {
base = in;

View File

@ -98,7 +98,7 @@ void cmRST::ProcessModule(std::istream& is)
continue;
}
if (line.substr(0, 2) == "# ") {
this->ProcessLine(line.substr(2, std::string::npos));
this->ProcessLine(line.substr(2));
continue;
}
rst = "";

View File

@ -2372,8 +2372,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
// not being changed.
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(), std::string::npos);
rp[rp_count].Value += se[i]->Value.substr(pos + oldRPath.length());
if (!rp[rp_count].Value.empty()) {
remove_rpath = false;