From fd7b37129360364531ddfeda7edb6e34ba773d00 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 15 Jan 2015 23:04:33 +0100 Subject: Replace foo.size() pattern with !foo.empty(). --- Source/CTest/cmCTestBuildAndTestHandler.cxx | 12 ++++++------ Source/CTest/cmCTestBuildHandler.cxx | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 12 ++++++------ Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestMemCheckHandler.cxx | 6 +++--- Source/CTest/cmCTestMultiProcessHandler.cxx | 6 +++--- Source/CTest/cmCTestRunTest.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/CTest/cmCTestSubmitHandler.cxx | 10 +++++----- Source/CTest/cmCTestTestHandler.cxx | 24 ++++++++++++------------ Source/CTest/cmCTestUpdateHandler.cxx | 2 +- Source/CTest/cmParseGTMCoverage.cxx | 2 +- Source/CTest/cmProcess.cxx | 2 +- Source/cmCTest.cxx | 6 +++--- Source/cmCacheManager.cxx | 2 +- Source/cmCoreTryCompile.cxx | 8 ++++---- Source/cmCreateTestSourceList.cxx | 4 ++-- Source/cmDocumentationFormatter.cxx | 2 +- Source/cmExecProgramCommand.cxx | 2 +- Source/cmExecuteProcessCommand.cxx | 4 ++-- Source/cmFileCommand.cxx | 20 ++++++++++---------- Source/cmFindPackageCommand.cxx | 2 +- Source/cmFindPathCommand.cxx | 4 ++-- Source/cmGetFilenameComponentCommand.cxx | 4 ++-- Source/cmGlobalGenerator.cxx | 12 ++++++------ Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmIfCommand.cxx | 4 ++-- Source/cmIncludeCommand.cxx | 4 ++-- Source/cmListCommand.cxx | 2 +- Source/cmLocalGenerator.cxx | 8 ++++---- Source/cmLocalUnixMakefileGenerator3.cxx | 4 ++-- Source/cmMacroCommand.cxx | 2 +- Source/cmMakeDepend.cxx | 6 +++--- Source/cmMakefile.cxx | 8 ++++---- Source/cmRemoveCommand.cxx | 2 +- Source/cmSetCommand.cxx | 2 +- Source/cmTryRunCommand.cxx | 16 ++++++++-------- Source/cmUtilitySourceCommand.cxx | 2 +- Source/cmUuid.cxx | 2 +- Source/cmWhileCommand.cxx | 2 +- Source/cmake.cxx | 6 +++--- 42 files changed, 114 insertions(+), 114 deletions(-) diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 9699d0d..d90aeb7 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -62,7 +62,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, std::vector args; args.push_back(cmSystemTools::GetCMakeCommand()); args.push_back(this->SourceDir); - if(this->BuildGenerator.size()) + if(!this->BuildGenerator.empty()) { std::string generator = "-G"; generator += this->BuildGenerator; @@ -74,7 +74,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, platform += this->BuildGeneratorPlatform; args.push_back(platform); } - if(this->BuildGeneratorToolset.size()) + if(!this->BuildGeneratorToolset.empty()) { std::string toolset = "-T"; toolset += this->BuildGeneratorToolset; @@ -212,7 +212,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::ostringstream out; if ( this->CTest->GetConfigType().empty() && - this->ConfigSample.size()) + !this->ConfigSample.empty()) { // use the config sample to set the ConfigType std::string fullPath; @@ -225,7 +225,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) resultingConfig, extraPaths, failed); - if (fullPath.size() && resultingConfig.size()) + if (!fullPath.empty() && !resultingConfig.empty()) { this->CTest->SetConfigType(resultingConfig.c_str()); } @@ -340,7 +340,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::string resultingConfig; std::vector extraPaths; // if this->ExecutableDirectory is set try that as well - if (this->ExecutableDirectory.size()) + if (!this->ExecutableDirectory.empty()) { std::string tempPath = this->ExecutableDirectory; tempPath += "/"; @@ -388,7 +388,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::string outs; int retval = 0; // 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"; cmSystemTools::ChangeDirectory(this->BuildRunDir); diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 4032499..8f087ab 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -1150,7 +1150,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, { // This is not an error or warning. // So, figure out if this is a post-context line - if ( this->ErrorsAndWarnings.size() && + if ( !this->ErrorsAndWarnings.empty() && this->LastErrorOrWarning != this->ErrorsAndWarnings.end() && this->PostContextCount < this->MaxPostContext ) { diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index f821724..08b7c66 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -87,7 +87,7 @@ public: } args.push_back(0); // null terminate cmsysProcess_SetCommand(this->Process, &*args.begin()); - if(this->WorkingDirectory.size()) + if(!this->WorkingDirectory.empty()) { cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); @@ -270,7 +270,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, std::string ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage", fFile.c_str(), checkDir.c_str()); - if ( ndc.size() ) + if (!ndc.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc << " 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. // If it is the same as fileDir, then ignore, otherwise check. std::string relPath; - if(checkDir.size() ) + if(!checkDir.empty()) { relPath = cmSystemTools::RelativePath(checkDir.c_str(), fFile.c_str()); @@ -309,7 +309,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage", fFile.c_str(), checkDir.c_str()); - if ( ndc.size() ) + if (!ndc.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc << " so skip coverage of: " << file << std::endl); @@ -2183,7 +2183,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( while(cmSystemTools::GetLineFromStream(fin, stdline)) { // if we have a line of output from stdout - if(stdline.size()) + if(!stdline.empty()) { // parse the comma separated output this->ParseBullsEyeCovsrcLine(stdline, @@ -2596,7 +2596,7 @@ std::set cmCTestCoverageHandler::FindUncoveredFiles( } } - if(extraMatches.size()) + if(!extraMatches.empty()) { for(cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i = cont->TotalCoverage.begin(); i != cont->TotalCoverage.end(); ++i) diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 77c5d57..62fa2be 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -720,7 +720,7 @@ bool cmCTestLaunch::Match(std::string const& line, //---------------------------------------------------------------------------- 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())) { return true; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 68c5a92..d4ff24f 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -223,7 +223,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand( this->MemoryTesterEnvironmentVariable; 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 // 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 // argument. - if(memTesterEnvironmentVariable.size()) + if(!memTesterEnvironmentVariable.empty()) { std::string::size_type pos = memTesterEnvironmentVariable.find("??"); if (pos != std::string::npos) @@ -848,7 +848,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( { resultFound = sanitizerWarning.match(1); } - if(resultFound.size()) + if(!resultFound.empty()) { std::vector::size_type idx = this->FindOrAddWarning(resultFound); if(result.empty() || idx > result.size()-1) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 8da9886..f9e8a3c 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -636,7 +636,7 @@ void cmCTestMultiProcessHandler::PrintTestList() testRun.SetTestProperties(&p); 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:"); } @@ -645,7 +645,7 @@ void cmCTestMultiProcessHandler::PrintTestList() { 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); } @@ -683,7 +683,7 @@ void cmCTestMultiProcessHandler::PrintLabels() allLabels.insert(p.Labels.begin(), p.Labels.end()); } - if(allLabels.size()) + if(!allLabels.empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl); } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 056554e..314c8ad 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -318,7 +318,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) *this->TestHandler->LogFile << "----------------------------------------------------------" << std::endl; - if(this->TestResult.Reason.size()) + if(!this->TestResult.Reason.empty()) { *this->TestHandler->LogFile << reasonType << ":\n" << this->TestResult.Reason << "\n"; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 71edd5b..8184bb4 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -415,7 +415,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->UpdateElapsedTime(); // add the script arg if defined - if (script_arg.size()) + if (!script_arg.empty()) { this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str()); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 2ed4b57..bc6fb31 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -61,7 +61,7 @@ private: std::string GetCurrentValue() { std::string val; - if(this->CurrentValue.size()) + if(!this->CurrentValue.empty()) { val.assign(&this->CurrentValue[0], this->CurrentValue.size()); } @@ -301,7 +301,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, << error_buffer << std::endl << " Curl output was: "; // avoid dereference of empty vector - if(chunk.size()) + if(!chunk.empty()) { *this->LogFile << cmCTestLogWrite(&*chunk.begin(), chunk.size()); cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: [" @@ -605,7 +605,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, << " Error message was: " << error_buffer << std::endl; // avoid deref of begin for zero size array - if(chunk.size()) + if(!chunk.empty()) { *this->LogFile << " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) @@ -766,7 +766,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( << std::endl << " Error message was: " << error_buffer << std::endl; - if(chunk.size()) + if(!chunk.empty()) { *this->LogFile << " Curl output was: " @@ -1060,7 +1060,7 @@ int cmCTestSubmitHandler::ProcessHandler() { std::string iscdash = this->CTest->GetCTestConfiguration("IsCDash"); // cdash does not need to trigger so just return true - if(iscdash.size()) + if(!iscdash.empty()) { this->CDash = true; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2896a50..925e3c9 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -564,7 +564,7 @@ int cmCTestTestHandler::ProcessHandler() } else { - if (this->HandlerVerbose && passed.size() && + if (this->HandlerVerbose && !passed.empty() && (this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag)) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl @@ -596,7 +596,7 @@ int cmCTestTestHandler::ProcessHandler() cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " << realBuf << "\n" ); - if (failed.size()) + if (!failed.empty()) { cmGeneratedFileStream ofs; cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl @@ -698,7 +698,7 @@ void cmCTestTestHandler::PrintLabelSummary() } } // now print times - if(labels.size()) + if(!labels.empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); } @@ -717,7 +717,7 @@ void cmCTestTestHandler::PrintLabelSummary() << buf << "\n"; } } - if(labels.size()) + if(!labels.empty()) { if(this->LogFile) { @@ -850,7 +850,7 @@ void cmCTestTestHandler::ComputeTestList() if (this->UseUnion) { // 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) == this->TestsToRun.end()) && !it->IsInBasedOnREOptions) { @@ -860,7 +860,7 @@ void cmCTestTestHandler::ComputeTestList() else { // 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(), this->TestsToRun.end(), inREcnt) == this->TestsToRun.end()) || !it->IsInBasedOnREOptions) @@ -891,7 +891,7 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed() cnt ++; // 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) == this->TestsToRun.end())) { @@ -1094,7 +1094,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, p.Timeout = this->CTest->GetGlobalTimeout(); } - if(p.Depends.size()) + if(!p.Depends.empty()) { for(std::vector::iterator i = p.Depends.begin(); i != p.Depends.end(); ++i) @@ -1192,7 +1192,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) << "name=\"Execution Time\">" << result->ExecutionTime << "\n"; - if(result->Reason.size()) + if(!result->Reason.empty()) { const char* reasonType = "Pass Reason"; if(result->Status != cmCTestTestHandler::COMPLETED && @@ -1376,7 +1376,7 @@ void cmCTestTestHandler { std::string tempPath; - if (filepath.size() && + if (!filepath.empty() && filepath[filepath.size()-1] != '/') { filepath += "/"; @@ -1385,7 +1385,7 @@ void cmCTestTestHandler attempted.push_back(tempPath); attemptedConfigs.push_back(""); - if(ctest->GetConfigType().size()) + if(!ctest->GetConfigType().empty()) { tempPath = filepath; tempPath += ctest->GetConfigType(); @@ -1463,7 +1463,7 @@ std::string cmCTestTestHandler // even if a fullpath was specified also try it relative to the current // directory - if (filepath.size() && filepath[0] == '/') + if (!filepath.empty() && filepath[0] == '/') { std::string localfilepath = filepath.substr(1,filepath.size()-1); cmCTestTestHandler::AddConfigurations(ctest, attempted, diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 772c9aa..4c37c8b 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -94,7 +94,7 @@ cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale() { // restore the value of LC_MESSAGES after running the version control // commands - if(saveLCMessages.size()) + if(!saveLCMessages.empty()) { std::string put = "LC_MESSAGES="; put += saveLCMessages; diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index d77244a..f3f8008 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -80,7 +80,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file) // no need to search the file if we just did it if(function == lastfunction && lastroutine == routine) { - if(lastpath.size()) + if(!lastpath.empty()) { this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber] += count; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index ca1ed8b..e1bd02b 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -56,7 +56,7 @@ bool cmProcess::StartProcess() this->ProcessArgs.push_back(0); // null terminate the list this->Process = cmsysProcess_New(); cmsysProcess_SetCommand(this->Process, &*this->ProcessArgs.begin()); - if(this->WorkingDirectory.size()) + if(!this->WorkingDirectory.empty()) { cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index b7e049d..1ef4c92 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -212,7 +212,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method, ::curl_easy_setopt(curl, CURLOPT_INFILE, file); //fall through to append GET fields case cmCTest::HTTP_GET: - if(fields.size()) + if(!fields.empty()) { url += "?" + fields; } @@ -1080,7 +1080,7 @@ int cmCTest::ProcessTests() if (this->Parts[PartNotes]) { this->UpdateCTestConfiguration(); - if ( this->NotesFiles.size() ) + if (!this->NotesFiles.empty()) { this->GenerateNotesFile(this->NotesFiles.c_str()); } @@ -3136,7 +3136,7 @@ double cmCTest::GetRemainingTimeAllowed() void cmCTest::OutputTestErrors(std::vector const &process_output) { 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()); } diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 6a47ea7..45e92ce 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -609,7 +609,7 @@ void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key) void cmCacheManager::OutputValue(std::ostream& fout, std::string const& value) { // 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] == '\t')) { diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 5850338..60d8dd9 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -201,13 +201,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) else { // only valid for srcfile signatures - if (compileDefs.size()) + if (!compileDefs.empty()) { this->Makefile->IssueMessage(cmake::FATAL_ERROR, "COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE"); return -1; } - if (copyFile.size()) + if (!copyFile.empty()) { this->Makefile->IssueMessage(cmake::FATAL_ERROR, "COPY_FILE specified on a srcdir type TRY_COMPILE"); @@ -371,7 +371,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n"); fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n"); // handle any compile flags we need to pass on - if (compileDefs.size()) + if (!compileDefs.empty()) { fprintf(fout, "add_definitions( "); for (size_t i = 0; i < compileDefs.size(); ++i) @@ -547,7 +547,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) std::string copyFileErrorMessage; this->FindOutputFile(targetName); - if ((res==0) && (copyFile.size())) + if ((res==0) && !copyFile.empty()) { if(this->OutputFile.empty() || !cmSystemTools::CopyFileAlways(this->OutputFile, diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 264a323..f93d3df 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -145,12 +145,12 @@ bool cmCreateTestSourceList " },\n"; numTests++; } - if(extraInclude.size()) + if(!extraInclude.empty()) { this->Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES", extraInclude.c_str()); } - if(function.size()) + if(!function.empty()) { this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION", function.c_str()); diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 29c806d..adf29b1 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -201,7 +201,7 @@ void cmDocumentationFormatter for(std::vector::const_iterator op = entries.begin(); op != entries.end(); ++op) { - if(op->Name.size()) + if(!op->Name.empty()) { os << " " << op->Name; this->TextIndent = " "; diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 3828468..e021d0b 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -84,7 +84,7 @@ bool cmExecProgramCommand } std::string command; - if(arguments.size()) + if(!arguments.empty()) { command = cmSystemTools::ConvertToRunCommandPath(args[0].c_str()); command += " "; diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 0707906..1225992 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -324,12 +324,12 @@ bool cmExecuteProcessCommand error_strip_trailing_whitespace); // Store the output obtained. - if(!output_variable.empty() && tempOutput.size()) + if(!output_variable.empty() && !tempOutput.empty()) { this->Makefile->AddDefinition(output_variable, &*tempOutput.begin()); } - if(!merge_output && !error_variable.empty() && tempError.size()) + if(!merge_output && !error_variable.empty() && !tempError.empty()) { this->Makefile->AddDefinition(error_variable, &*tempError.begin()); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 416dd3e..aab256a 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2992,7 +2992,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) msg = "returning early; file already exists with expected "; msg += hashMatchMSG; msg += "\""; - if(statusVar.size()) + if(!statusVar.empty()) { std::ostringstream result; result << (int)0 << ";\"" << msg; @@ -3085,7 +3085,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); check_curl_result(res, "DOWNLOAD cannot set follow-redirect option: "); - if(verboseLog.size()) + if(!verboseLog.empty()) { res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); check_curl_result(res, "DOWNLOAD cannot set verbose: "); @@ -3131,7 +3131,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) g_curl.release(); ::curl_easy_cleanup(curl); - if(statusVar.size()) + if(!statusVar.empty()) { std::ostringstream result; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\""; @@ -3172,14 +3172,14 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) } } - if(chunkDebug.size()) + if(!chunkDebug.empty()) { chunkDebug.push_back(0); if(CURLE_OPERATION_TIMEOUTED == res) { std::string output = &*chunkDebug.begin(); - if(verboseLog.size()) + if(!verboseLog.empty()) { this->Makefile->AddDefinition(verboseLog, &*chunkDebug.begin()); @@ -3335,7 +3335,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); check_curl_result(res, "UPLOAD cannot set follow-redirect option: "); - if(logVar.size()) + if(!logVar.empty()) { res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); check_curl_result(res, "UPLOAD cannot set verbose: "); @@ -3390,7 +3390,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) g_curl.release(); ::curl_easy_cleanup(curl); - if(statusVar.size()) + if(!statusVar.empty()) { std::ostringstream result; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\""; @@ -3403,11 +3403,11 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) fclose(fin); fin = NULL; - if(logVar.size()) + if(!logVar.empty()) { std::string log; - if(chunkResponse.size()) + if(!chunkResponse.empty()) { chunkResponse.push_back(0); log += "Response:\n"; @@ -3415,7 +3415,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) log += "\n"; } - if(chunkDebug.size()) + if(!chunkDebug.empty()) { chunkDebug.push_back(0); log += "Debug:\n"; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 28640fe..7746980 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -622,7 +622,7 @@ bool cmFindPackageCommand::FindModule(bool& found) module += this->Name; module += ".cmake"; std::string mfile = this->Makefile->GetModulesFile(module.c_str()); - if ( mfile.size() ) + if (!mfile.empty()) { // Load the module we found, and set "_FIND_MODULE" to true // while inside it. diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 1490710..49fbf45 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -108,7 +108,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, fileName = file; frameWorkName = ""; } - if(frameWorkName.size()) + if(!frameWorkName.empty()) { std::string fpath = dir; fpath += frameWorkName; @@ -134,7 +134,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, cmsys::Glob globIt; globIt.FindFiles(glob); std::vector files = globIt.GetFiles(); - if(files.size()) + if(!files.empty()) { std::string fheader = cmSystemTools::CollapseFullPath(files[0]); if(this->IncludeFileInPath) diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index e7d2857..9aceb39 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -113,7 +113,7 @@ bool cmGetFilenameComponentCommand if(args.size() == 4 && args[3] == "CACHE") { - if(programArgs.size() && storeArgs.size()) + if(!programArgs.empty() && !storeArgs.empty()) { this->Makefile->AddCacheDefinition (storeArgs, programArgs.c_str(), @@ -127,7 +127,7 @@ bool cmGetFilenameComponentCommand } else { - if(programArgs.size() && storeArgs.size()) + if(!programArgs.empty() && !storeArgs.empty()) { this->Makefile->AddDefinition(storeArgs, programArgs.c_str()); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 5ebc7cc..f8eaf8a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -276,7 +276,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) { std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile.c_str()); - if(setMakeProgram.size()) + if(!setMakeProgram.empty()) { mf->ReadListFile(0, setMakeProgram.c_str()); } @@ -426,7 +426,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, // If the configuration files path has been set, // 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 - if(this->ConfiguredFilesPath.size()) + if(!this->ConfiguredFilesPath.empty()) { rootBin = this->ConfiguredFilesPath; } @@ -1636,7 +1636,7 @@ void cmGlobalGenerator::CheckLocalGenerators() static_cast(this->LocalGenerators.size())); } - if(notFoundMap.size()) + if(!notFoundMap.empty()) { std::string notFoundVars; for(std::map::const_iterator @@ -2460,19 +2460,19 @@ void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf) locations.push_back("c:/mingw/bin"); std::string tgcc = cmSystemTools::FindProgram("gcc", locations); std::string gcc = "gcc.exe"; - if(tgcc.size()) + if(!tgcc.empty()) { gcc = tgcc; } std::string tgxx = cmSystemTools::FindProgram("g++", locations); std::string gxx = "g++.exe"; - if(tgxx.size()) + if(!tgxx.empty()) { gxx = tgxx; } std::string trc = cmSystemTools::FindProgram("windres", locations); std::string rc = "windres.exe"; - if(trc.size()) + if(!trc.empty()) { rc = trc; } diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index ee0c583..b9c01fa 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -236,7 +236,7 @@ bool cmGlobalKdevelopGenerator // make it relative to the project dir cmSystemTools::ReplaceString(tmp, projectDir.c_str(), ""); // only put relative paths - if (tmp.size() && tmp[0] != '/') + if (!tmp.empty() && tmp[0] != '/') { fout << tmp.c_str() <<"\n"; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a867ab3..5f1bb83 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -572,7 +572,7 @@ void cmGlobalUnixMakefileGenerator3 if (!targetName.empty()) { cmLocalUnixMakefileGenerator3 *lg; - if (this->LocalGenerators.size()) + if (!this->LocalGenerators.empty()) { lg = static_cast (this->LocalGenerators[0]); diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index da62eca..3362abb 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -116,7 +116,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, bool isTrue = conditionEvaluator.IsTrue( expandedArguments, errorString, messType); - if (errorString.size()) + if (!errorString.empty()) { std::string err = cmIfCommandError(&mf, expandedArguments); err += errorString; @@ -204,7 +204,7 @@ bool cmIfCommand bool isTrue = conditionEvaluator.IsTrue( expandedArguments, errorString, status); - if (errorString.size()) + if (!errorString.empty()) { std::string err = cmIfCommandError(this->Makefile, expandedArguments); err += errorString; diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index d434331..c15d46e 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -83,7 +83,7 @@ bool cmIncludeCommand std::string module = fname; module += ".cmake"; std::string mfile = this->Makefile->GetModulesFile(module.c_str()); - if ( mfile.size() ) + if (!mfile.empty()) { fname = mfile.c_str(); } @@ -137,7 +137,7 @@ bool cmIncludeCommand noPolicyScope); // add the location of the included file if a result variable was given - if (resultVarName.size()) + if (!resultVarName.empty()) { this->Makefile->AddDefinition(resultVarName, readit?fullFilePath.c_str():"NOTFOUND"); diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 98a2632..85413ca 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -257,7 +257,7 @@ bool cmListCommand::HandleAppendCommand(std::vector const& args) size_t cc; for ( cc = 2; cc < args.size(); ++ cc ) { - if(listString.size()) + if(!listString.empty()) { listString += ";"; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cb52ffb..0cbbdab 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -936,7 +936,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, if(variable == "TARGET_QUOTED") { std::string targetQuoted = replaceValues.Target; - if(targetQuoted.size() && targetQuoted[0] != '\"') + if(!targetQuoted.empty() && targetQuoted[0] != '\"') { targetQuoted = '\"'; targetQuoted += replaceValues.Target; @@ -1414,12 +1414,12 @@ std::string cmLocalGenerator::GetIncludeFlags( } std::string includePath = this->ConvertToIncludeReference(*i, shellFormat, forceFullPaths); - if(quotePaths && includePath.size() && includePath[0] != '\"') + if(quotePaths && !includePath.empty() && includePath[0] != '\"') { includeFlags << "\""; } includeFlags << includePath; - if(quotePaths && includePath.size() && includePath[0] != '\"') + if(quotePaths && !includePath.empty() && includePath[0] != '\"') { includeFlags << "\""; } @@ -2514,7 +2514,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags, { if(!newFlags.empty()) { - if(flags.size()) + if(!flags.empty()) { flags += " "; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index ebaee37..d4ba89a 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1160,7 +1160,7 @@ cmLocalUnixMakefileGenerator3 { // Build the command line in a single string. std::string cmd = ccg.GetCommand(c); - if (cmd.size()) + if (!cmd.empty()) { // Use "call " before any invocations of .bat or .cmd files // invoked as custom commands in the WindowsShell. @@ -2173,7 +2173,7 @@ cmLocalUnixMakefileGenerator3 cmd += " "; // Pass down verbosity level. - if(this->GetMakeSilentFlag().size()) + if(!this->GetMakeSilentFlag().empty()) { cmd += this->GetMakeSilentFlag(); cmd += " "; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 462e888..69fcca7 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -116,7 +116,7 @@ bool cmMacroHelperCommand::InvokeInitialPass std::string argnDef; bool argnDefInitialized = false; bool argvDefInitialized = false; - if( this->Functions.size()) + if(!this->Functions.empty()) { this->FilePath = this->Functions[0].FilePath; } diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 54b8535..31bbb73 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -175,7 +175,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) t != this->IncludeDirectories.end(); ++t) { std::string incpath = *t; - if (incpath.size() && incpath[incpath.size() - 1] != '/') + if (!incpath.empty() && incpath[incpath.size() - 1] != '/') { incpath = incpath + "/"; } @@ -318,7 +318,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) i != this->IncludeDirectories.end(); ++i) { std::string path = *i; - if (path.size() && path[path.size() - 1] != '/') + if (!path.empty() && path[path.size() - 1] != '/') { path = path + "/"; } @@ -335,7 +335,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) if (extraPath) { std::string path = extraPath; - if (path.size() && path[path.size() - 1] != '/') + if (!path.empty() && path[path.size() - 1] != '/') { path = path + "/"; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 67efdc5..87e62d7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1798,7 +1798,7 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value) } this->Internal->VarStack.top().Set(name, value); - if (this->Internal->VarUsageStack.size() && + if (!this->Internal->VarUsageStack.empty() && this->VariableInitialized(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) { this->Internal->VarStack.top().Set(name, value? "ON" : "OFF"); - if (this->Internal->VarUsageStack.size() && + if (!this->Internal->VarUsageStack.empty() && this->VariableInitialized(name)) { this->CheckForUnused("changing definition", name); @@ -1937,7 +1937,7 @@ void cmMakefile::CheckForUnused(const char* reason, { std::string path; cmListFileBacktrace bt(this->GetLocalGenerator()); - if (this->CallStack.size()) + if (!this->CallStack.empty()) { const cmListFileContext* file = this->CallStack.back().Context; bt.push_back(*file); @@ -1972,7 +1972,7 @@ void cmMakefile::CheckForUnused(const char* reason, void cmMakefile::RemoveDefinition(const std::string& name) { this->Internal->VarStack.top().Set(name, 0); - if (this->Internal->VarUsageStack.size() && + if (!this->Internal->VarUsageStack.empty() && this->VariableInitialized(name)) { this->CheckForUnused("unsetting", name); diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx index d8aa1cb..bad38be 100644 --- a/Source/cmRemoveCommand.cxx +++ b/Source/cmRemoveCommand.cxx @@ -57,7 +57,7 @@ bool cmRemoveCommand } if (!found) { - if (value.size()) + if (!value.empty()) { value += ";"; } diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 176a08d..90d7b03 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -37,7 +37,7 @@ bool cmSetCommand delete [] varName; // 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 if (!currValue || strcmp(currValue,args[1].c_str())) diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index a2f079a..3daf61e 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -104,8 +104,8 @@ bool cmTryRunCommand // although they could be used together, don't allow it, because // using OUTPUT_VARIABLE makes crosscompiling harder if (this->OutputVariable.size() - && ((this->RunOutputVariable.size()) - || (this->CompileOutputVariable.size()))) + && (!this->RunOutputVariable.empty() + || !this->CompileOutputVariable.empty())) { cmSystemTools::Error( "You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE " @@ -115,18 +115,18 @@ bool cmTryRunCommand } bool captureRunOutput = false; - if (this->OutputVariable.size()) + if (!this->OutputVariable.empty()) { captureRunOutput = true; tryCompile.push_back("OUTPUT_VARIABLE"); tryCompile.push_back(this->OutputVariable); } - if (this->CompileOutputVariable.size()) + if (!this->CompileOutputVariable.empty()) { tryCompile.push_back("OUTPUT_VARIABLE"); tryCompile.push_back(this->CompileOutputVariable); } - if (this->RunOutputVariable.size()) + if (!this->RunOutputVariable.empty()) { captureRunOutput = true; } @@ -160,13 +160,13 @@ bool cmTryRunCommand } // now put the output into the variables - if(this->RunOutputVariable.size()) + if(!this->RunOutputVariable.empty()) { this->Makefile->AddDefinition(this->RunOutputVariable, runOutputContents.c_str()); } - if(this->OutputVariable.size()) + if(!this->OutputVariable.empty()) { // if the TryCompileCore saved output in this outputVariable then // prepend that output to this output @@ -196,7 +196,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, int retVal = -1; std::string finalCommand = cmSystemTools::ConvertToRunCommandPath( this->OutputFile.c_str()); - if (runArgs.size()) + if (!runArgs.empty()) { finalCommand += runArgs; } diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index ba6b4ac..ee1ff29 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -95,7 +95,7 @@ bool cmUtilitySourceCommand { exePath = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"); } - if(exePath.size()) + if(!exePath.empty()) { utilityDirectory = exePath; } diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx index 8b5b7ae..e2d0049 100644 --- a/Source/cmUuid.cxx +++ b/Source/cmUuid.cxx @@ -66,7 +66,7 @@ void cmUuid::CreateHashInput(std::vector const& uuidNamespace, { output = uuidNamespace; - if(name.size()) + if(!name.empty()) { output.resize(output.size() + name.size()); diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 8c230a4..5170ead 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -47,7 +47,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, while (isTrue) { - if (errorString.size()) + if (!errorString.empty()) { std::string err = "had incorrect arguments: "; unsigned int i; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c03f01d..2a2f2ab 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1123,13 +1123,13 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) // restore the original environment variables CXX and CC // Restore CC std::string env = "CC="; - if(this->CCEnvironment.size()) + if(!this->CCEnvironment.empty()) { env += this->CCEnvironment; } cmSystemTools::PutEnv(env); env = "CXX="; - if(this->CXXEnvironment.size()) + if(!this->CXXEnvironment.empty()) { env += this->CXXEnvironment; } @@ -2277,7 +2277,7 @@ const char *cmake::GetProperty(const std::string& prop, this->GetCacheManager()->GetCacheIterator(); for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) { - if ( output.size() ) + if (!output.empty()) { output += ";"; } -- cgit v0.12