[Bf-blender-cvs] [9b9417b6615] master: Cleanup: Replace reinterpret_cast<> with static_cast<> in UI code

Julian Eisel noreply at git.blender.org
Fri Jul 29 18:46:04 CEST 2022


Commit: 9b9417b66150fd070619006dbd233369709edf1b
Author: Julian Eisel
Date:   Fri Jul 29 18:45:12 2022 +0200
Branches: master
https://developer.blender.org/rB9b9417b66150fd070619006dbd233369709edf1b

Cleanup: Replace reinterpret_cast<> with static_cast<> in UI code

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

M	source/blender/editors/render/render_preview.cc
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
M	source/blender/editors/space_outliner/tree/common.cc
M	source/blender/editors/space_outliner/tree/tree_element.cc
M	source/blender/editors/space_outliner/tree/tree_element_rna.cc
M	source/blender/makesrna/intern/rna_path.cc
M	source/blender/windowmanager/intern/wm_event_system.cc

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

diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc
index 97bbcaa102f..cd0a05f02bc 100644
--- a/source/blender/editors/render/render_preview.cc
+++ b/source/blender/editors/render/render_preview.cc
@@ -1771,7 +1771,7 @@ PreviewLoadJob &PreviewLoadJob::ensure_job(wmWindowManager *wm, wmWindow *win)
     WM_jobs_start(wm, wm_job);
   }
 
-  return *reinterpret_cast<PreviewLoadJob *>(WM_jobs_customdata_get(wm_job));
+  return *static_cast<PreviewLoadJob *>(WM_jobs_customdata_get(wm_job));
 }
 
 void PreviewLoadJob::load_jobless(PreviewImage *preview, const eIconSizes icon_size)
