diff --git a/src/Parsers/CppParser/cppdocumentparser.cpp b/src/Parsers/CppParser/cppdocumentparser.cpp index 2fae069..6e5e51e 100644 --- a/src/Parsers/CppParser/cppdocumentparser.cpp +++ b/src/Parsers/CppParser/cppdocumentparser.cpp @@ -342,7 +342,7 @@ class CppDocumentParserPrivate QStringSet getCppFiles( const QStringSet& list ) { return Utils::filtered( list, []( const QString& file ) { - const CppEditor::ProjectFile::Kind kind = CppEditor::ProjectFile::classify( file ); + const CppEditor::ProjectFile::Kind kind = CppEditor::ProjectFile::classify( Utils::FilePath::fromString( file ) ); switch( kind ) { case CppEditor::ProjectFile::Unclassified: return false; diff --git a/src/Parsers/CppParser/cppdocumentprocessor.cpp b/src/Parsers/CppParser/cppdocumentprocessor.cpp index 7a08dee..4397904 100644 --- a/src/Parsers/CppParser/cppdocumentprocessor.cpp +++ b/src/Parsers/CppParser/cppdocumentprocessor.cpp @@ -23,9 +23,10 @@ #include "cppparserconstants.h" #include -#include #include +#include #include +#include using namespace SpellChecker; using namespace SpellChecker::CppSpellChecker::Internal; diff --git a/src/SpellCheckers/HunspellChecker/hunspellchecker.cpp b/src/SpellCheckers/HunspellChecker/hunspellchecker.cpp index d011ebc..29833ba 100644 --- a/src/SpellCheckers/HunspellChecker/hunspellchecker.cpp +++ b/src/SpellCheckers/HunspellChecker/hunspellchecker.cpp @@ -33,9 +33,9 @@ #include #include #include -#include -#include #include +#include +#include #include #include @@ -56,7 +56,8 @@ class HunspellWrapper /* Get the affix dictionary path */ QString affPath = QString( dictionary ).replace( QRegularExpression("\\.dic$"), ".aff"); d_hunspell = HunspellPtr( new ::Hunspell( affPath.toLatin1(), dictionary.toLatin1() ) ); - d_codec = QTextCodec::codecForName( d_hunspell->get_dic_encoding() ); + d_decoder = QStringDecoder{ d_hunspell->get_dic_encoding() }; + d_encoder = QStringEncoder{ d_hunspell->get_dic_encoding() }; } /*! \brief Check if the supplied \a word is a spelling mistake or not. * @@ -110,8 +111,9 @@ class HunspellWrapper * its Latin-1 representation. */ std::string encode( const QString& word ) const { - if( d_codec != nullptr ) { - return d_codec->fromUnicode( word ).toStdString(); + if ( d_encoder.isValid() ) { + QByteArray encoded = d_encoder( word ); + return encoded.toStdString(); } return word.toLatin1().toStdString(); } @@ -126,8 +128,8 @@ class HunspellWrapper * its Latin-1 representation. */ QString decode( const std::string& word ) const { - if( d_codec != nullptr ) { - return d_codec->toUnicode( word.c_str(), word.size() ); + if ( d_decoder.isValid() ) { + return d_decoder.decode( QByteArrayView{ word.c_str(), static_cast( word.size() ) } ); } return QLatin1String( word ); } @@ -135,7 +137,8 @@ class HunspellWrapper private: using HunspellPtr = QSharedPointer< ::Hunspell>; HunspellPtr d_hunspell; - QTextCodec* d_codec; + mutable QStringDecoder d_decoder; + mutable QStringEncoder d_encoder; mutable QMutex d_mutex; };