use uintptr_t instead of unsigned long #4

Open
opened 2024-03-08 21:25:47 -08:00 by vtorri · 0 comments

patch below

diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index b5b82dd..558b2cb 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -1285,7 +1285,7 @@ _cb_icon_detail_check_changed(void *data, Evas_Object *o,
   int          v;
 
   _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
-  v = (int)(unsigned long)evas_object_data_get(o, "detail");
+  v = (int)(uintptr_t)evas_object_data_get(o, "detail");
   snprintf(detail, sizeof(detail), "detail%i", v);
   cmd_strbuf_append(buf, "detail", detail);
   if (elm_check_state_get(o)) state = "true";
@@ -1303,7 +1303,7 @@ _cb_icon_detail_button_clicked(void *data, Evas_Object *o,
   int          v;
 
   _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
-  v = (int)(unsigned long)evas_object_data_get(o, "detail");
+  v = (int)(uintptr_t)evas_object_data_get(o, "detail");
   snprintf(detail, sizeof(detail), "detail%i", v);
   cmd_strbuf_append(buf, "detail", detail);
   cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
@@ -1318,10 +1318,10 @@ _cb_icon_detail_segment_changed(void *data, Evas_Object *o,
   int              v;
   char             detail[32];
   Elm_Object_Item *it    = info;
-  int              n     = (int)(unsigned long)elm_object_item_data_get(it);
+  int              n     = (int)(uintptr_t)elm_object_item_data_get(it);
 
   _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
-  v = (int)(unsigned long)evas_object_data_get(o, "detail");
+  v = (int)(uintptr_t)evas_object_data_get(o, "detail");
   snprintf(detail, sizeof(detail), "detail%i", v);
   cmd_strbuf_append(buf, "detail", detail);
   snprintf(detail, sizeof(detail), "%i", n);
@@ -1338,10 +1338,10 @@ _cb_icon_detail_popdown_changed(void *data, Evas_Object *o,
   int              v;
   char             detail[32];
   Elm_Object_Item *it    = info;
-  int              n     = (int)(unsigned long)elm_object_item_data_get(it);
+  int              n     = (int)(uintptr_t)elm_object_item_data_get(it);
 
   _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
-  v = (int)(unsigned long)evas_object_data_get(o, "detail");
+  v = (int)(uintptr_t)evas_object_data_get(o, "detail");
   snprintf(detail, sizeof(detail), "detail%i", v);
   cmd_strbuf_append(buf, "detail", detail);
   snprintf(detail, sizeof(detail), "%i", n);
@@ -1360,7 +1360,7 @@ _cb_icon_detail_slider_changed(void *data, Evas_Object *o,
   double       val, val2;
 
   _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
-  v = (int)(unsigned long)evas_object_data_get(o, "detail");
+  v = (int)(uintptr_t)evas_object_data_get(o, "detail");
   snprintf(detail, sizeof(detail), "detail%i", v);
   cmd_strbuf_append(buf, "detail", detail);
   if (elm_slider_range_enabled_get(o))
@@ -1443,7 +1443,7 @@ static void
 _icon_detail_elm_object_prepare(Evas_Object *o, int col)
 {
   elm_object_focus_allow_set(o, EINA_FALSE);
-  evas_object_data_set(o, "detail", (void *)(unsigned long)(col + 1));
+  evas_object_data_set(o, "detail", (void *)(uintptr_t)(col + 1));
   evas_object_propagate_events_set(o, EINA_FALSE);
 }
 
@@ -1699,7 +1699,7 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
             }
           if (*label) it = elm_segment_control_item_add(o, o2, label);
           else it = elm_segment_control_item_add(o, o2, NULL);
-          elm_object_item_data_set(it, (void *)(unsigned long)n);
+          elm_object_item_data_set(it, (void *)(uintptr_t)n);
           if (sel) elm_segment_control_item_selected_set(it, EINA_TRUE);
           if (o2) evas_object_show(o2);
         }
@@ -1772,7 +1772,7 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
                                               NULL, NULL);
           else it = elm_hoversel_item_add(o, label, icpath, ictype,
                                           NULL, NULL);
-          elm_object_item_data_set(it, (void *)(unsigned long)n);
+          elm_object_item_data_set(it, (void *)(uintptr_t)n);
           if (sel) elm_object_text_set(o, label);
         }
       free(*plist);
diff --git a/src/shared/cmd.c b/src/shared/cmd.c
index 1167594..5c2cf11 100644
--- a/src/shared/cmd.c
+++ b/src/shared/cmd.c
@@ -158,12 +158,12 @@ cmd_modify(const Cmd *c, const char *key, const char *val)
             {
               if (val)
                 {
-                  c2->dict[i] = (void *)(unsigned long)
+                  c2->dict[i] = (void *)(uintptr_t)
                     eina_binbuf_length_get(binbuf);
                   eina_binbuf_append_length(binbuf,
                                             (unsigned char *)key,
                                             strlen(key) + 1);
-                  c2->dict[i + 1] = (void *)(unsigned long)
+                  c2->dict[i + 1] = (void *)(uintptr_t)
                     eina_binbuf_length_get(binbuf);
                   eina_binbuf_append_length(binbuf,
                                             (unsigned char *)val,
@@ -172,12 +172,12 @@ cmd_modify(const Cmd *c, const char *key, const char *val)
             }
           else
             {
-              c2->dict[i] =  (void *)(unsigned long)
+              c2->dict[i] =  (void *)(uintptr_t)
                 eina_binbuf_length_get(binbuf);
               eina_binbuf_append_length(binbuf,
                                         (unsigned char *)c->dict[i],
                                         strlen(c->dict[i]) + 1);
-              c2->dict[i + 1] =  (void *)(unsigned long)
+              c2->dict[i + 1] =  (void *)(uintptr_t)
                 eina_binbuf_length_get(binbuf);
               eina_binbuf_append_length(binbuf,
                                         (unsigned char *)c->dict[i + 1],
@@ -188,7 +188,7 @@ cmd_modify(const Cmd *c, const char *key, const char *val)
       if (!c2->buf) goto err;
       c2->buf_size = eina_binbuf_length_get(binbuf);
       eina_binbuf_free(binbuf);
-      for (i = 0; c2->dict[i]; i++) c2->dict[i] = c2->buf + (unsigned long)c2->dict[i];
+      for (i = 0; c2->dict[i]; i++) c2->dict[i] = c2->buf + (uintptr_t)c2->dict[i];
     }
   c2->command = c2->buf;
   return c2;
patch below ```diff diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c index b5b82dd..558b2cb 100644 --- a/src/efm/efm_util.c +++ b/src/efm/efm_util.c @@ -1285,7 +1285,7 @@ _cb_icon_detail_check_changed(void *data, Evas_Object *o, int v; _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon); - v = (int)(unsigned long)evas_object_data_get(o, "detail"); + v = (int)(uintptr_t)evas_object_data_get(o, "detail"); snprintf(detail, sizeof(detail), "detail%i", v); cmd_strbuf_append(buf, "detail", detail); if (elm_check_state_get(o)) state = "true"; @@ -1303,7 +1303,7 @@ _cb_icon_detail_button_clicked(void *data, Evas_Object *o, int v; _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon); - v = (int)(unsigned long)evas_object_data_get(o, "detail"); + v = (int)(uintptr_t)evas_object_data_get(o, "detail"); snprintf(detail, sizeof(detail), "detail%i", v); cmd_strbuf_append(buf, "detail", detail); cmd_strbuf_exe_consume(buf, icon->sd->exe_open); @@ -1318,10 +1318,10 @@ _cb_icon_detail_segment_changed(void *data, Evas_Object *o, int v; char detail[32]; Elm_Object_Item *it = info; - int n = (int)(unsigned long)elm_object_item_data_get(it); + int n = (int)(uintptr_t)elm_object_item_data_get(it); _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon); - v = (int)(unsigned long)evas_object_data_get(o, "detail"); + v = (int)(uintptr_t)evas_object_data_get(o, "detail"); snprintf(detail, sizeof(detail), "detail%i", v); cmd_strbuf_append(buf, "detail", detail); snprintf(detail, sizeof(detail), "%i", n); @@ -1338,10 +1338,10 @@ _cb_icon_detail_popdown_changed(void *data, Evas_Object *o, int v; char detail[32]; Elm_Object_Item *it = info; - int n = (int)(unsigned long)elm_object_item_data_get(it); + int n = (int)(uintptr_t)elm_object_item_data_get(it); _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon); - v = (int)(unsigned long)evas_object_data_get(o, "detail"); + v = (int)(uintptr_t)evas_object_data_get(o, "detail"); snprintf(detail, sizeof(detail), "detail%i", v); cmd_strbuf_append(buf, "detail", detail); snprintf(detail, sizeof(detail), "%i", n); @@ -1360,7 +1360,7 @@ _cb_icon_detail_slider_changed(void *data, Evas_Object *o, double val, val2; _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon); - v = (int)(unsigned long)evas_object_data_get(o, "detail"); + v = (int)(uintptr_t)evas_object_data_get(o, "detail"); snprintf(detail, sizeof(detail), "detail%i", v); cmd_strbuf_append(buf, "detail", detail); if (elm_slider_range_enabled_get(o)) @@ -1443,7 +1443,7 @@ static void _icon_detail_elm_object_prepare(Evas_Object *o, int col) { elm_object_focus_allow_set(o, EINA_FALSE); - evas_object_data_set(o, "detail", (void *)(unsigned long)(col + 1)); + evas_object_data_set(o, "detail", (void *)(uintptr_t)(col + 1)); evas_object_propagate_events_set(o, EINA_FALSE); } @@ -1699,7 +1699,7 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e, } if (*label) it = elm_segment_control_item_add(o, o2, label); else it = elm_segment_control_item_add(o, o2, NULL); - elm_object_item_data_set(it, (void *)(unsigned long)n); + elm_object_item_data_set(it, (void *)(uintptr_t)n); if (sel) elm_segment_control_item_selected_set(it, EINA_TRUE); if (o2) evas_object_show(o2); } @@ -1772,7 +1772,7 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e, NULL, NULL); else it = elm_hoversel_item_add(o, label, icpath, ictype, NULL, NULL); - elm_object_item_data_set(it, (void *)(unsigned long)n); + elm_object_item_data_set(it, (void *)(uintptr_t)n); if (sel) elm_object_text_set(o, label); } free(*plist); diff --git a/src/shared/cmd.c b/src/shared/cmd.c index 1167594..5c2cf11 100644 --- a/src/shared/cmd.c +++ b/src/shared/cmd.c @@ -158,12 +158,12 @@ cmd_modify(const Cmd *c, const char *key, const char *val) { if (val) { - c2->dict[i] = (void *)(unsigned long) + c2->dict[i] = (void *)(uintptr_t) eina_binbuf_length_get(binbuf); eina_binbuf_append_length(binbuf, (unsigned char *)key, strlen(key) + 1); - c2->dict[i + 1] = (void *)(unsigned long) + c2->dict[i + 1] = (void *)(uintptr_t) eina_binbuf_length_get(binbuf); eina_binbuf_append_length(binbuf, (unsigned char *)val, @@ -172,12 +172,12 @@ cmd_modify(const Cmd *c, const char *key, const char *val) } else { - c2->dict[i] = (void *)(unsigned long) + c2->dict[i] = (void *)(uintptr_t) eina_binbuf_length_get(binbuf); eina_binbuf_append_length(binbuf, (unsigned char *)c->dict[i], strlen(c->dict[i]) + 1); - c2->dict[i + 1] = (void *)(unsigned long) + c2->dict[i + 1] = (void *)(uintptr_t) eina_binbuf_length_get(binbuf); eina_binbuf_append_length(binbuf, (unsigned char *)c->dict[i + 1], @@ -188,7 +188,7 @@ cmd_modify(const Cmd *c, const char *key, const char *val) if (!c2->buf) goto err; c2->buf_size = eina_binbuf_length_get(binbuf); eina_binbuf_free(binbuf); - for (i = 0; c2->dict[i]; i++) c2->dict[i] = c2->buf + (unsigned long)c2->dict[i]; + for (i = 0; c2->dict[i]; i++) c2->dict[i] = c2->buf + (uintptr_t)c2->dict[i]; } c2->command = c2->buf; return c2; ```
vtorri changed title from use intptr_t instead of unsigned long to use uintptr_t instead of unsigned long 2024-03-08 22:14:58 -08:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: raster/efm2#4
No description provided.