summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-01-30 17:33:58 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-01-30 17:33:58 (GMT)
commit1180fc87803b39cc03e503e4d08fa7d68656da8a (patch)
tree217027628d5cfa0e8f7ecf213486a0038d87f983 /Source
parent748d024551d8f447046363ad617fc72bdd977fd2 (diff)
downloadCMake-1180fc87803b39cc03e503e4d08fa7d68656da8a.zip
CMake-1180fc87803b39cc03e503e4d08fa7d68656da8a.tar.gz
CMake-1180fc87803b39cc03e503e4d08fa7d68656da8a.tar.bz2
OutputCallback: Accept std::string argument
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx7
-rw-r--r--Source/QtDialog/QCMake.cxx12
-rw-r--r--Source/QtDialog/QCMake.h4
-rw-r--r--Source/cmSystemTools.cxx4
-rw-r--r--Source/cmSystemTools.h2
5 files changed, 13 insertions, 16 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 38aa1b3..2fd4c7a 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -123,11 +123,8 @@ public:
s += "\n";
});
- cmSystemTools::SetStdoutCallback(
- [&s](const char* m, size_t len) { s.append(m, len); });
-
- cmSystemTools::SetStderrCallback(
- [&s](const char* m, size_t len) { s.append(m, len); });
+ cmSystemTools::SetStdoutCallback([&s](std::string const& m) { s += m; });
+ cmSystemTools::SetStderrCallback([&s](std::string const& m) { s += m; });
this->CM.SetProgressCallback([&s](const char* msg, float /*unused*/) {
s += msg;
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 065d610..a073c30 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -29,9 +29,9 @@ QCMake::QCMake(QObject* p)
this->messageCallback(msg, title);
});
cmSystemTools::SetStdoutCallback(
- [this](const char* msg, size_t len) { this->stdoutCallback(msg, len); });
+ [this](std::string const& msg) { this->stdoutCallback(msg); });
cmSystemTools::SetStderrCallback(
- [this](const char* msg, size_t len) { this->stderrCallback(msg, len); });
+ [this](std::string const& msg) { this->stderrCallback(msg); });
this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project);
this->CMakeInstance->SetCMakeEditCommand(
@@ -365,15 +365,15 @@ void QCMake::messageCallback(const char* msg, const char* /*title*/)
QCoreApplication::processEvents();
}
-void QCMake::stdoutCallback(const char* msg, size_t len)
+void QCMake::stdoutCallback(std::string const& msg)
{
- emit this->outputMessage(QString::fromLocal8Bit(msg, int(len)));
+ emit this->outputMessage(QString::fromStdString(msg));
QCoreApplication::processEvents();
}
-void QCMake::stderrCallback(const char* msg, size_t len)
+void QCMake::stderrCallback(std::string const& msg)
{
- emit this->outputMessage(QString::fromLocal8Bit(msg, int(len)));
+ emit this->outputMessage(QString::fromStdString(msg));
QCoreApplication::processEvents();
}
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index 4f22505..ef4d2a1 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -170,8 +170,8 @@ protected:
bool interruptCallback();
void progressCallback(const char* msg, float percent);
void messageCallback(const char* msg, const char* title);
- void stdoutCallback(const char* msg, size_t len);
- void stderrCallback(const char* msg, size_t len);
+ void stdoutCallback(std::string const& msg);
+ void stderrCallback(std::string const& msg);
bool WarnUninitializedMode;
bool WarnUnusedMode;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index a9cf0c6..5d8c079 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -308,7 +308,7 @@ void cmSystemTools::SetStderrCallback(OutputCallback f)
void cmSystemTools::Stderr(const std::string& s)
{
if (s_StderrCallback) {
- s_StderrCallback(s.c_str(), s.length());
+ s_StderrCallback(s);
} else {
std::cerr << s << std::flush;
}
@@ -317,7 +317,7 @@ void cmSystemTools::Stderr(const std::string& s)
void cmSystemTools::Stdout(const std::string& s)
{
if (s_StdoutCallback) {
- s_StdoutCallback(s.c_str(), s.length());
+ s_StdoutCallback(s);
} else {
std::cout << s << std::flush;
}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 990c932..f39da64 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -80,7 +80,7 @@ public:
Message(m.c_str(), title);
}
- using OutputCallback = std::function<void(const char*, size_t)>;
+ using OutputCallback = std::function<void(std::string const&)>;
///! Send a string to stdout
static void Stdout(const std::string& s);