[vlc-commits] variables: pass VLC_VAR_ADDCHOICES parameters by value
Rémi Denis-Courmont
git at videolan.org
Sun Jun 10 12:11:09 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 9 14:46:51 2018 +0300| [84b960546b71d6dad84a1296576cf9d935c9bbb1] | committer: Rémi Denis-Courmont
variables: pass VLC_VAR_ADDCHOICES parameters by value
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=84b960546b71d6dad84a1296576cf9d935c9bbb1
---
modules/access/v4l2/controls.c | 21 +++++-----
modules/gui/skins2/src/theme_repository.cpp | 12 +++---
modules/video_filter/postproc.c | 12 +++---
src/audio_output/output.c | 61 ++++++++++++-----------------
src/input/control.c | 3 +-
src/input/es_out.c | 4 +-
src/input/event.c | 5 +--
src/input/var.c | 9 +++--
src/interface/interface.c | 13 +++---
src/misc/variables.c | 15 ++++---
src/video_output/interlacing.c | 7 ++--
src/video_output/vout_intf.c | 18 ++++-----
test/src/misc/variables.c | 6 +--
13 files changed, 80 insertions(+), 106 deletions(-)
diff --git a/modules/access/v4l2/controls.c b/modules/access/v4l2/controls.c
index 66779edf6a..bb90166734 100644
--- a/modules/access/v4l2/controls.c
+++ b/modules/access/v4l2/controls.c
@@ -476,10 +476,9 @@ static vlc_v4l2_ctrl_t *ControlAddMenu (vlc_object_t *obj, int fd,
continue;
msg_Dbg (obj, " choice %"PRIu32") %s", menu.index, menu.name);
- vlc_value_t text;
val.i_int = menu.index;
- text.psz_string = (char *)menu.name;
- var_Change (obj, c->name, VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(obj, c->name, VLC_VAR_ADDCHOICE, val,
+ (const char *)menu.name);
}
return c;
}
@@ -670,11 +669,10 @@ static vlc_v4l2_ctrl_t *ControlAddIntMenu (vlc_object_t *obj, int fd,
msg_Dbg (obj, " choice %"PRIu32") %"PRId64, menu.index,
(uint64_t)menu.value);
- vlc_value_t text;
val.i_int = menu.index;
- sprintf (name, "%"PRId64, (int64_t)menu.value);
- text.psz_string = name;
- var_Change (obj, c->name, VLC_VAR_ADDCHOICE, &val, &text);
+ sprintf(name, "%"PRId64, (int64_t)menu.value);
+ var_Change(obj, c->name, VLC_VAR_ADDCHOICE, val,
+ (const char *)name);
}
return c;
}
@@ -735,8 +733,8 @@ vlc_v4l2_ctrl_t *ControlsInit (vlc_object_t *obj, int fd)
text.psz_string = (char *)query.name;
var_Change(obj, c->name, VLC_VAR_SETTEXT, &text);
val.i_int = query.id;
- text.psz_string = (char *)c->name;
- var_Change (obj, "controls", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(obj, "controls", VLC_VAR_ADDCHOICE, val,
+ (const char *)c->name);
c->next = list;
list = c;
@@ -764,15 +762,14 @@ vlc_v4l2_ctrl_t *ControlsInit (vlc_object_t *obj, int fd)
/* Add a control to reset all controls to their default values */
{
- vlc_value_t val, text;
+ vlc_value_t val;
var_Create (obj, "reset", VLC_VAR_VOID | VLC_VAR_ISCOMMAND);
val.psz_string = _("Reset defaults");
var_Change(obj, "reset", VLC_VAR_SETTEXT, &val);
val.i_int = -1;
- text.psz_string = (char *)"reset";
- var_Change (obj, "controls", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(obj, "controls", VLC_VAR_ADDCHOICE, val, "reset");
var_AddCallback (obj, "reset", ControlsResetCallback, list);
}
if (var_InheritBool (obj, CFG_PREFIX"controls-reset"))
diff --git a/modules/gui/skins2/src/theme_repository.cpp b/modules/gui/skins2/src/theme_repository.cpp
index fdb06fdbf1..612aae378c 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -75,9 +75,8 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf )
std::string name = itmap->first;
std::string path = itmap->second;
val.psz_string = (char*) path.c_str();
- text.psz_string = (char*) name.c_str();
- var_Change( getIntf(), "intf-skins", VLC_VAR_ADDCHOICE, &val,
- &text );
+ var_Change( getIntf(), "intf-skins", VLC_VAR_ADDCHOICE, val,
+ name.c_str() );
if( name == "Default" )
{
@@ -204,7 +203,7 @@ int ThemeRepository::changeSkin( vlc_object_t *pIntf, char const *pVariable,
void ThemeRepository::updateRepository()
{
- vlc_value_t val, text;
+ vlc_value_t val;
// retrieve the current skin
char* psz_current = config_GetPsz( "skins2-last" );
@@ -212,7 +211,6 @@ void ThemeRepository::updateRepository()
return;
val.psz_string = psz_current;
- text.psz_string = psz_current;
// add this new skins if not yet present in repository
std::string current( psz_current );
@@ -224,8 +222,8 @@ void ThemeRepository::updateRepository()
}
if( it == m_skinsMap.end() )
{
- var_Change( getIntf(), "intf-skins", VLC_VAR_ADDCHOICE, &val,
- &text );
+ var_Change( getIntf(), "intf-skins", VLC_VAR_ADDCHOICE, val,
+ (const char *)psz_current );
std::string name = psz_current;
m_skinsMap[name] = name;
}
diff --git a/modules/video_filter/postproc.c b/modules/video_filter/postproc.c
index 08dc184ebe..97cbf90320 100644
--- a/modules/video_filter/postproc.c
+++ b/modules/video_filter/postproc.c
@@ -127,6 +127,7 @@ static int OpenPostproc( vlc_object_t *p_this )
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys;
vlc_value_t val, val_orig, text;
+ const char *desc;
int i_flags = 0;
if( p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma ||
@@ -232,20 +233,19 @@ static int OpenPostproc( vlc_object_t *p_this )
switch( val.i_int )
{
case 0:
- text.psz_string = _("Disable");
+ desc = _("Disable");
break;
case 1:
- text.psz_string = _("Lowest");
+ desc = _("Lowest");
break;
case PP_QUALITY_MAX:
- text.psz_string = _("Highest");
+ desc = _("Highest");
break;
default:
- text.psz_string = NULL;
+ desc = NULL;
break;
}
- var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_ADDCHOICE,
- &val, text.psz_string?&text:NULL );
+ var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_ADDCHOICE, val, desc );
}
vlc_mutex_init( &p_sys->lock );
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index b17a049d8e..1f11f3cf85 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -278,47 +278,38 @@ audio_output_t *aout_New (vlc_object_t *parent)
text.psz_string = _("Visualizations");
var_Change(aout, "visual", VLC_VAR_SETTEXT, &text);
val.psz_string = (char *)"";
- text.psz_string = _("Disable");
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("Disable"));
val.psz_string = (char *)"spectrometer";
- text.psz_string = _("Spectrometer");
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("Spectrometer"));
val.psz_string = (char *)"scope";
- text.psz_string = _("Scope");
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("Scope"));
val.psz_string = (char *)"spectrum";
- text.psz_string = _("Spectrum");
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("Spectrum"));
val.psz_string = (char *)"vuMeter";
- text.psz_string = _("VU meter");
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("VU meter"));
/* Look for goom plugin */
if (module_exists ("goom"))
{
val.psz_string = (char *)"goom";
- text.psz_string = (char *)"Goom";
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "Goom");
}
/* Look for libprojectM plugin */
if (module_exists ("projectm"))
{
val.psz_string = (char *)"projectm";
- text.psz_string = (char*)"projectM";
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "projectM");
}
/* Look for VSXu plugin */
if (module_exists ("vsxu"))
{
val.psz_string = (char *)"vsxu";
- text.psz_string = (char*)"Vovoid VSXu";
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "Vovoid VSXU");
}
/* Look for glspectrum plugin */
if (module_exists ("glspectrum"))
{
val.psz_string = (char *)"glspectrum";
- text.psz_string = (char*)"3D spectrum";
- var_Change (aout, "visual", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "3D spectrum");
}
str = var_GetNonEmptyString (aout, "effect-list");
if (str != NULL)
@@ -349,9 +340,8 @@ audio_output_t *aout_New (vlc_object_t *parent)
for (unsigned i = 0; i < cfg->list_count; i++)
{
val.psz_string = (char *)cfg->list.psz[i];
- text.psz_string = vlc_gettext(cfg->list_text[i]);
- var_Change (aout, "audio-replay-gain-mode", VLC_VAR_ADDCHOICE,
- &val, &text);
+ var_Change(aout, "audio-replay-gain-mode", VLC_VAR_ADDCHOICE,
+ val, vlc_gettext(cfg->list_text[i]));
}
/* Stereo mode */
@@ -426,7 +416,8 @@ static void aout_PrepareStereoMode (audio_output_t *aout,
/* Fill Stereo mode choices */
var_Change(aout, "stereo-mode", VLC_VAR_CLEARCHOICES);
- vlc_value_t val, txt;
+ vlc_value_t val;
+ const char *txt;
val.i_int = 0;
if (!AOUT_FMT_LINEAR(fmt) || i_nb_input_channels == 1)
@@ -436,26 +427,24 @@ static void aout_PrepareStereoMode (audio_output_t *aout,
int i_default_mode = AOUT_VAR_CHAN_UNSET;
val.i_int = AOUT_VAR_CHAN_MONO;
- txt.psz_string = _("Mono");
- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+ var_Change(aout, "stereo-mode", VLC_VAR_ADDCHOICE, val, _("Mono"));
if (i_nb_input_channels != 2)
{
val.i_int = AOUT_VAR_CHAN_UNSET;
- txt.psz_string = _("Original");
- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+ var_Change(aout, "stereo-mode", VLC_VAR_ADDCHOICE, val, _("Original"));
}
if (fmt->i_chan_mode & AOUT_CHANMODE_DOLBYSTEREO)
{
val.i_int = AOUT_VAR_CHAN_DOLBYS;
- txt.psz_string = _("Dolby Surround");
+ txt = _("Dolby Surround");
}
else
{
val.i_int = AOUT_VAR_CHAN_STEREO;
- txt.psz_string = _("Stereo");
+ txt = _("Stereo");
}
- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+ var_Change(aout, "stereo-mode", VLC_VAR_ADDCHOICE, val, txt);
if (i_nb_input_channels == 2)
{
@@ -465,23 +454,21 @@ static void aout_PrepareStereoMode (audio_output_t *aout,
i_default_mode = val.i_int; /* Stereo or Dolby Surround */
val.i_int = AOUT_VAR_CHAN_LEFT;
- txt.psz_string = _("Left");
- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+ var_Change(aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, _("Left"));
val.i_int = AOUT_VAR_CHAN_RIGHT;
- txt.psz_string = _("Right");
- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+ var_Change(aout, "stereo-mode", VLC_VAR_ADDCHOICE, val, _("Right"));
val.i_int = AOUT_VAR_CHAN_RSTEREO;
- txt.psz_string = _("Reverse stereo");
- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+ var_Change(aout, "stereo-mode", VLC_VAR_ADDCHOICE, val,
+ _("Reverse stereo"));
}
if (input_chan_type == AUDIO_CHANNEL_TYPE_AMBISONICS
|| i_nb_input_channels > 2)
{
val.i_int = AOUT_VAR_CHAN_HEADPHONES;
- txt.psz_string = _("Headphones");
- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+ var_Change(aout, "stereo-mode", VLC_VAR_ADDCHOICE, val,
+ _("Headphones"));
if (aout->current_sink_info.headphones)
i_default_mode = AOUT_VAR_CHAN_HEADPHONES;
diff --git a/src/input/control.c b/src/input/control.c
index aacee5e813..e92ab3a3f8 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -605,8 +605,7 @@ static void UpdateBookmarksOption( input_thread_t *p_input )
/* Add bookmark to choice-list */
var_Change( p_input, "bookmark", VLC_VAR_ADDCHOICE,
- &(vlc_value_t){ .i_int = i },
- &(vlc_value_t){ .psz_string = sp->psz_name } );
+ (vlc_value_t){ .i_int = i }, sp->psz_name );
/* Append bookmark to option-buffer */
/* TODO: escape inappropriate values */
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 6ff2cb2dbd..9aa7761f2d 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -955,8 +955,8 @@ static void EsOutESVarUpdateGeneric( es_out_t *out, int i_id,
vlc_value_t val2;
/* First one, we need to add the "Disable" choice */
- val2.i_int = -1; text.psz_string = _("Disable");
- var_Change( p_input, psz_var, VLC_VAR_ADDCHOICE, &val2, &text );
+ val2.i_int = -1;
+ var_Change( p_input, psz_var, VLC_VAR_ADDCHOICE, val2, _("Disable") );
val.i_int++;
}
diff --git a/src/input/event.c b/src/input/event.c
index 2881c42712..4cfbc08ee2 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -306,13 +306,10 @@ static void VarListAdd( input_thread_t *p_input,
int i_value, const char *psz_text )
{
vlc_value_t val;
- vlc_value_t text;
val.i_int = i_value;
- text.psz_string = (char*)psz_text;
- var_Change( p_input, psz_variable, VLC_VAR_ADDCHOICE,
- &val, psz_text ? &text : NULL );
+ var_Change( p_input, psz_variable, VLC_VAR_ADDCHOICE, val, psz_text );
Trigger( p_input, i_event );
}
diff --git a/src/input/var.c b/src/input/var.c
index bedad376e8..3cd39dd3c8 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -329,7 +329,8 @@ void input_ControlVarNavigation( input_thread_t *p_input )
/* Add title choice */
val2.i_int = i;
- var_Change( p_input, "title", VLC_VAR_ADDCHOICE, &val2, &text );
+ var_Change( p_input, "title", VLC_VAR_ADDCHOICE, val2,
+ (const char *)text.psz_string );
free( text.psz_string );
@@ -351,7 +352,8 @@ void input_ControlVarNavigation( input_thread_t *p_input )
strdup( input_priv(p_input)->title[i]->seekpoint[j]->psz_name );
}
- var_Change( p_input, title, VLC_VAR_ADDCHOICE, &val2, &text2 );
+ var_Change( p_input, title, VLC_VAR_ADDCHOICE, val2,
+ (const char *)text2.psz_string );
free( text2.psz_string );
}
@@ -407,7 +409,8 @@ void input_ControlVarTitle( input_thread_t *p_input, int i_title )
text.psz_string = strdup( t->seekpoint[i]->psz_name );
}
- var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val, &text );
+ var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, val,
+ (const char *)text.psz_string );
free( text.psz_string );
}
}
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 71a7549485..8712669cc9 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -86,18 +86,15 @@ int intf_Create( playlist_t *playlist, const char *chain )
#endif
{
val.psz_string = (char *)"rc,none";
- text.psz_string = (char *)_("Console");
- var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text );
+ var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, val, _("Console") );
}
val.psz_string = (char *)"telnet,none";
- text.psz_string = (char *)_("Telnet");
- var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text );
+ var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, val, _("Telnet") );
val.psz_string = (char *)"http,none";
- text.psz_string = (char *)_("Web");
- var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text );
+ var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, val, _("Web") );
val.psz_string = (char *)"gestures,none";
- text.psz_string = (char *)_("Mouse Gestures");
- var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text );
+ var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, val,
+ _("Mouse Gestures") );
var_AddCallback( p_intf, "intf-add", AddIntfCallback, playlist );
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 1c4a1a4cdd..47dd9f139b 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -477,21 +477,20 @@ int (var_Change)(vlc_object_t *p_this, const char *psz_name, int i_action, ...)
break;
case VLC_VAR_ADDCHOICE:
{
- vlc_value_t *p_val = va_arg(ap, vlc_value_t *);
- const vlc_value_t *p_val2 = va_arg(ap, vlc_value_t *);
+ vlc_value_t val = va_arg(ap, vlc_value_t);
+ const char *text = va_arg(ap, const char *);
int i = p_var->choices.i_count;
- TAB_APPEND(p_var->choices.i_count,
- p_var->choices.p_values, *p_val);
+ TAB_APPEND(p_var->choices.i_count, p_var->choices.p_values, val);
assert(i == p_var->choices_text.i_count);
TAB_APPEND(p_var->choices_text.i_count,
- p_var->choices_text.p_values, *p_val);
+ p_var->choices_text.p_values, val);
p_var->ops->pf_dup( &p_var->choices.p_values[i] );
p_var->choices_text.p_values[i].psz_string =
- ( p_val2 && p_val2->psz_string ) ?
- strdup( p_val2->psz_string ) : NULL;
+ (text != NULL) ? strdup(text) : NULL;
- TriggerListCallback(p_this, p_var, psz_name, VLC_VAR_ADDCHOICE, p_val);
+ TriggerListCallback(p_this, p_var, psz_name, VLC_VAR_ADDCHOICE,
+ &val);
break;
}
case VLC_VAR_DELCHOICE:
diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index ee9f6b42bf..b03635abb2 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -117,8 +117,8 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, bool is_interlaced)
if (likely(optd != NULL))
for (unsigned i = 0; i < optd->list_count; i++) {
val.i_int = optd->list.i[i];
- text.psz_string = vlc_gettext(optd->list_text[i]);
- var_Change(vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change(vout, "deinterlace", VLC_VAR_ADDCHOICE, val,
+ vlc_gettext(optd->list_text[i]));
}
var_AddCallback(vout, "deinterlace", DeinterlaceCallback, NULL);
/* */
@@ -136,9 +136,8 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, bool is_interlaced)
continue;
val.psz_string = (char *)optm->list.psz[i];
- text.psz_string = vlc_gettext(optm->list_text[i]);
var_Change(vout, "deinterlace-mode", VLC_VAR_ADDCHOICE,
- &val, &text);
+ val, vlc_gettext(optm->list_text[i]));
}
var_AddCallback(vout, "deinterlace-mode", DeinterlaceCallback, NULL);
/* */
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 92da0ebb7d..4ce5734fe6 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -133,7 +133,7 @@ static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
char *psz_next;
while( psz_cur && *psz_cur )
{
- vlc_value_t val, text;
+ vlc_value_t val;
psz_next = strchr( psz_cur, ',' );
if( psz_next )
{
@@ -141,8 +141,8 @@ static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
psz_next++;
}
val.psz_string = psz_cur;
- text.psz_string = psz_cur;
- var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, &val, &text);
+ var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, val,
+ (const char *)psz_cur );
psz_cur = psz_next;
}
}
@@ -179,8 +179,8 @@ void vout_IntfInit( vout_thread_t *p_vout )
for( size_t i = 0; i < ARRAY_SIZE(p_zoom_values); i++ )
{
val.f_float = p_zoom_values[i].f_value;
- text.psz_string = vlc_gettext( p_zoom_values[i].psz_label );
- var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, &val, &text );
+ var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, val,
+ vlc_gettext( p_zoom_values[i].psz_label ) );
}
var_AddCallback( p_vout, "zoom", ZoomCallback, NULL );
@@ -206,8 +206,8 @@ void vout_IntfInit( vout_thread_t *p_vout )
for( size_t i = 0; i < ARRAY_SIZE(p_crop_values); i++ )
{
val.psz_string = (char*)p_crop_values[i].psz_value;
- text.psz_string = _( p_crop_values[i].psz_label );
- var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
+ var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, val,
+ p_crop_values[i].psz_label );
}
/* Add custom crop ratios */
@@ -233,8 +233,8 @@ void vout_IntfInit( vout_thread_t *p_vout )
for( size_t i = 0; i < ARRAY_SIZE(p_aspect_ratio_values); i++ )
{
val.psz_string = (char*)p_aspect_ratio_values[i].psz_value;
- text.psz_string = _( p_aspect_ratio_values[i].psz_label );
- var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
+ var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, val,
+ vlc_gettext(p_aspect_ratio_values[i].psz_label) );
}
/* Add custom aspect ratios */
diff --git a/test/src/misc/variables.c b/test/src/misc/variables.c
index 8b4657ab54..8d30084c44 100644
--- a/test/src/misc/variables.c
+++ b/test/src/misc/variables.c
@@ -326,12 +326,10 @@ static void test_choices( libvlc_int_t *p_libvlc )
vlc_value_t val, val2;
var_Create( p_libvlc, "bla", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
val.i_int = 1;
- val2.psz_string = (char*)"one";
- var_Change( p_libvlc, "bla", VLC_VAR_ADDCHOICE, &val, &val2 );
+ var_Change( p_libvlc, "bla", VLC_VAR_ADDCHOICE, val, "one" );
val.i_int = 2;
- val2.psz_string = (char*)"two";
- var_Change( p_libvlc, "bla", VLC_VAR_ADDCHOICE, &val, &val2 );
+ var_Change( p_libvlc, "bla", VLC_VAR_ADDCHOICE, val, "two" );
assert( var_CountChoices( p_libvlc, "bla" ) == 2 );
More information about the vlc-commits
mailing list