diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index e47dadbe..b28a0ba2 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -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 ); } } diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index f0af8331..a3bbf5e0 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -915,7 +915,7 @@ pfnHostEndGame static void pfnHostEndGame( const char *szFinalMessage ) { if( !szFinalMessage ) szFinalMessage = ""; - Host_EndGame( true, szFinalMessage ); + Host_EndGame( true, "%s", szFinalMessage ); } /* diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 584706b2..906246c7 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -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 ) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index f1cf3232..6e028ced 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -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 ); } } -} \ No newline at end of file +} diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 882f123c..a3fe80ce 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -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" ); } diff --git a/engine/common/common.h b/engine/common/common.h index 4e29918e..64f4d389 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -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 diff --git a/engine/common/con_utils.c b/engine/common/con_utils.c index 628185d0..fde70227 100644 --- a/engine/common/con_utils.c +++ b/engine/common/con_utils.c @@ -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" ); diff --git a/engine/common/filesystem.c b/engine/common/filesystem.c index 3a752b68..73bfab1b 100644 --- a/engine/common/filesystem.c +++ b/engine/common/filesystem.c @@ -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; } } diff --git a/engine/common/host.c b/engine/common/host.c index 5baefccc..d802e0bd 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -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) ) ) { diff --git a/engine/common/hpak.c b/engine/common/hpak.c index a83ed0e4..1c4fa210 100644 --- a/engine/common/hpak.c +++ b/engine/common/hpak.c @@ -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; -} \ No newline at end of file +} diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index b39b6b5b..0074dcef 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -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; -} \ No newline at end of file +} diff --git a/engine/common/system.c b/engine/common/system.c index 141365fc..b7f4a956 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -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; } diff --git a/engine/common/system.h b/engine/common/system.h index c8bb68a9..cfbb4dd4 100644 --- a/engine/common/system.h +++ b/engine/common/system.h @@ -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 ); diff --git a/engine/menu_int.h b/engine/menu_int.h index e48394ea..ef941f8e 100644 --- a/engine/menu_int.h +++ b/engine/menu_int.h @@ -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 ); diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index 7e128750..31a313c2 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -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; } diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index f24eb596..e09481d4 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -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 )