summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2013-03-26 16:50:03 +0000
committerTim Angus <tim@ngus.net>2013-03-27 11:33:16 +0000
commitecf45acd236aaf1a0d2b00a94a24d8f24fbceae4 (patch)
tree23d703104aa48a4533daed653d5c429f73dccb05
parenta6e5804c1162832fa99d31c88033cbf6f1efd2f0 (diff)
Fix some of the things clang --analyze flagged
-rw-r--r--src/client/snd_adpcm.c2
-rw-r--r--src/client/snd_dma.c1
-rw-r--r--src/client/snd_mix.c2
-rw-r--r--src/client/snd_openal.c2
-rw-r--r--src/client/snd_wavelet.c6
-rw-r--r--src/qcommon/cm_polylib.c8
-rw-r--r--src/qcommon/cm_trace.c8
-rw-r--r--src/qcommon/common.c3
-rw-r--r--src/qcommon/files.c1
-rw-r--r--src/qcommon/huffman.c2
-rw-r--r--src/qcommon/unzip.c14
-rw-r--r--src/renderercommon/tr_image_bmp.c1
-rw-r--r--src/renderercommon/tr_image_png.c1
-rw-r--r--src/renderercommon/tr_image_tga.c5
-rw-r--r--src/renderergl1/tr_backend.c12
-rw-r--r--src/renderergl1/tr_image.c1
-rw-r--r--src/renderergl1/tr_main.c4
-rw-r--r--src/renderergl1/tr_marks.c4
-rw-r--r--src/renderergl1/tr_shader.c2
-rw-r--r--src/renderergl1/tr_world.c2
-rw-r--r--src/renderergl2/tr_backend.c14
-rw-r--r--src/renderergl2/tr_bsp.c3
-rw-r--r--src/renderergl2/tr_image.c8
-rw-r--r--src/renderergl2/tr_main.c4
-rw-r--r--src/renderergl2/tr_marks.c4
-rw-r--r--src/renderergl2/tr_shader.c3
-rw-r--r--src/renderergl2/tr_world.c2
27 files changed, 42 insertions, 77 deletions
diff --git a/src/client/snd_adpcm.c b/src/client/snd_adpcm.c
index 89e68f42..4e138726 100644
--- a/src/client/snd_adpcm.c
+++ b/src/client/snd_adpcm.c
@@ -310,7 +310,7 @@ void S_AdpcmEncodeSound( sfx_t *sfx, short *samples ) {
newchunk = SND_malloc();
if (sfx->soundData == NULL) {
sfx->soundData = newchunk;
- } else {
+ } else if (chunk != NULL) {
chunk->next = newchunk;
}
chunk = newchunk;
diff --git a/src/client/snd_dma.c b/src/client/snd_dma.c
index e0e6988c..8aca94ce 100644
--- a/src/client/snd_dma.c
+++ b/src/client/snd_dma.c
@@ -1468,7 +1468,6 @@ void S_UpdateBackgroundTrack( void ) {
r = S_CodecReadStream(s_backgroundStream, fileBytes, raw);
if(r < fileBytes)
{
- fileBytes = r;
fileSamples = r / (s_backgroundStream->info.width * s_backgroundStream->info.channels);
}
diff --git a/src/client/snd_mix.c b/src/client/snd_mix.c
index 71cfd781..682e03ce 100644
--- a/src/client/snd_mix.c
+++ b/src/client/snd_mix.c
@@ -599,7 +599,7 @@ void S_PaintChannelFromMuLaw( channel_t *ch, sfx_t *sc, int count, int sampleOff
samp[i].left += (data * leftvol)>>8;
samp[i].right += (data * rightvol)>>8;
samples++;
- if (samples == (byte *)chunk->sndChunk+(SND_CHUNK_SIZE*2)) {
+ if (chunk != NULL && samples == (byte *)chunk->sndChunk+(SND_CHUNK_SIZE*2)) {
chunk = chunk->next;
samples = (byte *)chunk->sndChunk;
}
diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c
index 01207a87..629f8921 100644
--- a/src/client/snd_openal.c
+++ b/src/client/snd_openal.c
@@ -2515,8 +2515,6 @@ qboolean S_AL_Init( soundInterface_t *si )
devicelist += curlen + 1;
}
}
- else
- devicelist = "";
s_alAvailableDevices = Cvar_Get("s_alAvailableDevices", devicenames, CVAR_ROM | CVAR_NORESTART);
}
diff --git a/src/client/snd_wavelet.c b/src/client/snd_wavelet.c
index 1355fcbe..51624614 100644
--- a/src/client/snd_wavelet.c
+++ b/src/client/snd_wavelet.c
@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
void daub4(float b[], unsigned long n, int isign)
{
- float wksp[4097];
+ float wksp[4097] = { 0.0f };
float *a=b-1; // numerical recipies so a[1] = b[0]
unsigned long nh,nh1,i,j;
@@ -147,7 +147,7 @@ void encodeWavelet( sfx_t *sfx, short *packets) {
newchunk = SND_malloc();
if (sfx->soundData == NULL) {
sfx->soundData = newchunk;
- } else {
+ } else if (chunk != NULL) {
chunk->next = newchunk;
}
chunk = newchunk;
@@ -216,7 +216,7 @@ void encodeMuLaw( sfx_t *sfx, short *packets) {
newchunk = SND_malloc();
if (sfx->soundData == NULL) {
sfx->soundData = newchunk;
- } else {
+ } else if (chunk != NULL) {
chunk->next = newchunk;
}
chunk = newchunk;
diff --git a/src/qcommon/cm_polylib.c b/src/qcommon/cm_polylib.c
index b2a49d47..85e62176 100644
--- a/src/qcommon/cm_polylib.c
+++ b/src/qcommon/cm_polylib.c
@@ -310,8 +310,8 @@ ClipWindingEpsilon
void ClipWindingEpsilon (winding_t *in, vec3_t normal, vec_t dist,
vec_t epsilon, winding_t **front, winding_t **back)
{
- vec_t dists[MAX_POINTS_ON_WINDING+4];
- int sides[MAX_POINTS_ON_WINDING+4];
+ vec_t dists[MAX_POINTS_ON_WINDING+4] = { 0 };
+ int sides[MAX_POINTS_ON_WINDING+4] = { 0 };
int counts[3];
static vec_t dot; // VC 4.2 optimizer bug if not static
int i, j;
@@ -422,8 +422,8 @@ ChopWindingInPlace
void ChopWindingInPlace (winding_t **inout, vec3_t normal, vec_t dist, vec_t epsilon)
{
winding_t *in;
- vec_t dists[MAX_POINTS_ON_WINDING+4];
- int sides[MAX_POINTS_ON_WINDING+4];
+ vec_t dists[MAX_POINTS_ON_WINDING+4] = { 0 };
+ int sides[MAX_POINTS_ON_WINDING+4] = { 0 };
int counts[3];
static vec_t dot; // VC 4.2 optimizer bug if not static
int i, j;
diff --git a/src/qcommon/cm_trace.c b/src/qcommon/cm_trace.c
index 4ee53373..ccf29a48 100644
--- a/src/qcommon/cm_trace.c
+++ b/src/qcommon/cm_trace.c
@@ -717,8 +717,12 @@ void CM_TraceThroughBrush( traceWork_t *tw, cbrush_t *brush ) {
enterFrac = 0;
}
tw->trace.fraction = enterFrac;
- tw->trace.plane = *clipplane;
- tw->trace.surfaceFlags = leadside->surfaceFlags;
+ if (clipplane != NULL) {
+ tw->trace.plane = *clipplane;
+ }
+ if (leadside != NULL) {
+ tw->trace.surfaceFlags = leadside->surfaceFlags;
+ }
tw->trace.contents = brush->contents;
}
}
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index b70890fb..41a8f5b0 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -883,9 +883,6 @@ void Z_Free( void *ptr ) {
block->size += other->size;
block->next = other->next;
block->next->prev = block;
- if (other == zone->rover) {
- zone->rover = block;
- }
}
}
diff --git a/src/qcommon/files.c b/src/qcommon/files.c
index 17101fba..59f60bc2 100644
--- a/src/qcommon/files.c
+++ b/src/qcommon/files.c
@@ -1633,7 +1633,6 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) {
_origin = SEEK_SET;
break;
default:
- _origin = SEEK_CUR;
Com_Error( ERR_FATAL, "Bad origin in FS_Seek" );
break;
}
diff --git a/src/qcommon/huffman.c b/src/qcommon/huffman.c
index fd228541..aa8ee226 100644
--- a/src/qcommon/huffman.c
+++ b/src/qcommon/huffman.c
@@ -406,7 +406,6 @@ void Huff_Compress(msg_t *mbuf, int offset) {
huff.tree->weight = 0;
huff.lhead->next = huff.lhead->prev = NULL;
huff.tree->parent = huff.tree->left = huff.tree->right = NULL;
- huff.loc[NYT] = huff.tree;
seq[0] = (size>>8);
seq[1] = size&0xff;
@@ -443,6 +442,5 @@ void Huff_Init(huffman_t *huff) {
huff->compressor.tree->weight = 0;
huff->compressor.lhead->next = huff->compressor.lhead->prev = NULL;
huff->compressor.tree->parent = huff->compressor.tree->left = huff->compressor.tree->right = NULL;
- huff->compressor.loc[NYT] = huff->compressor.tree;
}
diff --git a/src/qcommon/unzip.c b/src/qcommon/unzip.c
index 2dd0bf83..4fb2d3a9 100644
--- a/src/qcommon/unzip.c
+++ b/src/qcommon/unzip.c
@@ -713,18 +713,13 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
if (lSeek!=0)
{
- if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
+ if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)!=0)
err=UNZ_ERRNO;
}
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
- lSeek+=file_info.size_file_comment - uSizeRead;
}
- else
- lSeek+=file_info.size_file_comment;
if ((err==UNZ_OK) && (pfile_info!=NULL))
*pfile_info=file_info;
@@ -1144,13 +1139,12 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
pfile_in_zip_read_info->stream.next_in = (voidpf)0;
pfile_in_zip_read_info->stream.avail_in = 0;
- err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
- if (err == Z_OK)
+ if (inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS) == Z_OK)
pfile_in_zip_read_info->stream_initialised=1;
else
{
TRYFREE(pfile_in_zip_read_info);
- return err;
+ return UNZ_INTERNALERROR;
}
/* windowBits is passed < 0 to tell that there is no zlib header.
* Note that in this case inflate *requires* an extra "dummy" byte
@@ -1197,7 +1191,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
# endif
- return UNZ_OK;
+ return err;
}
extern int ZEXPORT unzOpenCurrentFile (file)
diff --git a/src/renderercommon/tr_image_bmp.c b/src/renderercommon/tr_image_bmp.c
index d3f84ac4..c5c280a0 100644
--- a/src/renderercommon/tr_image_bmp.c
+++ b/src/renderercommon/tr_image_bmp.c
@@ -120,7 +120,6 @@ void R_LoadBMP( const char *name, byte **pic, int *width, int *height )
ri.Error( ERR_DROP, "LoadBMP: header too short (%s)", name );
Com_Memcpy( bmpHeader.palette, buf_p, sizeof( bmpHeader.palette ) );
- buf_p += sizeof(bmpHeader.palette);
}
if (buffer.b + bmpHeader.bitmapDataOffset > end)
diff --git a/src/renderercommon/tr_image_png.c b/src/renderercommon/tr_image_png.c
index d3fc7bf8..87915a54 100644
--- a/src/renderercommon/tr_image_png.c
+++ b/src/renderercommon/tr_image_png.c
@@ -541,7 +541,6 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer)
*/
DecompressedData = NULL;
- DecompressedDataLength = 0;
*Buffer = DecompressedData;
CompressedData = NULL;
diff --git a/src/renderercommon/tr_image_tga.c b/src/renderercommon/tr_image_tga.c
index 6910c472..44952b11 100644
--- a/src/renderercommon/tr_image_tga.c
+++ b/src/renderercommon/tr_image_tga.c
@@ -193,11 +193,6 @@ void R_LoadTGA ( const char *name, byte **pic, int *width, int *height)
else if (targa_header.image_type==10) { // Runlength encoded RGB images
unsigned char red,green,blue,alphabyte,packetHeader,packetSize,j;
- red = 0;
- green = 0;
- blue = 0;
- alphabyte = 0xff;
-
for(row=rows-1; row>=0; row--) {
pixbuf = targa_rgba + row*columns*4;
for(column=0; column<columns; ) {
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<outheight ; i++, out += outwidth) {
inrow = in + inwidth*(int)((i+0.25)*inheight/outheight);
inrow2 = in + inwidth*(int)((i+0.75)*inheight/outheight);
- frac = fracstep >> 1;
for (j=0 ; j<outwidth ; j++) {
pix1 = (byte *)inrow + p1[j];
pix2 = (byte *)inrow + p2[j];
diff --git a/src/renderergl1/tr_main.c b/src/renderergl1/tr_main.c
index 2b6ce52f..c2e32c94 100644
--- a/src/renderergl1/tr_main.c
+++ b/src/renderergl1/tr_main.c
@@ -813,10 +813,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
diff --git a/src/renderergl1/tr_marks.c b/src/renderergl1/tr_marks.c
index f85a1244..05afb16c 100644
--- a/src/renderergl1/tr_marks.c
+++ b/src/renderergl1/tr_marks.c
@@ -42,8 +42,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;
diff --git a/src/renderergl1/tr_shader.c b/src/renderergl1/tr_shader.c
index c6d91a0c..f6f5c80d 100644
--- a/src/renderergl1/tr_shader.c
+++ b/src/renderergl1/tr_shader.c
@@ -1591,7 +1591,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 );
+ (void)COM_ParseExt( text, qfalse );
continue;
}
// cull <face>
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;
}
diff --git a/src/renderergl2/tr_backend.c b/src/renderergl2/tr_backend.c
index 6d6b0274..6b541fec 100644
--- a/src/renderergl2/tr_backend.c
+++ b/src/renderergl2/tr_backend.c
@@ -54,7 +54,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);
}
@@ -252,7 +254,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 ) )
{
@@ -286,7 +288,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;
}
@@ -318,7 +319,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;
}
@@ -608,7 +608,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;
@@ -631,8 +630,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();
}
@@ -757,7 +756,6 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
}
if (inQuery) {
- inQuery = qfalse;
qglEndQueryARB(GL_SAMPLES_PASSED_ARB);
}
diff --git a/src/renderergl2/tr_bsp.c b/src/renderergl2/tr_bsp.c
index 9b26241b..824e6c2b 100644
--- a/src/renderergl2/tr_bsp.c
+++ b/src/renderergl2/tr_bsp.c
@@ -2124,8 +2124,6 @@ static void R_CreateWorldVBO(void)
}
- startTime = ri.Milliseconds();
-
ri.Free(surfacesSorted);
ri.Hunk_FreeTempMemory(triangles);
@@ -2152,7 +2150,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);
diff --git a/src/renderergl2/tr_image.c b/src/renderergl2/tr_image.c
index 72a59329..6681cbd9 100644
--- a/src/renderergl2/tr_image.c
+++ b/src/renderergl2/tr_image.c
@@ -327,7 +327,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];
@@ -958,7 +957,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;
@@ -1573,8 +1572,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;
@@ -1770,7 +1769,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
diff --git a/src/renderergl2/tr_main.c b/src/renderergl2/tr_main.c
index 2f528bb3..dc8a478c 100644
--- a/src/renderergl2/tr_main.c
+++ b/src/renderergl2/tr_main.c
@@ -1558,10 +1558,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
diff --git a/src/renderergl2/tr_marks.c b/src/renderergl2/tr_marks.c
index f510b2db..bf6980e9 100644
--- a/src/renderergl2/tr_marks.c
+++ b/src/renderergl2/tr_marks.c
@@ -42,8 +42,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;
diff --git a/src/renderergl2/tr_shader.c b/src/renderergl2/tr_shader.c
index 06b004b1..6a42f4cb 100644
--- a/src/renderergl2/tr_shader.c
+++ b/src/renderergl2/tr_shader.c
@@ -1767,7 +1767,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>
@@ -2908,7 +2908,6 @@ static shader_t *FinishShader( void ) {
//
if ( stage > 1 && ( (r_vertexLight->integer && !r_uiFullScreen->integer) || glConfig.hardwareType == GLHW_PERMEDIA2 ) ) {
VertexLightingCollapse();
- stage = 1;
hasLightmapStage = qfalse;
}
diff --git a/src/renderergl2/tr_world.c b/src/renderergl2/tr_world.c
index 95cfea36..cbce8157 100644
--- a/src/renderergl2/tr_world.c
+++ b/src/renderergl2/tr_world.c
@@ -636,7 +636,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;
}