framework/st_things: apply tizenrt coding rule in st_things
authorDaesung <daesung87.an@samsung.com>
Thu, 19 Oct 2017 02:24:31 +0000 (11:24 +0900)
committerDaesung <daesung87.an@samsung.com>
Thu, 19 Oct 2017 04:17:03 +0000 (13:17 +0900)
- apply tizenrt coding rule.

framework/src/st_things/things_stack/src/common/framework/things_data_manager.c

index 6babd00..3daa1c2 100644 (file)
@@ -480,7 +480,7 @@ static int init_things_info_file(cJSON *cjson, char *origin_json_str)
                THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "%s is empty.", g_things_info_file_path);
                is_valid = 0;
        }
-       
+
        if (is_valid == 0) {
                THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Try to reset the info file.");
                if (set_json_string_into_file(g_things_info_file_path, origin_json_str) == 0) {
@@ -658,9 +658,9 @@ easysetup_connectivity_type_e dm_get_easysetup_connectivity_type(void)
 
 wifi_manager_softap_config_s *dm_get_softap_wifi_config(void)
 {
-       st_device_s *device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)(0));
+       st_device_s *device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)(0));
        int ssid_type = (is_artik == true ? 1 : 0);
-       unsigned char mac_id[16] = {0, };
+       unsigned char mac_id[16] = { 0, };
 
        wifi_manager_info_s st_wifi_info;
        wifi_manager_get_info(&st_wifi_info);
@@ -872,10 +872,10 @@ static int parse_things_info_json(const char *filename)
                                        }
                                        if (NULL != manufacturer_url) {
                                                memcpy(node->manufacturer_url, manufacturer_url->valuestring, strlen(manufacturer_url->valuestring) + 1);
-                                       }       
+                                       }
                                        if (NULL != manufacturing_date) {
                                                memcpy(node->manufacturing_date, manufacturing_date->valuestring, strlen(manufacturing_date->valuestring) + 1);
-                                       }                                               
+                                       }
                                        if (NULL != model_number) {
                                                memcpy(node->model_num, model_number->valuestring, strlen(model_number->valuestring) + 1);
                                        }
@@ -927,7 +927,7 @@ static int parse_things_info_json(const char *filename)
                                                                node->collection[iter].rt_cnt = type_cnt;
                                                                for (int typeiter = 0; typeiter < type_cnt; typeiter++) {
                                                                        cJSON *type = cJSON_GetArrayItem(types, typeiter);
-                                                                       node->collection[iter].resource_types[typeiter] = things_malloc(sizeof(char *) *strlen(type->valuestring) + 1);
+                                                                       node->collection[iter].resource_types[typeiter] = things_malloc(sizeof(char *) * strlen(type->valuestring) + 1);
                                                                        memcpy(node->collection[iter].resource_types[typeiter], type->valuestring, strlen(type->valuestring) + 1);
                                                                        THINGS_LOG_D(THINGS_INFO, TAG, "[COLLECTION] collection[iter].resource_types[typeiter] : %s", (node->collection[iter].resource_types[typeiter]));
                                                                }
