]> code.delx.au - gnu-emacs/commitdiff
(hack_wm_protocols): Use correct type for last parameter
authorAndreas Schwab <schwab@suse.de>
Thu, 17 Feb 2005 12:49:34 +0000 (12:49 +0000)
committerAndreas Schwab <schwab@suse.de>
Thu, 17 Feb 2005 12:49:34 +0000 (12:49 +0000)
of XGetWindowProperty to avoid aliasing issues.
(Fx_window_property): Likewise.

src/xfns.c

index c126d6ad361fada1ad13416d9b853d911c49672d..2be52a49670d85a8528aa5d088718fcab1fa7fe5 100644 (file)
@@ -1880,7 +1880,8 @@ hack_wm_protocols (f, widget)
 
   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 @@ hack_wm_protocols (f, widget)
                             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 @@ no value of TYPE.  */)
   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 @@ no value of TYPE.  */)
   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 @@ no value of TYPE.  */)
                               ! 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 @@ no value of TYPE.  */)
               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);