Commit e7268258 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Remove trailing whitespace, add checks for malloc return value.

parent 4a66eee1
......@@ -71,7 +71,7 @@ static void libvlc_exception_not_handled( const char *psz )
}
void libvlc_exception_raise( libvlc_exception_t *p_exception,
const char *psz_format, ... )
const char *psz_format, ... )
{
va_list args;
char * psz;
......@@ -131,7 +131,7 @@ libvlc_instance_t * libvlc_new( int argc, const char *const *argv,
p_new->p_callback_list = NULL;
vlc_mutex_init(&p_new->instance_lock);
vlc_mutex_init(&p_new->event_callback_lock);
libvlc_event_init(p_new, p_e);
return p_new;
......
......@@ -26,7 +26,6 @@
#include <vlc/libvlc.h>
#include <vlc_playlist.h>
/*
* Private functions
*/
......@@ -64,7 +63,8 @@ group_contains_listener( libvlc_event_listeners_group_t * group,
**************************************************************************/
void libvlc_event_init( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
{
(void)p_instance;(void)p_e;
VLC_UNUSED(p_instance);
VLC_UNUSED(p_e);
/* Will certainly be used to install libvlc_instance event */
}
......@@ -75,7 +75,7 @@ void libvlc_event_init( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
**************************************************************************/
void libvlc_event_fini( libvlc_instance_t *p_instance )
{
(void)p_instance;
VLC_UNUSED(p_instance);
}
/**************************************************************************
......@@ -233,7 +233,7 @@ void libvlc_event_send( libvlc_event_manager_t * p_em,
continue;
}
}
listener_cached->pf_callback( p_event, listener_cached->p_user_data );
listener_cached++;
}
......@@ -286,6 +286,7 @@ static const char * event_type_to_name[] =
EVENT(libvlc_MediaDiscovererEnded)
#undef EVENT
};
static const char * unkwown_event_name = "Unknown Event";
const char * libvlc_event_type_name( libvlc_event_type_t event_type )
......@@ -316,7 +317,7 @@ void libvlc_event_attach( libvlc_event_manager_t * p_event_manager,
libvlc_exception_raise( p_e, "No Memory left" );
return;
}
listener->event_type = event_type;
listener->p_user_data = p_user_data;
listener->pf_callback = pf_callback;
......@@ -370,7 +371,7 @@ void libvlc_event_detach( libvlc_event_manager_t *p_event_manager,
listener->p_user_data == p_user_data )
{
/* that's our listener */
/* Mark this group as edited so that libvlc_event_send
* will recheck what listener to call */
listeners_group->b_sublistener_removed = false;
......
......@@ -240,6 +240,12 @@ libvlc_media_t * libvlc_media_new_from_input_item(
}
p_md = malloc( sizeof(libvlc_media_t) );
if( !p_md )
{
libvlc_exception_raise( p_e, "Not enough memory" );
return NULL;
}
p_md->p_libvlc_instance = p_instance;
p_md->p_input_item = p_input_item;
p_md->b_preparsed = false;
......@@ -295,7 +301,7 @@ libvlc_media_t * libvlc_media_new(
/* The p_input_item is retained in libvlc_media_new_from_input_item */
vlc_gc_decref( p_input_item );
return p_md;
}
......@@ -339,7 +345,7 @@ void libvlc_media_add_option(
const char * ppsz_option,
libvlc_exception_t *p_e )
{
(void)p_e;
VLC_UNUSED(p_e);
input_ItemAddOpt( p_md->p_input_item, ppsz_option,
VLC_INPUT_OPTION_UNIQUE|VLC_INPUT_OPTION_TRUSTED );
}
......@@ -404,7 +410,7 @@ char *
libvlc_media_get_mrl( libvlc_media_t * p_md,
libvlc_exception_t * p_e )
{
(void)p_e;
VLC_UNUSED(p_e);
return input_item_GetURI( p_md->p_input_item );
}
......@@ -416,9 +422,8 @@ char * libvlc_media_get_meta( libvlc_media_t *p_md,
libvlc_meta_t e_meta,
libvlc_exception_t *p_e )
{
VLC_UNUSED(p_e);
char * psz_meta;
VLC_UNUSED(p_e);
/* XXX: locking */
......@@ -426,7 +431,7 @@ char * libvlc_media_get_meta( libvlc_media_t *p_md,
psz_meta = input_item_GetMeta( p_md->p_input_item,
libvlc_to_vlc_meta[e_meta] );
if( e_meta == libvlc_meta_ArtworkURL && !psz_meta )
{
playlist_AskForArtEnqueue(
......@@ -453,7 +458,7 @@ libvlc_state_t
libvlc_media_get_state( libvlc_media_t *p_md,
libvlc_exception_t *p_e )
{
(void)p_e;
VLC_UNUSED(p_e);
return p_md->state;
}
......@@ -466,8 +471,8 @@ libvlc_media_set_state( libvlc_media_t *p_md,
libvlc_state_t state,
libvlc_exception_t *p_e )
{
(void)p_e;
libvlc_event_t event;
VLC_UNUSED(p_e);
p_md->state = state;
......@@ -581,4 +586,3 @@ libvlc_media_get_user_data( libvlc_media_t * p_md,
return NULL;
}
}
......@@ -62,7 +62,7 @@ static void services_discovery_item_added( const vlc_event_t * p_event,
/* Insert the newly created mlist in our dictionary */
vlc_dictionary_insert( &p_mdis->catname_to_submedialist, psz_cat, p_mlist );
/* Insert the md into the root list */
libvlc_media_list_lock( p_mdis->p_mlist );
_libvlc_media_list_add_media( p_mdis->p_mlist, p_catmd, NULL );
......@@ -113,7 +113,7 @@ static void services_discovery_item_removed( const vlc_event_t * p_event,
static void services_discovery_started( const vlc_event_t * p_event,
void * user_data )
{
(void)p_event;
VLC_UNUSED(p_event);
libvlc_media_discoverer_t * p_mdis = user_data;
libvlc_event_t event;
p_mdis->running = true;
......@@ -128,7 +128,7 @@ static void services_discovery_started( const vlc_event_t * p_event,
static void services_discovery_ended( const vlc_event_t * p_event,
void * user_data )
{
(void)p_event;
VLC_UNUSED(p_event);
libvlc_media_discoverer_t * p_mdis = user_data;
libvlc_event_t event;
p_mdis->running = false;
......@@ -151,7 +151,7 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
libvlc_exception_t * p_e )
{
libvlc_media_discoverer_t * p_mdis;
p_mdis = malloc(sizeof(libvlc_media_discoverer_t));
if( !p_mdis )
{
......@@ -270,4 +270,3 @@ libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis )
{
return p_mdis->running;
}
......@@ -53,12 +53,13 @@ static const libvlc_state_t vlc_to_libvlc_state_array[] =
{
[INIT_S] = libvlc_Opening,
[OPENING_S] = libvlc_Opening,
[BUFFERING_S] = libvlc_Buffering,
[PLAYING_S] = libvlc_Playing,
[PAUSE_S] = libvlc_Paused,
[END_S] = libvlc_Ended,
[ERROR_S] = libvlc_Error,
[BUFFERING_S] = libvlc_Buffering,
[PLAYING_S] = libvlc_Playing,
[PAUSE_S] = libvlc_Paused,
[END_S] = libvlc_Ended,
[ERROR_S] = libvlc_Error,
};
static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
{
if( vlc_state < 0 || vlc_state > 6 )
......@@ -113,7 +114,7 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
input_thread_t *p_input_thread;
if( !p_mi ) RAISENULL( "Media Instance is NULL" );
vlc_mutex_lock( &p_mi->object_lock );
if( !p_mi->p_input_thread )
......@@ -257,7 +258,7 @@ input_time_changed( vlc_object_t * p_this, char const * psz_cmd,
if (!strncmp(psz_cmd, "intf", 4 /* "-change" no need to go further */))
{
input_thread_t * p_input = (input_thread_t *)p_this;
var_Get( p_input, "state", &val );
if( val.i_int != PLAYING_S )
return VLC_SUCCESS; /* Don't send the position while stopped */
......@@ -290,6 +291,11 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
}
p_mi = malloc( sizeof(libvlc_media_player_t) );
if( !p_mi )
{
libvlc_exception_raise( p_e, "Not enough memory" );
return NULL;
}
p_mi->p_md = NULL;
p_mi->drawable = 0;
p_mi->p_libvlc_instance = p_libvlc_instance;
......@@ -438,7 +444,7 @@ void libvlc_media_player_release( libvlc_media_player_t *p_mi )
return;
vlc_mutex_lock( &p_mi->object_lock );
p_mi->i_refcount--;
if( p_mi->i_refcount > 0 )
......@@ -452,7 +458,7 @@ void libvlc_media_player_release( libvlc_media_player_t *p_mi )
release_input_thread( p_mi );
libvlc_event_manager_release( p_mi->p_event_manager );
libvlc_media_release( p_mi->p_md );
free( p_mi );
......@@ -477,7 +483,7 @@ void libvlc_media_player_set_media(
libvlc_media_t *p_md,
libvlc_exception_t *p_e )
{
(void)p_e;
VLC_UNUSED(p_e);
if( !p_mi )
return;
......@@ -500,7 +506,7 @@ void libvlc_media_player_set_media(
libvlc_media_retain( p_md );
p_mi->p_md = p_md;
/* The policy here is to ignore that we were created using a different
* libvlc_instance, because we don't really care */
p_mi->p_libvlc_instance = p_md->p_libvlc_instance;
......@@ -516,7 +522,7 @@ libvlc_media_player_get_media(
libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
(void)p_e;
VLC_UNUSED(p_e);
if( !p_mi->p_md )
return NULL;
......@@ -533,7 +539,7 @@ libvlc_media_player_event_manager(
libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
(void)p_e;
VLC_UNUSED(p_e);
return p_mi->p_event_manager;
}
......@@ -558,7 +564,7 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
libvlc_exception_clear( p_e );
vlc_mutex_lock( &p_mi->object_lock );
if( !p_mi->p_md )
{
libvlc_exception_raise( p_e, "no associated media descriptor" );
......@@ -665,7 +671,7 @@ void libvlc_media_player_set_drawable( libvlc_media_player_t *p_mi,
libvlc_drawable_t drawable,
libvlc_exception_t *p_e )
{
(void)p_e;
VLC_UNUSED(p_e);
p_mi->drawable = drawable;
}
......@@ -675,7 +681,7 @@ void libvlc_media_player_set_drawable( libvlc_media_player_t *p_mi,
libvlc_drawable_t
libvlc_media_player_get_drawable ( libvlc_media_player_t *p_mi, libvlc_exception_t *p_e )
{
(void)p_e;
VLC_UNUSED(p_e);
return p_mi->drawable;
}
......
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