Don't use native MSW functions in wxString::CmpNoCase().
While the native CompareString() is much more efficient than MSVC CRT version of _wcsicmp(), it gives unexpected results for non-letter characters, so don't use it but use the slow but correct wxStricmp() instead. At least don't use char-by-char comparison (in non-UTF-8 case) as it's the slowest possible implementation of this function, the new one using wxStricmp() is 3 times faster (by comparison, using CompareString() is 16 times faster still -- but wrong). Closes #10375. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -455,6 +455,10 @@ void StringTestCase::Compare()
|
||||
CPPUNIT_ASSERT( s1 != neq2 );
|
||||
CPPUNIT_ASSERT( s1 != neq3 );
|
||||
CPPUNIT_ASSERT( s1 != neq4 );
|
||||
|
||||
CPPUNIT_ASSERT( wxString("\n").Cmp(" ") < 0 );
|
||||
CPPUNIT_ASSERT( wxString("'").Cmp("!") > 0 );
|
||||
CPPUNIT_ASSERT( wxString("!").Cmp("z") < 0 );
|
||||
}
|
||||
|
||||
void StringTestCase::CompareNoCase()
|
||||
@@ -502,6 +506,10 @@ void StringTestCase::CompareNoCase()
|
||||
CPPUNIT_CNCNEQ_ASSERT( s1, neq );
|
||||
CPPUNIT_CNCNEQ_ASSERT( s1, neq2 );
|
||||
CPPUNIT_CNCNEQ_ASSERT( s1, neq3 );
|
||||
|
||||
CPPUNIT_ASSERT( wxString("\n").CmpNoCase(" ") < 0 );
|
||||
CPPUNIT_ASSERT( wxString("'").CmpNoCase("!") > 0);
|
||||
CPPUNIT_ASSERT( wxString("!").Cmp("Z") < 0 );
|
||||
}
|
||||
|
||||
void StringTestCase::Contains()
|
||||
|
Reference in New Issue
Block a user