Don't create an invalid iterator in wxDateTime::ParseTime().

Creating an iterator pointing beyond the string end resulted in an assert from
MSVC 9 CRT. Fix this by using wxString ctor taking length (which may be
greater than the length of the string) instead of the one taking two iterators
(which must both be valid).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-12-30 13:46:27 +00:00
parent ede4fb2ffa
commit 4e2c2c7062

View File

@@ -1922,14 +1922,13 @@ wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end)
for ( size_t n = 0; n < WXSIZEOF(stdTimes); n++ )
{
const wxString timeString = wxGetTranslation(stdTimes[n].name);
const wxString::const_iterator p = time.begin() + timeString.length();
if ( timeString.CmpNoCase(wxString(time.begin(), p)) == 0 )
if ( timeString.CmpNoCase(wxString(time, timeString.length())) == 0 )
{
// casts required by DigitalMars
Set(stdTimes[n].hour, wxDateTime_t(0), wxDateTime_t(0));
if ( end )
*end = p;
*end = time.begin() + timeString.length();
return true;
}