r25056 by jghali - Revert incorrect modifications to hunspelldict.cpp done at the wrong place
scribus-commit
scribus-commit at lists.scribus.net
Thu Mar 24 21:25:20 UTC 2022
Author: jghali
Date: Thu Mar 24 21:25:20 2022
New Revision: 25056
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25056
Log:
Revert incorrect modifications to hunspelldict.cpp done at the wrong place
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=25056&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 21:25:20 2022
@@ -40,19 +40,19 @@
int HunspellDict::spell(const QString& word)
{
if (m_hunspell)
- return m_hunspell->spell(m_codec->fromUnicode(word).toStdString());
+ return m_hunspell->spell(m_codec->fromUnicode(word).constData());
return -1;
}
QStringList HunspellDict::suggest(const QString& word)
{
+ char **sugglist = nullptr;
QStringList replacements;
- std::vector<std::string> suggestions = m_hunspell->suggest(m_codec->fromUnicode(word).toStdString());
- replacements.reserve(suggestions.size());
- for(size_t i = 0, l = suggestions.size(); i < l; ++i)
- replacements << QString::fromStdString(suggestions[i]);
-// ugly but works
-// std::transform(suggestions.begin(), suggestions.end(), std::back_inserter(replacements), [](const std::string& s) -> QString { return QString::fromStdString(s); });
+
+ 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