[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52017] trunk/blender: code cleanup: double promotion warnings with new bevel code & wrong use of NULL in cycles .

Campbell Barton ideasman42 at gmail.com
Fri Nov 9 04:08:06 CET 2012


Revision: 52017
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52017
Author:   campbellbarton
Date:     2012-11-09 03:08:02 +0000 (Fri, 09 Nov 2012)
Log Message:
-----------
code cleanup: double promotion warnings with new bevel code & wrong use of NULL in cycles.

Modified Paths:
--------------
    trunk/blender/intern/cycles/blender/blender_util.h
    trunk/blender/source/blender/bmesh/operators/bmo_bevel.c

Modified: trunk/blender/intern/cycles/blender/blender_util.h
===================================================================
--- trunk/blender/intern/cycles/blender/blender_util.h	2012-11-08 19:50:25 UTC (rev 52016)
+++ trunk/blender/intern/cycles/blender/blender_util.h	2012-11-09 03:08:02 UTC (rev 52017)
@@ -287,7 +287,7 @@
 	bool is_used(const K& key)
 	{
 		T *data = find(key);
-		return (data)? used_set.find(data) != used_set.end(): NULL;
+		return (data) ? used_set.find(data) != used_set.end() : false;
 	}
 
 	void used(T *data)

Modified: trunk/blender/source/blender/bmesh/operators/bmo_bevel.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_bevel.c	2012-11-08 19:50:25 UTC (rev 52016)
+++ trunk/blender/source/blender/bmesh/operators/bmo_bevel.c	2012-11-09 03:08:02 UTC (rev 52017)
@@ -430,7 +430,7 @@
 	len = len_v3(dir);
 	normalize_v3(dir);
 	if (d > len)
-		d = len - 50 * BEVEL_EPSILON;
+		d = len - (float)(50 * BEVEL_EPSILON);
 	copy_v3_v3(slideco, v->co);
 	madd_v3_v3fl(slideco, dir, -d);
 }
@@ -481,17 +481,17 @@
 	nx = b2[0] - b1[0];
 	ny = b2[1] - b1[1];
 
-	s = ((b1[1] - a1[1]) / my + (a1[0] - b1[0]) / mx) / (nx / mx - ny / my);
-	t = (b1[0] - a1[0] + s * nx) / mx;
+	s = ((double)(b1[1] - a1[1]) / my + (double)(a1[0] - b1[0]) / mx) / (nx / mx - ny / my);
+	t = ((double)(b1[0] - a1[0]) + s * nx) / mx;
 
 
-	z1 = a1[2] + t * (a2[2] - a1[2]);
-	z2 = b1[2] + s * (b2[2] - b1[2]);
+	z1 = (double)a1[2] + t * (double)(a2[2] - a1[2]);
+	z2 = (double)b1[2] + s * (double)(b2[2] - b1[2]);
 
 	if (fabs(z1 - z2) < BEVEL_EPSILON) {
 		flag = 1;
-		r[0] = a1[0]  + t * mx;
-		r[1] = a1[1]  + t * my;
+		r[0] = (double)a1[0] + t * mx;
+		r[1] = (double)a1[1] + t * my;
 		r[2] = z1;
 	}
 	else
@@ -510,11 +510,11 @@
 static void find_intersection_point_plane(float r[3], float p1[3], float p2[3], float p3[3],
                                           float a[3], float m[3])
 {
+	const double null = 1e-20;
 	float P[3], N[3], A[3], M[3];
 	float vv1[3], vv2[3];
 	double t;
 	double C, D, E;
-	float null = 1e-20;
 
 
 	/* calculation of the normal to the surface */
@@ -549,9 +549,9 @@
 		else
 			t = (C - D) / E;
 
-		r[0] = m[0] + t * a[0];
-		r[1] = m[1] + t * a[1];
-		r[2] = m[2] + t * a[2];
+		r[0] = (double)m[0] + t * (double)a[0];
+		r[1] = (double)m[1] + t * (double)a[1];
+		r[2] = (double)m[2] + t * (double)a[2];
 	}
 
 }
@@ -579,7 +579,7 @@
 
 	add_v3_v3v3(center, vva, vvb);
 	normalize_v3(center);
-	mul_v3_fl(center, offset * (1.0 / cos(0.5 * angle)));
+	mul_v3_fl(center, offset * (1.0f / cosf(0.5f * angle)));
 	add_v3_v3(center, v);           /* coordinates of the center of the inscribed circle */
 
 
@@ -622,7 +622,7 @@
 	else
 		sub_v3_v3v3(dir, e->e->v2->co, e->e->v1->co);
 	normalize_v3(dir);
-	if (fabs(angle_v3v3(vva, vvb) - M_PI) > BEVEL_EPSILON) {
+	if (fabsf(angle_v3v3(vva, vvb) - (float)M_PI) > (float)BEVEL_EPSILON) {
 		copy_v3_v3(vaadj, va);
 		madd_v3_v3fl(vaadj, dir, -len_v3(vva) * cosf(angle_v3v3(vva, dir)));
 		copy_v3_v3(vbadj, vb);




More information about the Bf-blender-cvs mailing list