diff options
| author | Brad Linden <brad@lindenlab.com> | 2024-08-09 17:57:23 -0700 |
|---|---|---|
| committer | Brad Linden <brad@lindenlab.com> | 2024-08-09 17:57:23 -0700 |
| commit | a7fde9d79c517bfc6165756c1bc3eb16fa4d935c (patch) | |
| tree | f0608f7f72f23a447778f8bce6f210eb221ebdf1 /indra/llui/llspellcheck.cpp | |
| parent | ac330f63fd7ac655bbd06ce5d4ed65430aa2f42a (diff) | |
| parent | c106221726c48a4231b7854bff224ae422c0517f (diff) | |
Merge remote-tracking branch release/2024.06-atlasaurus into 'develop'
Diffstat (limited to 'indra/llui/llspellcheck.cpp')
| -rw-r--r-- | indra/llui/llspellcheck.cpp | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 1615db5b52..16ffd352cf 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -30,12 +30,7 @@ #include "llsdserialize.h" #include "llspellcheck.h" -#if LL_WINDOWS - #include <hunspell/hunspelldll.h> - #pragma comment(lib, "libhunspell.lib") -#else - #include <hunspell/hunspell.hxx> -#endif +#include <hunspell/hunspell.hxx> static const std::string DICT_DIR = "dictionaries"; static const std::string DICT_FILE_CUSTOM = "user_custom.dic"; @@ -64,11 +59,11 @@ void LLSpellChecker::initSingleton() bool LLSpellChecker::checkSpelling(const std::string& word) const { - if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word.c_str())) ) + if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word)) ) { return true; } - if (mIgnoreList.size() > 0) + if (!mIgnoreList.empty()) { std::string word_lower(word); LLStringUtil::toLower(word_lower); @@ -85,15 +80,8 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str return 0; } - char** suggestion_list; int suggestion_cnt = 0; - if ( (suggestion_cnt = mHunspell->suggest(&suggestion_list, word.c_str())) != 0 ) - { - for (int suggestion_index = 0; suggestion_index < suggestion_cnt; suggestion_index++) - { - suggestions.push_back(suggestion_list[suggestion_index]); - } - mHunspell->free_list(&suggestion_list, suggestion_cnt); - } + suggestions = mHunspell->suggest(word); + return static_cast<S32>(suggestions.size()); } @@ -194,7 +182,7 @@ void LLSpellChecker::addToCustomDictionary(const std::string& word) { if (mHunspell) { - mHunspell->add(word.c_str()); + mHunspell->add(word); } addToDictFile(getDictionaryUserPath() + DICT_FILE_CUSTOM, word); sSettingsChangeSignal(); @@ -422,7 +410,7 @@ bool LLSpellChecker::canRemoveDictionary(const std::string& dict_language) const LLSD dict_info = getDictionaryData(dict_language); return (dict_info["user_installed"].asBoolean()) && - ( (!getUseSpellCheck()) || (!LLSpellChecker::instance().isActiveDictionary(dict_language)) ); + ( (!getUseSpellCheck()) || (!isActiveDictionary(dict_language)) ); } void LLSpellChecker::removeDictionary(const std::string& dict_language) @@ -448,7 +436,7 @@ void LLSpellChecker::removeDictionary(const std::string& dict_language) { LLFile::remove(dict_aff); } - dict_map.erase(it - dict_map.beginArray()); + dict_map.erase((LLSD::Integer)(it - dict_map.beginArray())); break; } } |
