From af4c6d82d1e4dfa9aa60aeabed408486a3979a3e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 20 May 2021 15:57:57 +0300 Subject: fix for C++ runtime locale settings --- plugins/TabSRMM/src/chat_tools.cpp | 1 - plugins/TabSRMM/src/muchighlight.cpp | 1 - .../CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp | 4 ++-- src/mir_app/src/miranda.cpp | 1 + 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index b3d2044f9c..a10947d45f 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -366,7 +366,6 @@ wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2) { int i, j, k; - _wsetlocale(LC_ALL, L""); for (i = 0; s1[i]; i++) for (j = i, k = 0; towlower(s1[j]) == towlower(s2[k]); j++, k++) if (!s2[k + 1]) diff --git a/plugins/TabSRMM/src/muchighlight.cpp b/plugins/TabSRMM/src/muchighlight.cpp index 57f4df857e..c9d6351bf3 100644 --- a/plugins/TabSRMM/src/muchighlight.cpp +++ b/plugins/TabSRMM/src/muchighlight.cpp @@ -51,7 +51,6 @@ void CMUCHighlight::init() if (0 == db_get_ws(0, CHAT_MODULE, "HighlightWords", &dbv)) { m_TextPatternString = dbv.pwszVal; - _wsetlocale(LC_ALL, L""); wcslwr(m_TextPatternString); } diff --git a/protocols/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp b/protocols/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp index 9b1bfdc31a..db6d2104aa 100644 --- a/protocols/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp +++ b/protocols/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp @@ -19,12 +19,12 @@ CMStringW build_url(MCONTACT hContact, const CMStringW &rsURL) bool parse_response(const CMStringW &rsJSON, double &dRate) { - setlocale(LC_NUMERIC, "en_US"); JSONNode root = JSONNode::parse(_T2A(rsJSON)); if (!root) return false; - return 1 == swscanf(root.at(json_index_t(0)).as_mstring(), L"%lf", &dRate); + dRate = root.at(json_index_t(0)).as_float(); + return true; } using TWatchedRates = std::vector; diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index 38909e4202..0cd0a4c5b5 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -304,6 +304,7 @@ int WINAPI mir_main(LPTSTR cmdLine) CmdLine_Parse(cmdLine); setlocale(LC_ALL, ""); + setlocale(LC_NUMERIC, "C"); #ifdef _DEBUG if (CmdLine_GetOption(L"memdebug")) -- cgit v1.2.3