]> git.sesse.net Git - vlc/blobdiff - src/playlist/tree.c
playlist: sizeof -> strlen
[vlc] / src / playlist / tree.c
index 32ef051be5999cde7fcacc6e3b6441df2ac441f2..ce9397176d4e091674a583a54c90db3309efdadd 100644 (file)
@@ -144,7 +144,7 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
     }
 
     /* Delete the children */
-    for( i =  p_root->i_children - 1 ; i >= 0; i-- )
+    for( i = p_root->i_children - 1 ; i >= 0; i-- )
     {
         if( p_root->pp_children[i]->i_children > -1 )
         {
@@ -153,8 +153,7 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
         }
         else if( b_delete_items )
         {
-            playlist_DeleteFromItemId( p_playlist,
-                                       p_root->pp_children[i]->i_id );
+            playlist_DeleteItem( p_playlist, p_root->pp_children[i], true );
         }
     }
     /* Delete the node */
@@ -267,96 +266,9 @@ playlist_item_t *playlist_ChildSearchName( playlist_item_t *p_node,
     return NULL;
 }
 
-/**
- * Create a pair of nodes in the category and onelevel trees.
- * They share the same input item.
- * \param p_playlist the playlist
- * \param psz_name the name of the nodes
- * \param pp_node_cat pointer to return the node in category tree
- * \param pp_node_one pointer to return the node in onelevel tree
- * \param b_for_sd For Services Discovery ? (make node read-only and unskipping)
- */
-void playlist_NodesPairCreate( playlist_t *p_playlist, const char *psz_name,
-                               playlist_item_t **pp_node_cat,
-                               playlist_item_t **pp_node_one,
-                               bool b_for_sd )
-{
-    PL_ASSERT_LOCKED;
-    *pp_node_cat = playlist_NodeCreate( p_playlist, psz_name,
-                                        p_playlist->p_root_category, 0, NULL );
-    *pp_node_one = playlist_NodeCreate( p_playlist, psz_name,
-                                        p_playlist->p_root_onelevel, 0,
-                                        (*pp_node_cat)->p_input );
-    if( b_for_sd )
-    {
-        (*pp_node_cat)->i_flags |= PLAYLIST_RO_FLAG;
-        (*pp_node_cat)->i_flags |= PLAYLIST_SKIP_FLAG;
-        (*pp_node_one)->i_flags |= PLAYLIST_RO_FLAG;
-        (*pp_node_one)->i_flags |= PLAYLIST_SKIP_FLAG;
-    }
-}
-
-/**
- * Get the node in the preferred tree from a node in one of category
- * or onelevel tree.
- */
-playlist_item_t * playlist_GetPreferredNode( playlist_t *p_playlist,
-                                             playlist_item_t *p_node )
-{
-    PL_ASSERT_LOCKED;
-    int i;
-    if( p_node->p_parent == p_playlist->p_root_category )
-    {
-        if( pl_priv(p_playlist)->b_tree || p_node->p_input->b_prefers_tree )
-            return p_node;
-        for( i = 0 ; i< p_playlist->p_root_onelevel->i_children; i++ )
-        {
-            if( p_playlist->p_root_onelevel->pp_children[i]->p_input ==
-                    p_node->p_input )
-                return p_playlist->p_root_onelevel->pp_children[i];
-        }
-    }
-    else if( p_node->p_parent == p_playlist->p_root_onelevel )
-    {
-        if( !pl_priv(p_playlist)->b_tree || !p_node->p_input->b_prefers_tree )
-            return p_node;
-        for( i = 0 ; i< p_playlist->p_root_category->i_children; i++ )
-        {
-            if( p_playlist->p_root_category->pp_children[i]->p_input ==
-                    p_node->p_input )
-                return p_playlist->p_root_category->pp_children[i];
-        }
-    }
-    return NULL;
-}
-
 /**********************************************************************
  * Tree walking functions
  **********************************************************************/
-
-playlist_item_t *playlist_GetLastLeaf(playlist_t *p_playlist,
-                                      playlist_item_t *p_root )
-{
-    PL_ASSERT_LOCKED;
-    int i;
-    playlist_item_t *p_item;
-    for ( i = p_root->i_children - 1; i >= 0; i-- )
-    {
-        if( p_root->pp_children[i]->i_children == -1 )
-            return p_root->pp_children[i];
-        else if( p_root->pp_children[i]->i_children > 0)
-        {
-             p_item = playlist_GetLastLeaf( p_playlist,
-                                            p_root->pp_children[i] );
-            if ( p_item != NULL )
-                return p_item;
-        }
-        else if( i == 0 )
-            return NULL;
-    }
-    return NULL;
-}
-
 /**
  * Finds the next item to play
  *
@@ -415,7 +327,7 @@ playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist,
     PL_ASSERT_LOCKED;
     playlist_item_t *p_prev;
 
-    PL_DEBUG2( "finding previous os %s within %s", PLI_NAME( p_item ),
+    PL_DEBUG2( "finding previous of %s within %s", PLI_NAME( p_item ),
                                                    PLI_NAME( p_root ) );
     assert( p_root && p_root->i_children != -1 );