From cfca6221a44d8ce3039cb3e73e1fc632a1ed516b Mon Sep 17 00:00:00 2001 From: 0tkl <118708188+0tkl@users.noreply.github.com> Date: Sat, 25 Nov 2023 21:34:55 +0800 Subject: [PATCH] Remove unneeded type conversions in spellchecker_hunspell.cpp --- src/spellchecker_hunspell.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spellchecker_hunspell.cpp b/src/spellchecker_hunspell.cpp index 96edb3d7a0..0e1e36c7cc 100644 --- a/src/spellchecker_hunspell.cpp +++ b/src/spellchecker_hunspell.cpp @@ -59,7 +59,7 @@ void HunspellSpellChecker::AddWord(std::string_view word) { if (!hunspell) return; // Add it to the in-memory dictionary - hunspell->add(conv->Convert(word).c_str()); + hunspell->add(conv->Convert(word)); // Add the word if (customWords.insert(std::string(word)).second) @@ -70,7 +70,7 @@ void HunspellSpellChecker::RemoveWord(std::string_view word) { if (!hunspell) return; // Remove it from the in-memory dictionary - hunspell->remove(conv->Convert(word).c_str()); + hunspell->remove(conv->Convert(word)); auto word_iter = customWords.find(word); if (word_iter != customWords.end()) { @@ -117,7 +117,7 @@ void HunspellSpellChecker::WriteUserDictionary() { bool HunspellSpellChecker::CheckWord(std::string_view word) { if (!hunspell) return true; try { - return hunspell->spell(conv->Convert(word)) == 1; + return hunspell->spell(conv->Convert(word)); } catch (agi::charset::ConvError const&) { return false; @@ -205,7 +205,7 @@ void HunspellSpellChecker::OnLanguageChanged() { for (auto const& word : customWords) { try { - hunspell->add(conv->Convert(word).c_str()); + hunspell->add(conv->Convert(word)); } catch (agi::charset::ConvError const&) { // Normally this shouldn't happen, but some versions of Aegisub