changeset 60133:cfda6afe9273

(hack_wm_protocols): Use correct type for last parameter of XGetWindowProperty to avoid aliasing issues. (Fx_window_property): Likewise.
author Andreas Schwab <schwab@suse.de>
date Thu, 17 Feb 2005 12:49:34 +0000
parents 8a072d12b41a
children dd37bedfb1f4
files src/xfns.c
diffstat 1 files changed, 26 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Thu Feb 17 00:58:19 2005 +0000
+++ b/src/xfns.c	Thu Feb 17 12:49:34 2005 +0000
@@ -1880,7 +1880,8 @@
 
   BLOCK_INPUT;
   {
-    Atom type, *atoms = 0;
+    Atom type;
+    unsigned char *catoms;
     int format = 0;
     unsigned long nitems = 0;
     unsigned long bytes_after;
@@ -1889,20 +1890,27 @@
 			     FRAME_X_DISPLAY_INFO (f)->Xatom_wm_protocols,
 			     (long)0, (long)100, False, XA_ATOM,
 			     &type, &format, &nitems, &bytes_after,
-			     (unsigned char **) &atoms)
+			     &catoms)
 	 == Success)
 	&& format == 32 && type == XA_ATOM)
-      while (nitems > 0)
-	{
-	  nitems--;
- 	  if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window)
-	    need_delete = 0;
-	  else if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_take_focus)
-	    need_focus = 0;
-	  else if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself)
-	    need_save = 0;
-	}
-    if (atoms) XFree ((char *) atoms);
+      {
+	Atom *atoms = (Atom *) catoms;
+	while (nitems > 0)
+	  {
+	    nitems--;
+	    if (atoms[nitems]
+		== FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window)
+	      need_delete = 0;
+	    else if (atoms[nitems]
+		     == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_take_focus)
+	      need_focus = 0;
+	    else if (atoms[nitems]
+		     == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself)
+	      need_save = 0;
+	  }
+      }
+    if (catoms)
+      XFree (catoms);
   }
   {
     Atom props [10];
@@ -4156,7 +4164,7 @@
   Atom prop_atom;
   int rc;
   Lisp_Object prop_value = Qnil;
-  char *tmp_data = NULL;
+  unsigned char *tmp_data = NULL;
   Atom actual_type;
   Atom target_type = XA_STRING;
   int actual_format;
@@ -4196,7 +4204,7 @@
   rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window,
 			   prop_atom, 0, 0, False, target_type,
 			   &actual_type, &actual_format, &actual_size,
-			   &bytes_remaining, (unsigned char **) &tmp_data);
+			   &bytes_remaining, &tmp_data);
   if (rc == Success)
     {
       int size = bytes_remaining;
@@ -4209,7 +4217,7 @@
 			       ! NILP (delete_p), target_type,
 			       &actual_type, &actual_format,
 			       &actual_size, &bytes_remaining,
-			       (unsigned char **) &tmp_data);
+			       &tmp_data);
       if (rc == Success && tmp_data)
         {
           /* The man page for XGetWindowProperty says:
@@ -4233,14 +4241,14 @@
               long *ldata = (long *) tmp_data;
 
               for (i = 0; i < actual_size; ++i)
-                idata[i]= (int) ldata[i];
+                idata[i] = (int) ldata[i];
             }
 
           if (NILP (vector_ret_p))
             prop_value = make_string (tmp_data, size);
           else
             prop_value = x_property_data_to_lisp (f,
-                                                  (unsigned char *) tmp_data,
+                                                  tmp_data,
                                                   actual_type,
                                                   actual_format,
                                                   actual_size);