Apply Tizen coding rules 69/65269/1
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 8 Apr 2016 07:12:17 +0000 (16:12 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Fri, 8 Apr 2016 07:12:33 +0000 (16:12 +0900)
Change-Id: I8653f59b3adde86e1ad3cbaa96f09e6107bf8ba6
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
packaging/mobileap-agent.spec
src/mobileap_bluetooth.c
src/mobileap_common.c
src/mobileap_handler.c
src/mobileap_iptables.c
src/mobileap_main.c
src/mobileap_network.c
src/mobileap_notification.c
src/mobileap_softap.c
src/mobileap_usb.c
src/mobileap_wifi.c

index a8a1b1d..a35be2c 100644 (file)
@@ -1,6 +1,6 @@
 Name:          mobileap-agent
 Summary:       Mobile AP daemon for setting tethering environments
-Version:       1.0.51
+Version:       1.0.52
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 5759805..1407d35 100755 (executable)
@@ -39,7 +39,7 @@ static __bt_remote_device_s __bt_remote_devices[MOBILE_AP_MAX_BT_STA] = {
        {NULL, NULL, IP_ADDRESS_BT_1},
        {NULL, NULL, IP_ADDRESS_BT_2},
        {NULL, NULL, IP_ADDRESS_BT_3},
-       {NULL, NULL, IP_ADDRESS_BT_4}};
+       {NULL, NULL, IP_ADDRESS_BT_4} };
 
 static GDBusMethodInvocation *g_context = NULL;
 
@@ -239,9 +239,9 @@ static mobile_ap_error_code_e __turn_on_bt_adapter(gpointer data)
 
        ret = bt_adapter_enable();
        if (ret == BT_ERROR_NOW_IN_PROGRESS) {
-               if (__recheck_bt_adapter_timer) {
+               if (__recheck_bt_adapter_timer)
                        g_source_remove(__recheck_bt_adapter_timer);
-               }
+
                __recheck_bt_adapter_timer = g_timeout_add(PS_RECHECK_INTERVAL,
                                (GSourceFunc) __bt_adapter_timeout_cb, (gpointer) obj);
                return MOBILE_AP_ERROR_NONE;
@@ -318,9 +318,8 @@ mobile_ap_error_code_e _enable_bt_tethering(Tethering *obj)
        }
 
        ret = _init_tethering();
-       if (ret != MOBILE_AP_ERROR_NONE) {
+       if (ret != MOBILE_AP_ERROR_NONE)
                return ret;
-       }
 
        ret = __turn_on_bt_nap(obj);
        if (ret != MOBILE_AP_ERROR_NONE) {
@@ -395,14 +394,12 @@ static void __bt_nap_connection_changed(bool connected, const char *remote_addre
                }
 
                ret = _mh_core_set_ip_address(interface_name, remote->intf_ip);
-               if (ret != MOBILE_AP_ERROR_NONE) {
+               if (ret != MOBILE_AP_ERROR_NONE)
                        ERR("Setting ip address error : %d\n", ret);
-               }
        } else {
                _remove_station_info(remote_address, _slist_find_station_by_mac);
-               if (__del_bt_remote(remote_address) == FALSE) {
+               if (__del_bt_remote(remote_address) == FALSE)
                        ERR("__del_bt_remote is failed\n");
-               }
 
                _get_station_count((gconstpointer)MOBILE_AP_TYPE_BT,
                                _slist_find_station_by_interface, &n_station);
@@ -498,13 +495,11 @@ static void __bt_adapter_visibility_changed_cb(int result,
        bt_adapter_visibility_mode_e mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE;
 
        ret = bt_adapter_get_visibility(&mode, &duration);
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                ERR("bt_adapter_get_visibility is failed 0x[%X]\n", ret);
-       }
 
-       if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) {
+       if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE)
                        ERR("_launch_toast_popup() is failed\n");
-       }
 
        DBG("-\n");
 }
@@ -518,15 +513,13 @@ static void __handle_bt_adapter_visibility()
        bt_adapter_visibility_mode_e mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE;
 
        ret = bt_adapter_get_visibility(&mode, &duration);
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                ERR("bt_adapter_get_visibility is failed 0x[%X]\n", ret);
-       }
 
        if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) {
                ret = bt_adapter_set_visibility(BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE, 120);
-               if (ret != BT_ERROR_NONE) {
+               if (ret != BT_ERROR_NONE)
                        ERR("bt_adapter_set_visibility is failed 0x[%X]\n", ret);
-               }
        }
        bt_adapter_set_visibility_mode_changed_cb(__bt_adapter_visibility_changed_cb, NULL);
        DBG("-\n");
index e9f7ed0..fea1eab 100755 (executable)
@@ -93,13 +93,11 @@ void _update_station_count(int count)
        int bt_count = 0;
        int usb_count = 0;
 
-       if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP)) {
+       if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
                return;
-       }
 
