From 16732def37c5a66f3ea28dbe247b09cc6bca6677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 6 Nov 2020 17:49:09 +0100 Subject: Cleanup: Clang-Tidy modernize-use-nullptr Replace `NULL` with `nullptr` in C++ code. No functional changes. --- source/blender/freestyle/intern/stroke/Curve.cpp | 78 ++++++++++++------------ 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'source/blender/freestyle/intern/stroke/Curve.cpp') diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index 7129a35ffdb..95a6b2b3e57 100644 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -40,8 +40,8 @@ namespace Freestyle { CurvePoint::CurvePoint() { - __A = 0; - __B = 0; + __A = nullptr; + __B = nullptr; _t2d = 0; } @@ -50,11 +50,11 @@ CurvePoint::CurvePoint(SVertex *iA, SVertex *iB, float t) __A = iA; __B = iB; _t2d = t; - if ((iA == 0) && (t == 1.0f)) { + if ((iA == nullptr) && (t == 1.0f)) { _Point2d = __B->point2d(); _Point3d = __B->point3d(); } - else if ((iB == 0) && (t == 0.0f)) { + else if ((iB == nullptr) && (t == 0.0f)) { _Point2d = __A->point2d(); _Point3d = __A->point3d(); } @@ -66,17 +66,17 @@ CurvePoint::CurvePoint(SVertex *iA, SVertex *iB, float t) CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) { - __A = 0; - __B = 0; + __A = nullptr; + __B = nullptr; float t1 = iA->t2d(); float t2 = iB->t2d(); - if ((iA->A() == iB->A()) && (iA->B() == iB->B()) && (iA->A() != 0) && (iA->B() != 0) && - (iB->A() != 0) && (iB->B() != 0)) { + if ((iA->A() == iB->A()) && (iA->B() == iB->B()) && (iA->A() != nullptr) && (iA->B() != nullptr) && + (iB->A() != nullptr) && (iB->B() != nullptr)) { __A = iA->A(); __B = iB->B(); _t2d = t1 + t2 * t3 - t1 * t3; } - else if ((iA->B() == 0) && (iB->B() == 0)) { + else if ((iA->B() == nullptr) && (iB->B() == nullptr)) { __A = iA->A(); __B = iB->A(); _t2d = t3; @@ -133,15 +133,15 @@ CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) _t2d = t2 * t3; } } - else if (iA->A() != 0 && iB->A() != 0 && + else if (iA->A() != nullptr && iB->A() != nullptr && (iA->A()->point3d() - iB->A()->point3d()).norm() < 1.0e-6) { goto iA_A_eq_iB_A; } - else if (iA->B() != 0 && iB->B() != 0 && + else if (iA->B() != nullptr && iB->B() != nullptr && (iA->B()->point3d() - iB->B()->point3d()).norm() < 1.0e-6) { goto iA_B_eq_iB_B; } - else if (iA->B() != 0 && iB->A() != 0 && + else if (iA->B() != nullptr && iB->A() != nullptr && (iA->B()->point3d() - iB->A()->point3d()).norm() < 1.0e-6) { goto iA_B_eq_iB_A; } @@ -162,7 +162,7 @@ CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) cerr << "Fatal error in CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3)" << endl; } - BLI_assert(__A != 0 && __B != 0); + BLI_assert(__A != nullptr && __B != nullptr); #if 0 _Point2d = __A->point2d() + _t2d * (__B->point2d() - __A->point2d()); @@ -195,7 +195,7 @@ CurvePoint &CurvePoint::operator=(const CurvePoint &iBrother) FEdge *CurvePoint::fedge() { if (getNature() & Nature::T_VERTEX) { - return 0; + return nullptr; } return __A->fedge(); } @@ -206,14 +206,14 @@ FEdge *CurvePoint::getFEdge(Interface0D &inter) if (!iVertexB) { cerr << "Warning: CurvePoint::getFEdge() failed to cast the given 0D element to CurvePoint." << endl; - return 0; + return nullptr; } if (((__A == iVertexB->__A) && (__B == iVertexB->__B)) || ((__A == iVertexB->__B) && (__B == iVertexB->__A))) { return __A->getFEdge(*__B); } - if (__B == 0) { - if (iVertexB->__B == 0) { + if (__B == nullptr) { + if (iVertexB->__B == nullptr) { return __A->getFEdge(*(iVertexB->__A)); } if (iVertexB->__A == __A) { @@ -223,7 +223,7 @@ FEdge *CurvePoint::getFEdge(Interface0D &inter) return __A->getFEdge(*(iVertexB->__A)); } } - if (iVertexB->__B == 0) { + if (iVertexB->__B == nullptr) { if (iVertexB->__A == __A) { return __B->getFEdge(*(iVertexB->__A)); } @@ -284,15 +284,15 @@ FEdge *CurvePoint::getFEdge(Interface0D &inter) #endif cerr << "Warning: CurvePoint::getFEdge() failed." << endl; - return NULL; + return nullptr; } Vec3r CurvePoint::normal() const { - if (__B == 0) { + if (__B == nullptr) { return __A->normal(); } - if (__A == 0) { + if (__A == nullptr) { return __B->normal(); } Vec3r Na = __A->normal(); @@ -328,7 +328,7 @@ Id CurvePoint::shape_id() const const SShape *CurvePoint::shape() const { - if (__A == 0) { + if (__A == nullptr) { return __B->shape(); } return __A->shape(); @@ -357,10 +357,10 @@ const unsigned CurvePoint::qi() const occluder_container::const_iterator CurvePoint::occluders_begin() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluders_begin(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluders_begin(); } return __A->getFEdge(*__B)->occluders_begin(); @@ -368,10 +368,10 @@ occluder_container::const_iterator CurvePoint::occluders_begin() const occluder_container::const_iterator CurvePoint::occluders_end() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluders_end(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluders_end(); } return __A->getFEdge(*__B)->occluders_end(); @@ -379,10 +379,10 @@ occluder_container::const_iterator CurvePoint::occluders_end() const bool CurvePoint::occluders_empty() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluders_empty(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluders_empty(); } return __A->getFEdge(*__B)->occluders_empty(); @@ -390,10 +390,10 @@ bool CurvePoint::occluders_empty() const int CurvePoint::occluders_size() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluders_size(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluders_size(); } return __A->getFEdge(*__B)->occluders_size(); @@ -401,10 +401,10 @@ int CurvePoint::occluders_size() const const SShape *CurvePoint::occluded_shape() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluded_shape(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluded_shape(); } return __A->getFEdge(*__B)->occluded_shape(); @@ -412,10 +412,10 @@ const SShape *CurvePoint::occluded_shape() const const Polygon3r &CurvePoint::occludee() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occludee(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occludee(); } return __A->getFEdge(*__B)->occludee(); @@ -423,10 +423,10 @@ const Polygon3r &CurvePoint::occludee() const bool CurvePoint::occludee_empty() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occludee_empty(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occludee_empty(); } return __A->getFEdge(*__B)->occludee_empty(); @@ -434,13 +434,13 @@ bool CurvePoint::occludee_empty() const real CurvePoint::z_discontinuity() const { - if (__A == 0) { + if (__A == nullptr) { return __B->z_discontinuity(); } - if (__B == 0) { + if (__B == nullptr) { return __A->z_discontinuity(); } - if (__A->getFEdge(*__B) == 0) { + if (__A->getFEdge(*__B) == nullptr) { return 0.0; } -- cgit v1.2.3