From a04db55476f91883fb04c60b0191620916188e62 Mon Sep 17 00:00:00 2001 From: Uwe Date: Wed, 15 Jun 2022 03:55:08 +0200 Subject: [PATCH] [Base] remove unnecessary Boolean comparisons --- src/Base/BoundBox.h | 4 ++-- src/Base/Builder3D.cpp | 4 ++-- src/Base/FileInfo.cpp | 4 ++-- src/Base/StackWalker.cpp | 2 +- src/Base/Tools2D.cpp | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Base/BoundBox.h b/src/Base/BoundBox.h index ff01dd10bb..c589fc9b1e 100644 --- a/src/Base/BoundBox.h +++ b/src/Base/BoundBox.h @@ -610,7 +610,7 @@ inline bool BoundBox3<_Precision>::IntersectionPoint (const Vector3<_Precision> rc = IntersectPlaneWithLine(i, rcVct, rcVctDir, cVctRes); if (!cCmpBound.IsInBox(cVctRes)) rc = false; - if (rc == true) { + if (rc) { // does intersection point lie in desired direction // or was found the opposing side? // -> scalar product of both direction vectors > 0 (angle < 90) @@ -773,7 +773,7 @@ inline typename BoundBox3<_Precision>::SIDE BoundBox3<_Precision>::GetSideFromRa Vector3<_Precision>& rcInt) const { Vector3<_Precision> cP0, cP1; - if (IntersectWithLine(rclPt, rclDir, cP0, cP1) == false) + if (!IntersectWithLine(rclPt, rclDir, cP0, cP1)) return INVALID; Vector3<_Precision> cOut; diff --git a/src/Base/Builder3D.cpp b/src/Base/Builder3D.cpp index 073413244c..3e698c6dd9 100644 --- a/src/Base/Builder3D.cpp +++ b/src/Base/Builder3D.cpp @@ -116,7 +116,7 @@ void Builder3D::endPoints() void Builder3D::addSinglePoint(float x, float y, float z,short pointSize, float color_r,float color_g,float color_b) { // addSinglePoint() not between startXXX() and endXXX() allowed - assert( bStartEndOpen == false ); + assert(!bStartEndOpen); result << "Separator { "; result << "Material { "; @@ -155,7 +155,7 @@ void Builder3D::addSinglePoint(const Base::Vector3f &vec, short pointSize, float void Builder3D::addText(float pos_x, float pos_y , float pos_z,const char * text, float color_r,float color_g,float color_b) { // addSinglePoint() not between startXXX() and endXXX() allowed - assert( bStartEndOpen == false ); + assert(!bStartEndOpen); result << "Separator { " << "Material { diffuseColor " << color_r << " "<< color_g << " "<< color_b << "} " diff --git a/src/Base/FileInfo.cpp b/src/Base/FileInfo.cpp index 64467206b2..de13ebfe7e 100644 --- a/src/Base/FileInfo.cpp +++ b/src/Base/FileInfo.cpp @@ -556,7 +556,7 @@ bool FileInfo::createDirectories() const bool FileInfo::deleteDirectory() const { - if (isDir() == false ) + if (!isDir()) return false; #if defined (FC_OS_WIN32) std::wstring wstr = toStdWString(); @@ -570,7 +570,7 @@ bool FileInfo::deleteDirectory() const bool FileInfo::deleteDirectoryRecursive() const { - if (isDir() == false ) + if (!isDir()) return false; std::vector List = getDirectoryContent(); diff --git a/src/Base/StackWalker.cpp b/src/Base/StackWalker.cpp index cec306306b..cd8f60b6a7 100644 --- a/src/Base/StackWalker.cpp +++ b/src/Base/StackWalker.cpp @@ -1242,7 +1242,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT *context, PReadPro cleanup: if (pSym) free( pSym ); - if (bLastEntryCalled == false) + if (!bLastEntryCalled) this->OnCallstackEntry(lastEntry, csEntry); if (context == NULL) diff --git a/src/Base/Tools2D.cpp b/src/Base/Tools2D.cpp index 72ac465c12..3a76622a36 100644 --- a/src/Base/Tools2D.cpp +++ b/src/Base/Tools2D.cpp @@ -363,7 +363,7 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list &rc bool bInner = Contains(rclPolygon[0]); Polygon2d clResultPolygon; - if (bInner == true) // add first point if inner trim-polygon + if (bInner) // add first point if inner trim-polygon clResultPolygon.Add(rclPolygon[0]); // for each polygon segment @@ -384,7 +384,7 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list &rc Line2d clToTrimLine(At(i), clTrimPt2); Vector2d clV; - if (clLine.IntersectAndContain(clToTrimLine, clV) == true) + if (clLine.IntersectAndContain(clToTrimLine, clV)) { // save line parameter of intersection point double fDist = (clV - clPt0).Length(); @@ -398,7 +398,7 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list &rc { // intersection point Vector2d clPtIS = clLine.FromPos(*pF); - if (bInner == true) + if (bInner) { clResultPolygon.Add(clPtIS); rclResultPolygonList.push_back(clResultPolygon); @@ -412,12 +412,12 @@ void Polygon2d::Intersect (const Polygon2d &rclPolygon, std::list &rc } } - if (bInner == true) // add line end point if inside + if (bInner) // add line end point if inside clResultPolygon.Add(clPt1); } else { // no intersections, add line (means second point of it) if inside trim-polygon - if (bInner == true) + if (bInner) clResultPolygon.Add(clPt1); } }