[Bf-blender-cvs] [be692cc4fe9] master: Cleanup: Clang tidy

Hans Goudey noreply at git.blender.org
Sun Jun 26 02:10:04 CEST 2022


Commit: be692cc4fe9b4c0b764222d54b3103bfa710d57c
Author: Hans Goudey
Date:   Sat Jun 25 19:05:31 2022 -0500
Branches: master
https://developer.blender.org/rBbe692cc4fe9b4c0b764222d54b3103bfa710d57c

Cleanup: Clang tidy

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

M	source/blender/editors/interface/grid_view.cc
M	source/blender/editors/interface/tree_view.cc
M	source/blender/editors/sculpt_paint/paint_vertex.cc
M	source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc

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

diff --git a/source/blender/editors/interface/grid_view.cc b/source/blender/editors/interface/grid_view.cc
index a82cb7798fe..194052862cf 100644
--- a/source/blender/editors/interface/grid_view.cc
+++ b/source/blender/editors/interface/grid_view.cc
@@ -38,12 +38,12 @@ AbstractGridViewItem &AbstractGridView::add_item(std::unique_ptr<AbstractGridVie
 
 void AbstractGridView::foreach_item(ItemIterFn iter_fn) const
 {
-  for (auto &item_ptr : items_) {
+  for (const auto &item_ptr : items_) {
     iter_fn(*item_ptr);
   }
 }
 
-bool AbstractGridView::listen(const wmNotifier &) const
+bool AbstractGridView::listen(const wmNotifier & /*notifier*/) const
 {
   /* Nothing by default. */
   return false;
@@ -243,17 +243,17 @@ class BuildOnlyVisibleButtonsHelper {
   IndexRange visible_items_range_{};
 
  public:
-  BuildOnlyVisibleButtonsHelper(const View2D &,
+  BuildOnlyVisibleButtonsHelper(const View2D &v2d,
                                 const AbstractGridView &grid_view,
                                 int cols_per_row);
 
   bool is_item_visible(int item_idx) const;
-  void fill_layout_before_visible(uiBlock &) const;
-  void fill_layout_after_visible(uiBlock &) const;
+  void fill_layout_before_visible(uiBlock &block) const;
+  void fill_layout_after_visible(uiBlock &block) const;
 
  private:
   IndexRange get_visible_range() const;
-  void add_spacer_button(uiBlock &, int row_count) const;
+  void add_spacer_button(uiBlock &block, int row_count) const;
 };
 
 BuildOnlyVisibleButtonsHelper::BuildOnlyVisibleButtonsHelper(const View2D &v2d,
diff --git a/source/blender/editors/interface/tree_view.cc b/source/blender/editors/interface/tree_view.cc
index f86d1c4d8bc..96158ee48f6 100644
--- a/source/blender/editors/interface/tree_view.cc
+++ b/source/blender/editors/interface/tree_view.cc
@@ -68,7 +68,7 @@ void AbstractTreeView::foreach_item(ItemIterFn iter_fn, IterOptions options) con
   foreach_item_recursive(iter_fn, options);
 }
 
-bool AbstractTreeView::listen(const wmNotifier &) const
+bool AbstractTreeView::listen(const wmNotifier & /*notifier*/) const
 {
   /* Nothing by default. */
   return false;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.cc b/source/blender/editors/sculpt_paint/paint_vertex.cc
index b8403b1e34b..4e161b1a6ab 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.cc
+++ b/source/blender/editors/sculpt_paint/paint_vertex.cc
@@ -1788,7 +1788,8 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
   /* set up auto-normalize, and generate map for detecting which
    * vgroups affect deform bones */
   wpd->lock_flags = BKE_object_defgroup_lock_flags_get(ob, wpd->defbase_tot);
-  if (ts->auto_normalize || ts->multipaint || wpd->lock_flags || ts->wpaint_lock_relative) {
+  if (ts->auto_normalize || ts->multipaint || wpd->lock_flags != nullptr ||
+      ts->wpaint_lock_relative) {
     wpd->vgroup_validmap = BKE_object_defgroup_validmap_get(ob, wpd->defbase_tot);
   }
 
@@ -2577,31 +2578,14 @@ static void wpaint_stroke_done(const bContext *C, PaintStroke *stroke)
   WPaintData *wpd = (WPaintData *)paint_stroke_mode_data(stroke);
 
   if (wpd) {
-    if (wpd->defbase_sel) {
-      MEM_freeN((void *)wpd->defbase_sel);
-    }
-    if (wpd->vgroup_validmap) {
-      MEM_freeN((void *)wpd->vgroup_validmap);
-    }
-    if (wpd->vgroup_locked) {
-      MEM_freeN((void *)wpd->vgroup_locked);
-    }
-    if (wpd->vgroup_unlocked) {
-      MEM_freeN((void *)wpd->vgroup_unlocked);
-    }
-    if (wpd->lock_flags) {
-      MEM_freeN((void *)wpd->lock_flags);
-    }
-    if (wpd->active.lock) {
-      MEM_freeN((void *)wpd->active.lock);
-    }
-    if (wpd->mirror.lock) {
-      MEM_freeN((void *)wpd->mirror.lock);
-    }
-    if (wpd->precomputed_weight) {
-      MEM_freeN(wpd->precomputed_weight);
-    }
-
+    MEM_SAFE_FREE(wpd->defbase_sel);
+    MEM_SAFE_FREE(wpd->vgroup_validmap);
+    MEM_SAFE_FREE(wpd->vgroup_locked);
+    MEM_SAFE_FREE(wpd->vgroup_unlocked);
+    MEM_SAFE_FREE(wpd->lock_flags);
+    MEM_SAFE_FREE(wpd->active.lock);
+    MEM_SAFE_FREE(wpd->mirror.lock);
+    MEM_SAFE_FREE(wpd->precomputed_weight);
     MEM_freeN(wpd);
   }
 
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
index a7c44a17e05..9a3f2b9b708 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
@@ -343,7 +343,8 @@ static int vertex_color_brightness_contrast_exec(bContext *C, wmOperator *op)
   }
 
   Mesh *me;
-  if (((me = BKE_mesh_from_object(obact)) == NULL) || (ED_mesh_color_ensure(me, NULL) == false)) {
+  if (((me = BKE_mesh_from_object(obact)) == nullptr) ||
+      (ED_mesh_color_ensure(me, nullptr) == false)) {
     return OPERATOR_CANCELLED;
   }
 
@@ -390,7 +391,8 @@ static int vertex_color_hsv_exec(bContext *C, wmOperator *op)
   const float val = RNA_float_get(op->ptr, "v");
 
   Mesh *me;
-  if (((me = BKE_mesh_from_object(obact)) == NULL) || (ED_mesh_color_ensure(me, NULL) == false)) {
+  if (((me = BKE_mesh_from_object(obact)) == nullptr) ||
+      (ED_mesh_color_ensure(me, nullptr) == false)) {
     return OPERATOR_CANCELLED;
   }
 
@@ -441,7 +443,8 @@ static int vertex_color_invert_exec(bContext *C, wmOperator *UNUSED(op))
   Object *obact = CTX_data_active_object(C);
 
   Mesh *me;
-  if (((me = BKE_mesh_from_object(obact)) == NULL) || (ED_mesh_color_ensure(me, NULL) == false)) {
+  if (((me = BKE_mesh_from_object(obact)) == nullptr) ||
+      (ED_mesh_color_ensure(me, nullptr) == false)) {
     return OPERATOR_CANCELLED;
   }
 
@@ -479,7 +482,8 @@ static int vertex_color_levels_exec(bContext *C, wmOperator *op)
   const float offset = RNA_float_get(op->ptr, "offset");
 
   Mesh *me;
-  if (((me = BKE_mesh_from_object(obact)) == NULL) || (ED_mesh_color_ensure(me, NULL) == false)) {
+  if (((me = BKE_mesh_from_object(obact)) == nullptr) ||
+      (ED_mesh_color_ensure(me, nullptr) == false)) {
     return OPERATOR_CANCELLED;
   }



More information about the Bf-blender-cvs mailing list