Merge topic 'progress-stdstring'

950c099d83 cmake: Progress functions use `std::string` param

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2948
This commit is contained in:
Brad King
2019-02-12 13:28:43 +00:00
committed by Kitware Robot
22 changed files with 58 additions and 50 deletions

View File

@@ -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>();

View File

@@ -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