@@ -941,7 +941,7 @@ static int parse_things_info_json(const char *filename)
                                                                node->collection[iter].if_cnt = if_cnt;
                                                                for (int ifiter = 0; ifiter < if_cnt; ifiter++) {
                                                                        cJSON *interface = cJSON_GetArrayItem(interfaces, ifiter);
-                                                                       node->collection[iter].interface_types[ifiter] = things_malloc(sizeof(char *) *strlen(interface->valuestring) + 1);
+                                                                       node->collection[iter].interface_types[ifiter] = things_malloc(sizeof(char *) * strlen(interface->valuestring) + 1);
                                                                        memcpy(node->collection[iter].interface_types[ifiter], interface->valuestring, strlen(interface->valuestring) + 1);
                                                                }
                                                        } else {
@@ -974,7 +974,7 @@ static int parse_things_info_json(const char *filename)
                                                                                link_resource->rt_cnt = type_cnt;
                                                                                for (int typeiter = 0; typeiter < type_cnt; typeiter++) {
                                                                                        cJSON *type = cJSON_GetArrayItem(types, typeiter);
-                                                                                       link_resource->resource_types[typeiter] = things_malloc(sizeof(char *) *strlen(type->valuestring) + 1);
+                                                                                       link_resource->resource_types[typeiter] = things_malloc(sizeof(char *) * strlen(type->valuestring) + 1);
                                                                                        memcpy(link_resource->resource_types[typeiter], type->valuestring, strlen(type->valuestring) + 1);
                                                                                }
                                                                        } else {
@@ -986,7 +986,7 @@ static int parse_things_info_json(const char *filename)
                                                                                link_resource->if_cnt = if_cnt;
                                                                                for (int ifiter = 0; ifiter < if_cnt; ifiter++) {
                                                                                        cJSON *interface = cJSON_GetArrayItem(interfaces, ifiter);
-                                                                                       link_resource->interface_types[ifiter] = things_malloc(sizeof(char *) *strlen(interface->valuestring) + 1);
+                                                                                       link_resource->interface_types[ifiter] = things_malloc(sizeof(char *) * strlen(interface->valuestring) + 1);
                                                                                        memcpy(link_resource->interface_types[ifiter], interface->valuestring, strlen(interface->valuestring) + 1);
                                                                                }
                                                                        } else {
@@ -1041,7 +1041,7 @@ static int parse_things_info_json(const char *filename)
                                                                node->single[iter].rt_cnt = type_cnt;
                                                                for (int typeiter = 0; typeiter < type_cnt; typeiter++) {
                                                                        cJSON *type = cJSON_GetArrayItem(types, typeiter);
-                                                                       node->single[iter].resource_types[typeiter] = things_malloc(sizeof(char *) *strlen(type->valuestring) + 1);
+                                                                       node->single[iter].resource_types[typeiter] = things_malloc(sizeof(char *) * strlen(type->valuestring) + 1);
                                                                        memcpy(node->single[iter].resource_types[typeiter], type->valuestring, strlen(type->valuestring) + 1);
                                                                }
                                                        } else {
@@ -1053,7 +1053,7 @@ static int parse_things_info_json(const char *filename)
                                                                node->single[iter].if_cnt = if_cnt;
                                                                for (int ifiter = 0; ifiter < if_cnt; ifiter++) {
                                                                        cJSON *interface = cJSON_GetArrayItem(interfaces, ifiter);
-                                                                       node->single[iter].interface_types[ifiter] = things_malloc(sizeof(char *) *strlen(interface->valuestring) + 1);
+                                                                       node->single[iter].interface_types[ifiter] = things_malloc(sizeof(char *) * strlen(interface->valuestring) + 1);
                                                                        memcpy(node->single[iter].interface_types[ifiter], interface->valuestring, strlen(interface->valuestring) + 1);
                                                                }
                                                        } else {
@@ -1190,10 +1190,10 @@ static int parse_things_info_json(const char *filename)
 
                                                                THINGS_LOG_D(THINGS_INFO, TAG, "[configuration] manufature_id : %s / setup_id : %s / artik : %d", manufature_id->valuestring, setup_id->valuestring, is_artik);
 
-                                                               g_manufacturer_name = things_malloc(sizeof(char *) *strlen(manufature_id->valuestring) + 1);
+                                                               g_manufacturer_name = things_malloc(sizeof(char *) * strlen(manufature_id->valuestring) + 1);
                                                                strncpy(g_manufacturer_name, manufature_id->valuestring, strlen(manufature_id->valuestring) + 1);
 
-                                                               g_setup_id = things_malloc(sizeof(char *) *strlen(setup_id->valuestring) + 1);
+                                                               g_setup_id = things_malloc(sizeof(char *) * strlen(setup_id->valuestring) + 1);
                                                                strncpy(g_setup_id, setup_id->valuestring, strlen(setup_id->valuestring) + 1);
                                                        } else {
                                                                return 0;
@@ -1531,7 +1531,7 @@ const char *dm_get_things_device_type(int device_id)
        //THINGS_LOG_D(THINGS_DEBUG, TAG, THINGS_FUNC_ENTRY);
        st_device_s *device = NULL;
 
-       device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)device_id);
+       device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)device_id);
        if (device == NULL) {
 
                THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Device Not Exist");
@@ -1691,7 +1691,7 @@ long dm_get_num_of_dev_cnt(void)
 
 st_device_s *dm_get_info_of_dev(unsigned long number)
 {
-       return (st_device_s *) hashmap_get(g_device_hmap, number);
+       return (st_device_s *)hashmap_get(g_device_hmap, number);
 }
 
 static void dm_delete_user_define_device_id(void)
@@ -1715,13 +1715,13 @@ bool dm_register_device_id(void)
                return false;
        }
 
