Commit e1bd4f03 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Cosmetics

parent 9f5bed00
...@@ -390,7 +390,6 @@ void var_DestroyAll( vlc_object_t *obj ) ...@@ -390,7 +390,6 @@ void var_DestroyAll( vlc_object_t *obj )
int var_Change( vlc_object_t *p_this, const char *psz_name, int var_Change( vlc_object_t *p_this, const char *psz_name,
int i_action, vlc_value_t *p_val, vlc_value_t *p_val2 ) int i_action, vlc_value_t *p_val, vlc_value_t *p_val2 )
{ {
int i;
int ret = VLC_SUCCESS; int ret = VLC_SUCCESS;
variable_t *p_var; variable_t *p_var;
vlc_value_t oldval; vlc_value_t oldval;
...@@ -460,7 +459,8 @@ int var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -460,7 +459,8 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
ret = VLC_EGENERIC; ret = VLC_EGENERIC;
break; break;
case VLC_VAR_ADDCHOICE: case VLC_VAR_ADDCHOICE:
i = p_var->choices.i_count; {
int i = p_var->choices.i_count;
INSERT_ELEM( p_var->choices.p_values, p_var->choices.i_count, INSERT_ELEM( p_var->choices.p_values, p_var->choices.i_count,
i, *p_val ); i, *p_val );
...@@ -473,14 +473,14 @@ int var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -473,14 +473,14 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
CheckValue( p_var, &p_var->val ); CheckValue( p_var, &p_var->val );
break; break;
}
case VLC_VAR_DELCHOICE: case VLC_VAR_DELCHOICE:
{
int i;
for( i = 0 ; i < p_var->choices.i_count ; 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], *p_val ) == 0 )
{
break; break;
}
}
if( i == p_var->choices.i_count ) if( i == p_var->choices.i_count )
{ {
...@@ -490,13 +490,9 @@ int var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -490,13 +490,9 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
} }
if( p_var->i_default > i ) if( p_var->i_default > i )
{
p_var->i_default--; p_var->i_default--;
}
else if( p_var->i_default == i ) else if( p_var->i_default == i )
{
p_var->i_default = -1; p_var->i_default = -1;
}
p_var->ops->pf_free( &p_var->choices.p_values[i] ); p_var->ops->pf_free( &p_var->choices.p_values[i] );
free( p_var->choices_text.p_values[i].psz_string ); free( p_var->choices_text.p_values[i].psz_string );
...@@ -506,15 +502,14 @@ int var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -506,15 +502,14 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
CheckValue( p_var, &p_var->val ); CheckValue( p_var, &p_var->val );
break; break;
}
case VLC_VAR_CHOICESCOUNT: case VLC_VAR_CHOICESCOUNT:
p_val->i_int = p_var->choices.i_count; p_val->i_int = p_var->choices.i_count;
break; break;
case VLC_VAR_CLEARCHOICES: case VLC_VAR_CLEARCHOICES:
for( i = 0 ; i < p_var->choices.i_count ; i++ ) for( int i = 0 ; i < p_var->choices.i_count ; i++ )
{
p_var->ops->pf_free( &p_var->choices.p_values[i] ); p_var->ops->pf_free( &p_var->choices.p_values[i] );
} for( int i = 0 ; i < p_var->choices_text.i_count ; i++ )
for( i = 0 ; i < p_var->choices_text.i_count ; i++ )
free( p_var->choices_text.p_values[i].psz_string ); free( p_var->choices_text.p_values[i].psz_string );
if( p_var->choices.i_count ) free( p_var->choices.p_values ); if( p_var->choices.i_count ) free( p_var->choices.p_values );
...@@ -527,24 +522,21 @@ int var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -527,24 +522,21 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
p_var->i_default = -1; p_var->i_default = -1;
break; break;
case VLC_VAR_SETDEFAULT: case VLC_VAR_SETDEFAULT:
{
int i;
/* FIXME: the list is sorted, dude. Use something cleverer. */ /* FIXME: the list is sorted, dude. Use something cleverer. */
for( i = 0 ; i < p_var->choices.i_count ; 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], *p_val ) == 0 )
{
break; break;
}
}
if( i == p_var->choices.i_count ) if( i == p_var->choices.i_count )
{
/* Not found */ /* Not found */
break; break;
}
p_var->i_default = i; p_var->i_default = i;
CheckValue( p_var, &p_var->val ); CheckValue( p_var, &p_var->val );
break; break;
}
case VLC_VAR_SETVALUE: case VLC_VAR_SETVALUE:
/* Duplicate data if needed */ /* Duplicate data if needed */
newval = *p_val; newval = *p_val;
...@@ -578,7 +570,7 @@ int var_Change( vlc_object_t *p_this, const char *psz_name, ...@@ -578,7 +570,7 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
} }
p_val->p_list->i_count = p_var->choices.i_count; p_val->p_list->i_count = p_var->choices.i_count;
if( p_val2 ) p_val2->p_list->i_count = p_var->choices.i_count; if( p_val2 ) p_val2->p_list->i_count = p_var->choices.i_count;
for( i = 0 ; i < p_var->choices.i_count ; i++ ) for( int i = 0 ; i < p_var->choices.i_count ; i++ )
{ {
p_val->p_list->p_values[i] = p_var->choices.p_values[i]; p_val->p_list->p_values[i] = p_var->choices.p_values[i];
p_val->p_list->pi_types[i] = p_var->i_type; p_val->p_list->pi_types[i] = p_var->i_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment