Fix some format warnings

This commit is contained in:
Alibek Omarov 2018-04-23 21:49:37 +03:00
parent bd4988e588
commit fd649905ea
16 changed files with 43 additions and 47 deletions

View File

@ -243,7 +243,7 @@ void CL_InitCDAudio( const char *filename )
if( ++c > MAX_CDTRACKS - 1 )
{
MsgDev( D_WARN, "CD_Init: too many tracks %i in %s\n", filename, MAX_CDTRACKS );
MsgDev( D_WARN, "CD_Init: too many tracks %i in %s\n", MAX_CDTRACKS, filename );
break;
}
}
@ -3585,7 +3585,7 @@ void NetAPI_SendRequest( int context, int request, int flags, double timeout, ne
{
// local servers request
Q_snprintf( req, sizeof( req ), "netinfo %i %i %i", PROTOCOL_VERSION, context, request );
Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, req );
Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, "%s", req );
}
}

View File

@ -915,7 +915,7 @@ pfnHostEndGame
static void pfnHostEndGame( const char *szFinalMessage )
{
if( !szFinalMessage ) szFinalMessage = "";
Host_EndGame( true, szFinalMessage );
Host_EndGame( true, "%s", szFinalMessage );
}
/*

View File

@ -1796,7 +1796,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
if( crcValue == crcValue2 )
{
// packet was sucessfully delivered, adjust the fragment size and get challenge
Msg( "CRC %p is matched, get challenge, fragment size %d\n", crcValue, cls.max_fragment_size );
Msg( "CRC 0x%08x is matched, get challenge, fragment size %d\n", crcValue, cls.max_fragment_size );
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", cls.max_fragment_size );
cls.connect_time = host.realtime;
@ -1813,7 +1813,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
return;
}
Msg( "got testpacket, CRC mismatched %p should be %p, trying next fragment size %d\n", crcValue2, crcValue, cls.max_fragment_size >> 1 );
Msg( "got testpacket, CRC mismatched 0x%08x should be 0x%08x, trying next fragment size %d\n", crcValue2, crcValue, cls.max_fragment_size >> 1 );
// trying the next size of packet
cls.connect_time = MAX_HEARTBEAT;
}
@ -2189,7 +2189,7 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
}
else
{
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n", p->nDownloadSize );
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n", cls.netchan.tempbuffersize, p->nDownloadSize );
}
if( cls.netchan.tempbuffer )

View File

@ -730,7 +730,7 @@ void CL_BatchResourceRequest( qboolean initialize )
if( !COM_IsSafeFileToDownload( p->szFileName ))
{
CL_RemoveFromResourceList( p );
MsgDev( D_WARN, "Invalid file type...skipping download of %s\n", p );
MsgDev( D_WARN, "Invalid file type...skipping download of %s\n", p->szFileName );
Mem_Free( p );
break;
}
@ -2493,4 +2493,4 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
CL_WriteDemoMessage( true, starting_count, msg );
}
}
}
}

View File

@ -322,7 +322,7 @@ void Cmd_Echo_f( void )
int i;
for( i = 1; i < Cmd_Argc(); i++ )
Con_Printf( Cmd_Argv( i ));
Con_Printf( "%s", Cmd_Argv( i ));
Con_Printf( "\n" );
}

View File

@ -116,7 +116,7 @@ XASH SPECIFIC - sort of hack that works only in Xash3D not in GoldSrc
#define GAME_EXPORT
#endif
typedef unsigned long dword;
typedef unsigned int dword;
typedef unsigned int uint;
typedef char string[MAX_STRING];
typedef struct file_s file_t; // normal file
@ -439,7 +439,7 @@ typedef struct host_parm_s
// command line parms
int argc;
const char **argv;
char **argv;
double realtime; // host.curtime
double frametime; // time between engine frames

View File

@ -903,7 +903,7 @@ static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc
void Cmd_WriteOpenGLVariables( file_t *f )
{
Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, Cmd_WriteOpenGLCvar );
Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, (setpair_t)Cmd_WriteOpenGLCvar );
}
#ifndef XASH_DEDICATED
@ -1057,9 +1057,9 @@ void Key_EnumCmds_f( void )
FS_Printf( f, "//=======================================================================\n");
FS_Printf( f, "\n\n\t\t\tconsole variables\n\n");
Cvar_LookupVars( 0, NULL, f, Cmd_WriteHelp );
Cvar_LookupVars( 0, NULL, f, (setpair_t)Cmd_WriteHelp );
FS_Printf( f, "\n\n\t\t\tconsole commands\n\n");
Cmd_LookupCmds( NULL, f, Cmd_WriteHelp );
Cmd_LookupCmds( NULL, f, (setpair_t)Cmd_WriteHelp );
FS_Printf( f, "\n\n");
FS_Close( f );
Con_Printf( "help.txt created\n" );

View File

@ -888,7 +888,7 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
file_t *f = FS_Open( filepath, "w", false ); // we in binary-mode
if( !f ) Sys_Error( "FS_WriteGameInfo: can't write %s\n", filepath ); // may be disk-space is out?
FS_Print( f, "// generated by Xash3D\n\n\n" );
FS_Printf( f, "// generated by %s %s-%s (%s-%s)\n\n\n", XASH_ENGINE_NAME, XASH_VERSION, Q_buildcommit(), Q_buildos(), Q_buildarch() );
if( Q_strlen( GameInfo->basedir ))
FS_Printf( f, "basedir\t\t\"%s\"\n", GameInfo->basedir );
@ -1588,7 +1588,7 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode )
opt |= O_BINARY;
break;
default:
MsgDev( D_ERROR, "FS_SysOpen: %s: unknown char in mode (%c)\n", filepath, mode, mode[ind] );
MsgDev( D_ERROR, "FS_SysOpen: %s: unknown char %c in mode (%s)\n", filepath, mode[ind], mode );
break;
}
}

View File

@ -553,7 +553,7 @@ void Host_Error( const char *error, ... )
if( recursive )
{
Con_Printf( "Host_RecursiveError: %s", hosterror2 );
Sys_Error( hosterror1 );
Sys_Error( "%s", hosterror1 );
return; // don't multiple executes
}
@ -685,7 +685,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
if( !( baseDir = SDL_GetBasePath() ) )
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
Q_strncpy( host.rootdir, baseDir, sizeof( host.rootdir ) );
SDL_free( baseDir );
SDL_free( (void*)baseDir );
#else
if( !getcwd( host.rootdir, sizeof(host.rootdir) ) )
{

View File

@ -812,7 +812,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
if( !HPAK_FindResource( &hpak_read, pResource->rgucMD5_hash, NULL ))
{
MsgDev( D_ERROR, "HPAK doesn't contain specified lump: %s\n", pResource->szFileName, read_path );
MsgDev( D_ERROR, "HPAK %s doesn't contain specified lump: %s\n", read_path, pResource->szFileName );
Mem_Free( hpak_read.entries );
Mem_Free( hpak_save.entries );
FS_Close( file_src );
@ -1023,7 +1023,7 @@ void HPAK_Extract_f( void )
if( entry->disksize <= 0 || entry->disksize >= HPAK_MAX_SIZE )
{
MsgDev( D_WARN, "Unable to extract data, size invalid: %s\n", nDataSize );
MsgDev( D_WARN, "Unable to extract data, size invalid: %i\n", nDataSize );
continue;
}
@ -1085,4 +1085,4 @@ void HPAK_Init( void )
hpk_maxsize = Cvar_Get( "hpk_maxsize", "0", FCVAR_ARCHIVE, "set limit by size for all HPK-files ( 0 - unlimited )" );
gp_hpak_queue = NULL;
}
}

View File

@ -1528,7 +1528,7 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
{
if( ft1 > ft2 )
{
Con_Printf( S_WARN "Entity patch is older than bsp. Ignored.\n", entfilename );
Con_Printf( S_WARN "Entity patch %s is older than bsp. Ignored.\n", entfilename );
}
else if(( entpatch = FS_LoadFile( entfilename, &entpatchsize, true )) != NULL )
{
@ -3043,4 +3043,4 @@ int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lump
FS_Close( f );
return LUMP_SAVE_OK;
}
}

View File

@ -326,7 +326,7 @@ Sys_ParseCommandLine
==================
*/
void Sys_ParseCommandLine( int argc, const char** argv )
void Sys_ParseCommandLine( int argc, char** argv )
{
const char *blank = "censored";
int i;
@ -492,8 +492,8 @@ qboolean Sys_LoadLibrary( dll_info_t *dll )
error:
MsgDev( D_NOTE, " - failed\n" );
Sys_FreeLibrary( dll ); // trying to free
if( dll->crash ) Sys_Error( errorstring );
else MsgDev( D_ERROR, errorstring );
if( dll->crash ) Sys_Error( "%s", errorstring );
else MsgDev( D_ERROR, "%s", errorstring );
return false;
}

