clean: delete stub_msvc.h

This commit is contained in:
shenleban tongying 2024-11-20 04:36:02 -05:00
parent 112874b0e3
commit 8f6ef372be
18 changed files with 12 additions and 79 deletions

View file

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

View file

@ -40,7 +40,7 @@ inline QString rstrip( const QString & str )
} }
std::string c_string( 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 * remove punctuation , space, symbol
* *

View file

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

View file

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

View file

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

View file

@ -27,10 +27,6 @@
#include <list> #include <list>
#include <wctype.h> #include <wctype.h>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QSemaphore> #include <QSemaphore>
#include <QThreadPool> #include <QThreadPool>
#include <QAtomicInt> #include <QAtomicInt>
@ -1741,7 +1737,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
int extSize = ( uncompressedDsl ? 4 : 7 ); int extSize = ( uncompressedDsl ? 4 : 7 );
if ( fileName.size() - extSize >= 5 if ( fileName.size() - extSize >= 5
&& strncasecmp( fileName.c_str() + fileName.size() - extSize - 5, "_abrv", 5 ) == 0 ) { && qstrnicmp( fileName.c_str() + fileName.size() - extSize - 5, "_abrv", 5 ) == 0 ) {
// It is, skip it // It is, skip it
continue; continue;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,9 +9,6 @@
#include <QLocale> #include <QLocale>
#include <QRegularExpression> #include <QRegularExpression>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
// Language codes // Language codes
QMap< QString, GDLangCode > LangCoder::LANG_CODE_MAP = { QMap< QString, GDLangCode > LangCoder::LANG_CODE_MAP = {
@ -231,10 +228,10 @@ QString LangCoder::intToCode2( quint32 val )
quint32 LangCoder::findIdForLanguage( gd::wstring const & lang ) 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 ) { 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() ); 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