[iortcw] 203/497: All: Fix a few more warnings

Simon McVittie smcv at debian.org
Fri Sep 8 10:36:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 059a5cdb19e89d2cbd20e0129203a3dc63892a50
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Sat Aug 30 19:44:38 2014 +0000

    All: Fix a few more warnings
---
 MP/code/botlib/be_aas_reach.c                  |  4 +-
 MP/code/botlib/l_precomp.c                     | 10 ++---
 MP/code/game/ai_dmq3.c                         |  2 +-
 MP/code/game/g_items.c                         |  4 ++
 MP/code/game/g_mover.c                         |  4 ++
 MP/code/game/g_svcmds.c                        | 10 ++---
 MP/code/opus-1.1/silk/float/encode_frame_FLP.c |  2 +-
 MP/code/opus-1.1/src/opus_decoder.c            |  2 +-
 MP/code/opusfile-0.6/src/opusfile.c            | 14 +++----
 MP/code/qcommon/md4.c                          | 10 ++---
 MP/code/qcommon/msg.c                          |  2 +-
 MP/code/qcommon/net_ip.c                       |  2 +-
 MP/code/renderer/tr_bsp.c                      | 16 ++++----
 MP/code/renderer/tr_shader.c                   |  2 +-
 MP/code/sys/sys_unix.c                         | 54 ++++++++++----------------
 MP/code/ui/ui_players.c                        | 17 ++++----
 MP/code/ui/ui_shared.c                         |  8 +++-
 SP/code/botlib/be_aas_reach.c                  |  4 +-
 SP/code/botlib/l_precomp.c                     | 10 ++---
 SP/code/game/ai_dmq3.c                         |  2 +-
 SP/code/game/g_items.c                         |  4 ++
 SP/code/game/g_mover.c                         |  4 ++
 SP/code/game/g_svcmds.c                        | 34 ++++++++++++----
 SP/code/opus-1.1/silk/float/encode_frame_FLP.c |  2 +-
 SP/code/opus-1.1/src/opus_decoder.c            |  2 +-
 SP/code/opusfile-0.6/src/opusfile.c            | 14 +++----
 SP/code/qcommon/md4.c                          | 10 ++---
 SP/code/qcommon/msg.c                          |  2 +-
 SP/code/qcommon/net_ip.c                       |  2 +-
 SP/code/renderer/tr_bsp.c                      | 16 ++++----
 SP/code/renderer/tr_shader.c                   |  2 +-
 SP/code/sys/sys_unix.c                         | 54 ++++++++++----------------
 SP/code/ui/ui_players.c                        | 16 ++++----
 SP/code/ui/ui_shared.c                         |  8 +++-
 34 files changed, 183 insertions(+), 166 deletions(-)

