Browse Source

Replace 'foo.length() > 0' pattern with !foo.empty().

Stephen Kelly 10 years ago
parent
commit
f09fde2d21

+ 2 - 2
Source/CPack/cmCPackGenerator.cxx

@@ -926,7 +926,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
           }
 
         if (NULL !=mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
-          if (absoluteDestFiles.length()>0) {
+          if (!absoluteDestFiles.empty()) {
             absoluteDestFiles +=";";
           }
           absoluteDestFiles +=
@@ -1356,7 +1356,7 @@ int cmCPackGenerator::PrepareGroupingKind()
      groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING");
   }
 
-  if (groupingType.length()>0)
+  if (!groupingType.empty())
     {
     cmCPackLogger(cmCPackLog::LOG_VERBOSE,  "["
         << this->Name << "]"

+ 2 - 2
Source/cmDocumentation.cxx

@@ -162,7 +162,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
     // given stream.
     cmsys::ofstream* fout = 0;
     std::ostream* s = &os;
-    if(i->Filename.length() > 0)
+    if(!i->Filename.empty())
       {
       fout = new cmsys::ofstream(i->Filename.c_str(), std::ios::out);
       if(fout)
@@ -877,7 +877,7 @@ bool cmDocumentation::PrintHelp(std::ostream& os)
 //----------------------------------------------------------------------------
 const char* cmDocumentation::GetNameString() const
 {
-  if(this->NameString.length() > 0)
+  if(!this->NameString.empty())
     {
     return this->NameString.c_str();
     }

+ 1 - 1
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -2297,7 +2297,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
     for(unsigned int i=1; i < components.size(); ++i)
       {
       // Only the last component can be empty to avoid double slashes.
-      if(components[i].length() > 0 || (i == (components.size()-1)))
+      if(!components[i].empty() || (i == (components.size()-1)))
         {
         if(!first)
           {

+ 1 - 1
Source/cmStringCommand.cxx

@@ -386,7 +386,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
       this->SetError(e);
       return false;
       }
-    if(output.length() > 0)
+    if(!output.empty())
       {
       output += ";";
       }

+ 2 - 2
Source/cmake.cxx

@@ -909,7 +909,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
     }
 
   // If there is a CMakeCache.txt file, use its settings.
-  if(cachePath.length() > 0)
+  if(!cachePath.empty())
     {
     cmCacheManager* cachem = this->GetCacheManager();
     cmCacheManager::CacheIterator it = cachem->NewIterator();
@@ -925,7 +925,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
     }
 
   // If there is a CMakeLists.txt file, use it as the source tree.
-  if(listPath.length() > 0)
+  if(!listPath.empty())
     {
     this->SetHomeDirectory(listPath);
     this->SetStartDirectory(listPath);