Author: wyoung
Date: Mon Jan 21 18:19:08 2008
New Revision: 2122
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2122&view=rev
Log:
Check in converting floating point values in string form to doubles and
floats now uses the C locale information to figure out what the decimal
point character should be instead of assuming it's '.'.
Modified:
trunk/lib/mystring.h
Modified: trunk/lib/mystring.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/mystring.h?rev=2122&r1=2121&r2=2122&view=diff
==============================================================================
--- trunk/lib/mystring.h (original)
+++ trunk/lib/mystring.h Mon Jan 21 18:19:08 2008
@@ -37,6 +37,8 @@
#include "sql_buffer.h"
#include <string>
+
+#include <locale.h>
#include <stdlib.h>
namespace mysqlpp {
@@ -612,7 +614,7 @@
#endif // DOXYGEN_IGNORE
-// The generic conv() implementation for integral types.
+// The generic conv() implementation for numeric types.
template <class Type>
Type
String::conv(Type) const
@@ -625,7 +627,10 @@
const char* end = str;
Type num = internal_string_to_number_proxy<Type>(str, end);
- if (*end == '.') {
+ lconv* lc = localeconv();
+ if ((lc && lc->decimal_point && lc->decimal_point[0] ) ?
+ *end == lc->decimal_point[0] :
+ *end == '.') {
++end;
for (; *end == '0'; ++end) ;
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits