Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62682 - in branches/release/boost/date_time: gregorian posix_time
From: andrey.semashev_at_[hidden]
Date: 2010-06-09 14:10:14


Author: andysem
Date: 2010-06-09 14:10:13 EDT (Wed, 09 Jun 2010)
New Revision: 62682
URL: http://svn.boost.org/trac/boost/changeset/62682

Log:
Silence silly GCC warnings. Fixes #3563.

Text files modified:
   branches/release/boost/date_time/gregorian/conversion.hpp | 4 +++-
   branches/release/boost/date_time/posix_time/conversion.hpp | 4 +++-
   2 files changed, 6 insertions(+), 2 deletions(-)

Modified: branches/release/boost/date_time/gregorian/conversion.hpp
==============================================================================
--- branches/release/boost/date_time/gregorian/conversion.hpp (original)
+++ branches/release/boost/date_time/gregorian/conversion.hpp 2010-06-09 14:10:13 EDT (Wed, 09 Jun 2010)
@@ -9,6 +9,7 @@
  * $Date$
  */
 
+#include <cstring>
 #include <string>
 #include <stdexcept>
 #include <boost/throw_exception.hpp>
@@ -41,7 +42,8 @@
         boost::throw_exception(std::out_of_range(s));
     }
 
- std::tm datetm = {}; // zero initialization is needed for extension members, like tm_zone
+ std::tm datetm;
+ std::memset(&datetm, 0, sizeof(datetm));
     boost::gregorian::date::ymd_type ymd = d.year_month_day();
     datetm.tm_year = ymd.year - 1900;
     datetm.tm_mon = ymd.month - 1;

Modified: branches/release/boost/date_time/posix_time/conversion.hpp
==============================================================================
--- branches/release/boost/date_time/posix_time/conversion.hpp (original)
+++ branches/release/boost/date_time/posix_time/conversion.hpp 2010-06-09 14:10:13 EDT (Wed, 09 Jun 2010)
@@ -9,6 +9,7 @@
  * $Date$
  */
 
+#include <cstring>
 #include <boost/date_time/posix_time/ptime.hpp>
 #include <boost/date_time/posix_time/posix_time_duration.hpp>
 #include <boost/date_time/filetime_functions.hpp>
@@ -43,7 +44,8 @@
   //! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components
   inline
   std::tm to_tm(const boost::posix_time::time_duration& td) {
- std::tm timetm = {};
+ std::tm timetm;
+ std::memset(&timetm, 0, sizeof(timetm));
     timetm.tm_hour = date_time::absolute_value(td.hours());
     timetm.tm_min = date_time::absolute_value(td.minutes());
     timetm.tm_sec = date_time::absolute_value(td.seconds());


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk