diff --git a/Xext/shm.c b/Xext/shm.c index 564278fe7..f77fa7a7c 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -255,10 +255,7 @@ ProcShmQueryVersion(ClientPtr client) REQUEST_HEAD_STRUCT(xShmQueryVersionReq); xShmQueryVersionReply rep = { - .type = X_Reply, .sharedPixmaps = sharedPixmaps, - .sequenceNumber = client->sequence, - .length = 0, .majorVersion = SERVER_SHM_MAJOR_VERSION, .minorVersion = SERVER_SHM_MINOR_VERSION, .uid = geteuid(), @@ -266,16 +263,11 @@ ProcShmQueryVersion(ClientPtr client) .pixmapFormat = sharedPixmaps ? ZPixmap : 0 }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swaps(&rep.majorVersion); - swaps(&rep.minorVersion); - swaps(&rep.uid); - swaps(&rep.gid); - } - WriteToClient(client, sizeof(xShmQueryVersionReply), &rep); - return Success; + REPLY_FIELD_CARD16(majorVersion); + REPLY_FIELD_CARD16(minorVersion); + REPLY_FIELD_CARD16(uid); + REPLY_FIELD_CARD16(gid); + REPLY_SEND_RET_SUCCESS(); } /* @@ -601,7 +593,6 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff) DrawablePtr pDraw; long lenPer = 0, length; Mask plane = 0; - xShmGetImageReply xgi; ShmDescPtr shmdesc; VisualID visual = None; RegionPtr pVisibleRegion = NULL; @@ -646,13 +637,6 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff) return BadMatch; visual = None; } - xgi = (xShmGetImageReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .visual = visual, - .depth = pDraw->depth - }; if (stuff->format == ZPixmap) { length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; } @@ -664,7 +648,6 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff) } VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); - xgi.size = length; if (length == 0) { /* nothing to do */ @@ -681,7 +664,6 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff) stuff->format, shmdesc->addr + stuff->offset); } else { - length = stuff->offset; for (; plane; plane >>= 1) { if (stuff->planeMask & plane) { @@ -700,15 +682,15 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff) } } - if (client->swapped) { - swaps(&xgi.sequenceNumber); - swapl(&xgi.length); - swapl(&xgi.visual); - swapl(&xgi.size); - } - WriteToClient(client, sizeof(xShmGetImageReply), &xgi); + xShmGetImageReply rep = { + .visual = visual, + .depth = pDraw->depth, + .size = length, + }; - return Success; + REPLY_FIELD_CARD32(visual); + REPLY_FIELD_CARD32(size); + REPLY_SEND_RET_SUCCESS(); } static int @@ -793,7 +775,6 @@ ProcShmGetImage(ClientPtr client) #ifdef XINERAMA PanoramiXRes *draw; DrawablePtr pDraw; - xShmGetImageReply xgi; ShmDescPtr shmdesc; int i, x, y, w, h, format, rc; Mask plane = 0, planemask; @@ -885,16 +866,6 @@ ProcShmGetImage(ClientPtr client) IncludeInferiors); } - xgi = (xShmGetImageReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .visual = wVisual(((WindowPtr) pDraw)), - .depth = pDraw->depth - }; - - xgi.size = length; - if (length == 0) { /* nothing to do */ } else if (format == ZPixmap) { @@ -916,15 +887,15 @@ ProcShmGetImage(ClientPtr client) } free(drawables); - if (client->swapped) { - swaps(&xgi.sequenceNumber); - swapl(&xgi.length); - swapl(&xgi.visual); - swapl(&xgi.size); - } - WriteToClient(client, sizeof(xShmGetImageReply), &xgi); + xShmGetImageReply rep = { + .visual = wVisual(((WindowPtr) pDraw)), + .depth = pDraw->depth, + .size = length, + }; - return Success; + REPLY_FIELD_CARD32(visual); + REPLY_FIELD_CARD32(size); + REPLY_SEND_RET_SUCCESS(); #else return ShmGetImage(client, stuff); #endif /* XINERAMA */ @@ -1300,12 +1271,6 @@ ProcShmCreateSegment(ClientPtr client) int fd; ShmDescPtr shmdesc; - xShmCreateSegmentReply rep = { - .type = X_Reply, - .nfd = 1, - .sequenceNumber = client->sequence, - .length = 0, - }; LEGAL_NEW_RESOURCE(stuff->shmseg, client); if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) { @@ -1361,8 +1326,12 @@ ProcShmCreateSegment(ClientPtr client) close(fd); return BadAlloc; } - WriteToClient(client, sizeof (xShmCreateSegmentReply), &rep); - return Success; + + xShmCreateSegmentReply rep = { + .nfd = 1, + }; + + REPLY_SEND_RET_SUCCESS(); } #endif /* SHM_FD_PASSING */