[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41925] branches/bmesh/blender/source/ blender: quiet compiler warnings for BLI_array defines, split BLI_array_append into BLI_array_append / BLI_array_append_r, the latter returning the new array location.

Campbell Barton ideasman42 at gmail.com
Wed Nov 16 18:09:42 CET 2011


Revision: 41925
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41925
Author:   campbellbarton
Date:     2011-11-16 17:09:41 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
quiet compiler warnings for BLI_array defines, split BLI_array_append into BLI_array_append / BLI_array_append_r, the latter returning the new array location.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/BKE_DerivedMesh.h
    branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c
    branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c
    branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c
    branches/bmesh/blender/source/blender/blenlib/BLI_array.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_newcore.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_walkers_impl.c
    branches/bmesh/blender/source/blender/bmesh/operators/connectops.c
    branches/bmesh/blender/source/blender/bmesh/operators/createops.c
    branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c
    branches/bmesh/blender/source/blender/bmesh/operators/edgesplitop.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_select.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
    branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c
    branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/bmesh/blender/source/blender/editors/uvedit/uvedit_ops.c
    branches/bmesh/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
    branches/bmesh/blender/source/blender/modifiers/intern/MOD_array.c

Modified: branches/bmesh/blender/source/blender/blenkernel/BKE_DerivedMesh.h
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/BKE_DerivedMesh.h	2011-11-16 16:50:30 UTC (rev 41924)
+++ branches/bmesh/blender/source/blender/blenkernel/BKE_DerivedMesh.h	2011-11-16 17:09:41 UTC (rev 41925)
@@ -440,13 +440,15 @@
  * freed, see BKE_customdata.h for the different options
  */
 void DM_add_vert_layer(struct DerivedMesh *dm, int type, int alloctype,
-					   void *layer);
+                       void *layer);
 void DM_add_edge_layer(struct DerivedMesh *dm, int type, int alloctype,
-					   void *layer);
+                       void *layer);
 void DM_add_tessface_layer(struct DerivedMesh *dm, int type, int alloctype,
+                           void *layer);
+void DM_add_loop_layer(DerivedMesh *dm, int type, int alloctype,
                        void *layer);
 void DM_add_face_layer(struct DerivedMesh *dm, int type, int alloctype,
-					   void *layer);
+                       void *layer);
 
 /* custom data access functions
  * return pointer to data from first layer which matches type

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c	2011-11-16 16:50:30 UTC (rev 41924)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/DerivedMesh.c	2011-11-16 17:09:41 UTC (rev 41925)
@@ -354,7 +354,7 @@
 {
 	/* dm might depend on me, so we need to do everything with a local copy */
 	Mesh tmp = *me;
-	int totvert, totedge, totface, totloop, totpoly;
+	int totvert, totedge /*, totface */ /* UNUSED */, totloop, totpoly;
 	int did_shapekeys=0;
 	
 	memset(&tmp.vdata, 0, sizeof(tmp.vdata));
@@ -484,7 +484,7 @@
 	CustomData_add_layer(&dm->faceData, type, alloctype, layer, dm->numFaceData);
 }
 
-static void DM_add_loop_layer(DerivedMesh *dm, int type, int alloctype, void *layer)
+void DM_add_loop_layer(DerivedMesh *dm, int type, int alloctype, void *layer)
 {
 	CustomData_add_layer(&dm->loopData, type, alloctype, layer, dm->numLoopData);
 }

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c	2011-11-16 16:50:30 UTC (rev 41924)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/cdderivedmesh.c	2011-11-16 17:09:41 UTC (rev 41925)
@@ -2363,7 +2363,7 @@
 		if (!c)
 			continue;
 		
-		mp2 = BLI_array_append(mpoly, *mp);
+		mp2 = BLI_array_append_r(mpoly, *mp);
 		mp2->totloop = c;
 		mp2->loopstart = BLI_array_count(mloop) - c;
 		
@@ -2509,7 +2509,7 @@
 	EdgeHash *eh = BLI_edgehash_new();
 	int v1, v2;
 	int *eindex;
-	int i, j, k, *index, numEdges = cddm->dm.numEdgeData, maxFaces = dm->numPolyData;
+	int i, j, *index, numEdges = cddm->dm.numEdgeData, maxFaces = dm->numPolyData;
 
 	eindex = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
 
