Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78408 - trunk/boost
From: antoshkka_at_[hidden]
Date: 2012-05-10 13:39:48


Author: apolukhin
Date: 2012-05-10 13:39:46 EDT (Thu, 10 May 2012)
New Revision: 78408
URL: http://svn.boost.org/trac/boost/changeset/78408

Log:
Fixes #6852 for wide characters (ISO C++ does not support the ‘%lg’ gnu_printf format fixed)
Text files modified:
   trunk/boost/lexical_cast.hpp | 7 +++++--
   1 files changed, 5 insertions(+), 2 deletions(-)

Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp (original)
+++ trunk/boost/lexical_cast.hpp 2012-05-10 13:39:46 EDT (Thu, 10 May 2012)
@@ -1354,8 +1354,11 @@
             static bool shl_real_type(float val, wchar_t* begin, wchar_t*& end)
             { using namespace std;
                 if (put_inf_nan(begin, end, val)) return true;
+ const double val_as_double = val;
                 end = begin + swprintf(begin, end-begin,
- L"%.*g", static_cast<int>(boost::detail::lcast_get_precision<float >()), val );
+ L"%.*g",
+ static_cast<int>(boost::detail::lcast_get_precision<float >()),
+ val_as_double );
                 return end > begin;
             }
 
@@ -1363,7 +1366,7 @@
             { using namespace std;
                 if (put_inf_nan(begin, end, val)) return true;
                 end = begin + swprintf(begin, end-begin,
- L"%.*lg", static_cast<int>(boost::detail::lcast_get_precision<double >()), val );
+ L"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double >()), val );
                 return end > begin;
             }
 


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