Fix and testcase for wxString::rfind bug I introduced.
Patch by Robert Vazan. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -6807,6 +6807,7 @@ void TestStdString() | |||||||
|     //       01234567890123456789012345 |     //       01234567890123456789012345 | ||||||
|     s1 = _T("abcdefgABCDEFGabcABCabcABC"); |     s1 = _T("abcdefgABCDEFGabcABCabcABC"); | ||||||
|     s2 = _T("gAB"); |     s2 = _T("gAB"); | ||||||
|  |     s3 = _T("ab"); | ||||||
|  |  | ||||||
|     is_nom( s1.rfind(_T('A')), 23u ); |     is_nom( s1.rfind(_T('A')), 23u ); | ||||||
|     is_nom( s1.rfind(_T('A'), 7), 7u ); |     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), 6u ); | ||||||
|     is_nom( s1.rfind(s2, 5), wxString::npos ); |     is_nom( s1.rfind(s2, 5), wxString::npos ); | ||||||
|     is_nom( s1.rfind(s2, 6), 6u ); |     is_nom( s1.rfind(s2, 6), 6u ); | ||||||
|  |     is_nom( s1.rfind(s3, 1), 0u ); | ||||||
|  |  | ||||||
|     // resize |     // resize | ||||||
|     s1 = s2 = s3 = s4 = _T("abcABCdefDEF"); |     s1 = s2 = s3 = s4 = _T("abcABCdefDEF"); | ||||||
|   | |||||||
| @@ -504,8 +504,7 @@ size_t wxStringBase::rfind(const wxStringBase& str, size_t nStart) const | |||||||
|             { |             { | ||||||
|                 return cursor - c_str(); |                 return cursor - c_str(); | ||||||
|             } |             } | ||||||
|             --cursor; |         } while ( cursor-- > c_str() ); | ||||||
|         } while ( cursor > c_str() ); |  | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     return npos; |     return npos; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user