View File

@ -87,7 +87,7 @@ void Sys_Error( const char *error, ... ) _format( 1 );
qboolean Sys_LoadLibrary( dll_info_t *dll );
void* Sys_GetProcAddress( dll_info_t *dll, const char* name );
qboolean Sys_FreeLibrary( dll_info_t *dll );
void Sys_ParseCommandLine( int argc, const char **argv );
void Sys_ParseCommandLine( int argc, char **argv );
void Sys_MergeCommandLine( void );
void Sys_SetupCrashHandler( void );
void Sys_RestoreCrashHandler( void );

View File

@ -83,10 +83,10 @@ typedef struct ui_enginefuncs_s
char* (*pfnCmd_Args)( void );
// debug messages (in-menu shows only notify)
void (*Con_Printf)( char *fmt, ... );
void (*Con_DPrintf)( char *fmt, ... );
void (*Con_NPrintf)( int pos, char *fmt, ... );
void (*Con_NXPrintf)( struct con_nprint_s *info, char *fmt, ... );
void (*Con_Printf)( const char *fmt, ... );
void (*Con_DPrintf)( const char *fmt, ... );
void (*Con_NPrintf)( int pos, const char *fmt, ... );
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... );
// sound handlers
void (*pfnPlayLocalSound)( const char *szSound );

