2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 19:04:56 +00:00

Fix PyOutStream streambuf for MS STL

This commit is contained in:
Jack Andersen
2020-04-10 18:58:06 -10:00
parent 8fd6664984
commit 7ce829d134
5 changed files with 28 additions and 9 deletions

View File

@@ -583,6 +583,18 @@ bool PyOutStream::StreamBuf::sendLine(std::string_view line) {
return true;
}
PyOutStream::StreamBuf::int_type PyOutStream::StreamBuf::overflow(int_type ch) {
if (!m_parent.m_parent || !m_parent.m_parent->m_lock)
BlenderLog.report(logvisor::Fatal, fmt("lock not held for PyOutStream writing"));
if (ch != traits_type::eof() && ch != '\n' && ch != '\0') {
m_lineBuf += char_type(ch);
return ch;
}
sendLine(m_lineBuf);
m_lineBuf.clear();
return ch;
}
std::streamsize PyOutStream::StreamBuf::xsputn(const char_type* __first, std::streamsize __n) {
if (!m_parent.m_parent || !m_parent.m_parent->m_lock)
BlenderLog.report(logvisor::Fatal, fmt("lock not held for PyOutStream writing"));