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

This commit is contained in:
Stephen Kelly 2015-01-15 22:39:38 +01:00
parent 86b5bdfa08
commit f09fde2d21
5 changed files with 8 additions and 8 deletions

View File

@ -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 << "]"

View File

@ -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();
}

View File

@ -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)
{

View File

@ -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 += ";";
}

View File

@ -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);