diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-06-01 21:29:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-06-02 12:24:04 (GMT) |
commit | 7f6b8d3399dd841b0d29bf74d2b31021738c4ef8 (patch) | |
tree | 9b9184028cba2f16fdcc1c10ac5fb5467f09bff7 /Source/CPack | |
parent | d6754d37d593a0189809dcf98bc4fdf3a609f0a3 (diff) | |
download | CMake-7f6b8d3399dd841b0d29bf74d2b31021738c4ef8.zip CMake-7f6b8d3399dd841b0d29bf74d2b31021738c4ef8.tar.gz CMake-7f6b8d3399dd841b0d29bf74d2b31021738c4ef8.tar.bz2 |
Simplify boolean expressions
Use clang-tidy's readability-simplify-boolean-expr checker.
After applying the fix-its, revise all changes *very* carefully.
Be aware of false positives and invalid changes.
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWRepository.cxx | 14 | ||||
-rw-r--r-- | Source/CPack/cmCPackArchiveGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/cmCPackDebGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/cmCPackRPMGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/cpack.cxx | 6 |
5 files changed, 9 insertions, 29 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index b149f81..1838005 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -45,16 +45,16 @@ bool cmCPackIFWRepository::IsValid() const switch (Update) { case None: - valid = Url.empty() ? false : true; + valid = !Url.empty(); break; case Add: - valid = Url.empty() ? false : true; + valid = !Url.empty(); break; case Remove: - valid = Url.empty() ? false : true; + valid = !Url.empty(); break; case Replace: - valid = (OldUrl.empty() || NewUrl.empty()) ? false : true; + valid = !OldUrl.empty() && !NewUrl.empty(); break; } @@ -244,11 +244,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml() fout.Close(); - if (!cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data())) { - return false; - } - - return true; + return cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data()); } void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 7db20a4..baf6719 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -269,9 +269,5 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const // The Component installation support should only // be activated if explicitly requested by the user // (for backward compatibility reason) - if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL")) { - return true; - } else { - return false; - } + return IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL"); } diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 1ad4152..ddaa483 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -675,11 +675,7 @@ int cmCPackDebGenerator::createDeb() bool cmCPackDebGenerator::SupportsComponentInstallation() const { - if (IsOn("CPACK_DEB_COMPONENT_INSTALL")) { - return true; - } else { - return false; - } + return IsOn("CPACK_DEB_COMPONENT_INSTALL"); } std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 9827b70..bc10111 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -228,11 +228,7 @@ int cmCPackRPMGenerator::PackageFiles() bool cmCPackRPMGenerator::SupportsComponentInstallation() const { - if (IsOn("CPACK_RPM_COMPONENT_INSTALL")) { - return true; - } else { - return false; - } + return IsOn("CPACK_RPM_COMPONENT_INSTALL"); } std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 94e1615..425afd9 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -209,11 +209,7 @@ int main(int argc, char const* const* argv) * should launch cpack using "cpackConfigFile" if it exists * in the current directory. */ - if ((doc.CheckOptions(argc, argv, "-G")) && !(argc == 1)) { - help = true; - } else { - help = false; - } + help = doc.CheckOptions(argc, argv, "-G") && argc != 1; // This part is used for cpack documentation lookup as well. cminst.AddCMakePaths(); |