engine: common: fix up warnings, clean up unused variables

This commit is contained in:
Alibek Omarov
2026-05-13 10:13:52 +05:00
parent e9bdbf2f33
commit 2dc132f817
7 changed files with 16 additions and 22 deletions

View File

@@ -1304,7 +1304,6 @@ static void Cmd_UnprivilegedExec_f( void )
"scout.cfg", "sniper.cfg", "soldier.cfg", "spy.cfg",
};
char mapcfg[MAX_VA_STRING];
qboolean allow = false;
Q_snprintf( mapcfg, sizeof( mapcfg ), "%s.cfg", clgame.mapname );

View File

@@ -95,7 +95,7 @@ static qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
static qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
{
uint bits, bitmask;
uint bits;
byte *alphamask;
int x, y, i, j;
@@ -108,8 +108,6 @@ static qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
alphamask = fin + 2;
fin += 8;
bitmask = ((uint *)fin)[1];
fin += 8;
// last three bytes
@@ -278,9 +276,6 @@ static size_t Image_DXTCalcMipmapSize( dds_t *hdr )
static uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
{
size_t buffsize = 0;
int w = image.width;
int h = image.height;
int d = image.depth;
if( hdr->dsCaps.dwCaps2 & DDS_CUBEMAP )
{

View File

@@ -364,7 +364,7 @@ static char *Info_FindLargestKey( char *s )
char value[MAX_KV_SIZE];
static char largest_key[128];
int largest_size = 0;
int l, count;
int count;
char *o;
*largest_key = 0;
@@ -384,7 +384,6 @@ static char *Info_FindLargestKey( char *s )
count++;
}
l = o - key;
*o = 0;
size = Q_strlen( key );

View File

@@ -40,18 +40,15 @@ void COM_PushLibraryError( const char *error )
void *COM_FunctionFromName_SR( void *hInstance, const char *pName )
{
char **funcs = NULL;
size_t numfuncs, i;
void *f = NULL;
const char *func = NULL;
#ifdef XASH_ALLOW_SAVERESTORE_OFFSETS
if( !memcmp( pName, "ofs:", 4 ))
return (byte*)svgame.dllFuncs.pfnGameInit + Q_atoi( pName + 4 );
#endif
#if XASH_POSIX
funcs = COM_ConvertToLocalPlatform( MANGLE_ITANIUM, pName, &numfuncs );
size_t numfuncs, i;
void *f = NULL;
char **funcs = COM_ConvertToLocalPlatform( MANGLE_ITANIUM, pName, &numfuncs );
if( funcs )
{
@@ -69,7 +66,7 @@ void *COM_FunctionFromName_SR( void *hInstance, const char *pName )
// TODO: COM_ConvertToLocalPlatform doesn't support MSVC yet
// also custom loader strips always MSVC mangling, so Win32
// platforms already use platform-neutral names
func = COM_GetPlatformNeutralName( pName );
const char *func = COM_GetPlatformNeutralName( pName );
if( func )
return COM_FunctionFromName( hInstance, func );

View File

@@ -862,7 +862,6 @@ static void Mod_StudioComputeBounds( void *buffer, vec3_t mins, vec3_t maxs, qbo
studiohdr_t *pstudiohdr;
mstudiobodyparts_t *pbodypart;
mstudiomodel_t *m_pSubModel;
mstudioseqgroup_t *pseqgroup;
mstudioseqdesc_t *pseqdesc;
mstudiobone_t *pbones;
mstudioanim_t *panim;
@@ -902,7 +901,6 @@ static void Mod_StudioComputeBounds( void *buffer, vec3_t mins, vec3_t maxs, qbo
for( i = 0; i < numseq; i++ )
{
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + i;
pseqgroup = (mstudioseqgroup_t *)((byte *)pstudiohdr + pstudiohdr->seqgroupindex) + pseqdesc->seqgroup;
if( pseqdesc->seqgroup == 0 )
panim = (mstudioanim_t *)((byte *)pstudiohdr + pseqdesc->animindex);

View File

@@ -1809,7 +1809,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
int frag_offset[MAX_STREAMS] = { 0, 0 };
int frag_length[MAX_STREAMS] = { 0, 0 };
qboolean message_contains_fragments;
int i, qport, statId;
int i, statId;
// get sequence numbers
MSG_Clear( msg );
@@ -1821,7 +1821,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
// read the qport if we are a server
if( chan->sock == NS_SERVER )
qport = MSG_ReadShort( msg );
MSG_ReadShort( msg );
reliable_message = sequence >> 31;
reliable_ack = sequence_ack >> 31;
@@ -1925,7 +1925,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
{
for( i = 0; i < MAX_STREAMS; i++ )
{
int j, inbufferid;
int j;
int intotalbuffers;
int oldpos, curbit;
int numbitstoremove;
@@ -1934,7 +1934,6 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
if( !frag_message[i] )
continue;
inbufferid = FRAG_GETID( fragid[i] );
intotalbuffers = FRAG_GETCOUNT( fragid[i] );
if( fragid[i] != 0 )

View File

@@ -91,7 +91,14 @@ const char *SoundList_Get( enum soundlst_group_e group, int i )
switch( lst->type )
{
case SoundList_Range:
#if __GNUC__ || __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
Q_snprintf( temp, sizeof( temp ), lst->snd, lst->min + i );
#if __GNUC__ || __clang__
#pragma GCC diagnostic pop
#endif
return temp;
case SoundList_List:
return &lst->snd[i * lst->min];