View File

@ -87,8 +87,9 @@ void SV_GetChallenge( netadr_t from )
Netchan_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, "challenge %i", svs.challenges[i].challenge );
}
int SV_GetFragmentSize( sv_client_t *cl )
int SV_GetFragmentSize( void *pcl )
{
sv_client_t *cl = (sv_client_t*)pcl;
int cl_frag_size;
if( Netchan_IsLocal( &cl->netchan ))
@ -736,7 +737,7 @@ Responds with long info for local and broadcast requests
*/
void SV_BuildNetAnswer( netadr_t from )
{
char string[MAX_INFO_STRING], answer[512];
char string[MAX_INFO_STRING];
int version, context, type;
int i, count = 0;
@ -755,21 +756,18 @@ void SV_BuildNetAnswer( netadr_t from )
Info_SetValueForKey( string, "neterror", "protocol", MAX_INFO_STRING );
// send error unsupported protocol
Q_snprintf( answer, sizeof( answer ), "netinfo %i %i %s\n", context, type, string );
Netchan_OutOfBandPrint( NS_SERVER, from, answer );
Netchan_OutOfBandPrint( NS_SERVER, from, "netinfo %i %i %s\n", context, type, string );
return;
}
if( type == NETAPI_REQUEST_PING )
{
Q_snprintf( answer, sizeof( answer ), "netinfo %i %i %s\n", context, type, "" );
Netchan_OutOfBandPrint( NS_SERVER, from, answer );
Netchan_OutOfBandPrint( NS_SERVER, from, "netinfo %i %i %s\n", context, type, "" );
}
else if( type == NETAPI_REQUEST_RULES )
{
// send serverinfo
Q_snprintf( answer, sizeof( answer ), "netinfo %i %i %s\n", context, type, svs.serverinfo );
Netchan_OutOfBandPrint( NS_SERVER, from, answer );
Netchan_OutOfBandPrint( NS_SERVER, from, "netinfo %i %i %s\n", context, type, svs.serverinfo );
}
else if( type == NETAPI_REQUEST_PLAYERS )
{
@ -787,8 +785,7 @@ void SV_BuildNetAnswer( netadr_t from )
}
// send playernames
Q_snprintf( answer, sizeof( answer ), "netinfo %i %i %s\n", context, type, string );
Netchan_OutOfBandPrint( NS_SERVER, from, answer );
Netchan_OutOfBandPrint( NS_SERVER, from, "netinfo %i %i %s\n", context, type, string );
}
else if( type == NETAPI_REQUEST_DETAILS )
{
@ -804,8 +801,7 @@ void SV_BuildNetAnswer( netadr_t from )
Info_SetValueForKey( string, "map", sv.name, MAX_INFO_STRING );
// send serverinfo
Q_snprintf( answer, sizeof( answer ), "netinfo %i %i %s\n", context, type, string );
Netchan_OutOfBandPrint( NS_SERVER, from, answer );
Netchan_OutOfBandPrint( NS_SERVER, from, "netinfo %i %i %s\n", context, type, string );
}
else
{
@ -813,8 +809,7 @@ void SV_BuildNetAnswer( netadr_t from )
Info_SetValueForKey( string, "neterror", "undefined", MAX_INFO_STRING );
// send error undefined request type
Q_snprintf( answer, sizeof( answer ), "netinfo %i %i %s\n", context, type, string );
Netchan_OutOfBandPrint( NS_SERVER, from, answer );
Netchan_OutOfBandPrint( NS_SERVER, from, "netinfo %i %i %s\n", context, type, string );
}
}
@ -1934,10 +1929,11 @@ static qboolean SV_Begin_f( sv_client_t *cl )
SV_SendBuildInfo_f
==================
*/
static void SV_SendBuildInfo_f( sv_client_t *cl )
static qboolean SV_SendBuildInfo_f( sv_client_t *cl )
{
SV_ClientPrintf( cl, "Server running %s %s (build %i-%s, %s-%s)\n",
XASH_ENGINE_NAME, XASH_VERSION, Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch() );
return true;
}

View File

@ -565,7 +565,7 @@ void SV_ActivateServer( int runPhysics )
Con_Printf( "%i player server started\n", svs.maxclients );
else Con_Printf( "Game started\n" );
Log_Printf( "Started map \"%s\" (CRC \"%i\")\n", sv.name, sv.worldmapCRC );
Log_Printf( "Started map \"%s\" (CRC \"%lu\")\n", sv.name, sv.worldmapCRC );
// dedicated server purge unused resources here
if( host.type == HOST_DEDICATED )