mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
Xext: shm: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping much easier. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
57
Xext/shm.c
57
Xext/shm.c
@@ -238,6 +238,8 @@ ShmRegisterFbFuncs(ScreenPtr pScreen)
|
|||||||
static int
|
static int
|
||||||
ProcShmQueryVersion(ClientPtr client)
|
ProcShmQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
X_REQUEST_HEAD_STRUCT(xShmQueryVersionReq);
|
||||||
|
|
||||||
xShmQueryVersionReply reply = {
|
xShmQueryVersionReply reply = {
|
||||||
.sharedPixmaps = sharedPixmaps,
|
.sharedPixmaps = sharedPixmaps,
|
||||||
.majorVersion = SERVER_SHM_MAJOR_VERSION,
|
.majorVersion = SERVER_SHM_MAJOR_VERSION,
|
||||||
@@ -247,8 +249,6 @@ ProcShmQueryVersion(ClientPtr client)
|
|||||||
.pixmapFormat = sharedPixmaps ? ZPixmap : 0
|
.pixmapFormat = sharedPixmaps ? ZPixmap : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShmQueryVersionReq);
|
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&reply.majorVersion);
|
swaps(&reply.majorVersion);
|
||||||
swaps(&reply.minorVersion);
|
swaps(&reply.minorVersion);
|
||||||
@@ -328,8 +328,9 @@ shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
|
|||||||
static int
|
static int
|
||||||
ProcShmAttach(ClientPtr client)
|
ProcShmAttach(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xShmAttachReq);
|
X_REQUEST_HEAD_STRUCT(xShmAttachReq);
|
||||||
REQUEST_SIZE_MATCH(xShmAttachReq);
|
X_REQUEST_FIELD_CARD32(shmseg);
|
||||||
|
X_REQUEST_FIELD_CARD32(shmid);
|
||||||
|
|
||||||
if (!client->local)
|
if (!client->local)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
@@ -416,8 +417,8 @@ ShmDetachSegment(void *value, /* must conform to DeleteType */
|
|||||||
static int
|
static int
|
||||||
ProcShmDetach(ClientPtr client)
|
ProcShmDetach(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xShmDetachReq);
|
X_REQUEST_HEAD_STRUCT(xShmDetachReq);
|
||||||
REQUEST_SIZE_MATCH(xShmDetachReq);
|
X_REQUEST_FIELD_CARD32(shmseg);
|
||||||
|
|
||||||
if (!client->local)
|
if (!client->local)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
@@ -688,8 +689,19 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff)
|
|||||||
static int
|
static int
|
||||||
ProcShmPutImage(ClientPtr client)
|
ProcShmPutImage(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xShmPutImageReq);
|
X_REQUEST_HEAD_STRUCT(xShmPutImageReq);
|
||||||
REQUEST_SIZE_MATCH(xShmPutImageReq);
|
X_REQUEST_FIELD_CARD32(drawable);
|
||||||
|
X_REQUEST_FIELD_CARD32(gc);
|
||||||
|
X_REQUEST_FIELD_CARD16(totalWidth);
|
||||||
|
X_REQUEST_FIELD_CARD16(totalHeight);
|
||||||
|
X_REQUEST_FIELD_CARD16(srcX);
|
||||||
|
X_REQUEST_FIELD_CARD16(srcY);
|
||||||
|
X_REQUEST_FIELD_CARD16(srcWidth);
|
||||||
|
X_REQUEST_FIELD_CARD16(srcHeight);
|
||||||
|
X_REQUEST_FIELD_CARD16(dstX);
|
||||||
|
X_REQUEST_FIELD_CARD16(dstY);
|
||||||
|
X_REQUEST_FIELD_CARD32(shmseg);
|
||||||
|
X_REQUEST_FIELD_CARD32(offset);
|
||||||
|
|
||||||
if (!client->local)
|
if (!client->local)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
@@ -742,8 +754,15 @@ ProcShmPutImage(ClientPtr client)
|
|||||||
static int
|
static int
|
||||||
ProcShmGetImage(ClientPtr client)
|
ProcShmGetImage(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xShmGetImageReq);
|
X_REQUEST_HEAD_STRUCT(xShmGetImageReq);
|
||||||
REQUEST_SIZE_MATCH(xShmGetImageReq);
|
X_REQUEST_FIELD_CARD32(drawable);
|
||||||
|
X_REQUEST_FIELD_CARD16(x);
|
||||||
|
X_REQUEST_FIELD_CARD16(y);
|
||||||
|
X_REQUEST_FIELD_CARD16(width);
|
||||||
|
X_REQUEST_FIELD_CARD16(height);
|
||||||
|
X_REQUEST_FIELD_CARD32(planeMask);
|
||||||
|
X_REQUEST_FIELD_CARD32(shmseg);
|
||||||
|
X_REQUEST_FIELD_CARD32(offset);
|
||||||
|
|
||||||
if (!client->local)
|
if (!client->local)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
@@ -887,8 +906,13 @@ ProcShmGetImage(ClientPtr client)
|
|||||||
static int
|
static int
|
||||||
ProcShmCreatePixmap(ClientPtr client)
|
ProcShmCreatePixmap(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xShmCreatePixmapReq);
|
X_REQUEST_HEAD_STRUCT(xShmCreatePixmapReq);
|
||||||
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
|
X_REQUEST_FIELD_CARD32(pid);
|
||||||
|
X_REQUEST_FIELD_CARD32(drawable);
|
||||||
|
X_REQUEST_FIELD_CARD16(width);
|
||||||
|
X_REQUEST_FIELD_CARD16(height);
|
||||||
|
X_REQUEST_FIELD_CARD32(shmseg);
|
||||||
|
X_REQUEST_FIELD_CARD32(offset);
|
||||||
|
|
||||||
if (!client->local)
|
if (!client->local)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
@@ -1119,8 +1143,8 @@ ShmBusfaultNotify(void *context)
|
|||||||
static int
|
static int
|
||||||
ProcShmAttachFd(ClientPtr client)
|
ProcShmAttachFd(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xShmAttachFdReq);
|
X_REQUEST_HEAD_STRUCT(xShmAttachFdReq);
|
||||||
REQUEST_SIZE_MATCH(xShmAttachFdReq);
|
X_REQUEST_FIELD_CARD32(shmseg);
|
||||||
|
|
||||||
if (!client->local)
|
if (!client->local)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
@@ -1238,8 +1262,9 @@ shm_tmpfile(void)
|
|||||||
static int
|
static int
|
||||||
ProcShmCreateSegment(ClientPtr client)
|
ProcShmCreateSegment(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xShmCreateSegmentReq);
|
X_REQUEST_HEAD_STRUCT(xShmCreateSegmentReq);
|
||||||
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
|
X_REQUEST_FIELD_CARD32(shmseg);
|
||||||
|
X_REQUEST_FIELD_CARD32(size);
|
||||||
|
|
||||||
if (!client->local)
|
if (!client->local)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
|
|||||||
Reference in New Issue
Block a user