# HG changeset patch # User Jan Dj¸«£rv # Date 1107898021 0 # Node ID 22a410b2373b2f6024a4eb06379da277ac02840d # Parent 6e49a3404a8e0cf44720c7d6db697de72f8ca02e * 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 -r 6e49a3404a8e -r 22a410b2373b src/ChangeLog --- a/src/ChangeLog Tue Feb 08 20:49:16 2005 +0000 +++ b/src/ChangeLog Tue Feb 08 21:27:01 2005 +0000 @@ -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 -r 6e49a3404a8e -r 22a410b2373b src/xselect.c --- a/src/xselect.c Tue Feb 08 20:49:16 2005 +0000 +++ b/src/xselect.c Tue Feb 08 21:27:01 2005 +0000 @@ -1769,7 +1769,11 @@ 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 @@ 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 @@ 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