From ad42eb33b61ad262315bfa087dc7f4f0ddbca5fe Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 8 Sep 2016 23:33:08 +0200 Subject: [PATCH 1/4] QCMakeCacheView: no else after return --- Source/QtDialog/QCMakeCacheView.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 88ea049fa..ec7918b3f 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -554,14 +554,16 @@ QWidget* QCMakeCacheModelDelegate::createEditor( QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); return editor; - } else if (type == QCMakeProperty::FILEPATH) { + } + if (type == QCMakeProperty::FILEPATH) { QCMakeFilePathEditor* editor = new QCMakeFilePathEditor(p, var.data(Qt::DisplayRole).toString()); QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); return editor; - } else if (type == QCMakeProperty::STRING && - var.data(QCMakeCacheModel::StringsRole).isValid()) { + } + if (type == QCMakeProperty::STRING && + var.data(QCMakeCacheModel::StringsRole).isValid()) { QCMakeComboBox* editor = new QCMakeComboBox( p, var.data(QCMakeCacheModel::StringsRole).toStringList()); editor->setFrame(false); From 5d3b5bef11bc29bb00a14103433fea81e4dcc340 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 8 Sep 2016 23:35:59 +0200 Subject: [PATCH 2/4] QCMakeCacheView: simplify boolean expression --- Source/QtDialog/QCMakeCacheView.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index ec7918b3f..ed11f7b68 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -95,10 +95,7 @@ protected: // if there are no children if (!m->hasChildren(idx)) { bool adv = m->data(idx, QCMakeCacheModel::AdvancedRole).toBool(); - if (!adv || (adv && this->ShowAdvanced)) { - return true; - } - return false; + return !adv || this->ShowAdvanced; } // check children From 8f324c7cefea75a12c0f58977177edf263f42e9f Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 8 Sep 2016 23:41:31 +0200 Subject: [PATCH 3/4] cmSystemTools: simplify boolean expressions --- Source/cmSystemTools.cxx | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7da997581..73522176c 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1766,9 +1766,7 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) if (!GetFileTime(hFrom, &timeCreation, &timeLastAccess, &timeLastWrite)) { return false; } - if (!SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite)) { - return false; - } + return SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite) != 0; #else struct stat fromStat; if (stat(fromFile, &fromStat) < 0) { @@ -1778,11 +1776,8 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) struct utimbuf buf; buf.actime = fromStat.st_atime; buf.modtime = fromStat.st_mtime; - if (utime(toFile, &buf) < 0) { - return false; - } + return utime(toFile, &buf) >= 0; #endif - return true; } cmSystemToolsFileTime* cmSystemTools::FileTimeNew() @@ -1828,16 +1823,11 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t) if (!h) { return false; } - if (!SetFileTime(h, &t->timeCreation, &t->timeLastAccess, - &t->timeLastWrite)) { - return false; - } + return SetFileTime(h, &t->timeCreation, &t->timeLastAccess, + &t->timeLastWrite) != 0; #else - if (utime(fname, &t->timeBuf) < 0) { - return false; - } + return utime(fname, &t->timeBuf) >= 0; #endif - return true; } #ifdef _WIN32 From 73128b823c2fe8f63fcdc4c8c92c3672b6f05f3c Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 8 Sep 2016 23:43:06 +0200 Subject: [PATCH 4/4] cmDependsFortran: simplify boolean expression --- Source/cmDependsFortran.cxx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index b7e006d76..eb4c1ecd3 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -712,10 +712,5 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. - if (!cmFortranStreamsDiffer(finModFile, finStampFile)) { - return false; - } - - // The modules are different. - return true; + return cmFortranStreamsDiffer(finModFile, finStampFile); }