From db2d46e2ddbdf1c5d942e70b341e085f84e79c13 Mon Sep 17 00:00:00 2001 From: Pavel Solodovnikov Date: Tue, 30 May 2017 22:46:05 +0300 Subject: Remove second arg: npos in substr usages --- Source/CPack/cmCPackGenerator.cxx | 4 ++-- Source/CPack/cmCPackNSISGenerator.cxx | 4 ++-- Source/CTest/cmParseBlanketJSCoverage.cxx | 4 ++-- Source/cmCTest.cxx | 5 ++--- Source/cmDependsC.cxx | 2 +- Source/cmFindCommon.cxx | 2 +- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmRST.cxx | 2 +- Source/cmSystemTools.cxx | 3 +-- 11 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 3e113d3..d8e2753 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -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 <" diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index beb2d01..9697a38 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -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(), '/', '\\'); diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index f7f3e41..83a7b75 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, 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 diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7025747..e260556 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -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; } diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index a404ae8..2c464cc 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -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; } diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index b07a26a..103e692 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, std::string::npos); + suffix = suffix.substr(1); } if (suffix.empty()) { return; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6233ec6..9a33bec 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -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) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 19597fd..67e272d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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::const_iterator rhi = diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 146cfd0..9b9d22c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -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; diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 12bbaf6..5364f76 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -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 = ""; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 54ec6b0..f7192e0 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -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; -- cgit v0.12