Apply the coding rule to src, test folder 52/66252/1 accepted/tizen/common/20160418.141825 submit/tizen/20160418.054804
authorHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 18 Apr 2016 05:44:33 +0000 (14:44 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Mon, 18 Apr 2016 05:44:33 +0000 (14:44 +0900)
Change-Id: I7a65c298087abba0c811ef42fc6a2d9801cb713d
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
14 files changed:
src/bluetooth-adapter.c
src/bluetooth-audio.c
src/bluetooth-avrcp.c
src/bluetooth-common.c
src/bluetooth-device.c
src/bluetooth-gatt.c
src/bluetooth-hdp.c
src/bluetooth-hid.c
src/bluetooth-ipsp.c
src/bluetooth-pan.c
src/bluetooth-pbap.c
test/bt_chat_client.c
test/bt_chat_server.c
test/bt_unit_test.c

index 12a907fb9509327c6a73ab73f2161b8255fc2c4b..f4f0c15f01b4af383af92b51afb7a150e2deabcf 100644 (file)
@@ -1332,9 +1332,8 @@ static int __bt_remove_ad_data_by_type(char *in_data, unsigned int in_len,
        }
 
        p = (char *)malloc(sizeof(char) *(in_len - len));
-       if (p == NULL) {
+       if (p == NULL)
                return BT_ERROR_OUT_OF_MEMORY;
-       }
 
        memcpy(p, in_data, sizeof(char) *i);
        memcpy(p + i, in_data + i + len, sizeof(char) *(in_len - len - i));
@@ -1399,9 +1398,8 @@ int bt_adapter_le_add_advertising_data(bt_advertiser_h advertiser,
                *p = NULL;
 
        new_p = realloc(*p, sizeof(char) *(*len + data_size + 2));
-       if (new_p == NULL) {
+       if (new_p == NULL)
                return BT_ERROR_OUT_OF_MEMORY;
-       }
 
        new_p[*len] = data_size + 1;
        new_p[*len + 1] = adv_type;
@@ -1457,9 +1455,8 @@ int bt_adapter_le_remove_advertising_data(bt_advertiser_h advertiser,
        }
 
        ret = __bt_remove_ad_data_by_type(*p, *len, adv_type, &new_p, &new_len);
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                return ret;
-       }
 
        free(*p);
        *p = new_p;
index bfd413fa2f99ef884c614526f7abac466e6c775d..3e5a14ade40daefd4c72875160abf4c4c12cdb69 100644 (file)
@@ -271,9 +271,9 @@ int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type)
                break;
        }
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 /* LCOV_EXCL_STOP */
@@ -329,9 +329,9 @@ int bt_audio_disconnect(const char *remote_address, bt_audio_profile_type_e type
                break;
        }
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 /* LCOV_EXCL_STOP */
@@ -366,9 +366,9 @@ int bt_ag_notify_speaker_gain(int gain)
        BT_CHECK_AG_INIT_STATUS();
        error = bluetooth_telephony_set_speaker_gain((unsigned short)gain);
        error = _bt_convert_telephony_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 
@@ -382,9 +382,9 @@ int bt_ag_get_speaker_gain(int *gain)
        BT_CHECK_INPUT_PARAMETER(gain);
        error = bluetooth_telephony_get_headset_volume((unsigned int *)gain);
        error = _bt_convert_telephony_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 
@@ -400,9 +400,9 @@ int bt_ag_is_nrec_enabled(bool *enabled)
 
        error = bluetooth_telephony_is_nrec_enabled(&is_enabled);
        error = _bt_convert_telephony_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        if (is_enabled)
                *enabled = true;
        else
@@ -423,9 +423,9 @@ int bt_ag_is_wbs_mode(bool *wbs_mode)
 
        error = bluetooth_telephony_is_wbs_mode(&is_wbs_mode);
        error = _bt_convert_telephony_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        if (is_wbs_mode)
                *wbs_mode = true;
        else
@@ -487,9 +487,9 @@ int bt_ag_open_sco(void)
        BT_CHECK_AG_INIT_STATUS(); /* LCOV_EXCL_START */
        error = bluetooth_telephony_audio_open();
        error = _bt_convert_telephony_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error; /* LCOV_EXCL_STOP */
 }
 
@@ -502,9 +502,9 @@ int bt_ag_close_sco(void)
        BT_CHECK_AG_INIT_STATUS(); /* LCOV_EXCL_START */
        error = bluetooth_telephony_audio_close();
        error = _bt_convert_telephony_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error; /* LCOV_EXCL_STOP */
 }
 
@@ -582,9 +582,9 @@ int bt_ag_notify_call_event(bt_ag_call_event_e event, unsigned int call_id, cons
                error = BLUETOOTH_TELEPHONY_ERROR_INVALID_PARAM;
        }
        error = _bt_convert_telephony_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 
@@ -602,9 +602,9 @@ int bt_ag_notify_call_list(bt_call_list_h list)
        call_count = g_list_length(handle->list);
        error = bluetooth_telephony_set_call_status((void *)handle->list, call_count);
        error = _bt_convert_telephony_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 /* LCOV_EXCL_STOP */
@@ -621,9 +621,9 @@ int bt_ag_notify_voice_recognition_state(bool state)
        else
                error = bluetooth_telephony_stop_voice_recognition();
        error = _bt_convert_telephony_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error; /* LCOV_EXCL_STOP */
 }
 
@@ -898,9 +898,9 @@ int bt_hf_notify_call_event(bt_hf_call_event_e event, char *phone_number)
        }
 
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 
index 2c5d0d317e8080e99983bbcd511000e87a0f7b1c..dc022ffb0acbae9469e933c97b1516b9126a858c 100644 (file)
@@ -140,9 +140,9 @@ int bt_avrcp_target_notify_equalizer_state(bt_avrcp_equalizer_state_e state)
        error = bluetooth_media_player_change_property(EQUALIZER, state);
        error = _bt_convert_avrcp_error_code(error);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
-       }
+
        return error;
 }
 int bt_avrcp_target_notify_repeat_mode(bt_avrcp_repeat_mode_e mode)
@@ -155,9 +155,9 @@ int bt_avrcp_target_notify_repeat_mode(bt_avrcp_repeat_mode_e mode)
        error = bluetooth_media_player_change_property(REPEAT, mode);
        error = _bt_convert_avrcp_error_code(error);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
-       }
+
        return error;
 }
 
@@ -171,9 +171,9 @@ int bt_avrcp_target_notify_shuffle_mode(bt_avrcp_shuffle_mode_e mode)
        error = bluetooth_media_player_change_property(SHUFFLE, mode);
        error = _bt_convert_avrcp_error_code(error);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
-       }
+
        return error;
 }
 int bt_avrcp_target_notify_scan_mode(bt_avrcp_scan_mode_e mode)
@@ -186,9 +186,9 @@ int bt_avrcp_target_notify_scan_mode(bt_avrcp_scan_mode_e mode)
        error = bluetooth_media_player_change_property(SCAN, mode);
        error = _bt_convert_avrcp_error_code(error);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
-       }
+
        return error;
 }
 
@@ -202,9 +202,9 @@ int bt_avrcp_target_notify_player_state(bt_avrcp_player_state_e state)
        error = bluetooth_media_player_change_property(STATUS, state);
        error = _bt_convert_avrcp_error_code(error);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
-       }
+
        return error;
 }
 
@@ -218,9 +218,9 @@ int bt_avrcp_target_notify_position(unsigned int position)
        error = bluetooth_media_player_change_property(POSITION, position);
        error = _bt_convert_avrcp_error_code(error);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
-       }
+
        return error;
 }
 
