[Bf-blender-cvs] [9c782c1] master: Cleanup: hopefully last int->bool one in this area!

Bastien Montagne noreply at git.blender.org
Mon Dec 1 17:13:00 CET 2014


Commit: 9c782c17ba03b3ed61bec1f1e9c73bc5f6522ded
Author: Bastien Montagne
Date:   Mon Dec 1 14:33:38 2014 +0100
Branches: master
https://developer.blender.org/rB9c782c17ba03b3ed61bec1f1e9c73bc5f6522ded

Cleanup: hopefully last int->bool one in this area!

===================================================================

M	source/blender/blenlib/intern/BLI_kdopbvh.c
M	source/blender/blenlib/intern/graph.c
M	source/blender/blenlib/intern/math_geom.c
M	source/blender/blenlib/intern/math_matrix.c
M	source/blender/blenlib/intern/path_util.c
M	source/blender/blenlib/intern/scanfill.c

===================================================================

diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index d28215e..b76b925 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -986,7 +986,7 @@ bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const
 	
 	/* check if index exists */
 	if (index > tree->totleaf)
-		return 0;
+		return false;
 	
 	node = tree->nodearray + index;
 	
@@ -1001,7 +1001,7 @@ bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const
 		node->bv[(2 * axis_iter) + 1] += tree->epsilon; /* maximum */
 	}
 
-	return 1;
+	return true;
 }
 
 /* call BLI_bvhtree_update_node() first for every node/point/triangle */
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index d4d87df..81cc9fd 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -170,11 +170,11 @@ bool BLI_hasAdjacencyList(BGraph *graph)
 	
 	for (node = graph->nodes.first; node; node = node->next) {
 		if (node->arcs == NULL) {
-			return 0;
+			return false;
 		}
 	}
 	
-	return 1;
+	return true;
 }
 
 void BLI_replaceNodeInArc(BGraph *graph, BArc *arc, BNode *node_src, BNode *node_replaced)
@@ -337,7 +337,7 @@ static bool detectCycle(BNode *node, BArc *src_arc)
 		}
 	}
 	else {
-		value = 1;
+		value = true;
 	}
 	
 	return value;
@@ -354,7 +354,7 @@ bool BLI_isGraphCyclic(BGraph *graph)
 	BLI_flagNodes(graph, 0);
 
 	/* detectCycles in subgraphs */
