emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117483: Minor fixups related to usage of the 'long'


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117483: Minor fixups related to usage of the 'long' type.
Date: Mon, 07 Jul 2014 23:33:11 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117483
revision-id: address@hidden
parent: address@hidden
author: Paul Eggert  <address@hidden>
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2014-07-07 16:33:05 -0700
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/gnutls.c                   gnutls.c-20100926054902-dzayyj6wycit6kzn-3
  src/termcap.c                  termcap.c-20091113204419-o5vbwnq5f7feedwu-775
  src/xfaces.c                   xfaces.c-20091113204419-o5vbwnq5f7feedwu-560
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
  src/xselect.c                  xselect.c-20091113204419-o5vbwnq5f7feedwu-543
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-07-07 23:25:13 +0000
+++ b/src/ChangeLog     2014-07-07 23:33:05 +0000
@@ -1,5 +1,20 @@
 2014-07-07  Paul Eggert  <address@hidden>
 
+       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.

=== modified file 'src/gnutls.c'
--- a/src/gnutls.c      2014-04-05 19:30:36 +0000
+++ b/src/gnutls.c      2014-07-07 23:33:05 +0000
@@ -336,8 +336,8 @@
         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;

=== modified file 'src/termcap.c'
--- a/src/termcap.c     2014-01-01 07:43:34 +0000
+++ b/src/termcap.c     2014-07-07 23:33:05 +0000
@@ -520,7 +520,7 @@
   bufp->ateof = 0;
   *bufp->ptr = '\0';
 
-  lseek (fd, 0L, 0);
+  lseek (fd, 0, 0);
 
   while (!bufp->ateof)
     {

=== modified file 'src/xfaces.c'
--- a/src/xfaces.c      2014-07-03 06:00:53 +0000
+++ b/src/xfaces.c      2014-07-07 23:33:05 +0000
@@ -6299,7 +6299,7 @@
 {
   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,

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2014-06-29 16:12:08 +0000
+++ b/src/xfns.c        2014-07-07 23:33:05 +0000
@@ -1595,7 +1595,7 @@
 
     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 @@
 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,

=== modified file 'src/xselect.c'
--- a/src/xselect.c     2014-07-04 02:28:54 +0000
+++ b/src/xselect.c     2014-07-07 23:33:05 +0000
@@ -458,7 +458,7 @@
      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 @@
     }
 
   /* 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 @@
           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 @@
 
   /* 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 @@
       else if (STRINGP (o))
         {
           block_input ();
-          val = (long) XInternAtom (dpy, SSDATA (o), False);
+          val = XInternAtom (dpy, SSDATA (o), False);
           unblock_input ();
         }
       else

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2014-06-23 04:11:29 +0000
+++ b/src/xterm.c       2014-07-07 23:33:05 +0000
@@ -410,7 +410,7 @@
   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 @@
     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 @@
 
   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_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 @@
                 + 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 @@
      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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]