-       if ((dev_list = (st_device_s **) things_malloc(sizeof(st_device_s *) *device_cnt)) == NULL) {
+       if ((dev_list = (st_device_s **)things_malloc(sizeof(st_device_s *) * device_cnt)) == NULL) {
                THINGS_LOG_ERROR(THINGS_ERROR, TAG, "st_device_s mem allocation is failed.");
                return false;
        }
        // Set Main-Device ID
        id = OCGetServerInstanceIDString();
-       dev_list[0] = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)0);
+       dev_list[0] = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)0);
 
        if (id == NULL || dev_list[0] == NULL) {
                THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Error : id = %s, Main-device =0x%X", id, dev_list[0]);
@@ -1731,7 +1731,7 @@ bool dm_register_device_id(void)
 
        // Set Sub-Device ID
        for (i = 1; i < device_cnt; i++) {
-               dev_list[i] = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)i);
+               dev_list[i] = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)i);
                if (dev_list[i] == NULL) {
                        THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Error : device[%d] =0x%X", i, dev_list[i]);
                        goto GOTO_ERROR;
@@ -1808,7 +1808,7 @@ int dm_register_resource(things_server_builder_s *p_builder)
                // 2. Device Capability Resources Registration
                THINGS_LOG_D(THINGS_DEBUG, TAG, "BEFORE SEARCHING THE DEVICE  ITEM FROM HASH TABLE");
 
-               device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)device_num);
+               device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)device_num);
 
                if (NULL != device) {
                        snprintf(id, sizeof(id), "%d", device->no);
@@ -1903,7 +1903,7 @@ struct things_resource_s *dm_get_resource_instance(const char *uri, const int id
 
        int device_cnt = (int)hashmap_count(g_device_hmap);
        if (device_cnt > 0 && device_cnt > id) {
-               st_device_s *device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)(id));
+               st_device_s *device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)(id));
 
                if (device) {
                        for (int index = 0; index < MAX_DEVICE_CAPABILTY_CNT; index++) {
@@ -1934,13 +1934,13 @@ int dm_get_device_information(int *cnt, st_device_s ***list)
        int device_cnt = (int)hashmap_count(g_device_hmap);
        if (device_cnt > 0) {
                st_device_s **devices = NULL;
-               if ((devices = (st_device_s **) things_malloc(sizeof(st_device_s *) *device_cnt)) == NULL) {
+               if ((devices = (st_device_s **)things_malloc(sizeof(st_device_s *) * device_cnt)) == NULL) {
                        THINGS_LOG_ERROR(THINGS_ERROR, TAG, "st_device_s memory allocation is failed.");
                        return ret;
                }
 
                for (int index = 0; index < device_cnt; index++) {
-                       devices[index] = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)index);
+                       devices[index] = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)index);
                }
 
                (*list) = devices;
@@ -2029,7 +2029,7 @@ int dm_validate_attribute_in_request(char *rt, const void *payload)
        if (rt != NULL && payload != NULL) {
                // 1. Get index with resource type
                unsigned long index = hashmap_get_hashval((unsigned char *)rt);
-               OCRepPayload *r_payload = (OCRepPayload *) payload;
+               OCRepPayload *r_payload = (OCRepPayload *)payload;
 
                // 2. Get resource type instance
                THINGS_LOG_D(THINGS_INFO, TAG, "Index : %u  rt : %s", index, rt);
@@ -2097,7 +2097,7 @@ int things_get_resource_type(const char *resource_uri, int *count, char ***resou
        THINGS_LOG_D(THINGS_DEBUG, TAG, "things_get_resource_type : %s", resource_uri);
        int device_cnt = (int)hashmap_count(g_device_hmap);
        if (device_cnt > 0) {
-               st_device_s *device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)0);
+               st_device_s *device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)0);
 
                if (device != NULL) {
                        if (device->sig_cnt > 0) {
@@ -2178,7 +2178,7 @@ bool things_is_collection_resource(const char *res_uri)
        if (device_cnt > 0) {
                st_device_s *device = NULL;
 
-               device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)0);
+               device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)0);
                if (device == NULL) {
                        THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Device Not Exist");
                        return NULL;
@@ -2199,7 +2199,7 @@ int things_get_child_resources(const char *col_res_uri, int *count, things_resou
 {
        st_device_s *device = NULL;
 
-       device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)0);
+       device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)0);
        if (device == NULL) {
                THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Device Not Exist");
                return NULL;