diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-14 23:06:11 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-01-18 13:25:24 (GMT) |
commit | d92887efabad6a91e221588d0dc7a0bffd91a9f7 (patch) | |
tree | 0436e742b7efd6071e01879b90fd71d5890d8b1c | |
parent | f3e92d281682ee482b1425675b9fccd372cd01f3 (diff) | |
download | CMake-d92887efabad6a91e221588d0dc7a0bffd91a9f7.zip CMake-d92887efabad6a91e221588d0dc7a0bffd91a9f7.tar.gz CMake-d92887efabad6a91e221588d0dc7a0bffd91a9f7.tar.bz2 |
Replace 'foo.size() > 0' pattern with !foo.empty().
32 files changed, 83 insertions, 83 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 9cd53ea..b7ef090 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -421,7 +421,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( } } /* rebuild symlinks in the installed tree */ - if (symlinkedFiles.size()>0) + if (!symlinkedFiles.empty()) { std::list< std::pair<std::string,std::string> >::iterator symlinkedIt; std::string curDir = cmSystemTools::GetCurrentWorkingDirectory(); diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index 7befca0..7633ac2 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -102,7 +102,7 @@ void cmCPackLog::Log(int tag, const char* file, int line, display = true; if ( needTagString ) { - if ( tagString.size() > 0 ) { tagString += ","; } + if (!tagString.empty()) { tagString += ","; } tagString = "VERBOSE"; } } @@ -112,7 +112,7 @@ void cmCPackLog::Log(int tag, const char* file, int line, display = true; if ( needTagString ) { - if ( tagString.size() > 0 ) { tagString += ","; } + if (!tagString.empty()) { tagString += ","; } tagString = "WARNING"; } } @@ -122,7 +122,7 @@ void cmCPackLog::Log(int tag, const char* file, int line, display = true; if ( needTagString ) { - if ( tagString.size() > 0 ) { tagString += ","; } + if (!tagString.empty()) { tagString += ","; } tagString = "ERROR"; } } @@ -132,7 +132,7 @@ void cmCPackLog::Log(int tag, const char* file, int line, display = true; if ( needTagString ) { - if ( tagString.size() > 0 ) { tagString += ","; } + if (!tagString.empty()) { tagString += ","; } tagString = "DEBUG"; } useFileAndLine = true; @@ -143,7 +143,7 @@ void cmCPackLog::Log(int tag, const char* file, int line, display = true; if ( needTagString ) { - if ( tagString.size() > 0 ) { tagString += ","; } + if (!tagString.empty()) { tagString += ","; } tagString = "VERBOSE"; } } diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx index 7f966aa..d62c260 100644 --- a/Source/CTest/cmCTestBatchTestHandler.cxx +++ b/Source/CTest/cmCTestBatchTestHandler.cxx @@ -58,7 +58,7 @@ void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout) fout << "-J=" << properties->Name << " "; //Write dependency information - /*if(this->Tests[test].size() > 0) + /*if(!this->Tests[test].empty()) { fout << "-P=afterany"; for(TestSet::iterator i = this->Tests[test].begin(); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index b1fb02d..8499846 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -82,7 +82,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, } const char* config = 0; - if ( this->CTest->GetConfigType().size() > 0 ) + if (!this->CTest->GetConfigType().empty()) { config = this->CTest->GetConfigType().c_str(); } @@ -291,7 +291,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } std::string output; const char* config = 0; - if ( this->CTest->GetConfigType().size() > 0 ) + if (!this->CTest->GetConfigType().empty()) { config = this->CTest->GetConfigType().c_str(); } diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 0c3f206..5ddc75f 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -702,12 +702,12 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os) } if ( !cm->SourceFile.empty() && cm->LineNumber >= 0 ) { - if ( cm->SourceFile.size() > 0 ) + if (!cm->SourceFile.empty()) { os << "\t\t<SourceFile>" << cm->SourceFile << "</SourceFile>" << std::endl; } - if ( cm->SourceFileTail.size() > 0 ) + if (!cm->SourceFileTail.empty()) { os << "\t\t<SourceFileTail>" << cm->SourceFileTail << "</SourceFileTail>" << std::endl; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 6598111..8a1b724 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -665,7 +665,7 @@ int cmCTestCoverageHandler::ProcessHandler() this->EndCoverageLogFile(covLogFile, logFileCount); - if ( errorsWhileAccumulating.size() > 0 ) + if (!errorsWhileAccumulating.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, @@ -910,7 +910,7 @@ int cmCTestCoverageHandler::HandleJacocoCoverage( g.FindFiles(coverageFile); files=g.GetFiles(); - if (files.size() > 0) + if (!files.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found Jacoco Files, Performing Coverage" << std::endl); @@ -943,7 +943,7 @@ int cmCTestCoverageHandler::HandleDelphiCoverage( g.FindFiles(coverageFile); files=g.GetFiles(); - if (files.size() > 0) + if (!files.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found Delphi HTML Files, Performing Coverage" << std::endl); @@ -973,7 +973,7 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage( std::vector<std::string> files; g.FindFiles(coverageFile); files=g.GetFiles(); - if (files.size() > 0) + if (!files.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found BlanketJS output JSON, Performing Coverage" << std::endl); diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 2a39051..056554e 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -155,7 +155,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) std::string> >::iterator passIt; bool forceFail = false; bool outputTestErrorsToConsole = false; - if ( this->TestProperties->RequiredRegularExpressions.size() > 0 ) + if (!this->TestProperties->RequiredRegularExpressions.empty()) { bool found = false; for ( passIt = this->TestProperties->RequiredRegularExpressions.begin(); @@ -184,7 +184,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) } reason += "]"; } - if ( this->TestProperties->ErrorRegularExpressions.size() > 0 ) + if (!this->TestProperties->ErrorRegularExpressions.empty()) { for ( passIt = this->TestProperties->ErrorRegularExpressions.begin(); passIt != this->TestProperties->ErrorRegularExpressions.end(); @@ -670,7 +670,7 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, cmSystemTools::SaveRestoreEnvironment sre; #endif - if (environment && environment->size()>0) + if (environment && !environment->empty()) { cmSystemTools::AppendEnv(*environment); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index fea94ba..07bd413 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -273,13 +273,13 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, // Now run off and do what you've been told! res = ::curl_easy_perform(curl); - if ( chunk.size() > 0 ) + if (!chunk.empty()) { cmCTestLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl); } - if ( chunkDebug.size() > 0 ) + if (!chunkDebug.empty()) { cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" @@ -390,7 +390,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, break; default: curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - if (this->HTTPProxyAuth.size() > 0) + if (!this->HTTPProxyAuth.empty()) { curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, this->HTTPProxyAuth.c_str()); @@ -523,14 +523,14 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, chunk.assign(mock_output.begin(), mock_output.end()); } - if ( chunk.size() > 0 ) + if (!chunk.empty()) { cmCTestLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl); this->ParseResponse(chunk); } - if ( chunkDebug.size() > 0 ) + if (!chunkDebug.empty()) { cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" @@ -576,7 +576,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, res = ::curl_easy_perform(curl); - if ( chunk.size() > 0 ) + if (!chunk.empty()) { cmCTestLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" @@ -697,7 +697,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( break; default: curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - if (this->HTTPProxyAuth.size() > 0) + if (!this->HTTPProxyAuth.empty()) { curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, this->HTTPProxyAuth.c_str()); @@ -780,13 +780,13 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( return false; } - if ( chunk.size() > 0 ) + if (!chunk.empty()) { cmCTestLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl); } - if ( chunkDebug.size() > 0 ) + if (!chunkDebug.empty()) { cmCTestLog(this->CTest, DEBUG, "CURL debug output: [" << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) @@ -1140,12 +1140,12 @@ int cmCTestSubmitHandler::ProcessHandler() } } - if ( this->HTTPProxy.size() > 0 ) + if (!this->HTTPProxy.empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use HTTP Proxy: " << this->HTTPProxy << std::endl); } - if ( this->FTPProxy.size() > 0 ) + if (!this->FTPProxy.empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, " Use FTP Proxy: " << this->FTPProxy << std::endl); @@ -1256,12 +1256,12 @@ int cmCTestSubmitHandler::ProcessHandler() this->CTest->GetCTestConfiguration("DropSite") + cmCTest::MakeURLSafe( this->CTest->GetCTestConfiguration("DropLocation")); - if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 ) + if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration( "DropSiteUser").c_str()); - if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 ) + if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); } @@ -1310,12 +1310,12 @@ int cmCTestSubmitHandler::ProcessHandler() cmCTestLog(this->CTest, HANDLER_OUTPUT, " Using HTTP submit method" << std::endl << " Drop site:" << url); - if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 ) + if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { url += this->CTest->GetCTestConfiguration("DropSiteUser"); cmCTestLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration("DropSiteUser").c_str()); - if ( this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0 ) + if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); cmCTestLog(this->CTest, HANDLER_OUTPUT, ":******"); @@ -1400,7 +1400,7 @@ int cmCTestSubmitHandler::ProcessHandler() { std::string url; std::string oldWorkingDirectory; - if ( this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0 ) + if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { url += this->CTest->GetCTestConfiguration("DropSiteUser") + "@"; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index cfb0274..ca8f09f 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -578,7 +578,7 @@ int cmCTestTestHandler::ProcessHandler() } float percent = float(passed.size()) * 100.0f / float(total); - if ( failed.size() > 0 && percent > 99) + if (!failed.empty() && percent > 99) { percent = 99; } diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index 3afbfac..82194b3 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -61,7 +61,7 @@ public: continue; } else if((line.find("end;") != line.npos) - && (beginSet.size() > 0)) + && !beginSet.empty()) { beginSet.pop_back(); coverageVector.push_back(-1); @@ -80,7 +80,7 @@ public: } } //Based up what was found, add a line to the coverageVector - if((beginSet.size() > 0) && line != "" && !blockComFlag + if(!beginSet.empty() && line != "" && !blockComFlag && !lineComFlag) { coverageVector.push_back(0); diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index f270adb..780debc 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -106,7 +106,7 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser { FileLinesType& curFileLines= this->Coverage.TotalCoverage[this->CurFileName]; - if(curFileLines.size() > 0) + if(!curFileLines.empty()) { curFileLines[nr-1] = ci; } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 248efaf..dcd0b6c 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -893,7 +893,7 @@ void cmCursesMainForm::HandleInput() if ( key == 10 || key == KEY_ENTER ) { this->SearchMode = false; - if ( this->SearchString.size() > 0 ) + if (!this->SearchString.empty()) { this->JumpToCacheEntry(this->SearchString.c_str()); this->OldSearchString = this->SearchString; @@ -918,7 +918,7 @@ void cmCursesMainForm::HandleInput() } else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC ) { - if ( this->SearchString.size() > 0 ) + if (!this->SearchString.empty()) { this->SearchString.resize(this->SearchString.size()-1); } @@ -1067,7 +1067,7 @@ void cmCursesMainForm::HandleInput() } else if ( key == 'n' ) { - if ( this->OldSearchString.size() > 0 ) + if (!this->OldSearchString.empty()) { this->JumpToCacheEntry(this->OldSearchString.c_str()); } @@ -1201,7 +1201,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr) int findex = start_index; for(;;) { - if ( str.size() > 0 ) + if (!str.empty()) { cmCursesWidget* lbl = 0; if ( findex >= 0 ) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 76873ad..944d506 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -872,7 +872,7 @@ bool cmCTest::OpenOutputFile(const std::string& path, bool compress) { std::string testingDir = this->BinaryDir + "/Testing"; - if ( path.size() > 0 ) + if (!path.empty()) { testingDir += "/" + path; } @@ -1067,7 +1067,7 @@ int cmCTest::ProcessTests() if ( cmSystemTools::FileExists(fullname.c_str()) && !cmSystemTools::FileIsDirectory(fullname) ) { - if ( this->NotesFiles.size() > 0 ) + if (!this->NotesFiles.empty()) { this->NotesFiles += ";"; } @@ -1266,7 +1266,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::ostream* log, double testTimeOut, std::vector<std::string>* environment) { - bool modifyEnv = (environment && environment->size()>0); + bool modifyEnv = (environment && !environment->empty()); // determine how much time we have double timeout = this->GetRemainingTimeAllowed() - 120; @@ -2936,11 +2936,11 @@ bool cmCTest::RunCommand( } cmsysProcess_WaitForExit(cp, 0); - if ( tempOutput.size() > 0 ) + if (!tempOutput.empty()) { stdOut->append(&*tempOutput.begin(), tempOutput.size()); } - if ( tempError.size() > 0 ) + if (!tempError.empty()) { stdErr->append(&*tempError.begin(), tempError.size()); } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 002e75a..5850338 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -537,7 +537,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) "Result of TRY_COMPILE", cmCacheManager::INTERNAL); - if ( outputVariable.size() > 0 ) + if (!outputVariable.empty()) { this->Makefile->AddDefinition(outputVariable, output.c_str()); } diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 02fb8cb..264a323 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -101,7 +101,7 @@ bool cmCreateTestSourceList break; } std::string func_name; - if (cmSystemTools::GetFilenamePath(*i).size() > 0) + if (!cmSystemTools::GetFilenamePath(*i).empty()) { func_name = cmSystemTools::GetFilenamePath(*i) + "/" + cmSystemTools::GetFilenameWithoutLastExtension(*i); @@ -126,7 +126,7 @@ bool cmCreateTestSourceList for(i = testsBegin, j = tests_func_name.begin(); i != tests.end(); ++i, ++j) { std::string func_name; - if (cmSystemTools::GetFilenamePath(*i).size() > 0) + if (!cmSystemTools::GetFilenamePath(*i).empty()) { func_name = cmSystemTools::GetFilenamePath(*i) + "/" + cmSystemTools::GetFilenameWithoutLastExtension(*i); diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index 02f2d21..d7d052e 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -226,7 +226,7 @@ void cmDependsJavaParserHelper::EndClass() { CurrentClass* parent = 0; CurrentClass* current = 0; - if ( this->ClassStack.size() > 0 ) + if (!this->ClassStack.empty()) { current = &(*(this->ClassStack.end() - 1)); if ( this->ClassStack.size() > 1 ) @@ -305,13 +305,13 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) if ( verb ) { - if ( this->CurrentPackage.size() > 0 ) + if (!this->CurrentPackage.empty()) { std::cout << "Current package is: " << this->CurrentPackage << std::endl; } std::cout << "Imports packages:"; - if ( this->PackagesImport.size() > 0 ) + if (!this->PackagesImport.empty()) { std::vector<std::string>::iterator it; for ( it = this->PackagesImport.begin(); @@ -323,7 +323,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) } std::cout << std::endl; std::cout << "Depends on:"; - if ( this->ClassesFound.size() > 0 ) + if (!this->ClassesFound.empty()) { std::vector<std::string>::iterator it; for ( it = this->ClassesFound.begin(); diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 9b59088..3828468 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -41,7 +41,7 @@ bool cmExecProgramCommand } else if ( haveoutput_variable ) { - if ( output_variable.size() > 0 ) + if (!output_variable.empty()) { this->SetError("called with incorrect number of arguments"); return false; @@ -59,7 +59,7 @@ bool cmExecProgramCommand } else if ( havereturn_variable ) { - if ( return_variable.size() > 0 ) + if (!return_variable.empty()) { this->SetError("called with incorrect number of arguments"); return false; @@ -95,7 +95,7 @@ bool cmExecProgramCommand command = args[0]; } bool verbose = true; - if(output_variable.size() > 0) + if(!output_variable.empty()) { verbose = false; } @@ -118,7 +118,7 @@ bool cmExecProgramCommand retVal = -1; } - if ( output_variable.size() > 0 ) + if (!output_variable.empty()) { std::string::size_type first = output.find_first_not_of(" \n\t\r"); std::string::size_type last = output.find_last_not_of(" \n\t\r"); @@ -135,7 +135,7 @@ bool cmExecProgramCommand this->Makefile->AddDefinition(output_variable, coutput.c_str()); } - if ( return_variable.size() > 0 ) + if (!return_variable.empty()) { char buffer[100]; sprintf(buffer, "%d", retVal); diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 2f69882..387cea6 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1179,7 +1179,7 @@ std::string cmExtraEclipseCDT4Generator::GetPathBasename(const std::string& path) { std::string outputBasename = path; - while (outputBasename.size() > 0 && + while (!outputBasename.empty() && (outputBasename[outputBasename.size() - 1] == '/' || outputBasename[outputBasename.size() - 1] == '\\')) { diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 567542e..9645d0e 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -334,7 +334,7 @@ std::string cmExtraKateGenerator::GenerateProjectName(const std::string& name, std::string cmExtraKateGenerator::GetPathBasename(const std::string& path)const { std::string outputBasename = path; - while (outputBasename.size() > 0 && + while (!outputBasename.empty() && (outputBasename[outputBasename.size() - 1] == '/' || outputBasename[outputBasename.size() - 1] == '\\')) { diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 0306f18..862d1ca 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -336,14 +336,14 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) // is there a limit? long sizeLimit = -1; - if (limitArg.GetString().size() > 0) + if (!limitArg.GetString().empty()) { sizeLimit = atoi(limitArg.GetCString()); } // is there an offset? long offset = 0; - if (offsetArg.GetString().size() > 0) + if (!offsetArg.GetString().empty()) { offset = atoi(offsetArg.GetCString()); } @@ -899,7 +899,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args, { std::string expr = this->Makefile->GetCurrentDirectory(); // Handle script mode - if ( expr.size() > 0 ) + if (!expr.empty()) { expr += "/" + *i; g.FindFiles(expr); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 72737b7..28640fe 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -763,7 +763,7 @@ bool cmFindPackageCommand::HandlePackageMode() } // If there are files in ConsideredConfigs, it means that FooConfig.cmake // have been found, but they didn't have appropriate versions. - else if (this->ConsideredConfigs.size() > 0) + else if (!this->ConsideredConfigs.empty()) { e << "Could not find a configuration file for package \"" << this->Name << "\" that " diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index b213e80..c33048c 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -132,14 +132,14 @@ bool cmFunctionHelperCommand::InvokeInitialPass unsigned int cnt = 0; for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit ) { - if ( argvDef.size() > 0 ) + if (!argvDef.empty()) { argvDef += ";"; } argvDef += *eit; if ( cnt >= this->Args.size()-1 ) { - if ( argnDef.size() > 0 ) + if (!argnDef.empty()) { argnDef += ";"; } diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx index ec15daf..a17da8c 100644 --- a/Source/cmGeneratorExpressionParser.cxx +++ b/Source/cmGeneratorExpressionParser.cxx @@ -39,7 +39,7 @@ void cmGeneratorExpressionParser::Parse( static void extendText(std::vector<cmGeneratorExpressionEvaluator*> &result, std::vector<cmGeneratorExpressionToken>::const_iterator it) { - if (result.size() > 0 + if (!result.empty() && (*(result.end() - 1))->GetType() == cmGeneratorExpressionEvaluator::Text) { @@ -57,7 +57,7 @@ static void extendText(std::vector<cmGeneratorExpressionEvaluator*> &result, static void extendResult(std::vector<cmGeneratorExpressionEvaluator*> &result, const std::vector<cmGeneratorExpressionEvaluator*> &contents) { - if (result.size() > 0 + if (!result.empty() && (*(result.end() - 1))->GetType() == cmGeneratorExpressionEvaluator::Text && (*contents.begin())->GetType() @@ -256,7 +256,7 @@ void cmGeneratorExpressionParser::ParseContent( { if (this->NestingLevel == 0) { - if (result.size() > 0 + if (!result.empty() && (*(result.end() - 1))->GetType() == cmGeneratorExpressionEvaluator::Text) { diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index e88f498..e193cf5 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -33,7 +33,7 @@ bool cmGetCMakePropertyCommand { int cacheonly = 0; std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly); - if (vars.size()>0) + if (!vars.empty()) { output = vars[0]; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d17710e..6373235 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2318,7 +2318,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) cpackCommandLines.end()); depends.erase(depends.begin(), depends.end()); std::ostringstream ostr; - if ( componentsSet->size() > 0 ) + if (!componentsSet->empty()) { ostr << "Available install components are:"; std::set<std::string>::iterator it; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 11a5466..af88d1c 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -125,7 +125,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, __set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS"); this->TargetsToIgnoreRegex.clear(); - if (ignoreTargetsRegexes.size() > 0) + if (!ignoreTargetsRegexes.empty()) { std::vector<std::string> ignoreTargetsRegExVector; cmSystemTools::ExpandListArgument(ignoreTargetsRegexes, diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 9d44db1..d434331 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -40,7 +40,7 @@ bool cmIncludeCommand } else if(args[i] == "RESULT_VARIABLE") { - if (resultVarName.size() > 0) + if (!resultVarName.empty()) { this->SetError("called with invalid arguments: " "only one result variable allowed"); diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index a007693..06a78e5 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -80,7 +80,7 @@ void cmInstallFilesCommand::FinalPass() { // replace any variables std::string temps = *s; - if (cmSystemTools::GetFilenamePath(temps).size() > 0) + if (!cmSystemTools::GetFilenamePath(temps).empty()) { testf = cmSystemTools::GetFilenamePath(temps) + "/" + cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7b54b88..04106dc 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1427,7 +1427,7 @@ std::string cmLocalGenerator::GetIncludeFlags( } std::string flags = includeFlags.str(); // remove trailing separators - if((sep[0] != ' ') && flags.size()>0 && flags[flags.size()-1] == sep[0]) + if((sep[0] != ' ') && !flags.empty() && flags[flags.size()-1] == sep[0]) { flags[flags.size()-1] = ' '; } @@ -2906,7 +2906,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local, assert(in_remote[0] != '\"'); // The local path should never have a trailing slash. - assert(local.size() > 0 && !(local[local.size()-1] == "")); + assert(!local.empty() && !(local[local.size()-1] == "")); // If the path is already relative then just return the path. if(!cmSystemTools::FileIsFullPath(in_remote.c_str())) @@ -2998,7 +2998,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local, // the trailing slash in the output. for(unsigned int i=common; i < remote.size(); ++i) { - if(relative.size() > 0) + if(!relative.empty()) { relative += "/"; } diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 567403f..462e888 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -170,7 +170,7 @@ bool cmMacroHelperCommand::InvokeInitialPass { if ( cnt >= this->Args.size()-1 ) { - if ( argnDef.size() > 0 ) + if (!argnDef.empty()) { argnDef += ";"; } @@ -195,7 +195,7 @@ bool cmMacroHelperCommand::InvokeInitialPass std::vector<std::string>::const_iterator eit; for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit) { - if ( argvDef.size() > 0 ) + if (!argvDef.empty()) { argvDef += ";"; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c96c6da..c6181aa 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3857,7 +3857,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const result = moduleInCMakeRoot; } - if ((moduleInCMakeModulePath.size()>0) && (moduleInCMakeRoot.size()>0)) + if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty()) { const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE"); std::string mods = cmakeRoot + std::string("/Modules/"); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 4244b25..b6aac3c 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1608,7 +1608,7 @@ void cmake::PreLoadCMakeFiles() { std::vector<std::string> args; std::string pre_load = this->GetHomeDirectory(); - if ( pre_load.size() > 0 ) + if (!pre_load.empty()) { pre_load += "/PreLoad.cmake"; if ( cmSystemTools::FileExists(pre_load.c_str()) ) @@ -1617,7 +1617,7 @@ void cmake::PreLoadCMakeFiles() } } pre_load = this->GetHomeOutputDirectory(); - if ( pre_load.size() > 0 ) + if (!pre_load.empty()) { pre_load += "/PreLoad.cmake"; if ( cmSystemTools::FileExists(pre_load.c_str()) ) |