Fix a few warnings

This commit is contained in:
Tim Angus 2014-08-30 17:29:09 +01:00
parent c621589157
commit 621a72e698
18 changed files with 76 additions and 74 deletions

View file

@ -2108,7 +2108,7 @@ int AAS_Reachability_Jump(int area1num, int area2num)
int stopevent, areas[10], numareas;
float phys_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}, sidewards;
aas_area_t *area1, *area2;
aas_face_t *face1, *face2;
@ -3152,7 +3152,7 @@ aas_lreachability_t *AAS_FindFaceReachabilities(vec3_t *facepoints, int numpoint
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;

View file

@ -2086,9 +2086,12 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
//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);
} //end if

View file

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

View file

@ -1757,7 +1757,7 @@ BotHarvesterOrders
*/
void BotHarvesterOrders(bot_state_t *bs) {
int numteammates, defenders, attackers, i;
int teammates[MAX_CLIENTS];
int teammates[MAX_CLIENTS] = {0};
char name[MAX_NETNAME];
//sort team mates by travel time to base

View file

@ -1087,7 +1087,6 @@ qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const play
// don't pick up if already at max
#ifdef MISSIONPACK
if( bg_itemlist[ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_GUARD ) {
upperBound = ps->stats[STAT_MAX_HEALTH];
}
else
#endif

View file

@ -348,6 +348,10 @@ RespawnItem
===============
*/
void RespawnItem( gentity_t *ent ) {
if (!ent) {
return;
}
// randomly select from teamed entities
if (ent->team) {
gentity_t *master;

View file

@ -881,6 +881,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;

View file

@ -132,11 +132,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++)
@ -178,7 +178,7 @@ qboolean G_FilterPacket (char *from)
{
int i;
unsigned in;
byte m[4];
byte m[4] = {0};
char *p;
i = 0;

View file

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

View file

@ -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;
@ -930,7 +930,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;
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...*/
@ -1128,7 +1128,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;
@ -2114,7 +2114,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;
ogg_int64_t duration=0;
int nlinks;
int li;
OP_ASSERT(_pcm_offset>=0);
@ -2170,7 +2170,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;
@ -2289,7 +2289,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;
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.*/
@ -2503,7 +2503,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;
ogg_int64_t delta=0;
int li;
links=_of->links;
pcm_offset=0;

View file

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

View file

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

View file

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

View file

@ -927,7 +927,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) offset2 = (grid2->height-1) * grid2->width;
else offset2 = 0;
@ -971,7 +971,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) offset2 = grid2->width-1;
else offset2 = 0;
@ -1026,7 +1026,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) offset2 = (grid2->height-1) * grid2->width;
else offset2 = 0;

View file

@ -2915,7 +2915,7 @@ a single large text block that can be scanned for shader names
static void ScanAndLoadShaderFiles( void )
{
char **shaderFiles;
char *buffers[MAX_SHADER_FILES];
char *buffers[MAX_SHADER_FILES] = {0};
char *p;
int numShaderFiles;
int i;

View file

@ -719,6 +719,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;
@ -730,50 +731,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;
int exitCode;
if( !tried[ i ] )
commands[ i ]( type, message, title );
exitCode = Sys_Exec( );
if( exitCode >= 0 )
{
int exitCode;
commands[ i ]( type, message, title );
exitCode = Sys_Exec( );
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;
}
}
tried[ i ] = qtrue;
// The preference failed, so start again in order
if( preferredCommandType != NONE )
{
preferredCommandType = NONE;
break;
case DT_YES_NO: return exitCode ? DR_NO : DR_YES;
case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
default: return DR_OK;
}
}
}
for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
{
if( !tried[ i ] )
continue;
}
tried[ i ] = qtrue;
break;
// The preference failed, so start again in order
if( preferredCommandType != NONE )
{
preferredCommandType = NONE;
i = NONE + 1;
}
}
}
Com_DPrintf( S_COLOR_YELLOW "WARNING: failed to show a dialog\n" );

View file

@ -690,12 +690,12 @@ UI_DrawPlayer
*/
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 flash;
refEntity_t legs = {0};
refEntity_t torso = {0};
refEntity_t head = {0};
refEntity_t gun = {0};
refEntity_t barrel = {0};
refEntity_t flash = {0};
vec3_t origin;
int renderfx;
vec3_t mins = {-16, -16, -24};

View file

@ -417,6 +417,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;
if (token.string[0] == '-') {
@ -606,7 +608,7 @@ void Fade(int *flags, float *f, float clamp, int *nextTime, int offsetTime, qboo
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;
@ -4128,6 +4130,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);