diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-30 18:46:32 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-30 18:46:44 +0300 |
commit | 3f9376851bca4e01296a98f68ad1d64462905b94 (patch) | |
tree | fd992870f029c9f99cfd0e5bd2163635a0b0c66d /source | |
parent | 3437cf155e7ca73cb96882ed5372f5baf2eac78a (diff) |
Cleanup: Clang tidy
Mostly duplicate includes, also use nullptr, and using default
member initializers.
Diffstat (limited to 'source')
21 files changed, 17 insertions, 60 deletions
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_view3d/view3d_cursor_snap.c b/source/blender/editors/space_view3d/view3d_cursor_snap.c index 96a193cc10d..1e54afe46f0 100644 --- a/source/blender/editors/space_view3d/view3d_cursor_snap.c +++ b/source/blender/editors/space_view3d/view3d_cursor_snap.c @@ -12,7 +12,6 @@ #include "BLI_listbase.h" #include "BLI_rect.h" -#include "DNA_scene_types.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c index f0557205e8f..aa287403e23 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c @@ -19,8 +19,6 @@ #include "MEM_guardedalloc.h" -#include "WM_toolsystem.h" - #include "RNA_access.h" #include "RNA_define.h" diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index 685c35489de..2fa8fcf65ba 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -26,12 +26,9 @@ #include "RNA_prototypes.h" #include "transform.h" -#include "transform_snap.h" - #include "transform_convert.h" -#include "transform_snap.h" - #include "transform_mode.h" +#include "transform_snap.h" /** Used for NLA transform (stored in #TransData.extra pointer). */ typedef struct TransDataNla { diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencildash.c b/source/blender/gpencil_modifiers/intern/MOD_gpencildash.c index e57b9df03f5..f023b00480c 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencildash.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencildash.c @@ -12,8 +12,6 @@ #include "BLI_math.h" #include "BLI_string.h" -#include "BLT_translation.h" - #include "DNA_defaults.h" #include "DNA_gpencil_modifier_types.h" #include "DNA_gpencil_types.h" diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 0b2ea0e1ade..c634873cfe4 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -39,7 +39,6 @@ #include "BLO_read_write.h" -#include "BKE_curveprofile.h" #include "bmesh.h" #include "bmesh_tools.h" diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c index 6c06cd663fa..43497fb8318 100644 --- a/source/blender/render/intern/pipeline.c +++ b/source/blender/render/intern/pipeline.c @@ -87,8 +87,6 @@ # include "FRS_freestyle.h" #endif -#include "DEG_depsgraph.h" - /* internal */ #include "pipeline.h" #include "render_result.h" diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 8d6741dcfb6..dbce360cb61 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -59,6 +59,7 @@ #include "BKE_mask.h" /* free mask clipboard */ #include "BKE_material.h" /* BKE_material_copybuf_clear */ #include "BKE_studiolight.h" +#include "BKE_subdiv.h" #include "BKE_tracking.h" /* free tracking clipboard */ #include "RE_engine.h" @@ -114,9 +115,6 @@ #include "GPU_init_exit.h" #include "GPU_material.h" -#include "BKE_sound.h" -#include "BKE_subdiv.h" - #include "COM_compositor.h" #include "DEG_depsgraph.h" |