From 9838b7032ea9792bec21af424c53c07078636d21 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 21 Mar 2012 12:55:09 -0700 Subject: Introduce a consistent coding style This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard Acked-by: Daniel Stone Acked-by: Alan Coopersmith --- glx/indirect_program.c | 131 +++++++++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 65 deletions(-) (limited to 'glx/indirect_program.c') diff --git a/glx/indirect_program.c b/glx/indirect_program.c index fbf9d3fed..3b50ecd53 100644 --- a/glx/indirect_program.c +++ b/glx/indirect_program.c @@ -45,9 +45,9 @@ #include "glthread.h" #include "dispatch.h" -static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, - unsigned get_programiv_offset, unsigned get_program_string_offset, - Bool do_swap); +static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc, + unsigned get_programiv_offset, + unsigned get_program_string_offset, Bool do_swap); /** * Handle both types of glGetProgramString calls. @@ -58,91 +58,92 @@ static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, * caller. These can be the offsets of either the ARB versions or the NV * versions. */ -int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, - unsigned get_programiv_offset, - unsigned get_program_string_offset, - Bool do_swap) +int +DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc, + unsigned get_programiv_offset, + unsigned get_program_string_offset, Bool do_swap) { - xGLXVendorPrivateWithReplyReq * const req = - (xGLXVendorPrivateWithReplyReq *) pc; + xGLXVendorPrivateWithReplyReq *const req = + (xGLXVendorPrivateWithReplyReq *) pc; int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, & error); + __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error); ClientPtr client = cl->client; - pc += __GLX_VENDPRIV_HDR_SIZE; if (cx != NULL) { - GLenum target; - GLenum pname; - GLint compsize = 0; - char *answer = NULL, answerBuffer[200]; - - if (do_swap) { - target = (GLenum) bswap_32(*(int *)(pc + 0)); - pname = (GLenum) bswap_32(*(int *)(pc + 4)); - } - else { - target = *(GLenum *)(pc + 0); - pname = *(GLuint *)(pc + 4); - } - - /* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV - * enumerants is the same. - */ - CALL_by_offset(GET_DISPATCH(), - (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), - get_programiv_offset, - (target, GL_PROGRAM_LENGTH_ARB, &compsize)); - - if (compsize != 0) { - __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); - __glXClearErrorOccured(); - - CALL_by_offset(GET_DISPATCH(), - (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)), - get_program_string_offset, - (target, pname, (GLubyte *)answer)); - } - - if (__glXErrorOccured()) { - __GLX_BEGIN_REPLY(0); - __GLX_SEND_HEADER(); - } else { - __GLX_BEGIN_REPLY(compsize); - ((xGLXGetTexImageReply *)&__glXReply)->width = compsize; - __GLX_SEND_HEADER(); - __GLX_SEND_VOID_ARRAY(compsize); - } - - error = Success; + GLenum target; + GLenum pname; + GLint compsize = 0; + char *answer = NULL, answerBuffer[200]; + + if (do_swap) { + target = (GLenum) bswap_32(*(int *) (pc + 0)); + pname = (GLenum) bswap_32(*(int *) (pc + 4)); + } + else { + target = *(GLenum *) (pc + 0); + pname = *(GLuint *) (pc + 4); + } + + /* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV + * enumerants is the same. + */ + CALL_by_offset(GET_DISPATCH(), + (void (GLAPIENTRYP) (GLuint, GLenum, GLint *)), + get_programiv_offset, + (target, GL_PROGRAM_LENGTH_ARB, &compsize)); + + if (compsize != 0) { + __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); + __glXClearErrorOccured(); + + CALL_by_offset(GET_DISPATCH(), + (void (GLAPIENTRYP) (GLuint, GLenum, GLubyte *)), + get_program_string_offset, + (target, pname, (GLubyte *) answer)); + } + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } + else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetTexImageReply *) & __glXReply)->width = compsize; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + error = Success; } return error; } -int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte *pc) +int +__glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc) { return DoGetProgramString(cl, pc, _gloffset_GetProgramivARB, - _gloffset_GetProgramStringARB, False); + _gloffset_GetProgramStringARB, False); } - -int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte *pc) +int +__glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc) { return DoGetProgramString(cl, pc, _gloffset_GetProgramivARB, - _gloffset_GetProgramStringARB, True); + _gloffset_GetProgramStringARB, True); } - -int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte *pc) +int +__glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc) { return DoGetProgramString(cl, pc, _gloffset_GetProgramivNV, - _gloffset_GetProgramStringNV, False); + _gloffset_GetProgramStringNV, False); } - -int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte *pc) +int +__glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc) { return DoGetProgramString(cl, pc, _gloffset_GetProgramivNV, - _gloffset_GetProgramStringNV, True); + _gloffset_GetProgramStringNV, True); } -- cgit v1.2.3