Skip to content

Commit

Permalink
clean: delete stub_msvc.h
Browse files Browse the repository at this point in the history
  • Loading branch information
shenlebantongying authored Nov 20, 2024
1 parent 112874b commit 5b9a161
Show file tree
Hide file tree
Showing 18 changed files with 14 additions and 82 deletions.
8 changes: 2 additions & 6 deletions src/common/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#include <QStyle>
#include <QMessageBox>
#include <string>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif
#include <QBuffer>
#include <QTextCodec>

Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/common/utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
3 changes: 0 additions & 3 deletions src/dict/aard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#include <set>
#include <string>

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include <QString>
#include <QSemaphore>
Expand Down
3 changes: 0 additions & 3 deletions src/dict/bgl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#include <string.h>
#include <zlib.h>

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include <QAtomicInt>
#include <QPainter>
Expand Down
4 changes: 0 additions & 4 deletions src/dict/dictdfiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@

#include <QRegularExpression>

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

namespace DictdFiles {

using std::map;
Expand Down
11 changes: 3 additions & 8 deletions src/dict/dsl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
#include <list>
#include <wctype.h>

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include <QSemaphore>
#include <QThreadPool>
#include <QAtomicInt>
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 6 additions & 2 deletions src/dict/epwing_book.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 0 additions & 3 deletions src/dict/gls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
#include <map>
#include <set>

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

namespace Gls {

Expand Down
4 changes: 0 additions & 4 deletions src/dict/lsa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 0 additions & 3 deletions src/dict/mdx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
#include <map>
#include <set>
#include <list>
#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include "globalregex.hh"
#include "tiff.hh"
Expand Down
6 changes: 0 additions & 6 deletions src/dict/sdict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
#include <set>
#include <string>

#include "utils.hh"


#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

namespace Sdict {

Expand Down
4 changes: 0 additions & 4 deletions src/dict/slob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
#include "tiff.hh"
#include "utils.hh"

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include "iconv.hh"

#include <QString>
Expand Down
3 changes: 0 additions & 3 deletions src/dict/stardict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
#endif
#include <stdlib.h>

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include <QString>
#include <QSemaphore>
Expand Down
3 changes: 0 additions & 3 deletions src/dict/xdxf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include "tiff.hh"
#include "ftshelpers.hh"

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include <QIODevice>
#include <QXmlStreamReader>
Expand Down
4 changes: 0 additions & 4 deletions src/dict/zim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
#include "ftshelpers.hh"
#include "htmlescape.hh"

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include <QByteArray>
#include <QFile>
#include <QString>
Expand Down
3 changes: 0 additions & 3 deletions src/dict/zipsounds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
#include <QFile>
#include <QDir>

#ifdef _MSC_VER
#include <stub_msvc.h>
#endif

#include "utils.hh"

Expand Down
7 changes: 2 additions & 5 deletions src/langcoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 ) ) {

This comment has been minimized.

Copy link
@xiaoyifang

xiaoyifang Nov 20, 2024

Owner

==0,

return code2toInt( lc.code2.toStdString().c_str() );
}
}
Expand Down
17 changes: 0 additions & 17 deletions src/windows/stub_msvc.h

This file was deleted.

2 comments on commit 5b9a161

@atauzki
Copy link
Collaborator

@atauzki atauzki commented on 5b9a161 Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks windows dictioary index.

@xiaoyifang
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed ,
@shenlebantongying
Image

Please sign in to comment.