diff --git a/GUI/host/host.cpp b/GUI/host/host.cpp index ad890ef..1eeb34a 100644 --- a/GUI/host/host.cpp +++ b/GUI/host/host.cpp @@ -33,11 +33,11 @@ namespace } template - void Send(T data) + std::enable_if_t Send(T data) { std::thread([=] { - std::enable_if_t DUMMY; + DWORD DUMMY; WriteFile(pipe, &data, sizeof(data), &DUMMY, nullptr); }).detach(); } diff --git a/GUI/host/textthread.cpp b/GUI/host/textthread.cpp index 80c21e2..a8f4733 100644 --- a/GUI/host/textthread.cpp +++ b/GUI/host/textthread.cpp @@ -26,18 +26,18 @@ void TextThread::AddSentence(std::wstring&& sentence) queuedSentences->emplace_back(std::move(sentence)); } -void TextThread::Push(const BYTE* data, int length) +void TextThread::Push(BYTE* data, int length) { if (length < 0) return; std::scoped_lock lock(bufferMutex); BYTE doubleByteChar[2]; if (length == 1) // doublebyte characters must be processed as pairs - if (leadByte) std::tie(doubleByteChar[0], doubleByteChar[1], data, length, leadByte) = std::tuple(leadByte, data[0], doubleByteChar, 2, 0 ); + if (leadByte) std::tie(doubleByteChar[0], doubleByteChar[1], data, length, leadByte) = std::tuple(leadByte, data[0], doubleByteChar, 2, 0); else if (IsDBCSLeadByteEx(hp.codepage ? hp.codepage : Host::defaultCodepage, data[0])) std::tie(leadByte, length) = std::tuple(data[0], 0); - if (hp.type & USING_UNICODE) buffer += std::wstring((wchar_t*)data, length / sizeof(wchar_t)); - else if (auto converted = Util::StringToWideString(std::string((char*)data, length), hp.codepage ? hp.codepage : Host::defaultCodepage)) buffer += converted.value(); + if (hp.type & USING_UNICODE) buffer.append((wchar_t*)data, length / sizeof(wchar_t)); + else if (auto converted = Util::StringToWideString(std::string((char*)data, length), hp.codepage ? hp.codepage : Host::defaultCodepage)) buffer.append(converted.value()); else Host::AddConsoleOutput(INVALID_CODEPAGE); lastPushTime = GetTickCount(); diff --git a/GUI/host/textthread.h b/GUI/host/textthread.h index f93c985..3f546d1 100644 --- a/GUI/host/textthread.h +++ b/GUI/host/textthread.h @@ -18,7 +18,7 @@ public: void Start(); void Stop(); void AddSentence(std::wstring&& sentence); - void Push(const BYTE* data, int length); + void Push(BYTE* data, int length); ThreadSafe storage; const int64_t handle;