Fix to follow coding style
authorJiwan Kim <ji-wan.kim@samsung.com>
Tue, 13 Jun 2017 07:28:20 +0000 (16:28 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 17 Jul 2017 02:09:10 +0000 (11:09 +0900)
src/mesh.c
src/mesh_dbus.c
test/main.c
test/mesh_network.c

index bade637..e61014d 100644 (file)
@@ -143,7 +143,7 @@ EXPORT_API int mesh_network_set_meshid(mesh_network_h network, const char *meshi
 
        CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
 
-       if (network == NULL || meshid == NULL ) {
+       if (network == NULL || meshid == NULL) {
                LOGE("Invalid parameter"); //LCOV_EXCL_LINE
                return MESH_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
@@ -175,7 +175,7 @@ EXPORT_API int mesh_network_set_bssid(mesh_network_h network, const char *bssid)
 
        CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
 
-       if (network == NULL || bssid == NULL ) {
+       if (network == NULL || bssid == NULL) {
                LOGE("Invalid parameter"); //LCOV_EXCL_LINE
                return MESH_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
@@ -191,7 +191,7 @@ EXPORT_API int mesh_network_get_channel(mesh_network_h network, int *channel)
 
        CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
 
-       if (network == NULL || channel == NULL ) {
+       if (network == NULL || channel == NULL) {
                LOGE("Invalid parameter"); //LCOV_EXCL_LINE
                return MESH_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
@@ -223,7 +223,7 @@ EXPORT_API int mesh_network_get_rssi(mesh_network_h network, int *rssi)
 
        CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
 
-       if (network == NULL || rssi == NULL ) {
+       if (network == NULL || rssi == NULL) {
                LOGE("Invalid parameter"); //LCOV_EXCL_LINE
                return MESH_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
@@ -255,7 +255,7 @@ EXPORT_API int mesh_network_get_data_rate(mesh_network_h network, int *data_rate
 
        CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
 
-       if (network == NULL || data_rate == NULL ) {
+       if (network == NULL || data_rate == NULL) {
                LOGE("Invalid parameter"); //LCOV_EXCL_LINE
                return MESH_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
@@ -287,7 +287,7 @@ EXPORT_API int mesh_network_get_security(mesh_network_h network, mesh_security_t
 
        CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
 
-       if (network == NULL || security == NULL ) {
+       if (network == NULL || security == NULL) {
                LOGE("Invalid parameter"); //LCOV_EXCL_LINE
                return MESH_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
@@ -397,9 +397,8 @@ EXPORT_API int mesh_initialize(mesh_h *mesh)
        *mesh = handle;
 
        rv = _mesh_dbus_start(*mesh);
-       if (rv != MESH_ERROR_NONE) {
+       if (rv != MESH_ERROR_NONE)
                LOGD("D-Bus init: (0x%X)", rv);
-       }
 
        return MESH_ERROR_NONE;
 }
@@ -493,9 +492,8 @@ EXPORT_API int mesh_foreach_found_mesh_network(mesh_h handle,
        RETV_IF(NULL == handle, MESH_ERROR_INVALID_PARAMETER);
 
        rv = _mesh_get_scan_result(handle);
-       if (MESH_ERROR_NONE != rv) {
+       if (MESH_ERROR_NONE != rv)
                return rv;
-       }
 
        rv = _mesh_foreach_found_mesh_network(handle, cb, user_data);
        return rv;
@@ -511,9 +509,8 @@ EXPORT_API int mesh_foreach_connected_peers(mesh_h handle,
        RETV_IF(NULL == handle, MESH_ERROR_INVALID_PARAMETER);
 
        rv = _mesh_find_peers(handle);
-       if (MESH_ERROR_NONE != rv) {
+       if (MESH_ERROR_NONE != rv)
                return rv;
-       }
 
        rv = _mesh_foreach_connected_peers(handle, cb, user_data);
        return rv;
index 7e3bdd9..8b15f70 100644 (file)
@@ -200,27 +200,22 @@ int _mesh_get_scan_result(mesh_h handle)
                                        const char *buf = g_variant_get_string(val, &len);
                                        memcpy(network_info->meshid, buf, len);
                                        LOGD("  MeshID [%s]", network_info->meshid);
-                               }
-                               else if (strcasecmp(key, "bssid") == 0) {
+                               } else if (strcasecmp(key, "bssid") == 0) {
                                        const char *buf = g_variant_get_string(val, &len);
                                        memcpy(network_info->bssid, buf, len);
                                        LOGD("  BSSID [%s]", network_info->bssid);
-                               }
-                               else if (strcasecmp(key, "rssi") == 0) {
+                               } else if (strcasecmp(key, "rssi") == 0) {
                                        network_info->rssi = g_variant_get_int32(val);
                                        LOGD("  RSSI [%d]", network_info->rssi);
-                               }
-                               else if (strcasecmp(key, "channel") == 0) {
+                               } else if (strcasecmp(key, "channel") == 0) {
                                        network_info->channel = g_variant_get_uint32(val);
                                        LOGD("  Channel [%d]", network_info->channel);
-                               }
-                               else if (strcasecmp(key, "security") == 0) {
+                               } else if (strcasecmp(key, "security") == 0) {
                                        guint sec = g_variant_get_uint32(val);
                                        network_info->security = ((1 == sec) ? MESH_SECURITY_SAE : MESH_SECURITY_NONE);
                                        LOGD("  Security [%s]",
                                                (MESH_SECURITY_SAE == network_info->security) ? "SAE" : "NONE");
-                               }
-                               else if (strcasecmp(key, "state") == 0) {
+                               } else if (strcasecmp(key, "state") == 0) {
                                        network_info->state = g_variant_get_uint32(val);
                                        LOGD("  State [%d]", network_info->state);
                                }
@@ -500,9 +495,9 @@ static void _mesh_free_mpath(gpointer data)
 {
        struct mesh_mpath_dump_s *mpath = data;
 
-       //g_free(mpath->dest_addr);
-       //g_free(mpath->next_hop);
-       //g_free(mpath->iface);
+       /*g_free(mpath->dest_addr);*/
+       /*g_free(mpath->next_hop);*/
+       /*g_free(mpath->iface);*/
 
        g_free(mpath);
        mpath = NULL;
@@ -816,7 +811,7 @@ int _mesh_is_joined(mesh_h handle, int* is_joined)
        RETV_IF(NULL == _gproxy_mesh_service, MESH_ERROR_IO_ERROR);
 
        variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "is_joined",
-                               g_variant_new("(b)", (is_joined==0) ? FALSE : TRUE),
+                               g_variant_new("(b)", (is_joined == 0) ? FALSE : TRUE),
                                G_DBUS_CALL_FLAGS_NONE,
                                -1,
                                NULL, &error);
@@ -1379,9 +1374,8 @@ int _mesh_get_mpath_info(mesh_h handle, mesh_found_mpath_cb cb, void *user_data)
                                        /* Add temporal mesh path buffer */
                                        _mesh_add_mpath((gpointer)mpath);
 
-                                       if (cb) {
+                                       if (cb)
                                                cb(mpath, user_data);
-                                       }
                                }
                        }
                        g_variant_iter_free(iter_row);
index 1a286d5..f6256fc 100644 (file)
@@ -90,31 +90,31 @@ void event_cb(mesh_event_e event_type, mesh_event_data_s* event)
        msg("");
        msgp("Event received [%s]", _mesh_event_to_string(event_type));
 
-       switch(event_type) {
-               case MESH_MESH_ENABLED_EVENT: {
-                       msgp("  Mesh Network Enabled Result = %d", event->data.mesh_enable->result);
-               } break;
-               case MESH_SCAN_DONE_EVENT: {
-                       msgp("  Mesh Scan Done");
-               } break;
-               case MESH_CONNECTION_STATE_EVENT:{
-                       msgp("  Connection state changed [%s]",
-                               _mesh_connection_event_to_string(event->data.connection_state->state));
-                       msgp("  From Mesh ID[%-10s] BSSID[%s] Channel[%d] Security[%4s]",
-                               event->data.connection_state->mesh_id,
-                               event->data.connection_state->bssid,
-                               event->data.connection_state->channel,
-                               (MESH_SECURITY_SAE == event->data.connection_state->security) ? "SAE" : "NONE");
-               } break;
-               case MESH_STATION_JOIN_EVENT: {
-                       msgp("  New Station Joined = %s", event->data.sta_info->bssid);
-               } break;
-               case MESH_STATION_LEFT_EVENT: {
-                       msgp("  A Station Left = %s", event->data.sta_info->bssid);
-               } break;
-               default:
-                       msgr("  Unexpected event !");
-               break;
+       switch (event_type) {
+       case MESH_MESH_ENABLED_EVENT: {
+               msgp("  Mesh Network Enabled Result = %d", event->data.mesh_enable->result);
+       } break;
+       case MESH_SCAN_DONE_EVENT: {
+               msgp("  Mesh Scan Done");
+       } break;
+       case MESH_CONNECTION_STATE_EVENT:{
+               msgp("  Connection state changed [%s]",
+                       _mesh_connection_event_to_string(event->data.connection_state->state));
+               msgp("  From Mesh ID[%-10s] BSSID[%s] Channel[%d] Security[%4s]",
+                       event->data.connection_state->mesh_id,
+                       event->data.connection_state->bssid,
+                       event->data.connection_state->channel,
+                       (MESH_SECURITY_SAE == event->data.connection_state->security) ? "SAE" : "NONE");
+       } break;
+       case MESH_STATION_JOIN_EVENT: {
+               msgp("  New Station Joined = %s", event->data.sta_info->bssid);
+       } break;
+       case MESH_STATION_LEFT_EVENT: {
+               msgp("  A Station Left = %s", event->data.sta_info->bssid);
+       } break;
+       default:
+               msgr("  Unexpected event !");
+       break;
        }
 }
 
index 7d0b403..889d6df 100644 (file)
@@ -159,9 +159,9 @@ static int run_get_found_mesh_network(MManager *mm, struct menu_data *menu)
 
        /* Clear previous found network list */
        g_scan_net_idx = 1;
-       if (g_found_network_list) {
+       if (g_found_network_list)
                g_list_free_full(g_found_network_list, mesh_network_destroy);
-       }
+
        g_found_network_list = NULL;
 
        ret = mesh_foreach_found_mesh_network(mesh, found_mesh_network_cb, NULL);