diff options
author | Brad King <brad.king@kitware.com> | 2019-02-12 13:28:43 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-02-12 13:30:13 (GMT) |
commit | 20afd497c92f66883de5dae92e2105c2f0cb4f70 (patch) | |
tree | e466ac318883d07a73f3e0cea1f26f1b4443569f /Source/CursesDialog | |
parent | a7a85719332b5be90bb9ce1f3707a767197566c0 (diff) | |
parent | 950c099d83757acd57cec78a3579ea1f6aaddf96 (diff) | |
download | CMake-20afd497c92f66883de5dae92e2105c2f0cb4f70.zip CMake-20afd497c92f66883de5dae92e2105c2f0cb4f70.tar.gz CMake-20afd497c92f66883de5dae92e2105c2f0cb4f70.tar.bz2 |
Merge topic 'progress-stdstring'
950c099d83 cmake: Progress functions use `std::string` param
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2948
Diffstat (limited to 'Source/CursesDialog')
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 14 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.h | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 89061a4..3fe1834 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -490,14 +490,14 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) pos_form_cursor(this->Form); } -void cmCursesMainForm::UpdateProgress(const char* msg, float prog) +void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog) { char tmp[1024]; const char* cmsg = tmp; if (prog >= 0) { - sprintf(tmp, "%s %i%%", msg, static_cast<int>(100 * prog)); + sprintf(tmp, "%s %i%%", msg.c_str(), static_cast<int>(100 * prog)); } else { - cmsg = msg; + cmsg = msg.c_str(); } this->UpdateStatusBar(cmsg); this->PrintKeys(1); @@ -517,7 +517,9 @@ int cmCursesMainForm::Configure(int noconfigure) touchwin(stdscr); refresh(); this->CMakeInstance->SetProgressCallback( - [this](const char* msg, float prog) { this->UpdateProgress(msg, prog); }); + [this](const std::string& msg, float prog) { + this->UpdateProgress(msg, prog); + }); // always save the current gui values to disk this->FillCacheManagerFromUI(); @@ -587,7 +589,9 @@ int cmCursesMainForm::Generate() touchwin(stdscr); refresh(); this->CMakeInstance->SetProgressCallback( - [this](const char* msg, float prog) { this->UpdateProgress(msg, prog); }); + [this](const std::string& msg, float prog) { + this->UpdateProgress(msg, prog); + }); // Get rid of previous errors this->Errors = std::vector<std::string>(); diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index c09ce2a..d379975 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -102,7 +102,7 @@ public: /** * Progress callback */ - void UpdateProgress(const char* msg, float prog); + void UpdateProgress(const std::string& msg, float prog); protected: // Copy the cache values from the user interface to the actual |