[Bf-blender-cvs] [3f9376851bc] master: Cleanup: Clang tidy

Hans Goudey noreply at git.blender.org
Mon May 30 17:47:40 CEST 2022


Commit: 3f9376851bca4e01296a98f68ad1d64462905b94
Author: Hans Goudey
Date:   Mon May 30 17:46:32 2022 +0200
Branches: master
https://developer.blender.org/rB3f9376851bca4e01296a98f68ad1d64462905b94

Cleanup: Clang tidy

Mostly duplicate includes, also use nullptr, and using default
member initializers.

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

M	source/blender/blenkernel/intern/image_save.cc
M	source/blender/blenkernel/intern/volume.cc
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/depsgraph/intern/builder/deg_builder_rna.cc
M	source/blender/draw/intern/draw_curves.cc
M	source/blender/draw/intern/draw_manager.c
M	source/blender/editors/geometry/geometry_attributes.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
M	source/blender/editors/sculpt_paint/paint_image_proj.c
M	source/blender/editors/space_node/node_context_path.cc
M	source/blender/editors/space_sequencer/sequencer_view.c
M	source/blender/editors/space_spreadsheet/space_spreadsheet.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
M	source/blender/editors/space_view3d/view3d_cursor_snap.c
M	source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c
M	source/blender/editors/transform/transform_convert_nla.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencildash.c
M	source/blender/modifiers/intern/MOD_bevel.c
M	source/blender/render/intern/pipeline.c
M	source/blender/windowmanager/intern/wm_init_exit.c

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

