Replace 'foo.size() == 0' pattern with foo.empty().

This commit is contained in:
Stephen Kelly 2015-01-15 00:31:49 +01:00
parent d92887efab
commit 930bd47816
35 changed files with 72 additions and 72 deletions

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

@ -211,7 +211,7 @@ 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.size())
{ {
// use the config sample to set the ConfigType // use the config sample to set the ConfigType
@ -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("");
} }

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"

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

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

View File

@ -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) "
@ -851,7 +851,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
if(resultFound.size()) if(resultFound.size())
{ {
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

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

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

@ -1067,7 +1067,7 @@ int cmCTestSubmitHandler::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"

View File

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

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

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

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

View File

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

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

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

View File

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

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

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

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

View File

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

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

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

View File

@ -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 "./";

View File

@ -3852,7 +3852,7 @@ 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;
} }

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

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

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

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

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

View File

@ -203,7 +203,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);