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

This commit is contained in:
Stephen Kelly 2015-01-15 00:06:11 +01:00
parent f3e92d2816
commit d92887efab
32 changed files with 83 additions and 83 deletions

View File

@ -421,7 +421,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
}
/* rebuild symlinks in the installed tree */
if (symlinkedFiles.size()>0)
if (!symlinkedFiles.empty())
{
std::list< std::pair<std::string,std::string> >::iterator symlinkedIt;
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();

View File

@ -102,7 +102,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
if ( tagString.size() > 0 ) { tagString += ","; }
if (!tagString.empty()) { tagString += ","; }
tagString = "VERBOSE";
}
}
@ -112,7 +112,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
if ( tagString.size() > 0 ) { tagString += ","; }
if (!tagString.empty()) { tagString += ","; }
tagString = "WARNING";
}
}
@ -122,7 +122,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
if ( tagString.size() > 0 ) { tagString += ","; }
if (!tagString.empty()) { tagString += ","; }
tagString = "ERROR";
}
}
@ -132,7 +132,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
if ( tagString.size() > 0 ) { tagString += ","; }
if (!tagString.empty()) { tagString += ","; }
tagString = "DEBUG";
}
useFileAndLine = true;
@ -143,7 +143,7 @@ void cmCPackLog::Log(int tag, const char* file, int line,
display = true;
if ( needTagString )
{
if ( tagString.size() > 0 ) { tagString += ","; }
if (!tagString.empty()) { tagString += ","; }
tagString = "VERBOSE";
}
}

View File

