XI: use SwapLongs() in ProcXGetDeviceMotionEvents()
We already have a standard function for swapping 32 bit ints, so let's use this one instead of rolling our own loop. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
d082992690
commit
9ae97d7487
|
@ -86,13 +86,10 @@ SProcXGetDeviceMotionEvents(ClientPtr client)
|
||||||
int
|
int
|
||||||
ProcXGetDeviceMotionEvents(ClientPtr client)
|
ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||||
{
|
{
|
||||||
INT32 *coords = NULL, *bufptr;
|
INT32 *coords = NULL;
|
||||||
unsigned long i;
|
|
||||||
int rc, num_events, axes, size = 0;
|
int rc, num_events, axes, size = 0;
|
||||||
unsigned long nEvents;
|
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
TimeStamp start, stop;
|
TimeStamp start, stop;
|
||||||
int length = 0;
|
|
||||||
ValuatorClassPtr v;
|
ValuatorClassPtr v;
|
||||||
|
|
||||||
REQUEST(xGetDeviceMotionEventsReq);
|
REQUEST(xGetDeviceMotionEventsReq);
|
||||||
|
@ -134,22 +131,16 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||||
start.milliseconds, stop.milliseconds,
|
start.milliseconds, stop.milliseconds,
|
||||||
(ScreenPtr) NULL, FALSE);
|
(ScreenPtr) NULL, FALSE);
|
||||||
}
|
}
|
||||||
if (rep.nEvents > 0) {
|
|
||||||
length = bytes_to_int32(rep.nEvents * size);
|
const int length = rep.nEvents * size;
|
||||||
rep.length = length;
|
rep.length = bytes_to_int32(length);
|
||||||
|
|
||||||
|
if (client->swapped) {
|
||||||
|
SwapLongs((CARD32*) coords, rep.length);
|
||||||
}
|
}
|
||||||
nEvents = rep.nEvents;
|
|
||||||
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
|
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
|
||||||
if (nEvents) {
|
WriteToClient(client, length, coords);
|
||||||
if (client->swapped) {
|
|
||||||
bufptr = coords;
|
|
||||||
for (i = 0; i < nEvents * (axes + 1); i++) {
|
|
||||||
swapl(bufptr);
|
|
||||||
bufptr++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WriteToClient(client, length * 4, coords);
|
|
||||||
}
|
|
||||||
free(coords);
|
free(coords);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue