Cleanup: Clang tidy, use braces

Braces missed in b73d3b80fd
This commit is contained in:
Hans Goudey 2022-02-03 18:27:42 -06:00
parent 3ddc39bec9
commit 28656293c6
7 changed files with 22 additions and 16 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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