[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34793] trunk/blender/source/blender/ blenkernel: access past array bounds in layerInterp_mdisps, also make some vars const.

Campbell Barton ideasman42 at gmail.com
Sat Feb 12 11:18:22 CET 2011


Revision: 34793
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34793
Author:   campbellbarton
Date:     2011-02-12 10:18:21 +0000 (Sat, 12 Feb 2011)
Log Message:
-----------
access past array bounds in layerInterp_mdisps, also make some vars const.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_multires.h
    trunk/blender/source/blender/blenkernel/intern/customdata.c
    trunk/blender/source/blender/blenkernel/intern/multires.c

Modified: trunk/blender/source/blender/blenkernel/BKE_multires.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_multires.h	2011-02-12 09:58:28 UTC (rev 34792)
+++ trunk/blender/source/blender/blenkernel/BKE_multires.h	2011-02-12 10:18:21 UTC (rev 34793)
@@ -84,12 +84,12 @@
 void multires_topology_changed(struct Scene *scene, struct Object *ob);
 
 /**** interpolation stuff ****/
-void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, float v);
-void mdisp_rot_crn_to_face(int S, int corners, int face_side, float x, float y, float *u, float *v);
-int mdisp_rot_face_to_crn(int corners, int face_side, float u, float v, float *x, float *y);
-void mdisp_apply_weight(int S, int corners, int x, int y, int face_side, float crn_weight[4][2], float *u_r, float *v_r);
-void mdisp_flip_disp(int S, int corners, float axis_x[2], float axis_y[2], float disp[3]);
+void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v);
+void mdisp_rot_crn_to_face(const int S, const int corners, const int face_side, const float x, const float y, float *u, float *v);
+int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y);
+void mdisp_apply_weight(const int S, const int corners, int x, int y, const int face_side, float crn_weight[4][2], float *u_r, float *v_r);
+void mdisp_flip_disp(const int S, const int corners, const float axis_x[2], const float axis_y[2], float disp[3]);
 void mdisp_join_tris(struct MDisps *dst, struct MDisps *tri1, struct MDisps *tri2);
 
-#endif
+#endif // BKE_MULTIRES_H
 

Modified: trunk/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/customdata.c	2011-02-12 09:58:28 UTC (rev 34792)
+++ trunk/blender/source/blender/blenkernel/intern/customdata.c	2011-02-12 10:18:21 UTC (rev 34793)
@@ -524,8 +524,8 @@
 		mdisp_apply_weight(S, dst_corners, side-1, 0, st, crn_weight, &axis_x[0], &axis_x[1]);
 		mdisp_apply_weight(S, dst_corners, 0, side-1, st, crn_weight, &axis_y[0], &axis_y[1]);
 
-		sub_v3_v3(axis_x, base);
-		sub_v3_v3(axis_y, base);
+		sub_v2_v2(axis_x, base);
+		sub_v2_v2(axis_y, base);
 		normalize_v2(axis_x);
 		normalize_v2(axis_y);
 

Modified: trunk/blender/source/blender/blenkernel/intern/multires.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/multires.c	2011-02-12 09:58:28 UTC (rev 34792)
+++ trunk/blender/source/blender/blenkernel/intern/multires.c	2011-02-12 10:18:21 UTC (rev 34793)
@@ -962,7 +962,7 @@
 ***************************/
 
 /* Adapted from sculptmode.c */
-void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, float v)
+void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v)
 {
 	int x, y, x2, y2;
 	const int st_max = st - 1;
@@ -1965,7 +1965,7 @@
 	*x = maxf(x1, x2);
 }
 
-void mdisp_rot_crn_to_face(int S, int corners, int face_side, float x, float y, float *u, float *v)
+void mdisp_rot_crn_to_face(const int S, const int corners, const int face_side, const float x, const float y, float *u, float *v)
 {
 	float offset = face_side*0.5f - 0.5f;
 
@@ -1992,9 +1992,9 @@
 	}
 }
 
-int mdisp_rot_face_to_crn(int corners, int face_side, float u, float v, float *x, float *y)
+int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y)
 {
-	float offset = face_side*0.5f - 0.5f;
+	const float offset = face_side*0.5f - 0.5f;
 	int S = 0;
 
 	if (corners == 4) {
@@ -2037,7 +2037,7 @@
 	return S;
 }
 
-void mdisp_apply_weight(int S, int corners, int x, int y, int face_side,
+void mdisp_apply_weight(const int S, const int corners, int x, int y, const int face_side,
 	float crn_weight[4][2], float *u_r, float *v_r)
 {
 	float u, v, xl, yl;
@@ -2071,7 +2071,7 @@
 	*v_r = mid3[1];
 }
 
-void mdisp_flip_disp(int S, int corners, float axis_x[2], float axis_y[2], float disp[3])
+void mdisp_flip_disp(const int S, const int corners, const float axis_x[2], const float axis_y[2], float disp[3])
 {
 	float crn_x[2], crn_y[2];
 	float vx[2], vy[2], coord[2];




More information about the Bf-blender-cvs mailing list