From: Jan Djärv Date: Tue, 8 Feb 2005 21:27:01 +0000 (+0000) Subject: * xselect.c (selection_data_to_lisp_data): For the special case X-Git-Tag: ttn-vms-21-2-B4~2351 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b8d6f4af9785fe4f5a1343e9a3239af0be800e4d;p=emacs.git * xselect.c (selection_data_to_lisp_data): For the special case type == XA_ATOM, data contains array of int, not array of Atom. (x_property_data_to_lisp, selection_data_to_lisp_data): Comment update: data must be array of int for format == 32. --- diff --git a/src/ChangeLog b/src/ChangeLog index 4c628e025aa..aaf0ac1e3d0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2005-02-08 Jan Dj,Ad(Brv + + * xselect.c (selection_data_to_lisp_data): For the special case + type == XA_ATOM, data contains array of int, not array of Atom. + (x_property_data_to_lisp, selection_data_to_lisp_data): Comment + update: data must be array of int for format == 32. + 2005-02-08 Stefan Monnier * undo.c (Fprimitive_undo): Check veracity of delta,start,end. diff --git a/src/xselect.c b/src/xselect.c index f54e685873a..bf37cde4d0b 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -1769,7 +1769,11 @@ x_get_window_property_as_lisp_data (display, window, property, target_type, When converting an object to C, it may be of the form (SYMBOL . ) where SYMBOL is what we should claim that the type is. Format and - representation are as above. */ + representation are as above. + + Important: When format is 32, data should contain an array of int, + not an array of long as the X library returns. This makes a difference + when sizeof(long) != sizeof(int). */ @@ -1811,15 +1815,21 @@ selection_data_to_lisp_data (display, data, size, type, format) else if (type == XA_ATOM) { int i; - if (size == sizeof (Atom)) - return x_atom_to_symbol (display, *((Atom *) data)); + /* On a 64 bit machine sizeof(Atom) == sizeof(long) == 8. + But the callers of these function has made sure the data for + format == 32 is an array of int. Thus, use int instead + of Atom. */ + int *idata = (int *) data; + + if (size == sizeof (int)) + return x_atom_to_symbol (display, (Atom) idata[0]); else { - Lisp_Object v = Fmake_vector (make_number (size / sizeof (Atom)), + Lisp_Object v = Fmake_vector (make_number (size / sizeof (int)), make_number (0)); - for (i = 0; i < size / sizeof (Atom); i++) + for (i = 0; i < size / sizeof (int); i++) Faset (v, make_number (i), - x_atom_to_symbol (display, ((Atom *) data) [i])); + x_atom_to_symbol (display, (Atom) idata[i])); return v; } } @@ -2560,6 +2570,10 @@ x_fill_property_data (dpy, data, ret, format) be stored in RET. SIZE is the number of elements in DATA. + Important: When format is 32, data should contain an array of int, + not an array of long as the X library returns. This makes a difference + when sizeof(long) != sizeof(int). + Also see comment for selection_data_to_lisp_data above. */ Lisp_Object