Fix locale management on Windows.
We are currently passing a value previously returned by setlocale to a later call to setlocale, but the spec says that we should be making a copy of it. PiperOrigin-RevId: 531300386 Change-Id: I9531cfe738fc71fb26b4140a4129dfe67f5f6112
This commit is contained in:
committed by
Copybara-Service
parent
3d71b160e6
commit
0d0a41d549
+2
-2
@@ -62,13 +62,13 @@ class LocaleOverride {
|
|||||||
}
|
}
|
||||||
|
|
||||||
~LocaleOverride() {
|
~LocaleOverride() {
|
||||||
setlocale(LC_ALL, old_locale_);
|
setlocale(LC_ALL, old_locale_.c_str());
|
||||||
_configthreadlocale(old_per_thread_locale_type_);
|
_configthreadlocale(old_per_thread_locale_type_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int old_per_thread_locale_type_;
|
int old_per_thread_locale_type_;
|
||||||
char* old_locale_;
|
std::string old_locale_;
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
class LocaleOverride {
|
class LocaleOverride {
|
||||||
|
|||||||
Reference in New Issue
Block a user