Commit e0e7b2ef authored by Clément Stenac's avatar Clément Stenac

Change some error message to assertions

parent 9835f07b
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <assert.h>
#include <vlc/input.h> #include <vlc/input.h>
#include "vlc_playlist.h" #include "vlc_playlist.h"
...@@ -204,20 +205,14 @@ int playlist_NodeInsert( playlist_t *p_playlist, ...@@ -204,20 +205,14 @@ int playlist_NodeInsert( playlist_t *p_playlist,
playlist_item_t *p_parent, playlist_item_t *p_parent,
int i_position ) int i_position )
{ {
if( !p_parent || p_parent->i_children == -1 ) assert( p_parent && p_parent->i_children != -1 );
{
msg_Err( p_playlist, "invalid node" );
return VLC_EGENERIC;
}
if( i_position == -1 ) i_position = p_parent->i_children ; if( i_position == -1 ) i_position = p_parent->i_children ;
INSERT_ELEM( p_parent->pp_children, INSERT_ELEM( p_parent->pp_children,
p_parent->i_children, p_parent->i_children,
i_position, i_position,
p_item ); p_item );
p_item->p_parent = p_parent; p_item->p_parent = p_parent;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -346,11 +341,7 @@ playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist, ...@@ -346,11 +341,7 @@ playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
p_root->p_input->psz_name ); p_root->p_input->psz_name );
#endif #endif
if( !p_root || p_root->i_children == -1 ) assert( p_root && p_root->i_children != -1 );
{
msg_Err( p_playlist,"invalid arguments for GetNextLeaf" );
return NULL;
}
/* Now, walk the tree until we find a suitable next item */ /* Now, walk the tree until we find a suitable next item */
p_next = p_item; p_next = p_item;
...@@ -381,11 +372,7 @@ playlist_item_t *playlist_GetNextEnabledLeaf( playlist_t *p_playlist, ...@@ -381,11 +372,7 @@ playlist_item_t *playlist_GetNextEnabledLeaf( playlist_t *p_playlist,
p_root->p_input->psz_name ); p_root->p_input->psz_name );
#endif #endif
if( !p_root || p_root->i_children == -1 ) assert( p_root && p_root->i_children != -1 );
{
msg_Err( p_playlist,"invalid arguments for GetNextEnabledLeaf" );
return NULL;
}
/* Now, walk the tree until we find a suitable next item */ /* Now, walk the tree until we find a suitable next item */
p_next = p_item; p_next = p_item;
...@@ -425,12 +412,7 @@ playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist, ...@@ -425,12 +412,7 @@ playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist,
msg_Dbg( p_playlist, "finding previous to play within %s", msg_Dbg( p_playlist, "finding previous to play within %s",
p_root->p_input->psz_name ); p_root->p_input->psz_name );
#endif #endif
assert( p_root && p_root->i_children != -1 );
if( !p_root || p_root->i_children == -1 )
{
msg_Err( p_playlist,"invalid arguments for GetPrevLeaf" );
return NULL;
}
/* Now, walk the tree until we find a suitable previous item */ /* Now, walk the tree until we find a suitable previous item */
p_prev = p_item; p_prev = p_item;
......
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