Browse Source

Remove second arg: npos in substr usages

Pavel Solodovnikov 8 years ago
parent
commit
db2d46e2dd

+ 2 - 2
Source/CPack/cmCPackGenerator.cxx

@@ -811,8 +811,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
           for (fit = result.begin(); fit != diff; ++fit) {
           for (fit = result.begin(); fit != diff; ++fit) {
             localFileName =
             localFileName =
               cmSystemTools::RelativePath(InstallPrefix, fit->c_str());
               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);
             Components[installComponent].Files.push_back(localFileName);
             cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <"
             cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file <"
                             << localFileName << "> to component <"
                             << localFileName << "> to component <"

+ 2 - 2
Source/CPack/cmCPackNSISGenerator.cxx

@@ -76,7 +76,7 @@ int cmCPackNSISGenerator::PackageFiles()
       }
       }
 
 
       // Strip off the component part of the path.
       // 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(), '/', '\\');
     std::replace(fileN.begin(), fileN.end(), '/', '\\');
 
 
@@ -106,7 +106,7 @@ int cmCPackNSISGenerator::PackageFiles()
         componentName = fileN.substr(0, slash);
         componentName = fileN.substr(0, slash);
 
 
         // Strip off the component part of the path.
         // 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(), '/', '\\');
     std::replace(fileN.begin(), fileN.end(), '/', '\\');

+ 2 - 2
Source/CTest/cmParseBlanketJSCoverage.cxx

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

+ 2 - 3
Source/cmCTest.cxx

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

+ 1 - 1
Source/cmDependsC.cxx

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

+ 1 - 1
Source/cmFindCommon.cxx

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

+ 1 - 1
Source/cmGeneratorTarget.cxx

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

+ 1 - 1
Source/cmGlobalGenerator.cxx

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

+ 1 - 1
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('.');
   std::string::size_type dot_pos = in.rfind('.');
   if (dot_pos != std::string::npos) {
   if (dot_pos != std::string::npos) {
     // Remove the extension first in case &base == &in.
     // 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);
     base = in.substr(0, dot_pos);
   } else {
   } else {
     base = in;
     base = in;

+ 1 - 1
Source/cmRST.cxx

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

+ 1 - 2
Source/cmSystemTools.cxx

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