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:
Saran Tunyasuvunakool
2023-05-11 14:00:45 -07:00
committed by Copybara-Service
parent 3d71b160e6
commit 0d0a41d549
+2 -2
View File
@@ -62,13 +62,13 @@ class LocaleOverride {
}
~LocaleOverride() {
setlocale(LC_ALL, old_locale_);
setlocale(LC_ALL, old_locale_.c_str());
_configthreadlocale(old_per_thread_locale_type_);
}
private:
int old_per_thread_locale_type_;
char* old_locale_;
std::string old_locale_;
};
#else
class LocaleOverride {