From: Sangchul Lee Date: Thu, 9 Jul 2020 04:19:28 +0000 (+0900) Subject: Remove assert() X-Git-Tag: accepted/tizen/unified/20200710.114037^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5caa8020a99254cbb045cb16c69a8e4a8ebb2986;p=platform%2Fcore%2Fapi%2Fsound-manager.git Remove assert() These are replaced with SM_ARG_CHECK() macro if possible. [Version] 0.6.26 [Issue Type] Improvement Signed-off-by: Sangchul Lee Change-Id: I0d8f452dff3260264bd56d4482a4dde8247f0fb2 --- diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index 09a45be..c959b0f 100644 --- a/packaging/capi-media-sound-manager.spec +++ b/packaging/capi-media-sound-manager.spec @@ -1,6 +1,6 @@ Name: capi-media-sound-manager Summary: Sound Manager library -Version: 0.6.25 +Version: 0.6.26 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/sound_manager_private.c b/src/sound_manager_private.c index 4dfc552..9c3ad15 100644 --- a/src/sound_manager_private.c +++ b/src/sound_manager_private.c @@ -901,7 +901,15 @@ void _pa_context_state_cb(pa_context *c, void *userdata) pa_context_state_t state; sound_pa_info_s *pa_info = (sound_pa_info_s *)userdata; - assert(c); + if (!c) { + LOGE("pa_context is null"); + return; + } + + if (!pa_info) { + LOGE("pa_info is null"); + return; + } state = pa_context_get_state(c); @@ -929,12 +937,20 @@ void _pa_context_state_cb(pa_context *c, void *userdata) } //LCOV_EXCL_START -void _pa_stream_state_cb(pa_stream *s, void * userdata) +void _pa_stream_state_cb(pa_stream *s, void *userdata) { pa_stream_state_t state; virtual_sound_stream_info_s *vstream_h = (virtual_sound_stream_info_s*)userdata; - assert(s); + if (!s) { + LOGE("pa_stream is null"); + return; + } + + if (!vstream_h) { + LOGE("vstream_h is null"); + return; + } state = pa_stream_get_state(s); LOGI("vstream_h[%p] index[%d] state[%d]", vstream_h, pa_stream_get_index(s), state); @@ -967,8 +983,8 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) gsize size = 0; int i = 0; - assert(stream_type); - assert(info); + SM_ARG_CHECK(stream_type); + SM_ARG_CHECK(info); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; @@ -1104,7 +1120,7 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info) GError *err = NULL; const gchar *dbus_ret = NULL; - assert(info); + SM_ARG_CHECK(info); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; @@ -1182,7 +1198,7 @@ int _set_route_option(unsigned int index, const char *name, int value) GError *err = NULL; const gchar *dbus_ret = NULL; - assert(name); + SM_ARG_CHECK(name); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; @@ -1233,9 +1249,9 @@ int _get_volume_max_level(const char *direction, const char *volume_type, unsign GError *err = NULL; const gchar *dbus_ret = NULL; - assert(direction); - assert(volume_type); - assert(max_level); + SM_ARG_CHECK(direction); + SM_ARG_CHECK(volume_type); + SM_ARG_CHECK(max_level); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; @@ -1286,9 +1302,9 @@ int _get_volume_level(const char *direction, const char *volume_type, unsigned i GError *err = NULL; const gchar *dbus_ret = NULL; - assert(direction); - assert(volume_type); - assert(level); + SM_ARG_CHECK(direction); + SM_ARG_CHECK(volume_type); + SM_ARG_CHECK(level); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; @@ -1338,8 +1354,8 @@ int _set_volume_level(const char *direction, const char *volume_type, unsigned i int vret = 0; char volume_path[VCONF_PATH_MAX] = {0,}; - assert(direction); - assert(volume_type); + SM_ARG_CHECK(direction); + SM_ARG_CHECK(volume_type); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; @@ -1393,8 +1409,8 @@ int _get_current_volume_type(const char *direction, char **volume_type) const gchar *dbus_volume_type = NULL; const gchar *dbus_ret = NULL; - assert(direction); - assert(volume_type); + SM_ARG_CHECK(direction); + SM_ARG_CHECK(volume_type); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; @@ -1450,8 +1466,8 @@ int _get_current_media_routing_path(const char *direction, sound_device_type_e * const gchar *dbus_device_type = NULL; const gchar *dbus_ret = NULL; - assert(direction); - assert(device_type); + SM_ARG_CHECK(direction); + SM_ARG_CHECK(device_type); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret; @@ -1546,7 +1562,7 @@ int _is_device_running_by_id(int device_id, bool *is_running) GError *err = NULL; gboolean _is_running; - assert(is_running); + SM_ARG_CHECK(is_running); if ((ret = __get_dbus_connection(&conn)) != SOUND_MANAGER_ERROR_NONE) return ret;