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 /src/qcommon | |
parent | 76544bcec46127587d183a90e5ff817a71e1f139 (diff) |
Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings
Diffstat (limited to 'src/qcommon')
-rw-r--r-- | src/qcommon/cm_load.c | 2 | ||||
-rw-r--r-- | src/qcommon/cm_trace.c | 10 | ||||
-rw-r--r-- | src/qcommon/cmd.c | 3 | ||||
-rw-r--r-- | src/qcommon/common.c | 11 | ||||
-rw-r--r-- | src/qcommon/files.c | 5 | ||||
-rw-r--r-- | src/qcommon/msg.c | 4 | ||||
-rw-r--r-- | src/qcommon/net_chan.c | 3 | ||||
-rw-r--r-- | src/qcommon/net_ip.c | 10 | ||||
-rw-r--r-- | src/qcommon/q_shared.c | 3 | ||||
-rw-r--r-- | src/qcommon/qcommon.h | 4 | ||||
-rw-r--r-- | src/qcommon/vm.c | 6 | ||||
-rw-r--r-- | src/qcommon/vm_interpreted.c | 1 | ||||
-rw-r--r-- | src/qcommon/vm_x86.c | 3 |
13 files changed, 25 insertions, 40 deletions
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]; |