diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-11-06 19:49:09 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-11-06 20:08:25 +0300 |
commit | 16732def37c5a66f3ea28dbe247b09cc6bca6677 (patch) | |
tree | 5d14f5c920a1411e336bd80b12becbb3f73de19a /source/blender/blenkernel | |
parent | 88926375a0e4e45f72c87b9e487c060ddd3c9216 (diff) |
Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.
No functional changes.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve_test.cc | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lattice_deform_test.cc | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/simulation.cc | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/volume.cc | 46 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/volume_render.cc | 6 |
5 files changed, 35 insertions, 35 deletions
diff --git a/source/blender/blenkernel/intern/fcurve_test.cc b/source/blender/blenkernel/intern/fcurve_test.cc index a230c8f2e96..97dd541e2b9 100644 --- a/source/blender/blenkernel/intern/fcurve_test.cc +++ b/source/blender/blenkernel/intern/fcurve_test.cc @@ -290,7 +290,7 @@ TEST(fcurve_active_keyframe, ActiveKeyframe) EXPECT_EQ(BKE_fcurve_active_keyframe_index(fcu), 2); /* Check clearing the index. */ - BKE_fcurve_active_keyframe_set(fcu, NULL); + BKE_fcurve_active_keyframe_set(fcu, nullptr); EXPECT_EQ(fcu->active_keyframe_index, FCURVE_ACTIVE_KEYFRAME_NONE); EXPECT_EQ(BKE_fcurve_active_keyframe_index(fcu), FCURVE_ACTIVE_KEYFRAME_NONE); diff --git a/source/blender/blenkernel/intern/lattice_deform_test.cc b/source/blender/blenkernel/intern/lattice_deform_test.cc index 7db9d941458..f08d0349598 100644 --- a/source/blender/blenkernel/intern/lattice_deform_test.cc +++ b/source/blender/blenkernel/intern/lattice_deform_test.cc @@ -83,7 +83,7 @@ static void test_lattice_deform_free(LatticeDeformTestContext *ctx) TEST(lattice_deform_performance, performance_no_dvert_1) { const int32_t num_items = 1; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -92,7 +92,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1) TEST(lattice_deform_performance, performance_no_dvert_1000) { const int32_t num_items = 1000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -101,7 +101,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1000) TEST(lattice_deform_performance, performance_no_dvert_10000) { const int32_t num_items = 10000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -110,7 +110,7 @@ TEST(lattice_deform_performance, performance_no_dvert_10000) TEST(lattice_deform_performance, performance_no_dvert_100000) { const int32_t num_items = 100000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -119,7 +119,7 @@ TEST(lattice_deform_performance, performance_no_dvert_100000) TEST(lattice_deform_performance, performance_no_dvert_1000000) { const int32_t num_items = 1000000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -128,7 +128,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1000000) TEST(lattice_deform_performance, performance_no_dvert_10000000) { const int32_t num_items = 10000000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc index 6e4ce2eaee2..861779ec700 100644 --- a/source/blender/blenkernel/intern/simulation.cc +++ b/source/blender/blenkernel/intern/simulation.cc @@ -165,14 +165,14 @@ IDTypeInfo IDType_ID_SIM = { /* free_data */ simulation_free_data, /* make_local */ nullptr, /* foreach_id */ simulation_foreach_id, - /* foreach_cache */ NULL, + /* foreach_cache */ nullptr, /* blend_write */ simulation_blend_write, /* blend_read_data */ simulation_blend_read_data, /* blend_read_lib */ simulation_blend_read_lib, /* blend_read_expand */ simulation_blend_read_expand, - /* blend_read_undo_preserve */ NULL, + /* blend_read_undo_preserve */ nullptr, }; void *BKE_simulation_add(Main *bmain, const char *name) diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index 9c60cb842ae..b18bc3c7e6e 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -265,12 +265,12 @@ static struct VolumeFileCache { struct VolumeGrid { VolumeGrid(const VolumeFileCache::Entry &template_entry, const int simplify_level) - : entry(NULL), simplify_level(simplify_level), is_loaded(false) + : entry(nullptr), simplify_level(simplify_level), is_loaded(false) { entry = GLOBAL_CACHE.add_metadata_user(template_entry); } - VolumeGrid(const openvdb::GridBase::Ptr &grid) : entry(NULL), local_grid(grid), is_loaded(true) + VolumeGrid(const openvdb::GridBase::Ptr &grid) : entry(nullptr), local_grid(grid), is_loaded(true) { } @@ -295,7 +295,7 @@ struct VolumeGrid { void load(const char *volume_name, const char *filepath) { /* If already loaded or not file-backed, nothing to do. */ - if (is_loaded || entry == NULL) { + if (is_loaded || entry == nullptr) { return; } @@ -337,7 +337,7 @@ struct VolumeGrid { void unload(const char *volume_name) { /* Not loaded or not file-backed, nothing to do. */ - if (!is_loaded || entry == NULL) { + if (!is_loaded || entry == nullptr) { return; } @@ -364,7 +364,7 @@ struct VolumeGrid { local_grid = grid()->copyGridWithNewTree(); if (entry) { GLOBAL_CACHE.remove_user(*entry, is_loaded); - entry = NULL; + entry = nullptr; } is_loaded = true; } @@ -378,7 +378,7 @@ struct VolumeGrid { local_grid = grid()->deepCopyGrid(); if (entry) { GLOBAL_CACHE.remove_user(*entry, is_loaded); - entry = NULL; + entry = nullptr; } is_loaded = true; } @@ -398,7 +398,7 @@ struct VolumeGrid { return entry->error_msg.c_str(); } - return NULL; + return nullptr; } bool grid_is_loaded() const @@ -562,7 +562,7 @@ static void volume_blend_write(BlendWriter *writer, ID *id, const void *id_addre Volume *volume = (Volume *)id; if (volume->id.us > 0 || BLO_write_is_undo(writer)) { /* Clean up, important in undo case to reduce false detection of changed datablocks. */ - volume->runtime.grids = 0; + volume->runtime.grids = nullptr; /* write LibData */ BLO_write_id_struct(writer, Volume, id_address, &volume->id); @@ -634,13 +634,13 @@ IDTypeInfo IDType_ID_VO = { /* blend_read_lib */ volume_blend_read_lib, /* blend_read_expand */ volume_blend_read_expand, - /* blend_read_undo_preserve */ NULL, + /* blend_read_undo_preserve */ nullptr, }; void BKE_volume_init_grids(Volume *volume) { #ifdef WITH_OPENVDB - if (volume->runtime.grids == NULL) { + if (volume->runtime.grids == nullptr) { volume->runtime.grids = OBJECT_GUARDED_NEW(VolumeGridVector); } #else @@ -871,11 +871,11 @@ BoundBox *BKE_volume_boundbox_get(Object *ob) { BLI_assert(ob->type == OB_VOLUME); - if (ob->runtime.bb != NULL && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) { + if (ob->runtime.bb != nullptr && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) { return ob->runtime.bb; } - if (ob->runtime.bb == NULL) { + if (ob->runtime.bb == nullptr) { Volume *volume = (Volume *)ob->data; ob->runtime.bb = (BoundBox *)MEM_callocN(sizeof(BoundBox), "volume boundbox"); @@ -1006,7 +1006,7 @@ static Volume *volume_evaluate_modifiers(struct Depsgraph *depsgraph, if (volume_next && volume_next != volume) { /* If the modifier returned a new volume, release the old one. */ if (volume != volume_input) { - BKE_id_free(NULL, volume); + BKE_id_free(nullptr, volume); } volume = volume_next; } @@ -1057,7 +1057,7 @@ void BKE_volume_grids_backup_restore(Volume *volume, VolumeGridVector *grids, co /* Restore grids after datablock was re-copied from original by depsgraph, * we don't want to load them again if possible. */ BLI_assert(volume->id.tag & LIB_TAG_COPIED_ON_WRITE); - BLI_assert(volume->runtime.grids != NULL && grids != NULL); + BLI_assert(volume->runtime.grids != nullptr && grids != nullptr); if (!grids->is_loaded()) { /* No grids loaded in CoW datablock, nothing lost by discarding. */ @@ -1080,8 +1080,8 @@ void BKE_volume_grids_backup_restore(Volume *volume, VolumeGridVector *grids, co /* Draw Cache */ -void (*BKE_volume_batch_cache_dirty_tag_cb)(Volume *volume, int mode) = NULL; -void (*BKE_volume_batch_cache_free_cb)(Volume *volume) = NULL; +void (*BKE_volume_batch_cache_dirty_tag_cb)(Volume *volume, int mode) = nullptr; +void (*BKE_volume_batch_cache_free_cb)(Volume *volume) = nullptr; void BKE_volume_batch_cache_dirty_tag(Volume *volume, int mode) { @@ -1138,7 +1138,7 @@ VolumeGrid *BKE_volume_grid_get(const Volume *volume, int grid_index) return &grid; } } - return NULL; + return nullptr; #else UNUSED_VARS(volume, grid_index); return NULL; @@ -1149,7 +1149,7 @@ VolumeGrid *BKE_volume_grid_active_get(const Volume *volume) { const int num_grids = BKE_volume_num_grids(volume); if (num_grids == 0) { - return NULL; + return nullptr; } const int index = clamp_i(volume->active_grid, 0, num_grids - 1); @@ -1167,7 +1167,7 @@ VolumeGrid *BKE_volume_grid_find(const Volume *volume, const char *name) } } - return NULL; + return nullptr; } /* Grid Loading */ @@ -1352,7 +1352,7 @@ bool BKE_volume_grid_bounds(const VolumeGrid *volume_grid, float min[3], float m Volume *BKE_volume_new_for_eval(const Volume *volume_src) { - Volume *volume_dst = (Volume *)BKE_id_new_nomain(ID_VO, NULL); + Volume *volume_dst = (Volume *)BKE_id_new_nomain(ID_VO, nullptr); STRNCPY(volume_dst->id.name, volume_src->id.name); volume_dst->mat = (Material **)MEM_dupallocN(volume_src->mat); @@ -1372,7 +1372,7 @@ Volume *BKE_volume_copy_for_eval(Volume *volume_src, bool reference) flags |= LIB_ID_COPY_CD_REFERENCE; } - Volume *result = (Volume *)BKE_id_copy_ex(NULL, &volume_src->id, NULL, flags); + Volume *result = (Volume *)BKE_id_copy_ex(nullptr, &volume_src->id, nullptr, flags); return result; } @@ -1395,12 +1395,12 @@ VolumeGrid *BKE_volume_grid_add(Volume *volume, const char *name, VolumeGridType { #ifdef WITH_OPENVDB VolumeGridVector &grids = *volume->runtime.grids; - BLI_assert(BKE_volume_grid_find(volume, name) == NULL); + BLI_assert(BKE_volume_grid_find(volume, name) == nullptr); BLI_assert(type != VOLUME_GRID_UNKNOWN); openvdb::GridBase::Ptr vdb_grid = BKE_volume_grid_type_operation(type, CreateGridOp{}); if (!vdb_grid) { - return NULL; + return nullptr; } vdb_grid->setName(name); diff --git a/source/blender/blenkernel/intern/volume_render.cc b/source/blender/blenkernel/intern/volume_render.cc index 37b397a9c6d..55e04911d42 100644 --- a/source/blender/blenkernel/intern/volume_render.cc +++ b/source/blender/blenkernel/intern/volume_render.cc @@ -123,7 +123,7 @@ bool BKE_volume_grid_dense_floats(const Volume *volume, const int channels = BKE_volume_grid_channels(volume_grid); const int elem_size = sizeof(float) * channels; float *voxels = static_cast<float *>(MEM_malloc_arrayN(num_voxels, elem_size, __func__)); - if (voxels == NULL) { + if (voxels == nullptr) { return false; } @@ -143,7 +143,7 @@ bool BKE_volume_grid_dense_floats(const Volume *volume, void BKE_volume_dense_float_grid_clear(DenseFloatVolumeGrid *dense_grid) { - if (dense_grid->voxels != NULL) { + if (dense_grid->voxels != nullptr) { MEM_freeN(dense_grid->voxels); } } @@ -339,7 +339,7 @@ void BKE_volume_grid_wireframe(const Volume *volume, void *cb_userdata) { if (volume->display.wireframe_type == VOLUME_WIREFRAME_NONE) { - cb(cb_userdata, NULL, NULL, 0, 0); + cb(cb_userdata, nullptr, nullptr, 0, 0); return; } |