correct translation between iterators and char pointers in CallStrptime()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
dc310ea07f
commit
2887455004
@ -110,14 +110,19 @@ CallStrptime(const wxString& str,
|
||||
const char *fmt,
|
||||
tm *tm)
|
||||
{
|
||||
const char *start = str.mb_str();
|
||||
start = wxStringOperations::AddToIter(start, p - str.begin());
|
||||
// convert from iterator to char pointer: this is simple as wxCStrData
|
||||
// already supports this
|
||||
const char * const start = str.c_str() + (p - str.begin());
|
||||
|
||||
const char * const end = strptime(start, fmt, tm);
|
||||
if ( !end )
|
||||
return false;
|
||||
|
||||
p += wxStringOperations::DiffIters(end, start);
|
||||
// convert back from char pointer to iterator: unfortunately we have no way
|
||||
// to do it efficiently currently so create a temporary string just to
|
||||
// compute the number of characters between start and end
|
||||
p += wxString(start, end - start).length();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user