1
1

Cleanup: clang-tidy

This commit is contained in:
2021-06-18 14:27:43 +10:00
parent 50a4b9d502
commit af4167441b
17 changed files with 32 additions and 36 deletions

View File

@@ -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. */

View File

@@ -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);

View File

@@ -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,

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 *);

View File

@@ -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];

View File

@@ -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);