Commit cae17e36 authored by Paul Eggert's avatar Paul Eggert

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.
parent 0e142329
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.
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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,
......
......@@ -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,
......
......@@ -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
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment