diff options
author | Thilo Schulz <arny@ats.s.bawue.de> | 2011-07-29 12:27:00 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-10 22:36:34 +0000 |
commit | e7c06719510940898e1f7f8215f4137202611308 (patch) | |
tree | 0aec0bf91daa568d8cb4a1c412037ca26b2f92a6 | |
parent | 76544bcec46127587d183a90e5ff817a71e1f139 (diff) |
Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings
43 files changed, 89 insertions, 152 deletions
diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c index 0425cbd6..7e1248a5 100644 --- a/src/client/cl_cgame.c +++ b/src/client/cl_cgame.c @@ -877,7 +877,6 @@ or bursted delayed packets. #define RESET_TIME 500 void CL_AdjustTimeDelta( void ) { - int resetTime; int newDelta; int deltaDelta; @@ -888,13 +887,6 @@ void CL_AdjustTimeDelta( void ) { return; } - // if the current time is WAY off, just correct to the current value - if ( com_sv_running->integer ) { - resetTime = 100; - } else { - resetTime = RESET_TIME; - } - newDelta = cl.snap.serverTime - cls.realtime; deltaDelta = abs( newDelta - cl.serverTimeDelta ); diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c index 0628342a..8f6e82a2 100644 --- a/src/client/cl_cin.c +++ b/src/client/cl_cin.c @@ -938,10 +938,6 @@ static void setupQuad( long xOff, long yOff ) cin.oldysize = cinTable[currentHandle].ysize; cin.oldxsize = cinTable[currentHandle].xsize; - numQuadCels = (cinTable[currentHandle].CIN_WIDTH*cinTable[currentHandle].CIN_HEIGHT) / (16); - numQuadCels += numQuadCels/4 + numQuadCels/16; - numQuadCels += 64; // for overflow - numQuadCels = (cinTable[currentHandle].xsize*cinTable[currentHandle].ysize) / (16); numQuadCels += numQuadCels/4; numQuadCels += 64; // for overflow @@ -1611,7 +1607,6 @@ void CIN_DrawCinematic (int handle) { void CL_PlayCinematic_f(void) { char *arg, *s; - qboolean holdatend; int bits = CIN_system; Com_DPrintf("CL_PlayCinematic_f\n"); @@ -1622,7 +1617,6 @@ void CL_PlayCinematic_f(void) { arg = Cmd_Argv( 1 ); s = Cmd_Argv(2); - holdatend = qfalse; if ((s && s[0] == '1') || Q_stricmp(arg,"demoend.roq")==0 || Q_stricmp(arg,"end.roq")==0) { bits |= CIN_hold; } diff --git a/src/client/cl_input.c b/src/client/cl_input.c index bae37cfe..e25c840d 100644 --- a/src/client/cl_input.c +++ b/src/client/cl_input.c @@ -280,10 +280,6 @@ void IN_CenterView (void) { //========================================================================== -cvar_t *cl_upspeed; -cvar_t *cl_forwardspeed; -cvar_t *cl_sidespeed; - cvar_t *cl_yawspeed; cvar_t *cl_pitchspeed; @@ -400,13 +396,9 @@ CL_JoystickMove ================= */ void CL_JoystickMove( usercmd_t *cmd ) { - int movespeed; float anglespeed; - if ( in_speed.active ^ cl_run->integer ) { - movespeed = 2; - } else { - movespeed = 1; + if ( !(in_speed.active ^ cl_run->integer) ) { cmd->buttons |= BUTTON_WALKING; } @@ -618,10 +610,10 @@ usercmd_t CL_CreateCmd( void ) { // draw debug graphs of turning for mouse testing if ( cl_debugMove->integer ) { if ( cl_debugMove->integer == 1 ) { - SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]), 0 ); + SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]) ); } if ( cl_debugMove->integer == 2 ) { - SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]), 0 ); + SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]) ); } } @@ -637,7 +629,6 @@ Create a new usercmd_t structure for this frame ================= */ void CL_CreateNewCommands( void ) { - usercmd_t *cmd; int cmdNum; // no need to create usercmds until we have a gamestate @@ -659,7 +650,6 @@ void CL_CreateNewCommands( void ) { cl.cmdNumber++; cmdNum = cl.cmdNumber & CMD_MASK; cl.cmds[cmdNum] = CL_CreateCmd (); - cmd = &cl.cmds[cmdNum]; } /* diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 80756007..b9742649 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -492,9 +492,7 @@ void CL_CaptureVoip(void) // try to get more audio data from the sound card... if (initialFrame) { - float gain = cl_voipGainDuringCapture->value; - if (gain < 0.0f) gain = 0.0f; else if (gain >= 1.0f) gain = 1.0f; - S_MasterGain(cl_voipGainDuringCapture->value); + S_MasterGain(Com_Clamp(0.0f, 1.0f, cl_voipGainDuringCapture->value)); S_StartCapture(); CL_VoipNewGeneration(); CL_VoipParseTargets(); @@ -634,9 +632,8 @@ CL_ChangeReliableCommand ====================== */ void CL_ChangeReliableCommand( void ) { - int r, index, l; + int index, l; - r = clc.reliableSequence - (random() * 5); index = clc.reliableSequence & ( MAX_RELIABLE_COMMANDS - 1 ); l = strlen(clc.reliableCommands[ index ]); if ( l >= MAX_STRING_CHARS - 1 ) { @@ -3128,7 +3125,7 @@ void CL_Frame ( int msec ) { cls.realtime += cls.frametime; if ( cl_timegraph->integer ) { - SCR_DebugGraph ( cls.realFrametime * 0.25, 0 ); + SCR_DebugGraph ( cls.realFrametime * 0.25 ); } // see if we need to update any userinfo @@ -3910,10 +3907,8 @@ CL_GetServerStatus =================== */ serverStatus_t *CL_GetServerStatus( netadr_t from ) { - serverStatus_t *serverStatus; int i, oldest, oldestTime; - serverStatus = NULL; for (i = 0; i < MAX_SERVERSTATUSREQUESTS; i++) { if ( NET_CompareAdr( from, cl_serverStatusList[i].address ) ) { return &cl_serverStatusList[i]; @@ -4438,7 +4433,6 @@ qboolean CL_UpdateVisiblePings_f(int source) { if (slots < MAX_PINGREQUESTS) { serverInfo_t *server = NULL; - max = (source == AS_GLOBAL) ? MAX_GLOBAL_SERVERS : MAX_OTHER_SERVERS; switch (source) { case AS_LOCAL : server = &cls.localServers[0]; diff --git a/src/client/cl_scrn.c b/src/client/cl_scrn.c index afafea25..1a7a34b4 100644 --- a/src/client/cl_scrn.c +++ b/src/client/cl_scrn.c @@ -376,25 +376,18 @@ DEBUG GRAPH =============================================================================== */ -typedef struct -{ - float value; - int color; -} graphsamp_t; - static int current; -static graphsamp_t values[1024]; +static float values[1024]; /* ============== SCR_DebugGraph ============== */ -void SCR_DebugGraph (float value, int color) +void SCR_DebugGraph (float value) { - values[current&1023].value = value; - values[current&1023].color = color; - current++; + values[current] = value; + current = (current + 1) % ARRAY_LEN(values); } /* @@ -406,7 +399,6 @@ void SCR_DrawDebugGraph (void) { int a, x, y, w, i, h; float v; - int color; // // draw the graph @@ -421,9 +413,8 @@ void SCR_DrawDebugGraph (void) for (a=0 ; a<w ; a++) { - i = (current-1-a+1024) & 1023; - v = values[i].value; - color = values[i].color; + i = (ARRAY_LEN(values)+current-1-(a % ARRAY_LEN(values))) % ARRAY_LEN(values); + v = values[i]; v = v * cl_graphscale->integer + cl_graphshift->integer; if (v < 0) diff --git a/src/client/client.h b/src/client/client.h index 65ff9084..570a3dab 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -568,7 +568,7 @@ void CL_SaveConsoleHistory( void ); void SCR_Init (void); void SCR_UpdateScreen (void); -void SCR_DebugGraph (float value, int color); +void SCR_DebugGraph (float value); int SCR_GetBigStringWidth( const char *str ); // returns in virtual 640x480 coordinates diff --git a/src/client/snd_codec_wav.c b/src/client/snd_codec_wav.c index 140bc10d..8647e0da 100644 --- a/src/client/snd_codec_wav.c +++ b/src/client/snd_codec_wav.c @@ -132,7 +132,6 @@ S_ReadRIFFHeader static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info) { char dump[16]; - int wav_format; int bits; int fmtlen = 0; @@ -147,7 +146,7 @@ static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info) } // Save the parameters - wav_format = FGetLittleShort(file); + FGetLittleShort(file); // wav_format info->channels = FGetLittleShort(file); info->rate = FGetLittleLong(file); FGetLittleLong(file); diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c index 660525dd..28a7d2ee 100644 --- a/src/client/snd_openal.c +++ b/src/client/snd_openal.c @@ -246,8 +246,6 @@ S_AL_BufferUnload */ static void S_AL_BufferUnload(sfxHandle_t sfx) { - ALenum error; - if(knownSfx[sfx].filename[0] == '\0') return; @@ -257,7 +255,7 @@ static void S_AL_BufferUnload(sfxHandle_t sfx) // Delete it S_AL_ClearError( qfalse ); qalDeleteBuffers(1, &knownSfx[sfx].buffer); - if((error = qalGetError()) != AL_NO_ERROR) + if(qalGetError() != AL_NO_ERROR) Com_Printf( S_COLOR_RED "ERROR: Can't delete sound buffer for %s\n", knownSfx[sfx].filename); @@ -692,7 +690,6 @@ qboolean S_AL_SrcInit( void ) { int i; int limit; - ALenum error; // Clear the sources data structure memset(srcList, 0, sizeof(srcList)); @@ -711,7 +708,7 @@ qboolean S_AL_SrcInit( void ) for(i = 0; i < limit; i++) { qalGenSources(1, &srcList[i].alSource); - if((error = qalGetError()) != AL_NO_ERROR) + if(qalGetError() != AL_NO_ERROR) break; srcCount++; } @@ -2459,20 +2456,26 @@ qboolean S_AL_Init( soundInterface_t *si ) { char devicenames[16384] = ""; const char *devicelist; +#ifdef _WIN32 const char *defaultdevice; +#endif int curlen; // get all available devices + the default device name. if(enumeration_all_ext) { devicelist = qalcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); +#ifdef _WIN32 defaultdevice = qalcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); +#endif } else { // We don't have ALC_ENUMERATE_ALL_EXT but normal enumeration. devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER); +#ifdef _WIN32 defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); +#endif enumeration_ext = qtrue; } diff --git a/src/libspeex/cb_search.c b/src/libspeex/cb_search.c index 63f4c6a4..39ad50c2 100644 --- a/src/libspeex/cb_search.c +++ b/src/libspeex/cb_search.c @@ -524,14 +524,15 @@ spx_int32_t *seed VARDECL(int *ind); VARDECL(int *signs); const signed char *shape_cb; - int shape_cb_size, subvect_size, nb_subvect; + //int shape_cb_size; + int subvect_size, nb_subvect; const split_cb_params *params; int have_sign; params = (const split_cb_params *) par; subvect_size = params->subvect_size; nb_subvect = params->nb_subvect; - shape_cb_size = 1<<params->shape_bits; + //shape_cb_size = 1<<params->shape_bits; shape_cb = params->shape_cb; have_sign = params->have_sign; diff --git a/src/libspeex/jitter.c b/src/libspeex/jitter.c index 6a32e754..a1fbd88e 100644 --- a/src/libspeex/jitter.c +++ b/src/libspeex/jitter.c @@ -463,7 +463,7 @@ int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int3 { int i; unsigned int j; - int incomplete = 0; + //int incomplete = 0; spx_int16_t opt; if (start_offset != NULL) @@ -568,7 +568,7 @@ int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int3 if (found) { i=besti; - incomplete = 1; + //incomplete = 1; /*fprintf (stderr, "incomplete: %d %d %d %d\n", jitter->packets[i].timestamp, jitter->pointer_timestamp, chunk_size, jitter->packets[i].span);*/ } } diff --git a/src/libspeex/nb_celp.c b/src/libspeex/nb_celp.c index 9dd726a0..52e360d2 100644 --- a/src/libspeex/nb_celp.c +++ b/src/libspeex/nb_celp.c @@ -1300,7 +1300,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) { int offset; spx_word16_t *exc; - spx_word16_t *sp; + //spx_word16_t *sp; spx_word16_t *innov_save = NULL; spx_word16_t tmp; @@ -1309,7 +1309,7 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) /* Excitation */ exc=st->exc+offset; /* Original signal */ - sp=out+offset; + //sp=out+offset; if (st->innov_save) innov_save = st->innov_save+offset; @@ -1502,13 +1502,13 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) { int offset; spx_word16_t *sp; - spx_word16_t *exc; + //spx_word16_t *exc; /* Offset relative to start of frame */ offset = st->subframeSize*sub; /* Original signal */ sp=out+offset; /* Excitation */ - exc=st->exc+offset; + //exc=st->exc+offset; /* LSP interpolation (quantized and unquantized) */ lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes); diff --git a/src/libspeex/vbr.c b/src/libspeex/vbr.c index 5b7dd9bf..33df777d 100644 --- a/src/libspeex/vbr.c +++ b/src/libspeex/vbr.c @@ -126,7 +126,7 @@ float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float p int i; float ener=0, ener1=0, ener2=0; float qual=7; - int va; + //int va; float log_energy; float non_st=0; float voicing; @@ -159,7 +159,7 @@ float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float p || (voicing<0 && non_st < .05)) { float tmp; - va = 0; + //va = 0; vbr->consec_noise++; if (pow_ener > 3*vbr->noise_level) tmp = 3*vbr->noise_level; @@ -171,7 +171,7 @@ float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float p vbr->noise_accum_count = .95*vbr->noise_accum_count + .05; } } else { - va = 1; + //va = 1; vbr->consec_noise=0; } diff --git a/src/qcommon/cm_load.c b/src/qcommon/cm_load.c index 230b18b9..7ee71766 100644 --- a/src/qcommon/cm_load.c +++ b/src/qcommon/cm_load.c @@ -139,7 +139,7 @@ void CMod_LoadSubmodels( lump_t *l ) { Com_Error( ERR_DROP, "MAX_SUBMODELS exceeded" ); } - for ( i=0 ; i<count ; i++, in++, out++) + for ( i=0 ; i<count ; i++, in++) { out = &cm.cmodels[i]; diff --git a/src/qcommon/cm_trace.c b/src/qcommon/cm_trace.c index 6c4751fb..fcfa17b3 100644 --- a/src/qcommon/cm_trace.c +++ b/src/qcommon/cm_trace.c @@ -934,7 +934,8 @@ get the first intersection of the ray with the sphere */ void CM_TraceThroughSphere( traceWork_t *tw, vec3_t origin, float radius, vec3_t start, vec3_t end ) { float l1, l2, length, scale, fraction; - float a, b, c, d, sqrtd; + //float a; + float b, c, d, sqrtd; vec3_t v1, dir, intersection; // if inside the sphere @@ -970,7 +971,7 @@ void CM_TraceThroughSphere( traceWork_t *tw, vec3_t origin, float radius, vec3_t // VectorSubtract(start, origin, v1); // dir is normalized so a = 1 - a = 1.0f;//dir[0] * dir[0] + dir[1] * dir[1] + dir[2] * dir[2]; + //a = 1.0f;//dir[0] * dir[0] + dir[1] * dir[1] + dir[2] * dir[2]; b = 2.0f * (dir[0] * v1[0] + dir[1] * v1[1] + dir[2] * v1[2]); c = v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2] - (radius+RADIUS_EPSILON) * (radius+RADIUS_EPSILON); @@ -1022,7 +1023,8 @@ the cylinder extends halfheight above and below the origin */ void CM_TraceThroughVerticalCylinder( traceWork_t *tw, vec3_t origin, float radius, float halfheight, vec3_t start, vec3_t end) { float length, scale, fraction, l1, l2; - float a, b, c, d, sqrtd; + //float a; + float b, c, d, sqrtd; vec3_t v1, dir, start2d, end2d, org2d, intersection; // 2d coordinates @@ -1068,7 +1070,7 @@ void CM_TraceThroughVerticalCylinder( traceWork_t *tw, vec3_t origin, float radi // VectorSubtract(start, origin, v1); // dir is normalized so we can use a = 1 - a = 1.0f;// * (dir[0] * dir[0] + dir[1] * dir[1]); + //a = 1.0f;// * (dir[0] * dir[0] + dir[1] * dir[1]); b = 2.0f * (v1[0] * dir[0] + v1[1] * dir[1]); c = v1[0] * v1[0] + v1[1] * v1[1] - (radius+RADIUS_EPSILON) * (radius+RADIUS_EPSILON); diff --git a/src/qcommon/cmd.c b/src/qcommon/cmd.c index 99a80fd7..a67108f3 100644 --- a/src/qcommon/cmd.c +++ b/src/qcommon/cmd.c @@ -270,7 +270,6 @@ void Cmd_Exec_f( void ) { char *c; void *v; } f; - int len; char filename[MAX_QPATH]; if (Cmd_Argc () != 2) { @@ -280,7 +279,7 @@ void Cmd_Exec_f( void ) { Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) ); COM_DefaultExtension( filename, sizeof( filename ), ".cfg" ); - len = FS_ReadFile( filename, &f.v); + FS_ReadFile( filename, &f.v); if (!f.c) { Com_Printf ("couldn't exec %s\n",Cmd_Argv(1)); return; diff --git a/src/qcommon/common.c b/src/qcommon/common.c index c6feee42..3127dec1 100644 --- a/src/qcommon/common.c +++ b/src/qcommon/common.c @@ -926,10 +926,11 @@ Z_TagMalloc */ #ifdef ZONE_DEBUG void *Z_TagMallocDebug( int size, int tag, char *label, char *file, int line ) { + int allocSize; #else void *Z_TagMalloc( int size, int tag ) { #endif - int extra, allocSize; + int extra; memblock_t *start, *rover, *new, *base; memzone_t *zone; @@ -944,7 +945,9 @@ void *Z_TagMalloc( int size, int tag ) { zone = mainzone; } +#ifdef ZONE_DEBUG allocSize = size; +#endif // // scan through the block list looking for the first free block // of sufficient size @@ -1083,7 +1086,10 @@ void Z_LogZoneHeap( memzone_t *zone, char *name ) { if (!logfile || !FS_Initialized()) return; - size = allocSize = numBlocks = 0; + size = numBlocks = 0; +#ifdef ZONE_DEBUG + allocSize = 0; +#endif Com_sprintf(buf, sizeof(buf), "\r\n================\r\n%s log\r\n================\r\n", name); FS_Write(buf, strlen(buf), logfile); for (block = zone->blocklist.next ; block->next != &zone->blocklist; block = block->next) { @@ -2942,7 +2948,6 @@ void Com_Frame( void ) { else minMsec = 1; - timeVal = 0; do { if(com_sv_running->integer) diff --git a/src/qcommon/files.c b/src/qcommon/files.c index 72c8cffe..7ea04c12 100644 --- a/src/qcommon/files.c +++ b/src/qcommon/files.c @@ -2405,7 +2405,7 @@ int FS_GetModList( char *listbuf, int bufsize ) { qboolean bDrop = qfalse; *listbuf = 0; - nMods = nPotential = nTotal = 0; + nMods = nTotal = 0; pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue ); pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue ); @@ -2888,7 +2888,7 @@ we are not interested in a download string format, we want something human-reada */ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) { searchpath_t *sp; - qboolean havepak, badchecksum; + qboolean havepak; char *origpos = neededpaks; int i; @@ -2900,7 +2900,6 @@ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) { for ( i = 0 ; i < fs_numServerReferencedPaks ; i++ ) { // Ok, see if we have this pak file - badchecksum = qfalse; havepak = qfalse; // Make sure the server cannot make us write to non-quake3 directories. diff --git a/src/qcommon/msg.c b/src/qcommon/msg.c index 580637eb..74147964 100644 --- a/src/qcommon/msg.c +++ b/src/qcommon/msg.c @@ -1201,7 +1201,6 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p int persistantbits; int miscbits; int numFields; - int c; netField_t *field; int *fromF, *toF; float fullFloat; @@ -1212,8 +1211,6 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p Com_Memset (&dummy, 0, sizeof(dummy)); } - c = msg->cursize; - numFields = ARRAY_LEN( playerStateFields ); lc = 0; @@ -1261,7 +1258,6 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p MSG_WriteBits( msg, *toF, field->bits ); } } - c = msg->cursize - c; // diff --git a/src/qcommon/net_chan.c b/src/qcommon/net_chan.c index 8f2d8de7..49e06731 100644 --- a/src/qcommon/net_chan.c +++ b/src/qcommon/net_chan.c @@ -234,7 +234,6 @@ copied out. */ qboolean Netchan_Process( netchan_t *chan, msg_t *msg ) { int sequence; - int qport; int fragmentStart, fragmentLength; int checksum; qboolean fragmented; @@ -256,7 +255,7 @@ qboolean Netchan_Process( netchan_t *chan, msg_t *msg ) { // read the qport if we are a server if ( chan->sock == NS_SERVER ) { - qport = MSG_ReadShort( msg ); + MSG_ReadShort( msg ); } checksum = MSG_ReadLong(msg); diff --git a/src/qcommon/net_ip.c b/src/qcommon/net_ip.c index 2a93b0c4..815b004c 100644 --- a/src/qcommon/net_ip.c +++ b/src/qcommon/net_ip.c @@ -1070,7 +1070,6 @@ NET_OpenSocks */ void NET_OpenSocks( int port ) { struct sockaddr_in address; - int err; struct hostent *h; int len; qboolean rfc1929; @@ -1081,14 +1080,12 @@ void NET_OpenSocks( int port ) { Com_Printf( "Opening connection to SOCKS server.\n" ); if ( ( socks_socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) == INVALID_SOCKET ) { - err = socketError; Com_Printf( "WARNING: NET_OpenSocks: socket: %s\n", NET_ErrorString() ); return; } h = gethostbyname( net_socksServer->string ); if ( h == NULL ) { - err = socketError; Com_Printf( "WARNING: NET_OpenSocks: gethostbyname: %s\n", NET_ErrorString() ); return; } @@ -1101,7 +1098,6 @@ void NET_OpenSocks( int port ) { address.sin_port = htons( (short)net_socksPort->integer ); if ( connect( socks_socket, (struct sockaddr *)&address, sizeof( address ) ) == SOCKET_ERROR ) { - err = socketError; Com_Printf( "NET_OpenSocks: connect: %s\n", NET_ErrorString() ); return; } @@ -1129,7 +1125,6 @@ void NET_OpenSocks( int port ) { buf[2] = 2; // method #2 - method id #02: username/password } if ( send( socks_socket, (void *)buf, len, 0 ) == SOCKET_ERROR ) { - err = socketError; Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } @@ -1137,7 +1132,6 @@ void NET_OpenSocks( int port ) { // get the response len = recv( socks_socket, (void *)buf, 64, 0 ); if ( len == SOCKET_ERROR ) { - err = socketError; Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); return; } @@ -1176,7 +1170,6 @@ void NET_OpenSocks( int port ) { // send it if ( send( socks_socket, (void *)buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) { - err = socketError; Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } @@ -1184,7 +1177,6 @@ void NET_OpenSocks( int port ) { // get the response len = recv( socks_socket, (void *)buf, 64, 0 ); if ( len == SOCKET_ERROR ) { - err = socketError; Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); return; } @@ -1206,7 +1198,6 @@ void NET_OpenSocks( int port ) { *(int *)&buf[4] = INADDR_ANY; *(short *)&buf[8] = htons( (short)port ); // port if ( send( socks_socket, (void *)buf, 10, 0 ) == SOCKET_ERROR ) { - err = socketError; Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } @@ -1214,7 +1205,6 @@ void NET_OpenSocks( int port ) { // get the response len = recv( socks_socket, (void *)buf, 64, 0 ); if( len == SOCKET_ERROR ) { - err = socketError; Com_Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); return; } diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c index b1197a55..00473dbf 100644 --- a/src/qcommon/q_shared.c +++ b/src/qcommon/q_shared.c @@ -420,8 +420,9 @@ int COM_Compress( char *data_p ) { } } } + + *out = 0; } - *out = 0; return out - data_p; } diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h index f761b134..ead93b15 100644 --- a/src/qcommon/qcommon.h +++ b/src/qcommon/qcommon.h @@ -998,7 +998,7 @@ void Key_WriteBindings( fileHandle_t f ); void S_ClearSoundBuffer( void ); // call before filesystem access -void SCR_DebugGraph (float value, int color); // FIXME: move logging to common? +void SCR_DebugGraph (float value); // FIXME: move logging to common? // AVI files have the start of pixel lines 4 byte-aligned #define AVI_LINE_PADDING 4 @@ -1059,7 +1059,7 @@ void *Sys_GetBotLibAPI( void *parms ); char *Sys_GetCurrentUser( void ); -void QDECL Sys_Error( const char *error, ...) __attribute__ ((noreturn)) __attribute__ ((format (printf, 1, 2))); +void QDECL Sys_Error( const char *error, ...) __attribute__ ((noreturn, format (printf, 1, 2))); void Sys_Quit (void) __attribute__ ((noreturn)); char *Sys_GetClipboardData( void ); // note that this isn't journaled... diff --git a/src/qcommon/vm.c b/src/qcommon/vm.c index caf10863..2fdb77f0 100644 --- a/src/qcommon/vm.c +++ b/src/qcommon/vm.c @@ -218,7 +218,6 @@ VM_LoadSymbols =============== */ void VM_LoadSymbols( vm_t *vm ) { - int len; union { char *c; void *v; @@ -240,7 +239,7 @@ void VM_LoadSymbols( vm_t *vm ) { COM_StripExtension(vm->name, name, sizeof(name)); Com_sprintf( symbols, sizeof( symbols ), "vm/%s.map", name ); - len = FS_ReadFile( symbols, &mapfile.v ); + FS_ReadFile( symbols, &mapfile.v ); if ( !mapfile.c ) { Com_Printf( "Couldn't load symbol file: %s\n", symbols ); return; @@ -366,7 +365,6 @@ Load a .qvm file ================= */ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) { - int length; int dataLength; int i; char filename[MAX_QPATH]; @@ -379,7 +377,7 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) { Com_sprintf( filename, sizeof(filename), "vm/%s.qvm", vm->name ); Com_Printf( "Loading vm file %s...\n", filename ); - length = FS_ReadFileDir(filename, vm->searchPath, &header.v); + FS_ReadFileDir(filename, vm->searchPath, &header.v); if ( !header.h ) { Com_Printf( "Failed.\n" ); diff --git a/src/qcommon/vm_interpreted.c b/src/qcommon/vm_interpreted.c index 8e6d73e1..cd126ef4 100644 --- a/src/qcommon/vm_interpreted.c +++ b/src/qcommon/vm_interpreted.c @@ -238,7 +238,6 @@ void VM_PrepareInterpreter( vm_t *vm, vmHeader_t *header ) { } int_pc = 0; instruction = 0; - code = (byte *)header + header->codeOffset; // Now that the code has been expanded to int-sized opcodes, we'll translate instruction index //into an index into codeBase[], which contains opcodes and operands. diff --git a/src/qcommon/vm_x86.c b/src/qcommon/vm_x86.c index c5dcfddd..1dfefe5c 100644 --- a/src/qcommon/vm_x86.c +++ b/src/qcommon/vm_x86.c @@ -1717,7 +1717,6 @@ int VM_CallCompiled(vm_t *vm, int *args) { byte stack[OPSTACK_SIZE + 15]; void *entryPoint; - int programCounter; int programStack, stackOnEntry; byte *image; int *opStack; @@ -1734,8 +1733,6 @@ int VM_CallCompiled(vm_t *vm, int *args) // set up the stack frame image = vm->dataBase; - programCounter = 0; - programStack -= 48; *(int *)&image[ programStack + 44] = args[9]; diff --git a/src/renderer/tr_backend.c b/src/renderer/tr_backend.c index a93d3fee..7e896800 100644 --- a/src/renderer/tr_backend.c +++ b/src/renderer/tr_backend.c @@ -754,7 +754,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte * // we definately want to sync every frame for the cinematics qglFinish(); - start = end = 0; + start = 0; if ( r_speeds->integer ) { start = ri.Milliseconds(); } diff --git a/src/renderer/tr_curve.c b/src/renderer/tr_curve.c index 00cb2ed8..684329b1 100644 --- a/src/renderer/tr_curve.c +++ b/src/renderer/tr_curve.c @@ -205,10 +205,9 @@ static int neighbors[8][2] = { VectorAdd( normal, sum, sum ); count++; } - if ( count == 0 ) { -//printf("bad normal\n"); - count = 1; - } + //if ( count == 0 ) { + // printf("bad normal\n"); + //} VectorNormalize2( sum, dv->normal ); } } diff --git a/src/renderer/tr_flares.c b/src/renderer/tr_flares.c index afef22a4..8fc8265f 100644 --- a/src/renderer/tr_flares.c +++ b/src/renderer/tr_flares.c @@ -115,7 +115,7 @@ This is called at surface tesselation time */ void RB_AddFlare( void *surface, int fogNum, vec3_t point, vec3_t color, vec3_t normal ) { int i; - flare_t *f, *oldest; + flare_t *f; vec3_t local; float d = 1; vec4_t eye, clip, normalized, window; @@ -153,7 +153,6 @@ void RB_AddFlare( void *surface, int fogNum, vec3_t point, vec3_t color, vec3_t } // see if a flare with a matching surface, scene, and view exists - oldest = r_flareStructs; for ( f = r_activeFlares ; f ; f = f->next ) { if ( f->surface == surface && f->frameSceneNum == backEnd.viewParms.frameSceneNum && f->inPortal == backEnd.viewParms.isPortal ) { diff --git a/src/renderer/tr_image.c b/src/renderer/tr_image.c index 50ba3a75..136daf5f 100644 --- a/src/renderer/tr_image.c +++ b/src/renderer/tr_image.c @@ -1099,14 +1099,11 @@ R_CreateFogImage static void R_CreateFogImage( void ) { int x,y; byte *data; - float g; float d; float borderColor[4]; data = ri.Hunk_AllocateTempMemory( FOG_S * FOG_T * 4 ); - g = 2.0; - // S is distance, T is depth for (x=0 ; x<FOG_S ; x++) { for (y=0 ; y<FOG_T ; y++) { diff --git a/src/renderer/tr_image_png.c b/src/renderer/tr_image_png.c index ef44c165..8b65f758 100644 --- a/src/renderer/tr_image_png.c +++ b/src/renderer/tr_image_png.c @@ -791,8 +791,6 @@ static uint8_t PredictPaeth(uint8_t a, uint8_t b, uint8_t c) int p; int pa, pb, pc; - Pr = 0; - p = ((int) a) + ((int) b) - ((int) c); pa = abs(p - ((int) a)); pb = abs(p - ((int) b)); diff --git a/src/renderer/tr_main.c b/src/renderer/tr_main.c index 1a1bab8c..880850ef 100644 --- a/src/renderer/tr_main.c +++ b/src/renderer/tr_main.c @@ -913,7 +913,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 for ( i = 0; i < tess.numIndexes; i += 3 ) { vec3_t normal; - float dot; float len; VectorSubtract( tess.xyz[tess.indexes[i]], tr.viewParms.or.origin, normal ); @@ -924,7 +923,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 shortest = len; } - if ( ( dot = DotProduct( normal, tess.normal[tess.indexes[i]] ) ) >= 0 ) + if ( DotProduct( normal, tess.normal[tess.indexes[i]] ) >= 0 ) { numTriangles--; } @@ -1270,7 +1269,6 @@ void R_AddEntitySurfaces (void) { if ( (ent->e.renderfx & RF_THIRD_PERSON) && !tr.viewParms.isPortal) { break; } - shader = R_GetShaderByHandle( ent->e.customShader ); R_AddDrawSurf( &entitySurface, tr.defaultShader, 0, 0 ); break; default: diff --git a/src/renderer/tr_marks.c b/src/renderer/tr_marks.c index b3b53330..6bcd7cb1 100644 --- a/src/renderer/tr_marks.c +++ b/src/renderer/tr_marks.c @@ -273,6 +273,10 @@ int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projectio vec3_t v1, v2; int *indexes; + if (numPoints <= 0) { + return 0; + } + //increment view count for double check prevention tr.viewCount++; diff --git a/src/renderer/tr_model.c b/src/renderer/tr_model.c index 06473367..ce0bbdf7 100644 --- a/src/renderer/tr_model.c +++ b/src/renderer/tr_model.c @@ -932,7 +932,7 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) { // swap all the frames frameSize = (size_t)( &((md4Frame_t *)0)->bones[ md4->numBones ] ); - for ( i = 0 ; i < md4->numFrames ; i++, frame++) { + for ( i = 0 ; i < md4->numFrames ; i++) { frame = (md4Frame_t *) ( (byte *)md4 + md4->ofsFrames + i * frameSize ); frame->radius = LittleFloat( frame->radius ); for ( j = 0 ; j < 3 ; j++ ) { diff --git a/src/renderer/tr_model_iqm.c b/src/renderer/tr_model_iqm.c index 0e4672a1..a9144f44 100644 --- a/src/renderer/tr_model_iqm.c +++ b/src/renderer/tr_model_iqm.c @@ -885,8 +885,8 @@ static void ComputeJointMats( iqmData_t *data, int frame, int oldframe, int *joint = data->jointParents; int i; - if ( oldframe == frame ) { - mat1 = mat2 = data->poseMats + 12 * data->num_joints * frame; + if ( oldframe == frame ) { + mat1 = data->poseMats + 12 * data->num_joints * frame; for( i = 0; i < data->num_joints; i++, joint++ ) { if( *joint >= 0 ) { Matrix34Multiply( mat + 12 * *joint, diff --git a/src/renderer/tr_public.h b/src/renderer/tr_public.h index b1ccfbc1..fd2e4c05 100644 --- a/src/renderer/tr_public.h +++ b/src/renderer/tr_public.h @@ -111,7 +111,7 @@ typedef struct { void (QDECL *Printf)( int printLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); // abort the game - void (QDECL *Error)( int errorLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); + void (QDECL *Error)( int errorLevel, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 2, 3))); // milliseconds should only be used for profiling, never // for anything game related. Get time from the refdef diff --git a/src/renderer/tr_shade.c b/src/renderer/tr_shade.c index f12519b4..c71a8d34 100644 --- a/src/renderer/tr_shade.c +++ b/src/renderer/tr_shade.c @@ -1175,8 +1175,10 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) void RB_StageIteratorGeneric( void ) { shaderCommands_t *input; + shader_t *shader; input = &tess; + shader = input->shader; RB_DeformTessGeometry(); @@ -1193,10 +1195,10 @@ void RB_StageIteratorGeneric( void ) // // set face culling appropriately // - GL_Cull( input->shader->cullType ); + GL_Cull( shader->cullType ); // set polygon offset if necessary - if ( input->shader->polygonOffset ) + if ( shader->polygonOffset ) { qglEnable( GL_POLYGON_OFFSET_FILL ); qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value ); @@ -1208,7 +1210,7 @@ void RB_StageIteratorGeneric( void ) // to avoid compiling those arrays since they will change // during multipass rendering // - if ( tess.numPasses > 1 || input->shader->multitextureEnv ) + if ( tess.numPasses > 1 || shader->multitextureEnv ) { setArraysOnce = qfalse; qglDisableClientState (GL_COLOR_ARRAY); @@ -1276,7 +1278,7 @@ void RB_StageIteratorGeneric( void ) // // reset polygon offset // - if ( input->shader->polygonOffset ) + if ( shader->polygonOffset ) { qglDisable( GL_POLYGON_OFFSET_FILL ); } @@ -1292,7 +1294,6 @@ void RB_StageIteratorVertexLitTexture( void ) shader_t *shader; input = &tess; - shader = input->shader; // @@ -1313,7 +1314,7 @@ void RB_StageIteratorVertexLitTexture( void ) // // set face culling appropriately // - GL_Cull( input->shader->cullType ); + GL_Cull( shader->cullType ); // // set arrays and lock @@ -1366,8 +1367,10 @@ void RB_StageIteratorVertexLitTexture( void ) void RB_StageIteratorLightmappedMultitexture( void ) { shaderCommands_t *input; + shader_t *shader; input = &tess; + shader = input->shader; // // log this call @@ -1381,7 +1384,7 @@ void RB_StageIteratorLightmappedMultitexture( void ) { // // set face culling appropriately // - GL_Cull( input->shader->cullType ); + GL_Cull( shader->cullType ); // // set color, pointers, and lock diff --git a/src/renderer/tr_shade_calc.c b/src/renderer/tr_shade_calc.c index 8d02177b..a88aac9f 100644 --- a/src/renderer/tr_shade_calc.c +++ b/src/renderer/tr_shade_calc.c @@ -635,7 +635,7 @@ void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors ) for ( i = 0; i < tess.numVertexes; i++, pColors++ ) { - *pColors = * ( int * ) invModulate; + *pColors = c; } } diff --git a/src/renderer/tr_sky.c b/src/renderer/tr_sky.c index 5c7788c0..ffe84f50 100644 --- a/src/renderer/tr_sky.c +++ b/src/renderer/tr_sky.c @@ -619,14 +619,14 @@ void R_BuildCloudData( shaderCommands_t *input ) tess.numIndexes = 0; tess.numVertexes = 0; - if ( input->shader->sky.cloudHeight ) + if ( shader->sky.cloudHeight ) { for ( i = 0; i < MAX_SHADER_STAGES; i++ ) { if ( !tess.xstages[i] ) { break; } - FillCloudBox( input->shader, i ); + FillCloudBox( shader, i ); } } } diff --git a/src/renderer/tr_surface.c b/src/renderer/tr_surface.c index afb4121e..0fcfc3f0 100644 --- a/src/renderer/tr_surface.c +++ b/src/renderer/tr_surface.c @@ -929,10 +929,6 @@ static void RB_SurfaceFace( srfSurfaceFace_t *surf ) { tess.numIndexes += surf->numIndices; - v = surf->points[0]; - - ndx = tess.numVertexes; - numPoints = surf->numPoints; if ( tess.shader->needsNormal ) { @@ -1047,7 +1043,6 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) { // in the tess structure, so we may have to issue it in multiple passes used = 0; - rows = 0; while ( used < lodHeight - 1 ) { // see how many rows of both verts and indexes we can add without overflowing do { diff --git a/src/renderer/tr_world.c b/src/renderer/tr_world.c index feebb2ef..8f91285e 100644 --- a/src/renderer/tr_world.c +++ b/src/renderer/tr_world.c @@ -64,7 +64,6 @@ static qboolean R_CullGrid( srfGridMesh_t *cv ) { } else { sphereCull = R_CullPointAndRadius( cv->localOrigin, cv->meshRadius ); } - boxCull = CULL_OUT; // check for trivial reject if ( sphereCull == CULL_OUT ) diff --git a/src/server/sv_client.c b/src/server/sv_client.c index 25bf69f9..094ed98f 100644 --- a/src/server/sv_client.c +++ b/src/server/sv_client.c @@ -962,7 +962,6 @@ static void SV_VerifyPaks_f( client_t *cl ) { // if ( sv_pure->integer != 0 ) { - bGood = qtrue; nChkSum1 = nChkSum2 = 0; // we run the game, so determine which cgame and ui the client "should" be running bGood = (FS_FileIsInPAK("vm/cgame.qvm", &nChkSum1) == 1); diff --git a/src/server/sv_world.c b/src/server/sv_world.c index 667c9268..ce4230d7 100644 --- a/src/server/sv_world.c +++ b/src/server/sv_world.c @@ -383,9 +383,6 @@ SV_AreaEntities_r static void SV_AreaEntities_r( worldSector_t *node, areaParms_t *ap ) { svEntity_t *check, *next; sharedEntity_t *gcheck; - int count; - - count = 0; for ( check = node->entities ; check ; check = next ) { next = check->nextEntityInWorldSector; @@ -681,7 +678,7 @@ int SV_PointContents( const vec3_t p, int passEntityNum ) { angles = vec3_origin; // boxes don't rotate } - c2 = CM_TransformedPointContents (p, clipHandle, hit->s.origin, hit->s.angles); + c2 = CM_TransformedPointContents (p, clipHandle, hit->s.origin, angles); contents |= c2; } diff --git a/src/sys/sys_unix.c b/src/sys/sys_unix.c index b72c91d7..26fb2b29 100644 --- a/src/sys/sys_unix.c +++ b/src/sys/sys_unix.c @@ -398,9 +398,9 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter continue; if (*extension) { - if ( strlen( d->d_name ) < strlen( extension ) || + if ( strlen( d->d_name ) < extLen || Q_stricmp( - d->d_name + strlen( d->d_name ) - strlen( extension ), + d->d_name + strlen( d->d_name ) - extLen, extension ) ) { continue; // didn't match } |