diff --git a/include/wx/string.h b/include/wx/string.h index c2a60e233d..bf297f6a9a 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -2863,12 +2863,19 @@ inline const wchar_t* wxCStrData::AsWChar() const } #endif // wxUSE_UNICODE_WCHAR -#if !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY +#if !wxUSE_UNICODE +inline const char* wxCStrData::AsChar() const +{ + return m_str->wx_str() + m_offset; +} +#endif // !wxUSE_UNICODE + +#if wxUSE_UTF8_LOCALE_ONLY inline const char* wxCStrData::AsChar() const { return wxStringOperations::AddToIter(m_str->wx_str(), m_offset); } -#endif // !wxUSE_UNICODE +#endif // wxUSE_UTF8_LOCALE_ONLY inline const wxCharBuffer wxCStrData::AsCharBuf() const { @@ -2898,7 +2905,11 @@ inline wxString wxCStrData::AsString() const inline const wxStringCharType *wxCStrData::AsInternal() const { +#if wxUSE_UNICODE_UTF8 return wxStringOperations::AddToIter(m_str->wx_str(), m_offset); +#else + return m_str->wx_str() + m_offset; +#endif } inline wxUniChar wxCStrData::operator*() const diff --git a/include/wx/stringops.h b/include/wx/stringops.h index ed53532d9e..f3046794be 100644 --- a/include/wx/stringops.h +++ b/include/wx/stringops.h @@ -40,8 +40,6 @@ struct WXDLLIMPEXP_BASE wxStringOperationsWchar { return i + n; } static wxStringImpl::const_iterator AddToIter(const wxStringImpl::const_iterator& i, int n) { return i + n; } - static const wxChar* AddToIter(const wxChar *i, int n) - { return i + n; } // returns distance of the two iterators in Unicode characters static int DiffIters(const wxStringImpl::iterator& i1,