From 89120cd2417e2f6f39fa63ae18300bba0aefcfbd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 6 May 2017 14:18:31 +1000 Subject: bmesh: use 'uint' instead of 'unsigned int' no functional changes. --- source/blender/bmesh/tools/bmesh_beautify.c | 4 +- source/blender/bmesh/tools/bmesh_bisect_plane.c | 16 ++-- .../blender/bmesh/tools/bmesh_decimate_collapse.c | 8 +- .../bmesh/tools/bmesh_decimate_unsubdivide.c | 28 +++---- source/blender/bmesh/tools/bmesh_edgenet.c | 40 ++++----- source/blender/bmesh/tools/bmesh_edgesplit.c | 2 +- source/blender/bmesh/tools/bmesh_intersect.c | 60 ++++++------- source/blender/bmesh/tools/bmesh_path.h | 4 +- source/blender/bmesh/tools/bmesh_region_match.c | 98 +++++++++++----------- source/blender/bmesh/tools/bmesh_region_match.h | 2 +- source/blender/bmesh/tools/bmesh_separate.c | 8 +- 11 files changed, 135 insertions(+), 135 deletions(-) (limited to 'source/blender/bmesh/tools') diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c index 3e3a6547b75..f08f21a2c88 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.c +++ b/source/blender/bmesh/tools/bmesh_beautify.c @@ -62,7 +62,7 @@ typedef struct EdRotState { #if 0 /* use BLI_ghashutil_inthash_v4 direct */ -static unsigned int erot_gsetutil_hash(const void *ptr) +static uint erot_gsetutil_hash(const void *ptr) { const EdRotState *e_state = (const EdRotState *)ptr; return BLI_ghashutil_inthash_v4(&e_state->v1); @@ -368,7 +368,7 @@ void BM_mesh_beautify_fill( TIMEIT_START(beautify_fill); #endif - eheap = BLI_heap_new_ex((unsigned int)edge_array_len); + eheap = BLI_heap_new_ex((uint)edge_array_len); eheap_table = MEM_mallocN(sizeof(HeapNode *) * (size_t)edge_array_len, __func__); /* build heap */ diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c index 828c50c39fd..676a8de94c8 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.c +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c @@ -74,7 +74,7 @@ static short plane_point_test_v3(const float plane[4], const float co[3], const #define BM_VERT_DIST(v) ((v)->no[0]) /* Distance from the plane. */ #define BM_VERT_SORTVAL(v) ((v)->no[1]) /* Temp value for sorting. */ #define BM_VERT_LOOPINDEX(v) /* The verts index within a face (temp var) */ \ - (*((unsigned int *)(&(v)->no[2]))) + (*((uint *)(&(v)->no[2]))) /** * Hide flag access @@ -113,7 +113,7 @@ static int bm_vert_sortval_cb(const void *v_a_v, const void *v_b_v) static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], const short oflag_center, const short oflag_new) { /* unlikely more than 2 verts are needed */ - const unsigned int f_len_orig = (unsigned int)f->len; + const uint f_len_orig = (uint)f->len; BMVert **vert_split_arr = BLI_array_alloca(vert_split_arr, f_len_orig); STACK_DECLARE(vert_split_arr); BMLoop *l_iter, *l_first; @@ -171,7 +171,7 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con STACK_DECLARE(face_split_arr); float sort_dir[3]; - unsigned int i; + uint i; /* ---- */ @@ -246,7 +246,7 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con if (is_inside) { BMLoop *l_a, *l_b; bool found = false; - unsigned int j; + uint j; for (j = 0; j < STACK_SIZE(face_split_arr); j++) { /* would be nice to avoid loop lookup here, @@ -311,8 +311,8 @@ void BM_mesh_bisect_plane( const bool use_snap_center, const bool use_tag, const short oflag_center, const short oflag_new, const float eps) { - unsigned int einput_len; - unsigned int i; + uint einput_len; + uint i; BMEdge **edges_arr = MEM_mallocN(sizeof(*edges_arr) * (size_t)bm->totedge, __func__); BLI_LINKSTACK_DECLARE(face_stack, BMFace *); @@ -345,7 +345,7 @@ void BM_mesh_bisect_plane( } else { BMEdge *e; - einput_len = (unsigned int)bm->totedge; + einput_len = (uint)bm->totedge; BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) { edge_is_cut_enable(e); edges_arr[i] = e; @@ -425,7 +425,7 @@ void BM_mesh_bisect_plane( else if (side[0] == 0 || side[1] == 0) { /* check if either edge verts are aligned, * if so - tag and push all faces that use it into the stack */ - unsigned int j; + uint j; BM_ITER_ELEM_INDEX (v, &iter, e, BM_VERTS_OF_EDGE, j) { if (side[j] == 0) { if (vert_is_center_test(v) == 0) { diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index 372d341f223..c417131d588 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -180,7 +180,7 @@ static bool bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_ { BMIter liter; BMLoop *l; - unsigned int i; + uint i; for (i = 0; i < 2; i++) { /* loop over both verts */ @@ -367,7 +367,7 @@ static void bm_decim_build_edge_cost( { BMIter iter; BMEdge *e; - unsigned int i; + uint i; BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) { eheap_table[i] = NULL; /* keep sanity check happy */ @@ -418,12 +418,12 @@ static bool bm_edge_symmetry_check_cb(void *user_data, int index, const float UN return false; } -static int *bm_edge_symmetry_map(BMesh *bm, unsigned int symmetry_axis, float limit) +static int *bm_edge_symmetry_map(BMesh *bm, uint symmetry_axis, float limit) { struct KD_Symmetry_Data sym_data; BMIter iter; BMEdge *e, **etable; - unsigned int i; + uint i; int *edge_symmetry_map; const float limit_sq = SQUARE(limit); KDTree *tree; diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c index 92300ae66a2..f0ac6c673c9 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c +++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c @@ -43,10 +43,10 @@ static bool bm_vert_dissolve_fan_test(BMVert *v) BMVert *varr[4]; - unsigned int tot_edge = 0; - unsigned int tot_edge_boundary = 0; - unsigned int tot_edge_manifold = 0; - unsigned int tot_edge_wire = 0; + uint tot_edge = 0; + uint tot_edge_boundary = 0; + uint tot_edge_manifold = 0; + uint tot_edge_wire = 0; BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { if (BM_edge_is_boundary(e)) { @@ -97,11 +97,11 @@ static bool bm_vert_dissolve_fan(BMesh *bm, BMVert *v) BMIter iter; BMEdge *e; - unsigned int tot_loop = 0; - unsigned int tot_edge = 0; - unsigned int tot_edge_boundary = 0; - unsigned int tot_edge_manifold = 0; - unsigned int tot_edge_wire = 0; + uint tot_loop = 0; + uint tot_edge = 0; + uint tot_edge_boundary = 0; + uint tot_edge_manifold = 0; + uint tot_edge_wire = 0; BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) { if (BM_edge_is_boundary(e)) { @@ -143,7 +143,7 @@ static bool bm_vert_dissolve_fan(BMesh *bm, BMVert *v) if (tot_loop) { BMLoop *f_loop[4]; - unsigned int i; + uint i; /* ensure there are exactly tot_loop loops */ BLI_assert(BM_iter_at_index(bm, BM_LOOPS_OF_VERT, v, tot_loop) == NULL); @@ -192,8 +192,8 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool BMIter iter; - const unsigned int offset = 0; - const unsigned int nth = 2; + const uint offset = 0; + const uint nth = 2; int iter_step; @@ -229,8 +229,8 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool #ifdef USE_WALKER BMWalker walker; #else - unsigned int depth = 1; - unsigned int i; + uint depth = 1; + uint i; #endif BMVert *v_first = NULL; diff --git a/source/blender/bmesh/tools/bmesh_edgenet.c b/source/blender/bmesh/tools/bmesh_edgenet.c index 2a1946df7ae..193a032b46e 100644 --- a/source/blender/bmesh/tools/bmesh_edgenet.c +++ b/source/blender/bmesh/tools/bmesh_edgenet.c @@ -100,13 +100,13 @@ static BMEdge *bm_edgenet_edge_get_next( * * This function returns half a loop, the caller needs to run twice to get both sides. */ -static unsigned int bm_edgenet_path_from_pass( +static uint bm_edgenet_path_from_pass( BMVert *v, LinkNode **v_ls, VertNetInfo *vnet_info, BLI_mempool *path_pool) { VertNetInfo *vn = &vnet_info[BM_elem_index_get(v)]; const int pass = vn->pass; - unsigned int v_ls_tot = 0; + uint v_ls_tot = 0; do { BLI_linklist_prepend_pool(v_ls, v, path_pool); @@ -127,10 +127,10 @@ static bool bm_edgenet_path_check_overlap( VertNetInfo *vnet_info) { /* vert order doesn't matter */ - unsigned int v_ls_tot = 0; + uint v_ls_tot = 0; LinkNode *v_ls = NULL; BMVert *v_pair[2] = {v1, v2}; - unsigned int i; + uint i; for (i = 0; i < 2; i++) { BMVert *v = v_pair[i]; @@ -162,7 +162,7 @@ static bool bm_edgenet_path_check_overlap( * Create a face from the path. */ static BMFace *bm_edgenet_face_from_path( - BMesh *bm, LinkNode *path, const unsigned int path_len) + BMesh *bm, LinkNode *path, const uint path_len) { BMFace *f; LinkNode *v_lnk; @@ -205,8 +205,8 @@ static BMEdge *bm_edgenet_path_step( BMEdge *e; BMIter iter; - unsigned int tot; - unsigned int v_ls_tot; + uint tot; + uint v_ls_tot; begin: @@ -277,8 +277,8 @@ begin: * \return A linked list of verts. */ static LinkNode *bm_edgenet_path_calc( - BMEdge *e, const int pass_nr, const unsigned int path_cost_max, - unsigned int *r_path_len, unsigned int *r_path_cost, + BMEdge *e, const int pass_nr, const uint path_cost_max, + uint *r_path_len, uint *r_path_cost, VertNetInfo *vnet_info, BLI_mempool *path_pool) { VertNetInfo *vn_1, *vn_2; @@ -288,7 +288,7 @@ static LinkNode *bm_edgenet_path_calc( LinkNode *v_ls_prev = NULL; LinkNode *v_ls_next = NULL; - unsigned int path_cost_accum = 0; + uint path_cost_accum = 0; BLI_assert(bm_edge_step_ok(e)); @@ -331,7 +331,7 @@ static LinkNode *bm_edgenet_path_calc( if (e_found) { LinkNode *path = NULL; - unsigned int path_len; + uint path_len; BLI_linklist_free_pool(v_ls_next, NULL, path_pool); BLI_linklist_free_pool(v_ls_prev, NULL, path_pool); @@ -376,12 +376,12 @@ static LinkNode *bm_edgenet_path_calc( * _don't_ have a better option. */ static LinkNode *bm_edgenet_path_calc_best( - BMEdge *e, int *pass_nr, unsigned int path_cost_max, - unsigned int *r_path_len, unsigned int *r_path_cost, + BMEdge *e, int *pass_nr, uint path_cost_max, + uint *r_path_len, uint *r_path_cost, VertNetInfo *vnet_info, BLI_mempool *path_pool) { LinkNode *path; - unsigned int path_cost; + uint path_cost; path = bm_edgenet_path_calc(e, *pass_nr, path_cost_max, r_path_len, &path_cost, @@ -399,8 +399,8 @@ static LinkNode *bm_edgenet_path_calc_best( /* Check every edge to see if any can give a better path. * This avoids very strange/long paths from being created. */ - const unsigned int path_len = *r_path_len; - unsigned int i, i_prev; + const uint path_len = *r_path_len; + uint i, i_prev; BMVert **vert_arr = BLI_array_alloca(vert_arr, path_len); LinkNode *v_lnk; @@ -413,8 +413,8 @@ static LinkNode *bm_edgenet_path_calc_best( BMEdge *e_other = BM_edge_exists(vert_arr[i], vert_arr[i_prev]); if (e_other != e) { LinkNode *path_test; - unsigned int path_len_test; - unsigned int path_cost_test; + uint path_len_test; + uint path_cost_test; path_test = bm_edgenet_path_calc(e_other, *pass_nr, path_cost, &path_len_test, &path_cost_test, @@ -471,8 +471,8 @@ void BM_mesh_edgenet( while (true) { LinkNode *path = NULL; - unsigned int path_len; - unsigned int path_cost; + uint path_len; + uint path_cost; e = bm_edgenet_edge_get_next(bm, &edge_queue, edge_queue_pool); if (e == NULL) { diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.c b/source/blender/bmesh/tools/bmesh_edgesplit.c index a59a5c43c82..3a844a0b8d9 100644 --- a/source/blender/bmesh/tools/bmesh_edgesplit.c +++ b/source/blender/bmesh/tools/bmesh_edgesplit.c @@ -96,7 +96,7 @@ void BM_mesh_edgesplit( BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(e, BM_ELEM_TAG)) { - unsigned int i; + uint i; for (i = 0; i < 2; i++) { BMVert *v = ((&e->v1)[i]); if (BM_elem_flag_test(v, BM_ELEM_TAG)) { diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c index 2cb82d0fc02..b9408492cc1 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.c +++ b/source/blender/bmesh/tools/bmesh_intersect.c @@ -152,7 +152,7 @@ struct ISectState { */ struct LinkBase { LinkNode *list; - unsigned int list_len; + uint list_len; }; static bool ghash_insert_link( @@ -193,7 +193,7 @@ struct vert_sort_t { static void edge_verts_sort(const float co[3], struct LinkBase *v_ls_base) { /* not optimal but list will be typically < 5 */ - unsigned int i; + uint i; struct vert_sort_t *vert_sort = BLI_array_alloca(vert_sort, v_ls_base->list_len); LinkNode *node; @@ -246,8 +246,8 @@ static void face_edges_split( bool use_island_connect, MemArena *mem_arena_edgenet) { - unsigned int i; - unsigned int edge_arr_len = e_ls_base->list_len; + uint i; + uint edge_arr_len = e_ls_base->list_len; BMEdge **edge_arr = BLI_array_alloca(edge_arr, edge_arr_len); LinkNode *node; BLI_assert(f->head.htype == BM_FACE); @@ -263,7 +263,7 @@ static void face_edges_split( #ifdef USE_NET_ISLAND_CONNECT if (use_island_connect) { - unsigned int edge_arr_holes_len; + uint edge_arr_holes_len; BMEdge **edge_arr_holes; if (BM_face_split_edgenet_connect_islands( bm, f, @@ -305,14 +305,14 @@ static enum ISectType intersect_line_tri( const struct ISectEpsilon *e) { float p_dir[3]; - unsigned int i_t0; + uint i_t0; float fac; sub_v3_v3v3(p_dir, p0, p1); normalize_v3(p_dir); for (i_t0 = 0; i_t0 < 3; i_t0++) { - const unsigned int i_t1 = (i_t0 + 1) % 3; + const uint i_t1 = (i_t0 + 1) % 3; float te_dir[3]; sub_v3_v3v3(te_dir, t_cos[i_t0], t_cos[i_t1]); @@ -375,7 +375,7 @@ static BMVert *bm_isect_edge_tri( { BMesh *bm = s->bm; int k_arr[IX_TOT][4]; - unsigned int i; + uint i; const int ti[3] = {UNPACK3_EX(BM_elem_index_get, t, )}; float ix[3]; @@ -470,7 +470,7 @@ static BMVert *bm_isect_edge_tri( } if ((*r_side >= IX_EDGE_TRI_EDGE0) && (*r_side <= IX_EDGE_TRI_EDGE2)) { - i = (unsigned int)(*r_side - IX_EDGE_TRI_EDGE0); + i = (uint)(*r_side - IX_EDGE_TRI_EDGE0); e = BM_edge_exists(t[i], t[(i + 1) % 3]); if (e) { edge_verts_add(s, e, iv, false); @@ -537,7 +537,7 @@ static void bm_isect_tri_tri( const float *f_b_cos[3] = {UNPACK3_EX(, fv_b, ->co)}; float f_a_nor[3]; float f_b_nor[3]; - unsigned int i; + uint i; /* should be enough but may need to bump */ @@ -578,9 +578,9 @@ static void bm_isect_tri_tri( /* first check in any verts are touching * (any case where we wont create new verts) */ - unsigned int i_a; + uint i_a; for (i_a = 0; i_a < 3; i_a++) { - unsigned int i_b; + uint i_b; for (i_b = 0; i_b < 3; i_b++) { if (len_squared_v3v3(fv_a[i_a]->co, fv_b[i_b]->co) <= s->epsilon.eps2x_sq) { #ifdef USE_DUMP @@ -603,12 +603,12 @@ static void bm_isect_tri_tri( /* vert-edge * --------- */ { - unsigned int i_a; + uint i_a; for (i_a = 0; i_a < 3; i_a++) { if (BM_ELEM_API_FLAG_TEST(fv_a[i_a], VERT_VISIT_A) == 0) { - unsigned int i_b_e0; + uint i_b_e0; for (i_b_e0 = 0; i_b_e0 < 3; i_b_e0++) { - unsigned int i_b_e1 = (i_b_e0 + 1) % 3; + uint i_b_e1 = (i_b_e0 + 1) % 3; if (BM_ELEM_API_FLAG_TEST(fv_b[i_b_e0], VERT_VISIT_B) || BM_ELEM_API_FLAG_TEST(fv_b[i_b_e1], VERT_VISIT_B)) @@ -644,12 +644,12 @@ static void bm_isect_tri_tri( } { - unsigned int i_b; + uint i_b; for (i_b = 0; i_b < 3; i_b++) { if (BM_ELEM_API_FLAG_TEST(fv_b[i_b], VERT_VISIT_B) == 0) { - unsigned int i_a_e0; + uint i_a_e0; for (i_a_e0 = 0; i_a_e0 < 3; i_a_e0++) { - unsigned int i_a_e1 = (i_a_e0 + 1) % 3; + uint i_a_e1 = (i_a_e0 + 1) % 3; if (BM_ELEM_API_FLAG_TEST(fv_a[i_a_e0], VERT_VISIT_A) || BM_ELEM_API_FLAG_TEST(fv_a[i_a_e1], VERT_VISIT_A)) @@ -689,7 +689,7 @@ static void bm_isect_tri_tri( { float t_scale[3][3]; - unsigned int i_a; + uint i_a; copy_v3_v3(t_scale[0], fv_b[0]->co); copy_v3_v3(t_scale[1], fv_b[1]->co); @@ -717,7 +717,7 @@ static void bm_isect_tri_tri( { float t_scale[3][3]; - unsigned int i_b; + uint i_b; copy_v3_v3(t_scale[0], fv_a[0]->co); copy_v3_v3(t_scale[1], fv_a[1]->co); @@ -757,8 +757,8 @@ static void bm_isect_tri_tri( /* edge-tri & edge-edge * -------------------- */ { - for (unsigned int i_a_e0 = 0; i_a_e0 < 3; i_a_e0++) { - unsigned int i_a_e1 = (i_a_e0 + 1) % 3; + for (uint i_a_e0 = 0; i_a_e0 < 3; i_a_e0++) { + uint i_a_e1 = (i_a_e0 + 1) % 3; enum ISectType side; BMVert *iv; @@ -778,8 +778,8 @@ static void bm_isect_tri_tri( } } - for (unsigned int i_b_e0 = 0; i_b_e0 < 3; i_b_e0++) { - unsigned int i_b_e1 = (i_b_e0 + 1) % 3; + for (uint i_b_e0 = 0; i_b_e0 < 3; i_b_e0++) { + uint i_b_e1 = (i_b_e0 + 1) % 3; enum ISectType side; BMVert *iv; @@ -956,7 +956,7 @@ static int isect_bvhtree_point_v3( const float *depth_arr = z_buffer.data; float depth_last = depth_arr[0]; - for (unsigned int i = 1; i < z_buffer.count; i++) { + for (uint i = 1; i < z_buffer.count; i++) { if (depth_arr[i] - depth_last > eps) { depth_last = depth_arr[i]; num_isect++; @@ -1000,7 +1000,7 @@ bool BM_mesh_intersect( #ifdef USE_BVH BVHTree *tree_a, *tree_b; - unsigned int tree_overlap_tot; + uint tree_overlap_tot; BVHTreeOverlap *overlap; #else int i_a, i_b; @@ -1117,7 +1117,7 @@ bool BM_mesh_intersect( overlap = BLI_bvhtree_overlap(tree_b, tree_a, &tree_overlap_tot, NULL, NULL); if (overlap) { - unsigned int i; + uint i; for (i = 0; i < tree_overlap_tot; i++) { #ifdef USE_DUMP @@ -1390,7 +1390,7 @@ bool BM_mesh_intersect( GHASH_ITER (gh_iter, s.face_edges) { struct LinkBase *e_ls_base = BLI_ghashIterator_getValue(&gh_iter); LinkNode **node_prev_p; - unsigned int i; + uint i; node_prev_p = &e_ls_base->list; for (i = 0, node = e_ls_base->list; node; i++, node = node->next) { @@ -1455,7 +1455,7 @@ bool BM_mesh_intersect( } { - unsigned int i; + uint i; for (i = 0; i < STACK_SIZE(splice_ls); i++) { if (!BLI_gset_haskey(verts_invalid, splice_ls[i][0]) && !BLI_gset_haskey(verts_invalid, splice_ls[i][1])) @@ -1610,7 +1610,7 @@ bool BM_mesh_intersect( #ifdef USE_BOOLEAN_RAYCAST_DRAW { - unsigned int colors[4] = {0x00000000, 0xffffffff, 0xff000000, 0x0000ff}; + uint colors[4] = {0x00000000, 0xffffffff, 0xff000000, 0x0000ff}; float co_other[3] = {UNPACK3(co)}; co_other[0] += 1000.0f; bl_debug_color_set(colors[(hits & 1) == 1]); diff --git a/source/blender/bmesh/tools/bmesh_path.h b/source/blender/bmesh/tools/bmesh_path.h index b6de5e0e4e0..fbdd2296121 100644 --- a/source/blender/bmesh/tools/bmesh_path.h +++ b/source/blender/bmesh/tools/bmesh_path.h @@ -28,8 +28,8 @@ */ struct BMCalcPathParams { - unsigned int use_topology_distance : 1; - unsigned int use_step_face : 1; + uint use_topology_distance : 1; + uint use_step_face : 1; }; struct LinkNode *BM_mesh_calc_path_vert( diff --git a/source/blender/bmesh/tools/bmesh_region_match.c b/source/blender/bmesh/tools/bmesh_region_match.c index a6860a6614a..2abf8f2c46e 100644 --- a/source/blender/bmesh/tools/bmesh_region_match.c +++ b/source/blender/bmesh/tools/bmesh_region_match.c @@ -114,7 +114,7 @@ typedef struct UUIDWalk { GHash *faces_from_uuid; /* UUID -> UUIDFaceStepItem */ UUID_Int *rehash_store; - unsigned int rehash_store_len; + uint rehash_store_len; } cache; } UUIDWalk; @@ -136,7 +136,7 @@ typedef struct UUIDFaceStepItem { uintptr_t uuid; LinkNode *list; - unsigned int list_len; + uint list_len; } UUIDFaceStepItem; BLI_INLINE bool bm_uuidwalk_face_test( @@ -178,10 +178,10 @@ BLI_INLINE bool bm_uuidwalk_face_lookup( } } -static unsigned int ghashutil_bmelem_indexhash(const void *key) +static uint ghashutil_bmelem_indexhash(const void *key) { const BMElem *ele = key; - return (unsigned int)BM_elem_index_get(ele); + return (uint)BM_elem_index_get(ele); } static bool ghashutil_bmelem_indexcmp(const void *a, const void *b) @@ -192,14 +192,14 @@ static bool ghashutil_bmelem_indexcmp(const void *a, const void *b) static GHash *ghash_bmelem_new_ex( const char *info, - const unsigned int nentries_reserve) + const uint nentries_reserve) { return BLI_ghash_new_ex(ghashutil_bmelem_indexhash, ghashutil_bmelem_indexcmp, info, nentries_reserve); } static GSet *gset_bmelem_new_ex( const char *info, - const unsigned int nentries_reserve) + const uint nentries_reserve) { return BLI_gset_new_ex(ghashutil_bmelem_indexhash, ghashutil_bmelem_indexcmp, info, nentries_reserve); } @@ -218,8 +218,8 @@ static GSet *gset_bmelem_new(const char *info) static void bm_uuidwalk_init( UUIDWalk *uuidwalk, - const unsigned int faces_src_region_len, - const unsigned int verts_src_region_len) + const uint faces_src_region_len, + const uint verts_src_region_len) { BLI_listbase_clear(&uuidwalk->faces_step); @@ -307,7 +307,7 @@ static UUID_Int bm_uuidwalk_calc_vert_uuid( /* vert -> other */ { - unsigned int tot = 0; + uint tot = 0; BMIter eiter; BMEdge *e; BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { @@ -323,7 +323,7 @@ static UUID_Int bm_uuidwalk_calc_vert_uuid( /* faces */ { - unsigned int tot = 0; + uint tot = 0; BMIter iter; BMFace *f; @@ -357,7 +357,7 @@ static UUID_Int bm_uuidwalk_calc_face_uuid( UUID_Int uuid; - uuid = uuidwalk->pass * (unsigned int)f->len * PRIME_FACE_LARGE; + uuid = uuidwalk->pass * (uint)f->len * PRIME_FACE_LARGE; /* face-verts */ { @@ -399,7 +399,7 @@ static UUID_Int bm_uuidwalk_calc_face_uuid( } static void bm_uuidwalk_rehash_reserve( - UUIDWalk *uuidwalk, unsigned int rehash_store_len_new) + UUIDWalk *uuidwalk, uint rehash_store_len_new) { if (UNLIKELY(rehash_store_len_new > uuidwalk->cache.rehash_store_len)) { /* avoid re-allocs */ @@ -419,9 +419,9 @@ static void bm_uuidwalk_rehash( { GHashIterator gh_iter; UUID_Int *uuid_store; - unsigned int i; + uint i; - unsigned int rehash_store_len_new = MAX2(BLI_ghash_size(uuidwalk->verts_uuid), + uint rehash_store_len_new = MAX2(BLI_ghash_size(uuidwalk->verts_uuid), BLI_ghash_size(uuidwalk->faces_uuid)); bm_uuidwalk_rehash_reserve(uuidwalk, rehash_store_len_new); @@ -454,12 +454,12 @@ static void bm_uuidwalk_rehash( static void bm_uuidwalk_rehash_facelinks( UUIDWalk *uuidwalk, - LinkNode *faces, const unsigned int faces_len, + LinkNode *faces, const uint faces_len, const bool is_init) { UUID_Int *uuid_store; LinkNode *f_link; - unsigned int i; + uint i; bm_uuidwalk_rehash_reserve(uuidwalk, faces_len); uuid_store = uuidwalk->cache.rehash_store; @@ -502,7 +502,7 @@ static bool bm_vert_is_uuid_connect( } static void bm_uuidwalk_pass_add( - UUIDWalk *uuidwalk, LinkNode *faces_pass, const unsigned int faces_pass_len) + UUIDWalk *uuidwalk, LinkNode *faces_pass, const uint faces_pass_len) { GHashIterator gh_iter; GHash *verts_uuid_pass; @@ -511,7 +511,7 @@ static void bm_uuidwalk_pass_add( UUIDFaceStep *fstep; - BLI_assert(faces_pass_len == (unsigned int)BLI_linklist_count(faces_pass)); + BLI_assert(faces_pass_len == (uint)BLI_linklist_count(faces_pass)); /* rehash faces now all their verts have been added */ bm_uuidwalk_rehash_facelinks(uuidwalk, faces_pass, faces_pass_len, true); @@ -588,13 +588,13 @@ static int bm_face_len_cmp(const void *v1, const void *v2) else return 0; } -static unsigned int bm_uuidwalk_init_from_edge( +static uint bm_uuidwalk_init_from_edge( UUIDWalk *uuidwalk, BMEdge *e) { BMLoop *l_iter = e->l; - unsigned int f_arr_len = (unsigned int)BM_edge_face_count(e); + uint f_arr_len = (uint)BM_edge_face_count(e); BMFace **f_arr = BLI_array_alloca(f_arr, f_arr_len); - unsigned int fstep_num = 0, i = 0; + uint fstep_num = 0, i = 0; do { BMFace *f = l_iter->f; @@ -619,7 +619,7 @@ static unsigned int bm_uuidwalk_init_from_edge( * elsewhere using LinkNode's makes more sense */ for (i = 0; i < f_arr_len; ) { LinkNode *faces_pass = NULL; - const unsigned int i_init = i; + const uint i_init = i; const int f_len = f_arr[i]->len; do { @@ -750,9 +750,9 @@ static BMFace **bm_mesh_region_match_pair( UUIDWalk *w_src, UUIDWalk *w_dst, #endif BMEdge *e_src, BMEdge *e_dst, - const unsigned int faces_src_region_len, - const unsigned int verts_src_region_len, - unsigned int *r_faces_result_len) + const uint faces_src_region_len, + const uint verts_src_region_len, + uint *r_faces_result_len) { #ifndef USE_WALKER_REUSE UUIDWalk w_src_, w_dst_; @@ -877,8 +877,8 @@ static BMFace **bm_mesh_region_match_pair( if (found) { GHashIterator gh_iter; - const unsigned int faces_result_len = BLI_ghash_size(w_dst->faces_uuid); - unsigned int i; + const uint faces_result_len = BLI_ghash_size(w_dst->faces_uuid); + uint i; faces_result = MEM_mallocN(sizeof(*faces_result) * (faces_result_len + 1), __func__); GHASH_ITER_INDEX (gh_iter, w_dst->faces_uuid, i) { @@ -909,12 +909,12 @@ finally: * Tag as visited, avoid re-use. */ static void bm_face_array_visit( - BMFace **faces, const unsigned int faces_len, - unsigned int *r_verts_len, + BMFace **faces, const uint faces_len, + uint *r_verts_len, bool visit_faces) { - unsigned int verts_len = 0; - unsigned int i; + uint verts_len = 0; + uint i; for (i = 0; i < faces_len; i++) { BMFace *f = faces[i]; BMLoop *l_iter, *l_first; @@ -1081,9 +1081,9 @@ static SUID_Int bm_face_region_vert_pass_id(GHash *gh, BMVert *v) * This is only called once on the source region (no need to be highly optimized). */ static BMEdge *bm_face_region_pivot_edge_find( - BMFace **faces_region, unsigned int faces_region_len, - unsigned int verts_region_len, - unsigned int *r_depth) + BMFace **faces_region, uint faces_region_len, + uint verts_region_len, + uint *r_depth) { /* note, keep deterministic where possible (geometry order independent) * this function assumed all visit faces & edges are tagged */ @@ -1092,7 +1092,7 @@ static BMEdge *bm_face_region_pivot_edge_find( BLI_LINKSTACK_DECLARE(vert_queue_next, BMVert *); GHash *gh = BLI_ghash_ptr_new(__func__); - unsigned int i; + uint i; BMEdge *e_pivot = NULL; /* pick any non-boundary edge (not ideal) */ @@ -1101,7 +1101,7 @@ static BMEdge *bm_face_region_pivot_edge_find( SUID_Int pass = 0; /* total verts in 'gs' we have visited - aka - not v_init_none */ - unsigned int vert_queue_used = 0; + uint vert_queue_used = 0; BLI_LINKSTACK_INIT(vert_queue_prev); BLI_LINKSTACK_INIT(vert_queue_next); @@ -1115,7 +1115,7 @@ static BMEdge *bm_face_region_pivot_edge_find( do { BMEdge *e = l_iter->e; if (bm_edge_is_region_boundary(e)) { - unsigned int j; + uint j; for (j = 0; j < 2; j++) { void **val_p; if (!BLI_ghash_ensure_p(gh, (&e->v1)[j], &val_p)) { @@ -1251,7 +1251,7 @@ static BMEdge *bm_face_region_pivot_edge_find( pass = 0; } - *r_depth = (unsigned int)pass; + *r_depth = (uint)pass; return e_pivot; } @@ -1286,7 +1286,7 @@ static UUIDFashMatch bm_vert_fasthash_single(BMVert *v) e_num += 1; do { f_num += 1; - l_num += (unsigned int)l_iter->f->len; + l_num += (uint)l_iter->f->len; } while ((l_iter = l_iter->radial_next) != e->l); } } @@ -1301,16 +1301,16 @@ static UUIDFashMatch bm_vert_fasthash_single(BMVert *v) } static UUIDFashMatch *bm_vert_fasthash_create( - BMesh *bm, const unsigned int depth) + BMesh *bm, const uint depth) { UUIDFashMatch *id_prev; UUIDFashMatch *id_curr; - unsigned int pass, i; + uint pass, i; BMVert *v; BMIter iter; - id_prev = MEM_mallocN(sizeof(*id_prev) * (unsigned int)bm->totvert, __func__); - id_curr = MEM_mallocN(sizeof(*id_curr) * (unsigned int)bm->totvert, __func__); + id_prev = MEM_mallocN(sizeof(*id_prev) * (uint)bm->totvert, __func__); + id_curr = MEM_mallocN(sizeof(*id_curr) * (uint)bm->totvert, __func__); BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { id_prev[i] = bm_vert_fasthash_single(v); @@ -1319,7 +1319,7 @@ static UUIDFashMatch *bm_vert_fasthash_create( for (pass = 0; pass < depth; pass++) { BMEdge *e; - memcpy(id_curr, id_prev, sizeof(*id_prev) * (unsigned int)bm->totvert); + memcpy(id_curr, id_prev, sizeof(*id_prev) * (uint)bm->totvert); BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BM_edge_is_wire(e) == false) { @@ -1379,16 +1379,16 @@ static void bm_vert_fasthash_destroy( */ int BM_mesh_region_match( BMesh *bm, - BMFace **faces_region, unsigned int faces_region_len, + BMFace **faces_region, uint faces_region_len, ListBase *r_face_regions) { BMEdge *e_src; BMEdge *e_dst; BMIter iter; - unsigned int verts_region_len = 0; - unsigned int faces_result_len = 0; + uint verts_region_len = 0; + uint faces_result_len = 0; /* number of steps from e_src to a boundary vert */ - unsigned int depth; + uint depth; #ifdef USE_WALKER_REUSE @@ -1457,7 +1457,7 @@ int BM_mesh_region_match( BM_ITER_MESH (e_dst, &iter, bm, BM_EDGES_OF_MESH) { BMFace **faces_result; - unsigned int faces_result_len_out; + uint faces_result_len_out; if (BM_elem_flag_test(e_dst, BM_ELEM_TAG) || BM_edge_is_wire(e_dst)) { continue; diff --git a/source/blender/bmesh/tools/bmesh_region_match.h b/source/blender/bmesh/tools/bmesh_region_match.h index edf8369b070..8ef138629b8 100644 --- a/source/blender/bmesh/tools/bmesh_region_match.h +++ b/source/blender/bmesh/tools/bmesh_region_match.h @@ -27,7 +27,7 @@ int BM_mesh_region_match( BMesh *bm, - BMFace **faces_region, unsigned int faces_region_len, + BMFace **faces_region, uint faces_region_len, ListBase *r_face_regions); #endif /* __BMESH_REGION_MATCH_H__ */ diff --git a/source/blender/bmesh/tools/bmesh_separate.c b/source/blender/bmesh/tools/bmesh_separate.c index ff28ed4c156..287b4125330 100644 --- a/source/blender/bmesh/tools/bmesh_separate.c +++ b/source/blender/bmesh/tools/bmesh_separate.c @@ -58,8 +58,8 @@ void BM_mesh_separate_faces( BMFace *f; BMIter iter; - unsigned int faces_a_len = 0; - unsigned int faces_b_len = 0; + uint faces_a_len = 0; + uint faces_b_len = 0; { int i_a = 0; int i_b = bm->totface; @@ -77,7 +77,7 @@ void BM_mesh_separate_faces( BM_mesh_elem_hflag_enable_all(bm, BM_VERT, BM_ELEM_TAG, false); /* Disable vert tag on faces_b */ - for (unsigned int i = 0; i < faces_b_len; i++) { + for (uint i = 0; i < faces_b_len; i++) { BMLoop *l_iter, *l_first; l_iter = l_first = BM_FACE_FIRST_LOOP(faces_b[i]); do { @@ -89,7 +89,7 @@ void BM_mesh_separate_faces( BLI_buffer_declare_static(BMLoop **, loop_split, 0, 128); /* Check shared verts ('faces_a' tag and disable) */ - for (unsigned int i = 0; i < faces_a_len; i++) { + for (uint i = 0; i < faces_a_len; i++) { BMLoop *l_iter, *l_first; l_iter = l_first = BM_FACE_FIRST_LOOP(faces_a[i]); do { -- cgit v1.2.3