aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/glxcmds.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-10 14:56:29 +0200
committermarha <marha@users.sourceforge.net>2012-07-10 14:56:29 +0200
commitd137057fd13e83ec15ab416c7fe774741da06047 (patch)
treef4b38caa4f3ecb983f00e84f4f4d8d66699ecbc5 /xorg-server/glx/glxcmds.c
parentc29d91cfd8df084f16d0d2dfa82c3a86f7719a73 (diff)
downloadvcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.tar.gz
vcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.tar.bz2
vcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.zip
fontconfig mesa xserver git update 10 Jul 2012
Diffstat (limited to 'xorg-server/glx/glxcmds.c')
-rw-r--r--xorg-server/glx/glxcmds.c137
1 files changed, 75 insertions, 62 deletions
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index d05421971..c1f4e22f8 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -651,23 +651,23 @@ DoMakeCurrent(__GLXclientState * cl,
StopUsingContext(prevglxc);
+ reply = (xGLXMakeCurrentReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .contextTag = 0
+ };
+
if (glxc) {
StartUsingContext(cl, glxc);
reply.contextTag = glxc->id;
}
- else {
- reply.contextTag = 0;
- }
-
- reply.length = 0;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
if (client->swapped) {
__glXSwapMakeCurrentReply(client, &reply);
}
else {
- WriteToClient(client, sz_xGLXMakeCurrentReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXMakeCurrentReply, &reply);
}
return Success;
}
@@ -722,16 +722,18 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc)
if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
return err;
- reply.isDirect = glxc->isDirect;
- reply.length = 0;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
+ reply = (xGLXIsDirectReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .isDirect = glxc->isDirect
+ };
if (client->swapped) {
__glXSwapIsDirectReply(client, &reply);
}
else {
- WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXIsDirectReply, &reply);
}
return Success;
@@ -757,17 +759,19 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc)
** client if it wants to work with older clients; however, in this
** implementation the server just returns its version number.
*/
- reply.majorVersion = glxMajorVersion;
- reply.minorVersion = glxMinorVersion;
- reply.length = 0;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
+ reply = (xGLXQueryVersionReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = glxMajorVersion,
+ .minorVersion = glxMinorVersion
+ };
if (client->swapped) {
__glXSwapQueryVersionReply(client, &reply);
}
else {
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXQueryVersionReply, &reply);
}
return Success;
}
@@ -935,12 +939,14 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
return err;
- reply.numVisuals = pGlxScreen->numVisuals;
- reply.numProps = GLX_VIS_CONFIG_TOTAL;
- reply.length =
- (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
+ reply = (xGLXGetVisualConfigsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = (pGlxScreen->numVisuals *
+ __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2,
+ .numVisuals = pGlxScreen->numVisuals,
+ .numProps = GLX_VIS_CONFIG_TOTAL
+ };
if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -949,7 +955,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
__GLX_SWAP_INT(&reply.numProps);
}
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
for (i = 0; i < pGlxScreen->numVisuals; i++) {
modes = pGlxScreen->visuals[i];
@@ -1006,7 +1012,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, p);
}
- WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *) buf);
+ WriteToClient(client, __GLX_SIZE_CARD32 * p, buf);
}
return Success;
}
@@ -1039,11 +1045,13 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
if (!validGlxScreen(cl->client, screen, &pGlxScreen, &err))
return err;
- reply.numFBConfigs = pGlxScreen->numFBConfigs;
- reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS;
- reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * reply.numFBConfigs);
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
+ reply = (xGLXGetFBConfigsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = __GLX_FBCONFIG_ATTRIBS_LENGTH * pGlxScreen->numFBConfigs,
+ .numFBConfigs = pGlxScreen->numFBConfigs,
+ .numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS
+ };
if (client->swapped) {
__GLX_SWAP_SHORT(&reply.sequenceNumber);
@@ -1052,7 +1060,7 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
__GLX_SWAP_INT(&reply.numAttribs);
}
- WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply);
for (modes = pGlxScreen->fbconfigs; modes != NULL; modes = modes->next) {
p = 0;
@@ -1663,10 +1671,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
return err;
nProps = 3;
- reply.length = nProps << 1;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.n = nProps;
+ reply = (xGLXQueryContextInfoEXTReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = nProps << 1,
+ .n = nProps
+ };
nReplyBytes = reply.length << 2;
sendBuf = (int *) malloc((size_t) nReplyBytes);
@@ -1685,8 +1695,8 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
}
else {
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) &reply);
- WriteToClient(client, nReplyBytes, (char *) sendBuf);
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
+ WriteToClient(client, nReplyBytes, sendBuf);
}
free((char *) sendBuf);
@@ -1870,10 +1880,12 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
return error;
numAttribs = 3;
- reply.length = numAttribs << 1;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.numAttribs = numAttribs;
+ reply = (xGLXGetDrawableAttributesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = numAttribs << 1,
+ .numAttribs = numAttribs
+ };
attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
@@ -1887,10 +1899,8 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
}
else {
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
- (char *) &reply);
- WriteToClient(client, reply.length * sizeof(CARD32),
- (char *) attributes);
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply);
+ WriteToClient(client, reply.length * sizeof(CARD32), attributes);
}
return Success;
@@ -2311,13 +2321,15 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
n = strlen(pGlxScreen->GLXextensions) + 1;
length = __GLX_PAD(n) >> 2;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = length;
- reply.n = n;
+ reply = (xGLXQueryExtensionsStringReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = length,
+ .n = n
+ };
/* Allocate buffer to make sure it's a multiple of 4 bytes big. */
- buf = (char *) malloc(length << 2);
+ buf = calloc(length, 4);
if (buf == NULL)
return BadAlloc;
memcpy(buf, pGlxScreen->GLXextensions, n);
@@ -2326,9 +2338,8 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
glxSwapQueryExtensionsStringReply(client, &reply, buf);
}
else {
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply,
- (char *) &reply);
- WriteToClient(client, (int) (length << 2), (char *) buf);
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply);
+ WriteToClient(client, (int) (length << 2), buf);
}
free(buf);
@@ -2373,12 +2384,14 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
n = strlen(ptr) + 1;
length = __GLX_PAD(n) >> 2;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = length;
- reply.n = n;
-
- buf = (char *) malloc(length << 2);
+ reply = (xGLXQueryServerStringReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = length,
+ .n = n
+ };
+
+ buf = calloc(length, 4);
if (buf == NULL) {
return BadAlloc;
}
@@ -2388,7 +2401,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
glxSwapQueryServerStringReply(client, &reply, buf);
}
else {
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
+ WriteToClient(client, sz_xGLXQueryServerStringReply, &reply);
WriteToClient(client, (int) (length << 2), buf);
}