| File: | glx/singlepixswap.c |
| Location: | line 265, column 5 |
| Description: | Call to 'realloc' has an allocation size of 0 bytes |
| 1 | /* | |||||
| 2 | * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) | |||||
| 3 | * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. | |||||
| 4 | * | |||||
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a | |||||
| 6 | * copy of this software and associated documentation files (the "Software"), | |||||
| 7 | * to deal in the Software without restriction, including without limitation | |||||
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
| 9 | * and/or sell copies of the Software, and to permit persons to whom the | |||||
| 10 | * Software is furnished to do so, subject to the following conditions: | |||||
| 11 | * | |||||
| 12 | * The above copyright notice including the dates of first publication and | |||||
| 13 | * either this permission notice or a reference to | |||||
| 14 | * http://oss.sgi.com/projects/FreeB/ | |||||
| 15 | * shall be included in all copies or substantial portions of the Software. | |||||
| 16 | * | |||||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |||||
| 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
| 20 | * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |||||
| 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF | |||||
| 22 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||||
| 23 | * SOFTWARE. | |||||
| 24 | * | |||||
| 25 | * Except as contained in this notice, the name of Silicon Graphics, Inc. | |||||
| 26 | * shall not be used in advertising or otherwise to promote the sale, use or | |||||
| 27 | * other dealings in this Software without prior written authorization from | |||||
| 28 | * Silicon Graphics, Inc. | |||||
| 29 | */ | |||||
| 30 | ||||||
| 31 | #ifdef HAVE_DIX_CONFIG_H1 | |||||
| 32 | #include <dix-config.h> | |||||
| 33 | #endif | |||||
| 34 | ||||||
| 35 | #include "glxserver.h" | |||||
| 36 | #include "glxext.h" | |||||
| 37 | #include "singlesize.h" | |||||
| 38 | #include "unpack.h" | |||||
| 39 | #include "indirect_dispatch.h" | |||||
| 40 | #include "indirect_size_get.h" | |||||
| 41 | ||||||
| 42 | int | |||||
| 43 | __glXDispSwap_ReadPixels(__GLXclientState * cl, GLbyte * pc) | |||||
| 44 | { | |||||
| 45 | GLsizei width, height; | |||||
| 46 | GLenum format, type; | |||||
| 47 | GLboolean swapBytes, lsbFirst; | |||||
| 48 | GLint compsize; | |||||
| 49 | ||||||
| 50 | __GLX_DECLARE_SWAP_VARIABLESGLbyte sw; | |||||
| 51 | __GLXcontext *cx; | |||||
| 52 | ClientPtr client = cl->client; | |||||
| 53 | int error; | |||||
| 54 | char *answer, answerBuffer[200]; | |||||
| 55 | ||||||
| 56 | REQUEST_FIXED_SIZE(xGLXSingleReq, 28)if (((sizeof(xGLXSingleReq) >> 2) > client->req_len ) || (((28) >> 2) >= client->req_len) || ((((uint64_t ) sizeof(xGLXSingleReq) + (28) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 57 | ||||||
| 58 | __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag)sw = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag)) [0]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag)) [0] = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag) )[3]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag) )[3] = sw; sw = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[1]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[1] = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[2]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[2] = sw;; | |||||
| 59 | cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc)(((xGLXSingleReq*)pc)->contextTag), &error); | |||||
| 60 | if (!cx) { | |||||
| 61 | return error; | |||||
| 62 | } | |||||
| 63 | ||||||
| 64 | pc += __GLX_SINGLE_HDR_SIZE8; | |||||
| 65 | __GLX_SWAP_INT(pc + 0)sw = ((GLbyte *)(pc + 0))[0]; ((GLbyte *)(pc + 0))[0] = ((GLbyte *)(pc + 0))[3]; ((GLbyte *)(pc + 0))[3] = sw; sw = ((GLbyte * )(pc + 0))[1]; ((GLbyte *)(pc + 0))[1] = ((GLbyte *)(pc + 0)) [2]; ((GLbyte *)(pc + 0))[2] = sw;; | |||||
| 66 | __GLX_SWAP_INT(pc + 4)sw = ((GLbyte *)(pc + 4))[0]; ((GLbyte *)(pc + 4))[0] = ((GLbyte *)(pc + 4))[3]; ((GLbyte *)(pc + 4))[3] = sw; sw = ((GLbyte * )(pc + 4))[1]; ((GLbyte *)(pc + 4))[1] = ((GLbyte *)(pc + 4)) [2]; ((GLbyte *)(pc + 4))[2] = sw;; | |||||
| 67 | __GLX_SWAP_INT(pc + 8)sw = ((GLbyte *)(pc + 8))[0]; ((GLbyte *)(pc + 8))[0] = ((GLbyte *)(pc + 8))[3]; ((GLbyte *)(pc + 8))[3] = sw; sw = ((GLbyte * )(pc + 8))[1]; ((GLbyte *)(pc + 8))[1] = ((GLbyte *)(pc + 8)) [2]; ((GLbyte *)(pc + 8))[2] = sw;; | |||||
| 68 | __GLX_SWAP_INT(pc + 12)sw = ((GLbyte *)(pc + 12))[0]; ((GLbyte *)(pc + 12))[0] = ((GLbyte *)(pc + 12))[3]; ((GLbyte *)(pc + 12))[3] = sw; sw = ((GLbyte *)(pc + 12))[1]; ((GLbyte *)(pc + 12))[1] = ((GLbyte *)(pc + 12))[2]; ((GLbyte *)(pc + 12))[2] = sw;; | |||||
| 69 | __GLX_SWAP_INT(pc + 16)sw = ((GLbyte *)(pc + 16))[0]; ((GLbyte *)(pc + 16))[0] = ((GLbyte *)(pc + 16))[3]; ((GLbyte *)(pc + 16))[3] = sw; sw = ((GLbyte *)(pc + 16))[1]; ((GLbyte *)(pc + 16))[1] = ((GLbyte *)(pc + 16))[2]; ((GLbyte *)(pc + 16))[2] = sw;; | |||||
| 70 | __GLX_SWAP_INT(pc + 20)sw = ((GLbyte *)(pc + 20))[0]; ((GLbyte *)(pc + 20))[0] = ((GLbyte *)(pc + 20))[3]; ((GLbyte *)(pc + 20))[3] = sw; sw = ((GLbyte *)(pc + 20))[1]; ((GLbyte *)(pc + 20))[1] = ((GLbyte *)(pc + 20))[2]; ((GLbyte *)(pc + 20))[2] = sw;; | |||||
| 71 | ||||||
| 72 | width = *(GLsizei *) (pc + 8); | |||||
| 73 | height = *(GLsizei *) (pc + 12); | |||||
| 74 | format = *(GLenum *) (pc + 16); | |||||
| 75 | type = *(GLenum *) (pc + 20); | |||||
| 76 | swapBytes = *(GLboolean *) (pc + 24); | |||||
| 77 | lsbFirst = *(GLboolean *) (pc + 25); | |||||
| 78 | compsize = __glReadPixels_size(format, type, width, height); | |||||
| 79 | if (compsize < 0) | |||||
| 80 | return BadLength16; | |||||
| 81 | ||||||
| 82 | glPixelStorei(GL_PACK_SWAP_BYTES0x0D00, !swapBytes); | |||||
| 83 | glPixelStorei(GL_PACK_LSB_FIRST0x0D01, lsbFirst); | |||||
| 84 | __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1)if (compsize < 0) return 16; else if ((compsize) > sizeof (answerBuffer)) { int bump; if ((cl)->returnBufSize < ( compsize)+(1)) { (cl)->returnBuf = (GLbyte*)realloc((cl)-> returnBuf, (compsize)+(1)); if (!(cl)->returnBuf) { return 11; } (cl)->returnBufSize = (compsize)+(1); } answer = (char *)cl->returnBuf; bump = (long)(answer) % (1); if (bump) answer += (1) - (bump); } else { answer = (char *)answerBuffer; }; | |||||
| 85 | __glXClearErrorOccured(); | |||||
| 86 | glReadPixels(*(GLint *) (pc + 0), *(GLint *) (pc + 4), | |||||
| 87 | *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12), | |||||
| 88 | *(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer); | |||||
| 89 | ||||||
| 90 | if (__glXErrorOccured()) { | |||||
| 91 | __GLX_BEGIN_REPLY(0)__glXReply.length = (((0)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 92 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 93 | __GLX_SEND_HEADER()WriteToClient (client, 32, &__glXReply);; | |||||
| 94 | } | |||||
| 95 | else { | |||||
| 96 | __GLX_BEGIN_REPLY(compsize)__glXReply.length = (((compsize)+3) & (GLuint)~3) >> 2; __glXReply.type = 1; __glXReply.sequenceNumber = client-> sequence;; | |||||
| 97 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 98 | __GLX_SEND_HEADER()WriteToClient (client, 32, &__glXReply);; | |||||
| 99 | __GLX_SEND_VOID_ARRAY(compsize)WriteToClient(client, ((((compsize)*1)+3) & (GLuint)~3), answer ); | |||||
| 100 | } | |||||
| 101 | return Success0; | |||||
| 102 | } | |||||
| 103 | ||||||
| 104 | int | |||||
| 105 | __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc) | |||||
| 106 | { | |||||
| 107 | GLint level, compsize; | |||||
| 108 | GLenum format, type, target; | |||||
| 109 | GLboolean swapBytes; | |||||
| 110 | ||||||
| 111 | __GLX_DECLARE_SWAP_VARIABLESGLbyte sw; | |||||
| 112 | __GLXcontext *cx; | |||||
| 113 | ClientPtr client = cl->client; | |||||
| 114 | int error; | |||||
| 115 | char *answer, answerBuffer[200]; | |||||
| 116 | GLint width = 0, height = 0, depth = 1; | |||||
| 117 | ||||||
| 118 | REQUEST_FIXED_SIZE(xGLXSingleReq, 20)if (((sizeof(xGLXSingleReq) >> 2) > client->req_len ) || (((20) >> 2) >= client->req_len) || ((((uint64_t ) sizeof(xGLXSingleReq) + (20) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 119 | ||||||
| 120 | __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag)sw = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag)) [0]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag)) [0] = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag) )[3]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag) )[3] = sw; sw = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[1]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[1] = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[2]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[2] = sw;; | |||||
| 121 | cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc)(((xGLXSingleReq*)pc)->contextTag), &error); | |||||
| 122 | if (!cx) { | |||||
| 123 | return error; | |||||
| 124 | } | |||||
| 125 | ||||||
| 126 | pc += __GLX_SINGLE_HDR_SIZE8; | |||||
| 127 | __GLX_SWAP_INT(pc + 0)sw = ((GLbyte *)(pc + 0))[0]; ((GLbyte *)(pc + 0))[0] = ((GLbyte *)(pc + 0))[3]; ((GLbyte *)(pc + 0))[3] = sw; sw = ((GLbyte * )(pc + 0))[1]; ((GLbyte *)(pc + 0))[1] = ((GLbyte *)(pc + 0)) [2]; ((GLbyte *)(pc + 0))[2] = sw;; | |||||
| 128 | __GLX_SWAP_INT(pc + 4)sw = ((GLbyte *)(pc + 4))[0]; ((GLbyte *)(pc + 4))[0] = ((GLbyte *)(pc + 4))[3]; ((GLbyte *)(pc + 4))[3] = sw; sw = ((GLbyte * )(pc + 4))[1]; ((GLbyte *)(pc + 4))[1] = ((GLbyte *)(pc + 4)) [2]; ((GLbyte *)(pc + 4))[2] = sw;; | |||||
| 129 | __GLX_SWAP_INT(pc + 8)sw = ((GLbyte *)(pc + 8))[0]; ((GLbyte *)(pc + 8))[0] = ((GLbyte *)(pc + 8))[3]; ((GLbyte *)(pc + 8))[3] = sw; sw = ((GLbyte * )(pc + 8))[1]; ((GLbyte *)(pc + 8))[1] = ((GLbyte *)(pc + 8)) [2]; ((GLbyte *)(pc + 8))[2] = sw;; | |||||
| 130 | __GLX_SWAP_INT(pc + 12)sw = ((GLbyte *)(pc + 12))[0]; ((GLbyte *)(pc + 12))[0] = ((GLbyte *)(pc + 12))[3]; ((GLbyte *)(pc + 12))[3] = sw; sw = ((GLbyte *)(pc + 12))[1]; ((GLbyte *)(pc + 12))[1] = ((GLbyte *)(pc + 12))[2]; ((GLbyte *)(pc + 12))[2] = sw;; | |||||
| 131 | ||||||
| 132 | level = *(GLint *) (pc + 4); | |||||
| 133 | format = *(GLenum *) (pc + 8); | |||||
| 134 | type = *(GLenum *) (pc + 12); | |||||
| 135 | target = *(GLenum *) (pc + 0); | |||||
| 136 | swapBytes = *(GLboolean *) (pc + 16); | |||||
| 137 | ||||||
| 138 | glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH0x1000, &width); | |||||
| 139 | glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT0x1001, &height); | |||||
| 140 | if (target == GL_TEXTURE_3D0x806F) { | |||||
| 141 | glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH0x8071, &depth); | |||||
| 142 | } | |||||
| 143 | /* | |||||
| 144 | * The three queries above might fail if we're in a state where queries | |||||
| 145 | * are illegal, but then width, height, and depth would still be zero anyway. | |||||
| 146 | */ | |||||
| 147 | compsize = | |||||
| 148 | __glGetTexImage_size(target, level, format, type, width, height, depth); | |||||
| 149 | if (compsize < 0) | |||||
| 150 | return BadLength16; | |||||
| 151 | ||||||
| 152 | glPixelStorei(GL_PACK_SWAP_BYTES0x0D00, !swapBytes); | |||||
| 153 | __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1)if (compsize < 0) return 16; else if ((compsize) > sizeof (answerBuffer)) { int bump; if ((cl)->returnBufSize < ( compsize)+(1)) { (cl)->returnBuf = (GLbyte*)realloc((cl)-> returnBuf, (compsize)+(1)); if (!(cl)->returnBuf) { return 11; } (cl)->returnBufSize = (compsize)+(1); } answer = (char *)cl->returnBuf; bump = (long)(answer) % (1); if (bump) answer += (1) - (bump); } else { answer = (char *)answerBuffer; }; | |||||
| 154 | __glXClearErrorOccured(); | |||||
| 155 | glGetTexImage(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), | |||||
| 156 | *(GLenum *) (pc + 8), *(GLenum *) (pc + 12), answer); | |||||
| 157 | ||||||
| 158 | if (__glXErrorOccured()) { | |||||
| 159 | __GLX_BEGIN_REPLY(0)__glXReply.length = (((0)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 160 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 161 | __GLX_SEND_HEADER()WriteToClient (client, 32, &__glXReply);; | |||||
| 162 | } | |||||
| 163 | else { | |||||
| 164 | __GLX_BEGIN_REPLY(compsize)__glXReply.length = (((compsize)+3) & (GLuint)~3) >> 2; __glXReply.type = 1; __glXReply.sequenceNumber = client-> sequence;; | |||||
| 165 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 166 | __GLX_SWAP_INT(&width)sw = ((GLbyte *)(&width))[0]; ((GLbyte *)(&width))[0] = ((GLbyte *)(&width))[3]; ((GLbyte *)(&width))[3] = sw; sw = ((GLbyte *)(&width))[1]; ((GLbyte *)(&width ))[1] = ((GLbyte *)(&width))[2]; ((GLbyte *)(&width)) [2] = sw;; | |||||
| 167 | __GLX_SWAP_INT(&height)sw = ((GLbyte *)(&height))[0]; ((GLbyte *)(&height))[ 0] = ((GLbyte *)(&height))[3]; ((GLbyte *)(&height))[ 3] = sw; sw = ((GLbyte *)(&height))[1]; ((GLbyte *)(& height))[1] = ((GLbyte *)(&height))[2]; ((GLbyte *)(& height))[2] = sw;; | |||||
| 168 | __GLX_SWAP_INT(&depth)sw = ((GLbyte *)(&depth))[0]; ((GLbyte *)(&depth))[0] = ((GLbyte *)(&depth))[3]; ((GLbyte *)(&depth))[3] = sw; sw = ((GLbyte *)(&depth))[1]; ((GLbyte *)(&depth ))[1] = ((GLbyte *)(&depth))[2]; ((GLbyte *)(&depth)) [2] = sw;; | |||||
| 169 | ((xGLXGetTexImageReply *) &__glXReply)->width = width; | |||||
| 170 | ((xGLXGetTexImageReply *) &__glXReply)->height = height; | |||||
| 171 | ((xGLXGetTexImageReply *) &__glXReply)->depth = depth; | |||||
| 172 | __GLX_SEND_HEADER()WriteToClient (client, 32, &__glXReply);; | |||||
| 173 | __GLX_SEND_VOID_ARRAY(compsize)WriteToClient(client, ((((compsize)*1)+3) & (GLuint)~3), answer ); | |||||
| 174 | } | |||||
| 175 | return Success0; | |||||
| 176 | } | |||||
| 177 | ||||||
| 178 | int | |||||
| 179 | __glXDispSwap_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc) | |||||
| 180 | { | |||||
| 181 | GLboolean lsbFirst; | |||||
| 182 | __GLXcontext *cx; | |||||
| 183 | ClientPtr client = cl->client; | |||||
| 184 | int error; | |||||
| 185 | GLubyte answerBuffer[200]; | |||||
| 186 | char *answer; | |||||
| 187 | ||||||
| 188 | __GLX_DECLARE_SWAP_VARIABLESGLbyte sw; | |||||
| 189 | ||||||
| 190 | REQUEST_FIXED_SIZE(xGLXSingleReq, 4)if (((sizeof(xGLXSingleReq) >> 2) > client->req_len ) || (((4) >> 2) >= client->req_len) || ((((uint64_t ) sizeof(xGLXSingleReq) + (4) + 3) >> 2) != (uint64_t) client ->req_len)) return(16); | |||||
| 191 | ||||||
| 192 | __GLX_SWAP_INT(&((xGLXSingleReq *) pc)->contextTag)sw = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag)) [0]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag)) [0] = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag) )[3]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag) )[3] = sw; sw = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[1]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[1] = ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[2]; ((GLbyte *)(&((xGLXSingleReq *) pc)->contextTag ))[2] = sw;; | |||||
| 193 | cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc)(((xGLXSingleReq*)pc)->contextTag), &error); | |||||
| 194 | if (!cx) { | |||||
| 195 | return error; | |||||
| 196 | } | |||||
| 197 | pc += __GLX_SINGLE_HDR_SIZE8; | |||||
| 198 | lsbFirst = *(GLboolean *) (pc + 0); | |||||
| 199 | ||||||
| 200 | glPixelStorei(GL_PACK_LSB_FIRST0x0D01, lsbFirst); | |||||
| 201 | __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1)if (128 < 0) return 16; else if ((128) > sizeof(answerBuffer )) { int bump; if ((cl)->returnBufSize < (128)+(1)) { ( cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, (128 )+(1)); if (!(cl)->returnBuf) { return 11; } (cl)->returnBufSize = (128)+(1); } answer = (char*)cl->returnBuf; bump = (long )(answer) % (1); if (bump) answer += (1) - (bump); } else { answer = (char *)answerBuffer; }; | |||||
| 202 | ||||||
| 203 | __glXClearErrorOccured(); | |||||
| 204 | glGetPolygonStipple((GLubyte *) answer); | |||||
| 205 | if (__glXErrorOccured()) { | |||||
| 206 | __GLX_BEGIN_REPLY(0)__glXReply.length = (((0)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 207 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 208 | __GLX_SEND_HEADER()WriteToClient (client, 32, &__glXReply);; | |||||
| 209 | } | |||||
| 210 | else { | |||||
| 211 | __GLX_BEGIN_REPLY(128)__glXReply.length = (((128)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 212 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 213 | __GLX_SEND_HEADER()WriteToClient (client, 32, &__glXReply);; | |||||
| 214 | __GLX_SEND_BYTE_ARRAY(128)WriteToClient(client, ((((128)*1)+3) & (GLuint)~3), answer ); | |||||
| 215 | } | |||||
| 216 | return Success0; | |||||
| 217 | } | |||||
| 218 | ||||||
| 219 | static int | |||||
| 220 | GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) | |||||
| 221 | { | |||||
| 222 | GLint compsize, compsize2; | |||||
| 223 | GLenum format, type, target; | |||||
| 224 | GLboolean swapBytes; | |||||
| 225 | __GLXcontext *cx; | |||||
| 226 | ClientPtr client = cl->client; | |||||
| 227 | int error; | |||||
| 228 | ||||||
| 229 | __GLX_DECLARE_SWAP_VARIABLESGLbyte sw; | |||||
| 230 | char *answer, answerBuffer[200]; | |||||
| 231 | GLint width = 0, height = 0; | |||||
| 232 | ||||||
| 233 | cx = __glXForceCurrent(cl, tag, &error); | |||||
| 234 | if (!cx) { | |||||
| 235 | return error; | |||||
| 236 | } | |||||
| 237 | ||||||
| 238 | __GLX_SWAP_INT(pc + 0)sw = ((GLbyte *)(pc + 0))[0]; ((GLbyte *)(pc + 0))[0] = ((GLbyte *)(pc + 0))[3]; ((GLbyte *)(pc + 0))[3] = sw; sw = ((GLbyte * )(pc + 0))[1]; ((GLbyte *)(pc + 0))[1] = ((GLbyte *)(pc + 0)) [2]; ((GLbyte *)(pc + 0))[2] = sw;; | |||||
| 239 | __GLX_SWAP_INT(pc + 4)sw = ((GLbyte *)(pc + 4))[0]; ((GLbyte *)(pc + 4))[0] = ((GLbyte *)(pc + 4))[3]; ((GLbyte *)(pc + 4))[3] = sw; sw = ((GLbyte * )(pc + 4))[1]; ((GLbyte *)(pc + 4))[1] = ((GLbyte *)(pc + 4)) [2]; ((GLbyte *)(pc + 4))[2] = sw;; | |||||
| 240 | __GLX_SWAP_INT(pc + 8)sw = ((GLbyte *)(pc + 8))[0]; ((GLbyte *)(pc + 8))[0] = ((GLbyte *)(pc + 8))[3]; ((GLbyte *)(pc + 8))[3] = sw; sw = ((GLbyte * )(pc + 8))[1]; ((GLbyte *)(pc + 8))[1] = ((GLbyte *)(pc + 8)) [2]; ((GLbyte *)(pc + 8))[2] = sw;; | |||||
| 241 | ||||||
| 242 | format = *(GLenum *) (pc + 4); | |||||
| 243 | type = *(GLenum *) (pc + 8); | |||||
| 244 | target = *(GLenum *) (pc + 0); | |||||
| 245 | swapBytes = *(GLboolean *) (pc + 12); | |||||
| 246 | ||||||
| 247 | /* target must be SEPARABLE_2D, however I guess we can let the GL | |||||
| 248 | barf on this one.... */ | |||||
| 249 | ||||||
| 250 | glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH0x8018, &width); | |||||
| 251 | glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT0x8019, &height); | |||||
| 252 | /* | |||||
| 253 | * The two queries above might fail if we're in a state where queries | |||||
| 254 | * are illegal, but then width and height would still be zero anyway. | |||||
| 255 | */ | |||||
| 256 | compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); | |||||
| 257 | compsize2 = __glGetTexImage_size(target, 1, format, type, height, 1, 1); | |||||
| 258 | ||||||
| 259 | if ((compsize = safe_pad(compsize)) < 0) | |||||
| 260 | return BadLength16; | |||||
| 261 | if ((compsize2 = safe_pad(compsize2)) < 0) | |||||
| 262 | return BadLength16; | |||||
| 263 | ||||||
| 264 | glPixelStorei(GL_PACK_SWAP_BYTES0x0D00, !swapBytes); | |||||
| 265 | __GLX_GET_ANSWER_BUFFER(answer, cl, safe_add(compsize, compsize2), 1)if (safe_add(compsize, compsize2) < 0) return 16; else if ( (safe_add(compsize, compsize2)) > sizeof(answerBuffer)) { int bump; if ((cl)->returnBufSize < (safe_add(compsize, compsize2 ))+(1)) { (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf , (safe_add(compsize, compsize2))+(1)); if (!(cl)->returnBuf ) { return 11; } (cl)->returnBufSize = (safe_add(compsize, compsize2))+(1); } answer = (char*)cl->returnBuf; bump = ( long)(answer) % (1); if (bump) answer += (1) - (bump); } else { answer = (char *)answerBuffer; }; | |||||
| ||||||
| 266 | __glXClearErrorOccured(); | |||||
| 267 | glGetSeparableFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), | |||||
| 268 | *(GLenum *) (pc + 8), answer, answer + compsize, NULL((void*)0)); | |||||
| 269 | ||||||
| 270 | if (__glXErrorOccured()) { | |||||
| 271 | __GLX_BEGIN_REPLY(0)__glXReply.length = (((0)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 272 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 273 | } | |||||
| 274 | else { | |||||
| 275 | __GLX_BEGIN_REPLY(compsize + compsize2)__glXReply.length = (((compsize + compsize2)+3) & (GLuint )~3) >> 2; __glXReply.type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 276 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 277 | __GLX_SWAP_INT(&width)sw = ((GLbyte *)(&width))[0]; ((GLbyte *)(&width))[0] = ((GLbyte *)(&width))[3]; ((GLbyte *)(&width))[3] = sw; sw = ((GLbyte *)(&width))[1]; ((GLbyte *)(&width ))[1] = ((GLbyte *)(&width))[2]; ((GLbyte *)(&width)) [2] = sw;; | |||||
| 278 | __GLX_SWAP_INT(&height)sw = ((GLbyte *)(&height))[0]; ((GLbyte *)(&height))[ 0] = ((GLbyte *)(&height))[3]; ((GLbyte *)(&height))[ 3] = sw; sw = ((GLbyte *)(&height))[1]; ((GLbyte *)(& height))[1] = ((GLbyte *)(&height))[2]; ((GLbyte *)(& height))[2] = sw;; | |||||
| 279 | ((xGLXGetSeparableFilterReply *) &__glXReply)->width = width; | |||||
| 280 | ((xGLXGetSeparableFilterReply *) &__glXReply)->height = height; | |||||
| 281 | __GLX_SEND_VOID_ARRAY(compsize + compsize2)WriteToClient(client, ((((compsize + compsize2)*1)+3) & ( GLuint)~3), answer); | |||||
| 282 | } | |||||
| 283 | ||||||
| 284 | return Success0; | |||||
| 285 | } | |||||
| 286 | ||||||
| 287 | int | |||||
| 288 | __glXDispSwap_GetSeparableFilter(__GLXclientState * cl, GLbyte * pc) | |||||
| 289 | { | |||||
| 290 | const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc)(((xGLXSingleReq*)pc)->contextTag); | |||||
| 291 | ClientPtr client = cl->client; | |||||
| 292 | ||||||
| 293 | REQUEST_FIXED_SIZE(xGLXSingleReq, 16)if (((sizeof(xGLXSingleReq) >> 2) > client->req_len ) || (((16) >> 2) >= client->req_len) || ((((uint64_t ) sizeof(xGLXSingleReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 294 | return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE8, tag); | |||||
| 295 | } | |||||
| 296 | ||||||
| 297 | int | |||||
| 298 | __glXDispSwap_GetSeparableFilterEXT(__GLXclientState * cl, GLbyte * pc) | |||||
| 299 | { | |||||
| 300 | const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc)(((xGLXVendorPrivateReq*)pc)->contextTag); | |||||
| 301 | ClientPtr client = cl->client; | |||||
| 302 | ||||||
| 303 | REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16)if (((sizeof(xGLXVendorPrivateReq) >> 2) > client-> req_len) || (((16) >> 2) >= client->req_len) || ( (((uint64_t) sizeof(xGLXVendorPrivateReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 304 | return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE12, tag); | |||||
| ||||||
| 305 | } | |||||
| 306 | ||||||
| 307 | static int | |||||
| 308 | GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) | |||||
| 309 | { | |||||
| 310 | GLint compsize; | |||||
| 311 | GLenum format, type, target; | |||||
| 312 | GLboolean swapBytes; | |||||
| 313 | __GLXcontext *cx; | |||||
| 314 | ClientPtr client = cl->client; | |||||
| 315 | int error; | |||||
| 316 | ||||||
| 317 | __GLX_DECLARE_SWAP_VARIABLESGLbyte sw; | |||||
| 318 | char *answer, answerBuffer[200]; | |||||
| 319 | GLint width = 0, height = 0; | |||||
| 320 | ||||||
| 321 | cx = __glXForceCurrent(cl, tag, &error); | |||||
| 322 | if (!cx) { | |||||
| 323 | return error; | |||||
| 324 | } | |||||
| 325 | ||||||
| 326 | __GLX_SWAP_INT(pc + 0)sw = ((GLbyte *)(pc + 0))[0]; ((GLbyte *)(pc + 0))[0] = ((GLbyte *)(pc + 0))[3]; ((GLbyte *)(pc + 0))[3] = sw; sw = ((GLbyte * )(pc + 0))[1]; ((GLbyte *)(pc + 0))[1] = ((GLbyte *)(pc + 0)) [2]; ((GLbyte *)(pc + 0))[2] = sw;; | |||||
| 327 | __GLX_SWAP_INT(pc + 4)sw = ((GLbyte *)(pc + 4))[0]; ((GLbyte *)(pc + 4))[0] = ((GLbyte *)(pc + 4))[3]; ((GLbyte *)(pc + 4))[3] = sw; sw = ((GLbyte * )(pc + 4))[1]; ((GLbyte *)(pc + 4))[1] = ((GLbyte *)(pc + 4)) [2]; ((GLbyte *)(pc + 4))[2] = sw;; | |||||
| 328 | __GLX_SWAP_INT(pc + 8)sw = ((GLbyte *)(pc + 8))[0]; ((GLbyte *)(pc + 8))[0] = ((GLbyte *)(pc + 8))[3]; ((GLbyte *)(pc + 8))[3] = sw; sw = ((GLbyte * )(pc + 8))[1]; ((GLbyte *)(pc + 8))[1] = ((GLbyte *)(pc + 8)) [2]; ((GLbyte *)(pc + 8))[2] = sw;; | |||||
| 329 | ||||||
| 330 | format = *(GLenum *) (pc + 4); | |||||
| 331 | type = *(GLenum *) (pc + 8); | |||||
| 332 | target = *(GLenum *) (pc + 0); | |||||
| 333 | swapBytes = *(GLboolean *) (pc + 12); | |||||
| 334 | ||||||
| 335 | glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH0x8018, &width); | |||||
| 336 | if (target == GL_CONVOLUTION_2D0x8011) { | |||||
| 337 | height = 1; | |||||
| 338 | } | |||||
| 339 | else { | |||||
| 340 | glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT0x8019, &height); | |||||
| 341 | } | |||||
| 342 | /* | |||||
| 343 | * The two queries above might fail if we're in a state where queries | |||||
| 344 | * are illegal, but then width and height would still be zero anyway. | |||||
| 345 | */ | |||||
| 346 | compsize = __glGetTexImage_size(target, 1, format, type, width, height, 1); | |||||
| 347 | if (compsize < 0) | |||||
| 348 | return BadLength16; | |||||
| 349 | ||||||
| 350 | glPixelStorei(GL_PACK_SWAP_BYTES0x0D00, !swapBytes); | |||||
| 351 | __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1)if (compsize < 0) return 16; else if ((compsize) > sizeof (answerBuffer)) { int bump; if ((cl)->returnBufSize < ( compsize)+(1)) { (cl)->returnBuf = (GLbyte*)realloc((cl)-> returnBuf, (compsize)+(1)); if (!(cl)->returnBuf) { return 11; } (cl)->returnBufSize = (compsize)+(1); } answer = (char *)cl->returnBuf; bump = (long)(answer) % (1); if (bump) answer += (1) - (bump); } else { answer = (char *)answerBuffer; }; | |||||
| 352 | __glXClearErrorOccured(); | |||||
| 353 | glGetConvolutionFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), | |||||
| 354 | *(GLenum *) (pc + 8), answer); | |||||
| 355 | ||||||
| 356 | if (__glXErrorOccured()) { | |||||
| 357 | __GLX_BEGIN_REPLY(0)__glXReply.length = (((0)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 358 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 359 | } | |||||
| 360 | else { | |||||
| 361 | __GLX_BEGIN_REPLY(compsize)__glXReply.length = (((compsize)+3) & (GLuint)~3) >> 2; __glXReply.type = 1; __glXReply.sequenceNumber = client-> sequence;; | |||||
| 362 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 363 | __GLX_SWAP_INT(&width)sw = ((GLbyte *)(&width))[0]; ((GLbyte *)(&width))[0] = ((GLbyte *)(&width))[3]; ((GLbyte *)(&width))[3] = sw; sw = ((GLbyte *)(&width))[1]; ((GLbyte *)(&width ))[1] = ((GLbyte *)(&width))[2]; ((GLbyte *)(&width)) [2] = sw;; | |||||
| 364 | __GLX_SWAP_INT(&height)sw = ((GLbyte *)(&height))[0]; ((GLbyte *)(&height))[ 0] = ((GLbyte *)(&height))[3]; ((GLbyte *)(&height))[ 3] = sw; sw = ((GLbyte *)(&height))[1]; ((GLbyte *)(& height))[1] = ((GLbyte *)(&height))[2]; ((GLbyte *)(& height))[2] = sw;; | |||||
| 365 | ((xGLXGetConvolutionFilterReply *) &__glXReply)->width = width; | |||||
| 366 | ((xGLXGetConvolutionFilterReply *) &__glXReply)->height = height; | |||||
| 367 | __GLX_SEND_VOID_ARRAY(compsize)WriteToClient(client, ((((compsize)*1)+3) & (GLuint)~3), answer ); | |||||
| 368 | } | |||||
| 369 | ||||||
| 370 | return Success0; | |||||
| 371 | } | |||||
| 372 | ||||||
| 373 | int | |||||
| 374 | __glXDispSwap_GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc) | |||||
| 375 | { | |||||
| 376 | const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc)(((xGLXSingleReq*)pc)->contextTag); | |||||
| 377 | ClientPtr client = cl->client; | |||||
| 378 | ||||||
| 379 | REQUEST_FIXED_SIZE(xGLXSingleReq, 16)if (((sizeof(xGLXSingleReq) >> 2) > client->req_len ) || (((16) >> 2) >= client->req_len) || ((((uint64_t ) sizeof(xGLXSingleReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 380 | return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE8, tag); | |||||
| 381 | } | |||||
| 382 | ||||||
| 383 | int | |||||
| 384 | __glXDispSwap_GetConvolutionFilterEXT(__GLXclientState * cl, GLbyte * pc) | |||||
| 385 | { | |||||
| 386 | const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc)(((xGLXVendorPrivateReq*)pc)->contextTag); | |||||
| 387 | ClientPtr client = cl->client; | |||||
| 388 | ||||||
| 389 | REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16)if (((sizeof(xGLXVendorPrivateReq) >> 2) > client-> req_len) || (((16) >> 2) >= client->req_len) || ( (((uint64_t) sizeof(xGLXVendorPrivateReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 390 | return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE12, tag); | |||||
| 391 | } | |||||
| 392 | ||||||
| 393 | static int | |||||
| 394 | GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) | |||||
| 395 | { | |||||
| 396 | GLint compsize; | |||||
| 397 | GLenum format, type, target; | |||||
| 398 | GLboolean swapBytes, reset; | |||||
| 399 | __GLXcontext *cx; | |||||
| 400 | ClientPtr client = cl->client; | |||||
| 401 | int error; | |||||
| 402 | ||||||
| 403 | __GLX_DECLARE_SWAP_VARIABLESGLbyte sw; | |||||
| 404 | char *answer, answerBuffer[200]; | |||||
| 405 | GLint width = 0; | |||||
| 406 | ||||||
| 407 | cx = __glXForceCurrent(cl, tag, &error); | |||||
| 408 | if (!cx) { | |||||
| 409 | return error; | |||||
| 410 | } | |||||
| 411 | ||||||
| 412 | __GLX_SWAP_INT(pc + 0)sw = ((GLbyte *)(pc + 0))[0]; ((GLbyte *)(pc + 0))[0] = ((GLbyte *)(pc + 0))[3]; ((GLbyte *)(pc + 0))[3] = sw; sw = ((GLbyte * )(pc + 0))[1]; ((GLbyte *)(pc + 0))[1] = ((GLbyte *)(pc + 0)) [2]; ((GLbyte *)(pc + 0))[2] = sw;; | |||||
| 413 | __GLX_SWAP_INT(pc + 4)sw = ((GLbyte *)(pc + 4))[0]; ((GLbyte *)(pc + 4))[0] = ((GLbyte *)(pc + 4))[3]; ((GLbyte *)(pc + 4))[3] = sw; sw = ((GLbyte * )(pc + 4))[1]; ((GLbyte *)(pc + 4))[1] = ((GLbyte *)(pc + 4)) [2]; ((GLbyte *)(pc + 4))[2] = sw;; | |||||
| 414 | __GLX_SWAP_INT(pc + 8)sw = ((GLbyte *)(pc + 8))[0]; ((GLbyte *)(pc + 8))[0] = ((GLbyte *)(pc + 8))[3]; ((GLbyte *)(pc + 8))[3] = sw; sw = ((GLbyte * )(pc + 8))[1]; ((GLbyte *)(pc + 8))[1] = ((GLbyte *)(pc + 8)) [2]; ((GLbyte *)(pc + 8))[2] = sw;; | |||||
| 415 | ||||||
| 416 | format = *(GLenum *) (pc + 4); | |||||
| 417 | type = *(GLenum *) (pc + 8); | |||||
| 418 | target = *(GLenum *) (pc + 0); | |||||
| 419 | swapBytes = *(GLboolean *) (pc + 12); | |||||
| 420 | reset = *(GLboolean *) (pc + 13); | |||||
| 421 | ||||||
| 422 | glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH0x8026, &width); | |||||
| 423 | /* | |||||
| 424 | * The one query above might fail if we're in a state where queries | |||||
| 425 | * are illegal, but then width would still be zero anyway. | |||||
| 426 | */ | |||||
| 427 | compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); | |||||
| 428 | if (compsize < 0) | |||||
| 429 | return BadLength16; | |||||
| 430 | ||||||
| 431 | glPixelStorei(GL_PACK_SWAP_BYTES0x0D00, !swapBytes); | |||||
| 432 | __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1)if (compsize < 0) return 16; else if ((compsize) > sizeof (answerBuffer)) { int bump; if ((cl)->returnBufSize < ( compsize)+(1)) { (cl)->returnBuf = (GLbyte*)realloc((cl)-> returnBuf, (compsize)+(1)); if (!(cl)->returnBuf) { return 11; } (cl)->returnBufSize = (compsize)+(1); } answer = (char *)cl->returnBuf; bump = (long)(answer) % (1); if (bump) answer += (1) - (bump); } else { answer = (char *)answerBuffer; }; | |||||
| 433 | __glXClearErrorOccured(); | |||||
| 434 | glGetHistogram(target, reset, format, type, answer); | |||||
| 435 | ||||||
| 436 | if (__glXErrorOccured()) { | |||||
| 437 | __GLX_BEGIN_REPLY(0)__glXReply.length = (((0)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 438 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 439 | } | |||||
| 440 | else { | |||||
| 441 | __GLX_BEGIN_REPLY(compsize)__glXReply.length = (((compsize)+3) & (GLuint)~3) >> 2; __glXReply.type = 1; __glXReply.sequenceNumber = client-> sequence;; | |||||
| 442 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 443 | __GLX_SWAP_INT(&width)sw = ((GLbyte *)(&width))[0]; ((GLbyte *)(&width))[0] = ((GLbyte *)(&width))[3]; ((GLbyte *)(&width))[3] = sw; sw = ((GLbyte *)(&width))[1]; ((GLbyte *)(&width ))[1] = ((GLbyte *)(&width))[2]; ((GLbyte *)(&width)) [2] = sw;; | |||||
| 444 | ((xGLXGetHistogramReply *) &__glXReply)->width = width; | |||||
| 445 | __GLX_SEND_VOID_ARRAY(compsize)WriteToClient(client, ((((compsize)*1)+3) & (GLuint)~3), answer ); | |||||
| 446 | } | |||||
| 447 | ||||||
| 448 | return Success0; | |||||
| 449 | } | |||||
| 450 | ||||||
| 451 | int | |||||
| 452 | __glXDispSwap_GetHistogram(__GLXclientState * cl, GLbyte * pc) | |||||
| 453 | { | |||||
| 454 | const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc)(((xGLXSingleReq*)pc)->contextTag); | |||||
| 455 | ClientPtr client = cl->client; | |||||
| 456 | ||||||
| 457 | REQUEST_FIXED_SIZE(xGLXSingleReq, 16)if (((sizeof(xGLXSingleReq) >> 2) > client->req_len ) || (((16) >> 2) >= client->req_len) || ((((uint64_t ) sizeof(xGLXSingleReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 458 | return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE8, tag); | |||||
| 459 | } | |||||
| 460 | ||||||
| 461 | int | |||||
| 462 | __glXDispSwap_GetHistogramEXT(__GLXclientState * cl, GLbyte * pc) | |||||
| 463 | { | |||||
| 464 | const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc)(((xGLXVendorPrivateReq*)pc)->contextTag); | |||||
| 465 | ClientPtr client = cl->client; | |||||
| 466 | ||||||
| 467 | REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16)if (((sizeof(xGLXVendorPrivateReq) >> 2) > client-> req_len) || (((16) >> 2) >= client->req_len) || ( (((uint64_t) sizeof(xGLXVendorPrivateReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 468 | return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE12, tag); | |||||
| 469 | } | |||||
| 470 | ||||||
| 471 | static int | |||||
| 472 | GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) | |||||
| 473 | { | |||||
| 474 | GLint compsize; | |||||
| 475 | GLenum format, type, target; | |||||
| 476 | GLboolean swapBytes, reset; | |||||
| 477 | __GLXcontext *cx; | |||||
| 478 | ClientPtr client = cl->client; | |||||
| 479 | int error; | |||||
| 480 | ||||||
| 481 | __GLX_DECLARE_SWAP_VARIABLESGLbyte sw; | |||||
| 482 | char *answer, answerBuffer[200]; | |||||
| 483 | ||||||
| 484 | cx = __glXForceCurrent(cl, tag, &error); | |||||
| 485 | if (!cx) { | |||||
| 486 | return error; | |||||
| 487 | } | |||||
| 488 | ||||||
| 489 | __GLX_SWAP_INT(pc + 0)sw = ((GLbyte *)(pc + 0))[0]; ((GLbyte *)(pc + 0))[0] = ((GLbyte *)(pc + 0))[3]; ((GLbyte *)(pc + 0))[3] = sw; sw = ((GLbyte * )(pc + 0))[1]; ((GLbyte *)(pc + 0))[1] = ((GLbyte *)(pc + 0)) [2]; ((GLbyte *)(pc + 0))[2] = sw;; | |||||
| 490 | __GLX_SWAP_INT(pc + 4)sw = ((GLbyte *)(pc + 4))[0]; ((GLbyte *)(pc + 4))[0] = ((GLbyte *)(pc + 4))[3]; ((GLbyte *)(pc + 4))[3] = sw; sw = ((GLbyte * )(pc + 4))[1]; ((GLbyte *)(pc + 4))[1] = ((GLbyte *)(pc + 4)) [2]; ((GLbyte *)(pc + 4))[2] = sw;; | |||||
| 491 | __GLX_SWAP_INT(pc + 8)sw = ((GLbyte *)(pc + 8))[0]; ((GLbyte *)(pc + 8))[0] = ((GLbyte *)(pc + 8))[3]; ((GLbyte *)(pc + 8))[3] = sw; sw = ((GLbyte * )(pc + 8))[1]; ((GLbyte *)(pc + 8))[1] = ((GLbyte *)(pc + 8)) [2]; ((GLbyte *)(pc + 8))[2] = sw;; | |||||
| 492 | ||||||
| 493 | format = *(GLenum *) (pc + 4); | |||||
| 494 | type = *(GLenum *) (pc + 8); | |||||
| 495 | target = *(GLenum *) (pc + 0); | |||||
| 496 | swapBytes = *(GLboolean *) (pc + 12); | |||||
| 497 | reset = *(GLboolean *) (pc + 13); | |||||
| 498 | ||||||
| 499 | compsize = __glGetTexImage_size(target, 1, format, type, 2, 1, 1); | |||||
| 500 | if (compsize < 0) | |||||
| 501 | return BadLength16; | |||||
| 502 | ||||||
| 503 | glPixelStorei(GL_PACK_SWAP_BYTES0x0D00, !swapBytes); | |||||
| 504 | __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1)if (compsize < 0) return 16; else if ((compsize) > sizeof (answerBuffer)) { int bump; if ((cl)->returnBufSize < ( compsize)+(1)) { (cl)->returnBuf = (GLbyte*)realloc((cl)-> returnBuf, (compsize)+(1)); if (!(cl)->returnBuf) { return 11; } (cl)->returnBufSize = (compsize)+(1); } answer = (char *)cl->returnBuf; bump = (long)(answer) % (1); if (bump) answer += (1) - (bump); } else { answer = (char *)answerBuffer; }; | |||||
| 505 | __glXClearErrorOccured(); | |||||
| 506 | glGetMinmax(target, reset, format, type, answer); | |||||
| 507 | ||||||
| 508 | if (__glXErrorOccured()) { | |||||
| 509 | __GLX_BEGIN_REPLY(0)__glXReply.length = (((0)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 510 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 511 | } | |||||
| 512 | else { | |||||
| 513 | __GLX_BEGIN_REPLY(compsize)__glXReply.length = (((compsize)+3) & (GLuint)~3) >> 2; __glXReply.type = 1; __glXReply.sequenceNumber = client-> sequence;; | |||||
| 514 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 515 | __GLX_SEND_VOID_ARRAY(compsize)WriteToClient(client, ((((compsize)*1)+3) & (GLuint)~3), answer ); | |||||
| 516 | } | |||||
| 517 | ||||||
| 518 | return Success0; | |||||
| 519 | } | |||||
| 520 | ||||||
| 521 | int | |||||
| 522 | __glXDispSwap_GetMinmax(__GLXclientState * cl, GLbyte * pc) | |||||
| 523 | { | |||||
| 524 | const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc)(((xGLXSingleReq*)pc)->contextTag); | |||||
| 525 | ClientPtr client = cl->client; | |||||
| 526 | ||||||
| 527 | REQUEST_FIXED_SIZE(xGLXSingleReq, 16)if (((sizeof(xGLXSingleReq) >> 2) > client->req_len ) || (((16) >> 2) >= client->req_len) || ((((uint64_t ) sizeof(xGLXSingleReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 528 | return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE8, tag); | |||||
| 529 | } | |||||
| 530 | ||||||
| 531 | int | |||||
| 532 | __glXDispSwap_GetMinmaxEXT(__GLXclientState * cl, GLbyte * pc) | |||||
| 533 | { | |||||
| 534 | const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc)(((xGLXVendorPrivateReq*)pc)->contextTag); | |||||
| 535 | ClientPtr client = cl->client; | |||||
| 536 | ||||||
| 537 | REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16)if (((sizeof(xGLXVendorPrivateReq) >> 2) > client-> req_len) || (((16) >> 2) >= client->req_len) || ( (((uint64_t) sizeof(xGLXVendorPrivateReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 538 | return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE12, tag); | |||||
| 539 | } | |||||
| 540 | ||||||
| 541 | static int | |||||
| 542 | GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag) | |||||
| 543 | { | |||||
| 544 | GLint compsize; | |||||
| 545 | GLenum format, type, target; | |||||
| 546 | GLboolean swapBytes; | |||||
| 547 | __GLXcontext *cx; | |||||
| 548 | ClientPtr client = cl->client; | |||||
| 549 | int error; | |||||
| 550 | ||||||
| 551 | __GLX_DECLARE_SWAP_VARIABLESGLbyte sw; | |||||
| 552 | char *answer, answerBuffer[200]; | |||||
| 553 | GLint width = 0; | |||||
| 554 | ||||||
| 555 | cx = __glXForceCurrent(cl, tag, &error); | |||||
| 556 | if (!cx) { | |||||
| 557 | return error; | |||||
| 558 | } | |||||
| 559 | ||||||
| 560 | __GLX_SWAP_INT(pc + 0)sw = ((GLbyte *)(pc + 0))[0]; ((GLbyte *)(pc + 0))[0] = ((GLbyte *)(pc + 0))[3]; ((GLbyte *)(pc + 0))[3] = sw; sw = ((GLbyte * )(pc + 0))[1]; ((GLbyte *)(pc + 0))[1] = ((GLbyte *)(pc + 0)) [2]; ((GLbyte *)(pc + 0))[2] = sw;; | |||||
| 561 | __GLX_SWAP_INT(pc + 4)sw = ((GLbyte *)(pc + 4))[0]; ((GLbyte *)(pc + 4))[0] = ((GLbyte *)(pc + 4))[3]; ((GLbyte *)(pc + 4))[3] = sw; sw = ((GLbyte * )(pc + 4))[1]; ((GLbyte *)(pc + 4))[1] = ((GLbyte *)(pc + 4)) [2]; ((GLbyte *)(pc + 4))[2] = sw;; | |||||
| 562 | __GLX_SWAP_INT(pc + 8)sw = ((GLbyte *)(pc + 8))[0]; ((GLbyte *)(pc + 8))[0] = ((GLbyte *)(pc + 8))[3]; ((GLbyte *)(pc + 8))[3] = sw; sw = ((GLbyte * )(pc + 8))[1]; ((GLbyte *)(pc + 8))[1] = ((GLbyte *)(pc + 8)) [2]; ((GLbyte *)(pc + 8))[2] = sw;; | |||||
| 563 | ||||||
| 564 | format = *(GLenum *) (pc + 4); | |||||
| 565 | type = *(GLenum *) (pc + 8); | |||||
| 566 | target = *(GLenum *) (pc + 0); | |||||
| 567 | swapBytes = *(GLboolean *) (pc + 12); | |||||
| 568 | ||||||
| 569 | glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH0x80D9, &width); | |||||
| 570 | /* | |||||
| 571 | * The one query above might fail if we're in a state where queries | |||||
| 572 | * are illegal, but then width would still be zero anyway. | |||||
| 573 | */ | |||||
| 574 | compsize = __glGetTexImage_size(target, 1, format, type, width, 1, 1); | |||||
| 575 | if (compsize < 0) | |||||
| 576 | return BadLength16; | |||||
| 577 | ||||||
| 578 | glPixelStorei(GL_PACK_SWAP_BYTES0x0D00, !swapBytes); | |||||
| 579 | __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1)if (compsize < 0) return 16; else if ((compsize) > sizeof (answerBuffer)) { int bump; if ((cl)->returnBufSize < ( compsize)+(1)) { (cl)->returnBuf = (GLbyte*)realloc((cl)-> returnBuf, (compsize)+(1)); if (!(cl)->returnBuf) { return 11; } (cl)->returnBufSize = (compsize)+(1); } answer = (char *)cl->returnBuf; bump = (long)(answer) % (1); if (bump) answer += (1) - (bump); } else { answer = (char *)answerBuffer; }; | |||||
| 580 | __glXClearErrorOccured(); | |||||
| 581 | glGetColorTable(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), | |||||
| 582 | *(GLenum *) (pc + 8), answer); | |||||
| 583 | ||||||
| 584 | if (__glXErrorOccured()) { | |||||
| 585 | __GLX_BEGIN_REPLY(0)__glXReply.length = (((0)+3) & (GLuint)~3) >> 2; __glXReply .type = 1; __glXReply.sequenceNumber = client->sequence;; | |||||
| 586 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 587 | } | |||||
| 588 | else { | |||||
| 589 | __GLX_BEGIN_REPLY(compsize)__glXReply.length = (((compsize)+3) & (GLuint)~3) >> 2; __glXReply.type = 1; __glXReply.sequenceNumber = client-> sequence;; | |||||
| 590 | __GLX_SWAP_REPLY_HEADER()sw = ((GLbyte *)(&__glXReply.sequenceNumber))[0]; ((GLbyte *)(&__glXReply.sequenceNumber))[0] = ((GLbyte *)(&__glXReply .sequenceNumber))[1]; ((GLbyte *)(&__glXReply.sequenceNumber ))[1] = sw;; sw = ((GLbyte *)(&__glXReply.length))[0]; (( GLbyte *)(&__glXReply.length))[0] = ((GLbyte *)(&__glXReply .length))[3]; ((GLbyte *)(&__glXReply.length))[3] = sw; sw = ((GLbyte *)(&__glXReply.length))[1]; ((GLbyte *)(& __glXReply.length))[1] = ((GLbyte *)(&__glXReply.length)) [2]; ((GLbyte *)(&__glXReply.length))[2] = sw;;; | |||||
| 591 | __GLX_SWAP_INT(&width)sw = ((GLbyte *)(&width))[0]; ((GLbyte *)(&width))[0] = ((GLbyte *)(&width))[3]; ((GLbyte *)(&width))[3] = sw; sw = ((GLbyte *)(&width))[1]; ((GLbyte *)(&width ))[1] = ((GLbyte *)(&width))[2]; ((GLbyte *)(&width)) [2] = sw;; | |||||
| 592 | ((xGLXGetColorTableReply *) &__glXReply)->width = width; | |||||
| 593 | __GLX_SEND_VOID_ARRAY(compsize)WriteToClient(client, ((((compsize)*1)+3) & (GLuint)~3), answer ); | |||||
| 594 | } | |||||
| 595 | ||||||
| 596 | return Success0; | |||||
| 597 | } | |||||
| 598 | ||||||
| 599 | int | |||||
| 600 | __glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc) | |||||
| 601 | { | |||||
| 602 | const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc)(((xGLXSingleReq*)pc)->contextTag); | |||||
| 603 | ClientPtr client = cl->client; | |||||
| 604 | ||||||
| 605 | REQUEST_FIXED_SIZE(xGLXSingleReq, 16)if (((sizeof(xGLXSingleReq) >> 2) > client->req_len ) || (((16) >> 2) >= client->req_len) || ((((uint64_t ) sizeof(xGLXSingleReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 606 | return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE8, tag); | |||||
| 607 | } | |||||
| 608 | ||||||
| 609 | int | |||||
| 610 | __glXDispSwap_GetColorTableSGI(__GLXclientState * cl, GLbyte * pc) | |||||
| 611 | { | |||||
| 612 | const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc)(((xGLXVendorPrivateReq*)pc)->contextTag); | |||||
| 613 | ClientPtr client = cl->client; | |||||
| 614 | ||||||
| 615 | REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 16)if (((sizeof(xGLXVendorPrivateReq) >> 2) > client-> req_len) || (((16) >> 2) >= client->req_len) || ( (((uint64_t) sizeof(xGLXVendorPrivateReq) + (16) + 3) >> 2) != (uint64_t) client->req_len)) return(16); | |||||
| 616 | return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE12, tag); | |||||
| 617 | } |