[vlc-devel] [PATCH 2/3] variables: improve CheckValue

Zhao Zhili quinkblack at foxmail.com
Tue Aug 28 05:50:05 CEST 2018


---
 src/misc/variables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 9bd6866..f1e1be5 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -195,7 +195,7 @@ static void CheckValue(variable_t *var, vlc_value_t *val)
         case VLC_VAR_INTEGER:
             if (val->i_int < var->min.i_int)
                val->i_int = var->min.i_int;
-            if (val->i_int > var->max.i_int)
+            else if (val->i_int > var->max.i_int)
                 val->i_int = var->max.i_int;
             if (var->step.i_int != 0 && (val->i_int % var->step.i_int))
             {
@@ -211,7 +211,7 @@ static void CheckValue(variable_t *var, vlc_value_t *val)
         case VLC_VAR_FLOAT:
             if (isless(val->f_float, var->min.f_float))
                 val->f_float = var->min.f_float;
-            if (isgreater(val->f_float, var->max.f_float))
+            else if (isgreater(val->f_float, var->max.f_float))
                 val->f_float = var->max.f_float;
             if (var->step.f_float != 0.f)
                 val->f_float = var->step.f_float
-- 
2.9.5





More information about the vlc-devel mailing list