From 1407743b7ae823d2b0d79ab7e8bb38784d24f673 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Tue, 12 Sep 2017 14:48:25 +0900 Subject: [PATCH] Fix tizen coding style errors and warnings Change-Id: I686a9b692ae77ff858be3d6237eb0f0fd5a6aadf Signed-off-by: DoHyun Pyun --- bt-api/bt-event-handler.c | 6 ++---- bt-api/bt-gatt-client.c | 3 +-- bt-otp/bt-otpserver.c | 26 +++++++++----------------- bt-service/bt-service-agent.c | 2 +- bt-service/bt-service-otp.c | 8 ++++---- bt-service/include/bt-service-common.h | 4 ++-- include/bluetooth-api.h | 4 ++-- include/plugin.h | 9 +++++---- plugin/headed.c | 11 ++++++----- 9 files changed, 32 insertions(+), 41 deletions(-) diff --git a/bt-api/bt-event-handler.c b/bt-api/bt-event-handler.c index f1cb967..8e2a0f7 100644 --- a/bt-api/bt-event-handler.c +++ b/bt-api/bt-event-handler.c @@ -3084,9 +3084,8 @@ static void __bt_otp_event_filter(GDBusConnection *connection, result, info, event_info->cb, event_info->user_data); - if (info->handle) { + if (info->handle) g_free(info->handle); - } if (info->data) { g_free(info->data); @@ -3137,9 +3136,8 @@ static void __bt_otp_event_filter(GDBusConnection *connection, result, ind_res, event_info->cb, event_info->user_data); - if (ind_res->handle) { + if (ind_res->handle) g_free(ind_res->handle); - } if (ind_res->data) { g_free(ind_res->data); diff --git a/bt-api/bt-gatt-client.c b/bt-api/bt-gatt-client.c index ba8f797..dfca5e9 100644 --- a/bt-api/bt-gatt-client.c +++ b/bt-api/bt-gatt-client.c @@ -136,9 +136,8 @@ BT_EXPORT_API int bluetooth_gatt_set_service_change_watcher( return BLUETOOTH_ERROR_NONE; } - if (service_monitor_list == NULL) { + if (service_monitor_list == NULL) _bt_register_manager_subscribe_signal(TRUE); - } addr = g_malloc0(sizeof(bluetooth_device_address_t)); memcpy(addr, address, sizeof(bluetooth_device_address_t)); diff --git a/bt-otp/bt-otpserver.c b/bt-otp/bt-otpserver.c index 4de7302..7693b12 100644 --- a/bt-otp/bt-otpserver.c +++ b/bt-otp/bt-otpserver.c @@ -210,9 +210,8 @@ void _bt_otp_exit(void) if (ret != BLUETOOTH_ERROR_NONE) BT_ERR("Failed to stop ADV %d", ret); - if (main_loop != NULL) { + if (main_loop != NULL) g_main_loop_quit(main_loop); - } } static void _bt_otp_set_char_value(const char *obj_path, @@ -700,9 +699,8 @@ static void _bt_otp_method(GDBusConnection *connection, goto fail; } - while ((filename = g_dir_read_name(dir))) { + while ((filename = g_dir_read_name(dir))) list = g_slist_append(list, (gpointer) filename); - } g_dir_close(dir); @@ -1789,9 +1787,8 @@ int _bt_otp_read_cb(const char *obj_path, char **value, int *len, uint16_t offse } if (g_strcmp0(obj_path, otp_feature_obj_path)) { - if (!selected_object) { + if (!selected_object) return BLUETOOTH_OTP_ERROR_OBJECT_NOT_SELECTED; - } } info = otp_get_char_value(obj_path); @@ -1948,13 +1945,11 @@ void _bt_otp_gatt_char_property_changed_event(GVariant *msg, /* Send indication for CPs */ if (!g_strcmp0(char_path, otp_oacp_obj_path)) { - if (OACP_indicate) { + if (OACP_indicate) _bt_otp_send_indication(char_path, &info, &addr_hex); - } } else if (!g_strcmp0(char_path, otp_olcp_obj_path)) { - if (OLCP_indicate) { + if (OLCP_indicate) _bt_otp_send_indication(char_path, &info, &addr_hex); - } } } else { BT_ERR("Array Len 0"); @@ -2000,11 +1995,10 @@ void _bt_otp_gatt_char_property_changed_event(GVariant *msg, indicate ? "StartNotify" : "StopNotify"); BT_INFO("Type '%s'\n", g_variant_get_type_string(var)); - if (!g_strcmp0(char_path, otp_oacp_obj_path)) { + if (!g_strcmp0(char_path, otp_oacp_obj_path)) OACP_indicate = indicate; - } else if (!g_strcmp0(char_path, otp_olcp_obj_path)) { + else if (!g_strcmp0(char_path, otp_olcp_obj_path)) OLCP_indicate = indicate; - } } } return; @@ -2048,9 +2042,8 @@ void _bt_otp_adapter_event_filter(GDBusConnection *connection, BT_INFO("Interface %s, Signal %s", interface_name, signal_name); if (g_strcmp0(interface_name, BT_OTP_INTERFACE_NAME) == 0) { - if (strcasecmp(signal_name, BLE_DISABLED) == 0) { + if (strcasecmp(signal_name, BLE_DISABLED) == 0) _bt_otp_exit(); - } } } @@ -2232,9 +2225,8 @@ int main(void) BT_DBG("g_main_loop_quit called!"); - if (main_loop != NULL) { + if (main_loop != NULL) g_main_loop_unref(main_loop); - } return 0; } diff --git a/bt-service/bt-service-agent.c b/bt-service/bt-service-agent.c index 6e39de7..92ee46f 100644 --- a/bt-service/bt-service-agent.c +++ b/bt-service/bt-service-agent.c @@ -584,7 +584,7 @@ static gboolean __authorize_request(GapAgentPrivate *agent, GDBusProxy *device, } if (headed_plugin_info->plugin_headed_enabled) { - if (headed_plugin_info->headed_plugin->bt_is_tethering_enabled() == FALSE) { + if (headed_plugin_info->headed_plugin->bt_is_tethering_enabled() == false) { BT_ERR("BT tethering is not enabled"); goto fail; } diff --git a/bt-service/bt-service-otp.c b/bt-service/bt-service-otp.c index 17a2669..2fadc58 100644 --- a/bt-service/bt-service-otp.c +++ b/bt-service/bt-service-otp.c @@ -254,9 +254,10 @@ int bt_otp_server_deinit(int request_id) int __get_handle_length(char *handle) { int i = 0; - while (handle && (handle[i] != '\0')) { + + while (handle && (handle[i] != '\0')) i++; - } + return i; } @@ -757,9 +758,8 @@ int _bt_otp_write_characteristic_value(int request_id, char *sender, char *handl builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay")); - for (i = 0; i < length; i++) { + for (i = 0; i < length; i++) g_variant_builder_add(builder1, "y", param[i]); - } val = g_variant_new("ay", builder1); builder2 = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); diff --git a/bt-service/include/bt-service-common.h b/bt-service/include/bt-service-common.h index b0c2c8a..726a892 100644 --- a/bt-service/include/bt-service-common.h +++ b/bt-service/include/bt-service-common.h @@ -347,8 +347,8 @@ struct bluetooth_headed_plugin_t { const char *filename, const char *agent_path); void (*bt_destroy_popup_all)(void); - gboolean (*bt_launch_unable_to_pairing_syspopup)(int result); - gboolean (*bt_is_tethering_enabled)(void); + bool (*bt_launch_unable_to_pairing_syspopup)(int result); + bool (*bt_is_tethering_enabled)(void); int (*bt_get_mime_type)(char *file_name, char **mime_type); }; diff --git a/include/bluetooth-api.h b/include/bluetooth-api.h index 003563c..2d23b9c 100644 --- a/include/bluetooth-api.h +++ b/include/bluetooth-api.h @@ -210,7 +210,7 @@ extern "C" { #define BLUETOOTH_ATT_ERROR_WRITE_REQUEST_REJECTED 0xFC #define BLUETOOTH_ATT_ERROR_CCCD_IMPROPERLY_CONFIGURED 0xFD #define BLUETOOTH_ATT_ERROR_PROCEDURE_ALREADY_IN_PROGRESS 0xFE -#define BLUETOOTH_ATT_ERROR_OUT_OF_RANGE 0xFF +#define BLUETOOTH_ATT_ERROR_OUT_OF_RANGE 0xFF /* * Bluetooth ATT error codes specific to OTP @@ -7629,7 +7629,7 @@ int bluetooth_otp_enable_notification(const char *handle); * * @remark None */ -int bluetooth_otp_write_characteristics_value( const char *handle, +int bluetooth_otp_write_characteristics_value(const char *handle, unsigned char *buf, int length); /** diff --git a/include/plugin.h b/include/plugin.h index 0112dc4..6a79b28 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -18,8 +18,9 @@ #ifndef __BLUETOOTH_PLUGIN_H #define __BLUETOOTH_PLUGIN_H +#include #include -#include + #undef LOG_TAG #define LOG_TAG "BLUETOOTH_FRWK_PLUGIN" @@ -80,7 +81,7 @@ typedef enum { } bt_agent_event_type_t; struct bluetooth_headed_plugin_t { - int (*bt_launch_dpmpopup) (char *mode); + int (*bt_launch_dpmpopup)(char *mode); int (*bt_launch_system_popup)(bt_agent_event_type_t event_type, const char *device_name, const unsigned char *auth_info, @@ -89,8 +90,8 @@ struct bluetooth_headed_plugin_t { const char *agent_path); void (*bt_destroy_popup_all)(void); - gboolean (*bt_launch_unable_to_pairing_syspopup)(int result); - gboolean (*bt_is_tethering_enabled)(void); + bool (*bt_launch_unable_to_pairing_syspopup)(int result); + bool (*bt_is_tethering_enabled)(void); int (*bt_get_mime_type)(char *file_name, char **mime_type); }; diff --git a/plugin/headed.c b/plugin/headed.c index 8ed7698..9a2b3c5 100644 --- a/plugin/headed.c +++ b/plugin/headed.c @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -206,7 +207,7 @@ int bt_launch_system_popup(bt_agent_event_type_t event_type, return 0; } -gboolean bt_launch_unable_to_pairing_syspopup(int result) +bool bt_launch_unable_to_pairing_syspopup(int result) { BT_DBG("+"); int ret = 0; @@ -214,7 +215,7 @@ gboolean bt_launch_unable_to_pairing_syspopup(int result) b = bundle_create(); if (b == NULL) - return FALSE; + return false; bundle_add(b, "event-type", "unable-to-pairing"); @@ -235,11 +236,11 @@ gboolean bt_launch_unable_to_pairing_syspopup(int result) } BT_DBG("-"); - return TRUE; + return true; } -gboolean bt_is_tethering_enabled(void) +bool bt_is_tethering_enabled(void) { BT_DBG("+"); @@ -264,7 +265,7 @@ gboolean bt_is_tethering_enabled(void) if (ret != TETHERING_ERROR_NONE) BT_ERR("Fail to destroy tethering: %d", ret); - return (gboolean)enabled; + return enabled; } int bt_get_mime_type(char *file_name, char **mime_type) -- 2.7.4