-       if (prev_cnt == count) {
+       if (prev_cnt == count)
                return;
-       }
 
        if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_CONNECTED_DEVICE,
                                count) < 0) {
@@ -117,23 +115,21 @@ void _update_station_count(int count)
        _get_station_count((gconstpointer)MOBILE_AP_TYPE_BT, _slist_find_station_by_interface, &bt_count);
        _get_station_count((gconstpointer)MOBILE_AP_TYPE_USB, _slist_find_station_by_interface, &usb_count);
 
-       if (wifi_count > 0 && bt_count == 0 && usb_count == 0) {
+       if (wifi_count > 0 && bt_count == 0 && usb_count == 0)
                g_strlcpy(icon_path, MH_NOTI_ICON_WIFI, sizeof(icon_path));
-       } else if (wifi_count == 0 && bt_count > 0 && usb_count == 0) {
+       else if (wifi_count == 0 && bt_count > 0 && usb_count == 0)
                g_strlcpy(icon_path, MH_NOTI_ICON_BT, sizeof(icon_path));
-       } else if (wifi_count == 0 && bt_count == 0 && usb_count > 0) {
+       else if (wifi_count == 0 && bt_count == 0 && usb_count > 0)
                g_strlcpy(icon_path, MH_NOTI_ICON_USB, sizeof(icon_path));
-       } else if (wifi_count == 0 && bt_count == 0 && usb_count == 0) {
+       else if (wifi_count == 0 && bt_count == 0 && usb_count == 0)
                return;
-       } else {
+       else
                g_strlcpy(icon_path, MH_NOTI_ICON_GENERAL, sizeof(icon_path));
-       }
 
-       if (prev_cnt == 0) {
+       if (prev_cnt == 0)
                _create_connected_noti(count, icon_path);
-       } else {
+       else
                _update_connected_noti(count, icon_path);
-       }
 
        prev_cnt = count;
        return;
@@ -153,9 +149,8 @@ int _add_station_info(mobile_ap_station_info_t *info)
 
        if (_get_station_info(info->mac, _slist_find_station_by_mac, &si) ==
                        MOBILE_AP_ERROR_NONE) {
-               if (!si) {
+               if (!si)
                        return MOBILE_AP_ERROR_INTERNAL;
-               }
 
                if (g_strcmp0(si->hostname, info->hostname) == 0 &&
                                g_strcmp0(si->ip, info->ip) == 0) {
@@ -219,9 +214,8 @@ int _remove_station_info(gconstpointer data, GCompareFunc func)
 
 int _remove_station_info_all(mobile_ap_type_e type)
 {
-       if (station_list == NULL) {
+       if (station_list == NULL)
                return MOBILE_AP_ERROR_NONE;
-       }
 
        GSList *l = station_list;
        GSList *temp_l = NULL;
@@ -311,12 +305,12 @@ GVariant * _station_info_foreach()
        GVariantBuilder *outer_builder;
        mobile_ap_station_info_t *st = NULL;
 
-       outer_builder = g_variant_builder_new(G_VARIANT_TYPE ("a(a{sv})"));
+       outer_builder = g_variant_builder_new(G_VARIANT_TYPE("a(a{sv})"));
 
        for (l = station_list; l != NULL; l = g_slist_next(l)) {
                st = (mobile_ap_station_info_t *)l->data;
 
-               inner_builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+               inner_builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
                g_variant_builder_add(inner_builder, "{sv}", "Type",
                                        g_variant_new_int32(st->interface));
                g_variant_builder_add(inner_builder, "{sv}", "IP",
@@ -336,11 +330,11 @@ GVariant * _station_info_foreach()
        }
 
        params = g_variant_new("(@a(a{sv}))", g_variant_builder_end(outer_builder));
-       if (params == NULL) {
+       if (params == NULL)
                ERR("params IS NULL\n");
-       } else {
+       else
                SDBG("outer builder print  %s", g_variant_print(params, TRUE));
-       }
+
        g_variant_builder_unref(outer_builder);
        return params;
 }
@@ -484,9 +478,8 @@ int _execute_command(const char *cmd)
        }
 
        if (!pid) {
-               if (execv(args[0], args)) {
+               if (execv(args[0], args))
                        ERR("execl failed\n");
-               }
 
                ERR("Should never get here!\n");
                return EXIT_FAILURE;
index 0b5579b..79dd1bc 100644 (file)
@@ -43,7 +43,7 @@ static sp_timeout_handler_t sp_timeout_handler[MOBILE_AP_TYPE_MAX] = {
        {0, 0, __wifi_timeout_cb, NULL},
        {0, 0, NULL, NULL},
        {0, 0, __bt_timeout_cb, NULL},
-       {0, 0, NULL, NULL}};
+       {0, 0, NULL, NULL} };
 
 static void __handle_network_cellular_state_changed_cb(keynode_t *key, void *data)
 {
@@ -55,9 +55,8 @@ static void __handle_network_cellular_state_changed_cb(keynode_t *key, void *dat
        Tethering *obj = (Tethering *)data;
        int vconf_key = 0;
 
-       if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI | MOBILE_AP_STATE_WIFI_AP)) {
+       if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI | MOBILE_AP_STATE_WIFI_AP))
                return;
-       }
 
        if (vconf_keynode_get_type(key) != VCONF_TYPE_INT) {
                ERR("Invalid vconf key type\n");
@@ -95,9 +94,8 @@ static void __handle_device_name_changed_cb(keynode_t *key, void *data)
        softap_settings_t *new_settings = _get_softap_settings();
        softap_security_type_e sec_type;
 
-       if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI | MOBILE_AP_STATE_WIFI_AP)) {
+       if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI | MOBILE_AP_STATE_WIFI_AP))
                return;