@@ -243,9 +243,9 @@ int bt_avrcp_target_notify_track(const char *title, const char *artist, const ch
        error = bluetooth_media_player_change_track(&metadata);
        error = _bt_convert_avrcp_error_code(error);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
-       }
+
        return error;
 }
 
index eea0285dddf94072f2c15725756d0914a6a62409..ada528f615e74dcb24e5140f8f3f35b4825d46eb 100644 (file)
@@ -225,15 +225,13 @@ int _bt_get_bt_device_info_s(bt_device_info_s **dest_dev, bluetooth_device_info_
        BT_CHECK_INPUT_PARAMETER(source_dev);
 
        *dest_dev = (bt_device_info_s *)malloc(sizeof(bt_device_info_s));
-       if (*dest_dev == NULL) {
+       if (*dest_dev == NULL)
                return BT_ERROR_OUT_OF_MEMORY;
-       }
 
-       if (strlen(source_dev->device_name.name) > 0) {
+       if (strlen(source_dev->device_name.name) > 0)
                (*dest_dev)->remote_name = strdup(source_dev->device_name.name);
-       } else {
+       else
                (*dest_dev)->remote_name = NULL;
-       }
 
        _bt_convert_address_to_string(&((*dest_dev)->remote_address), &(source_dev->device_address));
 
@@ -247,9 +245,8 @@ int _bt_get_bt_device_info_s(bt_device_info_s **dest_dev, bluetooth_device_info_
                                (*dest_dev)->service_uuid[i] =
                                        g_strndup(source_dev->uuids[i],
                                                BLUETOOTH_UUID_STRING_MAX - 1);
-                               if ((*dest_dev)->service_uuid[i] != NULL) {
+                               if ((*dest_dev)->service_uuid[i] != NULL)
                                        __bt_convert_lower_to_upper((*dest_dev)->service_uuid[i]);
-                               }
                        }
                }
        } else {
@@ -310,11 +307,10 @@ int _bt_convert_address_to_string(char **addr_str, bluetooth_device_address_t *a
        snprintf(address, 18, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", addr_hex->addr[0], addr_hex->addr[1], addr_hex->addr[2], addr_hex->addr[3], addr_hex->addr[4], addr_hex->addr[5]);
        *addr_str = strdup(address);
 
-       if (*addr_str != NULL) {
+       if (*addr_str != NULL)
                return BT_ERROR_NONE;
-       } else {
+       else
                return BT_ERROR_OUT_OF_MEMORY; /* LCOV_EXCL_LINE */
-       }
 }
 
 void _bt_convert_address_to_hex(bluetooth_device_address_t *addr_hex, const char *addr_str)
@@ -326,13 +322,11 @@ void _bt_convert_address_to_hex(bluetooth_device_address_t *addr_hex, const char
                return; /* LCOV_EXCL_LINE */
 
        i = sscanf(addr_str, "%X:%X:%X:%X:%X:%X", &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]);
-       if (i != BLUETOOTH_ADDRESS_LENGTH) {
+       if (i != BLUETOOTH_ADDRESS_LENGTH)
                BT_ERR("Invalid format string - [%s]", addr_str); /* LCOV_EXCL_LINE */
-       }
 
-       for (i = 0; i < BLUETOOTH_ADDRESS_LENGTH; i++) {
+       for (i = 0; i < BLUETOOTH_ADDRESS_LENGTH; i++)
                addr_hex->addr[i] = (unsigned char)addr[i];
-       }
 }
 
 char *_bt_convert_error_to_string(int error)
@@ -1123,9 +1117,9 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                BT_INFO("BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED");
                dev_info = (bluetooth_network_device_info_t *)(param->param_data);
 
-               if (param->result != BLUETOOTH_ERROR_NONE) {
+               if (param->result != BLUETOOTH_ERROR_NONE)
                        BT_ERR("Fail to connect the network server");
-               }
+
                _bt_convert_address_to_string(&device_addr, &dev_info->device_address);
                ((bt_nap_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
                (TRUE, device_addr, dev_info->interface_name, bt_event_slot_container[event_index].user_data);
@@ -1138,9 +1132,9 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                BT_INFO("BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED");
                dev_info = (bluetooth_network_device_info_t *)(param->param_data);
 
-               if (param->result != BLUETOOTH_ERROR_NONE) {
+               if (param->result != BLUETOOTH_ERROR_NONE)
                        BT_ERR("Fail to disconnect the network server");
-               }
+
                _bt_convert_address_to_string(&device_addr, &dev_info->device_address);
                ((bt_nap_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
                (FALSE, device_addr, dev_info->interface_name, bt_event_slot_container[event_index].user_data);
@@ -1200,9 +1194,8 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
        case BLUETOOTH_EVENT_HDP_DATA_RECEIVED:
                BT_INFO("HDP data recieved callback will be ");
                hdp_data_ind = (bt_hdp_data_ind_t *)(param->param_data);
-               if (param->result != BLUETOOTH_ERROR_NONE) {
+               if (param->result != BLUETOOTH_ERROR_NONE)
                        BT_ERR("Fail to receive HDP data");
-               }
 
                ((bt_hdp_data_received_cb)bt_event_slot_container[event_index].callback)
                (hdp_data_ind->channel_id, hdp_data_ind->buffer, hdp_data_ind->size,
@@ -2150,15 +2143,13 @@ static int __bt_get_bt_adapter_device_discovery_info_s(bt_adapter_device_discove
        BT_CHECK_INPUT_PARAMETER(source_info);
 
        *discovery_info = (bt_adapter_device_discovery_info_s *)malloc(sizeof(bt_adapter_device_discovery_info_s));
-       if (*discovery_info == NULL) {
+       if (*discovery_info == NULL)
                return BT_ERROR_OUT_OF_MEMORY;
-       }
 
-       if (strlen(source_info->device_name.name) > 0) {
+       if (strlen(source_info->device_name.name) > 0)
                (*discovery_info)->remote_name = strdup(source_info->device_name.name);
-       } else {
+       else
                (*discovery_info)->remote_name = NULL;
-       }
 
        _bt_convert_address_to_string(&((*discovery_info)->remote_address), &(source_info->device_address));
 
@@ -2171,16 +2162,15 @@ static int __bt_get_bt_adapter_device_discovery_info_s(bt_adapter_device_discove
                if ((*discovery_info)->service_uuid != NULL) {
                        for (i = 0; i < source_info->service_index; i++) {
                                (*discovery_info)->service_uuid[i] = strdup(source_info->uuids[i]);
-                               if ((*discovery_info)->service_uuid[i] != NULL) {
+                               if ((*discovery_info)->service_uuid[i] != NULL)
                                        __bt_convert_lower_to_upper((*discovery_info)->service_uuid[i]);
-                               }
 
                                BT_INFO("UUID: %s", (*discovery_info)->service_uuid[i]);
                        }
                }
-       } else {
+       } else
                (*discovery_info)->service_uuid = NULL;
-       }
+
        (*discovery_info)->service_count = source_info->service_index;
 
        (*discovery_info)->rssi = (int)source_info->rssi;
@@ -2234,9 +2224,8 @@ static int __bt_get_bt_adapter_le_device_scan_info_s(
        BT_CHECK_INPUT_PARAMETER(source_info);
 
        *scan_info = (bt_adapter_le_device_scan_result_info_s *)malloc(sizeof(bt_adapter_le_device_scan_result_info_s));
-       if (*scan_info == NULL) {
+       if (*scan_info == NULL)
                return BT_ERROR_OUT_OF_MEMORY;
-       }
 
        _bt_convert_address_to_string(&((*scan_info)->remote_address), &(source_info->device_address));
 
@@ -2290,9 +2279,8 @@ static int __bt_get_bt_adapter_le_device_discovery_info_s(
        BT_CHECK_INPUT_PARAMETER(source_info);
 
        *le_discovery_info = (bt_adapter_le_device_discovery_info_s *)malloc(sizeof(bt_adapter_le_device_discovery_info_s));
-       if (*le_discovery_info == NULL) {
+       if (*le_discovery_info == NULL)
                return BT_ERROR_OUT_OF_MEMORY;
-       }
 
        _bt_convert_address_to_string(&((*le_discovery_info)->remote_address), &(source_info->device_address));
 
@@ -2596,9 +2584,8 @@ static void __bt_convert_lower_to_upper(char *origin)
        int i = 0;
 
        for (i = 0; i < length; i++) {
-               if (islower(origin[i])) {
+               if (islower(origin[i]))
                        origin[i] = toupper(origin[i]);
-               }
        }
 }
 
index 0001aa5e2db9a46da1aacd55efa5eff0186d241e..8335d521c3a23baccae1af4d822eb1abe52b6c78 100644 (file)
@@ -34,9 +34,8 @@ int bt_device_create_bond(const char *device_address)
 
        _bt_convert_address_to_hex(&addr_hex, device_address); /* LCOV_EXCL_START */
        error_code = _bt_get_error_code(bluetooth_bond_device(&addr_hex));
-       if (error_code != BT_ERROR_NONE) {
+       if (error_code != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
-       }
 
        return error_code;
 }
@@ -53,9 +52,8 @@ int bt_device_create_bond_by_type(const char *device_address,
 
        _bt_convert_address_to_hex(&addr_hex, device_address);
        error_code = _bt_get_error_code(bluetooth_bond_device_by_type(&addr_hex, conn_type));
-       if (error_code != BT_ERROR_NONE) {
+       if (error_code != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
-       }
 
        return error_code;
 } /* LCOV_EXCL_STOP */
@@ -147,9 +145,9 @@ int bt_device_start_service_search(const char *device_address)
        if (ret == BT_ERROR_OPERATION_FAILED)
                ret = BT_ERROR_SERVICE_SEARCH_FAILED;
 
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
+
        return ret;
 }
 
@@ -160,9 +158,8 @@ int bt_device_cancel_service_search(void)
        BT_CHECK_BT_SUPPORT();
        BT_CHECK_INIT_STATUS();
        ret = _bt_get_error_code(bluetooth_cancel_service_search());
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
 
        return ret; /* LCOV_EXCL_STOP */
 }
@@ -396,9 +393,8 @@ int bt_device_le_conn_update(const char *device_address,
 
        ret = _bt_get_error_code(bluetooth_le_conn_update(&addr_hex, &param));
 
-       if (BT_ERROR_NONE != ret) {
+       if (BT_ERROR_NONE != ret)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
 
        return ret;
 }
@@ -592,9 +588,9 @@ int bt_passkey_reply(char *passkey, bool authentication_reply)
        BT_CHECK_INPUT_PARAMETER(passkey);
        int error_code = BT_ERROR_NONE;
        error_code = _bt_get_error_code(bluetooth_passkey_reply(passkey, authentication_reply));
-       if (error_code != BT_ERROR_NONE) {
+       if (error_code != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
-       }
+
        return error_code;
 }
 
@@ -604,9 +600,9 @@ int bt_passkey_confirmation_reply(bool confirmation_reply)
 
        int error_code = BT_ERROR_NONE;
        error_code = _bt_get_error_code(bluetooth_passkey_confirmation_reply(confirmation_reply));
-       if (error_code != BT_ERROR_NONE) {
+       if (error_code != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
-       }
+
        return error_code;
 }
 int bt_device_le_set_data_length(const char *remote_address,
index 1cd0efd5c10fecf5d4227a3eae85d12c80f5f8b5..c7d8b669604339312a4c649b0f3127d7f39dbf31 100644 (file)
@@ -244,16 +244,16 @@ int bt_gatt_get_service_uuid(bt_gatt_attribute_h service, char **uuid)
 
                if (property.include_handles.count != 0 &&
                        property.include_handles.handle) {
-                       for (i = 0; i < property.include_handles.count; i++) {
+                       for (i = 0; i < property.include_handles.count; i++)
                                g_free(property.include_handles.handle[i]);
-                       }
+
                        g_free(property.include_handles.handle);
                }
                if (property.char_handle.count != 0 &&
                        property.char_handle.handle) {
-                       for (i = 0; i < property.char_handle.count; i++) {
+                       for (i = 0; i < property.char_handle.count; i++)
                                g_free(property.char_handle.handle[i]);
-                       }
+
                        g_free(property.char_handle.handle);
                }
        }
@@ -285,9 +285,9 @@ int bt_gatt_foreach_included_services(bt_gatt_attribute_h service,
        } else {
                if (property.char_handle.count != 0 &&
                        property.char_handle.handle) {
-                       for (i = 0; i < property.char_handle.count; i++) {
+                       for (i = 0; i < property.char_handle.count; i++)
                                g_free(property.char_handle.handle[i]);
-                       }
+
                        g_free(property.char_handle.handle);
                }
                if (property.include_handles.count == 0 ||
@@ -423,9 +423,8 @@ int bt_gatt_set_characteristic_value(bt_gatt_attribute_h characteristic,
        ret = _bt_get_error_code(bluetooth_gatt_set_characteristics_value((const char *)characteristic,
                                        (const guint8*)value, value_length));
 
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
 
        return ret; /* LCOV_EXCL_STOP */
 }
@@ -545,9 +544,9 @@ int bt_gatt_connect(const char *address, bool auto_connect)
        ret = _bt_get_error_code(bluetooth_connect_le(&bd_addr,
                                        auto_connect ? TRUE : FALSE));
 
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
+
        return ret;
 }
 
@@ -563,9 +562,9 @@ int bt_gatt_disconnect(const char *address)
 
        ret = _bt_get_error_code(bluetooth_disconnect_le(&bd_addr));
 
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
+
        return ret;
 }
 
@@ -852,29 +851,29 @@ float __convert_bytes_to_float(char b0, char b1, char b2, char b3)
 static int __get_data_type_float_size(bt_data_type_float_e type)
 {
        switch (type) {
-               case BT_DATA_TYPE_SFLOAT:
-                       return 2;
-               case BT_DATA_TYPE_FLOAT:
-                       return 4;
-               default:
-                       return 0;
+       case BT_DATA_TYPE_SFLOAT:
+               return 2;
+       case BT_DATA_TYPE_FLOAT:
+               return 4;
+       default:
+               return 0;
        }
 }
 
 static int __get_data_type_int_size(bt_data_type_int_e format)
 {
        switch (format) {
-               case BT_DATA_TYPE_SINT8:
-               case BT_DATA_TYPE_UINT8:
-                       return 1;
-               case BT_DATA_TYPE_SINT16:
-               case BT_DATA_TYPE_UINT16:
-                       return 2;
-               case BT_DATA_TYPE_SINT32:
-               case BT_DATA_TYPE_UINT32:
-                       return 4;
-               default:
-                       return 0;
+       case BT_DATA_TYPE_SINT8:
+       case BT_DATA_TYPE_UINT8:
+               return 1;
+       case BT_DATA_TYPE_SINT16:
+       case BT_DATA_TYPE_UINT16:
+               return 2;
+       case BT_DATA_TYPE_SINT32:
+       case BT_DATA_TYPE_UINT32:
+               return 4;
+       default:
+               return 0;
        }
 }
 
@@ -962,33 +961,33 @@ int bt_gatt_get_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
        }
 
        switch (type) {
-               case BT_DATA_TYPE_UINT8:
-                       *value = __convert_unsigned_byte_to_int(val[offset]);
-                       break;
-               case BT_DATA_TYPE_UINT16:
-                       *value = __convert_unsigned_bytes_to_int16(val[offset],
-                                                               val[offset+1]);
-                       break;
+       case BT_DATA_TYPE_UINT8:
+               *value = __convert_unsigned_byte_to_int(val[offset]);
+               break;
+       case BT_DATA_TYPE_UINT16:
+               *value = __convert_unsigned_bytes_to_int16(val[offset],
+                                                       val[offset+1]);
+               break;
 
-               case BT_DATA_TYPE_UINT32:
-                       *value = __convert_unsigned_bytes_to_int32(val[offset],
-                               val[offset+1], val[offset+2], val[offset+3]);
-                       break;
-               case BT_DATA_TYPE_SINT8:
-                       *value = __convert_unsigned_to_signed(__convert_unsigned_byte_to_int(val[offset]), 8);
-                       break;
+       case BT_DATA_TYPE_UINT32:
+               *value = __convert_unsigned_bytes_to_int32(val[offset],
+                       val[offset+1], val[offset+2], val[offset+3]);
+               break;
+       case BT_DATA_TYPE_SINT8:
+               *value = __convert_unsigned_to_signed(__convert_unsigned_byte_to_int(val[offset]), 8);
+               break;
 
-               case BT_DATA_TYPE_SINT16:
-                       *value = __convert_unsigned_to_signed(__convert_unsigned_bytes_to_int16(val[offset],
-                                                          val[offset+1]), 16);
-                       break;
+       case BT_DATA_TYPE_SINT16:
+               *value = __convert_unsigned_to_signed(__convert_unsigned_bytes_to_int16(val[offset],
+                                                  val[offset+1]), 16);
+               break;
 
-               case BT_DATA_TYPE_SINT32:
-                       *value = __convert_unsigned_to_signed(__convert_unsigned_bytes_to_int32(val[offset],
-                               val[offset+1], val[offset+2], val[offset+3]), 32);
-                       break;
-               default:
-                       return BT_ERROR_INVALID_PARAMETER;
+       case BT_DATA_TYPE_SINT32:
+               *value = __convert_unsigned_to_signed(__convert_unsigned_bytes_to_int32(val[offset],
+                       val[offset+1], val[offset+2], val[offset+3]), 32);
+               break;
+       default:
+               return BT_ERROR_INVALID_PARAMETER;
        }
 
        return BT_ERROR_NONE; /* LCOV_EXCL_STOP */
@@ -1025,17 +1024,17 @@ int bt_gatt_get_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
        }
 
        switch (type) {
-               case BT_DATA_TYPE_SFLOAT:
-                       *value = __convert_bytes_to_short_float(val[offset],
-                               val[offset+1]);
-                       break;
+       case BT_DATA_TYPE_SFLOAT:
+               *value = __convert_bytes_to_short_float(val[offset],
+                       val[offset+1]);
+               break;
 
-               case BT_DATA_TYPE_FLOAT:
-                       *value = __convert_bytes_to_float(val[offset],
-                               val[offset+1], val[offset+2], val[offset+3]);
-                       break;
-               default:
-                       return BT_ERROR_INVALID_PARAMETER;
+       case BT_DATA_TYPE_FLOAT:
+               *value = __convert_bytes_to_float(val[offset],
+                       val[offset+1], val[offset+2], val[offset+3]);
+               break;
+       default:
+               return BT_ERROR_INVALID_PARAMETER;
        }
 
        return BT_ERROR_NONE; /* LCOV_EXCL_STOP */
@@ -1149,35 +1148,35 @@ int bt_gatt_set_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
        }
 
        switch (type) {
-               case BT_DATA_TYPE_SINT8:
-                       value = __convert_int_to_signed_bits(value, 8);
-               case BT_DATA_TYPE_UINT8:
-                       if (*val)
-                               (*val)[idx] = (char)(value & 0xFF);
-                       break;
+       case BT_DATA_TYPE_SINT8:
+               value = __convert_int_to_signed_bits(value, 8);
+       case BT_DATA_TYPE_UINT8:
+               if (*val)
+                       (*val)[idx] = (char)(value & 0xFF);
+               break;
 
-               case BT_DATA_TYPE_SINT16:
-                       value = __convert_int_to_signed_bits(value, 16);
-               case BT_DATA_TYPE_UINT16:
-                       if (*val) {
-                                (*val)[idx++] = (char)(value & 0xFF);
-                                (*val)[idx] = (char)((value >> 8) & 0xFF);
-                       }
-                       break;
+       case BT_DATA_TYPE_SINT16:
+               value = __convert_int_to_signed_bits(value, 16);
+       case BT_DATA_TYPE_UINT16:
+               if (*val) {
+                        (*val)[idx++] = (char)(value & 0xFF);
+                        (*val)[idx] = (char)((value >> 8) & 0xFF);
+               }
+               break;
 
-               case BT_DATA_TYPE_SINT32:
-                       value = __convert_int_to_signed_bits(value, 32);
-               case BT_DATA_TYPE_UINT32:
-                       if (*val) {
-                               (*val)[idx++] = (char)(value & 0xFF);
-                               (*val)[idx++] = (char)((value >> 8) & 0xFF);
-                               (*val)[idx++] = (char)((value >> 16) & 0xFF);
-                               (*val)[idx] = (char)((value >> 24) & 0xFF);
-                       }
-                       break;
+       case BT_DATA_TYPE_SINT32:
+               value = __convert_int_to_signed_bits(value, 32);
+       case BT_DATA_TYPE_UINT32:
+               if (*val) {
+                       (*val)[idx++] = (char)(value & 0xFF);
+                       (*val)[idx++] = (char)((value >> 8) & 0xFF);
+                       (*val)[idx++] = (char)((value >> 16) & 0xFF);
+                       (*val)[idx] = (char)((value >> 24) & 0xFF);
+               }
+               break;
 
-               default:
-                       return BT_ERROR_INVALID_PARAMETER;
+       default:
+               return BT_ERROR_INVALID_PARAMETER;
        }
 
        if (handle->role == BT_GATT_ROLE_SERVER && handle->path) {
@@ -1265,25 +1264,25 @@ int bt_gatt_set_float_value(bt_gatt_h gatt_handle, bt_data_type_float_e type,
        }
 
        switch (type) {
-               case BT_DATA_TYPE_FLOAT:
-                       mant = __convert_int_to_signed_bits(mantissa, 24);
-                       exp = __convert_int_to_signed_bits(exponent, 8);
-                       (*val)[idx++] = (char)(mant & 0xFF);
-                       (*val)[idx++] = (char)((mant >> 8) & 0xFF);
-                       (*val)[idx++] = (char)((mant >> 16) & 0xFF);
-                       (*val)[idx] = (char)(exp & 0xFF);
-                       break;
+       case BT_DATA_TYPE_FLOAT:
+               mant = __convert_int_to_signed_bits(mantissa, 24);
+               exp = __convert_int_to_signed_bits(exponent, 8);
+               (*val)[idx++] = (char)(mant & 0xFF);
+               (*val)[idx++] = (char)((mant >> 8) & 0xFF);
+               (*val)[idx++] = (char)((mant >> 16) & 0xFF);
+               (*val)[idx] = (char)(exp & 0xFF);
+               break;
 
-               case BT_DATA_TYPE_SFLOAT:
-                       mant = __convert_int_to_signed_bits(mantissa, 12);
-                       exp = __convert_int_to_signed_bits(exponent, 4);
-                       (*val)[idx++] = (char)(mant & 0xFF);
-                       (*val)[idx] = (char)((mant >> 8) & 0x0F);
-                       (*val)[idx] += (char)((exp & 0x0F) << 4);
-                       break;
+       case BT_DATA_TYPE_SFLOAT:
+               mant = __convert_int_to_signed_bits(mantissa, 12);
+               exp = __convert_int_to_signed_bits(exponent, 4);
+               (*val)[idx++] = (char)(mant & 0xFF);
+               (*val)[idx] = (char)((mant >> 8) & 0x0F);
+               (*val)[idx] += (char)((exp & 0x0F) << 4);
+               break;
 
-               default:
-                       return BT_ERROR_INVALID_PARAMETER;
+       default:
+               return BT_ERROR_INVALID_PARAMETER;
        }
 
        if (handle->role == BT_GATT_ROLE_SERVER && handle->path) {
@@ -2197,9 +2196,9 @@ int bt_gatt_server_start(void)
        if (!is_gatt_server_started) {
                ret = bluetooth_gatt_register_application();
 
-               if (ret != BT_ERROR_NONE) {
+               if (ret != BT_ERROR_NONE)
                        BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-               }
+
                is_gatt_server_started = true;
                return ret;
        }
@@ -2227,9 +2226,8 @@ int bt_gatt_server_send_response(int request_id,
                                        BT_ERROR_NONE,
                                        offset, value, value_length));
 
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
 
        return ret;
 }
@@ -2577,9 +2575,8 @@ static const bt_gatt_client_h __find_gatt_client(const char *remote_address)
        for (l = gatt_client_list; l; l = g_slist_next(l)) {
                bt_gatt_client_s *client_s = l->data;
 
-               if (!g_strcmp0(client_s->remote_address, remote_address)) {
+               if (!g_strcmp0(client_s->remote_address, remote_address))
                        return (const bt_gatt_client_h)l->data;
-               }
        }
 
        return NULL;
index dafce240936e9889556e8a768e19f92dac7878b8..a2885de891575bf4dcc1f1dd89a0f4326dc22b48 100644 (file)
@@ -51,9 +51,8 @@ int bt_hdp_register_sink_app(unsigned short data_type, char **app_id)
        }
 
        *app_id = strdup(app_handle);
-       if (*app_id == NULL) {
+       if (*app_id == NULL)
                return BT_ERROR_OUT_OF_MEMORY;
-       }
 
        return BT_ERROR_NONE;
 }
@@ -67,9 +66,9 @@ int bt_hdp_unregister_sink_app(const char *app_id)
        BT_CHECK_INPUT_PARAMETER(app_id);
        error = bluetooth_hdp_deactivate(app_id);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
-       }
+
        return error;
 }
 
