]> Dogcows Code - chaz/openbox/commitdiff
do not commit bad char* foo that breaks on !32 bit platforms
authorDana Jansens <danakj@orodu.net>
Mon, 14 Apr 2003 17:06:32 +0000 (17:06 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 14 Apr 2003 17:06:32 +0000 (17:06 +0000)
openbox/prop.c
openbox/prop.h

index 97f5fb94b7832059dbc28547be71da3176af4ffc..52562f86034c07b1e2882066266358b592b504ba 100644 (file)
@@ -131,23 +131,21 @@ void prop_startup()
     CREATE(openbox_premax, "_OPENBOX_PREMAX");
 }
 
-gboolean prop_get(Window win, Atom prop, Atom type, int size,
-                 guchar **data, gulong num)
+gboolean prop_get32(Window win, Atom prop, Atom type, gulong **data,gulong num)
 {
     gboolean ret = FALSE;
     int res;
-    guchar *xdata = NULL;
+    gulong *xdata = NULL;
     Atom ret_type;
     int ret_size;
     gulong ret_items, bytes_left;
-    long num32 = 32 / size * num; /* num in 32-bit elements */
 
-    res = XGetWindowProperty(ob_display, win, prop, 0l, num32,
+    res = XGetWindowProperty(ob_display, win, prop, 0l, num,
                             FALSE, type, &ret_type, &ret_size,
-                            &ret_items, &bytes_left, &xdata);
+                            &ret_items, &bytes_left, (guchar**)&xdata);
     if (res == Success && ret_items && xdata) {
-       if (ret_size == size && ret_items >= num) {
-           *data = g_memdup(xdata, num * (size / 8));
+       if (ret_size == 32 && ret_items >= num) {
+           *data = g_memdup(xdata, num * sizeof(gulong));
            ret = TRUE;
        }
        XFree(xdata);
index c2de3b20597083702e76f4d58425b79170a6e17b..7899507f68d01d5a25a5479bce0e30fc7ecd5751 100644 (file)
@@ -139,8 +139,8 @@ Atoms prop_atoms;
 
 void prop_startup();
 
-gboolean prop_get(Window win, Atom prop, Atom type, int size,
-                       guchar **data, gulong num);
+gboolean prop_get32(Window win, Atom prop, Atom type,
+                    gulong **data, gulong num);
 
 gboolean prop_get_prealloc(Window win, Atom prop, Atom type, int size,
                           guchar *data, gulong num);
@@ -201,8 +201,7 @@ void prop_message(Window about, Atom messagetype, long data0, long data1,
 
 /* Get an amount of a 32-bit property into an array (which must be freed) */
 #define PROP_GET32A(win, prop, type, value, num) \
-  (prop_get(win, prop_atoms.prop, prop_atoms.type, 32, \
-           (guchar**)&value, num))
+  (prop_get32(win, prop_atoms.prop, prop_atoms.type, (gulong**)&value, num))
 
 /* Get an entire 32-bit property into an array (which must be freed) */
 #define PROP_GET32U(win, prop, type, value, num) \
This page took 0.030895 seconds and 4 git commands to generate.