From: Vadim Zeitlin Date: Tue, 13 Nov 2001 18:50:05 +0000 (+0000) Subject: fixed bugs in rfind() (patch 481325) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/19a2deddc5d218ac59b6f99ff959f586462e3220 fixed bugs in rfind() (patch 481325) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/string.cpp b/src/common/string.cpp index 680cc70c2b..7a30eb68ce 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1698,7 +1698,7 @@ size_t wxString::find(wxChar ch, size_t nStart) const size_t wxString::rfind(const wxString& str, size_t nStart) const { wxASSERT( str.GetStringData()->IsValid() ); - wxASSERT( nStart <= Len() ); + wxASSERT( nStart == npos || nStart <= Len() ); // TODO could be made much quicker than that const wxChar *p = c_str() + (nStart == npos ? Len() : nStart); @@ -1715,7 +1715,7 @@ size_t wxString::rfind(const wxString& str, size_t nStart) const #if !defined(__VISUALC__) || defined(__WIN32__) size_t wxString::rfind(const wxChar* sz, size_t nStart, size_t n) const { - return rfind(wxString(sz, n == npos ? 0 : n), nStart); + return rfind(wxString(sz, n == npos ? wxSTRING_MAXLEN : n), nStart); } size_t wxString::rfind(wxChar ch, size_t nStart) const