From 5f45e697bdeac0fe1e68caa42d5c8332c78cb6ba Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 28 Oct 2022 20:00:59 +0100 Subject: [PATCH] Don't use wxWxCharBuffer any more We still provide this #define, but there is no reason to use it inside the library itself, so replace it with the more clear wxWCharBuffer. No real changes. --- include/wx/stringops.h | 2 +- include/wx/tokenzr.h | 3 +-- src/common/fileconf.cpp | 6 +++--- src/common/stringops.cpp | 4 ++-- src/msw/app.cpp | 8 ++++---- src/msw/headerctrl.cpp | 2 +- src/msw/utilsexc.cpp | 2 +- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/include/wx/stringops.h b/include/wx/stringops.h index 8e885fd8a0..f3b94da46a 100644 --- a/include/wx/stringops.h +++ b/include/wx/stringops.h @@ -72,7 +72,7 @@ struct WXDLLIMPEXP_BASE wxStringOperationsWchar buf.data[1] = 0; return buf; } - static wxWxCharBuffer EncodeNChars(size_t n, const wxUniChar& ch); + static wxWCharBuffer EncodeNChars(size_t n, const wxUniChar& ch); static bool IsSingleCodeUnitCharacter(const wxUniChar&) { return true; } #endif diff --git a/include/wx/tokenzr.h b/include/wx/tokenzr.h index 45f91a0aef..cd03b25cea 100644 --- a/include/wx/tokenzr.h +++ b/include/wx/tokenzr.h @@ -128,8 +128,7 @@ protected: wxString m_string; // the string we tokenize wxString::const_iterator m_stringEnd; - // FIXME-UTF8: use wxWcharBuffer - wxWxCharBuffer m_delims; // all possible delimiters + wxWCharBuffer m_delims; // all possible delimiters size_t m_delimsLen; wxString::const_iterator m_pos; // the current position in m_string diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 7803f6f402..531f94245e 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -405,7 +405,7 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, const wxMBConv& conv) m_linesTail = nullptr; // read the entire stream contents in memory - wxWxCharBuffer cbuf; + wxWCharBuffer cbuf; static const size_t chunkLen = 1024; wxMemoryBuffer buf(chunkLen); @@ -501,8 +501,8 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal) for ( size_t n = 0; n < nLineCount; n++ ) { wxString strLine = buffer[n]; - // FIXME-UTF8: rewrite using iterators, without this buffer - wxWxCharBuffer buf(strLine.c_str()); + // FIXME-UTF8: rewrite using iterators + wxWCharBuffer buf(strLine.c_str()); const wxChar *pStart; const wxChar *pEnd; diff --git a/src/common/stringops.cpp b/src/common/stringops.cpp index 3d91804318..04953eea55 100644 --- a/src/common/stringops.cpp +++ b/src/common/stringops.cpp @@ -75,9 +75,9 @@ wxWCharBuffer wxStringOperationsWchar::EncodeNChars(size_t n, const wxUniChar& c #else -wxWxCharBuffer wxStringOperationsWchar::EncodeNChars(size_t n, const wxUniChar& ch) +wxWCharBuffer wxStringOperationsWchar::EncodeNChars(size_t n, const wxUniChar& ch) { - wxWxCharBuffer buf(n); + wxWCharBuffer buf(n); #if wxUSE_UNICODE_WCHAR wmemset(buf.data(), (wchar_t)ch, n); #else // ANSI diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 08ab9b0fac..a47fe9a490 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -386,7 +386,7 @@ private: // retrieve the command line history into the provided buffer and return // its length - int GetCommandHistory(wxWxCharBuffer& buf) const; + int GetCommandHistory(wxWCharBuffer& buf) const; // check if the console history has changed bool IsHistoryUnchanged() const; @@ -398,7 +398,7 @@ private: HANDLE m_hStderr; // console handle, if it's valid we must call // FreeConsole() (even if m_ok != 1) - wxWxCharBuffer m_history; // command history on startup + wxWCharBuffer m_history; // command history on startup int m_historyLen; // length command history buffer wxCharBuffer m_data; // data between empty line and cursor position @@ -493,7 +493,7 @@ bool wxConsoleStderr::DoInit() return true; } -int wxConsoleStderr::GetCommandHistory(wxWxCharBuffer& buf) const +int wxConsoleStderr::GetCommandHistory(wxWCharBuffer& buf) const { // these functions are internal and may only be called by cmd.exe static const wxChar *CMD_EXE = wxT("cmd.exe"); @@ -519,7 +519,7 @@ bool wxConsoleStderr::IsHistoryUnchanged() const wxASSERT_MSG( m_ok == 1, wxT("shouldn't be called if not initialized") ); // get (possibly changed) command history - wxWxCharBuffer history; + wxWCharBuffer history; const int historyLen = GetCommandHistory(history); // and compare it with the original one diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp index 5d5c73ded8..6368434688 100644 --- a/src/msw/headerctrl.cpp +++ b/src/msw/headerctrl.cpp @@ -456,7 +456,7 @@ void wxMSWHeaderCtrl::DoInsertItem(const wxHeaderColumn& col, unsigned int idx) // notice that we need to store the string we use the pointer to until we // pass it to the control hdi.mask |= HDI_TEXT; - wxWxCharBuffer buf = col.GetTitle().t_str(); + wxWCharBuffer buf = col.GetTitle().t_str(); hdi.pszText = buf.data(); hdi.cchTextMax = wxStrlen(buf); diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index bcb5fccc90..3ca7fe086d 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -760,7 +760,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, dwFlags |= CREATE_DEFAULT_ERROR_MODE ; - wxWxCharBuffer envBuffer; + wxWCharBuffer envBuffer; bool useCwd = false; if ( env ) {