From 4f7fe766176363b299c78937c491c969971f903d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 12 Sep 2011 05:01:39 +0000 Subject: [PATCH] set some function args to const, no functional change. --- source/blender/bmesh/bmesh.h | 12 ++++----- source/blender/bmesh/bmesh_marking.h | 2 +- source/blender/bmesh/intern/bmesh_construct.c | 27 ++++++++++--------- source/blender/bmesh/intern/bmesh_inline.c | 5 ++-- source/blender/bmesh/intern/bmesh_marking.c | 4 +-- source/blender/bmesh/intern/bmesh_newcore.c | 6 ++--- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index f45dc416f4d..87a9298571e 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -127,23 +127,23 @@ void BM_Free_Mesh_Data ( BMesh *bm ); void BM_Compute_Normals ( struct BMesh *bm ); /*Construction*/ -struct BMVert *BM_Make_Vert ( struct BMesh *bm, float co[3], struct BMVert *example ); -struct BMEdge *BM_Make_Edge ( struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, struct BMEdge *example, int nodouble ); -struct BMFace *BM_Make_Quadtriangle ( struct BMesh *bm, struct BMVert **verts, BMEdge **edges, int len, struct BMFace *example, int nodouble ); +struct BMVert *BM_Make_Vert ( struct BMesh *bm, float co[3], const struct BMVert *example ); +struct BMEdge *BM_Make_Edge ( struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, const struct BMEdge *example, int nodouble ); +struct BMFace *BM_Make_Quadtriangle ( struct BMesh *bm, struct BMVert **verts, BMEdge **edges, int len, const struct BMFace *example, int nodouble ); BMFace *BM_Make_Face(BMesh *bm, BMVert **verts, BMEdge **edges, int len); /*more easier to use version of BM_Make_Quadtriangle. creates edges if necassary.*/ BMFace *BM_Make_QuadTri ( BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, - BMVert *v4, BMFace *example, int nodouble ); + BMVert *v4, const BMFace *example, int nodouble ); /*makes an ngon from an unordered list of edges. v1 and v2 must be the verts defining edges[0], and define the winding of the new face.*/ struct BMFace *BM_Make_Ngon ( struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, struct BMEdge **edges, int len, int nodouble ); /*stuff for dealing with header flags*/ -BM_INLINE int BM_TestHFlag(void *element, const int flag); +BM_INLINE int BM_TestHFlag(const void *element, const int flag); /*stuff for dealing with header flags*/ BM_INLINE void BM_SetHFlag(void *element, const int flag); @@ -162,7 +162,7 @@ void BM_Face_CopyShared ( BMesh *bm, BMFace *f ); /*copies attributes, e.g. customdata, header flags, etc, from one element to another of the same type.*/ -void BM_Copy_Attributes ( struct BMesh *source_mesh, struct BMesh *target_mesh, void *source, void *target ); +void BM_Copy_Attributes ( struct BMesh *source_mesh, struct BMesh *target_mesh, const void *source, void *target ); /*Modification*/ /*join two adjacent faces together along an edge. note that diff --git a/source/blender/bmesh/bmesh_marking.h b/source/blender/bmesh/bmesh_marking.h index 1d80b297222..bf77ac53968 100644 --- a/source/blender/bmesh/bmesh_marking.h +++ b/source/blender/bmesh/bmesh_marking.h @@ -25,7 +25,7 @@ void BM_Select(struct BMesh *bm, void *element, int select); /*I don't use this function anywhere, been using BM_TestHFlag instead. Need to decide either to keep it and convert everything over, or chuck it.*/ -int BM_Selected(BMesh *bm, void *element); +int BM_Selected(BMesh *bm, const void *element); void BM_clear_flag_all(BMesh *bm, int flag); diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index 56b3f62d86a..b3ed3bb10b6 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -55,7 +55,7 @@ /*prototypes*/ static void bm_copy_loop_attributes(BMesh *source_mesh, BMesh *target_mesh, - BMLoop *source_loop, BMLoop *target_loop); + const BMLoop *source_loop, BMLoop *target_loop); #if 0 /* @@ -137,7 +137,7 @@ BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge *example, int nod */ BMFace *BM_Make_QuadTri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, - BMVert *v4, BMFace *example, int nodouble) + BMVert *v4, const BMFace *example, int nodouble) { BMEdge *edar[4]; BMVert *vtar[4]; @@ -162,7 +162,7 @@ BMFace *BM_Make_QuadTri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, } /*remove the edge array bits from this. Its not really needed?*/ -BMFace *BM_Make_Quadtriangle(BMesh *bm, BMVert **verts, BMEdge **edges, int len, BMFace *example, int nodouble) +BMFace *BM_Make_Quadtriangle(BMesh *bm, BMVert **verts, BMEdge **edges, int len, const BMFace *example, int nodouble) { BMEdge *edar[4]; BMFace *f = NULL; @@ -411,23 +411,23 @@ void BM_remove_tagged_verts(BMesh *bm, int flag) } } -static void bm_copy_vert_attributes(BMesh *source_mesh, BMesh *target_mesh, BMVert *source_vertex, BMVert *target_vertex) +static void bm_copy_vert_attributes(BMesh *source_mesh, BMesh *target_mesh, const BMVert *source_vertex, BMVert *target_vertex) { copy_v3_v3(target_vertex->no, source_vertex->no); CustomData_bmesh_copy_data(&source_mesh->vdata, &target_mesh->vdata, source_vertex->head.data, &target_vertex->head.data); } -static void bm_copy_edge_attributes(BMesh *source_mesh, BMesh *target_mesh, BMEdge *source_edge, BMEdge *target_edge) +static void bm_copy_edge_attributes(BMesh *source_mesh, BMesh *target_mesh, const BMEdge *source_edge, BMEdge *target_edge) { CustomData_bmesh_copy_data(&source_mesh->edata, &target_mesh->edata, source_edge->head.data, &target_edge->head.data); } -static void bm_copy_loop_attributes(BMesh *source_mesh, BMesh *target_mesh, BMLoop *source_loop, BMLoop *target_loop) +static void bm_copy_loop_attributes(BMesh *source_mesh, BMesh *target_mesh, const BMLoop *source_loop, BMLoop *target_loop) { CustomData_bmesh_copy_data(&source_mesh->ldata, &target_mesh->ldata, source_loop->head.data, &target_loop->head.data); } -static void bm_copy_face_attributes(BMesh *source_mesh, BMesh *target_mesh, BMFace *source_face, BMFace *target_face) +static void bm_copy_face_attributes(BMesh *source_mesh, BMesh *target_mesh, const BMFace *source_face, BMFace *target_face) { copy_v3_v3(target_face->no, source_face->no); CustomData_bmesh_copy_data(&source_mesh->pdata, &target_mesh->pdata, source_face->head.data, &target_face->head.data); @@ -436,9 +436,10 @@ static void bm_copy_face_attributes(BMesh *source_mesh, BMesh *target_mesh, BMFa /*BMESH_TODO: Special handling for hide flags?*/ -void BM_Copy_Attributes(BMesh *source_mesh, BMesh *target_mesh, void *source, void *target) +void BM_Copy_Attributes(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target) { - BMHeader *sheader = source, *theader = target; + const BMHeader *sheader = source; + BMHeader *theader = target; if(sheader->type != theader->type) return; @@ -451,13 +452,13 @@ void BM_Copy_Attributes(BMesh *source_mesh, BMesh *target_mesh, void *source, vo /*Copy specific attributes*/ if(theader->type == BM_VERT) - bm_copy_vert_attributes(source_mesh, target_mesh, (BMVert*)source, (BMVert*)target); + bm_copy_vert_attributes(source_mesh, target_mesh, (const BMVert*)source, (BMVert*)target); else if(theader->type == BM_EDGE) - bm_copy_edge_attributes(source_mesh, target_mesh, (BMEdge*)source, (BMEdge*)target); + bm_copy_edge_attributes(source_mesh, target_mesh, (const BMEdge*)source, (BMEdge*)target); else if(theader->type == BM_LOOP) - bm_copy_loop_attributes(source_mesh, target_mesh, (BMLoop*)source, (BMLoop*)target); + bm_copy_loop_attributes(source_mesh, target_mesh, (const BMLoop*)source, (BMLoop*)target); else if(theader->type == BM_FACE) - bm_copy_face_attributes(source_mesh, target_mesh, (BMFace*)source, (BMFace*)target); + bm_copy_face_attributes(source_mesh, target_mesh, (const BMFace*)source, (BMFace*)target); } BMesh *BM_Copy_Mesh(BMesh *bmold) diff --git a/source/blender/bmesh/intern/bmesh_inline.c b/source/blender/bmesh/intern/bmesh_inline.c index c9364758a2e..4a549248710 100644 --- a/source/blender/bmesh/intern/bmesh_inline.c +++ b/source/blender/bmesh/intern/bmesh_inline.c @@ -3,10 +3,9 @@ #include "bmesh.h" -BM_INLINE int BM_TestHFlag(void *element, const int flag) +BM_INLINE int BM_TestHFlag(const void *element, const int flag) { - BMHeader *e = element; - return e->flag & flag; + return ((const BMHeader *)element)->flag & flag; } BM_INLINE void BM_SetHFlag(void *element, const int flag) diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index bb964bdcf13..32e9c310544 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -333,9 +333,9 @@ void BM_Select(struct BMesh *bm, void *element, int select) else if(head->type == BM_FACE) BM_Select_Face(bm, (BMFace*)element, select); } -int BM_Selected(BMesh *UNUSED(bm), void *element) +int BM_Selected(BMesh *UNUSED(bm), const void *element) { - BMHeader *head = element; + const BMHeader *head = element; return BM_TestHFlag(head, BM_SELECT); } diff --git a/source/blender/bmesh/intern/bmesh_newcore.c b/source/blender/bmesh/intern/bmesh_newcore.c index 7dff6fe3807..3ce8cb7fb62 100644 --- a/source/blender/bmesh/intern/bmesh_newcore.c +++ b/source/blender/bmesh/intern/bmesh_newcore.c @@ -19,7 +19,7 @@ #include "bmesh_iterators.h" #include "bmesh_private.h" -BMVert *BM_Make_Vert(BMesh *bm, float co[3], struct BMVert *example) { +BMVert *BM_Make_Vert(BMesh *bm, float co[3], const struct BMVert *example) { BMVert *v = BLI_mempool_calloc(bm->vpool); bm->totvert += 1; @@ -66,7 +66,7 @@ BMEdge *BM_Edge_Exist(BMVert *v1, BMVert *v2) return NULL; } -BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge *example, int nodouble) { +BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble) { BMEdge *e; if (nodouble && (e=(BMEdge*)BM_Edge_Exist(v1, v2))) @@ -96,7 +96,7 @@ BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge *example, int nod return (BMEdge*) e; } -static BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, BMLoop *example){ +static BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, const BMLoop *example){ BMLoop *l=NULL; l = BLI_mempool_calloc(bm->lpool);