diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-04-25 19:52:11 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2009-01-22 15:08:57 +1100 |
commit | b5f49382fe48f0a762d9a15fb10a7d7e1183fc8d (patch) | |
tree | 702b7695062535454d079b2409ccc06b5a7532e4 | |
parent | 1bd7fd195d85681e722161f8c636a28f11b40abb (diff) |
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>
-rw-r--r-- | include/xkbstr.h | 14 | ||||
-rw-r--r-- | xkb/xkbActions.c | 2 | ||||
-rw-r--r-- | xkb/xkbtext.c | 2 | ||||
-rw-r--r-- | xkb/xkmread.c | 8 |
4 files changed, 7 insertions, 19 deletions
diff --git a/include/xkbstr.h b/include/xkbstr.h index 193f27618..0a49ee1c4 100644 --- a/include/xkbstr.h +++ b/include/xkbstr.h @@ -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; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index cd2688744..4eb6b0bf8 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -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; diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index debc2f9c6..e91ab2e97 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -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); diff --git a/xkb/xkmread.c b/xkb/xkmread.c index 9ba14c41f..e4d3d4d9c 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -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]; |