@@ -84,9 +83,9 @@ int bt_hdp_send_data(unsigned int channel, const char *data, unsigned int size)
        }
        error = bluetooth_hdp_send_data(channel, data, size);
        error = _bt_get_error_code(error);
-       if (BT_ERROR_NONE != error) {
+       if (BT_ERROR_NONE != error)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error; /* LCOV_EXCL_STOP */
 }
 
@@ -102,9 +101,9 @@ int bt_hdp_connect_to_source(const char *remote_address, const char *app_id)
        _bt_convert_address_to_hex(&addr_hex, remote_address);
        error = bluetooth_hdp_connect(app_id, HDP_QOS_ANY, &addr_hex);
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error; /* LCOV_EXCL_STOP */
 }
 
@@ -120,9 +119,9 @@ int bt_hdp_disconnect(const char *remote_address, unsigned int channel)
 
        error = bluetooth_hdp_disconnect(channel, &addr_hex);
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error; /* LCOV_EXCL_STOP */
 }
 
index 155f4993c75c13619143b4dfb23a83e72745b71a..5071e794d27644a4c43802f03869cdeecb7e08d3 100644 (file)
@@ -123,9 +123,9 @@ int bt_hid_host_connect(const char *remote_address)
 
        error = bluetooth_hid_connect((hid_device_address_t *)&addr_hex);
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error; /* LCOV_EXCL_STOP */
 }
 
