[vlc-commits] variables: avoid implicit upconversion to double

Rémi Denis-Courmont git at videolan.org
Wed Aug 13 20:29:14 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Aug 13 21:11:46 2014 +0300| [05faedf1a8062c5d904d4f749b8e607ba0f07765] | committer: Rémi Denis-Courmont

variables: avoid implicit upconversion to double

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=05faedf1a8062c5d904d4f749b8e607ba0f07765
---

 src/misc/variables.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 05a11d4..19b5fb7 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1248,12 +1248,9 @@ static void CheckValue ( variable_t *p_var, vlc_value_t *p_val )
         case VLC_VAR_FLOAT:
             if( p_var->i_type & VLC_VAR_HASSTEP && p_var->step.f_float )
             {
-                float f_round = p_var->step.f_float * (float)(int)( 0.5 +
-                                        p_val->f_float / p_var->step.f_float );
-                if( p_val->f_float != f_round )
-                {
-                    p_val->f_float = f_round;
-                }
+                float f_round = p_var->step.f_float
+                              * roundf( p_val->f_float / p_var->step.f_float );
+                p_val->f_float = f_round;
             }
             if( p_var->i_type & VLC_VAR_HASMIN
                  && p_val->f_float < p_var->min.f_float )



More information about the vlc-commits mailing list