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

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