@@ -143,9 +143,9 @@ int bt_hid_host_disconnect(const char *remote_address)
 
        error = bluetooth_hid_disconnect((hid_device_address_t *)&addr_hex);
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error; /* LCOV_EXCL_STOP */
 }
 /* LCOV_EXCL_START */
index 769202acc9a237611d5eb86b8f2956eeedecdfec..925bad3e1584649a7db6ab39922c6787cc67d6cc 100644 (file)
@@ -118,9 +118,9 @@ int _bt_le_ipsp_connect(const char *address)
 
        ret = _bt_get_error_code(bluetooth_le_ipsp_connect((ipsp_device_address_t *)&bd_addr));
 
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
+
        return ret;
 }
 
@@ -137,9 +137,9 @@ int _bt_le_ipsp_disconnect(const char *address)
 
        ret = _bt_get_error_code(bluetooth_le_ipsp_disconnect((ipsp_device_address_t *)&bd_addr));
 
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
-       }
+
        return ret;
 }
 
index da33f503679ae9bc8fec88e64dbfbf9b562b2806..bf8714e76bd52907027d20d2f865419b09d74d58 100644 (file)
@@ -43,9 +43,9 @@ int bt_nap_activate(void)
        BT_CHECK_INIT_STATUS();
        error = bluetooth_network_activate_server();
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 
@@ -57,9 +57,9 @@ int bt_nap_deactivate(void)
        BT_CHECK_INIT_STATUS();
        error = bluetooth_network_deactivate_server();
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       }
+
        return error;
 }
 
