]> git.eshelyaron.com Git - emacs.git/commitdiff
Minor fixups related to usage of the 'long' type.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 7 Jul 2014 23:33:05 +0000 (16:33 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 7 Jul 2014 23:33:05 +0000 (16:33 -0700)
* gnutls.c (emacs_gnutls_handshake):
* xfaces.c (dump_realized_face):
Work even if 'long' is narrower than 'void *'.
* termcap.c (scan_file):
* xselect.c (x_decline_selection_request)
(x_reply_selection_request, x_get_window_property):
* xterm.c (x_set_frame_alpha):
Remove unnecessary 'L' suffixes of integer constants.
* xfns.c (hack_wm_protocols):
* xselect.c (x_fill_property_data):
* xterm.c (x_set_offset, x_set_window_size_1, x_make_frame_invisible):
Remove unnecessary casts to 'long'.
(set_machine_and_pid_properties): Don't assume pid_t fits in 32 bits.

src/ChangeLog
src/gnutls.c
src/termcap.c
src/xfaces.c
src/xfns.c
src/xselect.c
src/xterm.c

index 8688bada693470b5a10d9be68615cd703e783aa9..2e6ad094382baebd7149d1bf26b4bad8665af296 100644 (file)
@@ -1,5 +1,20 @@
 2014-07-07  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Minor fixups related to usage of the 'long' type.
+       * gnutls.c (emacs_gnutls_handshake):
+       * xfaces.c (dump_realized_face):
+       Work even if 'long' is narrower than 'void *'.
+       * termcap.c (scan_file):
+       * xselect.c (x_decline_selection_request)
+       (x_reply_selection_request, x_get_window_property):
+       * xterm.c (x_set_frame_alpha):
+       Remove unnecessary 'L' suffixes of integer constants.
+       * xfns.c (hack_wm_protocols):
+       * xselect.c (x_fill_property_data):
+       * xterm.c (x_set_offset, x_set_window_size_1, x_make_frame_invisible):
+       Remove unnecessary casts to 'long'.
+       (set_machine_and_pid_properties): Don't assume pid_t fits in 32 bits.
+
        Minor ImageMagick safety fixes.
        * image.c (imagemagick_compute_animated_image):
        Remove useless assignment to local.  Avoid problems if dest_width is 0.
index d9b417b46ed209bf5e79bd1a808660129856dfca..5d48f78a6d4c53d9d7d7bda443f6072cf441c50e 100644 (file)
@@ -336,8 +336,8 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
         in.  For an Emacs process socket, infd and outfd are the
         same but we use this two-argument version for clarity.  */
       fn_gnutls_transport_set_ptr2 (state,
-                                   (gnutls_transport_ptr_t) (long) proc->infd,
-                                   (gnutls_transport_ptr_t) (long) proc->outfd);
+                                   (void *) (intptr_t) proc->infd,
+                                   (void *) (intptr_t) proc->outfd);
 #endif
 
       proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET;
index 8c766bd1994f1afb86a5c6529d016bd93d3b5cf4..26c6de06f88ee731f1d933fbceed2e72b790cd6c 100644 (file)
@@ -520,7 +520,7 @@ scan_file (char *str, int fd, struct termcap_buffer *bufp)
   bufp->ateof = 0;
   *bufp->ptr = '\0';
 
