From ecf45acd236aaf1a0d2b00a94a24d8f24fbceae4 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Tue, 26 Mar 2013 16:50:03 +0000 Subject: Fix some of the things clang --analyze flagged --- src/renderergl1/tr_backend.c | 12 ++++++------ src/renderergl1/tr_image.c | 1 - src/renderergl1/tr_main.c | 4 ---- src/renderergl1/tr_marks.c | 4 ++-- src/renderergl1/tr_shader.c | 2 +- src/renderergl1/tr_world.c | 2 +- 6 files changed, 10 insertions(+), 15 deletions(-) (limited to 'src/renderergl1') diff --git a/src/renderergl1/tr_backend.c b/src/renderergl1/tr_backend.c index f00a9257..432050b6 100644 --- a/src/renderergl1/tr_backend.c +++ b/src/renderergl1/tr_backend.c @@ -54,7 +54,9 @@ void GL_Bind( image_t *image ) { } if ( glState.currenttextures[glState.currenttmu] != texnum ) { - image->frameUsed = tr.frameCount; + if ( image ) { + image->frameUsed = tr.frameCount; + } glState.currenttextures[glState.currenttmu] = texnum; qglBindTexture (GL_TEXTURE_2D, texnum); } @@ -216,7 +218,7 @@ void GL_State( unsigned long stateBits ) // if ( diff & ( GLS_SRCBLEND_BITS | GLS_DSTBLEND_BITS ) ) { - GLenum srcFactor, dstFactor; + GLenum srcFactor = GL_ONE, dstFactor = GL_ONE; if ( stateBits & ( GLS_SRCBLEND_BITS | GLS_DSTBLEND_BITS ) ) { @@ -250,7 +252,6 @@ void GL_State( unsigned long stateBits ) srcFactor = GL_SRC_ALPHA_SATURATE; break; default: - srcFactor = GL_ONE; // to get warning to shut up ri.Error( ERR_DROP, "GL_State: invalid src blend state bits" ); break; } @@ -282,7 +283,6 @@ void GL_State( unsigned long stateBits ) dstFactor = GL_ONE_MINUS_DST_ALPHA; break; default: - dstFactor = GL_ONE; // to get warning to shut up ri.Error( ERR_DROP, "GL_State: invalid dst blend state bits" ); break; } @@ -546,8 +546,8 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { // change the tess parameters if needed // a "entityMergable" shader is a shader that can have surfaces from seperate // entities merged into a single batch, like smoke and blood puff sprites - if (shader != oldShader || fogNum != oldFogNum || dlighted != oldDlighted - || ( entityNum != oldEntityNum && !shader->entityMergable ) ) { + if ( shader != NULL && ( shader != oldShader || fogNum != oldFogNum || dlighted != oldDlighted + || ( entityNum != oldEntityNum && !shader->entityMergable ) ) ) { if (oldShader != NULL) { RB_EndSurface(); } diff --git a/src/renderergl1/tr_image.c b/src/renderergl1/tr_image.c index 082936a7..665038c9 100644 --- a/src/renderergl1/tr_image.c +++ b/src/renderergl1/tr_image.c @@ -327,7 +327,6 @@ static void ResampleTexture( unsigned *in, int inwidth, int inheight, unsigned * for (i=0 ; i> 1; for (j=0 ; j determines flaring in q3map, not needed here else if ( !Q_stricmp(token, "light") ) { - token = COM_ParseExt( text, qfalse ); + (void)COM_ParseExt( text, qfalse ); continue; } // cull diff --git a/src/renderergl1/tr_world.c b/src/renderergl1/tr_world.c index 2a5c750c..d7f67ebc 100644 --- a/src/renderergl1/tr_world.c +++ b/src/renderergl1/tr_world.c @@ -531,7 +531,7 @@ R_ClusterPVS ============== */ static const byte *R_ClusterPVS (int cluster) { - if (!tr.world || !tr.world->vis || cluster < 0 || cluster >= tr.world->numClusters ) { + if (!tr.world->vis || cluster < 0 || cluster >= tr.world->numClusters ) { return tr.world->novis; } -- cgit