Fixes for -Wformat=2 on 64-bit targets

This commit is contained in:
Alibek Omarov 2024-06-22 07:31:37 +03:00
parent d054782693
commit e18b61e041
8 changed files with 25 additions and 24 deletions

2
3rdparty/mainui vendored

@ -1 +1 @@
Subproject commit 54a9ff29f1f085f9b93fa529ccafcbb0ea961cb2
Subproject commit b4e7041c9687079450218786aa4f62273a874a1a

View file

@ -2736,7 +2736,7 @@ static void CL_SetInfo_f( void )
{
Con_Printf( "User info settings:\n" );
Info_Print( cls.userinfo );
Con_Printf( "Total %i symbols\n", Q_strlen( cls.userinfo ));
Con_Printf( "Total %zu symbols\n", Q_strlen( cls.userinfo ));
return;
}
@ -2772,7 +2772,7 @@ static void CL_Physinfo_f( void )
{
Con_Printf( "Phys info settings:\n" );
Info_Print( cls.physinfo );
Con_Printf( "Total %i symbols\n", Q_strlen( cls.physinfo ));
Con_Printf( "Total %zu symbols\n", Q_strlen( cls.physinfo ));
}
static qboolean CL_ShouldRescanFilesystem( void )

View file

@ -13,6 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include <inttypes.h>
#include "common.h"
#include <fcntl.h>
#if !XASH_WIN32
@ -104,7 +105,7 @@ static void ID_BloomFilter_f( void )
for( i = 1; i < Cmd_Argc(); i++ )
value |= BloomFilter_ProcessStr( Cmd_Argv( i ) );
Msg( "%d %016llX\n", BloomFilter_Weight( value ), value );
Msg( "%d %016"PRIX64"\n", BloomFilter_Weight( value ), value );
// test
// for( i = 1; i < Cmd_Argc(); i++ )
@ -283,7 +284,7 @@ static void ID_TestCPUInfo_f( void )
bloomfilter_t value = 0;
if( ID_ProcessCPUInfo( &value ) )
Msg( "Got %016llX\n", value );
Msg( "Got %016"PRIX64"\n", value );
else
Msg( "Could not get serial\n" );
}
@ -621,7 +622,7 @@ void ID_Init( void )
#endif
#if XASH_ANDROID && !XASH_DEDICATED
sscanf( Android_LoadID(), "%016llX", &id );
sscanf( Android_LoadID(), "%016"PRIX64, &id );
if( id )
{
id ^= SYSTEM_XOR_MASK;
@ -633,7 +634,7 @@ void ID_Init( void )
CHAR szBuf[MAX_PATH];
ID_GetKeyData( HKEY_CURRENT_USER, "Software\\Xash3D\\", "xash_id", szBuf, MAX_PATH );
sscanf(szBuf, "%016llX", &id);
sscanf(szBuf, "%016"PRIX64, &id);
id ^= SYSTEM_XOR_MASK;
ID_Check();
}
@ -649,7 +650,7 @@ void ID_Init( void )
cfg = fopen( va( "%s/.xash_id", home ), "r" );
if( cfg )
{
if( fscanf( cfg, "%016llX", &id ) > 0 )
if( fscanf( cfg, "%016"PRIX64, &id ) > 0 )
{
id ^= SYSTEM_XOR_MASK;
ID_Check();
@ -664,7 +665,7 @@ void ID_Init( void )
const char *buf = (const char*) FS_LoadFile( ".xash_id", NULL, false );
if( buf )
{
sscanf( buf, "%016llX", &id );
sscanf( buf, "%016"PRIX64, &id );
id ^= GAME_XOR_MASK;
ID_Check();
}
@ -680,11 +681,11 @@ void ID_Init( void )
Q_snprintf( &id_md5[i*2], sizeof( id_md5 ) - i * 2, "%02hhx", md5[i] );
#if XASH_ANDROID && !XASH_DEDICATED
Android_SaveID( va("%016llX", id^SYSTEM_XOR_MASK ) );
Android_SaveID( va("%016"PRIX64, id^SYSTEM_XOR_MASK ) );
#elif XASH_WIN32
{
CHAR Buf[MAX_PATH];
sprintf( Buf, "%016llX", id^SYSTEM_XOR_MASK );
sprintf( Buf, "%016"PRIX64, id^SYSTEM_XOR_MASK );
ID_SetKeyData( HKEY_CURRENT_USER, "Software\\Xash3D\\", REG_SZ, "xash_id", Buf, Q_strlen(Buf) );
}
#else
@ -699,14 +700,14 @@ void ID_Init( void )
cfg = fopen( va( "%s/.xash_id", home ), "w" );
if( cfg )
{
fprintf( cfg, "%016llX", id^SYSTEM_XOR_MASK );
fprintf( cfg, "%016"PRIX64, id^SYSTEM_XOR_MASK );
fclose( cfg );
}
}
}
#endif
FS_WriteFile( ".xash_id", va("%016llX", id^GAME_XOR_MASK), 16 );
FS_WriteFile( ".xash_id", va("%016"PRIX64, id^GAME_XOR_MASK), 16 );
#if 0
Msg("MD5 id: %s\nRAW id:%016llX\n", id_md5, id );
Msg("MD5 id: %s\nRAW id:%016"PRIX64"\n", id_md5, id );
#endif
}

