From 07820e4a7d68fe08dfbfee4750fb8bd7d1056501 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 10 Sep 2025 11:12:16 +0200 Subject: [PATCH] xfree86: dri: ProcXF86DRIOpenConnection() use x_rpcbuf_t Use x_rpcbuf_t for reply payload assembly and X_SEND_REPLY_WITH_RPCBUF() for sending it all out. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xfree86/dri/xf86dri.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c index c933f10474..fdad5f5d49 100644 --- a/hw/xfree86/dri/xf86dri.c +++ b/hw/xfree86/dri/xf86dri.c @@ -121,7 +121,6 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client) static int ProcXF86DRIOpenConnection(register ClientPtr client) { - xXF86DRIOpenConnectionReply rep; drm_handle_t hSAREA; char *busIdString; CARD32 busIdStringLength = 0; @@ -138,16 +137,14 @@ ProcXF86DRIOpenConnection(register ClientPtr client) return BadValue; } - if (busIdString) + x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE }; + if (busIdString) { busIdStringLength = strlen(busIdString); + x_rpcbuf_write_CARD8s(&rpcbuf, (CARD8*)busIdString, strlen(busIdString)); + } - rep = (xXF86DRIOpenConnectionReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = X_REPLY_HEADER_UNITS(xXF86DRIOpenConnectionReply) - + bytes_to_int32(busIdStringLength), + xXF86DRIOpenConnectionReply reply = { .busIdStringLength = busIdStringLength, - .hSAREALow = (CARD32) (hSAREA & 0xffffffff), #if defined(LONG64) && !defined(__linux__) .hSAREAHigh = (CARD32) (hSAREA >> 32), @@ -156,10 +153,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client) #endif }; - WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep); - if (busIdStringLength) - WriteToClient(client, busIdStringLength, busIdString); - return Success; + return X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf); } static int