[Bf-blender-cvs] [e159ec8bc18] blender2.8: Cleanup: compiler warnings, use const

Campbell Barton noreply at git.blender.org
Mon May 14 23:13:14 CEST 2018


Commit: e159ec8bc1871da8766b319fcda5c76eff1c0a48
Author: Campbell Barton
Date:   Mon May 14 23:12:51 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe159ec8bc1871da8766b319fcda5c76eff1c0a48

Cleanup: compiler warnings, use const

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

M	source/blender/blenlib/BLI_kdopbvh.h
M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/math_vector_inline.c
M	source/blender/editors/transform/transform_snap_object.c

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

diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index cef525d0592..76c3b6ef3fd 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -40,6 +40,8 @@ extern "C" {
 #endif
 
 struct BVHTree;
+struct DistProjectedAABBPrecalc;
+
 typedef struct BVHTree BVHTree;
 #define USE_KDOPBVH_WATERTIGHT
 
@@ -102,9 +104,10 @@ typedef bool (*BVHTree_OverlapCallback)(void *userdata, int index_a, int index_b
 typedef void (*BVHTree_RangeQuery)(void *userdata, int index, const float co[3], float dist_sq);
 
 /* callback to find nearest projected */
-typedef void (*BVHTree_NearestProjectedCallback)(void *userdata, int index,
-                                                 struct DistProjectedAABBPrecalc *precalc,
-                                                 BVHTreeNearest *nearest);
+typedef void (*BVHTree_NearestProjectedCallback)(
+        void *userdata, int index,
+        const struct DistProjectedAABBPrecalc *precalc,
+        BVHTreeNearest *nearest);
 
 
 /* callbacks to BLI_bvhtree_walk_dfs */
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index e4e0bf22de0..20852f8fc82 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -124,12 +124,12 @@ MINLINE void mul_v4_v4fl(float r[3], const float a[3], float f);
 MINLINE void mul_v2_v2_cw(float r[2], const float mat[2], const float vec[2]);
 MINLINE void mul_v2_v2_ccw(float r[2], const float mat[2], const float vec[2]);
 MINLINE float mul_project_m4_v3_zfac(const float mat[4][4], const float co[3]) ATTR_WARN_UNUSED_RESULT;
-MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT;
-MINLINE float dot_m3_v3_row_y(float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT;
-MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT;
-MINLINE float dot_m4_v3_row_x(float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT;
-MINLINE float dot_m4_v3_row_y(float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT;
-MINLINE float dot_m4_v3_row_z(float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT;
+MINLINE float dot_m3_v3_row_x(const float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT;
+MINLINE float dot_m3_v3_row_y(const float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT;
+MINLINE float dot_m3_v3_row_z(const float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT;
+MINLINE float dot_m4_v3_row_x(const float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT;
+MINLINE float dot_m4_v3_row_y(const float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT;
+MINLINE float dot_m4_v3_row_z(const float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT;
 
 MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f);
 MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f);
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 4f658ef015f..4c40921edb6 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -501,15 +501,15 @@ MINLINE float mul_project_m4_v3_zfac(const float mat[4][4], const float co[3])
 /**
  * Has the effect of #mul_m3_v3(), on a single axis.
  */
-MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3])
+MINLINE float dot_m3_v3_row_x(const float M[3][3], const float a[3])
 {
 	return M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
 }
-MINLINE float dot_m3_v3_row_y(float M[3][3], const float a[3])
+MINLINE float dot_m3_v3_row_y(const float M[3][3], const float a[3])
 {
 	return M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
 }
-MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3])
+MINLINE float dot_m3_v3_row_z(const float M[3][3], const float a[3])
 {
 	return M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2];
 }
@@ -518,15 +518,15 @@ MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3])
  * Has the effect of #mul_mat3_m4_v3(), on a single axis.
  * (no adding translation)
  */
-MINLINE float dot_m4_v3_row_x(float M[4][4], const float a[3])
+MINLINE float dot_m4_v3_row_x(const float M[4][4], const float a[3])
 {
 	return M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
 }
-MINLINE float dot_m4_v3_row_y(float M[4][4], const float a[3])
+MINLINE float dot_m4_v3_row_y(const float M[4][4], const float a[3])
 {
 	return M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
 }
-MINLINE float dot_m4_v3_row_z(float M[4][4], const float a[3])
+MINLINE float dot_m4_v3_row_z(const float M[4][4], const float a[3])
 {
 	return M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2];
 }
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index b5ff9c5f2e6..23d7760b1ad 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -896,7 +896,7 @@ static void cb_mlooptri_verts_get(
 }
 
 static bool test_projected_vert_dist(
-        struct DistProjectedAABBPrecalc *neasrest_precalc,
+        const struct DistProjectedAABBPrecalc *neasrest_precalc,
         const float depth_range[2],
         const bool is_persp, const float co[3],
         float *dist_px_sq, float r_co[3])
@@ -928,7 +928,7 @@ static bool test_projected_vert_dist(
 }
 
 static bool test_projected_edge_dist(
-        struct DistProjectedAABBPrecalc *neasrest_precalc,
+        const struct DistProjectedAABBPrecalc *neasrest_precalc,
         const float depth_range[2], const bool is_persp,
         const float va[3], const float vb[3],
         float *dist_px_sq, float r_co[3])
@@ -974,7 +974,7 @@ typedef struct Nearest2dUserData {
 
 static void cb_walk_leaf_snap_vert(
         void *userdata, int index,
-        struct DistProjectedAABBPrecalc *precalc,
+        const struct DistProjectedAABBPrecalc *precalc,
         BVHTreeNearest *nearest)
 {
 	struct Nearest2dUserData *data = userdata;
@@ -997,7 +997,7 @@ static void cb_walk_leaf_snap_vert(
 
 static void cb_walk_leaf_snap_edge(
         void *userdata, int index,
-        struct DistProjectedAABBPrecalc *precalc,
+        const struct DistProjectedAABBPrecalc *precalc,
         BVHTreeNearest *nearest)
 {
 	struct Nearest2dUserData *data = userdata;
@@ -1034,7 +1034,7 @@ static void cb_walk_leaf_snap_edge(
 
 static void cb_walk_leaf_snap_tri(
         void *userdata, int index,
-        struct DistProjectedAABBPrecalc *precalc,
+        const struct DistProjectedAABBPrecalc *precalc,
         BVHTreeNearest *nearest)
 {
 	struct Nearest2dUserData *data = userdata;



More information about the Bf-blender-cvs mailing list