[gnote] Pass pointer to const time_t to localtime_r



commit 612cf8e96aaa119d88a4ecc302fc98e3fa53f9c2
Author: Aurimas Ä?ernius <aurisc4 gmail com>
Date:   Sun May 8 22:34:11 2011 +0300

    Pass pointer to const time_t to localtime_r
    
    A change to previous commit 83289da65ab277e4d3b6880ac91f93b7efda5cfb.
    Fix build on FreeBSD and OpenBSD.
    Thanks Jasper Lievisse Adriaanse.
    Fixes bug 649472.

 src/sharp/datetime.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/sharp/datetime.cpp b/src/sharp/datetime.cpp
index 506f8ba..d95c984 100644
--- a/src/sharp/datetime.cpp
+++ b/src/sharp/datetime.cpp
@@ -70,28 +70,28 @@ namespace sharp {
   int DateTime::day() const
   {
     struct tm result;
-    localtime_r(const_cast<const time_t *>(&m_date.tv_sec), &result);
+    localtime_r((const time_t *)&m_date.tv_sec, &result);
     return result.tm_mday;
   }
 
   int DateTime::month() const
   {
     struct tm result;
-    localtime_r(const_cast<const time_t *>(&m_date.tv_sec), &result);
+    localtime_r((const time_t *)&m_date.tv_sec, &result);
     return result.tm_mon + 1;
   }
 
   int DateTime::year() const
   {
     struct tm result;
-    localtime_r(const_cast<const time_t *>(&m_date.tv_sec), &result);
+    localtime_r((const time_t *)&m_date.tv_sec, &result);
     return result.tm_year + 1900;
   }
 
   int DateTime::day_of_year() const
   {
     struct tm result;
-    localtime_r(const_cast<const time_t *>(&m_date.tv_sec), &result);
+    localtime_r((const time_t *)&m_date.tv_sec, &result);
     return result.tm_yday;
   }
 
@@ -110,14 +110,14 @@ namespace sharp {
   std::string DateTime::to_string(const char * format) const
   {
     struct tm result; 
-    return _to_string(format, localtime_r(const_cast<const time_t *>(&m_date.tv_sec), &result));
+    return _to_string(format, localtime_r((const time_t *)&m_date.tv_sec, &result));
   }
 
 
   std::string DateTime::to_short_time_string() const
   {
     struct tm result;
-    return _to_string("%R", localtime_r(const_cast<const time_t *>(&m_date.tv_sec), &result));
+    return _to_string("%R", localtime_r((const time_t *)&m_date.tv_sec, &result));
   }
 
   std::string DateTime::to_iso8601() const



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]