Fix different size warnings 21/48321/2
authorSangyoon Jang <s89.jang@samsung.com>
Fri, 18 Sep 2015 05:38:32 +0000 (14:38 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Fri, 18 Sep 2015 08:21:27 +0000 (17:21 +0900)
in 64bit environment, "int"(4byte) and "void *"(8byte) have different size.
so we pass "int" type variable to "intptr_t".
intptr_t size depends on architecture.

Change-Id: I5eceda7fb80e2c0196cf1ebd6c271c9c9fa52aa3
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
am_daemon/amd_app_group.c
am_daemon/amd_appinfo.c
am_session_agent/sigchild.h
app_launcher.c
test/launch_app.c
test/open_app.c

index 5ad4211..1b66a38 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 
 #include <glib.h>
 
@@ -28,7 +29,7 @@ static gint __comp_pid(gconstpointer a, gconstpointer b)
 {
        app_group_context_t *ac1 = (app_group_context_t*) a;
 
-       return ac1->pid - (int)b;
+       return ac1->pid - GPOINTER_TO_INT(b);
 }
 
 static void __list_destroy_cb(gpointer data)
@@ -39,7 +40,7 @@ static void __list_destroy_cb(gpointer data)
 static gboolean __hash_table_cb(gpointer key, gpointer value,
                gpointer user_data)
 {
-       int pid = (int) user_data;
+       int pid = GPOINTER_TO_INT(user_data);
        GList *list = (GList*) value;
        GList *itr = g_list_first(list);
 
@@ -113,7 +114,7 @@ static GList* __find_removable_apps(int from)
                        }
 
                        if (found) {
-                               list = g_list_append(list, (gpointer) gpids[j]);
+                               list = g_list_append(list, GINT_TO_POINTER(gpids[j]));
                        }
                }
 
@@ -151,7 +152,7 @@ void app_group_add(int leader_pid, int pid, int wid)
        GList *list = (GList*) g_hash_table_lookup(app_group_hash,
                        GINT_TO_POINTER(leader_pid));
        if (list != NULL) {
-               if (g_list_find_custom(list, (gconstpointer)pid, __comp_pid) != NULL) {
+               if (g_list_find_custom(list, (gconstpointer)(intptr_t)pid, __comp_pid) != NULL) {
                        _E("pid exist");
                        free(ac);
                        return;
@@ -199,7 +200,7 @@ void app_group_clear_top(int pid)
                        GList *itr = g_list_last(list);
 
                        while (itr != NULL) {
-                               int p = (int)(itr->data);
+                               int p = GPOINTER_TO_INT((itr->data));
 
                                aul_app_group_detach_window(p);
                                _term_sub_app(p);
@@ -279,7 +280,7 @@ void app_group_get_leader_pids(int *cnt, int **pids)
                g_hash_table_iter_init(&iter, app_group_hash);
                int i = 0;
                while (g_hash_table_iter_next(&iter, &key, &value)) {
-                       leader_pids[i] = (int) key;
+                       leader_pids[i] = GPOINTER_TO_INT(key);
                        i++;
                }
 
@@ -319,7 +320,7 @@ void app_group_get_group_pids(int leader_pid, int *cnt, int **pids)
 
        g_hash_table_iter_init(&iter, app_group_hash);
        while (g_hash_table_iter_next(&iter, &key, &value)) {
-               if ((int) key == leader_pid) {
+               if (GPOINTER_TO_INT(key) == leader_pid) {
                        GList *list = (GList*) value;
                        GList *i = g_list_first(list);
                        int size = g_list_length(list);
@@ -368,7 +369,7 @@ gboolean app_group_is_sub_app(int pid)
                GList *found = NULL;
 
                if (list != NULL) {
-                       if ((found = g_list_find_custom(list, (gconstpointer)pid, __comp_pid)) != NULL) {
+                       if ((found = g_list_find_custom(list, (gconstpointer)(intptr_t)pid, __comp_pid)) != NULL) {
                                if (g_list_first(list) == found)
                                        return FALSE;
                                return TRUE;
@@ -392,7 +393,7 @@ void app_group_reroute(int pid)
                GList *after = NULL;
 
                if (list != NULL) {
-                       if ((found = g_list_find_custom(list, (gconstpointer)pid, __comp_pid)) != NULL) {
+                       if ((found = g_list_find_custom(list, (gconstpointer)(intptr_t)pid, __comp_pid)) != NULL) {
                                before = g_list_previous(found);
                                after = g_list_next(found);
 
@@ -424,8 +425,8 @@ repeat:
                GList *list = (GList*) value;
 
                if (list != NULL) {
-                       if (g_list_find_custom(list, (gconstpointer)pid, __comp_pid) != NULL) {
-                               lpid = (int)key;
+                       if (g_list_find_custom(list, (gconstpointer)(intptr_t)pid, __comp_pid) != NULL) {
+                               lpid = GPOINTER_TO_INT(key);
                                break;
                        }
                }
index c57b5e7..e98254e 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include <errno.h>
 #include <glib.h>
@@ -265,7 +266,7 @@ static void _remove_user_appinfo(uid_t uid)
 static void __handle_onboot(void *user_data, const char *appid,
                struct appinfo *info)
 {
-       uid_t uid = (uid_t)user_data;
+       uid_t uid = (uid_t)(intptr_t)user_data;
 
        if (!strcmp(info->val[_AI_ONBOOT], "true")) {
                if (_status_app_is_running(appid, uid) > 0)
@@ -304,8 +305,9 @@ static struct user_appinfo *_add_user_appinfo(uid_t uid)
        }
 
        if (uid != GLOBAL_USER) {
-               appinfo_foreach(uid, __handle_onboot, (void *)uid);
-               appinfo_foreach(GLOBAL_USER, __handle_onboot, (void *)uid);
+               appinfo_foreach(uid, __handle_onboot, (void *)(intptr_t)uid);
+               appinfo_foreach(GLOBAL_USER, __handle_onboot,
+                               (void *)(intptr_t)uid);
        }
 
        _D("loaded appinfo table for uid %d", uid);
@@ -374,7 +376,7 @@ static void _appinfo_delete_on_event(uid_t uid, const char *pkgid)
 static void _appinfo_insert_on_event(uid_t uid, const char *pkgid)
 {
        appinfo_insert(uid, pkgid);
-       appinfo_foreach(uid, __handle_onboot, (void *)uid);
+       appinfo_foreach(uid, __handle_onboot, (void *)(intptr_t)uid);
 }
 
 static int __package_event_cb(uid_t target_uid, int req_id,
index 654d138..e3add6c 100644 (file)
@@ -151,7 +151,7 @@ static int __sigchild_action(void *data)
        pid_t dead_pid;
        char buf[MAX_LOCAL_BUFSZ];
 
-       dead_pid = (pid_t) data;
+       dead_pid = (pid_t)(intptr_t)data;
        if (dead_pid <= 0)
                goto end;
 
@@ -186,7 +186,7 @@ static void __agent_sig_child(int sigchld_fd)
        while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) {
                if (child_pid == child_pgid)
                        killpg(child_pgid, SIGKILL);
-               __sigchild_action((void *)child_pid);
+               __sigchild_action((void *)(intptr_t)child_pid);
        }
 
        return;
index 781f367..2d331d2 100644 (file)
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <getopt.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <string.h>
@@ -66,7 +67,7 @@ static bundle *_create_internal_bundle(struct launch_arg *args)
 
 static int __launch_app_dead_handler(int pid, void *data)
 {
-       int listen_pid = (int)data;
+       int listen_pid = (intptr_t)data;
 
        if (listen_pid == pid)
                g_main_loop_quit(mainloop);
@@ -92,7 +93,7 @@ static gboolean run_func(void *data)
                printf("... successfully launched pid = %d with debug %d\n",
                                pid, launch_arg_data->flag_debug);
                if (launch_arg_data->sync) {
-                       aul_listen_app_dead_signal(__launch_app_dead_handler, (void *)pid);
+                       aul_listen_app_dead_signal(__launch_app_dead_handler, (void *)(intptr_t)pid);
                        return FALSE;
                }
        } else {
index 344e39f..2e083f9 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <string.h>
@@ -90,7 +91,7 @@ void print_usage(char *progname)
 
 static int __launch_app_dead_handler(int pid, void *data)
 {
-       int listen_pid = (intdata;
+       int listen_pid = (intptr_t)data;
 
        if(listen_pid == pid)
                g_main_loop_quit(mainloop);
@@ -108,7 +109,7 @@ static gboolean run_func(void *data)
                str = bundle_get_val(kb, "__LAUNCH_APP_MODE__");
 
                if (str && strcmp(str, "SYNC") == 0 )
-                       aul_listen_app_dead_signal(__launch_app_dead_handler, (void *)pid);
+                       aul_listen_app_dead_signal(__launch_app_dead_handler, (void *)(intptr_t)pid);
                else
                        g_main_loop_quit(mainloop);
        } else {
index 6ed774d..c5c3111 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <string.h>
@@ -72,7 +73,7 @@ void print_usage(char *progname)
 
 static int __launch_app_dead_handler(int pid, void *data)
 {
-       int listen_pid = (intdata;
+       int listen_pid = (intptr_t)data;
 
        if(listen_pid == pid)
                g_main_loop_quit(mainloop);
@@ -94,7 +95,7 @@ static gboolean run_func(void *data)
                str = bundle_get_val(kb, "__LAUNCH_APP_MODE__");
 
                if (str && strcmp(str, "SYNC") == 0 )
-                       aul_listen_app_dead_signal(__launch_app_dead_handler, (void *)pid);
+                       aul_listen_app_dead_signal(__launch_app_dead_handler, (void *)(intptr_t)pid);
                else
                        g_main_loop_quit(mainloop);