From 5bb2fce3c4f1088c1a2765e1df93aeb05bca193a Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Sun, 29 May 2022 16:42:04 +0800 Subject: [PATCH 1/3] fix:clang warning in macos --- dsl.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dsl.cc b/dsl.cc index 6125342e..ae1e6b42 100644 --- a/dsl.cc +++ b/dsl.cc @@ -128,11 +128,7 @@ struct InsidedCard InsidedCard( uint32_t _offset, uint32_t _size, QVector< wstring > const & words ) : offset( _offset ), size( _size ), headwords( words ) {} - InsidedCard( InsidedCard const & e ) : - offset( e.offset ), size( e.size ), headwords( e.headwords ) - {} InsidedCard() {} - }; bool indexIsOldOrBad( string const & indexFile, bool hasZipFile ) From 002a4c830229a0194f61ac1be283e4cd6e0763d7 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Mon, 30 May 2022 07:57:00 +0800 Subject: [PATCH 2/3] add debug info to release version --- goldendict.pro | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/goldendict.pro b/goldendict.pro index f42b42c6..7ff16554 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -65,6 +65,8 @@ LIBS += \ CONFIG+=utf8_source +CONFIG+=force_debug_info + win32 { TARGET = GoldenDict @@ -78,10 +80,7 @@ win32 { # silence the warning C4290: C++ exception specification ignored QMAKE_CXXFLAGS += /wd4290 /Zc:__cplusplus /std:c++17 /permissive- # QMAKE_LFLAGS_RELEASE += /OPT:REF /OPT:ICF - # QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /DEBUG - CONFIG+=force_debug_info - QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO - QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO + # QMAKE_CXXFLAGS_RELEASE += /GL # slows down the linking significantly LIBS += -lshell32 -luser32 -lsapi -lole32 Debug: LIBS+= -lhunspelld From 71b5d3e6ba60103f640ae18b2d8c4d5c5e48cf87 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Mon, 30 May 2022 20:21:44 +0800 Subject: [PATCH 3/3] opt:remove runnable in ftshelper --- ftshelpers.cc | 5 ----- ftshelpers.hh | 29 ++--------------------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/ftshelpers.cc b/ftshelpers.cc index 0d775282..c1a8f08f 100644 --- a/ftshelpers.cc +++ b/ftshelpers.cc @@ -399,11 +399,6 @@ bool isCJKChar( ushort ch ) return false; } -void FTSResultsRequestRunnable::run() -{ - r.run(); -} - void FTSResultsRequest::checkArticles( QVector< uint32_t > const & offsets, QStringList const & words, QRegExp const & searchRegexp ) diff --git a/ftshelpers.hh b/ftshelpers.hh index f8392d09..6d0fa29a 100644 --- a/ftshelpers.hh +++ b/ftshelpers.hh @@ -65,28 +65,6 @@ void makeFTSIndex( BtreeIndexing::BtreeDictionary * dict, QAtomicInt & isCancell bool isCJKChar( ushort ch ); -class FTSResultsRequest; - -class FTSResultsRequestRunnable : public QRunnable -{ - FTSResultsRequest & r; - QSemaphore & hasExited; - -public: - - FTSResultsRequestRunnable( FTSResultsRequest & r_, - QSemaphore & hasExited_ ) : r( r_ ), - hasExited( hasExited_ ) - {} - - ~FTSResultsRequestRunnable() - { - hasExited.release(); - } - - virtual void run(); -}; - class FTSResultsRequest : public Dictionary::DataRequest { BtreeIndexing::BtreeDictionary & dict; @@ -102,7 +80,6 @@ class FTSResultsRequest : public Dictionary::DataRequest int wordsInIndex; QAtomicInt isCancelled; - QSemaphore hasExited; QList< FTS::FtsHeadword > * foundHeadwords; @@ -149,11 +126,10 @@ public: searchString = gd::toQString( Folding::applyDiacriticsOnly( gd::toWString( searchString_ ) ) ); foundHeadwords = new QList< FTS::FtsHeadword >; - QThreadPool::globalInstance()->start( - new FTSResultsRequestRunnable( *this, hasExited ), -100 ); + QThreadPool::globalInstance()->start( [ this ]() { this->run(); }, -100 ); } - void run(); // Run from another thread by DslResourceRequestRunnable + void run(); virtual void cancel() { @@ -165,7 +141,6 @@ public: isCancelled.ref(); if( foundHeadwords ) delete foundHeadwords; - hasExited.acquire(); } };