Commit 46c366a8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix a bunch of warnings / undefined pointers

By the way, using asprintf(&ptr)/free(ptr) to determine the length of a string
is really lame, when you can do the same with snprintf(NULL, 0);
parent 397710b2
...@@ -190,7 +190,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) ...@@ -190,7 +190,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
} }
p_info = p_cat->pp_infos[i]; p_info = p_cat->pp_infos[i];
vasprintf( &p_info->psz_value, psz_format, args ); if( vasprintf( &p_info->psz_value, psz_format, args ) == -1 )
p_info->psz_value = NULL;
vlc_mutex_unlock( &p_input->p->input.p_item->lock ); vlc_mutex_unlock( &p_input->p->input.p_item->lock );
...@@ -306,8 +307,9 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) ...@@ -306,8 +307,9 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
vlc_mutex_lock( &p_input->p->input.p_item->lock ); vlc_mutex_lock( &p_input->p->input.p_item->lock );
if( !p_bkmk->psz_name ) if( !p_bkmk->psz_name )
{ {
asprintf( &p_bkmk->psz_name, _("Bookmark %i"), if( asprintf( &p_bkmk->psz_name, _("Bookmark %i"),
p_input->p->i_bookmark ); p_input->p->i_bookmark ) == -1 )
p_bkmk->psz_name = NULL;
} }
TAB_APPEND( p_input->p->i_bookmark, p_input->p->bookmark, p_bkmk ); TAB_APPEND( p_input->p->i_bookmark, p_input->p->bookmark, p_bkmk );
...@@ -518,8 +520,9 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) ...@@ -518,8 +520,9 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
sizeof(char **) ); sizeof(char **) );
} }
asprintf( &p_input->p->input.p_item->ppsz_options[i], if( asprintf( &p_input->p->input.p_item->ppsz_options[i],
"%s=%s", psz_option, psz_value ) ; "%s=%s", psz_option, psz_value ) == -1 )
p_input->p->input.p_item->ppsz_options[i] = NULL;
vlc_mutex_unlock( &p_input->p->input.p_item->lock ); vlc_mutex_unlock( &p_input->p->input.p_item->lock );
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -613,12 +616,10 @@ static void UpdateBookmarksOption( input_thread_t *p_input ) ...@@ -613,12 +616,10 @@ static void UpdateBookmarksOption( input_thread_t *p_input )
vlc_mutex_lock( &p_input->p->input.p_item->lock ); vlc_mutex_lock( &p_input->p->input.p_item->lock );
for( i = 0; i < p_input->p->i_bookmark; i++ ) for( i = 0; i < p_input->p->i_bookmark; i++ )
{ {
asprintf( &psz_value, "{name=%s,bytes="I64Fd",time="I64Fd"}", i_len += snprintf( NULL, 0, "{name=%s,bytes="I64Fd",time="I64Fd"}",
p_input->p->bookmark[i]->psz_name, p_input->p->bookmark[i]->psz_name,
p_input->p->bookmark[i]->i_byte_offset, p_input->p->bookmark[i]->i_byte_offset,
p_input->p->bookmark[i]->i_time_offset/1000000 ); p_input->p->bookmark[i]->i_time_offset/1000000 );
i_len += strlen( psz_value );
free( psz_value );
} }
for( i = 0; i < p_input->p->i_bookmark; i++ ) for( i = 0; i < p_input->p->i_bookmark; i++ )
{ {
......
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