Merge topic 'consistent-empty-method'

5f69314e Replace foo.length() pattern with !foo.empty().
fd0c036c Replace 'foo.length() >= 1' pattern with !foo.empty()
f09fde2d Replace 'foo.length() > 0' pattern with !foo.empty().
86b5bdfa Replace 'foo.length() == 0' pattern with foo.empty().
fd7b3712 Replace foo.size() pattern with !foo.empty().
aa773035 Replace !foo.size() pattern with foo.empty().
64592633 cmListCommand: Use empty() and expand whitespace.
607e1938 Replace 'foo.size() != 0' pattern with !foo.empty().
930bd478 Replace 'foo.size() == 0' pattern with foo.empty().
d92887ef Replace 'foo.size() > 0' pattern with !foo.empty().
This commit is contained in:
Brad King 2015-01-19 09:43:28 -05:00 committed by CMake Topic Stage
commit 9de2ab7fce
81 changed files with 310 additions and 310 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();
@ -926,7 +926,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
} }
if (NULL !=mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { if (NULL !=mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
if (absoluteDestFiles.length()>0) { if (!absoluteDestFiles.empty()) {
absoluteDestFiles +=";"; absoluteDestFiles +=";";
} }
absoluteDestFiles += absoluteDestFiles +=
@ -1356,7 +1356,7 @@ int cmCPackGenerator::PrepareGroupingKind()
groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING"); groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING");
} }
if (groupingType.length()>0) if (!groupingType.empty())
{ {
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" cmCPackLogger(cmCPackLog::LOG_VERBOSE, "["
<< this->Name << "]" << this->Name << "]"

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

@ -117,7 +117,7 @@ int main (int argc, char const* const* argv)
cmSystemTools::EnableMSVCDebugHook(); cmSystemTools::EnableMSVCDebugHook();
if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 ) if (cmSystemTools::GetCurrentWorkingDirectory().empty())
{ {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR, cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Current working directory cannot be established." << std::endl); "Current working directory cannot be established." << std::endl);

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

@ -62,7 +62,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
std::vector<std::string> args; std::vector<std::string> args;
args.push_back(cmSystemTools::GetCMakeCommand()); args.push_back(cmSystemTools::GetCMakeCommand());
args.push_back(this->SourceDir); args.push_back(this->SourceDir);
if(this->BuildGenerator.size()) if(!this->BuildGenerator.empty())
{ {
std::string generator = "-G"; std::string generator = "-G";
generator += this->BuildGenerator; generator += this->BuildGenerator;
@ -74,7 +74,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
platform += this->BuildGeneratorPlatform; platform += this->BuildGeneratorPlatform;
args.push_back(platform); args.push_back(platform);
} }
if(this->BuildGeneratorToolset.size()) if(!this->BuildGeneratorToolset.empty())
{ {
std::string toolset = "-T"; std::string toolset = "-T";
toolset += this->BuildGeneratorToolset; toolset += this->BuildGeneratorToolset;
@ -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();
} }
@ -193,7 +193,7 @@ public:
int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
{ {
// if the generator and make program are not specified then it is an error // if the generator and make program are not specified then it is an error
if (!this->BuildGenerator.size()) if (this->BuildGenerator.empty())
{ {
if(outstring) if(outstring)
{ {
@ -211,8 +211,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
static_cast<void>(captureRAII); static_cast<void>(captureRAII);
std::ostringstream out; std::ostringstream out;
if ( this->CTest->GetConfigType().size() == 0 && if ( this->CTest->GetConfigType().empty() &&
this->ConfigSample.size()) !this->ConfigSample.empty())
{ {
// use the config sample to set the ConfigType // use the config sample to set the ConfigType
std::string fullPath; std::string fullPath;
@ -225,7 +225,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
resultingConfig, resultingConfig,
extraPaths, extraPaths,
failed); failed);
if (fullPath.size() && resultingConfig.size()) if (!fullPath.empty() && !resultingConfig.empty())
{ {
this->CTest->SetConfigType(resultingConfig.c_str()); this->CTest->SetConfigType(resultingConfig.c_str());
} }
@ -269,7 +269,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// do the build // do the build
std::vector<std::string>::iterator tarIt; std::vector<std::string>::iterator tarIt;
if ( this->BuildTargets.size() == 0 ) if (this->BuildTargets.empty())
{ {
this->BuildTargets.push_back(""); this->BuildTargets.push_back("");
} }
@ -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();
} }
@ -329,7 +329,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
} }
// if no test was specified then we are done // if no test was specified then we are done
if (!this->TestCommand.size()) if (this->TestCommand.empty())
{ {
return 0; return 0;
} }
@ -340,7 +340,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::string resultingConfig; std::string resultingConfig;
std::vector<std::string> extraPaths; std::vector<std::string> extraPaths;
// if this->ExecutableDirectory is set try that as well // if this->ExecutableDirectory is set try that as well
if (this->ExecutableDirectory.size()) if (!this->ExecutableDirectory.empty())
{ {
std::string tempPath = this->ExecutableDirectory; std::string tempPath = this->ExecutableDirectory;
tempPath += "/"; tempPath += "/";
@ -388,7 +388,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::string outs; std::string outs;
int retval = 0; int retval = 0;
// run the test from the this->BuildRunDir if set // run the test from the this->BuildRunDir if set
if(this->BuildRunDir.size()) if(!this->BuildRunDir.empty())
{ {
out << "Run test in directory: " << this->BuildRunDir << "\n"; out << "Run test in directory: " << this->BuildRunDir << "\n";
cmSystemTools::ChangeDirectory(this->BuildRunDir); cmSystemTools::ChangeDirectory(this->BuildRunDir);

View File

@ -344,7 +344,7 @@ int cmCTestBuildHandler::ProcessHandler()
// Determine build command and build directory // Determine build command and build directory
std::string makeCommand = this->GetMakeCommand(); std::string makeCommand = this->GetMakeCommand();
if ( makeCommand.size() == 0 ) if (makeCommand.empty())
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find MakeCommand key in the DartConfiguration.tcl" "Cannot find MakeCommand key in the DartConfiguration.tcl"
@ -354,7 +354,7 @@ int cmCTestBuildHandler::ProcessHandler()
const std::string &buildDirectory const std::string &buildDirectory
= this->CTest->GetCTestConfiguration("BuildDirectory"); = this->CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 ) if (buildDirectory.empty())
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl" "Cannot find BuildDirectory key in the DartConfiguration.tcl"
@ -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;
@ -1150,7 +1150,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
{ {
// This is not an error or warning. // This is not an error or warning.
// So, figure out if this is a post-context line // So, figure out if this is a post-context line
if ( this->ErrorsAndWarnings.size() && if ( !this->ErrorsAndWarnings.empty() &&
this->LastErrorOrWarning != this->ErrorsAndWarnings.end() && this->LastErrorOrWarning != this->ErrorsAndWarnings.end() &&
this->PostContextCount < this->MaxPostContext ) this->PostContextCount < this->MaxPostContext )
{ {

View File

@ -38,7 +38,7 @@ int cmCTestConfigureHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Configure project" << std::endl); cmCTestLog(this->CTest, HANDLER_OUTPUT, "Configure project" << std::endl);
std::string cCommand std::string cCommand
= this->CTest->GetCTestConfiguration("ConfigureCommand"); = this->CTest->GetCTestConfiguration("ConfigureCommand");
if ( cCommand.size() == 0 ) if (cCommand.empty())
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find ConfigureCommand key in the DartConfiguration.tcl" "Cannot find ConfigureCommand key in the DartConfiguration.tcl"
@ -48,7 +48,7 @@ int cmCTestConfigureHandler::ProcessHandler()
std::string buildDirectory std::string buildDirectory
= this->CTest->GetCTestConfiguration("BuildDirectory"); = this->CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 ) if (buildDirectory.empty())
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl" "Cannot find BuildDirectory key in the DartConfiguration.tcl"

View File

@ -87,7 +87,7 @@ public:
} }
args.push_back(0); // null terminate args.push_back(0); // null terminate
cmsysProcess_SetCommand(this->Process, &*args.begin()); cmsysProcess_SetCommand(this->Process, &*args.begin());
if(this->WorkingDirectory.size()) if(!this->WorkingDirectory.empty())
{ {
cmsysProcess_SetWorkingDirectory(this->Process, cmsysProcess_SetWorkingDirectory(this->Process,
this->WorkingDirectory.c_str()); this->WorkingDirectory.c_str());
@ -270,7 +270,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
std::string ndc std::string ndc
= cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage", = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage",
fFile.c_str(), checkDir.c_str()); fFile.c_str(), checkDir.c_str());
if ( ndc.size() ) if (!ndc.empty())
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
<< " so skip coverage of " << file << std::endl); << " so skip coverage of " << file << std::endl);
@ -281,7 +281,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
// Get the relative path to the file an apply it to the opposite directory. // Get the relative path to the file an apply it to the opposite directory.
// If it is the same as fileDir, then ignore, otherwise check. // If it is the same as fileDir, then ignore, otherwise check.
std::string relPath; std::string relPath;
if(checkDir.size() ) if(!checkDir.empty())
{ {
relPath = cmSystemTools::RelativePath(checkDir.c_str(), relPath = cmSystemTools::RelativePath(checkDir.c_str(),
fFile.c_str()); fFile.c_str());
@ -309,7 +309,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage", ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage",
fFile.c_str(), checkDir.c_str()); fFile.c_str(), checkDir.c_str());
if ( ndc.size() ) if (!ndc.empty())
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
<< " so skip coverage of: " << file << std::endl); << " so skip coverage of: " << file << std::endl);
@ -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);
@ -1037,7 +1037,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
this->FindGCovFiles(files); this->FindGCovFiles(files);
std::vector<std::string>::iterator it; std::vector<std::string>::iterator it;
if ( files.size() == 0 ) if (files.empty())
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find any GCov coverage files." " Cannot find any GCov coverage files."
@ -1131,7 +1131,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]" cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]"
<< std::endl); << std::endl);
if ( line->size() == 0 ) if (line->empty())
{ {
// Ignore empty line; probably style 2 // Ignore empty line; probably style 2
} }
@ -1311,7 +1311,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
//TODO: Handle gcov 3.0 non-coverage lines //TODO: Handle gcov 3.0 non-coverage lines
// Skip empty lines // Skip empty lines
if ( !nl.size() ) if (nl.empty())
{ {
continue; continue;
} }
@ -1456,7 +1456,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
this->FindLCovFiles(files); this->FindLCovFiles(files);
std::vector<std::string>::iterator it; std::vector<std::string>::iterator it;
if ( files.size() == 0 ) if (files.empty())
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find any LCov coverage files." " Cannot find any LCov coverage files."
@ -1538,7 +1538,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
std::string sourceFile; std::string sourceFile;
std::string lcovFile; std::string lcovFile;
if ( line->size() == 0 ) if (line->empty())
{ {
// Ignore empty line // Ignore empty line
} }
@ -1627,7 +1627,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
cnt ++; cnt ++;
// Skip empty lines // Skip empty lines
if ( !nl.size() ) if (nl.empty())
{ {
continue; continue;
} }
@ -1759,7 +1759,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
gl.FindFiles(daGlob); gl.FindFiles(daGlob);
std::vector<std::string> files = gl.GetFiles(); std::vector<std::string> files = gl.GetFiles();
if ( files.size() == 0 ) if (files.empty())
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find any Python Trace.py coverage files." " Cannot find any Python Trace.py coverage files."
@ -1813,7 +1813,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
cnt ++; cnt ++;
// Skip empty lines // Skip empty lines
if ( !nl.size() ) if (nl.empty())
{ {
continue; continue;
} }
@ -2076,7 +2076,7 @@ int cmCTestCoverageHandler::RunBullseyeCommand(
std::string& outputFile) std::string& outputFile)
{ {
std::string program = cmSystemTools::FindProgram(cmd); std::string program = cmSystemTools::FindProgram(cmd);
if(program.size() == 0) if(program.empty())
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find :" << cmd << "\n"); cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find :" << cmd << "\n");
return 0; return 0;
@ -2183,7 +2183,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
while(cmSystemTools::GetLineFromStream(fin, stdline)) while(cmSystemTools::GetLineFromStream(fin, stdline))
{ {
// if we have a line of output from stdout // if we have a line of output from stdout
if(stdline.size()) if(!stdline.empty())
{ {
// parse the comma separated output // parse the comma separated output
this->ParseBullsEyeCovsrcLine(stdline, this->ParseBullsEyeCovsrcLine(stdline,
@ -2596,7 +2596,7 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles(
} }
} }
if(extraMatches.size()) if(!extraMatches.empty())
{ {
for(cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i = for(cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i =
cont->TotalCoverage.begin(); i != cont->TotalCoverage.end(); ++i) cont->TotalCoverage.begin(); i != cont->TotalCoverage.end(); ++i)

View File

@ -720,7 +720,7 @@ bool cmCTestLaunch::Match(std::string const& line,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const
{ {
if(this->OptionFilterPrefix.size() && cmSystemTools::StringStartsWith( if(!this->OptionFilterPrefix.empty() && cmSystemTools::StringStartsWith(
line.c_str(), this->OptionFilterPrefix.c_str())) line.c_str(), this->OptionFilterPrefix.c_str()))
{ {
return true; return true;

View File

@ -223,7 +223,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
this->MemoryTesterEnvironmentVariable; this->MemoryTesterEnvironmentVariable;
for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ ) for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ )
{ {
if(memTesterEnvironmentVariable.size()) if(!memTesterEnvironmentVariable.empty())
{ {
// If we are using env to pass options, append all the options to // If we are using env to pass options, append all the options to
// this string with space separation. // this string with space separation.
@ -241,7 +241,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
} }
// if this is an env option type, then add the env string as a single // if this is an env option type, then add the env string as a single
// argument. // argument.
if(memTesterEnvironmentVariable.size()) if(!memTesterEnvironmentVariable.empty())
{ {
std::string::size_type pos = memTesterEnvironmentVariable.find("??"); std::string::size_type pos = memTesterEnvironmentVariable.find("??");
if (pos != std::string::npos) if (pos != std::string::npos)
@ -592,7 +592,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
} }
} }
if(this->MemoryTester.size() == 0 ) if(this->MemoryTester.empty())
{ {
cmCTestLog(this->CTest, WARNING, cmCTestLog(this->CTest, WARNING,
"Memory checker (MemoryCheckCommand) " "Memory checker (MemoryCheckCommand) "
@ -848,10 +848,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
{ {
resultFound = sanitizerWarning.match(1); resultFound = sanitizerWarning.match(1);
} }
if(resultFound.size()) if(!resultFound.empty())
{ {
std::vector<int>::size_type idx = this->FindOrAddWarning(resultFound); std::vector<int>::size_type idx = this->FindOrAddWarning(resultFound);
if(result.size() == 0 || idx > result.size()-1) if(result.empty() || idx > result.size()-1)
{ {
result.push_back(1); result.push_back(1);
} }
@ -1197,7 +1197,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res,
<< res.Name << std::endl); << res.Name << std::endl);
std::vector<std::string> files; std::vector<std::string> files;
this->TestOutputFileNames(test, files); this->TestOutputFileNames(test, files);
if ( files.size() == 0 ) if (files.empty())
{ {
return; return;
} }
@ -1280,7 +1280,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(int test,
ofile += ".*"; ofile += ".*";
cmsys::Glob g; cmsys::Glob g;
g.FindFiles(ofile); g.FindFiles(ofile);
if(g.GetFiles().size() == 0) if(g.GetFiles().empty())
{ {
std::string log = "Cannot find memory tester output file: " std::string log = "Cannot find memory tester output file: "
+ ofile; + ofile;

View File

@ -92,7 +92,7 @@ void cmCTestMultiProcessHandler::RunTests()
} }
this->TestHandler->SetMaxIndex(this->FindMaxIndex()); this->TestHandler->SetMaxIndex(this->FindMaxIndex());
this->StartNextTests(); this->StartNextTests();
while(this->Tests.size() != 0) while(!this->Tests.empty())
{ {
if(this->StopTimePassed) if(this->StopTimePassed)
{ {
@ -265,7 +265,7 @@ void cmCTestMultiProcessHandler::StartNextTests()
bool cmCTestMultiProcessHandler::CheckOutput() bool cmCTestMultiProcessHandler::CheckOutput()
{ {
// no more output we are done // no more output we are done
if(this->RunningTests.size() == 0) if(this->RunningTests.empty())
{ {
return false; return false;
} }
@ -636,7 +636,7 @@ void cmCTestMultiProcessHandler::PrintTestList()
testRun.SetTestProperties(&p); testRun.SetTestProperties(&p);
testRun.ComputeArguments(); //logs the command in verbose mode testRun.ComputeArguments(); //logs the command in verbose mode
if(p.Labels.size()) //print the labels if(!p.Labels.empty()) //print the labels
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:"); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:");
} }
@ -645,7 +645,7 @@ void cmCTestMultiProcessHandler::PrintTestList()
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label);
} }
if(p.Labels.size()) //print the labels if(!p.Labels.empty()) //print the labels
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
} }
@ -683,7 +683,7 @@ void cmCTestMultiProcessHandler::PrintLabels()
allLabels.insert(p.Labels.begin(), p.Labels.end()); allLabels.insert(p.Labels.begin(), p.Labels.end());
} }
if(allLabels.size()) if(!allLabels.empty())
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl); cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl);
} }

View File

@ -324,7 +324,7 @@ private:
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions) void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions)
{ {
if(P4Options.size() == 0) if(P4Options.empty())
{ {
const char* p4 = this->CommandLineTool.c_str(); const char* p4 = this->CommandLineTool.c_str();
P4Options.push_back(p4); P4Options.push_back(p4);
@ -447,7 +447,7 @@ void cmCTestP4::LoadRevisions()
ChangeLists.clear(); ChangeLists.clear();
this->RunChild(&p4_changes[0], &out, &err); this->RunChild(&p4_changes[0], &out, &err);
if(ChangeLists.size() == 0) if(ChangeLists.empty())
return; return;
//p4 describe -s ...@1111111,2222222 //p4 describe -s ...@1111111,2222222

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();
@ -318,7 +318,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
*this->TestHandler->LogFile *this->TestHandler->LogFile
<< "----------------------------------------------------------" << "----------------------------------------------------------"
<< std::endl; << std::endl;
if(this->TestResult.Reason.size()) if(!this->TestResult.Reason.empty())
{ {
*this->TestHandler->LogFile << reasonType << ":\n" *this->TestHandler->LogFile << reasonType << ":\n"
<< this->TestResult.Reason << "\n"; << this->TestResult.Reason << "\n";
@ -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

@ -415,7 +415,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
this->UpdateElapsedTime(); this->UpdateElapsedTime();
// add the script arg if defined // add the script arg if defined
if (script_arg.size()) if (!script_arg.empty())
{ {
this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str()); this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
} }

View File

@ -61,7 +61,7 @@ private:
std::string GetCurrentValue() std::string GetCurrentValue()
{ {
std::string val; std::string val;
if(this->CurrentValue.size()) if(!this->CurrentValue.empty())
{ {
val.assign(&this->CurrentValue[0], this->CurrentValue.size()); val.assign(&this->CurrentValue[0], this->CurrentValue.size());
} }
@ -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()) << "]"
@ -301,7 +301,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
<< error_buffer << std::endl << error_buffer << std::endl
<< " Curl output was: "; << " Curl output was: ";
// avoid dereference of empty vector // avoid dereference of empty vector
if(chunk.size()) if(!chunk.empty())
{ {
*this->LogFile << cmCTestLogWrite(&*chunk.begin(), chunk.size()); *this->LogFile << cmCTestLogWrite(&*chunk.begin(), chunk.size());
cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: [" cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
@ -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()) << "]"
@ -605,7 +605,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
<< " Error message was: " << error_buffer << " Error message was: " << error_buffer
<< std::endl; << std::endl;
// avoid deref of begin for zero size array // avoid deref of begin for zero size array
if(chunk.size()) if(!chunk.empty())
{ {
*this->LogFile << " Curl output was: " *this->LogFile << " Curl output was: "
<< 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());
@ -766,7 +766,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
<< std::endl << std::endl
<< " Error message was: " << error_buffer << " Error message was: " << error_buffer
<< std::endl; << std::endl;
if(chunk.size()) if(!chunk.empty())
{ {
*this->LogFile *this->LogFile
<< " Curl output was: " << " Curl output was: "
@ -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())
@ -812,8 +812,8 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(
const std::string& remoteprefix, const std::string& remoteprefix,
const std::string& url) const std::string& url)
{ {
if ( !scp_command.size() || !localprefix.size() || if ( scp_command.empty() || localprefix.empty() ||
!files.size() || !remoteprefix.size() || !url.size() ) files.empty() || remoteprefix.empty() || url.empty() )
{ {
return 0; return 0;
} }
@ -912,8 +912,8 @@ bool cmCTestSubmitHandler::SubmitUsingCP(
const std::string& remoteprefix, const std::string& remoteprefix,
const std::string& destination) const std::string& destination)
{ {
if ( !localprefix.size() || if ( localprefix.empty() ||
!files.size() || !remoteprefix.size() || !destination.size() ) files.empty() || remoteprefix.empty() || destination.empty() )
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Missing arguments for submit via cp:\n" "Missing arguments for submit via cp:\n"
@ -1060,14 +1060,14 @@ int cmCTestSubmitHandler::ProcessHandler()
{ {
std::string iscdash = this->CTest->GetCTestConfiguration("IsCDash"); std::string iscdash = this->CTest->GetCTestConfiguration("IsCDash");
// cdash does not need to trigger so just return true // cdash does not need to trigger so just return true
if(iscdash.size()) if(!iscdash.empty())
{ {
this->CDash = true; this->CDash = true;
} }
const std::string &buildDirectory const std::string &buildDirectory
= this->CTest->GetCTestConfiguration("BuildDirectory"); = this->CTest->GetCTestConfiguration("BuildDirectory");
if ( buildDirectory.size() == 0 ) if (buildDirectory.empty())
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot find BuildDirectory key in the DartConfiguration.tcl" "Cannot find BuildDirectory key in the DartConfiguration.tcl"
@ -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

@ -564,7 +564,7 @@ int cmCTestTestHandler::ProcessHandler()
} }
else else
{ {
if (this->HandlerVerbose && passed.size() && if (this->HandlerVerbose && !passed.empty() &&
(this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag)) (this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag))
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
@ -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;
} }
@ -596,7 +596,7 @@ int cmCTestTestHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = "
<< realBuf << "\n" ); << realBuf << "\n" );
if (failed.size()) if (!failed.empty())
{ {
cmGeneratedFileStream ofs; cmGeneratedFileStream ofs;
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
@ -668,7 +668,7 @@ void cmCTestTestHandler::PrintLabelSummary()
for(; it != this->TestList.end(); ++it) for(; it != this->TestList.end(); ++it)
{ {
cmCTestTestProperties& p = *it; cmCTestTestProperties& p = *it;
if(p.Labels.size() != 0) if(!p.Labels.empty())
{ {
for(std::vector<std::string>::iterator l = p.Labels.begin(); for(std::vector<std::string>::iterator l = p.Labels.begin();
l != p.Labels.end(); ++l) l != p.Labels.end(); ++l)
@ -688,7 +688,7 @@ void cmCTestTestHandler::PrintLabelSummary()
{ {
cmCTestTestResult &result = *ri; cmCTestTestResult &result = *ri;
cmCTestTestProperties& p = *result.Properties; cmCTestTestProperties& p = *result.Properties;
if(p.Labels.size() != 0) if(!p.Labels.empty())
{ {
for(std::vector<std::string>::iterator l = p.Labels.begin(); for(std::vector<std::string>::iterator l = p.Labels.begin();
l != p.Labels.end(); ++l) l != p.Labels.end(); ++l)
@ -698,7 +698,7 @@ void cmCTestTestHandler::PrintLabelSummary()
} }
} }
// now print times // now print times
if(labels.size()) if(!labels.empty())
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:");
} }
@ -717,7 +717,7 @@ void cmCTestTestHandler::PrintLabelSummary()
<< buf << "\n"; << buf << "\n";
} }
} }
if(labels.size()) if(!labels.empty())
{ {
if(this->LogFile) if(this->LogFile)
{ {
@ -738,7 +738,7 @@ void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it)
} }
// if there are no labels and we are filtering by labels // if there are no labels and we are filtering by labels
// then exclude the test as it does not have the label // then exclude the test as it does not have the label
if(it.Labels.size() == 0 ) if(it.Labels.empty())
{ {
it.IsInBasedOnREOptions = false; it.IsInBasedOnREOptions = false;
return; return;
@ -772,7 +772,7 @@ void cmCTestTestHandler::CheckLabelFilterExclude(cmCTestTestProperties& it)
} }
// if there are no labels and we are excluding by labels // if there are no labels and we are excluding by labels
// then do nothing as a no label can not be a match // then do nothing as a no label can not be a match
if(it.Labels.size() == 0 ) if(it.Labels.empty())
{ {
return; return;
} }
@ -850,7 +850,7 @@ void cmCTestTestHandler::ComputeTestList()
if (this->UseUnion) if (this->UseUnion)
{ {
// if it is not in the list and not in the regexp then skip // if it is not in the list and not in the regexp then skip
if ((this->TestsToRun.size() && if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
== this->TestsToRun.end()) && !it->IsInBasedOnREOptions) == this->TestsToRun.end()) && !it->IsInBasedOnREOptions)
{ {
@ -860,7 +860,7 @@ void cmCTestTestHandler::ComputeTestList()
else else
{ {
// is this test in the list of tests to run? If not then skip it // is this test in the list of tests to run? If not then skip it
if ((this->TestsToRun.size() && if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(), std::find(this->TestsToRun.begin(),
this->TestsToRun.end(), inREcnt) this->TestsToRun.end(), inREcnt)
== this->TestsToRun.end()) || !it->IsInBasedOnREOptions) == this->TestsToRun.end()) || !it->IsInBasedOnREOptions)
@ -891,7 +891,7 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed()
cnt ++; cnt ++;
// if this test is not in our list of tests to run, then skip it. // if this test is not in our list of tests to run, then skip it.
if ((this->TestsToRun.size() && if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
== this->TestsToRun.end())) == this->TestsToRun.end()))
{ {
@ -1094,7 +1094,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed,
p.Timeout = this->CTest->GetGlobalTimeout(); p.Timeout = this->CTest->GetGlobalTimeout();
} }
if(p.Depends.size()) if(!p.Depends.empty())
{ {
for(std::vector<std::string>::iterator i = p.Depends.begin(); for(std::vector<std::string>::iterator i = p.Depends.begin();
i != p.Depends.end(); ++i) i != p.Depends.end(); ++i)
@ -1192,7 +1192,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
<< "name=\"Execution Time\"><Value>" << "name=\"Execution Time\"><Value>"
<< result->ExecutionTime << result->ExecutionTime
<< "</Value></NamedMeasurement>\n"; << "</Value></NamedMeasurement>\n";
if(result->Reason.size()) if(!result->Reason.empty())
{ {
const char* reasonType = "Pass Reason"; const char* reasonType = "Pass Reason";
if(result->Status != cmCTestTestHandler::COMPLETED && if(result->Status != cmCTestTestHandler::COMPLETED &&
@ -1376,7 +1376,7 @@ void cmCTestTestHandler
{ {
std::string tempPath; std::string tempPath;
if (filepath.size() && if (!filepath.empty() &&
filepath[filepath.size()-1] != '/') filepath[filepath.size()-1] != '/')
{ {
filepath += "/"; filepath += "/";
@ -1385,7 +1385,7 @@ void cmCTestTestHandler
attempted.push_back(tempPath); attempted.push_back(tempPath);
attemptedConfigs.push_back(""); attemptedConfigs.push_back("");
if(ctest->GetConfigType().size()) if(!ctest->GetConfigType().empty())
{ {
tempPath = filepath; tempPath = filepath;
tempPath += ctest->GetConfigType(); tempPath += ctest->GetConfigType();
@ -1463,7 +1463,7 @@ std::string cmCTestTestHandler
// even if a fullpath was specified also try it relative to the current // even if a fullpath was specified also try it relative to the current
// directory // directory
if (filepath.size() && filepath[0] == '/') if (!filepath.empty() && filepath[0] == '/')
{ {
std::string localfilepath = filepath.substr(1,filepath.size()-1); std::string localfilepath = filepath.substr(1,filepath.size()-1);
cmCTestTestHandler::AddConfigurations(ctest, attempted, cmCTestTestHandler::AddConfigurations(ctest, attempted,
@ -1474,7 +1474,7 @@ std::string cmCTestTestHandler
// if extraPaths are provided and we were not passed a full path, try them, // if extraPaths are provided and we were not passed a full path, try them,
// try any extra paths // try any extra paths
if (filepath.size() == 0) if (filepath.empty())
{ {
for (unsigned int i = 0; i < extraPaths.size(); ++i) for (unsigned int i = 0; i < extraPaths.size(); ++i)
{ {
@ -1494,7 +1494,7 @@ std::string cmCTestTestHandler
// now look in the paths we specified above // now look in the paths we specified above
for(unsigned int ai=0; for(unsigned int ai=0;
ai < attempted.size() && fullPath.size() == 0; ++ai) ai < attempted.size() && fullPath.empty(); ++ai)
{ {
// first check without exe extension // first check without exe extension
if(cmSystemTools::FileExists(attempted[ai].c_str()) if(cmSystemTools::FileExists(attempted[ai].c_str())
@ -1524,7 +1524,7 @@ std::string cmCTestTestHandler
// if everything else failed, check the users path, but only if a full path // if everything else failed, check the users path, but only if a full path
// wasn't specified // wasn't specified
if (fullPath.size() == 0 && filepath.size() == 0) if (fullPath.empty() && filepath.empty())
{ {
std::string path = cmSystemTools::FindProgram(filename.c_str()); std::string path = cmSystemTools::FindProgram(filename.c_str());
if (path != "") if (path != "")
@ -1533,7 +1533,7 @@ std::string cmCTestTestHandler
return path; return path;
} }
} }
if(fullPath.size() == 0) if(fullPath.empty())
{ {
cmCTestLog(ctest, HANDLER_OUTPUT, cmCTestLog(ctest, HANDLER_OUTPUT,
"Could not find executable " << testCommand << "\n" "Could not find executable " << testCommand << "\n"

View File

@ -94,7 +94,7 @@ cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale()
{ {
// restore the value of LC_MESSAGES after running the version control // restore the value of LC_MESSAGES after running the version control
// commands // commands
if(saveLCMessages.size()) if(!saveLCMessages.empty())
{ {
std::string put = "LC_MESSAGES="; std::string put = "LC_MESSAGES=";
put += saveLCMessages; put += saveLCMessages;

View File

@ -163,7 +163,7 @@ bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
} }
// if we do not have a routine yet, then it should be // if we do not have a routine yet, then it should be
// the first argument in the vector // the first argument in the vector
if(routine.size() == 0) if(routine.empty())
{ {
routine = separateLine[0]; routine = separateLine[0];
// Find the full path to the file // Find the full path to the file
@ -191,7 +191,7 @@ bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
// move to next line. We should have already warned // move to next line. We should have already warned
// after the call to FindMumpsFile that we did not find // after the call to FindMumpsFile that we did not find
// it, so don't report again to cut down on output // it, so don't report again to cut down on output
if(filepath.size() == 0) if(filepath.empty())
{ {
continue; continue;
} }

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);
@ -147,7 +147,7 @@ public:
std::string glob = Coverage.SourceDir + "*/" + filename; std::string glob = Coverage.SourceDir + "*/" + filename;
gl.FindFiles(glob); gl.FindFiles(glob);
std::vector<std::string> const& files = gl.GetFiles(); std::vector<std::string> const& files = gl.GetFiles();
if(files.size() == 0) if(files.empty())
{ {
/* /*
* If that doesn't find any matching files * If that doesn't find any matching files

View File

@ -80,7 +80,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
// no need to search the file if we just did it // no need to search the file if we just did it
if(function == lastfunction && lastroutine == routine) if(function == lastfunction && lastroutine == routine)
{ {
if(lastpath.size()) if(!lastpath.empty())
{ {
this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber] this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber]
+= count; += count;

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

@ -39,7 +39,7 @@ void cmProcess::SetCommandArguments(std::vector<std::string> const& args)
bool cmProcess::StartProcess() bool cmProcess::StartProcess()
{ {
if(this->Command.size() == 0) if(this->Command.empty())
{ {
return false; return false;
} }
@ -56,7 +56,7 @@ bool cmProcess::StartProcess()
this->ProcessArgs.push_back(0); // null terminate the list this->ProcessArgs.push_back(0); // null terminate the list
this->Process = cmsysProcess_New(); this->Process = cmsysProcess_New();
cmsysProcess_SetCommand(this->Process, &*this->ProcessArgs.begin()); cmsysProcess_SetCommand(this->Process, &*this->ProcessArgs.begin());
if(this->WorkingDirectory.size()) if(!this->WorkingDirectory.empty())
{ {
cmsysProcess_SetWorkingDirectory(this->Process, cmsysProcess_SetWorkingDirectory(this->Process,
this->WorkingDirectory.c_str()); this->WorkingDirectory.c_str());

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

@ -37,7 +37,7 @@ bool cmAddSubDirectoryCommand::InitialPass
excludeFromAll = true; excludeFromAll = true;
continue; continue;
} }
else if (!binArg.size()) else if (binArg.empty())
{ {
binArg = *i; binArg = *i;
} }

View File

@ -61,7 +61,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass
std::string ext = file.substr(dotpos+1); std::string ext = file.substr(dotpos+1);
std::string base = file.substr(0, dotpos); std::string base = file.substr(0, dotpos);
// Process only source files // Process only source files
if( base.size() != 0 if(!base.empty()
&& std::find( this->Makefile->GetSourceExtensions().begin(), && std::find( this->Makefile->GetSourceExtensions().begin(),
this->Makefile->GetSourceExtensions().end(), ext ) this->Makefile->GetSourceExtensions().end(), ext )
!= this->Makefile->GetSourceExtensions().end() ) != this->Makefile->GetSourceExtensions().end() )

View File

@ -50,7 +50,7 @@ bool cmBuildNameCommand
{ {
buildname = ""; buildname = "";
cmSystemTools::RunSingleCommand("uname -a", &buildname); cmSystemTools::RunSingleCommand("uname -a", &buildname);
if(buildname.length()) if(!buildname.empty())
{ {
std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) "; std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) ";
cmsys::RegularExpression reg( RegExp.c_str() ); cmsys::RegularExpression reg( RegExp.c_str() );

View File

@ -212,7 +212,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
::curl_easy_setopt(curl, CURLOPT_INFILE, file); ::curl_easy_setopt(curl, CURLOPT_INFILE, file);
//fall through to append GET fields //fall through to append GET fields
case cmCTest::HTTP_GET: case cmCTest::HTTP_GET:
if(fields.size()) if(!fields.empty())
{ {
url += "?" + fields; url += "?" + fields;
} }
@ -580,7 +580,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
} }
tfin.close(); tfin.close();
} }
if (tag.size() == 0 || (0 != command) || this->Parts[PartStart]) if (tag.empty() || (0 != command) || this->Parts[PartStart])
{ {
cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString() cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString()
<< std::endl); << std::endl);
@ -772,7 +772,7 @@ bool cmCTest::UpdateCTestConfiguration()
fin.getline(buffer, 1023); fin.getline(buffer, 1023);
buffer[1023] = 0; buffer[1023] = 0;
std::string line = cmCTest::CleanString(buffer); std::string line = cmCTest::CleanString(buffer);
if(line.size() == 0) if(line.empty())
{ {
continue; continue;
} }
@ -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 += ";";
} }
@ -1080,7 +1080,7 @@ int cmCTest::ProcessTests()
if (this->Parts[PartNotes]) if (this->Parts[PartNotes])
{ {
this->UpdateCTestConfiguration(); this->UpdateCTestConfiguration();
if ( this->NotesFiles.size() ) if (!this->NotesFiles.empty())
{ {
this->GenerateNotesFile(this->NotesFiles.c_str()); this->GenerateNotesFile(this->NotesFiles.c_str());
} }
@ -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;
@ -1653,7 +1653,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles)
cmCTestLog(this, OUTPUT, "Create notes file" << std::endl); cmCTestLog(this, OUTPUT, "Create notes file" << std::endl);
files = cmSystemTools::SplitString(cfiles, ';'); files = cmSystemTools::SplitString(cfiles, ';');
if ( files.size() == 0 ) if (files.empty())
{ {
return 1; return 1;
} }
@ -1744,7 +1744,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles)
cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl); cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl);
files = cmSystemTools::SplitString(cfiles, ';'); files = cmSystemTools::SplitString(cfiles, ';');
if ( files.size() == 0 ) if (files.empty())
{ {
return 1; return 1;
} }
@ -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());
} }
@ -3136,7 +3136,7 @@ double cmCTest::GetRemainingTimeAllowed()
void cmCTest::OutputTestErrors(std::vector<char> const &process_output) void cmCTest::OutputTestErrors(std::vector<char> const &process_output)
{ {
std::string test_outputs("\n*** Test Failed:\n"); std::string test_outputs("\n*** Test Failed:\n");
if(process_output.size()) if(!process_output.empty())
{ {
test_outputs.append(&*process_output.begin(), process_output.size()); test_outputs.append(&*process_output.begin(), process_output.size());
} }

View File

@ -609,7 +609,7 @@ void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key)
void cmCacheManager::OutputValue(std::ostream& fout, std::string const& value) void cmCacheManager::OutputValue(std::ostream& fout, std::string const& value)
{ {
// if value has trailing space or tab, enclose it in single quotes // if value has trailing space or tab, enclose it in single quotes
if (value.size() && if (!value.empty() &&
(value[value.size() - 1] == ' ' || (value[value.size() - 1] == ' ' ||
value[value.size() - 1] == '\t')) value[value.size() - 1] == '\t'))
{ {

View File

@ -155,7 +155,7 @@ public:
*/ */
const char* GetError() const char* GetError()
{ {
if(this->Error.length() == 0) if(this->Error.empty())
{ {
this->Error = this->GetName(); this->Error = this->GetName();
this->Error += " unknown error."; this->Error += " unknown error.";

View File

@ -201,13 +201,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
else else
{ {
// only valid for srcfile signatures // only valid for srcfile signatures
if (compileDefs.size()) if (!compileDefs.empty())
{ {
this->Makefile->IssueMessage(cmake::FATAL_ERROR, this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE"); "COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE");
return -1; return -1;
} }
if (copyFile.size()) if (!copyFile.empty())
{ {
this->Makefile->IssueMessage(cmake::FATAL_ERROR, this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"COPY_FILE specified on a srcdir type TRY_COMPILE"); "COPY_FILE specified on a srcdir type TRY_COMPILE");
@ -371,7 +371,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n"); fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n");
fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n"); fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n");
// handle any compile flags we need to pass on // handle any compile flags we need to pass on
if (compileDefs.size()) if (!compileDefs.empty())
{ {
fprintf(fout, "add_definitions( "); fprintf(fout, "add_definitions( ");
for (size_t i = 0; i < compileDefs.size(); ++i) for (size_t i = 0; i < compileDefs.size(); ++i)
@ -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());
} }
@ -547,7 +547,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::string copyFileErrorMessage; std::string copyFileErrorMessage;
this->FindOutputFile(targetName); this->FindOutputFile(targetName);
if ((res==0) && (copyFile.size())) if ((res==0) && !copyFile.empty())
{ {
if(this->OutputFile.empty() || if(this->OutputFile.empty() ||
!cmSystemTools::CopyFileAlways(this->OutputFile, !cmSystemTools::CopyFileAlways(this->OutputFile,

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);
@ -145,12 +145,12 @@ bool cmCreateTestSourceList
" },\n"; " },\n";
numTests++; numTests++;
} }
if(extraInclude.size()) if(!extraInclude.empty())
{ {
this->Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES", this->Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES",
extraInclude.c_str()); extraInclude.c_str());
} }
if(function.size()) if(!function.empty())
{ {
this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION", this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION",
function.c_str()); function.c_str());

View File

@ -285,7 +285,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmDependsC::ReadCacheFile() void cmDependsC::ReadCacheFile()
{ {
if(this->CacheFileName.size() == 0) if(this->CacheFileName.empty())
{ {
return; return;
} }
@ -374,7 +374,7 @@ void cmDependsC::ReadCacheFile()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmDependsC::WriteCacheFile() const void cmDependsC::WriteCacheFile() const
{ {
if(this->CacheFileName.size() == 0) if(this->CacheFileName.empty())
{ {
return; return;
} }

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 )
@ -251,7 +251,7 @@ void cmDependsJavaParserHelper::EndClass()
void cmDependsJavaParserHelper::PrintClasses() void cmDependsJavaParserHelper::PrintClasses()
{ {
if ( this->ClassStack.size() == 0 ) if (this->ClassStack.empty())
{ {
std::cerr << "Error when parsing. No classes on class stack" << std::endl; std::cerr << "Error when parsing. No classes on class stack" << std::endl;
abort(); abort();
@ -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

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

View File

@ -46,7 +46,7 @@ void cmDocumentationFormatter::PrintFormatted(std::ostream& os,
preformatted.append(1, '\n'); preformatted.append(1, '\n');
} }
} }
if(preformatted.length()) if(!preformatted.empty())
{ {
this->PrintPreformatted(os, preformatted.c_str()); this->PrintPreformatted(os, preformatted.c_str());
} }
@ -62,7 +62,7 @@ void cmDocumentationFormatter::PrintFormatted(std::ostream& os,
++ptr; ++ptr;
paragraph.append(1, '\n'); paragraph.append(1, '\n');
} }
if(paragraph.length()) if(!paragraph.empty())
{ {
this->PrintParagraph(os, paragraph.c_str()); this->PrintParagraph(os, paragraph.c_str());
} }
@ -201,7 +201,7 @@ void cmDocumentationFormatter
for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin(); for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
op != entries.end(); ++op) op != entries.end(); ++op)
{ {
if(op->Name.size()) if(!op->Name.empty())
{ {
os << " " << op->Name; os << " " << op->Name;
this->TextIndent = " "; this->TextIndent = " ";

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;
@ -84,7 +84,7 @@ bool cmExecProgramCommand
} }
std::string command; std::string command;
if(arguments.size()) if(!arguments.empty())
{ {
command = cmSystemTools::ConvertToRunCommandPath(args[0].c_str()); command = cmSystemTools::ConvertToRunCommandPath(args[0].c_str());
command += " "; command += " ";
@ -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

@ -324,12 +324,12 @@ bool cmExecuteProcessCommand
error_strip_trailing_whitespace); error_strip_trailing_whitespace);
// Store the output obtained. // Store the output obtained.
if(!output_variable.empty() && tempOutput.size()) if(!output_variable.empty() && !tempOutput.empty())
{ {
this->Makefile->AddDefinition(output_variable, this->Makefile->AddDefinition(output_variable,
&*tempOutput.begin()); &*tempOutput.begin());
} }
if(!merge_output && !error_variable.empty() && tempError.size()) if(!merge_output && !error_variable.empty() && !tempError.empty())
{ {
this->Makefile->AddDefinition(error_variable, this->Makefile->AddDefinition(error_variable,
&*tempError.begin()); &*tempError.begin());

View File

@ -1180,7 +1180,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());
} }
@ -745,7 +745,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// A non-string character has been found. Check if the current // A non-string character has been found. Check if the current
// string matches the requirements. We require that the length // string matches the requirements. We require that the length
// be at least one no matter what the user specified. // be at least one no matter what the user specified.
if(s.length() >= minlen && s.length() >= 1 && if(s.length() >= minlen && !s.empty() &&
(!have_regex || regex.find(s.c_str()))) (!have_regex || regex.find(s.c_str())))
{ {
output_size += static_cast<int>(s.size()) + 1; output_size += static_cast<int>(s.size()) + 1;
@ -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);
@ -2992,7 +2992,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
msg = "returning early; file already exists with expected "; msg = "returning early; file already exists with expected ";
msg += hashMatchMSG; msg += hashMatchMSG;
msg += "\""; msg += "\"";
if(statusVar.size()) if(!statusVar.empty())
{ {
std::ostringstream result; std::ostringstream result;
result << (int)0 << ";\"" << msg; result << (int)0 << ";\"" << msg;
@ -3085,7 +3085,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
check_curl_result(res, "DOWNLOAD cannot set follow-redirect option: "); check_curl_result(res, "DOWNLOAD cannot set follow-redirect option: ");
if(verboseLog.size()) if(!verboseLog.empty())
{ {
res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
check_curl_result(res, "DOWNLOAD cannot set verbose: "); check_curl_result(res, "DOWNLOAD cannot set verbose: ");
@ -3131,7 +3131,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
g_curl.release(); g_curl.release();
::curl_easy_cleanup(curl); ::curl_easy_cleanup(curl);
if(statusVar.size()) if(!statusVar.empty())
{ {
std::ostringstream result; std::ostringstream result;
result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\""; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
@ -3151,7 +3151,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
if (hash.get()) if (hash.get())
{ {
std::string actualHash = hash->HashFile(file); std::string actualHash = hash->HashFile(file);
if (actualHash.size() == 0) if (actualHash.empty())
{ {
this->SetError("DOWNLOAD cannot compute hash on downloaded file"); this->SetError("DOWNLOAD cannot compute hash on downloaded file");
return false; return false;
@ -3172,14 +3172,14 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
} }
} }
if(chunkDebug.size()) if(!chunkDebug.empty())
{ {
chunkDebug.push_back(0); chunkDebug.push_back(0);
if(CURLE_OPERATION_TIMEOUTED == res) if(CURLE_OPERATION_TIMEOUTED == res)
{ {
std::string output = &*chunkDebug.begin(); std::string output = &*chunkDebug.begin();
if(verboseLog.size()) if(!verboseLog.empty())
{ {
this->Makefile->AddDefinition(verboseLog, this->Makefile->AddDefinition(verboseLog,
&*chunkDebug.begin()); &*chunkDebug.begin());
@ -3335,7 +3335,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
check_curl_result(res, "UPLOAD cannot set follow-redirect option: "); check_curl_result(res, "UPLOAD cannot set follow-redirect option: ");
if(logVar.size()) if(!logVar.empty())
{ {
res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
check_curl_result(res, "UPLOAD cannot set verbose: "); check_curl_result(res, "UPLOAD cannot set verbose: ");
@ -3390,7 +3390,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
g_curl.release(); g_curl.release();
::curl_easy_cleanup(curl); ::curl_easy_cleanup(curl);
if(statusVar.size()) if(!statusVar.empty())
{ {
std::ostringstream result; std::ostringstream result;
result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\""; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
@ -3403,11 +3403,11 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
fclose(fin); fclose(fin);
fin = NULL; fin = NULL;
if(logVar.size()) if(!logVar.empty())
{ {
std::string log; std::string log;
if(chunkResponse.size()) if(!chunkResponse.empty())
{ {
chunkResponse.push_back(0); chunkResponse.push_back(0);
log += "Response:\n"; log += "Response:\n";
@ -3415,7 +3415,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
log += "\n"; log += "\n";
} }
if(chunkDebug.size()) if(!chunkDebug.empty())
{ {
chunkDebug.push_back(0); chunkDebug.push_back(0);
log += "Debug:\n"; log += "Debug:\n";

View File

@ -152,10 +152,10 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
} }
} }
if(this->VariableDocumentation.size() == 0) if(this->VariableDocumentation.empty())
{ {
this->VariableDocumentation = "Where can "; this->VariableDocumentation = "Where can ";
if(this->Names.size() == 0) if(this->Names.empty())
{ {
this->VariableDocumentation += "the (unknown) library be found"; this->VariableDocumentation += "the (unknown) library be found";
} }

View File

@ -622,7 +622,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
module += this->Name; module += this->Name;
module += ".cmake"; module += ".cmake";
std::string mfile = this->Makefile->GetModulesFile(module.c_str()); std::string mfile = this->Makefile->GetModulesFile(module.c_str());
if ( mfile.size() ) if (!mfile.empty())
{ {
// Load the module we found, and set "<name>_FIND_MODULE" to true // Load the module we found, and set "<name>_FIND_MODULE" to true
// while inside it. // while inside it.
@ -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

@ -48,7 +48,7 @@ bool cmFindPathCommand
} }
std::string result = this->FindHeader(); std::string result = this->FindHeader();
if(result.size() != 0) if(!result.empty())
{ {
this->Makefile->AddCacheDefinition this->Makefile->AddCacheDefinition
(this->VariableName, result.c_str(), (this->VariableName, result.c_str(),
@ -108,7 +108,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file,
fileName = file; fileName = file;
frameWorkName = ""; frameWorkName = "";
} }
if(frameWorkName.size()) if(!frameWorkName.empty())
{ {
std::string fpath = dir; std::string fpath = dir;
fpath += frameWorkName; fpath += frameWorkName;
@ -134,7 +134,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file,
cmsys::Glob globIt; cmsys::Glob globIt;
globIt.FindFiles(glob); globIt.FindFiles(glob);
std::vector<std::string> files = globIt.GetFiles(); std::vector<std::string> files = globIt.GetFiles();
if(files.size()) if(!files.empty())
{ {
std::string fheader = cmSystemTools::CollapseFullPath(files[0]); std::string fheader = cmSystemTools::CollapseFullPath(files[0]);
if(this->IncludeFileInPath) if(this->IncludeFileInPath)

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

@ -429,7 +429,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
{ {
const char *compilerId = const char *compilerId =
context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID");
if (parameters.size() == 0) if (parameters.empty())
{ {
return compilerId ? compilerId : ""; return compilerId ? compilerId : "";
} }
@ -534,7 +534,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
{ {
const char *compilerVersion = context->Makefile->GetSafeDefinition( const char *compilerVersion = context->Makefile->GetSafeDefinition(
"CMAKE_" + lang + "_COMPILER_VERSION"); "CMAKE_" + lang + "_COMPILER_VERSION");
if (parameters.size() == 0) if (parameters.empty())
{ {
return compilerVersion ? compilerVersion : ""; return compilerVersion ? compilerVersion : "";
} }
@ -616,7 +616,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
{ {
const char *platformId = const char *platformId =
context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME");
if (parameters.size() == 0) if (parameters.empty())
{ {
return platformId ? platformId : ""; return platformId ? platformId : "";
} }

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

@ -113,7 +113,7 @@ bool cmGetFilenameComponentCommand
if(args.size() == 4 && args[3] == "CACHE") if(args.size() == 4 && args[3] == "CACHE")
{ {
if(programArgs.size() && storeArgs.size()) if(!programArgs.empty() && !storeArgs.empty())
{ {
this->Makefile->AddCacheDefinition this->Makefile->AddCacheDefinition
(storeArgs, programArgs.c_str(), (storeArgs, programArgs.c_str(),
@ -127,7 +127,7 @@ bool cmGetFilenameComponentCommand
} }
else else
{ {
if(programArgs.size() && storeArgs.size()) if(!programArgs.empty() && !storeArgs.empty())
{ {
this->Makefile->AddDefinition(storeArgs, programArgs.c_str()); this->Makefile->AddDefinition(storeArgs, programArgs.c_str());
} }

View File

@ -174,7 +174,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
{ {
path = name; path = name;
} }
if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str())) if((path.empty() || !cmSystemTools::FileExists(path.c_str()))
&& (optional==false)) && (optional==false))
{ {
return; return;
@ -265,7 +265,7 @@ cmGlobalGenerator::IsExportedTargetsFile(const std::string &filename) const
// Find the make program for the generator, required for try compiles // Find the make program for the generator, required for try compiles
void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{ {
if(this->FindMakeProgramFile.size() == 0) if(this->FindMakeProgramFile.empty())
{ {
cmSystemTools::Error( cmSystemTools::Error(
"Generator implementation error, " "Generator implementation error, "
@ -276,7 +276,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{ {
std::string setMakeProgram = std::string setMakeProgram =
mf->GetModulesFile(this->FindMakeProgramFile.c_str()); mf->GetModulesFile(this->FindMakeProgramFile.c_str());
if(setMakeProgram.size()) if(!setMakeProgram.empty())
{ {
mf->ReadListFile(0, setMakeProgram.c_str()); mf->ReadListFile(0, setMakeProgram.c_str());
} }
@ -383,7 +383,7 @@ void
cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *mf, bool optional) cmMakefile *mf, bool optional)
{ {
if(languages.size() == 0) if(languages.empty())
{ {
cmSystemTools::Error("EnableLanguage must have a lang specified!"); cmSystemTools::Error("EnableLanguage must have a lang specified!");
cmSystemTools::SetFatalErrorOccured(); cmSystemTools::SetFatalErrorOccured();
@ -426,7 +426,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// If the configuration files path has been set, // If the configuration files path has been set,
// then we are in a try compile and need to copy the enable language // then we are in a try compile and need to copy the enable language
// files from the parent cmake bin dir, into the try compile bin dir // files from the parent cmake bin dir, into the try compile bin dir
if(this->ConfiguredFilesPath.size()) if(!this->ConfiguredFilesPath.empty())
{ {
rootBin = this->ConfiguredFilesPath; rootBin = this->ConfiguredFilesPath;
} }
@ -1632,7 +1632,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
static_cast<float>(this->LocalGenerators.size())); static_cast<float>(this->LocalGenerators.size()));
} }
if(notFoundMap.size()) if(!notFoundMap.empty())
{ {
std::string notFoundVars; std::string notFoundVars;
for(std::map<std::string, std::string>::const_iterator for(std::map<std::string, std::string>::const_iterator
@ -2314,7 +2314,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;
@ -2456,19 +2456,19 @@ void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf)
locations.push_back("c:/mingw/bin"); locations.push_back("c:/mingw/bin");
std::string tgcc = cmSystemTools::FindProgram("gcc", locations); std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
std::string gcc = "gcc.exe"; std::string gcc = "gcc.exe";
if(tgcc.size()) if(!tgcc.empty())
{ {
gcc = tgcc; gcc = tgcc;
} }
std::string tgxx = cmSystemTools::FindProgram("g++", locations); std::string tgxx = cmSystemTools::FindProgram("g++", locations);
std::string gxx = "g++.exe"; std::string gxx = "g++.exe";
if(tgxx.size()) if(!tgxx.empty())
{ {
gxx = tgxx; gxx = tgxx;
} }
std::string trc = cmSystemTools::FindProgram("windres", locations); std::string trc = cmSystemTools::FindProgram("windres", locations);
std::string rc = "windres.exe"; std::string rc = "windres.exe";
if(trc.size()) if(!trc.empty())
{ {
rc = trc; rc = trc;
} }

View File

@ -236,7 +236,7 @@ bool cmGlobalKdevelopGenerator
// make it relative to the project dir // make it relative to the project dir
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
// only put relative paths // only put relative paths
if (tmp.size() && tmp[0] != '/') if (!tmp.empty() && tmp[0] != '/')
{ {
fout << tmp.c_str() <<"\n"; fout << tmp.c_str() <<"\n";
} }

View File

@ -572,7 +572,7 @@ void cmGlobalUnixMakefileGenerator3
if (!targetName.empty()) if (!targetName.empty())
{ {
cmLocalUnixMakefileGenerator3 *lg; cmLocalUnixMakefileGenerator3 *lg;
if (this->LocalGenerators.size()) if (!this->LocalGenerators.empty())
{ {
lg = static_cast<cmLocalUnixMakefileGenerator3 *> lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[0]); (this->LocalGenerators[0]);
@ -597,7 +597,7 @@ void cmGlobalUnixMakefileGenerator3
tname = lg->Convert(tname,cmLocalGenerator::HOME_OUTPUT); tname = lg->Convert(tname,cmLocalGenerator::HOME_OUTPUT);
cmSystemTools::ConvertToOutputSlashes(tname); cmSystemTools::ConvertToOutputSlashes(tname);
makeCommand.push_back(tname); makeCommand.push_back(tname);
if (!this->LocalGenerators.size()) if (this->LocalGenerators.empty())
{ {
delete lg; delete lg;
} }

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

@ -116,7 +116,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
bool isTrue = conditionEvaluator.IsTrue( bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, messType); expandedArguments, errorString, messType);
if (errorString.size()) if (!errorString.empty())
{ {
std::string err = cmIfCommandError(&mf, expandedArguments); std::string err = cmIfCommandError(&mf, expandedArguments);
err += errorString; err += errorString;
@ -177,7 +177,7 @@ bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
{ {
// if the endif has arguments, then make sure // if the endif has arguments, then make sure
// they match the arguments of the matching if // they match the arguments of the matching if
if (lff.Arguments.size() == 0 || if (lff.Arguments.empty() ||
lff.Arguments == this->Args) lff.Arguments == this->Args)
{ {
return true; return true;
@ -204,7 +204,7 @@ bool cmIfCommand
bool isTrue = conditionEvaluator.IsTrue( bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, status); expandedArguments, errorString, status);
if (errorString.size()) if (!errorString.empty())
{ {
std::string err = cmIfCommandError(this->Makefile, expandedArguments); std::string err = cmIfCommandError(this->Makefile, expandedArguments);
err += errorString; err += errorString;

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");
@ -83,7 +83,7 @@ bool cmIncludeCommand
std::string module = fname; std::string module = fname;
module += ".cmake"; module += ".cmake";
std::string mfile = this->Makefile->GetModulesFile(module.c_str()); std::string mfile = this->Makefile->GetModulesFile(module.c_str());
if ( mfile.size() ) if (!mfile.empty())
{ {
fname = mfile.c_str(); fname = mfile.c_str();
} }
@ -137,7 +137,7 @@ bool cmIncludeCommand
noPolicyScope); noPolicyScope);
// add the location of the included file if a result variable was given // add the location of the included file if a result variable was given
if (resultVarName.size()) if (!resultVarName.empty())
{ {
this->Makefile->AddDefinition(resultVarName, this->Makefile->AddDefinition(resultVarName,
readit?fullFilePath.c_str():"NOTFOUND"); readit?fullFilePath.c_str():"NOTFOUND");

View File

@ -47,7 +47,7 @@ bool cmIncludeDirectoryCommand
system = true; system = true;
continue; continue;
} }
if(i->size() == 0) if(i->empty())
{ {
this->SetError("given empty-string as include directory."); this->SetError("given empty-string as include directory.");
return false; return false;

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

@ -523,7 +523,7 @@ cmInstallTargetGenerator
std::string installNameTool = std::string installNameTool =
this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL"); this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
if(!installNameTool.size()) if(installNameTool.empty())
{ {
return; return;
} }

View File

@ -98,7 +98,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
return false; return false;
} }
// if the size of the list // if the size of the list
if(listString.size() == 0) if(listString.empty())
{ {
return true; return true;
} }
@ -109,7 +109,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
for(std::vector<std::string>::iterator i = list.begin(); for(std::vector<std::string>::iterator i = list.begin();
i != list.end(); ++i) i != list.end(); ++i)
{ {
if(i->size() == 0) if(i->empty())
{ {
hasEmpty = true; hasEmpty = true;
break; break;
@ -257,7 +257,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
size_t cc; size_t cc;
for ( cc = 2; cc < args.size(); ++ cc ) for ( cc = 2; cc < args.size(); ++ cc )
{ {
if(listString.size()) if(!listString.empty())
{ {
listString += ";"; listString += ";";
} }
@ -328,7 +328,7 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
return false; return false;
} }
if ( varArgsExpanded.size() != 0 ) if (!varArgsExpanded.empty())
{ {
size_t nitem = varArgsExpanded.size(); size_t nitem = varArgsExpanded.size();
if ( item < 0 ) if ( item < 0 )
@ -340,7 +340,7 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
std::ostringstream str; std::ostringstream str;
str << "index: " << item << " out of range (-" str << "index: " << item << " out of range (-"
<< varArgsExpanded.size() << ", " << varArgsExpanded.size() << ", "
<< (varArgsExpanded.size() == 0?0:(varArgsExpanded.size()-1)) << ")"; << (varArgsExpanded.empty() ? 0 : (varArgsExpanded.size() - 1)) << ")";
this->SetError(str.str()); this->SetError(str.str());
return false; return false;
} }

View File

@ -157,7 +157,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args)
} }
} }
} }
if(line.length()) if(!line.empty())
{ {
// Partial last line. // Partial last line.
this->CheckLine(line.c_str()); this->CheckLine(line.c_str());
@ -181,7 +181,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// This was requested. Set this variable locally with the given // This was requested. Set this variable locally with the given
// prefix. // prefix.
var = this->Prefix + var; var = this->Prefix + var;
if(value.length()) if(!value.empty())
{ {
this->Makefile->AddDefinition(var, value.c_str()); this->Makefile->AddDefinition(var, value.c_str());
} }

View File

@ -335,7 +335,7 @@ void cmLocalGenerator::GenerateTestFiles()
{ {
(*gi)->Generate(fout, config, configurationTypes); (*gi)->Generate(fout, config, configurationTypes);
} }
if ( this->Children.size()) if (!this->Children.empty())
{ {
size_t i; size_t i;
for(i = 0; i < this->Children.size(); ++i) for(i = 0; i < this->Children.size(); ++i)
@ -936,7 +936,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
if(variable == "TARGET_QUOTED") if(variable == "TARGET_QUOTED")
{ {
std::string targetQuoted = replaceValues.Target; std::string targetQuoted = replaceValues.Target;
if(targetQuoted.size() && targetQuoted[0] != '\"') if(!targetQuoted.empty() && targetQuoted[0] != '\"')
{ {
targetQuoted = '\"'; targetQuoted = '\"';
targetQuoted += replaceValues.Target; targetQuoted += replaceValues.Target;
@ -1414,12 +1414,12 @@ std::string cmLocalGenerator::GetIncludeFlags(
} }
std::string includePath = std::string includePath =
this->ConvertToIncludeReference(*i, shellFormat, forceFullPaths); this->ConvertToIncludeReference(*i, shellFormat, forceFullPaths);
if(quotePaths && includePath.size() && includePath[0] != '\"') if(quotePaths && !includePath.empty() && includePath[0] != '\"')
{ {
includeFlags << "\""; includeFlags << "\"";
} }
includeFlags << includePath; includeFlags << includePath;
if(quotePaths && includePath.size() && includePath[0] != '\"') if(quotePaths && !includePath.empty() && includePath[0] != '\"')
{ {
includeFlags << "\""; includeFlags << "\"";
} }
@ -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] = ' ';
} }
@ -2514,7 +2514,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
{ {
if(!newFlags.empty()) if(!newFlags.empty())
{ {
if(flags.size()) if(!flags.empty())
{ {
flags += " "; flags += " ";
} }
@ -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()))
@ -2968,7 +2968,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
// If the entire path is in common except for a trailing slash then // If the entire path is in common except for a trailing slash then
// just return a "./". // just return a "./".
if(common+1 == remote.size() && if(common+1 == remote.size() &&
remote[common].size() == 0 && remote[common].empty() &&
common == local.size()) common == local.size())
{ {
return "./"; return "./";
@ -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

@ -1157,7 +1157,7 @@ cmLocalUnixMakefileGenerator3
{ {
// Build the command line in a single string. // Build the command line in a single string.
std::string cmd = ccg.GetCommand(c); std::string cmd = ccg.GetCommand(c);
if (cmd.size()) if (!cmd.empty())
{ {
// Use "call " before any invocations of .bat or .cmd files // Use "call " before any invocations of .bat or .cmd files
// invoked as custom commands in the WindowsShell. // invoked as custom commands in the WindowsShell.
@ -2170,7 +2170,7 @@ cmLocalUnixMakefileGenerator3
cmd += " "; cmd += " ";
// Pass down verbosity level. // Pass down verbosity level.
if(this->GetMakeSilentFlag().size()) if(!this->GetMakeSilentFlag().empty())
{ {
cmd += this->GetMakeSilentFlag(); cmd += this->GetMakeSilentFlag();
cmd += " "; cmd += " ";
@ -2294,7 +2294,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
for(unsigned int i=1; i < components.size(); ++i) for(unsigned int i=1; i < components.size(); ++i)
{ {
// Only the last component can be empty to avoid double slashes. // 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) if(!first)
{ {

View File

@ -116,7 +116,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
std::string argnDef; std::string argnDef;
bool argnDefInitialized = false; bool argnDefInitialized = false;
bool argvDefInitialized = false; bool argvDefInitialized = false;
if( this->Functions.size()) if(!this->Functions.empty())
{ {
this->FilePath = this->Functions[0].FilePath; this->FilePath = this->Functions[0].FilePath;
} }
@ -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

@ -175,7 +175,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
t != this->IncludeDirectories.end(); ++t) t != this->IncludeDirectories.end(); ++t)
{ {
std::string incpath = *t; std::string incpath = *t;
if (incpath.size() && incpath[incpath.size() - 1] != '/') if (!incpath.empty() && incpath[incpath.size() - 1] != '/')
{ {
incpath = incpath + "/"; incpath = incpath + "/";
} }
@ -318,7 +318,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
i != this->IncludeDirectories.end(); ++i) i != this->IncludeDirectories.end(); ++i)
{ {
std::string path = *i; std::string path = *i;
if (path.size() && path[path.size() - 1] != '/') if (!path.empty() && path[path.size() - 1] != '/')
{ {
path = path + "/"; path = path + "/";
} }
@ -335,7 +335,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
if (extraPath) if (extraPath)
{ {
std::string path = extraPath; std::string path = extraPath;
if (path.size() && path[path.size() - 1] != '/') if (!path.empty() && path[path.size() - 1] != '/')
{ {
path = path + "/"; path = path + "/";
} }

View File

@ -1798,7 +1798,7 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
} }
this->Internal->VarStack.top().Set(name, value); this->Internal->VarStack.top().Set(name, value);
if (this->Internal->VarUsageStack.size() && if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name)) this->VariableInitialized(name))
{ {
this->CheckForUnused("changing definition", name); this->CheckForUnused("changing definition", name);
@ -1873,7 +1873,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
void cmMakefile::AddDefinition(const std::string& name, bool value) void cmMakefile::AddDefinition(const std::string& name, bool value)
{ {
this->Internal->VarStack.top().Set(name, value? "ON" : "OFF"); this->Internal->VarStack.top().Set(name, value? "ON" : "OFF");
if (this->Internal->VarUsageStack.size() && if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name)) this->VariableInitialized(name))
{ {
this->CheckForUnused("changing definition", name); this->CheckForUnused("changing definition", name);
@ -1937,7 +1937,7 @@ void cmMakefile::CheckForUnused(const char* reason,
{ {
std::string path; std::string path;
cmListFileBacktrace bt(this->GetLocalGenerator()); cmListFileBacktrace bt(this->GetLocalGenerator());
if (this->CallStack.size()) if (!this->CallStack.empty())
{ {
const cmListFileContext* file = this->CallStack.back().Context; const cmListFileContext* file = this->CallStack.back().Context;
bt.push_back(*file); bt.push_back(*file);
@ -1972,7 +1972,7 @@ void cmMakefile::CheckForUnused(const char* reason,
void cmMakefile::RemoveDefinition(const std::string& name) void cmMakefile::RemoveDefinition(const std::string& name)
{ {
this->Internal->VarStack.top().Set(name, 0); this->Internal->VarStack.top().Set(name, 0);
if (this->Internal->VarUsageStack.size() && if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name)) this->VariableInitialized(name))
{ {
this->CheckForUnused("unsetting", name); this->CheckForUnused("unsetting", name);
@ -3852,12 +3852,12 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
// from which we are being called is located itself in CMAKE_ROOT, then // from which we are being called is located itself in CMAKE_ROOT, then
// prefer results from CMAKE_ROOT depending on the policy setting. // prefer results from CMAKE_ROOT depending on the policy setting.
result = moduleInCMakeModulePath; result = moduleInCMakeModulePath;
if (result.size() == 0) if (result.empty())
{ {
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

@ -57,7 +57,7 @@ bool cmRemoveCommand
} }
if (!found) if (!found)
{ {
if (value.size()) if (!value.empty())
{ {
value += ";"; value += ";";
} }

View File

@ -37,7 +37,7 @@ bool cmSetCommand
delete [] varName; delete [] varName;
// will it be set to something, then set it // will it be set to something, then set it
if (args.size() > 1 && args[1].size()) if (args.size() > 1 && !args[1].empty())
{ {
// but only if it is different from current value // but only if it is different from current value
if (!currValue || strcmp(currValue,args[1].c_str())) if (!currValue || strcmp(currValue,args[1].c_str()))

View File

@ -61,7 +61,7 @@ bool cmSetTargetPropertiesCommand
return false; return false;
} }
} }
if(propertyPairs.size() == 0) if(propertyPairs.empty())
{ {
this->SetError("called with illegal arguments, maybe missing " this->SetError("called with illegal arguments, maybe missing "
"a PROPERTIES specifier?"); "a PROPERTIES specifier?");

View File

@ -62,7 +62,7 @@ bool cmSetTestsPropertiesCommand
return false; return false;
} }
} }
if(propertyPairs.size() == 0) if(propertyPairs.empty())
{ {
this->SetError("called with illegal arguments, maybe " this->SetError("called with illegal arguments, maybe "
"missing a PROPERTIES specifier?"); "missing a PROPERTIES specifier?");

View File

@ -66,7 +66,7 @@ bool cmSiteNameCommand
&host, 0, 0, cmSystemTools::OUTPUT_NONE); &host, 0, 0, cmSystemTools::OUTPUT_NONE);
// got the hostname // got the hostname
if (host.length()) if (!host.empty())
{ {
// remove any white space from the host name // remove any white space from the host name
std::string hostRegExp = "[ \t\n\r]*([^\t\n\r ]*)[ \t\n\r]*"; std::string hostRegExp = "[ \t\n\r]*([^\t\n\r ]*)[ \t\n\r]*";
@ -77,7 +77,7 @@ bool cmSiteNameCommand
host = hostReg.match(1); host = hostReg.match(1);
} }
if(host.length()) if(!host.empty())
{ {
siteName = host; siteName = host;
} }

View File

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

View File

@ -1152,7 +1152,7 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
std::string path = cmSystemTools::GetFilenamePath(glob); std::string path = cmSystemTools::GetFilenamePath(glob);
std::string ppath = cmSystemTools::GetFilenameName(glob); std::string ppath = cmSystemTools::GetFilenameName(glob);
ppath = ppath.substr(0, ppath.size()-1); ppath = ppath.substr(0, ppath.size()-1);
if ( path.size() == 0 ) if (path.empty())
{ {
path = "/"; path = "/";
} }

View File

@ -1508,7 +1508,7 @@ cmTarget::AnalyzeLibDependenciesForVS6( const cmMakefile& mf )
{ {
// skip zero size library entries, this may happen // skip zero size library entries, this may happen
// if a variable expands to nothing. // if a variable expands to nothing.
if (lib->first.size() != 0) if (!lib->first.empty())
{ {
this->EmitForVS6( *lib, dep_map, done, visited, newLinkLibrariesForVS6 ); this->EmitForVS6( *lib, dep_map, done, visited, newLinkLibrariesForVS6 );
} }
@ -1648,7 +1648,7 @@ void cmTarget::GatherDependenciesForVS6( const cmMakefile& mf,
while( end != std::string::npos ) while( end != std::string::npos )
{ {
std::string l = depline.substr( start, end-start ); std::string l = depline.substr( start, end-start );
if( l.size() != 0 ) if(!l.empty())
{ {
if (l == "debug") if (l == "debug")
{ {

View File

@ -104,8 +104,8 @@ bool cmTryRunCommand
// although they could be used together, don't allow it, because // although they could be used together, don't allow it, because
// using OUTPUT_VARIABLE makes crosscompiling harder // using OUTPUT_VARIABLE makes crosscompiling harder
if (this->OutputVariable.size() if (this->OutputVariable.size()
&& ((this->RunOutputVariable.size()) && (!this->RunOutputVariable.empty()
|| (this->CompileOutputVariable.size()))) || !this->CompileOutputVariable.empty()))
{ {
cmSystemTools::Error( cmSystemTools::Error(
"You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE " "You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE "
@ -115,18 +115,18 @@ bool cmTryRunCommand
} }
bool captureRunOutput = false; bool captureRunOutput = false;
if (this->OutputVariable.size()) if (!this->OutputVariable.empty())
{ {
captureRunOutput = true; captureRunOutput = true;
tryCompile.push_back("OUTPUT_VARIABLE"); tryCompile.push_back("OUTPUT_VARIABLE");
tryCompile.push_back(this->OutputVariable); tryCompile.push_back(this->OutputVariable);
} }
if (this->CompileOutputVariable.size()) if (!this->CompileOutputVariable.empty())
{ {
tryCompile.push_back("OUTPUT_VARIABLE"); tryCompile.push_back("OUTPUT_VARIABLE");
tryCompile.push_back(this->CompileOutputVariable); tryCompile.push_back(this->CompileOutputVariable);
} }
if (this->RunOutputVariable.size()) if (!this->RunOutputVariable.empty())
{ {
captureRunOutput = true; captureRunOutput = true;
} }
@ -140,7 +140,7 @@ bool cmTryRunCommand
// now try running the command if it compiled // now try running the command if it compiled
if (!res) if (!res)
{ {
if (this->OutputFile.size() == 0) if (this->OutputFile.empty())
{ {
cmSystemTools::Error(this->FindErrorMessage.c_str()); cmSystemTools::Error(this->FindErrorMessage.c_str());
} }
@ -160,13 +160,13 @@ bool cmTryRunCommand
} }
// now put the output into the variables // now put the output into the variables
if(this->RunOutputVariable.size()) if(!this->RunOutputVariable.empty())
{ {
this->Makefile->AddDefinition(this->RunOutputVariable, this->Makefile->AddDefinition(this->RunOutputVariable,
runOutputContents.c_str()); runOutputContents.c_str());
} }
if(this->OutputVariable.size()) if(!this->OutputVariable.empty())
{ {
// if the TryCompileCore saved output in this outputVariable then // if the TryCompileCore saved output in this outputVariable then
// prepend that output to this output // prepend that output to this output
@ -196,7 +196,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
int retVal = -1; int retVal = -1;
std::string finalCommand = cmSystemTools::ConvertToRunCommandPath( std::string finalCommand = cmSystemTools::ConvertToRunCommandPath(
this->OutputFile.c_str()); this->OutputFile.c_str());
if (runArgs.size()) if (!runArgs.empty())
{ {
finalCommand += runArgs; finalCommand += runArgs;
} }

View File

@ -44,7 +44,7 @@ bool cmUseMangledMesaCommand
const char* destDir = args[1].c_str(); const char* destDir = args[1].c_str();
std::vector<std::string> files; std::vector<std::string> files;
cmSystemTools::Glob(inputDir, "\\.h$", files); cmSystemTools::Glob(inputDir, "\\.h$", files);
if(files.size() == 0) if(files.empty())
{ {
cmSystemTools::Error("Could not open Mesa Directory ", inputDir); cmSystemTools::Error("Could not open Mesa Directory ", inputDir);
return false; return false;

View File

@ -95,7 +95,7 @@ bool cmUtilitySourceCommand
{ {
exePath = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"); exePath = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
} }
if(exePath.size()) if(!exePath.empty())
{ {
utilityDirectory = exePath; utilityDirectory = exePath;
} }

View File

@ -66,7 +66,7 @@ void cmUuid::CreateHashInput(std::vector<unsigned char> const& uuidNamespace,
{ {
output = uuidNamespace; output = uuidNamespace;
if(name.size()) if(!name.empty())
{ {
output.resize(output.size() + name.size()); output.resize(output.size() + name.size());

View File

@ -47,7 +47,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
while (isTrue) while (isTrue)
{ {
if (errorString.size()) if (!errorString.empty())
{ {
std::string err = "had incorrect arguments: "; std::string err = "had incorrect arguments: ";
unsigned int i; unsigned int i;
@ -120,7 +120,7 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& )
{ {
// if the endwhile has arguments, then make sure // if the endwhile has arguments, then make sure
// they match the arguments of the matching while // they match the arguments of the matching while
if (lff.Arguments.size() == 0 || if (lff.Arguments.empty() ||
lff.Arguments == this->Args) lff.Arguments == this->Args)
{ {
return true; return true;

View File

@ -316,7 +316,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
if(arg.find("-D",0) == 0) if(arg.find("-D",0) == 0)
{ {
std::string entry = arg.substr(2); std::string entry = arg.substr(2);
if(entry.size() == 0) if(entry.empty())
{ {
++i; ++i;
if(i < args.size()) if(i < args.size())
@ -380,7 +380,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
else if(arg.find("-U",0) == 0) else if(arg.find("-U",0) == 0)
{ {
std::string entryPattern = arg.substr(2); std::string entryPattern = arg.substr(2);
if(entryPattern.size() == 0) if(entryPattern.empty())
{ {
++i; ++i;
if(i < args.size()) if(i < args.size())
@ -424,7 +424,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
else if(arg.find("-C",0) == 0) else if(arg.find("-C",0) == 0)
{ {
std::string path = arg.substr(2); std::string path = arg.substr(2);
if ( path.size() == 0 ) if (path.empty())
{ {
++i; ++i;
if(i < args.size()) if(i < args.size())
@ -449,7 +449,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false; return false;
} }
std::string path = args[i]; std::string path = args[i];
if ( path.size() == 0 ) if (path.empty())
{ {
cmSystemTools::Error("No cmake script provided."); cmSystemTools::Error("No cmake script provided.");
return false; return false;
@ -763,7 +763,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
else if(arg.find("-A",0) == 0) else if(arg.find("-A",0) == 0)
{ {
std::string value = arg.substr(2); std::string value = arg.substr(2);
if(value.size() == 0) if(value.empty())
{ {
++i; ++i;
if(i >= args.size()) if(i >= args.size())
@ -784,7 +784,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
else if(arg.find("-T",0) == 0) else if(arg.find("-T",0) == 0)
{ {
std::string value = arg.substr(2); std::string value = arg.substr(2);
if(value.size() == 0) if(value.empty())
{ {
++i; ++i;
if(i >= args.size()) if(i >= args.size())
@ -805,7 +805,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
else if(arg.find("-G",0) == 0) else if(arg.find("-G",0) == 0)
{ {
std::string value = arg.substr(2); std::string value = arg.substr(2);
if(value.size() == 0) if(value.empty())
{ {
++i; ++i;
if(i >= args.size()) if(i >= args.size())
@ -909,7 +909,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
} }
// If there is a CMakeCache.txt file, use its settings. // If there is a CMakeCache.txt file, use its settings.
if(cachePath.length() > 0) if(!cachePath.empty())
{ {
cmCacheManager* cachem = this->GetCacheManager(); cmCacheManager* cachem = this->GetCacheManager();
cmCacheManager::CacheIterator it = cachem->NewIterator(); 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 there is a CMakeLists.txt file, use it as the source tree.
if(listPath.length() > 0) if(!listPath.empty())
{ {
this->SetHomeDirectory(listPath); this->SetHomeDirectory(listPath);
this->SetStartDirectory(listPath); this->SetStartDirectory(listPath);
@ -1123,13 +1123,13 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
// restore the original environment variables CXX and CC // restore the original environment variables CXX and CC
// Restore CC // Restore CC
std::string env = "CC="; std::string env = "CC=";
if(this->CCEnvironment.size()) if(!this->CCEnvironment.empty())
{ {
env += this->CCEnvironment; env += this->CCEnvironment;
} }
cmSystemTools::PutEnv(env); cmSystemTools::PutEnv(env);
env = "CXX="; env = "CXX=";
if(this->CXXEnvironment.size()) if(!this->CXXEnvironment.empty())
{ {
env += this->CXXEnvironment; env += this->CXXEnvironment;
} }
@ -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()) )
@ -1959,7 +1959,7 @@ int cmake::CheckBuildSystem()
// determine whether CMake should rerun. // determine whether CMake should rerun.
// If no file is provided for the check, we have to rerun. // If no file is provided for the check, we have to rerun.
if(this->CheckBuildSystemArgument.size() == 0) if(this->CheckBuildSystemArgument.empty())
{ {
if(verbose) if(verbose)
{ {
@ -2277,7 +2277,7 @@ const char *cmake::GetProperty(const std::string& prop,
this->GetCacheManager()->GetCacheIterator(); this->GetCacheManager()->GetCacheIterator();
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
{ {
if ( output.size() ) if (!output.empty())
{ {
output += ";"; output += ";";
} }
@ -2395,7 +2395,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
else if(arg.find("-G",0) == 0) else if(arg.find("-G",0) == 0)
{ {
std::string value = arg.substr(2); std::string value = arg.substr(2);
if(value.size() == 0) if(value.empty())
{ {
++i; ++i;
if(i >= args.size()) if(i >= args.size())
@ -2450,7 +2450,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
} }
// do we write to a file or to stdout? // do we write to a file or to stdout?
if (resultFile.size() == 0) if (resultFile.empty())
{ {
resultFile = cwd; resultFile = cwd;
resultFile += "/__cmake_systeminformation/results.txt"; resultFile += "/__cmake_systeminformation/results.txt";
@ -2531,7 +2531,7 @@ static bool cmakeCheckStampFile(const char* stampName)
while(cmSystemTools::GetLineFromStream(fin, dep)) while(cmSystemTools::GetLineFromStream(fin, dep))
{ {
int result; int result;
if(dep.length() >= 1 && dep[0] != '#' && if(!dep.empty() && dep[0] != '#' &&
(!ftc.FileTimeCompare(stampDepends.c_str(), dep.c_str(), &result) (!ftc.FileTimeCompare(stampDepends.c_str(), dep.c_str(), &result)
|| result < 0)) || result < 0))
{ {

View File

@ -201,7 +201,7 @@ int main(int ac, char const* const* av)
int do_cmake(int ac, char const* const* av) int do_cmake(int ac, char const* const* av)
{ {
if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 ) if (cmSystemTools::GetCurrentWorkingDirectory().empty())
{ {
std::cerr << "Current working directory cannot be established." std::cerr << "Current working directory cannot be established."
<< std::endl; << std::endl;

View File

@ -1228,7 +1228,7 @@ int cmcmd::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
targetName = i->substr(5); targetName = i->substr(5);
} }
} }
if(targetName.size() == 0 || command.size() == 0) if(targetName.empty() || command.empty())
{ {
return -1; return -1;
} }

View File

@ -136,7 +136,7 @@ int main (int argc, char const* const* argv)
cmCTest inst; cmCTest inst;
if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 ) if (cmSystemTools::GetCurrentWorkingDirectory().empty())
{ {
cmCTestLog(&inst, ERROR_MESSAGE, cmCTestLog(&inst, ERROR_MESSAGE,
"Current working directory cannot be established." << std::endl); "Current working directory cannot be established." << std::endl);