aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/xres.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xext/xres.c')
-rw-r--r--xorg-server/Xext/xres.c93
1 files changed, 51 insertions, 42 deletions
diff --git a/xorg-server/Xext/xres.c b/xorg-server/Xext/xres.c
index dbefeebdb..7d21ad7e9 100644
--- a/xorg-server/Xext/xres.c
+++ b/xorg-server/Xext/xres.c
@@ -21,7 +21,7 @@
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
-#include "modinit.h"
+#include "extinit.h"
#include "protocol-versions.h"
#include "client.h"
#include "list.h"
@@ -190,26 +190,29 @@ DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx)
ht_destroy(ctx->visitedResources);
}
+extern void ResExtensionInit(void);
+
static int
ProcXResQueryVersion(ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
- xXResQueryVersionReply rep;
+ xXResQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .server_major = SERVER_XRES_MAJOR_VERSION,
+ .server_minor = SERVER_XRES_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.server_major = SERVER_XRES_MAJOR_VERSION;
- rep.server_minor = SERVER_XRES_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
}
- WriteToClient(client, sizeof(xXResQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXResQueryVersionReply), &rep);
return Success;
}
@@ -233,16 +236,18 @@ ProcXResQueryClients(ClientPtr client)
}
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_clients = num_clients;
- rep.length = bytes_to_int32(rep.num_clients * sz_xXResClient);
+ rep = (xXResQueryClientsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(num_clients * sz_xXResClient),
+ .num_clients = num_clients
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.num_clients);
}
- WriteToClient(client, sizeof(xXResQueryClientsReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
if (num_clients) {
xXResClient scratch;
@@ -255,7 +260,7 @@ ProcXResQueryClients(ClientPtr client)
swapl(&scratch.resource_base);
swapl(&scratch.resource_mask);
}
- WriteToClient(client, sz_xXResClient, (char *) &scratch);
+ WriteToClient(client, sz_xXResClient, &scratch);
}
}
@@ -300,18 +305,19 @@ ProcXResQueryClientResources(ClientPtr client)
num_types++;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_types = num_types;
- rep.length = bytes_to_int32(rep.num_types * sz_xXResType);
+ rep = (xXResQueryClientResourcesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(num_types * sz_xXResType),
+ .num_types = num_types
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.num_types);
}
- WriteToClient(client, sizeof(xXResQueryClientResourcesReply),
- (char *) &rep);
+ WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
if (num_types) {
xXResType scratch;
@@ -337,7 +343,7 @@ ProcXResQueryClientResources(ClientPtr client)
swapl(&scratch.resource_type);
swapl(&scratch.count);
}
- WriteToClient(client, sz_xXResType, (char *) &scratch);
+ WriteToClient(client, sz_xXResType, &scratch);
}
}
@@ -471,23 +477,24 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
(pointer)(&bytes));
#endif
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.bytes = bytes;
+ rep = (xXResQueryClientPixmapBytesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .bytes = bytes,
#ifdef _XSERVER64
- rep.bytes_overflow = bytes >> 32;
+ .bytes_overflow = bytes >> 32
#else
- rep.bytes_overflow = 0;
+ .bytes_overflow = 0
#endif
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.bytes);
swapl(&rep.bytes_overflow);
}
- WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply),
- (char *) &rep);
+ WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), &rep);
return Success;
}
@@ -652,7 +659,6 @@ ProcXResQueryClientIds (ClientPtr client)
{
REQUEST(xXResQueryClientIdsReq);
- xXResQueryClientIdsReply rep;
xXResClientIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
int rc;
ConstructClientIdCtx ctx;
@@ -666,12 +672,14 @@ ProcXResQueryClientIds (ClientPtr client)
rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
if (rc == Success) {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
+ xXResQueryClientIdsReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(ctx.resultBytes),
+ .numIds = ctx.numIds
+ };
assert((ctx.resultBytes & 3) == 0);
- rep.length = bytes_to_int32(ctx.resultBytes);
- rep.numIds = ctx.numIds;
if (client->swapped) {
swaps (&rep.sequenceNumber);
@@ -679,7 +687,7 @@ ProcXResQueryClientIds (ClientPtr client)
swapl (&rep.numIds);
}
- WriteToClient(client,sizeof(rep),(char*)&rep);
+ WriteToClient(client, sizeof(rep), &rep);
WriteFragmentsToClient(client, &ctx.response);
}
@@ -1030,7 +1038,6 @@ ProcXResQueryResourceBytes (ClientPtr client)
{
REQUEST(xXResQueryResourceBytesReq);
- xXResQueryResourceBytesReply rep;
int rc;
ConstructResourceBytesCtx ctx;
@@ -1048,10 +1055,12 @@ ProcXResQueryResourceBytes (ClientPtr client)
rc = ConstructResourceBytes(stuff->client, &ctx);
if (rc == Success) {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.numSizes = ctx.numSizes;
- rep.length = bytes_to_int32(ctx.resultBytes);
+ xXResQueryResourceBytesReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(ctx.resultBytes),
+ .numSizes = ctx.numSizes
+ };
if (client->swapped) {
swaps (&rep.sequenceNumber);
@@ -1061,7 +1070,7 @@ ProcXResQueryResourceBytes (ClientPtr client)
SwapXResQueryResourceBytes(&ctx.response);
}
- WriteToClient(client,sizeof(rep),(char*)&rep);
+ WriteToClient(client, sizeof(rep), &rep);
WriteFragmentsToClient(client, &ctx.response);
}
@@ -1177,7 +1186,7 @@ SProcResDispatch (ClientPtr client)
}
void
-ResExtensionInit(INITARGS)
+ResExtensionInit(void)
{
(void) AddExtension(XRES_NAME, 0, 0,
ProcResDispatch, SProcResDispatch,