From 838d2dd40b0b731eba9b73d89323cf1617dcb43b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 9 Nov 2023 13:10:29 +0300 Subject: =?UTF-8?q?fixes=20#3901=20(IRC:=20=D0=BF=D0=B5=D1=80=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BB=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=82=D1=8C=D1=81=D1=8F=20=D0=BD=D0=B5=D0=BA=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B8=D0=B7=20=D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81?= =?UTF-8?q?=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mir_core/src/Windows/langpack.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mir_core/src/Windows/langpack.cpp b/src/mir_core/src/Windows/langpack.cpp index 0e8ab01532..9a9a96fde8 100644 --- a/src/mir_core/src/Windows/langpack.cpp +++ b/src/mir_core/src/Windows/langpack.cpp @@ -47,7 +47,7 @@ struct LangPackEntry : public MZeroedObject char *utfLocal; wchar_t *wszLocal; MUUID *pMuuid; - LangPackEntry* pNext; // for langpack items with the same hash value + LangPackEntry *pNext; // for langpack items with the same hash value ~LangPackEntry() { @@ -111,7 +111,7 @@ static int ConvertBackslashes(char *str, UINT fileCp) #endif // MurmurHash2 -MIR_CORE_DLL(unsigned int) mir_hash(const void * key, unsigned int len) +MIR_CORE_DLL(unsigned int) mir_hash(const void *key, unsigned int len) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. @@ -249,7 +249,7 @@ static void LoadLangPackFile(FILE *fp, char *line) if (!memcmp(line + 1, "include", 7)) { wchar_t tszFileName[MAX_PATH]; - wchar_t *p = wcsrchr(langPack.tszFullPath, '\\'); + wchar_t *p = wcsrchr(langPack.tszFullPath, '\\'); if (p) *p = 0; mir_snwprintf(tszFileName, L"%s\\%S", langPack.tszFullPath, ltrim(line + 9)); @@ -302,10 +302,9 @@ static void LoadLangPackFile(FILE *fp, char *line) E->pMuuid = pCurrentMuuid; auto p = g_entries.find(hash); - if (p == g_entries.end()) - g_entries[hash] = E; - else - (*p).second->pNext = E; + if (p != g_entries.end()) + E->pNext = (*p).second; + g_entries[hash] = E; int iNeeded = MultiByteToWideChar(CP_UTF8, 0, line, -1, nullptr, 0), iOldLen; if (E->wszLocal == nullptr) { @@ -395,7 +394,8 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start wchar_t *p = wcschr(lpinfo.tszFileName, '_'); wcsncpy_s(lpinfo.tszLanguage, ((p != nullptr) ? (p + 1) : lpinfo.tszFileName), _TRUNCATE); p = wcsrchr(lpinfo.tszLanguage, '.'); - if (p != nullptr) *p = '\0'; + if (p != nullptr) + *p = '\0'; } return 0; } @@ -636,7 +636,7 @@ void GetDefaultLang() return; } } - + // try to load langpack that matches UserDefaultUILanguage wchar_t tszPath[MAX_PATH]; if (GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, tszLangName, _countof(tszLangName))) { -- cgit v1.2.3