diff --git a/MP/code/botlib/be_aas_reach.c b/MP/code/botlib/be_aas_reach.c
index 9a35070..c6ff636 100644
--- a/MP/code/botlib/be_aas_reach.c
+++ b/MP/code/botlib/be_aas_reach.c
@@ -1990,7 +1990,7 @@ int AAS_Reachability_Jump( int area1num, int area2num ) {
 	int i, j, k, l, face1num, face2num, edge1num, edge2num, traveltype;
 	float sv_jumpvel, maxjumpdistance, maxjumpheight, height, bestdist, speed;
 	vec_t *v1, *v2, *v3, *v4;
-	vec3_t beststart, beststart2 = {0}, bestend, bestend2 = {0};
+	vec3_t beststart = {0}, beststart2 = {0}, bestend = {0}, bestend2 = {0};
 	vec3_t teststart, testend, dir, velocity, cmdmove, up = {0, 0, 1};
 	aas_area_t *area1, *area2;
 	aas_face_t *face1, *face2;
@@ -2994,7 +2994,7 @@ aas_lreachability_t *AAS_FindFaceReachabilities( vec3_t *facepoints, int numpoin
 	int facenum, edgenum, bestfacenum;
 	float *v1, *v2, *v3, *v4;
 	float bestdist, speed, hordist, dist;
-	vec3_t beststart, beststart2 = {0}, bestend, bestend2 = {0}, tmp, hordir, testpoint;
+	vec3_t beststart = {0}, beststart2 = {0}, bestend = {0}, bestend2 = {0}, tmp, hordir, testpoint;
 	aas_lreachability_t *lreach, *lreachabilities;
 	aas_area_t *area;
 	aas_face_t *face;
diff --git a/MP/code/botlib/l_precomp.c b/MP/code/botlib/l_precomp.c
index 8bcc47e..808be8b 100644
--- a/MP/code/botlib/l_precomp.c
+++ b/MP/code/botlib/l_precomp.c
@@ -2046,11 +2046,11 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
 			//remove the second value if not question mark operator
 			if ( o->operator != P_QUESTIONMARK ) {v = v->next;}
 			//
-			if ( v->prev ) {
-				v->prev->next = v->next;
-			} else { firstvalue = v->next;}
-			if ( v->next ) {
-				v->next->prev = v->prev;
+			if (v)
+			{
+				if (v->prev) v->prev->next = v->next;
+				else firstvalue = v->next;
+				if (v->next) v->next->prev = v->prev;
 			}
 			//FreeMemory(v);
 			FreeValue( v );
diff --git a/MP/code/game/ai_dmq3.c b/MP/code/game/ai_dmq3.c
index 7304ef9..7732b9f 100644
--- a/MP/code/game/ai_dmq3.c
+++ b/MP/code/game/ai_dmq3.c
@@ -349,7 +349,7 @@ EasyClientName
 char *EasyClientName( int client, char *buf, int size ) {
 	int i;
 	char *str1, *str2, *ptr, c;
-	char name[128];
+	char name[128] = {0};
 
 	ClientName(client, name, sizeof(name));
 	for ( i = 0; name[i]; i++ ) name[i] &= 127;
diff --git a/MP/code/game/g_items.c b/MP/code/game/g_items.c
index fa4da07..39b4568 100644
--- a/MP/code/game/g_items.c
+++ b/MP/code/game/g_items.c
@@ -637,6 +637,10 @@ RespawnItem
 ===============
 */
 void RespawnItem( gentity_t *ent ) {
+	if (!ent) {
+		return;
+	}
+
 	// randomly select from teamed entities
 	if ( ent->team ) {
 		gentity_t   *master;
diff --git a/MP/code/game/g_mover.c b/MP/code/game/g_mover.c
index 901534f..c9abcc5 100644
--- a/MP/code/game/g_mover.c
+++ b/MP/code/game/g_mover.c
@@ -1937,6 +1937,10 @@ void Think_SpawnNewDoorTrigger( gentity_t *ent ) {
 	vec3_t mins, maxs;
 	int i, best;
 
+	if (!ent) {
+		return;
+	}
+
 	// set all of the slaves as shootable
 	for ( other = ent ; other ; other = other->teamchain ) {
 		other->takedamage = qtrue;
diff --git a/MP/code/game/g_svcmds.c b/MP/code/game/g_svcmds.c
index 3252b1b..d6de89c 100644
--- a/MP/code/game/g_svcmds.c
+++ b/MP/code/game/g_svcmds.c
@@ -148,11 +148,11 @@ UpdateIPBans
 =================
 */
 static void UpdateIPBans( void ) {
-	byte b[4];
-	byte m[4];
+	byte b[4] = {0};
+	byte m[4] = {0};
 	int i,j;
-	char iplist_final[MAX_CVAR_VALUE_STRING];
-	char ip[64];
+	char iplist_final[MAX_CVAR_VALUE_STRING] = {0};
+	char ip[64] = {0};
 
 	*iplist_final = 0;
 	for ( i = 0 ; i < numIPFilters ; i++ )
@@ -203,7 +203,7 @@ G_FilterPacket
 qboolean G_FilterPacket( char *from ) {
 	int i;
 	unsigned in;
-	byte m[4];
+	byte m[4] = {0};
 	char *p;
 
 	i = 0;
diff --git a/MP/code/opus-1.1/silk/float/encode_frame_FLP.c b/MP/code/opus-1.1/silk/float/encode_frame_FLP.c
index d54e268..583393c 100644
--- a/MP/code/opus-1.1/silk/float/encode_frame_FLP.c
+++ b/MP/code/opus-1.1/silk/float/encode_frame_FLP.c
@@ -87,7 +87,7 @@ opus_int silk_encode_frame_FLP(
     silk_float   *x_frame, *res_pitch_frame;
     silk_float   xfw[ MAX_FRAME_LENGTH ];
     silk_float   res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ];
-    ec_enc       sRangeEnc_copy, sRangeEnc_copy2;
+    ec_enc       sRangeEnc_copy, sRangeEnc_copy2 = {0};
     silk_nsq_state sNSQ_copy, sNSQ_copy2;
     opus_int32   seed_copy, nBits, nBits_lower, nBits_upper, gainMult_lower, gainMult_upper;
     opus_int32   gainsID, gainsID_lower, gainsID_upper;
diff --git a/MP/code/opus-1.1/src/opus_decoder.c b/MP/code/opus-1.1/src/opus_decoder.c
index 4d03770..0ba3a05 100644
--- a/MP/code/opus-1.1/src/opus_decoder.c
+++ b/MP/code/opus-1.1/src/opus_decoder.c
@@ -215,7 +215,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
    VARDECL(opus_val16, pcm_transition_silk);
    int pcm_transition_celt_size;
    VARDECL(opus_val16, pcm_transition_celt);
-   opus_val16 *pcm_transition;
+   opus_val16 *pcm_transition=NULL;
    int redundant_audio_size;
    VARDECL(opus_val16, redundant_audio);
 
diff --git a/MP/code/opusfile-0.6/src/opusfile.c b/MP/code/opusfile-0.6/src/opusfile.c
index e8ce150..eb46c01 100644
--- a/MP/code/opusfile-0.6/src/opusfile.c
+++ b/MP/code/opusfile-0.6/src/opusfile.c
@@ -317,7 +317,7 @@ struct OpusSeekRecord{
 static int op_get_prev_page_serial(OggOpusFile *_of,OpusSeekRecord *_sr,
  opus_int64 _offset,ogg_uint32_t _serialno,
  const ogg_uint32_t *_serialnos,int _nserialnos){
-  OpusSeekRecord preferred_sr;
+  OpusSeekRecord preferred_sr={0};
   ogg_page       og;
   opus_int64     begin;
   opus_int64     end;
@@ -925,7 +925,7 @@ static int op_find_initial_pcm_offset(OggOpusFile *_of,
   prev_packet_gp=pcm_start;
   for(pi=0;pi<op_count;pi++){
     if(cur_page_eos){
-      ogg_int64_t diff = 0;
+      ogg_int64_t diff=0;
       OP_ALWAYS_TRUE(!op_granpos_diff(&diff,cur_page_gp,prev_packet_gp));
       diff=durations[pi]-diff;
       /*If we have samples to trim...*/
@@ -1123,7 +1123,7 @@ static int op_bisect_forward_serialno(OggOpusFile *_of,
     opus_int64  bisect;
     opus_int64  next;
     opus_int64  last;
-    ogg_int64_t end_offset;
+    ogg_int64_t end_offset=0;
     ogg_int64_t end_gp;
     int         sri;
     serialnos=*_serialnos;
@@ -2109,7 +2109,7 @@ int op_raw_seek(OggOpusFile *_of,opus_int64 _pos){
 static ogg_int64_t op_get_granulepos(const OggOpusFile *_of,
  ogg_int64_t _pcm_offset,int *_li){
   const OggOpusLink *links;
-  ogg_int64_t        duration = 0;
+  ogg_int64_t        duration=0;
   int                nlinks;
   int                li;
   OP_ASSERT(_pcm_offset>=0);
@@ -2165,7 +2165,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
   ogg_int64_t        pcm_start;
   ogg_int64_t        pcm_end;
   ogg_int64_t        best_gp;
-  ogg_int64_t        diff;
+  ogg_int64_t        diff=0;
   ogg_uint32_t       serialno;
   opus_int32         pre_skip;
   opus_int64         begin;
@@ -2284,7 +2284,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
       d2=end-begin>>1;
       if(force_bisect)bisect=begin+(end-begin>>1);
       else{
-        ogg_int64_t diff2 = 0;
+        ogg_int64_t diff2=0;
         OP_ALWAYS_TRUE(!op_granpos_diff(&diff,_target_gp,pcm_start));
         OP_ALWAYS_TRUE(!op_granpos_diff(&diff2,pcm_end,pcm_start));
         /*Take a (pretty decent) guess.*/
@@ -2498,7 +2498,7 @@ static ogg_int64_t op_get_pcm_offset(const OggOpusFile *_of,
  ogg_int64_t _gp,int _li){
   const OggOpusLink *links;
   ogg_int64_t        pcm_offset;
-  ogg_int64_t        delta = 0;
+  ogg_int64_t        delta=0;
   int                li;
   links=_of->links;
   pcm_offset=0;
diff --git a/MP/code/qcommon/md4.c b/MP/code/qcommon/md4.c
index b37c87b..0eb23a5 100644
--- a/MP/code/qcommon/md4.c
+++ b/MP/code/qcommon/md4.c
@@ -177,12 +177,10 @@ static void mdfour_update(struct mdfour *md, byte *in, int n)
 
 static void mdfour_result(struct mdfour *md, byte *out)
 {
-	m = md;
-
-	copy4(out, m->A);
-	copy4(out+4, m->B);
-	copy4(out+8, m->C);
-	copy4(out+12, m->D);
+	copy4(out, md->A);
+	copy4(out+4, md->B);
+	copy4(out+8, md->C);
+	copy4(out+12, md->D);
 }
 
 static void mdfour(byte *out, byte *in, int n)
diff --git a/MP/code/qcommon/msg.c b/MP/code/qcommon/msg.c
index b91f701..6700573 100644
--- a/MP/code/qcommon/msg.c
+++ b/MP/code/qcommon/msg.c
@@ -243,7 +243,7 @@ int MSG_ReadBits( msg_t *msg, int bits ) {
 		}
 		msg->readcount = ( msg->bit >> 3 ) + 1;
 	}
-	if ( sgn ) {
+	if ( sgn && bits > 0 && bits < 32 ) {
 		if ( value & ( 1 << ( bits - 1 ) ) ) {
 			value |= -1 ^ ( ( 1 << bits ) - 1 );
 		}
diff --git a/MP/code/qcommon/net_ip.c b/MP/code/qcommon/net_ip.c
index b100bf3..2c4f6df 100644
--- a/MP/code/qcommon/net_ip.c
+++ b/MP/code/qcommon/net_ip.c
@@ -1620,7 +1620,7 @@ Called from NET_Sleep which uses select() to determine which sockets have seen a
 void NET_Event(fd_set *fdr)
 {
 	byte bufData[MAX_MSGLEN + 1];
-	netadr_t from;
+	netadr_t from = {0};
 	msg_t netmsg;
 	
 	while(1)
diff --git a/MP/code/renderer/tr_bsp.c b/MP/code/renderer/tr_bsp.c
index 3c3aa0c..88428b0 100644
--- a/MP/code/renderer/tr_bsp.c
+++ b/MP/code/renderer/tr_bsp.c
@@ -857,7 +857,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->width >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -913,7 +913,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 			}
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->height >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -980,7 +980,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 		for ( k = 0; k < grid1->height - 2; k += 2 ) {
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->width >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1036,7 +1036,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 			}
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->height >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1104,7 +1104,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->width >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1160,7 +1160,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 			}
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->height >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1230,7 +1230,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 		for ( k = grid1->height - 1; k > 1; k -= 2 ) {
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->width >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1286,7 +1286,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 			}
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->height >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
diff --git a/MP/code/renderer/tr_shader.c b/MP/code/renderer/tr_shader.c
index d991201..fae6165 100644
--- a/MP/code/renderer/tr_shader.c
+++ b/MP/code/renderer/tr_shader.c
@@ -2968,7 +2968,7 @@ a single large text block that can be scanned for shader names
 #define MAX_SHADER_FILES    4096
 static void ScanAndLoadShaderFiles( void ) {
 	char **shaderFiles;
-	char *buffers[MAX_SHADER_FILES];
+	char *buffers[MAX_SHADER_FILES] = {0};
 	char *p;
 	int numShaderFiles;
 	int i;
diff --git a/MP/code/sys/sys_unix.c b/MP/code/sys/sys_unix.c
index 461272a..e296ca6 100644
--- a/MP/code/sys/sys_unix.c
+++ b/MP/code/sys/sys_unix.c
@@ -717,6 +717,7 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
 	qboolean                tried[ NUM_DIALOG_PROGRAMS ] = { qfalse };
 	dialogCommandBuilder_t  commands[ NUM_DIALOG_PROGRAMS ] = { NULL };
 	dialogCommandType_t     preferredCommandType = NONE;
+	int                     i;
 
 	commands[ ZENITY ] = &Sys_ZenityCommand;
 	commands[ KDIALOG ] = &Sys_KdialogCommand;
@@ -728,50 +729,37 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
 	else if( !Q_stricmp( session, "kde" ) )
 		preferredCommandType = KDIALOG;
 
-	while( 1 )
+	for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
 	{
-		int i;
+		if( preferredCommandType != NONE && preferredCommandType != i )
+			continue;
 
-		for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
+		if( !tried[ i ] )
 		{
-			if( preferredCommandType != NONE && preferredCommandType != i )
-				continue;
-
-			if( !tried[ i ] )
-			{
-				int exitCode;
+			int exitCode;
 
-				commands[ i ]( type, message, title );
-				exitCode = Sys_Exec( );
+			commands[ i ]( type, message, title );
+			exitCode = Sys_Exec( );
 
-				if( exitCode >= 0 )
+			if( exitCode >= 0 )
+			{
+				switch( type )
 				{
-					switch( type )
-					{
-						case DT_YES_NO:    return exitCode ? DR_NO : DR_YES;
-						case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
-						default:           return DR_OK;
-					}
+					case DT_YES_NO:    return exitCode ? DR_NO : DR_YES;
+					case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
+					default:           return DR_OK;
 				}
+			}
 
-				tried[ i ] = qtrue;
+			tried[ i ] = qtrue;
 
-				// The preference failed, so start again in order
-				if( preferredCommandType != NONE )
-				{
-					preferredCommandType = NONE;
-					break;
-				}
+			// The preference failed, so start again in order
+			if( preferredCommandType != NONE )
+			{
+				preferredCommandType = NONE;
+				i = NONE + 1;
 			}
 		}
-
-		for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
-		{
-			if( !tried[ i ] )
-				continue;
-		}
-
-		break;
 	}
 
 	Com_DPrintf( S_COLOR_YELLOW "WARNING: failed to show a dialog\n" );
diff --git a/MP/code/ui/ui_players.c b/MP/code/ui/ui_players.c
index f3f5cd9..79457b1 100644
--- a/MP/code/ui/ui_players.c
+++ b/MP/code/ui/ui_players.c
@@ -765,15 +765,14 @@ void WM_getWeaponAnim( const char **torso_anim, const char **legs_anim );
 
 void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int time ) {
 	refdef_t refdef;
-	refEntity_t legs;
-	refEntity_t torso;
-	refEntity_t head;
-	refEntity_t gun;
-	refEntity_t barrel;
-	refEntity_t backpack;
-	refEntity_t helmet;
-//	refEntity_t		barrel;
-	refEntity_t flash;
+	refEntity_t legs = {0};
+	refEntity_t torso = {0};
+	refEntity_t head = {0};
+	refEntity_t gun = {0};
+	refEntity_t barrel = {0};
+	refEntity_t backpack = {0};
+	refEntity_t helmet = {0};
+	refEntity_t flash = {0};
 	vec3_t origin;
 	int renderfx;
 	vec3_t mins = {-16, -16, -24};
diff --git a/MP/code/ui/ui_shared.c b/MP/code/ui/ui_shared.c
index c90f841..a72134e 100644
--- a/MP/code/ui/ui_shared.c
+++ b/MP/code/ui/ui_shared.c
@@ -429,6 +429,8 @@ qboolean PC_Int_Parse( int handle, int *i ) {
 	pc_token_t token;
 	int negative = qfalse;
 
+	if (!i)
+		return qfalse;
 	if ( !trap_PC_ReadToken( handle, &token ) ) {
 		return qfalse;
 	}
@@ -660,7 +662,7 @@ void Fade( int *flags, float *f, float clamp, int *nextTime, int offsetTime, qbo
 
 void Window_Paint( Window *w, float fadeAmount, float fadeClamp, float fadeCycle ) {
 	//float bordersize = 0;
-	vec4_t color;
+	vec4_t color = {0};
 	rectDef_t fillRect = w->rect;
 
 	if ( debugMode ) {
@@ -4553,6 +4555,10 @@ menuDef_t *Menus_ActivateByName( const char *p, qboolean modalStack ) {
 
 
 void Item_Init( itemDef_t *item ) {
+	if (item == NULL) {
+		return;
+	}
+
 	memset( item, 0, sizeof( itemDef_t ) );
 	item->textscale = 0.55f;
 	Window_Init( &item->window );
diff --git a/SP/code/botlib/be_aas_reach.c b/SP/code/botlib/be_aas_reach.c
index e41e930..63fd841 100644
--- a/SP/code/botlib/be_aas_reach.c
+++ b/SP/code/botlib/be_aas_reach.c
@@ -1994,7 +1994,7 @@ int AAS_Reachability_Jump( int area1num, int area2num ) {
 	int i, j, k, l, face1num, face2num, edge1num, edge2num, traveltype;
 	float sv_jumpvel, maxjumpdistance, maxjumpheight, height, bestdist, speed;
 	vec_t *v1, *v2, *v3, *v4;
-	vec3_t beststart, beststart2 = {0}, bestend, bestend2 = {0};
+	vec3_t beststart = {0}, beststart2 = {0}, bestend = {0}, bestend2 = {0};
 	vec3_t teststart, testend, dir, velocity, cmdmove, up = {0, 0, 1};
 	aas_area_t *area1, *area2;
 	aas_face_t *face1, *face2;
@@ -2998,7 +2998,7 @@ aas_lreachability_t *AAS_FindFaceReachabilities( vec3_t *facepoints, int numpoin
 	int facenum, edgenum, bestfacenum;
 	float *v1, *v2, *v3, *v4;
 	float bestdist, speed, hordist, dist;
-	vec3_t beststart, beststart2 = {0}, bestend, bestend2 = {0}, tmp, hordir, testpoint;
+	vec3_t beststart = {0}, beststart2 = {0}, bestend = {0}, bestend2 = {0}, tmp, hordir, testpoint;
 	aas_lreachability_t *lreach, *lreachabilities;
 	aas_area_t *area;
 	aas_face_t *face;
diff --git a/SP/code/botlib/l_precomp.c b/SP/code/botlib/l_precomp.c
index 141d65f..9fd28eb 100644
--- a/SP/code/botlib/l_precomp.c
+++ b/SP/code/botlib/l_precomp.c
@@ -2049,11 +2049,11 @@ int PC_EvaluateTokens( source_t *source, token_t *tokens, signed long int *intva
 				v = v->next;
 			}
 			//
-			if ( v->prev ) {
-				v->prev->next = v->next;
-			} else { firstvalue = v->next;}
-			if ( v->next ) {
-				v->next->prev = v->prev;
+			if (v)
+			{
+				if (v->prev) v->prev->next = v->next;
+				else firstvalue = v->next;
+				if (v->next) v->next->prev = v->prev;
 			}
 			//FreeMemory(v);
 			FreeValue( v );
diff --git a/SP/code/game/ai_dmq3.c b/SP/code/game/ai_dmq3.c
index 4957d45..073cd7b 100644
--- a/SP/code/game/ai_dmq3.c
+++ b/SP/code/game/ai_dmq3.c
@@ -350,7 +350,7 @@ EasyClientName
 char *EasyClientName( int client, char *buf, int size ) {
 	int i;
 	char *str1, *str2, *ptr, c;
-	char name[128];
+	char name[128] = {0};
 
 	ClientName(client, name, sizeof(name));
 	for ( i = 0; name[i]; i++ ) name[i] &= 127;
diff --git a/SP/code/game/g_items.c b/SP/code/game/g_items.c
index 3de3dbf..6fd39e0 100644
--- a/SP/code/game/g_items.c
+++ b/SP/code/game/g_items.c
@@ -571,6 +571,10 @@ RespawnItem
 ===============
 */
 void RespawnItem( gentity_t *ent ) {
+	if (!ent) {
+		return;
+	}
+
 	// randomly select from teamed entities
 	if ( ent->team ) {
 		gentity_t   *master;
diff --git a/SP/code/game/g_mover.c b/SP/code/game/g_mover.c
index 9e8ba89..26786bd 100644
--- a/SP/code/game/g_mover.c
+++ b/SP/code/game/g_mover.c
@@ -1943,6 +1943,10 @@ void Think_SpawnNewDoorTrigger( gentity_t *ent ) {
 	vec3_t mins, maxs;
 	int i, best;
 
+	if (!ent) {
+		return;
+	}
+
 	// set all of the slaves as shootable
 	for ( other = ent ; other ; other = other->teamchain ) {
 		other->takedamage = qtrue;
diff --git a/SP/code/game/g_svcmds.c b/SP/code/game/g_svcmds.c
index 88e8adc..20934a3 100644
--- a/SP/code/game/g_svcmds.c
+++ b/SP/code/game/g_svcmds.c
@@ -130,11 +130,13 @@ UpdateIPBans
 =================
 */
 static void UpdateIPBans( void ) {
-	byte b[4];
-	int i;
-	char iplist[MAX_INFO_STRING];
+	byte b[4] = {0};
+	byte m[4] = {0};
+	int i,j;
+	char iplist_final[MAX_CVAR_VALUE_STRING] = {0};
+	char ip[64] = {0};
 
-	*iplist = 0;
+	*iplist_final = 0;
 	for ( i = 0 ; i < numIPFilters ; i++ )
 	{
 		if ( ipFilters[i].compare == 0xffffffff ) {
@@ -142,11 +144,27 @@ static void UpdateIPBans( void ) {
 		}
 
 		*(unsigned *)b = ipFilters[i].compare;
-		Com_sprintf( iplist + strlen( iplist ), sizeof( iplist ) - strlen( iplist ),
-					 "%i.%i.%i.%i ", b[0], b[1], b[2], b[3] );
+		*(unsigned *)m = ipFilters[i].mask;
+		*ip = 0;
+		for ( j = 0 ; j < 4 ; j++ )
+		{
+			if ( m[j] != 255 ) {
+				Q_strcat( ip, sizeof( ip ), "*" );
+			} else {
+				Q_strcat( ip, sizeof( ip ), va( "%i", b[j] ) );
+			}
+			Q_strcat( ip, sizeof( ip ), ( j < 3 ) ? "." : " " );
+		}
+		if ( strlen( iplist_final ) + strlen( ip ) < MAX_CVAR_VALUE_STRING ) {
+			Q_strcat( iplist_final, sizeof( iplist_final ), ip );
+		} else
+		{
+			Com_Printf( "g_banIPs overflowed at MAX_CVAR_VALUE_STRING\n" );
+			break;
+		}
 	}
 
-	trap_Cvar_Set( "g_banIPs", iplist );
+	trap_Cvar_Set( "g_banIPs", iplist_final );
 }
 
 /*
@@ -157,7 +175,7 @@ G_FilterPacket
 qboolean G_FilterPacket( char *from ) {
 	int i;
 	unsigned in;
-	byte m[4];
+	byte m[4] = {0};
 	char *p;
 
 	i = 0;
diff --git a/SP/code/opus-1.1/silk/float/encode_frame_FLP.c b/SP/code/opus-1.1/silk/float/encode_frame_FLP.c
index d54e268..583393c 100644
--- a/SP/code/opus-1.1/silk/float/encode_frame_FLP.c
+++ b/SP/code/opus-1.1/silk/float/encode_frame_FLP.c
@@ -87,7 +87,7 @@ opus_int silk_encode_frame_FLP(
     silk_float   *x_frame, *res_pitch_frame;
     silk_float   xfw[ MAX_FRAME_LENGTH ];
     silk_float   res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ];
-    ec_enc       sRangeEnc_copy, sRangeEnc_copy2;
+    ec_enc       sRangeEnc_copy, sRangeEnc_copy2 = {0};
     silk_nsq_state sNSQ_copy, sNSQ_copy2;
     opus_int32   seed_copy, nBits, nBits_lower, nBits_upper, gainMult_lower, gainMult_upper;
     opus_int32   gainsID, gainsID_lower, gainsID_upper;
diff --git a/SP/code/opus-1.1/src/opus_decoder.c b/SP/code/opus-1.1/src/opus_decoder.c
index 4d03770..0ba3a05 100644
--- a/SP/code/opus-1.1/src/opus_decoder.c
+++ b/SP/code/opus-1.1/src/opus_decoder.c
@@ -215,7 +215,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
    VARDECL(opus_val16, pcm_transition_silk);
    int pcm_transition_celt_size;
    VARDECL(opus_val16, pcm_transition_celt);
-   opus_val16 *pcm_transition;
+   opus_val16 *pcm_transition=NULL;
    int redundant_audio_size;
    VARDECL(opus_val16, redundant_audio);
 
diff --git a/SP/code/opusfile-0.6/src/opusfile.c b/SP/code/opusfile-0.6/src/opusfile.c
index e8ce150..eb46c01 100644
--- a/SP/code/opusfile-0.6/src/opusfile.c
+++ b/SP/code/opusfile-0.6/src/opusfile.c
@@ -317,7 +317,7 @@ struct OpusSeekRecord{
 static int op_get_prev_page_serial(OggOpusFile *_of,OpusSeekRecord *_sr,
  opus_int64 _offset,ogg_uint32_t _serialno,
  const ogg_uint32_t *_serialnos,int _nserialnos){
-  OpusSeekRecord preferred_sr;
+  OpusSeekRecord preferred_sr={0};
   ogg_page       og;
   opus_int64     begin;
   opus_int64     end;
@@ -925,7 +925,7 @@ static int op_find_initial_pcm_offset(OggOpusFile *_of,
   prev_packet_gp=pcm_start;
   for(pi=0;pi<op_count;pi++){
     if(cur_page_eos){
-      ogg_int64_t diff = 0;
+      ogg_int64_t diff=0;
       OP_ALWAYS_TRUE(!op_granpos_diff(&diff,cur_page_gp,prev_packet_gp));
       diff=durations[pi]-diff;
       /*If we have samples to trim...*/
@@ -1123,7 +1123,7 @@ static int op_bisect_forward_serialno(OggOpusFile *_of,
     opus_int64  bisect;
     opus_int64  next;
     opus_int64  last;
-    ogg_int64_t end_offset;
+    ogg_int64_t end_offset=0;
     ogg_int64_t end_gp;
     int         sri;
     serialnos=*_serialnos;
@@ -2109,7 +2109,7 @@ int op_raw_seek(OggOpusFile *_of,opus_int64 _pos){
 static ogg_int64_t op_get_granulepos(const OggOpusFile *_of,
  ogg_int64_t _pcm_offset,int *_li){
   const OggOpusLink *links;
-  ogg_int64_t        duration = 0;
+  ogg_int64_t        duration=0;
   int                nlinks;
   int                li;
   OP_ASSERT(_pcm_offset>=0);
@@ -2165,7 +2165,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
   ogg_int64_t        pcm_start;
   ogg_int64_t        pcm_end;
   ogg_int64_t        best_gp;
-  ogg_int64_t        diff;
+  ogg_int64_t        diff=0;
   ogg_uint32_t       serialno;
   opus_int32         pre_skip;
   opus_int64         begin;
@@ -2284,7 +2284,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
       d2=end-begin>>1;
       if(force_bisect)bisect=begin+(end-begin>>1);
       else{
-        ogg_int64_t diff2 = 0;
+        ogg_int64_t diff2=0;
         OP_ALWAYS_TRUE(!op_granpos_diff(&diff,_target_gp,pcm_start));
         OP_ALWAYS_TRUE(!op_granpos_diff(&diff2,pcm_end,pcm_start));
         /*Take a (pretty decent) guess.*/
@@ -2498,7 +2498,7 @@ static ogg_int64_t op_get_pcm_offset(const OggOpusFile *_of,
  ogg_int64_t _gp,int _li){
   const OggOpusLink *links;
   ogg_int64_t        pcm_offset;
-  ogg_int64_t        delta = 0;
+  ogg_int64_t        delta=0;
   int                li;
   links=_of->links;
   pcm_offset=0;
diff --git a/SP/code/qcommon/md4.c b/SP/code/qcommon/md4.c
index b37c87b..0eb23a5 100644
--- a/SP/code/qcommon/md4.c
+++ b/SP/code/qcommon/md4.c
@@ -177,12 +177,10 @@ static void mdfour_update(struct mdfour *md, byte *in, int n)
 
 static void mdfour_result(struct mdfour *md, byte *out)
 {
-	m = md;
-
-	copy4(out, m->A);
-	copy4(out+4, m->B);
-	copy4(out+8, m->C);
-	copy4(out+12, m->D);
+	copy4(out, md->A);
+	copy4(out+4, md->B);
+	copy4(out+8, md->C);
+	copy4(out+12, md->D);
 }
 
 static void mdfour(byte *out, byte *in, int n)
diff --git a/SP/code/qcommon/msg.c b/SP/code/qcommon/msg.c
index 3a244d7..7bf7f08 100644
--- a/SP/code/qcommon/msg.c
+++ b/SP/code/qcommon/msg.c
@@ -240,7 +240,7 @@ int MSG_ReadBits( msg_t *msg, int bits ) {
 		}
 		msg->readcount = ( msg->bit >> 3 ) + 1;
 	}
-	if ( sgn ) {
+	if ( sgn && bits > 0 && bits < 32 ) {
 		if ( value & ( 1 << ( bits - 1 ) ) ) {
 			value |= -1 ^ ( ( 1 << bits ) - 1 );
 		}
diff --git a/SP/code/qcommon/net_ip.c b/SP/code/qcommon/net_ip.c
index b100bf3..2c4f6df 100644
--- a/SP/code/qcommon/net_ip.c
+++ b/SP/code/qcommon/net_ip.c
@@ -1620,7 +1620,7 @@ Called from NET_Sleep which uses select() to determine which sockets have seen a
 void NET_Event(fd_set *fdr)
 {
 	byte bufData[MAX_MSGLEN + 1];
-	netadr_t from;
+	netadr_t from = {0};
 	msg_t netmsg;
 	
 	while(1)
diff --git a/SP/code/renderer/tr_bsp.c b/SP/code/renderer/tr_bsp.c
index c87980f..5ba2c7a 100644
--- a/SP/code/renderer/tr_bsp.c
+++ b/SP/code/renderer/tr_bsp.c
@@ -855,7 +855,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->width >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -911,7 +911,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 			}
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->height >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -978,7 +978,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 		for ( k = 0; k < grid1->height - 2; k += 2 ) {
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->width >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1034,7 +1034,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 			}
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->height >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1102,7 +1102,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->width >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1158,7 +1158,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 			}
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->height >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1228,7 +1228,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 		for ( k = grid1->height - 1; k > 1; k -= 2 ) {
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->width >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->width >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
@@ -1284,7 +1284,7 @@ int R_StitchPatches( int grid1num, int grid2num ) {
 			}
 			for ( m = 0; m < 2; m++ ) {
 
-				if ( grid2->height >= MAX_GRID_SIZE ) {
+				if ( !grid2 || grid2->height >= MAX_GRID_SIZE ) {
 					break;
 				}
 				if ( m ) {
diff --git a/SP/code/renderer/tr_shader.c b/SP/code/renderer/tr_shader.c
index 4b1b39c..0b79426 100644
--- a/SP/code/renderer/tr_shader.c
+++ b/SP/code/renderer/tr_shader.c
@@ -3076,7 +3076,7 @@ a single large text block that can be scanned for shader names
 #define MAX_SHADER_FILES    4096
 static void ScanAndLoadShaderFiles( void ) {
 	char **shaderFiles;
-	char *buffers[MAX_SHADER_FILES];
+	char *buffers[MAX_SHADER_FILES] = {0};
 	char *p;
 	int numShaderFiles;
 	int i;
diff --git a/SP/code/sys/sys_unix.c b/SP/code/sys/sys_unix.c
index ec08ba0..0421362 100644
--- a/SP/code/sys/sys_unix.c
+++ b/SP/code/sys/sys_unix.c
@@ -717,6 +717,7 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
 	qboolean                tried[ NUM_DIALOG_PROGRAMS ] = { qfalse };
 	dialogCommandBuilder_t  commands[ NUM_DIALOG_PROGRAMS ] = { NULL };
 	dialogCommandType_t     preferredCommandType = NONE;
+	int                     i;
 
 	commands[ ZENITY ] = &Sys_ZenityCommand;
 	commands[ KDIALOG ] = &Sys_KdialogCommand;
@@ -728,50 +729,37 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
 	else if( !Q_stricmp( session, "kde" ) )
 		preferredCommandType = KDIALOG;
 
-	while( 1 )
+	for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
 	{
-		int i;
+		if( preferredCommandType != NONE && preferredCommandType != i )
+			continue;
 
-		for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
+		if( !tried[ i ] )
 		{
-			if( preferredCommandType != NONE && preferredCommandType != i )
-				continue;
-
-			if( !tried[ i ] )
-			{
-				int exitCode;
+			int exitCode;
 
-				commands[ i ]( type, message, title );
-				exitCode = Sys_Exec( );
+			commands[ i ]( type, message, title );
+			exitCode = Sys_Exec( );
 
-				if( exitCode >= 0 )
+			if( exitCode >= 0 )
+			{
+				switch( type )
 				{
-					switch( type )
-					{
-						case DT_YES_NO:    return exitCode ? DR_NO : DR_YES;
-						case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
-						default:           return DR_OK;
-					}
+					case DT_YES_NO:    return exitCode ? DR_NO : DR_YES;
+					case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
+					default:           return DR_OK;
 				}
+			}
 
-				tried[ i ] = qtrue;
+			tried[ i ] = qtrue;
 
-				// The preference failed, so start again in order
-				if( preferredCommandType != NONE )
-				{
-					preferredCommandType = NONE;
-					break;
-				}
+			// The preference failed, so start again in order
+			if( preferredCommandType != NONE )
+			{
+				preferredCommandType = NONE;
+				i = NONE + 1;
 			}
 		}
-
-		for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
-		{
-			if( !tried[ i ] )
-				continue;
-		}
-
-		break;
 	}
 
 	Com_DPrintf( S_COLOR_YELLOW "WARNING: failed to show a dialog\n" );
diff --git a/SP/code/ui/ui_players.c b/SP/code/ui/ui_players.c
index eefc15e..6a88b72 100644
--- a/SP/code/ui/ui_players.c
+++ b/SP/code/ui/ui_players.c
@@ -747,14 +747,14 @@ void WM_getWeaponAnim( const char **torso_anim, const char **legs_anim );
 
 void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int time ) {
 	refdef_t refdef;
-	refEntity_t legs;
-	refEntity_t torso;
-	refEntity_t head;
-	refEntity_t gun;
-	refEntity_t backpack;
-	refEntity_t helmet;
-//	refEntity_t		barrel;
-	refEntity_t flash;
+	refEntity_t legs = {0};
+	refEntity_t torso = {0};
+	refEntity_t head = {0};
+	refEntity_t gun = {0};
+	refEntity_t backpack = {0};
+	refEntity_t helmet = {0};
+//	refEntity_t		barrel = {0};
+	refEntity_t flash = {0};
 	vec3_t origin;
 	int renderfx;
 	vec3_t mins = {-16, -16, -24};
diff --git a/SP/code/ui/ui_shared.c b/SP/code/ui/ui_shared.c
index 1654e43..30ac739 100644
--- a/SP/code/ui/ui_shared.c
+++ b/SP/code/ui/ui_shared.c
@@ -501,6 +501,8 @@ qboolean PC_Int_Parse( int handle, int *i ) {
 	pc_token_t token;
 	int negative = qfalse;
 
+	if (!i)
+		return qfalse;
 	if ( !trap_PC_ReadToken( handle, &token ) ) {
 		return qfalse;
 	}
@@ -714,7 +716,7 @@ void Fade( int *flags, float *f, float clamp, int *nextTime, int offsetTime, qbo
 
 void Window_Paint( Window *w, float fadeAmount, float fadeClamp, float fadeCycle ) {
 	//float bordersize = 0;
-	vec4_t color;
+	vec4_t color = {0};
 	rectDef_t fillRect = w->rect;
 
 	if ( debugMode ) {
@@ -4502,6 +4504,10 @@ menuDef_t *Menus_ActivateByName( const char *p ) {
 
 
 void Item_Init( itemDef_t *item ) {
+	if (item == NULL) {
+		return;
+	}
+
 	memset( item, 0, sizeof( itemDef_t ) );
 	item->textscale = 0.55f;
 	Window_Init( &item->window );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list