Cleanup: Clang tidy

Mostly duplicate includes, also use nullptr, and using default
member initializers.
This commit is contained in:
Hans Goudey 2022-05-30 17:46:32 +02:00
parent 3437cf155e
commit 3f9376851b
21 changed files with 17 additions and 60 deletions

View File

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

View File

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

View File

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

View File

@ -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 **************************** */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,8 +26,6 @@
#include "UI_interface.hh"
#include "UI_resources.h"
#include "UI_interface.hh"
#include "node_intern.hh"
struct Curve;

View File

@ -20,8 +20,6 @@
#include "UI_view2d.h"
#include "RNA_define.h"
#include "SEQ_iterator.h"
#include "SEQ_select.h"
#include "SEQ_sequencer.h"

View File

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

View File

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

View File

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

View File

@ -12,7 +12,6 @@
#include "BLI_listbase.h"
#include "BLI_rect.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"

View File

@ -19,8 +19,6 @@
#include "MEM_guardedalloc.h"
#include "WM_toolsystem.h"
#include "RNA_access.h"
#include "RNA_define.h"

View File

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

View File

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

View File

@ -39,7 +39,6 @@
#include "BLO_read_write.h"
#include "BKE_curveprofile.h"
#include "bmesh.h"
#include "bmesh_tools.h"

View File

@ -87,8 +87,6 @@
# include "FRS_freestyle.h"
#endif
#include "DEG_depsgraph.h"
/* internal */
#include "pipeline.h"
#include "render_result.h"

View File

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