@@ -2531,7 +2531,6 @@
 		}
 	}
 
-	k = numEdges;
 	numEdges = BLI_edgehash_size(eh);
 
 	/* write new edges into a temporary CustomData */

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c	2011-11-16 16:50:30 UTC (rev 41924)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/editderivedbmesh.c	2011-11-16 17:09:41 UTC (rev 41925)
@@ -399,8 +399,6 @@
 	int i;
 	
 	if (bmdm->vertexCos) {
-		BMVert *eve;
-		BMIter viter;
 
 		BM_ElemIndex_Ensure(bmdm->tc->bm, BM_VERT);
 
@@ -563,7 +561,6 @@
 static void bmDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no), void *userData)
 {
 	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
-	BMVert *eve;
 	BMFace *efa;
 	BMIter iter;
 	float cent[3];
@@ -588,7 +585,6 @@
 {
 	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 	BMFace *efa;
-	BMIter iter;
 	int i, draw;
 
 	const int skip_normals= !glIsEnabled(GL_LIGHTING); /* could be passed as an arg */
@@ -773,8 +769,6 @@
 	float (*vertexCos)[3]= bmdm->vertexCos;
 	float (*vertexNos)[3]= bmdm->vertexNos;
 	BMFace *efa;
-	BMVert *eve;
-	BMIter iter;
 	MLoopUV *luv[3], dummyluv = {{0}};
 	MLoopCol *lcol[3], dummylcol = {0};
 	int i, has_vcol = CustomData_has_layer(&bm->ldata, CD_MLOOPCOL);
@@ -978,9 +972,7 @@
 	BMEditMesh *em = bmdm->tc;
 	float (*vertexCos)[3]= bmdm->vertexCos;
 	float (*vertexNos)[3]= bmdm->vertexNos;
-	BMVert *eve;
 	BMFace *efa;
-	BMIter iter;
 	BMLoop **ltri;
 	DMVertexAttribs attribs;
 	GPUVertexAttribs gattribs;
@@ -1104,13 +1096,11 @@
 	BMEditMesh *em = bmdm->tc;
 	float (*vertexCos)[3]= bmdm->vertexCos;
 	float (*vertexNos)[3]= bmdm->vertexNos;
-	BMVert *eve;
 	BMFace *efa;
-	BMIter iter;
 	BMLoop **ltri;
 	DMVertexAttribs attribs= {{{0}}};
 	GPUVertexAttribs gattribs;
-	int i, b, matnr, new_matnr, dodraw;
+	int i, b, matnr, new_matnr;
 
 	matnr = -1;
 
@@ -1368,7 +1358,6 @@
 	BMesh *bm = ((EditDerivedBMesh *)dm)->tc->bm;
 	BMEdge *ee;
 	BMIter iter;
-	BMVert *ev;
 	int has_bweight = CustomData_has_layer(&bm->edata, CD_BWEIGHT);
 	int has_crease = CustomData_has_layer(&bm->edata, CD_CREASE);
 
@@ -1396,12 +1385,10 @@
 	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
 	BMesh *bm = ((EditDerivedBMesh *)dm)->tc->bm;
 	BMFace *ef;
-	BMVert *ev;
-	BMIter iter;
 	BMLoop **l;
 	int i;
 
-	BM_ElemIndex_Ensure(bmdm->tc->bm, BM_VERT);
+	BM_ElemIndex_Ensure(bm, BM_VERT);
 
 	for (i=0; i<bmdm->tc->tottri; i++, face_r++) {
 		l = bmdm->tc->looptris[i];

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c	2011-11-16 16:50:30 UTC (rev 41924)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c	2011-11-16 17:09:41 UTC (rev 41925)
@@ -117,7 +117,7 @@
 		case MESHCMP_VERTCOMISMATCH:
 					return "Vertex Coordinate Mismatch";
 		case MESHCMP_CDLAYERS_MISMATCH:
-					"CustomData Layer Count Mismatch";
+					return "CustomData Layer Count Mismatch";
 		default:
 				return "Mesh Comparison Code Unknown";
 		}

Modified: branches/bmesh/blender/source/blender/blenlib/BLI_array.h
===================================================================
--- branches/bmesh/blender/source/blender/blenlib/BLI_array.h	2011-11-16 16:50:30 UTC (rev 41924)
+++ branches/bmesh/blender/source/blender/blenlib/BLI_array.h	2011-11-16 17:09:41 UTC (rev 41925)
@@ -120,15 +120,20 @@
 )
 
 
+/* appends an item to the array. */
+#define BLI_array_append(arr, item)  (                                        \
+	(void) BLI_array_growone(arr),                                            \
+	(void) (arr[_##arr##_count-1] = item)                                     \
+)
+
 /* appends an item to the array and returns a pointer to the item in the array.
  * item is not a pointer, but actual data value.*/
-#define BLI_array_append(arr, item)  (                                        \
-	BLI_array_growone(arr),                                                   \
-	(arr[_##arr##_count-1] = item),                                           \
-	(arr+(_##arr##_count-1))                                                  \
+#define BLI_array_append_r(arr, item)  (                                      \
+	(void) BLI_array_growone(arr),                                            \
+	(void) (arr[_##arr##_count-1] = item),                                    \
+	(&arr[_##arr##_count-1])                                                  \
 )
 
-
 /* grow an array by a specified number of items. */
 /* TODO, this could be done in a less crappy way by not looping - campbell */
 #define BLI_array_growitems(arr, num)                                         \

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c	2011-11-16 16:50:30 UTC (rev 41924)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c	2011-11-16 17:09:41 UTC (rev 41925)
@@ -265,7 +265,7 @@
 	BMFace *f = NULL;
 	BMEdge *e;
 	BMVert *ev1, *ev2;
-	int overlap = 0, i, /* j,*/ v1found, reverse;
+	int i, /* j,*/ v1found, reverse;
 
 	/*this code is hideous, yeek.  I'll have to think about ways of
 	  cleaning it up.  basically, it now combines the old BM_Make_Ngon

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c	2011-11-16 16:50:30 UTC (rev 41924)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c	2011-11-16 17:09:41 UTC (rev 41925)
@@ -82,7 +82,7 @@
 */
 
 
-static void BM_Data_Vert_Average(BMesh *UNUSED(bm), BMFace *UNUSED(f))
+static void UNUSED_FUNCTION(BM_Data_Vert_Average)(BMesh *UNUSED(bm), BMFace *UNUSED(f))
 {
 	// BMIter iter;
 }
@@ -244,7 +244,7 @@
 }
 
 /* point closest to v1 on line v2-v3 in 3D */
-static void closest_to_line_segment_v3_d(double *closest, double v1[3], double v2[3], double v3[3])
+static void UNUSED_FUNCTION(closest_to_line_segment_v3_d)(double *closest, double v1[3], double v2[3], double v3[3])
 {
 	double lambda, cp[3];
 
@@ -259,12 +259,12 @@
 	}
 }
 
-static double len_v3_d(const double a[3])
+static double UNUSED_FUNCTION(len_v3_d)(const double a[3])
 {
 	return sqrt(INPR(a, a));
 }
 
-static double len_v3v3_d(const double a[3], const double b[3])
+static double UNUSED_FUNCTION(len_v3v3_d)(const double a[3], const double b[3])
 {
 	double d[3];
 
@@ -279,14 +279,14 @@
 	cent[2]= 0.25*(v1[2]+v2[2]+v3[2]+v4[2]);
 }
 
-static void cent_tri_v3_d(double *cent, double *v1, double *v2, double *v3)
+static void UNUSED_FUNCTION(cent_tri_v3_d)(double *cent, double *v1, double *v2, double *v3)
 {
 	cent[0]= 0.33333*(v1[0]+v2[0]+v3[0]);
 	cent[1]= 0.33333*(v1[1]+v2[1]+v3[1]);
 	cent[2]= 0.33333*(v1[2]+v2[2]+v3[2]);
 }
 
-static void cross_v3_v3v3_d(double r[3], const double a[3], const double b[3])
+static void UNUSED_FUNCTION(cross_v3_v3v3_d)(double r[3], const double a[3], const double b[3])
 {
 	r[0]= a[1]*b[2] - a[2]*b[1];
 	r[1]= a[2]*b[0] - a[0]*b[2];
@@ -294,7 +294,7 @@
 }
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list