-       }
 
        if (vconf_keynode_get_type(key) != VCONF_TYPE_STRING) {
                ERR("Invalid vconf key type\n");
@@ -107,11 +105,11 @@ static void __handle_device_name_changed_cb(keynode_t *key, void *data)
 
        if (g_strcmp0(vconf_key, new_settings->ssid) != 0) {
                DBG("Device name is changed\n");
-               if (!g_strcmp0(new_settings->security_type, SOFTAP_SECURITY_TYPE_WPA2_PSK_STR)) {
+               if (!g_strcmp0(new_settings->security_type, SOFTAP_SECURITY_TYPE_WPA2_PSK_STR))
                        sec_type = SOFTAP_SECURITY_TYPE_WPA2_PSK;
-               } else {
+               else
                        sec_type = SOFTAP_SECURITY_TYPE_OPEN;
-               }
+
                if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI)) {
                        _reload_softap_settings(obj, vconf_key, new_settings->key,
                                        new_settings->mode, new_settings->channel, new_settings->hide_mode, new_settings->mac_filter, sec_type);
@@ -171,16 +169,14 @@ void _register_vconf_cb(void *user_data)
        while (vconf_reg[i].key != NULL && vconf_reg[i].cb != NULL) {
                ret = vconf_notify_key_changed(vconf_reg[i].key,
                                        vconf_reg[i].cb, user_data);
-               if (ret != 0) {
+               if (ret != 0)
                        ERR("vconf_notify_key_changed is failed : %d\n", ret);
-               }
 
                if (vconf_reg[i].value) {
                        ret = vconf_get_int(vconf_reg[i].key,
                                        vconf_reg[i].value);
-                       if (ret != 0) {
+                       if (ret != 0)
                                ERR("vconf_get_int is failed : %d\n", ret);
-                       }
                }
 
                i++;
@@ -207,9 +203,8 @@ void _unregister_vconf_cb(void)
        while (vconf_reg[i].key != NULL && vconf_reg[i].cb != NULL) {
                ret = vconf_ignore_key_changed(vconf_reg[i].key,
                                vconf_reg[i].cb);
-               if (ret != 0) {
+               if (ret != 0)
                        ERR("vconf_notify_key_changed is failed : %d\n", ret);
-               }
 
                i++;
        }
@@ -234,7 +229,9 @@ static gboolean __wifi_timeout_cb(gpointer data)
 
        _disable_wifi_tethering(obj);
        tethering_emit_wifi_off(obj, SIGNAL_MSG_TIMEOUT);
-       //_launch_toast_popup(MOBILE_AP_TETHERING_TIMEOUT_TOAST_POPUP);
+#if 0
+       _launch_toast_popup(MOBILE_AP_TETHERING_TIMEOUT_TOAST_POPUP);
+#endif
        _create_timeout_noti(MH_NOTI_ICON_WIFI);
        DBG("-\n");
        return FALSE;
@@ -257,7 +254,9 @@ static gboolean __bt_timeout_cb(gpointer data)
 
        _disable_bt_tethering(obj);
        tethering_emit_bluetooth_off(obj, SIGNAL_MSG_TIMEOUT);
-       //_launch_toast_popup(MOBILE_AP_TETHERING_TIMEOUT_TOAST_POPUP);
+#if 0
+       _launch_toast_popup(MOBILE_AP_TETHERING_TIMEOUT_TOAST_POPUP);
+#endif
        _create_timeout_noti(MH_NOTI_ICON_BT);
        DBG("-\n");
        return FALSE;
@@ -352,9 +351,8 @@ void _init_timeout_cb(mobile_ap_type_e type, void *user_data)
 {
        DBG("+\n");
 
-       if (sp_timeout_handler[type].func == NULL) {
+       if (sp_timeout_handler[type].func == NULL)
                return;
-       }
 
        if (user_data == NULL) {
                ERR("Invalid param\n");
@@ -376,17 +374,15 @@ void _start_timeout_cb(mobile_ap_type_e type, time_t end_time)
        mobile_ap_type_e i;
        sp_timeout_handler_t *next_timeout;
 
-       if (sp_timeout_handler[type].func == NULL) {
+       if (sp_timeout_handler[type].func == NULL)
                return;
-       }
 
        __reset_timeout(&sp_timeout_handler[type]);
        sp_timeout_handler[type].end_time = end_time;
 
        next_timeout = __find_next_timeout();
-       if (next_timeout->alarm_id > 0) {
+       if (next_timeout->alarm_id > 0)
                return;
-       }
 
        for (i = MOBILE_AP_TYPE_WIFI; i < MOBILE_AP_TYPE_MAX; i++) {
                if (sp_timeout_handler[i].alarm_id == 0)
@@ -421,9 +417,8 @@ void _stop_timeout_cb(mobile_ap_type_e type)
        mobile_ap_type_e i;
        sp_timeout_handler_t *next_timeout;
 
-       if (sp_timeout_handler[type].func == NULL) {
+       if (sp_timeout_handler[type].func == NULL)
                return;
-       }
 
        if (sp_timeout_handler[type].alarm_id == 0) {
                sp_timeout_handler[type].end_time = 0;
@@ -463,16 +458,15 @@ void _stop_timeout_cb(mobile_ap_type_e type)
        return;
 }
 
-void _deinit_timeout_cb(mobile_ap_type_e type) {
+void _deinit_timeout_cb(mobile_ap_type_e type)
+{
        DBG("+\n");
 
-       if (sp_timeout_handler[type].func == NULL) {
+       if (sp_timeout_handler[type].func == NULL)
                return;
-       }
 
-       if (sp_timeout_handler[type].alarm_id > 0) {
+       if (sp_timeout_handler[type].alarm_id > 0)
                _stop_timeout_cb(type);
-       }
 
        sp_timeout_handler[type].user_data = NULL;
        sp_timeout_handler[type].end_time = 0;
index 9a89373..5320bee 100755 (executable)
@@ -283,9 +283,8 @@ int _get_data_usage(const char *src, const char *dest, unsigned long long *tx,
        snprintf(cmd, sizeof(cmd),
                "%s -t %s -L %s -vx | %s -v DROP | %s \"%s[ ]*%s\" | %s '{ print $2 }' > %s",
                IPTABLES, TABLE_FILTER, TETH_FILTER_FW, GREP, GREP, src, dest, AWK, DATA_USAGE_FILE);
-       if (system(cmd) < 0) {
+       if (system(cmd) < 0)
                ERR("cmd %s is failed\n", cmd);
-       }
 
        *tx = 0;
 
@@ -297,9 +296,8 @@ int _get_data_usage(const char *src, const char *dest, unsigned long long *tx,
                return MOBILE_AP_ERROR_INTERNAL;
        }
 
-       while (fgets(buf, sizeof(buf), fp) != NULL) {
+       while (fgets(buf, sizeof(buf), fp) != NULL)
                *tx += atoll(buf);
-       }
 
        fclose(fp);
        unlink(DATA_USAGE_FILE);
@@ -308,9 +306,8 @@ int _get_data_usage(const char *src, const char *dest, unsigned long long *tx,
        snprintf(cmd, sizeof(cmd),
                "%s -t %s -L %s -vx | %s -v DROP | %s \"%s[ ]*%s\" | %s '{ print $2 }' > %s",
                IPTABLES, TABLE_FILTER, TETH_FILTER_FW, GREP, GREP, dest, src, AWK, DATA_USAGE_FILE);
-       if (system(cmd) < 0) {
+       if (system(cmd) < 0)
                ERR("cmd %s is failed\n", cmd);
-       }
 
        *rx = 0;
 
@@ -322,9 +319,8 @@ int _get_data_usage(const char *src, const char *dest, unsigned long long *tx,
                return MOBILE_AP_ERROR_INTERNAL;
        }
 
-       while (fgets(buf, sizeof(buf), fp) != NULL) {
+       while (fgets(buf, sizeof(buf), fp) != NULL)
                *rx += atoll(buf);
-       }
 
        fclose(fp);
        unlink(DATA_USAGE_FILE);
index 819c1bd..7eaeaf0 100644 (file)
@@ -142,9 +142,8 @@ gboolean _mobileap_clear_state(int state)
 
 gboolean _terminate_mobileap_agent(gpointer user_data)
 {
-       if (mainloop == NULL) {
+       if (mainloop == NULL)
                return FALSE;
-       }
 
        if (!_mobileap_is_disabled()) {
                DBG("Tethering is enabled\n");
@@ -211,9 +210,9 @@ int _init_tethering(void)
                return MOBILE_AP_ERROR_NONE;
        }
 
-       if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP)) {
+       if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
                ret = _open_network();
-       }
+
        _mh_core_execute_dhcp_server();
 
        init_count++;
@@ -240,14 +239,12 @@ gboolean _deinit_tethering(void)
 
        _mh_core_terminate_dhcp_server();
 
-       if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP)) {
+       if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
                _close_network();
-       }
 
        idle_id = g_idle_add(_terminate_mobileap_agent, NULL);
-       if (idle_id == 0) {
+       if (idle_id == 0)
                ERR("g_idle_add is failed\n");
-       }
 
        return TRUE;
 }
@@ -356,7 +353,7 @@ gboolean softap_get_station_info(Softap *obj,
        return TRUE;
 }
 
-void static __handle_dnsmasq_dhcp_status_changed_cb(GDBusConnection *connection,
+static void __handle_dnsmasq_dhcp_status_changed_cb(GDBusConnection *connection,
                        const gchar *sender_name, const gchar *object_path,
                        const gchar *interface_name, const gchar *signal_name,
                        GVariant *parameters, gpointer user_data)
@@ -381,17 +378,16 @@ void static __handle_dnsmasq_dhcp_status_changed_cb(GDBusConnection *connection,
                /*
                 * DHCP ACK received, destroy timeout if exists
                 */
-               if (ip_addr == NULL || mac == NULL) {
+               if (ip_addr == NULL || mac == NULL)
                        goto EXIT;
-               }
+
                _destroy_dhcp_ack_timer(mac);
 
                if (_get_tethering_type_from_ip(ip_addr, &type) != MOBILE_AP_ERROR_NONE)
                        goto EXIT;
 
-               if (_mobileap_is_enabled_by_type(type) == FALSE) {
+               if (_mobileap_is_enabled_by_type(type) == FALSE)
                        goto EXIT;
-               }
 
                info = (mobile_ap_station_info_t *)g_malloc(sizeof(mobile_ap_station_info_t));
                if (info == NULL) {
@@ -436,14 +432,14 @@ void static __handle_dnsmasq_dhcp_status_changed_cb(GDBusConnection *connection,
        } else {
                SDBG("UNKNOWN member signal\n");
        }
-EXIT :
+EXIT:
        g_free(ip_addr);
        g_free(mac);
        g_free(name);
        DBG("-\n");
 }
 
-static void on_bus_acquired_cb (GDBusConnection *connection, const gchar *name,
+static void on_bus_acquired_cb(GDBusConnection *connection, const gchar *name,
                                gpointer user_data)
 {
        DBG("+\n");
@@ -452,7 +448,7 @@ static void on_bus_acquired_cb (GDBusConnection *connection, const gchar *name,
        teth_gdbus_conn = connection;
 
        manager_server = g_dbus_object_manager_server_new(TETHERING_SERVICE_OBJECT_PATH);
-       if(manager_server == NULL) {
+       if (manager_server == NULL) {
                DBG("Manager server not created.");
                return;
        }
@@ -574,7 +570,7 @@ int main(int argc, char **argv)
 
        DBG("+\n");
 
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
        g_type_init();
 #endif
 
@@ -590,9 +586,8 @@ int main(int argc, char **argv)
                return 0;
        }
        /* Platform modules */
-       if (appcore_set_i18n(MOBILEAP_LOCALE_COMMON_PKG, MOBILEAP_LOCALE_COMMON_RES) < 0) {
+       if (appcore_set_i18n(MOBILEAP_LOCALE_COMMON_PKG, MOBILEAP_LOCALE_COMMON_RES) < 0)
                ERR("appcore_set_i18n is failed\n");
-       }
 
        if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &mobileap_state) < 0) {
                ERR("vconf_get_int is failed\n");
@@ -602,18 +597,16 @@ int main(int argc, char **argv)
        _register_wifi_station_handler();
 
        ret = wifi_initialize();
-       if (ret != WIFI_ERROR_NONE) {
+       if (ret != WIFI_ERROR_NONE)
                ERR("wifi_initialize() is failed : %d\n", ret);
-       }
 
        ret = alarmmgr_init(APPNAME);
        if (ret != ALARMMGR_RESULT_SUCCESS) {
                ERR("alarmmgr_init(%s) is failed : %d\n", APPNAME, ret);
        } else {
                ret = alarmmgr_set_cb(_sp_timeout_handler, NULL);
-               if (ret != ALARMMGR_RESULT_SUCCESS) {
+               if (ret != ALARMMGR_RESULT_SUCCESS)
                        ERR("alarmmgr_set_cb is failed : %d\n", ret);
-               }
        }
 
        _register_app_for_wifi_passphrase(MOBILE_AP_UG_PKG_ID);
@@ -623,9 +616,8 @@ int main(int argc, char **argv)
        alarmmgr_fini();
 
        ret = wifi_deinitialize();
-       if (ret != WIFI_ERROR_NONE) {
+       if (ret != WIFI_ERROR_NONE)
                ERR("wifi_deinitialize() is failed : %d\n", ret);
-       }
 
        _unregister_vconf_cb();
        _unregister_wifi_station_handler();
index ea00d2a..66eee6b 100644 (file)
@@ -343,9 +343,8 @@ static void __handle_open_network_error(void)
 {
        int ret = MOBILE_AP_ERROR_NONE;
 
-       if (_mobileap_is_disabled()) {
+       if (_mobileap_is_disabled())
                return;
-       }
 
        ret = _disable_wifi_tethering(obj);
        DBG("_disable_wifi_tethering returns %d\n", ret);
@@ -401,9 +400,8 @@ static gboolean __is_connected_profile(connection_profile_h profile)
                return FALSE;
        }
 
-       if (pstat != CONNECTION_PROFILE_STATE_CONNECTED) {
+       if (pstat != CONNECTION_PROFILE_STATE_CONNECTED)
                return FALSE;
-       }
 
        DBG("Profile is connected\n");
        return TRUE;
@@ -594,11 +592,10 @@ static void __profile_closed_cb(connection_error_e result, void *user_data)
 {
        connection_profile_refresh(c_prof.handle);
 
-       if (result != CONNECTION_ERROR_NONE) {
+       if (result != CONNECTION_ERROR_NONE)
                ERR("Unable to close profile [0x%X]", result);
-       } else {
+       else
                DBG("Tethering profile is closed");
-       }
 
        return;
 }
@@ -730,9 +727,8 @@ static gboolean __open_tethering_profile(void)
 
        DBG("+\n");
 
-       if (c_prof.svc_type == __INTERNET) {
+       if (c_prof.svc_type == __INTERNET)
                return TRUE;
-       }
 
        if (__is_connected_profile(c_prof.handle)) {
                DBG("Already connected profile\n");
@@ -782,9 +778,8 @@ gboolean _get_network_interface_name(char **if_name)
                return FALSE;
        }
 
-       if (tethered_prof == NULL) {
+       if (tethered_prof == NULL)
                return FALSE;
-       }
 
        int ret = 0;
 
@@ -812,9 +807,8 @@ gboolean _get_network_gateway_address(char **ip)
                return FALSE;
        }
 
-       if (tethered_prof == NULL) {
+       if (tethered_prof == NULL)
                return FALSE;
-       }
 
        int ret = 0;
 
@@ -878,9 +872,8 @@ gboolean _add_default_router(void)
        char *ip = NULL;
        char *interface = NULL;
 
-       if (_get_network_gateway_address(&ip) == FALSE) {
+       if (_get_network_gateway_address(&ip) == FALSE)
                return FALSE;
-       }
 
        if (_get_network_interface_name(&interface) == FALSE) {
                free(ip);
@@ -911,9 +904,8 @@ gboolean _del_default_router(void)
        char *ip = NULL;
        char *interface = NULL;
 
-       if (_get_network_gateway_address(&ip) == FALSE) {
+       if (_get_network_gateway_address(&ip) == FALSE)
                return FALSE;
-       }
 
        if (_get_network_interface_name(&interface) == FALSE) {
                free(ip);
@@ -940,9 +932,8 @@ void _add_port_forward_rule(void)
        GSList *l;
        port_forward_info_s *pf;
 
-       if (access(MH_PORT_FORWARD_CONF_FILEPATH, F_OK) < 0) {
+       if (access(MH_PORT_FORWARD_CONF_FILEPATH, F_OK) < 0)
                return;
-       }
 
        if (__read_port_forward_info(MH_PORT_FORWARD_CONF_FILEPATH) == FALSE) {
                ERR("__read_port_forward_info() is failed\n");
@@ -980,7 +971,7 @@ void _del_port_forward_rule(void)
                return;
        }
 
-       for(l = port_forward_info; l;) {
+       for (l = port_forward_info; l;) {
                pf = (port_forward_info_s *)l->data;
                if (pf) {
                        g_free(pf->new_dest_ip);
@@ -1059,9 +1050,8 @@ int _open_network(void)
                __print_cellular_profile();
 
                if (!__is_connected_profile(c_prof.handle)) {
-                       if (c_prof.svc_type != __TETHERING_ONLY) {
+                       if (c_prof.svc_type != __TETHERING_ONLY)
                                return MOBILE_AP_ERROR_NONE;
-                       }
 
                        if (net_timeout_id) {
                                g_source_remove(net_timeout_id);
@@ -1185,9 +1175,8 @@ gboolean _deinit_network(void)
        }
 
        ret = connection_unset_type_changed_cb(connection);
-       if (ret != CONNECTION_ERROR_NONE) {
+       if (ret != CONNECTION_ERROR_NONE)
                ERR("connection_unset_type_changed_cb is failed : %d\n", ret);
-       }
 
        connection_destroy(connection);
        connection = NULL;
index 0b2ec8f..2845040 100644 (file)
@@ -89,9 +89,8 @@ int _create_timeout_noti(const char *icon_path)
                        }
 
                        ret = notification_free(noti);
-                       if (ret != NOTIFICATION_ERROR_NONE) {
+                       if (ret != NOTIFICATION_ERROR_NONE)
                                ERR("Fail to notification_free [%d]\n", ret);
-                       }
                }
 
                timeout_noti_id = 0;
@@ -203,9 +202,8 @@ int _delete_timeout_noti(void)
                return MOBILE_AP_ERROR_INTERNAL;
        }
 
-       if (noti_list == NULL) {
+       if (noti_list == NULL)
                return MOBILE_AP_ERROR_NONE;
-       }
 
        for (l = noti_list; l; l = notification_list_get_next(l)) {
                noti = notification_list_get_data(l);
@@ -394,9 +392,8 @@ int _update_connected_noti(int count, const char *icon_path)
 
 FAIL:
        ret = notification_free(noti);
-       if (ret != NOTIFICATION_ERROR_NONE) {
+       if (ret != NOTIFICATION_ERROR_NONE)
                ERR("Fail to notification_free [%d]\n", ret);
-       }
 
        return MOBILE_AP_ERROR_INTERNAL;
 }
@@ -469,9 +466,8 @@ void _create_bt_tethering_active_noti(void)
        }
 
        ret = bt_adapter_get_visibility(&mode, &duration);
-       if (ret != BT_ERROR_NONE) {
+       if (ret != BT_ERROR_NONE)
                ERR("bt_adapter_get_visibility is failed 0x[%X]\n", ret);
-       }
 
        if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) {
                str2 = MH_STR_BT_VISIBILITY;
index a4953c7..45a89d5 100755 (executable)
@@ -65,10 +65,9 @@ static char *__find_first_caps_char(char *str)
                return NULL;
        }
 
-       while(*str) {
-               if (isupper(*str)) {
+       while (*str) {
+               if (isupper(*str))
                        return str;
-               }
                str++;
        }
        return NULL;
@@ -146,11 +145,10 @@ static int __execute_hostapd(const mobile_ap_type_e type, const char *ssid,
        char key[MOBILE_AP_WIFI_KEY_MAX_LEN + 1];
        char *hw_mode = NULL;
 
-       if (mode == NULL) {
+       if (mode == NULL)
                hw_mode = g_strdup("g");
-       } else {
+       else
                hw_mode = g_strdup(mode);
-       }
 
        /* Default conf. */
        snprintf(buf, sizeof(buf), HOSTAPD_CONF,
@@ -315,9 +313,8 @@ static int __send_hostapd_req(int fd, const char *req, const int req_len,
 
                *buf_len = ret;
                buf[ret] = '\0';
-               if (ret == 0) {
+               if (ret == 0)
                        ERR("socket is closed\n");
-               }
 
                break;
        }
@@ -349,9 +346,8 @@ static int __open_hostapd_intf(int *fd, const char *intf)
        src.sun_family = AF_UNIX;
        g_strlcpy(src.sun_path, intf, sizeof(src.sun_path));
 
-       if (stat(src.sun_path, &stat_buf) == 0) {
+       if (stat(src.sun_path, &stat_buf) == 0)
                unlink(src.sun_path);
-       }
 
        if (bind(*fd, (struct sockaddr *)&src, sizeof(src)) < 0) {
                ERR("bind is failed\n");
@@ -450,9 +446,8 @@ static gboolean __hostapd_monitor_cb(GIOChannel *source)
        /* concatenated string, containing multiple events can arrive */
        while (pbuf && *pbuf) {
                pbuf = __find_first_caps_char(pbuf);
-               if (!pbuf || !*pbuf) {
+               if (!pbuf || !*pbuf)
                        break;
-               }
 
                if (!strncmp(pbuf, HOSTAPD_STA_CONN, HOSTAPD_STA_CONN_LEN)) {
                        pbuf = pbuf + HOSTAPD_STA_CONN_LEN;
@@ -477,9 +472,8 @@ static gboolean __hostapd_monitor_cb(GIOChannel *source)
 
                        for (l = sta_timer_list; l != NULL; l = g_slist_next(l)) {
                                ptr = (sta_timer_t *)l->data;
-                               if (ptr == NULL) {
+                               if (ptr == NULL)
                                        continue;
-                               }
 
                                if (g_strcmp0(ptr->mac_addr, mac) == 0) {
                                        g_free(mac);
@@ -489,9 +483,8 @@ static gboolean __hostapd_monitor_cb(GIOChannel *source)
                        }
 
                        /* Matched station found, so skip */
-                       if (l != NULL) {
+                       if (l != NULL)
                                continue;
-                       }
 
                        SDBG("%s%s\n", HOSTAPD_STA_CONN, mac);
                        ptr = (sta_timer_t *)g_malloc(sizeof(sta_timer_t));
@@ -508,9 +501,8 @@ static gboolean __hostapd_monitor_cb(GIOChannel *source)
 
                } else if (!strncmp(pbuf, HOSTAPD_STA_DISCONN, HOSTAPD_STA_DISCONN_LEN)) {
                        pbuf = pbuf + HOSTAPD_STA_DISCONN_LEN;
-                       if (!pbuf || !*pbuf) {
+                       if (!pbuf || !*pbuf)
                                break;
-                       }
 
                        end = strchr(pbuf, '<');
                        if (end && *end) {
@@ -548,13 +540,12 @@ static gboolean __hostapd_monitor_cb(GIOChannel *source)
        if (discon_event == FALSE)
                goto DONE;
 
-       if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI)) {
+       if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI))
                type = MOBILE_AP_TYPE_WIFI;
-       } else if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP)) {
+       else if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
                type = MOBILE_AP_TYPE_WIFI_AP;
-       } else {
+       else
                goto DONE;
-       }
 
        _get_station_count((gconstpointer)type,
                        _slist_find_station_by_interface, &n_station);
@@ -636,9 +627,8 @@ static mobile_ap_drv_interface_e __get_drv_interface(void)
 {
        static mobile_ap_drv_interface_e drv_interface = MOBILE_AP_DRV_INTERFACE_NONE;
 
-       if (drv_interface != MOBILE_AP_DRV_INTERFACE_NONE) {
+       if (drv_interface != MOBILE_AP_DRV_INTERFACE_NONE)
                return drv_interface;
-       }
 
        const char *drv_rfkill_path = "/sys/devices/platform";
        const char *wext_drv[] = {
@@ -705,7 +695,7 @@ static int __mh_core_softap_firmware_start(void)
                        NETCONFIG_DBUS_REPLY_TIMEOUT, &error);
        if (dbus_error_is_set(&error) == TRUE) {
                if (NULL != strstr(error.message, ".AlreadyExists")) {
-                       // softap already enabled
+                       /* softap already enabled */
                } else {
                        ERR("dbus_connection_send_with_reply_and_block() failed. "
                                        "DBus error [%s: %s]", error.name, error.message);
@@ -760,7 +750,7 @@ static int __mh_core_softap_firmware_stop(void)
                        NETCONFIG_DBUS_REPLY_TIMEOUT, &error);
        if (dbus_error_is_set(&error) == TRUE) {
                if (NULL != strstr(error.message, ".AlreadyExists")) {
-                       // softap already disabled
+                       /* softap already disabled */
                } else {
                        ERR("dbus_connection_send_with_reply_and_block() failed. "
                                        "DBus error [%s: %s]", error.name, error.message);
@@ -948,9 +938,8 @@ int _mh_core_disable_softap(void)
                        ERR("hostapd termination is failed\n");
 
                ret_status = __terminate_hostapd();
-               if (ret_status != MOBILE_AP_ERROR_NONE) {
+               if (ret_status != MOBILE_AP_ERROR_NONE)
                        ERR("hostapd termination is failed\n");
-               }
                break;
 
        default:
@@ -1397,9 +1386,8 @@ static void __handle_station_signal(int sig)
 {
        int idle_id = 0;
        idle_id = g_idle_add(__send_station_event_cb, GINT_TO_POINTER(sig));
-       if (idle_id == 0) {
+       if (idle_id == 0)
                ERR("g_idle_add is failed\n");
-       }
 }
 
 void _register_wifi_station_handler(void)
@@ -1492,7 +1480,7 @@ static gboolean __hostapd_connect_timer_cb(gpointer user_data)
 
        return FALSE;
 
-SUCCESS :
+SUCCESS:
        if (_add_station_info(info) != MOBILE_AP_ERROR_NONE) {
                g_free(info->hostname);
                g_free(info);
index e1e371a..4076246 100755 (executable)
@@ -68,8 +68,8 @@ static void __usb_device_state_change_cb(GDBusConnection *connection,
        }
        g_variant_get(parameters, "(u)", &value);
        DBG("Received signal(%s), value: (%u)", signal_name, value);
-       DBG("USB connected ? (%s)", value & USBCLIENT_STATE_CONNECTED? "Yes":"No");
-       DBG("USB available ? (%s)", value & USBCLIENT_STATE_AVAILABLE? "Yes":"No");
+       DBG("USB connected ? (%s)", value & USBCLIENT_STATE_CONNECTED ? "Yes" : "No");
+       DBG("USB available ? (%s)", value & USBCLIENT_STATE_AVAILABLE ? "Yes" : "No");
 
        if (USBCLIENT_STATE_DISCONNECTED == value) {
                _disable_usb_tethering(obj);
@@ -90,7 +90,7 @@ int _dbus_register_usb_state_change_signal(void *data)
        mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
        GError *error = NULL;
 
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
        g_type_init();
 #endif
 
@@ -223,9 +223,8 @@ static void __handle_usb_mode_change(keynode_t *key, void *data)
                vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
                                __handle_usb_disconnect_cb, (void *)obj);
                ret = vconf_get_int(VCONFKEY_SETAPPL_USB_MODE_INT, &vconf_key);
-               if (ret != 0) {
+               if (ret != 0)
                        ERR("vconf_get_int is failed. but ignored [%d]\n", ret);
-               }
 
                if (vconf_key != SETTING_USB_TETHERING_MODE) {
                        ERR("USB Mode is changed suddenly\n");
@@ -297,9 +296,8 @@ mobile_ap_error_code_e _enable_usb_tethering(Tethering *obj)
        }
 
        ret = _init_tethering();
-       if (ret != MOBILE_AP_ERROR_NONE) {
+       if (ret != MOBILE_AP_ERROR_NONE)
                goto FAIL;
-       }
 
        vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
                        __handle_usb_mode_change, (void *)obj);
@@ -351,9 +349,8 @@ mobile_ap_error_code_e _disable_usb_tethering(Tethering *obj)
 
        _deinit_tethering();
 
-       if (_remove_station_info_all(MOBILE_AP_TYPE_USB) != MOBILE_AP_ERROR_NONE) {
+       if (_remove_station_info_all(MOBILE_AP_TYPE_USB) != MOBILE_AP_ERROR_NONE)
                ERR("_remove_station_info_all is failed. Ignore it\n");
-       }
 
        /* Clear DBus Signal Handler for USB Client State */
        if (conn) {
index f6708f7..e4606dd 100755 (executable)
@@ -187,14 +187,12 @@ static gboolean __turn_on_wifi_timeout_cb(gpointer user_data)
        wifi_recovery_timeout_id = 0;
 
        ret = wifi_activate(__wifi_activated_cb, NULL);
-       if (ret != WIFI_ERROR_NONE) {
+       if (ret != WIFI_ERROR_NONE)
                ERR("wifi_activate() is failed : %d\n", ret);
-       }
 
        idle_id = g_idle_add(_terminate_mobileap_agent, NULL);
-       if (idle_id == 0) {
+       if (idle_id == 0)
                ERR("g_idle_add is failed\n");
-       }
 
        return FALSE;
 }
@@ -284,9 +282,8 @@ static mobile_ap_error_code_e __update_softap_settings(softap_settings_t *st,
                return MOBILE_AP_ERROR_INTERNAL;
        }
 
-       if (mode != NULL) {
+       if (mode != NULL)
                g_strlcpy(st->mode, mode, sizeof(st->mode));
-       }
 
        st->channel = channel;
        st->hide_mode = hide_mode;
@@ -445,9 +442,8 @@ int _register_app_for_wifi_passphrase(const char *pkg_id)
 
 int _get_wifi_name_from_lease_info(const char *mac, char **name_buf)
 {
-       if (mac == NULL || name_buf == NULL) {
+       if (mac == NULL || name_buf == NULL)
                return MOBILE_AP_ERROR_INVALID_PARAM;
-       }
 
        GIOChannel *io = NULL;
        char *line = NULL;
@@ -459,9 +455,8 @@ int _get_wifi_name_from_lease_info(const char *mac, char **name_buf)
        char extra[MOBILE_AP_STR_INFO_LEN] = {0, };
 
        io = g_io_channel_new_file(DNSMASQ_LEASES_FILE, "r", NULL);
-       if (io == NULL) {
+       if (io == NULL)
                return MOBILE_AP_ERROR_RESOURCE;
-       }
 
        while (g_io_channel_read_line(io, &line, NULL, NULL, NULL) ==
                        G_IO_STATUS_NORMAL) {
@@ -591,9 +586,9 @@ mobile_ap_error_code_e _enable_wifi_ap(Tethering *obj,
                return MOBILE_AP_ERROR_ALREADY_ENABLED;
        }
 
-       if (!_mobileap_set_state(MOBILE_AP_STATE_WIFI_AP)) {
+       if (!_mobileap_set_state(MOBILE_AP_STATE_WIFI_AP))
                return MOBILE_AP_ERROR_RESOURCE;
-       }
+
        ret = __update_softap_settings(&obj_softap_settings, ssid, passphrase,
                        NULL, MOBILE_AP_WIFI_CHANNEL, hide_mode, false, security_type);
        if (ret != MOBILE_AP_ERROR_NONE) {
@@ -656,9 +651,8 @@ mobile_ap_error_code_e _disable_wifi_tethering(Tethering *obj)
        _flush_ip_address(WIFI_IF);
        _deinit_timeout_cb(type);
 
-       if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE) {
+       if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
                ERR("_remove_station_info_all is failed. Ignore it.\n");
-       }
 
        ret = _mh_core_disable_softap();
        if (ret != MOBILE_AP_ERROR_NONE) {
@@ -671,9 +665,8 @@ mobile_ap_error_code_e _disable_wifi_tethering(Tethering *obj)
 
        if (prev_wifi_on == TRUE) {
                DBG("Previous Wi-Fi was turned on. Recover it\n");
-               if (__turn_on_wifi() != MOBILE_AP_ERROR_NONE) {
+               if (__turn_on_wifi() != MOBILE_AP_ERROR_NONE)
                        ERR("__turn_on_wifi() is failed\n");
-               }
                prev_wifi_on = FALSE;
        }
        DBG("_disable_wifi_tethering is done\n");
@@ -704,9 +697,8 @@ mobile_ap_error_code_e _disable_wifi_ap(Tethering *obj)
        _flush_ip_address(WIFI_IF);
        _deinit_timeout_cb(type);
 
-       if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE) {
+       if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
                ERR("_remove_station_info_all is failed. Ignore it.\n");
-       }
 
        ret = _mh_core_disable_softap();
        if (ret != MOBILE_AP_ERROR_NONE) {
@@ -752,9 +744,9 @@ mobile_ap_error_code_e _enable_soft_ap(Softap *obj,
                return MOBILE_AP_ERROR_ALREADY_ENABLED;
        }
 
-       if (!_mobileap_set_state(MOBILE_AP_STATE_WIFI_AP)) {
+       if (!_mobileap_set_state(MOBILE_AP_STATE_WIFI_AP))
                return MOBILE_AP_ERROR_RESOURCE;
-       }
+
        ret = __update_softap_settings(&obj_softap_settings, ssid, passphrase,
                        NULL, MOBILE_AP_WIFI_CHANNEL, hide_mode, false, security_type);
        if (ret != MOBILE_AP_ERROR_NONE) {
@@ -762,13 +754,11 @@ mobile_ap_error_code_e _enable_soft_ap(Softap *obj,
                return ret;
        }
 
-       if (vconf_set_str(VCONFKEY_SOFTAP_SSID, obj_softap_settings.ssid) < 0) {
+       if (vconf_set_str(VCONFKEY_SOFTAP_SSID, obj_softap_settings.ssid) < 0)
                ERR("vconf_set_str is failed");
-       }
 
-       if (vconf_set_str(VCONFKEY_SOFTAP_KEY, obj_softap_settings.key) < 0) {
+       if (vconf_set_str(VCONFKEY_SOFTAP_KEY, obj_softap_settings.key) < 0)
                ERR("vconf_set_str is failed");
-       }
 
        _block_device_sleep();
 
@@ -825,9 +815,8 @@ mobile_ap_error_code_e _disable_soft_ap(Softap *obj)
        _flush_ip_address(WIFI_IF);
        _deinit_timeout_cb(type);
 
-       if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE) {
+       if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
                ERR("_remove_station_info_all is failed. Ignore it.\n");
-       }
 
        ret = _mh_core_disable_softap();
        if (ret != MOBILE_AP_ERROR_NONE) {
@@ -1010,8 +999,7 @@ gboolean tethering_enable_wifi_ap(Tethering *obj, GDBusMethodInvocation *context
                wifi_recovery_timeout_id = 0;
        }
 
-       ret = _enable_wifi_ap(obj, ssid, key, !visibility,
-                       (softap_security_type_e)security_type);
+       ret = _enable_wifi_ap(obj, ssid, key, !visibility, (softap_security_type_e)security_type);
        if (ret != MOBILE_AP_ERROR_NONE) {
                ERR("_enable_wifi_tethering is failed\n");
        } else {
@@ -1210,7 +1198,7 @@ static mobile_ap_error_code_e __get_passphrase(char *passphrase,
                g_strlcpy(passphrase, (char *)ckmc_buf->data, (*passphrase_len) + 1);
        }
 
-    if (alias)
+       if (alias)
                free(alias);
 
        return MOBILE_AP_ERROR_NONE;
@@ -1221,14 +1209,13 @@ gboolean tethering_enable_dhcp(Tethering *obj,
 {
        mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
 
-       if (enable) {
+       if (enable)
                ret = _mh_core_execute_dhcp_server();
-       }
-       else {
+       else
                ret = _mh_core_terminate_dhcp_server();
-       }
 
        tethering_complete_enable_dhcp(obj, context, ret);
+
        return TRUE;
 }
 
@@ -1264,24 +1251,21 @@ gboolean tethering_get_wifi_tethering_passphrase(Tethering *obj,
 gboolean tethering_set_wifi_tethering_passphrase(Tethering *obj,
                GDBusMethodInvocation *context, gchar *passphrase)
 {
-    char old_passphrase[MOBILE_AP_WIFI_KEY_MAX_LEN + 1] = {0, };
-    unsigned int old_len = 0;
-    unsigned int passphrase_len = strlen(passphrase);
-    mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
-
-    ret = __get_passphrase(old_passphrase, sizeof(old_passphrase), &old_len);
-    if (ret == MOBILE_AP_ERROR_NONE && old_len == passphrase_len &&
-        !g_strcmp0(old_passphrase, passphrase)) {
-        ret =  MOBILE_AP_ERROR_NONE;
-        tethering_complete_set_wifi_tethering_passphrase(obj, context, ret);
-        return true;
-    }
-
-    ret = __set_passphrase(passphrase, passphrase_len);
+       char old_passphrase[MOBILE_AP_WIFI_KEY_MAX_LEN + 1] = {0, };
+       unsigned int old_len = 0;
+       unsigned int passphrase_len = strlen(passphrase);
+       mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
 
-    tethering_complete_set_wifi_tethering_passphrase(obj, context, ret);
+       ret = __get_passphrase(old_passphrase, sizeof(old_passphrase), &old_len);
+       if (ret == MOBILE_AP_ERROR_NONE && old_len == passphrase_len && !g_strcmp0(old_passphrase, passphrase)) {
+               ret =  MOBILE_AP_ERROR_NONE;
+               tethering_complete_set_wifi_tethering_passphrase(obj, context, ret);
+               return true;
+       }
+       ret = __set_passphrase(passphrase, passphrase_len);
+       tethering_complete_set_wifi_tethering_passphrase(obj, context, ret);
 
-    return true;
+       return true;
 }
 
 gboolean softap_enable(Softap *obj, GDBusMethodInvocation *context,
@@ -1289,7 +1273,7 @@ gboolean softap_enable(Softap *obj, GDBusMethodInvocation *context,
 {
        mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
        gboolean ret_val = FALSE;
-       
+
        DBG("+");
 
        g_assert(obj != NULL);