diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-18 07:27:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-18 07:41:24 +0300 |
commit | af4167441bc37707c1ed32ded348bc0865f9c093 (patch) | |
tree | 586d24617fe21cc8b6257851e5176ba664d6ccdb /source/blender | |
parent | 50a4b9d502104aabdd33ed924a89fe018cfa80b3 (diff) |
Cleanup: clang-tidy
Diffstat (limited to 'source/blender')
17 files changed, 32 insertions, 36 deletions
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 5ac85ad3aaf..9f5f70ab2ba 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -249,9 +249,7 @@ bool BKE_gpencil_is_first_lineart_in_stack(const Object *ob, const GpencilModifi if (gmd == md) { return true; } - else { - return false; - } + return false; } } /* If we reach here it means md is not in ob's modifier stack. */ diff --git a/source/blender/blenkernel/intern/lib_id_test.cc b/source/blender/blenkernel/intern/lib_id_test.cc index 8e21ae88aa6..f6988a2d71f 100644 --- a/source/blender/blenkernel/intern/lib_id_test.cc +++ b/source/blender/blenkernel/intern/lib_id_test.cc @@ -123,7 +123,7 @@ TEST(lib_id_main_unique_name, local_ids_1) test_lib_id_main_sort_check_order({id_a, id_b, id_c}); BLI_strncpy(id_c->name, id_a->name, sizeof(id_c->name)); - BKE_id_new_name_validate(&ctx.bmain->objects, id_c, NULL, false); + BKE_id_new_name_validate(&ctx.bmain->objects, id_c, nullptr, false); EXPECT_TRUE(strcmp(id_c->name + 2, "OB_A.001") == 0); EXPECT_TRUE(strcmp(id_a->name + 2, "OB_A") == 0); EXPECT_TRUE(ctx.bmain->objects.first == id_a); @@ -150,7 +150,7 @@ TEST(lib_id_main_unique_name, linked_ids_1) id_b->lib = lib_a; id_sort_by_name(&ctx.bmain->objects, id_b, nullptr); BLI_strncpy(id_b->name, id_a->name, sizeof(id_b->name)); - BKE_id_new_name_validate(&ctx.bmain->objects, id_b, NULL, true); + BKE_id_new_name_validate(&ctx.bmain->objects, id_b, nullptr, true); EXPECT_TRUE(strcmp(id_b->name + 2, "OB_A.001") == 0); EXPECT_TRUE(strcmp(id_a->name + 2, "OB_A") == 0); EXPECT_TRUE(ctx.bmain->objects.first == id_c); @@ -160,7 +160,7 @@ TEST(lib_id_main_unique_name, linked_ids_1) id_b->lib = lib_b; id_sort_by_name(&ctx.bmain->objects, id_b, nullptr); BLI_strncpy(id_b->name, id_a->name, sizeof(id_b->name)); - BKE_id_new_name_validate(&ctx.bmain->objects, id_b, NULL, true); + BKE_id_new_name_validate(&ctx.bmain->objects, id_b, nullptr, true); EXPECT_TRUE(strcmp(id_b->name + 2, "OB_A") == 0); EXPECT_TRUE(strcmp(id_a->name + 2, "OB_A") == 0); EXPECT_TRUE(ctx.bmain->objects.first == id_c); diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc index e8294086c35..e375fa929ed 100644 --- a/source/blender/blenkernel/intern/spline_base.cc +++ b/source/blender/blenkernel/intern/spline_base.cc @@ -241,9 +241,7 @@ static float3 calculate_next_normal(const float3 &last_normal, const float3 axis = float3::cross(last_tangent, current_tangent).normalized(); return rotate_direction_around_axis(last_normal, axis, angle); } - else { - return last_normal; - } + return last_normal; } static void calculate_normals_minimum(Span<float3> tangents, diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c index 5f732ba91ab..4ca6f93b014 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.c +++ b/source/blender/blenkernel/intern/subdiv_ccg.c @@ -1042,7 +1042,7 @@ typedef struct AverageGridsBoundariesData { CCGKey *key; /* Optional lookup table. Maps task index to index in `subdiv_ccg->adjacent_vertices`. */ - int *adjacent_edge_index_map; + const int *adjacent_edge_index_map; } AverageGridsBoundariesData; typedef struct AverageGridsBoundariesTLSData { @@ -1117,7 +1117,7 @@ typedef struct AverageGridsCornerData { CCGKey *key; /* Optional lookup table. Maps task range index to index in subdiv_ccg->adjacent_vertices*/ - int *adjacent_vert_index_map; + const int *adjacent_vert_index_map; } AverageGridsCornerData; static void subdiv_ccg_average_grids_corners(SubdivCCG *subdiv_ccg, @@ -1161,7 +1161,7 @@ static void subdiv_ccg_average_grids_corners_task(void *__restrict userdata_v, static void subdiv_ccg_average_boundaries(SubdivCCG *subdiv_ccg, CCGKey *key, - int *adjacent_edge_index_map, + const int *adjacent_edge_index_map, int num_adjacent_edges) { TaskParallelSettings parallel_range_settings; @@ -1186,7 +1186,7 @@ static void subdiv_ccg_average_all_boundaries(SubdivCCG *subdiv_ccg, CCGKey *key static void subdiv_ccg_average_corners(SubdivCCG *subdiv_ccg, CCGKey *key, - int *adjacent_vert_index_map, + const int *adjacent_vert_index_map, int num_adjacent_vertices) { TaskParallelSettings parallel_range_settings; diff --git a/source/blender/blenlib/tests/BLI_task_test.cc b/source/blender/blenlib/tests/BLI_task_test.cc index 52603428031..dd4441517a9 100644 --- a/source/blender/blenlib/tests/BLI_task_test.cc +++ b/source/blender/blenlib/tests/BLI_task_test.cc @@ -141,9 +141,9 @@ TEST(task, MempoolIter) /* *** Parallel iterations over mempool items with TLS. *** */ -typedef struct TaskMemPool_Chunk { +using TaskMemPool_Chunk = struct TaskMemPool_Chunk { ListBase *accumulate_items; -} TaskMemPool_Chunk; +}; static void task_mempool_iter_tls_func(void *UNUSED(userdata), MempoolIterData *item, @@ -206,7 +206,7 @@ TEST(task, MempoolIterTLS) BLI_parallel_mempool_settings_defaults(&settings); TaskMemPool_Chunk tls_data; - tls_data.accumulate_items = NULL; + tls_data.accumulate_items = nullptr; settings.userdata_chunk = &tls_data; settings.userdata_chunk_size = sizeof(tls_data); diff --git a/source/blender/blenloader/intern/versioning_common.cc b/source/blender/blenloader/intern/versioning_common.cc index da3ff08a7dd..f5083b8e259 100644 --- a/source/blender/blenloader/intern/versioning_common.cc +++ b/source/blender/blenloader/intern/versioning_common.cc @@ -33,10 +33,10 @@ ARegion *do_versions_add_region_if_not_found(ListBase *regionbase, const char *name, int link_after_region_type) { - ARegion *link_after_region = NULL; + ARegion *link_after_region = nullptr; LISTBASE_FOREACH (ARegion *, region, regionbase) { if (region->regiontype == region_type) { - return NULL; + return nullptr; } if (region->regiontype == link_after_region_type) { link_after_region = region; diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index 021565fceac..b3399e98af7 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -126,7 +126,7 @@ class ExtractorRunDatas : public Vector<ExtractorRunData> { return iter_type; } - const uint iter_types_len() const + uint iter_types_len() const { const eMRIterType iter_type = iter_types(); uint bits = static_cast<uint>(iter_type); diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc index 565f8834ab1..2dff101c71f 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc @@ -96,7 +96,7 @@ static void extract_edituv_tris_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_edituv_tris() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_edituv_tris_init; extractor.iter_looptri_bm = extract_edituv_tris_iter_looptri_bm; extractor.iter_looptri_mesh = extract_edituv_tris_iter_looptri_mesh; @@ -186,7 +186,7 @@ static void extract_edituv_lines_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_edituv_lines() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_edituv_lines_init; extractor.iter_poly_bm = extract_edituv_lines_iter_poly_bm; extractor.iter_poly_mesh = extract_edituv_lines_iter_poly_mesh; @@ -270,7 +270,7 @@ static void extract_edituv_points_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_edituv_points() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_edituv_points_init; extractor.iter_poly_bm = extract_edituv_points_iter_poly_bm; extractor.iter_poly_mesh = extract_edituv_points_iter_poly_mesh; @@ -366,7 +366,7 @@ static void extract_edituv_fdots_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_edituv_fdots() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_edituv_fdots_init; extractor.iter_poly_bm = extract_edituv_fdots_iter_poly_bm; extractor.iter_poly_mesh = extract_edituv_fdots_iter_poly_mesh; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc index 1d1a000061d..c21725ffa32 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc @@ -97,7 +97,7 @@ static void extract_fdots_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_fdots() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_fdots_init; extractor.iter_poly_bm = extract_fdots_iter_poly_bm; extractor.iter_poly_mesh = extract_fdots_iter_poly_mesh; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc index 64aaed6600f..2c2603af1b2 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc @@ -157,7 +157,7 @@ static void extract_lines_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_lines() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_lines_init; extractor.iter_poly_bm = extract_lines_iter_poly_bm; extractor.iter_poly_mesh = extract_lines_iter_poly_mesh; @@ -202,7 +202,7 @@ static void extract_lines_with_lines_loose_finish(const MeshRenderData *mr, constexpr MeshExtract create_extractor_lines_with_lines_loose() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_lines_init; extractor.iter_poly_bm = extract_lines_iter_poly_bm; extractor.iter_poly_mesh = extract_lines_iter_poly_mesh; @@ -235,7 +235,7 @@ static void extract_lines_loose_only_init(const MeshRenderData *mr, constexpr MeshExtract create_extractor_lines_loose_only() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_lines_loose_only_init; extractor.data_type = MR_DATA_NONE; extractor.data_size = 0; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc index cace18b0c08..35b60002c1f 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc @@ -177,7 +177,7 @@ static void extract_lines_adjacency_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_lines_adjacency() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_lines_adjacency_init; extractor.iter_looptri_bm = extract_lines_adjacency_iter_looptri_bm; extractor.iter_looptri_mesh = extract_lines_adjacency_iter_looptri_mesh; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc index a142692ab4e..277f9d69c2f 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc @@ -107,7 +107,7 @@ static void extract_lines_paint_mask_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_lines_paint_mask() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_lines_paint_mask_init; extractor.iter_poly_mesh = extract_lines_paint_mask_iter_poly_mesh; extractor.finish = extract_lines_paint_mask_finish; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc index 1e4e76ba7c5..cee0c224aab 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc @@ -156,7 +156,7 @@ static void extract_points_finish(const MeshRenderData *UNUSED(mr), constexpr MeshExtract create_extractor_points() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_points_init; extractor.iter_poly_bm = extract_points_iter_poly_bm; extractor.iter_poly_mesh = extract_points_iter_poly_mesh; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc index ec968fa33da..93f71f920eb 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc @@ -115,7 +115,7 @@ static void extract_tris_finish(const MeshRenderData *mr, constexpr MeshExtract create_extractor_tris() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_tris_init; extractor.iter_looptri_bm = extract_tris_iter_looptri_bm; extractor.iter_looptri_mesh = extract_tris_iter_looptri_mesh; @@ -197,7 +197,7 @@ static void extract_tris_single_mat_finish(const MeshRenderData *mr, for (int i = 0; i < mr->mat_len; i++) { /* These IBOs have not been queried yet but we create them just in case they are needed * later since they are not tracked by mesh_buffer_cache_create_requested(). */ - if (mbc->tris_per_mat[i] == NULL) { + if (mbc->tris_per_mat[i] == nullptr) { mbc->tris_per_mat[i] = GPU_indexbuf_calloc(); } /* Multiply by 3 because these are triangle indices. */ @@ -209,7 +209,7 @@ static void extract_tris_single_mat_finish(const MeshRenderData *mr, constexpr MeshExtract create_extractor_tris_single_mat() { - MeshExtract extractor = {0}; + MeshExtract extractor = {nullptr}; extractor.init = extract_tris_single_mat_init; extractor.iter_looptri_bm = extract_tris_single_mat_iter_looptri_bm; extractor.iter_looptri_mesh = extract_tris_single_mat_iter_looptri_mesh; diff --git a/source/blender/gpu/GPU_index_buffer.h b/source/blender/gpu/GPU_index_buffer.h index a89ed91674f..197077cf76c 100644 --- a/source/blender/gpu/GPU_index_buffer.h +++ b/source/blender/gpu/GPU_index_buffer.h @@ -58,7 +58,7 @@ GPUIndexBuf *GPU_indexbuf_build_on_device(uint index_len); * * Function inspired by the reduction directives of multithread work APIs.. */ -void GPU_indexbuf_join(GPUIndexBufBuilder *builder, const GPUIndexBufBuilder *parent_builder); +void GPU_indexbuf_join(GPUIndexBufBuilder *builder, const GPUIndexBufBuilder *builder_from); void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *, uint v); void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder *); diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc index 3a4492d24d6..bfd6027e0fc 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc @@ -97,7 +97,7 @@ static void raycast_to_mesh(const Mesh *mesh, BVHTreeFromMesh tree_data; BKE_bvhtree_from_mesh_get(&tree_data, const_cast<Mesh *>(mesh), BVHTREE_FROM_LOOPTRI, 4); - if (tree_data.tree != NULL) { + if (tree_data.tree != nullptr) { for (const int i : ray_origins.index_range()) { const float ray_length = ray_lengths[i]; const float3 ray_origin = ray_origins[i]; diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc b/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc index 52f2adb10dd..6baaa17f956 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc @@ -134,7 +134,7 @@ void register_node_type_sh_mix_rgb(void) sh_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out); node_type_label(&ntype, node_blend_label); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_mix_rgb); + node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_mix_rgb); node_type_gpu(&ntype, gpu_shader_mix_rgb); nodeRegisterType(&ntype); |