Fix some of the things clang --analyze flagged

This commit is contained in:
Tim Angus 2013-03-26 16:50:03 +00:00
parent 352cd151e0
commit 98360bcd57
34 changed files with 58 additions and 112 deletions

View file

@ -3237,8 +3237,10 @@ aas_lreachability_t *AAS_FindFaceReachabilities(vec3_t *facepoints, int numpoint
//
if (towardsface) VectorCopy(bestend, testpoint);
else VectorCopy(beststart, testpoint);
testpoint[2] = 0;
testpoint[2] = (bestfaceplane->dist - DotProduct(bestfaceplane->normal, testpoint)) / bestfaceplane->normal[2];
if (bestfaceplane != NULL)
testpoint[2] = (bestfaceplane->dist - DotProduct(bestfaceplane->normal, testpoint)) / bestfaceplane->normal[2];
else
testpoint[2] = 0;
//
if (!AAS_PointInsideFace(bestfacenum, testpoint, 0.1f))
{
@ -3786,7 +3788,7 @@ int AAS_Reachability_Grapple(int area1num, int area2num)
aas_face_t *face2;
aas_area_t *area1, *area2;
aas_lreachability_t *lreach;
vec3_t areastart, facecenter, start, end, dir, down = {0, 0, -1};
vec3_t areastart = {0, 0, 0}, facecenter, start, end, dir, down = {0, 0, -1};
vec_t *v;
//only grapple when on the ground or swimming

View file

@ -168,12 +168,11 @@ void AAS_InitTravelFlagFromType(void)
//===========================================================================
static ID_INLINE int AAS_TravelFlagForType_inline(int traveltype)
{
int tfl;
int tfl = 0;
tfl = 0;
if (tfl & TRAVELFLAG_NOTTEAM1)
if (traveltype & TRAVELFLAG_NOTTEAM1)
tfl |= TFL_NOTTEAM1;
if (tfl & TRAVELFLAG_NOTTEAM2)
if (traveltype & TRAVELFLAG_NOTTEAM2)
tfl |= TFL_NOTTEAM2;
traveltype &= TRAVELTYPE_MASK;
if (traveltype < 0 || traveltype >= MAX_TRAVELTYPES)

View file

@ -673,7 +673,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
else if (!strcmp(token.string, "["))
{
size += sizeof(bot_synonymlist_t);
if (pass)
if (pass && ptr)
{
syn = (bot_synonymlist_t *) ptr;
ptr += sizeof(bot_synonymlist_t);
@ -705,7 +705,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
len = strlen(token.string) + 1;
len = PAD(len, sizeof(long));
size += sizeof(bot_synonym_t) + len;
if (pass)
if (pass && ptr)
{
synonym = (bot_synonym_t *) ptr;
ptr += sizeof(bot_synonym_t);
@ -725,7 +725,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
FreeSource(source);
return NULL;
} //end if
if (pass)
if (pass && ptr)
{
synonym->weight = token.floatvalue;
syn->totalweight += synonym->weight;
@ -1003,7 +1003,7 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename)
len = strlen(token.string) + 1;
len = PAD(len, sizeof(long));
size += sizeof(bot_randomlist_t) + len;
if (pass)
if (pass && ptr)
{
random = (bot_randomlist_t *) ptr;
ptr += sizeof(bot_randomlist_t);
@ -1034,7 +1034,7 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename)
len = strlen(chatmessagestring) + 1;
len = PAD(len, sizeof(long));
size += sizeof(bot_randomstring_t) + len;
if (pass)
if (pass && ptr)
{
randomstring = (bot_randomstring_t *) ptr;
ptr += sizeof(bot_randomstring_t);
@ -2113,7 +2113,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname)
return NULL;
} //end if
StripDoubleQuotes(token.string);
if (pass)
if (pass && ptr)
{
chattype = (bot_chattype_t *) ptr;
strncpy(chattype->name, token.string, MAX_CHATTYPE_NAME);
@ -2136,7 +2136,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname)
} //end if
len = strlen(chatmessagestring) + 1;
len = PAD(len, sizeof(long));
if (pass)
if (pass && ptr)
{
chatmessage = (bot_chatmessage_t *) ptr;
chatmessage->time = -2*CHATMESSAGE_RECENTTIME;
@ -2583,7 +2583,6 @@ void BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *v
strcat(match.string, var7);
match.variables[7].offset = index;
match.variables[7].length = strlen(var7);
index += strlen(var7);
}
//
BotConstructChatMessage(cs, message, mcontext, &match, 0, qfalse);
@ -2766,7 +2765,6 @@ int BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char
strcat(bestmatch.string, var7);
bestmatch.variables[7].offset = index;
bestmatch.variables[7].length = strlen(var7);
index += strlen(var7);
}
if (LibVarGetValue("bot_testrchat"))
{

View file

@ -446,12 +446,6 @@ void BotResetWeaponState(int weaponstate)
ws = BotWeaponStateFromHandle(weaponstate);
if (!ws) return;
weaponweightconfig = ws->weaponweightconfig;
weaponweightindex = ws->weaponweightindex;
//Com_Memset(ws, 0, sizeof(bot_weaponstate_t));
ws->weaponweightconfig = weaponweightconfig;
ws->weaponweightindex = weaponweightindex;
} //end of the function BotResetWeaponState
//========================================================================
//

View file

@ -272,7 +272,6 @@ fuzzyseperator_t *ReadFuzzySeperators_r(source_t *source)
fs->child = NULL;
if (lastfs) lastfs->next = fs;
else firstfs = fs;
lastfs = fs;
} //end if
//
return firstfs;

View file

@ -414,7 +414,6 @@ int PC_ReadDefineParms(source_t *source, define_t *define, token_t **parms, int
if (indent <= 0)
{
if (lastcomma) SourceWarning(source, "too many comma's");
lastcomma = 1;
break;
} //end if
} //end if
@ -783,7 +782,7 @@ int PC_ExpandBuiltinDefine(source_t *source, token_t *deftoken, define_t *define
int PC_ExpandDefine(source_t *source, token_t *deftoken, define_t *define,
token_t **firsttoken, token_t **lasttoken)
{
token_t *parms[MAX_DEFINEPARMS], *dt, *pt, *t;
token_t *parms[MAX_DEFINEPARMS] = { NULL }, *dt, *pt, *t;
token_t *t1, *t2, *first, *last, *nextpt, token;
int parmnum, i;
@ -1209,12 +1208,6 @@ int PC_Directive_define(source_t *source)
//unread the define name before executing the #undef directive
PC_UnreadSourceToken(source, &token);
if (!PC_Directive_undef(source)) return qfalse;
//if the define was not removed (define->flags & DEFINE_FIXED)
#if DEFINEHASHING
define = PC_FindHashedDefine(source->definehash, token.string);
#else
define = PC_FindDefine(source->defines, token.string);
#endif //DEFINEHASHING
} //end if
//allocate define
define = (define_t *) GetMemory(sizeof(define_t));
@ -2096,7 +2089,6 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
if (v->prev) v->prev->next = v->next;
else firstvalue = v->next;
if (v->next) v->next->prev = v->prev;
else lastvalue = v->prev;
//FreeMemory(v);
FreeValue(v);
} //end if
@ -2104,7 +2096,6 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
if (o->prev) o->prev->next = o->next;
else firstoperator = o->next;
if (o->next) o->next->prev = o->prev;
else lastoperator = o->prev;
//FreeMemory(o);
FreeOperator(o);
} //end while