@@ -73,11 +73,10 @@ int bt_nap_disconnect_all(void)
        BT_CHECK_INIT_STATUS();
        error = bluetooth_network_deactivate_server();
        error = _bt_get_error_code(error);
-       if (error != BT_ERROR_NONE) {
+       if (error != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
-       } else {
+       else
                return bt_nap_activate();
-       }
 
        return error;
 }
index 496c8140d68a23073354fa96dfbeb0d1eec7414b..9072d8d537375bd8300893b6bfbac60e3b76d626 100644 (file)
@@ -42,9 +42,8 @@ int bt_pbap_init(void)
        BT_CHECK_INIT_STATUS();
        int error_code = BT_ERROR_NONE;
        error_code = _bt_get_error_code(bluetooth_pbap_init());
-       if (error_code != BT_ERROR_NONE) {
+       if (error_code != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
-       }
 
        return error_code;
 }
@@ -55,9 +54,8 @@ int bt_pbap_deinit(void)
        BT_CHECK_INIT_STATUS();
        int error_code = BT_ERROR_NONE;
        error_code = _bt_get_error_code(bluetooth_pbap_deinit());
-       if (error_code != BT_ERROR_NONE) {
+       if (error_code != BT_ERROR_NONE)
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
-       }
 
        return error_code;
 }
index 36304baeb3a138bd210d3052e12cafab667afc02..d6f7708978821a7fa04d792c32169f56b611eba7 100644 (file)
@@ -62,9 +62,8 @@ void bt_state_changed_impl(int result,
                }
        }
 
-       if (g_mainloop) {
+       if (g_mainloop)
                g_main_loop_quit(g_mainloop);
-       }
 }
 
 void bt_socket_connection_state_changed_impl(int result,
@@ -100,16 +99,14 @@ void bt_socket_connection_state_changed_impl(int result,
                        } else {
                                LOGE("[%s] Callback: bt_socket_send_data() failed.",
                                        __FUNCTION__);
-                               if (g_mainloop) {
+                               if (g_mainloop)
                                        g_main_loop_quit(g_mainloop);
-                               }
                        }
                } else {
                        LOGI("[%s] Callback: Failed to connect",
                                __FUNCTION__);
-                       if (g_mainloop) {
+                       if (g_mainloop)
                                g_main_loop_quit(g_mainloop);
-                       }
                }
        } else {
                LOGI("[%s] Callback: Disconnected.",
@@ -126,9 +123,8 @@ void bt_socket_data_received_impl(bt_socket_received_data_s *data,
                                        quit_command, data->data_size)) {
                                LOGI("[%s] Callback: Quit command.",
                                        __FUNCTION__);
-                               if (g_mainloop) {
+                               if (g_mainloop)
                                        g_main_loop_quit(g_mainloop);
-                               }
                        }
                } else {
                        LOGE("[%s] Callback: No data.",
@@ -220,9 +216,8 @@ void bt_adapter_device_discovery_state_changed_impl(int result,
        } else if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FINISHED) {
                LOGI("[%s] Callback: device discovery finished.",
                        __FUNCTION__);
-               if (g_mainloop) {
+               if (g_mainloop)
                        g_main_loop_quit(g_mainloop);
-               }
        }
 }
 
