diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2019-02-11 15:30:00 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2019-02-11 15:32:43 (GMT) |
commit | 950c099d83757acd57cec78a3579ea1f6aaddf96 (patch) | |
tree | 87862c59076f42dc9c4be9c8c002e1fccfdb90cd /Source/CursesDialog | |
parent | 8a1d25afdf92cabab88598cc9b9e5a9fb2a9493b (diff) | |
download | CMake-950c099d83757acd57cec78a3579ea1f6aaddf96.zip CMake-950c099d83757acd57cec78a3579ea1f6aaddf96.tar.gz CMake-950c099d83757acd57cec78a3579ea1f6aaddf96.tar.bz2 |
cmake: Progress functions use `std::string` param
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 076ee3d..ec18ece 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -501,14 +501,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); @@ -528,7 +528,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(); @@ -598,7 +600,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 |