[Bf-blender-cvs] [9134529b9eb] master: UI: avoid int cast before clamping number input
Campbell Barton
noreply at git.blender.org
Sun Sep 17 09:49:35 CEST 2017
Commit: 9134529b9eb9401470eb51d1cfc0d91a2ad2c109
Author: Campbell Barton
Date: Sun Sep 17 17:56:23 2017 +1000
Branches: master
https://developer.blender.org/rB9134529b9eb9401470eb51d1cfc0d91a2ad2c109
UI: avoid int cast before clamping number input
Values outside int range would overflow.
===================================================================
M source/blender/editors/interface/interface.c
===================================================================
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 7ab4e1d9c35..427291e713a 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2479,7 +2479,9 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
return false;
}
- if (!ui_but_is_float(but)) value = (int)floor(value + 0.5);
+ if (!ui_but_is_float(but)) {
+ value = floor(value + 0.5);
+ }
/* not that we use hard limits here */
if (value < (double)but->hardmin) value = but->hardmin;
More information about the Bf-blender-cvs
mailing list