]> git.saurik.com Git - wxWidgets.git/commitdiff
build fix (part of r59673, r59656)
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Fri, 20 Mar 2009 21:42:43 +0000 (21:42 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Fri, 20 Mar 2009 21:42:43 +0000 (21:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/datetime.h
src/common/datetime.cpp
src/common/datetimefmt.cpp

index 6e4341618a24f6517fbfe9f53987af1547b4c10d..95a38f562ab66553cdb48488dc9a36c697517db0 100644 (file)
@@ -133,6 +133,40 @@ extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime;
 
 #define wxInvalidDateTime wxDefaultDateTime
 
+
+// ----------------------------------------------------------------------------
+// conditional compilation
+// ----------------------------------------------------------------------------
+
+#if defined(HAVE_STRPTIME) && defined(__GLIBC__) && \
+        ((__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0))
+    // glibc 2.0.7 strptime() is broken - the following snippet causes it to
+    // crash (instead of just failing):
+    //
+    //      strncpy(buf, "Tue Dec 21 20:25:40 1999", 128);
+    //      strptime(buf, "%x", &tm);
+    //
+    // so don't use it
+    #undef HAVE_STRPTIME
+#endif // broken strptime()
+
+#if defined(HAVE_STRPTIME) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
+    // configure detects strptime as linkable because it's in the OS X
+    // System library but MSL headers don't declare it.
+
+//    char *strptime(const char *, const char *, struct tm *);
+    // However, we DON'T want to just provide it here because we would
+    // crash and/or overwrite data when strptime from OS X tries
+    // to fill in MW's struct tm which is two fields shorter (no TZ stuff)
+    // So for now let's just say we don't have strptime
+    #undef HAVE_STRPTIME
+#endif
+
+// everyone has strftime except Win CE unless VC8 is used
+#if !defined(__WXWINCE__) || defined(__VISUALC8__)
+    #define HAVE_STRFTIME
+#endif
+
 // ----------------------------------------------------------------------------
 // wxDateTime represents an absolute moment in the time
 // ----------------------------------------------------------------------------
@@ -233,7 +267,7 @@ public:
         // adoption of the Gregorian calendar (see IsGregorian())
         //
         // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)"
-        // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html
+        // by Claus Tndering, http://www.pip.dknet.dk/~c-t/calendar.html
         // except for the comments "we take".
         //
         // Symbol "->" should be read as "was followed by" in the comments
index 83790cf9ab7413a858c502d3cb6e6f54cbd9ce19..d4c2925d7c5a9f529931d592919c83f9f267e010 100644 (file)
@@ -88,7 +88,9 @@
 
 #include "wx/datetime.h"
 
-const long wxDateTime::TIME_T_FACTOR = 1000l;
+// ----------------------------------------------------------------------------
+// wxXTI
+// ----------------------------------------------------------------------------
 
 #if wxUSE_EXTENDED_RTTI
 
@@ -106,35 +108,11 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter<wxDateTime> , wxFromStringCon
 
 #endif // wxUSE_EXTENDED_RTTI
 
-//
+
 // ----------------------------------------------------------------------------
 // conditional compilation
 // ----------------------------------------------------------------------------
 
-#if defined(HAVE_STRPTIME) && defined(__GLIBC__) && \
-        ((__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0))
-    // glibc 2.0.7 strptime() is broken - the following snippet causes it to
-    // crash (instead of just failing):
-    //
-    //      strncpy(buf, "Tue Dec 21 20:25:40 1999", 128);
-    //      strptime(buf, "%x", &tm);
-    //
-    // so don't use it
-    #undef HAVE_STRPTIME
-#endif // broken strptime()
-
-#if defined(HAVE_STRPTIME) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
-    // configure detects strptime as linkable because it's in the OS X
-    // System library but MSL headers don't declare it.
-
-//    char *strptime(const char *, const char *, struct tm *);
-    // However, we DON'T want to just provide it here because we would
-    // crash and/or overwrite data when strptime from OS X tries
-    // to fill in MW's struct tm which is two fields shorter (no TZ stuff)
-    // So for now let's just say we don't have strptime
-    #undef HAVE_STRPTIME
-#endif
-
 #if defined(__MWERKS__) && wxUSE_UNICODE
     #include <wtime.h>
 #endif
@@ -203,11 +181,6 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter<wxDateTime> , wxFromStringCon
     #endif
 #endif // !WX_TIMEZONE && !WX_GMTOFF_IN_TM
 
-// everyone has strftime except Win CE unless VC8 is used
-#if !defined(__WXWINCE__) || defined(__VISUALC8__)
-    #define HAVE_STRFTIME
-#endif
-
 // NB: VC8 safe time functions could/should be used for wxMSW as well probably
 #if defined(__WXWINCE__) && defined(__VISUALC8__)
 
@@ -358,6 +331,8 @@ static const wxDateTime::wxDateTime_t gs_cumulatedDays[2][MONTHS_IN_YEAR] =
     { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }
 };
 
+const long wxDateTime::TIME_T_FACTOR = 1000l;
+
 // ----------------------------------------------------------------------------
 // global data
 // ----------------------------------------------------------------------------
index 98c4d17edd3e4e382a9d33a2565fd98faf86d3b1..845d8ead326d37bc0c7380b0854c32044507276d 100644 (file)
@@ -1183,12 +1183,13 @@ wxDateTime::ParseFormat(const wxString& date,
             case _T('c'):       // locale default date and time  representation
                 {
                     wxDateTime dt;
-                    tm tm;
 
                     const wxString inc(input);
 
                     // NOTE: %c is locale-dependent; try strptime
 #ifdef HAVE_STRPTIME
+                    struct tm tm;
+
                     // try using strptime() -- it may fail even if the input is
                     // correct but the date is out of range, so we will fall back
                     // to our generic code anyhow