Commit f083827e authored by Gildas Bazin's avatar Gildas Bazin

* ALL: make sure newly created playlist_item_t are initialized properly.
parent 83455b12
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* slp.c: SLP access plugin * slp.c: SLP access plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: slp.c,v 1.18 2004/01/05 13:07:02 zorglub Exp $ * $Id: slp.c,v 1.19 2004/01/17 12:28:56 gbazin Exp $
* *
* Authors: Loc Minier <lool@videolan.org> * Authors: Loc Minier <lool@videolan.org>
* *
...@@ -179,6 +179,7 @@ static SLPBoolean SrvUrlCallback( SLPHandle slph_slp, ...@@ -179,6 +179,7 @@ static SLPBoolean SrvUrlCallback( SLPHandle slph_slp,
/* create a playlist item */ /* create a playlist item */
p_playlist_item = malloc( sizeof( playlist_item_t ) ); p_playlist_item = malloc( sizeof( playlist_item_t ) );
memset( p_playlist_item, 0, sizeof( playlist_item_t ) );
if( p_playlist_item == NULL ) if( p_playlist_item == NULL )
{ {
msg_Err( p_input, "out of memory" ); msg_Err( p_input, "out of memory" );
...@@ -187,13 +188,9 @@ static SLPBoolean SrvUrlCallback( SLPHandle slph_slp, ...@@ -187,13 +188,9 @@ static SLPBoolean SrvUrlCallback( SLPHandle slph_slp,
p_playlist_item->psz_name = NULL; p_playlist_item->psz_name = NULL;
p_playlist_item->psz_uri = strdup( psz_s ); p_playlist_item->psz_uri = strdup( psz_s );
p_playlist_item->i_status = 0;
p_playlist_item->b_autodeletion = VLC_FALSE;
p_playlist_item->i_duration = -1; p_playlist_item->i_duration = -1;
p_playlist_item->i_group = i_group; p_playlist_item->i_group = i_group;
p_playlist_item->b_enabled = VLC_TRUE; p_playlist_item->b_enabled = VLC_TRUE;
p_playlist_item->pp_categories = NULL;
p_playlist_item->i_categories = NULL;
/* search the description of the stream */ /* search the description of the stream */
if( SLPOpen( config_GetPsz( p_input, "slp-lang" ), if( SLPOpen( config_GetPsz( p_input, "slp-lang" ),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* http.c : http mini-server ;) * http.c : http mini-server ;)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2004 VideoLAN * Copyright (C) 2001-2004 VideoLAN
* $Id: http.c,v 1.43 2004/01/10 03:36:03 hartman Exp $ * $Id: http.c,v 1.44 2004/01/17 12:28:57 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr> * Laurent Aimar <fenrir@via.ecp.fr>
...@@ -2945,12 +2945,10 @@ playlist_item_t * parse_MRL( char *psz ) ...@@ -2945,12 +2945,10 @@ playlist_item_t * parse_MRL( char *psz )
{ {
/* now create an item */ /* now create an item */
p_item = malloc( sizeof( playlist_item_t ) ); p_item = malloc( sizeof( playlist_item_t ) );
memset( p_item, 0, sizeof( playlist_item_t ) );
p_item->psz_name = mrl; p_item->psz_name = mrl;
p_item->psz_uri = strdup( mrl ); p_item->psz_uri = strdup( mrl );
p_item->i_duration = -1; p_item->i_duration = -1;
p_item->i_status = 0;
p_item->b_autodeletion = VLC_FALSE;
p_item->b_enabled = VLC_TRUE; p_item->b_enabled = VLC_TRUE;
p_item->i_group = PLAYLIST_TYPE_MANUAL; p_item->i_group = PLAYLIST_TYPE_MANUAL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port) * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.cpp,v 1.41 2004/01/05 13:07:03 zorglub Exp $ * $Id: VlcWrapper.cpp,v 1.42 2004/01/17 12:28:57 gbazin Exp $
* *
* Authors: Florian G. Pflug <fgp@phlo.org> * Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -706,11 +706,9 @@ VlcWrapper::PlaylistCloneItem( void* castToItem ) const ...@@ -706,11 +706,9 @@ VlcWrapper::PlaylistCloneItem( void* castToItem ) const
if ( copy ) if ( copy )
{ {
// make a copy of the item at index // make a copy of the item at index
*copy = *item;
copy->psz_name = strdup( item->psz_name ); copy->psz_name = strdup( item->psz_name );
copy->psz_uri = strdup( item->psz_uri ); copy->psz_uri = strdup( item->psz_uri );
copy->i_type = item->i_type;
copy->i_status = item->i_status;
copy->b_autodeletion = item->b_autodeletion;
} }
} }
return (void*)copy; return (void*)copy;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* item-ext.c : Exported playlist item functions * item-ext.c : Exported playlist item functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2004 VideoLAN * Copyright (C) 1999-2004 VideoLAN
* $Id: item-ext.c,v 1.8 2004/01/11 00:45:06 zorglub Exp $ * $Id: item-ext.c,v 1.9 2004/01/17 12:28:57 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Clément Stenac <zorglub@videolan.org> * Clément Stenac <zorglub@videolan.org>
...@@ -60,6 +60,7 @@ int playlist_AddWDuration( playlist_t *p_playlist, const char * psz_uri, ...@@ -60,6 +60,7 @@ int playlist_AddWDuration( playlist_t *p_playlist, const char * psz_uri,
msg_Err( p_playlist, "Not adding NULL item"); msg_Err( p_playlist, "Not adding NULL item");
return -1; return -1;
} }
memset( p_item, 0, sizeof( playlist_item_t ) );
p_item->psz_uri = strdup( psz_uri ); p_item->psz_uri = strdup( psz_uri );
if( psz_name != NULL ) if( psz_name != NULL )
{ {
...@@ -69,15 +70,10 @@ int playlist_AddWDuration( playlist_t *p_playlist, const char * psz_uri, ...@@ -69,15 +70,10 @@ int playlist_AddWDuration( playlist_t *p_playlist, const char * psz_uri,
{ {
p_item->psz_name = strdup ( psz_uri ); p_item->psz_name = strdup ( psz_uri );
} }
p_item->i_status = 0;
p_item->b_autodeletion = VLC_FALSE;
p_item->b_enabled = VLC_TRUE; p_item->b_enabled = VLC_TRUE;
p_item->i_group = PLAYLIST_TYPE_MANUAL; p_item->i_group = PLAYLIST_TYPE_MANUAL;
p_item->i_duration = i_duration; p_item->i_duration = i_duration;
p_item->pp_categories = NULL;
p_item->i_categories = 0;
playlist_CreateItemCategory( p_item, _("General") ); playlist_CreateItemCategory( p_item, _("General") );
playlist_CreateItemCategory( p_item, _("Options") ); playlist_CreateItemCategory( p_item, _("Options") );
return playlist_AddItem( p_playlist, p_item, i_mode, i_pos ); return playlist_AddItem( p_playlist, p_item, i_mode, i_pos );
......
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