XKB: Sanitise ctrls action

Turn four unsigned chars into one unsigned long.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Daniel Stone 2008-04-25 19:52:11 +03:00
parent 1bd7fd195d
commit b5f49382fe
4 changed files with 7 additions and 19 deletions

View File

@ -180,20 +180,8 @@ typedef struct _XkbSwitchScreenAction {
typedef struct _XkbCtrlsAction {
unsigned char type;
unsigned char flags;
/* FIXME: Make this an int. */
unsigned char ctrls3;
unsigned char ctrls2;
unsigned char ctrls1;
unsigned char ctrls0;
unsigned long ctrls;
} XkbCtrlsAction;
#define XkbActionSetCtrls(a, c) ((a)->ctrls3 = ((c) >> 24) & 0xff, \
(a)->ctrls2 = ((c) >> 16) & 0xff, \
(a)->ctrls1 = ((c) >> 8) & 0xff, \
(a)->ctrls0 = (c) & 0xff)
#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
(((unsigned int)(a)->ctrls2)<<16)|\
(((unsigned int)(a)->ctrls1)<<8)|\
((unsigned int) (a)->ctrls0))
typedef struct _XkbMessageAction {
unsigned char type;

View File

@ -671,7 +671,7 @@ XkbEventCauseRec cause;
filter->keycode = keycode;
filter->active = 1;
filter->filterOthers = 0;
change= XkbActionCtrls(&pAction->ctrls);
change= pAction->ctrls.ctrls;
filter->priv = change;
filter->filter = _XkbFilterControls;
filter->upAction = *pAction;

View File

@ -890,7 +890,7 @@ unsigned tmp;
char tbuf[32];
act= &action->ctrls;
tmp= XkbActionCtrls(act);
tmp= act->ctrls;
TryCopyStr(buf,"controls=",sz);
if (tmp==0)
TryCopyStr(buf,"none",sz);

View File

@ -503,10 +503,10 @@ XkbAction *act;
case XkbSA_SetControls:
case XkbSA_LockControls:
act->ctrls.flags = wire.actionData[0];
act->ctrls.ctrls3 = wire.actionData[1];
act->ctrls.ctrls2 = wire.actionData[2];
act->ctrls.ctrls1 = wire.actionData[3];
act->ctrls.ctrls0 = wire.actionData[4];
act->ctrls.ctrls = (wire.actionData[1] << 24) | \
(wire.actionData[2] << 16) | \
(wire.actionData[3] << 8) | \
wire.actionData[4];
break;
case XkbSA_RedirectKey:
act->redirect.new_key = wire.actionData[0];