[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40150] branches/bmesh/blender/source/ blender/bmesh: set some function args to const, no functional change.

Campbell Barton ideasman42 at gmail.com
Mon Sep 12 07:01:39 CEST 2011


Revision: 40150
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40150
Author:   campbellbarton
Date:     2011-09-12 05:01:39 +0000 (Mon, 12 Sep 2011)
Log Message:
-----------
set some function args to const, no functional change.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/bmesh.h
    branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_inline.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh.h	2011-09-12 04:57:20 UTC (rev 40149)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh.h	2011-09-12 05:01:39 UTC (rev 40150)
@@ -127,23 +127,23 @@
 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 @@
 
 /*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

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h	2011-09-12 04:57:20 UTC (rev 40149)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_marking.h	2011-09-12 05:01:39 UTC (rev 40150)
@@ -25,7 +25,7 @@
 /*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);
 

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c	2011-09-12 04:57:20 UTC (rev 40149)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c	2011-09-12 05:01:39 UTC (rev 40150)
@@ -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 @@
 */
 
 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 @@
 }
 
 /*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 @@
 	}
 }
 
-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 @@
 
 /*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 @@
 	
 	/*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)

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_inline.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_inline.c	2011-09-12 04:57:20 UTC (rev 40149)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_inline.c	2011-09-12 05:01:39 UTC (rev 40150)
@@ -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)

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c	2011-09-12 04:57:20 UTC (rev 40149)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c	2011-09-12 05:01:39 UTC (rev 40150)
@@ -333,9 +333,9 @@
 	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);
 }
 

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c	2011-09-12 04:57:20 UTC (rev 40149)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c	2011-09-12 05:01:39 UTC (rev 40150)
@@ -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 @@
 	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 @@
 	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);




More information about the Bf-blender-cvs mailing list