diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 4742117c3..559dbc1c8 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -367,8 +367,6 @@ ProcXFixesGetCursorImage(ClientPtr client) CopyCursorToImage(pCursor, image); xXFixesGetCursorImageReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, .length = npixels, .width = width, .height = height, @@ -379,20 +377,15 @@ ProcXFixesGetCursorImage(ClientPtr client) .cursorSerial = pCursor->serialNumber, }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swaps(&rep.x); - swaps(&rep.y); - swaps(&rep.width); - swaps(&rep.height); - swaps(&rep.xhot); - swaps(&rep.yhot); - swapl(&rep.cursorSerial); - SwapLongs(image, npixels); - } - WriteToClient(client, sizeof(xXFixesGetCursorImageReply), &rep); - WriteToClient(client, sizeof(image), image); + REPLY_FIELD_CARD16(x); + REPLY_FIELD_CARD16(y); + REPLY_FIELD_CARD16(width); + REPLY_FIELD_CARD16(height); + REPLY_FIELD_CARD16(xhot); + REPLY_FIELD_CARD16(yhot); + REPLY_FIELD_CARD32(cursorSerial); + REPLY_BUF_CARD32(image, npixels); + REPLY_SEND_EXTRA(image, sizeof(image)); return Success; } @@ -436,21 +429,12 @@ ProcXFixesGetCursorName(ClientPtr client) len = strlen(str); xXFixesGetCursorNameReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(len), .atom = pCursor->name, .nbytes = len }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.atom); - swaps(&rep.nbytes); - } - WriteToClient(client, sizeof(rep), &rep); - WriteToClient(client, len, str); - + REPLY_FIELD_CARD32(atom); + REPLY_FIELD_CARD16(nbytes); + REPLY_SEND_EXTRA(str, len); return Success; } @@ -488,9 +472,6 @@ ProcXFixesGetCursorImageAndName(ClientPtr client) memcpy((image + npixels), name, nbytes); xXFixesGetCursorImageAndNameReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(sizeof(image)), .width = width, .height = height, .x = x, @@ -502,22 +483,17 @@ ProcXFixesGetCursorImageAndName(ClientPtr client) .nbytes = nbytes, }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swaps(&rep.x); - swaps(&rep.y); - swaps(&rep.width); - swaps(&rep.height); - swaps(&rep.xhot); - swaps(&rep.yhot); - swapl(&rep.cursorSerial); - swapl(&rep.cursorName); - swaps(&rep.nbytes); - SwapLongs(image, npixels); - } - WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply), &rep); - WriteToClient(client, sizeof(image), image); + REPLY_FIELD_CARD16(x); + REPLY_FIELD_CARD16(y); + REPLY_FIELD_CARD16(width); + REPLY_FIELD_CARD16(height); + REPLY_FIELD_CARD16(xhot); + REPLY_FIELD_CARD16(yhot); + REPLY_FIELD_CARD32(cursorSerial); + REPLY_FIELD_CARD32(cursorName); + REPLY_FIELD_CARD16(nbytes); + REPLY_BUF_CARD32(image, npixels); + REPLY_SEND_EXTRA(image, sizeof(image)); return Success; } diff --git a/xfixes/disconnect.c b/xfixes/disconnect.c index 0ee2941ff..d76027da0 100644 --- a/xfixes/disconnect.c +++ b/xfixes/disconnect.c @@ -81,18 +81,11 @@ ProcXFixesGetClientDisconnectMode(ClientPtr client) ClientDisconnectPtr pDisconnect = GetClientDisconnect(client); xXFixesGetClientDisconnectModeReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, .disconnect_mode = pDisconnect->disconnect_mode, }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.disconnect_mode); - } - WriteToClient(client, sizeof(xXFixesGetClientDisconnectModeReply), &rep); - return Success; + REPLY_FIELD_CARD32(disconnect_mode); + REPLY_SEND_RET_SUCCESS(); } Bool diff --git a/xfixes/region.c b/xfixes/region.c index bc200bd90..312d98c92 100644 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -427,26 +427,18 @@ ProcXFixesFetchRegion(ClientPtr client) } xXFixesFetchRegionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = nBox << 1, .x = pExtent->x1, .y = pExtent->y1, .width = pExtent->x2 - pExtent->x1, .height = pExtent->y2 - pExtent->y1, }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swaps(&rep.x); - swaps(&rep.y); - swaps(&rep.width); - swaps(&rep.height); - SwapShorts((INT16 *) pRect, nBox * 4); - } - WriteToClient(client, sizeof(xXFixesFetchRegionReply), &rep); - WriteToClient(client, sizeof(pRect), pRect); + REPLY_FIELD_CARD16(x); + REPLY_FIELD_CARD16(y); + REPLY_FIELD_CARD16(width); + REPLY_FIELD_CARD16(height); + REPLY_BUF_CARD16(pRect, nBox * 4); + REPLY_SEND_EXTRA(pRect, sizeof(pRect)); return Success; } diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c index a51723c33..65c256f84 100644 --- a/xfixes/xfixes.c +++ b/xfixes/xfixes.c @@ -70,11 +70,7 @@ ProcXFixesQueryVersion(ClientPtr client) int major, minor; XFixesClientPtr pXFixesClient = GetXFixesClient(client); - xXFixesQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0 - }; + xXFixesQueryVersionReply rep = { 0 }; if (version_compare(stuff->majorVersion, stuff->minorVersion, SERVER_XFIXES_MAJOR_VERSION, @@ -90,14 +86,10 @@ ProcXFixesQueryVersion(ClientPtr client) pXFixesClient->major_version = major; rep.majorVersion = min(stuff->majorVersion, major); rep.minorVersion = minor; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.majorVersion); - swapl(&rep.minorVersion); - } - WriteToClient(client, sizeof(xXFixesQueryVersionReply), &rep); - return Success; + + REPLY_FIELD_CARD32(majorVersion); + REPLY_FIELD_CARD32(minorVersion); + REPLY_SEND_RET_SUCCESS(); } /* Major version controls available requests */