mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
dri3: proc_dri3_get_supported_modifiers(): use x_rpcbuf_t
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
ac4408b929
commit
3cdb1c3266
@@ -355,7 +355,6 @@ proc_dri3_get_supported_modifiers(ClientPtr client)
|
|||||||
CARD32 nwindowmodifiers = 0;
|
CARD32 nwindowmodifiers = 0;
|
||||||
CARD32 nscreenmodifiers = 0;
|
CARD32 nscreenmodifiers = 0;
|
||||||
int status;
|
int status;
|
||||||
int i;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDRI3GetSupportedModifiersReq);
|
REQUEST_SIZE_MATCH(xDRI3GetSupportedModifiersReq);
|
||||||
|
|
||||||
@@ -369,41 +368,24 @@ proc_dri3_get_supported_modifiers(ClientPtr client)
|
|||||||
&nwindowmodifiers, &window_modifiers,
|
&nwindowmodifiers, &window_modifiers,
|
||||||
&nscreenmodifiers, &screen_modifiers);
|
&nscreenmodifiers, &screen_modifiers);
|
||||||
|
|
||||||
const size_t bufsz = (nwindowmodifiers + nscreenmodifiers) * sizeof(CARD64);
|
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||||
CARD64 *buf = calloc(1, bufsz);
|
x_rpcbuf_write_CARD64s(&rpcbuf, window_modifiers, nwindowmodifiers);
|
||||||
if (!buf) {
|
x_rpcbuf_write_CARD64s(&rpcbuf, screen_modifiers, nscreenmodifiers);
|
||||||
free(window_modifiers);
|
|
||||||
free(screen_modifiers);
|
|
||||||
return BadAlloc;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(buf, window_modifiers, sizeof(CARD64) * nwindowmodifiers);
|
|
||||||
memcpy(&buf[nwindowmodifiers], screen_modifiers, sizeof(CARD64) * nscreenmodifiers);
|
|
||||||
|
|
||||||
free(window_modifiers);
|
free(window_modifiers);
|
||||||
free(screen_modifiers);
|
free(screen_modifiers);
|
||||||
|
|
||||||
xDRI3GetSupportedModifiersReply rep = {
|
xDRI3GetSupportedModifiersReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.numWindowModifiers = nwindowmodifiers,
|
.numWindowModifiers = nwindowmodifiers,
|
||||||
.numScreenModifiers = nscreenmodifiers,
|
.numScreenModifiers = nscreenmodifiers,
|
||||||
.length = bytes_to_int32(bufsz),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
swapl(&rep.numWindowModifiers);
|
swapl(&rep.numWindowModifiers);
|
||||||
swapl(&rep.numScreenModifiers);
|
swapl(&rep.numScreenModifiers);
|
||||||
for (i = 0; i < nwindowmodifiers+nscreenmodifiers; i++)
|
|
||||||
swapll(&buf[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(rep), &rep);
|
return X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf);
|
||||||
WriteToClient(client, bufsz, buf);
|
|
||||||
free(buf);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
Reference in New Issue
Block a user