#if wxUSE_STREAMS
#include "wx/datstrm.h"
-#include "wx/math.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/math.h"
+#endif //WX_PRECOMP
// ---------------------------------------------------------------------------
// wxDataInputStream
// ---------------------------------------------------------------------------
#if wxUSE_UNICODE
-wxDataInputStream::wxDataInputStream(wxInputStream& s, wxMBConv& conv)
- : m_input(&s), m_be_order(false), m_conv(conv)
+wxDataInputStream::wxDataInputStream(wxInputStream& s, const wxMBConv& conv)
+ : m_input(&s), m_be_order(false), m_conv(conv.Clone())
#else
wxDataInputStream::wxDataInputStream(wxInputStream& s)
: m_input(&s), m_be_order(false)
{
}
+wxDataInputStream::~wxDataInputStream()
+{
+#if wxUSE_UNICODE
+ delete m_conv;
+#endif // wxUSE_UNICODE
+}
+
#if wxHAS_INT64
wxUint64 wxDataInputStream::Read64()
{
wxCharBuffer tmp(len + 1);
m_input->Read(tmp.data(), len);
tmp.data()[len] = '\0';
- wxString ret(m_conv.cMB2WX(tmp.data()));
+ wxString ret(m_conv->cMB2WX(tmp.data()));
#else
wxString ret;
m_input->Read( wxStringBuffer(ret, len), len);
// ---------------------------------------------------------------------------
#if wxUSE_UNICODE
-wxDataOutputStream::wxDataOutputStream(wxOutputStream& s, wxMBConv& conv)
- : m_output(&s), m_be_order(false), m_conv(conv)
+wxDataOutputStream::wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv)
+ : m_output(&s), m_be_order(false), m_conv(conv.Clone())
#else
wxDataOutputStream::wxDataOutputStream(wxOutputStream& s)
: m_output(&s), m_be_order(false)
{
}
+wxDataOutputStream::~wxDataOutputStream()
+{
+#if wxUSE_UNICODE
+ delete m_conv;
+#endif // wxUSE_UNICODE
+}
+
#if wxHAS_INT64
void wxDataOutputStream::Write64(wxUint64 i)
{
void wxDataOutputStream::WriteString(const wxString& string)
{
#if wxUSE_UNICODE
- const wxWX2MBbuf buf = string.mb_str(m_conv);
+ const wxWX2MBbuf buf = string.mb_str(*m_conv);
#else
const wxWX2MBbuf buf = string.mb_str();
#endif