From faabf7d64658ae47842b4ccabdb4b68513f3cdf7 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Sat, 12 Jul 2014 16:07:46 +0200 Subject: fix a bunch of compiler warnings --- src/cgame/cg_buildable.c | 22 +++++++--------------- src/cgame/cg_event.c | 1 - src/cgame/cg_main.c | 4 +--- src/cgame/cg_predict.c | 2 -- src/cgame/cg_scanner.c | 2 +- src/cgame/cg_servercmds.c | 2 +- src/cgame/cg_view.c | 6 ++---- src/cgame/cg_weapons.c | 1 - src/game/bg_pmove.c | 1 - src/game/g_active.c | 1 - src/game/g_admin.c | 1 - src/game/g_buildable.c | 2 -- src/game/g_client.c | 1 - src/game/g_cmds.c | 1 - src/game/g_combat.c | 3 +-- src/game/g_main.c | 3 --- src/qcommon/common.c | 2 +- src/qcommon/md5.c | 2 +- src/qcommon/unzip.c | 2 +- src/renderer/tr_bsp.c | 4 +++- src/renderer/tr_scene.c | 2 +- src/ui/ui_main.c | 2 +- 22 files changed, 21 insertions(+), 46 deletions(-) diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 5646f90..9b1d8d4 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -194,8 +194,7 @@ void CG_DrawCuboid( vec3_t origin, vec3_t dims, qhandle_t shader, int margin ) void CG_DrawCuboidAxis(vec3_t cuboidOrigin, vec3_t size, int axis, qhandle_t shader) { vec3_t origin, localZ, localX, localY, start, end, quad[2][4]; - float len, width; - polyVert_t poly[4]; + float len; VectorCopy(cuboidOrigin,origin); origin[2]+=size[2]/2.0f; @@ -273,7 +272,7 @@ void CG_InitCuboidExplosions(void) void CG_CuboidExplosion(buildable_t buildable, vec3_t origin, vec3_t dims) { - int i,p,m,q; + int i,p,q; float v,s; cuboidParticle_t *pc; vec3_t sdims; @@ -301,7 +300,7 @@ void CG_CuboidExplosion(buildable_t buildable, vec3_t origin, vec3_t dims) p=ceil(sqrt(v/pow(sdims[2],3)))*2; else if(q==2) p=ceil(pow(v/pow(sdims[2],3),0.75f))*3; - else if(q>=3) + else p=ceil(pow(v/pow(sdims[2],3),0.85f))*6; p=MIN(p,MAX_CPARTICLES_PER_EXPLOSION); @@ -363,9 +362,8 @@ void CG_CuboidParticlePhysics(cuboidParticle_t *pc) void CG_DrawCuboidParticles(void) { - int i,j,drawn=0,c; - float t; - vec3_t alight, dlight, lightdir, newOrigin; + int i,j,drawn=0; + //vec3_t alight, dlight, lightdir; cuboidParticle_t *pc; refEntity_t re; @@ -687,8 +685,6 @@ void CG_InitBuildables( void ) fileHandle_t f; pc_token_t token; cuboidInfo_t *cuboid; - const char *s; - float n; memset( cg_buildables, 0, sizeof( cg_buildables ) ); @@ -1095,7 +1091,7 @@ void CG_GhostBuildable( buildable_t buildable, vec3_t dims ) if(BG_Buildable(buildable, NULL)->cuboid) { - qhandle_t shader, ashader; + qhandle_t shader; CG_Cuboid_Send( ); //NOTE: CG_Cuboid_Send has its own timer so we don't spam server with commands every frame @@ -1832,7 +1828,7 @@ void CG_Buildable( centity_t *cent ) prebuildSound = cgs.media.unpoweredSurgeLoop; } } - else if( team == TEAM_ALIENS ) + else { texture = cgs.media.cuboidAlienPrebuild; prebuildSound = cgs.media.alienBuildablePrebuild; @@ -2318,8 +2314,6 @@ Syntax: #define SWAPFLOATS(a,b) {float __t;__t=a,a=b,b=__t;} void CG_CuboidRotate_f(void) { - int axis; - if( !BG_Buildable( cg.predictedPlayerState.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT, NULL )->cuboid ) return; switch( cg_cuboidResizeAxis.integer ) @@ -2378,8 +2372,6 @@ Syntax: */ void CG_CuboidSize_f(void) { - int axis; - if( trap_Argc( ) < 4 ) { Com_Printf( "cuboidAxis x y z : set the cuboid selection\n" ); diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index adc319c..a364a46 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -491,7 +491,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) int clientNum; clientInfo_t *ci; int steptime; - vec3_t cuboid; buildable_t cuboidType; if( cg.snap->ps.persistant[ PERS_SPECSTATE ] != SPECTATOR_NOT ) diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 7c798a2..ef69ea8 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -654,7 +654,6 @@ static void CG_RegisterSounds( void ) int i; char name[ MAX_QPATH ]; const char *soundName; - const cuboidAttributes_t *cuboid; cgs.media.alienStageTransition = trap_S_RegisterSound( "sound/announcements/overmindevolved.wav", qtrue ); cgs.media.humanStageTransition = trap_S_RegisterSound( "sound/announcements/reinforcement.wav", qtrue ); @@ -779,8 +778,7 @@ This function may execute for a couple of minutes with a slow disk. */ static void CG_RegisterGraphics( void ) { - int i,j; - const cuboidAttributes_t *cuboid; + int i; static char *sb_nums[ 11 ] = { diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c index f0fbbd5..12a0dc0 100644 --- a/src/cgame/cg_predict.c +++ b/src/cgame/cg_predict.c @@ -98,8 +98,6 @@ static void CG_ClipMoveToEntities ( const vec3_t start, const vec3_t mins, vec3_t bmins, bmaxs; vec3_t origin, angles; centity_t *cent; - vec3_t dims; - vec3_t size; //SUPAR HACK //this causes a trace to collide with the local player diff --git a/src/cgame/cg_scanner.c b/src/cgame/cg_scanner.c index 821c8bf..e95dd53 100644 --- a/src/cgame/cg_scanner.c +++ b/src/cgame/cg_scanner.c @@ -223,7 +223,7 @@ CG_BasivisionBlip */ void CG_BasivisionBlip( vec3_t origin, float size, qhandle_t shader, float flareSize, qhandle_t flare ) { - float x, y, s; + float x, y; if( !CG_WorldToScreen( origin, &x, &y ) ) return; diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index f9a173a..83aaa53 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -1101,7 +1101,7 @@ static void CG_ParseVoice( void ) return; vChan = atoi( CG_Argv( 2 ) ); - if( vChan < 0 || vChan >= VOICE_CHAN_NUM_CHANS ) + if( (int)vChan < 0 || vChan >= VOICE_CHAN_NUM_CHANS ) return; if( cg_teamChatsOnly.integer && vChan != VOICE_CHAN_TEAM ) diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 97b7582..0feebc8 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -581,7 +581,7 @@ void CG_OffsetFirstPersonView( void ) // camera shake effect else if( cg.snap->ps.stats[ STAT_SHAKE ] > 0 ) { - float fac, mag; + float fac; fac = (float) cg.snap->ps.stats[ STAT_SHAKE ] * cg_cameraShakeMagnitude.value * 0.15f; @@ -944,9 +944,7 @@ static int CG_CalcFov( void ) { f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME; - if ( f > 1.0f ) - fov_y = fov_y; - else + if ( f <= 1.0f ) fov_y = zoomFov + f * ( fov_y - zoomFov ); // BUTTON_ATTACK2 is held so zoom next time diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index b3dd4c7..55ad649 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1404,7 +1404,6 @@ void CG_AddViewWeapon( playerState_t *ps ) weaponInfo_t *wi; weapon_t weapon = ps->weapon; weaponMode_t weaponMode = ps->generic1; - vec3_t cuboidSize; // no weapon carried - can't draw it if( weapon == WP_NONE ) diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index d5719a5..be1a695 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -1238,7 +1238,6 @@ static void PM_AirMove( void ) usercmd_t cmd; float accel; // CPM - float wishspeed2; // CPM float velscale;//classes temp.var velscale = BG_Class( pm->ps->stats[ STAT_CLASS ] )->airAcceleration; diff --git a/src/game/g_active.c b/src/game/g_active.c index 95f00d6..c21eec0 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -610,7 +610,6 @@ void ClientTimerActions( gentity_t *ent, int msec ) qboolean walking = qfalse, stopped = qfalse, crouched = qfalse, jumping = qfalse, strafing = qfalse; - int i; ucmd = &ent->client->pers.cmd; diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 90f42c8..f424505 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -3346,7 +3346,6 @@ qboolean G_admin_settitle( gentity_t *ent ) int i; gentity_t *vic = NULL; g_admin_admin_t *a = NULL; - g_admin_level_t *l = NULL; int na; int len; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index c1e34bb..3114792 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1060,7 +1060,6 @@ Think function for Alien Overmind */ void AOvermind_Think( gentity_t *self ) { - vec3_t range = { OVERMIND_ATTACK_RANGE, OVERMIND_ATTACK_RANGE, OVERMIND_ATTACK_RANGE }; int i; if( self->spawned && ( self->health > 0 ) ) @@ -2748,7 +2747,6 @@ G_QueueBuildPoints */ void G_QueueBuildPoints( gentity_t *self ) { - gentity_t *powerEntity; int queuePoints; queuePoints = G_QueueValue( self ); diff --git a/src/game/g_client.c b/src/game/g_client.c index a3c7a67..0f96ce6 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -284,7 +284,6 @@ find the nearest impregnated human for spawning static gentity_t *G_SelectAlienImplantedSpawn( vec3_t preference ) { int i; - float r; gentity_t *search, *spot = NULL; for( i = 0; i < level.num_entities; i++ ) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index c1da4e0..f3eaa83 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2598,7 +2598,6 @@ void Cmd_Build_f( gentity_t *ent ) float dist; vec3_t origin, normal; team_t team; - char buf[128]; vec3_t dims; if( ent->client->pers.namelog->denyBuild ) diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 6acf6b7..6c8d3fd 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -234,12 +234,11 @@ player_die */ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) { - gentity_t *ent, *ent2; + gentity_t *ent; int anim; int killer, killerHP; int i; char *killerName, *obit; - vec3_t dir; if( self->client->ps.pm_type == PM_DEAD ) return; diff --git a/src/game/g_main.c b/src/game/g_main.c index 1cbf897..b792bd3 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1192,7 +1192,6 @@ Recalculate the quantity of building points available to the teams void G_CalculateBuildPoints( void ) { int i; - buildable_t buildable; // BP queue updates while( level.alienBuildPointQueue > 0 && @@ -2234,9 +2233,7 @@ CheckCvars void CheckCvars( void ) { static int lastPasswordModCount = -1; - static int lastMarkDeconModCount = -1; static int lastSDTimeModCount = -1; - static int lastNumZones = 0; if( g_password.modificationCount != lastPasswordModCount ) { diff --git a/src/qcommon/common.c b/src/qcommon/common.c index 761fe72..bacb01c 100644 --- a/src/qcommon/common.c +++ b/src/qcommon/common.c @@ -2314,7 +2314,7 @@ A way to force a bus error for development reasons ================= */ static void Com_Crash_f( void ) { - * ( int * ) 0 = 0x12345678; + * ( volatile int * ) 0 = 0x12345678; } /* diff --git a/src/qcommon/md5.c b/src/qcommon/md5.c index 5cf12bb..994083f 100644 --- a/src/qcommon/md5.c +++ b/src/qcommon/md5.c @@ -253,7 +253,7 @@ static void MD5Final(struct MD5Context *ctx, unsigned char *digest) if (digest!=NULL) memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } diff --git a/src/qcommon/unzip.c b/src/qcommon/unzip.c index b307e98..128502c 100644 --- a/src/qcommon/unzip.c +++ b/src/qcommon/unzip.c @@ -1250,7 +1250,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) return UNZ_PARAMERROR; - if ((pfile_in_zip_read_info->read_buffer == NULL)) + if (pfile_in_zip_read_info->read_buffer == NULL) return UNZ_END_OF_LIST_OF_FILE; if (len==0) return 0; diff --git a/src/renderer/tr_bsp.c b/src/renderer/tr_bsp.c index 563bb36..059f9b9 100644 --- a/src/renderer/tr_bsp.c +++ b/src/renderer/tr_bsp.c @@ -264,6 +264,8 @@ static void R_LoadVisibility( lump_t *l ) { //=============================================================================== +#define LL(x) x=LittleLong(x) + /* =============== ShaderForShaderNum @@ -273,7 +275,7 @@ static shader_t *ShaderForShaderNum( int shaderNum, int lightmapNum ) { shader_t *shader; dshader_t *dsh; - shaderNum = LittleLong( shaderNum ); + LL( shaderNum ); if ( shaderNum < 0 || shaderNum >= s_worldData.numShaders ) { ri.Error( ERR_DROP, "ShaderForShaderNum: bad num %i", shaderNum ); } diff --git a/src/renderer/tr_scene.c b/src/renderer/tr_scene.c index 232cb68..973d4ac 100644 --- a/src/renderer/tr_scene.c +++ b/src/renderer/tr_scene.c @@ -220,7 +220,7 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) { } return; } - if ( ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) { + if ( (int)ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) { ri.Error( ERR_DROP, "RE_AddRefEntityToScene: bad reType %i", ent->reType ); } diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index ef53272..783fa12 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -866,7 +866,7 @@ static void UI_BuildServerStatus( qboolean force ) UI_BuildServerDisplayList ================== */ -static void UI_BuildServerDisplayList( qboolean force ) +static void UI_BuildServerDisplayList( int force ) { int i, count, clients, maxClients, ping, len, visible; char info[MAX_STRING_CHARS]; -- cgit