fix: wrong use of QBtyeArrayView::compare (#1971)

* fix wrong use of `QBtyeArrayView::compare`

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
atauzki 2024-11-20 20:02:36 +08:00 committed by GitHub
parent 5b9a1611ff
commit 9c46e5c317
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -30,7 +30,8 @@ std::string c_string( const QString & str )
bool endsWithIgnoreCase( QByteArrayView str, QByteArrayView extension )
{
return ( str.size() >= extension.size() ) && str.last( extension.size() ).compare( extension, Qt::CaseInsensitive );
return ( str.size() >= extension.size() )
&& ( str.last( extension.size() ).compare( extension, Qt::CaseInsensitive ) == 0 );
}
QString escapeAmps( QString const & str )

View file

@ -1736,7 +1736,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
// Make sure it's not an abbreviation file. extSize of ".dsl" or ".dsl.dz"
if ( int extSize = ( uncompressedDsl ? 4 : 7 ); ( fileName.size() >= ( 5 + extSize ) )
&& QByteArrayView( fileName ).chopped( extSize ).last( 5 ).compare( "_abrv", Qt::CaseInsensitive ) ) {
&& ( QByteArrayView( fileName ).chopped( extSize ).last( 5 ).compare( "_abrv", Qt::CaseInsensitive ) == 0 ) ) {
// It is, skip it
continue;
}

View file

@ -231,7 +231,7 @@ quint32 LangCoder::findIdForLanguage( gd::wstring const & lang )
const auto langFolded = QByteArrayView( Utf8::encode( lang ) );
for ( auto const & lc : LANG_CODE_MAP ) {
if ( langFolded.compare( lc.lang, Qt::CaseInsensitive ) ) {
if ( langFolded.compare( lc.lang, Qt::CaseInsensitive ) == 0 ) {
return code2toInt( lc.code2.toStdString().c_str() );
}
}