xprops: Fix more gulong / 64-bit fallout from the xcb port

This commit is contained in:
Jasper St. Pierre 2015-06-23 15:09:07 -07:00
parent 734402e14d
commit 92d6a69153
5 changed files with 20 additions and 34 deletions

View File

@ -1166,7 +1166,7 @@ update_num_workspaces (MetaScreen *screen,
if (meta_prefs_get_dynamic_workspaces ()) if (meta_prefs_get_dynamic_workspaces ())
{ {
int n_items; int n_items;
gulong *list; uint32_t *list;
n_items = 0; n_items = 0;
list = NULL; list = NULL;
@ -1755,7 +1755,7 @@ meta_screen_get_monitor_geometry (MetaScreen *screen,
void void
meta_screen_update_workspace_layout (MetaScreen *screen) meta_screen_update_workspace_layout (MetaScreen *screen)
{ {
gulong *list; uint32_t *list;
int n_items; int n_items;
if (screen->workspace_layout_overridden) if (screen->workspace_layout_overridden)

View File

@ -428,10 +428,10 @@ reload_net_wm_pid (MetaWindow *window,
{ {
if (value->type != META_PROP_VALUE_INVALID) if (value->type != META_PROP_VALUE_INVALID)
{ {
gulong cardinal = (int) value->v.cardinal; uint32_t cardinal = (int) value->v.cardinal;
if (cardinal <= 0) 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); cardinal);
else else
{ {
@ -449,7 +449,7 @@ reload_net_wm_user_time (MetaWindow *window,
{ {
if (value->type != META_PROP_VALUE_INVALID) 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); meta_window_set_user_time (window, cardinal);
} }
} }
@ -670,7 +670,7 @@ reload_opaque_region (MetaWindow *window,
if (value->type != META_PROP_VALUE_INVALID) 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; int nitems = value->v.cardinal_list.n_cardinals;
cairo_rectangle_int_t *rects; cairo_rectangle_int_t *rects;

View File

@ -1283,7 +1283,7 @@ meta_window_x11_update_struts (MetaWindow *window)
GSList *old_struts; GSList *old_struts;
GSList *new_struts; GSList *new_struts;
GSList *old_iter, *new_iter; GSList *old_iter, *new_iter;
gulong *struts = NULL; uint32_t *struts = NULL;
int nitems; int nitems;
gboolean changed; gboolean changed;
@ -1346,7 +1346,7 @@ meta_window_x11_update_struts (MetaWindow *window)
new_struts = g_slist_prepend (new_struts, temp); 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", "window %s\n",
struts[0], struts[1], struts[2], struts[3], struts[0], struts[1], struts[2], struts[3],
window->desc); window->desc);
@ -1405,7 +1405,7 @@ meta_window_x11_update_struts (MetaWindow *window)
new_struts = g_slist_prepend (new_struts, temp); 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], struts[0], struts[1], struts[2], struts[3],
window->desc); window->desc);
} }

View File

@ -275,26 +275,16 @@ meta_prop_get_atom_list (MetaDisplay *display,
static gboolean static gboolean
cardinal_list_from_results (GetPropertyResults *results, cardinal_list_from_results (GetPropertyResults *results,
gulong **cardinals_p, uint32_t **cardinals_p,
int *n_cardinals_p) int *n_cardinals_p)
{ {
if (!validate_or_free_results (results, 32, XA_CARDINAL, FALSE)) if (!validate_or_free_results (results, 32, XA_CARDINAL, FALSE))
return FALSE; return FALSE;
*cardinals_p = (gulong*) results->prop; *cardinals_p = (uint32_t *) results->prop;
*n_cardinals_p = results->n_items; *n_cardinals_p = results->n_items;
results->prop = NULL; 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; return TRUE;
} }
@ -302,7 +292,7 @@ gboolean
meta_prop_get_cardinal_list (MetaDisplay *display, meta_prop_get_cardinal_list (MetaDisplay *display,
Window xwindow, Window xwindow,
Atom xatom, Atom xatom,
gulong **cardinals_p, uint32_t **cardinals_p,
int *n_cardinals_p) int *n_cardinals_p)
{ {
GetPropertyResults results; GetPropertyResults results;
@ -677,7 +667,7 @@ counter_from_results (GetPropertyResults *results,
static gboolean static gboolean
counter_list_from_results (GetPropertyResults *results, counter_list_from_results (GetPropertyResults *results,
XSyncCounter **counters_p, uint32_t **counters_p,
int *n_counters_p) int *n_counters_p)
{ {
if (!validate_or_free_results (results, 32, if (!validate_or_free_results (results, 32,
@ -685,7 +675,7 @@ counter_list_from_results (GetPropertyResults *results,
FALSE)) FALSE))
return FALSE; return FALSE;
*counters_p = (XSyncCounter*) results->prop; *counters_p = (uint32_t *) results->prop;
*n_counters_p = results->n_items; *n_counters_p = results->n_items;
results->prop = NULL; 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)) if (!validate_or_free_results (results, 32, prop_type, TRUE))
return FALSE; return FALSE;
*cardinal_p = *(gulong*) results->prop; *cardinal_p = *((uint32_t *) results->prop);
#if GLIB_SIZEOF_LONG == 8
/* Xlib sign-extends format=32 items, but we want them unsigned */
*cardinal_p &= 0xffffffff;
#endif
g_free (results->prop); g_free (results->prop);
results->prop = NULL; results->prop = NULL;

View File

@ -83,7 +83,7 @@ gboolean meta_prop_get_motif_hints (MetaDisplay *display,
gboolean meta_prop_get_cardinal_list (MetaDisplay *display, gboolean meta_prop_get_cardinal_list (MetaDisplay *display,
Window xwindow, Window xwindow,
Atom xatom, Atom xatom,
gulong **cardinals_p, uint32_t **cardinals_p,
int *n_cardinals_p); int *n_cardinals_p);
gboolean meta_prop_get_latin1_string (MetaDisplay *display, gboolean meta_prop_get_latin1_string (MetaDisplay *display,
Window xwindow, Window xwindow,
@ -180,7 +180,7 @@ typedef struct
XSyncCounter xcounter; XSyncCounter xcounter;
struct struct
{ {
gulong *counters; uint32_t *counters;
int n_counters; int n_counters;
} xcounter_list; } xcounter_list;
@ -192,7 +192,7 @@ typedef struct
struct struct
{ {
gulong *cardinals; uint32_t *cardinals;
int n_cardinals; int n_cardinals;
} cardinal_list; } cardinal_list;