mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
performance: Prefer prefix ++/-- operators for non-primitive types.
more detail check https://hownot2code.com/2016/06/30/use-a-prefix-increment-operator-i-in-iterators-instead-of-a-postfix-i-operator/
This commit is contained in:
parent
1969c11ded
commit
9ecc10ed50
|
@ -3566,7 +3566,7 @@ void MainWindow::on_saveArticle_triggered()
|
||||||
|
|
||||||
// Pull and save resources to files
|
// Pull and save resources to files
|
||||||
for ( vector< pair< QUrl, QString > >::const_iterator i = downloadResources.begin();
|
for ( vector< pair< QUrl, QString > >::const_iterator i = downloadResources.begin();
|
||||||
i != downloadResources.end(); i++ )
|
i != downloadResources.end(); ++i )
|
||||||
{
|
{
|
||||||
ResourceToSaveHandler * handler = view->saveResource( i->first, i->second );
|
ResourceToSaveHandler * handler = view->saveResource( i->first, i->second );
|
||||||
if( !handler->isEmpty() )
|
if( !handler->isEmpty() )
|
||||||
|
|
|
@ -165,7 +165,7 @@ bool MdictParser::readNextHeadWordIndex( MdictParser::HeadWordIndex & headWordIn
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
headWordIndex = splitHeadWordBlock( decompressed );
|
headWordIndex = splitHeadWordBlock( decompressed );
|
||||||
headWordBlockInfosIter_++;
|
++headWordBlockInfosIter_;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
mdx.cc
12
mdx.cc
|
@ -848,7 +848,7 @@ void MddResourceRequest::run()
|
||||||
catch ( File::exCantOpen & )
|
catch ( File::exCantOpen & )
|
||||||
{
|
{
|
||||||
for ( vector< sptr< IndexedMdd > >::const_iterator i = dict.mddResources.begin();
|
for ( vector< sptr< IndexedMdd > >::const_iterator i = dict.mddResources.begin();
|
||||||
i != dict.mddResources.end(); i++ )
|
i != dict.mddResources.end(); ++i )
|
||||||
{
|
{
|
||||||
sptr< IndexedMdd > mddResource = *i;
|
sptr< IndexedMdd > mddResource = *i;
|
||||||
if ( mddResource->loadFile( resourceName, data ) )
|
if ( mddResource->loadFile( resourceName, data ) )
|
||||||
|
@ -1272,7 +1272,7 @@ QString MdxDictionary::getCachedFileName( QString filename )
|
||||||
catch ( File::exCantOpen & )
|
catch ( File::exCantOpen & )
|
||||||
{
|
{
|
||||||
for ( vector< sptr< IndexedMdd > >::const_iterator i = mddResources.begin();
|
for ( vector< sptr< IndexedMdd > >::const_iterator i = mddResources.begin();
|
||||||
i != mddResources.end(); i++ )
|
i != mddResources.end(); ++i )
|
||||||
{
|
{
|
||||||
sptr< IndexedMdd > mddResource = *i;
|
sptr< IndexedMdd > mddResource = *i;
|
||||||
if ( mddResource->loadFile( resourceName, data ) )
|
if ( mddResource->loadFile( resourceName, data ) )
|
||||||
|
@ -1447,7 +1447,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
|
||||||
{
|
{
|
||||||
vector< sptr< Dictionary::Class > > dictionaries;
|
vector< sptr< Dictionary::Class > > dictionaries;
|
||||||
|
|
||||||
for ( vector< string >::const_iterator i = fileNames.begin(); i != fileNames.end(); i++ )
|
for ( vector< string >::const_iterator i = fileNames.begin(); i != fileNames.end(); ++i )
|
||||||
{
|
{
|
||||||
// Skip files with the extensions different to .mdx to speed up the
|
// Skip files with the extensions different to .mdx to speed up the
|
||||||
// scanning
|
// scanning
|
||||||
|
@ -1477,7 +1477,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
|
||||||
initializing.indexingDictionary( title );
|
initializing.indexingDictionary( title );
|
||||||
|
|
||||||
for ( vector< string >::const_iterator mddIter = dictFiles.begin() + 1;
|
for ( vector< string >::const_iterator mddIter = dictFiles.begin() + 1;
|
||||||
mddIter != dictFiles.end(); mddIter++ )
|
mddIter != dictFiles.end(); ++mddIter )
|
||||||
{
|
{
|
||||||
if ( File::exists( *mddIter ) )
|
if ( File::exists( *mddIter ) )
|
||||||
{
|
{
|
||||||
|
@ -1576,7 +1576,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
|
||||||
idxHeader.styleSheetCount = styleSheets.size();
|
idxHeader.styleSheetCount = styleSheets.size();
|
||||||
|
|
||||||
for ( MdictParser::StyleSheets::const_iterator iter = styleSheets.begin();
|
for ( MdictParser::StyleSheets::const_iterator iter = styleSheets.begin();
|
||||||
iter != styleSheets.end(); iter++ )
|
iter != styleSheets.end(); ++iter )
|
||||||
{
|
{
|
||||||
string styleBegin( iter->second.first.toUtf8().constData() );
|
string styleBegin( iter->second.first.toUtf8().constData() );
|
||||||
string styleEnd( iter->second.second.toUtf8().constData() );
|
string styleEnd( iter->second.second.toUtf8().constData() );
|
||||||
|
@ -1607,7 +1607,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
|
||||||
// Build index info for each mdd file
|
// Build index info for each mdd file
|
||||||
vector< IndexInfo > mddIndexInfos;
|
vector< IndexInfo > mddIndexInfos;
|
||||||
for ( vector< sptr< IndexedWords > >::const_iterator mddIndexIter = mddIndices.begin();
|
for ( vector< sptr< IndexedWords > >::const_iterator mddIndexIter = mddIndices.begin();
|
||||||
mddIndexIter != mddIndices.end(); mddIndexIter++ )
|
mddIndexIter != mddIndices.end(); ++mddIndexIter )
|
||||||
{
|
{
|
||||||
IndexInfo resourceIdxInfo = BtreeIndexing::buildIndex( *( *mddIndexIter ), idx );
|
IndexInfo resourceIdxInfo = BtreeIndexing::buildIndex( *( *mddIndexIter ), idx );
|
||||||
mddIndexInfos.push_back( resourceIdxInfo );
|
mddIndexInfos.push_back( resourceIdxInfo );
|
||||||
|
|
|
@ -112,7 +112,7 @@ unsigned int ProcessWrapper::findProcess(const char *name, unsigned int pid_skip
|
||||||
QDir pd("/proc");
|
QDir pd("/proc");
|
||||||
QFileInfoList list = pd.entryInfoList(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
QFileInfoList list = pd.entryInfoList(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
||||||
QFileInfoList::iterator it, it_end = list.end();
|
QFileInfoList::iterator it, it_end = list.end();
|
||||||
for (it = list.begin(); it != it_end; it++)
|
for (it = list.begin(); it != it_end; ++it)
|
||||||
{
|
{
|
||||||
const QFileInfo &fi = *it;
|
const QFileInfo &fi = *it;
|
||||||
if (fi.baseName().at(0).isDigit()) {
|
if (fi.baseName().at(0).isDigit()) {
|
||||||
|
|
Loading…
Reference in a new issue