[vlc-devel] commit: variables: ( Rémi Duraffort )
git version control
git at videolan.org
Fri Jul 31 13:26:28 CEST 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Jul 31 13:17:45 2009 +0200| [81d38c62fd3d6667898c3e5c795f9344e8d20dc9] | committer: Rémi Duraffort
variables:
* print an error message when the variable creation failed because of a name
clash (two variables with the same name but different types)
* print a warning when calling var_Get on a void variable
* fix one comment as the list is NOT sorted (and that too expensif to do).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=81d38c62fd3d6667898c3e5c795f9344e8d20dc9
---
src/misc/variables.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 485b9f5..4a20354 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -197,6 +197,8 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
/* If the types differ, variable creation failed. */
if( (i_type & VLC_VAR_TYPE) != (p_priv->p_vars[i_new].i_type & VLC_VAR_TYPE) )
{
+ msg_Err( p_this, "Variable '%s' (0x%04x) already exist but with a different type (0x%04x)",
+ psz_name, p_priv->p_vars[i_new].i_type, i_type );
vlc_mutex_unlock( &p_priv->var_lock );
return VLC_EBADVAR;
}
@@ -833,6 +835,10 @@ int var_GetChecked( vlc_object_t *p_this, const char *psz_name,
/* Really get the variable */
*p_val = p_var->val;
+ /* Alert if the type is VLC_VAR_VOID */
+ if( ( p_var->i_type & VLC_VAR_TYPE ) == VLC_VAR_VOID )
+ msg_Warn( p_this, "Calling var_GetVoid on the void variable '%s' (0x%04x)", psz_name, p_var->i_type );
+
/* Duplicate value if needed */
p_var->ops->pf_dup( p_val );
}
@@ -1062,7 +1068,7 @@ void var_OptionParse( vlc_object_t *p_obj, const char *psz_option,
/* Create the variable in the input object.
* Children of the input object will be able to retreive this value
* thanks to the inheritance property of the object variables. */
- var_Create( p_obj, psz_name, i_type );
+ __var_Create( p_obj, psz_name, i_type );
switch( i_type )
{
@@ -1302,7 +1308,7 @@ static void CheckValue ( variable_t *p_var, vlc_value_t *p_val )
{
int i;
- /* FIXME: the list is sorted, dude. Use something cleverer. */
+ /* This list is not sorted so go throug it (this is a small list) */
for( i = p_var->choices.i_count ; i-- ; )
{
if( p_var->ops->pf_cmp( *p_val, p_var->choices.p_values[i] ) == 0 )
More information about the vlc-devel
mailing list