From 92d6a69153172c41ceb9a78bb817836986b22b24 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 23 Jun 2015 15:09:07 -0700 Subject: [PATCH] xprops: Fix more gulong / 64-bit fallout from the xcb port --- src/core/screen.c | 4 ++-- src/x11/window-props.c | 8 ++++---- src/x11/window-x11.c | 6 +++--- src/x11/xprops.c | 26 ++++++-------------------- src/x11/xprops.h | 10 +++++----- 5 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/core/screen.c b/src/core/screen.c index 46d818f3b..6ef5dd01e 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1166,7 +1166,7 @@ update_num_workspaces (MetaScreen *screen, if (meta_prefs_get_dynamic_workspaces ()) { int n_items; - gulong *list; + uint32_t *list; n_items = 0; list = NULL; @@ -1755,7 +1755,7 @@ meta_screen_get_monitor_geometry (MetaScreen *screen, void meta_screen_update_workspace_layout (MetaScreen *screen) { - gulong *list; + uint32_t *list; int n_items; if (screen->workspace_layout_overridden) diff --git a/src/x11/window-props.c b/src/x11/window-props.c index 8836a1dd1..2bf83ef0a 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -428,10 +428,10 @@ reload_net_wm_pid (MetaWindow *window, { if (value->type != META_PROP_VALUE_INVALID) { - gulong cardinal = (int) value->v.cardinal; + uint32_t cardinal = (int) value->v.cardinal; if (cardinal <= 0) - meta_warning ("Application set a bogus _NET_WM_PID %lu\n", + meta_warning ("Application set a bogus _NET_WM_PID %u\n", cardinal); else { @@ -449,7 +449,7 @@ reload_net_wm_user_time (MetaWindow *window, { if (value->type != META_PROP_VALUE_INVALID) { - gulong cardinal = value->v.cardinal; + uint32_t cardinal = value->v.cardinal; meta_window_set_user_time (window, cardinal); } } @@ -670,7 +670,7 @@ reload_opaque_region (MetaWindow *window, if (value->type != META_PROP_VALUE_INVALID) { - gulong *region = value->v.cardinal_list.cardinals; + uint32_t *region = value->v.cardinal_list.cardinals; int nitems = value->v.cardinal_list.n_cardinals; cairo_rectangle_int_t *rects; diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index f37be2620..b69fb793f 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -1283,7 +1283,7 @@ meta_window_x11_update_struts (MetaWindow *window) GSList *old_struts; GSList *new_struts; GSList *old_iter, *new_iter; - gulong *struts = NULL; + uint32_t *struts = NULL; int nitems; gboolean changed; @@ -1346,7 +1346,7 @@ meta_window_x11_update_struts (MetaWindow *window) new_struts = g_slist_prepend (new_struts, temp); } - meta_verbose ("_NET_WM_STRUT_PARTIAL struts %lu %lu %lu %lu for " + meta_verbose ("_NET_WM_STRUT_PARTIAL struts %u %u %u %u for " "window %s\n", struts[0], struts[1], struts[2], struts[3], window->desc); @@ -1405,7 +1405,7 @@ meta_window_x11_update_struts (MetaWindow *window) new_struts = g_slist_prepend (new_struts, temp); } - meta_verbose ("_NET_WM_STRUT struts %lu %lu %lu %lu for window %s\n", + meta_verbose ("_NET_WM_STRUT struts %u %u %u %u for window %s\n", struts[0], struts[1], struts[2], struts[3], window->desc); } diff --git a/src/x11/xprops.c b/src/x11/xprops.c index f50709a3b..56b607bde 100644 --- a/src/x11/xprops.c +++ b/src/x11/xprops.c @@ -275,26 +275,16 @@ meta_prop_get_atom_list (MetaDisplay *display, static gboolean cardinal_list_from_results (GetPropertyResults *results, - gulong **cardinals_p, + uint32_t **cardinals_p, int *n_cardinals_p) { if (!validate_or_free_results (results, 32, XA_CARDINAL, FALSE)) return FALSE; - *cardinals_p = (gulong*) results->prop; + *cardinals_p = (uint32_t *) results->prop; *n_cardinals_p = results->n_items; results->prop = NULL; -#if GLIB_SIZEOF_LONG == 8 - /* Xlib sign-extends format=32 items, but we want them unsigned */ - { - int i; - - for (i = 0; i < *n_cardinals_p; i++) - (*cardinals_p)[i] = (*cardinals_p)[i] & 0xffffffff; - } -#endif - return TRUE; } @@ -302,7 +292,7 @@ gboolean meta_prop_get_cardinal_list (MetaDisplay *display, Window xwindow, Atom xatom, - gulong **cardinals_p, + uint32_t **cardinals_p, int *n_cardinals_p) { GetPropertyResults results; @@ -677,7 +667,7 @@ counter_from_results (GetPropertyResults *results, static gboolean counter_list_from_results (GetPropertyResults *results, - XSyncCounter **counters_p, + uint32_t **counters_p, int *n_counters_p) { if (!validate_or_free_results (results, 32, @@ -685,7 +675,7 @@ counter_list_from_results (GetPropertyResults *results, FALSE)) return FALSE; - *counters_p = (XSyncCounter*) results->prop; + *counters_p = (uint32_t *) results->prop; *n_counters_p = results->n_items; results->prop = NULL; @@ -727,11 +717,7 @@ cardinal_with_atom_type_from_results (GetPropertyResults *results, if (!validate_or_free_results (results, 32, prop_type, TRUE)) return FALSE; - *cardinal_p = *(gulong*) results->prop; -#if GLIB_SIZEOF_LONG == 8 - /* Xlib sign-extends format=32 items, but we want them unsigned */ - *cardinal_p &= 0xffffffff; -#endif + *cardinal_p = *((uint32_t *) results->prop); g_free (results->prop); results->prop = NULL; diff --git a/src/x11/xprops.h b/src/x11/xprops.h index 0e8e28729..d30af7c74 100644 --- a/src/x11/xprops.h +++ b/src/x11/xprops.h @@ -83,7 +83,7 @@ gboolean meta_prop_get_motif_hints (MetaDisplay *display, gboolean meta_prop_get_cardinal_list (MetaDisplay *display, Window xwindow, Atom xatom, - gulong **cardinals_p, + uint32_t **cardinals_p, int *n_cardinals_p); gboolean meta_prop_get_latin1_string (MetaDisplay *display, Window xwindow, @@ -180,8 +180,8 @@ typedef struct XSyncCounter xcounter; struct { - gulong *counters; - int n_counters; + uint32_t *counters; + int n_counters; } xcounter_list; struct @@ -192,8 +192,8 @@ typedef struct struct { - gulong *cardinals; - int n_cardinals; + uint32_t *cardinals; + int n_cardinals; } cardinal_list; struct