diff options
author | Tim Angus <tim@ngus.net> | 2013-03-26 16:50:03 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-03-27 11:33:16 +0000 |
commit | ecf45acd236aaf1a0d2b00a94a24d8f24fbceae4 (patch) | |
tree | 23d703104aa48a4533daed653d5c429f73dccb05 /src/qcommon | |
parent | a6e5804c1162832fa99d31c88033cbf6f1efd2f0 (diff) |
Fix some of the things clang --analyze flagged
Diffstat (limited to 'src/qcommon')
-rw-r--r-- | src/qcommon/cm_polylib.c | 8 | ||||
-rw-r--r-- | src/qcommon/cm_trace.c | 8 | ||||
-rw-r--r-- | src/qcommon/common.c | 3 | ||||
-rw-r--r-- | src/qcommon/files.c | 1 | ||||
-rw-r--r-- | src/qcommon/huffman.c | 2 | ||||
-rw-r--r-- | src/qcommon/unzip.c | 14 |
6 files changed, 14 insertions, 22 deletions
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) |