From 1288739a40f2278b700f98cc8708c763e07c6a93 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 16 Dec 2015 08:20:28 +0900 Subject: [PATCH] Fix type casting Change-Id: I7c775163e24cf91bff2e9baef24fdb144554f1e6 Signed-off-by: Hwankyu Jhun --- am_daemon/amd_appinfo.c | 16 ++++++++-------- am_daemon/amd_status.c | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/am_daemon/amd_appinfo.c b/am_daemon/amd_appinfo.c index 0f633a8..293f7d6 100644 --- a/am_daemon/amd_appinfo.c +++ b/am_daemon/amd_appinfo.c @@ -132,7 +132,7 @@ static char *__convert_apptype(const char *type) static int __read_background_category(const char *category_name, void *user_data) { struct appinfo *c = user_data; - int category = (int)(c->val[_AI_BG_CATEGORY]); + int category = (intptr_t)(c->val[_AI_BG_CATEGORY]); if (!category_name) return 0; @@ -143,19 +143,19 @@ static int __read_background_category(const char *category_name, void *user_data } if (strncmp(category_name, "media", strlen("media")) == 0) - c->val[_AI_BG_CATEGORY] = (char *)(category | _BACKGROUND_CATEGORY_MEDIA); + c->val[_AI_BG_CATEGORY] = (char *)((intptr_t)(category | _BACKGROUND_CATEGORY_MEDIA)); else if (strncmp(category_name, "download", strlen("download")) == 0) - c->val[_AI_BG_CATEGORY] = (char *)(category | _BACKGROUND_CATEGORY_DOWNLOAD); + c->val[_AI_BG_CATEGORY] = (char *)((intptr_t)(category | _BACKGROUND_CATEGORY_DOWNLOAD)); else if (strncmp(category_name, "background-network", strlen("background-network")) == 0) - c->val[_AI_BG_CATEGORY] = (char *)(category | _BACKGROUND_CATEGORY_BACKGROUND_NETWORK); + c->val[_AI_BG_CATEGORY] = (char *)((intptr_t)(category | _BACKGROUND_CATEGORY_BACKGROUND_NETWORK)); else if (strncmp(category_name, "location", strlen("location")) == 0) - c->val[_AI_BG_CATEGORY] = (char *)(category | _BACKGROUND_CATEGORY_LOCATION); + c->val[_AI_BG_CATEGORY] = (char *)((intptr_t)(category | _BACKGROUND_CATEGORY_LOCATION)); else if (strncmp(category_name, "sensor", strlen("sensor")) == 0) - c->val[_AI_BG_CATEGORY] = (char *)(category | _BACKGROUND_CATEGORY_SENSOR); + c->val[_AI_BG_CATEGORY] = (char *)((intptr_t)(category | _BACKGROUND_CATEGORY_SENSOR)); else if (strncmp(category_name, "iot-communication", strlen("iot-communication")) == 0) - c->val[_AI_BG_CATEGORY] = (char *)(category | _BACKGROUND_CATEGORY_IOT_COMMUNICATION); + c->val[_AI_BG_CATEGORY] = (char *)((intptr_t)(category | _BACKGROUND_CATEGORY_IOT_COMMUNICATION)); else if (strncmp(category_name, "system", strlen("system")) == 0) - c->val[_AI_BG_CATEGORY] = (char *)(category | _BACKGROUND_CATEGORY_SYSTEM); + c->val[_AI_BG_CATEGORY] = (char *)((intptr_t)(category | _BACKGROUND_CATEGORY_SYSTEM)); return 0; } diff --git a/am_daemon/amd_status.c b/am_daemon/amd_status.c index c7ab024..822aa5f 100644 --- a/am_daemon/amd_status.c +++ b/am_daemon/amd_status.c @@ -401,7 +401,7 @@ void _status_find_service_apps(int pid, uid_t uid, enum app_status status, void svc_info_t = (app_status_info_t *)svc_list->data; if (svc_info_t) { ai = appinfo_find(uid, svc_info_t->appid); - bg_allowed = (int)appinfo_get_value(ai, AIT_BG_CATEGORY); + bg_allowed = (intptr_t)appinfo_get_value(ai, AIT_BG_CATEGORY); if (!bg_allowed) { send_event_to_svc_core(svc_info_t->pid); /* TODO: APIs should be prepared @@ -448,7 +448,7 @@ void _status_check_service_only(int pid, uid_t uid, void (*send_event_to_svc_cor appid = _status_app_get_appid_bypid(pid); if (appid) { ai = appinfo_find(uid, appid); - bg_allowed = (int)appinfo_get_value(ai, AIT_BG_CATEGORY); + bg_allowed = (intptr_t)appinfo_get_value(ai, AIT_BG_CATEGORY); if (!bg_allowed) { send_event_to_svc_core(pid); -- 2.7.4