diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-07 12:31:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-07 12:31:56 +0300 |
commit | d644d959712596bb4a54353da1003212bac4091b (patch) | |
tree | af4c90df460aad43a393e5e4393f0ea877947929 /plugins/SpellChecker/src/utils.cpp | |
parent | 9df9bf30b3090c46d3501b9ec7425602af20144a (diff) |
code cleaning
Diffstat (limited to 'plugins/SpellChecker/src/utils.cpp')
-rw-r--r-- | plugins/SpellChecker/src/utils.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
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)
|