[vlc-devel] [PATCH 7/7] config/cmdline: respect ranges when creating variables

Filip Roséen filip at atch.se
Wed Oct 12 19:39:39 CEST 2016


When creating variables that has their origin on the command-line, we
need to make sure that their lower and upperbound is honored.

fixes #17430
---
 src/config/cmdline.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/config/cmdline.c b/src/config/cmdline.c
index 12e92ba..5f1e390 100644
--- a/src/config/cmdline.c
+++ b/src/config/cmdline.c
@@ -239,11 +239,17 @@ int config_LoadCmdLine( vlc_object_t *p_this, int i_argc,
                         break;
                     case CONFIG_ITEM_INTEGER:
                         var_Create( p_this, psz_name, VLC_VAR_INTEGER );
+                        var_Change( p_this, psz_name, VLC_VAR_SETMINMAX,
+                            &(vlc_value_t){ .i_int = p_conf->min.i },
+                            &(vlc_value_t){ .i_int = p_conf->max.i } );
                         var_SetInteger( p_this, psz_name,
                                         strtoll(state.arg, NULL, 0));
                         break;
                     case CONFIG_ITEM_FLOAT:
                         var_Create( p_this, psz_name, VLC_VAR_FLOAT );
+                        var_Change( p_this, psz_name, VLC_VAR_SETMINMAX,
+                            &(vlc_value_t){ .f_float = p_conf->min.f },
+                            &(vlc_value_t){ .f_float = p_conf->max.f } );
                         var_SetFloat( p_this, psz_name, us_atof(state.arg) );
                         break;
                     case CONFIG_ITEM_BOOL:
-- 
2.10.0



More information about the vlc-devel mailing list