[Bf-blender-cvs] [5dbd6968a68] master: Cleanup: clang-tidy

Campbell Barton noreply at git.blender.org
Mon Apr 4 07:44:09 CEST 2022


Commit: 5dbd6968a6851a7f1ed4ee1b9b5372a3b082dff9
Author: Campbell Barton
Date:   Mon Apr 4 15:42:37 2022 +1000
Branches: master
https://developer.blender.org/rB5dbd6968a6851a7f1ed4ee1b9b5372a3b082dff9

Cleanup: clang-tidy

===================================================================

M	source/blender/blenkernel/intern/gpencil_geom.cc
M	source/blender/blenkernel/intern/mesh_debug.cc
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
M	source/blender/editors/curve/editcurve_pen.c
M	source/blender/editors/curves/intern/curves_ops.cc
M	source/blender/editors/object/object_transform.cc
M	source/blender/editors/space_node/node_draw.cc
M	source/blender/editors/space_outliner/outliner_tools.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc
index 76f21e369aa..e1a79986719 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -1308,7 +1308,7 @@ void BKE_gpencil_stroke_smooth(bGPDstroke *gps,
   /* Smooth stroke. */
   for (int i = 0; i < gps->totpoints; i++) {
     float val = influence;
-    if (weights != NULL) {
+    if (weights != nullptr) {
       val *= weights[i];
       if (val <= 0.0f) {
         continue;
diff --git a/source/blender/blenkernel/intern/mesh_debug.cc b/source/blender/blenkernel/intern/mesh_debug.cc
index 1d62c0251fb..6f12726d364 100644
--- a/source/blender/blenkernel/intern/mesh_debug.cc
+++ b/source/blender/blenkernel/intern/mesh_debug.cc
@@ -11,7 +11,7 @@
 
 #ifndef NDEBUG
 
-#  include <stdio.h>
+#  include <cstdio>
 
 #  include "MEM_guardedalloc.h"
 
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
index ab17b2e5294..dd056891a94 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
@@ -233,7 +233,7 @@ static void extract_pos_nor_init_subdiv(const DRWSubdivCache *subdiv_cache,
     Mesh *coarse_mesh = subdiv_cache->mesh;
     float(*lnors)[3] = static_cast<float(*)[3]>(
         CustomData_get_layer(&coarse_mesh->ldata, CD_NORMAL));
-    BLI_assert(lnors != NULL);
+    BLI_assert(lnors != nullptr);
 
     GPUVertBuf *src_custom_normals = GPU_vertbuf_calloc();
     GPU_vertbuf_init_with_format(src_custom_normals, get_custom_normals_format());
diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c
index 0524159fe54..fca850076ae 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -1162,16 +1162,14 @@ static void move_segment(ViewContext *vc, MoveSegmentData *seg_data, const wmEve
     if (bezt2->hide) {
       return;
     }
-    else {
-      /*
-       * Swap bezt1 and bezt2 in all calculations if only bezt2 is visible.
-       * (The first point needs to be visible for the calculations of the second point to be valid)
-       */
-      BezTriple *temp_bezt = bezt2;
-      bezt2 = bezt1;
-      bezt1 = temp_bezt;
-      h1 = 0, h2 = 2;
-    }
+    /*
+     * Swap bezt1 and bezt2 in all calculations if only bezt2 is visible.
+     * (The first point needs to be visible for the calculations of the second point to be valid)
+     */
+    BezTriple *temp_bezt = bezt2;
+    bezt2 = bezt1;
+    bezt1 = temp_bezt;
+    h1 = 0, h2 = 2;
   }
 
   const float t = max_ff(min_ff(seg_data->t, 0.9f), 0.1f);
diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc
index bbd48ccd89a..07dd650d433 100644
--- a/source/blender/editors/curves/intern/curves_ops.cc
+++ b/source/blender/editors/curves/intern/curves_ops.cc
@@ -254,7 +254,7 @@ static int curves_convert_to_particle_system_exec(bContext *C, wmOperator *UNUSE
   }
   CTX_DATA_END;
 
-  WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+  WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, nullptr);
 
   return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/object/object_transform.cc b/source/blender/editors/object/object_transform.cc
index 4c61e95c9e9..3d4d543012d 100644
--- a/source/blender/editors/object/object_transform.cc
+++ b/source/blender/editors/object/object_transform.cc
@@ -655,7 +655,7 @@ static int apply_objects_internal(bContext *C,
   float obact_invmat[4][4], obact_parent[4][4], obact_parentinv[4][4];
 
   /* Only used when do_multi_user is set. */
-  Object *obact = NULL;
+  Object *obact = nullptr;
   bool make_single_user = false;
 
   if (do_multi_user) {
@@ -675,7 +675,7 @@ static int apply_objects_internal(bContext *C,
         ID *obact_data = static_cast<ID *>(obact->data);
         BKE_reportf(reports,
                     RPT_ERROR,
-                    "Cannot apply to a multi user: Object \"%s\", %s \"%s\", aborting",
+                    R"(Cannot apply to a multi user: Object "%s", %s "%s", aborting)",
                     obact->id.name + 2,
                     BKE_idtype_idcode_to_name(GS(obact_data->name)),
                     obact_data->name + 2);
@@ -818,7 +818,7 @@ static int apply_objects_internal(bContext *C,
     /* Make single user. */
     ED_object_single_obdata_user(bmain, scene, obact);
     BKE_main_id_newptr_and_tag_clear(bmain);
-    WM_event_add_notifier(C, NC_WINDOW, NULL);
+    WM_event_add_notifier(C, NC_WINDOW, nullptr);
     DEG_relations_tag_update(bmain);
   }
 
@@ -1128,7 +1128,7 @@ static int object_transform_apply_invoke(bContext *C, wmOperator *op, const wmEv
   bool can_handle_multiuser = apply_objects_internal_can_multiuser(C);
   bool need_single_user = can_handle_multiuser && apply_objects_internal_need_single_user(C);
 
-  if ((ob->data != NULL) && need_single_user) {
+  if ((ob->data != nullptr) && need_single_user) {
     PropertyRNA *prop = RNA_struct_find_property(op->ptr, "isolate_users");
     if (!RNA_property_is_set(op->ptr, prop)) {
       RNA_property_boolean_set(op->ptr, prop, true);
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index 4ab81bac9aa..68cfd1c9ef0 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -2580,7 +2580,7 @@ static void reroute_node_draw(
     const int y = node.totr.ymax;
 
     uiBut *label_but = uiDefBut(
-        &block, UI_BTYPE_LABEL, 0, showname, x, y, width, (short)NODE_DY, NULL, 0, 0, 0, 0, NULL);
+        &block, UI_BTYPE_LABEL, 0, showname, x, y, width, (short)NODE_DY, nullptr, 0, 0, 0, 0, nullptr);
 
     UI_but_drawflag_disable(label_but, UI_BUT_TEXT_LEFT);
   }
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc
index 22e42c762ca..6cbb701d763 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -1167,7 +1167,6 @@ static void id_override_library_clear_single_fn(bContext *C,
   }
 
   WM_event_add_notifier(C, NC_WINDOW, nullptr);
-  return;
 }
 
 static void id_fake_user_set_fn(bContext *UNUSED(C),
@@ -1813,11 +1812,11 @@ void OUTLINER_OT_object_operation(wmOperatorType *ot)
 
 using OutlinerDeleteFn = void (*)(bContext *C, ReportList *reports, Scene *scene, Object *ob);
 
-typedef struct ObjectEditData {
+using ObjectEditData = struct ObjectEditData {
   GSet *objects_set;
   bool is_liboverride_allowed;
   bool is_liboverride_hierarchy_root_allowed;
-} ObjectEditData;
+};
 
 static void outliner_do_object_delete(bContext *C,
                                       ReportList *reports,



More information about the Bf-blender-cvs mailing list