]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/datetimefmt.cpp
Add wxDataViewCtrl::GTKPathToItem() function and use it.
[wxWidgets.git] / src / common / datetimefmt.cpp
index c624b6c6f0b5a39c2741bc88d145656e9960942b..bf920165252fc7c7bf71a74fd65a8664864c4288 100644 (file)
@@ -1497,10 +1497,9 @@ wxDateTime::ParseDateTime(const wxString& date, wxString::const_iterator *end)
 {
     wxCHECK_MSG( end, false, "end iterator pointer must be specified" );
 
-    // Set to current day and hour, so strings like '14:00' becomes today at
-    // 14, not some other random date
-    wxDateTime dtDate = wxDateTime::Today();
-    wxDateTime dtTime = wxDateTime::Today();
+    wxDateTime
+        dtDate,
+        dtTime;
 
     wxString::const_iterator
         endTime,
@@ -1559,7 +1558,7 @@ wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end)
     const wxString::const_iterator pEnd = date.end();
 
     wxString::const_iterator p = pBegin;
-    while ( wxIsspace(*p) )
+    while ( p != pEnd && wxIsspace(*p) )
         p++;
 
     // some special cases
@@ -1760,7 +1759,7 @@ wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end)
                 else // not a valid weekday name
                 {
                     // try the ordinals
-                    static const char *ordinals[] =
+                    static const char *const ordinals[] =
                     {
                         wxTRANSLATE("first"),
                         wxTRANSLATE("second"),
@@ -1922,14 +1921,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;
         }
@@ -1937,12 +1935,12 @@ wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end)
 
     // try all time formats we may think about in the order from longest to
     // shortest
-    static const char *timeFormats[] =
+    static const char *const timeFormats[] =
     {
         "%I:%M:%S %p",  // 12hour with AM/PM
         "%H:%M:%S",     // could be the same or 24 hour one so try it too
         "%I:%M %p",     // 12hour with AM/PM but without seconds
-        "%H:%M:%S",     // and a possibly 24 hour version without seconds
+        "%H:%M",        // and a possibly 24 hour version without seconds
         "%X",           // possibly something from above or maybe something
                         // completely different -- try it last