From 28656293c624612a72224e0c7139471188c1203e Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 3 Feb 2022 18:27:42 -0600 Subject: Cleanup: Clang tidy, use braces Braces missed in b73d3b80fdcb72446 --- source/blender/blenkernel/intern/customdata.cc | 4 ++-- source/blender/bmesh/tools/bmesh_boolean.cc | 4 ++-- source/blender/editors/mesh/editmesh_select.c | 3 ++- source/blender/editors/space_outliner/outliner_tools.cc | 9 +++++++-- source/blender/gpu/opengl/gl_shader_interface.cc | 4 ++-- source/blender/io/usd/intern/usd_writer_material.cc | 12 ++++++------ source/blender/nodes/geometry/nodes/node_geo_triangulate.cc | 2 +- 7 files changed, 22 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 8b752fc3533..db30e223185 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -2431,7 +2431,7 @@ const char *CustomData_get_active_layer_name(const struct CustomData *data, cons { /* Get the layer index of the active layer of this type. */ const int layer_index = CustomData_get_active_layer_index(data, type); - return layer_index < 0 ? NULL : data->layers[layer_index].name; + return layer_index < 0 ? nullptr : data->layers[layer_index].name; } void CustomData_set_layer_active(CustomData *data, int type, int n) @@ -2786,7 +2786,7 @@ void CustomData_free_layers_anonymous(struct CustomData *data, int totelem) bool found_anonymous_layer = false; for (int i = 0; i < data->totlayer; i++) { const CustomDataLayer *layer = &data->layers[i]; - if (layer->anonymous_id != NULL) { + if (layer->anonymous_id != nullptr) { CustomData_free_layer(data, layer->type, totelem, i); found_anonymous_layer = true; break; diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc b/source/blender/bmesh/tools/bmesh_boolean.cc index e244bc377db..91883b0adee 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.cc +++ b/source/blender/bmesh/tools/bmesh_boolean.cc @@ -192,12 +192,12 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out, bool keep_hidden BM_elem_flag_enable(bmv, KEEP_FLAG); } else { - new_bmvs[v] = NULL; + new_bmvs[v] = nullptr; } } for (int v : m_out.vert_index_range()) { const Vert *vertp = m_out.vert(v); - if (new_bmvs[v] == NULL) { + if (new_bmvs[v] == nullptr) { float co[3]; const double3 &d_co = vertp->co; for (int i = 0; i < 3; ++i) { diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 6b2d56322fc..9396c9e53ea 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1405,7 +1405,7 @@ static char *edbm_select_mode_get_description(struct bContext *UNUSED(C), if (RNA_struct_property_is_set(values, "type") && !RNA_struct_property_is_set(values, "use_extend") && !RNA_struct_property_is_set(values, "use_expand") && - !RNA_struct_property_is_set(values, "action")) + !RNA_struct_property_is_set(values, "action")) { switch (type) { case SCE_SELECT_VERTEX: return BLI_strdup( @@ -1418,6 +1418,7 @@ static char *edbm_select_mode_get_description(struct bContext *UNUSED(C), return BLI_strdup( N_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection")); } + } return NULL; } diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index 12c5c9f99f5..3b8c284cd65 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -842,8 +842,13 @@ static void id_override_library_create_fn(bContext *C, te->store_elem->id->tag |= LIB_TAG_DOIT; } - success = BKE_lib_override_library_create( - bmain, CTX_data_scene(C), CTX_data_view_layer(C), NULL, id_root, id_reference, nullptr); + success = BKE_lib_override_library_create(bmain, + CTX_data_scene(C), + CTX_data_view_layer(C), + nullptr, + id_root, + id_reference, + nullptr); } else if (ID_IS_OVERRIDABLE_LIBRARY(id_root)) { success = BKE_lib_override_library_create_from_id(bmain, id_root, true) != nullptr; diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc index 71b908665d3..83016fca8a5 100644 --- a/source/blender/gpu/opengl/gl_shader_interface.cc +++ b/source/blender/gpu/opengl/gl_shader_interface.cc @@ -497,7 +497,7 @@ GLShaderInterface::~GLShaderInterface() void GLShaderInterface::ref_add(GLVaoCache *ref) { for (int i = 0; i < refs_.size(); i++) { - if (refs_[i] == NULL) { + if (refs_[i] == nullptr) { refs_[i] = ref; return; } @@ -509,7 +509,7 @@ void GLShaderInterface::ref_remove(GLVaoCache *ref) { for (int i = 0; i < refs_.size(); i++) { if (refs_[i] == ref) { - refs_[i] = NULL; + refs_[i] = nullptr; break; /* cannot have duplicates */ } } diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc index 52ad349fb98..5ce04339503 100644 --- a/source/blender/io/usd/intern/usd_writer_material.cc +++ b/source/blender/io/usd/intern/usd_writer_material.cc @@ -286,7 +286,7 @@ static void create_uvmap_shader(const USDExporterContext &usd_export_context, } bNode *uv_node = traverse_channel(tex_node_sock, SH_NODE_UVMAP); - if (uv_node == NULL) { + if (uv_node == nullptr) { continue; } @@ -391,7 +391,7 @@ static void export_in_memory_texture(Image *ima, BKE_image_path_ensure_ext_from_imformat(file_name, &imageFormat); char export_path[FILE_MAX]; - BLI_path_join(export_path, FILE_MAX, export_dir.c_str(), file_name, NULL); + BLI_path_join(export_path, FILE_MAX, export_dir.c_str(), file_name, nullptr); if (!allow_overwrite && BLI_exists(export_path)) { return; @@ -590,7 +590,7 @@ static std::string get_tex_image_asset_path(bNode *node, BLI_split_file_part(path.c_str(), file_path, FILE_MAX); if (export_params.relative_texture_paths) { - BLI_path_join(exp_path, FILE_MAX, ".", "textures", file_path, NULL); + BLI_path_join(exp_path, FILE_MAX, ".", "textures", file_path, nullptr); } else { /* Create absolute path in the textures directory. */ @@ -602,7 +602,7 @@ static std::string get_tex_image_asset_path(bNode *node, char dir_path[FILE_MAX]; BLI_split_dir_part(stage_path.c_str(), dir_path, FILE_MAX); - BLI_path_join(exp_path, FILE_MAX, dir_path, "textures", file_path, NULL); + BLI_path_join(exp_path, FILE_MAX, dir_path, "textures", file_path, nullptr); } return exp_path; } @@ -697,7 +697,7 @@ static void copy_single_file(Image *ima, const std::string &dest_dir, const bool BLI_split_file_part(source_path, file_name, FILE_MAX); char dest_path[FILE_MAX]; - BLI_path_join(dest_path, FILE_MAX, dest_dir.c_str(), file_name, NULL); + BLI_path_join(dest_path, FILE_MAX, dest_dir.c_str(), file_name, nullptr); if (!allow_overwrite && BLI_exists(dest_path)) { return; @@ -743,7 +743,7 @@ static void export_texture(bNode *node, BLI_split_dir_part(stage_path.c_str(), usd_dir_path, FILE_MAX); char tex_dir_path[FILE_MAX]; - BLI_path_join(tex_dir_path, FILE_MAX, usd_dir_path, "textures", SEP_STR, NULL); + BLI_path_join(tex_dir_path, FILE_MAX, usd_dir_path, "textures", SEP_STR, nullptr); BLI_dir_create_recursive(tex_dir_path); diff --git a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc index e78c4d7bc35..ab1afeb39f4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc @@ -67,7 +67,7 @@ static Mesh *triangulate_mesh_selection(const Mesh &mesh, BM_elem_flag_set(BM_face_at_index(bm, i_face), BM_ELEM_TAG, true); } - BM_mesh_triangulate(bm, quad_method, ngon_method, min_vertices, true, NULL, NULL, NULL); + BM_mesh_triangulate(bm, quad_method, ngon_method, min_vertices, true, nullptr, nullptr, nullptr); Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, &cd_mask_extra, &mesh); BM_mesh_free(bm); BKE_mesh_normals_tag_dirty(result); -- cgit v1.2.3