[vlc-commits] config/chain: respect ranges when creating variables

Filip Roséen git at videolan.org
Thu Oct 13 18:05:39 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Oct 12 19:39:38 2016 +0200| [e909811793eeaf63de1ea07ae13846ad8476754a] | committer: Thomas Guillem

config/chain: respect ranges when creating variables

When creating variables that has their origin in a config-chain, we need to
make sure that their lower and upperbound is honored.

fixes #17431

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 src/config/chain.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/config/chain.c b/src/config/chain.c
index 7d0b71d..660ad8f 100644
--- a/src/config/chain.c
+++ b/src/config/chain.c
@@ -34,8 +34,10 @@
 #include <vlc_common.h>
 #include "libvlc.h"
 #include <vlc_charset.h>
+#include <vlc_plugin.h>
 
 #include "vlc_interface.h"
+#include "configuration.h"
 
 /*****************************************************************************
  * Local prototypes
@@ -284,6 +286,24 @@ void config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
         if( var_Create( p_this, name,
                         config_GetType( p_this, name ) | VLC_VAR_DOINHERIT ) )
             return /* VLC_xxx */;
+
+        module_config_t* p_conf = config_FindConfig( p_this, name );
+        if( p_conf )
+        {
+            switch( CONFIG_CLASS( p_conf->i_type ) )
+            {
+                case CONFIG_ITEM_INTEGER:
+                    var_Change( p_this, name, VLC_VAR_SETMINMAX,
+                        &(vlc_value_t){ .i_int = p_conf->min.i },
+                        &(vlc_value_t){ .i_int = p_conf->max.i } );
+                    break;
+                case CONFIG_ITEM_FLOAT:
+                    var_Change( p_this, name, VLC_VAR_SETMINMAX,
+                        &(vlc_value_t){ .f_float = p_conf->min.f },
+                        &(vlc_value_t){ .f_float = p_conf->max.f } );
+                    break;
+            }
+        }
     }
 
     /* Now parse options and set value */



More information about the vlc-commits mailing list