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/bmesh | |
parent | 88926375a0e4e45f72c87b9e487c060ddd3c9216 (diff) |
Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.
No functional changes.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/tests/bmesh_core_test.cc | 10 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_boolean.cc | 28 |
2 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/bmesh/tests/bmesh_core_test.cc b/source/blender/bmesh/tests/bmesh_core_test.cc index afbc11e0722..202d16b09e3 100644 --- a/source/blender/bmesh/tests/bmesh_core_test.cc +++ b/source/blender/bmesh/tests/bmesh_core_test.cc @@ -16,8 +16,8 @@ TEST(bmesh_core, BMVertCreate) EXPECT_EQ(bm->totvert, 0); /* make a custom layer so we can see if it is copied properly */ BM_data_layer_add(bm, &bm->vdata, CD_PROP_FLOAT); - bv1 = BM_vert_create(bm, co1, NULL, BM_CREATE_NOP); - ASSERT_TRUE(bv1 != NULL); + bv1 = BM_vert_create(bm, co1, nullptr, BM_CREATE_NOP); + ASSERT_TRUE(bv1 != nullptr); EXPECT_EQ(bv1->co[0], 1.0f); EXPECT_EQ(bv1->co[1], 2.0f); EXPECT_EQ(bv1->co[2], 0.0f); @@ -25,14 +25,14 @@ TEST(bmesh_core, BMVertCreate) EXPECT_EQ(bv1->head.htype, (char)BM_VERT); EXPECT_EQ(bv1->head.hflag, 0); EXPECT_EQ(bv1->head.api_flag, 0); - bv2 = BM_vert_create(bm, NULL, NULL, BM_CREATE_NOP); - ASSERT_TRUE(bv2 != NULL); + bv2 = BM_vert_create(bm, nullptr, nullptr, BM_CREATE_NOP); + ASSERT_TRUE(bv2 != nullptr); EXPECT_TRUE(is_zero_v3(bv2->co)); /* create with example should copy custom data but not select flag */ BM_vert_select_set(bm, bv2, true); BM_elem_float_data_set(&bm->vdata, bv2, CD_PROP_FLOAT, 1.5f); bv3 = BM_vert_create(bm, co1, bv2, BM_CREATE_NOP); - ASSERT_TRUE(bv3 != NULL); + ASSERT_TRUE(bv3 != nullptr); EXPECT_FALSE(BM_elem_flag_test((BMElem *)bv3, BM_ELEM_SELECT)); EXPECT_EQ(BM_elem_float_data_get(&bm->vdata, bv3, CD_PROP_FLOAT), 1.5f); EXPECT_EQ(BM_mesh_elem_count(bm, BM_VERT), 3); diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc b/source/blender/bmesh/tools/bmesh_boolean.cc index 56585cb722e..819ee420661 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.cc +++ b/source/blender/bmesh/tools/bmesh_boolean.cc @@ -121,7 +121,7 @@ static bool face_has_verts_in_order(BMesh *bm, BMFace *bmf, const BMVert *v1, co { BMIter liter; BMLoop *l = static_cast<BMLoop *>(BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, bmf)); - while (l != NULL) { + while (l != nullptr) { if (l->v == v1 && l->next->v == v2) { return true; } @@ -184,7 +184,7 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) for (int i = 0; i < 3; ++i) { co[i] = static_cast<float>(d_co[i]); } - BMVert *bmv = BM_vert_create(bm, co, NULL, BM_CREATE_NOP); + BMVert *bmv = BM_vert_create(bm, co, nullptr, BM_CREATE_NOP); new_bmvs[v] = bmv; BM_elem_flag_enable(bmv, KEEP_FLAG); any_change = true; @@ -231,7 +231,7 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) BMFace *bmf = BM_face_exists(face_bmverts.data(), flen); /* #BM_face_exists checks if the face exists with the vertices in either order. * We can only reuse the face if the orientations are the same. */ - if (bmf != NULL && face_has_verts_in_order(bm, bmf, face_bmverts[0], face_bmverts[1])) { + if (bmf != nullptr && face_has_verts_in_order(bm, bmf, face_bmverts[0], face_bmverts[1])) { BM_elem_flag_enable(bmf, KEEP_FLAG); } else { @@ -242,20 +242,20 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) orig_face = old_bmfs[orig]; } else { - orig_face = NULL; + orig_face = nullptr; } /* Make or find #BMEdge's. */ for (int i = 0; i < flen; ++i) { BMVert *bmv1 = face_bmverts[i]; BMVert *bmv2 = face_bmverts[(i + 1) % flen]; BMEdge *bme = BM_edge_exists(bmv1, bmv2); - if (bme == NULL) { - BMEdge *orig_edge = NULL; + if (bme == nullptr) { + BMEdge *orig_edge = nullptr; if (face.edge_orig[i] != NO_INDEX) { orig_edge = old_edges[face.edge_orig[i]]; } bme = BM_edge_create(bm, bmv1, bmv2, orig_edge, BM_CREATE_NOP); - if (orig_edge != NULL) { + if (orig_edge != nullptr) { BM_elem_select_copy(bm, bme, orig_edge); } } @@ -269,15 +269,15 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) } BMFace *bmf = BM_face_create( bm, face_bmverts.data(), face_bmedges.data(), flen, orig_face, BM_CREATE_NOP); - if (orig_face != NULL) { + if (orig_face != nullptr) { BM_elem_select_copy(bm, bmf, orig_face); } BM_elem_flag_enable(bmf, KEEP_FLAG); /* Now do interpolation of loop data (e.g., UV's) using the example face. */ - if (orig_face != NULL) { + if (orig_face != nullptr) { BMIter liter; BMLoop *l = static_cast<BMLoop *>(BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, bmf)); - while (l != NULL) { + while (l != nullptr) { BM_loop_interp_from_face(bm, l, orig_face, true, true); l = static_cast<BMLoop *>(BM_iter_step(&liter)); } @@ -290,8 +290,8 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) /* #BM_ITER_MESH_MUTABLE macro needs type casts for C++, so expand here. * TODO(howard): make some nice C++ iterators for #BMesh. */ BMIter iter; - BMFace *bmf = static_cast<BMFace *>(BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL)); - while (bmf != NULL) { + BMFace *bmf = static_cast<BMFace *>(BM_iter_new(&iter, bm, BM_FACES_OF_MESH, nullptr)); + while (bmf != nullptr) { # ifdef DEBUG iter.count = BM_iter_mesh_count(BM_FACES_OF_MESH, bm); # endif @@ -308,8 +308,8 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) } bmf = bmf_next; } - BMVert *bmv = static_cast<BMVert *>(BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL)); - while (bmv != NULL) { + BMVert *bmv = static_cast<BMVert *>(BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, nullptr)); + while (bmv != nullptr) { # ifdef DEBUG iter.count = BM_iter_mesh_count(BM_VERTS_OF_MESH, bm); # endif |