diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-11-06 19:49:09 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-11-06 20:08:25 +0300 |
commit | 16732def37c5a66f3ea28dbe247b09cc6bca6677 (patch) | |
tree | 5d14f5c920a1411e336bd80b12becbb3f73de19a /source/blender/freestyle/intern/winged_edge | |
parent | 88926375a0e4e45f72c87b9e487c060ddd3c9216 (diff) |
Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.
No functional changes.
Diffstat (limited to 'source/blender/freestyle/intern/winged_edge')
3 files changed, 32 insertions, 32 deletions
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index c8805c144e3..0811fe336b7 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -63,7 +63,7 @@ WVertex::WVertex(WVertex &iBrother) _Shape = iBrother._Shape; _Smooth = iBrother._Smooth; _Border = iBrother._Border; - userdata = NULL; + userdata = nullptr; iBrother.userdata = new vertexdata; ((vertexdata *)(iBrother.userdata))->_copy = this; } @@ -84,12 +84,12 @@ void WVertex::incoming_edge_iterator::increment() WOEdge *twin = _current->twin(); if (!twin) { // we reached a hole - _current = 0; + _current = nullptr; return; } WOEdge *next = twin->getPrevOnFace(); if (next == _begin) { - next = NULL; + next = nullptr; } _current = next; } @@ -98,7 +98,7 @@ WFace *WVertex::face_iterator::operator*() { WOEdge *woedge = *_edge_it; if (!woedge) { - return NULL; + return nullptr; } return (woedge)->GetbFace(); } @@ -163,7 +163,7 @@ WVertex::incoming_edge_iterator WVertex::incoming_edges_end() else { begin = _EdgeList.front()->GetbOEdge(); } - return incoming_edge_iterator(this, begin, 0); + return incoming_edge_iterator(this, begin, nullptr); } #if 0 WOEdge **WVertex::incoming_edge_iterator::operator->() @@ -194,7 +194,7 @@ WOEdge::WOEdge(WOEdge &iBrother) _paFace = iBrother.GetaFace(); _pbFace = iBrother.GetbFace(); _pOwner = iBrother.GetOwner(); - userdata = NULL; + userdata = nullptr; iBrother.userdata = new oedgedata; ((oedgedata *)(iBrother.userdata))->_copy = this; @@ -228,11 +228,11 @@ WOEdge *WOEdge::getPrevOnFace() WEdge::WEdge(WEdge &iBrother) { - _paOEdge = NULL; - _pbOEdge = NULL; + _paOEdge = nullptr; + _pbOEdge = nullptr; WOEdge *aoedge = iBrother.GetaOEdge(); WOEdge *boedge = iBrother.GetbOEdge(); - userdata = NULL; + userdata = nullptr; if (aoedge) { //_paOEdge = new WOEdge(*aoedge); @@ -272,7 +272,7 @@ WFace::WFace(WFace &iBrother) _Id = iBrother.GetId(); _FrsMaterialIndex = iBrother._FrsMaterialIndex; _Mark = iBrother._Mark; - userdata = NULL; + userdata = nullptr; iBrother.userdata = new facedata; ((facedata *)(iBrother.userdata))->_copy = this; } @@ -332,7 +332,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2) // checks whether this edge already exists or not // If it exists, it points outward v2 bool exist = false; - WOEdge *pInvertEdge = NULL; // The inverted edge if it exists + WOEdge *pInvertEdge = nullptr; // The inverted edge if it exists vector<WEdge *> &v2Edges = v2->GetEdges(); vector<WEdge *>::iterator it; for (it = v2Edges.begin(); it != v2Edges.end(); it++) { @@ -394,7 +394,7 @@ bool WFace::getOppositeEdge(const WVertex *v, WOEdge *&e) } vector<WOEdge *>::iterator it; - e = NULL; + e = nullptr; for (it = _OEdgeList.begin(); it != _OEdgeList.end(); it++) { if ((*it)->GetaVertex() == v) { e = *it; @@ -403,7 +403,7 @@ bool WFace::getOppositeEdge(const WVertex *v, WOEdge *&e) if (!e) { return false; } - e = NULL; + e = nullptr; for (it = _OEdgeList.begin(); it != _OEdgeList.end(); it++) { if (((*it)->GetaVertex() != v) && ((*it)->GetbVertex() != v)) { e = *it; @@ -449,7 +449,7 @@ WOEdge *WFace::GetPrevOEdge(WOEdge *iOEdge) return prev; } - return NULL; + return nullptr; } WShape *WFace::getShape() @@ -570,22 +570,22 @@ WShape::WShape(WShape &iBrother) vend = iBrother.getVertexList().end(); for (v = iBrother.getVertexList().begin(); v != vend; ++v) { delete (vertexdata *)((*v)->userdata); - (*v)->userdata = NULL; + (*v)->userdata = nullptr; } // Edges and OEdges: eend = iBrother.getEdgeList().end(); for (e = iBrother.getEdgeList().begin(); e != eend; ++e) { delete (edgedata *)((*e)->userdata); - (*e)->userdata = NULL; + (*e)->userdata = nullptr; // OEdge a: delete (oedgedata *)((*e)->GetaOEdge()->userdata); - (*e)->GetaOEdge()->userdata = NULL; + (*e)->GetaOEdge()->userdata = nullptr; // OEdge b: WOEdge *oedgeb = (*e)->GetbOEdge(); if (oedgeb) { delete (oedgedata *)(oedgeb->userdata); - oedgeb->userdata = NULL; + oedgeb->userdata = nullptr; } } @@ -593,7 +593,7 @@ WShape::WShape(WShape &iBrother) fend = iBrother.GetFaceList().end(); for (f = iBrother.GetFaceList().begin(); f != fend; ++f) { delete (facedata *)((*f)->userdata); - (*f)->userdata = NULL; + (*f)->userdata = nullptr; } } @@ -621,7 +621,7 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, WFace *face = MakeFace(iVertexList, iFaceEdgeMarksList, iMaterial); if (!face) { - return NULL; + return nullptr; } // set the list of per-vertex normals @@ -649,7 +649,7 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, if ((iVertexList[0] == iVertexList[1]) || (iVertexList[0] == iVertexList[2]) || (iVertexList[2] == iVertexList[1])) { cerr << "Warning: degenerated triangle detected, correcting" << endl; - return NULL; + return nullptr; } } @@ -695,7 +695,7 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, } if (!oedge) { - return NULL; + return nullptr; } WEdge *edge = oedge->GetOwner(); diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index 57eca876913..bedf4192d64 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -74,13 +74,13 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() return _pSmoothEdge; } float ta, tb; - WOEdge *woea(0), *woeb(0); + WOEdge *woea(nullptr), *woeb(nullptr); bool ok = false; vector<int> cuspEdgesIndices; int indexStart, indexEnd; unsigned nedges = _pWXFace->numberOfEdges(); if (_nNullDotP == nedges) { - _pSmoothEdge = NULL; + _pSmoothEdge = nullptr; return _pSmoothEdge; } if ((_nPosDotP != 0) && (_nPosDotP != _DotP.size()) && (_nNullDotP == 0)) { @@ -89,7 +89,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() // We retrieve the 2 edges for which we have opposite signs for each extremity RetrieveCuspEdgesIndices(cuspEdgesIndices); if (cuspEdgesIndices.size() != 2) { // we necessarly have 2 cusp edges - return 0; + return nullptr; } // let us determine which cusp edge corresponds to the starting: @@ -120,7 +120,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() // that means that we have exactly one of the 2 extremities of our silhouette edge is a vertex // of the mesh if (ELEM(_nPosDotP, 2, 0)) { - _pSmoothEdge = NULL; + _pSmoothEdge = nullptr; return _pSmoothEdge; } RetrieveCuspEdgesIndices(cuspEdgesIndices); @@ -129,8 +129,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() if (G.debug & G_DEBUG_FREESTYLE) { cout << "Warning in BuildSmoothEdge: weird WXFace configuration" << endl; } - _pSmoothEdge = NULL; - return NULL; + _pSmoothEdge = nullptr; + return nullptr; } unsigned index0 = Get0VertexIndex(); // retrieve the 0 vertex index unsigned nedges = _pWXFace->numberOfEdges(); @@ -275,7 +275,7 @@ WFace *WXShape::MakeFace(vector<WVertex *> &iVertexList, { WFace *face = WShape::MakeFace(iVertexList, iFaceEdgeMarksList, iMaterialIndex); if (!face) { - return NULL; + return nullptr; } Vec3f center; diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index 0fefb15f887..d9d6a6675c2 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -69,7 +69,7 @@ void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform &UNUSED(transform) delete _current_matrix; if (_matrices_stack.empty()) { - _current_matrix = NULL; + _current_matrix = nullptr; return; } @@ -133,12 +133,12 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) const unsigned int *vindices = ifs.vindices(); const unsigned int *nindices = ifs.nindices(); - const unsigned int *tindices = NULL; + const unsigned int *tindices = nullptr; if (ifs.tsize()) { tindices = ifs.tindices(); } - const unsigned int *mindices = NULL; + const unsigned int *mindices = nullptr; if (ifs.msize()) { mindices = ifs.mindices(); } |