diff options
Diffstat (limited to 'source/blender/blenlib')
23 files changed, 203 insertions, 203 deletions
diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc index 568a3206b18..daa006fd5cc 100644 --- a/source/blender/blenlib/intern/delaunay_2d.cc +++ b/source/blender/blenlib/intern/delaunay_2d.cc @@ -654,12 +654,12 @@ template<typename T> inline bool is_border_edge(const CDTEdge<T> *e, const CDT_s template<typename T> inline bool is_constrained_edge(const CDTEdge<T> *e) { - return e->input_ids != NULL; + return e->input_ids != nullptr; } template<typename T> inline bool is_deleted_edge(const CDTEdge<T> *e) { - return e->symedges[0].next == NULL; + return e->symedges[0].next == nullptr; } template<typename T> inline bool is_original_vert(const CDTVert<T> *v, CDT_state<T> *cdt) @@ -1386,8 +1386,8 @@ void fill_crossdata_for_through_vert(CDTVert<T> *v, cd_next->lambda = T(0); cd_next->vert = v; - cd_next->in = NULL; - cd_next->out = NULL; + cd_next->in = nullptr; + cd_next->out = nullptr; if (cd->lambda == 0) { cd->out = cd_out; } @@ -1630,10 +1630,10 @@ void add_edge_constraint( if (dbg_level > 0) { std::cout << "\nADD EDGE CONSTRAINT\n" << vertname(v1) << " " << vertname(v2) << "\n"; } - LinkNodePair edge_list = {NULL, NULL}; + LinkNodePair edge_list = {nullptr, nullptr}; if (r_edges) { - *r_edges = NULL; + *r_edges = nullptr; } /* @@ -1648,7 +1648,7 @@ void add_edge_constraint( if (t != nullptr) { /* Segment already there. */ add_to_input_ids(&t->edge->input_ids, input_id); - if (r_edges != NULL) { + if (r_edges != nullptr) { BLI_linklist_append(&edge_list, t->edge); *r_edges = edge_list.list; } @@ -1736,15 +1736,15 @@ void add_edge_constraint( SymEdge<T> *se; if (cd_prev->lambda == 0.0) { se = find_symedge_between_verts(cd_prev->vert, v); - if (se == NULL) { + if (se == nullptr) { return; } cd_prev->out = se; - cd->in = NULL; + cd->in = nullptr; } else { se = find_symedge_with_face(v, sym(cd_prev->in)->face); - if (se == NULL) { + if (se == nullptr) { return; } cd->in = se; @@ -1783,7 +1783,7 @@ void add_edge_constraint( if (cd->lambda == -1.0) { continue; /* This crossing was deleted. */ } - t = NULL; + t = nullptr; SymEdge<T> *tnext = t; CDTEdge<T> *edge; if (cd->lambda != 0.0) { @@ -1795,7 +1795,7 @@ void add_edge_constraint( else if (cd->lambda == 0.0) { t = cd->in; tnext = cd->out; - if (t == NULL) { + if (t == nullptr) { /* Previous non-deleted crossing must also have been a vert, and segment should exist. */ int j; CrossData<T> *cd_prev; @@ -1809,12 +1809,12 @@ void add_edge_constraint( BLI_assert(cd_prev->out->next->vert == cd->vert); edge = cd_prev->out->edge; add_to_input_ids(&edge->input_ids, input_id); - if (r_edges != NULL) { + if (r_edges != nullptr) { BLI_linklist_append(&edge_list, edge); } } } - if (t != NULL) { + if (t != nullptr) { if (tstart->next->vert == t->vert) { edge = tstart->edge; } @@ -1822,7 +1822,7 @@ void add_edge_constraint( edge = cdt_state->cdt.add_diagonal(tstart, t); } add_to_input_ids(&edge->input_ids, input_id); - if (r_edges != NULL) { + if (r_edges != nullptr) { BLI_linklist_append(&edge_list, edge); } /* Now retriangulate upper and lower gaps. */ @@ -1830,7 +1830,7 @@ void add_edge_constraint( re_delaunay_triangulate(&cdt_state->cdt, &edge->symedges[1]); } if (i < ncrossings - 1) { - if (tnext != NULL) { + if (tnext != nullptr) { tstart = tnext; } } @@ -2011,7 +2011,7 @@ template<typename T> void dissolve_symedge(CDT_state<T> *cdt_state, SymEdge<T> * if (ELEM(cdt->outer_face->symedge, se, symse)) { /* Advancing by 2 to get past possible 'sym(se)'. */ if (se->next->next == se) { - cdt->outer_face->symedge = NULL; + cdt->outer_face->symedge = nullptr; } else { cdt->outer_face->symedge = se->next->next; @@ -2177,9 +2177,9 @@ template<typename T> void remove_outer_edges_until_constraints(CDT_state<T> *cdt } se = se->next; } while (se != se_start); - while (to_dissolve != NULL) { + while (to_dissolve != nullptr) { se = static_cast<SymEdge<T> *>(BLI_linklist_pop(&to_dissolve)); - if (se->next != NULL) { + if (se->next != nullptr) { dissolve_symedge(cdt_state, se); } } diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index 6647f8b8c92..53c104aae09 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -1137,7 +1137,7 @@ static bool non_trivially_2d_hex_overlap(int orients[2][3][3]) for (int ab = 0; ab < 2; ++ab) { for (int i = 0; i < 3; ++i) { bool ok = orients[ab][i][0] + orients[ab][i][1] + orients[ab][i][2] == 1 && - orients[ab][i][0] != 0 && orients[ab][i][1] != 0 && orients[i][2] != 0; + orients[ab][i][0] != 0 && orients[ab][i][1] != 0 && orients[i][2] != nullptr; if (!ok) { return false; } @@ -2460,12 +2460,12 @@ class TriOverlaps { if (two_trees_no_self) { BLI_bvhtree_balance(tree_b_); /* Don't expect a lot of trivial intersects in this case. */ - overlap_ = BLI_bvhtree_overlap(tree_, tree_b_, &overlap_tot_, NULL, NULL); + overlap_ = BLI_bvhtree_overlap(tree_, tree_b_, &overlap_tot_, nullptr, nullptr); } else { CBData cbdata{tm, shape_fn, nshapes, use_self}; if (nshapes == 1) { - overlap_ = BLI_bvhtree_overlap(tree_, tree_, &overlap_tot_, NULL, NULL); + overlap_ = BLI_bvhtree_overlap(tree_, tree_, &overlap_tot_, nullptr, nullptr); } else { overlap_ = BLI_bvhtree_overlap( diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc index cf328ec407c..1a119e135d5 100644 --- a/source/blender/blenlib/intern/task_pool.cc +++ b/source/blender/blenlib/intern/task_pool.cc @@ -83,11 +83,11 @@ class Task { free_taskdata(other.free_taskdata), freedata(other.freedata) { - other.pool = NULL; - other.run = NULL; - other.taskdata = NULL; + other.pool = nullptr; + other.run = nullptr; + other.taskdata = nullptr; other.free_taskdata = false; - other.freedata = NULL; + other.freedata = nullptr; } #if defined(WITH_TBB) && TBB_INTERFACE_VERSION_MAJOR < 10 @@ -302,7 +302,7 @@ static void *background_task_run(void *userdata) task->~Task(); MEM_freeN(task); } - return NULL; + return nullptr; } static void background_task_pool_create(TaskPool *pool) diff --git a/source/blender/blenlib/intern/task_range.cc b/source/blender/blenlib/intern/task_range.cc index 27e0fb0ed07..229129bd088 100644 --- a/source/blender/blenlib/intern/task_range.cc +++ b/source/blender/blenlib/intern/task_range.cc @@ -70,7 +70,7 @@ struct RangeTask { ~RangeTask() { - if (settings->func_free != NULL) { + if (settings->func_free != nullptr) { settings->func_free(userdata, userdata_chunk); } MEM_SAFE_FREE(userdata_chunk); @@ -83,7 +83,7 @@ struct RangeTask { memcpy(userdata_chunk, from_chunk, settings->userdata_chunk_size); } else { - userdata_chunk = NULL; + userdata_chunk = nullptr; } } @@ -139,7 +139,7 @@ void BLI_task_parallel_range(const int start, for (int i = start; i < stop; i++) { func(userdata, i, &tls); } - if (settings->func_free != NULL) { + if (settings->func_free != nullptr) { settings->func_free(userdata, settings->userdata_chunk); } } diff --git a/source/blender/blenlib/tests/BLI_array_store_test.cc b/source/blender/blenlib/tests/BLI_array_store_test.cc index a1ec8ec7bb3..ff050ce24db 100644 --- a/source/blender/blenlib/tests/BLI_array_store_test.cc +++ b/source/blender/blenlib/tests/BLI_array_store_test.cc @@ -125,7 +125,7 @@ static TestBuffer *testbuffer_list_add(ListBase *lb, const void *data, size_t da TestBuffer *tb = (TestBuffer *)MEM_mallocN(sizeof(*tb), __func__); tb->data = data; tb->data_len = data_len; - tb->state = NULL; + tb->state = nullptr; BLI_addtail(lb, tb); return tb; } @@ -244,10 +244,10 @@ static void testbuffer_list_data_randomize(ListBase *lb, unsigned int random_see static void testbuffer_list_store_populate(BArrayStore *bs, ListBase *lb) { - for (TestBuffer *tb = (TestBuffer *)lb->first, *tb_prev = NULL; tb; + for (TestBuffer *tb = (TestBuffer *)lb->first, *tb_prev = nullptr; tb; tb_prev = tb, tb = tb->next) { tb->state = BLI_array_store_state_add( - bs, tb->data, tb->data_len, (tb_prev ? tb_prev->state : NULL)); + bs, tb->data, tb->data_len, (tb_prev ? tb_prev->state : nullptr)); } } @@ -255,7 +255,7 @@ static void testbuffer_list_store_clear(BArrayStore *bs, ListBase *lb) { for (TestBuffer *tb = (TestBuffer *)lb->first; tb; tb = tb->next) { BLI_array_store_state_remove(bs, tb->state); - tb->state = NULL; + tb->state = nullptr; } } @@ -313,7 +313,7 @@ TEST(array_store, NopState) { BArrayStore *bs = BLI_array_store_create(1, 32); const unsigned char data[] = "test"; - BArrayState *state = BLI_array_store_state_add(bs, data, sizeof(data) - 1, NULL); + BArrayState *state = BLI_array_store_state_add(bs, data, sizeof(data) - 1, nullptr); EXPECT_EQ(BLI_array_store_state_size_get(state), sizeof(data) - 1); BLI_array_store_state_remove(bs, state); BLI_array_store_destroy(bs); @@ -324,7 +324,7 @@ TEST(array_store, Single) BArrayStore *bs = BLI_array_store_create(1, 32); const char data_src[] = "test"; const char *data_dst; - BArrayState *state = BLI_array_store_state_add(bs, data_src, sizeof(data_src), NULL); + BArrayState *state = BLI_array_store_state_add(bs, data_src, sizeof(data_src), nullptr); size_t data_dst_len; data_dst = (char *)BLI_array_store_state_data_get_alloc(state, &data_dst_len); EXPECT_STREQ(data_src, data_dst); @@ -339,7 +339,7 @@ TEST(array_store, DoubleNop) const char data_src[] = "test"; const char *data_dst; - BArrayState *state_a = BLI_array_store_state_add(bs, data_src, sizeof(data_src), NULL); + BArrayState *state_a = BLI_array_store_state_add(bs, data_src, sizeof(data_src), nullptr); BArrayState *state_b = BLI_array_store_state_add(bs, data_src, sizeof(data_src), state_a); EXPECT_EQ(BLI_array_store_calc_size_compacted_get(bs), sizeof(data_src)); @@ -366,7 +366,7 @@ TEST(array_store, DoubleDiff) const char data_src_b[] = "####"; const char *data_dst; - BArrayState *state_a = BLI_array_store_state_add(bs, data_src_a, sizeof(data_src_a), NULL); + BArrayState *state_a = BLI_array_store_state_add(bs, data_src_a, sizeof(data_src_a), nullptr); BArrayState *state_b = BLI_array_store_state_add(bs, data_src_b, sizeof(data_src_b), state_a); size_t data_dst_len; @@ -594,7 +594,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, size_t data_len = rand_range_i(rng, data_min_len, data_max_len + stride, stride); char *data = (char *)MEM_mallocN(data_len, __func__); - if (lb->last == NULL) { + if (lb->last == nullptr) { BLI_rng_get_char_n(rng, data, data_len); } else { diff --git a/source/blender/blenlib/tests/BLI_array_utils_test.cc b/source/blender/blenlib/tests/BLI_array_utils_test.cc index 33b4cd35d52..5d12b8fbd4d 100644 --- a/source/blender/blenlib/tests/BLI_array_utils_test.cc +++ b/source/blender/blenlib/tests/BLI_array_utils_test.cc @@ -91,7 +91,7 @@ TEST(array_utils, FindIndexInt4_DupeMid) TEST(array_utils, FindIndexPointer) { - const char *data[4] = {NULL}; + const char *data[4] = {nullptr}; STACK_DECLARE(data); STACK_INIT(data, ARRAY_SIZE(data)); diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc index caacbf1a2c4..338d6f96bef 100644 --- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc @@ -1513,7 +1513,7 @@ TEST(delaunay_d, CintTwoFace) input.edges_len = 0; input.faces_len = 2; input.vert_coords = vert_coords; - input.edges = NULL; + input.edges = nullptr; input.faces = faces; input.faces_len_table = faces_len; input.faces_start_table = faces_start; diff --git a/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc b/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc index aad21ae4ad4..390f687dbd1 100644 --- a/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc +++ b/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc @@ -12,7 +12,7 @@ static void expr_pylike_parse_fail_test(const char *str) { - ExprPyLike_Parsed *expr = BLI_expr_pylike_parse(str, NULL, 0); + ExprPyLike_Parsed *expr = BLI_expr_pylike_parse(str, nullptr, 0); EXPECT_FALSE(BLI_expr_pylike_is_valid(expr)); @@ -21,7 +21,7 @@ static void expr_pylike_parse_fail_test(const char *str) static void expr_pylike_const_test(const char *str, double value, bool force_const) { - ExprPyLike_Parsed *expr = BLI_expr_pylike_parse(str, NULL, 0); + ExprPyLike_Parsed *expr = BLI_expr_pylike_parse(str, nullptr, 0); if (force_const) { EXPECT_TRUE(BLI_expr_pylike_is_constant(expr)); @@ -32,7 +32,7 @@ static void expr_pylike_const_test(const char *str, double value, bool force_con } double result; - eExprPyLike_EvalStatus status = BLI_expr_pylike_eval(expr, NULL, 0, &result); + eExprPyLike_EvalStatus status = BLI_expr_pylike_eval(expr, nullptr, 0, &result); EXPECT_EQ(status, EXPR_PYLIKE_SUCCESS); EXPECT_EQ(result, value); @@ -344,10 +344,10 @@ TEST_ERROR(Mixed3, "sqrt(x) + 1 / max(0, x)", 1.0, EXPR_PYLIKE_SUCCESS) TEST(expr_pylike, Error_Invalid) { - ExprPyLike_Parsed *expr = BLI_expr_pylike_parse("", NULL, 0); + ExprPyLike_Parsed *expr = BLI_expr_pylike_parse("", nullptr, 0); double result; - EXPECT_EQ(BLI_expr_pylike_eval(expr, NULL, 0, &result), EXPR_PYLIKE_INVALID); + EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID); BLI_expr_pylike_free(expr); } @@ -357,7 +357,7 @@ TEST(expr_pylike, Error_ArgumentCount) ExprPyLike_Parsed *expr = parse_for_eval("x", false); double result; - EXPECT_EQ(BLI_expr_pylike_eval(expr, NULL, 0, &result), EXPR_PYLIKE_FATAL_ERROR); + EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_FATAL_ERROR); BLI_expr_pylike_free(expr); } diff --git a/source/blender/blenlib/tests/BLI_ghash_test.cc b/source/blender/blenlib/tests/BLI_ghash_test.cc index 484f158a85c..a0b24e96fcc 100644 --- a/source/blender/blenlib/tests/BLI_ghash_test.cc +++ b/source/blender/blenlib/tests/BLI_ghash_test.cc @@ -77,7 +77,7 @@ TEST(ghash, InsertLookup) EXPECT_EQ(POINTER_AS_UINT(v), *k); } - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); } /* Here we simply insert and then remove all keys, ensuring we do get an empty, @@ -98,14 +98,14 @@ TEST(ghash, InsertRemove) bkt_size = BLI_ghash_buckets_len(ghash); for (i = TESTCASE_SIZE, k = keys; i--; k++) { - void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), NULL); + void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), nullptr); EXPECT_EQ(POINTER_AS_UINT(v), *k); } EXPECT_EQ(BLI_ghash_len(ghash), 0); EXPECT_EQ(BLI_ghash_buckets_len(ghash), bkt_size); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); } /* Same as above, but this time we allow ghash to shrink. */ @@ -126,14 +126,14 @@ TEST(ghash, InsertRemoveShrink) bkt_size = BLI_ghash_buckets_len(ghash); for (i = TESTCASE_SIZE, k = keys; i--; k++) { - void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), NULL); + void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), nullptr); EXPECT_EQ(POINTER_AS_UINT(v), *k); } EXPECT_EQ(BLI_ghash_len(ghash), 0); EXPECT_LT(BLI_ghash_buckets_len(ghash), bkt_size); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); } /* Check copy. */ @@ -152,7 +152,7 @@ TEST(ghash, Copy) EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE); - ghash_copy = BLI_ghash_copy(ghash, NULL, NULL); + ghash_copy = BLI_ghash_copy(ghash, nullptr, nullptr); EXPECT_EQ(BLI_ghash_len(ghash_copy), TESTCASE_SIZE); EXPECT_EQ(BLI_ghash_buckets_len(ghash_copy), BLI_ghash_buckets_len(ghash)); @@ -162,8 +162,8 @@ TEST(ghash, Copy) EXPECT_EQ(POINTER_AS_UINT(v), *k); } - BLI_ghash_free(ghash, NULL, NULL); - BLI_ghash_free(ghash_copy, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); + BLI_ghash_free(ghash_copy, nullptr, nullptr); } /* Check pop. */ @@ -205,5 +205,5 @@ TEST(ghash, Pop) } EXPECT_EQ(BLI_ghash_len(ghash), 0); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); } diff --git a/source/blender/blenlib/tests/BLI_heap_simple_test.cc b/source/blender/blenlib/tests/BLI_heap_simple_test.cc index e717a6e2653..f3a65125eeb 100644 --- a/source/blender/blenlib/tests/BLI_heap_simple_test.cc +++ b/source/blender/blenlib/tests/BLI_heap_simple_test.cc @@ -29,7 +29,7 @@ TEST(heap, SimpleEmpty) heap = BLI_heapsimple_new(); EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); EXPECT_EQ(BLI_heapsimple_len(heap), 0); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } TEST(heap, SimpleOne) @@ -45,7 +45,7 @@ TEST(heap, SimpleOne) EXPECT_EQ(in, BLI_heapsimple_pop_min(heap)); EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); EXPECT_EQ(BLI_heapsimple_len(heap), 0); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } TEST(heap, SimpleRange) @@ -59,7 +59,7 @@ TEST(heap, SimpleRange) EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap))); } EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } TEST(heap, SimpleRangeReverse) @@ -73,7 +73,7 @@ TEST(heap, SimpleRangeReverse) EXPECT_EQ(-out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap))); } EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } TEST(heap, SimpleDuplicates) @@ -81,13 +81,13 @@ TEST(heap, SimpleDuplicates) const int items_total = SIZE; HeapSimple *heap = BLI_heapsimple_new(); for (int in = 0; in < items_total; in++) { - BLI_heapsimple_insert(heap, 1.0f, 0); + BLI_heapsimple_insert(heap, 1.0f, nullptr); } for (int out_test = 0; out_test < items_total; out_test++) { EXPECT_EQ(0, POINTER_AS_INT(BLI_heapsimple_pop_min(heap))); } EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } static void random_heapsimple_helper(const int items_total, const int random_seed) @@ -103,7 +103,7 @@ static void random_heapsimple_helper(const int items_total, const int random_see EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap))); } EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); MEM_freeN(values); } diff --git a/source/blender/blenlib/tests/BLI_heap_test.cc b/source/blender/blenlib/tests/BLI_heap_test.cc index 87e68c175a2..8b207c17c84 100644 --- a/source/blender/blenlib/tests/BLI_heap_test.cc +++ b/source/blender/blenlib/tests/BLI_heap_test.cc @@ -28,7 +28,7 @@ TEST(heap, Empty) heap = BLI_heap_new(); EXPECT_TRUE(BLI_heap_is_empty(heap)); EXPECT_EQ(BLI_heap_len(heap), 0); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } TEST(heap, One) @@ -44,7 +44,7 @@ TEST(heap, One) EXPECT_EQ(in, BLI_heap_pop_min(heap)); EXPECT_TRUE(BLI_heap_is_empty(heap)); EXPECT_EQ(BLI_heap_len(heap), 0); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } TEST(heap, Range) @@ -58,7 +58,7 @@ TEST(heap, Range) EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } TEST(heap, RangeReverse) @@ -72,7 +72,7 @@ TEST(heap, RangeReverse) EXPECT_EQ(-out_test, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } TEST(heap, RangeRemove) @@ -85,13 +85,13 @@ TEST(heap, RangeRemove) } for (int i = 0; i < items_total; i += 2) { BLI_heap_remove(heap, nodes[i]); - nodes[i] = NULL; + nodes[i] = nullptr; } for (int out_test = 1; out_test < items_total; out_test += 2) { EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); MEM_freeN(nodes); } @@ -100,13 +100,13 @@ TEST(heap, Duplicates) const int items_total = SIZE; Heap *heap = BLI_heap_new(); for (int in = 0; in < items_total; in++) { - BLI_heap_insert(heap, 1.0f, 0); + BLI_heap_insert(heap, 1.0f, nullptr); } for (int out_test = 0; out_test < items_total; out_test++) { EXPECT_EQ(0, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } static void random_heap_helper(const int items_total, const int random_seed) @@ -122,7 +122,7 @@ static void random_heap_helper(const int items_total, const int random_seed) EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); MEM_freeN(values); } @@ -156,7 +156,7 @@ TEST(heap, ReInsertSimple) } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); MEM_freeN(nodes); } @@ -181,7 +181,7 @@ static void random_heap_reinsert_helper(const int items_total, const int random_ BLI_heap_pop_min(heap); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); MEM_freeN(nodes); } diff --git a/source/blender/blenlib/tests/BLI_kdopbvh_test.cc b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc index 2e8032400e3..f921c3ae2a4 100644 --- a/source/blender/blenlib/tests/BLI_kdopbvh_test.cc +++ b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc @@ -82,11 +82,11 @@ static void find_nearest_points_test( BLI_bvhtree_balance(tree); /* first find each point */ - BVHTree_NearestPointCallback callback = optimal ? optimal_check_callback : NULL; + BVHTree_NearestPointCallback callback = optimal ? optimal_check_callback : nullptr; int flags = optimal ? BVH_NEAREST_OPTIMAL_ORDER : 0; for (int i = 0; i < points_len; i++) { - const int j = BLI_bvhtree_find_nearest_ex(tree, points[i], NULL, callback, points, flags); + const int j = BLI_bvhtree_find_nearest_ex(tree, points[i], nullptr, callback, points, flags); if (j != i) { #if 0 const float dist = len_v3v3(points[i], points[j]); diff --git a/source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc b/source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc index d1a527d57ac..f2ae121e8ae 100644 --- a/source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc +++ b/source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc @@ -15,7 +15,7 @@ TEST(LockfreeLinkList, Init) BLI_linklist_lockfree_init(&list); EXPECT_EQ(list.head, &list.dummy_node); EXPECT_EQ(list.tail, &list.dummy_node); - BLI_linklist_lockfree_free(&list, NULL); + BLI_linklist_lockfree_free(&list, nullptr); } TEST(LockfreeLinkList, InsertSingle) @@ -27,7 +27,7 @@ TEST(LockfreeLinkList, InsertSingle) EXPECT_EQ(list.head, &list.dummy_node); EXPECT_EQ(list.head->next, &node); EXPECT_EQ(list.tail, &node); - BLI_linklist_lockfree_free(&list, NULL); + BLI_linklist_lockfree_free(&list, nullptr); } TEST(LockfreeLinkList, InsertMultiple) @@ -45,7 +45,7 @@ TEST(LockfreeLinkList, InsertMultiple) EXPECT_EQ(list.tail, &nodes[num_nodes - 1]); /* Check rest of the nodes. */ int node_index = 0; - for (LockfreeLinkNode *node = BLI_linklist_lockfree_begin(&list); node != NULL; + for (LockfreeLinkNode *node = BLI_linklist_lockfree_begin(&list); node != nullptr; node = node->next, ++node_index) { EXPECT_EQ(node, &nodes[node_index]); if (node_index != num_nodes - 1) { @@ -53,7 +53,7 @@ TEST(LockfreeLinkList, InsertMultiple) } } /* Free list. */ - BLI_linklist_lockfree_free(&list, NULL); + BLI_linklist_lockfree_free(&list, nullptr); } namespace { @@ -84,7 +84,7 @@ TEST(LockfreeLinkList, InsertMultipleConcurrent) TaskPool *pool = BLI_task_pool_create_suspended(&list, TASK_PRIORITY_HIGH); /* Push tasks to the pool. */ for (int i = 0; i < num_nodes; ++i) { - BLI_task_pool_push(pool, concurrent_insert, POINTER_FROM_INT(i), false, NULL); + BLI_task_pool_push(pool, concurrent_insert, POINTER_FROM_INT(i), false, nullptr); } /* Run all the tasks. */ BLI_task_pool_work_and_wait(pool); @@ -92,7 +92,7 @@ TEST(LockfreeLinkList, InsertMultipleConcurrent) EXPECT_EQ(list.head, &list.dummy_node); bool *visited_nodes = (bool *)MEM_callocN(sizeof(bool) * num_nodes, "visited nodes"); /* First, we make sure that none of the nodes are added twice. */ - for (LockfreeLinkNode *node_v = BLI_linklist_lockfree_begin(&list); node_v != NULL; + for (LockfreeLinkNode *node_v = BLI_linklist_lockfree_begin(&list); node_v != nullptr; node_v = node_v->next) { IndexedNode *node = (IndexedNode *)node_v; EXPECT_GE(node->index, 0); diff --git a/source/blender/blenlib/tests/BLI_listbase_test.cc b/source/blender/blenlib/tests/BLI_listbase_test.cc index e5b504a0040..ff85cf79e87 100644 --- a/source/blender/blenlib/tests/BLI_listbase_test.cc +++ b/source/blender/blenlib/tests/BLI_listbase_test.cc @@ -22,19 +22,19 @@ static bool listbase_is_valid(const ListBase *listbase) if (listbase->first) { const Link *prev, *link; link = (Link *)listbase->first; - TESTFAIL(link->prev == NULL); + TESTFAIL(link->prev == nullptr); link = (Link *)listbase->last; - TESTFAIL(link->next == NULL); + TESTFAIL(link->next == nullptr); - prev = NULL; + prev = nullptr; link = (Link *)listbase->first; do { TESTFAIL(link->prev == prev); } while ((void)(prev = link), (link = link->next)); TESTFAIL(prev == listbase->last); - prev = NULL; + prev = nullptr; link = (Link *)listbase->last; do { TESTFAIL(link->next == prev); @@ -42,7 +42,7 @@ static bool listbase_is_valid(const ListBase *listbase) TESTFAIL(prev == listbase->first); } else { - TESTFAIL(listbase->last == NULL); + TESTFAIL(listbase->last == nullptr); } #undef TESTFAIL @@ -73,12 +73,12 @@ TEST(listbase, FindLinkOrIndex) /* Empty list */ BLI_listbase_clear(&lb); - EXPECT_EQ(BLI_findlink(&lb, -1), (void *)NULL); - EXPECT_EQ(BLI_findlink(&lb, 0), (void *)NULL); - EXPECT_EQ(BLI_findlink(&lb, 1), (void *)NULL); - EXPECT_EQ(BLI_rfindlink(&lb, -1), (void *)NULL); - EXPECT_EQ(BLI_rfindlink(&lb, 0), (void *)NULL); - EXPECT_EQ(BLI_rfindlink(&lb, 1), (void *)NULL); + EXPECT_EQ(BLI_findlink(&lb, -1), (void *)nullptr); + EXPECT_EQ(BLI_findlink(&lb, 0), (void *)nullptr); + EXPECT_EQ(BLI_findlink(&lb, 1), (void *)nullptr); + EXPECT_EQ(BLI_rfindlink(&lb, -1), (void *)nullptr); + EXPECT_EQ(BLI_rfindlink(&lb, 0), (void *)nullptr); + EXPECT_EQ(BLI_rfindlink(&lb, 1), (void *)nullptr); EXPECT_EQ(BLI_findindex(&lb, link1), -1); /* One link */ diff --git a/source/blender/blenlib/tests/BLI_path_util_test.cc b/source/blender/blenlib/tests/BLI_path_util_test.cc index d8c10f60093..cf5135731e2 100644 --- a/source/blender/blenlib/tests/BLI_path_util_test.cc +++ b/source/blender/blenlib/tests/BLI_path_util_test.cc @@ -18,46 +18,46 @@ TEST(path_util, Clean) /* "/./" -> "/" */ { char path[FILE_MAX] = "/a/./b/./c/./"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/a/b/c/", path); } { char path[FILE_MAX] = "/./././"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/", path); } { char path[FILE_MAX] = "/a/./././b/"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/a/b/", path); } /* "//" -> "/" */ { char path[FILE_MAX] = "a////"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("a/", path); } if (false) /* FIXME */ { char path[FILE_MAX] = "./a////"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("./a/", path); } /* "foo/bar/../" -> "foo/" */ { char path[FILE_MAX] = "/a/b/c/../../../"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/", path); } { char path[FILE_MAX] = "/a/../a/b/../b/c/../c/"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/a/b/c/", path); } @@ -96,10 +96,10 @@ TEST(path_util, NameAtIndex_Single) AT_INDEX("//a//", 0, "a"); AT_INDEX("a/b", 0, "a"); - AT_INDEX("/a", 1, NULL); - AT_INDEX("/a/", 1, NULL); - AT_INDEX("a/", 1, NULL); - AT_INDEX("//a//", 1, NULL); + AT_INDEX("/a", 1, nullptr); + AT_INDEX("/a/", 1, nullptr); + AT_INDEX("a/", 1, nullptr); + AT_INDEX("//a//", 1, nullptr); } TEST(path_util, NameAtIndex_SingleNeg) { @@ -109,10 +109,10 @@ TEST(path_util, NameAtIndex_SingleNeg) AT_INDEX("//a//", -1, "a"); AT_INDEX("a/b", -1, "b"); - AT_INDEX("/a", -2, NULL); - AT_INDEX("/a/", -2, NULL); - AT_INDEX("a/", -2, NULL); - AT_INDEX("//a//", -2, NULL); + AT_INDEX("/a", -2, nullptr); + AT_INDEX("/a/", -2, nullptr); + AT_INDEX("a/", -2, nullptr); + AT_INDEX("//a//", -2, nullptr); } TEST(path_util, NameAtIndex_Double) @@ -123,10 +123,10 @@ TEST(path_util, NameAtIndex_Double) AT_INDEX("//ab//", 0, "ab"); AT_INDEX("ab/c", 0, "ab"); - AT_INDEX("/ab", 1, NULL); - AT_INDEX("/ab/", 1, NULL); - AT_INDEX("ab/", 1, NULL); - AT_INDEX("//ab//", 1, NULL); + AT_INDEX("/ab", 1, nullptr); + AT_INDEX("/ab/", 1, nullptr); + AT_INDEX("ab/", 1, nullptr); + AT_INDEX("//ab//", 1, nullptr); } TEST(path_util, NameAtIndex_DoublNeg) @@ -137,10 +137,10 @@ TEST(path_util, NameAtIndex_DoublNeg) AT_INDEX("//ab//", -1, "ab"); AT_INDEX("ab/c", -1, "c"); - AT_INDEX("/ab", -2, NULL); - AT_INDEX("/ab/", -2, NULL); - AT_INDEX("ab/", -2, NULL); - AT_INDEX("//ab//", -2, NULL); + AT_INDEX("/ab", -2, nullptr); + AT_INDEX("/ab/", -2, nullptr); + AT_INDEX("ab/", -2, nullptr); + AT_INDEX("//ab//", -2, nullptr); } TEST(path_util, NameAtIndex_Misc) @@ -149,8 +149,8 @@ TEST(path_util, NameAtIndex_Misc) AT_INDEX("/how/now/brown/cow", 1, "now"); AT_INDEX("/how/now/brown/cow", 2, "brown"); AT_INDEX("/how/now/brown/cow", 3, "cow"); - AT_INDEX("/how/now/brown/cow", 4, NULL); - AT_INDEX("/how/now/brown/cow/", 4, NULL); + AT_INDEX("/how/now/brown/cow", 4, nullptr); + AT_INDEX("/how/now/brown/cow/", 4, nullptr); } TEST(path_util, NameAtIndex_MiscNeg) @@ -159,8 +159,8 @@ TEST(path_util, NameAtIndex_MiscNeg) AT_INDEX("/how/now/brown/cow", 1, "now"); AT_INDEX("/how/now/brown/cow", 2, "brown"); AT_INDEX("/how/now/brown/cow", 3, "cow"); - AT_INDEX("/how/now/brown/cow", 4, NULL); - AT_INDEX("/how/now/brown/cow/", 4, NULL); + AT_INDEX("/how/now/brown/cow", 4, nullptr); + AT_INDEX("/how/now/brown/cow/", 4, nullptr); } TEST(path_util, NameAtIndex_MiscComplex) @@ -169,8 +169,8 @@ TEST(path_util, NameAtIndex_MiscComplex) AT_INDEX("//how///now\\/brown/cow", 1, "now"); AT_INDEX("/how/now\\//brown\\/cow", 2, "brown"); AT_INDEX("/how/now/brown/cow//\\", 3, "cow"); - AT_INDEX("/how/now/brown/\\cow", 4, NULL); - AT_INDEX("how/now/brown/\\cow\\", 4, NULL); + AT_INDEX("/how/now/brown/\\cow", 4, nullptr); + AT_INDEX("how/now/brown/\\cow\\", 4, nullptr); } TEST(path_util, NameAtIndex_MiscComplexNeg) @@ -179,24 +179,24 @@ TEST(path_util, NameAtIndex_MiscComplexNeg) AT_INDEX("//how///now\\/brown/cow", -3, "now"); AT_INDEX("/how/now\\//brown\\/cow", -2, "brown"); AT_INDEX("/how/now/brown/cow//\\", -1, "cow"); - AT_INDEX("/how/now/brown/\\cow", -5, NULL); - AT_INDEX("how/now/brown/\\cow\\", -5, NULL); + AT_INDEX("/how/now/brown/\\cow", -5, nullptr); + AT_INDEX("how/now/brown/\\cow\\", -5, nullptr); } TEST(path_util, NameAtIndex_NoneComplex) { - AT_INDEX("", 0, NULL); - AT_INDEX("/", 0, NULL); - AT_INDEX("//", 0, NULL); - AT_INDEX("///", 0, NULL); + AT_INDEX("", 0, nullptr); + AT_INDEX("/", 0, nullptr); + AT_INDEX("//", 0, nullptr); + AT_INDEX("///", 0, nullptr); } TEST(path_util, NameAtIndex_NoneComplexNeg) { - AT_INDEX("", -1, NULL); - AT_INDEX("/", -1, NULL); - AT_INDEX("//", -1, NULL); - AT_INDEX("///", -1, NULL); + AT_INDEX("", -1, nullptr); + AT_INDEX("/", -1, nullptr); + AT_INDEX("//", -1, nullptr); + AT_INDEX("///", -1, nullptr); } #undef AT_INDEX @@ -590,9 +590,9 @@ TEST(path_util, PathFrameGet) /* BLI_path_extension */ TEST(path_util, PathExtension) { - EXPECT_EQ(NULL, BLI_path_extension("some.def/file")); - EXPECT_EQ(NULL, BLI_path_extension("Text")); - EXPECT_EQ(NULL, BLI_path_extension("Text…001")); + EXPECT_EQ(nullptr, BLI_path_extension("some.def/file")); + EXPECT_EQ(nullptr, BLI_path_extension("Text")); + EXPECT_EQ(nullptr, BLI_path_extension("Text…001")); EXPECT_STREQ(".", BLI_path_extension("some/file.")); EXPECT_STREQ(".gz", BLI_path_extension("some/file.tar.gz")); diff --git a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc index 624a296e758..3c9d12c7178 100644 --- a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc @@ -118,7 +118,7 @@ static void test_polyfill_topology(const float /*poly*/[][2], } BLI_edgehashIterator_free(ehi); - BLI_edgehash_free(edgehash, NULL); + BLI_edgehash_free(edgehash, nullptr); } /** @@ -205,7 +205,7 @@ static void test_polyfill_template(const char *id, test_polyfill_template_check(id, is_degenerate, poly, poly_tot, tris, tris_tot); BLI_memarena_free(pf_arena); - BLI_heap_free(pf_heap, NULL); + BLI_heap_free(pf_heap, nullptr); } #endif } diff --git a/source/blender/blenlib/tests/BLI_string_test.cc b/source/blender/blenlib/tests/BLI_string_test.cc index e8fe505a6c9..58135adbcca 100644 --- a/source/blender/blenlib/tests/BLI_string_test.cc +++ b/source/blender/blenlib/tests/BLI_string_test.cc @@ -66,8 +66,8 @@ TEST(string, StrPartition) /* "" -> "", NULL, NULL, 0 */ pre_ln = BLI_str_partition(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 0); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } { @@ -76,8 +76,8 @@ TEST(string, StrPartition) /* "material" -> "material", NULL, NULL, 8 */ pre_ln = BLI_str_partition(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 8); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -125,8 +125,8 @@ TEST(string, StrRPartition) /* "" -> "", NULL, NULL, 0 */ pre_ln = BLI_str_rpartition(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 0); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } { @@ -135,8 +135,8 @@ TEST(string, StrRPartition) /* "material" -> "material", NULL, NULL, 8 */ pre_ln = BLI_str_rpartition(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 8); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -166,8 +166,8 @@ TEST(string, StrPartitionEx) /* "mate.rial" over "mate" -> "mate.rial", NULL, NULL, 4 */ pre_ln = BLI_str_partition_ex(str, str + 4, delim, &sep, &suf, true); EXPECT_EQ(pre_ln, 4); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -215,8 +215,8 @@ TEST(string, StrPartitionUtf8) /* "" -> "", NULL, NULL, 0 */ pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 0); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } { @@ -225,8 +225,8 @@ TEST(string, StrPartitionUtf8) /* "material" -> "material", NULL, NULL, 8 */ pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 8); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -274,8 +274,8 @@ TEST(string, StrRPartitionUtf8) /* "" -> "", NULL, NULL, 0 */ pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 0); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } { @@ -284,8 +284,8 @@ TEST(string, StrRPartitionUtf8) /* "material" -> "material", NULL, NULL, 8 */ pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 8); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -316,8 +316,8 @@ TEST(string, StrPartitionExUtf8) /* "mate\xe2\x98\xafrial" over "mate" -> "mate\xe2\x98\xafrial", NULL, NULL, 4 */ pre_ln = BLI_str_partition_ex_utf8(str, str + 4, delim, &sep, &suf, true); EXPECT_EQ(pre_ln, 4); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -567,7 +567,7 @@ TEST(string, StringStrncasestr) EXPECT_EQ(res, str_test0 + 1); res = BLI_strncasestr(str_test0, "not there", 9); - EXPECT_EQ(res, (void *)NULL); + EXPECT_EQ(res, (void *)nullptr); } /* BLI_string_max_possible_word_count */ diff --git a/source/blender/blenlib/tests/BLI_string_utf8_test.cc b/source/blender/blenlib/tests/BLI_string_utf8_test.cc index 9743c1387a0..1833945b3fd 100644 --- a/source/blender/blenlib/tests/BLI_string_utf8_test.cc +++ b/source/blender/blenlib/tests/BLI_string_utf8_test.cc @@ -262,14 +262,14 @@ const char *utf8_invalid_tests[][3] = { /* For now, we ignore those, they do not seem to be crucial anyway... */ /* 5.3.3 U+FDD0 .. U+FDEF * 5.3.4 U+nFFFE U+nFFFF (for n = 1..10) */ - {NULL, NULL, NULL}, + {nullptr, nullptr, nullptr}, }; /* clang-format on */ /* BLI_utf8_invalid_strip (and indirectly, BLI_utf8_invalid_byte). */ TEST(string, Utf8InvalidBytes) { - for (int i = 0; utf8_invalid_tests[i][0] != NULL; i++) { + for (int i = 0; utf8_invalid_tests[i][0] != nullptr; i++) { const char *tst = utf8_invalid_tests[i][0]; const char *tst_stripped = utf8_invalid_tests[i][1]; const int num_errors = (int)utf8_invalid_tests[i][2][0]; diff --git a/source/blender/blenlib/tests/BLI_task_graph_test.cc b/source/blender/blenlib/tests/BLI_task_graph_test.cc index efcbf923625..3374411b2bd 100644 --- a/source/blender/blenlib/tests/BLI_task_graph_test.cc +++ b/source/blender/blenlib/tests/BLI_task_graph_test.cc @@ -52,16 +52,16 @@ TEST(task, GraphSequential) TaskGraph *graph = BLI_task_graph_create(); /* 0 => 1 */ - TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); /* 1 => 2 */ TaskNode *node_b = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_value, &data, NULL); + graph, TaskData_multiply_by_two_value, &data, nullptr); /* 2 => 1 */ - TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_decrease_value, &data, NULL); + TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_decrease_value, &data, nullptr); /* 2 => 1 */ - TaskNode *node_d = BLI_task_graph_node_create(graph, TaskData_square_value, &data, NULL); + TaskNode *node_d = BLI_task_graph_node_create(graph, TaskData_square_value, &data, nullptr); /* 1 => 1 */ - TaskNode *node_e = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + TaskNode *node_e = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); /* 1 => 2 */ const int expected_value = 2; @@ -82,12 +82,12 @@ TEST(task, GraphStartAtAnyNode) TaskData data = {4}; TaskGraph *graph = BLI_task_graph_create(); - TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); TaskNode *node_b = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_value, &data, NULL); - TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_decrease_value, &data, NULL); - TaskNode *node_d = BLI_task_graph_node_create(graph, TaskData_square_value, &data, NULL); - TaskNode *node_e = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + graph, TaskData_multiply_by_two_value, &data, nullptr); + TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_decrease_value, &data, nullptr); + TaskNode *node_d = BLI_task_graph_node_create(graph, TaskData_square_value, &data, nullptr); + TaskNode *node_e = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); // ((4 - 1) * (4 - 1)) + 1 const int expected_value = 10; @@ -109,11 +109,11 @@ TEST(task, GraphSplit) TaskData data = {1}; TaskGraph *graph = BLI_task_graph_create(); - TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); - TaskNode *node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data, NULL); - TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); + TaskNode *node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data, nullptr); + TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); TaskNode *node_d = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_store, &data, NULL); + graph, TaskData_multiply_by_two_store, &data, nullptr); BLI_task_graph_edge_create(node_a, node_b); BLI_task_graph_edge_create(node_b, node_c); BLI_task_graph_edge_create(node_b, node_d); @@ -134,12 +134,12 @@ TEST(task, GraphForest) { TaskNode *tree1_node_a = BLI_task_graph_node_create( - graph, TaskData_increase_value, &data1, NULL); - TaskNode *tree1_node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data1, NULL); + graph, TaskData_increase_value, &data1, nullptr); + TaskNode *tree1_node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data1, nullptr); TaskNode *tree1_node_c = BLI_task_graph_node_create( - graph, TaskData_increase_value, &data1, NULL); + graph, TaskData_increase_value, &data1, nullptr); TaskNode *tree1_node_d = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_store, &data1, NULL); + graph, TaskData_multiply_by_two_store, &data1, nullptr); BLI_task_graph_edge_create(tree1_node_a, tree1_node_b); BLI_task_graph_edge_create(tree1_node_b, tree1_node_c); BLI_task_graph_edge_create(tree1_node_b, tree1_node_d); @@ -148,12 +148,12 @@ TEST(task, GraphForest) { TaskNode *tree2_node_a = BLI_task_graph_node_create( - graph, TaskData_increase_value, &data2, NULL); - TaskNode *tree2_node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data2, NULL); + graph, TaskData_increase_value, &data2, nullptr); + TaskNode *tree2_node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data2, nullptr); TaskNode *tree2_node_c = BLI_task_graph_node_create( - graph, TaskData_increase_value, &data2, NULL); + graph, TaskData_increase_value, &data2, nullptr); TaskNode *tree2_node_d = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_store, &data2, NULL); + graph, TaskData_multiply_by_two_store, &data2, nullptr); BLI_task_graph_edge_create(tree2_node_a, tree2_node_b); BLI_task_graph_edge_create(tree2_node_b, tree2_node_c); BLI_task_graph_edge_create(tree2_node_b, tree2_node_d); @@ -175,7 +175,7 @@ TEST(task, GraphTaskData) TaskGraph *graph = BLI_task_graph_create(); TaskNode *node_a = BLI_task_graph_node_create( graph, TaskData_store_value, &data, TaskData_increase_value); - TaskNode *node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data, NULL); + TaskNode *node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data, nullptr); BLI_task_graph_edge_create(node_a, node_b); EXPECT_TRUE(BLI_task_graph_node_push_work(node_a)); BLI_task_graph_work_and_wait(graph); diff --git a/source/blender/blenlib/tests/BLI_task_test.cc b/source/blender/blenlib/tests/BLI_task_test.cc index 3abaf6a6c0b..2a3fddf5e3d 100644 --- a/source/blender/blenlib/tests/BLI_task_test.cc +++ b/source/blender/blenlib/tests/BLI_task_test.cc @@ -72,7 +72,7 @@ static void task_mempool_iter_func(void *userdata, MempoolIterData *item) int *data = (int *)item; int *count = (int *)userdata; - EXPECT_TRUE(data != NULL); + EXPECT_TRUE(data != nullptr); *data += 1; atomic_sub_and_fetch_uint32((uint32_t *)count, 1); @@ -97,12 +97,12 @@ TEST(task, MempoolIter) for (i = 0; i < NUM_ITEMS; i += 3) { BLI_mempool_free(mempool, data[i]); - data[i] = NULL; + data[i] = nullptr; num_items--; } for (i = 0; i < NUM_ITEMS; i += 7) { - if (data[i] == NULL) { + if (data[i] == nullptr) { data[i] = (int *)BLI_mempool_alloc(mempool); *data[i] = i - 1; num_items++; @@ -111,9 +111,9 @@ TEST(task, MempoolIter) for (i = 0; i < NUM_ITEMS - 5; i += 23) { for (int j = 0; j < 5; j++) { - if (data[i + j] != NULL) { + if (data[i + j] != nullptr) { BLI_mempool_free(mempool, data[i + j]); - data[i + j] = NULL; + data[i + j] = nullptr; num_items--; } } @@ -125,7 +125,7 @@ TEST(task, MempoolIter) * expected. */ EXPECT_EQ(num_items, 0); for (i = 0; i < NUM_ITEMS; i++) { - if (data[i] != NULL) { + if (data[i] != nullptr) { EXPECT_EQ(*data[i], i); } } @@ -150,7 +150,7 @@ static void task_listbase_iter_func(void *userdata, TEST(task, ListBaseIter) { - ListBase list = {NULL, NULL}; + ListBase list = {nullptr, nullptr}; LinkData *items_buffer = (LinkData *)MEM_calloc_arrayN( NUM_ITEMS, sizeof(*items_buffer), __func__); BLI_threadapi_init(); @@ -172,7 +172,7 @@ TEST(task, ListBaseIter) * as expected. */ EXPECT_EQ(num_items, 0); LinkData *item; - for (i = 0, item = (LinkData *)list.first; i < NUM_ITEMS && item != NULL; + for (i = 0, item = (LinkData *)list.first; i < NUM_ITEMS && item != nullptr; i++, item = item->next) { EXPECT_EQ(POINTER_AS_INT(item->data), i); } diff --git a/source/blender/blenlib/tests/BLI_vector_test.cc b/source/blender/blenlib/tests/BLI_vector_test.cc index ffdebd33873..0088ae21983 100644 --- a/source/blender/blenlib/tests/BLI_vector_test.cc +++ b/source/blender/blenlib/tests/BLI_vector_test.cc @@ -79,11 +79,11 @@ struct TestListValue { TEST(vector, ListBaseConstructor) { - TestListValue *value1 = new TestListValue{0, 0, 4}; - TestListValue *value2 = new TestListValue{0, 0, 5}; - TestListValue *value3 = new TestListValue{0, 0, 6}; + TestListValue *value1 = new TestListValue{nullptr, nullptr, 4}; + TestListValue *value2 = new TestListValue{nullptr, nullptr, 5}; + TestListValue *value3 = new TestListValue{nullptr, nullptr, 6}; - ListBase list = {NULL, NULL}; + ListBase list = {nullptr, nullptr}; BLI_addtail(&list, value1); BLI_addtail(&list, value2); BLI_addtail(&list, value3); diff --git a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc index 6400bec93f9..9a374cd0b1f 100644 --- a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc +++ b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc @@ -152,7 +152,7 @@ static void str_ghash_tests(GHash *ghash, const char *id) TIMEIT_END(string_lookup); } - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); MEM_freeN(data); MEM_freeN(data_p); MEM_freeN(data_w); @@ -227,7 +227,7 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr } EXPECT_EQ(BLI_ghash_len(ghash), 0); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); printf("========== ENDED %s ==========\n\n", id); } @@ -309,7 +309,7 @@ static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int TIMEIT_END(int_lookup); } - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); MEM_freeN(data); printf("========== ENDED %s ==========\n\n", id); @@ -421,7 +421,7 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nb TIMEIT_END(int_v4_lookup); } - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); MEM_freeN(data); printf("========== ENDED %s ==========\n\n", id); @@ -506,7 +506,7 @@ static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned i EXPECT_EQ(POINTER_AS_UINT(v), *dt); } - BLI_ghash_clear(ghash, NULL, NULL); + BLI_ghash_clear(ghash, nullptr, nullptr); MEM_freeN(data); } @@ -538,7 +538,7 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned TIMEIT_END(multi_small2_ghash); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); BLI_rng_free(rng); printf("========== ENDED %s ==========\n\n", id); diff --git a/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc index 208f168b599..c5b0f86e384 100644 --- a/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc +++ b/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc @@ -119,7 +119,7 @@ static void task_listbase_test_do(ListBase *list, } LinkData *item; int j; - for (j = 0, item = (LinkData *)list->first; j < num_items && item != NULL; + for (j = 0, item = (LinkData *)list->first; j < num_items && item != nullptr; j++, item = item->next) { EXPECT_EQ(POINTER_AS_INT(item->data), j); item->data = POINTER_FROM_INT(0); @@ -139,7 +139,7 @@ static void task_listbase_test(const char *id, const int nbr, const bool use_thr { printf("\n========== STARTING %s ==========\n", id); - ListBase list = {NULL, NULL}; + ListBase list = {nullptr, nullptr}; LinkData *items_buffer = (LinkData *)MEM_calloc_arrayN(nbr, sizeof(*items_buffer), __func__); BLI_threadapi_init(); |