engine: client: fix warnings, cleanup unused or maybe-uninitialized variables

This commit is contained in:
Alibek Omarov
2026-05-13 10:48:37 +05:00
parent cef6cb58bb
commit 0f490a2f16
12 changed files with 18 additions and 35 deletions

View File

@@ -416,7 +416,6 @@ void CL_KillDeadBeams( cl_entity_t *pDeadEntity )
while( pbeam )
{
cl_entity_t *beament;
pnext = pbeam->next;
// link into new list.

View File

@@ -1986,8 +1986,6 @@ all the keys and values must be ends with ^7
*/
static void CL_FixupColorStringsForInfoString( const char *in, char *out, size_t len )
{
qboolean hasPrefix = false;
qboolean endOfKeyVal = false;
int color = 7;
int count = 0;
@@ -2163,7 +2161,6 @@ static void CL_ParseNETInfoMessage( netadr_t from, const char *s )
int i, context, type;
int errorBits = 0;
const char *val;
size_t slen;
context = Q_atoi( Cmd_Argv( 1 ));
type = Q_atoi( Cmd_Argv( 2 ));

View File

@@ -253,7 +253,6 @@ NetGraph_DrawTimes
static void NetGraph_DrawTimes( wrect_t rect, int x, int w )
{
int i, j, extrap_point = NETGRAPH_LERP_HEIGHT / 3, a, h;
rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 };
wrect_t fill;
for( a = 0; a < w; a++ )

View File

@@ -355,7 +355,7 @@ static void SteamBroker_UpdateIdle( void )
}
}
void SteamBroker_AnnounceGameStart( const char *gamedir )
static void SteamBroker_AnnounceGameStart( const char *gamedir )
{
if( Q_stricmp( cl_ticket_generator.string, "steam" ) != 0 )
return;
@@ -371,7 +371,7 @@ void SteamBroker_AnnounceGameStart( const char *gamedir )
SteamBroker_SendFrame( buf, len );
}
void SteamBroker_AnnounceGameShutdown( void )
static void SteamBroker_AnnounceGameShutdown( void )
{
if( Q_stricmp( cl_ticket_generator.string, "steam" ) != 0 )
return;

View File

@@ -1669,7 +1669,6 @@ void GAME_EXPORT R_PlayerSprites( int client, int modelIndex, int count, int siz
cl_entity_t *pEnt;
vec3_t position;
vec3_t dir;
float vel;
int i;
pEnt = CL_GetEntityByIndex( client );
@@ -1677,8 +1676,6 @@ void GAME_EXPORT R_PlayerSprites( int client, int modelIndex, int count, int siz
if( !pEnt || !pEnt->player )
return;
vel = 128;
for( i = 0; i < count; i++ )
{
VectorCopy( pEnt->origin, position );

View File

@@ -159,7 +159,7 @@ static void Con_SaveHistory( con_history_t *self );
Con_BackgroundMapActive
================
*/
qboolean Con_BackgroundMapActive( void )
static qboolean Con_BackgroundMapActive( void )
{
return sv_background.value != 0.0f || cl.background;
}
@@ -475,7 +475,7 @@ If the line width has changed, reformat the buffer.
static void Con_CheckResize( void )
{
int charWidth = 8;
int i, width;
int width;
if( con.curFont && con.curFont->hFontTexture )
charWidth = con.curFont->charWidths['O'] - 1;
@@ -1105,7 +1105,7 @@ static void Con_ClearField( field_t *edit )
Field_Set
================
*/
static void Field_Set( field_t *f, const char *string )
MAYBE_UNUSED static void Field_Set( field_t *f, const char *string )
{
f->scroll = 0;
f->cursor = Q_strncpy( f->buffer, string, sizeof( f->buffer ));
@@ -1935,10 +1935,10 @@ Draws the console with the solid background
*/
static void Con_DrawSolidConsole( int lines )
{
int i, x, y;
int x, y;
float fraction;
int start;
int stringLen, width = 0, charH;
int stringLen, charH;
string curbuild;
byte color[4];

View File

@@ -80,7 +80,7 @@ static uint BloomFilter_Weight( bloomfilter_t value )
return weight;
}
static qboolean BloomFilter_ContainsString( bloomfilter_t filter, const char *str )
MAYBE_UNUSED static qboolean BloomFilter_ContainsString( bloomfilter_t filter, const char *str )
{
bloomfilter_t value = BloomFilter_ProcessStr( str );

View File

@@ -28,7 +28,6 @@ GNU General Public License for more details.
static qboolean in_mouseactive; // false when not focus app
static qboolean in_mouseinitialized;
static qboolean in_mouse_suspended;
static struct
{
int x, y;

View File

@@ -725,7 +725,7 @@ static void R_DrawHull( hull_model_t *hull )
{
int i;
srand((unsigned int)poly );
srand((unsigned int)(uintptr_t)poly );
ref.dllFuncs.Color4ub( rand() & 255, rand() & 255, rand() & 255, 255 );
ref.dllFuncs.Begin( TRI_POLYGON );

View File

@@ -256,7 +256,7 @@ static client entity
*/
static void CL_ParseStaticEntity( sizebuf_t *msg )
{
int i, newnum;
int i;
const entity_state_t from = { 0 };
entity_state_t to;
cl_entity_t *ent;
@@ -264,7 +264,7 @@ static void CL_ParseStaticEntity( sizebuf_t *msg )
if( !clgame.static_entities )
clgame.static_entities = Mem_Calloc( clgame.mempool, sizeof( cl_entity_t ) * MAX_STATIC_ENTITIES );
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
MSG_ReadDeltaEntity( msg, &from, &to, 0, DELTA_STATIC, cl.mtime[0] );
i = clgame.numStatics;

View File

@@ -627,8 +627,8 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
{
wavdata_t *pSource;
sfx_t *sfx = NULL;
channel_t *target_chan, *check;
int vol, ch_idx;
channel_t *target_chan;
int vol;
qboolean bIgnore = false;
if( !snd.initialized ) return;
@@ -874,7 +874,7 @@ void S_AmbientSound( const vec3_t pos, int ent, sound_t handle, float fvol, floa
channel_t *ch;
wavdata_t *pSource = NULL;
sfx_t *sfx = NULL;
int vol, fvox = 0;
int vol;
if( !snd.initialized ) return;
sfx = S_GetSfxByHandle( handle );
@@ -911,7 +911,6 @@ void S_AmbientSound( const vec3_t pos, int ent, sound_t handle, float fvol, floa
Q_strncpy( ch->name, sfx->name, sizeof( ch->name ));
sfx = ch->sfx;
if( sfx ) pSource = sfx->cache;
fvox = 1;
}
else
{
@@ -1085,8 +1084,6 @@ S_UpdateAmbientSounds
*/
static void S_UpdateAmbientSounds( void )
{
int ambient_channel;
if( !snd.have_ambient_sfx )
return;
@@ -1117,7 +1114,7 @@ static void S_UpdateAmbientSounds( void )
continue;
}
float vol = s_ambient_level.value * leaf->ambient_sound_level[ambient_channel];
float vol = s_ambient_level.value * leaf->ambient_sound_level[i];
if( vol < 0.0f )
vol = 0.0f;
@@ -1863,8 +1860,8 @@ static void S_SoundFade_f( void )
int c = Cmd_Argc();
int fade_percent;
int hold_time;
int fade_out_seconds;
int fade_in_seconds;
int fade_out_seconds = 0;
int fade_in_seconds = 0;
if( c != 3 && c != 5 )
{

View File

@@ -601,7 +601,6 @@ static int Voice_ProcessGSData( int ent, const uint8_t *data, uint32_t size )
uint32_t crc;
size_t offset;
size_t samples;
uint16_t sample_rate;
uint8_t vpc_type;
uint16_t data_len;
OpusDecoder *decoder;
@@ -637,7 +636,6 @@ static int Voice_ProcessGSData( int ent, const uint8_t *data, uint32_t size )
if( offset + sizeof( uint32_t ) > size - sizeof( uint32_t ))
return 0;
sample_rate = LittleShort( *(uint16_t *)( data + offset ));
offset += sizeof( uint16_t );
vpc_type = data[offset++];
@@ -987,7 +985,6 @@ void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
const int playernum = ent - 1;
int samples = 0;
int ofs = 0;
voice_status_t *status = NULL;
if( !voice.initialized || !voice_enable.value )
return;
@@ -1041,7 +1038,7 @@ Encode our voice data and send it to server
void CL_AddVoiceToDatagram( void )
{
byte buffer[VOICE_MAX_DATA_SIZE];
uint size, frames;
uint size, frames = 0;
if( cls.state != ca_active || !voice.device_opened || !Voice_IsRecording())
return;
@@ -1131,8 +1128,6 @@ Run timeout for clients
*/
void Voice_Idle( double frametime )
{
int i;
if( FBitSet( voice_enable.flags, FCVAR_CHANGED ))
{
ClearBits( voice_enable.flags, FCVAR_CHANGED );