Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86322 - in branches/release: boost/date_time libs/date_time/test/gregorian
From: marshall_at_[hidden]
Date: 2013-10-15 11:22:02


Author: marshall
Date: 2013-10-15 11:22:02 EDT (Tue, 15 Oct 2013)
New Revision: 86322
URL: http://svn.boost.org/trac/boost/changeset/86322

Log:
Merge DateTime bug fix to Release; Fixes #9216

Properties modified:
   branches/release/boost/date_time/format_date_parser.hpp (contents, props changed)
   branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp (contents, props changed)
Text files modified:
   branches/release/boost/date_time/format_date_parser.hpp | 12 ++++++++----
   branches/release/boost/date_time/time_facet.hpp | 4 ++--
   branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp | 5 +++++
   3 files changed, 15 insertions(+), 6 deletions(-)

Modified: branches/release/boost/date_time/format_date_parser.hpp
==============================================================================
--- branches/release/boost/date_time/format_date_parser.hpp Tue Oct 15 10:08:57 2013 (r86321)
+++ branches/release/boost/date_time/format_date_parser.hpp 2013-10-15 11:22:02 EDT (Tue, 15 Oct 2013) (r86322)
@@ -271,7 +271,8 @@
     const_itr itr(format_str.begin());
     while (itr != format_str.end() && (sitr != stream_end)) {
       if (*itr == '%') {
- itr++;
+ if ( ++itr == format_str.end())
+ break;
         if (*itr != '%') {
           switch(*itr) {
           case 'a':
@@ -476,7 +477,8 @@
     const_itr itr(format_str.begin());
     while (itr != format_str.end() && (sitr != stream_end)) {
       if (*itr == '%') {
- itr++;
+ if ( ++itr == format_str.end())
+ break;
         if (*itr != '%') {
           switch(*itr) {
           case 'b':
@@ -577,7 +579,8 @@
     const_itr itr(format_str.begin());
     while (itr != format_str.end() && (sitr != stream_end)) {
       if (*itr == '%') {
- itr++;
+ if ( ++itr == format_str.end())
+ break;
         if (*itr != '%') {
           switch(*itr) {
           case 'a':
@@ -666,7 +669,8 @@
     const_itr itr(format_str.begin());
     while (itr != format_str.end() && (sitr != stream_end)) {
       if (*itr == '%') {
- itr++;
+ if ( ++itr == format_str.end())
+ break;
         if (*itr != '%') {
           //match_results mr;
           switch(*itr) {

Modified: branches/release/boost/date_time/time_facet.hpp
==============================================================================
--- branches/release/boost/date_time/time_facet.hpp Tue Oct 15 10:08:57 2013 (r86321)
+++ branches/release/boost/date_time/time_facet.hpp 2013-10-15 11:22:02 EDT (Tue, 15 Oct 2013) (r86322)
@@ -822,7 +822,7 @@
         const_itr itr(m_time_duration_format.begin());
         while (itr != m_time_duration_format.end() && (sitr != stream_end)) {
           if (*itr == '%') {
- ++itr;
+ if (++itr == m_time_duration_format.end()) break;
             if (*itr != '%') {
               switch(*itr) {
               case 'O':
@@ -994,7 +994,7 @@
         const_itr itr(this->m_format.begin());
         while (itr != this->m_format.end() && (sitr != stream_end)) {
           if (*itr == '%') {
- ++itr;
+ if (++itr == this->m_format.end()) break;
             if (*itr != '%') {
               // the cases are grouped by date & time flags - not alphabetical order
               switch(*itr) {

Modified: branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp
==============================================================================
--- branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp Tue Oct 15 10:08:57 2013 (r86321)
+++ branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp 2013-10-15 11:22:02 EDT (Tue, 15 Oct 2013) (r86322)
@@ -212,6 +212,11 @@
     ss.str("%2005");
     ss >> y;
     check_equal("Multiple literal '%'s in year format", y, greg_year(2005));
+
+ f->year_format("%Y%");
+ ss.str("2005%");
+ ss >> y;
+ check_equal("Trailing'%'s in year format", y, greg_year(2005));
   }
 
   // All days, month, weekday, day, and year formats have been tested


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