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(spec.mask);
|
||||||
REPLY_FIELD_CARD32(length); // need to do it, since not calling REPLY_SEND()
|
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));
|
memcpy(ptr, &rep, sizeof(rep));
|
||||||
*value = pid;
|
*value = pid;
|
||||||
|
|
76
dbe/dbe.c
76
dbe/dbe.c
|
@ -115,23 +115,13 @@ ProcDbeGetVersion(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xDbeGetVersionReq);
|
REQUEST_HEAD_STRUCT(xDbeGetVersionReq);
|
||||||
|
|
||||||
xDbeGetVersionReply rep = {
|
xDbeGetVersionReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.majorVersion = DBE_MAJOR_VERSION,
|
.majorVersion = DBE_MAJOR_VERSION,
|
||||||
.minorVersion = DBE_MINOR_VERSION
|
.minorVersion = DBE_MINOR_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.sequenceNumber);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xDbeGetVersionReply), &rep);
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
|
|
||||||
} /* ProcDbeGetVersion() */
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* DBE DIX Procedure: ProcDbeAllocateBackBufferName
|
* DBE DIX Procedure: ProcDbeAllocateBackBufferName
|
||||||
|
@ -563,7 +553,6 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
REQUEST_REST_CARD32();
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
DbeScreenPrivPtr pDbeScreenPriv;
|
DbeScreenPrivPtr pDbeScreenPriv;
|
||||||
xDbeGetVisualInfoReply rep;
|
|
||||||
register int i, j, rc;
|
register int i, j, rc;
|
||||||
register int count; /* number of visual infos in reply */
|
register int count; /* number of visual infos in reply */
|
||||||
register int length; /* length of reply */
|
register int length; /* length of reply */
|
||||||
|
@ -621,22 +610,6 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
length += pScrVisInfo[i].count * sizeof(xDbeVisInfo);
|
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 buf[length];
|
||||||
char *walk = buf;
|
char *walk = buf;
|
||||||
|
@ -646,7 +619,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
|
|
||||||
/* Send off number of visuals. */
|
/* Send off number of visuals. */
|
||||||
*(CARD32*)walk = pScrVisInfo[i].count;
|
*(CARD32*)walk = pScrVisInfo[i].count;
|
||||||
if (client->swapped) { swapl((CARD32*)walk); }
|
REPLY_BUF_CARD32((CARD32*)walk, 1);
|
||||||
walk += sizeof(CARD32);
|
walk += sizeof(CARD32);
|
||||||
|
|
||||||
/* Now send off visual info items. */
|
/* Now send off visual info items. */
|
||||||
|
@ -657,21 +630,20 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
* data structure. We will send data to the client from the
|
* data structure. We will send data to the client from the
|
||||||
* protocol data structure.
|
* protocol data structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
visInfo->visualID = pScrVisInfo[i].visinfo[j].visual;
|
visInfo->visualID = pScrVisInfo[i].visinfo[j].visual;
|
||||||
visInfo->depth = pScrVisInfo[i].visinfo[j].depth;
|
visInfo->depth = pScrVisInfo[i].visinfo[j].depth;
|
||||||
visInfo->perfLevel = pScrVisInfo[i].visinfo[j].perflevel;
|
visInfo->perfLevel = pScrVisInfo[i].visinfo[j].perflevel;
|
||||||
|
|
||||||
if (client->swapped) {
|
walk += sizeof(xDbeVisInfo);
|
||||||
swapl(&visInfo->visualID);
|
|
||||||
|
|
||||||
/* 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;
|
rc = Success;
|
||||||
|
@ -707,35 +679,21 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xDbeGetBackBufferAttributesReq);
|
REQUEST_HEAD_STRUCT(xDbeGetBackBufferAttributesReq);
|
||||||
REQUEST_FIELD_CARD32(buffer);
|
REQUEST_FIELD_CARD32(buffer);
|
||||||
|
|
||||||
xDbeGetBackBufferAttributesReply rep = {
|
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0
|
|
||||||
};
|
|
||||||
DbeWindowPrivPtr pDbeWindowPriv;
|
DbeWindowPrivPtr pDbeWindowPriv;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pDbeWindowPriv, stuff->buffer,
|
rc = dixLookupResourceByType((void **) &pDbeWindowPriv, stuff->buffer,
|
||||||
dbeWindowPrivResType, client,
|
dbeWindowPrivResType, client,
|
||||||
DixGetAttrAccess);
|
DixGetAttrAccess);
|
||||||
if (rc == Success) {
|
|
||||||
rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rep.attributes = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client->swapped) {
|
xDbeGetBackBufferAttributesReply rep = {
|
||||||
swaps(&rep.sequenceNumber);
|
.attributes = (rc == Success) ? pDbeWindowPriv->pWindow->drawable.id : None,
|
||||||
swapl(&rep.length);
|
};
|
||||||
swapl(&rep.attributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply), &rep);
|
REPLY_FIELD_CARD32(attributes);
|
||||||
return Success;
|
REPLY_SEND_RET_SUCCESS();
|
||||||
|
}
|
||||||
|
|
||||||
} /* ProcDbeGetbackBufferAttributes() */
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* DBE DIX Procedure: ProcDbeDispatch
|
* DBE DIX Procedure: ProcDbeDispatch
|
||||||
|
|
Loading…
Reference in New Issue