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 */ /* rebuild symlinks in the installed tree */
if (symlinkedFiles.size()>0) if (!symlinkedFiles.empty())
{ {
std::list< std::pair<std::string,std::string> >::iterator symlinkedIt; std::list< std::pair<std::string,std::string> >::iterator symlinkedIt;
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory(); std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();

View File

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

View File

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

View File

@ -82,7 +82,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
} }
const char* config = 0; const char* config = 0;
if ( this->CTest->GetConfigType().size() > 0 ) if (!this->CTest->GetConfigType().empty())
{ {
config = this->CTest->GetConfigType().c_str(); config = this->CTest->GetConfigType().c_str();
} }
@ -291,7 +291,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
} }
std::string output; std::string output;
const char* config = 0; const char* config = 0;
if ( this->CTest->GetConfigType().size() > 0 ) if (!this->CTest->GetConfigType().empty())
{ {
config = this->CTest->GetConfigType().c_str(); 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.empty() && cm->LineNumber >= 0 )
{ {
if ( cm->SourceFile.size() > 0 ) if (!cm->SourceFile.empty())
{ {
os << "\t\t<SourceFile>" << cm->SourceFile << "</SourceFile>" os << "\t\t<SourceFile>" << cm->SourceFile << "</SourceFile>"
<< std::endl; << std::endl;
} }
if ( cm->SourceFileTail.size() > 0 ) if (!cm->SourceFileTail.empty())
{ {
os << "\t\t<SourceFileTail>" << cm->SourceFileTail os << "\t\t<SourceFileTail>" << cm->SourceFileTail
<< "</SourceFileTail>" << std::endl; << "</SourceFileTail>" << std::endl;

View File

@ -665,7 +665,7 @@ int cmCTestCoverageHandler::ProcessHandler()
this->EndCoverageLogFile(covLogFile, logFileCount); this->EndCoverageLogFile(covLogFile, logFileCount);
if ( errorsWhileAccumulating.size() > 0 ) if (!errorsWhileAccumulating.empty())
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
@ -910,7 +910,7 @@ int cmCTestCoverageHandler::HandleJacocoCoverage(
g.FindFiles(coverageFile); g.FindFiles(coverageFile);
files=g.GetFiles(); files=g.GetFiles();
if (files.size() > 0) if (!files.empty())
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found Jacoco Files, Performing Coverage" << std::endl); "Found Jacoco Files, Performing Coverage" << std::endl);
@ -943,7 +943,7 @@ int cmCTestCoverageHandler::HandleDelphiCoverage(
g.FindFiles(coverageFile); g.FindFiles(coverageFile);
files=g.GetFiles(); files=g.GetFiles();
if (files.size() > 0) if (!files.empty())
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found Delphi HTML Files, Performing Coverage" << std::endl); "Found Delphi HTML Files, Performing Coverage" << std::endl);
@ -973,7 +973,7 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage(
std::vector<std::string> files; std::vector<std::string> files;
g.FindFiles(coverageFile); g.FindFiles(coverageFile);
files=g.GetFiles(); files=g.GetFiles();
if (files.size() > 0) if (!files.empty())
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found BlanketJS output JSON, Performing Coverage" << std::endl); "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; std::string> >::iterator passIt;
bool forceFail = false; bool forceFail = false;
bool outputTestErrorsToConsole = false; bool outputTestErrorsToConsole = false;
if ( this->TestProperties->RequiredRegularExpressions.size() > 0 ) if (!this->TestProperties->RequiredRegularExpressions.empty())
{ {
bool found = false; bool found = false;
for ( passIt = this->TestProperties->RequiredRegularExpressions.begin(); for ( passIt = this->TestProperties->RequiredRegularExpressions.begin();
@ -184,7 +184,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
} }
reason += "]"; reason += "]";
} }
if ( this->TestProperties->ErrorRegularExpressions.size() > 0 ) if (!this->TestProperties->ErrorRegularExpressions.empty())
{ {
for ( passIt = this->TestProperties->ErrorRegularExpressions.begin(); for ( passIt = this->TestProperties->ErrorRegularExpressions.begin();
passIt != this->TestProperties->ErrorRegularExpressions.end(); passIt != this->TestProperties->ErrorRegularExpressions.end();
@ -670,7 +670,7 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout,
cmSystemTools::SaveRestoreEnvironment sre; cmSystemTools::SaveRestoreEnvironment sre;
#endif #endif
if (environment && environment->size()>0) if (environment && !environment->empty())
{ {
cmSystemTools::AppendEnv(*environment); 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! // Now run off and do what you've been told!
res = ::curl_easy_perform(curl); res = ::curl_easy_perform(curl);
if ( chunk.size() > 0 ) if (!chunk.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL output: [" cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl); << std::endl);
} }
if ( chunkDebug.size() > 0 ) if (!chunkDebug.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
@ -390,7 +390,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
break; break;
default: default:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
if (this->HTTPProxyAuth.size() > 0) if (!this->HTTPProxyAuth.empty())
{ {
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
this->HTTPProxyAuth.c_str()); this->HTTPProxyAuth.c_str());
@ -523,14 +523,14 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
chunk.assign(mock_output.begin(), mock_output.end()); chunk.assign(mock_output.begin(), mock_output.end());
} }
if ( chunk.size() > 0 ) if (!chunk.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL output: [" cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl); << std::endl);
this->ParseResponse(chunk); this->ParseResponse(chunk);
} }
if ( chunkDebug.size() > 0 ) if (!chunkDebug.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
@ -576,7 +576,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
res = ::curl_easy_perform(curl); res = ::curl_easy_perform(curl);
if ( chunk.size() > 0 ) if (!chunk.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL output: [" cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
@ -697,7 +697,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
break; break;
default: default:
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
if (this->HTTPProxyAuth.size() > 0) if (!this->HTTPProxyAuth.empty())
{ {
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
this->HTTPProxyAuth.c_str()); this->HTTPProxyAuth.c_str());
@ -780,13 +780,13 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
return false; return false;
} }
if ( chunk.size() > 0 ) if (!chunk.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL output: [" cmCTestLog(this->CTest, DEBUG, "CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl); << std::endl);
} }
if ( chunkDebug.size() > 0 ) if (!chunkDebug.empty())
{ {
cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" cmCTestLog(this->CTest, DEBUG, "CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << 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: " cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: "
<< this->HTTPProxy << std::endl); << this->HTTPProxy << std::endl);
} }
if ( this->FTPProxy.size() > 0 ) if (!this->FTPProxy.empty())
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: " cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: "
<< this->FTPProxy << std::endl); << this->FTPProxy << std::endl);
@ -1256,12 +1256,12 @@ int cmCTestSubmitHandler::ProcessHandler()
this->CTest->GetCTestConfiguration("DropSite") + this->CTest->GetCTestConfiguration("DropSite") +
cmCTest::MakeURLSafe( cmCTest::MakeURLSafe(
this->CTest->GetCTestConfiguration("DropLocation")); this->CTest->GetCTestConfiguration("DropLocation"));
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 ) if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration( this->CTest->GetCTestConfiguration(
"DropSiteUser").c_str()); "DropSiteUser").c_str());
if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 ) if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty())
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
} }
@ -1310,12 +1310,12 @@ int cmCTestSubmitHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method" cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method"
<< std::endl << std::endl
<< " Drop site:" << url); << " Drop site:" << url);
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 ) if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{ {
url += this->CTest->GetCTestConfiguration("DropSiteUser"); url += this->CTest->GetCTestConfiguration("DropSiteUser");
cmCTestLog(this->CTest, HANDLER_OUTPUT, cmCTestLog(this->CTest, HANDLER_OUTPUT,
this->CTest->GetCTestConfiguration("DropSiteUser").c_str()); this->CTest->GetCTestConfiguration("DropSiteUser").c_str());
if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 ) if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty())
{ {
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******");
@ -1400,7 +1400,7 @@ int cmCTestSubmitHandler::ProcessHandler()
{ {
std::string url; std::string url;
std::string oldWorkingDirectory; std::string oldWorkingDirectory;
if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 ) if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty())
{ {
url += this->CTest->GetCTestConfiguration("DropSiteUser") + "@"; url += this->CTest->GetCTestConfiguration("DropSiteUser") + "@";
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1179,7 +1179,7 @@ std::string
cmExtraEclipseCDT4Generator::GetPathBasename(const std::string& path) cmExtraEclipseCDT4Generator::GetPathBasename(const std::string& path)
{ {
std::string outputBasename = path; std::string outputBasename = path;
while (outputBasename.size() > 0 && while (!outputBasename.empty() &&
(outputBasename[outputBasename.size() - 1] == '/' || (outputBasename[outputBasename.size() - 1] == '/' ||
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 cmExtraKateGenerator::GetPathBasename(const std::string& path)const
{ {
std::string outputBasename = path; std::string outputBasename = path;
while (outputBasename.size() > 0 && while (!outputBasename.empty() &&
(outputBasename[outputBasename.size() - 1] == '/' || (outputBasename[outputBasename.size() - 1] == '/' ||
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? // is there a limit?
long sizeLimit = -1; long sizeLimit = -1;
if (limitArg.GetString().size() > 0) if (!limitArg.GetString().empty())
{ {
sizeLimit = atoi(limitArg.GetCString()); sizeLimit = atoi(limitArg.GetCString());
} }
// is there an offset? // is there an offset?
long offset = 0; long offset = 0;
if (offsetArg.GetString().size() > 0) if (!offsetArg.GetString().empty())
{ {
offset = atoi(offsetArg.GetCString()); offset = atoi(offsetArg.GetCString());
} }
@ -899,7 +899,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
{ {
std::string expr = this->Makefile->GetCurrentDirectory(); std::string expr = this->Makefile->GetCurrentDirectory();
// Handle script mode // Handle script mode
if ( expr.size() > 0 ) if (!expr.empty())
{ {
expr += "/" + *i; expr += "/" + *i;
g.FindFiles(expr); g.FindFiles(expr);

View File

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

View File

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

View File

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

View File

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

View File

@ -2318,7 +2318,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.end()); cpackCommandLines.end());
depends.erase(depends.begin(), depends.end()); depends.erase(depends.begin(), depends.end());
std::ostringstream ostr; std::ostringstream ostr;
if ( componentsSet->size() > 0 ) if (!componentsSet->empty())
{ {
ostr << "Available install components are:"; ostr << "Available install components are:";
std::set<std::string>::iterator it; 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"); __set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS");
this->TargetsToIgnoreRegex.clear(); this->TargetsToIgnoreRegex.clear();
if (ignoreTargetsRegexes.size() > 0) if (!ignoreTargetsRegexes.empty())
{ {
std::vector<std::string> ignoreTargetsRegExVector; std::vector<std::string> ignoreTargetsRegExVector;
cmSystemTools::ExpandListArgument(ignoreTargetsRegexes, cmSystemTools::ExpandListArgument(ignoreTargetsRegexes,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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