summaryrefslogtreecommitdiffstats
path: root/src/CommandOutput.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-05-11 10:39:45 +0200
committerMattes D <github@xoft.cz>2015-05-11 10:39:45 +0200
commit7d66162e3c339e82d56e5144d466cab97eca82ab (patch)
tree5f3f1a00f704c7def6fc18b98c296e964f218815 /src/CommandOutput.cpp
parentMerge pull request #1977 from mc-server/warnings (diff)
parentAPIDump: Added linkification to hook return values. (diff)
downloadcuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.gz
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.bz2
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.lz
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.xz
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.zst
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.zip
Diffstat (limited to '')
-rw-r--r--src/CommandOutput.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/CommandOutput.cpp b/src/CommandOutput.cpp
index 510461d81..255ec3e9b 100644
--- a/src/CommandOutput.cpp
+++ b/src/CommandOutput.cpp
@@ -29,29 +29,32 @@ void cCommandOutputCallback::Out(const char * a_Fmt, ...)
////////////////////////////////////////////////////////////////////////////////
-// cLogCommandOutputCallback:
+// cStringAccumCommandOutputCallback:
-void cLogCommandOutputCallback::Out(const AString & a_Text)
+void cStringAccumCommandOutputCallback::Out(const AString & a_Text)
{
- m_Buffer.append(a_Text);
+ m_Accum.append(a_Text);
}
+////////////////////////////////////////////////////////////////////////////////
+// cLogCommandOutputCallback:
+
void cLogCommandOutputCallback::Finished(void)
{
// Log each line separately:
- size_t len = m_Buffer.length();
+ size_t len = m_Accum.length();
size_t last = 0;
for (size_t i = 0; i < len; i++)
{
- switch (m_Buffer[i])
+ switch (m_Accum[i])
{
case '\n':
{
- LOG("%s", m_Buffer.substr(last, i - last).c_str());
+ LOG("%s", m_Accum.substr(last, i - last).c_str());
last = i + 1;
break;
}
@@ -59,11 +62,11 @@ void cLogCommandOutputCallback::Finished(void)
} // for i - m_Buffer[]
if (last < len)
{
- LOG("%s", m_Buffer.substr(last).c_str());
+ LOG("%s", m_Accum.substr(last).c_str());
}
// Clear the buffer for the next command output:
- m_Buffer.clear();
+ m_Accum.clear();
}