|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73347 - trunk/boost
From: antoshkka_at_[hidden]
Date: 2011-07-25 01:02:08
Author: apolukhin
Date: 2011-07-25 01:02:07 EDT (Mon, 25 Jul 2011)
New Revision: 73347
URL: http://svn.boost.org/trac/boost/changeset/73347
Log:
#5732. Adds workaround for MinGW bugs
Text files modified:
trunk/boost/lexical_cast.hpp | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp (original)
+++ trunk/boost/lexical_cast.hpp 2011-07-25 01:02:07 EDT (Mon, 25 Jul 2011)
@@ -1147,21 +1147,42 @@
bool shl_float(float val,wchar_t* out)
{ using namespace std;
if (put_inf_nan(start,finish,val)) return true;
- finish = start + swprintf(out,finish-start,L"%.*g", static_cast<int>(boost::detail::lcast_get_precision<float >()), val );
+ finish = start + swprintf(out,
+#ifndef __MINGW32__
+ finish-start,
+#endif
+ L"%.*g", static_cast<int>(boost::detail::lcast_get_precision<float >()), val );
+
return finish > start;
}
+
bool shl_double(double val,wchar_t* out)
{ using namespace std;
if (put_inf_nan(start,finish,val)) return true;
- finish = start + swprintf(out,finish-start,L"%.*lg", static_cast<int>(boost::detail::lcast_get_precision<double >()), val );
+ /* __MINGW32__ is defined for both mingw.org and for mingw-w64.
+ * For mingw-w64, __MINGW64__ is defined, too, when targetting
+ * 64 bits.
+ *
+ * swprintf realization in MinGW does not conform to the ISO C
+ * Standard.
+ */
+ finish = start + swprintf(out,
+#ifndef __MINGW32__
+ finish-start,
+#endif
+ L"%.*lg", static_cast<int>(boost::detail::lcast_get_precision<double >()), val );
return finish > start;
}
bool shl_long_double(long double val,wchar_t* out)
{ using namespace std;
if (put_inf_nan(start,finish,val)) return true;
- finish = start + swprintf(out,finish-start,L"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double >()), val );
+ finish = start + swprintf(out,
+#ifndef __MINGW32__
+ finish-start,
+#endif
+ L"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double >()), val );
return finish > start;
}
#endif
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