From 6ba04daa38989e6d74ca9d34f380dbfce5c1ae6c Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 09:43:18 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- src/common/utils.hh | 2 +- src/dict/dictserver.cc | 37 ++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/common/utils.hh b/src/common/utils.hh index 6cff5ac53..15a4d35ee 100644 --- a/src/common/utils.hh +++ b/src/common/utils.hh @@ -45,7 +45,7 @@ inline uint32_t leadingSpaceCount( const QString & str ) if ( str.at( i ).isSpace() ) { continue; } - else{ + else { return i; } } diff --git a/src/dict/dictserver.cc b/src/dict/dictserver.cc index 9794ee980..9e05a88bb 100644 --- a/src/dict/dictserver.cc +++ b/src/dict/dictserver.cc @@ -599,35 +599,34 @@ class DictServerArticleRequest: public Dictionary::DataRequest } //modify the articleText,remove extra lines[start with 15X etc.] - QList lines = articleText.split("\n", Qt::SkipEmptyParts); + QList< QString > lines = articleText.split( "\n", Qt::SkipEmptyParts ); QStringList resultStr; // proccess the line - QRegularExpression re("^\\d{3} "); + QRegularExpression re( "^\\d{3} " ); uint32_t leadingSpaceCount = 0; for ( const QString & line : lines ) { //ignore 15X lines - if (re.match(line).hasMatch()) { - continue; - } - // ignore . endline - if(line.trimmed()=="."){ - break; - } - - auto lsc = Utils::leadingSpaceCount( line ); + if ( re.match( line ).hasMatch() ) { + continue; + } + // ignore . endline + if ( line.trimmed() == "." ) { + break; + } + auto lsc = Utils::leadingSpaceCount( line ); - if ( lsc >= leadingSpaceCount && lsc > 4 ) { - resultStr.append( line.trimmed() ); - } - else{ - resultStr.append( "\n" ); - resultStr.append( line ); - } - leadingSpaceCount = lsc; + if ( lsc >= leadingSpaceCount && lsc > 4 ) { + resultStr.append( line.trimmed() ); + } + else { + resultStr.append( "\n" ); + resultStr.append( line ); + } + leadingSpaceCount = lsc; } static QRegularExpression phonetic( R"(\\([^\\]+)\\)",