My "Simplify boolean expressions" refactoring caused C4800 warnings for MSVC builds. A fixup is attached, as I cannot ssh at the moment.
From ece15fe51c46cb93823ccd8a54243d35ebdc0d3c Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer <dan...@pfeifer-mail.de> Date: Thu, 2 Jun 2016 09:59:36 +0200 Subject: [PATCH] fixup! Simplify boolean expressions
--- Source/cmDependsFortran.cxx | 3 +-- Source/cmELF.cxx | 6 +++--- Source/cmGeneratedFileStream.cxx | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index f7db417..a20fb98 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -654,8 +654,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // but also do not include a date so we can fall through to // compare them without skipping any prefix. unsigned char hdr[2]; - finModFile.read(reinterpret_cast<char*>(hdr), 2); - bool okay = static_cast<bool>(finModFile); + bool okay = !finModFile.read(reinterpret_cast<char*>(hdr), 2).fail(); finModFile.seekg(0); if (!okay || hdr[0] != 0x1f || hdr[1] != 0x8b) { const char seq[1] = { '\n' }; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index db32184..c7f8a2d 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -143,7 +143,7 @@ public: { this->Stream.seekg(pos); this->Stream.read(buf, size); - return static_cast<bool>(this->Stream); + return !this->Stream.fail(); } // Lookup the SONAME in the DYNAMIC section. @@ -497,7 +497,7 @@ private: this->NeedSwap) { ByteSwap(x); } - return static_cast<bool>(this->Stream); + return !this->Stream.fail(); } bool Read(ELF_Dyn& x) { @@ -505,7 +505,7 @@ private: this->NeedSwap) { ByteSwap(x); } - return static_cast<bool>(this->Stream); + return !this->Stream.fail(); } bool LoadSectionHeader(ELF_Half i) diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 562ff88..dee174b 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -42,7 +42,7 @@ cmGeneratedFileStream::~cmGeneratedFileStream() // stream will be destroyed which will close the temporary file. // Finally the base destructor will be called to replace the // destination file. - this->Okay = static_cast<bool>(*this); + this->Okay = !this->fail(); } cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name, @@ -71,7 +71,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name, bool cmGeneratedFileStream::Close() { // Save whether the temporary output file is valid before closing. - this->Okay = static_cast<bool>(*this); + this->Okay = !this->fail(); // Close the temporary output file. this->Stream::close(); -- 2.8.3
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers