]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/datetime.cpp
Applied [ 1223122 ] [wxMSW] Proper repainting when resizing - take 2
[wxWidgets.git] / src / common / datetime.cpp
index d0e828f406564017ac9f62a09dc20ed20610fb49..b09fe1ef75c694a91d067104276475d089d0a09e 100644 (file)
@@ -376,13 +376,18 @@ static long GetTruncatedJDN(wxDateTime::wxDateTime_t day,
 static wxString CallStrftime(const wxChar *format, const tm* tm)
 {
     wxChar buf[4096];
+    // Create temp wxString here to work around mingw/cygwin bug 1046059
+    // http://sourceforge.net/tracker/?func=detail&atid=102435&aid=1046059&group_id=2435
+    wxString s;
+
     if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) )
     {
         // buffer is too small?
         wxFAIL_MSG(_T("strftime() failed"));
     }
 
-    return wxString(buf);
+    s = buf;
+    return s;
 }
 #endif
 
@@ -2309,12 +2314,12 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
                     // find the YEAR which is a year in the strftime() range (1970
                     // - 2038) whose Jan 1 falls on the same week day as the Jan 1
                     // of the real year. Then make a copy of the format and
-                    // replace all occurences of YEAR in it with some unique
+                    // replace all occurrences of YEAR in it with some unique
                     // string not appearing anywhere else in it, then use
                     // strftime() to format the date in year YEAR and then replace
                     // YEAR back by the real year and the unique replacement
-                    // string back with YEAR. Notice that "all occurences of YEAR"
-                    // means all occurences of 4 digit as well as 2 digit form!
+                    // string back with YEAR. Notice that "all occurrences of YEAR"
+                    // means all occurrences of 4 digit as well as 2 digit form!
                     //
                     // the bugs: we assume that neither of %c nor %x contains any
                     // fields which may change between the YEAR and real year. For
@@ -2372,8 +2377,8 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
                         strYear.Printf(_T("%d"), year);
                         strYear2.Printf(_T("%d"), year % 100);
 
-                        // find two strings not occuring in format (this is surely
-                        // not optimal way of doing it... improvements welcome!)
+                        // find two strings not occurring in format (this is surely
+                        // not the optimal way of doing it... improvements welcome!)
                         wxString fmt = format;
                         wxString replacement = (wxChar)-1;
                         while ( fmt.Find(replacement) != wxNOT_FOUND )
@@ -2387,7 +2392,7 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
                             replacement << (wxChar)-2;
                         }
 
-                        // replace all occurences of year with it
+                        // replace all occurrences of year with it
                         bool wasReplaced = fmt.Replace(strYear, replacement) > 0;
                         if ( !wasReplaced )
                             wasReplaced = fmt.Replace(strYear2, replacement2) > 0;
@@ -2414,14 +2419,14 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
                                                                   : _T("%x"),
                                                     &tmAdjusted);
 
-                        // now replace the occurence of 1999 with the real year
+                        // now replace the occurrence of 1999 with the real year
                         wxString strYearReal, strYearReal2;
                         strYearReal.Printf(_T("%04d"), yearReal);
                         strYearReal2.Printf(_T("%02d"), yearReal % 100);
                         str.Replace(strYear, strYearReal);
                         str.Replace(strYear2, strYearReal2);
 
-                        // and replace back all occurences of replacement string
+                        // and replace back all occurrences of replacement string
                         if ( wasReplaced )
                         {
                             str.Replace(replacement2, strYear2);