char *psz_parse = NULL;
char *psz_backup = NULL;
bool b_entry = false;
- input_item_t *p_input;
INIT_PLAYLIST_STUFF;
/* init txt */
for( ;; )
{
int i_read = stream_Read( p_demux->s, &p_sys->psz_data[i_pos], p_sys->i_data_len - i_pos );
- p_sys->psz_data[i_read] = '\0';
+ p_sys->psz_data[i_pos + i_read] = '\0';
if( i_read < p_sys->i_data_len - i_pos ) break; /* Done */
psz_string = malloc( i_strlen*sizeof( char ) +1);
memcpy( psz_string, psz_backup, i_strlen );
psz_string[i_strlen] = '\0';
- p_input = input_ItemNew( p_playlist, psz_string, psz_title_asx );
- input_ItemCopyOptions( p_current_input, p_input );
- input_ItemAddSubItem( p_current_input, p_input );
+ input_item_t *p_input;
+ p_input = input_item_New( p_demux, psz_string, psz_title_asx );
+ input_item_CopyOptions( p_current_input, p_input );
+ input_item_AddSubItem( p_current_input, p_input );
+ vlc_gc_decref( p_input );
free( psz_string );
}
else continue;
{
if( i_starttime || i_duration )
{
- if( i_starttime ) {
- asprintf(ppsz_options+i_options, ":start-time=%d", i_starttime);
- ++i_options;
+ if( i_starttime )
+ {
+ if( asprintf(ppsz_options+i_options, ":start-time=%d", i_starttime) == -1 )
+ *(ppsz_options+i_options) = NULL;
+ else
+ ++i_options;
}
- if( i_duration ) {
- asprintf(ppsz_options+i_options, ":stop-time=%d", i_starttime + i_duration);
- ++i_options;
+ if( i_duration )
+ {
+ if( asprintf(ppsz_options+i_options, ":stop-time=%d", i_starttime + i_duration) == -1 )
+ *(ppsz_options+i_options) = NULL;
+ else
+ ++i_options;
}
}
/* create the new entry */
- asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current_input->psz_name ) );
-
- p_entry = input_ItemNewExt( p_playlist, psz_href, psz_name, i_options, (const char * const *)ppsz_options, -1 );
- FREENULL( psz_name );
- input_ItemCopyOptions( p_current_input, p_entry );
- while( i_options )
+ if( asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current_input->psz_name ) ) != -1 )
{
- psz_name = ppsz_options[--i_options];
- FREENULL(psz_name);
- }
+ p_entry = input_item_NewExt( p_demux, psz_href, psz_name, i_options, (const char * const *)ppsz_options, -1 );
+ FREENULL( psz_name );
+ input_item_CopyOptions( p_current_input, p_entry );
+ while( i_options )
+ {
+ psz_name = ppsz_options[--i_options];
+ FREENULL( psz_name );
+ }
- if( psz_title_entry ) input_item_SetTitle( p_entry, psz_title_entry );
- if( psz_artist_entry ) input_item_SetArtist( p_entry, psz_artist_entry );
- if( psz_copyright_entry ) input_item_SetCopyright( p_entry, psz_copyright_entry );
- if( psz_moreinfo_entry ) input_item_SetURL( p_entry, psz_moreinfo_entry );
- if( psz_abstract_entry ) input_item_SetDescription( p_entry, psz_abstract_entry );
- input_ItemAddSubItem( p_current_input, p_entry );
- vlc_gc_decref( p_entry );
+ if( psz_title_entry ) input_item_SetTitle( p_entry, psz_title_entry );
+ if( psz_artist_entry ) input_item_SetArtist( p_entry, psz_artist_entry );
+ if( psz_copyright_entry ) input_item_SetCopyright( p_entry, psz_copyright_entry );
+ if( psz_moreinfo_entry ) input_item_SetURL( p_entry, psz_moreinfo_entry );
+ if( psz_abstract_entry ) input_item_SetDescription( p_entry, psz_abstract_entry );
+ input_item_AddSubItem( p_current_input, p_entry );
+ vlc_gc_decref( p_entry );
+ }
}
/* cleanup entry */;