[PATCH] XInput: protocol error handling cleanup
Eamon Walsh
ewalsh at tycho.nsa.gov
Mon Sep 24 16:06:20 PDT 2007
Error handling cleanup patch for XInput. Return errors to the dispatcher
instead of calling SendErrorToClient. Also fixes 2 "unused variable: stuff"
warnings.
Will commit to master, without objection.
Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
---
Xi/allowev.c | 12 +---
Xi/chgdctl.c | 15 +----
Xi/chgfctl.c | 179 ++++++++++++++++++--------------------------------------
Xi/chgkbd.c | 9 +--
Xi/chgkmap.c | 14 +----
Xi/chgprop.c | 36 ++++--------
Xi/chgptr.c | 9 +--
Xi/closedev.c | 9 +--
Xi/devbell.c | 18 ++----
Xi/extinit.c | 10 +---
Xi/getbmap.c | 18 ++----
Xi/getdctl.c | 39 ++++---------
Xi/getfctl.c | 21 ++-----
Xi/getfocus.c | 9 +--
Xi/getkmap.c | 23 ++------
Xi/getmmap.c | 18 ++----
Xi/getprop.c | 10 +---
Xi/getselev.c | 10 +---
Xi/getvers.c | 10 +---
Xi/grabdev.c | 49 ++++++----------
Xi/grabdevb.c | 36 ++++--------
Xi/grabdevk.c | 36 +++--------
Xi/gtmotion.c | 24 ++------
Xi/opendev.c | 21 ++-----
Xi/queryst.c | 15 +----
Xi/selectev.c | 32 +++-------
Xi/sendexev.c | 28 +++------
Xi/setbmap.c | 24 ++------
Xi/setdval.c | 36 ++++--------
Xi/setfocus.c | 13 +---
Xi/setmmap.c | 17 +----
Xi/setmode.c | 21 ++-----
Xi/ungrdev.c | 9 +--
Xi/ungrdevb.c | 41 ++++---------
Xi/ungrdevk.c | 48 +++++----------
35 files changed, 267 insertions(+), 652 deletions(-)
diff --git a/Xi/allowev.c b/Xi/allowev.c
index 85b6eaf..cf075e1 100644
--- a/Xi/allowev.c
+++ b/Xi/allowev.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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -103,10 +100,8 @@ ProcXAllowDeviceEvents(ClientPtr client)
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
thisdev = LookupDeviceIntRec(stuff->deviceid);
- if (thisdev == NULL) {
- SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice);
- return Success;
- }
+ if (thisdev == NULL)
+ return BadDevice;
time = ClientTimeToServerTime(stuff->time);
switch (stuff->mode) {
@@ -129,9 +124,8 @@ ProcXAllowDeviceEvents(ClientPtr client)
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
- SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadValue);
client->errorValue = stuff->mode;
- return Success;
+ return BadValue;
}
return Success;
}
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index 9676fb7..055f459 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -56,14 +56,11 @@ 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> /* control constants */
#include "XIstubs.h"
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "exevents.h"
@@ -153,11 +150,8 @@ ProcXChangeDeviceControl(ClientPtr client)
a = &dev->valuator->axes[r->first_valuator];
for (i = 0; i < r->num_valuators; i++)
if (*(resolution + i) < (a + i)->min_resolution ||
- *(resolution + i) > (a + i)->max_resolution) {
- SendErrorToClient(client, IReqCode,
- X_ChangeDeviceControl, 0, BadValue);
- return Success;
- }
+ *(resolution + i) > (a + i)->max_resolution)
+ return BadValue;
for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++;
@@ -269,11 +263,8 @@ out:
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
}
- else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret);
- }
- return Success;
+ return ret;
}
/***********************************************************************
diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c
index 2e0e13c..46bb8e7 100644
--- a/Xi/chgfctl.c
+++ b/Xi/chgfctl.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> /* control constants */
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -119,9 +116,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
t = defaultKeyboardControl.click;
else if (t < 0 || t > 100) {
client->errorValue = t;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
}
kctrl.click = t;
}
@@ -132,9 +127,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) {
client->errorValue = t;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
}
kctrl.bell = t;
}
@@ -145,9 +138,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
t = defaultKeyboardControl.bell_pitch;
else if (t < 0) {
client->errorValue = t;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
}
kctrl.bell_pitch = t;
}
@@ -158,9 +149,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
t = defaultKeyboardControl.bell_duration;
else if (t < 0) {
client->errorValue = t;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
}
kctrl.bell_duration = t;
}
@@ -174,15 +163,10 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
key = (KeyCode) f->key;
if (key < 8 || key > 255) {
client->errorValue = key;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
- }
- if (!(mask & DvAutoRepeatMode)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadMatch);
- return Success;
+ return BadValue;
}
+ if (!(mask & DvAutoRepeatMode))
+ return BadMatch;
}
if (mask & DvAutoRepeatMode) {
@@ -210,9 +194,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
(defaultKeyboardControl.autoRepeats[inx] & kmask);
} else {
client->errorValue = t;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
}
}
@@ -250,9 +232,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
pctrl.num = defaultPointerControl.num;
else if (accelNum < 0) {
client->errorValue = accelNum;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
} else
pctrl.num = accelNum;
}
@@ -265,9 +245,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
pctrl.den = defaultPointerControl.den;
else if (accelDenom <= 0) {
client->errorValue = accelDenom;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
} else
pctrl.den = accelDenom;
}
@@ -280,9 +258,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
pctrl.threshold = defaultPointerControl.threshold;
else if (threshold < 0) {
client->errorValue = threshold;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
} else
pctrl.threshold = threshold;
}
@@ -341,21 +317,16 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
}
}
- if (f->num_keysyms > s->ctrl.max_symbols) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
- }
+ if (f->num_keysyms > s->ctrl.max_symbols)
+ return BadValue;
+
sup_syms = s->ctrl.symbols_supported;
for (i = 0; i < f->num_keysyms; i++) {
for (j = 0; j < s->ctrl.num_symbols_supported; j++)
if (*(syms + i) == *(sup_syms + j))
break;
- if (j == s->ctrl.num_symbols_supported) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadMatch);
- return Success;
- }
+ if (j == s->ctrl.num_symbols_supported)
+ return BadMatch;
}
s->ctrl.num_symbols_displayed = f->num_keysyms;
@@ -393,9 +364,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
t = defaultKeyboardControl.bell;
else if (t < 0 || t > 100) {
client->errorValue = t;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
}
bctrl.percent = t;
}
@@ -406,9 +375,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
t = defaultKeyboardControl.bell_pitch;
else if (t < 0) {
client->errorValue = t;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
}
bctrl.pitch = t;
}
@@ -419,9 +386,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
t = defaultKeyboardControl.bell_duration;
else if (t < 0) {
client->errorValue = t;
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadValue);
- return Success;
+ return BadValue;
}
bctrl.duration = t;
}
@@ -485,38 +450,27 @@ ProcXChangeFeedbackControl(ClientPtr client)
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
switch (stuff->feedbackid) {
case KbdFeedbackClass:
- if (len != (sizeof(xKbdFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
+ if (len != (sizeof(xKbdFeedbackCtl) >> 2))
+ return BadLength;
+
for (k = dev->kbdfeed; k; k = k->next)
- if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) {
- ChangeKbdFeedback(client, dev, stuff->mask, k,
- (xKbdFeedbackCtl *) & stuff[1]);
- return Success;
- }
+ if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id)
+ return ChangeKbdFeedback(client, dev, stuff->mask, k,
+ (xKbdFeedbackCtl *) & stuff[1]);
break;
case PtrFeedbackClass:
- if (len != (sizeof(xPtrFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
+ if (len != (sizeof(xPtrFeedbackCtl) >> 2))
+ return BadLength;
+
for (p = dev->ptrfeed; p; p = p->next)
- if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) {
- ChangePtrFeedback(client, dev, stuff->mask, p,
- (xPtrFeedbackCtl *) & stuff[1]);
- return Success;
- }
+ if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id)
+ return ChangePtrFeedback(client, dev, stuff->mask, p,
+ (xPtrFeedbackCtl *) & stuff[1]);
break;
case StringFeedbackClass:
{
@@ -526,63 +480,46 @@ ProcXChangeFeedbackControl(ClientPtr client)
if (client->swapped) {
swaps(&f->num_keysyms, n);
}
- if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
+ if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms))
+ return BadLength;
+
for (s = dev->stringfeed; s; s = s->next)
- if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) {
- ChangeStringFeedback(client, dev, stuff->mask, s,
- (xStringFeedbackCtl *) & stuff[1]);
- return Success;
- }
+ if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id)
+ return ChangeStringFeedback(client, dev, stuff->mask, s,
+ (xStringFeedbackCtl *) & stuff[1]);
break;
}
case IntegerFeedbackClass:
- if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
+ if (len != (sizeof(xIntegerFeedbackCtl) >> 2))
+ return BadLength;
+
for (i = dev->intfeed; i; i = i->next)
- if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) {
- ChangeIntegerFeedback(client, dev, stuff->mask, i,
- (xIntegerFeedbackCtl *) & stuff[1]);
- return Success;
- }
+ if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
+ return ChangeIntegerFeedback(client, dev, stuff->mask, i,
+ (xIntegerFeedbackCtl *)&stuff[1]);
break;
case LedFeedbackClass:
- if (len != (sizeof(xLedFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
+ if (len != (sizeof(xLedFeedbackCtl) >> 2))
+ return BadLength;
+
for (l = dev->leds; l; l = l->next)
- if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) {
- ChangeLedFeedback(client, dev, stuff->mask, l,
- (xLedFeedbackCtl *) & stuff[1]);
- return Success;
- }
+ if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id)
+ return ChangeLedFeedback(client, dev, stuff->mask, l,
+ (xLedFeedbackCtl *) & stuff[1]);
break;
case BellFeedbackClass:
- if (len != (sizeof(xBellFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
+ if (len != (sizeof(xBellFeedbackCtl) >> 2))
+ return BadLength;
+
for (b = dev->bell; b; b = b->next)
- if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) {
- ChangeBellFeedback(client, dev, stuff->mask, b,
- (xBellFeedbackCtl *) & stuff[1]);
- return Success;
- }
+ if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id)
+ return ChangeBellFeedback(client, dev, stuff->mask, b,
+ (xBellFeedbackCtl *) & stuff[1]);
break;
default:
break;
}
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
- return Success;
+ return BadMatch;
}
diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c
index 2cf8225..83de646 100644
--- a/Xi/chgkbd.c
+++ b/Xi/chgkbd.c
@@ -56,14 +56,11 @@ 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 "globals.h"
-#include "extnsionst.h"
#include "exevents.h"
#include "exglobals.h"
@@ -98,10 +95,8 @@ SProcXChangeKeyboardDevice(ClientPtr client)
int
ProcXChangeKeyboardDevice(ClientPtr client)
{
- REQUEST(xChangeKeyboardDeviceReq);
+ /* REQUEST(xChangeKeyboardDeviceReq); */
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadDevice);
- return Success;
+ return BadDevice;
}
diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c
index eac520f..bfdc1ce 100644
--- a/Xi/chgkmap.c
+++ b/Xi/chgkmap.c
@@ -56,12 +56,9 @@ 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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -111,18 +108,13 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0,
- BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes,
stuff->keySymsPerKeyCode, (KeySym *) & stuff[1]);
- if (ret != Success)
- SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0, ret);
- return Success;
+ return ret;
}
diff --git a/Xi/chgprop.c b/Xi/chgprop.c
index 59a93c6..13463dd 100644
--- a/Xi/chgprop.c
+++ b/Xi/chgprop.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 "windowstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
@@ -115,30 +112,22 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (stuff->length != (sizeof(xChangeDeviceDontPropagateListReq) >> 2) +
- stuff->count) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
- BadLength);
- return Success;
- }
+ stuff->count)
+ return BadLength;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
- if (rc != Success) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
- rc);
- return Success;
- }
+ if (rc != Success)
+ return rc;
if (stuff->mode != AddToList && stuff->mode != DeleteFromList) {
client->errorValue = stuff->window;
- SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
- BadMode);
- return Success;
+ return BadMode;
}
- if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
- stuff->count, tmp, NULL,
- X_ChangeDeviceDontPropagateList) != Success)
- return Success;
+ if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
+ stuff->count, tmp, NULL,
+ X_ChangeDeviceDontPropagateList)) != Success)
+ return rc;
others = wOtherInputMasks(pWin);
if (!others && stuff->mode == DeleteFromList)
@@ -153,11 +142,8 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
tmp[i].mask |= others->dontPropagateMask[i];
if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) !=
- Success) {
- SendErrorToClient(client, IReqCode,
- X_ChangeDeviceDontPropagateList, 0, BadClass);
- return Success;
- }
+ Success)
+ return BadClass;
}
return Success;
diff --git a/Xi/chgptr.c b/Xi/chgptr.c
index a949068..2ce81d1 100644
--- a/Xi/chgptr.c
+++ b/Xi/chgptr.c
@@ -56,8 +56,6 @@ 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>
@@ -65,7 +63,6 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "dixevents.h"
@@ -101,10 +98,8 @@ SProcXChangePointerDevice(ClientPtr client)
int
ProcXChangePointerDevice(ClientPtr client)
{
- REQUEST(xChangePointerDeviceReq);
+ /* REQUEST(xChangePointerDeviceReq); */
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
- BadDevice);
- return Success;
+ return BadDevice;
}
diff --git a/Xi/closedev.c b/Xi/closedev.c
index 8d38ec8..1ec3fa1 100644
--- a/Xi/closedev.c
+++ b/Xi/closedev.c
@@ -56,15 +56,12 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -151,10 +148,8 @@ ProcXCloseDevice(ClientPtr client)
REQUEST_SIZE_MATCH(xCloseDeviceReq);
d = LookupDeviceIntRec(stuff->deviceid);
- if (d == NULL) {
- SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
- return Success;
- }
+ if (d == NULL)
+ return BadDevice;
if (d->grab && SameClient(d->grab, client))
(*d->DeactivateGrab) (d); /* release active grab */
diff --git a/Xi/devbell.c b/Xi/devbell.c
index ba873c7..83e844d 100644
--- a/Xi/devbell.c
+++ b/Xi/devbell.c
@@ -56,12 +56,9 @@ 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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -108,14 +105,12 @@ ProcXDeviceBell(ClientPtr client)
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
client->errorValue = stuff->deviceid;
- SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice);
- return Success;
+ return BadDevice;
}
if (stuff->percent < -100 || stuff->percent > 100) {
client->errorValue = stuff->percent;
- SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
- return Success;
+ return BadValue;
}
if (stuff->feedbackclass == KbdFeedbackClass) {
for (k = dev->kbdfeed; k; k = k->next)
@@ -123,8 +118,7 @@ ProcXDeviceBell(ClientPtr client)
break;
if (!k) {
client->errorValue = stuff->feedbackid;
- SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
- return Success;
+ return BadValue;
}
base = k->ctrl.bell;
proc = k->BellProc;
@@ -136,8 +130,7 @@ ProcXDeviceBell(ClientPtr client)
break;
if (!b) {
client->errorValue = stuff->feedbackid;
- SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
- return Success;
+ return BadValue;
}
base = b->ctrl.percent;
proc = b->BellProc;
@@ -145,8 +138,7 @@ ProcXDeviceBell(ClientPtr client)
class = BellFeedbackClass;
} else {
client->errorValue = stuff->feedbackclass;
- SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
- return Success;
+ return BadValue;
}
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)
diff --git a/Xi/extinit.c b/Xi/extinit.c
index b1ec321..a61746e 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -58,8 +58,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h>
-#include <X11/Xproto.h>
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
@@ -289,9 +287,7 @@ ProcIDispatch(ClientPtr client)
return (ProcXGetDeviceControl(client));
else if (stuff->data == X_ChangeDeviceControl)
return (ProcXChangeDeviceControl(client));
- else {
- SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
- }
+
return (BadRequest);
}
@@ -378,9 +374,7 @@ SProcIDispatch(ClientPtr client)
return (SProcXGetDeviceControl(client));
else if (stuff->data == X_ChangeDeviceControl)
return (SProcXChangeDeviceControl(client));
- else {
- SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
- }
+
return (BadRequest);
}
diff --git a/Xi/getbmap.c b/Xi/getbmap.c
index 5e8cf07..ebb0613 100644
--- a/Xi/getbmap.c
+++ b/Xi/getbmap.c
@@ -56,12 +56,9 @@ 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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -106,18 +103,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
- BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
b = dev->button;
- if (b == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
- BadMatch);
- return Success;
- }
+ if (b == NULL)
+ return BadMatch;
+
rep.nElts = b->numButtons;
rep.length = (rep.nElts + (4 - 1)) / 4;
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 88f061e..8a84e91 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -56,12 +56,9 @@ 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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -250,10 +247,8 @@ ProcXGetDeviceControl(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
rep.repType = X_Reply;
rep.RepType = X_GetDeviceControl;
@@ -262,29 +257,20 @@ ProcXGetDeviceControl(ClientPtr client)
switch (stuff->control) {
case DEVICE_RESOLUTION:
- if (!dev->valuator) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
- BadMatch);
- return Success;
- }
+ if (!dev->valuator)
+ return BadMatch;
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
case DEVICE_ABS_CALIB:
- if (!dev->absolute) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
- BadMatch);
- return Success;
- }
+ if (!dev->absolute)
+ return BadMatch;
total_length = sizeof(xDeviceAbsCalibCtl);
break;
case DEVICE_ABS_AREA:
- if (!dev->absolute) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
- BadMatch);
- return Success;
- }
+ if (!dev->absolute)
+ return BadMatch;
total_length = sizeof(xDeviceAbsAreaCtl);
break;
@@ -295,15 +281,12 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceEnableCtl);
break;
default:
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
- return Success;
+ return BadValue;
}
buf = (char *)xalloc(total_length);
- if (!buf) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc);
- return Success;
- }
+ if (!buf)
+ return BadAlloc;
savbuf = buf;
switch (stuff->control) {
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index 5ca90db..7dff32f 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -56,12 +56,9 @@ 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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -308,10 +305,8 @@ ProcXGetFeedbackControl(ClientPtr client)
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
rep.repType = X_Reply;
rep.RepType = X_GetFeedbackControl;
@@ -345,16 +340,12 @@ ProcXGetFeedbackControl(ClientPtr client)
total_length += sizeof(xBellFeedbackState);
}
- if (total_length == 0) {
- SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch);
- return Success;
- }
+ if (total_length == 0)
+ return BadMatch;
buf = (char *)xalloc(total_length);
- if (!buf) {
- SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc);
- return Success;
- }
+ if (!buf)
+ return BadAlloc;
savbuf = buf;
for (k = dev->kbdfeed; k; k = k->next)
diff --git a/Xi/getfocus.c b/Xi/getfocus.c
index 245b5f1..073913b 100644
--- a/Xi/getfocus.c
+++ b/Xi/getfocus.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 "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -101,10 +98,8 @@ ProcXGetDeviceFocus(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceFocusReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL || !dev->focus) {
- SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL || !dev->focus)
+ return BadDevice;
rep.repType = X_Reply;
rep.RepType = X_GetDeviceFocus;
diff --git a/Xi/getkmap.c b/Xi/getkmap.c
index 989f3d5..eaa0cff 100644
--- a/Xi/getkmap.c
+++ b/Xi/getkmap.c
@@ -56,12 +56,9 @@ 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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
@@ -102,29 +99,21 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0,
- BadDevice);
- return Success;
- }
-
- if (dev->key == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadMatch);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
+ if (dev->key == NULL)
+ return BadMatch;
k = &dev->key->curKeySyms;
if ((stuff->firstKeyCode < k->minKeyCode) ||
(stuff->firstKeyCode > k->maxKeyCode)) {
client->errorValue = stuff->firstKeyCode;
- SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
- return Success;
+ return BadValue;
}
if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) {
client->errorValue = stuff->count;
- SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue);
- return Success;
+ return BadValue;
}
rep.repType = X_Reply;
diff --git a/Xi/getmmap.c b/Xi/getmmap.c
index 038937e..8a99d63 100644
--- a/Xi/getmmap.c
+++ b/Xi/getmmap.c
@@ -56,12 +56,9 @@ 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> /* Request macro */
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -102,18 +99,13 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
- BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
kp = dev->key;
- if (kp == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0,
- BadMatch);
- return Success;
- }
+ if (kp == NULL)
+ return BadMatch;
+
maxkeys = kp->maxKeysPerModifier;
rep.repType = X_Reply;
diff --git a/Xi/getprop.c b/Xi/getprop.c
index 6fa1986..531e65f 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.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 "windowstr.h" /* window structs */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
@@ -116,11 +113,8 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
rep.count = 0;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
- if (rc != Success) {
- SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
- rc);
- return Success;
- }
+ if (rc != Success)
+ return rc;
if ((others = wOtherInputMasks(pWin)) != 0) {
for (i = 0; i < EMASKSIZE; i++)
diff --git a/Xi/getselev.c b/Xi/getselev.c
index 9c5f219..819b2db 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.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 <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "swaprep.h"
@@ -118,11 +115,8 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
rep.all_clients_count = 0;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
- if (rc != Success) {
- SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
- rc);
- return Success;
- }
+ if (rc != Success)
+ return rc;
if ((pOthers = wOtherInputMasks(pWin)) != 0) {
for (others = pOthers->inputClients; others; others = others->next)
diff --git a/Xi/getvers.c b/Xi/getvers.c
index b3f4c1c..a223a5d 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -56,12 +56,9 @@ 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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -102,11 +99,8 @@ ProcXGetExtensionVersion(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
if (stuff->length != (sizeof(xGetExtensionVersionReq) +
- stuff->nbytes + 3) >> 2) {
- SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0,
- BadLength);
- return Success;
- }
+ stuff->nbytes + 3) >> 2)
+ return BadLength;
rep.repType = X_Reply;
rep.RepType = X_GetExtensionVersion;
diff --git a/Xi/grabdev.c b/Xi/grabdev.c
index e2809ef..b303695 100644
--- a/Xi/grabdev.c
+++ b/Xi/grabdev.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 "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixevents.h" /* GrabDevice */
@@ -109,7 +106,7 @@ SProcXGrabDevice(ClientPtr client)
int
ProcXGrabDevice(ClientPtr client)
{
- int error;
+ int rc;
xGrabDeviceReply rep;
DeviceIntPtr dev;
struct tmask tmp[EMASKSIZE];
@@ -117,10 +114,8 @@ ProcXGrabDevice(ClientPtr client)
REQUEST(xGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
- if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count) {
- SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadLength);
- return Success;
- }
+ if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count)
+ return BadLength;
rep.repType = X_Reply;
rep.RepType = X_GrabDevice;
@@ -128,25 +123,22 @@ ProcXGrabDevice(ClientPtr client)
rep.length = 0;
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
- if (CreateMaskFromList(client, (XEventClass *) & stuff[1],
- stuff->event_count, tmp, dev,
- X_GrabDevice) != Success)
- return Success;
+ if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1],
+ stuff->event_count, tmp, dev,
+ X_GrabDevice)) != Success)
+ return rc;
- error = GrabDevice(client, dev, stuff->this_device_mode,
- stuff->other_devices_mode, stuff->grabWindow,
- stuff->ownerEvents, stuff->time,
- tmp[stuff->deviceid].mask, &rep.status);
+ rc = GrabDevice(client, dev, stuff->this_device_mode,
+ stuff->other_devices_mode, stuff->grabWindow,
+ stuff->ownerEvents, stuff->time,
+ tmp[stuff->deviceid].mask, &rep.status);
+
+ if (rc != Success)
+ return rc;
- if (error != Success) {
- SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);
- return Success;
- }
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success;
}
@@ -172,15 +164,12 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
for (i = 0; i < count; i++, list++) {
device = *list >> 8;
- if (device > 255) {
- SendErrorToClient(client, IReqCode, req, 0, BadClass);
+ if (device > 255)
return BadClass;
- }
+
tdev = LookupDeviceIntRec(device);
- if (tdev == NULL || (dev != NULL && tdev != dev)) {
- SendErrorToClient(client, IReqCode, req, 0, BadClass);
+ if (tdev == NULL || (dev != NULL && tdev != dev))
return BadClass;
- }
for (j = 0; j < ExtEventIndex; j++)
if (EventInfo[j].type == (*list & 0xff)) {
diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
index df62d0c..21e46fc 100644
--- a/Xi/grabdevb.c
+++ b/Xi/grabdevb.c
@@ -56,14 +56,11 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -117,28 +114,19 @@ ProcXGrabDeviceButton(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
if (stuff->length !=
- (sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadLength);
- return Success;
- }
+ (sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count)
+ return BadLength;
dev = LookupDeviceIntRec(stuff->grabbed_device);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
+
if (stuff->modifier_device != UseXKeyboard) {
mdev = LookupDeviceIntRec(stuff->modifier_device);
- if (mdev == NULL) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
- BadDevice);
- return Success;
- }
- if (mdev->key == NULL) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
- BadMatch);
- return Success;
- }
+ if (mdev == NULL)
+ return BadDevice;
+ if (mdev->key == NULL)
+ return BadMatch;
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
@@ -147,13 +135,11 @@ ProcXGrabDeviceButton(ClientPtr client)
if ((ret = CreateMaskFromList(client, class,
stuff->event_count, tmp, dev,
X_GrabDeviceButton)) != Success)
- return Success;
+ return ret;
ret = GrabButton(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev,
stuff->button, stuff->grabWindow, stuff->ownerEvents,
(Cursor) 0, (Window) 0, tmp[stuff->grabbed_device].mask);
- if (ret != Success)
- SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret);
- return (Success);
+ return ret;
}
diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
index b74592f..8da36ba 100644
--- a/Xi/grabdevk.c
+++ b/Xi/grabdevk.c
@@ -56,14 +56,11 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exevents.h"
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -115,27 +112,19 @@ ProcXGrabDeviceKey(ClientPtr client)
REQUEST(xGrabDeviceKeyReq);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
- if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadLength);
- return Success;
- }
+ if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count)
+ return BadLength;
dev = LookupDeviceIntRec(stuff->grabbed_device);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
if (stuff->modifier_device != UseXKeyboard) {
mdev = LookupDeviceIntRec(stuff->modifier_device);
- if (mdev == NULL) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice);
- return Success;
- }
- if (mdev->key == NULL) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadMatch);
- return Success;
- }
+ if (mdev == NULL)
+ return BadDevice;
+ if (mdev->key == NULL)
+ return BadMatch;
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
@@ -144,17 +133,12 @@ ProcXGrabDeviceKey(ClientPtr client)
if ((ret = CreateMaskFromList(client, class,
stuff->event_count, tmp, dev,
X_GrabDeviceKey)) != Success)
- return Success;
+ return ret;
ret = GrabKey(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev,
stuff->key, stuff->grabWindow, stuff->ownerEvents,
tmp[stuff->grabbed_device].mask);
- if (ret != Success) {
- SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret);
- return Success;
- }
-
- return Success;
+ return ret;
}
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index cfc7f89..51d4248 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -56,12 +56,9 @@ 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 "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -110,17 +107,11 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
- BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
v = dev->valuator;
- if (v == NULL || v->numAxes == 0) {
- SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
- BadMatch);
- return Success;
- }
+ if (v == NULL || v->numAxes == 0)
+ return BadMatch;
if (dev->valuator->motionHintWindow)
MaybeStopDeviceHint(dev, client);
axes = v->numAxes;
@@ -145,11 +136,8 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
size = sizeof(Time) + (axes * sizeof(INT32));
tsize = num_events * size;
coords = (INT32 *) ALLOCATE_LOCAL(tsize);
- if (!coords) {
- SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
- BadAlloc);
- return Success;
- }
+ if (!coords)
+ return BadAlloc;
rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */
start.milliseconds, stop.milliseconds,
(ScreenPtr) NULL);
diff --git a/Xi/opendev.c b/Xi/opendev.c
index 0b0671d..dfefe05 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -56,14 +56,11 @@ 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 "windowstr.h" /* window structure */
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -107,26 +104,20 @@ ProcXOpenDevice(ClientPtr client)
REQUEST_SIZE_MATCH(xOpenDeviceReq);
if (stuff->deviceid == inputInfo.pointer->id ||
- stuff->deviceid == inputInfo.keyboard->id) {
- SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
- return Success;
- }
+ stuff->deviceid == inputInfo.keyboard->id)
+ return BadDevice;
if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) { /* not open */
for (dev = inputInfo.off_devices; dev; dev = dev->next)
if (dev->id == stuff->deviceid)
break;
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
}
OpenInputDevice(dev, client, &status);
- if (status != Success) {
- SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status);
- return Success;
- }
+ if (status != Success)
+ return status;
rep.repType = X_Reply;
rep.RepType = X_OpenDevice;
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 972cd2c..2b66b7e 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -38,13 +38,10 @@ from The Open Group.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -100,10 +97,8 @@ ProcXQueryDeviceState(ClientPtr client)
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
v = dev->valuator;
if (v != NULL && v->motionHintWindow != NULL)
@@ -126,10 +121,8 @@ ProcXQueryDeviceState(ClientPtr client)
num_classes++;
}
buf = (char *)xalloc(total_length);
- if (!buf) {
- SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadAlloc);
- return Success;
- }
+ if (!buf)
+ return BadAlloc;
savbuf = buf;
if (k != NULL) {
diff --git a/Xi/selectev.c b/Xi/selectev.c
index d52db1b..a5cf567 100644
--- a/Xi/selectev.c
+++ b/Xi/selectev.c
@@ -57,13 +57,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 "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -164,40 +161,29 @@ ProcXSelectExtensionEvent(ClientPtr client)
REQUEST(xSelectExtensionEventReq);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
- if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count) {
- SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
- BadLength);
- return Success;
- }
+ if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count)
+ return BadLength;
ret = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
- if (ret != Success) {
- SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, ret);
- return Success;
- }
+ if (ret != Success)
+ return ret;
if (HandleDevicePresenceMask(client, pWin, (XEventClass *) & stuff[1],
- &stuff->count) != Success) {
- SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
- BadAlloc);
- return Success;
- }
+ &stuff->count) != Success)
+ return BadAlloc;
if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL,
X_SelectExtensionEvent)) != Success)
- return Success;
+ return ret;
for (i = 0; i < EMASKSIZE; i++)
if (tmp[i].dev != NULL) {
if ((ret =
SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
tmp[i].mask, ExtExclusiveMasks[i],
- ExtValidMasks[i])) != Success) {
- SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
- ret);
- return Success;
- }
+ ExtValidMasks[i])) != Success)
+ return ret;
}
return Success;
diff --git a/Xi/sendexev.c b/Xi/sendexev.c
index eac9abe..20b415a 100644
--- a/Xi/sendexev.c
+++ b/Xi/sendexev.c
@@ -57,13 +57,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 "windowstr.h" /* Window */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -131,38 +128,29 @@ ProcXSendExtensionEvent(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count +
- (stuff->num_events * (sizeof(xEvent) >> 2))) {
- SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadLength);
- return Success;
- }
+ (stuff->num_events * (sizeof(xEvent) >> 2)))
+ return BadLength;
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
/* The client's event type must be one defined by an extension. */
first = ((xEvent *) & stuff[1]);
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
- (first->u.u.type < lastEvent))) {
+ (first->u.u.type < lastEvent)))
client->errorValue = first->u.u.type;
- SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadValue);
- return Success;
- }
+ return BadValue;
list = (XEventClass *) (first + stuff->num_events);
if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
X_SendExtensionEvent)) != Success)
- return Success;
+ return ret;
ret = (SendEvent(client, dev, stuff->destination,
stuff->propagate, (xEvent *) & stuff[1],
tmp[stuff->deviceid].mask, stuff->num_events));
- if (ret != Success)
- SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret);
-
- return Success;
+ return ret;
}
diff --git a/Xi/setbmap.c b/Xi/setbmap.c
index 1f5970d..40f0f9a 100644
--- a/Xi/setbmap.c
+++ b/Xi/setbmap.c
@@ -59,13 +59,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 "exevents.h"
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -104,11 +101,8 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) +
- stuff->map_length + 3) >> 2) {
- SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
- BadLength);
- return Success;
- }
+ stuff->map_length + 3) >> 2)
+ return BadLength;
rep.repType = X_Reply;
rep.RepType = X_SetDeviceButtonMapping;
@@ -117,18 +111,14 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
rep.status = MappingSuccess;
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
- BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]);
- if (ret == BadValue || ret == BadMatch) {
- SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, ret);
- return Success;
- } else {
+ if (ret == BadValue || ret == BadMatch)
+ return ret;
+ else {
rep.status = ret;
WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
}
diff --git a/Xi/setdval.c b/Xi/setdval.c
index e947a74..cb35b91 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;
}
diff --git a/Xi/setfocus.c b/Xi/setfocus.c
index aaf88ce..74de17e 100644
--- a/Xi/setfocus.c
+++ b/Xi/setfocus.c
@@ -56,8 +56,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
@@ -65,7 +63,6 @@ SOFTWARE.
#include "dixevents.h"
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -106,15 +103,11 @@ ProcXSetDeviceFocus(ClientPtr client)
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
dev = LookupDeviceIntRec(stuff->device);
- if (dev == NULL || !dev->focus) {
- SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL || !dev->focus)
+ return BadDevice;
ret = SetInputFocus(client, dev, stuff->focus, stuff->revertTo,
stuff->time, TRUE);
- if (ret != Success)
- SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret);
- return Success;
+ return ret;
}
diff --git a/Xi/setmmap.c b/Xi/setmmap.c
index e30213e..19ec71b 100644
--- a/Xi/setmmap.c
+++ b/Xi/setmmap.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 "exevents.h"
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -103,11 +100,8 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0,
- BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
rep.repType = X_Reply;
rep.RepType = X_SetDeviceModifierMapping;
@@ -125,11 +119,8 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
SendDeviceMappingNotify(client, MappingModifier, 0, 0, dev);
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),
&rep);
- } else {
- if (ret == -1)
- ret = BadValue;
- SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, ret);
- }
+ } else if (ret == -1)
+ return BadValue;
return Success;
}
diff --git a/Xi/setmode.c b/Xi/setmode.c
index 688f2a2..957721c 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.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"
@@ -105,14 +102,10 @@ ProcXSetDeviceMode(ClientPtr client)
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadDevice);
- return Success;
- }
- if (dev->valuator == NULL) {
- SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
+ if (dev->valuator == NULL)
+ return BadMatch;
if ((dev->grab) && !SameClient(dev->grab, client))
rep.status = AlreadyGrabbed;
else
@@ -120,10 +113,8 @@ ProcXSetDeviceMode(ClientPtr client)
if (rep.status == Success)
dev->valuator->mode = stuff->mode;
- else if (rep.status != AlreadyGrabbed) {
- SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status);
- return Success;
- }
+ else if (rep.status != AlreadyGrabbed)
+ return rep.status;
WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep);
return Success;
diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c
index 0abbd2e..505d669 100644
--- a/Xi/ungrdev.c
+++ b/Xi/ungrdev.c
@@ -56,12 +56,9 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <X11/X.h> /* for inputstr.h */
-#include <X11/Xproto.h> /* Request macro */
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
@@ -102,10 +99,8 @@ ProcXUngrabDevice(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
grab = dev->grab;
time = ClientTimeToServerTime(stuff->time);
diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c
index b9f236b..0dfe805 100644
--- a/Xi/ungrdevb.c
+++ b/Xi/ungrdevb.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 "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixgrabs.h"
@@ -111,41 +108,27 @@ ProcXUngrabDeviceButton(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
dev = LookupDeviceIntRec(stuff->grabbed_device);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadDevice);
- return Success;
- }
- if (dev->button == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
+ if (dev->button == NULL)
+ return BadMatch;
if (stuff->modifier_device != UseXKeyboard) {
mdev = LookupDeviceIntRec(stuff->modifier_device);
- if (mdev == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
- BadDevice);
- return Success;
- }
- if (mdev->key == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
- BadMatch);
- return Success;
- }
+ if (mdev == NULL)
+ return BadDevice;
+ if (mdev->key == NULL)
+ return BadMatch;
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
- if (rc != Success) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, rc);
- return Success;
- }
+ if (rc != Success)
+ return rc;
if ((stuff->modifiers != AnyModifier) &&
- (stuff->modifiers & ~AllModifiersMask)) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadValue);
- return Success;
- }
+ (stuff->modifiers & ~AllModifiersMask))
+ return BadValue;
temporaryGrab.resource = client->clientAsMask;
temporaryGrab.device = dev;
diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c
index d316990..e6307af 100644
--- a/Xi/ungrdevk.c
+++ b/Xi/ungrdevk.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 "windowstr.h" /* window structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
#include "dixgrabs.h"
@@ -111,45 +108,32 @@ ProcXUngrabDeviceKey(ClientPtr client)
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
dev = LookupDeviceIntRec(stuff->grabbed_device);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice);
- return Success;
- }
- if (dev->key == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
- return Success;
- }
+ if (dev == NULL)
+ return BadDevice;
+ if (dev->key == NULL)
+ return BadMatch;
if (stuff->modifier_device != UseXKeyboard) {
mdev = LookupDeviceIntRec(stuff->modifier_device);
- if (mdev == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
- BadDevice);
- return Success;
- }
- if (mdev->key == NULL) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
- return Success;
- }
+ if (mdev == NULL)
+ return BadDevice;
+ if (mdev->key == NULL)
+ return BadMatch;
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
- if (rc != Success) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, rc);
- return Success;
- }
+ if (rc != Success)
+ return rc;
+
if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||
(stuff->key < dev->key->curKeySyms.minKeyCode))
- && (stuff->key != AnyKey)) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue);
- return Success;
- }
+ && (stuff->key != AnyKey))
+ return BadValue;
+
if ((stuff->modifiers != AnyModifier) &&
- (stuff->modifiers & ~AllModifiersMask)) {
- SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue);
- return Success;
- }
+ (stuff->modifiers & ~AllModifiersMask))
+ return BadValue;
temporaryGrab.resource = client->clientAsMask;
temporaryGrab.device = dev;
--
1.5.2.5
More information about the xorg
mailing list