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:
		
							parent
							
								
									1bd7fd195d
								
							
						
					
					
						commit
						b5f49382fe
					
				| 
						 | 
					@ -180,20 +180,8 @@ typedef struct _XkbSwitchScreenAction {
 | 
				
			||||||
typedef struct _XkbCtrlsAction {
 | 
					typedef struct _XkbCtrlsAction {
 | 
				
			||||||
	unsigned char	type;
 | 
						unsigned char	type;
 | 
				
			||||||
	unsigned char	flags;
 | 
						unsigned char	flags;
 | 
				
			||||||
        /* FIXME: Make this an int. */
 | 
						unsigned long	ctrls;
 | 
				
			||||||
	unsigned char	ctrls3;
 | 
					 | 
				
			||||||
	unsigned char	ctrls2;
 | 
					 | 
				
			||||||
	unsigned char	ctrls1;
 | 
					 | 
				
			||||||
	unsigned char	ctrls0;
 | 
					 | 
				
			||||||
} XkbCtrlsAction;
 | 
					} 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 {
 | 
					typedef struct _XkbMessageAction {
 | 
				
			||||||
	unsigned char	type;
 | 
						unsigned char	type;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -671,7 +671,7 @@ XkbEventCauseRec	cause;
 | 
				
			||||||
	filter->keycode = keycode;
 | 
						filter->keycode = keycode;
 | 
				
			||||||
	filter->active = 1;
 | 
						filter->active = 1;
 | 
				
			||||||
	filter->filterOthers = 0;
 | 
						filter->filterOthers = 0;
 | 
				
			||||||
	change= XkbActionCtrls(&pAction->ctrls);
 | 
						change= pAction->ctrls.ctrls;
 | 
				
			||||||
	filter->priv = change;
 | 
						filter->priv = change;
 | 
				
			||||||
	filter->filter = _XkbFilterControls;
 | 
						filter->filter = _XkbFilterControls;
 | 
				
			||||||
	filter->upAction = *pAction;
 | 
						filter->upAction = *pAction;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -890,7 +890,7 @@ unsigned		tmp;
 | 
				
			||||||
char			tbuf[32];
 | 
					char			tbuf[32];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    act= &action->ctrls;
 | 
					    act= &action->ctrls;
 | 
				
			||||||
    tmp= XkbActionCtrls(act);
 | 
					    tmp= act->ctrls;
 | 
				
			||||||
    TryCopyStr(buf,"controls=",sz);
 | 
					    TryCopyStr(buf,"controls=",sz);
 | 
				
			||||||
    if (tmp==0)
 | 
					    if (tmp==0)
 | 
				
			||||||
	TryCopyStr(buf,"none",sz);
 | 
						TryCopyStr(buf,"none",sz);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -503,10 +503,10 @@ XkbAction               *act;
 | 
				
			||||||
        case XkbSA_SetControls:
 | 
					        case XkbSA_SetControls:
 | 
				
			||||||
        case XkbSA_LockControls:
 | 
					        case XkbSA_LockControls:
 | 
				
			||||||
            act->ctrls.flags = wire.actionData[0];
 | 
					            act->ctrls.flags = wire.actionData[0];
 | 
				
			||||||
            act->ctrls.ctrls3 = wire.actionData[1];
 | 
					            act->ctrls.ctrls = (wire.actionData[1] << 24) | \
 | 
				
			||||||
            act->ctrls.ctrls2 = wire.actionData[2];
 | 
					                               (wire.actionData[2] << 16) | \
 | 
				
			||||||
            act->ctrls.ctrls1 = wire.actionData[3];
 | 
					                               (wire.actionData[3] << 8) | \
 | 
				
			||||||
            act->ctrls.ctrls0 = wire.actionData[4];
 | 
					                               wire.actionData[4];
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case XkbSA_RedirectKey:
 | 
					        case XkbSA_RedirectKey:
 | 
				
			||||||
            act->redirect.new_key = wire.actionData[0];
 | 
					            act->redirect.new_key = wire.actionData[0];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue