From 9dfe9a1a1223995f068d6fc34f48f951d4e9d6a6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 May 2009 09:29:22 +0000 Subject: [PATCH] VC6 compilation fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60501 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/stdstream.cpp | 43 ++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/common/stdstream.cpp b/src/common/stdstream.cpp index af8475cdd3..1fa0057642 100644 --- a/src/common/stdstream.cpp +++ b/src/common/stdstream.cpp @@ -183,16 +183,6 @@ wxStdInputStreamBuffer::pbackfail(int c) return m_stream.Ungetch((char) c) ? c : EOF; } -// ========================================================================== -// wxStdInputStream -// ========================================================================== - -wxStdInputStream::wxStdInputStream(wxInputStream& stream) : - std::istream(NULL), m_streamBuffer(stream) -{ - std::ios::init(&m_streamBuffer); -} - // ========================================================================== // wxStdOutputStreamBuffer // ========================================================================== @@ -260,13 +250,44 @@ wxStdOutputStreamBuffer::overflow(int c) } // ========================================================================== -// wxStdOutputStream +// wxStdInputStream and wxStdOutputStream // ========================================================================== +// FIXME-VC6: it is impossible to call basic_ios::init() with this +// compiler, it complains about invalid call to non-static member +// function so use a suspicious (as it uses a pointer to not yet +// constructed streambuf) but working workaround +// +// It also doesn't like using istream in the ctor initializer list +// and we must spell it out as basic_istream. +#ifdef __VISUALC6__ + +wxStdInputStream::wxStdInputStream(wxInputStream& stream) + : std::basic_istream >(&m_streamBuffer), + m_streamBuffer(stream) +{ +} + +wxStdOutputStream::wxStdOutputStream(wxOutputStream& stream) + : std::basic_ostream >(&m_streamBuffer), + m_streamBuffer(stream) +{ +} + +#else // !VC6 + +wxStdInputStream::wxStdInputStream(wxInputStream& stream) : + std::istream(NULL), m_streamBuffer(stream) +{ + std::ios::init(&m_streamBuffer); +} + wxStdOutputStream::wxStdOutputStream(wxOutputStream& stream) : std::ostream(NULL), m_streamBuffer(stream) { std::ios::init(&m_streamBuffer); } +#endif // VC6/!VC6 + #endif // wxUSE_STD_IOSTREAM -- 2.45.2