-	for (node = graph->nodes.first; node && value == 0; node = node->next) {
+	for (node = graph->nodes.first; node && value == false; node = node->next) {
 		/* only for nodes in subgraphs that haven't been visited yet */
 		if (node->flag == 0) {
 			value = value || detectCycle(node, NULL);
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 6037345..1c75a90 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -912,12 +912,12 @@ bool isect_point_tri_v2_cw(const float pt[2], const float v1[2], const float v2[
 	if (line_point_side_v2(v1, v2, pt) >= 0.0f) {
 		if (line_point_side_v2(v2, v3, pt) >= 0.0f) {
 			if (line_point_side_v2(v3, v1, pt) >= 0.0f) {
-				return 1;
+				return true;
 			}
 		}
 	}
 
-	return 0;
+	return false;
 }
 
 int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
@@ -983,28 +983,28 @@ bool isect_line_tri_v3(const float p1[3], const float p2[3],
 
 	cross_v3_v3v3(p, d, e2);
 	a = dot_v3v3(e1, p);
-	if (a == 0.0f) return 0;
+	if (a == 0.0f) return false;
 	f = 1.0f / a;
 
 	sub_v3_v3v3(s, p1, v0);
 
 	u = f * dot_v3v3(s, p);
-	if ((u < 0.0f) || (u > 1.0f)) return 0;
+	if ((u < 0.0f) || (u > 1.0f)) return false;
 
 	cross_v3_v3v3(q, s, e1);
 
 	v = f * dot_v3v3(d, q);
-	if ((v < 0.0f) || ((u + v) > 1.0f)) return 0;
+	if ((v < 0.0f) || ((u + v) > 1.0f)) return false;
 
 	*r_lambda = f * dot_v3v3(e2, q);
-	if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return 0;
+	if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return false;
 
 	if (r_uv) {
 		r_uv[0] = u;
 		r_uv[1] = v;
 	}
 
-	return 1;
+	return true;
 }
 
 /* like isect_line_tri_v3, but allows epsilon tolerance around triangle */
@@ -1022,28 +1022,28 @@ bool isect_line_tri_epsilon_v3(const float p1[3], const float p2[3],
 
 	cross_v3_v3v3(p, d, e2);
 	a = dot_v3v3(e1, p);
-	if (a == 0.0f) return 0;
+	if (a == 0.0f) return false;
 	f = 1.0f / a;
 
 	sub_v3_v3v3(s, p1, v0);
 
 	u = f * dot_v3v3(s, p);
-	if ((u < -epsilon) || (u > 1.0f + epsilon)) return 0;
+	if ((u < -epsilon) || (u > 1.0f + epsilon)) return false;
 
 	cross_v3_v3v3(q, s, e1);
 
 	v = f * dot_v3v3(d, q);
-	if ((v < -epsilon) || ((u + v) > 1.0f + epsilon)) return 0;
+	if ((v < -epsilon) || ((u + v) > 1.0f + epsilon)) return false;
 
 	*r_lambda = f * dot_v3v3(e2, q);
-	if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return 0;
+	if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return false;
 
 	if (r_uv) {
 		r_uv[0] = u;
 		r_uv[1] = v;
 	}
 
-	return 1;
+	return true;
 }
 
 /* moved from effect.c
@@ -1064,28 +1064,28 @@ bool isect_ray_tri_v3(const float p1[3], const float d[3],
 	a = dot_v3v3(e1, p);
 	/* note: these values were 0.000001 in 2.4x but for projection snapping on
 	 * a human head (1BU == 1m), subsurf level 2, this gave many errors - campbell */
-	if ((a > -0.00000001f) && (a < 0.00000001f)) return 0;
+	if ((a > -0.00000001f) && (a < 0.00000001f)) return false;
 	f = 1.0f / a;
 
 	sub_v3_v3v3(s, p1, v0);
 
 	u = f * dot_v3v3(s, p);
-	if ((u < 0.0f) || (u > 1.0f)) return 0;
+	if ((u < 0.0f) || (u > 1.0f)) return false;
 
 	cross_v3_v3v3(q, s, e1);
 
 	v = f * dot_v3v3(d, q);
-	if ((v < 0.0f) || ((u + v) > 1.0f)) return 0;
+	if ((v < 0.0f) || ((u + v) > 1.0f)) return false;
 
 	*r_lambda = f * dot_v3v3(e2, q);
-	if ((*r_lambda < 0.0f)) return 0;
+	if ((*r_lambda < 0.0f)) return false;
 
 	if (r_uv) {
 		r_uv[0] = u;
 		r_uv[1] = v;
 	}
 
-	return 1;
+	return true;
 }
 
 /**
@@ -1107,7 +1107,7 @@ bool isect_ray_plane_v3(const float p1[3], const float d[3],
 	a = dot_v3v3(e1, p);
 	/* note: these values were 0.000001 in 2.4x but for projection snapping on
 	 * a human head (1BU == 1m), subsurf level 2, this gave many errors - campbell */
-	if ((a > -0.00000001f) && (a < 0.00000001f)) return 0;
+	if ((a > -0.00000001f) && (a < 0.00000001f)) return false;
 	f = 1.0f / a;
 
 	sub_v3_v3v3(s, p1, v0);
@@ -1119,9 +1119,9 @@ bool isect_ray_plane_v3(const float p1[3], const float d[3],
 	/* v = f * dot_v3v3(d, q); */ /*UNUSED*/
 
 	*r_lambda = f * dot_v3v3(e2, q);
-	if (clip && (*r_lambda < 0.0f)) return 0;
+	if (clip && (*r_lambda < 0.0f)) return false;
 
-	return 1;
+	return true;
 }
 
 bool isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
@@ -1142,22 +1142,22 @@ bool isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
 	sub_v3_v3v3(s, p1, v0);
 
 	u = f * dot_v3v3(s, p);
-	if ((u < -epsilon) || (u > 1.0f + epsilon)) return 0;
+	if ((u < -epsilon) || (u > 1.0f + epsilon)) return false;
 
 	cross_v3_v3v3(q, s, e1);
 
 	v = f * dot_v3v3(d, q);
-	if ((v < -epsilon) || ((u + v) > 1.0f + epsilon)) return 0;
+	if ((v < -epsilon) || ((u + v) > 1.0f + epsilon)) return false;
 
 	*r_lambda = f * dot_v3v3(e2, q);
-	if ((*r_lambda < 0.0f)) return 0;
+	if ((*r_lambda < 0.0f)) return false;
 
 	if (uv) {
 		uv[0] = u;
 		uv[1] = v;
 	}
 
-	return 1;
+	return true;
 }
 
 bool isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
@@ -1173,14 +1173,14 @@ bool isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
 
 	cross_v3_v3v3(p, d, e2);
 	a = dot_v3v3(e1, p);
-	if ((a > -0.000001f) && (a < 0.000001f)) return 0;
+	if ((a > -0.000001f) && (a < 0.000001f)) return false;
 	f = 1.0f / a;
 
 	sub_v3_v3v3(s, p1, v0);
 
 	cross_v3_v3v3(q, s, e1);
 	*r_lambda = f * dot_v3v3(e2, q);
-	if ((*r_lambda < 0.0f)) return 0;
+	if ((*r_lambda < 0.0f)) return false;
 
 	u = f * dot_v3v3(s, p);
 	v = f * dot_v3v3(d, q);
@@ -1204,7 +1204,7 @@ bool isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
 	mul_v3_fl(e2, dv);
 
 	if (len_squared_v3(e1) + len_squared_v3(e2) > threshold * threshold) {
-		return 0;
+		return false;
 	}
 
 	if (r_uv) {
@@ -1212,7 +1212,7 @@ bool isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
 		r_uv[1] = v;
 	}
 
-	return 1;
+	return true;
 }
 
 /**
@@ -1363,7 +1363,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const fl
 		if (t0 > t1)
 			SWAP(float, t0, t1);
 
-		if (t0 > 1.0f || t1 < 0.0f) return 0;
+		if (t0 > 1.0f || t1 < 0.0f) return false;
 
 		/* clamp to [0, 1] */
 		CLAMP(t0, 0.0f, 1.0f);
@@ -1542,7 +1542,7 @@ bool isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3
 	if ((f > -0.000001f) && (f < 0.000001f)) return false;
 
 	v = (p[a2] * e1[a1] - p[a1] * e1[a2]) / f;
-	if ((v < 0.0f) || (v > 1.0f)) return 0;
+	if ((v < 0.0f) || (v > 1.0f)) return false;
 
 	f = e1[a1];
 	if ((f > -0.000001f) && (f < 0.000001f)) {
@@ -1553,7 +1553,7 @@ bool isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3
 	else
 		u = (-p[a1] - v * e2[a1]) / f;
 
-	if ((u < 0.0f) || ((u + v) > 1.0f)) return 0;
+	if ((u < 0.0f) || ((u + v) > 1.0f)) return false;
 
 	*r_lambda = (p[a0] + u * e1[a0] + v * e2[a0]) / (p2[a0] - p1[a0]);
 
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 8f9fcbc..1b4bbaf 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -866,7 +866,7 @@ bool invert_m4_m4(float inverse[4][4], float mat[4][4])
 			}
 		}
 	}