View file

@ -1548,7 +1548,7 @@ static qboolean Mod_LoadColoredLighting( model_t *mod, dbspmodel_t *bmod )
if( litdatasize != ( bmod->lightdatasize * 3 ))
{
Con_Printf( S_ERROR "%s has mismatched size (%llu should be %zu)\n", path, litdatasize, bmod->lightdatasize * 3 );
Con_Printf( S_ERROR "%s has mismatched size (%li should be %zu)\n", path, (long)litdatasize, bmod->lightdatasize * 3 );
Mem_Free( in );
return false;
}
@ -1603,7 +1603,7 @@ static void Mod_LoadDeluxemap( model_t *mod, dbspmodel_t *bmod )
if( deluxdatasize != bmod->lightdatasize )
{
Con_Reportf( S_ERROR "%s has mismatched size (%llu should be %zu)\n", path, deluxdatasize, bmod->lightdatasize );
Con_Reportf( S_ERROR "%s has mismatched size (%li should be %zu)\n", path, (long)deluxdatasize, bmod->lightdatasize );
Mem_Free( in );
return;
}
@ -3084,7 +3084,7 @@ static void Mod_CalcPHS( model_t *mod )
t2 = Platform_DoubleTime();
if( vis_stats )
Con_Reportf( "Average leaves visible / audible / total: %i / %i / %i\n", vcount / count, hcount / count, count );
Con_Reportf( "Average leaves visible / audible / total: %zu / %zu / %zu\n", vcount / count, hcount / count, count );
Con_Reportf( "Uncompressed PHS size: %s\n", Q_memprint( rowbytes * count ));
Con_Reportf( "Compressed PHS size: %s\n", Q_memprint( total_compressed_size + sizeof( *world.phsofs ) * count ));
Con_Reportf( "PHS building time: %.2f ms\n", ( t2 - t1 ) * 1000.0f );

View file

@ -104,7 +104,7 @@ static void FindNextChunk( const char *filename, const char *name )
|| IsFourCC( iff_lastChunk, "LIST" )
|| IsFourCC( iff_lastChunk, "data" ))
{
Con_DPrintf( "%s: '%s' truncated by %i bytes\n", __func__, filename, iff_chunkLen - remaining );
Con_DPrintf( "%s: '%s' truncated by %zi bytes\n", __func__, filename, iff_chunkLen - remaining );
}
iff_chunkLen = remaining;
}

View file

@ -105,7 +105,7 @@ void GL_BackendEndFrame( void )
break;
case 4:
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i static entities\n%3i normal entities\n%3i server entities",
r_numStatics, r_numEntities - r_numStatics, ENGINE_GET_PARM( PARM_NUMENTITIES ));
r_numStatics, r_numEntities - r_numStatics, (int)ENGINE_GET_PARM( PARM_NUMENTITIES ));
break;
case 5:
Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i tempents\n%3i viewbeams\n%3i particles",

View file

@ -231,7 +231,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
if( p->color > sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
{
gEngfuncs.Con_Printf( S_ERROR "UserTracer with color(%d) > %d\n", p->color, sizeof( gTracerColors ) / sizeof( gTracerColors[0] ));
gEngfuncs.Con_Printf( S_ERROR "UserTracer with color(%d) > %zu\n", p->color, sizeof( gTracerColors ) / sizeof( gTracerColors[0] ));
p->color = 0;
}

View file

@ -238,7 +238,7 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers
if( p->color > sizeof( gTracerColors ) / sizeof( gTracerColors[0] ))
{
gEngfuncs.Con_Printf( S_ERROR "UserTracer with color(%d) > %d\n", p->color, sizeof( gTracerColors ) / sizeof( gTracerColors[0] ));
gEngfuncs.Con_Printf( S_ERROR "UserTracer with color(%d) > %zu\n", p->color, sizeof( gTracerColors ) / sizeof( gTracerColors[0] ));
p->color = 0;
}