[Bf-blender-cvs] [28750bcf7e8] master: Cleanup: replace NULL with nullptr for C++ files

Campbell Barton noreply at git.blender.org
Sun Aug 28 12:56:08 CEST 2022


Commit: 28750bcf7e8b73d9da015898a3c0f21ef5d761f2
Author: Campbell Barton
Date:   Sun Aug 28 20:52:28 2022 +1000
Branches: master
https://developer.blender.org/rB28750bcf7e8b73d9da015898a3c0f21ef5d761f2

Cleanup: replace NULL with nullptr for C++ files

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

M	source/blender/blenkernel/intern/asset_catalog.cc
M	source/blender/blenkernel/intern/image.cc
M	source/blender/blenkernel/intern/mball.cc
M	source/blender/blenkernel/intern/mesh_wrapper.cc
M	source/blender/blenlib/intern/mesh_intersect.cc
M	source/blender/blenlib/intern/task_pool.cc
M	source/blender/blenlib/tests/BLI_array_store_test.cc
M	source/blender/blenloader/tests/blendfile_loading_base_test.cc
M	source/blender/draw/intern/draw_cache_impl_pointcloud.cc
M	source/blender/draw/intern/draw_cache_impl_subdivision.cc
M	source/blender/editors/interface/interface_drag.cc
M	source/blender/editors/interface/interface_ops.cc
M	source/blender/editors/mesh/editface.cc
M	source/blender/editors/object/object_add.cc
M	source/blender/editors/space_outliner/outliner_collections.cc
M	source/blender/editors/space_outliner/tree/tree_element_overrides.cc
M	source/blender/gpu/opengl/gl_context.cc
M	source/blender/io/usd/intern/usd_writer_volume.cc
M	source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M	source/blender/makesrna/intern/rna_path.cc
M	source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
M	source/blender/nodes/shader/node_shader_tree.cc
M	source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
M	source/blender/nodes/shader/nodes/node_shader_vector_transform.cc

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

diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc
index fccff602d2e..f7b14cc3479 100644
--- a/source/blender/blenkernel/intern/asset_catalog.cc
+++ b/source/blender/blenkernel/intern/asset_catalog.cc
@@ -516,7 +516,7 @@ CatalogFilePath AssetCatalogService::find_suitable_cdf_path_for_writing(
                   sizeof(asset_lib_cdf_path),
                   suitable_root_path,
                   DEFAULT_CATALOG_FILENAME.c_str(),
-                  NULL);
+                  nullptr);
     return asset_lib_cdf_path;
   }
 
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc
index d6caec86b5d..ae24383e5b9 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -1248,7 +1248,7 @@ Image *BKE_image_add_generated(Main *bmain,
 
 static void image_colorspace_from_imbuf(Image *image, const ImBuf *ibuf)
 {
-  const char *colorspace_name = NULL;
+  const char *colorspace_name = nullptr;
 
   if (ibuf->rect_float) {
     if (ibuf->float_colorspace) {
diff --git a/source/blender/blenkernel/intern/mball.cc b/source/blender/blenkernel/intern/mball.cc
index 1a2b4b22080..2ff8e6fc061 100644
--- a/source/blender/blenkernel/intern/mball.cc
+++ b/source/blender/blenkernel/intern/mball.cc
@@ -250,10 +250,10 @@ MetaElem *BKE_mball_element_add(MetaBall *mb, const int type)
 BoundBox *BKE_mball_boundbox_get(Object *ob)
 {
   BLI_assert(ob->type == OB_MBALL);
-  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) {
     ob->runtime.bb = MEM_cnew<BoundBox>(__func__);
   }
 
@@ -682,7 +682,7 @@ void BKE_mball_data_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
   }
 
   Mesh *mesh = BKE_mball_polygonize(depsgraph, scene, ob);
-  if (mesh == NULL) {
+  if (mesh == nullptr) {
     return;
   }
 
@@ -693,14 +693,14 @@ void BKE_mball_data_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
   if (ob->parent && ob->parent->type == OB_LATTICE && ob->partype == PARSKEL) {
     int verts_num;
     float(*positions)[3] = BKE_mesh_vert_coords_alloc(mesh, &verts_num);
-    BKE_lattice_deform_coords(ob->parent, ob, positions, verts_num, 0, NULL, 1.0f);
+    BKE_lattice_deform_coords(ob->parent, ob, positions, verts_num, 0, nullptr, 1.0f);
     BKE_mesh_vert_coords_apply(mesh, positions);
     MEM_freeN(positions);
   }
 
   ob->runtime.geometry_set_eval = new GeometrySet(GeometrySet::create_with_mesh(mesh));
 
-  if (ob->runtime.bb == NULL) {
+  if (ob->runtime.bb == nullptr) {
     ob->runtime.bb = MEM_cnew<BoundBox>(__func__);
   }
   blender::float3 min(std::numeric_limits<float>::max());
diff --git a/source/blender/blenkernel/intern/mesh_wrapper.cc b/source/blender/blenkernel/intern/mesh_wrapper.cc
index 989cd5f1df1..19d4444aa2f 100644
--- a/source/blender/blenkernel/intern/mesh_wrapper.cc
+++ b/source/blender/blenkernel/intern/mesh_wrapper.cc
@@ -343,7 +343,7 @@ static Mesh *mesh_wrapper_ensure_subdivision(Mesh *me)
   if (use_clnors) {
     float(*lnors)[3] = static_cast<float(*)[3]>(
         CustomData_get_layer(&subdiv_mesh->ldata, CD_NORMAL));
-    BLI_assert(lnors != NULL);
+    BLI_assert(lnors != nullptr);
     BKE_mesh_set_custom_normals(subdiv_mesh, lnors);
     CustomData_set_layer_flag(&me->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
     CustomData_set_layer_flag(&subdiv_mesh->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc
index d5585f953ec..e8aa359fbe4 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -710,7 +710,7 @@ bool IMesh::erase_face_positions(int f_index, Span<bool> face_pos_erase, IMeshAr
      * mark with null pointer and caller should call remove_null_faces().
      * the loop is done.
      */
-    this->face_[f_index] = NULL;
+    this->face_[f_index] = nullptr;
     return true;
   }
   Array<const Vert *> new_vert(new_len);
diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc
index a29dbe95ba9..c335d04413c 100644
--- a/source/blender/blenlib/intern/task_pool.cc
+++ b/source/blender/blenlib/intern/task_pool.cc
@@ -84,11 +84,11 @@ class Task {
         free_taskdata(other.free_taskdata),
         freedata(other.freedata)
   {
-    ((Task &)other).pool = NULL;
-    ((Task &)other).run = NULL;
-    ((Task &)other).taskdata = NULL;
+    ((Task &)other).pool = nullptr;
+    ((Task &)other).run = nullptr;
+    ((Task &)other).taskdata = nullptr;
     ((Task &)other).free_taskdata = false;
-    ((Task &)other).freedata = NULL;
+    ((Task &)other).freedata = nullptr;
   }
 #else
   Task(const Task &other) = delete;
diff --git a/source/blender/blenlib/tests/BLI_array_store_test.cc b/source/blender/blenlib/tests/BLI_array_store_test.cc
index 20e2a4d88f8..5d05e3be1f3 100644
--- a/source/blender/blenlib/tests/BLI_array_store_test.cc
+++ b/source/blender/blenlib/tests/BLI_array_store_test.cc
@@ -181,7 +181,7 @@ static void testbuffer_list_state_from_data__stride_expand(ListBase *lb,
 #define TESTBUFFER_STRINGS_CREATE(lb, ...) \
   { \
     BLI_listbase_clear(lb); \
-    const char *data_array[] = {__VA_ARGS__ NULL}; \
+    const char *data_array[] = {__VA_ARGS__ nullptr}; \
     testbuffer_list_state_from_string_array((lb), data_array); \
   } \
   ((void)0)
@@ -795,10 +795,10 @@ TEST(array_store, TestChunk_Rand31_Stride11_Chunk21)
 
 /* Test From Files (disabled, keep for local tests.) */
 
-void *file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t *r_size)
+static void *file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t *r_size)
 {
   FILE *fp = fopen(filepath, "rb");
-  void *mem = NULL;
+  void *mem = nullptr;
 
   if (fp) {
     long int filelen_read;
@@ -810,14 +810,14 @@ void *file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t *r_
     fseek(fp, 0L, SEEK_SET);
 
     mem = MEM_mallocN(filelen + pad_bytes, __func__);
-    if (mem == NULL) {
+    if (mem == nullptr) {
       goto finally;
     }
 
     filelen_read = fread(mem, 1, filelen, fp);
     if ((filelen_read != filelen) || ferror(fp)) {
       MEM_freeN(mem);
-      mem = NULL;
+      mem = nullptr;
       goto finally;
     }
 
diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc b/source/blender/blenloader/tests/blendfile_loading_base_test.cc
index af570aa9d4b..7df0ce944e4 100644
--- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc
+++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc
@@ -116,7 +116,7 @@ bool BlendfileLoadingBaseTest::blendfile_load(const char *filepath)
   }
 
   char abspath[FILENAME_MAX];
-  BLI_path_join(abspath, sizeof(abspath), test_assets_dir.c_str(), filepath, NULL);
+  BLI_path_join(abspath, sizeof(abspath), test_assets_dir.c_str(), filepath, nullptr);
 
   BlendFileReadReport bf_reports = {nullptr};
   bfile = BLO_read_from_file(abspath, BLO_READ_SKIP_NONE, &bf_reports);
diff --git a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
index d99af0c77e4..57efed855f5 100644
--- a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
+++ b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
@@ -55,7 +55,7 @@ static bool pointcloud_batch_cache_valid(PointCloud &pointcloud)
 {
   PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
 
-  if (cache == NULL) {
+  if (cache == nullptr) {
     return false;
   }
   if (cache->mat_len != DRW_pointcloud_material_count_get(&pointcloud)) {
@@ -86,7 +86,7 @@ static void pointcloud_batch_cache_init(PointCloud &pointcloud)
 void DRW_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
 {
   PointCloudBatchCache *cache = pointcloud_batch_cache_get(*pointcloud);
-  if (cache == NULL) {
+  if (cache == nullptr) {
     return;
   }
   switch (mode) {
@@ -137,7 +137,7 @@ static void pointcloud_batch_cache_ensure_pos(const PointCloud &pointcloud,
                                               PointCloudBatchCache &cache)
 {
   using namespace blender;
-  if (cache.pos != NULL) {
+  if (cache.pos != nullptr) {
     return;
   }
 
@@ -198,7 +198,7 @@ static const uint half_octahedron_tris[4][3] = {
 
 static void pointcloud_batch_cache_ensure_geom(PointCloudBatchCache &cache)
 {
-  if (cache.geom != NULL) {
+  if (cache.geom != nullptr) {
     return;
   }
 
@@ -232,9 +232,9 @@ GPUBatch *DRW_pointcloud_batch_cache_get_dots(Object *ob)
   PointCloud &pointcloud = *static_cast<PointCloud *>(ob->data);
   PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
 
-  if (cache->dots == NULL) {
+  if (cache->dots == nullptr) {
     pointcloud_batch_cache_ensure_pos(pointcloud, *cache);
-    cache->dots = GPU_batch_create(GPU_PRIM_POINTS, cache->pos, NULL);
+    cache->dots = GPU_batch_create(GPU_PRIM_POINTS, cache->pos, nullptr);
   }
 
   return cache->dots;
@@ -245,7 +245,7 @@ GPUBatch *DRW_pointcloud_batch_cache_get_surface(Object *ob)
   PointCloud &pointcloud = *static_cast<PointCloud *>(ob->data);
   PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
 
-  if (cache->surface == NULL) {
+  if (cache->surface == nullptr) {
     pointcloud_batch_cache_ensure_pos(pointcloud, *cache);
     pointcloud_batch_cache_ensure_geom(*cache);
 
@@ -265,7 +265,7 @@ GPUBatch **DRW_cache_pointcloud_surface_shaded_get(Object *ob,
   BLI_assert(cache->mat_len == gpumat_array_len);
   UNUSED_VARS(gpumat_array_len);
 
-  if (cache->surface_per_mat[0] == NULL) {
+  if (cache->surface_per_mat[0] == nullptr) {
     pointcloud_batch_cache_ensure_pos(pointcloud, *cache);
     pointcloud_batch_cache_ensure_geom(*cache);
 
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index e86e342fea0..f6242aa072d 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list