From dcda91716ae2b363b8d8bcd689d592e4d35d7939 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 6 Jun 2012 20:43:22 +0000 Subject: [PATCH] Removed a bit of undefined behavior (noted by STL @ microsoft) [SVN r78839] --- include/boost/algorithm/hex.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/boost/algorithm/hex.hpp b/include/boost/algorithm/hex.hpp index 3b9ff80..b6b1548 100644 --- a/include/boost/algorithm/hex.hpp +++ b/include/boost/algorithm/hex.hpp @@ -73,7 +73,7 @@ namespace detail { 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 @@ OutputIterator unhex ( const T *ptr, OutputIterator out ) { // 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; }