summaryrefslogtreecommitdiff
path: root/Xi/setdval.c
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-09-24 13:33:01 -0400
committerEamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil>2007-09-26 07:26:59 -0400
commit31a7994ac7365562ef1d00e0a7b25f967a961a4e (patch)
treea2054c0e371e9c62396f2e09df469142dca0a633 /Xi/setdval.c
parent56ffc381d32687242dd094395fcf2216339bab2a (diff)
Input: Return errors to the dispatcher instead of sending them ourself.
Also fixed two "unused variable: stuff" warnings.
Diffstat (limited to 'Xi/setdval.c')
-rw-r--r--Xi/setdval.c36
1 files changed, 12 insertions, 24 deletions
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 <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#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;
}