[vlc-commits] Remove unused variable variable type

Rémi Denis-Courmont git at videolan.org
Sat May 23 10:29:10 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 23 11:21:02 2015 +0300| [75e7a5f3ebc0791b225807dcd918443dd20dd79e] | committer: Rémi Denis-Courmont

Remove unused variable variable type

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

 include/vlc_variables.h       |    1 -
 modules/gui/macosx/MainMenu.m |    6 +-----
 modules/gui/qt4/menus.cpp     |   48 ++++-------------------------------------
 src/misc/variables.c          |    1 -
 4 files changed, 5 insertions(+), 51 deletions(-)

diff --git a/include/vlc_variables.h b/include/vlc_variables.h
index 935ce89..1d1bf7f 100644
--- a/include/vlc_variables.h
+++ b/include/vlc_variables.h
@@ -54,7 +54,6 @@
 #define VLC_VAR_BOOL      0x0020
 #define VLC_VAR_INTEGER   0x0030
 #define VLC_VAR_STRING    0x0040
-#define VLC_VAR_VARIABLE  0x0044
 #define VLC_VAR_FLOAT     0x0050
 #define VLC_VAR_ADDRESS   0x0070
 #define VLC_VAR_COORDS    0x00A0
diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index 3660bc0..bef644d 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -1326,7 +1326,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
     switch(i_type & VLC_VAR_TYPE) {
         case VLC_VAR_VOID:
         case VLC_VAR_BOOL:
-        case VLC_VAR_VARIABLE:
         case VLC_VAR_STRING:
         case VLC_VAR_INTEGER:
             break;
@@ -1410,9 +1409,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
     /* Make sure we want to display the variable */
     if (i_type & VLC_VAR_HASCHOICE) {
         var_Change(p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL);
-        if (val.i_int == 0)
-            return;
-        if ((i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1)
+        if (val.i_int == 0 || val.i_int == 1)
             return;
     }
     else
@@ -1421,7 +1418,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
     switch(i_type & VLC_VAR_TYPE) {
         case VLC_VAR_VOID:
         case VLC_VAR_BOOL:
-        case VLC_VAR_VARIABLE:
         case VLC_VAR_STRING:
         case VLC_VAR_INTEGER:
             break;
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 6e51d15..7351a14 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -1224,44 +1224,13 @@ static bool IsMenuEmpty( const char *psz_var,
                          vlc_object_t *p_object,
                          bool b_root = true )
 {
-    vlc_value_t val, val_list;
-    int i_type, i_result, i;
-
-    /* Check the type of the object variable */
-    i_type = var_Type( p_object, psz_var );
-
     /* Check if we want to display the variable */
-    if( !( i_type & VLC_VAR_HASCHOICE ) ) return false;
+    if( !(var_Type( p_object, psz_var) & VLC_VAR_HASCHOICE) )
+        return false;
 
+    vlc_value_t val;
     var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
-    if( val.i_int == 0 ) return true;
-
-    if( ( i_type & VLC_VAR_TYPE ) != VLC_VAR_VARIABLE )
-    {
-        if( val.i_int == 1 && b_root ) return true;
-        else return false;
-    }
-
-    /* Check children variables in case of VLC_VAR_VARIABLE */
-    if( var_Change( p_object, psz_var, VLC_VAR_GETCHOICES, &val_list, NULL ) < 0 )
-    {
-        return true;
-    }
-
-    for( i = 0, i_result = true; i < val_list.p_list->i_count; i++ )
-    {
-        if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
-                    p_object, false ) )
-        {
-            i_result = false;
-            break;
-        }
-    }
-
-    /* clean up everything */
-    var_FreeList( &val_list, NULL );
-
-    return i_result;
+    return val.i_int == 0 || (val.i_int == 1 && b_root);
 }
 
 #define TEXT_OR_VAR qfue ( text.psz_string ? text.psz_string : psz_var )
@@ -1296,7 +1265,6 @@ void VLCMenuBar::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
     {
         case VLC_VAR_VOID:
         case VLC_VAR_BOOL:
-        case VLC_VAR_VARIABLE:
         case VLC_VAR_STRING:
         case VLC_VAR_INTEGER:
         case VLC_VAR_FLOAT:
@@ -1418,7 +1386,6 @@ int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
     {
         case VLC_VAR_VOID:
         case VLC_VAR_BOOL:
-        case VLC_VAR_VARIABLE:
         case VLC_VAR_STRING:
         case VLC_VAR_INTEGER:
         case VLC_VAR_FLOAT:
@@ -1442,16 +1409,9 @@ int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
     {
         vlc_value_t another_val;
         QString menutext;
-        QMenu *subsubmenu = new QMenu( submenu );
 
         switch( i_type & VLC_VAR_TYPE )
         {
-            case VLC_VAR_VARIABLE:
-                CreateChoicesMenu( subsubmenu, CURVAL.psz_string, p_object, false );
-                subsubmenu->setTitle( qfue( CURTEXT ? CURTEXT :CURVAL.psz_string ) );
-                submenu->addMenu( subsubmenu );
-                break;
-
             case VLC_VAR_STRING:
                 var_Get( p_object, psz_var, &val );
                 another_val.psz_string = strdup( CURVAL.psz_string );
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 7008dc1..cd2e182 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1477,7 +1477,6 @@ static void DumpVariable(const void *data, const VISIT which, const int depth)
         case VLC_VAR_BOOL:     typename = "bool";        break;
         case VLC_VAR_INTEGER:  typename = "integer";     break;
         case VLC_VAR_STRING:   typename = "string";      break;
-        case VLC_VAR_VARIABLE: typename = "variable";    break;
         case VLC_VAR_FLOAT:    typename = "float";       break;
         case VLC_VAR_COORDS:   typename = "coordinates"; break;
         case VLC_VAR_ADDRESS:  typename = "address";     break;



More information about the vlc-commits mailing list