Return valid pointers from wxDateTime::ParseXXX() with non-wxString strings.

The pointer returned by wxDateTime::ParseXXX() methods could point into a
buffer of a temporary wxString created to wrap a char* or wchar_t* argument so
dereferencing it was illegal.

Fix this by defining separate overloads for char*/wchar_t* arguments returning
pointers into the original string.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-03-25 16:45:53 +00:00
parent 52dc2108ae
commit f17ac57417
3 changed files with 148 additions and 0 deletions

View File

@@ -1043,6 +1043,10 @@ void DateTimeTestCase::TestDateParse()
);
}
}
// Check that incomplete parse works correctly.
const char* p = dt.ParseFormat("2012-03-23 12:34:56", "%Y-%m-%d");
CPPUNIT_ASSERT_EQUAL( " 12:34:56", wxString(p) );
}
void DateTimeTestCase::TestDateParseISO()