Martin Sebor
Thu, 03 Apr 2008 08:55:43 -0700
[EMAIL PROTECTED] wrote:
Author: elemings Date: Thu Apr 3 08:32:56 2008 New Revision: 644364 URL: http://svn.apache.org/viewvc?rev=644364&view=rev Log: 2008-04-03 Eric Lemings <[EMAIL PROTECTED]> STDCXX-811 * src/locale_global.cpp (std::locale::global): Replace call to non-reentrant setlocale() C function with reentrant __rw_setlocale object.
I don't think that's correct. The object's dtor restores the original locale. We need a mutex around the call to setlocale. Look for/at the _RWSTD_STATIC_GUARD() and _RWSTD_CLASS_GUARD() macros. Martin
* tests/localization/22.locale.statics.mt.cpp (test_global): Fix [un]signed integer conversion warnings. Modified: stdcxx/trunk/src/locale_global.cpp stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp Modified: stdcxx/trunk/src/locale_global.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/locale_global.cpp?rev=644364&r1=644363&r2=644364&view=diff ============================================================================== --- stdcxx/trunk/src/locale_global.cpp (original) +++ stdcxx/trunk/src/locale_global.cpp Thu Apr 3 08:32:56 2008 @@ -37,6 +37,7 @@ #include <loc/_locale.h>#include "locale_body.h"+#include "setlocale.h"@@ -53,7 +54,8 @@ // assumes all locale names (i.e., including those of combined// locales) are in a format understandable by setlocale() - setlocale (_RWSTD_LC_ALL, rhs.name ().c_str ()); + const _RW::__rw_setlocale clocale (rhs.name().c_str(), _RWSTD_LC_ALL); + _RWSTD_UNUSED(clocale);// FIXME:// handle unnamed locales (i.e., locales containing non-standard Modified: stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp?rev=644364&r1=644363&r2=644364&view=diff ============================================================================== --- stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp (original) +++ stdcxx/trunk/tests/localization/22.locale.statics.mt.cpp Thu Apr 3 08:32:56 2008 @@ -88,9 +88,9 @@ static void* test_global (void*) { - for (int i = 0; i != opt_nloops; ++i) { + for (std::size_t i = 0; i != opt_nloops; ++i) {- const int inx = i % nlocales;+ const std::size_t inx = i % nlocales;const std::locale last (std::locale::global (locales [inx]));