[Bf-blender-cvs] [1bd0a873840] master: Cleanup: Clang tidy
Hans Goudey
noreply at git.blender.org
Fri Jan 14 00:12:01 CET 2022
Commit: 1bd0a87384011b739d1f4f06e0933d7d094732ac
Author: Hans Goudey
Date: Thu Jan 13 17:11:38 2022 -0600
Branches: master
https://developer.blender.org/rB1bd0a87384011b739d1f4f06e0933d7d094732ac
Cleanup: Clang tidy
- modernize-deprecated-headers
- modernize-use-using
- modernize-use-nullptr
- modernize-use-bool-literals
===================================================================
M source/blender/editors/space_outliner/outliner_collections.cc
M source/blender/editors/space_outliner/outliner_dragdrop.cc
M source/blender/editors/space_outliner/outliner_draw.cc
M source/blender/editors/space_outliner/outliner_edit.cc
M source/blender/editors/space_outliner/outliner_select.cc
M source/blender/editors/space_outliner/outliner_sync.cc
M source/blender/editors/space_outliner/outliner_tools.cc
M source/blender/editors/space_outliner/outliner_tree.cc
M source/blender/editors/space_outliner/outliner_utils.cc
M source/blender/editors/space_outliner/space_outliner.cc
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_collections.cc b/source/blender/editors/space_outliner/outliner_collections.cc
index e4c4d41a04b..8d60a6088d3 100644
--- a/source/blender/editors/space_outliner/outliner_collections.cc
+++ b/source/blender/editors/space_outliner/outliner_collections.cc
@@ -18,7 +18,7 @@
* \ingroup spoutliner
*/
-#include <string.h>
+#include <cstring>
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.cc b/source/blender/editors/space_outliner/outliner_dragdrop.cc
index 30f1ef911e4..3745894d630 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.cc
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.cc
@@ -21,7 +21,7 @@
* \ingroup spoutliner
*/
-#include <string.h>
+#include <cstring>
#include "MEM_guardedalloc.h"
@@ -187,7 +187,7 @@ static TreeElement *outliner_drop_insert_find(bContext *C,
return nullptr;
}
-typedef bool (*CheckTypeFn)(TreeElement *te);
+using CheckTypeFn = bool (*)(TreeElement *te);
static TreeElement *outliner_data_from_tree_element_and_parents(CheckTypeFn check_type,
TreeElement *te)
@@ -662,13 +662,13 @@ void OUTLINER_OT_material_drop(wmOperatorType *ot)
* - Copying a single modifier/constraint/effect to another object.
* - Copying (linking) an object's modifiers/constraints/effects to another. */
-typedef enum eDataStackDropAction {
+enum eDataStackDropAction {
DATA_STACK_DROP_REORDER,
DATA_STACK_DROP_COPY,
DATA_STACK_DROP_LINK,
-} eDataStackDropAction;
+};
-typedef struct StackDropData {
+struct StackDropData {
Object *ob_parent;
bPoseChannel *pchan_parent;
TreeStoreElem *drag_tselem;
@@ -678,7 +678,7 @@ typedef struct StackDropData {
eDataStackDropAction drop_action;
TreeElement *drop_te;
TreeElementInsertType insert_type;
-} StackDropData;
+};
static void datastack_drop_data_init(wmDrag *drag,
Object *ob,
@@ -1082,13 +1082,13 @@ void OUTLINER_OT_datastack_drop(wmOperatorType *ot)
/* ******************** Collection Drop Operator *********************** */
-typedef struct CollectionDrop {
+struct CollectionDrop {
Collection *from;
Collection *to;
TreeElement *te;
TreeElementInsertType insert_type;
-} CollectionDrop;
+};
static Collection *collection_parent_from_ID(ID *id)
{
diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc
index 3d29f1762ec..e7f35b856c0 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -869,7 +869,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
}
}
-typedef struct RestrictProperties {
+struct RestrictProperties {
bool initialized;
PropertyRNA *object_hide_viewport, *object_hide_select, *object_hide_render;
@@ -880,11 +880,11 @@ typedef struct RestrictProperties {
PropertyRNA *modifier_show_viewport, *modifier_show_render;
PropertyRNA *constraint_enable;
PropertyRNA *bone_hide_viewport;
-} RestrictProperties;
+};
/* We don't care about the value of the property
* but whether the property should be active or grayed out. */
-typedef struct RestrictPropertiesActive {
+struct RestrictPropertiesActive {
bool object_hide_viewport;
bool object_hide_select;
bool object_hide_render;
@@ -900,7 +900,7 @@ typedef struct RestrictPropertiesActive {
bool modifier_show_render;
bool constraint_enable;
bool bone_hide_viewport;
-} RestrictPropertiesActive;
+};
static void outliner_restrict_properties_enable_collection_set(
PointerRNA *collection_ptr, RestrictProperties *props, RestrictPropertiesActive *props_active)
@@ -1995,13 +1995,13 @@ static void outliner_buttons(const bContext *C,
/* If we add support to rename Sequence, need change this. */
if (tselem->type == TSE_EBONE) {
- len = sizeof(((EditBone *)0)->name);
+ len = sizeof(((EditBone *)nullptr)->name);
}
else if (tselem->type == TSE_MODIFIER) {
- len = sizeof(((ModifierData *)0)->name);
+ len = sizeof(((ModifierData *)nullptr)->name);
}
else if (tselem->id && GS(tselem->id->name) == ID_LI) {
- len = sizeof(((Library *)0)->filepath);
+ len = sizeof(((Library *)nullptr)->filepath);
}
else {
len = MAX_ID_NAME - 2;
@@ -2234,7 +2234,7 @@ static void outliner_draw_warning_column(const bContext *C,
TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
{
- TreeElementIcon data = {0};
+ TreeElementIcon data = {nullptr};
if (tselem->type != TSE_SOME_ID) {
switch (tselem->type) {
diff --git a/source/blender/editors/space_outliner/outliner_edit.cc b/source/blender/editors/space_outliner/outliner_edit.cc
index c80431584a2..9a4ef1c5d2e 100644
--- a/source/blender/editors/space_outliner/outliner_edit.cc
+++ b/source/blender/editors/space_outliner/outliner_edit.cc
@@ -21,7 +21,7 @@
* \ingroup spoutliner
*/
-#include <string.h>
+#include <cstring>
#include "MEM_guardedalloc.h"
@@ -183,11 +183,11 @@ void outliner_item_openclose(SpaceOutliner *space_outliner,
}
}
-typedef struct OpenCloseData {
+struct OpenCloseData {
TreeStoreElem *prev_tselem;
bool open;
int x_location;
-} OpenCloseData;
+};
static int outliner_item_openclose_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
@@ -1389,7 +1389,7 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot)
ot->poll = ED_operator_outliner_active;
/* properties */
- prop = RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page");
+ prop = RNA_def_boolean(ot->srna, "up", false, "Up", "Scroll up one page");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
@@ -1586,7 +1586,7 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot)
/* no undo or registry, UI option */
/* properties */
- prop = RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep");
+ prop = RNA_def_boolean(ot->srna, "open", true, "Open", "Expand all entries one level deep");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
@@ -1698,7 +1698,7 @@ static bool ed_operator_outliner_datablocks_active(bContext *C)
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
return (space_outliner->outlinevis == SO_DATA_API);
}
- return 0;
+ return false;
}
/* Helper func to extract an RNA path from selected tree element
diff --git a/source/blender/editors/space_outliner/outliner_select.cc b/source/blender/editors/space_outliner/outliner_select.cc
index 636c6a389d5..887890090db 100644
--- a/source/blender/editors/space_outliner/outliner_select.cc
+++ b/source/blender/editors/space_outliner/outliner_select.cc
@@ -21,7 +21,7 @@
* \ingroup spoutliner
*/
-#include <stdlib.h>
+#include <cstdlib>
#include "MEM_guardedalloc.h"
@@ -1165,7 +1165,7 @@ static void outliner_sync_to_properties_editors(const bContext *C,
static void outliner_set_properties_tab(bContext *C, TreeElement *te, TreeStoreElem *tselem)
{
- PointerRNA ptr = {0};
+ PointerRNA ptr = {nullptr};
int context = 0;
/* ID Types */
diff --git a/source/blender/editors/space_outliner/outliner_sync.cc b/source/blender/editors/space_outliner/outliner_sync.cc
index b312a262253..20806ff0a10 100644
--- a/source/blender/editors/space_outliner/outliner_sync.cc
+++ b/source/blender/editors/space_outliner/outliner_sync.cc
@@ -21,7 +21,7 @@
* \ingroup spoutliner
*/
-#include <stdio.h>
+#include <cstdio>
#include "DNA_armature_types.h"
#include "DNA_layer_types.h"
@@ -115,12 +115,12 @@ void ED_outliner_select_sync_flag_outliners(const bContext *C)
* outliner display mode also needs to be considered. This stores the types of data
* to sync to increase code clarity.
*/
-typedef struct SyncSelectTypes {
+struct SyncSelectTypes {
bool object;
bool edit_bone;
bool pose_bone;
bool sequence;
-} SyncSelectTypes;
+};
/**
* Set which types of data to sync when syncing selection from the outliner based on object
@@ -174,11 +174,11 @@ static bool outliner_sync_select_to_outliner_set_types(const bContext *C,
* Stores items selected from a sync from the outliner. Prevents syncing the selection
* state of the last instance of an object linked in multiple collections.
*/
-typedef struct SelectedItems {
+struct SelectedItems {
GSet *objects;
GSet *edit_bones;
GSet *pose_bones;
-} SelectedItems;
+};
static void selected_items_init(SelectedItems *selected_items)
{
@@ -487,12 +487,12 @@ static void outliner_select_sync_from_sequence(Sequence *sequence_active, TreeSt
* Contains active object, bones, and sequence for syncing to prevent getting active data
* repeatedly throughout syncing to the outliner.
*/
-typedef struct SyncSelectActiveData {
+struct SyncSelectActiveData {
Object *object;
EditBone *edit_bone;
bPoseChannel *pose_channel;
Sequence *sequence;
-} SyncSelectActiveData;
+};
/** Sync select and active flags from active view layer, bones, and sequences to the outliner. */
static void outliner_sync_selection_to_outliner(ViewLayer *view_layer,
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc
index 89d35f54e8c..1c1a4f6f4c2 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -437,9 +437,9 @@ static void outliner_do_libdata_operation(bContext *C,
/** \name Scene Menu Operator
* \{ */
-typedef enum eOutliner_PropSceneOps {
+enum eOutliner_PropSceneOps {
OL_SCENE_OP_DELETE = 1,
-} eOutliner_PropSceneOps;
+};
static const EnumPropertyItem prop_scene_op_types[] = {
{OL_SCENE_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
@@ -534,10 +534,10 @@ void OUTLINER_OT_scene_operation(wmOperatorType *ot)
* the merged select popup menu. The sub-tree of the parent is searched and
* the child is needed to only show elements of the same type in the popup.
*/
-typedef struct MergedSearchData {
+struct MergedSearchData {
TreeElement *parent_element;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list