Skip to content

Commit

Permalink
libvlc: add missing "_t" in media_discoverer structs/enums
Browse files Browse the repository at this point in the history
For the sake of coherence.
  • Loading branch information
tguillem committed Jul 20, 2016
1 parent 9d2a950 commit b0984a6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions include/vlc/libvlc_media_discoverer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {
* Category of a media discoverer
* \see libvlc_media_discoverer_list_get()
*/
typedef enum libvlc_media_discoverer_category {
typedef enum libvlc_media_discoverer_category_t {
/** devices, like portable music player */
libvlc_media_discoverer_devices,
/** LAN/WAN services, like Upnp, SMB, or SAP */
Expand All @@ -43,17 +43,17 @@ typedef enum libvlc_media_discoverer_category {
libvlc_media_discoverer_podcasts,
/** Local directories, like Video, Music or Pictures directories */
libvlc_media_discoverer_localdirs,
} libvlc_media_discoverer_category;
} libvlc_media_discoverer_category_t;

/**
* Media discoverer description
* \see libvlc_media_discoverer_list_get()
*/
typedef struct libvlc_media_discoverer_description {
typedef struct libvlc_media_discoverer_description_t {
char *psz_name;
char *psz_longname;
libvlc_media_discoverer_category i_cat;
} libvlc_media_discoverer_description;
libvlc_media_discoverer_category_t i_cat;
} libvlc_media_discoverer_description_t;

/** \defgroup libvlc_media_discoverer LibVLC media discovery
* \ingroup libvlc
Expand Down Expand Up @@ -164,8 +164,8 @@ libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis );
*/
LIBVLC_API ssize_t
libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
libvlc_media_discoverer_category i_cat,
libvlc_media_discoverer_description ***ppp_services );
libvlc_media_discoverer_category_t i_cat,
libvlc_media_discoverer_description_t ***ppp_services );

/**
* Release an array of media discoverer services
Expand All @@ -178,7 +178,7 @@ libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
* \param i_count number of elements in the array
*/
LIBVLC_API void
libvlc_media_discoverer_list_release( libvlc_media_discoverer_description **pp_services,
libvlc_media_discoverer_list_release( libvlc_media_discoverer_description_t **pp_services,
size_t i_count );

/**@} */
Expand Down
14 changes: 7 additions & 7 deletions lib/media_discoverer.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis )
}

void
libvlc_media_discoverer_list_release( libvlc_media_discoverer_description **pp_services,
libvlc_media_discoverer_list_release( libvlc_media_discoverer_description_t **pp_services,
size_t i_count )
{
if( i_count > 0 )
Expand All @@ -372,8 +372,8 @@ libvlc_media_discoverer_list_release( libvlc_media_discoverer_description **pp_s

ssize_t
libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
libvlc_media_discoverer_category i_cat,
libvlc_media_discoverer_description ***ppp_services )
libvlc_media_discoverer_category_t i_cat,
libvlc_media_discoverer_description_t ***ppp_services )
{
assert( p_inst != NULL && ppp_services != NULL );

Expand Down Expand Up @@ -420,17 +420,17 @@ libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
i_nb_services++;
}

libvlc_media_discoverer_description **pp_services = NULL, *p_services = NULL;
libvlc_media_discoverer_description_t **pp_services = NULL, *p_services = NULL;
if( i_nb_services > 0 )
{
/* Double alloc here, so that the caller iterates through pointers of
* struct instead of structs. This allows us to modify the struct
* without breaking the API. */

pp_services = malloc( i_nb_services
* sizeof(libvlc_media_discoverer_description *) );
* sizeof(libvlc_media_discoverer_description_t *) );
p_services = malloc( i_nb_services
* sizeof(libvlc_media_discoverer_description) );
* sizeof(libvlc_media_discoverer_description_t) );
if( pp_services == NULL || p_services == NULL )
{
free( pp_services );
Expand All @@ -448,7 +448,7 @@ libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
ppsz_name = ppsz_names;
p_category = p_categories;
unsigned int i_service_idx = 0;
libvlc_media_discoverer_description *p_service = p_services;
libvlc_media_discoverer_description_t *p_service = p_services;
for( ; *ppsz_name != NULL; ppsz_name++, ppsz_longname++, p_category++ )
{
if( pp_services != NULL && *p_category == i_core_cat )
Expand Down
10 changes: 5 additions & 5 deletions test/libvlc/media_discoverer.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ main(int i_argc, char *ppsz_argv[])
return 0;
}

for(libvlc_media_discoverer_category i_cat = libvlc_media_discoverer_devices;
for(libvlc_media_discoverer_category_t i_cat = libvlc_media_discoverer_devices;
i_cat <= libvlc_media_discoverer_localdirs; i_cat ++)
{
log("== getting list of media_discoverer for %d category ==\n", i_cat);

libvlc_media_discoverer_description **pp_services;
unsigned int i_count =
libvlc_media_discoverer_description_t **pp_services;
ssize_t i_count =
libvlc_media_discoverer_list_get(p_vlc, i_cat, &pp_services);
if (i_count == 0)
if (i_count <= 0)
{
log("warn: no discoverers (not critical)\n");
continue;
Expand All @@ -131,7 +131,7 @@ main(int i_argc, char *ppsz_argv[])

for (unsigned int i = 0; i < i_count; ++i)
{
libvlc_media_discoverer_description *p_service = pp_services[i];
libvlc_media_discoverer_description_t *p_service = pp_services[i];

assert(i_cat == p_service->i_cat);
log("= discoverer: name: '%s', longname: '%s' =\n",
Expand Down

0 comments on commit b0984a6

Please sign in to comment.