From 9449df58965f814be3d9656c7a2f5cfbe51457f7 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 2 Sep 2025 17:52:05 +0200 Subject: [PATCH] glx: __glXSendReply(): use x_rpcbuf_t Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF() for sending it all out. Signed-off-by: Enrico Weigelt, metux IT consult --- glx/indirect_util.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/glx/indirect_util.c b/glx/indirect_util.c index 140b3b21f2..b8cd7c6f54 100644 --- a/glx/indirect_util.c +++ b/glx/indirect_util.c @@ -30,6 +30,9 @@ #include #include +#include "dix/dix_priv.h" +#include "dix/rpcbuf_priv.h" + #include "indirect_size.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" @@ -120,10 +123,11 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements, reply_ints = bytes_to_int32(elements * element_size); } + x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE }; + /* data should already be padded */ + x_rpcbuf_write_CARD8s(&rpcbuf, data, reply_ints * 4); + xGLXSingleReply reply = { - .length = reply_ints, - .type = X_Reply, - .sequenceNumber = client->sequence, .size = elements, .retval = retval, }; @@ -132,11 +136,8 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements, if (elements == 1) { (void) memcpy(&reply.pad3, data, element_size); } - WriteToClient(client, sizeof(xGLXSingleReply), &reply); - if (reply_ints != 0) { - WriteToClient(client, reply_ints * 4, data); - } + X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf); } /**