[vlc-devel] [RFC PATCH 2/2] libvlc: media_discoverer: remove usage of ssize_t
Thomas Guillem
thomas at gllm.fr
Fri Jul 22 14:26:53 CEST 2016
It's in POSIX but not in C standard.
---
include/vlc/libvlc_media_discoverer.h | 4 ++--
lib/media_discoverer.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/vlc/libvlc_media_discoverer.h b/include/vlc/libvlc_media_discoverer.h
index 17024e9..96c0515 100644
--- a/include/vlc/libvlc_media_discoverer.h
+++ b/include/vlc/libvlc_media_discoverer.h
@@ -158,9 +158,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 or -1 on error
+ * \return the number of media discoverer services (0 on error)
*/
-LIBVLC_API ssize_t
+LIBVLC_API size_t
libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
libvlc_media_discoverer_category_t i_cat,
libvlc_media_discoverer_description_t ***ppp_services );
diff --git a/lib/media_discoverer.c b/lib/media_discoverer.c
index 5862e2a..75a91d7 100644
--- a/lib/media_discoverer.c
+++ b/lib/media_discoverer.c
@@ -370,7 +370,7 @@ libvlc_media_discoverer_list_release( libvlc_media_discoverer_description_t **pp
}
}
-ssize_t
+size_t
libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
libvlc_media_discoverer_category_t i_cat,
libvlc_media_discoverer_description_t ***ppp_services )
@@ -395,7 +395,7 @@ libvlc_media_discoverer_list_get( libvlc_instance_t *p_inst,
default:
vlc_assert_unreachable();
*ppp_services = NULL;
- return -1;
+ return 0;
}
/* 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) */
- ssize_t i_nb_services = 0;
+ size_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 = -1;
+ i_nb_services = 0;
/* Even if alloc fails, the next loop must be run in order to free
* names returned by vlc_sd_GetNames */
}
--
2.8.1
More information about the vlc-devel
mailing list