From 54d83caf8f92c6a68cf4e7fc067c31a5cc6880f1 Mon Sep 17 00:00:00 2001 From: Li Xiaoming Date: Wed, 20 Nov 2019 11:53:25 +0100 Subject: Fix build warning of typecast Bug-AGL: SPEC-2422 Change-Id: I184490cf84b9423b1194c9b9c309dd8c97a07a76 Signed-off-by: Li Xiaoming --- src/af-steering-wheel-binding.c | 4 ++-- src/steering_wheel_json.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/af-steering-wheel-binding.c b/src/af-steering-wheel-binding.c index 8b75175..5a792af 100644 --- a/src/af-steering-wheel-binding.c +++ b/src/af-steering-wheel-binding.c @@ -318,10 +318,10 @@ static void unsubscribe(afb_req_t req) else { struct json_object *ent; - n = json_object_array_length(val); + n = (int)json_object_array_length(val); for (i = 0; i < n; i++) { - ent = json_object_array_get_idx(val,i); + ent = json_object_array_get_idx(val, (size_t)i); err += unsubscribe_signal(req, json_object_get_string(ent)); } } diff --git a/src/steering_wheel_json.c b/src/steering_wheel_json.c index 4377a72..9c7145b 100644 --- a/src/steering_wheel_json.c +++ b/src/steering_wheel_json.c @@ -76,7 +76,7 @@ static int parse_propertys(json_object *obj_propertys) enum json_type type = json_object_get_type(obj_propertys); if (type == json_type_array) { - int array_len = json_object_array_length(obj_propertys); + int array_len = (int)json_object_array_length(obj_propertys); if(array_len > DEFAULT_PROP_CNT) { wheel_info = realloc(wheel_info, sizeof(struct wheel_info_t) + ((size_t)array_len * sizeof(struct prop_info_t))); @@ -91,7 +91,7 @@ static int parse_propertys(json_object *obj_propertys) for (int i = 0; i < array_len; i++) { - obj_property = json_object_array_get_idx(obj_propertys, i); + obj_property = json_object_array_get_idx(obj_propertys, (size_t)i); err = parse_property(wheel_info, i, obj_property); } @@ -182,11 +182,11 @@ static int parse_gear_para_json(json_object *obj) enum json_type type = json_object_get_type(val); if (type == json_type_array) { - int array_len = json_object_array_length(val); + int array_len = (int)json_object_array_length(val); NOTICEMSG("array_len:%d!", array_len); for (int i = 0; i < array_len; i++) { - obj_speed_para = json_object_array_get_idx(val, i); + obj_speed_para = json_object_array_get_idx(val, (size_t)i); if(obj_speed_para) { json_object_object_foreach(obj_speed_para, key, val) -- cgit 1.2.3-korg