Code cleanup: use 'const' for arrays (bmesh)
authorCampbell Barton <ideasman42@gmail.com>
Sat, 26 Apr 2014 14:23:36 +0000 (00:23 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 26 Apr 2014 14:25:16 +0000 (00:25 +1000)
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_edgeloop.c
source/blender/bmesh/intern/bmesh_interp.c
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/operators/bmo_connect_nonplanar.c
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_similar.c
source/blender/bmesh/operators/bmo_subdivide.c
source/blender/bmesh/tools/bmesh_bevel.c
source/blender/bmesh/tools/bmesh_decimate_collapse.c

index 109f964a5f920c6e13dc1c57a97861db72221598..eef1e7bbb4fdb70169a415b7956f35364f169993 100644 (file)
@@ -388,7 +388,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len,
 
        float cent[3], nor[3];
 
-       float *far = NULL, *far_cross = NULL;
+       const float *far = NULL, *far_cross = NULL;
 
        float far_vec[3];
        float far_cross_vec[3];
index 08c405f956929a5267ce574869ff85262c74bf6a..82c9f6234c09fbf004dd734f6288ad3c63532197 100644 (file)
@@ -544,9 +544,9 @@ void BM_edgeloop_calc_center(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
        LinkData *node_first = el_store->verts.first;
        LinkData *node_next = node_first;
 
-       float const *v_prev = NODE_AS_CO(node_prev);
-       float const *v_curr = NODE_AS_CO(node_curr);
-       float const *v_next = NODE_AS_CO(node_next);
+       const float const *v_prev = NODE_AS_CO(node_prev);
+       const float const *v_curr = NODE_AS_CO(node_curr);
+       const float const *v_next = NODE_AS_CO(node_next);
 
        float totw = 0.0f;
        float w_prev;
@@ -582,8 +582,8 @@ void BM_edgeloop_calc_center(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
 bool BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
 {
        LinkData *node_curr = el_store->verts.first;
-       float const *v_prev = NODE_AS_CO(el_store->verts.last);
-       float const *v_curr = NODE_AS_CO(node_curr);
+       const float const *v_prev = NODE_AS_CO(el_store->verts.last);
+       const float const *v_curr = NODE_AS_CO(node_curr);
 
        zero_v3(el_store->no);
 
@@ -619,8 +619,8 @@ bool BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
 bool BM_edgeloop_calc_normal_aligned(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store, const float no_align[3])
 {
        LinkData *node_curr = el_store->verts.first;
-       float const *v_prev = NODE_AS_CO(el_store->verts.last);
-       float const *v_curr = NODE_AS_CO(node_curr);
+       const float const *v_prev = NODE_AS_CO(el_store->verts.last);
+       const float const *v_curr = NODE_AS_CO(node_curr);
 
        zero_v3(el_store->no);
 
index 5bd1a72b5a2ccd818efecaa00535d7fbd4f110c7..1a1b3991aac5cf90705ed0db14c39bd5658e06f8 100644 (file)
@@ -884,7 +884,7 @@ void BM_data_layer_copy(BMesh *bm, CustomData *data, int type, int src_n, int ds
 
 float BM_elem_float_data_get(CustomData *cd, void *element, int type)
 {
-       float *f = CustomData_bmesh_get(cd, ((BMHeader *)element)->data, type);
+       const float *f = CustomData_bmesh_get(cd, ((BMHeader *)element)->data, type);
        return f ? *f : 0.0f;
 }
 
index a2cfdc41281782d3b77d431f46ac83dac6bbed31..06c32d3ead2c7b84f547a19883947707db452a6b 100644 (file)
@@ -78,8 +78,8 @@ static void bm_face_calc_poly_normal(const BMFace *f, float n[3])
 {
        BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
        BMLoop *l_iter  = l_first;
-       float const *v_prev = l_first->prev->v->co;
-       float const *v_curr = l_first->v->co;
+       const float const *v_prev = l_first->prev->v->co;
+       const float const *v_curr = l_first->v->co;
 
        zero_v3(n);
 
@@ -109,8 +109,8 @@ static void bm_face_calc_poly_normal_vertex_cos(BMFace *f, float r_no[3],
 {
        BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
        BMLoop *l_iter  = l_first;
-       float const *v_prev = vertexCos[BM_elem_index_get(l_first->prev->v)];
-       float const *v_curr = vertexCos[BM_elem_index_get(l_first->v)];
+       const float const *v_prev = vertexCos[BM_elem_index_get(l_first->prev->v)];
+       const float const *v_curr = vertexCos[BM_elem_index_get(l_first->v)];
 
        zero_v3(r_no);
 
index 334647fc68c680404b7e2b4d37e94391d5cb644b..f30f16629b27dd3309f9f4ab10a300dbb4ab5554 100644 (file)
@@ -43,7 +43,7 @@
  */
 static bool bm_face_subset_calc_normal(BMLoop *l_first, BMLoop *l_last, float r_no[3])
 {
-       float const *v_prev, *v_curr;
+       const float const *v_prev, *v_curr;
 
        /* Newell's Method */
        BMLoop *l_iter = l_first;
index 5e2e057c5b6abbc23560272f62191ed45ce7e3d2..cb4255d337e06884b15da8966fb2ab8ef34651bb 100644 (file)
@@ -948,7 +948,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
                        zero_v3(es->e_new->v2->no);
                }
                for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
-                       float *no = es->l->f->no;
+                       const float *no = es->l->f->no;
                        add_v3_v3(es->e_new->v1->no, no);
                        add_v3_v3(es->e_new->v2->no, no);
                }
index 2d6ceb23f37f8c7c0f2462c365c53cf43da416ad..f779828a00dc66e6ca321146f646c2358ad9b143 100644 (file)
@@ -438,7 +438,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
 
                                        case SIMEDGE_CREASE:
                                                {
-                                                       float *c1, *c2;
+                                                       const float *c1, *c2;
 
                                                        c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_CREASE);
                                                        c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_CREASE);
@@ -453,7 +453,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
 
                                        case SIMEDGE_BEVEL:
                                                {
-                                                       float *c1, *c2;
+                                                       const float *c1, *c2;
 
                                                        c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_BWEIGHT);
                                                        c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_BWEIGHT);
index 1e93340d8a35896937b54c04241ac9691f5f3930..e0c86564db4f0965c645bf1d120a1591e4bdf03f 100644 (file)
@@ -1002,7 +1002,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 
        /* copy original-geometry displacements to current coordinates */
        BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
-               float *co = BM_ELEM_CD_GET_VOID_P(v, params.shape_info.cd_vert_shape_offset_tmp);
+               const float *co = BM_ELEM_CD_GET_VOID_P(v, params.shape_info.cd_vert_shape_offset_tmp);
                copy_v3_v3(v->co, co);
        }
 
@@ -1147,7 +1147,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
 
        /* copy original-geometry displacements to current coordinates */
        BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
-               float *co = BM_ELEM_CD_GET_VOID_P(v, params.shape_info.cd_vert_shape_offset_tmp);
+               const float *co = BM_ELEM_CD_GET_VOID_P(v, params.shape_info.cd_vert_shape_offset_tmp);
                copy_v3_v3(v->co, co);
        }
 
index d781f9c3572dc23561dfe08ec87744060213afea..867109ae5c2ac07c70efeb30c064260666b2c11d 100644 (file)
@@ -1197,7 +1197,7 @@ static void get_profile_point(BevelParams *bp, const Profile *pro, int i, int n,
 static void calculate_profile(BevelParams *bp, BoundVert *bndv)
 {
        int i, k, ns;
-       float *uvals;
+       const float *uvals;
        float co[3], co2[3], p[3], m[4][4];
        float *prof_co, *prof_co_k;
        float r;
index 1e9d8e9ee9d610dfd398477280a07b5a1d51f6af..a1994199fe7d8fefd2a0e90ef04e1f22f6e41da5 100644 (file)
@@ -146,8 +146,8 @@ static bool bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_
 
                BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
                        if (l->e != e && l->prev->e != e) {
-                               float *co_prev = l->prev->v->co;
-                               float *co_next = l->next->v->co;
+                               const float *co_prev = l->prev->v->co;
+                               const float *co_next = l->next->v->co;
                                float cross_exist[3];
                                float cross_optim[3];