mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
treewide: macro for computing extra units needed for reply header
Add and use macro X_REPLY_HEADER_UNITS() for computing how many extra protocol units are needed for a reply header (for .length field) Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
bb6a70be0f
commit
d6089c52c3
@@ -256,8 +256,7 @@ ProcVidModeGetModeLine(ClientPtr client)
|
||||
.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
|
||||
.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
|
||||
.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS),
|
||||
.length = bytes_to_int32(sizeof(xXF86VidModeGetModeLineReply) -
|
||||
sizeof(xGenericReply)),
|
||||
.length = X_REPLY_HEADER_UNITS(xXF86VidModeGetModeLineReply),
|
||||
/*
|
||||
* Older servers sometimes had server privates that the VidMode
|
||||
* extension made available. So to be compatible pretend that
|
||||
@@ -294,8 +293,7 @@ ProcVidModeGetModeLine(ClientPtr client)
|
||||
xXF86OldVidModeGetModeLineReply oldrep = {
|
||||
.type = rep.type,
|
||||
.sequenceNumber = rep.sequenceNumber,
|
||||
.length = bytes_to_int32(sizeof(xXF86OldVidModeGetModeLineReply) -
|
||||
sizeof(xGenericReply)),
|
||||
.length = X_REPLY_HEADER_UNITS(xXF86OldVidModeGetModeLineReply),
|
||||
.dotclock = rep.dotclock,
|
||||
.hdisplay = rep.hdisplay,
|
||||
.hsyncstart = rep.hsyncstart,
|
||||
@@ -395,8 +393,8 @@ ProcVidModeGetAllModeLines(ClientPtr client)
|
||||
|
||||
xXF86VidModeGetAllModeLinesReply rep = {
|
||||
.type = X_Reply,
|
||||
.length = bytes_to_int32(sizeof(xXF86VidModeGetAllModeLinesReply) -
|
||||
sizeof(xGenericReply) + rpcbuf.wpos),
|
||||
.length = X_REPLY_HEADER_UNITS(xXF86VidModeGetAllModeLinesReply)
|
||||
+ x_rpcbuf_wsize_units(&rpcbuf),
|
||||
.sequenceNumber = client->sequence,
|
||||
.modecount = modecount
|
||||
};
|
||||
@@ -1009,8 +1007,7 @@ VidModeValidateModeLine(ClientPtr client, xXF86VidModeValidateModeLineReq *stuff
|
||||
xXF86VidModeValidateModeLineReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReply)
|
||||
- sizeof(xGenericReply)),
|
||||
.length = X_REPLY_HEADER_UNITS(xXF86VidModeValidateModeLineReply),
|
||||
.status = status
|
||||
};
|
||||
if (client->swapped) {
|
||||
@@ -1258,8 +1255,7 @@ ProcVidModeGetMonitor(ClientPtr client)
|
||||
.nvsync = nVrefresh,
|
||||
.vendorLength = x_safe_strlen(vendorStr),
|
||||
.modelLength = x_safe_strlen(modelStr),
|
||||
.length = bytes_to_int32(sizeof(xXF86VidModeGetMonitorReply) -
|
||||
sizeof(xGenericReply)) +
|
||||
.length = X_REPLY_HEADER_UNITS(xXF86VidModeGetMonitorReply) +
|
||||
x_rpcbuf_wsize_units(&rpcbuf)
|
||||
};
|
||||
|
||||
@@ -1387,8 +1383,7 @@ ProcVidModeGetDotClocks(ClientPtr client)
|
||||
xXF86VidModeGetDotClocksReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(sizeof(xXF86VidModeGetDotClocksReply)
|
||||
- sizeof(xGenericReply)) + numClocks,
|
||||
.length = X_REPLY_HEADER_UNITS(xXF86VidModeGetDotClocksReply) + numClocks,
|
||||
.clocks = numClocks,
|
||||
.maxclocks = MAXCLOCKS,
|
||||
.flags = (ClockProg ? CLKFLAG_PROGRAMABLE : 0),
|
||||
|
||||
Reference in New Issue
Block a user