@@ -257,9 +252,8 @@ void bt_device_bond_created_impl(int result,
                        __FUNCTION__);
        }
 
-       if (g_mainloop) {
+       if (g_mainloop)
                g_main_loop_quit(g_mainloop);
-       }
 }
 
 void bt_device_service_searched_impl(int result,
@@ -286,9 +280,8 @@ void bt_device_service_searched_impl(int result,
                        __FUNCTION__);
        }
 
-       if (g_mainloop) {
+       if (g_mainloop)
                g_main_loop_quit(g_mainloop);
-       }
 }
 
 int main()
index 2fbab30a0f4b1555f27e295be97cb6372ca8ce9b..f2d954289d9bb31299742d8faf7d36f3c0dcbc0f 100644 (file)
@@ -44,9 +44,8 @@ static char *quit_command = "Quit";
 gboolean timeout_func(gpointer data)
 {
        LOGE("[%s] Timeout.", __FUNCTION__);
-       if (g_mainloop) {
+       if (g_mainloop)
                g_main_loop_quit((GMainLoop *)data);
-       }
 
        return FALSE;
 }
@@ -66,9 +65,8 @@ void bt_state_changed_impl(int result,
                }
        }
 
-       if (g_mainloop) {
+       if (g_mainloop)
                g_main_loop_quit(g_mainloop);
-       }
 }
 
 void bt_socket_connection_state_changed_impl(int result,
@@ -117,9 +115,8 @@ void bt_socket_data_received_impl(bt_socket_received_data_s *data,
        if (data->data_size > 0) {
                if (!strncmp(data->data, quit_command, data->data_size)) {
                        LOGI("[%s] Callback: Quit command.", __FUNCTION__);
-                       if (g_mainloop) {
+                       if (g_mainloop)
                                g_main_loop_quit(g_mainloop);
-                       }
                }
 
                if (bt_socket_send_data(connected_socket,
index eb0aa8bdf9d3eb278e0c1e12ed55bcd96007f9d6..0c00847baa1f7d133d10bb7061b9d9e94c2d36e3 100644 (file)
@@ -1217,9 +1217,8 @@ static void __bt_adapter_manufacturer_data_changed_cb(char *data,
        int i;
 
        TC_PRT("manufacturer data is changed");
-       for (i = 0; i < len; i++) {
+       for (i = 0; i < len; i++)
                TC_PRT("[%d] %02x", i, data[i]);
-       }
 }
 
 static void __bt_adapter_authentication_req_cb(
@@ -1255,9 +1254,8 @@ static bool __bt_adapter_bonded_device_cb(bt_device_info_s *device_info,
        if (device_info->service_uuid == NULL) {
                TC_PRT("No uuids");
        } else {
-               for (i = 0; i < device_info->service_count; i++) {
+               for (i = 0; i < device_info->service_count; i++)
                        TC_PRT("uuid: %s", device_info->service_uuid[i]);
-               }
        }
 
        if (device_info->manufacturer_data_len > 0) {
@@ -1295,9 +1293,8 @@ static void __bt_adapter_device_discovery_state_changed_cb(
        if (discovery_info->service_uuid == NULL) {
                TC_PRT("No uuids");
        } else {
-               for (i = 0; i < discovery_info->service_count; i++) {
+               for (i = 0; i < discovery_info->service_count; i++)
                        TC_PRT("uuid: %s", discovery_info->service_uuid[i]);
-               }
        }
 
        if (discovery_info->manufacturer_data_len > 0) {
@@ -1469,7 +1466,6 @@ static void __bt_adapter_le_device_discovery_state_changed_cb(int result,
                int i, ret;
                int field_len = 0;
                unsigned char *field_data;
-               
                printf("Adv data [");
                for (i = 0; i < discovery_info->adv_data_len; i++)
                        printf("%02x ", discovery_info->adv_data[i]);
@@ -1495,7 +1491,7 @@ static void __bt_adapter_le_device_discovery_state_changed_cb(int result,
                if (ret == BT_ERROR_NONE) {
                        TC_PRT("%s", field_data);
                        g_free(field_data);
-               }               
+               }
 #endif
        }
 }
@@ -1562,75 +1558,77 @@ static void __bt_hid_device_data_received_cb(const bt_hid_device_received_data_s
        TC_PRT("Address: %s", data->address);
        TC_PRT("Type: %d", data->type);
        TC_PRT("Param: %d", data->param);
+
        switch (data->type) {
-               case BT_HID_HEADER_HANDSHAKE:
-                       TC_PRT("HANDSHAKE data");
-                       break;
-               case BT_HID_HEADER_HID_CONTROL:
-                       TC_PRT("HID Control data");
-                       ret = bt_hid_device_disconnect(remote_addr);
-                       TC_PRT("ret %d", ret);
-                       break;
-               case BT_HID_HEADER_GET_REPORT:
-                       TC_PRT("GET_REPORT data");
-                       TC_PRT("ReportId %d", data->data[1]);
-                       bt_hid_key_data_s send_data;
-                       /* Will send character 'a' */
-                       char    pressedkey[8]    = { 4, 0, 0, 0,  0, 0, 0, 0 };
-                       memcpy(send_data.key, pressedkey, 8);
-                       send_data.modify = 0;
-                       if (data->data[1] == 0x02) {
-                       ret = bt_hid_device_reply_to_report(remote_addr,
-                                       BT_HID_HEADER_GET_REPORT,
-                                       BT_HID_PARAM_DATA_RTYPE_INPUT,
-                                       (const char *)&send_data,
-                                       sizeof(send_data));
-                       } else if (data->data[1] == 0x01) {
-                               TC_PRT("Send Mouse Event");
-                       } else {
-                               TC_PRT("Invalid ReportId");
-                               val = BT_HID_HANDSHAKE_ERR_INVALID_REPORT_ID;
-                               ret = bt_hid_device_reply_to_report(remote_addr,
-                                               BT_HID_HEADER_HANDSHAKE,
-                                               BT_HID_PARAM_DATA_RTYPE_INPUT,
-                                               &val, sizeof(val));
-                       }
-                       TC_PRT("ret %d", ret);
-                       break;
-               case BT_HID_HEADER_SET_REPORT:
-                       TC_PRT("SET_REPORT data");
-                       break;
-               case BT_HID_HEADER_DATA:
-                       TC_PRT("TRANs DATA");
-                       break;
-               case BT_HID_HEADER_GET_PROTOCOL:
-                       TC_PRT("GET PROTOCOL");
-                       ret = bt_hid_device_reply_to_report(remote_addr,
-                                       BT_HID_HEADER_GET_PROTOCOL,
-                                       BT_HID_PARAM_DATA_RTYPE_INPUT,
-                                       &val, sizeof(val));
-                       TC_PRT("ret %d", ret);
-                       break;
-               case BT_HID_HEADER_SET_PROTOCOL:
-                       TC_PRT("SET PROTOCOL");
-                       val = BT_HID_HANDSHAKE_SUCCESSFUL;
+       case BT_HID_HEADER_HANDSHAKE:
+               TC_PRT("HANDSHAKE data");
+               break;
+       case BT_HID_HEADER_HID_CONTROL:
+               TC_PRT("HID Control data");
+               ret = bt_hid_device_disconnect(remote_addr);
+               TC_PRT("ret %d", ret);
+               break;
+       case BT_HID_HEADER_GET_REPORT:
+               TC_PRT("GET_REPORT data");
+               TC_PRT("ReportId %d", data->data[1]);
+               bt_hid_key_data_s send_data;
+               /* Will send character 'a' */
+               char    pressedkey[8]    = { 4, 0, 0, 0,  0, 0, 0, 0 };
+               memcpy(send_data.key, pressedkey, 8);
+               send_data.modify = 0;
+               if (data->data[1] == 0x02) {
+               ret = bt_hid_device_reply_to_report(remote_addr,
+                               BT_HID_HEADER_GET_REPORT,
+                               BT_HID_PARAM_DATA_RTYPE_INPUT,
+                               (const char *)&send_data,
+                               sizeof(send_data));
+               } else if (data->data[1] == 0x01) {
+                       TC_PRT("Send Mouse Event");
+               } else {
+                       TC_PRT("Invalid ReportId");
+                       val = BT_HID_HANDSHAKE_ERR_INVALID_REPORT_ID;
                        ret = bt_hid_device_reply_to_report(remote_addr,
                                        BT_HID_HEADER_HANDSHAKE,
                                        BT_HID_PARAM_DATA_RTYPE_INPUT,
                                        &val, sizeof(val));
-                       TC_PRT("ret %d", ret);
-                       break;
-               default:
-                       TC_PRT("Unkonw");
-                       break;
+               }
+               TC_PRT("ret %d", ret);
+               break;
+       case BT_HID_HEADER_SET_REPORT:
+               TC_PRT("SET_REPORT data");
+               break;
+       case BT_HID_HEADER_DATA:
+               TC_PRT("TRANs DATA");
+               break;
+       case BT_HID_HEADER_GET_PROTOCOL:
+               TC_PRT("GET PROTOCOL");
+               ret = bt_hid_device_reply_to_report(remote_addr,
+                               BT_HID_HEADER_GET_PROTOCOL,
+                               BT_HID_PARAM_DATA_RTYPE_INPUT,
+                               &val, sizeof(val));
+               TC_PRT("ret %d", ret);
+               break;
+       case BT_HID_HEADER_SET_PROTOCOL:
+               TC_PRT("SET PROTOCOL");
+               val = BT_HID_HANDSHAKE_SUCCESSFUL;
+               ret = bt_hid_device_reply_to_report(remote_addr,
+                               BT_HID_HEADER_HANDSHAKE,
+                               BT_HID_PARAM_DATA_RTYPE_INPUT,
+                               &val, sizeof(val));
+               TC_PRT("ret %d", ret);
+               break;
+       default:
+               TC_PRT("Unkonw");
+               break;
        }
+
        switch (data->param) {
-               case BT_HID_PARAM_DATA_RTYPE_INPUT:
-                       TC_PRT("Input Report");
-                       break;
-               case BT_HID_PARAM_DATA_RTYPE_OUTPUT:
-                       TC_PRT("Output Report");
-                       break;
+       case BT_HID_PARAM_DATA_RTYPE_INPUT:
+               TC_PRT("Input Report");
+               break;
+       case BT_HID_PARAM_DATA_RTYPE_OUTPUT:
+               TC_PRT("Output Report");
+               break;
        }
 }
 
@@ -2219,9 +2217,8 @@ void __bt_gatt_client_value_changed_cb(bt_gatt_h chr,
 
        TC_PRT("Value changed for [%s]", uuid);
        TC_PRT("len [%d]", len);
-       for (i = 0; i < len; i++) {
+       for (i = 0; i < len; i++)
                TC_PRT("value %u", value[i]);
-       }
 
        g_free(uuid);
 
@@ -2238,9 +2235,8 @@ void __bt_HP_client_cp_req_status_changed_cb(bt_gatt_h chr,
 
        TC_PRT("Value changed for [%s]", uuid);
        TC_PRT("len [%d]", len);
-               for (i = 0; i < len; i++) {
+               for (i = 0; i < len; i++)
                                TC_PRT("value %u", value[i]);
-               }
 
        g_free(uuid);
 
@@ -2265,9 +2261,9 @@ void __bt_gatt_server_value_changed_cb(char *remote_address,
        TC_PRT("remote_address : %s", remote_address);
        TC_PRT("offset : %d", offset);
        TC_PRT("len [%d] : ", len);
-       for (i = 0; i < len; i++) {
+       for (i = 0; i < len; i++)
                printf("%d ", value[i]);
-       }
+
        printf("\n");
 }
 
@@ -2363,9 +2359,8 @@ void __bt_gatt_characteristic_changed_cb(bt_gatt_attribute_h characteristic,
        TC_PRT("service %s", (char *)characteristic);
        TC_PRT("value_length %d", value_length);
 
-       for (i = 0; i < value_length; i++) {
+       for (i = 0; i < value_length; i++)
                TC_PRT("value %c", value[i]);
-       }
 
        return;
 }
@@ -2385,9 +2380,8 @@ void __bt_gatt_char_read_cb(unsigned char *value,
 
        TC_PRT("value_length %d", value_length);
 
-       for (i = 0; i < value_length; i++) {
+       for (i = 0; i < value_length; i++)
                TC_PRT("value %u", value[i]);
-       }
 
        return;
 }
@@ -4123,7 +4117,7 @@ int test_input_callback(void *data)
                                        BT_ADAPTER_LE_PACKET_ADVERTISING, true);
                                if (ret != BT_ERROR_NONE)
                                        TC_PRT("add appearance data [0x%04x]", ret);
-                               manufacture = manufacture_2;            
+                               manufacture = manufacture_2;
                                break;
 
                        case 3: /* All */
@@ -4609,9 +4603,9 @@ int test_input_callback(void *data)
 
                        ret = bt_device_is_profile_connected(remote_addr,
                                profile, &connected_status);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("returns %s\n", __bt_get_error_message(ret));
-                       }
+
                        TC_PRT("Profile [%s]",
                                connected_status ? "Connected" : "Disconnected");
                        break;
@@ -4665,16 +4659,14 @@ int test_input_callback(void *data)
                        ret = bt_device_get_connection_state(remote_addr,
                                        BT_DEVICE_CONNECTION_LINK_BREDR,
                                        &bredr_connected);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("returns %s\n", __bt_get_error_message(ret));
-                       }
 
                        ret = bt_device_get_connection_state(remote_addr,
                                        BT_DEVICE_CONNECTION_LINK_LE,
                                        &le_connected);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("returns %s\n", __bt_get_error_message(ret));
-                       }
 
                        TC_PRT("BR/EDR [%s], LE [%s]",
                                bredr_connected ? "Connected" : "Disconnected",
@@ -4973,9 +4965,8 @@ int test_input_callback(void *data)
                        bool opened = false;
                        ret = bt_ag_is_sco_opened(&opened);
                        TC_PRT("opend[%s]", opened ? "YES" : "NO");
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("returns %s\n", __bt_get_error_message(ret));
-                       }
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_AG_SET_SCO_STATE_CHANGED_CB:
@@ -5115,9 +5106,8 @@ int test_input_callback(void *data)
                        bool enabled = false;
                        ret = bt_ag_is_nrec_enabled(&enabled);
                        TC_PRT("opend[%s]", enabled ? "YES" : "NO");
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("returns %s\n", __bt_get_error_message(ret));
-                       }
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
@@ -5252,9 +5242,8 @@ int test_input_callback(void *data)
                                __bt_gatt_client_foreach_svc_cb,
                                (void *)test_id);
 #endif
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("returns %s\n", __bt_get_error_message(ret));
-                       }
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_GATT_CLIENT_READ_VALUE: {
@@ -5305,9 +5294,8 @@ int test_input_callback(void *data)
                                                __bt_gatt_client_read_complete_cb, NULL);
                        }
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_read_value is failed : %d", ret);
-                       }
 
                        __bt_free_test_param(&g_test_param);
                        break;
@@ -5377,9 +5365,8 @@ int test_input_callback(void *data)
                                                __bt_gatt_client_write_complete_cb, NULL);
                        }
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_write_value is failed : %d", ret);
-                       }
 
                        __bt_free_test_param(&g_test_param);
                        break;
