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.
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;
bufp->ateof = 0;
*bufp->ptr = '\0';
- lseek (fd, 0L, 0);
+ lseek (fd, 0, 0);
while (!bufp->ateof)
{
{
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,
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)
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,
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 ();
}
/* Now issue the SelectionNotify event. */
- XSendEvent (display, window, False, 0L, &reply_base);
+ XSendEvent (display, window, False, 0, &reply_base);
XFlush (display);
#ifdef TRACE_SELECTION
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));
/* 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);
else if (STRINGP (o))
{
block_input ();
- val = (long) XInternAtom (dpy, SSDATA (o), False);
+ val = XInternAtom (dpy, SSDATA (o), False);
unblock_input ();
}
else
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 */
{
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);
XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *) &opac, 1L);
+ (unsigned char *) &opac, 1);
x_uncatch_errors ();
}
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;
+ 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);
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))