]> git.lyx.org Git - lyx.git/blobdiff - src/aspell.C
fix two crashes related to dEPM. Some crashes remain
[lyx.git] / src / aspell.C
index 4dc3ccef0d92b75e8d900cc4e4f714c5b2474ac8..be2dc6ae981734d7c9b29c37948c21142ffca9fc 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file aspell_local.C
+ * \file aspell.C
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
@@ -11,8 +11,6 @@
 
 #include <config.h>
 
-#ifdef USE_ASPELL
-
 #include "debug.h"
 
 #include <aspell.h>
@@ -20,8 +18,9 @@
 #include "aspell_local.h"
 #include "WordLangTuple.h"
 
+#include <boost/assert.hpp>
 
-using namespace lyx::support;
+using std::string;
 
 
 ASpell::ASpell(BufferParams const &, string const & lang)
@@ -72,9 +71,9 @@ void ASpell::addSpeller(string const & lang)
 }
 
 
-enum ASpell::Result ASpell::check(WordLangTuple const & word)
+ASpell::Result ASpell::check(WordLangTuple const & word)
 {
-       Result res = UNKNOWN;
+       Result res = UNKNOWN_WORD;
 
        Spellers::iterator it = spellers_.find(word.lang_code());
        if (it == spellers_.end()) {
@@ -87,7 +86,7 @@ enum ASpell::Result ASpell::check(WordLangTuple const & word)
 
        AspellSpeller * m = it->second.speller;
 
-       int word_ok = aspell_speller_check(m, word.word().c_str(), -1);
+       int const word_ok = aspell_speller_check(m, word.word().c_str(), -1);
        BOOST_ASSERT(word_ok != -1);
 
        if (word_ok) {
@@ -98,9 +97,9 @@ enum ASpell::Result ASpell::check(WordLangTuple const & word)
                BOOST_ASSERT(sugs != 0);
                els = aspell_word_list_elements(sugs);
                if (aspell_word_list_empty(sugs))
-                       res = UNKNOWN;
+                       res = UNKNOWN_WORD;
                else
-                       res = MISSED;
+                       res = SUGGESTED_WORDS;
        }
        return res;
 }
@@ -128,9 +127,8 @@ string const ASpell::nextMiss()
 
        if (els)
                str = aspell_string_enumeration_next(els);
-       if (str)
-               return str;
-       return "";
+
+       return (str ? str : "");
 }
 
 
@@ -142,9 +140,5 @@ string const ASpell::error()
                err = aspell_error_message(spell_error_object);
        }
 
-       if (err)
-               return err;
-       return "";
+       return (err ? err : "");
 }
-
-#endif // USE_ASPELL