mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 16:04:06 +00:00
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:
parent
5b9a1611ff
commit
9c46e5c317
|
@ -30,7 +30,8 @@ std::string c_string( const QString & str )
|
||||||
|
|
||||||
bool endsWithIgnoreCase( QByteArrayView str, QByteArrayView extension )
|
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 )
|
QString escapeAmps( QString const & str )
|
||||||
|
|
|
@ -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"
|
// Make sure it's not an abbreviation file. extSize of ".dsl" or ".dsl.dz"
|
||||||
|
|
||||||
if ( int extSize = ( uncompressedDsl ? 4 : 7 ); ( fileName.size() >= ( 5 + extSize ) )
|
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
|
// It is, skip it
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ quint32 LangCoder::findIdForLanguage( gd::wstring const & lang )
|
||||||
const auto langFolded = QByteArrayView( Utf8::encode( lang ) );
|
const auto langFolded = QByteArrayView( Utf8::encode( lang ) );
|
||||||
|
|
||||||
for ( auto const & lc : LANG_CODE_MAP ) {
|
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() );
|
return code2toInt( lc.code2.toStdString().c_str() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue