[Bf-blender-cvs] [35380cd] master: Fix for uninitialized unit_use_radians variable with inset and bevel

Campbell Barton noreply at git.blender.org
Tue May 6 11:21:36 CEST 2014


Commit: 35380cdcad60a30d51a6fb6ae4e9f3606067aa5b
Author: Campbell Barton
Date:   Tue May 6 19:20:03 2014 +1000
https://developer.blender.org/rB35380cdcad60a30d51a6fb6ae4e9f3606067aa5b

Fix for uninitialized unit_use_radians variable with inset and bevel

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

M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/math_vector.c
M	source/blender/editors/util/numinput.c

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

diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index ddf716e..f816ad5 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -313,6 +313,7 @@ void msub_vn_vn(float *array_tar, const float *array_src, const float f, const i
 void msub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size);
 void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size);
 void fill_vn_i(int *array_tar, const int size, const int val);
+void fill_vn_short(short *array_tar, const int size, const short val);
 void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val);
 void fill_vn_fl(float *array_tar, const int size, const float val);
 
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index cfe33dd..7d3829f 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -992,6 +992,15 @@ void fill_vn_i(int *array_tar, const int size, const int val)
 	}
 }
 
+void fill_vn_short(short *array_tar, const int size, const short val)
+{
+	short *tar = array_tar + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = val;
+	}
+}
+
 void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val)
 {
 	unsigned short *tar = array_tar + (size - 1);
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 850f1d1..ee391af 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -70,17 +70,20 @@ enum {
 
 void initNumInput(NumInput *n)
 {
-	n->unit_sys = USER_UNIT_NONE;
-	n->unit_type[0] = n->unit_type[1] = n->unit_type[2] = B_UNIT_NONE;
-	n->idx = 0;
 	n->idx_max = 0;
+	n->unit_sys = USER_UNIT_NONE;
+	fill_vn_i(n->unit_type, NUM_MAX_ELEMENTS, B_UNIT_NONE);
+	n->unit_use_radians = false;
+
 	n->flag = 0;
-	n->val_flag[0] = n->val_flag[1] = n->val_flag[2] = 0;
-	zero_v3(n->val_org);
+	fill_vn_short(n->val_flag, NUM_MAX_ELEMENTS, 0);
 	zero_v3(n->val);
+	fill_vn_fl(n->val_org, NUM_MAX_ELEMENTS, 0.0f);
+	fill_vn_fl(n->val_inc, NUM_MAX_ELEMENTS, 1.0f);
+
+	n->idx = 0;
 	n->str[0] = '\0';
 	n->str_cur = 0;
-	copy_v3_fl(n->val_inc, 1.0f);
 }
 
 /* str must be NUM_STR_REP_LEN * (idx_max + 1) length. */




More information about the Bf-blender-cvs mailing list