Remove wxUSE_UNICODE checks as they're always true now

Also remove all code guarded by "#if !wxUSE_UNICODE".
This commit is contained in:
Vadim Zeitlin
2022-10-27 19:43:30 +02:00
parent 5c49448c75
commit 4519d8e08a
195 changed files with 400 additions and 3509 deletions
-17
View File
@@ -35,16 +35,10 @@
// TODO: Do we want to include the null char in the stream? If so then
// just add +1 to m_len in the ctor
wxStringInputStream::wxStringInputStream(const wxString& s)
#if wxUSE_UNICODE
// FIXME-UTF8: use wxCharBufferWithLength if we have it
: m_str(s), m_buf(s.utf8_str()), m_len(strlen(m_buf))
#else
: m_str(s), m_buf(s.mb_str()), m_len(s.length())
#endif
{
#if wxUSE_UNICODE
wxASSERT_MSG(m_buf.data() != nullptr, wxT("Could not convert string to UTF8!"));
#endif
m_pos = 0;
}
@@ -127,13 +121,10 @@ size_t wxStringInputStream::OnSysRead(void *buffer, size_t size)
wxStringOutputStream::wxStringOutputStream(wxString *pString, wxMBConv& conv)
: m_conv(conv)
#if wxUSE_UNICODE
, m_unconv(0)
#endif // wxUSE_UNICODE
{
m_str = pString ? pString : &m_strInternal;
#if wxUSE_UNICODE
// We can avoid doing the conversion in the common case of using UTF-8
// conversion in UTF-8 build, as it is exactly the same as the string
// length anyhow in this case.
@@ -143,9 +134,6 @@ wxStringOutputStream::wxStringOutputStream(wxString *pString, wxMBConv& conv)
else
#endif // wxUSE_UNICODE_UTF8
m_pos = m_conv.FromWChar(nullptr, 0, m_str->wc_str(), m_str->length());
#else // !wxUSE_UNICODE
m_pos = m_str->length();
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
}
// ----------------------------------------------------------------------------
@@ -165,7 +153,6 @@ size_t wxStringOutputStream::OnSysWrite(const void *buffer, size_t size)
{
const char *p = static_cast<const char *>(buffer);
#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
@@ -207,10 +194,6 @@ size_t wxStringOutputStream::OnSysWrite(const void *buffer, size_t size)
// not update m_pos as m_str hasn't changed
return size;
}
#else // !wxUSE_UNICODE
// no recoding necessary
m_str->append(p, size);
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
// update position
m_pos += size;