euroelessar / qutim

Module based Instant Messenger
http://qutim.org/
Other
141 stars 32 forks source link

Build failed with hunspell 1.5.4 #399

Open Hubbitus opened 7 years ago

Hubbitus commented 7 years ago
/builddir/build/BUILD/qutim.468bede/src/plugins/generic/hunspeller/src/hunspellchecker.cpp:89:30: error: no matching function for call to 'Hunspell::add(QByteArray)'
  m_speller->add(convert(word));

Full build log: https://kojipkgs.fedoraproject.org//work/tasks/3456/17183456/build.log

sibskull commented 5 years ago

Try this patch:

diff --git a/qutim/plugins/hunspeller/src/hunspellchecker.cpp b/qutim/plugins/hunspeller/src/hunspellchecker.cpp
index a7e99de..35b8f18 100644
--- a/qutim/plugins/hunspeller/src/hunspellchecker.cpp
+++ b/qutim/plugins/hunspeller/src/hunspellchecker.cpp
@@ -66,7 +66,8 @@ bool HunSpellChecker::isCorrect(const QString &word) const
 {
        if (!m_speller)
                return true; //unnecessary underline all words
-       return m_speller->spell(QString(convert(word)));
+       QByteArray b = convert(word);
+       return m_speller->spell(std::string(b.constData(), b.length()));
 }

 QStringList HunSpellChecker::suggest(const QString &word) const
@@ -75,7 +76,8 @@ QStringList HunSpellChecker::suggest(const QString &word) const
                return QStringList();
        char **selection;
        QStringList lst;
-       int count = m_speller->suggest(&selection, QString(convert(word)));
+       QByteArray b = convert(word);
+       int count = m_speller->suggest(&selection, std::string(b.constData(), b.length()).c_str());
        for(int i = 0; i < count; ++i)
                lst << (m_codec ? m_codec->toUnicode(selection[i]) : QString::fromUtf8(selection[i]));
        m_speller->free_list(&selection, count);
@@ -86,7 +88,8 @@ void HunSpellChecker::store(const QString &word) const
 {
        if (!m_speller)
                return;
-       m_speller->add(QString(convert(word)));
+       QByteArray b = convert(word);
+       m_speller->add(std::string(b.constData(), b.length()));
 }

 void HunSpellChecker::storeReplacement(const QString &bad, const QString &good)