@@ -5945,9 +5932,8 @@ int test_input_callback(void *data)
 
                        ret = bt_gatt_client_set_characteristic_value_changed_cb(noti_source,
                                        __bt_gatt_client_value_changed_cb, NULL);
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_set_characteristic_value_changed_cb is failed : %d", ret);
-                       }
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_ANCS_POSITIVE_ACTION: {
@@ -6025,9 +6011,8 @@ int test_input_callback(void *data)
 
                        ret = bt_gatt_client_set_characteristic_value_changed_cb(data_source,
                                        __bt_gatt_client_value_changed_cb, NULL);
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_set_characteristic_value_changed_cb is failed : %d", ret);
-                       }
 
                        noti_id = g_test_param.params[0];
                        id = atoi(noti_id);
@@ -6164,9 +6149,8 @@ int test_input_callback(void *data)
                                bt_gatt_get_uuid_specification_name(uuid, &name);
                                TC_PRT("uuid: %s [%s]", uuid, name);
 
-                               for (i = 0; i < value_length; i++) {
+                               for (i = 0; i < value_length; i++)
                                        TC_PRT("value %c", value[i]);
-                               }
 
                                g_free(uuid);
                                g_free(name);
@@ -6286,9 +6270,8 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_foreach_services(hps_client,
                                        __bt_hps_client_svc_cb, (void *)test_id);
 #endif
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("returns %s\n", __bt_get_error_message(ret));
-                       }
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_URI: {
@@ -6328,9 +6311,8 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_write_value(chr,
                                        __bt_gatt_client_write_complete_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_write_value is failed : %d", ret);
-                       }
 
                        __bt_free_test_param(&g_test_param);
                        break;
@@ -6373,9 +6355,8 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_write_value(chr,
                                        __bt_gatt_client_write_complete_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_write_value is failed : %d", ret);
-                       }
 
                        __bt_free_test_param(&g_test_param);
                        break;
@@ -6419,16 +6400,14 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_set_characteristic_value_changed_cb(chr,
                                        __bt_HP_client_cp_req_status_changed_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_write_value is failed : %d", ret);
-                       }
 
                        ret = bt_gatt_client_write_value(chr,
                                        __bt_gatt_client_write_complete_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_write_value is failed : %d", ret);
-                       }
 
                        __bt_free_test_param(&g_test_param);
                        break;
@@ -6469,9 +6448,9 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_write_value(chr,
                                        __bt_gatt_client_write_complete_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_write_value is failed : %d", ret);
-                       }
+
                        __bt_free_test_param(&g_test_param);
                        break;
                }
