]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/datetime.cpp
make string at least empty (instead of containing garbage) if malloc() failed
[wxWidgets.git] / src / common / datetime.cpp
index 4f1df66c7ec2d0fc4acd85e9c93f2dae9ab96ee3..6c87ccc2368bcd26bbe23989e9afca0d9930d582 100644 (file)
@@ -75,8 +75,6 @@
 #include "wx/tokenzr.h"
 #include "wx/module.h"
 
-#define wxDEFINE_TIME_CONSTANTS // before including datetime.h
-
 #include <ctype.h>
 
 #include "wx/datetime.h"
@@ -162,7 +160,7 @@ public:
     virtual void OnExit()
     {
         wxDateTimeHolidayAuthority::ClearAllAuthorities();
-        wxDateTimeHolidayAuthority::ms_authorities.Clear();
+        wxDateTimeHolidayAuthority::ms_authorities.clear();
     }
 
 private:
@@ -224,16 +222,6 @@ const wxDateTime wxDefaultDateTime;
 
 wxDateTime::Country wxDateTime::ms_country = wxDateTime::Country_Unknown;
 
-// ----------------------------------------------------------------------------
-// private globals
-// ----------------------------------------------------------------------------
-
-// a critical section is needed to protect GetTimeZone() static
-// variable in MT case
-#if wxUSE_THREADS
-    static wxCriticalSection gs_critsectTimezone;
-#endif // wxUSE_THREADS
-
 // ----------------------------------------------------------------------------
 // private functions
 // ----------------------------------------------------------------------------
@@ -275,8 +263,6 @@ static int GetTimeZone()
     static long gmtoffset = LONG_MAX; // invalid timezone
 #endif
 
-    wxCRIT_SECT_LOCKER(lock, gs_critsectTimezone);
-
     // ensure that the timezone variable is set by calling localtime
     if ( !s_timezoneSet )
     {
@@ -3816,7 +3802,7 @@ wxHolidayAuthoritiesArray wxDateTimeHolidayAuthority::ms_authorities;
 /* static */
 bool wxDateTimeHolidayAuthority::IsHoliday(const wxDateTime& dt)
 {
-    size_t count = ms_authorities.GetCount();
+    size_t count = ms_authorities.size();
     for ( size_t n = 0; n < count; n++ )
     {
         if ( ms_authorities[n]->DoIsHoliday(dt) )
@@ -3836,9 +3822,9 @@ wxDateTimeHolidayAuthority::GetHolidaysInRange(const wxDateTime& dtStart,
 {
     wxDateTimeArray hol;
 
-    holidays.Empty();
+    holidays.Clear();
 
-    size_t count = ms_authorities.GetCount();
+    size_t count = ms_authorities.size();
     for ( size_t nAuth = 0; nAuth < count; nAuth++ )
     {
         ms_authorities[nAuth]->DoGetHolidaysInRange(dtStart, dtEnd, hol);
@@ -3848,7 +3834,7 @@ wxDateTimeHolidayAuthority::GetHolidaysInRange(const wxDateTime& dtStart,
 
     holidays.Sort(wxDateTimeCompareFunc);
 
-    return holidays.GetCount();
+    return holidays.size();
 }
 
 /* static */
@@ -3860,7 +3846,7 @@ void wxDateTimeHolidayAuthority::ClearAllAuthorities()
 /* static */
 void wxDateTimeHolidayAuthority::AddAuthority(wxDateTimeHolidayAuthority *auth)
 {
-    ms_authorities.Add(auth);
+    ms_authorities.push_back(auth);
 }
 
 wxDateTimeHolidayAuthority::~wxDateTimeHolidayAuthority()