Better locale changing.

GitOrigin-RevId: 51700edad491f43264769b932961a3eae1c7fd34
This commit is contained in:
levlam 2018-02-10 00:52:03 +03:00
parent eb8c28c711
commit df4f8b0809
2 changed files with 4 additions and 4 deletions

View File

@ -2957,9 +2957,9 @@ void main(int argc, char **argv) {
set_signal_handler(SignalType::Abort, fail_signal).ensure();
td::Log::set_fatal_error_callback(on_fatal_error);
std::string locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "C" : "fr-FR");
std::locale locale_fr(locale_name);
std::locale::global(locale_fr);
const char *locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "" : "fr-FR");
std::locale new_locale(locale_name);
std::locale::global(new_locale);
SCOPE_EXIT {
std::locale::global(std::locale::classic());
};

View File

@ -217,7 +217,7 @@ static void test_to_double() {
TEST(Misc, to_double) {
test_to_double();
std::string locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "C" : "fr-FR");
const char *locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "" : "fr-FR");
std::locale new_locale(locale_name);
std::locale::global(new_locale);
test_to_double();