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>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdint.h>
#include <glib.h>
{
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)
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);
}
if (found) {
- list = g_list_append(list, (gpointer) gpids[j]);
+ list = g_list_append(list, GINT_TO_POINTER(gpids[j]));
}
}
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;
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);
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++;
}
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);
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;
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);
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;
}
}
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <glib.h>
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)
}
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);
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,
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;
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;
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
+#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
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);
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 {
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
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);
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 {
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
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);
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);