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

@ -2,15 +2,21 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
project(hecl)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
# Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D_CRT_SECURE_NO_WARNINGS=1 /wd4267 /wd4244)
add_compile_options(
# Disable exceptions
$<$<COMPILE_LANGUAGE:CXX>:/EHsc>
/wd4267 /wd4244
)
add_compile_definitions(UNICODE=1 _UNICODE=1 _CRT_SECURE_NO_WARNINGS=1)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-multichar -fno-exceptions")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(
# Disable exceptions
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
-Wno-multichar
)
endif()
endif()

2
hecl/extern/athena vendored

@ -1 +1 @@
Subproject commit 9c39a038a583d427b65536f5ae6a21c0b436bda0
Subproject commit ebda6add23ff8e0560e5eb080752b35fb84af5dc

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit 56a6b06210abd5c4fdfdc18d43f9eea811c06d77
Subproject commit de85119690a57b13d1258d20bc93fb54601c648c

View File

@ -82,6 +82,7 @@ class PyOutStream : public std::ostream {
StreamBuf(const StreamBuf& other) = delete;
StreamBuf(StreamBuf&& other) = default;
bool sendLine(std::string_view line);
int_type overflow(int_type ch) override;
std::streamsize xsputn(const char_type* __s, std::streamsize __n) override;
} m_sbuf;
PyOutStream(Connection* parent, bool deleteOnError);

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"));