aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-07-07 16:33:05 -0700
committerPaul Eggert2014-07-07 16:33:05 -0700
commitcae17e36bc98cbcf5aa54d90396de1fe1d7b5c77 (patch)
tree12f28771f8d62c14c5f0281916aaecf02c152f6f /src
parent0e14232948f875e390ed46348969b9ebeb9133c1 (diff)
downloademacs-cae17e36bc98cbcf5aa54d90396de1fe1d7b5c77.tar.gz
emacs-cae17e36bc98cbcf5aa54d90396de1fe1d7b5c77.zip
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.
Diffstat (limited to 'src')
-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 8688bada693..2e6ad094382 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,20 @@
12014-07-07 Paul Eggert <eggert@cs.ucla.edu> 12014-07-07 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Minor fixups related to usage of the 'long' type.
4 * gnutls.c (emacs_gnutls_handshake):
5 * xfaces.c (dump_realized_face):
6 Work even if 'long' is narrower than 'void *'.
7 * termcap.c (scan_file):
8 * xselect.c (x_decline_selection_request)
9 (x_reply_selection_request, x_get_window_property):
10 * xterm.c (x_set_frame_alpha):
11 Remove unnecessary 'L' suffixes of integer constants.
12 * xfns.c (hack_wm_protocols):
13 * xselect.c (x_fill_property_data):
14 * xterm.c (x_set_offset, x_set_window_size_1, x_make_frame_invisible):
15 Remove unnecessary casts to 'long'.
16 (set_machine_and_pid_properties): Don't assume pid_t fits in 32 bits.
17
3 Minor ImageMagick safety fixes. 18 Minor ImageMagick safety fixes.
4 * image.c (imagemagick_compute_animated_image): 19 * image.c (imagemagick_compute_animated_image):
5 Remove useless assignment to local. Avoid problems if dest_width is 0. 20 Remove useless assignment to local. Avoid problems if dest_width is 0.
diff --git a/src/gnutls.c b/src/gnutls.c
index d9b417b46ed..5d48f78a6d4 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -336,8 +336,8 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
336 in. For an Emacs process socket, infd and outfd are the 336 in. For an Emacs process socket, infd and outfd are the
337 same but we use this two-argument version for clarity. */ 337 same but we use this two-argument version for clarity. */
338 fn_gnutls_transport_set_ptr2 (state, 338 fn_gnutls_transport_set_ptr2 (state,
339 (gnutls_transport_ptr_t) (long) proc->infd, 339 (void *) (intptr_t) proc->infd,
340 (gnutls_transport_ptr_t) (long) proc->outfd); 340 (void *) (intptr_t) proc->outfd);
341#endif 341#endif
342 342
343 proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET; 343 proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET;
diff --git a/src/termcap.c b/src/termcap.c
index 8c766bd1994..26c6de06f88 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -520,7 +520,7 @@ scan_file (char *str, int fd, struct termcap_buffer *bufp)
520 bufp->ateof = 0; 520 bufp->ateof = 0;
521 *bufp->ptr = '\0'; 521 *bufp->ptr = '\0';
522 522
523 lseek (fd, 0L, 0); 523 lseek (fd, 0, 0);
524 524
525 while (!bufp->ateof) 525 while (!bufp->ateof)
526 { 526 {
diff --git a/src/xfaces.c b/src/xfaces.c
index ead14f0116d..081875f5bea 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6299,7 +6299,7 @@ dump_realized_face (struct face *face)
6299{ 6299{
6300 fprintf (stderr, "ID: %d\n", face->id); 6300 fprintf (stderr, "ID: %d\n", face->id);
6301#ifdef HAVE_X_WINDOWS 6301#ifdef HAVE_X_WINDOWS
6302 fprintf (stderr, "gc: %ld\n", (long) face->gc); 6302 fprintf (stderr, "gc: %p\n", face->gc);
6303#endif 6303#endif
6304 fprintf (stderr, "foreground: 0x%lx (%s)\n", 6304 fprintf (stderr, "foreground: 0x%lx (%s)\n",
6305 face->foreground, 6305 face->foreground,
diff --git a/src/xfns.c b/src/xfns.c
index 651d21294e3..1ecfadd88b7 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1595,7 +1595,7 @@ hack_wm_protocols (struct frame *f, Widget widget)
1595 1595
1596 if ((XGetWindowProperty (dpy, w, 1596 if ((XGetWindowProperty (dpy, w,
1597 FRAME_DISPLAY_INFO (f)->Xatom_wm_protocols, 1597 FRAME_DISPLAY_INFO (f)->Xatom_wm_protocols,
1598 (long)0, (long)100, False, XA_ATOM, 1598 0, 100, False, XA_ATOM,
1599 &type, &format, &nitems, &bytes_after, 1599 &type, &format, &nitems, &bytes_after,
1600 &catoms) 1600 &catoms)
1601 == Success) 1601 == Success)
@@ -2853,18 +2853,21 @@ Signal error if FRAME is not an X frame. */)
2853static void 2853static void
2854set_machine_and_pid_properties (struct frame *f) 2854set_machine_and_pid_properties (struct frame *f)
2855{ 2855{
2856 long pid = (long) getpid ();
2857
2858 /* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME. */ 2856 /* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME. */
2859 XSetWMProperties (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), NULL, NULL, 2857 XSetWMProperties (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), NULL, NULL,
2860 NULL, 0, NULL, NULL, NULL); 2858 NULL, 0, NULL, NULL, NULL);
2861 XChangeProperty (FRAME_X_DISPLAY (f), 2859 pid_t pid = getpid ();
2862 FRAME_OUTER_WINDOW (f), 2860 if (pid <= 0xffffffffu)
2863 XInternAtom (FRAME_X_DISPLAY (f), 2861 {
2864 "_NET_WM_PID", 2862 unsigned long xpid = pid;
2865 False), 2863 XChangeProperty (FRAME_X_DISPLAY (f),
2866 XA_CARDINAL, 32, PropModeReplace, 2864 FRAME_OUTER_WINDOW (f),
2867 (unsigned char *) &pid, 1); 2865 XInternAtom (FRAME_X_DISPLAY (f),
2866 "_NET_WM_PID",
2867 False),
2868 XA_CARDINAL, 32, PropModeReplace,
2869 (unsigned char *) &xpid, 1);
2870 }
2868} 2871}
2869 2872
2870DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 2873DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
diff --git a/src/xselect.c b/src/xselect.c
index f23256346cb..eb6f8f3b161 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -458,7 +458,7 @@ x_decline_selection_request (struct input_event *event)
458 died in the meantime. Handle that case. */ 458 died in the meantime. Handle that case. */
459 block_input (); 459 block_input ();
460 x_catch_errors (reply->display); 460 x_catch_errors (reply->display);
461 XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base); 461 XSendEvent (reply->display, reply->requestor, False, 0, &reply_base);
462 XFlush (reply->display); 462 XFlush (reply->display);
463 x_uncatch_errors (); 463 x_uncatch_errors ();
464 unblock_input (); 464 unblock_input ();
@@ -632,7 +632,7 @@ x_reply_selection_request (struct input_event *event,
632 } 632 }
633 633
634 /* Now issue the SelectionNotify event. */ 634 /* Now issue the SelectionNotify event. */
635 XSendEvent (display, window, False, 0L, &reply_base); 635 XSendEvent (display, window, False, 0, &reply_base);
636 XFlush (display); 636 XFlush (display);
637 637
638#ifdef TRACE_SELECTION 638#ifdef TRACE_SELECTION
@@ -710,7 +710,7 @@ x_reply_selection_request (struct input_event *event,
710 requestor that we're done. */ 710 requestor that we're done. */
711 block_input (); 711 block_input ();
712 if (! waiting_for_other_props_on_window (display, window)) 712 if (! waiting_for_other_props_on_window (display, window))
713 XSelectInput (display, window, 0L); 713 XSelectInput (display, window, 0);
714 714
715 TRACE1 ("Set %s to a 0-length chunk to indicate EOF", 715 TRACE1 ("Set %s to a 0-length chunk to indicate EOF",
716 XGetAtomName (display, cs->property)); 716 XGetAtomName (display, cs->property));
@@ -1283,7 +1283,7 @@ x_get_window_property (Display *display, Window window, Atom property,
1283 1283
1284 /* First probe the thing to find out how big it is. */ 1284 /* First probe the thing to find out how big it is. */
1285 result = XGetWindowProperty (display, window, property, 1285 result = XGetWindowProperty (display, window, property,
1286 0L, 0L, False, AnyPropertyType, 1286 0, 0, False, AnyPropertyType,
1287 actual_type_ret, actual_format_ret, 1287 actual_type_ret, actual_format_ret,
1288 actual_size_ret, 1288 actual_size_ret,
1289 &bytes_remaining, &tmp_data); 1289 &bytes_remaining, &tmp_data);
@@ -2314,7 +2314,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
2314 else if (STRINGP (o)) 2314 else if (STRINGP (o))
2315 { 2315 {
2316 block_input (); 2316 block_input ();
2317 val = (long) XInternAtom (dpy, SSDATA (o), False); 2317 val = XInternAtom (dpy, SSDATA (o), False);
2318 unblock_input (); 2318 unblock_input ();
2319 } 2319 }
2320 else 2320 else
diff --git a/src/xterm.c b/src/xterm.c
index 45bb7b2a918..b7a7f0b3d4c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -410,7 +410,7 @@ x_set_frame_alpha (struct frame *f)
410 if (parent != None) 410 if (parent != None)
411 XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity, 411 XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity,
412 XA_CARDINAL, 32, PropModeReplace, 412 XA_CARDINAL, 32, PropModeReplace,
413 (unsigned char *) &opac, 1L); 413 (unsigned char *) &opac, 1);
414 414
415 /* return unless necessary */ 415 /* return unless necessary */
416 { 416 {
@@ -420,7 +420,7 @@ x_set_frame_alpha (struct frame *f)
420 unsigned long n, left; 420 unsigned long n, left;
421 421
422 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, 422 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
423 0L, 1L, False, XA_CARDINAL, 423 0, 1, False, XA_CARDINAL,
424 &actual, &format, &n, &left, 424 &actual, &format, &n, &left,
425 &data); 425 &data);
426 426
@@ -438,7 +438,7 @@ x_set_frame_alpha (struct frame *f)
438 438
439 XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, 439 XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
440 XA_CARDINAL, 32, PropModeReplace, 440 XA_CARDINAL, 32, PropModeReplace,
441 (unsigned char *) &opac, 1L); 441 (unsigned char *) &opac, 1);
442 x_uncatch_errors (); 442 x_uncatch_errors ();
443} 443}
444 444
@@ -8094,7 +8094,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8094 x_calc_absolute_position (f); 8094 x_calc_absolute_position (f);
8095 8095
8096 block_input (); 8096 block_input ();
8097 x_wm_set_size_hint (f, (long) 0, 0); 8097 x_wm_set_size_hint (f, 0, 0);
8098 8098
8099 modified_left = f->left_pos; 8099 modified_left = f->left_pos;
8100 modified_top = f->top_pos; 8100 modified_top = f->top_pos;
@@ -8639,7 +8639,7 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height,
8639 + FRAME_MENUBAR_HEIGHT (f) 8639 + FRAME_MENUBAR_HEIGHT (f)
8640 + FRAME_TOOLBAR_HEIGHT (f)); 8640 + FRAME_TOOLBAR_HEIGHT (f));
8641 if (change_gravity) f->win_gravity = NorthWestGravity; 8641 if (change_gravity) f->win_gravity = NorthWestGravity;
8642 x_wm_set_size_hint (f, (long) 0, 0); 8642 x_wm_set_size_hint (f, 0, 0);
8643 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 8643 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
8644 pixelwidth, pixelheight); 8644 pixelwidth, pixelheight);
8645 8645
@@ -9046,7 +9046,7 @@ x_make_frame_invisible (struct frame *f)
9046 program-specified, so that when the window is mapped again, it will be 9046 program-specified, so that when the window is mapped again, it will be
9047 placed at the same location, without forcing the user to position it 9047 placed at the same location, without forcing the user to position it
9048 by hand again (they have already done that once for this window.) */ 9048 by hand again (they have already done that once for this window.) */
9049 x_wm_set_size_hint (f, (long) 0, 1); 9049 x_wm_set_size_hint (f, 0, 1);
9050 9050
9051#ifdef USE_GTK 9051#ifdef USE_GTK
9052 if (FRAME_GTK_OUTER_WIDGET (f)) 9052 if (FRAME_GTK_OUTER_WIDGET (f))