From 085de22d4285237297e9f0f386322cd99578860d Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 1 Aug 2019 06:44:00 +0000 Subject: [PATCH] examples: cast to uintptr_t instead of long on Windows, long is a 32 bits type Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9470 --- src/examples/elementary/genlist_example_01.c | 6 +++--- src/examples/elementary/genlist_example_02.c | 6 +++--- src/examples/elementary/genlist_example_03.c | 6 +++--- src/examples/elementary/genlist_example_04.c | 16 ++++++++-------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/examples/elementary/genlist_example_01.c b/src/examples/elementary/genlist_example_01.c index b8afb22134..7ab3ad5f15 100644 --- a/src/examples/elementary/genlist_example_01.c +++ b/src/examples/elementary/genlist_example_01.c @@ -11,7 +11,7 @@ static char * _item_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) { char buf[256]; - snprintf(buf, sizeof(buf), "Item # %i", (int)(long)data); + snprintf(buf, sizeof(buf), "Item # %i", (int)(uintptr_t)data); return strdup(buf); } @@ -39,7 +39,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) { Evas_Object *win; Evas_Object *list; - int i; + unsigned int i; win = elm_win_util_standard_add("genlist", "Genlist"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); @@ -60,7 +60,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) for (i = 0; i < N_ITEMS; i++) { elm_genlist_item_append(list, _itc, - (void *)(long)i, NULL, + (void *)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); } diff --git a/src/examples/elementary/genlist_example_02.c b/src/examples/elementary/genlist_example_02.c index bce62ccf20..77c81ac8f7 100644 --- a/src/examples/elementary/genlist_example_02.c +++ b/src/examples/elementary/genlist_example_02.c @@ -13,7 +13,7 @@ _item_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_ { time_t t = (time_t)ecore_time_unix_get(); char buf[256]; - int i = (int)(long)data; + int i = (int)(uintptr_t)data; if (i % 2) { int n; @@ -90,7 +90,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) { Evas_Object *win, *box, *hbox; Evas_Object *list, *btn; - int i; + unsigned int i; win = elm_win_util_standard_add("genlist", "Genlist - simple"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); @@ -151,7 +151,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) for (i = 0; i < N_ITEMS; i++) { elm_genlist_item_append(list, _itc, - (void *)(long)i, NULL, + (void *)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); } diff --git a/src/examples/elementary/genlist_example_03.c b/src/examples/elementary/genlist_example_03.c index 2517962c91..ec233602db 100644 --- a/src/examples/elementary/genlist_example_03.c +++ b/src/examples/elementary/genlist_example_03.c @@ -12,7 +12,7 @@ _item_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part) { time_t t = (time_t)ecore_time_unix_get(); char buf[256]; - int i = (int)(long)data; + int i = (int)(uintptr_t)data; if (!strcmp(part, "elm.text")) snprintf(buf, sizeof(buf), "Item # %i", i); @@ -60,12 +60,12 @@ _genlist_add(Evas_Object *box) static void _genlist_fill(Evas_Object *list) { - int i; + unsigned int i; for (i = 0; i < N_ITEMS; i++) { elm_genlist_item_append(list, _itc, - (void *)(long)i, NULL, + (void *)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); } diff --git a/src/examples/elementary/genlist_example_04.c b/src/examples/elementary/genlist_example_04.c index abb15dd65d..48a722b1a9 100644 --- a/src/examples/elementary/genlist_example_04.c +++ b/src/examples/elementary/genlist_example_04.c @@ -14,7 +14,7 @@ _item_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part) { time_t t = (time_t)ecore_time_unix_get(); char buf[256]; - int i = (int)(long)data; + int i = (int)(uintptr_t)data; if (!strcmp(part, "elm.text")) snprintf(buf, sizeof(buf), "Item # %i", i); @@ -52,7 +52,7 @@ static char * _group_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) { char buf[256]; - int i = (int)(long)data; + int i = (int)(uintptr_t)data; snprintf(buf, sizeof(buf), "Group %d (item #%d)", i / 7, i); @@ -77,7 +77,7 @@ _append_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED) Evas_Object *list = data; elm_genlist_item_append(list, _itc, - (void *)(long)nitems++, NULL, + (void *)(uintptr_t)nitems++, NULL, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); @@ -89,7 +89,7 @@ _prepend_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED Evas_Object *list = data; elm_genlist_item_prepend(list, _itc, - (void *)(long)nitems++, NULL, + (void *)(uintptr_t)nitems++, NULL, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); @@ -104,7 +104,7 @@ _insert_before_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_ if (!glit) return; elm_genlist_item_insert_before(list, _itc, - (void *)(long)nitems++, NULL, + (void *)(uintptr_t)nitems++, NULL, glit, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); @@ -119,7 +119,7 @@ _insert_after_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_U if (!glit) return; elm_genlist_item_insert_after(list, _itc, - (void *)(long)nitems++, NULL, + (void *)(uintptr_t)nitems++, NULL, glit, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); @@ -305,7 +305,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) if (i % 7 == 0) { glg = gli = elm_genlist_item_append(list, _itc_group, - (void *)(long)nitems++, NULL, + (void *)(uintptr_t)nitems++, NULL, ELM_GENLIST_ITEM_GROUP, _item_sel_cb, NULL); elm_genlist_item_select_mode_set(gli, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); @@ -313,7 +313,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) else { gli = elm_genlist_item_append(list, _itc, - (void *)(long)nitems++, glg, + (void *)(uintptr_t)nitems++, glg, ELM_GENLIST_ITEM_NONE, _item_sel_cb, NULL); }