[vlc-commits] libvlc: use ssize_t/size_t for the count of the media discoverer list
Thomas Guillem
git at videolan.org
Wed Jul 20 13:24:15 CEST 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 20 11:35:44 2016 +0200| [74f3deabb4a0713d156a84888c7abcd6bced01fa] | committer: Thomas Guillem
libvlc: use ssize_t/size_t for the count of the media discoverer list
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74f3deabb4a0713d156a84888c7abcd6bced01fa
---
include/vlc/libvlc_media_discoverer.h | 6 +++---
lib/media_discoverer.c | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/vlc/libvlc_media_discoverer.h b/include/vlc/libvlc_media_discoverer.h
index 79b8e43..e18bfbb 100644
--- a/include/vlc/libvlc_media_discoverer.h
+++ b/include/vlc/libvlc_media_discoverer.h
@@ -160,9 +160,9 @@ libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis );
* services (must be freed with libvlc_media_discoverer_list_release() by
* the caller) [OUT]
*
- * \return the number of media discoverer services (zero on error)
+ * \return the number of media discoverer services or -1 on error
*/
-LIBVLC_API unsigned int
+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 );
@@ -179,7 +179,7 @@ libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
*/
LIBVLC_API void
libvlc_media_discoverer_list_release( libvlc_media_discoverer_description **pp_services,
- unsigned int i_count );
+ size_t i_count );
/**@} */
diff --git a/lib/media_discoverer.c b/lib/media_discoverer.c
index 55e5c95..d91937e 100644
--- a/lib/media_discoverer.c
+++ b/lib/media_discoverer.c
@@ -356,11 +356,11 @@ libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis )
void
libvlc_media_discoverer_list_release( libvlc_media_discoverer_description **pp_services,
- unsigned int i_count )
+ size_t i_count )
{
if( i_count > 0 )
{
- for( unsigned int i = 0; i < i_count; ++i )
+ for( size_t i = 0; i < i_count; ++i )
{
free( pp_services[i]->psz_name );
free( pp_services[i]->psz_longname );
@@ -370,7 +370,7 @@ libvlc_media_discoverer_list_release( libvlc_media_discoverer_description **pp_s
}
}
-unsigned int
+ssize_t
libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
libvlc_media_discoverer_category i_cat,
libvlc_media_discoverer_description ***ppp_services )
@@ -395,7 +395,7 @@ libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
default:
vlc_assert_unreachable();
*ppp_services = NULL;
- return 0;
+ return -1;
}
/* Fetch all sd names, longnames and categories */
@@ -411,7 +411,7 @@ libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
}
/* Count the number of sd matching our category (i_cat/i_core_cat) */
- unsigned int i_nb_services = 0;
+ ssize_t i_nb_services = 0;
char **ppsz_name = ppsz_names;
int *p_category = p_categories;
for( ; *ppsz_name != NULL; ppsz_name++, p_category++ )
@@ -437,7 +437,7 @@ libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
free( p_services );
pp_services = NULL;
p_services = NULL;
- i_nb_services = 0;
+ i_nb_services = -1;
/* Even if alloc fails, the next loop must be run in order to free
* names returned by vlc_sd_GetNames */
}
More information about the vlc-commits
mailing list