@ -58,7 +58,7 @@ void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout)
fout << "-J=" << properties->Name << " ";
//Write dependency information
/*if(this->Tests[test].size() > 0)
/*if(!this->Tests[test].empty())
{
fout << "-P=afterany";
for(TestSet::iterator i = this->Tests[test].begin();

View File

@ -82,7 +82,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
}
const char* config = 0;
if ( this->CTest->GetConfigType().size() > 0 )
if (!this->CTest->GetConfigType().empty())
{
config = this->CTest->GetConfigType().c_str();
}
@ -291,7 +291,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
std::string output;
const char* config = 0;
if ( this->CTest->GetConfigType().size() > 0 )
if (!this->CTest->GetConfigType().empty())
{
config = this->CTest->GetConfigType().c_str();
}

View File

@ -702,12 +702,12 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os)
}
if ( !cm->SourceFile.empty() && cm->LineNumber >= 0 )
{
if ( cm->SourceFile.size() > 0 )
if (!cm->SourceFile.empty())
{
os << "\t\t<SourceFile>" << cm->SourceFile << "</SourceFile>"
<< std::endl;
}
if ( cm->SourceFileTail.size() > 0 )
if (!cm->SourceFileTail.empty())
{
os << "\t\t<SourceFileTail>" << cm->SourceFileTail
<< "</SourceFileTail>" << std::endl;

View File

@ -665,7 +665,7 @@ int cmCTestCoverageHandler::ProcessHandler()
this->EndCoverageLogFile(covLogFile, logFileCount);
if ( errorsWhileAccumulating.size() > 0 )
if (!errorsWhileAccumulating.empty())
{
cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE,
@ -910,7 +910,7 @@ int cmCTestCoverageHandler::HandleJacocoCoverage(
g.FindFiles(coverageFile);
files=g.GetFiles();
if (files.size() > 0)
if (!files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found Jacoco Files, Performing Coverage" << std::endl);
@ -943,7 +943,7 @@ int cmCTestCoverageHandler::HandleDelphiCoverage(
g.FindFiles(coverageFile);
files=g.GetFiles();
if (files.size() > 0)
if (!files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found Delphi HTML Files, Performing Coverage" << std::endl);
@ -973,7 +973,7 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage(
std::vector<std::string> files;
g.FindFiles(coverageFile);
files=g.GetFiles();
if (files.size() > 0)
if (!files.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found BlanketJS output JSON, Performing Coverage" << std::endl);

View File

@ -155,7 +155,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
std::string> >::iterator passIt;
bool forceFail = false;
bool outputTestErrorsToConsole = false;
if ( this->TestProperties->RequiredRegularExpressions.size() > 0 )
if (!this->TestProperties->RequiredRegularExpressions.empty())
{
bool found = false;
for ( passIt = this->TestProperties->RequiredRegularExpressions.begin();
@ -184,7 +184,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
}
reason += "]";
}
if ( this->TestProperties->ErrorRegularExpressions.size() > 0 )
if (!this->TestProperties->ErrorRegularExpressions.empty())
{
for ( passIt = this->TestProperties->ErrorRegularExpressions.begin();
passIt != this->TestProperties->ErrorRegularExpressions.end();
@ -670,7 +670,7 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout,
cmSystemTools::SaveRestoreEnvironment sre;
#endif
if (environment && environment->size()>0)
if (environment && !environment->empty())
{
cmSystemTools::AppendEnv(*environment);
}

View File

@ -273,13 +273,13 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
// Now run off and do what you've been told!
res = ::curl_easy_perform(curl);
if ( chunk.size() > 0 )
if (!chunk.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
if ( chunkDebug.size() > 0 )
if (!chunkDebug.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
@ -390,7 +390,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
break;
default:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
if (this->HTTPProxyAuth.size() > 0)
if (!this->HTTPProxyAuth.empty())
{
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
this->HTTPProxyAuth.c_str());
@ -523,14 +523,14 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
chunk.assign(mock_output.begin(), mock_output.end());
}
if ( chunk.size() > 0 )
if (!chunk.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
this->ParseResponse(chunk);
}
if ( chunkDebug.size() > 0 )
if (!chunkDebug.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
@ -576,7 +576,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
res = ::curl_easy_perform(curl);
if ( chunk.size() > 0 )
if (!chunk.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
@ -697,7 +697,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
break;
default:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
if (this->HTTPProxyAuth.size() > 0)
if (!this->HTTPProxyAuth.empty())
{
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
this->HTTPProxyAuth.c_str());
@ -780,13 +780,13 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
return false;
}
if ( chunk.size() > 0 )
if (!chunk.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl);
}
if ( chunkDebug.size() > 0 )
if (!chunkDebug.empty())
{
cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size())
@ -1140,12 +1140,12 @@ int cmCTestSubmitHandler::ProcessHandler()
}
}
if ( this->HTTPProxy.size() > 0 )
if (!this->HTTPProxy.empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: "
<< this->HTTPProxy << std::endl);
}
if ( this->FTPProxy.size() > 0 )
if (!this->FTPProxy.empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: "
<< this->FTPProxy << std::endl);
@ -1256,12 +1256,12 @@ int cmCTestSubmitHandler::ProcessHandler()
this->CTest->GetCTestConfiguration("DropSite") +
cmCTest::MakeURLSafe(
this->CTest->GetCTestConfiguration("DropLocation"));
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration(
"DropSiteUser").c_str());
if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
}
@ -1310,12 +1310,12 @@ int cmCTestSubmitHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method"
<< std::endl
<< " Drop site:" << url);
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{
url += this->CTest->GetCTestConfiguration("DropSiteUser");
cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSiteUser").c_str());
if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 )
if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty())
{
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
@ -1400,7 +1400,7 @@ int cmCTestSubmitHandler::ProcessHandler()
{
std::string url;
std::string oldWorkingDirectory;
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 )
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{
url += this->CTest->GetCTestConfiguration("DropSiteUser") + "@";
}

View File

@ -578,7 +578,7 @@ int cmCTestTestHandler::ProcessHandler()
}
float percent = float(passed.size()) * 100.0f / float(total);
if ( failed.size() > 0 && percent > 99)
if (!failed.empty() && percent > 99)
{
percent = 99;
}

View File

@ -61,7 +61,7 @@ public:
continue;
}
else if((line.find("end;") != line.npos)
&& (beginSet.size() > 0))
&& !beginSet.empty())
{
beginSet.pop_back();
coverageVector.push_back(-1);
@ -80,7 +80,7 @@ public:
}
}
//Based up what was found, add a line to the coverageVector
if((beginSet.size() > 0) && line != "" && !blockComFlag
if(!beginSet.empty() && line != "" && !blockComFlag
&& !lineComFlag)
{
coverageVector.push_back(0);

View File

@ -106,7 +106,7 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
{
FileLinesType& curFileLines=
this->Coverage.TotalCoverage[this->CurFileName];
if(curFileLines.size() > 0)
if(!curFileLines.empty())
{
curFileLines[nr-1] = ci;
}

View File

@ -893,7 +893,7 @@ void cmCursesMainForm::HandleInput()
if ( key == 10 || key == KEY_ENTER )
{
this->SearchMode = false;
if ( this->SearchString.size() > 0 )
if (!this->SearchString.empty())
{
this->JumpToCacheEntry(this->SearchString.c_str());
this->OldSearchString = this->SearchString;
@ -918,7 +918,7 @@ void cmCursesMainForm::HandleInput()
}
else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC )
{
if ( this->SearchString.size() > 0 )
if (!this->SearchString.empty())
{
this->SearchString.resize(this->SearchString.size()-1);
}
@ -1067,7 +1067,7 @@ void cmCursesMainForm::HandleInput()
}
else if ( key == 'n' )
{
if ( this->OldSearchString.size() > 0 )
if (!this->OldSearchString.empty())
{
this->JumpToCacheEntry(this->OldSearchString.c_str());
}
@ -1201,7 +1201,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
int findex = start_index;
for(;;)
{
if ( str.size() > 0 )
if (!str.empty())
{
cmCursesWidget* lbl = 0;
if ( findex >= 0 )

View File

@ -872,7 +872,7 @@ bool cmCTest::OpenOutputFile(const std::string& path,
bool compress)
{
std::string testingDir = this->BinaryDir + "/Testing";
if ( path.size() > 0 )
if (!path.empty())
{
testingDir += "/" + path;
}
@ -1067,7 +1067,7 @@ int cmCTest::ProcessTests()
if ( cmSystemTools::FileExists(fullname.c_str()) &&
!cmSystemTools::FileIsDirectory(fullname) )
{
if ( this->NotesFiles.size() > 0 )
if (!this->NotesFiles.empty())
{
this->NotesFiles += ";";
}
@ -1266,7 +1266,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
std::ostream* log, double testTimeOut,
std::vector<std::string>* environment)
{
bool modifyEnv = (environment && environment->size()>0);
bool modifyEnv = (environment && !environment->empty());
// determine how much time we have
double timeout = this->GetRemainingTimeAllowed() - 120;
@ -2936,11 +2936,11 @@ bool cmCTest::RunCommand(
}
cmsysProcess_WaitForExit(cp, 0);
if ( tempOutput.size() > 0 )
if (!tempOutput.empty())
{
stdOut->append(&*tempOutput.begin(), tempOutput.size());
}
if ( tempError.size() > 0 )
if (!tempError.empty())
{
stdErr->append(&*tempError.begin(), tempError.size());
}

View File

@ -537,7 +537,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
"Result of TRY_COMPILE",
cmCacheManager::INTERNAL);
if ( outputVariable.size() > 0 )
if (!outputVariable.empty())
{
this->Makefile->AddDefinition(outputVariable, output.c_str());
}

View File

@ -101,7 +101,7 @@ bool cmCreateTestSourceList
break;
}
std::string func_name;
if (cmSystemTools::GetFilenamePath(*i).size() > 0)
if (!cmSystemTools::GetFilenamePath(*i).empty())
{
func_name = cmSystemTools::GetFilenamePath(*i) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(*i);
@ -126,7 +126,7 @@ bool cmCreateTestSourceList
for(i = testsBegin, j = tests_func_name.begin(); i != tests.end(); ++i, ++j)
{
std::string func_name;
if (cmSystemTools::GetFilenamePath(*i).size() > 0)
if (!cmSystemTools::GetFilenamePath(*i).empty())
{
func_name = cmSystemTools::GetFilenamePath(*i) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(*i);

View File

@ -226,7 +226,7 @@ void cmDependsJavaParserHelper::EndClass()
{
CurrentClass* parent = 0;
CurrentClass* current = 0;
if ( this->ClassStack.size() > 0 )
if (!this->ClassStack.empty())
{
current = &(*(this->ClassStack.end() - 1));
if ( this->ClassStack.size() > 1 )
@ -305,13 +305,13 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb)
if ( verb )
{
if ( this->CurrentPackage.size() > 0 )
if (!this->CurrentPackage.empty())
{
std::cout << "Current package is: " <<
this->CurrentPackage << std::endl;
}
std::cout << "Imports packages:";
if ( this->PackagesImport.size() > 0 )
if (!this->PackagesImport.empty())
{
std::vector<std::string>::iterator it;
for ( it = this->PackagesImport.begin();
@ -323,7 +323,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb)
}
std::cout << std::endl;
std::cout << "Depends on:";
if ( this->ClassesFound.size() > 0 )
if (!this->ClassesFound.empty())
{
std::vector<std::string>::iterator it;
for ( it = this->ClassesFound.begin();

View File

@ -41,7 +41,7 @@ bool cmExecProgramCommand
}
else if ( haveoutput_variable )
{
if ( output_variable.size() > 0 )
if (!output_variable.empty())
{
this->SetError("called with incorrect number of arguments");
return false;
@ -59,7 +59,7 @@ bool cmExecProgramCommand
}
else if ( havereturn_variable )
{
if ( return_variable.size() > 0 )
if (!return_variable.empty())
{
this->SetError("called with incorrect number of arguments");
return false;
@ -95,7 +95,7 @@ bool cmExecProgramCommand
command = args[0];
}
bool verbose = true;
if(output_variable.size() > 0)
if(!output_variable.empty())
{
verbose = false;
}
@ -118,7 +118,7 @@ bool cmExecProgramCommand
retVal = -1;
}
if ( output_variable.size() > 0 )
if (!output_variable.empty())
{
std::string::size_type first = output.find_first_not_of(" \n\t\r");
std::string::size_type last = output.find_last_not_of(" \n\t\r");
@ -135,7 +135,7 @@ bool cmExecProgramCommand
this->Makefile->AddDefinition(output_variable, coutput.c_str());
}
if ( return_variable.size() > 0 )
if (!return_variable.empty())
{
char buffer[100];
sprintf(buffer, "%d", retVal);

View File

@ -1179,7 +1179,7 @@ std::string
cmExtraEclipseCDT4Generator::GetPathBasename(const std::string& path)
{
std::string outputBasename = path;
while (outputBasename.size() > 0 &&
while (!outputBasename.empty() &&
(outputBasename[outputBasename.size() - 1] == '/' ||
outputBasename[outputBasename.size() - 1] == '\\'))
{

View File

@ -334,7 +334,7 @@ std::string cmExtraKateGenerator::GenerateProjectName(const std::string& name,
std::string cmExtraKateGenerator::GetPathBasename(const std::string& path)const
{
std::string outputBasename = path;
while (outputBasename.size() > 0 &&
while (!outputBasename.empty() &&
(outputBasename[outputBasename.size() - 1] == '/' ||
outputBasename[outputBasename.size() - 1] == '\\'))
{

View File

@ -336,14 +336,14 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
// is there a limit?
long sizeLimit = -1;
if (limitArg.GetString().size() > 0)
if (!limitArg.GetString().empty())
{
sizeLimit = atoi(limitArg.GetCString());
}
// is there an offset?
long offset = 0;
if (offsetArg.GetString().size() > 0)
if (!offsetArg.GetString().empty())
{
offset = atoi(offsetArg.GetCString());
}
@ -899,7 +899,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
{
std::string expr = this->Makefile->GetCurrentDirectory();
// Handle script mode
if ( expr.size() > 0 )
if (!expr.empty())
{
expr += "/" + *i;
g.FindFiles(expr);

View File

@ -763,7 +763,7 @@ bool cmFindPackageCommand::HandlePackageMode()
}
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
// have been found, but they didn't have appropriate versions.
else if (this->ConsideredConfigs.size() > 0)
else if (!this->ConsideredConfigs.empty())
{
e << "Could not find a configuration file for package \""
<< this->Name << "\" that "

View File

@ -132,14 +132,14 @@ bool cmFunctionHelperCommand::InvokeInitialPass
unsigned int cnt = 0;
for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit )
{
if ( argvDef.size() > 0 )
if (!argvDef.empty())
{
argvDef += ";";
}
argvDef += *eit;
if ( cnt >= this->Args.size()-1 )
{
if ( argnDef.size() > 0 )
if (!argnDef.empty())
{
argnDef += ";";
}

View File

@ -39,7 +39,7 @@ void cmGeneratorExpressionParser::Parse(
static void extendText(std::vector<cmGeneratorExpressionEvaluator*> &result,
std::vector<cmGeneratorExpressionToken>::const_iterator it)
{
if (result.size() > 0
if (!result.empty()
&& (*(result.end() - 1))->GetType()
== cmGeneratorExpressionEvaluator::Text)
{
@ -57,7 +57,7 @@ static void extendText(std::vector<cmGeneratorExpressionEvaluator*> &result,
static void extendResult(std::vector<cmGeneratorExpressionEvaluator*> &result,
const std::vector<cmGeneratorExpressionEvaluator*> &contents)
{
if (result.size() > 0
if (!result.empty()
&& (*(result.end() - 1))->GetType()
== cmGeneratorExpressionEvaluator::Text
&& (*contents.begin())->GetType()
@ -256,7 +256,7 @@ void cmGeneratorExpressionParser::ParseContent(
{
if (this->NestingLevel == 0)
{
if (result.size() > 0
if (!result.empty()
&& (*(result.end() - 1))->GetType()
== cmGeneratorExpressionEvaluator::Text)
{

View File

@ -33,7 +33,7 @@ bool cmGetCMakePropertyCommand
{
int cacheonly = 0;
std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly);
if (vars.size()>0)
if (!vars.empty())
{
output = vars[0];
}

View File

@ -2318,7 +2318,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.end());
depends.erase(depends.begin(), depends.end());
std::ostringstream ostr;
if ( componentsSet->size() > 0 )
if (!componentsSet->empty())
{
ostr << "Available install components are:";
std::set<std::string>::iterator it;

View File

@ -125,7 +125,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
__set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS");
this->TargetsToIgnoreRegex.clear();
if (ignoreTargetsRegexes.size() > 0)
if (!ignoreTargetsRegexes.empty())
{
std::vector<std::string> ignoreTargetsRegExVector;
cmSystemTools::ExpandListArgument(ignoreTargetsRegexes,

View File

@ -40,7 +40,7 @@ bool cmIncludeCommand
}
else if(args[i] == "RESULT_VARIABLE")
{
if (resultVarName.size() > 0)
if (!resultVarName.empty())
{
this->SetError("called with invalid arguments: "
"only one result variable allowed");

View File

@ -80,7 +80,7 @@ void cmInstallFilesCommand::FinalPass()
{
// replace any variables
std::string temps = *s;
if (cmSystemTools::GetFilenamePath(temps).size() > 0)
if (!cmSystemTools::GetFilenamePath(temps).empty())
{
testf = cmSystemTools::GetFilenamePath(temps) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext;

View File

@ -1427,7 +1427,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
std::string flags = includeFlags.str();
// remove trailing separators
if((sep[0] != ' ') && flags.size()>0 && flags[flags.size()-1] == sep[0])
if((sep[0] != ' ') && !flags.empty() && flags[flags.size()-1] == sep[0])
{
flags[flags.size()-1] = ' ';
}
@ -2906,7 +2906,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
assert(in_remote[0] != '\"');
// The local path should never have a trailing slash.
assert(local.size() > 0 && !(local[local.size()-1] == ""));
assert(!local.empty() && !(local[local.size()-1] == ""));
// If the path is already relative then just return the path.
if(!cmSystemTools::FileIsFullPath(in_remote.c_str()))
@ -2998,7 +2998,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
// the trailing slash in the output.
for(unsigned int i=common; i < remote.size(); ++i)
{
if(relative.size() > 0)
if(!relative.empty())
{
relative += "/";
}

View File

@ -170,7 +170,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
{
if ( cnt >= this->Args.size()-1 )
{
if ( argnDef.size() > 0 )
if (!argnDef.empty())
{
argnDef += ";";
}
@ -195,7 +195,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
std::vector<std::string>::const_iterator eit;
for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
{
if ( argvDef.size() > 0 )
if (!argvDef.empty())
{
argvDef += ";";
}

View File

@ -3857,7 +3857,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
result = moduleInCMakeRoot;
}
if ((moduleInCMakeModulePath.size()>0) && (moduleInCMakeRoot.size()>0))
if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty())
{
const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
std::string mods = cmakeRoot + std::string("/Modules/");

View File

@ -1608,7 +1608,7 @@ void cmake::PreLoadCMakeFiles()
{
std::vector<std::string> args;
std::string pre_load = this->GetHomeDirectory();
if ( pre_load.size() > 0 )
if (!pre_load.empty())
{
pre_load += "/PreLoad.cmake";
if ( cmSystemTools::FileExists(pre_load.c_str()) )
@ -1617,7 +1617,7 @@ void cmake::PreLoadCMakeFiles()
}
}
pre_load = this->GetHomeOutputDirectory();
if ( pre_load.size() > 0 )
if (!pre_load.empty())
{
pre_load += "/PreLoad.cmake";
if ( cmSystemTools::FileExists(pre_load.c_str()) )