[vlc-commits] variables: pass VLC_VAR_DELCHOICES parameter by value

Rémi Denis-Courmont git at videolan.org
Sun Jun 10 12:11:11 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  9 14:46:51 2018 +0300| [77a24d6a33ffc636684b1702eec597b0bd79c828] | committer: Rémi Denis-Courmont

variables: pass VLC_VAR_DELCHOICES parameter by value

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

 modules/video_filter/postproc.c | 2 +-
 src/input/event.c               | 2 +-
 src/input/var.c                 | 2 +-
 src/misc/variables.c            | 7 ++++---
 test/src/misc/variables.c       | 2 +-
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/video_filter/postproc.c b/modules/video_filter/postproc.c
index 97cbf90320..ee2469fc90 100644
--- a/modules/video_filter/postproc.c
+++ b/modules/video_filter/postproc.c
@@ -203,7 +203,7 @@ static int OpenPostproc( vlc_object_t *p_this )
     var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_SETTEXT, &text );
 
     var_Get( p_filter, FILTER_PREFIX "q", &val_orig );
-    var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_DELCHOICE, &val_orig );
+    var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_DELCHOICE, val_orig );
 
     val.psz_string = var_GetNonEmptyString( p_filter, FILTER_PREFIX "name" );
     if( val_orig.i_int )
diff --git a/src/input/event.c b/src/input/event.c
index 4cfbc08ee2..d326982263 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -322,7 +322,7 @@ static void VarListDel( input_thread_t *p_input,
     if( i_value >= 0 )
     {
         val.i_int = i_value;
-        var_Change( p_input, psz_variable, VLC_VAR_DELCHOICE, &val );
+        var_Change( p_input, psz_variable, VLC_VAR_DELCHOICE, val );
     }
     else
     {
diff --git a/src/input/var.c b/src/input/var.c
index 3cd39dd3c8..68ab3dcc9d 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -156,7 +156,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
     var_Create( p_input, "program", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
     var_Get( p_input, "program", &val );
     if( val.i_int <= 0 )
-        var_Change( p_input, "program", VLC_VAR_DELCHOICE, &val );
+        var_Change( p_input, "program", VLC_VAR_DELCHOICE, val );
     text.psz_string = _("Program");
     var_Change( p_input, "program", VLC_VAR_SETTEXT, &text );
 
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 47dd9f139b..d9fafdb6fc 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -495,11 +495,11 @@ int (var_Change)(vlc_object_t *p_this, const char *psz_name, int i_action, ...)
         }
         case VLC_VAR_DELCHOICE:
         {
-            vlc_value_t *p_val = va_arg(ap, vlc_value_t *);
+            vlc_value_t val = va_arg(ap, vlc_value_t);
             int i;
 
             for( i = 0 ; i < p_var->choices.i_count ; i++ )
-                if( p_var->ops->pf_cmp( p_var->choices.p_values[i], *p_val ) == 0 )
+                if( p_var->ops->pf_cmp( p_var->choices.p_values[i], val ) == 0 )
                     break;
 
             if( i == p_var->choices.i_count )
@@ -514,7 +514,8 @@ int (var_Change)(vlc_object_t *p_this, const char *psz_name, int i_action, ...)
             TAB_ERASE(p_var->choices_text.i_count,
                       p_var->choices_text.p_values, i);
 
-            TriggerListCallback(p_this, p_var, psz_name, VLC_VAR_DELCHOICE, p_val);
+            TriggerListCallback(p_this, p_var, psz_name, VLC_VAR_DELCHOICE,
+                                &val);
             break;
         }
         case VLC_VAR_CHOICESCOUNT:
diff --git a/test/src/misc/variables.c b/test/src/misc/variables.c
index 8d30084c44..83e246dcbf 100644
--- a/test/src/misc/variables.c
+++ b/test/src/misc/variables.c
@@ -333,7 +333,7 @@ static void test_choices( libvlc_int_t *p_libvlc )
 
     assert( var_CountChoices( p_libvlc, "bla" ) == 2 );
 
-    var_Change( p_libvlc, "bla", VLC_VAR_DELCHOICE, &val );
+    var_Change( p_libvlc, "bla", VLC_VAR_DELCHOICE, val );
     assert( var_CountChoices( p_libvlc, "bla" ) == 1 );
 
     var_Change( p_libvlc, "bla", VLC_VAR_GETCHOICES, &val, &val2 );



More information about the vlc-commits mailing list