mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 10:14:52 +00:00
Xi: ProcXGetDeviceProperty(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly and byte-swap, instead of writing in little pieces via complicated callbacks. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
a857543be6
commit
f0341145f0
@@ -36,6 +36,7 @@
|
||||
#include "dix/exevents_priv.h"
|
||||
#include "dix/extension_priv.h"
|
||||
#include "dix/input_priv.h"
|
||||
#include "dix/rpcbuf_priv.h"
|
||||
|
||||
#include "dix.h"
|
||||
#include "inputstr.h"
|
||||
@@ -986,23 +987,26 @@ ProcXGetDeviceProperty(ClientPtr client)
|
||||
swapl(&rep.bytesAfter);
|
||||
swapl(&rep.nItems);
|
||||
}
|
||||
WriteToClient(client, sizeof(xGenericReply), &rep);
|
||||
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
|
||||
if (length) {
|
||||
switch (rep.format) {
|
||||
switch (format) {
|
||||
case 32:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
||||
x_rpcbuf_write_CARD32s(&rpcbuf, (CARD32*)data, length / 4);
|
||||
break;
|
||||
case 16:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
|
||||
x_rpcbuf_write_CARD16s(&rpcbuf, (CARD16*)data, length / 2);
|
||||
break;
|
||||
default:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
|
||||
x_rpcbuf_write_CARD8s(&rpcbuf, (CARD8*)data, length);
|
||||
break;
|
||||
}
|
||||
WriteSwappedDataToClient(client, length, data);
|
||||
}
|
||||
|
||||
if (rpcbuf.error)
|
||||
return BadAlloc;
|
||||
|
||||
/* delete the Property */
|
||||
if (stuff->delete && (rep.bytesAfter == 0)) {
|
||||
XIPropertyPtr prop, *prev;
|
||||
@@ -1016,6 +1020,9 @@ ProcXGetDeviceProperty(ClientPtr client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xGenericReply), &rep);
|
||||
WriteRpcbufToClient(client, &rpcbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user