Remove unuseful code
authorJaehyun Kim <jeik01.kim@samsung.com>
Sun, 3 Feb 2013 09:58:35 +0000 (18:58 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Sun, 3 Feb 2013 09:59:25 +0000 (18:59 +0900)
  - Array compared against 0
  - Unreachable code

Change-Id: Ia6e0054fafbfbc0ae827e0b7058e424d9f574d41

debian/changelog
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/src/wifi-direct-plugin.c
src/wifi-direct-client-handler.c
src/wifi-direct-utils.c

index a766acc..4fe45fb 100644 (file)
@@ -1,3 +1,11 @@
+wfi-direct-manager (0.6.5) precise; urgency=low
+
+  * Remove unuseful code
+  * Git : framework/connectivity/wifi-direct-manager
+  * Tag : wifi-direct-manager_0.6.5
+
+ -- Jaehyun Kim <jeik01@samsung.com>  Sun, 03 Feb 2013 17:29:47 +0900
+
 wfi-direct-manager (0.6.4) precise; urgency=low
 
   * Fix bug of invitation behavior
index 44fcf9d..1a162c2 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wifi-direct-manager
 Summary:    Wi-Fi Direct manger
-Version:    0.6.4
+Version:    0.6.5
 Release:    1
 Group:      TO_BE_FILLED
 License:    Apache License Version 2.0
index d4377d6..7b7ae64 100644 (file)
@@ -192,10 +192,10 @@ int __send_wpa_request(int sockfd, char *cmd, char *reply, size_t reply_buf_len)
                        {
                                WDP_LOGD("POLLIN \n");
                                result = read(sockfd, (char *) reply, reply_buf_len);
-                               
+
                                WDP_LOGD("sockfd %d retval %d\n", sockfd, result);
                                WDP_LOGD("reply[%s]\n", reply);
-                               
+
                                if (result < 0)
                                {
                                        WDP_LOGE( "Error!!! reading data, error [%s]\n", strerror(errno));
@@ -850,8 +850,7 @@ void __parsing_ws_event(char* buf, ws_event_s *event)
        ptr = ptr +3;
        ptr = __get_event_str(ptr, event_str);
 
-       if (NULL != event_str)
-               WDP_LOGD( "event str [%s]\n", event_str);
+       WDP_LOGD( "event str [%s]\n", event_str);
 
        i=0;
        event_id = WS_EVENT_NONE;
@@ -1547,11 +1546,11 @@ static gboolean __ws_event_callback(GIOChannel * source,
                        memcpy(&g_incomming_peer_mac_address, la_mac_addr, 6);
                        memset(g_incomming_peer_ssid, 0, sizeof(g_incomming_peer_ssid));
                        strncpy(g_incomming_peer_ssid, event.peer_ssid, sizeof(g_incomming_peer_ssid));
-                       if (event.wps_pin != NULL) {
-                               WDP_LOGD( "NEW PIN RECEIVED = %s\n", event.wps_pin);
-                               memset(g_wps_pin, 0x00, sizeof(g_wps_pin));
-                               strncpy(g_wps_pin, event.wps_pin, sizeof(g_wps_pin));
-                       }
+
+                       WDP_LOGD( "NEW PIN RECEIVED = %s\n", event.wps_pin);
+                       memset(g_wps_pin, 0x00, sizeof(g_wps_pin));
+                       strncpy(g_wps_pin, event.wps_pin, sizeof(g_wps_pin));
+
                        WDP_LOGD( "Prov Req:  mac[" MACSTR"] ssid=[%s]\n",
                                MAC2STR(g_incomming_peer_mac_address), g_incomming_peer_ssid);
 
@@ -2837,22 +2836,16 @@ int wfd_ws_get_discovery_result(wfd_discovery_entry_s ** peer_list, int* peer_nu
                } wfd_discovery_entry_s;
 */
                // Device MAC address
-               if (NULL != ws_peer_list[i].mac)
-               {
-                       unsigned char la_mac_addr[6];
+               unsigned char la_mac_addr1[6];
 
-                       wfd_macaddr_atoe(ws_peer_list[i].mac, la_mac_addr);
-                       memcpy(wfd_peer_list[i].mac_address, (char*)(la_mac_addr), sizeof(la_mac_addr));
-               }
+               wfd_macaddr_atoe(ws_peer_list[i].mac, la_mac_addr1);
+               memcpy(wfd_peer_list[i].mac_address, (char*)(la_mac_addr1), sizeof(la_mac_addr1));
 
                // Interface MAC address
-               if (NULL != ws_peer_list[i].interface_addr)
-               {
-                       unsigned char la_mac_addr[6];
+               unsigned char la_mac_addr2[6];
 
-                       wfd_macaddr_atoe(ws_peer_list[i].interface_addr, la_mac_addr);
-                       memcpy(wfd_peer_list[i].intf_mac_address, (char*)(la_mac_addr), sizeof(la_mac_addr));
-               }
+               wfd_macaddr_atoe(ws_peer_list[i].interface_addr, la_mac_addr2);
+               memcpy(wfd_peer_list[i].intf_mac_address, (char*)(la_mac_addr2), sizeof(la_mac_addr2));
 
                // WPS Config method
                wfd_peer_list[i].wps_cfg_methods = 0;
@@ -2955,22 +2948,17 @@ int wfd_ws_get_peer_info(unsigned char *mac_addr, wfd_discovery_entry_s **peer)
                        ws_peer_info.pri_dev_type,
                        ws_peer_info.oper_ssid);
 
-       if (NULL != ws_peer_info.mac)
-       {
-               unsigned char la_mac_addr[6];
+       // Device MAC address
+       unsigned char la_mac_addr1[6];
 
-               wfd_macaddr_atoe(ws_peer_info.mac, la_mac_addr);
-               memcpy(wfd_peer_info->mac_address, (char*)(la_mac_addr), sizeof(la_mac_addr));
-       }
+       wfd_macaddr_atoe(ws_peer_info.mac, la_mac_addr1);
+       memcpy(wfd_peer_info->mac_address, (char*)(la_mac_addr1), sizeof(la_mac_addr1));
 
        // Interface MAC address
-       if (NULL != ws_peer_info.interface_addr)
-       {
-               unsigned char la_mac_addr[6];
+       unsigned char la_mac_addr2[6];
 
-               wfd_macaddr_atoe(ws_peer_info.interface_addr, la_mac_addr);
-               memcpy(wfd_peer_info->intf_mac_address, (char*)(la_mac_addr), sizeof(la_mac_addr));
-       }
+       wfd_macaddr_atoe(ws_peer_info.interface_addr, la_mac_addr2);
+       memcpy(wfd_peer_info->intf_mac_address, (char*)(la_mac_addr2), sizeof(la_mac_addr2));
 
        // WPS Config method
        wfd_peer_info->wps_cfg_methods = 0;
index 664b08d..5bc4f93 100644 (file)
@@ -726,14 +726,6 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                {
                        if (NULL == peer)
                        {
-                               if ( NULL == wfd_server->current_peer.intf_mac_address )
-                               {
-                                       WDS_LOGF( "[wfd_server->current_peer.intf_mac_address] is NULL!\n");
-                                       resp.result = WIFI_DIRECT_ERROR_INVALID_PARAMETER;
-                                       wfd_server_send_response(client->sync_sockfd, &resp, sizeof(wifi_direct_client_response_s));
-                                       break;
-                               }
-                               
                                if (wfd_oem_disconnect_sta(wfd_server->current_peer.intf_mac_address))
                                {
                                        wfd_server_remember_connecting_peer(client_req->data.mac_addr);
@@ -1013,10 +1005,8 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                        __WDS_LOG_FUNC_EXIT__;
                        return;
                }
-               if ( NULL != device_name )
-                       WDS_LOGI( "device_name = [%s]\n", device_name);
-               else
-                       WDS_LOGF( "device_name is NULL !!\n");
+
+               WDS_LOGI( "device_name = [%s]\n", device_name);
 
                memset(wfd_server->config_data.device_name, 0, WIFI_DIRECT_MAX_DEVICE_NAME_LEN+1);
                strncpy(wfd_server->config_data.device_name, device_name, WIFI_DIRECT_MAX_DEVICE_NAME_LEN);
@@ -1063,10 +1053,8 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                        __WDS_LOG_FUNC_EXIT__;
                        return;
                }
-               if ( NULL != pin )
-                       WDS_LOGF( "PIN = [%s]\n", pin);
-               else
-                       WDS_LOGF( "PIN is NULL !!\n");
+
+               WDS_LOGF( "PIN = [%s]\n", pin);
 
                ret = wfd_oem_set_wps_pin(pin);
 
@@ -1140,10 +1128,8 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                        __WDS_LOG_FUNC_EXIT__;
                        return;
                }
-               if ( NULL != ssid )
-                       WDS_LOGF( "ssid = [%s]\n", ssid);
-               else
-                       WDS_LOGF( "ssid is NULL !!\n");
+
+               WDS_LOGF( "ssid = [%s]\n", ssid);
 
                ret = wfd_oem_set_ssid(ssid);
 
@@ -1173,10 +1159,8 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                        __WDS_LOG_FUNC_EXIT__;
                        return;
                }
-               if ( NULL != new_wpa )
-                       WDS_LOGF( "new_wpa = [%s]\n", new_wpa);
-               else
-                       WDS_LOGF( "new_wpa is NULL !!\n");
+
+               WDS_LOGF( "new_wpa = [%s]\n", new_wpa);
 
                if (wfd_oem_set_wpa_passphrase(new_wpa) == false)
                        resp.result = WIFI_DIRECT_ERROR_OPERATION_FAILED;
index 6fa8df6..390e759 100644 (file)
@@ -132,7 +132,6 @@ char *wfd_print_state(wifi_direct_state_e s)
        default:
                return "Unknown";
        }
-       return "Unknown";
 }
 
 int wfd_macaddr_atoe(char *p, unsigned char mac[])