Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62850 - in branches/date_time_io_rewrite/boost/date_time: gregorian local_time posix_time
From: andrey.semashev_at_[hidden]
Date: 2010-06-12 09:22:27


Author: andysem
Date: 2010-06-12 09:22:26 EDT (Sat, 12 Jun 2010)
New Revision: 62850
URL: http://svn.boost.org/trac/boost/changeset/62850

Log:
Merged recent changes from trunk.

Text files modified:
   branches/date_time_io_rewrite/boost/date_time/gregorian/conversion.hpp | 4 +++-
   branches/date_time_io_rewrite/boost/date_time/local_time/posix_time_zone.hpp | 21 ++++++++++++++-------
   branches/date_time_io_rewrite/boost/date_time/posix_time/conversion.hpp | 4 +++-
   branches/date_time_io_rewrite/boost/date_time/posix_time/time_serialize.hpp | 2 +-
   4 files changed, 21 insertions(+), 10 deletions(-)

Modified: branches/date_time_io_rewrite/boost/date_time/gregorian/conversion.hpp
==============================================================================
--- branches/date_time_io_rewrite/boost/date_time/gregorian/conversion.hpp (original)
+++ branches/date_time_io_rewrite/boost/date_time/gregorian/conversion.hpp 2010-06-12 09:22:26 EDT (Sat, 12 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/date_time_io_rewrite/boost/date_time/local_time/posix_time_zone.hpp
==============================================================================
--- branches/date_time_io_rewrite/boost/date_time/local_time/posix_time_zone.hpp (original)
+++ branches/date_time_io_rewrite/boost/date_time/local_time/posix_time_zone.hpp 2010-06-12 09:22:26 EDT (Sat, 12 Jun 2010)
@@ -78,9 +78,7 @@
     typedef boost::tokenizer<char_separator_type,
                              typename string_type::const_iterator,
                              string_type> tokenizer_type;
- typedef typename boost::tokenizer<char_separator_type,
- typename string_type::const_iterator,
- string_type>::iterator tokenizer_iterator_type;
+ typedef typename tokenizer_type::iterator tokenizer_iterator_type;
 
     //! Construct from a POSIX time zone string
     posix_time_zone_base(const string_type& s) :
@@ -100,11 +98,20 @@
 #endif
       char_separator_type sep(sep_chars);
       tokenizer_type tokens(s, sep);
- tokenizer_iterator_type it = tokens.begin();
+ tokenizer_iterator_type it = tokens.begin(), end = tokens.end();
+ if (it == end)
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse time zone name"));
       calc_zone(*it++);
- if(has_dst_){
- string_type tmp_str = *it++;
- calc_rules(tmp_str, *it);
+ if(has_dst_)
+ {
+ if (it == end)
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse DST begin time"));
+ string_type dst_begin = *it++;
+
+ if (it == end)
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse DST end time"));
+ string_type dst_end = *it;
+ calc_rules(dst_begin, dst_end);
       }
     }
     virtual ~posix_time_zone_base() {};

Modified: branches/date_time_io_rewrite/boost/date_time/posix_time/conversion.hpp
==============================================================================
--- branches/date_time_io_rewrite/boost/date_time/posix_time/conversion.hpp (original)
+++ branches/date_time_io_rewrite/boost/date_time/posix_time/conversion.hpp 2010-06-12 09:22:26 EDT (Sat, 12 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());

Modified: branches/date_time_io_rewrite/boost/date_time/posix_time/time_serialize.hpp
==============================================================================
--- branches/date_time_io_rewrite/boost/date_time/posix_time/time_serialize.hpp (original)
+++ branches/date_time_io_rewrite/boost/date_time/posix_time/time_serialize.hpp 2010-06-12 09:22:26 EDT (Sat, 12 Jun 2010)
@@ -137,7 +137,7 @@
 
 //!override needed b/c no default constructor
 template<class Archive>
-inline void load_construct_data(Archive & ar,
+inline void load_construct_data(Archive & /*ar*/,
                                 posix_time::ptime* pt,
                                 const unsigned int /*file_version*/)
 {


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