Skip to content

Commit

Permalink
fix: 修改code review 提出的问题;
Browse files Browse the repository at this point in the history
Description: 修改code review 提出的问题 ;

Log: 修改code review 提出的问题;
Change-Id: Ic4f6c2f2f61337e637c07e3ce355756d1e8d2b60
  • Loading branch information
guoshaoyu committed Apr 6, 2022
1 parent d9f1a9d commit 3233eed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/common/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
Settings *Settings::s_pSetting = nullptr;

CustemBackend::CustemBackend(const QString &filepath, QObject *parent)
: DSettingsBackend (parent)
: DSettingsBackend (parent),
m_settings (new QSettings(filepath, QSettings::IniFormat))
{
m_settings = new QSettings(filepath, QSettings::IniFormat);

}

void CustemBackend::doSync()
Expand Down
6 changes: 3 additions & 3 deletions src/encodes/detectcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ QByteArray DetectCode::GetFileEncodingFormat(QString filepath, QByteArray conten
QByteArray ucharDetectdRet;
QByteArrayList icuDetectRetList;
QByteArray detectRet;
float chardetconfidence = 0;
float chardetconfidence = 0.0f;

/* chardet识别编码 */
QString str(content);
Expand All @@ -54,15 +54,15 @@ QByteArray DetectCode::GetFileEncodingFormat(QString filepath, QByteArray conten
ucharDetectdRet = charDetectedResult.toLatin1();

/* uchardet识别编码 */
if (ucharDetectdRet == "unknown" || ucharDetectdRet == "???" || ucharDetectdRet.isEmpty()) {
if (ucharDetectdRet.contains("unknown") || ucharDetectdRet.contains("???") || ucharDetectdRet.isEmpty()) {
ucharDetectdRet = DetectCode::UchardetCode(filepath);
}

/* icu识别编码 */
icuDetectTextEncoding(filepath, icuDetectRetList);
detectRet = selectCoding(ucharDetectdRet, icuDetectRetList);

if(detectRet == "ASCII" || detectRet.isEmpty()) {
if(detectRet.contains("ASCII") || detectRet.isEmpty()) {
detectRet = "UTF-8";
}

Expand Down

0 comments on commit 3233eed

Please sign in to comment.