X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14f355c2b5c71fc7c3d680aea366582d2ac60f7b..708c45a6cef439edb007ca8f8329582244f152f5:/src/common/string.cpp?ds=sidebyside diff --git a/src/common/string.cpp b/src/common/string.cpp index 2bd4e6178f..4715f63154 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -509,13 +509,15 @@ size_t wxStringBase::rfind(wxChar ch, size_t nStart) const wxASSERT( nStart <= length() ); } - const wxChar *p = wxStrrchr(c_str(), ch); - - if ( p == NULL ) - return npos; + const wxChar *actual; + for ( actual = c_str() + ( nStart == npos ? length() : nStart + 1 ); + actual > c_str(); --actual ) + { + if ( *(actual - 1) == ch ) + return (actual - 1) - c_str(); + } - size_t result = p - c_str(); - return ( result > nStart ) ? npos : result; + return npos; } size_t wxStringBase::find_first_of(const wxChar* sz, size_t nStart) const @@ -1961,6 +1963,11 @@ wxArrayString::~wxArrayString() wxDELETEA(m_pItems); } +void wxArrayString::reserve(size_t nSize) +{ + Alloc(nSize); +} + // pre-allocates memory (frees the previous data!) void wxArrayString::Alloc(size_t nSize) {