Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings

This commit is contained in:
Thilo Schulz 2011-07-29 12:27:00 +00:00
parent 1ea7ab1f42
commit 23f6fd1633
85 changed files with 246 additions and 496 deletions

View file

@ -138,7 +138,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];

View file

@ -732,7 +732,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
@ -768,7 +769,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);
@ -820,7 +821,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
@ -866,7 +868,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);

View file

@ -269,7 +269,6 @@ void Cmd_Exec_f( void ) {
char *c;
void *v;
} f;
int len;
char filename[MAX_QPATH];
if (Cmd_Argc () != 2) {
@ -279,7 +278,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;

View file

@ -930,10 +930,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;
@ -948,7 +949,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
@ -1087,7 +1090,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) {
@ -3105,7 +3111,6 @@ void Com_Frame( void ) {
else
minMsec = 1;
timeVal = 0;
do
{
if(com_sv_running->integer)

View file

@ -2443,7 +2443,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 );
@ -2946,7 +2946,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;
@ -2958,7 +2958,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;
// never autodownload any of the id paks

View file

@ -1208,7 +1208,6 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p
int ammobits;
int powerupbits;
int numFields;
int c;
netField_t *field;
int *fromF, *toF;
float fullFloat;
@ -1219,8 +1218,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;
@ -1268,7 +1265,6 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p
MSG_WriteBits( msg, *toF, field->bits );
}
}
c = msg->cursize - c;
//

View file

@ -243,7 +243,6 @@ copied out.
*/
qboolean Netchan_Process( netchan_t *chan, msg_t *msg ) {
int sequence;
int qport;
int fragmentStart, fragmentLength;
qboolean fragmented;
@ -264,7 +263,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 );
}
#ifdef LEGACY_PROTOCOL

View file

@ -1073,7 +1073,6 @@ NET_OpenSocks
*/
void NET_OpenSocks( int port ) {
struct sockaddr_in address;
int err;
struct hostent *h;
int len;
qboolean rfc1929;
@ -1084,14 +1083,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;
}
@ -1104,7 +1101,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;
}
@ -1132,7 +1128,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;
}
@ -1140,7 +1135,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;
}
@ -1179,7 +1173,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;
}
@ -1187,7 +1180,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;
}
@ -1209,7 +1201,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;
}
@ -1217,7 +1208,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;
}

View file

@ -419,8 +419,9 @@ int COM_Compress( char *data_p ) {
}
}
}
*out = 0;
}
*out = 0;
return out - data_p;
}

View file

@ -1027,7 +1027,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
@ -1089,7 +1089,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...

View file

@ -217,7 +217,6 @@ VM_LoadSymbols
===============
*/
void VM_LoadSymbols( vm_t *vm ) {
int len;
union {
char *c;
void *v;
@ -239,7 +238,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;
@ -365,7 +364,6 @@ Load a .qvm file
=================
*/
vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) {
int length;
int dataLength;
int i;
char filename[MAX_QPATH];
@ -378,7 +376,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" );

View file

@ -237,7 +237,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.

View file

@ -1716,7 +1716,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;
@ -1733,8 +1732,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];