]> git.sesse.net Git - vlc/commitdiff
variables: when the variable already exist, check the type only (integer,
authorRémi Duraffort <ivoire@videolan.org>
Fri, 24 Jul 2009 05:46:48 +0000 (07:46 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Fri, 24 Jul 2009 06:40:23 +0000 (08:40 +0200)
float, ...), so remove all the flags before the check.

src/misc/variables.c

index 1f382ea6ef56a13b0cc3e332a115e1a032ec504a..4d9ae4a46fde0cfd3ffc6e7b9d5b26d2c1b5d46b 100644 (file)
@@ -193,15 +193,15 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
     if( i_new >= 0 )
     {
         /* If the types differ, variable creation failed. */
-        if( (i_type & ~(VLC_VAR_DOINHERIT|VLC_VAR_ISCOMMAND)) != p_priv->p_vars[i_new].i_type )
+        if( (i_type & VLC_VAR_TYPE) != (p_priv->p_vars[i_new].i_type & VLC_VAR_TYPE) )
         {
             vlc_mutex_unlock( &p_priv->var_lock );
             return VLC_EBADVAR;
         }
 
         p_priv->p_vars[i_new].i_usage++;
-        if( i_type & VLC_VAR_ISCOMMAND )
-            p_priv->p_vars[i_new].i_type |= VLC_VAR_ISCOMMAND;
+        p_priv->p_vars[i_new].i_type |= ( i_type & VLC_VAR_ISCOMMAND );
+        p_priv->p_vars[i_new].i_type |= ( i_type & VLC_VAR_HASCHOICE );
         vlc_mutex_unlock( &p_priv->var_lock );
         return VLC_SUCCESS;
     }