+2005-02-08 Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
+
+ * 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 <monnier@iro.umontreal.ca>
* undo.c (Fprimitive_undo): Check veracity of delta,start,end.
When converting an object to C, it may be of the form (SYMBOL . <data>)
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). */
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;
}
}
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