diff options
author | Tim Angus <tim@ngus.net> | 2014-08-30 17:29:09 +0100 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:38:07 +0000 |
commit | 61f78e272375bba4c55e8a976c9f73e6ed1b5713 (patch) | |
tree | fa832f3c63db10d0ddb9d936e05b2a5e20b1bb33 /src | |
parent | f67547574ba6f11f8e52ceba614992ca953aae4a (diff) |
Fix a few warnings
Diffstat (limited to 'src')
-rw-r--r-- | src/opus-1.1/src/opus_decoder.c | 2 | ||||
-rw-r--r-- | src/opusfile-0.5/src/opusfile.c | 14 | ||||
-rw-r--r-- | src/qcommon/md4.c | 10 | ||||
-rw-r--r-- | src/qcommon/msg.c | 2 | ||||
-rw-r--r-- | src/qcommon/net_ip.c | 2 | ||||
-rw-r--r-- | src/renderergl1/tr_bsp.c | 6 | ||||
-rw-r--r-- | src/renderergl1/tr_shader.c | 2 | ||||
-rw-r--r-- | src/sys/sys_unix.c | 54 |
8 files changed, 39 insertions, 53 deletions
diff --git a/src/opus-1.1/src/opus_decoder.c b/src/opus-1.1/src/opus_decoder.c index 4d03770d..0ba3a058 100644 --- a/src/opus-1.1/src/opus_decoder.c +++ b/src/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/src/opusfile-0.5/src/opusfile.c b/src/opusfile-0.5/src/opusfile.c index aaabdd1c..73b95de6 100644 --- a/src/opusfile-0.5/src/opusfile.c +++ b/src/opusfile-0.5/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; @@ -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; diff --git a/src/qcommon/md4.c b/src/qcommon/md4.c index b37c87b4..0eb23a50 100644 --- a/src/qcommon/md4.c +++ b/src/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/src/qcommon/msg.c b/src/qcommon/msg.c index aaed712a..f7001d7b 100644 --- a/src/qcommon/msg.c +++ b/src/qcommon/msg.c @@ -247,7 +247,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/src/qcommon/net_ip.c b/src/qcommon/net_ip.c index fdbe75cc..bb528d99 100644 --- a/src/qcommon/net_ip.c +++ b/src/qcommon/net_ip.c @@ -1616,7 +1616,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/src/renderergl1/tr_bsp.c b/src/renderergl1/tr_bsp.c index bde7ad0c..dc695cce 100644 --- a/src/renderergl1/tr_bsp.c +++ b/src/renderergl1/tr_bsp.c @@ -928,7 +928,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; @@ -972,7 +972,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; @@ -1027,7 +1027,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; diff --git a/src/renderergl1/tr_shader.c b/src/renderergl1/tr_shader.c index 1408902d..f84d02c6 100644 --- a/src/renderergl1/tr_shader.c +++ b/src/renderergl1/tr_shader.c @@ -2916,7 +2916,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; diff --git a/src/sys/sys_unix.c b/src/sys/sys_unix.c index 734a1e2c..7d497459 100644 --- a/src/sys/sys_unix.c +++ b/src/sys/sys_unix.c @@ -712,6 +712,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; @@ -723,50 +724,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" ); |