View file

@ -615,8 +615,6 @@ void Con_DrawNotify (void)
Field_BigDraw( &chatField, skip * BIGCHAR_WIDTH, v,
SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue, qtrue );
v += BIGCHAR_HEIGHT;
}
}

View file

@ -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;

View file

@ -1452,7 +1452,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);
}

View file

@ -598,7 +598,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;
}

View file

@ -2496,8 +2496,6 @@ qboolean S_AL_Init( soundInterface_t *si )
devicelist += curlen + 1;
}
}
else
devicelist = "";
s_alAvailableDevices = Cvar_Get("s_alAvailableDevices", devicenames, CVAR_ROM | CVAR_NORESTART);
}

View file

@ -29,7 +29,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;
@ -146,7 +146,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;
@ -215,7 +215,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;

View file

@ -309,8 +309,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;
@ -421,8 +421,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;

View file

@ -650,8 +650,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;
}
}

View file

@ -887,9 +887,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;
}
}
}

View file

@ -1671,7 +1671,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;
}

View file

@ -405,7 +405,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;
@ -442,6 +441,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;
}

View file

@ -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)

View file

@ -119,7 +119,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)

View file

@ -540,7 +540,6 @@ static uint32_t DecompressIDATs(struct BufferedFile *BF, uint8_t **Buffer)
*/
DecompressedData = NULL;
DecompressedDataLength = 0;
*Buffer = DecompressedData;
CompressedData = NULL;

View file

@ -192,11 +192,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; ) {

View file

@ -53,7 +53,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);
}
@ -215,7 +217,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 ) )
{
@ -249,7 +251,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;
}
@ -281,7 +282,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;
}
@ -545,8 +545,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();
}

View file

@ -326,7 +326,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];

View file

@ -812,10 +812,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

View file

@ -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;

View file

@ -1590,7 +1590,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>

View file

@ -530,7 +530,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;
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}