Fix some of the things clang --analyze flagged
This commit is contained in:
parent
352cd151e0
commit
98360bcd57
34 changed files with 58 additions and 112 deletions
|
@ -53,7 +53,9 @@ void GL_Bind2( image_t *image, GLenum type ) {
|
|||
}
|
||||
|
||||
if ( glState.currenttextures[glState.currenttmu] != texnum ) {
|
||||
image->frameUsed = tr.frameCount;
|
||||
if ( image ) {
|
||||
image->frameUsed = tr.frameCount;
|
||||
}
|
||||
glState.currenttextures[glState.currenttmu] = texnum;
|
||||
qglBindTexture (type, texnum);
|
||||
}
|
||||
|
@ -251,7 +253,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 ) )
|
||||
{
|
||||
|
@ -285,7 +287,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;
|
||||
}
|
||||
|
@ -317,7 +318,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;
|
||||
}
|
||||
|
@ -607,7 +607,6 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
oldDlighted = qfalse;
|
||||
oldPshadowed = qfalse;
|
||||
oldSort = -1;
|
||||
depthRange = qfalse;
|
||||
|
||||
depth[0] = 0.f;
|
||||
depth[1] = 1.f;
|
||||
|
@ -630,8 +629,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 || pshadowed != oldPshadowed
|
||||
|| ( entityNum != oldEntityNum && !shader->entityMergable ) ) {
|
||||
if ( shader != NULL && ( shader != oldShader || fogNum != oldFogNum || dlighted != oldDlighted || pshadowed != oldPshadowed
|
||||
|| ( entityNum != oldEntityNum && !shader->entityMergable ) ) ) {
|
||||
if (oldShader != NULL) {
|
||||
RB_EndSurface();
|
||||
}
|
||||
|
@ -756,7 +755,6 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
}
|
||||
|
||||
if (inQuery) {
|
||||
inQuery = qfalse;
|
||||
qglEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
}
|
||||
|
||||
|
|
|
@ -2123,8 +2123,6 @@ static void R_CreateWorldVBO(void)
|
|||
}
|
||||
|
||||
|
||||
startTime = ri.Milliseconds();
|
||||
|
||||
ri.Free(surfacesSorted);
|
||||
|
||||
ri.Hunk_FreeTempMemory(triangles);
|
||||
|
@ -2151,7 +2149,6 @@ static void R_LoadSurfaces( lump_t *surfs, lump_t *verts, lump_t *indexLump ) {
|
|||
numTriSurfs = 0;
|
||||
numFlares = 0;
|
||||
|
||||
in = (void *)(fileBase + surfs->fileofs);
|
||||
if (surfs->filelen % sizeof(*in))
|
||||
ri.Error (ERR_DROP, "LoadMap: funny lump size in %s",s_worldData.name);
|
||||
count = surfs->filelen / sizeof(*in);
|
||||
|
|
|
@ -326,7 +326,6 @@ static void ResampleTexture( byte *in, int inwidth, int inheight, byte *out,
|
|||
for (i=0 ; i<outheight ; i++) {
|
||||
inrow = in + 4*inwidth*(int)((i+0.25)*inheight/outheight);
|
||||
inrow2 = in + 4*inwidth*(int)((i+0.75)*inheight/outheight);
|
||||
frac = fracstep >> 1;
|
||||
for (j=0 ; j<outwidth ; j++) {
|
||||
pix1 = inrow + p1[j];
|
||||
pix2 = inrow + p2[j];
|
||||
|
@ -957,7 +956,7 @@ static void DoLinear(byte *in, byte *out, int width, int height)
|
|||
|
||||
for (y = 1; y < height - 1; y += 2)
|
||||
{
|
||||
byte sd[4], se[4], sh[4], si[4];
|
||||
byte sd[4] = {0}, se[4] = {0}, sh[4] = {0}, si[4] = {0};
|
||||
byte *line2, *line3;
|
||||
|
||||
x = 1;
|
||||
|
@ -1572,8 +1571,8 @@ static void RawImage_ScaleToPower2( byte **data, int *inout_width, int *inout_he
|
|||
{
|
||||
int width = *inout_width;
|
||||
int height = *inout_height;
|
||||
int scaled_width = *inout_scaled_width;
|
||||
int scaled_height = *inout_scaled_height;
|
||||
int scaled_width;
|
||||
int scaled_height;
|
||||
qboolean picmip = flags & IMGFLAG_PICMIP;
|
||||
qboolean mipmap = flags & IMGFLAG_MIPMAP;
|
||||
qboolean clampToEdge = flags & IMGFLAG_CLAMPTOEDGE;
|
||||
|
@ -1769,7 +1768,6 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, qboolean light
|
|||
}
|
||||
else if(lightMap)
|
||||
{
|
||||
samples = 4;
|
||||
if(r_greyscale->integer)
|
||||
internalFormat = GL_LUMINANCE;
|
||||
else
|
||||
|
|
|
@ -1557,10 +1557,6 @@ static qboolean IsMirror( const drawSurf_t *drawSurf, int entityNum )
|
|||
// translate the original plane
|
||||
originalPlane.dist = originalPlane.dist + DotProduct( originalPlane.normal, tr.or.origin );
|
||||
}
|
||||
else
|
||||
{
|
||||
plane = originalPlane;
|
||||
}
|
||||
|
||||
// locate the portal entity closest to this plane.
|
||||
// origin will be the origin of the portal, origin2 will be
|
||||
|
|
|
@ -41,8 +41,8 @@ Out must have space for two more vertexes than in
|
|||
static void R_ChopPolyBehindPlane( int numInPoints, vec3_t inPoints[MAX_VERTS_ON_POLY],
|
||||
int *numOutPoints, vec3_t outPoints[MAX_VERTS_ON_POLY],
|
||||
vec3_t normal, vec_t dist, vec_t epsilon) {
|
||||
float dists[MAX_VERTS_ON_POLY+4];
|
||||
int sides[MAX_VERTS_ON_POLY+4];
|
||||
float dists[MAX_VERTS_ON_POLY+4] = { 0 };
|
||||
int sides[MAX_VERTS_ON_POLY+4] = { 0 };
|
||||
int counts[3];
|
||||
float dot;
|
||||
int i, j;
|
||||
|
|
|
@ -1766,7 +1766,7 @@ static qboolean ParseShader( char **text )
|
|||
// light <value> determines flaring in q3map, not needed here
|
||||
else if ( !Q_stricmp(token, "light") )
|
||||
{
|
||||
token = COM_ParseExt( text, qfalse );
|
||||
COM_ParseExt( text, qfalse );
|
||||
continue;
|
||||
}
|
||||
// cull <face>
|
||||
|
@ -2907,7 +2907,6 @@ static shader_t *FinishShader( void ) {
|
|||
//
|
||||
if ( stage > 1 && ( (r_vertexLight->integer && !r_uiFullScreen->integer) || glConfig.hardwareType == GLHW_PERMEDIA2 ) ) {
|
||||
VertexLightingCollapse();
|
||||
stage = 1;
|
||||
hasLightmapStage = qfalse;
|
||||
}
|
||||
|
||||
|
|
|
@ -635,7 +635,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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue