From d644d959712596bb4a54353da1003212bac4091b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 7 Feb 2019 12:31:56 +0300 Subject: code cleaning --- plugins/SpellChecker/src/utils.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'plugins/SpellChecker') diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index a96952d541..fc8a83365e 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -707,22 +707,16 @@ int GetClosestLanguage(wchar_t *lang_name) void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, char *setting) { - DBVARIANT dbv = { 0 }; - dbv.type = DBVT_WCHAR; - if (db_get_ws(hContact, group, setting, &dbv)) + ptrW wszLang(db_get_wsa(hContact, group, setting)); + if (wszLang == nullptr) return; - if (dbv.type == DBVT_WCHAR && dbv.pwszVal != nullptr) { - wchar_t *lang = dbv.pwszVal; - - for (auto &dict : languages) { - if (mir_wstrcmpi(dict->localized_name, lang) == 0 || mir_wstrcmpi(dict->english_name, lang) == 0 || mir_wstrcmpi(dict->language, lang) == 0) { - mir_wstrncpy(dlg->lang_name, dict->language, _countof(dlg->lang_name)); - break; - } + for (auto &dict : languages) { + if (mir_wstrcmpi(dict->localized_name, wszLang) == 0 || mir_wstrcmpi(dict->english_name, wszLang) == 0 || mir_wstrcmpi(dict->language, wszLang) == 0) { + mir_wstrncpy(dlg->lang_name, dict->language, _countof(dlg->lang_name)); + break; } } - db_free(&dbv); } void GetUserLanguageSetting(Dialog *dlg, char *setting) -- cgit v1.2.3