Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-12 13:18:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-12 13:18:21 +0300
commit9e9e028f059f29d493dc020dda965a9bea8ffd6b (patch)
treeb2785d85bbe058f896f699f87588527a7bc31368
parent3396f73c1719db18500d4741d4fc21d6bba9423c (diff)
access past array bounds in layerInterp_mdisps, also make some vars const.
-rw-r--r--source/blender/blenkernel/BKE_multires.h12
-rw-r--r--source/blender/blenkernel/intern/customdata.c4
-rw-r--r--source/blender/blenkernel/intern/multires.c12
3 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index 23fabce68ba..de895ebce51 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -84,12 +84,12 @@ void multires_mdisp_smooth_bounds(struct MDisps *disps);
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
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 94bb771aecd..0ed479b899a 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -524,8 +524,8 @@ static void layerInterp_mdisps(void **sources, float *UNUSED(weights),
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);
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 2a3052d10c9..2601adbcb5e 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -962,7 +962,7 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int loca
***************************/
/* 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 @@ static void face_to_crn_interp(float u, float v, float v1[2], float v2[2], float
*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 @@ void mdisp_rot_crn_to_face(int S, int corners, int face_side, float x, float y,
}
}
-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 @@ int mdisp_rot_face_to_crn(int corners, int face_side, float u, float v, float *x
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 @@ void mdisp_apply_weight(int S, int corners, int x, int y, int face_side,
*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];