commit 6b3204cbe16f23b16f856daeddc8d13e94e4290b Author: Christophe Giboudeaux Date: Sun Aug 19 14:17:25 2018 +0200 Revert "Use the current hunspell API" The new hunspell api is not available in leap 42.3. This reverts commit 0a96acf251baa5c9dd042d093ab2bf8fcee10502. diff --git a/src/plugins/hunspell/hunspelldict.cpp b/src/plugins/hunspell/hunspelldict.cpp index 397bbbb..cc1dd9b 100644 --- a/src/plugins/hunspell/hunspelldict.cpp +++ b/src/plugins/hunspell/hunspelldict.cpp @@ -102,9 +102,9 @@ bool HunspellDict::isCorrect(const QString &word) const if (!m_speller) { return false; } - bool result = m_speller->spell(toDictEncoding(word).toStdString()); + int result = m_speller->spell(toDictEncoding(word).constData()); qCDebug(SONNET_HUNSPELL) << " result :" << result; - return result; + return result != 0; } QStringList HunspellDict::suggest(const QString &word) const @@ -112,10 +112,13 @@ QStringList HunspellDict::suggest(const QString &word) const if (!m_speller) { return QStringList(); } + char **selection; QStringList lst; - const auto suggestions = m_speller->suggest(toDictEncoding(word).toStdString()); - for_each (suggestions.begin(), suggestions.end(), [this, &lst](const std::string &suggestion) { - lst << m_codec->toUnicode(suggestion.c_str()); }); + int nbWord = m_speller->suggest(&selection, toDictEncoding(word).constData()); + for (int i = 0; i < nbWord; ++i) { + lst << m_codec->toUnicode(selection[i]); + } + m_speller->free_list(&selection, nbWord); return lst; }