7133639 integrate [Patch] libstdc++/19642 in our bundled gcc (3.4.3) in c++locale.h
authorStefan Teleman <stefan.teleman@oracle.com>
Thu, 16 Feb 2012 11:49:02 -0800
changeset 695 14430a2565d4
parent 694 a8816ddd9020
child 696 b491465fd766
7133639 integrate [Patch] libstdc++/19642 in our bundled gcc (3.4.3) in c++locale.h
components/gcc3/patches/7133639.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gcc3/patches/7133639.patch	Thu Feb 16 11:49:02 2012 -0800
@@ -0,0 +1,34 @@
+--- gcc-3.4.3/libstdc++-v3/config/locale/generic/c_locale.h	Mon Aug 16 09:03:24 2004
++++ gcc-3.4.3/libstdc++-v3/config/locale/generic/c_locale.h	Mon Jan 30 09:50:48 2012
[email protected]@ -59,10 +59,14 @@
+ 		     const char* __fmt,
+ 		     _Tv __v, const __c_locale&, int __prec)
+     {
+-      char* __old = std::setlocale(LC_ALL, NULL);
+-      char* __sav = new char[std::strlen(__old) + 1];
++      char* __old = std::setlocale(LC_NUMERIC, NULL);
++      char* __sav = NULL;
++      if (std::strcmp(__old, "C"))
++	{
++	  __sav = new char[std::strlen(__old) + 1];
+       std::strcpy(__sav, __old);
+-      std::setlocale(LC_ALL, "C");
++	  std::setlocale(LC_NUMERIC, "C");
++	}
+ 
+ #ifdef _GLIBCXX_USE_C99
+       const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
[email protected]@ -69,8 +73,12 @@
+ #else
+       const int __ret = std::sprintf(__out, __fmt, __prec, __v);
+ #endif
+-      std::setlocale(LC_ALL, __sav);
++      
++      if (__sav)
++	{
++	  std::setlocale(LC_NUMERIC, __sav);
+       delete [] __sav;
++	}
+       return __ret;
+     }
+ }