From 31a7994ac7365562ef1d00e0a7b25f967a961a4e Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Mon, 24 Sep 2007 13:33:01 -0400 Subject: Input: Return errors to the dispatcher instead of sending them ourself. Also fixed two "unused variable: stuff" warnings. --- Xi/setdval.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'Xi/setdval.c') diff --git a/Xi/setdval.c b/Xi/setdval.c index e947a749a..cb35b9157 100644 --- a/Xi/setdval.c +++ b/Xi/setdval.c @@ -56,13 +56,10 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "XIstubs.h" -#include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" @@ -106,24 +103,17 @@ ProcXSetDeviceValuators(ClientPtr client) rep.sequenceNumber = client->sequence; if (stuff->length != (sizeof(xSetDeviceValuatorsReq) >> 2) + - stuff->num_valuators) { - SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadLength); - return Success; - } + stuff->num_valuators) + return BadLength; + dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadDevice); - return Success; - } - if (dev->valuator == NULL) { - SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadMatch); - return Success; - } - - if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) { - SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadValue); - return Success; - } + if (dev == NULL) + return BadDevice; + if (dev->valuator == NULL) + return BadMatch; + + if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) + return BadValue; if ((dev->grab) && !SameClient(dev->grab, client)) rep.status = AlreadyGrabbed; @@ -133,11 +123,9 @@ ProcXSetDeviceValuators(ClientPtr client) stuff->num_valuators); if (rep.status != Success && rep.status != AlreadyGrabbed) - SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, - rep.status); - else - WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep); + return rep.status; + WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep); return Success; } -- cgit v1.2.3