From 930bd4781694ea85a876c08c34a2dd8243688920 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 15 Jan 2015 00:31:49 +0100 Subject: Replace 'foo.size() == 0' pattern with foo.empty(). --- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 4 ++-- Source/CTest/cmCTestBuildHandler.cxx | 4 ++-- Source/CTest/cmCTestConfigureHandler.cxx | 4 ++-- Source/CTest/cmCTestCoverageHandler.cxx | 12 ++++++------ Source/CTest/cmCTestMemCheckHandler.cxx | 8 ++++---- Source/CTest/cmCTestMultiProcessHandler.cxx | 2 +- Source/CTest/cmCTestP4.cxx | 4 ++-- Source/CTest/cmCTestSubmitHandler.cxx | 2 +- Source/CTest/cmCTestTestHandler.cxx | 12 ++++++------ Source/CTest/cmParseCacheCoverage.cxx | 4 ++-- Source/CTest/cmParseDelphiCoverage.cxx | 2 +- Source/CTest/cmProcess.cxx | 2 +- Source/cmCTest.cxx | 8 ++++---- Source/cmDependsC.cxx | 4 ++-- Source/cmDependsJavaParserHelper.cxx | 2 +- Source/cmFileCommand.cxx | 2 +- Source/cmFindBase.cxx | 4 ++-- Source/cmGeneratorExpressionEvaluator.cxx | 6 +++--- Source/cmGlobalGenerator.cxx | 6 +++--- Source/cmIfCommand.cxx | 2 +- Source/cmIncludeDirectoryCommand.cxx | 2 +- Source/cmListCommand.cxx | 4 ++-- Source/cmLocalGenerator.cxx | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmSetTargetPropertiesCommand.cxx | 2 +- Source/cmSetTestsPropertiesCommand.cxx | 2 +- Source/cmSystemTools.cxx | 2 +- Source/cmTryRunCommand.cxx | 2 +- Source/cmUseMangledMesaCommand.cxx | 2 +- Source/cmWhileCommand.cxx | 2 +- Source/cmake.cxx | 20 ++++++++++---------- Source/cmakemain.cxx | 2 +- Source/cmcmd.cxx | 2 +- Source/ctest.cxx | 2 +- 35 files changed, 72 insertions(+), 72 deletions(-) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index b1b122d..00bfe5b 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -117,7 +117,7 @@ int main (int argc, char const* const* argv) cmSystemTools::EnableMSVCDebugHook(); - if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 ) + if (cmSystemTools::GetCurrentWorkingDirectory().empty()) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Current working directory cannot be established." << std::endl); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 8499846..e5d5988 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -211,7 +211,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) static_cast(captureRAII); std::ostringstream out; - if ( this->CTest->GetConfigType().size() == 0 && + if ( this->CTest->GetConfigType().empty() && this->ConfigSample.size()) { // use the config sample to set the ConfigType @@ -269,7 +269,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) // do the build std::vector::iterator tarIt; - if ( this->BuildTargets.size() == 0 ) + if (this->BuildTargets.empty()) { this->BuildTargets.push_back(""); } diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 5ddc75f..4032499 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -344,7 +344,7 @@ int cmCTestBuildHandler::ProcessHandler() // Determine build command and build directory std::string makeCommand = this->GetMakeCommand(); - if ( makeCommand.size() == 0 ) + if (makeCommand.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find MakeCommand key in the DartConfiguration.tcl" @@ -354,7 +354,7 @@ int cmCTestBuildHandler::ProcessHandler() const std::string &buildDirectory = this->CTest->GetCTestConfiguration("BuildDirectory"); - if ( buildDirectory.size() == 0 ) + if (buildDirectory.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find BuildDirectory key in the DartConfiguration.tcl" diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index c492bf0..506433f 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -38,7 +38,7 @@ int cmCTestConfigureHandler::ProcessHandler() cmCTestLog(this->CTest, HANDLER_OUTPUT, "Configure project" << std::endl); std::string cCommand = this->CTest->GetCTestConfiguration("ConfigureCommand"); - if ( cCommand.size() == 0 ) + if (cCommand.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find ConfigureCommand key in the DartConfiguration.tcl" @@ -48,7 +48,7 @@ int cmCTestConfigureHandler::ProcessHandler() std::string buildDirectory = this->CTest->GetCTestConfiguration("BuildDirectory"); - if ( buildDirectory.size() == 0 ) + if (buildDirectory.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find BuildDirectory key in the DartConfiguration.tcl" diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 8a1b724..87c7e8f 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1037,7 +1037,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( this->FindGCovFiles(files); std::vector::iterator it; - if ( files.size() == 0 ) + if (files.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any GCov coverage files." @@ -1131,7 +1131,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]" << std::endl); - if ( line->size() == 0 ) + if (line->empty()) { // Ignore empty line; probably style 2 } @@ -1456,7 +1456,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( this->FindLCovFiles(files); std::vector::iterator it; - if ( files.size() == 0 ) + if (files.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any LCov coverage files." @@ -1538,7 +1538,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( std::string sourceFile; std::string lcovFile; - if ( line->size() == 0 ) + if (line->empty()) { // Ignore empty line } @@ -1759,7 +1759,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( gl.FindFiles(daGlob); std::vector files = gl.GetFiles(); - if ( files.size() == 0 ) + if (files.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Cannot find any Python Trace.py coverage files." @@ -2076,7 +2076,7 @@ int cmCTestCoverageHandler::RunBullseyeCommand( std::string& outputFile) { std::string program = cmSystemTools::FindProgram(cmd); - if(program.size() == 0) + if(program.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find :" << cmd << "\n"); return 0; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index fd0388a..68c5a92 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -592,7 +592,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; } } - if(this->MemoryTester.size() == 0 ) + if(this->MemoryTester.empty()) { cmCTestLog(this->CTest, WARNING, "Memory checker (MemoryCheckCommand) " @@ -851,7 +851,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( if(resultFound.size()) { std::vector::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); } @@ -1197,7 +1197,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, << res.Name << std::endl); std::vector files; this->TestOutputFileNames(test, files); - if ( files.size() == 0 ) + if (files.empty()) { return; } @@ -1280,7 +1280,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames(int test, ofile += ".*"; cmsys::Glob g; g.FindFiles(ofile); - if(g.GetFiles().size() == 0) + if(g.GetFiles().empty()) { std::string log = "Cannot find memory tester output file: " + ofile; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index b32d47b..594f53a 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -265,7 +265,7 @@ void cmCTestMultiProcessHandler::StartNextTests() bool cmCTestMultiProcessHandler::CheckOutput() { // no more output we are done - if(this->RunningTests.size() == 0) + if(this->RunningTests.empty()) { return false; } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 52b98d7..31002a6 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -324,7 +324,7 @@ private: //---------------------------------------------------------------------------- void cmCTestP4::SetP4Options(std::vector &CommandOptions) { - if(P4Options.size() == 0) + if(P4Options.empty()) { const char* p4 = this->CommandLineTool.c_str(); P4Options.push_back(p4); @@ -447,7 +447,7 @@ void cmCTestP4::LoadRevisions() ChangeLists.clear(); this->RunChild(&p4_changes[0], &out, &err); - if(ChangeLists.size() == 0) + if(ChangeLists.empty()) return; //p4 describe -s ...@1111111,2222222 diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 07bd413..1d50788 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -1067,7 +1067,7 @@ int cmCTestSubmitHandler::ProcessHandler() const std::string &buildDirectory = this->CTest->GetCTestConfiguration("BuildDirectory"); - if ( buildDirectory.size() == 0 ) + if (buildDirectory.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find BuildDirectory key in the DartConfiguration.tcl" diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index ca8f09f..b6b0357 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -738,7 +738,7 @@ void cmCTestTestHandler::CheckLabelFilterInclude(cmCTestTestProperties& it) } // if there are no labels and we are filtering by labels // then exclude the test as it does not have the label - if(it.Labels.size() == 0 ) + if(it.Labels.empty()) { it.IsInBasedOnREOptions = false; return; @@ -772,7 +772,7 @@ void cmCTestTestHandler::CheckLabelFilterExclude(cmCTestTestProperties& it) } // if there are no labels and we are excluding by labels // then do nothing as a no label can not be a match - if(it.Labels.size() == 0 ) + if(it.Labels.empty()) { return; } @@ -1474,7 +1474,7 @@ std::string cmCTestTestHandler // if extraPaths are provided and we were not passed a full path, try them, // try any extra paths - if (filepath.size() == 0) + if (filepath.empty()) { for (unsigned int i = 0; i < extraPaths.size(); ++i) { @@ -1494,7 +1494,7 @@ std::string cmCTestTestHandler // now look in the paths we specified above for(unsigned int ai=0; - ai < attempted.size() && fullPath.size() == 0; ++ai) + ai < attempted.size() && fullPath.empty(); ++ai) { // first check without exe extension 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 // wasn't specified - if (fullPath.size() == 0 && filepath.size() == 0) + if (fullPath.empty() && filepath.empty()) { std::string path = cmSystemTools::FindProgram(filename.c_str()); if (path != "") @@ -1533,7 +1533,7 @@ std::string cmCTestTestHandler return path; } } - if(fullPath.size() == 0) + if(fullPath.empty()) { cmCTestLog(ctest, HANDLER_OUTPUT, "Could not find executable " << testCommand << "\n" diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index 97454a8..3642308 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -163,7 +163,7 @@ bool cmParseCacheCoverage::ReadCMCovFile(const char* file) } // if we do not have a routine yet, then it should be // the first argument in the vector - if(routine.size() == 0) + if(routine.empty()) { routine = separateLine[0]; // 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 // after the call to FindMumpsFile that we did not find // it, so don't report again to cut down on output - if(filepath.size() == 0) + if(filepath.empty()) { continue; } diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index 82194b3..4dfdfac 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -147,7 +147,7 @@ public: std::string glob = Coverage.SourceDir + "*/" + filename; gl.FindFiles(glob); std::vector const& files = gl.GetFiles(); - if(files.size() == 0) + if(files.empty()) { /* * If that doesn't find any matching files diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 167b992..ca1ed8b 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -39,7 +39,7 @@ void cmProcess::SetCommandArguments(std::vector const& args) bool cmProcess::StartProcess() { - if(this->Command.size() == 0) + if(this->Command.empty()) { return false; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 944d506..b7e049d 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -580,7 +580,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) } 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() << std::endl); @@ -772,7 +772,7 @@ bool cmCTest::UpdateCTestConfiguration() fin.getline(buffer, 1023); buffer[1023] = 0; std::string line = cmCTest::CleanString(buffer); - if(line.size() == 0) + if(line.empty()) { continue; } @@ -1653,7 +1653,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles) cmCTestLog(this, OUTPUT, "Create notes file" << std::endl); files = cmSystemTools::SplitString(cfiles, ';'); - if ( files.size() == 0 ) + if (files.empty()) { return 1; } @@ -1744,7 +1744,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles) cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl); files = cmSystemTools::SplitString(cfiles, ';'); - if ( files.size() == 0 ) + if (files.empty()) { return 1; } diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 5ae065e..6dde349 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -285,7 +285,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, //---------------------------------------------------------------------------- void cmDependsC::ReadCacheFile() { - if(this->CacheFileName.size() == 0) + if(this->CacheFileName.empty()) { return; } @@ -374,7 +374,7 @@ void cmDependsC::ReadCacheFile() //---------------------------------------------------------------------------- void cmDependsC::WriteCacheFile() const { - if(this->CacheFileName.size() == 0) + if(this->CacheFileName.empty()) { return; } diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index d7d052e..3c02325 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -251,7 +251,7 @@ void cmDependsJavaParserHelper::EndClass() void cmDependsJavaParserHelper::PrintClasses() { - if ( this->ClassStack.size() == 0 ) + if (this->ClassStack.empty()) { std::cerr << "Error when parsing. No classes on class stack" << std::endl; abort(); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 862d1ca..416dd3e 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3151,7 +3151,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) if (hash.get()) { std::string actualHash = hash->HashFile(file); - if (actualHash.size() == 0) + if (actualHash.empty()) { this->SetError("DOWNLOAD cannot compute hash on downloaded file"); return false; diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 013724e..69991d5 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -152,10 +152,10 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) } } - if(this->VariableDocumentation.size() == 0) + if(this->VariableDocumentation.empty()) { this->VariableDocumentation = "Where can "; - if(this->Names.size() == 0) + if(this->Names.empty()) { this->VariableDocumentation += "the (unknown) library be found"; } diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 3b1e9c2..5f246f9 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -429,7 +429,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode { const char *compilerId = context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); - if (parameters.size() == 0) + if (parameters.empty()) { return compilerId ? compilerId : ""; } @@ -534,7 +534,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode { const char *compilerVersion = context->Makefile->GetSafeDefinition( "CMAKE_" + lang + "_COMPILER_VERSION"); - if (parameters.size() == 0) + if (parameters.empty()) { return compilerVersion ? compilerVersion : ""; } @@ -616,7 +616,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode { const char *platformId = context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - if (parameters.size() == 0) + if (parameters.empty()) { return platformId ? platformId : ""; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6373235..5ebc7cc 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -174,7 +174,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, { path = name; } - if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str())) + if((path.empty() || !cmSystemTools::FileExists(path.c_str())) && (optional==false)) { return; @@ -265,7 +265,7 @@ cmGlobalGenerator::IsExportedTargetsFile(const std::string &filename) const // Find the make program for the generator, required for try compiles void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) { - if(this->FindMakeProgramFile.size() == 0) + if(this->FindMakeProgramFile.empty()) { cmSystemTools::Error( "Generator implementation error, " @@ -383,7 +383,7 @@ void cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, cmMakefile *mf, bool optional) { - if(languages.size() == 0) + if(languages.empty()) { cmSystemTools::Error("EnableLanguage must have a lang specified!"); cmSystemTools::SetFatalErrorOccured(); diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index b8e30b7..da62eca 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -177,7 +177,7 @@ bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff, { // if the endif has arguments, then make sure // they match the arguments of the matching if - if (lff.Arguments.size() == 0 || + if (lff.Arguments.empty() || lff.Arguments == this->Args) { return true; diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index f37d8bc..464b4c2 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -47,7 +47,7 @@ bool cmIncludeDirectoryCommand system = true; continue; } - if(i->size() == 0) + if(i->empty()) { this->SetError("given empty-string as include directory."); return false; diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index c3f0f57..c82d278 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -98,7 +98,7 @@ bool cmListCommand::GetList(std::vector& list, return false; } // if the size of the list - if(listString.size() == 0) + if(listString.empty()) { return true; } @@ -109,7 +109,7 @@ bool cmListCommand::GetList(std::vector& list, for(std::vector::iterator i = list.begin(); i != list.end(); ++i) { - if(i->size() == 0) + if(i->empty()) { hasEmpty = true; break; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 04106dc..cb52ffb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2968,7 +2968,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, // If the entire path is in common except for a trailing slash then // just return a "./". if(common+1 == remote.size() && - remote[common].size() == 0 && + remote[common].empty() && common == local.size()) { return "./"; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c6181aa..67efdc5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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 // prefer results from CMAKE_ROOT depending on the policy setting. result = moduleInCMakeModulePath; - if (result.size() == 0) + if (result.empty()) { result = moduleInCMakeRoot; } diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index bf3519c..aeb8077 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -61,7 +61,7 @@ bool cmSetTargetPropertiesCommand return false; } } - if(propertyPairs.size() == 0) + if(propertyPairs.empty()) { this->SetError("called with illegal arguments, maybe missing " "a PROPERTIES specifier?"); diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index b026ff3..e66d13d 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -62,7 +62,7 @@ bool cmSetTestsPropertiesCommand return false; } } - if(propertyPairs.size() == 0) + if(propertyPairs.empty()) { this->SetError("called with illegal arguments, maybe " "missing a PROPERTIES specifier?"); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c769154..7d938c5 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1152,7 +1152,7 @@ bool cmSystemTools::SimpleGlob(const std::string& glob, std::string path = cmSystemTools::GetFilenamePath(glob); std::string ppath = cmSystemTools::GetFilenameName(glob); ppath = ppath.substr(0, ppath.size()-1); - if ( path.size() == 0 ) + if (path.empty()) { path = "/"; } diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 8f2deeb..a2f079a 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -140,7 +140,7 @@ bool cmTryRunCommand // now try running the command if it compiled if (!res) { - if (this->OutputFile.size() == 0) + if (this->OutputFile.empty()) { cmSystemTools::Error(this->FindErrorMessage.c_str()); } diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 8d26f86..2ee664f 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -44,7 +44,7 @@ bool cmUseMangledMesaCommand const char* destDir = args[1].c_str(); std::vector files; cmSystemTools::Glob(inputDir, "\\.h$", files); - if(files.size() == 0) + if(files.empty()) { cmSystemTools::Error("Could not open Mesa Directory ", inputDir); return false; diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 47edb03..8c230a4 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -120,7 +120,7 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& ) { // if the endwhile has arguments, then make sure // they match the arguments of the matching while - if (lff.Arguments.size() == 0 || + if (lff.Arguments.empty() || lff.Arguments == this->Args) { return true; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b6aac3c..c03f01d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -316,7 +316,7 @@ bool cmake::SetCacheArgs(const std::vector& args) if(arg.find("-D",0) == 0) { std::string entry = arg.substr(2); - if(entry.size() == 0) + if(entry.empty()) { ++i; if(i < args.size()) @@ -380,7 +380,7 @@ bool cmake::SetCacheArgs(const std::vector& args) else if(arg.find("-U",0) == 0) { std::string entryPattern = arg.substr(2); - if(entryPattern.size() == 0) + if(entryPattern.empty()) { ++i; if(i < args.size()) @@ -424,7 +424,7 @@ bool cmake::SetCacheArgs(const std::vector& args) else if(arg.find("-C",0) == 0) { std::string path = arg.substr(2); - if ( path.size() == 0 ) + if (path.empty()) { ++i; if(i < args.size()) @@ -449,7 +449,7 @@ bool cmake::SetCacheArgs(const std::vector& args) return false; } std::string path = args[i]; - if ( path.size() == 0 ) + if (path.empty()) { cmSystemTools::Error("No cmake script provided."); return false; @@ -763,7 +763,7 @@ void cmake::SetArgs(const std::vector& args, else if(arg.find("-A",0) == 0) { std::string value = arg.substr(2); - if(value.size() == 0) + if(value.empty()) { ++i; if(i >= args.size()) @@ -784,7 +784,7 @@ void cmake::SetArgs(const std::vector& args, else if(arg.find("-T",0) == 0) { std::string value = arg.substr(2); - if(value.size() == 0) + if(value.empty()) { ++i; if(i >= args.size()) @@ -805,7 +805,7 @@ void cmake::SetArgs(const std::vector& args, else if(arg.find("-G",0) == 0) { std::string value = arg.substr(2); - if(value.size() == 0) + if(value.empty()) { ++i; if(i >= args.size()) @@ -1959,7 +1959,7 @@ int cmake::CheckBuildSystem() // determine whether CMake should rerun. // If no file is provided for the check, we have to rerun. - if(this->CheckBuildSystemArgument.size() == 0) + if(this->CheckBuildSystemArgument.empty()) { if(verbose) { @@ -2395,7 +2395,7 @@ int cmake::GetSystemInformation(std::vector& args) else if(arg.find("-G",0) == 0) { std::string value = arg.substr(2); - if(value.size() == 0) + if(value.empty()) { ++i; if(i >= args.size()) @@ -2450,7 +2450,7 @@ int cmake::GetSystemInformation(std::vector& args) } // do we write to a file or to stdout? - if (resultFile.size() == 0) + if (resultFile.empty()) { resultFile = cwd; resultFile += "/__cmake_systeminformation/results.txt"; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 61b175e..f3e54d3 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -203,7 +203,7 @@ int main(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::endl; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 70d98d2..ecf4650 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1228,7 +1228,7 @@ int cmcmd::ParseVisualStudioLinkCommand(std::vector& args, targetName = i->substr(5); } } - if(targetName.size() == 0 || command.size() == 0) + if(targetName.empty() || command.empty()) { return -1; } diff --git a/Source/ctest.cxx b/Source/ctest.cxx index fb97af6..b77c231 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -136,7 +136,7 @@ int main (int argc, char const* const* argv) cmCTest inst; - if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 ) + if (cmSystemTools::GetCurrentWorkingDirectory().empty()) { cmCTestLog(&inst, ERROR_MESSAGE, "Current working directory cannot be established." << std::endl); -- cgit v0.12