mirror of https://github.com/AxioDL/metaforce.git
Fix PyOutStream streambuf for MS STL
This commit is contained in:
parent
8fd6664984
commit
7ce829d134
|
@ -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
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
||||||
project(hecl)
|
project(hecl)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
add_compile_options(
|
||||||
# Shaddup MSVC
|
# Disable exceptions
|
||||||
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D_CRT_SECURE_NO_WARNINGS=1 /wd4267 /wd4244)
|
$<$<COMPILE_LANGUAGE:CXX>:/EHsc>
|
||||||
|
/wd4267 /wd4244
|
||||||
|
)
|
||||||
|
add_compile_definitions(UNICODE=1 _UNICODE=1 _CRT_SECURE_NO_WARNINGS=1)
|
||||||
else()
|
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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9c39a038a583d427b65536f5ae6a21c0b436bda0
|
Subproject commit ebda6add23ff8e0560e5eb080752b35fb84af5dc
|
|
@ -1 +1 @@
|
||||||
Subproject commit 56a6b06210abd5c4fdfdc18d43f9eea811c06d77
|
Subproject commit de85119690a57b13d1258d20bc93fb54601c648c
|
|
@ -82,6 +82,7 @@ class PyOutStream : public std::ostream {
|
||||||
StreamBuf(const StreamBuf& other) = delete;
|
StreamBuf(const StreamBuf& other) = delete;
|
||||||
StreamBuf(StreamBuf&& other) = default;
|
StreamBuf(StreamBuf&& other) = default;
|
||||||
bool sendLine(std::string_view line);
|
bool sendLine(std::string_view line);
|
||||||
|
int_type overflow(int_type ch) override;
|
||||||
std::streamsize xsputn(const char_type* __s, std::streamsize __n) override;
|
std::streamsize xsputn(const char_type* __s, std::streamsize __n) override;
|
||||||
} m_sbuf;
|
} m_sbuf;
|
||||||
PyOutStream(Connection* parent, bool deleteOnError);
|
PyOutStream(Connection* parent, bool deleteOnError);
|
||||||
|
|
|
@ -583,6 +583,18 @@ bool PyOutStream::StreamBuf::sendLine(std::string_view line) {
|
||||||
return true;
|
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) {
|
std::streamsize PyOutStream::StreamBuf::xsputn(const char_type* __first, std::streamsize __n) {
|
||||||
if (!m_parent.m_parent || !m_parent.m_parent->m_lock)
|
if (!m_parent.m_parent || !m_parent.m_parent->m_lock)
|
||||||
BlenderLog.report(logvisor::Fatal, fmt("lock not held for PyOutStream writing"));
|
BlenderLog.report(logvisor::Fatal, fmt("lock not held for PyOutStream writing"));
|
||||||
|
|
Loading…
Reference in New Issue