[PATCH:xf86-input-keyboard 07/21] Add translation table for AT/PS2 pseudo XT scancodes.

Thomas Klausner wiz at NetBSD.org
Sun Jul 28 06:50:50 PDT 2013


On Sat, Jul 27, 2013 at 11:27:59AM +0200, walter harms wrote:
> > +#define WS_XT_MAP_SIZE (sizeof(wsXtMap)/sizeof(unsigned char))
> > +
>
> I would be careful here, the type is CARD8, that may be or not
> size of unsigned char. I prefer using *wsXtMap or wsXtMap[0]
> that circumvents the problem very nicely.

I just followed the other examples in the file:
#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char))
#define WS_XT_MAP_SIZE (sizeof(wsXtMap)/sizeof(unsigned char))
#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char))
#define WS_LK201_MAP_SIZE (sizeof(wsLk201Map)/sizeof(unsigned char))
#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char))

I agree your suggestion is more stable, if something changes.

Should I change them all to use sizeof(*wsFOOMap) instead?
 Thomas


More information about the xorg-devel mailing list