For some reason the conversion of the bytes written to this stream to Unicode
was only done in wxUSE_UNICODE_WCHAR build but not in wxUSE_UNICODE_UTF8 one.
Do it in any wxUSE_UNICODE build now.
This allows to use wxStringOutputStream under Unix again, in particular it
fixes an assert in samples/html/zip when trying to load the raw contents of a
ZIP file in wxHtmlWindow.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67968
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxStringOutputStream(wxString *pString = NULL,
wxMBConv& conv = wxConvUTF8)
: m_conv(conv)
-#if wxUSE_UNICODE_WCHAR
+#if wxUSE_UNICODE
, m_unconv(0)
-#endif // wxUSE_UNICODE_WCHAR
+#endif // wxUSE_UNICODE
{
m_str = pString ? pString : &m_strInternal;
m_pos = m_str->length() / sizeof(wxChar);
// arbitrary 8 bit data
wxMBConv& m_conv;
-#if wxUSE_UNICODE_WCHAR
+#if wxUSE_UNICODE
// unconverted data from the last call to OnSysWrite()
wxMemoryBuffer m_unconv;
-#endif // wxUSE_UNICODE_WCHAR
+#endif // wxUSE_UNICODE
wxDECLARE_NO_COPY_CLASS(wxStringOutputStream);
};
{
const char *p = static_cast<const char *>(buffer);
-#if wxUSE_UNICODE_WCHAR
+#if wxUSE_UNICODE
// the part of the string we have here may be incomplete, i.e. it can stop
// in the middle of an UTF-8 character and so converting it would fail; if
// this is the case, accumulate the part which we failed to convert until
// not update m_pos as m_str hasn't changed
return size;
}
-#else // !wxUSE_UNICODE_WCHAR
- // no recoding necessary, the data is supposed to already be in UTF-8 (if
- // supported) or ASCII otherwise
+#else // !wxUSE_UNICODE
+ // no recoding necessary
m_str->append(p, size);
-#endif // wxUSE_UNICODE_WCHAR/!wxUSE_UNICODE_WCHAR
+#endif // wxUSE_UNICODE/!wxUSE_UNICODE
// update position
m_pos += size;