// wxDataInputStream
// ---------------------------------------------------------------------------
+#if wxUSE_UNICODE
+wxDataInputStream::wxDataInputStream(wxInputStream& s, wxMBConv& conv)
+ : m_input(&s), m_be_order(FALSE), m_conv(conv)
+#else
wxDataInputStream::wxDataInputStream(wxInputStream& s)
: m_input(&s), m_be_order(FALSE)
+#endif
{
}
char *tmp = new char[len + 1];
m_input->Read(tmp, len);
tmp[len] = 0;
- wxString s(tmp);
+ wxString ret( (const wxChar*) m_conv.cMB2WX(tmp) );
delete[] tmp;
#else
- wxString s;
- m_input->Read(s.GetWriteBuf(len), len);
- s.UngetWriteBuf();
+ wxString ret;
+ m_input->Read( ret.GetWriteBuf(len), len);
+ ret.UngetWriteBuf();
#endif
- return s;
+ return ret;
}
else
return wxEmptyString;
// wxDataOutputStream
// ---------------------------------------------------------------------------
+#if wxUSE_UNICODE
+wxDataOutputStream::wxDataOutputStream(wxOutputStream& s, wxMBConv& conv)
+ : m_output(&s), m_be_order(FALSE), m_conv(conv)
+#else
wxDataOutputStream::wxDataOutputStream(wxOutputStream& s)
: m_output(&s), m_be_order(FALSE)
+#endif
{
}
void wxDataOutputStream::WriteString(const wxString& string)
{
+#if wxUSE_UNICODE
+ const wxWX2MBbuf buf = string.mb_str(m_conv);
+#else
const wxWX2MBbuf buf = string.mb_str();
- Write32(string.Len());
- if (string.Len() > 0)
- m_output->Write(buf, string.Len());
+#endif
+ size_t len = strlen(buf);
+ Write32(len);
+ if (len > 0)
+ m_output->Write(buf, len);
}
// Must be at global scope for VC++ 5