[vlc-commits] variables: pass VLC_VAR_SETMINMAX parameters by value

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  9 13:34:11 2018 +0300| [880bfc7266bd1f27038896367e4e817636c10a87] | committer: Rémi Denis-Courmont

variables: pass VLC_VAR_SETMINMAX parameters by value

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

 modules/access/v4l2/controls.c | 16 ++++++++--------
 src/config/chain.c             |  8 ++++----
 src/config/cmdline.c           |  8 ++++----
 src/misc/variables.c           |  4 ++--
 test/src/misc/variables.c      |  8 ++++----
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/modules/access/v4l2/controls.c b/modules/access/v4l2/controls.c
index 6c6362d9b7..1133ae9858 100644
--- a/modules/access/v4l2/controls.c
+++ b/modules/access/v4l2/controls.c
@@ -393,8 +393,8 @@ static vlc_v4l2_ctrl_t *ControlAddInteger (vlc_object_t *obj, int fd,
         var_Change(obj, c->name, VLC_VAR_SETVALUE, &val);
     }
     var_Change (obj, c->name, VLC_VAR_SETMINMAX,
-        &(vlc_value_t){ .i_int = query->minimum },
-        &(vlc_value_t){ .i_int = query->maximum } );
+        (vlc_value_t){ .i_int = query->minimum },
+        (vlc_value_t){ .i_int = query->maximum } );
     if (query->step != 1)
     {
         val.i_int = query->step;
@@ -462,8 +462,8 @@ static vlc_v4l2_ctrl_t *ControlAddMenu (vlc_object_t *obj, int fd,
         var_Change(obj, c->name, VLC_VAR_SETVALUE, &val);
     }
     var_Change (obj, c->name, VLC_VAR_SETMINMAX,
-        &(vlc_value_t){ .i_int = query->minimum },
-        &(vlc_value_t){ .i_int = query->maximum } );
+        (vlc_value_t){ .i_int = query->minimum },
+        (vlc_value_t){ .i_int = query->maximum } );
 
     /* Import menu choices */
     for (uint_fast32_t idx = query->minimum;
@@ -621,8 +621,8 @@ static vlc_v4l2_ctrl_t *ControlAddBitMask (vlc_object_t *obj, int fd,
         var_Change(obj, c->name, VLC_VAR_SETVALUE, &val);
     }
     var_Change (obj, c->name, VLC_VAR_SETMINMAX,
-        &(vlc_value_t){ .i_int = 0 },
-        &(vlc_value_t){ .i_int = (uint32_t)query->maximum } );
+        (vlc_value_t){ .i_int = 0 },
+        (vlc_value_t){ .i_int = (uint32_t)query->maximum } );
     return c;
 }
 
@@ -654,8 +654,8 @@ static vlc_v4l2_ctrl_t *ControlAddIntMenu (vlc_object_t *obj, int fd,
         var_Change(obj, c->name, VLC_VAR_SETVALUE, &val);
     }
     var_Change (obj, c->name, VLC_VAR_SETMINMAX,
-        &(vlc_value_t){ .i_int = query->minimum },
-        &(vlc_value_t){ .i_int = query->maximum } );
+        (vlc_value_t){ .i_int = query->minimum },
+        (vlc_value_t){ .i_int = query->maximum } );
 
     /* Import menu choices */
     for (uint_fast32_t idx = query->minimum;
diff --git a/src/config/chain.c b/src/config/chain.c
index 2cfc58f640..f947e40f15 100644
--- a/src/config/chain.c
+++ b/src/config/chain.c
@@ -294,13 +294,13 @@ void config_ChainParse( vlc_object_t *p_this, const char *psz_prefix,
             {
                 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 } );
+                        (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 } );
+                        (vlc_value_t){ .f_float = p_conf->min.f },
+                        (vlc_value_t){ .f_float = p_conf->max.f } );
                     break;
             }
         }
diff --git a/src/config/cmdline.c b/src/config/cmdline.c
index 535306cc1c..d16462a624 100644
--- a/src/config/cmdline.c
+++ b/src/config/cmdline.c
@@ -219,16 +219,16 @@ int config_LoadCmdLine( vlc_object_t *p_this, int i_argc,
                     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 } );
+                            (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 } );
+                            (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:
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 2cd9a21cee..b07448861e 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -450,8 +450,8 @@ int (var_Change)(vlc_object_t *p_this, const char *psz_name, int i_action, ...)
             break;
         case VLC_VAR_SETMINMAX:
             assert(p_var->ops->pf_free == FreeDummy);
-            p_var->min = *va_arg(ap, vlc_value_t *);
-            p_var->max = *va_arg(ap, vlc_value_t *);
+            p_var->min = va_arg(ap, vlc_value_t);
+            p_var->max = va_arg(ap, vlc_value_t);
             break;
         case VLC_VAR_SETSTEP:
             assert(p_var->ops->pf_free == FreeDummy);
diff --git a/test/src/misc/variables.c b/test/src/misc/variables.c
index 9394fde24d..279051ac4c 100644
--- a/test/src/misc/variables.c
+++ b/test/src/misc/variables.c
@@ -290,8 +290,8 @@ static void test_limits( libvlc_int_t *p_libvlc )
     assert( val.i_int == INT64_MAX );
 
     var_Change( p_libvlc, "bla", VLC_VAR_SETMINMAX,
-                &(vlc_value_t){ .i_int = -1234 },
-                &(vlc_value_t){ .i_int = 12345 } );
+                (vlc_value_t){ .i_int = -1234 },
+                (vlc_value_t){ .i_int = 12345 } );
 
     var_Change( p_libvlc, "bla", VLC_VAR_GETMIN, &val );
     assert( val.i_int == -1234 );
@@ -359,7 +359,7 @@ static void test_change( libvlc_int_t *p_libvlc )
     step.i_int = 13;
 
     var_Create( p_libvlc, "bla", VLC_VAR_INTEGER );
-    var_Change( p_libvlc, "bla", VLC_VAR_SETMINMAX, &min, &max );
+    var_Change( p_libvlc, "bla", VLC_VAR_SETMINMAX, min, max );
     var_Change( p_libvlc, "bla", VLC_VAR_SETSTEP, &step );
 
     var_SetInteger( p_libvlc, "bla", 13 );
@@ -405,7 +405,7 @@ static void test_creation_and_type( libvlc_int_t *p_libvlc )
     assert( var_Change( p_libvlc, "bla", VLC_VAR_GETMAX, &val ) != 0
          || val.i_int == INT64_MAX );
     val.i_int = 4212;
-    var_Change( p_libvlc, "bla", VLC_VAR_SETMINMAX, &val, &val );
+    var_Change( p_libvlc, "bla", VLC_VAR_SETMINMAX, val, val );
     assert( var_Change( p_libvlc, "bla", VLC_VAR_GETMIN, &val ) == 0
          && val.i_int == 4212 );
     assert( var_Change( p_libvlc, "bla", VLC_VAR_GETMAX, &val ) == 0



More information about the vlc-commits mailing list