@@ -6497,9 +6476,8 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_read_value(chr,
                                        __bt_gatt_client_read_complete_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_read_value is failed : %d", ret);
-                       }
                        break;
                }
 
@@ -6524,9 +6502,8 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_read_value(chr,
                                        __bt_gatt_client_read_complete_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_read_value is failed : %d", ret);
-                       }
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_GET_ENTITY: {
@@ -6550,9 +6527,9 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_read_value(chr,
                                        __bt_gatt_client_read_complete_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_read_value is failed : %d", ret);
-                       }
+
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_GET_SECURITY: {
@@ -6576,9 +6553,9 @@ int test_input_callback(void *data)
                        ret = bt_gatt_client_read_value(chr,
                                        __bt_gatt_client_read_complete_cb, NULL);
 
-                       if (ret != BT_ERROR_NONE) {
+                       if (ret != BT_ERROR_NONE)
                                TC_PRT("bt_gatt_client_read_value is failed : %d", ret);
-                       }
+
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_HPS_CLIENT_SET_STATUS_NOTIFICATION: {
@@ -7212,91 +7189,81 @@ int test_input_callback(void *data)
                switch (test_id) {
                case BT_UNIT_TEST_FUNCTION_HF_INITIALIZE:
                        ret = bt_hf_initialize();
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_DEINITIALIZE:
                        ret = bt_hf_deinitialize();
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_ANSWER:
                        ret = bt_hf_notify_call_event(
                                        BT_HF_CALL_EVENT_ANSWER,
                                        "9663868998");
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_SPEAKER_GAIN:
                        ret = bt_hf_notify_speaker_gain(10);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_SET_SPEAKER_GAIN_CB:
                        ret = bt_hf_set_speaker_gain_changed_cb(
                                        __bt_hf_speaker_gain_changed_cb,
                                        NULL);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_UNSET_SPEAKER_GAIN_CB:
                        ret = bt_hf_unset_speaker_gain_changed_cb();
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_VOICE_REC_TRUE:
                        ret = bt_hf_notify_voice_recognition_state(true);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_TERM:
                        ret = bt_hf_notify_call_event(
                                        BT_HF_CALL_EVENT_IDLE,
                                        "9663868998");
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_INIT:
                        ret = bt_hf_notify_call_event(
                                        BT_HF_CALL_EVENT_DIAL,
                                        "9663868998");
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_VOICE_REC_FALSE:
                        ret = bt_hf_notify_voice_recognition_state(false);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_IS_SCO_OPENED: {
                        bool is_opened = false;
@@ -7316,9 +7283,9 @@ int test_input_callback(void *data)
                        GSList *list;
                        ret = bt_hf_get_call_status_info_list(&list);
 
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       else {
+                       else {
                                for (; list; list = g_slist_next(list)) {
                                        bt_hf_call_status_info_s *call_info = list->data;
                                        TC_PRT("Call info [No:%s, Dir:%d, Stat:%d, Mpt:%d, Idx:%d]",
@@ -7333,55 +7300,49 @@ int test_input_callback(void *data)
                case BT_UNIT_TEST_FUNCTION_HF_SET_SCO_CHANGED_CB:
                        ret = bt_hf_set_sco_state_changed_cb(
                                        __bt_hf_sco_state_changed_cb, NULL);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_UNSET_SCO_CHANGED_CB:
                        ret = bt_hf_unset_sco_state_changed_cb();
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_SET_CALL_EVENT_CB:
                        ret = bt_hf_set_call_handling_event_cb(
                                        __bt_hf_set_call_handling_event_cb,
                                        NULL);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_UNSET_CALL_EVENT_CB:
                        ret = bt_hf_unset_call_handling_event_cb();
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_SET_CALL_STATUS_UPDATED_EVENT_CB:
                        ret = bt_hf_set_call_status_updated_event_cb(
                                        __bt_hf_call_status_updated_event_cb,
                                        NULL);
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_HF_UNSET_CALL_STATUS_UPDATED_EVENT_CB:
                        ret = bt_hf_unset_call_status_updated_event_cb();
-                       if (ret < BT_ERROR_NONE) {
+                       if (ret < BT_ERROR_NONE)
                                TC_PRT("failed with [0x%04x]", ret);
-                       } else if (ret == BT_ERROR_NONE) {
+                       else if (ret == BT_ERROR_NONE)
                                TC_PRT("Success");
-                       }
                        break;
                case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
                        need_to_set_params = true;