@@ -1807,11 +1807,11 @@ void PreviewLoadJob::run_fn(void *customdata,
                             short *do_update,
                             float *UNUSED(progress))
 {
-  PreviewLoadJob *job_data = reinterpret_cast<PreviewLoadJob *>(customdata);
+  PreviewLoadJob *job_data = static_cast<PreviewLoadJob *>(customdata);
 
   IMB_thumb_locks_acquire();
 
-  while (RequestedPreview *request = reinterpret_cast<RequestedPreview *>(
+  while (RequestedPreview *request = static_cast<RequestedPreview *>(
              BLI_thread_queue_pop_timeout(job_data->todo_queue_, 100))) {
     if (*stop) {
       break;
@@ -1864,7 +1864,7 @@ void PreviewLoadJob::finish_request(RequestedPreview &request)
 
 void PreviewLoadJob::update_fn(void *customdata)
 {
-  PreviewLoadJob *job_data = reinterpret_cast<PreviewLoadJob *>(customdata);
+  PreviewLoadJob *job_data = static_cast<PreviewLoadJob *>(customdata);
 
   for (auto request_it = job_data->requested_previews_.begin();
        request_it != job_data->requested_previews_.end();) {
@@ -1884,7 +1884,7 @@ void PreviewLoadJob::update_fn(void *customdata)
 
 void PreviewLoadJob::end_fn(void *customdata)
 {
-  PreviewLoadJob *job_data = reinterpret_cast<PreviewLoadJob *>(customdata);
+  PreviewLoadJob *job_data = static_cast<PreviewLoadJob *>(customdata);
 
   /* Finish any possibly remaining queued previews. */
   for (RequestedPreview &request : job_data->requested_previews_) {
@@ -1895,7 +1895,7 @@ void PreviewLoadJob::end_fn(void *customdata)
 
 void PreviewLoadJob::free_fn(void *customdata)
 {
-  MEM_delete(reinterpret_cast<PreviewLoadJob *>(customdata));
+  MEM_delete(static_cast<PreviewLoadJob *>(customdata));
 }
 
 static void icon_preview_free(void *customdata)
diff --git a/source/blender/editors/space_outliner/outliner_collections.cc b/source/blender/editors/space_outliner/outliner_collections.cc
index 8ca2ffe6a9c..7d0a0a921e4 100644
--- a/source/blender/editors/space_outliner/outliner_collections.cc
+++ b/source/blender/editors/space_outliner/outliner_collections.cc
@@ -72,7 +72,7 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te)
   }
 
   if (tselem->type == TSE_LAYER_COLLECTION) {
-    LayerCollection *lc = reinterpret_cast<LayerCollection *>(te->directdata);
+    LayerCollection *lc = static_cast<LayerCollection *>(te->directdata);
     return lc->collection;
   }
   if (ELEM(tselem->type, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) {
@@ -88,7 +88,7 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te)
 
 TreeTraversalAction outliner_find_selected_collections(TreeElement *te, void *customdata)
 {
-  struct IDsSelectedData *data = reinterpret_cast<IDsSelectedData *>(customdata);
+  struct IDsSelectedData *data = static_cast<IDsSelectedData *>(customdata);
   TreeStoreElem *tselem = TREESTORE(te);
 
   if (outliner_is_collection_tree_element(te)) {
@@ -105,7 +105,7 @@ TreeTraversalAction outliner_find_selected_collections(TreeElement *te, void *cu
 
 TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *customdata)
 {
-  struct IDsSelectedData *data = reinterpret_cast<IDsSelectedData *>(customdata);
+  struct IDsSelectedData *data = static_cast<IDsSelectedData *>(customdata);
   TreeStoreElem *tselem = TREESTORE(te);
 
   if (outliner_is_collection_tree_element(te)) {
@@ -184,7 +184,7 @@ struct CollectionNewData {
 
 static TreeTraversalAction collection_find_selected_to_add(TreeElement *te, void *customdata)
 {
-  struct CollectionNewData *data = reinterpret_cast<CollectionNewData *>(customdata);
+  struct CollectionNewData *data = static_cast<CollectionNewData *>(customdata);
   Collection *collection = outliner_collection_from_tree_element(te);
 
   if (!collection) {
@@ -286,7 +286,7 @@ struct CollectionEditData {
 
 static TreeTraversalAction collection_find_data_to_edit(TreeElement *te, void *customdata)
 {
-  CollectionEditData *data = reinterpret_cast<CollectionEditData *>(customdata);
+  CollectionEditData *data = static_cast<CollectionEditData *>(customdata);
   Collection *collection = outliner_collection_from_tree_element(te);
 
   if (!collection) {
@@ -339,7 +339,7 @@ void outliner_collection_delete(
   /* Effectively delete the collections. */
   GSetIterator collections_to_edit_iter;
   GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
-    Collection *collection = reinterpret_cast<Collection *>(
+    Collection *collection = static_cast<Collection *>(
         BLI_gsetIterator_getKey(&collections_to_edit_iter));
 
     /* Test in case collection got deleted as part of another one. */
@@ -444,12 +444,12 @@ struct CollectionObjectsSelectData {
 static TreeTraversalAction outliner_find_first_selected_layer_collection(TreeElement *te,
                                                                          void *customdata)
 {
-  CollectionObjectsSelectData *data = reinterpret_cast<CollectionObjectsSelectData *>(customdata);
+  CollectionObjectsSelectData *data = static_cast<CollectionObjectsSelectData *>(customdata);
   TreeStoreElem *tselem = TREESTORE(te);
 
   switch (tselem->type) {
     case TSE_LAYER_COLLECTION:
-      data->layer_collection = reinterpret_cast<LayerCollection *>(te->directdata);
+      data->layer_collection = static_cast<LayerCollection *>(te->directdata);
       return TRAVERSE_BREAK;
     case TSE_R_LAYER:
     case TSE_SCENE_COLLECTION_BASE:
@@ -538,7 +538,7 @@ struct CollectionDuplicateData {
 static TreeTraversalAction outliner_find_first_selected_collection(TreeElement *te,
                                                                    void *customdata)
 {
-  CollectionDuplicateData *data = reinterpret_cast<CollectionDuplicateData *>(customdata);
+  CollectionDuplicateData *data = static_cast<CollectionDuplicateData *>(customdata);
   TreeStoreElem *tselem = TREESTORE(te);
 
   switch (tselem->type) {
@@ -701,7 +701,7 @@ static int collection_link_exec(bContext *C, wmOperator *op)
   /* Effectively link the collections. */
   GSetIterator collections_to_edit_iter;
   GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
-    Collection *collection = reinterpret_cast<Collection *>(
+    Collection *collection = static_cast<Collection *>(
         BLI_gsetIterator_getKey(&collections_to_edit_iter));
     BKE_collection_child_add(bmain, active_collection, collection);
     id_fake_user_clear(&collection->id);
@@ -762,7 +762,7 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
 
   GSetIterator collections_to_edit_iter;
   GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
-    Collection *collection = reinterpret_cast<Collection *>(
+    Collection *collection = static_cast<Collection *>(
         BLI_gsetIterator_getKey(&collections_to_edit_iter));
 
     while (BKE_collection_cycle_find(active_lc->collection, collection)) {
@@ -772,7 +772,7 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
 
   /* Effectively instance the collections. */
   GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
-    Collection *collection = reinterpret_cast<Collection *>(
+    Collection *collection = static_cast<Collection *>(
         BLI_gsetIterator_getKey(&collections_to_edit_iter));
     Object *ob = ED_object_add_type(
         C, OB_EMPTY, collection->id.name + 2, scene->cursor.location, nullptr, false, 0);
@@ -814,14 +814,14 @@ void OUTLINER_OT_collection_instance(wmOperatorType *ot)
 
 static TreeTraversalAction layer_collection_find_data_to_edit(TreeElement *te, void *customdata)
 {
-  CollectionEditData *data = reinterpret_cast<CollectionEditData *>(customdata);
+  CollectionEditData *data = static_cast<CollectionEditData *>(customdata);
   TreeStoreElem *tselem = TREESTORE(te);
 
   if (!(tselem && tselem->type == TSE_LAYER_COLLECTION)) {
     return TRAVERSE_CONTINUE;
   }
 
-  LayerCollection *lc = reinterpret_cast<LayerCollection *>(te->directdata);
+  LayerCollection *lc = static_cast<LayerCollection *>(te->directdata);
 
   if (lc->collection->flag & COLLECTION_IS_MASTER) {
     /* skip - showing warning/error message might be misleading
@@ -862,7 +862,7 @@ static bool collections_view_layer_poll(bContext *C, bool clear, int flag)
 
   GSetIterator collections_to_edit_iter;
   GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
-    LayerCollection *lc = reinterpret_cast<LayerCollection *>(
+    LayerCollection *lc = static_cast<LayerCollection *>(
         BLI_gsetIterator_getKey(&collections_to_edit_iter));
 
     if (clear && (lc->flag & flag)) {
@@ -934,7 +934,7 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
 
   GSetIterator collections_to_edit_iter;
   GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
-    LayerCollection *lc = reinterpret_cast<LayerCollection *>(
+    LayerCollection *lc = static_cast<LayerCollection *>(
         BLI_gsetIterator_getKey(&collections_to_edit_iter));
     BKE_layer_collection_set_flag(lc, flag, !clear);
   }
@@ -1068,7 +1068,7 @@ static int collection_isolate_exec(bContext *C, wmOperator *op)
 
   GSetIterator collections_to_edit_iter;
   GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
-    LayerCollection *layer_collection = reinterpret_cast<LayerCollection *>(
+    LayerCollection *layer_collection = static_cast<LayerCollection *>(
         BLI_gsetIterator_getKey(&collections_to_edit_iter));
 
     if (extend) {
@@ -1168,7 +1168,7 @@ static int collection_visibility_exec(bContext *C, wmOperator *op)
 
   GSetIterator collections_to_edit_iter

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list