diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 8d7c71615..594795995 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -412,7 +412,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) // Report progress else if (strcmp(argv[i], "--report-progress") == 0) { - _settings->reportProgressTime = 10; + _settings->reportProgress = true; } // --std diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 085b6d8ba..ad95b0eeb 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -161,7 +161,7 @@ int CppCheckExecutor::check(int argc, const char* const argv[]) return EXIT_FAILURE; } - if (_settings.reportProgressTime > 0) + if (cppCheck.settings().reportProgress) time1 = std::time(0); _settings = cppCheck.settings(); @@ -247,12 +247,12 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st { (void)filename; - if (_settings.reportProgressTime == 0) + if (!time1) return; // Report progress messages every 10 seconds const std::time_t time2 = std::time(NULL); - if (time2 >= (time1 + _settings.reportProgressTime)) { + if (time2 >= (time1 + 10)) { time1 = time2; // current time in the format "Www Mmm dd hh:mm:ss yyyy" diff --git a/lib/settings.cpp b/lib/settings.cpp index 118fc8004..4e5595bde 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -43,7 +43,7 @@ Settings::Settings() inconclusive = false; experimental = false; test_2_pass = false; - reportProgressTime = 0; + reportProgress = false; ifcfg = false; checkConfiguration = false; diff --git a/lib/settings.h b/lib/settings.h index f110ee62d..d11536e96 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -156,8 +156,8 @@ public: /** @brief Experimental 2 pass checking of files */ bool test_2_pass; - /** @brief 0 => don't report progress. 1-.. => report progress every T seconds */ - unsigned char reportProgressTime; + /** @brief --report-progress */ + bool reportProgress; /** * @brief Is there any preprocessor configurations in the source code? diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 13ac98063..d3bce588f 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -616,7 +616,7 @@ private: Settings settings; CmdLineParser parser(&settings); ASSERT(parser.ParseFromArgs(3, argv)); - ASSERT_EQUALS(10U, settings.reportProgressTime); + ASSERT(settings.reportProgress); } void stdposix() {