From f08b3f2046e9f72369c36fe39e71ced5d1943e8c Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Fri, 2 Aug 2024 06:31:11 -0400 Subject: Update to libhunspell 1.7.2-r1 (#2175) --- indra/llui/llspellcheck.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'indra/llui/llspellcheck.cpp') diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 9d8eadfd3f..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 - #pragma comment(lib, "libhunspell.lib") -#else - #include -#endif +#include 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::vectorsuggest(&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(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) -- cgit v1.2.3