From f09fde2d21ef0c97f0ed1b8c6849f0d7055bc24e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 15 Jan 2015 22:39:38 +0100 Subject: [PATCH] Replace 'foo.length() > 0' pattern with !foo.empty(). --- Source/CPack/cmCPackGenerator.cxx | 4 ++-- Source/cmDocumentation.cxx | 4 ++-- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmStringCommand.cxx | 2 +- Source/cmake.cxx | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index b7ef09029..f21fcf64f 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/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 << "]" diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index a268d1217..f4e3a75f7 100644 --- a/Source/cmDocumentation.cxx +++ b/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(); } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index d4ba89a69..84b34d91b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/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) { diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index ddfb7482a..3e606d748 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -386,7 +386,7 @@ bool cmStringCommand::RegexMatchAll(std::vector const& args) this->SetError(e); return false; } - if(output.length() > 0) + if(!output.empty()) { output += ";"; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2a2f2ab70..7accec288 100644 --- a/Source/cmake.cxx +++ b/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);