Commit: 6a982a080caafdd2bf8d4382ae1c35e7ea237d10
Author: Bastien Montagne
Date:   Mon Jul 13 22:00:49 2015 +0200
Branches: master
https://developer.blender.org/rB6a982a080caafdd2bf8d4382ae1c35e7ea237d10

Add some pedantic casts, since some guys around like to take all warnings from 
their compilers as errors, even the stupidest ones!

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

M       source/blender/blenkernel/intern/mesh_remap.c

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

diff --git a/source/blender/blenkernel/intern/mesh_remap.c 
b/source/blender/blenkernel/intern/mesh_remap.c
index c818c6b..32542d7 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -175,7 +175,7 @@ static void mesh_calc_eigen_matrix(
 {
        float center[3], covmat[3][3];
        float eigen_val[3], eigen_vec[3][3];
-       float (*cos)[3] = (float (*)[3])vcos;
+       float (*cos)[3] = NULL;
 
        bool eigen_success;
        int i;
@@ -184,7 +184,7 @@ static void mesh_calc_eigen_matrix(
                const MVert *mv;
                float (*co)[3];
 
-               cos = MEM_mallocN(sizeof(*cos) * (size_t)numverts, __func__);
+               vcos = cos = MEM_mallocN(sizeof(*cos) * (size_t)numverts, 
__func__);
                for (i = 0, co = cos, mv = verts; i < numverts; i++, co++, 
mv++) {
                        copy_v3_v3(*co, mv->co);
                }
@@ -193,9 +193,13 @@ static void mesh_calc_eigen_matrix(
 
        /* Note: here we apply sample correction to covariance matrix, since we 
consider the vertices as a sample
         *       of the whole 'surface' population of our mesh... */
-       BLI_covariance_m3_v3n(cos, numverts, true, covmat, center);
+       BLI_covariance_m3_v3n(vcos, numverts, true, covmat, center);
 
-       eigen_success = BLI_eigen_solve_selfadjoint_m3(covmat, eigen_val, 
eigen_vec);
+       if (cos) {
+               MEM_freeN(cos);
+       }
+
+       eigen_success = BLI_eigen_solve_selfadjoint_m3((const float 
(*)[3])covmat, eigen_val, eigen_vec);
        BLI_assert(eigen_success);
        UNUSED_VARS_NDEBUG(eigen_success);
 
@@ -236,10 +240,6 @@ static void mesh_calc_eigen_matrix(
 
        copy_m4_m3(r_mat, eigen_vec);
        copy_v3_v3(r_mat[3], center);
-
-       if (verts) {
-               MEM_freeN(cos);
-       }
 }
 
 /**
@@ -268,7 +268,7 @@ void BKE_mesh_remap_find_best_match_from_dm(
        float (*vcos_src)[3] = MEM_mallocN(sizeof(*vcos_src) * 
(size_t)numverts_src, __func__);
        dm_src->getVertCos(dm_src, vcos_src);
 
-       mesh_calc_eigen_matrix(NULL, vcos_src, numverts_src, mat_src);
+       mesh_calc_eigen_matrix(NULL, (const float (*)[3])vcos_src, 
numverts_src, mat_src);
        mesh_calc_eigen_matrix(verts_dst, NULL, numverts_dst, mat_dst);
 
        BLI_space_transform_global_from_matrices(r_space_transform, mat_dst, 
mat_src);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to