]> git.saurik.com Git - wxWidgets.git/commitdiff
correct translation between iterators and char pointers in CallStrptime()
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 24 Mar 2009 12:20:23 +0000 (12:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 24 Mar 2009 12:20:23 +0000 (12:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datetimefmt.cpp

index 10111e562a5871045f2cd3dc53ccfff79de2fa6a..d7218ac9994c97e4fedc7f1535ca4957c02aa28f 100644 (file)
@@ -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;
 }