summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-07-07 16:33:05 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-07-07 16:33:05 -0700
commitcae17e36bc98cbcf5aa54d90396de1fe1d7b5c77 (patch)
tree12f28771f8d62c14c5f0281916aaecf02c152f6f
parent0e14232948f875e390ed46348969b9ebeb9133c1 (diff)
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.
-rw-r--r--src/ChangeLog15
-rw-r--r--src/gnutls.c4
-rw-r--r--src/termcap.c2
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c23
-rw-r--r--src/xselect.c10
-rw-r--r--src/xterm.c12
7 files changed, 43 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8688bada69..2e6ad09438 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/gnutls.c b/src/gnutls.c
index d9b417b46e..5d48f78a6d 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -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;
diff --git a/src/termcap.c b/src/termcap.c
index 8c766bd199..26c6de06f8 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -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)
{
diff --git a/src/xfaces.c b/src/xfaces.c
index ead14f0116..081875f5be 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -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,
diff --git a/src/xfns.c b/src/xfns.c
index 651d21294e..1ecfadd88b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -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,
diff --git a/src/xselect.c b/src/xselect.c
index f23256346c..eb6f8f3b16 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -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
diff --git a/src/xterm.c b/src/xterm.c
index 45bb7b2a91..b7a7f0b3d4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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))