diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-05-13 00:03:35 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-09 19:12:56 -0700 |
commit | 789d64e19a3b3d98b88bc80f677e0c37bfb5c631 (patch) | |
tree | 40f01917cef8f4b645bda7f95aa2c769225d2a4a /glx | |
parent | 329db3292223cccd4887062956622285c45a1523 (diff) |
Remove unneccesary casts from WriteToClient calls
Casting return to (void) was used to tell lint that you intended
to ignore the return value, so it didn't warn you about it.
Casting the third argument to (char *) was used as the most generic
pointer type in the days before compilers supported C89 (void *)
(except for a couple places it's used for byte-sized pointer math).
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'glx')
-rw-r--r-- | glx/glxcmds.c | 29 | ||||
-rw-r--r-- | glx/glxcmdsswap.c | 18 | ||||
-rw-r--r-- | glx/indirect_util.c | 8 | ||||
-rw-r--r-- | glx/single2.c | 6 | ||||
-rw-r--r-- | glx/single2swap.c | 4 | ||||
-rw-r--r-- | glx/unpack.h | 12 |
6 files changed, 37 insertions, 40 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c index d05421971..9cb9e735b 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -667,7 +667,7 @@ DoMakeCurrent(__GLXclientState * cl, __glXSwapMakeCurrentReply(client, &reply); } else { - WriteToClient(client, sz_xGLXMakeCurrentReply, (char *) &reply); + WriteToClient(client, sz_xGLXMakeCurrentReply, &reply); } return Success; } @@ -731,7 +731,7 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc) __glXSwapIsDirectReply(client, &reply); } else { - WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply); + WriteToClient(client, sz_xGLXIsDirectReply, &reply); } return Success; @@ -767,7 +767,7 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc) __glXSwapQueryVersionReply(client, &reply); } else { - WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply); + WriteToClient(client, sz_xGLXQueryVersionReply, &reply); } return Success; } @@ -949,7 +949,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 +1006,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; } @@ -1052,7 +1052,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; @@ -1685,8 +1685,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); @@ -1887,10 +1887,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; @@ -2326,9 +2324,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); @@ -2388,7 +2385,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); } diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c index e8520d6cb..43f88d335 100644 --- a/glx/glxcmdsswap.c +++ b/glx/glxcmdsswap.c @@ -840,7 +840,7 @@ __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply * reply) __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->contextTag); - WriteToClient(client, sz_xGLXMakeCurrentReply, (char *) reply); + WriteToClient(client, sz_xGLXMakeCurrentReply, reply); } void @@ -849,7 +849,7 @@ __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply) __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); - WriteToClient(client, sz_xGLXIsDirectReply, (char *) reply); + WriteToClient(client, sz_xGLXIsDirectReply, reply); } void @@ -860,7 +860,7 @@ __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply) __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->majorVersion); __GLX_SWAP_INT(&reply->minorVersion); - WriteToClient(client, sz_xGLXQueryVersionReply, (char *) reply); + WriteToClient(client, sz_xGLXQueryVersionReply, reply); } void @@ -875,7 +875,7 @@ glxSwapQueryExtensionsStringReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *) reply); + WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply); __GLX_SWAP_INT_ARRAY((int *) buf, length); WriteToClient(client, length << 2, buf); } @@ -890,7 +890,7 @@ glxSwapQueryServerStringReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) reply); + WriteToClient(client, sz_xGLXQueryServerStringReply, reply); /** no swap is needed for an array of chars **/ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ WriteToClient(client, length << 2, buf); @@ -908,9 +908,9 @@ __glXSwapQueryContextInfoEXTReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) reply); + WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply); __GLX_SWAP_INT_ARRAY((int *) buf, length); - WriteToClient(client, length << 2, (char *) buf); + WriteToClient(client, length << 2, buf); } void @@ -925,9 +925,9 @@ __glXSwapGetDrawableAttributesReply(ClientPtr client, __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->numAttribs); - WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *) reply); + WriteToClient(client, sz_xGLXGetDrawableAttributesReply, reply); __GLX_SWAP_INT_ARRAY((int *) buf, length); - WriteToClient(client, length << 2, (char *) buf); + WriteToClient(client, length << 2, buf); } /************************************************************************/ diff --git a/glx/indirect_util.c b/glx/indirect_util.c index a54f70aee..a30b1f880 100644 --- a/glx/indirect_util.c +++ b/glx/indirect_util.c @@ -138,10 +138,10 @@ __glXSendReply(ClientPtr client, const void *data, size_t elements, */ (void) memcpy(&__glXReply.pad3, data, 8); - WriteToClient(client, sz_xGLXSingleReply, (char *) &__glXReply); + WriteToClient(client, sz_xGLXSingleReply, &__glXReply); if (reply_ints != 0) { - WriteToClient(client, reply_ints * 4, (char *) data); + WriteToClient(client, reply_ints * 4, data); } } @@ -184,10 +184,10 @@ __glXSendReplySwap(ClientPtr client, const void *data, size_t elements, */ (void) memcpy(&__glXReply.pad3, data, 8); - WriteToClient(client, sz_xGLXSingleReply, (char *) &__glXReply); + WriteToClient(client, sz_xGLXSingleReply, &__glXReply); if (reply_ints != 0) { - WriteToClient(client, reply_ints * 4, (char *) data); + WriteToClient(client, reply_ints * 4, data); } } diff --git a/glx/single2.c b/glx/single2.c index 42cccc148..4d8ea4e43 100644 --- a/glx/single2.c +++ b/glx/single2.c @@ -199,9 +199,9 @@ __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc) reply.retval = retval; reply.size = nitems; reply.newMode = newMode; - WriteToClient(client, sz_xGLXRenderModeReply, (char *) &reply); + WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { - WriteToClient(client, retBytes, (char *) retBuffer); + WriteToClient(client, retBytes, retBuffer); } return Success; } @@ -384,7 +384,7 @@ DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap) } __GLX_SEND_HEADER(); - WriteToClient(client, length, (char *) string); + WriteToClient(client, length, string); free(buf); return Success; diff --git a/glx/single2swap.c b/glx/single2swap.c index e6bb585d9..9da2afdd1 100644 --- a/glx/single2swap.c +++ b/glx/single2swap.c @@ -216,9 +216,9 @@ __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc) __GLX_SWAP_INT(&reply.retval); __GLX_SWAP_INT(&reply.size); __GLX_SWAP_INT(&reply.newMode); - WriteToClient(client, sz_xGLXRenderModeReply, (char *) &reply); + WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { - WriteToClient(client, retBytes, (char *) retBuffer); + WriteToClient(client, retBytes, retBuffer); } return Success; } diff --git a/glx/unpack.h b/glx/unpack.h index 0a088fc33..52fba74e1 100644 --- a/glx/unpack.h +++ b/glx/unpack.h @@ -63,7 +63,7 @@ extern xGLXSingleReply __glXReply; __glXReply.sequenceNumber = client->sequence; #define __GLX_SEND_HEADER() \ - WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply); + WriteToClient (client, sz_xGLXSingleReply, &__glXReply); #define __GLX_PUT_RETVAL(a) \ __glXReply.retval = (a); @@ -116,19 +116,19 @@ extern xGLXSingleReply __glXReply; *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer #define __GLX_SEND_BYTE_ARRAY(len) \ - WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer) + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer) #define __GLX_SEND_SHORT_ARRAY(len) \ - WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer) + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer) #define __GLX_SEND_INT_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_INT32, answer) #define __GLX_SEND_FLOAT_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer) #define __GLX_SEND_DOUBLE_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer) + WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer) #define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) #define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) |