r25054 by craig - For HUNSPELL_NEWAPI, use new API
scribus-commit
scribus-commit at lists.scribus.net
Thu Mar 24 20:54:51 UTC 2022
Author: craig
Date: Thu Mar 24 20:54:50 2022
New Revision: 25054
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25054
Log:
For HUNSPELL_NEWAPI, use new API
Modified:
trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp
Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25054&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp (original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldict.cpp Thu Mar 24 20:54:50 2022
@@ -40,19 +40,23 @@
int HunspellDict::spell(const QString& word)
{
if (m_hunspell)
- return m_hunspell->spell(m_codec->fromUnicode(word).constData());
+ return m_hunspell->spell(word.toStdString());
return -1;
}
QStringList HunspellDict::suggest(const QString& word)
{
- char **sugglist = nullptr;
QStringList replacements;
+ std::vector<std::string> suggestions = m_hunspell->suggest(word.toStdString());
+ replacements.reserve(suggestions.size());
+ for(size_t i = 0, l = suggestions.size(); i < l; ++i)
+ replacements << QString::fromStdString(suggestions[i]);
- int suggCount = m_hunspell->suggest(&sugglist, m_codec->fromUnicode(word).constData());
- for (int j = 0; j < suggCount; ++j)
- replacements << m_codec->toUnicode(sugglist[j]);
- m_hunspell->free_list(&sugglist, suggCount);
+ // char **sugglist = nullptr;
+// int suggCount = m_hunspell->suggest(&sugglist, m_codec->fromUnicode(word).constData());
+// for (int j = 0; j < suggCount; ++j)
+// replacements << m_codec->toUnicode(sugglist[j]);
+// m_hunspell->free_list(&sugglist, suggCount);
return replacements;
}
More information about the scribus-commit
mailing list