diff --git a/source/blender/blenkernel/intern/image_save.cc b/source/blender/blenkernel/intern/image_save.cc
index 910ac15d1c5..6bfdaf9b522 100644
--- a/source/blender/blenkernel/intern/image_save.cc
+++ b/source/blender/blenkernel/intern/image_save.cc
@@ -107,7 +107,7 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts,
 
     if (opts->save_as_render) {
       /* Render/compositor output or user chose to save with render settings. */
-      BKE_image_format_init_for_write(&opts->im_format, scene, NULL);
+      BKE_image_format_init_for_write(&opts->im_format, scene, nullptr);
       is_depth_set = true;
       if (!BKE_image_is_multiview(ima)) {
         /* In case multiview is disabled,
@@ -188,7 +188,7 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts,
       }
 
       /* append UDIM marker if not present */
-      if (ima->source == IMA_SRC_TILED && strstr(opts->filepath, "<UDIM>") == NULL) {
+      if (ima->source == IMA_SRC_TILED && strstr(opts->filepath, "<UDIM>") == nullptr) {
         int len = strlen(opts->filepath);
         STR_CONCAT(opts->filepath, len, ".<UDIM>");
       }
@@ -201,7 +201,7 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts,
 
   BKE_image_release_ibuf(ima, ibuf, lock);
 
-  return (ibuf != NULL);
+  return (ibuf != nullptr);
 }
 
 void BKE_image_save_options_update(ImageSaveOptions *opts, Image *image)
@@ -210,7 +210,7 @@ void BKE_image_save_options_update(ImageSaveOptions *opts, Image *image)
   if (opts->save_as_render) {
     if (!opts->prev_save_as_render) {
       if (ELEM(image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
-        BKE_image_format_init_for_write(&opts->im_format, opts->scene, NULL);
+        BKE_image_format_init_for_write(&opts->im_format, opts->scene, nullptr);
       }
       else {
         BKE_image_format_color_management_copy_from_scene(&opts->im_format, opts->scene);
diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc
index 307466d7dc9..82405830437 100644
--- a/source/blender/blenkernel/intern/volume.cc
+++ b/source/blender/blenkernel/intern/volume.cc
@@ -97,12 +97,7 @@ static struct VolumeFileCache {
   /* Cache Entry */
   struct Entry {
     Entry(const std::string &filepath, const openvdb::GridBase::Ptr &grid)
-        : filepath(filepath),
-          grid_name(grid->getName()),
-          grid(grid),
-          is_loaded(false),
-          num_metadata_users(0),
-          num_tree_users(0)
+        : filepath(filepath), grid_name(grid->getName()), grid(grid)
     {
     }
 
@@ -110,9 +105,7 @@ static struct VolumeFileCache {
         : filepath(other.filepath),
           grid_name(other.grid_name),
           grid(other.grid),
-          is_loaded(other.is_loaded),
-          num_metadata_users(0),
-          num_tree_users(0)
+          is_loaded(other.is_loaded)
     {
     }
 
@@ -151,12 +144,12 @@ static struct VolumeFileCache {
     blender::Map<int, openvdb::GridBase::Ptr> simplified_grids;
 
     /* Has the grid tree been loaded? */
-    mutable bool is_loaded;
+    mutable bool is_loaded = false;
     /* Error message if an error occurred while loading. */
     std::string error_msg;
     /* User counting. */
-    int num_metadata_users;
-    int num_tree_users;
+    int num_metadata_users = 0;
+    int num_tree_users = 0;
     /* Mutex for on-demand reading of tree. */
     mutable std::mutex mutex;
   };
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 74621a477cd..83d325e9c40 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -63,7 +63,7 @@
 #include "RNA_prototypes.h"
 
 #include "BLO_readfile.h"
-#include "MEM_guardedalloc.h"
+
 #include "readfile.h"
 
 #include "SEQ_channels.h"
@@ -71,8 +71,6 @@
 #include "SEQ_sequencer.h"
 #include "SEQ_time.h"
 
-#include "RNA_access.h"
-
 #include "versioning_common.h"
 
 static CLG_LogRef LOG = {"blo.readfile.doversion"};
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
index 8a81adf0aeb..ac7a5bc2f30 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
@@ -39,7 +39,7 @@ namespace blender::deg {
 
 class RNANodeQueryIDData {
  public:
-  explicit RNANodeQueryIDData(const ID *id) : id_(id), constraint_to_pchan_map_(nullptr)
+  explicit RNANodeQueryIDData(const ID *id) : id_(id)
   {
   }
 
@@ -77,7 +77,7 @@ class RNANodeQueryIDData {
 
   /* indexed by bConstraint*, returns pose channel which contains that
    * constraint. */
-  Map<const bConstraint *, const bPoseChannel *> *constraint_to_pchan_map_;
+  Map<const bConstraint *, const bPoseChannel *> *constraint_to_pchan_map_ = nullptr;
 };
 
 /* ***************************** Node Identifier **************************** */
diff --git a/source/blender/draw/intern/draw_curves.cc b/source/blender/draw/intern/draw_curves.cc
index d90c63b680e..39d4845994f 100644
--- a/source/blender/draw/intern/draw_curves.cc
+++ b/source/blender/draw/intern/draw_curves.cc
@@ -81,9 +81,9 @@ struct CurvesUniformBufPool {
   {
     if (used >= ubos.size()) {
       ubos.append(std::make_unique<CurvesInfosBuf>());
-      return *ubos.last().get();
+      return *ubos.last();
     }
-    return *ubos[used++].get();
+    return *ubos[used++];
   }
 };
 
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 1372b843442..bc9d0a3d02a 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -44,7 +44,6 @@
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_world_types.h"
-#include "draw_manager.h"
 
 #include "ED_gpencil.h"
 #include "ED_screen.h"
diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc
index cfc158b117f..ed16b8a903a 100644
--- a/source/blender/editors/geometry/geometry_attributes.cc
+++ b/source/blender/editors/geometry/geometry_attributes.cc
@@ -402,7 +402,7 @@ void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
   static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
 
   prop = RNA_def_float_color(
-      ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f);
+      ot->srna, "color", 4, nullptr, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f);
   RNA_def_property_subtype(prop, PROP_COLOR_GAMMA);
   RNA_def_property_float_array_default(prop, default_color);
 }
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc b/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
index b0a6d6ef29c..25eb8041f4c 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
@@ -2,8 +2,6 @@
 
 #include <algorithm>
 
-#include "curves_sculpt_intern.hh"
-
 #include "BLI_enumerable_thread_specific.hh"
 #include "BLI_float4x4.hh"
 #include "BLI_kdtree.h"
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 95a7c1d8dee..b7ec427349f 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -97,8 +97,6 @@
 #include "RNA_enum_types.h"
 #include "RNA_types.h"
 
-#include "NOD_shader.h"
-
 #include "IMB_colormanagement.h"
 
 //#include "bmesh_tools.h"
diff --git a/source/blender/editors/space_node/node_context_path.cc b/source/blender/editors/space_node/node_context_path.cc
index dfc0beb13fc..b9bee3ed15e 100644
--- a/source/blender/editors/space_node/node_context_path.cc
+++ b/source/blender/editors/space_node/node_context_path.cc
@@ -26,8 +26,6 @@
 #include "UI_interface.hh"
 #include "UI_resources.h"
 
-#include "UI_interface.hh"
-
 #include "node_intern.hh"
 
 struct Curve;
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index b3dbc3c72d1..93641375d42 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -20,8 +20,6 @@
 
 #include "UI_view2d.h"
 
-#include "RNA_define.h"
-
 #include "SEQ_iterator.h"
 #include "SEQ_select.h"
 #include "SEQ_sequencer.h"
diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
index b3d6c395e89..a498e5e99cf 100644
--- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
+++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
@@ -32,8 +32,6 @@
 
 #include "BLF_api.h"
 
-#include "spreadsheet_intern.hh"
-
 #include "spreadsheet_context.hh"
 #include "spreadsheet_data_source_geometry.hh"
 #include "spreadsheet_dataset_draw.hh"
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc b/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
index 4d6dc3b4166..d76bbbf3be6 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
@@ -5,12 +5,6 @@
 
 #include "ED_screen.h"
 
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
 #include "BLI_listbase.h"
 
 #include "MEM_guardedalloc.h"
@@ -20,8 +14,6 @@
 #include "RNA_access.h"
 #include "RNA_define.h"
 
-#include "ED_screen.h"
-
 #include "WM_api.h"
 #include "WM_types.h"
 
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
index 3ae4536b652..91ce5c2f6ec 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
@@ -14,8 +14,6 @@
 
 #include "RNA_access.h"
 
-#include "spreadsheet_intern.hh"
-
 #include "spreadsheet_data_source_geometry.hh"
 #include "spreadsheet_intern.hh"
 #include "spreadsheet_layout.hh"
diff --git a/source/blender/editors/space_view

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list