Fixed: Coding rule issues.
[apps/native/ug-wifi-direct.git] / popup-wifidirect / src / wfd-app-client.c
index af29d58..43bb060 100644 (file)
@@ -125,9 +125,8 @@ Eina_Bool wfd_automatic_deactivated_for_connection_cb(void *user_data)
 
        /* check the timeout, if not timeout, keep the cb */
        interval = time(NULL) - ad->last_wfd_transmit_time;
-       if (interval < NO_ACTION_TIME_OUT) {
+       if (interval < NO_ACTION_TIME_OUT)
                return ECORE_CALLBACK_RENEW;
-       }
 
        /* get transfer state */
        if (vconf_get_int(VCONFKEY_WIFI_DIRECT_TRANSFER_STATE, &wfd_transfer_state) < 0) {
@@ -137,9 +136,8 @@ Eina_Bool wfd_automatic_deactivated_for_connection_cb(void *user_data)
        }
 
        res = wifi_direct_get_state(&ad->wfd_status);
-       if (res != WIFI_DIRECT_ERROR_NONE) {
+       if (res != WIFI_DIRECT_ERROR_NONE)
                return ECORE_CALLBACK_CANCEL;
-       }
 
        if (ad->wfd_status < WIFI_DIRECT_STATE_CONNECTED) {
                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Wi-Fi Direct is unconnected!");
@@ -167,22 +165,20 @@ int wfd_app_client_switch_off(void *data)
 {
        wfd_appdata_t *ad = (wfd_appdata_t *)data;
        int res;
-       if(NULL == ad) {
+       if (NULL == ad) {
                WFD_APP_LOG(WFD_APP_LOG_ERROR, "NULL == ad!\n");
                return -1;
        }
        res = wifi_direct_get_state(&ad->wfd_status);
-       if (res != WIFI_DIRECT_ERROR_NONE) {
+       if (res != WIFI_DIRECT_ERROR_NONE)
                return ECORE_CALLBACK_CANCEL;
-       }
 
        if (ad->wfd_status >= WIFI_DIRECT_STATE_ACTIVATING) {
                /*if connected, disconnect all devices*/
                if (WIFI_DIRECT_STATE_CONNECTED == ad->wfd_status) {
                        res = wifi_direct_disconnect_all();
-                       if (res != WIFI_DIRECT_ERROR_NONE) {
+                       if (res != WIFI_DIRECT_ERROR_NONE)
                                return -1;
-                       }
                }
                res = wifi_direct_deactivate();
                if (res != WIFI_DIRECT_ERROR_NONE) {
@@ -209,9 +205,8 @@ static Eina_Bool _wfd_automatic_deactivated_for_no_connection_cb(void *user_data
        int screen_mirroring_status = 0;
 #endif
 
-       if (NULL == ad) {
+       if (NULL == ad)
                return ECORE_CALLBACK_CANCEL;
-       }
 
        /* check the action, if action is exist, keep the cb */
        res = wifi_direct_get_state(&ad->wfd_status);
@@ -228,9 +223,8 @@ static Eina_Bool _wfd_automatic_deactivated_for_no_connection_cb(void *user_data
 
        /* check the timeout, if not timeout, keep the cb */
        interval = time(NULL) - ad->last_wfd_time;
-       if (interval < MAX_NO_ACTION_TIME_OUT) {
+       if (interval < MAX_NO_ACTION_TIME_OUT)
                return ECORE_CALLBACK_RENEW;
-       }
 
        /* turn off the Wi-Fi Direct */
        wifi_direct_get_state(&ad->wfd_status);
@@ -239,9 +233,7 @@ static Eina_Bool _wfd_automatic_deactivated_for_no_connection_cb(void *user_data
        } else {
 #ifdef WFD_SCREEN_MIRRORING_ENABLED
                if (vconf_get_int(VCONFKEY_SCREEN_MIRRORING_STATE, &screen_mirroring_status) < 0)
-               {
                        WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_SCREEN_MIRRORING_STATE\n");
-               }
 
                if (screen_mirroring_status == VCONFKEY_SCREEN_MIRRORING_ACTIVATED) {
                        ad->last_wfd_time = time(NULL);
@@ -255,9 +247,8 @@ static Eina_Bool _wfd_automatic_deactivated_for_no_connection_cb(void *user_data
        }
 
        /* reset monitor timer */
-       if (ad->monitor_timer) {
+       if (ad->monitor_timer)
                ad->monitor_timer = NULL;       //ECORE_CALLBACK_CANCEL will release timer.
-       }
 
        return ECORE_CALLBACK_CANCEL;
 }
@@ -446,7 +437,7 @@ void _cb_connection(int error_code, wifi_direct_connection_state_e connection_st
                                break;
                        }
                        int res = display_change_state(LCD_NORMAL);
-                       if(res < 0)
+                       if (res < 0)
                                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to change PM state(%d)", res);
                }
        }
@@ -597,14 +588,13 @@ void _cb_connection(int error_code, wifi_direct_connection_state_e connection_st
         */
        /* wifi_direct_get_state(&ad->wfd_status); */
 
-       if (vconf_get_int(VCONFKEY_WIFI_DIRECT_STATE, &wfd_state) < 0) {
+       if (vconf_get_int(VCONFKEY_WIFI_DIRECT_STATE, &wfd_state) < 0)
                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Error reading vconf (%s)\n", VCONFKEY_WIFI_DIRECT_STATE);
-       }
+
        WFD_APP_LOG(WFD_APP_LOG_LOW, "wfd state: %d", wfd_state);
 
-       if (wfd_state == VCONFKEY_WIFI_DIRECT_DEACTIVATED) {
+       if (wfd_state == VCONFKEY_WIFI_DIRECT_DEACTIVATED)
                wfd_app_util_del_notification(ad);
-       }
 
 #ifdef NOT_CONNECTED_INDICATOR_ICON
        if (wfd_state >= VCONFKEY_WIFI_DIRECT_CONNECTED) {
@@ -614,9 +604,8 @@ void _cb_connection(int error_code, wifi_direct_connection_state_e connection_st
                } else {
                        noti_err = notification_free(ad->noti_wifi_direct_on);
                        ad->noti_wifi_direct_on = NULL;
-                       if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       if (noti_err != NOTIFICATION_ERROR_NONE)
                                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Fail to notification_free.(%d)\n", noti_err);
-                       }
                }
        }
 #endif
@@ -731,19 +720,16 @@ int deinit_wfd_client(wfd_appdata_t *ad)
 #endif
 
        ret = wifi_direct_unset_device_state_changed_cb();
-       if (ret != WIFI_DIRECT_ERROR_NONE) {
+       if (ret != WIFI_DIRECT_ERROR_NONE)
                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to deregister _cb_activation(%d)\n", ret);
-       }
 
        ret = wifi_direct_unset_connection_state_changed_cb();
-       if (ret != WIFI_DIRECT_ERROR_NONE) {
+       if (ret != WIFI_DIRECT_ERROR_NONE)
                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to deregister _cb_connection(%d)\n", ret);
-       }
 
        ret = wifi_direct_deinitialize();
-       if (ret != WIFI_DIRECT_ERROR_NONE) {
+       if (ret != WIFI_DIRECT_ERROR_NONE)
                WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to deinitialize Wi-Fi Direct. error code = [%d]\n", ret);
-       }
 
        __WFD_APP_FUNC_EXIT__;
        return 0;