diff options
author | George Hazan <ghazan@miranda.im> | 2017-12-03 21:53:10 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-12-03 21:53:19 +0300 |
commit | 37481a4f6fa9e8b05f0946771c3a15dc3d9fd797 (patch) | |
tree | 10f2b9bec5983abc5220878836f716e01a9968e3 | |
parent | c80c5a68b607b96c645aecd1bff184640669a509 (diff) |
SpellChecker: code cleaning
-rw-r--r-- | plugins/SpellChecker/src/dictionary.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index e12c7d7d47..92f74af3b2 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -428,12 +428,12 @@ protected: return ret; } - wchar_t* fromHunspellAndFree(std::string hunspellWord) + wchar_t* fromHunspellAndFree(const char *hunspellWord) { - if (hunspellWord.c_str() == nullptr) + if (hunspellWord == nullptr) return nullptr; - wchar_t *ret = fromHunspell(hunspellWord.c_str()); + wchar_t *ret = fromHunspell(hunspellWord); return ret; } @@ -460,16 +460,15 @@ public: virtual ~HunspellDictionary() { - if (hunspell != nullptr) - delete hunspell; + delete hunspell; if (wordChars != nullptr) free(wordChars); } wchar_t * merge(wchar_t * s1, wchar_t *s2) { - int len1 = (s1 == nullptr ? 0 : mir_wstrlen(s1)); - int len2 = (s2 == nullptr ? 0 : mir_wstrlen(s2)); + int len1 = mir_wstrlen(s1); + int len2 = mir_wstrlen(s2); wchar_t *ret; if (len1 > 0 && len2 > 0) { @@ -549,7 +548,7 @@ public: hwordchars = fromHunspell(hunspell->get_wordchars()); } - wchar_t *casechars = fromHunspellAndFree(get_casechars(dic_enc)); + wchar_t *casechars = fromHunspellAndFree(get_casechars(dic_enc).c_str()); wchar_t *try_string = fromHunspellAndFree(hunspell->get_try_string()); wordChars = merge(merge(casechars, hwordchars), try_string); |