-	return 1;
+	return true;
 }
 
 /****************************** Linear Algebra *******************************/
@@ -1150,11 +1150,11 @@ bool is_orthogonal_m3(float m[3][3])
 	for (i = 0; i < 3; i++) {
 		for (j = 0; j < i; j++) {
 			if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
-				return 0;
+				return false;
 		}
 	}
 
-	return 1;
+	return true;
 }
 
 bool is_orthogonal_m4(float m[4][4])
@@ -1164,12 +1164,12 @@ bool is_orthogonal_m4(float m[4][4])
 	for (i = 0; i < 4; i++) {
 		for (j = 0; j < i; j++) {
 			if (fabsf(dot_v4v4(m[i], m[j])) > 1.5f * FLT_EPSILON)
-				return 0;
+				return false;
 		}
 
 	}
 
-	return 1;
+	return true;
 }
 
 bool is_orthonormal_m3(float m[3][3])
@@ -1179,12 +1179,12 @@ bool is_orthonormal_m3(float m[3][3])
 
 		for (i = 0; i < 3; i++)
 			if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
-				return 0;
+				return false;
 
-		return 1;
+		return true;
 	}
 
-	return 0;
+	return false;
 }
 
 bool is_orthonormal_m4(float m[4][4])
@@ -1194,12 +1194,12 @@ bool is_orthonormal_m4(float m[4][4])
 
 		for (i = 0; i < 4; i++)
 			if (fabsf(dot_v4v4(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
-				return 0;
+				return false;
 
-		return 1;
+		return true;
 	}
 
-	return 0;
+	return false;
 }
 
 bool is_uniform_scaled_m3(float m[3][3])
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index abb6cc3..0a30a35 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list