Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78839 - trunk/boost/algorithm
From: marshall_at_[hidden]
Date: 2012-06-06 16:43:23


Author: marshall
Date: 2012-06-06 16:43:22 EDT (Wed, 06 Jun 2012)
New Revision: 78839
URL: http://svn.boost.org/trac/boost/changeset/78839

Log:
Removed a bit of undefined behavior (noted by STL @ microsoft)
Text files modified:
   trunk/boost/algorithm/hex.hpp | 6 ++----
   1 files changed, 2 insertions(+), 4 deletions(-)

Modified: trunk/boost/algorithm/hex.hpp
==============================================================================
--- trunk/boost/algorithm/hex.hpp (original)
+++ trunk/boost/algorithm/hex.hpp 2012-06-06 16:43:22 EDT (Wed, 06 Jun 2012)
@@ -73,7 +73,7 @@
         if ( c >= '0' && c <= '9' ) return c - '0';
         if ( c >= 'A' && c <= 'F' ) return c - 'A' + 10;
         if ( c >= 'a' && c <= 'f' ) return c - 'a' + 10;
- BOOST_THROW_EXCEPTION (non_hex_input() << boost::algorithm::bad_char (c));
+ BOOST_THROW_EXCEPTION (non_hex_input() << bad_char (c));
         return 0; // keep dumb compilers happy
         }
     
@@ -223,10 +223,8 @@
 // If we run into the terminator while decoding, we will throw a
 // malformed input exception. It would be nicer to throw a 'Not enough input'
 // exception - but how much extra work would that require?
-// I just make up an "end iterator" which we will never get to -
-// two Ts per byte of the output type.
     while ( *ptr )
- out = detail::decode_one ( ptr, ptr + 2 * sizeof(OutputType), out );
+ out = detail::decode_one ( ptr, (const T *) NULL, out );
     return out;
     }
 


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