Compare commits

...

5 commits

Author SHA1 Message Date
autofix-ci[bot] 88a54b0bbf
[autofix.ci] apply automated fixes 2024-11-20 10:18:45 +00:00
shenleban tongying 6f95e19881 merge if decl 2024-11-20 05:17:13 -05:00
shenleban tongying 0999f386d2 merge if 2024-11-20 05:02:04 -05:00
shenleban tongying d4d3e443b1 s 2024-11-20 04:49:23 -05:00
shenleban tongying 8f6ef372be clean: delete stub_msvc.h 2024-11-20 04:36:02 -05:00
18 changed files with 14 additions and 82 deletions

View file

@ -4,9 +4,6 @@
#include <QStyle>
#include <QMessageBox>
#include <string>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QBuffer>
#include <QTextCodec>
@ -31,10 +28,9 @@ std::string c_string( const QString & str )
return std::string( str.toUtf8().constData() );
}
bool endsWithIgnoreCase( const string & str1, string str2 )
bool endsWithIgnoreCase( QByteArrayView str, QByteArrayView extension )
{
return ( str1.size() >= (unsigned)str2.size() )
&& ( strcasecmp( str1.c_str() + ( str1.size() - str2.size() ), str2.data() ) == 0 );
return ( str.size() >= extension.size() ) && str.last( extension.size() ).compare( extension, Qt::CaseInsensitive );
}
QString escapeAmps( QString const & str )

View file

@ -40,7 +40,7 @@ inline QString rstrip( const QString & str )
}
std::string c_string( const QString & str );
bool endsWithIgnoreCase( const string & str1, string str2 );
bool endsWithIgnoreCase( QByteArrayView str, QByteArrayView extension );
/**
* remove punctuation , space, symbol
*

View file

@ -16,9 +16,6 @@
#include <set>
#include <string>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QString>
#include <QSemaphore>

View file

@ -22,9 +22,6 @@
#include <string.h>
#include <zlib.h>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QAtomicInt>
#include <QPainter>

View file

@ -23,10 +23,6 @@
#include <QRegularExpression>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
namespace DictdFiles {
using std::map;

View file

@ -27,10 +27,6 @@
#include <list>
#include <wctype.h>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QSemaphore>
#include <QThreadPool>
#include <QAtomicInt>
@ -1737,11 +1733,10 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
continue;
}
// Make sure it's not an abbreviation file
// Make sure it's not an abbreviation file. extSize of ".dsl" or ".dsl.dz"
int extSize = ( uncompressedDsl ? 4 : 7 );
if ( fileName.size() - extSize >= 5
&& strncasecmp( fileName.c_str() + fileName.size() - extSize - 5, "_abrv", 5 ) == 0 ) {
if ( int extSize = ( uncompressedDsl ? 4 : 7 ); ( fileName.size() >= ( 5 + extSize ) )
&& QByteArrayView( fileName ).chopped( extSize ).last( 5 ).compare( "_abrv", Qt::CaseInsensitive ) ) {
// It is, skip it
continue;
}

View file

@ -18,8 +18,12 @@
#include <QString>
#include <QtCore5Compat/QTextCodec>
#ifdef _MSC_VER
#include <stub_msvc.h>
// POSIX symbol unavailable on Windows needed for eb headers
#ifdef Q_OS_WIN
#ifndef _SSIZE_T
#define _SSIZE_T
#define ssize_t long
#endif
#endif
#include <eb/eb.h>

View file

@ -39,9 +39,6 @@
#include <map>
#include <set>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
namespace Gls {

View file

@ -14,10 +14,6 @@
#include <set>
#include <string>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#define OV_EXCLUDE_STATIC_CALLBACKS
#include <vorbis/vorbisfile.h>
#include <QDir>

View file

@ -23,9 +23,6 @@
#include <map>
#include <set>
#include <list>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include "globalregex.hh"
#include "tiff.hh"

View file

@ -19,12 +19,6 @@
#include <set>
#include <string>
#include "utils.hh"
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
namespace Sdict {

View file

@ -17,10 +17,6 @@
#include "tiff.hh"
#include "utils.hh"
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include "iconv.hh"
#include <QString>

View file

@ -30,9 +30,6 @@
#endif
#include <stdlib.h>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QString>
#include <QSemaphore>

View file

@ -27,9 +27,6 @@
#include "tiff.hh"
#include "ftshelpers.hh"
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QIODevice>
#include <QXmlStreamReader>

View file

@ -17,10 +17,6 @@
#include "ftshelpers.hh"
#include "htmlescape.hh"
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QByteArray>
#include <QFile>
#include <QString>

View file

@ -19,9 +19,6 @@
#include <QFile>
#include <QDir>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include "utils.hh"

View file

@ -9,9 +9,6 @@
#include <QLocale>
#include <QRegularExpression>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
// Language codes
QMap< QString, GDLangCode > LangCoder::LANG_CODE_MAP = {
@ -231,10 +228,10 @@ QString LangCoder::intToCode2( quint32 val )
quint32 LangCoder::findIdForLanguage( gd::wstring const & lang )
{
const auto langFolded = Utf8::encode( lang );
const auto langFolded = QByteArrayView( Utf8::encode( lang ) );
for ( auto const & lc : LANG_CODE_MAP ) {
if ( strcasecmp( langFolded.c_str(), lc.lang.c_str() ) == 0 ) {
if ( langFolded.compare( lc.lang, Qt::CaseInsensitive ) ) {
return code2toInt( lc.code2.toStdString().c_str() );
}
}

View file

@ -1,17 +0,0 @@
#pragma once
#include <string>
#ifdef _MSC_VER
#if !defined(strcasecmp)
# define strcasecmp _strcmpi
#endif
#if !defined(strncasecmp)
# define strncasecmp _strnicmp
#endif
#ifndef _SSIZE_T
#define _SSIZE_T
#define ssize_t long
#endif
#endif