diff options
Diffstat (limited to 'src/xselect.c')
| -rw-r--r-- | src/xselect.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/xselect.c b/src/xselect.c index 48d6215a7bb..383aebf96c8 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -1594,7 +1594,7 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo, | |||
| 1594 | return x_atom_to_symbol (dpyinfo, (Atom) idata[0]); | 1594 | return x_atom_to_symbol (dpyinfo, (Atom) idata[0]); |
| 1595 | else | 1595 | else |
| 1596 | { | 1596 | { |
| 1597 | Lisp_Object v = make_uninit_vector (size / sizeof (int)); | 1597 | Lisp_Object v = make_nil_vector (size / sizeof (int)); |
| 1598 | 1598 | ||
| 1599 | for (i = 0; i < size / sizeof (int); i++) | 1599 | for (i = 0; i < size / sizeof (int); i++) |
| 1600 | ASET (v, i, x_atom_to_symbol (dpyinfo, (Atom) idata[i])); | 1600 | ASET (v, i, x_atom_to_symbol (dpyinfo, (Atom) idata[i])); |
| @@ -1653,7 +1653,7 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo, | |||
| 1653 | else | 1653 | else |
| 1654 | { | 1654 | { |
| 1655 | ptrdiff_t i; | 1655 | ptrdiff_t i; |
| 1656 | Lisp_Object v = make_uninit_vector (size / X_LONG_SIZE); | 1656 | Lisp_Object v = make_nil_vector (size / X_LONG_SIZE); |
| 1657 | 1657 | ||
| 1658 | if (type == XA_INTEGER) | 1658 | if (type == XA_INTEGER) |
| 1659 | { | 1659 | { |
| @@ -1860,7 +1860,7 @@ clean_local_selection_data (Lisp_Object obj) | |||
| 1860 | Lisp_Object copy; | 1860 | Lisp_Object copy; |
| 1861 | if (size == 1) | 1861 | if (size == 1) |
| 1862 | return clean_local_selection_data (AREF (obj, 0)); | 1862 | return clean_local_selection_data (AREF (obj, 0)); |
| 1863 | copy = make_uninit_vector (size); | 1863 | copy = make_nil_vector (size); |
| 1864 | for (i = 0; i < size; i++) | 1864 | for (i = 0; i < size; i++) |
| 1865 | ASET (copy, i, clean_local_selection_data (AREF (obj, i))); | 1865 | ASET (copy, i, clean_local_selection_data (AREF (obj, i))); |
| 1866 | return copy; | 1866 | return copy; |
| @@ -2276,23 +2276,28 @@ x_check_property_data (Lisp_Object data) | |||
| 2276 | 2276 | ||
| 2277 | DPY is the display use to look up X atoms. | 2277 | DPY is the display use to look up X atoms. |
| 2278 | DATA is a Lisp list of values to be converted. | 2278 | DATA is a Lisp list of values to be converted. |
| 2279 | RET is the C array that contains the converted values. It is assumed | 2279 | RET is the C array that contains the converted values. |
| 2280 | it is big enough to hold all values. | 2280 | NELEMENTS_MAX is the number of values that will fit in RET. |
| 2281 | Any excess values in DATA are ignored. | ||
| 2281 | FORMAT is 8, 16 or 32 and denotes char/short/long for each C value to | 2282 | FORMAT is 8, 16 or 32 and denotes char/short/long for each C value to |
| 2282 | be stored in RET. Note that long is used for 32 even if long is more | 2283 | be stored in RET. Note that long is used for 32 even if long is more |
| 2283 | than 32 bits (see man pages for XChangeProperty, XGetWindowProperty and | 2284 | than 32 bits (see man pages for XChangeProperty, XGetWindowProperty and |
| 2284 | XClientMessageEvent). */ | 2285 | XClientMessageEvent). */ |
| 2285 | 2286 | ||
| 2286 | void | 2287 | void |
| 2287 | x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format) | 2288 | x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, |
| 2289 | int nelements_max, int format) | ||
| 2288 | { | 2290 | { |
| 2289 | unsigned long val; | 2291 | unsigned long val; |
| 2290 | unsigned long *d32 = (unsigned long *) ret; | 2292 | unsigned long *d32 = (unsigned long *) ret; |
| 2291 | unsigned short *d16 = (unsigned short *) ret; | 2293 | unsigned short *d16 = (unsigned short *) ret; |
| 2292 | unsigned char *d08 = (unsigned char *) ret; | 2294 | unsigned char *d08 = (unsigned char *) ret; |
| 2295 | int nelements; | ||
| 2293 | Lisp_Object iter; | 2296 | Lisp_Object iter; |
| 2294 | 2297 | ||
| 2295 | for (iter = data; CONSP (iter); iter = XCDR (iter)) | 2298 | for (iter = data, nelements = 0; |
| 2299 | CONSP (iter) && nelements < nelements_max; | ||
| 2300 | iter = XCDR (iter), nelements++) | ||
| 2296 | { | 2301 | { |
| 2297 | Lisp_Object o = XCAR (iter); | 2302 | Lisp_Object o = XCAR (iter); |
| 2298 | 2303 | ||
| @@ -2593,7 +2598,9 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, | |||
| 2593 | event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest; | 2598 | event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest; |
| 2594 | 2599 | ||
| 2595 | memset (event.xclient.data.l, 0, sizeof (event.xclient.data.l)); | 2600 | memset (event.xclient.data.l, 0, sizeof (event.xclient.data.l)); |
| 2601 | /* event.xclient.data can hold 20 chars, 10 shorts, or 5 longs. */ | ||
| 2596 | x_fill_property_data (dpyinfo->display, values, event.xclient.data.b, | 2602 | x_fill_property_data (dpyinfo->display, values, event.xclient.data.b, |
| 2603 | 5 * 32 / event.xclient.format, | ||
| 2597 | event.xclient.format); | 2604 | event.xclient.format); |
| 2598 | 2605 | ||
| 2599 | /* If event mask is 0 the event is sent to the client that created | 2606 | /* If event mask is 0 the event is sent to the client that created |