diff options
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CursesDialog/ccmake.cxx | 2 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesForm.h | 4 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 3 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.h | 2 | ||||
-rw-r--r-- | Source/QtDialog/QCMake.cxx | 6 | ||||
-rw-r--r-- | Source/QtDialog/QCMake.h | 2 | ||||
-rw-r--r-- | Source/cmServer.cxx | 7 | ||||
-rw-r--r-- | Source/cmServer.h | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 6 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 8 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 25 |
12 files changed, 35 insertions, 34 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 2fd4c7a..3856569 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -118,7 +118,7 @@ public: : CM(cm) { cmSystemTools::SetMessageCallback( - [&s](const char* msg, const char* /*unused*/) { + [&s](const std::string& msg, const char* /*unused*/) { s += msg; s += "\n"; }); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index f2982a6..745c6bb 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -150,7 +150,7 @@ int main(int argc, char const* const* argv) } cmSystemTools::SetMessageCallback( - [myform](const char* message, const char* title) { + [myform](const std::string& message, const char* title) { myform->AddError(message, title); }); diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h index ddb67de..7842905 100644 --- a/Source/CursesDialog/cmCursesForm.h +++ b/Source/CursesDialog/cmCursesForm.h @@ -9,6 +9,8 @@ #include "cmsys/FStream.hxx" +#include <string> + class cmCursesForm { public: @@ -34,7 +36,7 @@ public: // Description: // During a CMake run, an error handle should add errors // to be displayed afterwards. - virtual void AddError(const char*, const char*) {} + virtual void AddError(const std::string&, const char*) {} // Description: // Turn debugging on. This will create ccmakelog.txt. diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 8ca7802..f6a1a57 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -647,7 +647,8 @@ int cmCursesMainForm::Generate() return 0; } -void cmCursesMainForm::AddError(const char* message, const char* /*unused*/) +void cmCursesMainForm::AddError(const std::string& message, + const char* /*unused*/) { this->Errors.emplace_back(message); } diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index cc6482f..c09ce2a 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -81,7 +81,7 @@ public: * During a CMake run, an error handle should add errors * to be displayed afterwards. */ - void AddError(const char* message, const char* title) override; + void AddError(const std::string& message, const char* title) override; /** * Used to do a configure. If argument is specified, it does only the check diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index a073c30..6442d05 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -25,7 +25,7 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetRunCommandHideConsole(true); cmSystemTools::SetMessageCallback( - [this](const char* msg, const char* title) { + [this](std::string const& msg, const char* title) { this->messageCallback(msg, title); }); cmSystemTools::SetStdoutCallback( @@ -359,9 +359,9 @@ void QCMake::progressCallback(const char* msg, float percent) QCoreApplication::processEvents(); } -void QCMake::messageCallback(const char* msg, const char* /*title*/) +void QCMake::messageCallback(std::string const& msg, const char* /*title*/) { - emit this->errorMessage(QString::fromLocal8Bit(msg)); + emit this->errorMessage(QString::fromStdString(msg)); QCoreApplication::processEvents(); } diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index ef4d2a1..8492606 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -169,7 +169,7 @@ protected: bool interruptCallback(); void progressCallback(const char* msg, float percent); - void messageCallback(const char* msg, const char* title); + void messageCallback(std::string const& msg, const char* title); void stdoutCallback(std::string const& msg); void stderrCallback(std::string const& msg); diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index e740c05..719e6b1 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -97,7 +97,7 @@ void cmServer::ProcessRequest(cmConnection* connection, } cmSystemTools::SetMessageCallback( - [&request](const char* msg, const char* title) { + [&request](const std::string& msg, const char* title) { reportMessage(msg, title, request); }); @@ -165,15 +165,14 @@ void cmServer::reportProgress(const char* msg, float progress, } } -void cmServer::reportMessage(const char* msg, const char* title, +void cmServer::reportMessage(const std::string& msg, const char* title, const cmServerRequest& request) { - assert(msg); std::string titleString; if (title) { titleString = title; } - request.ReportMessage(std::string(msg), titleString); + request.ReportMessage(msg, titleString); } cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request) diff --git a/Source/cmServer.h b/Source/cmServer.h index e1ed27a..3edc887 100644 --- a/Source/cmServer.h +++ b/Source/cmServer.h @@ -121,7 +121,7 @@ public: private: static void reportProgress(const char* msg, float progress, const cmServerRequest& request); - static void reportMessage(const char* msg, const char* title, + static void reportMessage(const std::string& msg, const char* title, const cmServerRequest& request); // Handle requests: diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 1d20e2f..ec38b65 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -323,16 +323,16 @@ void cmSystemTools::Stdout(const std::string& s) } } -void cmSystemTools::Message(const char* m1, const char* title) +void cmSystemTools::Message(const std::string& m, const char* title) { if (s_DisableMessages) { return; } if (s_MessageCallback) { - s_MessageCallback(m1, title); + s_MessageCallback(m, title); return; } - std::cerr << m1 << std::endl << std::flush; + std::cerr << m << std::endl << std::flush; } void cmSystemTools::ReportLastSystemError(const char* msg) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 0f92fe2..75860bc 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -56,7 +56,7 @@ public: */ static std::string TrimWhitespace(const std::string& s); - using MessageCallback = std::function<void(const char*, const char*)>; + using MessageCallback = std::function<void(const std::string&, const char*)>; /** * Set the function used by GUIs to display error messages * Function gets passed: message as a const char*, @@ -74,11 +74,7 @@ public: /** * Display a message. */ - static void Message(const char* m, const char* title = nullptr); - static void Message(const std::string& m, const char* title = nullptr) - { - Message(m.c_str(), title); - } + static void Message(const std::string& m, const char* title = nullptr); using OutputCallback = std::function<void(std::string const&)>; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 890b74e..a49246b 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -142,8 +142,8 @@ static std::string cmakemainGetStack(cmake* cm) return msg; } -static void cmakemainMessageCallback(const char* m, const char* /*unused*/, - cmake* cm) +static void cmakemainMessageCallback(const std::string& m, + const char* /*unused*/, cmake* cm) { std::cerr << m << cmakemainGetStack(cm) << std::endl << std::flush; } @@ -319,9 +319,10 @@ int do_cmake(int ac, char const* const* av) cmake cm(role, mode); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); - cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) { - cmakemainMessageCallback(msg, title, &cm); - }); + cmSystemTools::SetMessageCallback( + [&cm](const std::string& msg, const char* title) { + cmakemainMessageCallback(msg, title, &cm); + }); cm.SetProgressCallback([&cm](const char* msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); }); @@ -499,9 +500,10 @@ static int do_build(int ac, char const* const* av) } cmake cm(cmake::RoleInternal, cmState::Unknown); - cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) { - cmakemainMessageCallback(msg, title, &cm); - }); + cmSystemTools::SetMessageCallback( + [&cm](const std::string& msg, const char* title) { + cmakemainMessageCallback(msg, title, &cm); + }); cm.SetProgressCallback([&cm](const char* msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); }); @@ -541,9 +543,10 @@ static int do_open(int ac, char const* const* av) } cmake cm(cmake::RoleInternal, cmState::Unknown); - cmSystemTools::SetMessageCallback([&cm](const char* msg, const char* title) { - cmakemainMessageCallback(msg, title, &cm); - }); + cmSystemTools::SetMessageCallback( + [&cm](const std::string& msg, const char* title) { + cmakemainMessageCallback(msg, title, &cm); + }); cm.SetProgressCallback([&cm](const char* msg, float prog) { cmakemainProgressCallback(msg, prog, &cm); }); |