dbe: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
2a63c0911f
commit
bbfdb50b5c
|
@ -430,7 +430,7 @@ ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask,
|
|||
REPLY_FIELD_CARD32(spec.mask);
|
||||
REPLY_FIELD_CARD32(length); // need to do it, since not calling REPLY_SEND()
|
||||
|
||||
if (sendClient->swapped) swapl (value);
|
||||
REPLY_BUF_CARD32(value, 1);
|
||||
|
||||
memcpy(ptr, &rep, sizeof(rep));
|
||||
*value = pid;
|
||||
|
|
78
dbe/dbe.c
78
dbe/dbe.c
|
@ -115,23 +115,13 @@ ProcDbeGetVersion(ClientPtr client)
|
|||
REQUEST_HEAD_STRUCT(xDbeGetVersionReq);
|
||||
|
||||
xDbeGetVersionReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.majorVersion = DBE_MAJOR_VERSION,
|
||||
.minorVersion = DBE_MINOR_VERSION
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
}
|
||||
REPLY_SEND_RET_SUCCESS();
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xDbeGetVersionReply), &rep);
|
||||
|
||||
return Success;
|
||||
|
||||
} /* ProcDbeGetVersion() */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* DBE DIX Procedure: ProcDbeAllocateBackBufferName
|
||||
|
@ -563,7 +553,6 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
REQUEST_REST_CARD32();
|
||||
|
||||
DbeScreenPrivPtr pDbeScreenPriv;
|
||||
xDbeGetVisualInfoReply rep;
|
||||
register int i, j, rc;
|
||||
register int count; /* number of visual infos in reply */
|
||||
register int length; /* length of reply */
|
||||
|
@ -621,22 +610,6 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
length += pScrVisInfo[i].count * sizeof(xDbeVisInfo);
|
||||
}
|
||||
|
||||
rep = (xDbeGetVisualInfoReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(length),
|
||||
.m = count
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.m);
|
||||
}
|
||||
|
||||
/* Send off reply. */
|
||||
WriteToClient(client, sizeof(xDbeGetVisualInfoReply), &rep);
|
||||
|
||||
{
|
||||
char buf[length];
|
||||
char *walk = buf;
|
||||
|
@ -646,7 +619,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
|
||||
/* Send off number of visuals. */
|
||||
*(CARD32*)walk = pScrVisInfo[i].count;
|
||||
if (client->swapped) { swapl((CARD32*)walk); }
|
||||
REPLY_BUF_CARD32((CARD32*)walk, 1);
|
||||
walk += sizeof(CARD32);
|
||||
|
||||
/* Now send off visual info items. */
|
||||
|
@ -657,21 +630,20 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
* data structure. We will send data to the client from the
|
||||
* protocol data structure.
|
||||
*/
|
||||
|
||||
visInfo->visualID = pScrVisInfo[i].visinfo[j].visual;
|
||||
visInfo->depth = pScrVisInfo[i].visinfo[j].depth;
|
||||
visInfo->perfLevel = pScrVisInfo[i].visinfo[j].perflevel;
|
||||
|
||||
if (client->swapped) {
|
||||
swapl(&visInfo->visualID);
|
||||
walk += sizeof(xDbeVisInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/* We do not need to swap depth and perfLevel since they are
|
||||
* already 1 byte quantities.
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
WriteToClient(client, sizeof(buf), buf);
|
||||
xDbeGetVisualInfoReply rep = {
|
||||
.m = count
|
||||
};
|
||||
|
||||
REPLY_FIELD_CARD32(m);
|
||||
REPLY_SEND_EXTRA(buf, length);
|
||||
}
|
||||
|
||||
rc = Success;
|
||||
|
@ -707,35 +679,21 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
|||
REQUEST_HEAD_STRUCT(xDbeGetBackBufferAttributesReq);
|
||||
REQUEST_FIELD_CARD32(buffer);
|
||||
|
||||
xDbeGetBackBufferAttributesReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
DbeWindowPrivPtr pDbeWindowPriv;
|
||||
int rc;
|
||||
|
||||
rc = dixLookupResourceByType((void **) &pDbeWindowPriv, stuff->buffer,
|
||||
dbeWindowPrivResType, client,
|
||||
DixGetAttrAccess);
|
||||
if (rc == Success) {
|
||||
rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
|
||||
}
|
||||
else {
|
||||
rep.attributes = None;
|
||||
}
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.attributes);
|
||||
}
|
||||
xDbeGetBackBufferAttributesReply rep = {
|
||||
.attributes = (rc == Success) ? pDbeWindowPriv->pWindow->drawable.id : None,
|
||||
};
|
||||
|
||||
WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply), &rep);
|
||||
return Success;
|
||||
REPLY_FIELD_CARD32(attributes);
|
||||
REPLY_SEND_RET_SUCCESS();
|
||||
}
|
||||
|
||||
} /* ProcDbeGetbackBufferAttributes() */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* DBE DIX Procedure: ProcDbeDispatch
|
||||
|
|
Loading…
Reference in New Issue