From d0b249f1c5df81f3941d638f9625fe1e16c31807 Mon Sep 17 00:00:00 2001 From: George Staplin Date: Sat, 14 Mar 2009 20:40:52 -0600 Subject: [PATCH] GL: glx: Fix an issue with the glxint.h causing an ABI disagreement over the number of properties sent. This is apparently resolved in newer branches of the X server. Add some assertions to prevent this from happening again in the 1.4 branch, and write out the total number of properties actually written, rather than the value from glxint.h. --- GL/glx/glxcmds.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index b45e7c3bd..38eef3de3 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -912,6 +912,15 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc) } +enum { + GLX_VIS_CONFIG_UNPAIRED = 18, + GLX_VIS_CONFIG_PAIRED = 14 +}; + +enum { + GLX_VIS_CONFIG_TOTAL = GLX_VIS_CONFIG_UNPAIRED + GLX_VIS_CONFIG_PAIRED +}; + int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) { @@ -919,7 +928,7 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, xGLXGetVisualConfigsReply reply; __GLXscreen *pGlxScreen; __GLcontextModes *modes; - CARD32 buf[__GLX_TOTAL_CONFIG]; + CARD32 buf[GLX_VIS_CONFIG_TOTAL]; int p; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; @@ -932,9 +941,9 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, pGlxScreen = __glXActiveScreens[screen]; reply.numVisuals = pGlxScreen->numUsableVisuals; - reply.numProps = __GLX_TOTAL_CONFIG; + reply.numProps = GLX_VIS_CONFIG_TOTAL; reply.length = (pGlxScreen->numUsableVisuals * __GLX_SIZE_CARD32 * - __GLX_TOTAL_CONFIG) >> 2; + GLX_VIS_CONFIG_TOTAL) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -974,6 +983,8 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, buf[p++] = modes->stencilBits; buf[p++] = modes->numAuxBuffers; buf[p++] = modes->level; + + assert(p == GLX_VIS_CONFIG_UNPAIRED); /* ** Add token/value pairs for extensions. */ @@ -992,10 +1003,12 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; buf[p++] = modes->transparentIndex; + assert(p == GLX_VIS_CONFIG_TOTAL); + if ( do_swap ) { - __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); + __GLX_SWAP_INT_ARRAY(buf, p); } - WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, + WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *)buf); } return Success;