From: Sangchul Lee Date: Thu, 18 Oct 2018 04:46:42 +0000 (+0900) Subject: Revise location of putting LCOV_EXCL_START/STOP macros and apply LCOV_EXCL_LINE macro... X-Git-Tag: submit/tizen/20190709.022805~1^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1eb2594fbc4f1472dae5e997683ca9f7c40b756;p=platform%2Fcore%2Fapi%2Fsound-manager.git Revise location of putting LCOV_EXCL_START/STOP macros and apply LCOV_EXCL_LINE macros to sound_manager_private.c Change-Id: I054e5afd650590fca7148d935842568e3225ae7a Signed-off-by: Sangchul Lee --- diff --git a/src/sound_manager_private.c b/src/sound_manager_private.c index 3289f0b..5b9fb1d 100644 --- a/src/sound_manager_private.c +++ b/src/sound_manager_private.c @@ -122,8 +122,10 @@ int _convert_sound_manager_error_code(const char *func, int code) case MM_ERROR_SOUND_INTERNAL: case MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY: case MM_ERROR_OUT_OF_MEMORY: + //LCOV_EXCL_START ret = SOUND_MANAGER_ERROR_INTERNAL; errorstr = "INTERNAL"; + //LCOV_EXCL_STOP break; case MM_ERROR_POLICY_DUPLICATED: case MM_ERROR_POLICY_INTERNAL: @@ -198,9 +200,11 @@ int _convert_stream_type(sound_stream_type_e stream_type_enum, char **stream_typ *stream_type = "ext-media"; break; default: + //LCOV_EXCL_START LOGE("could not find the stream_type[%d] in this switch case statement", stream_type_enum); ret = MM_ERROR_SOUND_INTERNAL; break; + //LCOV_EXCL_STOP } LOGI("stream_type[%s]", *stream_type); @@ -285,7 +289,7 @@ int _convert_stream_type_to_change_reason(const char *stream_type, sound_stream_ *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA; } else if (!strncmp(stream_type, "system", SOUND_STREAM_TYPE_LEN)) { - *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_SYSTEM; + *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_SYSTEM;//LCOV_EXCL_LINE } else if (!strncmp(stream_type, "alarm", SOUND_STREAM_TYPE_LEN)) { *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_ALARM; @@ -294,10 +298,10 @@ int _convert_stream_type_to_change_reason(const char *stream_type, sound_stream_ *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_NOTIFICATION; } else if (!strncmp(stream_type, "emergency", SOUND_STREAM_TYPE_LEN)) { - *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_EMERGENCY; + *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_EMERGENCY;//LCOV_EXCL_LINE } else if (!strncmp(stream_type, "voice-information", SOUND_STREAM_TYPE_LEN)) { - *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_INFORMATION; + *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_INFORMATION;//LCOV_EXCL_LINE } else if (!strncmp(stream_type, "voice-recognition", SOUND_STREAM_TYPE_LEN) || !strncmp(stream_type, "voice-recognition-service", SOUND_STREAM_TYPE_LEN)) { @@ -313,7 +317,7 @@ int _convert_stream_type_to_change_reason(const char *stream_type, sound_stream_ } else if (!strncmp(stream_type, "call-voice", SOUND_STREAM_TYPE_LEN) || !strncmp(stream_type, "call-video", SOUND_STREAM_TYPE_LEN)) { - *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_CALL; + *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_CALL;//LCOV_EXCL_LINE } else if (!strncmp(stream_type, "ext-media", SOUND_STREAM_TYPE_LEN)) { *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA_EXTERNAL_ONLY; @@ -388,17 +392,17 @@ int _convert_sound_type_to_enum(const char *sound_type, sound_type_e *sound_type SM_NULL_ARG_CHECK_FOR_PRIV(sound_type_enum); if (!strncmp(sound_type, "system", strlen(sound_type))) { - *sound_type_enum = SOUND_TYPE_SYSTEM; + *sound_type_enum = SOUND_TYPE_SYSTEM;//LCOV_EXCL_LINE } else if (!strncmp(sound_type, "notification", strlen(sound_type))) { - *sound_type_enum = SOUND_TYPE_NOTIFICATION; + *sound_type_enum = SOUND_TYPE_NOTIFICATION;//LCOV_EXCL_LINE } else if (!strncmp(sound_type, "alarm", strlen(sound_type))) { *sound_type_enum = SOUND_TYPE_ALARM; } else if (!strncmp(sound_type, "ringtone", strlen(sound_type))) { - *sound_type_enum = SOUND_TYPE_RINGTONE; + *sound_type_enum = SOUND_TYPE_RINGTONE;//LCOV_EXCL_LINE } else if (!strncmp(sound_type, "media", strlen(sound_type))) { *sound_type_enum = SOUND_TYPE_MEDIA; } else if (!strncmp(sound_type, "call", strlen(sound_type))) { - *sound_type_enum = SOUND_TYPE_CALL; + *sound_type_enum = SOUND_TYPE_CALL;//LCOV_EXCL_LINE } else if (!strncmp(sound_type, "voip", strlen(sound_type))) { *sound_type_enum = SOUND_TYPE_VOIP; } else if (!strncmp(sound_type, "voice", strlen(sound_type))) { @@ -412,7 +416,7 @@ int _convert_sound_type_to_enum(const char *sound_type, sound_type_e *sound_type return MM_ERROR_NONE; } - +//LCOV_EXCL_START int _convert_device_type_enum_to_str(sound_device_type_e device_type, char **device_type_str) { SM_NULL_ARG_CHECK_FOR_PRIV(device_type_str); @@ -427,7 +431,6 @@ int _convert_device_type_enum_to_str(sound_device_type_e device_type, char **dev case SOUND_DEVICE_BUILTIN_MIC: *device_type_str = "builtin-mic"; break; - //LCOV_EXCL_START case SOUND_DEVICE_AUDIO_JACK: *device_type_str = "audio-jack"; break; @@ -449,7 +452,6 @@ int _convert_device_type_enum_to_str(sound_device_type_e device_type, char **dev default: LOGE("could not find the device_type[%d] in this switch case statement", device_type); return MM_ERROR_SOUND_INTERNAL; - //LCOV_EXCL_STOP } LOGI("device_type[%s]", *device_type_str); @@ -464,7 +466,7 @@ int _convert_device_type_str_to_enum(const char *device_type_str, sound_device_t if (!strncmp(device_type_str, "builtin-speaker", SOUND_DEVICE_TYPE_LEN)) { *device_type = SOUND_DEVICE_BUILTIN_SPEAKER; - //LCOV_EXCL_START + } else if (!strncmp(device_type_str, "builtin-receiver", SOUND_DEVICE_TYPE_LEN)) { *device_type = SOUND_DEVICE_BUILTIN_RECEIVER; @@ -489,11 +491,10 @@ int _convert_device_type_str_to_enum(const char *device_type_str, sound_device_t LOGE("not supported device_type(%s)", device_type_str); return MM_ERROR_INVALID_ARGUMENT; } - //LCOV_EXCL_STOP return MM_ERROR_NONE; } - +//LCOV_EXCL_STOP int _convert_device_type(mm_sound_device_type_e device_type, sound_device_type_e *sound_device_type) { switch (device_type) { @@ -552,7 +553,7 @@ int _convert_device_io_direction(mm_sound_device_io_direction_e io_direction, so return MM_ERROR_NONE; } - +//LCOV_EXCL_START const char* _convert_api_name(native_api_e api_name) { const char* name = NULL; @@ -581,7 +582,6 @@ const char* _convert_api_name(native_api_e api_name) return name; } -//LCOV_EXCL_START int _convert_sample_format_enum_to_str(sound_sample_format_e format, char **format_str) { SM_NULL_ARG_CHECK_FOR_PRIV(format_str); @@ -888,10 +888,12 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) NULL, &err); if (!result || err) { + //LCOV_EXCL_START LOGE("g_dbus_connection_call_sync() for GET_STREAM_INFO error (%s)", err ? err->message : NULL); g_error_free(err); ret = MM_ERROR_SOUND_INTERNAL; goto LEAVE; + //LCOV_EXCL_STOP } /* get priority */ @@ -972,7 +974,7 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) i = 0; while (g_variant_iter_loop(&iter, "&s", &name)) { if (size == 1 && !strncmp(name, "none", strlen("none"))) { - LOGI(" framework is [%s], skip it", name); + LOGI(" framework is [%s], skip it", name);//LCOV_EXCL_LINE break; } LOGI(" framework name : %s", name); @@ -982,7 +984,7 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) g_variant_unref(child); if (info->priority == -1) { - LOGE("could not find the info of stream type(%s)", stream_type); + LOGE("could not find the info of stream type(%s)", stream_type);//LCOV_EXCL_LINE ret = MM_ERROR_NOT_SUPPORT_API; } @@ -1044,10 +1046,12 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info) NULL, &err); if (!result || err) { + //LCOV_EXCL_START LOGE("g_dbus_connection_call_sync() for SET_STREAM_ROUTE_DEVICES error (%s)", err ? err->message : NULL); g_error_free(err); ret = MM_ERROR_SOUND_INTERNAL; goto LEAVE; + //LCOV_EXCL_STOP } g_variant_get(result, "(&s)", &dbus_ret); @@ -1144,16 +1148,18 @@ int _get_volume_max_level(const char *direction, const char *volume_type, unsign NULL, &err); if (!result || err) { + //LCOV_EXCL_START LOGE("g_dbus_connection_call_sync() for GET_VOLUME_MAX_LEVEL error (%s)", err ? err->message : NULL); g_error_free(err); ret = MM_ERROR_SOUND_INTERNAL; goto LEAVE; + //LCOV_EXCL_STOP } g_variant_get(result, "(u&s)", max_level, &dbus_ret); LOGI("g_dbus_connection_call_sync() success, method return value is (%u, %s)", *max_level, dbus_ret); if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) - ret = MM_ERROR_SOUND_INTERNAL; + ret = MM_ERROR_SOUND_INTERNAL;//LCOV_EXCL_LINE LEAVE: g_variant_unref(result); @@ -1288,21 +1294,23 @@ int _get_current_volume_type(const char *direction, char **volume_type) NULL, &err); if (!result || err) { + //LCOV_EXCL_START LOGE("g_dbus_connection_call_sync() for GET_CURRENT_VOLUME_TYPE error (%s)", err ? err->message : NULL); g_error_free(err); ret = MM_ERROR_SOUND_INTERNAL; goto LEAVE; + //LCOV_EXCL_STOP } g_variant_get(result, "(&s&s)", &dbus_volume_type, &dbus_ret); LOGI("g_dbus_connection_call_sync() success, method return value is (%s, %s)", dbus_volume_type, dbus_ret); if (!strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) { - ret = MM_ERROR_NONE; - *volume_type = strdup(dbus_volume_type); + ret = MM_ERROR_NONE;//LCOV_EXCL_LINE + *volume_type = strdup(dbus_volume_type);//LCOV_EXCL_LINE } else if (!strncmp("STREAM_MANAGER_RETURN_ERROR_NO_STREAM", dbus_ret, strlen(dbus_ret))) { ret = MM_ERROR_SOUND_VOLUME_NO_INSTANCE; } else { - ret = MM_ERROR_SOUND_INTERNAL; + ret = MM_ERROR_SOUND_INTERNAL;//LCOV_EXCL_LINE } LEAVE: @@ -1339,10 +1347,12 @@ int _get_current_media_routing_path(const char *direction, sound_device_type_e * NULL, &err); if (!result || err) { + //LCOV_EXCL_START LOGE("g_dbus_connection_call_sync() for GET_CURRENT_MEDIA_ROUTING_PATH error (%s)", err ? err->message : NULL); g_error_free(err); ret = MM_ERROR_SOUND_INTERNAL; goto LEAVE; + //LCOV_EXCL_STOP } g_variant_get(result, "(&s&s)", &dbus_device_type, &dbus_ret); @@ -1350,7 +1360,7 @@ int _get_current_media_routing_path(const char *direction, sound_device_type_e * if (!strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) { ret = MM_ERROR_NONE; if (_convert_device_type_str_to_enum(dbus_device_type, device_type) < 0) - ret = MM_ERROR_SOUND_INTERNAL; + ret = MM_ERROR_SOUND_INTERNAL;//LCOV_EXCL_LINE } else { if (!strncmp("none", dbus_device_type, strlen(dbus_device_type))) ret = MM_ERROR_SOUND_NO_DATA; @@ -1387,14 +1397,16 @@ void _update_focus_status(unsigned int index, unsigned int acquired_focus_status NULL, &err); if (!result || err) { + //LCOV_EXCL_START LOGE("g_dbus_connection_call_sync() for UPDATE_FOCUS_STATUS error (%s)", err ? err->message : NULL); g_error_free(err); goto LEAVE; + //LCOV_EXCL_STOP } g_variant_get(result, "(&s)", &dbus_ret); LOGI("g_dbus_connection_call_sync() success, method return value is (%s)", dbus_ret); if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) - LOGE("failed to UPDATE_FOCUS_STATUS error (%s)", dbus_ret); + LOGE("failed to UPDATE_FOCUS_STATUS error (%s)", dbus_ret);//LCOV_EXCL_LINE LEAVE: g_variant_unref(result); @@ -1944,7 +1956,7 @@ int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, sound_ pa_context_set_state_callback(stream_h->pa_context, _pa_context_state_cb, stream_h); if (pa_context_connect(stream_h->pa_context, NULL, 0, NULL) < 0) { - pa_ret = pa_context_errno(stream_h->pa_context); + pa_ret = pa_context_errno(stream_h->pa_context);//LCOV_EXCL_LINE goto PA_ERROR; } @@ -1960,7 +1972,7 @@ int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, sound_ if (state == PA_CONTEXT_READY) break; if (!PA_CONTEXT_IS_GOOD(state)) { - pa_ret = pa_context_errno(stream_h->pa_context); + pa_ret = pa_context_errno(stream_h->pa_context);//LCOV_EXCL_LINE goto PA_ERROR_WITH_UNLOCK; } pa_threaded_mainloop_wait(stream_h->pa_mainloop); @@ -1978,7 +1990,7 @@ int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, sound_ stream_h->user_cb = callback; stream_h->user_data = user_data; } else { - LOGE("failed to register focus, ret(0x%x)", ret); + LOGE("failed to register focus, ret(0x%x)", ret);//LCOV_EXCL_LINE /* disconnect */ goto PA_ERROR; } @@ -2045,7 +2057,7 @@ int _destroy_pa_connection_and_unregister_focus(sound_stream_info_s *stream_h) if (!stream_h->is_focus_unavailable) { ret = mm_sound_unregister_focus(stream_h->focus_id); if (ret) - LOGE("failed to unregister focus, ret(0x%x)", ret); + LOGE("failed to unregister focus, ret(0x%x)", ret);//LCOV_EXCL_LINE } for (i = 0; i < AVAIL_DEVICES_MAX; i++) { @@ -2268,7 +2280,7 @@ int _remove_all_devices_for_stream_routing(sound_stream_info_s *stream_info) return MM_ERROR_NONE; } - +//LCOV_EXCL_START int _add_device_id_for_stream_routing(sound_stream_info_s *stream_info, int device_id) { int ret = MM_ERROR_NONE; @@ -2340,7 +2352,7 @@ LEAVE: mm_sound_free_device(device); return ret; } - +//LCOV_EXCL_STOP int _apply_stream_routing(sound_stream_info_s *stream_info) { int i = 0; @@ -2349,10 +2361,10 @@ int _apply_stream_routing(sound_stream_info_s *stream_info) if (stream_info->stream_conf_info.route_type != STREAM_ROUTE_TYPE_MANUAL && stream_info->stream_conf_info.route_type != STREAM_ROUTE_TYPE_MANUAL_EXT) { - LOGE("route type is not manual or manual-ext"); + LOGE("route type is not manual or manual-ext");//LCOV_EXCL_LINE /* Differ from others, it uses SOUND_INTERNAL error. * ACR process is required prior to changing error value. */ - return MM_ERROR_SOUND_INTERNAL; + return MM_ERROR_SOUND_INTERNAL;//LCOV_EXCL_LINE } for (i = 0; i < AVAIL_DEVICES_MAX; i++) {