diff --git a/samples/console/console.cpp b/samples/console/console.cpp index 4f7d0d4519..5cf447428d 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -6807,6 +6807,7 @@ void TestStdString() // 01234567890123456789012345 s1 = _T("abcdefgABCDEFGabcABCabcABC"); s2 = _T("gAB"); + s3 = _T("ab"); is_nom( s1.rfind(_T('A')), 23u ); is_nom( s1.rfind(_T('A'), 7), 7u ); @@ -6823,6 +6824,7 @@ void TestStdString() is_nom( s1.rfind(s2), 6u ); is_nom( s1.rfind(s2, 5), wxString::npos ); is_nom( s1.rfind(s2, 6), 6u ); + is_nom( s1.rfind(s3, 1), 0u ); // resize s1 = s2 = s3 = s4 = _T("abcABCdefDEF"); diff --git a/src/common/string.cpp b/src/common/string.cpp index 76a89a88a3..8415f0c3f3 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -504,8 +504,7 @@ size_t wxStringBase::rfind(const wxStringBase& str, size_t nStart) const { return cursor - c_str(); } - --cursor; - } while ( cursor > c_str() ); + } while ( cursor-- > c_str() ); } return npos;