mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-10 04:37:15 +00:00
vidmode: ProcVidModeGetMonitor(): create reply struct right before send
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / Release pushed tag (push) Waiting to run
check PRs for merge conflicts / notify (push) Waiting to run
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / Release pushed tag (push) Waiting to run
check PRs for merge conflicts / notify (push) Waiting to run
Move the declaration of the reply struct down to after the payload has been finally assembled, so we don't need extra payload size compuation anymore. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
4a57142388
commit
bca6d2ddcd
1 changed files with 13 additions and 18 deletions
|
|
@ -40,6 +40,7 @@ from Kaleb S. KEITHLEY
|
|||
#include "dix/dix_priv.h"
|
||||
#include "dix/rpcbuf_priv.h"
|
||||
#include "os/log_priv.h"
|
||||
#include "os/osdep.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "dixstruct.h"
|
||||
|
|
@ -1228,24 +1229,6 @@ ProcVidModeGetMonitor(ClientPtr client)
|
|||
const char *vendorStr = (const char*)pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VENDOR, 0).ptr;
|
||||
const char *modelStr = (const char*)pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0).ptr;
|
||||
|
||||
const int vendorLength = (vendorStr ? strlen(vendorStr) : 0);
|
||||
const int modelLength = (modelStr ? strlen(modelStr) : 0);
|
||||
|
||||
const int nVendorItems = bytes_to_int32(vendorLength);
|
||||
const int nModelItems = bytes_to_int32(modelLength);
|
||||
|
||||
xXF86VidModeGetMonitorReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.nhsync = nHsync,
|
||||
.nvsync = nVrefresh,
|
||||
.vendorLength = vendorLength,
|
||||
.modelLength = modelLength,
|
||||
.length = bytes_to_int32(sizeof(xXF86VidModeGetMonitorReply) -
|
||||
sizeof(xGenericReply))
|
||||
+ nHsync + nVrefresh + nVendorItems + nModelItems
|
||||
};
|
||||
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
|
||||
for (int i = 0; i < nHsync; i++) {
|
||||
|
|
@ -1268,6 +1251,18 @@ ProcVidModeGetMonitor(ClientPtr client)
|
|||
if (rpcbuf.error)
|
||||
return BadAlloc;
|
||||
|
||||
xXF86VidModeGetMonitorReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.nhsync = nHsync,
|
||||
.nvsync = nVrefresh,
|
||||
.vendorLength = x_safe_strlen(vendorStr),
|
||||
.modelLength = x_safe_strlen(modelStr),
|
||||
.length = bytes_to_int32(sizeof(xXF86VidModeGetMonitorReply) -
|
||||
sizeof(xGenericReply)) +
|
||||
x_rpcbuf_wsize_units(&rpcbuf)
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
|
|
|
|||
Loading…
Reference in a new issue