Cleanup: Clang tidy

This commit is contained in:
Hans Goudey 2022-06-25 19:05:31 -05:00
parent ef8bb8c0d5
commit be692cc4fe
4 changed files with 25 additions and 37 deletions

View File

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

View File

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

View File

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

View File

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