-  lseek (fd, 0L, 0);
+  lseek (fd, 0, 0);
 
   while (!bufp->ateof)
     {
index ead14f0116defc0cbc3e9fbd583e90e6eef6971c..081875f5bea8984b1be20a6f260b1297e59c2234 100644 (file)
@@ -6299,7 +6299,7 @@ dump_realized_face (struct face *face)
 {
   fprintf (stderr, "ID: %d\n", face->id);
 #ifdef HAVE_X_WINDOWS
-  fprintf (stderr, "gc: %ld\n", (long) face->gc);
+  fprintf (stderr, "gc: %p\n", face->gc);
 #endif
   fprintf (stderr, "foreground: 0x%lx (%s)\n",
           face->foreground,
index 651d21294e3ab13a70f0959edad7c62451d275e3..1ecfadd88b731deedcd60ea6a8dbb2b52b9e59ac 100644 (file)
@@ -1595,7 +1595,7 @@ hack_wm_protocols (struct frame *f, Widget widget)
 
     if ((XGetWindowProperty (dpy, w,
                             FRAME_DISPLAY_INFO (f)->Xatom_wm_protocols,
-                            (long)0, (long)100, False, XA_ATOM,
+                            0, 100, False, XA_ATOM,
                             &type, &format, &nitems, &bytes_after,
                             &catoms)
         == Success)
@@ -2853,18 +2853,21 @@ Signal error if FRAME is not an X frame.  */)
 static void
 set_machine_and_pid_properties (struct frame *f)
 {
-  long pid = (long) getpid ();
-
   /* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME.  */
   XSetWMProperties (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), NULL, NULL,
                     NULL, 0, NULL, NULL, NULL);
-  XChangeProperty (FRAME_X_DISPLAY (f),
-                   FRAME_OUTER_WINDOW (f),
-                   XInternAtom (FRAME_X_DISPLAY (f),
-                                "_NET_WM_PID",
-                                False),
-                   XA_CARDINAL, 32, PropModeReplace,
-                   (unsigned char *) &pid, 1);
+  pid_t pid = getpid ();
+  if (pid <= 0xffffffffu)
+    {
+      unsigned long xpid = pid;
+      XChangeProperty (FRAME_X_DISPLAY (f),
+                      FRAME_OUTER_WINDOW (f),
+                      XInternAtom (FRAME_X_DISPLAY (f),
+                                   "_NET_WM_PID",
+                                   False),
+                      XA_CARDINAL, 32, PropModeReplace,
+                      (unsigned char *) &xpid, 1);
+    }
 }
 
 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
index f23256346cb534b4a34f0542732b0e4a6356dbe8..eb6f8f3b161e0bdc4b3e815b841a34bdb9ef0726 100644 (file)
@@ -458,7 +458,7 @@ x_decline_selection_request (struct input_event *event)
      died in the meantime.  Handle that case.  */
   block_input ();
   x_catch_errors (reply->display);
-  XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base);
+  XSendEvent (reply->display, reply->requestor, False, 0, &reply_base);
   XFlush (reply->display);
   x_uncatch_errors ();
   unblock_input ();
@@ -632,7 +632,7 @@ x_reply_selection_request (struct input_event *event,
     }
 
   /* Now issue the SelectionNotify event.  */
-  XSendEvent (display, window, False, 0L, &reply_base);
+  XSendEvent (display, window, False, 0, &reply_base);
   XFlush (display);
 
 #ifdef TRACE_SELECTION
@@ -710,7 +710,7 @@ x_reply_selection_request (struct input_event *event,
           requestor that we're done.  */
        block_input ();
        if (! waiting_for_other_props_on_window (display, window))
-         XSelectInput (display, window, 0L);
+         XSelectInput (display, window, 0);
 
        TRACE1 ("Set %s to a 0-length chunk to indicate EOF",
                XGetAtomName (display, cs->property));
@@ -1283,7 +1283,7 @@ x_get_window_property (Display *display, Window window, Atom property,
 
   /* First probe the thing to find out how big it is.  */
   result = XGetWindowProperty (display, window, property,
-                              0L, 0L, False, AnyPropertyType,
+                              0, 0, False, AnyPropertyType,
                               actual_type_ret, actual_format_ret,
                               actual_size_ret,
                               &bytes_remaining, &tmp_data);
@@ -2314,7 +2314,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
       else if (STRINGP (o))
         {
           block_input ();
-          val = (long) XInternAtom (dpy, SSDATA (o), False);
+          val = XInternAtom (dpy, SSDATA (o), False);
           unblock_input ();
         }
       else
index 45bb7b2a91851d8996d93f0907493c4f0c2af5f0..b7a7f0b3d4cb5a4d079ef1b8253a5f52f1f01c8d 100644 (file)
@@ -410,7 +410,7 @@ x_set_frame_alpha (struct frame *f)
   if (parent != None)
     XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity,
                      XA_CARDINAL, 32, PropModeReplace,
-                     (unsigned char *) &opac, 1L);
+                     (unsigned char *) &opac, 1);
 
   /* return unless necessary */
   {
@@ -420,7 +420,7 @@ x_set_frame_alpha (struct frame *f)
     unsigned long n, left;
 
     rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
-                            0L, 1L, False, XA_CARDINAL,
+                            0, 1, False, XA_CARDINAL,
                             &actual, &format, &n, &left,
                             &data);
 
@@ -438,7 +438,7 @@ x_set_frame_alpha (struct frame *f)
 
   XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
                   XA_CARDINAL, 32, PropModeReplace,
-                  (unsigned char *) &opac, 1L);
+                  (unsigned char *) &opac, 1);
   x_uncatch_errors ();
 }
 
@@ -8094,7 +8094,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
   x_calc_absolute_position (f);
 
   block_input ();
-  x_wm_set_size_hint (f, (long) 0, 0);
+  x_wm_set_size_hint (f, 0, 0);
 
   modified_left = f->left_pos;
   modified_top = f->top_pos;
@@ -8639,7 +8639,7 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height,
                 + FRAME_MENUBAR_HEIGHT (f)
                 + FRAME_TOOLBAR_HEIGHT (f));
   if (change_gravity) f->win_gravity = NorthWestGravity;
-  x_wm_set_size_hint (f, (long) 0, 0);
+  x_wm_set_size_hint (f, 0, 0);
   XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                 pixelwidth, pixelheight);
 
@@ -9046,7 +9046,7 @@ x_make_frame_invisible (struct frame *f)
      program-specified, so that when the window is mapped again, it will be
      placed at the same location, without forcing the user to position it
      by hand again (they have already done that once for this window.)  */
-  x_wm_set_size_hint (f, (long) 0, 1);
+  x_wm_set_size_hint (f, 0, 1);
 
 #ifdef USE_GTK
   if (FRAME_GTK_OUTER_WIDGET (f))