From d56e53a3476b32833fb7e3585e309dbe0c4561e9 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 19 Jun 2024 06:46:08 +0300 Subject: [PATCH] Replace hardcoded functions names by __func__ macro * while we're here, fix some possible bugs * and fix -Wformat=2 s/__FUNCTION__/__func__/g awawawa --- 3rdparty/mainui | 2 +- common/xash3d_types.h | 5 +- engine/client/cl_custom.c | 4 +- engine/client/cl_demo.c | 2 +- engine/client/cl_events.c | 8 +- engine/client/cl_frame.c | 10 +- engine/client/cl_game.c | 42 ++++---- engine/client/cl_gameui.c | 18 ++-- engine/client/cl_main.c | 18 ++-- engine/client/cl_parse.c | 16 +-- engine/client/cl_parse_48.c | 8 +- engine/client/cl_qparse.c | 14 +-- engine/client/cl_render.c | 2 +- engine/client/cl_scrn.c | 2 +- engine/client/cl_tent.c | 6 +- engine/client/cl_view.c | 3 +- engine/client/client.h | 4 +- engine/client/in_joy.c | 4 +- engine/client/in_touch.c | 7 +- engine/client/keys.c | 2 +- engine/client/mod_dbghulls.c | 4 +- engine/client/ref_common.c | 12 +-- engine/client/s_load.c | 2 +- engine/client/s_main.c | 2 +- engine/client/s_vox.c | 8 +- engine/client/titles.c | 10 +- engine/client/vgui/vgui_draw.c | 6 +- engine/common/base_cmd.c | 2 +- engine/common/cmd.c | 20 ++-- engine/common/common.c | 4 +- engine/common/con_utils.c | 8 +- engine/common/cvar.c | 8 +- engine/common/host.c | 19 ++-- engine/common/hpak.c | 24 ++--- engine/common/identification.c | 6 +- engine/common/imagelib/img_bmp.c | 14 +-- engine/common/imagelib/img_dds.c | 8 +- engine/common/imagelib/img_ktx2.c | 22 ++--- engine/common/imagelib/img_main.c | 2 +- engine/common/imagelib/img_png.c | 48 ++++----- engine/common/imagelib/img_tga.c | 12 +-- engine/common/imagelib/img_utils.c | 6 +- engine/common/imagelib/img_wad.c | 2 +- engine/common/lib_common.c | 10 +- engine/common/masterlist.c | 2 +- engine/common/mod_bmodel.c | 48 ++++----- engine/common/mod_studio.c | 8 +- engine/common/net_chan.c | 14 +-- engine/common/net_encode.c | 42 ++++---- engine/common/net_ws.c | 42 ++++---- engine/common/pm_trace.c | 2 +- engine/common/soundlib/snd_main.c | 2 +- engine/common/soundlib/snd_mp3.c | 26 ++--- engine/common/soundlib/snd_utils.c | 6 +- engine/common/soundlib/snd_wav.c | 28 +++--- engine/common/sys_con.c | 2 +- engine/common/system.c | 8 +- engine/common/zone.c | 20 ++-- engine/platform/dos/vid_dos.c | 2 +- engine/platform/linux/in_evdev.c | 2 +- engine/platform/linux/vid_fbdev.c | 4 +- engine/platform/misc/lib_static.c | 6 +- engine/platform/nswitch/sys_nswitch.c | 4 +- engine/platform/posix/lib_posix.c | 6 +- engine/platform/sdl/events.c | 4 +- engine/platform/sdl/s_sdl.c | 4 +- engine/platform/sdl/vid_sdl.c | 44 ++++----- engine/platform/win32/con_win.c | 2 +- engine/platform/win32/lib_win.c | 14 +-- engine/server/sv_client.c | 18 ++-- engine/server/sv_cmds.c | 4 +- engine/server/sv_custom.c | 4 +- engine/server/sv_game.c | 134 +++++++++++++------------- engine/server/sv_main.c | 2 +- engine/server/sv_phys.c | 8 +- engine/server/sv_pmove.c | 2 +- filesystem/VFileSystem009.cpp | 2 +- filesystem/dir.c | 2 +- filesystem/filesystem.c | 28 +++--- filesystem/pak.c | 2 +- filesystem/wad.c | 20 ++-- filesystem/zip.c | 22 ++--- ref/gl/gl2_shim/gl2_shim.c | 16 +-- ref/gl/gl_alias.c | 4 +- ref/gl/gl_backend.c | 4 +- ref/gl/gl_beams.c | 2 +- ref/gl/gl_context.c | 2 +- ref/gl/gl_decals.c | 2 +- ref/gl/gl_draw.c | 8 +- ref/gl/gl_image.c | 32 +++--- ref/gl/gl_opengl.c | 6 +- ref/gl/gl_rmain.c | 2 +- ref/gl/gl_rsurf.c | 12 +-- ref/gl/gl_sprite.c | 4 +- ref/gl/gl_warp.c | 2 +- ref/soft/r_beams.c | 2 +- ref/soft/r_context.c | 4 +- ref/soft/r_decals.c | 2 +- ref/soft/r_image.c | 20 ++-- ref/soft/r_main.c | 2 +- ref/soft/r_polyse.c | 4 +- ref/soft/r_sprite.c | 4 +- ref/soft/r_surf.c | 8 +- wscript | 2 +- 104 files changed, 586 insertions(+), 584 deletions(-) diff --git a/3rdparty/mainui b/3rdparty/mainui index 16379c10..54a9ff29 160000 --- a/3rdparty/mainui +++ b/3rdparty/mainui @@ -1 +1 @@ -Subproject commit 16379c10c7ebafcbfaf355069ec5a405c77c8e24 +Subproject commit 54a9ff29f1f085f9b93fa529ccafcbb0ea961cb2 diff --git a/common/xash3d_types.h b/common/xash3d_types.h index 8457e1df..86476caf 100644 --- a/common/xash3d_types.h +++ b/common/xash3d_types.h @@ -168,8 +168,9 @@ _inline float LittleFloat( float f ) #endif -typedef unsigned int dword; -typedef unsigned int uint; +typedef unsigned int dword; +typedef unsigned int uint; +typedef unsigned long ulong; typedef char string[MAX_STRING]; typedef struct file_s file_t; // normal file typedef struct stream_s stream_t; // sound stream for background music playing diff --git a/engine/client/cl_custom.c b/engine/client/cl_custom.c index 72432a72..fb77e698 100644 --- a/engine/client/cl_custom.c +++ b/engine/client/cl_custom.c @@ -105,7 +105,7 @@ void CL_AddToResourceList( resource_t *pResource, resource_t *pList ) void CL_RemoveFromResourceList( resource_t *pResource ) { if( pResource->pPrev == NULL || pResource->pNext == NULL ) - Host_Error( "mislinked resource in CL_RemoveFromResourceList\n" ); + Host_Error( "mislinked resource in %s\n", __func__ ); if( pResource->pNext == pResource || pResource->pPrev == pResource ) Host_Error( "attempt to free last entry in list.\n" ); @@ -120,7 +120,7 @@ void CL_MoveToOnHandList( resource_t *pResource ) { if( !pResource ) { - Con_Reportf( "Null resource passed to CL_MoveToOnHandList\n" ); + Con_Reportf( "Null resource passed to %s\n", __func__ ); return; } diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index 6965ab25..92ce21a3 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -1623,7 +1623,7 @@ void CL_StartDemos_f( void ) c = Cmd_Argc() - 1; if( c > MAX_DEMOS ) { - Con_DPrintf( S_WARN "Host_StartDemos: max %i demos in demoloop\n", MAX_DEMOS ); + Con_DPrintf( S_WARN "%s: max %i demos in demoloop\n", __func__, MAX_DEMOS ); c = MAX_DEMOS; } diff --git a/engine/client/cl_events.c b/engine/client/cl_events.c index ed66a5f8..a041029e 100644 --- a/engine/client/cl_events.c +++ b/engine/client/cl_events.c @@ -219,7 +219,7 @@ static qboolean CL_FireEvent( event_info_t *ei, int slot ) if( !ev ) { idx = bound( 1, ei->index, ( MAX_EVENTS - 1 )); - Con_Reportf( S_ERROR "CL_FireEvent: %s not precached\n", cl.event_precache[idx] ); + Con_Reportf( S_ERROR "%s: %s not precached\n", __func__, cl.event_precache[idx] ); break; } @@ -244,7 +244,7 @@ static qboolean CL_FireEvent( event_info_t *ei, int slot ) return true; } - Con_Reportf( S_ERROR "CL_FireEvent: %s not hooked\n", name ); + Con_Reportf( S_ERROR "%s: %s not hooked\n", __func__, name ); break; } } @@ -497,14 +497,14 @@ void GAME_EXPORT CL_PlaybackEvent( int flags, const edict_t *pInvoker, word even // first check event for out of bounds if( eventindex < 1 || eventindex >= MAX_EVENTS ) { - Con_DPrintf( S_ERROR "CL_PlaybackEvent: invalid eventindex %i\n", eventindex ); + Con_DPrintf( S_ERROR "%s: invalid eventindex %i\n", __func__, eventindex ); return; } // check event for precached if( !CL_EventIndex( cl.event_precache[eventindex] )) { - Con_DPrintf( S_ERROR "CL_PlaybackEvent: event %i was not precached\n", eventindex ); + Con_DPrintf( S_ERROR "%s: event %i was not precached\n", __func__, eventindex ); return; } diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index 0ceaa727..170eedce 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -712,7 +712,7 @@ static void CL_FlushEntityPacket( sizebuf_t *msg ) break; // done if( MSG_CheckOverflow( msg )) - Host_Error( "CL_FlushEntityPacket: overflow\n" ); + Host_Error( "%s: overflow\n", __func__ ); MSG_ReadDeltaEntity( msg, &from, &to, newnum, CL_IsPlayerIndex( newnum ) ? DELTA_PLAYER : DELTA_ENTITY, cl.mtime[0] ); } @@ -740,7 +740,7 @@ static void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_s if(( newnum < 0 ) || ( newnum >= clgame.maxEntities )) { - Con_DPrintf( S_ERROR "CL_DeltaEntity: invalid newnum: %d\n", newnum ); + Con_DPrintf( S_ERROR "%s: invalid newnum: %d\n", __func__, newnum ); if( has_update ) MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] ); return; @@ -885,7 +885,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta ) break; // done if( MSG_CheckOverflow( msg )) - Host_Error( "CL_ParsePacketEntities: overflow\n" ); + Host_Error( "%s: overflow\n", __func__ ); player = CL_IsPlayerIndex( newnum ); @@ -955,7 +955,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta ) } if( newframe->num_entities != count && newframe->num_entities != 0 ) - Con_Reportf( S_WARN "CL_Parse%sPacketEntities: (%i should be %i)\n", delta ? "Delta" : "", newframe->num_entities, count ); + Con_Reportf( S_WARN "%s%s: (%i should be %i)\n", __func__, delta ? "Delta" : "", newframe->num_entities, count ); if( !newframe->valid ) return playerbytes; // frame is not valid but message was parsed @@ -1187,7 +1187,7 @@ static void CL_LinkPacketEntities( frame_t *frame ) if( !ent ) { - Con_Reportf( S_ERROR "CL_LinkPacketEntity: bad entity %i\n", state->number ); + Con_Reportf( S_ERROR "%s: bad entity %i\n", __func__, state->number ); continue; } diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 03360388..fab4b3e3 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -231,7 +231,7 @@ static void CL_InitCDAudio( const char *filename ) if( ++c > MAX_CDTRACKS - 1 ) { - Con_Reportf( S_WARN "CD_Init: too many tracks %i in %s\n", MAX_CDTRACKS, filename ); + Con_Reportf( S_WARN "%s: too many tracks %i in %s\n", __func__, MAX_CDTRACKS, filename ); break; } } @@ -777,14 +777,14 @@ static const char *CL_SoundFromIndex( int index ) if( !hSound ) { - Con_DPrintf( S_ERROR "CL_SoundFromIndex: invalid sound index %i\n", index ); + Con_DPrintf( S_ERROR "%s: invalid sound index %i\n", __func__, index ); return NULL; } sfx = S_GetSfxByHandle( hSound ); if( !sfx ) { - Con_DPrintf( S_ERROR "CL_SoundFromIndex: bad sfx for index %i\n", index ); + Con_DPrintf( S_ERROR "%s: bad sfx for index %i\n", __func__, index ); return NULL; } @@ -1041,10 +1041,10 @@ void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize ) int i; if( !pszName || !*pszName ) - Host_Error( "CL_LinkUserMessage: bad message name\n" ); + Host_Error( "%s: bad message name\n", __func__ ); if( svc_num <= svc_lastmsg ) - Host_Error( "CL_LinkUserMessage: tried to hook a system message \"%s\"\n", svc_strings[svc_num] ); + Host_Error( "%s: tried to hook a system message \"%s\"\n", __func__, svc_strings[svc_num] ); // see if already hooked for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ ) @@ -1061,7 +1061,7 @@ void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize ) if( i == MAX_USER_MESSAGES ) { - Host_Error( "CL_LinkUserMessage: MAX_USER_MESSAGES hit!\n" ); + Host_Error( "%s: MAX_USER_MESSAGES hit!\n", __func__ ); return; } @@ -1242,7 +1242,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla if( !COM_CheckString( filename )) { - Con_Reportf( S_ERROR "CL_LoadSpriteModel: bad name!\n" ); + Con_Reportf( S_ERROR "%s: bad name!\n", __func__ ); return NULL; } @@ -1503,12 +1503,12 @@ static void GAME_EXPORT pfnSPR_DrawAdditive( int frame, int x, int y, const wrec /* ========= -pfnSPR_GetList +SPR_GetList for parsing half-life scripts - hud.txt etc ========= */ -static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount ) +static client_sprite_t *SPR_GetList( char *psz, int *piCount ) { cached_spritelist_t *pEntry = &clgame.sprlist[0]; int slot, index, numSprites = 0; @@ -1534,7 +1534,7 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount ) if( slot == MAX_CLIENT_SPRITES ) { - Con_Printf( S_ERROR "SPR_GetList: overflow cache!\n" ); + Con_Printf( S_ERROR "%s: overflow cache!\n", __func__ ); return NULL; } @@ -1743,7 +1743,7 @@ static int GAME_EXPORT pfnHookUserMsg( const char *pszName, pfnUserMsgHook pfn ) if( i == MAX_USER_MESSAGES ) { - Host_Error( "HookUserMsg: MAX_USER_MESSAGES hit!\n" ); + Host_Error( "%s: MAX_USER_MESSAGES hit!\n", __func__ ); return 0; } @@ -2293,7 +2293,7 @@ static void GAME_EXPORT pfnHookEvent( const char *filename, pfnEventHook pfn ) if( !Q_stricmp( name, ev->name ) && ev->func != NULL ) { - Con_Reportf( S_WARN "CL_HookEvent: %s already hooked!\n", name ); + Con_Reportf( S_WARN "%s: %s already hooked!\n", __func__, name ); return; } } @@ -3420,7 +3420,7 @@ static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags, if( !response ) { - Con_DPrintf( S_ERROR "Net_SendRequest: no callbcak specified for request with context %i!\n", context ); + Con_DPrintf( S_ERROR "%s: no callbcak specified for request with context %i!\n", __func__, context ); return; } @@ -3808,7 +3808,7 @@ static cl_enginefunc_t gEngfuncs = pfnSPR_DrawAdditive, SPR_EnableScissor, SPR_DisableScissor, - pfnSPR_GetList, + SPR_GetList, CL_FillRGBA, CL_GetScreenInfo, pfnSetCrosshair, @@ -4030,14 +4030,14 @@ qboolean CL_LoadProgs( const char *name ) // trying to get single export if(( GetClientAPI = (void *)COM_GetProcAddress( clgame.hInstance, "GetClientAPI" )) != NULL ) { - Con_Reportf( "CL_LoadProgs: found single callback export\n" ); + Con_Reportf( "%s: found single callback export\n", __func__ ); // trying to fill interface now GetClientAPI( &clgame.dllFuncs ); } else if(( GetClientAPI = (void *)COM_GetProcAddress( clgame.hInstance, "F" )) != NULL ) { - Con_Reportf( "CL_LoadProgs: found single callback export (secured client dlls)\n" ); + Con_Reportf( "%s: found single callback export (secured client dlls)\n", __func__ ); // trying to fill interface now CL_GetSecuredClientAPI( GetClientAPI ); @@ -4065,7 +4065,7 @@ qboolean CL_LoadProgs( const char *name ) // functions are cleared before all the extensions are evaluated if(( *func->func = (void *)COM_GetProcAddress( clgame.hInstance, func->name )) == NULL ) { - Con_Reportf( "CL_LoadProgs: failed to get address of %s proc\n", func->name ); + Con_Reportf( "%s: failed to get address of %s proc\n", __func__, func->name ); if( critical_exports ) { @@ -4092,13 +4092,13 @@ qboolean CL_LoadProgs( const char *name ) // functions are cleared before all the extensions are evaluated // NOTE: new exports can be missed without stop the engine if(( *func->func = (void *)COM_GetProcAddress( clgame.hInstance, func->name )) == NULL ) - Con_Reportf( "CL_LoadProgs: failed to get address of %s proc\n", func->name ); + Con_Reportf( "%s: failed to get address of %s proc\n", __func__, func->name ); } if( !clgame.dllFuncs.pfnInitialize( &gEngfuncs, CLDLL_INTERFACE_VERSION )) { COM_FreeLibrary( clgame.hInstance ); - Con_Reportf( "CL_LoadProgs: can't init client API\n" ); + Con_Reportf( "%s: can't init client API\n", __func__ ); clgame.hInstance = NULL; return false; } @@ -4115,10 +4115,10 @@ qboolean CL_LoadProgs( const char *name ) CL_InitTempEnts (); if( !R_InitRenderAPI()) // Xash3D extension - Con_Reportf( S_WARN "CL_LoadProgs: couldn't get render API\n" ); + Con_Reportf( S_WARN "%s: couldn't get render API\n", __func__ ); if( !Mobile_Init() ) // Xash3D FWGS extension: mobile interface - Con_Reportf( S_WARN "CL_LoadProgs: couldn't get mobility API\n" ); + Con_Reportf( S_WARN "%s: couldn't get mobility API\n", __func__ ); CL_InitEdicts( cl.maxclients ); // initailize local player and world CL_InitClientMove(); // initialize pm_shared diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index b93037d9..e35c958a 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -494,7 +494,7 @@ static HIMAGE GAME_EXPORT pfnPIC_Load( const char *szPicName, const byte *image_ if( !COM_CheckString( szPicName )) { - Con_Reportf( S_ERROR "CL_LoadImage: refusing to load image with empty name\n" ); + Con_Reportf( S_ERROR "%s: refusing to load image with empty name\n", __func__ ); return 0; } @@ -1013,7 +1013,7 @@ pfnChangeInstance */ static void GAME_EXPORT pfnChangeInstance( const char *newInstance, const char *szFinalMessage ) { - Con_Reportf( S_ERROR "ChangeInstance menu call is deprecated!\n" ); + Con_Reportf( S_ERROR "%s menu call is deprecated!\n", __func__ ); } /* @@ -1296,7 +1296,7 @@ qboolean UI_LoadProgs( void ) if(( GetMenuAPI = (MENUAPI)COM_GetProcAddress( gameui.hInstance, "GetMenuAPI" )) == NULL ) { COM_FreeLibrary( gameui.hInstance ); - Con_Reportf( "UI_LoadProgs: can't init menu API\n" ); + Con_Reportf( "%s: can't init menu API\n", __func__ ); gameui.hInstance = NULL; return false; } @@ -1312,7 +1312,7 @@ qboolean UI_LoadProgs( void ) if( !GetMenuAPI( &gameui.dllFuncs, &gpEngfuncs, gameui.globals )) { COM_FreeLibrary( gameui.hInstance ); - Con_Reportf( "UI_LoadProgs: can't init menu API\n" ); + Con_Reportf( "%s: can't init menu API\n", __func__ ); Mem_FreePool( &gameui.mempool ); gameui.hInstance = NULL; return false; @@ -1325,10 +1325,10 @@ qboolean UI_LoadProgs( void ) // try to initialize new extended API if( ( GetExtAPI = (UIEXTENEDEDAPI)COM_GetProcAddress( gameui.hInstance, "GetExtAPI" ) ) ) { - Con_Reportf( "UI_LoadProgs: extended Menu API found\n" ); + Con_Reportf( "%s: extended Menu API found\n", __func__ ); if( GetExtAPI( MENU_EXTENDED_API_VERSION, &gameui.dllFuncs2, &gpExtendedfuncs ) ) { - Con_Reportf( "UI_LoadProgs: extended Menu API initialized\n" ); + Con_Reportf( "%s: extended Menu API initialized\n", __func__ ); gameui.use_extended_api = true; } } @@ -1336,11 +1336,11 @@ qboolean UI_LoadProgs( void ) { if( ( GiveTextApi = (UITEXTAPI)COM_GetProcAddress( gameui.hInstance, "GiveTextAPI" ) ) ) { - Con_Reportf( "UI_LoadProgs: extended text API found\n" ); + Con_Reportf( "%s: extended text API found\n", __func__ ); Con_Reportf( S_WARN "Text API is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" ); if( GiveTextApi( &gpExtendedfuncs ) ) // they are binary compatible, so we can just pass extended funcs API to menu { - Con_Reportf( "UI_LoadProgs: extended text API initialized\n" ); + Con_Reportf( "%s: extended text API initialized\n", __func__ ); gameui.use_extended_api = true; } } @@ -1348,7 +1348,7 @@ qboolean UI_LoadProgs( void ) gameui.dllFuncs2.pfnAddTouchButtonToList = (ADDTOUCHBUTTONTOLIST)COM_GetProcAddress( gameui.hInstance, "AddTouchButtonToList" ); if( gameui.dllFuncs2.pfnAddTouchButtonToList ) { - Con_Reportf( "UI_LoadProgs: AddTouchButtonToList call found\n" ); + Con_Reportf( "%s: AddTouchButtonToList call found\n", __func__ ); Con_Reportf( S_WARN "AddTouchButtonToList is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" ); } } diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 08f7c0bb..c6073bb1 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -223,7 +223,7 @@ An svc_signonnum has been received, perform a client side setup void CL_SignonReply( void ) { // g-cont. my favorite message :-) - Con_Reportf( "CL_SignonReply: %i\n", cls.signon ); + Con_Reportf( "%s: %i\n", __func__, cls.signon ); switch( cls.signon ) { @@ -827,7 +827,7 @@ static void CL_WritePacket( void ) from = to; if( MSG_CheckOverflow( &buf )) - Host_Error( "CL_WritePacket: overflowed command buffer (%i bytes)\n", MAX_CMD_BUFFER ); + Host_Error( "%s: overflowed command buffer (%i bytes)\n", __func__, MAX_CMD_BUFFER ); } // calculate a checksum over the move commands @@ -852,7 +852,7 @@ static void CL_WritePacket( void ) } if( MSG_CheckOverflow( &buf )) - Host_Error( "CL_WritePacket: overflowed command buffer (%i bytes)\n", MAX_CMD_BUFFER ); + Host_Error( "%s: overflowed command buffer (%i bytes)\n", __func__, MAX_CMD_BUFFER ); // remember outgoing command that we are sending cls.lastoutgoingcommand = cls.netchan.outgoing_sequence; @@ -1019,7 +1019,7 @@ static void CL_SendConnectPacket( void ) if( !NET_StringToAdr( cls.servername, &adr )) { - Con_Printf( "CL_SendConnectPacket: bad server address\n"); + Con_Printf( "%s: bad server address\n", __func__ ); cls.connect_time = 0; return; } @@ -1167,7 +1167,7 @@ static void CL_CheckForResend( void ) // only retry so many times before failure. if( cls.connect_retry >= CL_CONNECTION_RETRIES ) { - Con_DPrintf( S_ERROR "CL_CheckForResend: couldn't connected\n" ); + Con_DPrintf( S_ERROR "%s: couldn't connect\n", __func__ ); CL_Disconnect(); return; } @@ -2014,7 +2014,7 @@ static void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg ) Cmd_TokenizeString( args ); c = Cmd_Argv( 0 ); - Con_Reportf( "CL_ConnectionlessPacket: %s : %s\n", NET_AdrToString( from ), c ); + Con_Reportf( "%s: %s : %s\n", __func__, NET_AdrToString( from ), c ); // server connection if( !Q_strcmp( c, "client_connect" )) @@ -2382,14 +2382,14 @@ static void CL_ReadNetMessage( void ) { if( MSG_GetMaxBytes( &net_message ) < 8 ) { - Con_Printf( S_WARN "CL_ReadPackets: %s:runt packet\n", NET_AdrToString( net_from )); + Con_Printf( S_WARN "%s: %s:runt packet\n", __func__, NET_AdrToString( net_from )); continue; } // packet from server if( !NET_CompareAdr( net_from, cls.netchan.remote_address )) { - Con_DPrintf( S_ERROR "CL_ReadPackets: %s:sequenced packet without connection\n", NET_AdrToString( net_from )); + Con_DPrintf( S_ERROR "%s: %s:sequenced packet without connection\n", __func__, NET_AdrToString( net_from )); continue; } @@ -3295,7 +3295,7 @@ CL_Shutdown */ void CL_Shutdown( void ) { - Con_Printf( "CL_Shutdown()\n" ); + Con_Printf( "%s()\n", __func__ ); if( !host.crashed && cls.initialized ) { diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index df98c038..b7cc47a4 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1204,7 +1204,7 @@ void CL_ParseBaseline( sizebuf_t *msg, qboolean legacy ) player = CL_IsPlayerIndex( newnum ); if( newnum >= clgame.maxEntities ) - Host_Error( "CL_AllocEdict: no free edicts\n" ); + Host_Error( "%s: no free edicts\n", __func__ ); ent = CL_EDICT_NUM( newnum ); memset( &ent->prevstate, 0, sizeof( ent->prevstate )); @@ -1381,7 +1381,7 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy ) slot = MSG_ReadUBitLong( msg, MAX_CLIENT_BITS ); if( slot >= MAX_CLIENTS ) - Host_Error( "CL_ParseServerMessage: svc_updateuserinfo >= MAX_CLIENTS\n" ); + Host_Error( "%s: svc_updateuserinfo >= MAX_CLIENTS\n", __func__ ); player = &cl.players[slot]; @@ -1494,7 +1494,7 @@ void CL_UpdateUserPings( sizebuf_t *msg ) slot = MSG_ReadUBitLong( msg, MAX_CLIENT_BITS ); if( slot >= MAX_CLIENTS ) - Host_Error( "CL_ParseServerMessage: svc_pings > MAX_CLIENTS\n" ); + Host_Error( "%s: svc_pings > MAX_CLIENTS\n", __func__ ); player = &cl.players[slot]; player->ping = MSG_ReadUBitLong( msg, 12 ); @@ -1722,7 +1722,7 @@ static void CL_ParseConsistencyInfo( sizebuf_t *msg ) } if( cl.num_consistency >= MAX_MODELS ) - Host_Error( "CL_CheckConsistency: MAX_MODELS limit exceeded (%d)\n", MAX_MODELS ); + Host_Error( "%s: MAX_MODELS limit exceeded (%d)\n", __func__, MAX_MODELS ); pc = &cl.consistency_list[cl.num_consistency]; cl.num_consistency++; @@ -2140,7 +2140,7 @@ void CL_ParseUserMessage( sizebuf_t *msg, int svc_num ) if( svc_num <= svc_lastmsg || svc_num > ( MAX_USER_MESSAGES + svc_lastmsg )) { // out or range - Host_Error( "CL_ParseUserMessage: illegible server message %d\n", svc_num ); + Host_Error( "%s: illegible server message %d\n", __func__, svc_num ); return; } @@ -2152,7 +2152,7 @@ void CL_ParseUserMessage( sizebuf_t *msg, int svc_num ) } if( i == MAX_USER_MESSAGES ) // probably unregistered - Host_Error( "CL_ParseUserMessage: illegible server message %d\n", svc_num ); + Host_Error( "%s: illegible server message %d\n", __func__, svc_num ); // NOTE: some user messages handled into engine if( !Q_strcmp( clgame.msg[i].name, "ScreenShake" )) @@ -2178,7 +2178,7 @@ void CL_ParseUserMessage( sizebuf_t *msg, int svc_num ) if( iSize >= MAX_USERMSG_LENGTH ) { - Msg("WTF??? %d %d\n", i, svc_num ); + Con_Reportf( "%s: user message %s size limit hit (%d > %d)!\n", __func__, clgame.msg[i].name, iSize, MAX_USERMSG_LENGTH ); return; } @@ -2207,7 +2207,7 @@ void CL_ParseUserMessage( sizebuf_t *msg, int svc_num ) } else { - Con_DPrintf( S_ERROR "UserMsg: No pfn %s %d\n", clgame.msg[i].name, clgame.msg[i].number ); + Con_DPrintf( S_ERROR "%s: No pfn %s %d\n", __func__, clgame.msg[i].name, clgame.msg[i].number ); clgame.msg[i].func = CL_UserMsgStub; // throw warning only once } } diff --git a/engine/client/cl_parse_48.c b/engine/client/cl_parse_48.c index 4e35ab86..d18928d7 100644 --- a/engine/client/cl_parse_48.c +++ b/engine/client/cl_parse_48.c @@ -174,7 +174,7 @@ static void CL_LegacyPrecacheSound( sizebuf_t *msg ) soundIndex = MSG_ReadUBitLong( msg, MAX_SOUND_BITS ); if( soundIndex < 0 || soundIndex >= MAX_SOUNDS ) - Host_Error( "CL_PrecacheSound: bad soundindex %i\n", soundIndex ); + Host_Error( "%s: bad soundindex %i\n", __func__, soundIndex ); Q_strncpy( cl.sound_precache[soundIndex], MSG_ReadString( msg ), sizeof( cl.sound_precache[0] )); @@ -192,7 +192,7 @@ static void CL_LegacyPrecacheModel( sizebuf_t *msg ) modelIndex = MSG_ReadUBitLong( msg, MAX_LEGACY_MODEL_BITS ); if( modelIndex < 0 || modelIndex >= MAX_MODELS ) - Host_Error( "CL_PrecacheModel: bad modelindex %i\n", modelIndex ); + Host_Error( "%s: bad modelindex %i\n", __func__, modelIndex ); Q_strncpy( model, MSG_ReadString( msg ), sizeof( model )); //Q_strncpy( cl.model_precache[modelIndex], BF_ReadString( msg ), sizeof( cl.model_precache[0] )); @@ -221,7 +221,7 @@ static void CL_LegacyPrecacheEvent( sizebuf_t *msg ) eventIndex = MSG_ReadUBitLong( msg, MAX_EVENT_BITS ); if( eventIndex < 0 || eventIndex >= MAX_EVENTS ) - Host_Error( "CL_PrecacheEvent: bad eventindex %i\n", eventIndex ); + Host_Error( "%s: bad eventindex %i\n", __func__, eventIndex ); Q_strncpy( cl.event_precache[eventIndex], MSG_ReadString( msg ), sizeof( cl.event_precache[0] )); @@ -256,7 +256,7 @@ static void CL_LegacyParseResourceList( sizebuf_t *msg ) reslist.rescount = MSG_ReadWord( msg ) - 1; if( reslist.rescount > MAX_LEGACY_RESOURCES ) - Host_Error("MAX_RESOURCES reached\n"); + Host_Error( "MAX_RESOURCES reached\n" ); for( i = 0; i < reslist.rescount; i++ ) { diff --git a/engine/client/cl_qparse.c b/engine/client/cl_qparse.c index ae3caa41..eb603b12 100644 --- a/engine/client/cl_qparse.c +++ b/engine/client/cl_qparse.c @@ -620,11 +620,11 @@ static void CL_ParseQuakeDamage( sizebuf_t *msg ) /* =================== -CL_ParseQuakeStaticEntity +CL_ParseStaticEntity =================== */ -static void CL_ParseQuakeStaticEntity( sizebuf_t *msg ) +static void CL_ParseStaticEntity( sizebuf_t *msg ) { entity_state_t state; cl_entity_t *ent; @@ -646,7 +646,7 @@ static void CL_ParseQuakeStaticEntity( sizebuf_t *msg ) i = clgame.numStatics; if( i >= MAX_STATIC_ENTITIES ) { - Con_Printf( S_ERROR "CL_ParseStaticEntity: static entities limit exceeded!\n" ); + Con_Printf( S_ERROR "%s: static entities limit exceeded!\n", __func__ ); return; } @@ -697,7 +697,7 @@ static void CL_ParseQuakeBaseline( sizebuf_t *msg ) newnum = MSG_ReadWord( msg ); // entnum if( newnum >= clgame.maxEntities ) - Host_Error( "CL_AllocEdict: no free edicts\n" ); + Host_Error( "%s: no free edicts\n", __func__ ); // parse baseline memset( &state, 0, sizeof( state )); @@ -778,7 +778,7 @@ static void CL_ParseQuakeSignon( sizebuf_t *msg ) int i = MSG_ReadByte( msg ); if( i == 3 ) cls.signon = SIGNONS - 1; - Con_Reportf( "CL_Signon: %d\n", i ); + Con_Reportf( "%s: %d\n", __func__, i ); } /* @@ -1005,7 +1005,7 @@ void CL_ParseQuakeMessage( sizebuf_t *msg ) CL_ParseQuakeDamage( msg ); break; case svc_spawnstatic: - CL_ParseQuakeStaticEntity( msg ); + CL_ParseStaticEntity( msg ); break; case svc_spawnbinary: // never used in Quake @@ -1091,7 +1091,7 @@ void CL_ParseQuakeMessage( sizebuf_t *msg ) } break; default: - Host_Error( "CL_ParseServerMessage: Illegible server message\n" ); + Host_Error( "%s: Illegible server message\n", __func__ ); break; } } diff --git a/engine/client/cl_render.c b/engine/client/cl_render.c index e75d0c8f..d328632a 100644 --- a/engine/client/cl_render.c +++ b/engine/client/cl_render.c @@ -347,7 +347,7 @@ qboolean R_InitRenderAPI( void ) { if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs )) { - Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION ); + Con_Reportf( "%s: ^2initailized extended RenderAPI ^7ver. %i\n", __func__, CL_RENDER_INTERFACE_VERSION ); return true; } diff --git a/engine/client/cl_scrn.c b/engine/client/cl_scrn.c index 67c983bc..ca44be6e 100644 --- a/engine/client/cl_scrn.c +++ b/engine/client/cl_scrn.c @@ -543,7 +543,7 @@ void SCR_UpdateScreen( void ) SCR_DrawCinematic(); break; default: - Host_Error( "SCR_UpdateScreen: bad cls.state\n" ); + Host_Error( "%s: bad cls.state\n", __func__ ); break; } diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 8c63564a..83216fb1 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -1904,7 +1904,7 @@ void CL_ParseTempEntity( sizebuf_t *msg ) // this will probably be fatal anyway if( iSize > sizeof( pbuf )) - Con_Printf( S_ERROR "%s: Temp buffer overflow!\n", __FUNCTION__ ); + Con_Printf( S_ERROR "%s: Temp buffer overflow!\n", __func__ ); // parse user message into buffer MSG_ReadBytes( msg, pbuf, iSize ); @@ -2384,13 +2384,13 @@ void CL_ParseTempEntity( sizebuf_t *msg ) R_UserTracerParticle( pos, pos2, life, color, scale, 0, NULL ); break; default: - Con_DPrintf( S_ERROR "ParseTempEntity: illegible TE message %i\n", type ); + Con_DPrintf( S_ERROR "%s: illegible TE message %i\n", __func__, type ); break; } // throw warning if( MSG_CheckOverflow( &buf )) - Con_DPrintf( S_WARN "ParseTempEntity: overflow TE message %i\n", type ); + Con_DPrintf( S_WARN "%s: overflow TE message %i\n", __func__, type ); } diff --git a/engine/client/cl_view.c b/engine/client/cl_view.c index f16eaa6e..4058d25e 100644 --- a/engine/client/cl_view.c +++ b/engine/client/cl_view.c @@ -341,7 +341,7 @@ qboolean V_PreRender( void ) { if(( host.realtime - cls.disable_screen ) > cl_timeout.value ) { - Con_Reportf( "V_PreRender: loading plaque timed out\n" ); + Con_Reportf( "%s: loading plaque timed out\n", __func__ ); cls.disable_screen = 0.0f; } return false; @@ -506,7 +506,6 @@ V_PostRender */ void V_PostRender( void ) { - static double oldtime; qboolean draw_2d = false; ref.dllFuncs.R_AllowFog( false ); diff --git a/engine/client/client.h b/engine/client/client.h index f1e9212c..d2813331 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -852,14 +852,14 @@ _inline cl_entity_t *CL_EDICT_NUM( int n ) { if( !clgame.entities ) { - Host_Error( "CL_EDICT_NUM: clgame.entities is NULL\n"); + Host_Error( "%s: clgame.entities is NULL\n", __func__ ); return NULL; } if(( n >= 0 ) && ( n < clgame.maxEntities )) return clgame.entities + n; - Host_Error( "CL_EDICT_NUM: bad number %i\n", n ); + Host_Error( "%s: bad number %i\n", __func__, n ); return NULL; } diff --git a/engine/client/in_joy.c b/engine/client/in_joy.c index 5caa470d..08f9ec08 100644 --- a/engine/client/in_joy.c +++ b/engine/client/in_joy.c @@ -134,7 +134,7 @@ static void Joy_ProcessTrigger( const engineAxis_t engineAxis, short value ) trigThreshold = joy_lt_threshold.value; break; default: - Con_Reportf( S_ERROR "Joy_ProcessTrigger: invalid axis = %i", engineAxis ); + Con_Reportf( S_ERROR "%s: invalid axis = %i\n", __func__, engineAxis ); break; } @@ -205,7 +205,7 @@ static void Joy_ProcessStick( const engineAxis_t engineAxis, short value ) case JOY_AXIS_PITCH: deadzone = joy_pitch_deadzone.value; break; case JOY_AXIS_YAW: deadzone = joy_yaw_deadzone.value; break; default: - Con_Reportf( S_ERROR "Joy_ProcessStick: invalid axis = %i", engineAxis ); + Con_Reportf( S_ERROR "%s: invalid axis = %i\n", __func__, engineAxis ); break; } diff --git a/engine/client/in_touch.c b/engine/client/in_touch.c index abc656d7..21cf799e 100644 --- a/engine/client/in_touch.c +++ b/engine/client/in_touch.c @@ -333,7 +333,7 @@ void Touch_WriteConfig( void ) if( Sys_CheckParm( "-nowriteconfig" ) || !touch.configchanged || !touch.config_loaded ) return; - Con_DPrintf( "Touch_WriteConfig(): %s\n", touch_config_file.string ); + Con_DPrintf( "%s: %s\n", __func__, touch_config_file.string ); Q_snprintf( newconfigfile, sizeof( newconfigfile ), "%s.new", touch_config_file.string ); Q_snprintf( oldconfigfile, sizeof( oldconfigfile ), "%s.bak", touch_config_file.string ); @@ -1064,7 +1064,7 @@ void Touch_Init( void ) return; touch.mempool = Mem_AllocPool( "Touch" ); //touch.first = touch.last = NULL; - Con_Printf( "IN_TouchInit()\n"); + Con_Printf( "%s()\n", __func__ ); touch.move_finger = touch.resize_finger = touch.look_finger = touch.wheel_finger = -1; touch.state = state_none; touch.showeditbuttons = true; @@ -2163,8 +2163,7 @@ void Touch_KeyEvent( int key, int down ) x = xi / SCR_W; y = yi / SCR_H; - Con_DPrintf( "event %d %.2f %.2f %.2f %.2f\n", - event, x, y, x - lx, y - ly ); + // Con_DPrintf( "event %d %.2f %.2f %.2f %.2f\n", event, x, y, x - lx, y - ly ); IN_TouchEvent( event, finger, x, y, x - lx, y - ly ); diff --git a/engine/client/keys.c b/engine/client/keys.c index 5064a0a6..742eb932 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -840,7 +840,7 @@ void GAME_EXPORT Key_SetKeyDest( int key_dest ) cls.key_dest = key_message; break; default: - Host_Error( "Key_SetKeyDest: wrong destination (%i)\n", key_dest ); + Host_Error( "%s: wrong destination (%i)\n", __func__, key_dest ); break; } } diff --git a/engine/client/mod_dbghulls.c b/engine/client/mod_dbghulls.c index 678e1cd1..6cc5ae06 100644 --- a/engine/client/mod_dbghulls.c +++ b/engine/client/mod_dbghulls.c @@ -74,7 +74,7 @@ static void free_winding( winding_t *w ) { // simple sentinel by Carmack if( *(unsigned *)w == 0xDEADC0DE ) - Host_Error( "free_winding: freed a freed winding\n" ); + Host_Error( "%s: freed a freed winding\n", __func__ ); *(unsigned *)w = 0xDEADC0DE; free( w ); } @@ -154,7 +154,7 @@ static winding_t *winding_for_plane( const mplane_t *p ) vup[0] = 1; break; default: - Host_Error( "BaseWindingForPlane: no axis found\n" ); + Host_Error( "%s: no axis found\n", __func__ ); return NULL; } diff --git a/engine/client/ref_common.c b/engine/client/ref_common.c index 2abcf86f..12397327 100644 --- a/engine/client/ref_common.c +++ b/engine/client/ref_common.c @@ -182,7 +182,7 @@ static model_t *pfnGetDefaultSprite( enum ref_defaultsprite_e spr ) { case REF_DOT_SPRITE: return cl_sprite_dot; case REF_CHROME_SPRITE: return cl_sprite_shell; - default: Host_Error( "GetDefaultSprite: unknown sprite %d\n", spr ); + default: Host_Error( "%s: unknown sprite %d\n", __func__, spr ); } return NULL; } @@ -195,7 +195,7 @@ static void *pfnMod_Extradata( int type, model_t *m ) case mod_studio: return Mod_StudioExtradata( m ); case mod_sprite: // fallthrough case mod_brush: return NULL; - default: Host_Error( "Mod_Extradata: unknown type %d\n", type ); + default: Host_Error( "%s: unknown type %d\n", __func__, type ); } return NULL; } @@ -477,7 +477,7 @@ static qboolean R_LoadProgs( const char *name ) if( !(ref.hInstance = COM_LoadLibrary( name, false, true ) )) { FS_AllowDirectPaths( false ); - Con_Reportf( "R_LoadProgs: can't load renderer library %s: %s\n", name, COM_GetLibraryError() ); + Con_Reportf( "%s: can't load renderer library %s: %s\n", __func__, name, COM_GetLibraryError() ); return false; } @@ -486,7 +486,7 @@ static qboolean R_LoadProgs( const char *name ) if( !( GetRefAPI = (REFAPI)COM_GetProcAddress( ref.hInstance, GET_REF_API )) ) { COM_FreeLibrary( ref.hInstance ); - Con_Reportf( "R_LoadProgs: can't find GetRefAPI entry point in %s\n", name ); + Con_Reportf( "%s: can't find GetRefAPI entry point in %s\n", __func__, name ); ref.hInstance = NULL; return false; } @@ -497,7 +497,7 @@ static qboolean R_LoadProgs( const char *name ) if( GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ) != REF_API_VERSION ) { COM_FreeLibrary( ref.hInstance ); - Con_Reportf( "R_LoadProgs: can't init renderer API: wrong version\n" ); + Con_Reportf( "%s: can't init renderer API: wrong version\n", __func__ ); ref.hInstance = NULL; return false; } @@ -507,7 +507,7 @@ static qboolean R_LoadProgs( const char *name ) if( !ref.dllFuncs.R_Init( ) ) { COM_FreeLibrary( ref.hInstance ); - Con_Reportf( "R_LoadProgs: can't init renderer!\n" ); //, ref.dllFuncs.R_GetInitError() ); + Con_Reportf( "%s: can't init renderer!\n", __func__ ); //, ref.dllFuncs.R_GetInitError() ); ref.hInstance = NULL; return false; } diff --git a/engine/client/s_load.c b/engine/client/s_load.c index e73edced..1ea5f32a 100644 --- a/engine/client/s_load.c +++ b/engine/client/s_load.c @@ -145,7 +145,7 @@ wavdata_t *S_LoadSound( sfx_t *sfx ) { // load it from disk if( s_warn_late_precache.value > 0 && cls.state == ca_active ) - Con_Printf( S_WARN "S_LoadSound: late precache of %s\n", sfx->name ); + Con_Printf( S_WARN "%s: late precache of %s\n", __func__, sfx->name ); if( sfx->name[0] == '*' ) sc = FS_LoadSound( sfx->name + 1, NULL, 0 ); diff --git a/engine/client/s_main.c b/engine/client/s_main.c index ce42b5e9..f0d8c85d 100644 --- a/engine/client/s_main.c +++ b/engine/client/s_main.c @@ -382,7 +382,7 @@ channel_t *SND_PickStaticChannel( const vec3_t pos, sfx_t *sfx ) // no empty slots, alloc a new static sound channel if( total_channels == MAX_CHANNELS ) { - Con_DPrintf( S_ERROR "S_PickStaticChannel: no free channels\n" ); + Con_DPrintf( S_ERROR "%s: no free channels\n", __func__ ); return NULL; } diff --git a/engine/client/s_vox.c b/engine/client/s_vox.c index 388ca74b..a5cd1816 100644 --- a/engine/client/s_vox.c +++ b/engine/client/s_vox.c @@ -261,7 +261,7 @@ static const char *VOX_GetDirectory( char *szpath, const char *psz, int nsize ) if( len > nsize ) { - Con_Printf( "VOX_GetDirectory: invalid directory in: %s\n", psz ); + Con_Printf( "%s: invalid directory in: %s\n", __func__, psz ); return NULL; } @@ -467,7 +467,7 @@ void VOX_LoadSound( channel_t *ch, const char *pszin ) if( !psz ) { - Con_Printf( "VOX_LoadSound: no sentence named %s\n", pszin ); + Con_Printf( "%s: no sentence named %s\n", __func__, pszin ); return; } @@ -475,13 +475,13 @@ void VOX_LoadSound( channel_t *ch, const char *pszin ) if( !psz ) { - Con_Printf( "VOX_LoadSound: failed getting directory for %s\n", pszin ); + Con_Printf( "%s: failed getting directory for %s\n", __func__, pszin ); return; } if( Q_strlen( psz ) >= sizeof( buffer ) ) { - Con_Printf( "VOX_LoadSound: sentence is too long %s", psz ); + Con_Printf( "%s: sentence is too long %s", __func__, psz ); return; } diff --git a/engine/client/titles.c b/engine/client/titles.c index bf5e283d..fd6f5ff3 100644 --- a/engine/client/titles.c +++ b/engine/client/titles.c @@ -250,7 +250,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize ) if( IsEndOfText( trim )) { - Con_Reportf( "TextMessage: unexpected '}' found, line %d\n", lineNumber ); + Con_Reportf( "%s: unexpected '}' found, line %d\n", __func__, lineNumber ); return; } Q_strncpy( currentName, trim, sizeof( currentName )); @@ -263,7 +263,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize ) // save name on name heap if( lastNamePos + length > 32768 ) { - Con_Reportf( "TextMessage: error while parsing!\n" ); + Con_Reportf( "%s: error while parsing!\n", __func__ ); return; } @@ -286,7 +286,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize ) } if( IsStartOfText( trim )) { - Con_Reportf( "TextMessage: unexpected '{' found, line %d\n", lineNumber ); + Con_Reportf( "%s: unexpected '{' found, line %d\n", __func__, lineNumber ); return; } break; @@ -302,7 +302,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize ) } } - Con_Reportf( "TextMessage: parsed %d text messages\n", messageCount ); + Con_Reportf( "%s: parsed %d text messages\n", __func__, messageCount ); nameHeapSize = lastNamePos; textHeapSize = 0; @@ -347,7 +347,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize ) } if(( pCurrentText - (char *)clgame.titles ) != ( textHeapSize + nameHeapSize + messageSize )) - Con_DPrintf( S_ERROR "TextMessage: overflow text message buffer!\n" ); + Con_DPrintf( S_ERROR "%s: overflow text message buffer!\n", __func__ ); clgame.numTitles = messageCount; } diff --git a/engine/client/vgui/vgui_draw.c b/engine/client/vgui/vgui_draw.c index d9844f7f..5a1a6a93 100644 --- a/engine/client/vgui/vgui_draw.c +++ b/engine/client/vgui/vgui_draw.c @@ -305,7 +305,7 @@ qboolean VGui_LoadProgs( HINSTANCE hInstance ) { if( FS_FileExists( vguiloader, false )) Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() ); - else Con_Reportf( "vgui_support: not found\n" ); + else Con_Reportf( "%s: not found\n", __func__ ); return false; } @@ -319,12 +319,12 @@ qboolean VGui_LoadProgs( HINSTANCE hInstance ) F( &vgui.dllFuncs ); vgui.initialized = vgui.dllFuncs.initialized = true; - Con_Reportf( "vgui_support: initialized legacy API in %s module\n", client ? "client" : "support" ); + Con_Reportf( "%s: initialized legacy API in %s module\n", __func__, client ? "client" : "support" ); return true; } - Con_Reportf( S_ERROR "Failed to find VGUI support API entry point in %s module\n", client ? "client" : "support" ); + Con_Reportf( S_ERROR "%s: Failed to find VGUI support API entry point in %s module\n", __func__, client ? "client" : "support" ); return false; } diff --git a/engine/common/base_cmd.c b/engine/common/base_cmd.c index c260008f..6039e238 100644 --- a/engine/common/base_cmd.c +++ b/engine/common/base_cmd.c @@ -162,7 +162,7 @@ void BaseCmd_Remove( base_command_type_e type, const char *name ) if( !i ) { - Con_Reportf( S_ERROR "Couldn't find %s in buckets\n", name ); + Con_Reportf( S_ERROR "%s: Couldn't find %s in buckets\n", __func__, name ); return; } diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 3ba8dd1a..d921f31d 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -86,7 +86,7 @@ static void *Cbuf_GetSpace( cmdbuf_t *buf, int length ) if(( buf->cursize + length ) > buf->maxsize ) { buf->cursize = 0; - Host_Error( "Cbuf_GetSpace: overflow\n" ); + Host_Error( "%s: overflow\n", __func__ ); } data = buf->data + buf->cursize; @@ -156,7 +156,7 @@ static void Cbuf_InsertTextToBuffer( cmdbuf_t *buf, const char *text ) if(( buf->cursize + l ) >= buf->maxsize ) { - Con_Reportf( S_WARN "Cbuf_InsertText: overflow\n" ); + Con_Reportf( S_WARN "%s: overflow\n", __func__ ); } else { @@ -224,7 +224,7 @@ static void Cbuf_ExecuteCommandsFromBuffer( cmdbuf_t *buf, qboolean isPrivileged if( i >= ( MAX_CMD_LINE - 1 )) { - Con_DPrintf( S_ERROR "Cbuf_Execute: command string owerflow\n" ); + Con_DPrintf( S_ERROR "%s: command string owerflow\n", __func__ ); line[0] = 0; } else @@ -682,7 +682,7 @@ static int Cmd_AddCommandEx( const char *funcname, const char *cmd_name, xcomman if( !COM_CheckString( cmd_name )) { - Con_Reportf( S_ERROR "%s: NULL name\n", funcname ); + Con_Reportf( S_ERROR "%s: NULL name\n", funcname ); return 0; } @@ -728,7 +728,7 @@ Cmd_AddCommand */ void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc ) { - Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, cmd_desc, 0 ); + Cmd_AddCommandEx( __func__, cmd_name, function, cmd_desc, 0 ); } @@ -739,7 +739,7 @@ Cmd_AddRestrictedCommand */ void Cmd_AddRestrictedCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc ) { - Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, cmd_desc, CMD_PRIVILEGED ); + Cmd_AddCommandEx( __func__, cmd_name, function, cmd_desc, CMD_PRIVILEGED ); } /* @@ -749,7 +749,7 @@ Cmd_AddServerCommand */ void GAME_EXPORT Cmd_AddServerCommand( const char *cmd_name, xcommand_t function ) { - Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "server command", CMD_SERVERDLL ); + Cmd_AddCommandEx( __func__, cmd_name, function, "server command", CMD_SERVERDLL ); } /* @@ -767,7 +767,7 @@ int GAME_EXPORT Cmd_AddClientCommand( const char *cmd_name, xcommand_t function flags |= CMD_PRIVILEGED; } - return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "client command", flags ); + return Cmd_AddCommandEx( __func__, cmd_name, function, "client command", flags ); } /* @@ -777,7 +777,7 @@ Cmd_AddGameUICommand */ int GAME_EXPORT Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function ) { - return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "gameui command", CMD_GAMEUIDLL ); + return Cmd_AddCommandEx( __func__, cmd_name, function, "gameui command", CMD_GAMEUIDLL ); } /* @@ -787,7 +787,7 @@ Cmd_AddRefCommand */ int Cmd_AddRefCommand( const char *cmd_name, xcommand_t function, const char *description ) { - return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, description, CMD_REFDLL ); + return Cmd_AddCommandEx( __func__, cmd_name, function, description, CMD_REFDLL ); } /* diff --git a/engine/common/common.c b/engine/common/common.c index 4bf99751..785dd8e7 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -971,7 +971,7 @@ used by CS:CZ */ void *GAME_EXPORT pfnSequenceGet( const char *fileName, const char *entryName ) { - Msg( "Sequence_Get: file %s, entry %s\n", fileName, entryName ); + Msg( "%s: file %s, entry %s\n", __func__, fileName, entryName ); return NULL; } @@ -985,7 +985,7 @@ used by CS:CZ */ void *GAME_EXPORT pfnSequencePickSentence( const char *groupName, int pickMethod, int *picked ) { - Msg( "Sequence_PickSentence: group %s, pickMethod %i\n", groupName, pickMethod ); + Msg( "%s: group %s, pickMethod %i\n", __func__, groupName, pickMethod ); return NULL; diff --git a/engine/common/con_utils.c b/engine/common/con_utils.c index 6bad2d52..9d0da329 100644 --- a/engine/common/con_utils.c +++ b/engine/common/con_utils.c @@ -585,7 +585,7 @@ static qboolean Cmd_GetKeysList( const char *s, char *completedname, int length Con_Printf( "%16s\n", matchbuf ); } - Con_Printf( "\n^3 %lu keys found.\n", numkeys ); + Con_Printf( "\n^3 %zu keys found.\n", numkeys ); if( completedname && length ) { @@ -1395,7 +1395,7 @@ void Host_WriteConfig( void ) f = FS_Open( "config.cfg.new", "w", false ); if( f ) { - Con_Reportf( "Host_WriteConfig()\n" ); + Con_Reportf( "%s()\n", __func__ ); FS_Printf( f, "//=======================================================================\n"); FS_Printf( f, "//\t\t\tCopyright XashXT Group & Flying With Gauss %s (C)\n", Q_timestamp( TIME_YEAR_ONLY )); FS_Printf( f, "//\t\t\tconfig.cfg - archive of cvars\n" ); @@ -1478,7 +1478,7 @@ void Host_WriteOpenGLConfig( void ) f = FS_Open( va( "%s.new", name ), "w", false ); if( f ) { - Con_Reportf( "Host_WriteGLConfig()\n" ); + Con_Reportf( "%s()\n", __func__ ); FS_Printf( f, "//=======================================================================\n" ); FS_Printf( f, "//\t\t\tCopyright XashXT Group & Flying With Gauss %s (C)\n", Q_timestamp( TIME_YEAR_ONLY )); FS_Printf( f, "//\t\t %s - archive of renderer implementation cvars\n", name ); @@ -1508,7 +1508,7 @@ void Host_WriteVideoConfig( void ) f = FS_Open( "video.cfg.new", "w", false ); if( f ) { - Con_Reportf( "Host_WriteVideoConfig()\n" ); + Con_Reportf( "%s()\n", __func__ ); FS_Printf( f, "//=======================================================================\n" ); FS_Printf( f, "//\t\t\tCopyright XashXT Group & Flying With Gauss %s (C)\n", Q_timestamp( TIME_YEAR_ONLY )); FS_Printf( f, "//\t\tvideo.cfg - archive of renderer variables\n"); diff --git a/engine/common/cvar.c b/engine/common/cvar.c index c72e2274..54d69016 100644 --- a/engine/common/cvar.c +++ b/engine/common/cvar.c @@ -794,7 +794,7 @@ void GAME_EXPORT Cvar_Set( const char *var_name, const char *value ) if( !var_name ) { // there is an error in C code if this happens - Con_Printf( "Cvar_Set: passed NULL variable name\n" ); + Con_Printf( "%s: passed NULL variable name\n", __func__ ); return; } @@ -803,7 +803,7 @@ void GAME_EXPORT Cvar_Set( const char *var_name, const char *value ) if( !var ) { // there is an error in C code if this happens - Con_Printf( "Cvar_Set: variable '%s' not found\n", var_name ); + Con_Printf( "%s: variable '%s' not found\n", __func__, var_name ); return; } @@ -848,7 +848,7 @@ float GAME_EXPORT Cvar_VariableValue( const char *var_name ) if( !var_name ) { // there is an error in C code if this happens - Con_Printf( "Cvar_VariableValue: passed NULL variable name\n" ); + Con_Printf( "%s: passed NULL variable name\n", __func__ ); return 0.0f; } @@ -885,7 +885,7 @@ const char *Cvar_VariableString( const char *var_name ) if( !var_name ) { // there is an error in C code if this happens - Con_Printf( "Cvar_VariableString: passed NULL variable name\n" ); + Con_Printf( "%s: passed NULL variable name\n", __func__ ); return ""; } diff --git a/engine/common/host.c b/engine/common/host.c index e1c62710..02333e48 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -551,10 +551,6 @@ static void Host_InitDecals( void ) int i, num_decals = 0; search_t *t; - // NOTE: only once resource without which engine can't continue work - if( !FS_FileExists( "gfx/conchars", false )) - Sys_Error( "W_LoadWadFile: couldn't load gfx.wad\n" ); - memset( host.draw_decals, 0, sizeof( host.draw_decals )); // lookup all the decals in decals.wad (basedir, gamedir, falldir) @@ -567,7 +563,7 @@ static void Host_InitDecals( void ) } if( t ) Mem_Free( t ); - Con_Reportf( "InitDecals: %i decals\n", num_decals ); + Con_Reportf( "%s: %i decals\n", __func__, num_decals ); } /* @@ -786,11 +782,11 @@ void GAME_EXPORT Host_Error( const char *error, ... ) if( host.framecount < 3 ) { - Sys_Error( "Host_InitError: %s", hosterror1 ); + Sys_Error( "%sInit: %s", __func__, hosterror1 ); } else if( host.framecount == host.errorframe ) { - Sys_Error( "Host_MultiError: %s", hosterror2 ); + Sys_Error( "%sMulti: %s", __func__, hosterror2 ); } else { @@ -798,7 +794,7 @@ void GAME_EXPORT Host_Error( const char *error, ... ) { UI_SetActiveMenu( false ); Key_SetKeyDest( key_console ); - Con_Printf( "Host_Error: %s", hosterror1 ); + Con_Printf( "%s: %s", __func__, hosterror1 ); } else Platform_MessageBox( "Host Error", hosterror1, true ); } @@ -808,7 +804,7 @@ void GAME_EXPORT Host_Error( const char *error, ... ) if( recursive ) { - Con_Printf( "Host_RecursiveError: %s", hosterror2 ); + Con_Printf( "%sRecursive: %s", __func__, hosterror2 ); Sys_Error( "%s", hosterror1 ); } @@ -1102,6 +1098,11 @@ static void Host_InitCommon( int argc, char **argv, const char *progname, qboole Cvar_PostFSInit(); Image_CheckPaletteQ1 (); + + // NOTE: only once resource without which engine can't continue work + if( !FS_FileExists( "gfx/conchars", false )) + Sys_Error( "%s: couldn't load gfx.wad\n", __func__ ); + Host_InitDecals (); // reload decals HPAK_Init(); diff --git a/engine/common/hpak.c b/engine/common/hpak.c index e031fafc..1cd67b62 100644 --- a/engine/common/hpak.c +++ b/engine/common/hpak.c @@ -77,7 +77,7 @@ static void HPAK_AddToQueue( const char *name, resource_t *pResource, void *data if( data != NULL ) memcpy( p->data, data, p->size ); else if( f != NULL ) FS_Read( f, p->data, p->size ); - else Host_Error( "HPAK_AddToQueue: data == NULL.\n" ); + else Host_Error( "%s: data == NULL.\n", __func__ ); p->next = gp_hpak_queue; gp_hpak_queue = p; @@ -120,7 +120,7 @@ static void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *p fout = FS_Open( pakname, "wb", true ); if( !fout ) { - Con_DPrintf( S_ERROR "HPAK_CreatePak: can't write %s.\n", pakname ); + Con_DPrintf( S_ERROR "%s: can't write %s.\n", __func__, pakname ); return; } @@ -149,7 +149,7 @@ static void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *p if( memcmp( md5, pResource->rgucMD5_hash, 16 )) { - Con_DPrintf( S_ERROR "HPAK_CreatePak: bad checksum for %s. Ignored\n", pakname ); + Con_DPrintf( S_ERROR "%s: bad checksum for %s. Ignored\n", __func__, pakname ); return; } @@ -250,7 +250,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource, if( memcmp( md5, pResource->rgucMD5_hash, 16 )) { - Con_DPrintf( S_ERROR "HPAK_AddLump: bad checksum for %s. Ignored\n", pResource->szFileName ); + Con_DPrintf( S_ERROR "%s: bad checksum for %s. Ignored\n", __func__, pResource->szFileName ); return; } @@ -279,7 +279,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource, if( !file_dst ) { - Con_DPrintf( S_ERROR "HPAK_AddLump: couldn't open %s.\n", srcname ); + Con_DPrintf( S_ERROR "%s: couldn't open %s.\n", __func__, srcname ); FS_Close( file_src ); return; } @@ -290,7 +290,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource, if( hash_pack_header.version != IDHPAK_VERSION ) { // we don't check the HPAK bit for some reason. - Con_DPrintf( S_ERROR "HPAK_AddLump: %s does not have a valid header.\n", srcname ); + Con_DPrintf( S_ERROR "%s: %s does not have a valid header.\n", __func__, srcname ); FS_Close( file_src ); FS_Close( file_dst ); return; @@ -305,7 +305,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource, if( srcpak.count < 1 || srcpak.count > HPAK_MAX_ENTRIES ) { - Con_DPrintf( S_ERROR "HPAK_AddLump: %s contain too many lumps.\n", srcname ); + Con_DPrintf( S_ERROR "%s: %s contain too many lumps.\n", __func__, srcname ); FS_Close( file_src ); FS_Close( file_dst ); return; @@ -414,7 +414,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de FS_Read( f, &hdr, sizeof( hdr )); if( hdr.ident != IDHPAKHEADER || hdr.version != IDHPAK_VERSION ) { - Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s does not have a valid HPAK header.\n", pakname ); + Con_DPrintf( S_ERROR "%s: %s does not have a valid HPAK header.\n", __func__, pakname ); FS_Close( f ); if( delete ) FS_Delete( pakname ); return false; @@ -425,7 +425,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de if( num_lumps < 1 || num_lumps > HPAK_MAX_ENTRIES ) { - Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s has too many lumps %u.\n", pakname, num_lumps ); + Con_DPrintf( S_ERROR "%s: %s has too many lumps %u.\n", __func__, pakname, num_lumps ); FS_Close( f ); if( delete ) FS_Delete( pakname ); return false; @@ -443,7 +443,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de if( dataDir[i].disksize < HPAK_ENTRY_MIN_SIZE || dataDir[i].disksize > HPAK_ENTRY_MAX_SIZE ) { // odd max size - Con_DPrintf( S_ERROR "HPAK_ValidatePak: lump %i has invalid size %s\n", i, Q_pretifymem( dataDir[i].disksize, 2 )); + Con_DPrintf( S_ERROR "%s: lump %i has invalid size %s\n", __func__, i, Q_pretifymem( dataDir[i].disksize, 2 )); Mem_Free( dataDir ); FS_Close( f ); if( delete ) FS_Delete( pakname ); @@ -471,7 +471,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de { if( quiet ) { - Con_DPrintf( S_ERROR "HPAK_ValidatePak: %s has invalid checksum.\n", pakname ); + Con_DPrintf( S_ERROR "%s: %s has invalid checksum.\n", __func__, pakname ); Mem_Free( dataPak ); Mem_Free( dataDir ); FS_Close( f ); @@ -712,7 +712,7 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte if( directory.count < 1 || directory.count > HPAK_MAX_ENTRIES ) { - Con_DPrintf( S_ERROR "HPAK_GetDataPointer: %s has too many lumps %u.\n", filename, directory.count ); + Con_DPrintf( S_ERROR "%s: %s has too many lumps %u.\n", __func__, filename, directory.count ); FS_Close( f ); return false; } diff --git a/engine/common/identification.c b/engine/common/identification.c index a7d6ff7f..c1e7cf0c 100644 --- a/engine/common/identification.c +++ b/engine/common/identification.c @@ -555,7 +555,7 @@ static uint ID_CheckRawId( bloomfilter_t filter ) } #endif #if 0 - Msg( "ID_CheckRawId: %d\n", count ); + Msg( "%s: %d\n", __func__, count ); #endif return count; } @@ -575,7 +575,7 @@ static void ID_Check( void ) { id = 0; #if 0 - Msg( "ID_Check(): fail %d\n", weight ); + Msg( "%s: fail %d\n", __func__, weight ); #endif return; } @@ -583,7 +583,7 @@ static void ID_Check( void ) if( ID_CheckRawId( id ) < mincount ) id = 0; #if 0 - Msg( "ID_Check(): success %d\n", weight ); + Msg( "%s: success %d\n", __func__, weight ); #endif } diff --git a/engine/common/imagelib/img_bmp.c b/engine/common/imagelib/img_bmp.c index 921bb1e4..ab13c85c 100644 --- a/engine/common/imagelib/img_bmp.c +++ b/engine/common/imagelib/img_bmp.c @@ -35,7 +35,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi if( filesize < sizeof( bhdr )) { - Con_Reportf( S_ERROR "Image_LoadBMP: %s have incorrect file size %li should be greater than %li (header)\n", name, filesize, sizeof( bhdr ) ); + Con_Reportf( S_ERROR "%s: %s have incorrect file size %li should be greater than %zu (header)\n", __func__, name, (long)filesize, sizeof( bhdr )); return false; } @@ -49,13 +49,13 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi if( memcmp( bhdr.id, "BM", 2 )) { - Con_DPrintf( S_ERROR "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: only Windows-style BMP files supported (%s)\n", __func__, name ); return false; } if(!( bhdr.bitmapHeaderSize == 40 || bhdr.bitmapHeaderSize == 108 || bhdr.bitmapHeaderSize == 124 )) { - Con_DPrintf( S_ERROR "Image_LoadBMP: %s have non-standard header size %i\n", name, bhdr.bitmapHeaderSize ); + Con_DPrintf( S_ERROR "%s: %s have non-standard header size %i\n", __func__, name, bhdr.bitmapHeaderSize ); return false; } @@ -63,7 +63,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi if( bhdr.fileSize != filesize ) { // Sweet Half-Life issues. splash.bmp have bogus filesize - Con_Reportf( S_WARN "Image_LoadBMP: %s have incorrect file size %li should be %i\n", name, filesize, bhdr.fileSize ); + Con_Reportf( S_WARN "%s: %s have incorrect file size %li should be %i\n", __func__, name, (long)filesize, bhdr.fileSize ); } // bogus compression? Only non-compressed supported. @@ -71,7 +71,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi { if( bhdr.bitsPerPixel != 32 || bhdr.compression != BI_BITFIELDS ) { - Con_DPrintf( S_ERROR "Image_LoadBMP: only uncompressed BMP files supported (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: only uncompressed BMP files supported (%s)\n", __func__, name ); return false; } } @@ -108,7 +108,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi estimatedSize = ( buf_p - buffer ) + cbPalBytes; if( filesize < estimatedSize ) { - Con_Reportf( S_ERROR "Image_LoadBMP: %s have incorrect file size %li should be greater than %li (palette)\n", name, filesize, estimatedSize ); + Con_Reportf( S_ERROR "%s: %s have incorrect file size %li should be greater than %li (palette)\n", __func__, name, (long)filesize, (long)estimatedSize ); return false; } @@ -186,7 +186,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi image.palette = NULL; } - Con_Reportf( S_ERROR "Image_LoadBMP: %s have incorrect file size %li should be greater than %li (pixels)\n", name, filesize, estimatedSize ); + Con_Reportf( S_ERROR "%s: %s have incorrect file size %li should be greater than %li (pixels)\n", __func__, name, (long)filesize, (long)estimatedSize ); return false; } diff --git a/engine/common/imagelib/img_dds.c b/engine/common/imagelib/img_dds.c index ad54143c..fa840345 100644 --- a/engine/common/imagelib/img_dds.c +++ b/engine/common/imagelib/img_dds.c @@ -261,7 +261,7 @@ static uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize ) if( filesize != buffsize ) // main check { - Con_DPrintf( S_WARN "Image_LoadDDS: (%s) probably corrupted (%zu should be %lu)\n", name, buffsize, filesize ); + Con_DPrintf( S_WARN "%s: (%s) probably corrupted (%zu should be %zu)\n", __func__, name, buffsize, filesize ); if( buffsize > filesize ) return false; } @@ -300,13 +300,13 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi if( header.dwSize != sizeof( header ) - sizeof( uint )) // size of the structure (minus MagicNum) { - Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) have corrupted header\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) have corrupted header\n", __func__, name ); return false; } if( header.dsPixelFormat.dwSize != sizeof( dds_pixf_t )) // size of the structure { - Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) have corrupt pixelformat header\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) have corrupt pixelformat header\n", __func__, name ); return false; } @@ -334,7 +334,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi if( image.type == PF_UNKNOWN ) { - Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) has unrecognized type\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) has unrecognized type\n", __func__, name ); return false; } diff --git a/engine/common/imagelib/img_ktx2.c b/engine/common/imagelib/img_ktx2.c index babd1f47..998d82b2 100644 --- a/engine/common/imagelib/img_ktx2.c +++ b/engine/common/imagelib/img_ktx2.c @@ -78,49 +78,49 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer if( image.type == PF_UNKNOWN ) { - Con_DPrintf( S_ERROR "%s: unsupported KTX2 format %d\n", __FUNCTION__, header->vkFormat ); + Con_DPrintf( S_ERROR "%s: unsupported KTX2 format %d\n", __func__, header->vkFormat ); return false; } if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ImageCompressed( image.type )) { - Con_DPrintf( S_WARN "%s: has compressed format, but support is not advertized\n", __FUNCTION__ ); + Con_DPrintf( S_WARN "%s: has compressed format, but support is not advertized\n", __func__ ); return false; } if( header->levelCount == 0 ) { - Con_DPrintf( S_ERROR "%s: file has no mip levels\n", __FUNCTION__ ); + Con_DPrintf( S_ERROR "%s: file has no mip levels\n", __func__ ); return false; } if( header->pixelDepth > 1 ) { - Con_DPrintf( S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __FUNCTION__, header->pixelDepth ); + Con_DPrintf( S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __func__, header->pixelDepth ); return false; } if( header->faceCount > 1 ) { - Con_DPrintf( S_ERROR "%s: unsupported KTX2 faceCount %d\n", __FUNCTION__, header->faceCount ); + Con_DPrintf( S_ERROR "%s: unsupported KTX2 faceCount %d\n", __func__, header->faceCount ); return false; } if( header->layerCount > 1 ) { - Con_DPrintf( S_ERROR "%s: unsupported KTX2 layerCount %d\n", __FUNCTION__, header->layerCount ); + Con_DPrintf( S_ERROR "%s: unsupported KTX2 layerCount %d\n", __func__, header->layerCount ); return false; } if( header->supercompressionScheme != 0 ) { - Con_DPrintf( S_ERROR "%s: unsupported KTX2 supercompressionScheme %d\n", __FUNCTION__, header->supercompressionScheme ); + Con_DPrintf( S_ERROR "%s: unsupported KTX2 supercompressionScheme %d\n", __func__, header->supercompressionScheme ); return false; } if( header->levelCount * sizeof( ktx2_level_t ) + KTX2_LEVELS_OFFSET > filesize ) { - Con_DPrintf( S_ERROR "%s: file abruptly ends\n", __FUNCTION__ ); + Con_DPrintf( S_ERROR "%s: file abruptly ends\n", __func__ ); return false; } @@ -138,7 +138,7 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer if( mip_size != level.byteLength ) { Con_DPrintf( S_ERROR "%s: mip=%d size mismatch read=%d, but computed=%d\n", - __FUNCTION__, mip, (int)level.byteLength, mip_size ); + __func__, mip, (int)level.byteLength, mip_size ); return false; } @@ -175,7 +175,7 @@ qboolean Image_LoadKTX2( const char *name, const byte *buffer, fs_offset_t files if( memcmp( buffer, KTX2_IDENTIFIER, KTX2_IDENTIFIER_SIZE ) != 0 ) { - Con_DPrintf( S_ERROR "%s: (%s) has invalid identifier\n", __FUNCTION__, name ); + Con_DPrintf( S_ERROR "%s: (%s) has invalid identifier\n", __func__, name ); return false; } @@ -196,7 +196,7 @@ qboolean Image_LoadKTX2( const char *name, const byte *buffer, fs_offset_t files // If KTX2 to imagelib conversion failed, try passing the file as raw data. // This is useful for ref_vk which can directly support hundreds of formats which we don't convert to pixformat_t here - Con_DPrintf( S_WARN "%s: (%s) could not be converted to supported imagelib format, passing as raw KTX2 data\n", __FUNCTION__, name ); + Con_DPrintf( S_WARN "%s: (%s) could not be converted to supported imagelib format, passing as raw KTX2 data\n", __func__, name ); // This is a catch-all for ref_vk, which can do this format directly and natively image.type = PF_KTX2_RAW; diff --git a/engine/common/imagelib/img_main.c b/engine/common/imagelib/img_main.c index 4fe937cb..83d9be17 100644 --- a/engine/common/imagelib/img_main.c +++ b/engine/common/imagelib/img_main.c @@ -360,7 +360,7 @@ load_internal: } if( loadname[0] != '#' ) - Con_Reportf( S_WARN "FS_LoadImage: couldn't load \"%s\"\n", loadname ); + Con_Reportf( S_WARN "%s: couldn't load \"%s\"\n", __func__, loadname ); // clear any force flags image.force_flags = 0; diff --git a/engine/common/imagelib/img_png.c b/engine/common/imagelib/img_png.c index 2a4c742d..21ebdf11 100644 --- a/engine/common/imagelib/img_png.c +++ b/engine/common/imagelib/img_png.c @@ -63,7 +63,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi // check png signature if( memcmp( png_hdr.sign, png_sign, sizeof( png_sign ) ) ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Invalid PNG signature (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: Invalid PNG signature (%s)\n", __func__, name ); return false; } @@ -73,14 +73,14 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi // check IHDR chunk length (valid value - 13) if( png_hdr.ihdr_len != sizeof( png_ihdr_t ) ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Invalid IHDR chunk size %u (%s)\n", png_hdr.ihdr_len, name ); + Con_DPrintf( S_ERROR "%s: Invalid IHDR chunk size %u (%s)\n", __func__, png_hdr.ihdr_len, name ); return false; } // check IHDR chunk signature if( memcmp( png_hdr.ihdr_sign, ihdr_sign, sizeof( ihdr_sign ) ) ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: IHDR chunk corrupted (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: IHDR chunk corrupted (%s)\n", __func__, name ); return false; } @@ -90,7 +90,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi if( png_hdr.ihdr_chunk.height == 0 || png_hdr.ihdr_chunk.width == 0 ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Invalid image size %ux%u (%s)\n", png_hdr.ihdr_chunk.width, png_hdr.ihdr_chunk.height, name ); + Con_DPrintf( S_ERROR "%s: Invalid image size %ux%u (%s)\n", __func__, png_hdr.ihdr_chunk.width, png_hdr.ihdr_chunk.height, name ); return false; } @@ -99,7 +99,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi if( png_hdr.ihdr_chunk.bitdepth != 8 ) { - Con_DPrintf( S_WARN "Image_LoadPNG: Only 8-bit images is supported (%s)\n", name ); + Con_DPrintf( S_WARN "%s: Only 8-bit images is supported (%s)\n", __func__, name ); return false; } @@ -109,31 +109,31 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi || png_hdr.ihdr_chunk.colortype == PNG_CT_ALPHA || png_hdr.ihdr_chunk.colortype == PNG_CT_PALLETE ) ) { - Con_DPrintf( S_WARN "Image_LoadPNG: Unknown color type %u (%s)\n", png_hdr.ihdr_chunk.colortype, name ); + Con_DPrintf( S_WARN "%s: Unknown color type %u (%s)\n", __func__, png_hdr.ihdr_chunk.colortype, name ); return false; } if( png_hdr.ihdr_chunk.compression > 0 ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Unknown compression method %u (%s)\n", png_hdr.ihdr_chunk.compression, name ); + Con_DPrintf( S_ERROR "%s: Unknown compression method %u (%s)\n", __func__, png_hdr.ihdr_chunk.compression, name ); return false; } if( png_hdr.ihdr_chunk.filter > 0 ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Unknown filter type %u (%s)\n", png_hdr.ihdr_chunk.filter, name ); + Con_DPrintf( S_ERROR "%s: Unknown filter type %u (%s)\n", __func__, png_hdr.ihdr_chunk.filter, name ); return false; } if( png_hdr.ihdr_chunk.interlace == 1 ) { - Con_DPrintf( S_WARN "Image_LoadPNG: Adam7 Interlacing not supported (%s)\n", name ); + Con_DPrintf( S_WARN "%s: Adam7 Interlacing not supported (%s)\n", __func__, name ); return false; } if( png_hdr.ihdr_chunk.interlace > 0 ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Unknown interlacing type %u (%s)\n", png_hdr.ihdr_chunk.interlace, name ); + Con_DPrintf( S_ERROR "%s: Unknown interlacing type %u (%s)\n", __func__, png_hdr.ihdr_chunk.interlace, name ); return false; } @@ -145,7 +145,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi // check IHDR chunk CRC if( ntohl( png_hdr.ihdr_crc32 ) != crc32_check ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: IHDR chunk has wrong CRC32 sum (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: IHDR chunk has wrong CRC32 sum (%s)\n", __func__, name ); return false; } @@ -163,14 +163,14 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi if( chunk_len > INT_MAX ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Found chunk with wrong size (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: Found chunk with wrong size (%s)\n", __func__, name ); if( idat_buf ) Mem_Free( idat_buf ); return false; } if( chunk_len > filesize - ( buf_p - buffer )) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Found chunk with size past file size (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: Found chunk with size past file size (%s)\n", __func__, name ); if( idat_buf ) Mem_Free( idat_buf ); return false; } @@ -216,7 +216,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi // check chunk CRC if( ntohl( crc32 ) != crc32_check ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Found chunk with wrong CRC32 sum (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: Found chunk with wrong CRC32 sum (%s)\n", __func__, name ); if( idat_buf ) Mem_Free( idat_buf ); return false; } @@ -227,27 +227,27 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi if( oldsize == 0 ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: Couldn't find IDAT chunks (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: Couldn't find IDAT chunks (%s)\n", __func__, name ); return false; } if( png_hdr.ihdr_chunk.colortype == PNG_CT_PALLETE && !pallete ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: PLTE chunk not found (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: PLTE chunk not found (%s)\n", __func__, name ); Mem_Free( idat_buf ); return false; } if( !has_iend_chunk ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: IEND chunk not found (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: IEND chunk not found (%s)\n", __func__, name ); Mem_Free( idat_buf ); return false; } if( chunk_len != 0 ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: IEND chunk has wrong size %u (%s)\n", chunk_len, name ); + Con_DPrintf( S_ERROR "%s: IEND chunk has wrong size %u (%s)\n", __func__, chunk_len, name ); Mem_Free( idat_buf ); return false; } @@ -298,7 +298,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi // uncompress image if( inflateInit2( &stream, MAX_WBITS ) != Z_OK ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: IDAT chunk decompression failed (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: IDAT chunk decompression failed (%s)\n", __func__, name ); Mem_Free( uncompressed_buffer ); Mem_Free( idat_buf ); return false; @@ -311,7 +311,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi if( ret != Z_OK && ret != Z_STREAM_END ) { - Con_DPrintf( S_ERROR "Image_LoadPNG: IDAT chunk decompression failed (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: IDAT chunk decompression failed (%s)\n", __func__, name ); Mem_Free( uncompressed_buffer ); return false; } @@ -351,7 +351,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi pixbuf[i] = raw[i] + ( pixbuf[i - pixel_size] >> 1 ); break; default: - Con_DPrintf( S_ERROR "Image_LoadPNG: Found unknown filter type (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: Found unknown filter type (%s)\n", __func__, name ); Mem_Free( uncompressed_buffer ); Mem_Free( image.rgba ); return false; @@ -415,7 +415,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi } break; default: - Con_DPrintf( S_ERROR "Image_LoadPNG: Found unknown filter type (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: Found unknown filter type (%s)\n", __func__, name ); Mem_Free( uncompressed_buffer ); Mem_Free( image.rgba ); return false; @@ -650,7 +650,7 @@ qboolean Image_SavePNG( const char *name, rgbdata_t *pix ) // compress image if( deflateInit( &stream, Z_BEST_COMPRESSION ) != Z_OK ) { - Con_DPrintf( S_ERROR "Image_SavePNG: deflateInit failed (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: deflateInit failed (%s)\n", __func__, name ); Mem_Free( filtered_buffer ); Mem_Free( buffer ); return false; @@ -663,7 +663,7 @@ qboolean Image_SavePNG( const char *name, rgbdata_t *pix ) if( ret != Z_OK && ret != Z_STREAM_END ) { - Con_DPrintf( S_ERROR "Image_SavePNG: IDAT chunk compression failed (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: IDAT chunk compression failed (%s)\n", __func__, name ); Mem_Free( buffer ); return false; } diff --git a/engine/common/imagelib/img_tga.c b/engine/common/imagelib/img_tga.c index d675147d..fb622e95 100644 --- a/engine/common/imagelib/img_tga.c +++ b/engine/common/imagelib/img_tga.c @@ -62,17 +62,17 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi // uncompressed colormapped image if( targa_header.pixel_size != 8 ) { - Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit images supported for type 1 and 9\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) Only 8 bit images supported for type 1 and 9\n", __func__, name ); return false; } if( targa_header.colormap_length != 256 ) { - Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit colormaps are supported for type 1 and 9\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) Only 8 bit colormaps are supported for type 1 and 9\n", __func__, name ); return false; } if( targa_header.colormap_index ) { - Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) colormap_index is not supported for type 1 and 9\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) colormap_index is not supported for type 1 and 9\n", __func__, name ); return false; } if( targa_header.colormap_size == 24 ) @@ -97,7 +97,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi } else { - Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) only 24 and 32 bit colormaps are supported for type 1 and 9\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) only 24 and 32 bit colormaps are supported for type 1 and 9\n", __func__, name ); return false; } } @@ -106,7 +106,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi // uncompressed or RLE compressed RGB if( targa_header.pixel_size != 32 && targa_header.pixel_size != 24 ) { - Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 32 or 24 bit images supported for type 2 and 10\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) Only 32 or 24 bit images supported for type 2 and 10\n", __func__, name ); return false; } } @@ -115,7 +115,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi // uncompressed greyscale if( targa_header.pixel_size != 8 && targa_header.pixel_size != 16 ) { - Con_DPrintf( S_ERROR "Image_LoadTGA: (%s) Only 8 bit images supported for type 3 and 11\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) Only 8 bit images supported for type 3 and 11\n", __func__, name ); return false; } } diff --git a/engine/common/imagelib/img_utils.c b/engine/common/imagelib/img_utils.c index 6efa97f0..1da2dccc 100644 --- a/engine/common/imagelib/img_utils.c +++ b/engine/common/imagelib/img_utils.c @@ -1179,7 +1179,7 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t return image.tempbuffer; } -static byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int flags ) +static byte *Image_MakeLuma( byte *fin, int width, int height, int type, int flags ) { byte *out; int i; @@ -1197,7 +1197,7 @@ static byte *Image_CreateLumaInternal( byte *fin, int width, int height, int typ break; default: // another formats does ugly result :( - Con_Printf( S_ERROR "Image_MakeLuma: unsupported format %s\n", PFDesc[type].name ); + Con_Printf( S_ERROR "%s: unsupported format %s\n", __func__, PFDesc[type].name ); return (byte *)fin; } @@ -1396,7 +1396,7 @@ qboolean Image_Process(rgbdata_t **pix, int width, int height, uint flags, float if( FBitSet( flags, IMAGE_MAKE_LUMA )) { - out = Image_CreateLumaInternal( pic->buffer, pic->width, pic->height, pic->type, pic->flags ); + out = Image_MakeLuma( pic->buffer, pic->width, pic->height, pic->type, pic->flags ); if( pic->buffer != out ) memcpy( pic->buffer, image.tempbuffer, pic->size ); ClearBits( pic->flags, IMAGE_HAS_LUMA ); } diff --git a/engine/common/imagelib/img_wad.c b/engine/common/imagelib/img_wad.c index 37412106..42269187 100644 --- a/engine/common/imagelib/img_wad.c +++ b/engine/common/imagelib/img_wad.c @@ -31,7 +31,7 @@ qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesi if( filesize != 768 ) { - Con_DPrintf( S_ERROR "Image_LoadPAL: (%s) have invalid size (%ld should be %d)\n", name, filesize, 768 ); + Con_DPrintf( S_ERROR "%s: (%s) have invalid size (%li should be %d)\n", __func__, name, (long)filesize, 768 ); return false; } diff --git a/engine/common/lib_common.c b/engine/common/lib_common.c index b38508ed..7c4fb8aa 100644 --- a/engine/common/lib_common.c +++ b/engine/common/lib_common.c @@ -81,8 +81,8 @@ void *COM_FunctionFromName_SR( void *hInstance, const char *pName ) const char *COM_OffsetNameForFunction( void *function ) { static string sname; - Q_snprintf( sname, MAX_STRING, "ofs:%lu", (size_t)((byte*)function - (byte*)svgame.dllFuncs.pfnGameInit) ); - Con_Reportf( "COM_OffsetNameForFunction %s\n", sname ); + Q_snprintf( sname, MAX_STRING, "ofs:%zu", ((byte*)function - (byte*)svgame.dllFuncs.pfnGameInit) ); + Con_Reportf( "%s: %s\n", __func__, sname ); return sname; } @@ -359,7 +359,7 @@ static char *COM_GetItaniumName( const char * const in_name ) if( i == MAX_NESTED_NAMESPACES ) { - Con_DPrintf( "%s: too much nested namespaces: %s\n", __FUNCTION__, in_name ); + Con_DPrintf( "%s: too much nested namespaces: %s\n", __func__, in_name ); return NULL; } @@ -373,7 +373,7 @@ static char *COM_GetItaniumName( const char * const in_name ) return out_name; invalid_format: - Con_DPrintf( "%s: invalid format: %s\n", __FUNCTION__, in_name ); + Con_DPrintf( "%s: invalid format: %s\n", __func__, in_name ); return NULL; } @@ -421,7 +421,7 @@ char **COM_ConvertToLocalPlatform( EFunctionMangleType to, const char *from, siz if( i == MAX_NESTED_NAMESPACES ) { - Con_DPrintf( "%s: too much nested namespaces: %s\n", __FUNCTION__, from ); + Con_DPrintf( "%s: too much nested namespaces: %s\n", __func__, from ); return NULL; } diff --git a/engine/common/masterlist.c b/engine/common/masterlist.c index 8df6cc51..7225a6ff 100644 --- a/engine/common/masterlist.c +++ b/engine/common/masterlist.c @@ -389,7 +389,7 @@ void NET_SaveMasters( void ) if( !f ) { - Con_Reportf( S_ERROR "Couldn't write xashcomm.lst\n" ); + Con_Reportf( S_ERROR "Couldn't write xashcomm.lst\n" ); return; } diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index 9af9843e..a1bea8c9 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -313,7 +313,7 @@ static qboolean Mod_NameImpliesTextureIsAnimated( texture_t *tex ) if( !( tex->name[1] >= '0' && tex->name[1] <= '9' ) && !( tex->name[1] >= 'a' && tex->name[1] <= 'j' )) { - Con_Printf( S_ERROR "Mod_NameImpliesTextureIsAnimated: animating texture \"%s\" has invalid name\n", tex->name ); + Con_Printf( S_ERROR "%s: animating texture \"%s\" has invalid name\n", __func__, tex->name ); return false; } @@ -942,7 +942,7 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL ) { if( token[0] != '{' ) - Host_Error( "Mod_FindModelOrigin: found %s when expecting {\n", token ); + Host_Error( "%s: found %s when expecting {\n", __func__, token ); model_found = origin_found = false; VectorClear( origin ); @@ -951,17 +951,17 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve { // parse key if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL ) - Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" ); + Host_Error( "%s: EOF without closing brace\n", __func__ ); if( token[0] == '}' ) break; // end of desc Q_strncpy( keyname, token, sizeof( keyname )); // parse value if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL ) - Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" ); + Host_Error( "%s: EOF without closing brace\n", __func__ ); if( token[0] == '}' ) - Host_Error( "Mod_FindModelOrigin: closing brace without data\n" ); + Host_Error( "%s: closing brace without data\n", __func__ ); if( !Q_stricmp( keyname, "model" ) && !Q_stricmp( modelname, token )) model_found = true; @@ -1198,7 +1198,7 @@ static void Mod_CalcSurfaceExtents( model_t *mod, msurface_t *surf ) e = mod->surfedges[surf->firstedge + i]; if( e >= mod->numedges || e <= -mod->numedges ) - Host_Error( "Mod_CalcSurfaceExtents: bad edge\n" ); + Host_Error( "%s: bad edge\n", __func__ ); if( e >= 0 ) v = &mod->vertexes[mod->edges[e].v[0]]; else v = &mod->vertexes[mod->edges[-e].v[1]]; @@ -1267,7 +1267,7 @@ static void Mod_CalcSurfaceBounds( model_t *mod, msurface_t *surf ) e = mod->surfedges[surf->firstedge + i]; if( e >= mod->numedges || e <= -mod->numedges ) - Host_Error( "Mod_CalcSurfaceBounds: bad edge\n" ); + Host_Error( "%s: bad edge\n", __func__ ); if( e >= 0 ) v = &mod->vertexes[mod->edges[e].v[0]]; else v = &mod->vertexes[mod->edges[-e].v[1]]; @@ -1491,7 +1491,7 @@ static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, poolhandle_t mempool VectorCopy( host.player_maxs[1], hull->clip_maxs ); break; default: - Host_Error( "Mod_SetupHull: bad hull number %i\n", hullnum ); + Host_Error( "%s: bad hull number %i\n", __func__, hullnum ); break; } @@ -1841,23 +1841,23 @@ static void Mod_LoadEntities( model_t *mod, dbspmodel_t *bmod ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL ) { if( token[0] != '{' ) - Host_Error( "Mod_LoadEntities: found %s when expecting {\n", token ); + Host_Error( "%s: found %s when expecting {\n", __func__, token ); while( 1 ) { // parse key if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL ) - Host_Error( "Mod_LoadEntities: EOF without closing brace\n" ); + Host_Error( "%s: EOF without closing brace\n", __func__ ); if( token[0] == '}' ) break; // end of desc Q_strncpy( keyname, token, sizeof( keyname )); // parse value if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL ) - Host_Error( "Mod_LoadEntities: EOF without closing brace\n" ); + Host_Error( "%s: EOF without closing brace\n", __func__ ); if( token[0] == '}' ) - Host_Error( "Mod_LoadEntities: closing brace without data\n" ); + Host_Error( "%s: closing brace without data\n", __func__ ); if( !Q_stricmp( keyname, "wad" )) { @@ -2035,7 +2035,7 @@ static void Mod_LoadMarkSurfaces( model_t *mod, dbspmodel_t *bmod ) for( i = 0; i < bmod->nummarkfaces; i++, in++ ) { if( *in < 0 || *in >= mod->numsurfaces ) - Host_Error( "Mod_LoadMarkFaces: bad surface number in '%s'\n", mod->name ); + Host_Error( "%s: bad surface number in '%s'\n", __func__, mod->name ); out[i] = mod->surfaces + *in; } } @@ -2046,7 +2046,7 @@ static void Mod_LoadMarkSurfaces( model_t *mod, dbspmodel_t *bmod ) for( i = 0; i < bmod->nummarkfaces; i++, in++ ) { if( *in < 0 || *in >= mod->numsurfaces ) - Host_Error( "Mod_LoadMarkFaces: bad surface number in '%s'\n", mod->name ); + Host_Error( "%s: bad surface number in '%s'\n", __func__, mod->name ); out[i] = mod->surfaces + *in; } } @@ -2166,7 +2166,7 @@ static void Mod_InitSkyClouds( model_t *mod, mip_t *mt, texture_t *tx, qboolean if( !r_sky || !r_sky->palette || r_sky->type != PF_INDEXED_32 || r_sky->height == 0 ) { - Con_Printf( S_ERROR "%s: unable to load sky texture %s\n", tx->name ); + Con_Printf( S_ERROR "%s: unable to load sky texture %s\n", __func__, tx->name ); if( r_sky ) FS_FreeImage( r_sky ); @@ -2520,7 +2520,8 @@ static void Mod_SequenceAnimatedTexture( model_t *mod, int baseTextureIndex ) if( !tex ) { - Con_Printf( S_ERROR "Mod_SequenceAnimatedTexture: missing frame %i of animated texture \"%s\"\n", + Con_Printf( S_ERROR "%s: missing frame %i of animated texture \"%s\"\n", + __func__, candidateIndex, baseTexture->name ); @@ -2544,7 +2545,8 @@ static void Mod_SequenceAnimatedTexture( model_t *mod, int baseTextureIndex ) if( !tex ) { - Con_Printf( S_ERROR "Mod_SequenceAnimatedTexture: missing alternate frame %i of animated texture \"%s\"\n", + Con_Printf( S_ERROR "%s: missing alternate frame %i of animated texture \"%s\"\n", + __func__, candidateIndex, baseTexture->name ); @@ -2959,7 +2961,7 @@ static void Mod_LoadLeafs( model_t *mod, dbspmodel_t *bmod ) } if( bmod->isworld && mod->leafs[0].contents != CONTENTS_SOLID ) - Host_Error( "Mod_LoadLeafs: Map %s has leaf 0 is not CONTENTS_SOLID\n", mod->name ); + Host_Error( "%s: Map %s has leaf 0 is not CONTENTS_SOLID\n", __func__, mod->name ); // do some final things for world if( bmod->isworld && Mod_CheckWaterAlphaSupport( mod, bmod )) @@ -3180,7 +3182,7 @@ static void Mod_LoadLightVecs( model_t *mod, dbspmodel_t *bmod ) if( bmod->deluxdatasize != bmod->lightdatasize ) { if( bmod->deluxdatasize > 0 ) - Con_Printf( S_ERROR "Mod_LoadLightVecs: has mismatched size (%zu should be %zu)\n", bmod->deluxdatasize, bmod->lightdatasize ); + Con_Printf( S_ERROR "%s: has mismatched size (%zu should be %zu)\n", __func__, bmod->deluxdatasize, bmod->lightdatasize ); else Mod_LoadDeluxemap( mod, bmod ); // old method return; } @@ -3199,7 +3201,7 @@ static void Mod_LoadShadowmap( model_t *mod, dbspmodel_t *bmod ) if( bmod->shadowdatasize != ( bmod->lightdatasize / 3 )) { if( bmod->shadowdatasize > 0 ) - Con_Printf( S_ERROR "Mod_LoadShadowmap: has mismatched size (%zu should be %zu)\n", bmod->shadowdatasize, bmod->lightdatasize / 3 ); + Con_Printf( S_ERROR "%s: has mismatched size (%zu should be %zu)\n", __func__, bmod->shadowdatasize, bmod->lightdatasize / 3 ); return; } @@ -3241,7 +3243,7 @@ static void Mod_LoadLighting( model_t *mod, dbspmodel_t *bmod ) SetBits( mod->flags, MODEL_COLORED_LIGHTING ); break; default: - Host_Error( "Mod_LoadLighting: bad lightmap sample count %i\n", bmod->lightmap_samples ); + Host_Error( "%s: bad lightmap sample count %i\n", __func__, bmod->lightmap_samples ); break; } @@ -3560,13 +3562,13 @@ qboolean Mod_TestBmodelLumps( file_t *f, const char *name, const byte *mod_base, if( loadstat.numerrors ) { if( !FBitSet( flags, LUMP_SILENT )) - Con_Printf( "Mod_LoadWorld: %i error(s), %i warning(s)\n", loadstat.numerrors, loadstat.numwarnings ); + Con_Printf( "%s: %i error(s), %i warning(s)\n", __func__, loadstat.numerrors, loadstat.numwarnings ); return false; // there were errors, we can't load this map } else if( loadstat.numwarnings ) { if( !FBitSet( flags, LUMP_SILENT )) - Con_Printf( "Mod_LoadWorld: %i warning(s)\n", loadstat.numwarnings ); + Con_Printf( "%s: %i warning(s)\n", __func__, loadstat.numwarnings ); } return true; diff --git a/engine/common/mod_studio.c b/engine/common/mod_studio.c index 382ce370..7b1d55ed 100644 --- a/engine/common/mod_studio.c +++ b/engine/common/mod_studio.c @@ -436,8 +436,8 @@ void *R_StudioGetAnim( studiohdr_t *m_pStudioHeader, model_t *m_pSubModel, mstud Q_snprintf( filepath, sizeof( filepath ), "%s/%s%i%i.mdl", modelpath, modelname, pseqdesc->seqgroup / 10, pseqdesc->seqgroup % 10 ); buf = FS_LoadFile( filepath, &filesize, false ); - if( !buf || !filesize ) Host_Error( "StudioGetAnim: can't load %s\n", filepath ); - if( IDSEQGRPHEADER != *(uint *)buf ) Host_Error( "StudioGetAnim: %s is corrupted\n", filepath ); + if( !buf || !filesize ) Host_Error( "%s: can't load %s\n", __func__, filepath ); + if( IDSEQGRPHEADER != *(uint *)buf ) Host_Error( "%s: %s is corrupted\n", __func__, filepath ); Con_Printf( "loading: %s\n", filepath ); @@ -482,7 +482,7 @@ static void SV_StudioSetupBones( model_t *pModel, float frame, int sequence, con { // only show warn if sequence that out of range was specified intentionally if( sequence > mod_studiohdr->numseq ) - Con_Reportf( S_WARN "SV_StudioSetupBones: sequence %i/%i out of range for model %s\n", sequence, mod_studiohdr->numseq, pModel->name ); + Con_Reportf( S_WARN "%s: sequence %i/%i out of range for model %s\n", __func__, sequence, mod_studiohdr->numseq, pModel->name ); sequence = 0; } @@ -994,7 +994,7 @@ void Mod_InitStudioAPI( void ) pBlendIface = (STUDIOAPI)COM_GetProcAddress( svgame.hInstance, "Server_GetBlendingInterface" ); if( pBlendIface && pBlendIface( SV_BLENDING_INTERFACE_VERSION, &pBlendAPI, &gStudioAPI, &studio_transform, &studio_bones )) { - Con_Reportf( "SV_LoadProgs: ^2initailized Server Blending interface ^7ver. %i\n", SV_BLENDING_INTERFACE_VERSION ); + Con_Reportf( "%s: ^2initailized Server Blending interface ^7ver. %i\n", __func__, SV_BLENDING_INTERFACE_VERSION ); return; } diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 5723acca..0217cd7a 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -131,7 +131,7 @@ qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *l LittleLongSW(packet->part); p = &ns->packets[packet->id & NETSPLIT_BACKUP_MASK]; - // Con_Reportf( S_NOTE "NetSplit_GetLong: packet from %s, id %d, index %d length %d\n", NET_AdrToString( *from ), (int)packet->id, (int)packet->index, (int)*length ); + // Con_Reportf( S_NOTE "%s: packet from %s, id %d, index %d length %d\n", __func__, NET_AdrToString( *from ), (int)packet->id, (int)packet->index, (int)*length ); // no packets with this id received if( packet->id != p->id ) @@ -140,7 +140,7 @@ qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *l if( p->received < p->count ) { UI_ShowConnectionWarning(); - Con_Reportf( S_WARN "NetSplit_GetLong: lost packet %d\n", p->id ); + Con_Reportf( S_WARN "%s: lost packet %d\n", __func__, p->id ); } p->id = packet->id; @@ -152,7 +152,7 @@ qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *l // use bool vector to detect dup packets if( p->recieved_v[packet->index >> 5 ] & ( 1 << ( packet->index & 31 ) ) ) { - Con_Reportf( S_WARN "NetSplit_GetLong: dup packet from %s\n", NET_AdrToString( *from ) ); + Con_Reportf( S_WARN "%s: dup packet from %s\n", __func__, NET_AdrToString( *from ) ); return false; } @@ -164,13 +164,13 @@ qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *l // prevent overflow if( packet->part * packet->index > NET_MAX_PAYLOAD ) { - Con_Reportf( S_WARN "NetSplit_GetLong: packet out fo bounds from %s (part %d index %d)\n", NET_AdrToString( *from ), packet->part, packet->index ); + Con_Reportf( S_WARN "%s: packet out fo bounds from %s (part %d index %d)\n", __func__, NET_AdrToString( *from ), packet->part, packet->index ); return false; } if( packet->length > NET_MAX_PAYLOAD ) { - Con_Reportf( S_WARN "NetSplit_GetLong: packet out fo bounds from %s (length %d)\n", NET_AdrToString( *from ), packet->length ); + Con_Reportf( S_WARN "%s: packet out fo bounds from %s (length %d)\n", __func__, NET_AdrToString( *from ), packet->length ); return false; } @@ -187,7 +187,7 @@ qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *l ns->total_received_uncompressed += len; *length = len; - // Con_Reportf( S_NOTE "NetSplit_GetLong: packet from %s, id %d received %d length %d\n", NET_AdrToString( *from ), (int)packet->id, (int)p->received, (int)packet->length ); + // Con_Reportf( S_NOTE "%s: packet from %s, id %d received %d length %d\n", __func__, NET_AdrToString( *from ), (int)packet->id, (int)p->received, (int)packet->length ); memcpy( data, p->data, len ); return true; } @@ -1624,7 +1624,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data ) if( (( MSG_GetNumBytesWritten( &send ) + length ) >> 3) <= maxsize ) MSG_WriteBits( &send, data, length ); - else Con_Printf( S_WARN "Netchan_Transmit: unreliable message overflow: %d\n", MSG_GetNumBytesWritten( &send ) ); + else Con_Printf( S_WARN "%s: unreliable message overflow: %d\n", __func__, MSG_GetNumBytesWritten( &send ) ); } // deal with packets that are too small for some networks diff --git a/engine/common/net_encode.c b/engine/common/net_encode.c index df2ca1fc..4459d870 100644 --- a/engine/common/net_encode.c +++ b/engine/common/net_encode.c @@ -510,13 +510,13 @@ static qboolean Delta_AddField( delta_info_t *dt, const char *pName, int flags, pFieldInfo = Delta_FindFieldInfo( dt->pInfo, pName ); if( !pFieldInfo ) { - Con_DPrintf( S_ERROR "Delta_Add: couldn't find description for %s->%s\n", dt->pName, pName ); + Con_DPrintf( S_ERROR "%s: couldn't find description for %s->%s\n", __func__, dt->pName, pName ); return false; } if( dt->numFields + 1 > dt->maxFields ) { - Con_DPrintf( S_WARN "Delta_Add: can't add %s->%s encoder list is full\n", dt->pName, pName ); + Con_DPrintf( S_WARN "%s: can't add %s->%s encoder list is full\n", __func__, dt->pName, pName ); return false; // too many fields specified (duplicated ?) } @@ -587,7 +587,7 @@ void Delta_ParseTableField( sizebuf_t *msg ) tableIndex = MSG_ReadUBitLong( msg, 4 ); dt = Delta_FindStructByIndex( tableIndex ); if( !dt ) - Host_Error( "Delta_ParseTableField: not initialized" ); + Host_Error( "%s: not initialized", __func__ ); nameIndex = MSG_ReadUBitLong( msg, 8 ); // read field name index if( ( nameIndex >= 0 && nameIndex < dt->maxFields ) ) @@ -597,7 +597,7 @@ void Delta_ParseTableField( sizebuf_t *msg ) else { ignore = true; - Con_Reportf( "Delta_ParseTableField: wrong nameIndex %d for table %s, ignoring\n", nameIndex, dt->pName ); + Con_Reportf( "%s: wrong nameIndex %d for table %s, ignoring\n", __func__, nameIndex, dt->pName ); } flags = MSG_ReadUBitLong( msg, 10 ); @@ -630,28 +630,28 @@ static qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInf *delta_script = COM_ParseFile( *delta_script, token, sizeof( token )); if( Q_strcmp( token, "(" )) { - Con_DPrintf( S_ERROR "Delta_ParseField: expected '(', found '%s' instead\n", token ); + Con_DPrintf( S_ERROR "%s: expected '(', found '%s' instead\n", __func__, token ); return false; } // read the variable name if(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) == NULL ) { - Con_DPrintf( S_ERROR "Delta_ParseField: missing field name\n" ); + Con_DPrintf( S_ERROR "%s: missing field name\n", __func__ ); return false; } pFieldInfo = Delta_FindFieldInfo( pInfo, token ); if( !pFieldInfo ) { - Con_DPrintf( S_ERROR "Delta_ParseField: unable to find field %s\n", token ); + Con_DPrintf( S_ERROR "%s: unable to find field %s\n", __func__, token ); return false; } *delta_script = COM_ParseFile( *delta_script, token, sizeof( token )); if( Q_strcmp( token, "," )) { - Con_DPrintf( S_ERROR "Delta_ParseField: expected ',', found '%s' instead\n", token ); + Con_DPrintf( S_ERROR "%s: expected ',', found '%s' instead\n", __func__, token ); return false; } @@ -692,14 +692,14 @@ static qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInf if( Q_strcmp( token, "," )) { - Con_DPrintf( S_ERROR "Delta_ParseField: expected ',', found '%s' instead\n", token ); + Con_DPrintf( S_ERROR "%s: expected ',', found '%s' instead\n", __func__, token ); return false; } // read delta-bits if(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) == NULL ) { - Con_DPrintf( S_ERROR "Delta_ParseField: %s field bits argument is missing\n", pField->name ); + Con_DPrintf( S_ERROR "%s: %s field bits argument is missing\n", __func__, pField->name ); return false; } @@ -708,14 +708,14 @@ static qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInf *delta_script = COM_ParseFile( *delta_script, token, sizeof( token )); if( Q_strcmp( token, "," )) { - Con_DPrintf( S_ERROR "Delta_ParseField: expected ',', found '%s' instead\n", token ); + Con_DPrintf( S_ERROR "%s: expected ',', found '%s' instead\n", __func__, token ); return false; } // read delta-multiplier if(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) == NULL ) { - Con_DPrintf( S_ERROR "Delta_ParseField: %s missing 'multiplier' argument\n", pField->name ); + Con_DPrintf( S_ERROR "%s: %s missing 'multiplier' argument\n", __func__, pField->name ); return false; } @@ -726,14 +726,14 @@ static qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInf *delta_script = COM_ParseFile( *delta_script, token, sizeof( token )); if( Q_strcmp( token, "," )) { - Con_DPrintf( S_ERROR "Delta_ParseField: expected ',', found '%s' instead\n", token ); + Con_DPrintf( S_ERROR "%s: expected ',', found '%s' instead\n", __func__, token ); return false; } // read delta-postmultiplier if(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) == NULL ) { - Con_DPrintf( S_ERROR "Delta_ParseField: %s missing 'post_multiply' argument\n", pField->name ); + Con_DPrintf( S_ERROR "%s: %s missing 'post_multiply' argument\n", __func__, pField->name ); return false; } @@ -749,7 +749,7 @@ static qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInf *delta_script = COM_ParseFile( *delta_script, token, sizeof( token )); if( Q_strcmp( token, ")" )) { - Con_DPrintf( S_ERROR "Delta_ParseField: expected ')', found '%s' instead\n", token ); + Con_DPrintf( S_ERROR "%s: expected ')', found '%s' instead\n", __func__, token ); return false; } @@ -823,7 +823,7 @@ static void Delta_InitFields( void ) delta_info_t *dt; afile = FS_LoadFile( DELTA_PATH, NULL, false ); - if( !afile ) Sys_Error( "DELTA_Load: couldn't load file %s\n", DELTA_PATH ); + if( !afile ) Sys_Error( "%s: couldn't load file %s\n", __func__, DELTA_PATH ); pfile = (char *)afile; @@ -1801,7 +1801,7 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t * startBit = msg->iCurBit; if( to->number < 0 || to->number >= GI->max_edicts ) - Host_Error( "MSG_WriteDeltaEntity: Bad entity number: %i\n", to->number ); + Host_Error( "%s: Bad entity number: %i\n", __func__, to->number ); MSG_WriteUBitLong( msg, to->number, MAX_ENTITY_BITS ); MSG_WriteUBitLong( msg, 0, 2 ); // alive @@ -1882,7 +1882,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state int baseline_offset = 0; if( number < 0 || number >= clgame.maxEntities ) - Host_Error( "MSG_ReadDeltaEntity: bad delta entity number: %i\n", number ); + Host_Error( "%s: bad delta entity number: %i\n", __func__, number ); fRemoveType = MSG_ReadUBitLong( msg, 2 ); @@ -1904,7 +1904,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state return false; } - Host_Error( "MSG_ReadDeltaEntity: unknown update type %i\n", fRemoveType ); + Host_Error( "%s: unknown update type %i\n", __func__, fRemoveType ); } if( !cls.legacymode ) @@ -2003,13 +2003,13 @@ void GAME_EXPORT Delta_AddEncoder( char *name, pfnDeltaEncode encodeFunc ) if( !dt || !dt->bInitialized ) { - Con_DPrintf( S_ERROR "Delta_AddEncoder: couldn't find delta with specified custom encode %s\n", name ); + Con_DPrintf( S_ERROR "%s: couldn't find delta with specified custom encode %s\n", __func__, name ); return; } if( dt->customEncode == CUSTOM_NONE ) { - Con_DPrintf( S_ERROR "Delta_AddEncoder: %s not supposed for custom encoding\n", dt->pName ); + Con_DPrintf( S_ERROR "%s: %s not supposed for custom encoding\n", __func__, dt->pName ); return; } diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c index d3146cdd..5fd10de7 100644 --- a/engine/common/net_ws.c +++ b/engine/common/net_ws.c @@ -544,7 +544,7 @@ static net_gai_state_t NET_StringToSockaddr( const char *s, struct sockaddr_stor } else // failed to create thread { - Con_Reportf( S_ERROR "NET_StringToSockaddr: failed to create thread!\n"); + Con_Reportf( S_ERROR "%s: failed to create thread!\n", __func__ ); nsthread.busy = false; } } @@ -937,7 +937,7 @@ qboolean NET_CompareAdr( const netadr_t a, const netadr_t b ) return true; } - Con_DPrintf( S_ERROR "NET_CompareAdr: bad address type\n" ); + Con_DPrintf( S_ERROR "%s: bad address type\n", __func__ ); return false; } @@ -1397,7 +1397,7 @@ static qboolean NET_GetLong( byte *pData, int size, size_t *outSize, int splitsi } else { - Con_DPrintf( "NET_GetLong: Ignoring duplicated split packet %i of %i ( %i bytes )\n", packet_number + 1, packet_count, size ); + Con_DPrintf( "%s: Ignoring duplicated split packet %i of %i ( %i bytes )\n", __func__, packet_number + 1, packet_count, size ); } offset = (packet_number * body_size); @@ -1478,7 +1478,7 @@ static qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size } else { - Con_Reportf( "NET_QueuePacket: oversize packet from %s\n", NET_AdrToString( *from )); + Con_Reportf( "%s: oversize packet from %s\n", __func__, NET_AdrToString( *from )); } } else @@ -1494,7 +1494,7 @@ static qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size case WSAETIMEDOUT: break; default: // let's continue even after errors - Con_DPrintf( S_ERROR "NET_QueuePacket: %s from %s\n", NET_ErrorString(), NET_AdrToString( *from )); + Con_DPrintf( S_ERROR "%s: %s from %s\n", __func__, NET_ErrorString(), NET_AdrToString( *from )); break; } } @@ -1624,7 +1624,7 @@ void NET_SendPacketEx( netsrc_t sock, size_t length, const void *data, netadr_t } else { - Host_Error( "NET_SendPacket: bad address type %i (%i)\n", to.type, to.type6 ); + Host_Error( "%s: bad address type %i (%i)\n", __func__, to.type, to.type6 ); } NET_NetadrToSockadr( &to, &addr ); @@ -1645,15 +1645,15 @@ void NET_SendPacketEx( netsrc_t sock, size_t length, const void *data, netadr_t if( Host_IsDedicated( )) { - Con_DPrintf( S_ERROR "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to )); + Con_DPrintf( S_ERROR "%s: %s to %s\n", __func__, NET_ErrorString(), NET_AdrToString( to )); } else if( err == WSAEADDRNOTAVAIL || err == WSAENOBUFS ) { - Con_DPrintf( S_ERROR "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to )); + Con_DPrintf( S_ERROR "%s: %s to %s\n", __func__, NET_ErrorString(), NET_AdrToString( to )); } else { - Con_Printf( S_ERROR "NET_SendPacket: %s to %s\n", NET_ErrorString(), NET_AdrToString( to )); + Con_Printf( S_ERROR "%s: %s to %s\n", __func__, NET_ErrorString(), NET_AdrToString( to )); } } @@ -1689,7 +1689,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) { err = WSAGetLastError(); if( err != WSAEAFNOSUPPORT ) - Con_DPrintf( S_WARN "NET_UDPSocket: port: %d socket: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port: %d socket: %s\n", __func__, port, NET_ErrorString( )); return INVALID_SOCKET; } @@ -1697,7 +1697,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) { struct timeval timeout; - Con_DPrintf( S_WARN "NET_UDPSocket: port: %d ioctl FIONBIO: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port: %d ioctl FIONBIO: %s\n", __func__, port, NET_ErrorString( )); // try timeout instead of NBIO timeout.tv_sec = timeout.tv_usec = 0; setsockopt( net_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout)); @@ -1706,12 +1706,12 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) // make it broadcast capable if( NET_IsSocketError( setsockopt( net_socket, SOL_SOCKET, SO_BROADCAST, (char *)&_true, sizeof( _true )))) { - Con_DPrintf( S_WARN "NET_UDPSocket: port: %d setsockopt SO_BROADCAST: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port: %d setsockopt SO_BROADCAST: %s\n", __func__, port, NET_ErrorString( )); } if( NET_IsSocketError( setsockopt( net_socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&optval, sizeof( optval )))) { - Con_DPrintf( S_WARN "NET_UDPSocket: port: %d setsockopt SO_REUSEADDR: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port: %d setsockopt SO_REUSEADDR: %s\n", __func__, port, NET_ErrorString( )); closesocket( net_socket ); return INVALID_SOCKET; } @@ -1722,7 +1722,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) { if( NET_IsSocketError( setsockopt( net_socket, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&_true, sizeof( _true )))) { - Con_DPrintf( S_WARN "NET_UDPSocket: port: %d setsockopt IPV6_V6ONLY: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port: %d setsockopt IPV6_V6ONLY: %s\n", __func__, port, NET_ErrorString( )); closesocket( net_socket ); return INVALID_SOCKET; } @@ -1730,7 +1730,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) if( Sys_CheckParm( "-loopback" )) { if( NET_IsSocketError( setsockopt( net_socket, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&_true, sizeof( _true )))) - Con_DPrintf( S_WARN "NET_UDPSocket: port %d setsockopt IPV6_MULTICAST_LOOP: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port %d setsockopt IPV6_MULTICAST_LOOP: %s\n", __func__, port, NET_ErrorString( )); } if( COM_CheckStringEmpty( net_iface ) && Q_stricmp( net_iface, "localhost" )) @@ -1742,7 +1742,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) if( NET_IsSocketError( bind( net_socket, (struct sockaddr *)&addr, sizeof( struct sockaddr_in6 )))) { - Con_DPrintf( S_WARN "NET_UDPSocket: port: %d bind6: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port: %d bind6: %s\n", __func__, port, NET_ErrorString( )); closesocket( net_socket ); return INVALID_SOCKET; } @@ -1758,7 +1758,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) { err = WSAGetLastError(); if( err != WSAENOPROTOOPT ) - Con_Printf( S_WARN "NET_UDPSocket: port: %d setsockopt IP_TOS: %s\n", port, NET_ErrorString( )); + Con_Printf( S_WARN "%s: port: %d setsockopt IP_TOS: %s\n", __func__, port, NET_ErrorString( )); closesocket( net_socket ); return INVALID_SOCKET; } @@ -1767,7 +1767,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) if( Sys_CheckParm( "-loopback" )) { if( NET_IsSocketError( setsockopt( net_socket, IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&_true, sizeof( _true )))) - Con_DPrintf( S_WARN "NET_UDPSocket: port %d setsockopt IP_MULTICAST_LOOP: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port %d setsockopt IP_MULTICAST_LOOP: %s\n", __func__, port, NET_ErrorString( )); } if( COM_CheckStringEmpty( net_iface ) && Q_stricmp( net_iface, "localhost" )) @@ -1779,7 +1779,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family ) if( NET_IsSocketError( bind( net_socket, (struct sockaddr *)&addr, sizeof( struct sockaddr_in )))) { - Con_DPrintf( S_WARN "NET_UDPSocket: port: %d bind: %s\n", port, NET_ErrorString( )); + Con_DPrintf( S_WARN "%s: port: %d bind: %s\n", __func__, port, NET_ErrorString( )); closesocket( net_socket ); return INVALID_SOCKET; } @@ -1796,8 +1796,8 @@ NET_OpenIP static void NET_OpenIP( qboolean change_port, int *sockets, const char *net_iface, int hostport, int clientport, int family ) { int port; - qboolean sv_nat = Cvar_VariableInteger("sv_nat"); - qboolean cl_nat = Cvar_VariableInteger("cl_nat"); + qboolean sv_nat = Cvar_VariableInteger( "sv_nat" ); + qboolean cl_nat = Cvar_VariableInteger( "cl_nat" ); if( change_port && ( FBitSet( net_hostport.flags, FCVAR_CHANGED ) || sv_nat )) { diff --git a/engine/common/pm_trace.c b/engine/common/pm_trace.c index e90aff2f..26d411e7 100644 --- a/engine/common/pm_trace.c +++ b/engine/common/pm_trace.c @@ -246,7 +246,7 @@ loc0: } if( num < hull->firstclipnode || num > hull->lastclipnode ) - Host_Error( "PM_RecursiveHullCheck: bad node number %i\n", num ); + Host_Error( "%s: bad node number %i\n", __func__, num ); // find the point distances node = hull->clipnodes + num; diff --git a/engine/common/soundlib/snd_main.c b/engine/common/soundlib/snd_main.c index 20b6796c..fd2c25b6 100644 --- a/engine/common/soundlib/snd_main.c +++ b/engine/common/soundlib/snd_main.c @@ -120,7 +120,7 @@ load_internal: } if( filename[0] != '#' ) - Con_DPrintf( S_WARN "FS_LoadSound: couldn't load \"%s\"\n", loadname ); + Con_DPrintf( S_WARN "%s: couldn't load \"%s\"\n", __func__, loadname ); return NULL; } diff --git a/engine/common/soundlib/snd_mp3.c b/engine/common/soundlib/snd_mp3.c index e1814c48..5747ba89 100644 --- a/engine/common/soundlib/snd_mp3.c +++ b/engine/common/soundlib/snd_mp3.c @@ -94,7 +94,7 @@ static qboolean Sound_ParseID3Frame( const did3v2_frame_t *frame, const byte *bu value_len = frame_length - (1 + key_len + 1); if( value_len <= 0 || value_len >= sizeof( value )) { - Con_Printf( S_ERROR "Sound_ParseID3Frame: invalid TXXX description, possibly broken file.\n" ); + Con_Printf( S_ERROR "%s: invalid TXXX description, possibly broken file.\n", __func__ ); return false; } @@ -106,9 +106,9 @@ static qboolean Sound_ParseID3Frame( const did3v2_frame_t *frame, const byte *bu else { if( buffer[0] == 0x01 || buffer[0] == 0x02 ) // UTF-16 with BOM - Con_Printf( S_ERROR "Sound_ParseID3Frame: UTF-16 encoding is unsupported. Use UTF-8 or ISO-8859!\n" ); + Con_Printf( S_ERROR "%s: UTF-16 encoding is unsupported. Use UTF-8 or ISO-8859!\n", __func__ ); else - Con_Printf( S_ERROR "Sound_ParseID3Frame: unknown TXXX tag encoding %d, possibly broken file.\n", buffer[0] ); + Con_Printf( S_ERROR "%s: unknown TXXX tag encoding %d, possibly broken file.\n", __func__, buffer[0] ); return false; } } @@ -132,7 +132,7 @@ static qboolean Sound_ParseID3Tag( const byte *buffer, fs_offset_t filesize ) { // old id3v1 header found if( CHECK_IDENT( header->ident, 'T', 'A', 'G' )) - Con_Printf( S_ERROR "Sound_ParseID3Tag: ID3v1 is not supported! Convert to ID3v2.4!\n" ); + Con_Printf( S_ERROR "%s: ID3v1 is not supported! Convert to ID3v2.4!\n", __func__ ); return true; // missing tag header is not an error } @@ -140,14 +140,14 @@ static qboolean Sound_ParseID3Tag( const byte *buffer, fs_offset_t filesize ) // support only latest id3 v2.4 if( header->major_ver != 4 || header->minor_ver == 0xff ) { - Con_Printf( S_ERROR "Sound_ParseID3Tag: invalid ID3v2 tag version 2.%d.%d. Convert to ID3v2.4!\n", header->major_ver, header->minor_ver ); + Con_Printf( S_ERROR "%s: invalid ID3v2 tag version 2.%d.%d. Convert to ID3v2.4!\n", __func__, header->major_ver, header->minor_ver ); return false; } tag_length = Sound_ParseSynchInteger( header->length ); if( tag_length > filesize - sizeof( *header )) { - Con_Printf( S_ERROR "Sound_ParseID3Tag: invalid tag length %u, possibly broken file.\n", tag_length ); + Con_Printf( S_ERROR "%s: invalid tag length %u, possibly broken file.\n", __func__, tag_length ); return false; } @@ -159,7 +159,7 @@ static qboolean Sound_ParseID3Tag( const byte *buffer, fs_offset_t filesize ) if( ext_length > tag_length ) { - Con_Printf( S_ERROR "Sound_ParseID3Tag: invalid extended header length %u, possibly broken file.\n", ext_length ); + Con_Printf( S_ERROR "%s: invalid extended header length %u, possibly broken file.\n", __func__, ext_length ); return false; } @@ -173,7 +173,7 @@ static qboolean Sound_ParseID3Tag( const byte *buffer, fs_offset_t filesize ) if( frame_length > tag_length ) { - Con_Printf( S_ERROR "Sound_ParseID3Tag: invalid frame length %u, possibly broken file.\n", frame_length ); + Con_Printf( S_ERROR "%s: invalid frame length %u, possibly broken file.\n", __func__, frame_length ); return false; } @@ -228,7 +228,7 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, fs_offset_t filesi // trying to read header if( !feed_mpeg_header( mpeg, buffer, FRAME_SIZE, filesize, &sc )) { - Con_DPrintf( S_ERROR "Sound_LoadMPG: failed to load (%s): %s\n", name, get_error( mpeg )); + Con_DPrintf( S_ERROR "%s: failed to load (%s): %s\n", __func__, name, get_error( mpeg )); close_decoder( mpeg ); return false; } @@ -242,13 +242,13 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, fs_offset_t filesi if( !Sound_ParseID3Tag( buffer, filesize )) { - Con_DPrintf( S_WARN "Sound_LoadMPG: (%s) failed to extract LOOP_START tag\n", name ); + Con_DPrintf( S_WARN "%s: (%s) failed to extract LOOP_START tag\n", __func__, name ); } if( !sound.size ) { // bad mpeg file ? - Con_DPrintf( S_ERROR "Sound_LoadMPG: (%s) is probably corrupted\n", name ); + Con_DPrintf( S_ERROR "%s: (%s) is probably corrupted\n", __func__, name ); close_decoder( mpeg ); return false; } @@ -325,7 +325,7 @@ stream_t *Stream_OpenMPG( const char *filename ) // couldn't create decoder if(( mpeg = create_decoder( &ret )) == NULL ) { - Con_DPrintf( S_ERROR "Stream_OpenMPG: couldn't create decoder: %s\n", get_error( mpeg ) ); + Con_DPrintf( S_ERROR "%s: couldn't create decoder: %s\n", __func__, get_error( mpeg ) ); Mem_Free( stream ); FS_Close( file ); return NULL; @@ -336,7 +336,7 @@ stream_t *Stream_OpenMPG( const char *filename ) // trying to open stream and read header if( !open_mpeg_stream( mpeg, file, FS_ReadMpg, FS_SeekMpg, &sc )) { - Con_DPrintf( S_ERROR "Stream_OpenMPG: failed to load (%s): %s\n", filename, get_error( mpeg )); + Con_DPrintf( S_ERROR "%s: failed to load (%s): %s\n", __func__, filename, get_error( mpeg )); close_decoder( mpeg ); Mem_Free( stream ); FS_Close( file ); diff --git a/engine/common/soundlib/snd_utils.c b/engine/common/soundlib/snd_utils.c index 0f65bbb0..c01402d2 100644 --- a/engine/common/soundlib/snd_utils.c +++ b/engine/common/soundlib/snd_utils.c @@ -504,12 +504,12 @@ static qboolean Sound_ResampleInternal( wavdata_t *sc, int inrate, int inwidth, if( handled ) { if( t2 - t1 > 0.01f ) // critical, report to mod developer - Con_Printf( S_WARN "Sound_Resample: from [%d bit %d Hz] to [%d bit %d Hz] (took %.3fs)\n", inwidth * 8, inrate, outwidth * 8, outrate, t2 - t1 ); + Con_Printf( S_WARN "%s: from [%d bit %d Hz] to [%d bit %d Hz] (took %.3fs)\n", __func__, inwidth * 8, inrate, outwidth * 8, outrate, t2 - t1 ); else - Con_Reportf( "Sound_Resample: from [%d bit %d Hz] to [%d bit %d Hz] (took %.3fs)\n", inwidth * 8, inrate, outwidth * 8, outrate, t2 - t1 ); + Con_Reportf( "%s: from [%d bit %d Hz] to [%d bit %d Hz] (took %.3fs)\n", __func__, inwidth * 8, inrate, outwidth * 8, outrate, t2 - t1 ); } else - Con_Printf( S_ERROR "Sound_Resample: unsupported from [%d bit %d Hz] to [%d bit %d Hz]\n", inwidth * 8, inrate, outwidth * 8, outrate ); + Con_Printf( S_ERROR "%s: unsupported from [%d bit %d Hz] to [%d bit %d Hz]\n", __func__, inwidth * 8, inrate, outwidth * 8, outrate ); sc->rate = outrate; sc->width = outwidth; diff --git a/engine/common/soundlib/snd_wav.c b/engine/common/soundlib/snd_wav.c index 9119dfa3..fe176529 100644 --- a/engine/common/soundlib/snd_wav.c +++ b/engine/common/soundlib/snd_wav.c @@ -188,7 +188,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi if( !iff_dataPtr || !IsFourCC( iff_dataPtr + 8, "WAVE" )) { - Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'RIFF/WAVE' chunks\n", name ); + Con_DPrintf( S_ERROR "%s: %s missing 'RIFF/WAVE' chunks\n", __func__, name ); return false; } @@ -198,7 +198,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi if( !iff_dataPtr ) { - Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'fmt ' chunk\n", name ); + Con_DPrintf( S_ERROR "%s: %s missing 'fmt ' chunk\n", __func__, name ); return false; } @@ -209,7 +209,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi { if( fmt != 85 ) { - Con_DPrintf( S_ERROR "Sound_LoadWAV: %s not a microsoft PCM format\n", name ); + Con_DPrintf( S_ERROR "%s: %s not a microsoft PCM format\n", __func__, name ); return false; } else @@ -222,7 +222,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi sound.channels = GetLittleShort(); if( sound.channels != 1 && sound.channels != 2 ) { - Con_DPrintf( S_ERROR "Sound_LoadWAV: only mono and stereo WAV files supported (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: only mono and stereo WAV files supported (%s)\n", __func__, name ); return false; } @@ -234,7 +234,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi if( sound.width != 1 && sound.width != 2 ) { - Con_DPrintf( S_ERROR "Sound_LoadWAV: only 8 and 16 bit WAV files supported (%s)\n", name ); + Con_DPrintf( S_ERROR "%s: only 8 and 16 bit WAV files supported (%s)\n", __func__, name ); return false; } @@ -269,7 +269,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi if( !iff_dataPtr ) { - Con_DPrintf( S_ERROR "Sound_LoadWAV: %s missing 'data' chunk\n", name ); + Con_DPrintf( S_ERROR "%s: %s missing 'data' chunk\n", __func__, name ); return false; } @@ -280,7 +280,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi { if( samples < sound.samples ) { - Con_DPrintf( S_ERROR "Sound_LoadWAV: %s has a bad loop length\n", name ); + Con_DPrintf( S_ERROR "%s: %s has a bad loop length\n", __func__, name ); return false; } } @@ -288,7 +288,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi if( sound.samples <= 0 ) { - Con_Reportf( S_ERROR "Sound_LoadWAV: file with %i samples (%s)\n", sound.samples, name ); + Con_Reportf( S_ERROR "%s: file with %i samples (%s)\n", __func__, sound.samples, name ); return false; } @@ -360,7 +360,7 @@ stream_t *Stream_OpenWAV( const char *filename ) // find "RIFF" chunk if( !StreamFindNextChunk( file, "RIFF", &last_chunk )) { - Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing RIFF chunk\n", filename ); + Con_DPrintf( S_ERROR "%s: %s missing RIFF chunk\n", __func__, filename ); FS_Close( file ); return NULL; } @@ -369,14 +369,14 @@ stream_t *Stream_OpenWAV( const char *filename ) if( FS_Read( file, chunkName, 4 ) != 4 ) { - Con_DPrintf( S_ERROR "%s: %s missing WAVE chunk, truncated\n", filename ); + Con_DPrintf( S_ERROR "%s: %s missing WAVE chunk, truncated\n", __func__, filename ); FS_Close( file ); return false; } if( !IsFourCC( chunkName, "WAVE" )) { - Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing WAVE chunk\n", filename ); + Con_DPrintf( S_ERROR "%s: %s missing WAVE chunk\n", __func__, filename ); FS_Close( file ); return NULL; } @@ -386,7 +386,7 @@ stream_t *Stream_OpenWAV( const char *filename ) last_chunk = iff_data; if( !StreamFindNextChunk( file, "fmt ", &last_chunk )) { - Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing 'fmt ' chunk\n", filename ); + Con_DPrintf( S_ERROR "%s: %s missing 'fmt ' chunk\n", __func__, filename ); FS_Close( file ); return NULL; } @@ -396,7 +396,7 @@ stream_t *Stream_OpenWAV( const char *filename ) FS_Read( file, &t, sizeof( t )); if( t != 1 ) { - Con_DPrintf( S_ERROR "Stream_OpenWAV: %s not a microsoft PCM format\n", filename ); + Con_DPrintf( S_ERROR "%s: %s not a microsoft PCM format\n", __func__, filename ); FS_Close( file ); return NULL; } @@ -417,7 +417,7 @@ stream_t *Stream_OpenWAV( const char *filename ) last_chunk = iff_data; if( !StreamFindNextChunk( file, "data", &last_chunk )) { - Con_DPrintf( S_ERROR "Stream_OpenWAV: %s missing 'data' chunk\n", filename ); + Con_DPrintf( S_ERROR "%s: %s missing 'data' chunk\n", __func__, filename ); FS_Close( file ); return NULL; } diff --git a/engine/common/sys_con.c b/engine/common/sys_con.c index 7f58b160..fae8f7a7 100644 --- a/engine/common/sys_con.c +++ b/engine/common/sys_con.c @@ -89,7 +89,7 @@ char *Sys_Input( void ) void Sys_DestroyConsole( void ) { // last text message into console or log - Con_Reportf( "Sys_DestroyConsole: Exiting!\n" ); + Con_Reportf( "%s: Exiting!\n", __func__ ); #if XASH_WIN32 Wcon_DestroyConsole(); #endif diff --git a/engine/common/system.c b/engine/common/system.c index cebe1bbf..0c967aeb 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -268,7 +268,7 @@ qboolean Sys_LoadLibrary( dll_info_t *dll ) if( !dll->name || !*dll->name ) return false; // nothing to load - Con_Reportf( "Sys_LoadLibrary: Loading %s", dll->name ); + Con_Reportf( "%s: Loading %s", __func__, dll->name ); if( dll->fcts ) { @@ -325,10 +325,10 @@ qboolean Sys_FreeLibrary( dll_info_t *dll ) if( host.status == HOST_CRASHED ) { // we need to hold down all modules, while MSVC can find error - Con_Reportf( "Sys_FreeLibrary: hold %s for debugging\n", dll->name ); + Con_Reportf( "%s: hold %s for debugging\n", __func__, dll->name ); return false; } - else Con_Reportf( "Sys_FreeLibrary: Unloading %s\n", dll->name ); + else Con_Reportf( "%s: Unloading %s\n", __func__, dll->name ); COM_FreeLibrary( dll->link ); dll->link = NULL; @@ -380,7 +380,7 @@ void Sys_Warn( const char *format, ... ) Sys_DebugBreak(); - Msg( "Sys_Warn: %s\n", text ); + Msg( "%s: %s\n", __func__, text ); if( !Host_IsDedicated() ) // dedicated server should not hang on messagebox Platform_MessageBox( "Xash Warning", text, true ); diff --git a/engine/common/zone.c b/engine/common/zone.c index 08b86346..91fae491 100644 --- a/engine/common/zone.c +++ b/engine/common/zone.c @@ -89,7 +89,7 @@ static mempool_t *Mem_FindPool( poolhandle_t poolptr ) if( likely( poolptr > 0 && poolptr <= poolcount )) return &poolchain[poolptr - 1]; - Sys_Error( "%s: not allocated or double freed pool %d", __FUNCTION__, poolptr ); + Sys_Error( "%s: not allocated or double freed pool %d", __func__, poolptr ); return NULL; } @@ -234,7 +234,7 @@ void _Mem_Free( void *data, const char *filename, int fileline ) { if( data == NULL ) { - Sys_Error( "Mem_Free: data == NULL (called at %s:%i)\n", filename, fileline ); + Sys_Error( "%s: data == NULL (called at %s:%i)\n", __func__, filename, fileline ); return; } @@ -253,7 +253,7 @@ void *_Mem_Realloc( poolhandle_t poolptr, void *data, size_t size, qboolean clea if( unlikely( !poolptr )) { - Sys_Error( "Mem_Realloc: pool == NULL (alloc at %s:%i)\n", filename, fileline ); + Sys_Error( "%s: pool == NULL (alloc at %s:%i)\n", __func__, filename, fileline ); return NULL; } @@ -267,8 +267,8 @@ void *_Mem_Realloc( poolhandle_t poolptr, void *data, size_t size, qboolean clea if( unlikely( mem->poolptr != poolptr )) { - Sys_Error( "Mem_Realloc: pool migration is not allowed (alloc at %s:%i, realloc at %s:%i)\n", - Mem_CheckFilename( mem->filename ), mem->fileline, filename, fileline ); + Sys_Error( "%s: pool migration is not allowed (alloc at %s:%i, realloc at %s:%i)\n", + __func__, Mem_CheckFilename( mem->filename ), mem->fileline, filename, fileline ); return NULL; } @@ -283,7 +283,7 @@ void *_Mem_Realloc( poolhandle_t poolptr, void *data, size_t size, qboolean clea if( mem == NULL ) { - Sys_Error( "Mem_Realloc: out of memory (alloc size %s at %s:%i)\n", Q_memprint( size ), filename, fileline ); + Sys_Error( "%s: out of memory (alloc size %s at %s:%i)\n", __func__, Q_memprint( size ), filename, fileline ); return NULL; } @@ -338,7 +338,7 @@ poolhandle_t _Mem_AllocPool( const char *name, const char *filename, int filelin pool = (mempool_t *)Q_realloc( poolchain, sizeof( *poolchain ) * ( poolcount + 1 )); if( pool == NULL ) { - Sys_Error( "Mem_AllocPool: out of memory (allocpool at %s:%i)\n", filename, fileline ); + Sys_Error( "%s: out of memory (allocpool at %s:%i)\n", __func__, filename, fileline ); return 0; } @@ -355,7 +355,7 @@ void _Mem_FreePool( poolhandle_t *poolptr, const char *filename, int fileline ) { if( !pool->filename ) { - Sys_Error( "Mem_FreePool: pool already free (freepool at %s:%i)\n", filename, fileline ); + Sys_Error( "%s: pool already free (freepool at %s:%i)\n", __func__, filename, fileline ); *poolptr = 0; return; } @@ -377,7 +377,7 @@ void _Mem_EmptyPool( poolhandle_t poolptr, const char *filename, int fileline ) mempool_t *pool; if( unlikely( !poolptr )) { - Sys_Error( "Mem_EmptyPool: pool == NULL (emptypool at %s:%i)\n", filename, fileline ); + Sys_Error( "%s: pool == NULL (emptypool at %s:%i)\n", __func__, filename, fileline ); return; } @@ -458,7 +458,7 @@ void Mem_PrintStats( void ) realsize += pool->realsize; } - Con_Printf( "^3%lu^7 memory pools, totalling: ^1%s\n", count, Q_memprint( size )); + Con_Printf( "^3%zu^7 memory pools, totalling: ^1%s\n", count, Q_memprint( size )); Con_Printf( "total allocated size: ^1%s\n", Q_memprint( realsize )); } diff --git a/engine/platform/dos/vid_dos.c b/engine/platform/dos/vid_dos.c index 833567ce..0cbd6e42 100644 --- a/engine/platform/dos/vid_dos.c +++ b/engine/platform/dos/vid_dos.c @@ -89,7 +89,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_m render_w = width; render_h = height; - Con_Reportf( "R_ChangeDisplaySettings: forced resolution to %dx%d)\n", width, height ); + Con_Reportf( "%s: forced resolution to %dx%d)\n", __func__, width, height ); if( ref.dllFuncs.R_SetDisplayTransform( rotate, 0, 0, vid_scale->value, vid_scale->value ) ) { diff --git a/engine/platform/linux/in_evdev.c b/engine/platform/linux/in_evdev.c index ecccce6b..9c8e9f6c 100644 --- a/engine/platform/linux/in_evdev.c +++ b/engine/platform/linux/in_evdev.c @@ -272,7 +272,7 @@ void Evdev_OpenDevice ( const char *path ) ret = open( path, O_RDONLY | O_NONBLOCK ); if( ret < 0 ) { - Con_Reportf( S_ERROR "Could not open input device %s: %s\n", path, strerror( errno ) ); + Con_Reportf( S_ERROR "Could not open input device %s: %s\n", path, strerror( errno ) ); return; } Con_Printf( "Input device #%d: %s opened sucessfully\n", evdev.devices, path ); diff --git a/engine/platform/linux/vid_fbdev.c b/engine/platform/linux/vid_fbdev.c index 9a7e7aa0..143bf605 100644 --- a/engine/platform/linux/vid_fbdev.c +++ b/engine/platform/linux/vid_fbdev.c @@ -117,7 +117,7 @@ qboolean VID_SetMode( void ) return true; } -rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mode ) +rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mode ) { int render_w, render_h; @@ -126,7 +126,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_m render_w = width; render_h = height; - Con_Reportf( "R_ChangeDisplaySettings: forced resolution to %dx%d)\n", width, height ); + Con_Reportf( "%s: forced resolution to %dx%d)\n", __func__, width, height ); VID_SetDisplayTransform( &render_w, &render_h ); R_SaveVideoMode( width, height, render_w, render_h ); diff --git a/engine/platform/misc/lib_static.c b/engine/platform/misc/lib_static.c index f5f16552..84f5677a 100644 --- a/engine/platform/misc/lib_static.c +++ b/engine/platform/misc/lib_static.c @@ -20,19 +20,19 @@ GNU General Public License for more details. void *dlsym(void *handle, const char *symbol ) { - Con_DPrintf( "dlsym( %p, \"%s\" ): stub\n", handle, symbol ); + Con_DPrintf( "%s( %p, \"%s\" ): stub\n", __func__, handle, symbol ); return NULL; } void *dlopen(const char *name, int flag ) { - Con_DPrintf( "dlopen( \"%s\", %d ): stub\n", name, flag ); + Con_DPrintf( "%s( \"%s\", %d ): stub\n", __func__, name, flag ); return NULL; } int dlclose(void *handle) { - Con_DPrintf( "dlsym( %p ): stub\n", handle ); + Con_DPrintf( "%s( %p ): stub\n", __func__, handle ); return 0; } diff --git a/engine/platform/nswitch/sys_nswitch.c b/engine/platform/nswitch/sys_nswitch.c index 61203e1a..bba21009 100644 --- a/engine/platform/nswitch/sys_nswitch.c +++ b/engine/platform/nswitch/sys_nswitch.c @@ -113,12 +113,12 @@ void userAppExit( void ) void NSwitch_Init( void ) { - printf( "NSwitch_Init\n" ); + printf( "%s\n", __func__ ); } void NSwitch_Shutdown( void ) { - printf( "NSwitch_Shutdown\n" ); + printf( "%s\n", __func__ ); // force deinit everything SDL-related to avoid issues with changing games if ( SDL_WasInit( 0 ) ) SDL_Quit( ); diff --git a/engine/platform/posix/lib_posix.c b/engine/platform/posix/lib_posix.c index f3086597..5bffe8f9 100644 --- a/engine/platform/posix/lib_posix.c +++ b/engine/platform/posix/lib_posix.c @@ -45,19 +45,19 @@ const char * Loader_GetFuncName_int( void *wm , void *func); void *dlsym(void *handle, const char *symbol ) { - Con_DPrintf( "dlsym( %p, \"%s\" ): stub\n", handle, symbol ); + Con_DPrintf( "%s( %p, \"%s\" ): stub\n", __func__, handle, symbol ); return NULL; } void *dlopen(const char *name, int flag ) { - Con_DPrintf( "dlopen( \"%s\", %d ): stub\n", name, flag ); + Con_DPrintf( "%s( \"%s\", %d ): stub\n", __func__, name, flag ); return NULL; } int dlclose(void *handle) { - Con_DPrintf( "dlsym( %p ): stub\n", handle ); + Con_DPrintf( "%s( %p ): stub\n", __func__, handle ); return 0; } diff --git a/engine/platform/sdl/events.c b/engine/platform/sdl/events.c index 4797a753..472e34a8 100644 --- a/engine/platform/sdl/events.c +++ b/engine/platform/sdl/events.c @@ -279,11 +279,11 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key ) #endif // SDL_VERSION_ATLEAST( 2, 0, 0 ) case SDL_SCANCODE_UNKNOWN: { - if( down ) Con_Reportf( "SDLash_KeyEvent: Unknown scancode\n" ); + if( down ) Con_Reportf( "%s: Unknown scancode\n", __func__ ); return; } default: - if( down ) Con_Reportf( "SDLash_KeyEvent: Unknown key: %s = %i\n", SDL_GetScancodeName( keynum ), keynum ); + if( down ) Con_Reportf( "%s: Unknown key: %s = %i\n", __func__, SDL_GetScancodeName( keynum ), keynum ); return; } } diff --git a/engine/platform/sdl/s_sdl.c b/engine/platform/sdl/s_sdl.c index f12b67b8..1c71a334 100644 --- a/engine/platform/sdl/s_sdl.c +++ b/engine/platform/sdl/s_sdl.c @@ -281,11 +281,11 @@ qboolean VoiceCapture_Init( void ) if( SDLash_IsAudioError( in_dev )) { - Con_Printf( "VoiceCapture_Init: error creating capture device (%s)\n", SDL_GetError() ); + Con_Printf( "%s: error creating capture device (%s)\n", __func__, SDL_GetError() ); return false; } - Con_Printf( S_NOTE "VoiceCapture_Init: capture device creation success (%i: %s)\n", in_dev, SDL_GetAudioDeviceName( in_dev, SDL_TRUE ) ); + Con_Printf( S_NOTE "%s: capture device creation success (%i: %s)\n", __func__, in_dev, SDL_GetAudioDeviceName( in_dev, SDL_TRUE ) ); return true; } diff --git a/engine/platform/sdl/vid_sdl.c b/engine/platform/sdl/vid_sdl.c index a7e6299a..e709afeb 100644 --- a/engine/platform/sdl/vid_sdl.c +++ b/engine/platform/sdl/vid_sdl.c @@ -377,21 +377,21 @@ static void WIN_SetDPIAwareness( void ) if( hResult == S_OK ) { - Con_Reportf( "SetDPIAwareness: Success\n" ); + Con_Reportf( "%s: Success\n", __func__ ); bSuccess = TRUE; } - else if( hResult == E_INVALIDARG ) Con_Reportf( "SetDPIAwareness: Invalid argument\n" ); - else if( hResult == E_ACCESSDENIED ) Con_Reportf( "SetDPIAwareness: Access Denied\n" ); + else if( hResult == E_INVALIDARG ) Con_Reportf( "%s: Invalid argument\n", __func__ ); + else if( hResult == E_ACCESSDENIED ) Con_Reportf( "%s: Access Denied\n", __func__ ); } - else Con_Reportf( "SetDPIAwareness: Can't get SetProcessDpiAwareness\n" ); + else Con_Reportf( "%s: Can't get SetProcessDpiAwareness\n", __func__ ); FreeLibrary( hModule ); } - else Con_Reportf( "SetDPIAwareness: Can't load shcore.dll\n" ); + else Con_Reportf( "%s: Can't load shcore.dll\n", __func__ ); if( !bSuccess ) { - Con_Reportf( "SetDPIAwareness: Trying SetProcessDPIAware...\n" ); + Con_Reportf( "%s: Trying SetProcessDPIAware...\n", __func__ ); if( ( hModule = LoadLibrary( "user32.dll" ) ) ) { @@ -402,15 +402,15 @@ static void WIN_SetDPIAwareness( void ) if( hResult ) { - Con_Reportf( "SetDPIAwareness: Success\n" ); + Con_Reportf( "%s: Success\n", __func__ ); bSuccess = TRUE; } - else Con_Reportf( "SetDPIAwareness: fail\n" ); + else Con_Reportf( "%s: fail\n", __func__ ); } - else Con_Reportf( "SetDPIAwareness: Can't get SetProcessDPIAware\n" ); + else Con_Reportf( "%s: Can't get SetProcessDPIAware\n", __func__ ); FreeLibrary( hModule ); } - else Con_Reportf( "SetDPIAwareness: Can't load user32.dll\n" ); + else Con_Reportf( "%s: Can't load user32.dll\n", __func__ ); } } @@ -472,7 +472,7 @@ void *GL_GetProcAddress( const char *name ) if( !func ) { - Con_Reportf( S_ERROR "GL_GetProcAddress failed for %s\n", name ); + Con_Reportf( S_ERROR "%s failed for %s\n", __func__, name ); } return func; @@ -531,7 +531,7 @@ static qboolean GL_CreateContext( void ) #if SDL_VERSION_ATLEAST(2, 0, 0) if( ( glw_state.context = SDL_GL_CreateContext( host.hWnd ) ) == NULL) { - Con_Reportf( S_ERROR "GL_CreateContext: %s\n", SDL_GetError()); + Con_Reportf( S_ERROR "%s: %s\n", __func__, SDL_GetError( )); return GL_DeleteContext(); } #endif // SDL_VERSION_ATLEAST( 2, 0, 0 ) @@ -548,7 +548,7 @@ static qboolean GL_UpdateContext( void ) #if SDL_VERSION_ATLEAST( 2, 0, 0 ) if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ) < 0 ) { - Con_Reportf( S_ERROR "GL_UpdateContext: %s\n", SDL_GetError()); + Con_Reportf( S_ERROR "%s: %s\n", __func__, SDL_GetError( )); return GL_DeleteContext(); } #endif // SDL_VERSION_ATLEAST( 2, 0, 0 ) @@ -704,7 +704,7 @@ static qboolean VID_CreateWindowWithSafeGL( const char *wndname, int xpos, int y if( host.hWnd ) break; - Con_Reportf( S_ERROR "VID_CreateWindow: couldn't create '%s' with safegl level %d: %s\n", wndname, glw_state.safe, SDL_GetError()); + Con_Reportf( S_ERROR "%s: couldn't create '%s' with safegl level %d: %s\n", __func__, wndname, glw_state.safe, SDL_GetError()); glw_state.safe++; @@ -758,7 +758,7 @@ qboolean VID_CreateWindow( int width, int height, window_mode_t window_mode ) if( SDL_GetDisplayBounds( 0, &r ) < 0 ) #endif { - Con_Reportf( S_ERROR "VID_CreateWindow: SDL_GetDisplayBounds failed: %s\n", SDL_GetError( )); + Con_Reportf( S_ERROR "%s: SDL_GetDisplayBounds failed: %s\n", __func__, SDL_GetError( )); xpos = SDL_WINDOWPOS_CENTERED; ypos = SDL_WINDOWPOS_CENTERED; } @@ -1097,7 +1097,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod #endif refState.fullScreen = window_mode != WINDOW_MODE_WINDOWED; - Con_Reportf( "R_ChangeDisplaySettings: Setting video mode to %dx%d %s\n", width, height, refState.fullScreen ? "fullscreen" : "windowed" ); + Con_Reportf( "%s: Setting video mode to %dx%d %s\n", __func__, width, height, refState.fullScreen ? "fullscreen" : "windowed" ); if( !host.hWnd ) { @@ -1173,7 +1173,7 @@ qboolean VID_SetMode( void ) if( Q_strcmp( vid_fullscreen.string, DEFAULT_FULLSCREEN )) { Cvar_DirectSet( &vid_fullscreen, DEFAULT_FULLSCREEN ); - Con_Reportf( S_ERROR "VID_SetMode: windowed unavailable on this platform\n" ); + Con_Reportf( S_ERROR "%s: windowed unavailable on this platform\n", __func__ ); } #endif @@ -1196,22 +1196,22 @@ qboolean VID_SetMode( void ) if( err == rserr_invalid_fullscreen ) { Cvar_DirectSet( &vid_fullscreen, "0" ); - Con_Reportf( S_ERROR "VID_SetMode: fullscreen unavailable in this mode\n" ); - Sys_Warn("fullscreen unavailable in this mode!"); + Con_Reportf( S_ERROR "%s: fullscreen unavailable in this mode\n", __func__ ); + Sys_Warn( "fullscreen unavailable in this mode!" ); if(( err = R_ChangeDisplaySettings( iScreenWidth, iScreenHeight, WINDOW_MODE_WINDOWED )) == rserr_ok ) return true; } else if( err == rserr_invalid_mode ) { - Con_Reportf( S_ERROR "VID_SetMode: invalid mode\n" ); + Con_Reportf( S_ERROR "%s: invalid mode\n", __func__ ); Sys_Warn( "invalid mode, engine will run in %dx%d", sdlState.prev_width, sdlState.prev_height ); } // try setting it back to something safe if(( err = R_ChangeDisplaySettings( sdlState.prev_width, sdlState.prev_height, WINDOW_MODE_WINDOWED )) != rserr_ok ) { - Con_Reportf( S_ERROR "VID_SetMode: could not revert to safe mode\n" ); - Sys_Warn("could not revert to safe mode!"); + Con_Reportf( S_ERROR "%s: could not revert to safe mode\n", __func__ ); + Sys_Warn( "could not revert to safe mode!" ); return false; } } diff --git a/engine/platform/win32/con_win.c b/engine/platform/win32/con_win.c index 16be7294..f7559346 100644 --- a/engine/platform/win32/con_win.c +++ b/engine/platform/win32/con_win.c @@ -586,7 +586,7 @@ destroy win32 console void Wcon_DestroyConsole( void ) { // last text message into console or log - Con_Reportf( "Sys_FreeLibrary: Unloading xash.dll\n" ); + Con_Reportf( "%s: Unloading xash.dll\n", __func__ ); Sys_CloseLog(); diff --git a/engine/platform/win32/lib_win.c b/engine/platform/win32/lib_win.c index ef5f8aef..21ba1b2c 100644 --- a/engine/platform/win32/lib_win.c +++ b/engine/platform/win32/lib_win.c @@ -289,7 +289,7 @@ table_error: if( f ) FS_Close( f ); if( p_Names ) Mem_Free( p_Names ); FreeNameFuncGlobals( hInst ); - Con_Printf( S_ERROR "LoadLibrary: %s\n", errorstring ); + Con_Printf( S_ERROR "%s: %s\n", __func__, errorstring ); return false; } @@ -318,28 +318,28 @@ static PIMAGE_IMPORT_DESCRIPTOR GetImportDescriptor( const char *name, byte *dat if ( !data ) { - Con_Printf( S_ERROR "%s: couldn't load %s\n", __FUNCTION__, name ); + Con_Printf( S_ERROR "%s: couldn't load %s\n", __func__, name ); return NULL; } dosHeader = (PIMAGE_DOS_HEADER)data; if ( dosHeader->e_magic != IMAGE_DOS_SIGNATURE ) { - Con_Printf( S_ERROR "%s: %s is not a valid executable file\n", __FUNCTION__, name ); + Con_Printf( S_ERROR "%s: %s is not a valid executable file\n", __func__, name ); return NULL; } peHeader = (PIMAGE_NT_HEADERS)( data + dosHeader->e_lfanew ); if ( peHeader->Signature != IMAGE_NT_SIGNATURE ) { - Con_Printf( S_ERROR "%s: %s is missing a PE header\n", __FUNCTION__, name ); + Con_Printf( S_ERROR "%s: %s is missing a PE header\n", __func__, name ); return NULL; } importDir = &peHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; if( importDir->Size <= 0 ) { - Con_Printf( S_ERROR "%s: %s has no dependencies\n", __FUNCTION__, name ); + Con_Printf( S_ERROR "%s: %s has no dependencies\n", __func__, name ); return NULL; } @@ -521,10 +521,10 @@ void COM_FreeLibrary( void *hInstance ) if( host.status == HOST_CRASHED ) { // we need to hold down all modules, while MSVC can find error - Con_Reportf( "Sys_FreeLibrary: hold %s for debugging\n", hInst->dllName ); + Con_Reportf( "%s: hold %s for debugging\n", __func__, hInst->dllName ); return; } - else Con_Reportf( "Sys_FreeLibrary: Unloading %s\n", hInst->dllName ); + else Con_Reportf( "%s: Unloading %s\n", __func__, hInst->dllName ); #if XASH_X86 if( hInst->custom_loader ) diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index f249a143..5ed66e09 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -710,7 +710,7 @@ static void SV_FlushRedirect( netadr_t adr, int dest, char *buf ) MSG_WriteString( &sv.current_client->netchan.message, buf ); break; case RD_NONE: - Con_Printf( S_ERROR "SV_FlushRedirect: %s: invalid destination\n", NET_AdrToString( adr )); + Con_Printf( S_ERROR "%s: %s: invalid destination\n", __func__, NET_AdrToString( adr )); break; } } @@ -1004,7 +1004,7 @@ static void SV_BuildNetAnswer( netadr_t from ) if( ret == -1 ) { - Con_DPrintf( S_WARN "SV_BuildNetAnswer: NETAPI_REQUEST_PLAYERS: buffer overflow!\n" ); + Con_DPrintf( S_WARN "%s: NETAPI_REQUEST_PLAYERS: buffer overflow!\n", __func__ ); break; } @@ -1792,8 +1792,8 @@ static qboolean SV_ShouldUpdateUserinfo( sv_client_t *cl ) // player changes userinfo too quick! ignore! if( host.realtime < cl->userinfo_next_changetime ) { - Con_Reportf( "SV_ShouldUpdateUserinfo: ignore userinfo update for %s: penalty %f, attempts %i\n", - cl->name, cl->userinfo_penalty, cl->userinfo_change_attempts ); + Con_Reportf( "%s: ignore userinfo update for %s: penalty %f, attempts %i\n", + __func__, cl->name, cl->userinfo_penalty, cl->userinfo_change_attempts ); allow = false; } @@ -1803,7 +1803,7 @@ static qboolean SV_ShouldUpdateUserinfo( sv_client_t *cl ) // they spammed too fast, increase penalty if( cl->userinfo_change_attempts > sv_userinfo_penalty_attempts.value ) { - Con_Reportf( "SV_ShouldUpdateUserinfo: penalty set %f for %s\n", + Con_Reportf( "%s: penalty set %f for %s\n", __func__, cl->userinfo_penalty, cl->name ); cl->userinfo_penalty *= sv_userinfo_penalty_multiplier.value; cl->userinfo_change_attempts = 0; @@ -3141,7 +3141,7 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg ) pcmd = Cmd_Argv( 0 ); if( sv_log_outofband.value ) - Con_Reportf( "SV_ConnectionlessPacket: %s : %s\n", NET_AdrToString( from ), pcmd ); + Con_Reportf( "%s: %s : %s\n", __func__, NET_AdrToString( from ), pcmd ); if( !Q_strcmp( pcmd, "ping" )) SV_Ping( from ); else if( !Q_strcmp( pcmd, "ack" )) SV_Ack( from ); @@ -3209,7 +3209,7 @@ static void SV_ParseClientMove( sv_client_t *cl, sizebuf_t *msg ) if( totalcmds < 0 || totalcmds >= CMD_MASK ) { - Con_Reportf( S_ERROR "SV_ParseClientMove: %s sending too many commands %i\n", cl->name, totalcmds ); + Con_Reportf( S_ERROR "%s: %s sending too many commands %i\n", __func__, cl->name, totalcmds ); SV_DropClient( cl, false ); return; } @@ -3232,7 +3232,7 @@ static void SV_ParseClientMove( sv_client_t *cl, sizebuf_t *msg ) if( checksum2 != checksum1 ) { - Con_Reportf( S_ERROR "SV_UserMove: failed command checksum for %s (%d != %d)\n", cl->name, checksum2, checksum1 ); + Con_Reportf( S_ERROR "%s: failed command checksum for %s (%d != %d)\n", __func__, cl->name, checksum2, checksum1 ); return; } @@ -3451,7 +3451,7 @@ static void SV_ParseVoiceData( sv_client_t *cl, sizebuf_t *msg ) if( size > sizeof( received )) { - Con_DPrintf( "SV_ParseVoiceData: invalid incoming packet.\n" ); + Con_DPrintf( "%s: invalid incoming packet.\n", __func__ ); SV_DropClient( cl, false ); return; } diff --git a/engine/server/sv_cmds.c b/engine/server/sv_cmds.c index e7c5001a..811cdd52 100644 --- a/engine/server/sv_cmds.c +++ b/engine/server/sv_cmds.c @@ -727,7 +727,7 @@ static void SV_ServerInfo_f( void ) { Con_Printf( "Server info settings:\n" ); Info_Print( svs.serverinfo ); - Con_Printf( "Total %lu symbols\n", Q_strlen( svs.serverinfo )); + Con_Printf( "Total %zu symbols\n", Q_strlen( svs.serverinfo )); return; } @@ -769,7 +769,7 @@ static void SV_LocalInfo_f( void ) { Con_Printf( "Local info settings:\n" ); Info_Print( svs.localinfo ); - Con_Printf( "Total %lu symbols\n", Q_strlen( svs.localinfo )); + Con_Printf( "Total %zu symbols\n", Q_strlen( svs.localinfo )); return; } diff --git a/engine/server/sv_custom.c b/engine/server/sv_custom.c index 027180e4..159358be 100644 --- a/engine/server/sv_custom.c +++ b/engine/server/sv_custom.c @@ -56,7 +56,7 @@ static void SV_CreateCustomizationList( sv_client_t *cl ) } else { - Con_Printf( S_WARN "SV_CreateCustomization list, ignoring dup. resource for player %s\n", cl->name ); + Con_Printf( S_WARN "%s: ignoring dup. resource for player %s\n", __func__, cl->name ); } } } @@ -228,7 +228,7 @@ void SV_TransferConsistencyInfo( void ) break; case force_model_samebounds: if( !Mod_GetStudioBounds( filepath, mins, maxs )) - Host_Error( "Mod_GetStudioBounds: couldn't get bounds for %s\n", filepath ); + Host_Error( "%s: couldn't get bounds for %s\n", __func__, filepath ); memcpy( &pResource->rguc_reserved[0x01], mins, sizeof( mins )); memcpy( &pResource->rguc_reserved[0x0D], maxs, sizeof( maxs )); pResource->rguc_reserved[0] = pc->check_type; diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index 76c0be3b..9e0e951c 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -252,13 +252,13 @@ void GAME_EXPORT SV_SetModel( edict_t *ent, const char *modelname ) if( !SV_IsValidEdict( ent )) { - Con_Printf( S_WARN "SV_SetModel: invalid entity %s\n", SV_ClassName( ent )); + Con_Printf( S_WARN "%s: invalid entity %s\n", __func__, SV_ClassName( ent )); return; } if( !modelname || ((byte)modelname[0] ) <= ' ' ) { - Con_Printf( S_WARN "SV_SetModel: null name\n" ); + Con_Printf( S_WARN "%s: null name\n", __func__ ); return; } @@ -272,7 +272,7 @@ void GAME_EXPORT SV_SetModel( edict_t *ent, const char *modelname ) if( i == 0 ) { if( sv.state == ss_active ) - Con_Printf( S_ERROR "SV_SetModel: failed to set model %s: world model cannot be changed\n", name ); + Con_Printf( S_ERROR "%s: failed to set model %s: world model cannot be changed\n", __func__, name ); return; } @@ -445,7 +445,7 @@ static int SV_Multicast( int dest, const vec3_t origin, const edict_t *ent, qboo specproxy = reliable = true; break; default: - Host_Error( "SV_Multicast: bad dest: %i\n", dest ); + Host_Error( "%s: bad dest: %i\n", __func__, dest ); return 0; } @@ -1087,7 +1087,7 @@ edict_t *GAME_EXPORT SV_AllocEdict( void ) } if( i >= GI->max_edicts ) - Host_Error( "ED_AllocEdict: no free edicts (max is %d)\n", GI->max_edicts ); + Host_Error( "%s: no free edicts (max is %d)\n", __func__, GI->max_edicts ); svgame.numEntities++; e = EDICT_NUM( i ); @@ -1990,31 +1990,31 @@ int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample if( vol < 0 || vol > 255 ) { - Con_Reportf( S_ERROR "SV_StartSound: volume = %i\n", vol ); + Con_Reportf( S_ERROR "%s: volume = %i\n", __func__, vol ); vol = bound( 0, vol, 255 ); } if( attn < 0.0f || attn > 4.0f ) { - Con_Reportf( S_ERROR "SV_StartSound: attenuation %g must be in range 0-4\n", attn ); + Con_Reportf( S_ERROR "%s: attenuation %g must be in range 0-4\n", __func__, attn ); attn = bound( 0.0f, attn, 4.0f ); } if( chan < 0 || chan > 7 ) { - Con_Reportf( S_ERROR "SV_StartSound: channel must be in range 0-7\n" ); + Con_Reportf( S_ERROR "%s: channel must be in range 0-7\n", __func__ ); chan = bound( 0, chan, 7 ); } if( pitch < 0 || pitch > 255 ) { - Con_Reportf( S_ERROR "SV_StartSound: pitch = %i\n", pitch ); + Con_Reportf( S_ERROR "%s: pitch = %i\n", __func__, pitch ); pitch = bound( 0, pitch, 255 ); } if( !COM_CheckString( sample )) { - Con_Reportf( S_ERROR "SV_StartSound: passed NULL sample\n" ); + Con_Reportf( S_ERROR "%s: passed NULL sample\n", __func__ ); return 0; } @@ -2048,7 +2048,7 @@ int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample if( !sound_idx ) { - Con_Printf( S_ERROR "SV_StartSound: %s not precached (%d)\n", sample, sound_idx ); + Con_Printf( S_ERROR "%s: %s not precached (%d)\n", __func__, sample, sound_idx ); return 0; } } @@ -2469,7 +2469,7 @@ static void GAME_EXPORT pfnLightStyle( int style, const char* val ) { if( style < 0 ) style = 0; if( style >= MAX_LIGHTSTYLES ) - Host_Error( "SV_LightStyle: style: %i >= %d", style, MAX_LIGHTSTYLES ); + Host_Error( "%s: style: %i >= %d", __func__, style, MAX_LIGHTSTYLES ); if( sv.loadgame ) return; // don't let the world overwrite our restored styles SV_SetLightStyle( style, val, 0.0f ); // set correct style @@ -2565,7 +2565,7 @@ static void GAME_EXPORT pfnMessageBegin( int msg_dest, int msg_num, const float int i, iSize; if( svgame.msg_started ) - Host_Error( "MessageBegin: New message started when msg '%s' has not been sent yet\n", svgame.msg_name ); + Host_Error( "%s: New message started when msg '%s' has not been sent yet\n", __func__, svgame.msg_name ); svgame.msg_started = true; // check range @@ -2605,7 +2605,7 @@ static void GAME_EXPORT pfnMessageBegin( int msg_dest, int msg_num, const float if( i == MAX_USER_MESSAGES ) { - Host_Error( "MessageBegin: tried to send unregistered message %i\n", msg_num ); + Host_Error( "%s: tried to send unregistered message %i\n", __func__, msg_num ); return; } @@ -2637,7 +2637,7 @@ static void GAME_EXPORT pfnMessageBegin( int msg_dest, int msg_num, const float msg_num > svc_lastmsg && Q_strcmp( svgame.msg_name, "ReqState" ); - if( svgame.msg_trace ) Con_Printf( "^3%s( %i, %s )\n", __FUNCTION__, msg_dest, svgame.msg_name ); + if( svgame.msg_trace ) Con_Printf( "^3%s( %i, %s )\n", __func__, msg_dest, svgame.msg_name ); } /* @@ -2653,12 +2653,12 @@ static void GAME_EXPORT pfnMessageEnd( void ) word realsize; if( svgame.msg_name ) name = svgame.msg_name; - if( !svgame.msg_started ) Host_Error( "MessageEnd: called with no active message\n" ); + if( !svgame.msg_started ) Host_Error( "%s: called with no active message\n", __func__ ); svgame.msg_started = false; if( MSG_CheckOverflow( &sv.multicast )) { - Con_Printf( S_ERROR "MessageEnd: %s has overflow multicast buffer\n", name ); + Con_Printf( S_ERROR "%s: %s has overflow multicast buffer\n", __func__, name ); MSG_Clear( &sv.multicast ); return; } @@ -2669,14 +2669,14 @@ static void GAME_EXPORT pfnMessageEnd( void ) { if( MSG_CheckOverflow( &sv.multicast )) { - Con_Printf( S_ERROR "MessageEnd: %s has overflow multicast buffer (post-rewrite)\n", name ); + Con_Printf( S_ERROR "%s: %s has overflow multicast buffer (post-rewrite)\n", __func__, name ); MSG_Clear( &sv.multicast ); return; } } else { - Con_Printf( S_ERROR "MessageEnd: failed to rewrite message %s\n", name ); + Con_Printf( S_ERROR "%s: failed to rewrite message %s\n", __func__, name ); MSG_Clear( &sv.multicast ); return; } @@ -2690,13 +2690,13 @@ static void GAME_EXPORT pfnMessageEnd( void ) // variable sized message if( svgame.msg_realsize > MAX_USERMSG_LENGTH ) { - Con_Printf( S_ERROR "SV_Multicast: %s too long (more than %d bytes)\n", name, MAX_USERMSG_LENGTH ); + Con_Printf( S_ERROR "%s: %s too long (more than %d bytes)\n", __func__, name, MAX_USERMSG_LENGTH ); MSG_Clear( &sv.multicast ); return; } else if( svgame.msg_realsize < 0 ) { - Con_Printf( S_ERROR "SV_Multicast: %s writes NULL message\n", name ); + Con_Printf( S_ERROR "%s: %s writes NULL message\n", __func__, name ); MSG_Clear( &sv.multicast ); return; } @@ -2713,7 +2713,7 @@ static void GAME_EXPORT pfnMessageEnd( void ) // compare sizes if( expsize != realsize ) { - Con_Printf( S_ERROR "SV_Multicast: %s expected %i bytes, it written %i. Ignored.\n", name, expsize, realsize ); + Con_Printf( S_ERROR "%s: %s expected %i bytes, it written %i. Ignored.\n", __func__, name, expsize, realsize ); MSG_Clear( &sv.multicast ); return; } @@ -2723,13 +2723,13 @@ static void GAME_EXPORT pfnMessageEnd( void ) // variable sized message if( svgame.msg_realsize > MAX_USERMSG_LENGTH ) { - Con_Printf( S_ERROR "SV_Multicast: %s too long (more than %d bytes)\n", name, MAX_USERMSG_LENGTH ); + Con_Printf( S_ERROR "%s: %s too long (more than %d bytes)\n", __func__, name, MAX_USERMSG_LENGTH ); MSG_Clear( &sv.multicast ); return; } else if( svgame.msg_realsize < 0 ) { - Con_Printf( S_ERROR "SV_Multicast: %s writes NULL message\n", name ); + Con_Printf( S_ERROR "%s: %s writes NULL message\n", __func__, name ); MSG_Clear( &sv.multicast ); return; } @@ -2740,7 +2740,7 @@ static void GAME_EXPORT pfnMessageEnd( void ) else { // this should never happen - Con_Printf( S_ERROR "SV_Multicast: %s have encountered error\n", name ); + Con_Printf( S_ERROR "%s: %s have encountered error\n", __func__, name ); MSG_Clear( &sv.multicast ); return; } @@ -2757,7 +2757,7 @@ static void GAME_EXPORT pfnMessageEnd( void ) SV_Multicast( svgame.msg_dest, org, svgame.msg_ent, true, false ); - if( svgame.msg_trace ) Con_Printf( "^3%s()\n", __FUNCTION__ ); + if( svgame.msg_trace ) Con_Printf( "^3%s()\n", __func__ ); } /* @@ -2770,7 +2770,7 @@ static void GAME_EXPORT pfnWriteByte( int iValue ) { if( iValue == -1 ) iValue = 0xFF; // convert char to byte MSG_WriteByte( &sv.multicast, (byte)iValue ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __FUNCTION__, iValue ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __func__, iValue ); svgame.msg_realsize++; } @@ -2783,7 +2783,7 @@ pfnWriteChar static void GAME_EXPORT pfnWriteChar( int iValue ) { MSG_WriteChar( &sv.multicast, (signed char)iValue ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __FUNCTION__, iValue ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __func__, iValue ); svgame.msg_realsize++; } @@ -2796,7 +2796,7 @@ pfnWriteShort static void GAME_EXPORT pfnWriteShort( int iValue ) { MSG_WriteShort( &sv.multicast, (short)iValue ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __FUNCTION__, iValue ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __func__, iValue ); svgame.msg_realsize += 2; } @@ -2809,7 +2809,7 @@ pfnWriteLong static void GAME_EXPORT pfnWriteLong( int iValue ) { MSG_WriteLong( &sv.multicast, iValue ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __FUNCTION__, iValue ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __func__, iValue ); svgame.msg_realsize += 4; } @@ -2825,7 +2825,7 @@ static void GAME_EXPORT pfnWriteAngle( float flValue ) int iAngle = ((int)(( flValue ) * 256 / 360) & 255); MSG_WriteChar( &sv.multicast, iAngle ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %f )\n", __FUNCTION__, flValue ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %f )\n", __func__, flValue ); svgame.msg_realsize += 1; } @@ -2838,7 +2838,7 @@ pfnWriteCoord static void GAME_EXPORT pfnWriteCoord( float flValue ) { MSG_WriteCoord( &sv.multicast, flValue ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %f )\n", __FUNCTION__, flValue ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %f )\n", __func__, flValue ); svgame.msg_realsize += 2; } @@ -2851,7 +2851,7 @@ pfnWriteString static void GAME_EXPORT pfnWriteString( const char *src ) { MSG_WriteString( &sv.multicast, src ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %s )\n", __FUNCTION__, src ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %s )\n", __func__, src ); // NOTE: some messages with constant string length can be marked as known sized svgame.msg_realsize += Q_strlen( src ) + 1; @@ -2866,9 +2866,9 @@ pfnWriteEntity static void GAME_EXPORT pfnWriteEntity( int iValue ) { if( iValue < 0 || iValue >= svgame.numEntities ) - Host_Error( "MSG_WriteEntity: invalid entnumber %i\n", iValue ); + Host_Error( "%s: invalid entnumber %i\n", __func__, iValue ); MSG_WriteShort( &sv.multicast, (short)iValue ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __FUNCTION__, iValue ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __func__, iValue ); svgame.msg_realsize += 2; } @@ -3055,7 +3055,7 @@ this helps not to lose strings that belongs to static game part void SV_SetStringArrayMode( qboolean dynamic ) { #ifdef XASH_64BIT - Con_Reportf( "SV_SetStringArrayMode(%d) %d\n", dynamic, str64.dynamic ); + Con_Reportf( "%s(%d) %d\n", __func__, dynamic, str64.dynamic ); if( dynamic == str64.dynamic ) return; @@ -3087,7 +3087,7 @@ static void SV_AllocStringPool( void ) void *ptr = NULL; string lenstr; - Con_Reportf( "SV_AllocStringPool()\n" ); + Con_Reportf( "%s()\n", __func__ ); if( Sys_GetParmFromCmdLine( "-str64alloc", lenstr ) ) { str64.maxstringarray = Q_atoi( lenstr ); @@ -3143,17 +3143,17 @@ static void SV_AllocStringPool( void ) if( ptr ) { - Con_Reportf( "SV_AllocStringPool: Allocated string array near the server library: %p %p\n", base, ptr ); + Con_Reportf( "%s: Allocated string array near the server library: %p %p\n", __func__, base, ptr ); } else { - Con_Reportf( "SV_AllocStringPool: Failed to allocate string array near the server library!\n" ); - ptr = str64.staticstringarray = Mem_Calloc(host.mempool, str64.maxstringarray * 2); + Con_Reportf( "%s: Failed to allocate string array near the server library!\n", __func__ ); + ptr = str64.staticstringarray = Mem_Calloc( host.mempool, str64.maxstringarray * 2 ); } } #else - ptr = str64.staticstringarray = Mem_Calloc(host.mempool, str64.maxstringarray * 2); + ptr = str64.staticstringarray = Mem_Calloc( host.mempool, str64.maxstringarray * 2 ); #endif str64.pstringarray = ptr; @@ -3170,7 +3170,7 @@ static void SV_AllocStringPool( void ) static void SV_FreeStringPool( void ) { #ifdef XASH_64BIT - Con_Reportf( "SV_FreeStringPool()\n" ); + Con_Reportf( "%s()\n", __func__ ); #ifdef USE_MMAP if( str64.pstringarray != str64.staticstringarray ) @@ -3519,13 +3519,13 @@ static int GAME_EXPORT pfnRegUserMsg( const char *pszName, int iSize ) if( Q_strlen( pszName ) >= sizeof( svgame.msg[0].name )) { - Con_Printf( S_ERROR "REG_USER_MSG: too long name %s\n", pszName ); + Con_Printf( S_ERROR "%s: too long name %s\n", __func__, pszName ); return svc_bad; // force error } if( iSize > MAX_USERMSG_LENGTH ) { - Con_Printf( S_ERROR "REG_USER_MSG: %s has too big size %i\n", pszName, iSize ); + Con_Printf( S_ERROR "%s: %s has too big size %i\n", __func__, pszName, iSize ); return svc_bad; // force error } @@ -3542,7 +3542,7 @@ static int GAME_EXPORT pfnRegUserMsg( const char *pszName, int iSize ) if( i == MAX_USER_MESSAGES ) { - Con_Printf( S_ERROR "REG_USER_MSG: user messages limit exceeded\n" ); + Con_Printf( S_ERROR "%s: user messages limit exceeded\n", __func__ ); return svc_bad; } @@ -3709,7 +3709,7 @@ static void GAME_EXPORT pfnSetView( const edict_t *pClient, const edict_t *pView if(( client = SV_ClientFromEdict( pClient, false )) == NULL ) { - Con_Printf( S_ERROR "PF_SetView_I: not a client!\n" ); + Con_Printf( S_ERROR "%s: not a client!\n", __func__ ); return; } @@ -3978,7 +3978,7 @@ static const char *GAME_EXPORT pfnGetPhysicsKeyValue( const edict_t *pClient, co // pfnUserInfoChanged passed if(( cl = SV_ClientFromEdict( pClient, false )) == NULL ) { - Con_Printf( S_ERROR "GetPhysicsKeyValue: tried to a non-client!\n" ); + Con_Printf( S_ERROR "%s: tried to a non-client!\n", __func__ ); return ""; } @@ -3998,7 +3998,7 @@ static void GAME_EXPORT pfnSetPhysicsKeyValue( const edict_t *pClient, const cha // pfnUserInfoChanged passed if(( cl = SV_ClientFromEdict( pClient, false )) == NULL ) { - Con_Printf( S_ERROR "SetPhysicsKeyValue: tried to a non-client!\n" ); + Con_Printf( S_ERROR "%s: tried to a non-client!\n", __func__ ); return; } @@ -4018,7 +4018,7 @@ static const char *GAME_EXPORT pfnGetPhysicsInfoString( const edict_t *pClient ) // pfnUserInfoChanged passed if(( cl = SV_ClientFromEdict( pClient, false )) == NULL ) { - Con_Printf( S_ERROR "GetPhysicsInfoString: tried to a non-client!\n" ); + Con_Printf( S_ERROR "%s: tried to a non-client!\n", __func__ ); return ""; } @@ -4062,14 +4062,14 @@ void GAME_EXPORT SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word // first check event for out of bounds if( eventindex < 1 || eventindex >= MAX_EVENTS ) { - Con_Printf( S_ERROR "EV_Playback: invalid eventindex %i\n", eventindex ); + Con_Printf( S_ERROR "%s: invalid eventindex %i\n", __func__, eventindex ); return; } // check event for precached if( !COM_CheckString( sv.event_precache[eventindex] )) { - Con_Printf( S_ERROR "EV_Playback: event %i was not precached\n", eventindex ); + Con_Printf( S_ERROR "%s: event %i was not precached\n", __func__, eventindex ); return; } @@ -4580,7 +4580,7 @@ static void GAME_EXPORT pfnQueryClientCvarValue( const edict_t *player, const ch { if( svgame.dllFuncs2.pfnCvarValue ) svgame.dllFuncs2.pfnCvarValue( player, "Bad Player" ); - Con_Printf( S_ERROR "QueryClientCvarValue: tried to send to a non-client!\n" ); + Con_Printf( S_ERROR "%s: tried to send to a non-client!\n", __func__ ); } } @@ -4608,7 +4608,7 @@ static void GAME_EXPORT pfnQueryClientCvarValue2( const edict_t *player, const c { if( svgame.dllFuncs2.pfnCvarValue2 ) svgame.dllFuncs2.pfnCvarValue2( player, requestID, cvarName, "Bad Player" ); - Con_Printf( S_ERROR "QueryClientCvarValue: tried to send to a non-client!\n" ); + Con_Printf( S_ERROR "%s: tried to send to a non-client!\n", __func__ ); } } @@ -4845,17 +4845,17 @@ static qboolean SV_ParseEdict( char **pfile, edict_t *ent ) // parse key if(( *pfile = COM_ParseFile( *pfile, keyname, sizeof( keyname ))) == NULL ) - Host_Error( "ED_ParseEdict: EOF without closing brace\n" ); + Host_Error( "%s: EOF without closing brace\n", __func__ ); if( keyname[0] == '}' ) break; // end of desc // parse value if(( *pfile = COM_ParseFile( *pfile, value, sizeof( value ))) == NULL ) - Host_Error( "ED_ParseEdict: EOF without closing brace\n" ); + Host_Error( "%s: EOF without closing brace\n", __func__ ); if( value[0] == '}' ) - Host_Error( "ED_ParseEdict: closing brace without data\n" ); + Host_Error( "%s: closing brace without data\n", __func__ ); // ignore attempts to set empty key or value // "wad" field is already handled @@ -5041,7 +5041,7 @@ static void SV_LoadFromFile( const char *mapname, char *entities ) while(( entities = COM_ParseFile( entities, token, sizeof( token ))) != NULL ) { if( token[0] != '{' ) - Host_Error( "ED_LoadFromFile: found %s when expecting {\n", token ); + Host_Error( "%s: found %s when expecting {\n", __func__, token ); if( create_world ) { @@ -5209,7 +5209,7 @@ qboolean SV_LoadProgs( const char *name ) if( !GetEntityAPI && !GetEntityAPI2 ) { COM_FreeLibrary( svgame.hInstance ); - Con_Printf( S_ERROR "SV_LoadProgs: failed to get address of GetEntityAPI proc\n" ); + Con_Printf( S_ERROR "%s: failed to get address of GetEntityAPI proc\n", __func__ ); svgame.hInstance = NULL; Mem_FreePool( &svgame.mempool ); return false; @@ -5220,7 +5220,7 @@ qboolean SV_LoadProgs( const char *name ) if( !GiveFnptrsToDll ) { COM_FreeLibrary( svgame.hInstance ); - Con_Printf( S_ERROR "SV_LoadProgs: failed to get address of GiveFnptrsToDll proc\n" ); + Con_Printf( S_ERROR "%s: failed to get address of GiveFnptrsToDll proc\n", __func__ ); svgame.hInstance = NULL; Mem_FreePool( &svgame.mempool ); return false; @@ -5236,7 +5236,7 @@ qboolean SV_LoadProgs( const char *name ) if( !GiveNewDllFuncs( &svgame.dllFuncs2, &version )) { if( version != NEW_DLL_FUNCTIONS_VERSION ) - Con_Printf( S_WARN "SV_LoadProgs: new interface version %i should be %i\n", NEW_DLL_FUNCTIONS_VERSION, version ); + Con_Printf( S_WARN "%s: new interface version %i should be %i\n", __func__, NEW_DLL_FUNCTIONS_VERSION, version ); memset( &svgame.dllFuncs2, 0, sizeof( svgame.dllFuncs2 )); } } @@ -5248,37 +5248,37 @@ qboolean SV_LoadProgs( const char *name ) if( !GetEntityAPI2( &svgame.dllFuncs, &version )) { if( INTERFACE_VERSION != version ) - Con_Printf( S_WARN "SV_LoadProgs: interface version %i should be %i\n", INTERFACE_VERSION, version ); + Con_Printf( S_WARN "%s: interface version %i should be %i\n", __func__, INTERFACE_VERSION, version ); // fallback to old API if( !GetEntityAPI( &svgame.dllFuncs, version )) { COM_FreeLibrary( svgame.hInstance ); - Con_Printf( S_ERROR "SV_LoadProgs: couldn't get entity API\n" ); + Con_Printf( S_ERROR "%s: couldn't get entity API\n", __func__ ); svgame.hInstance = NULL; Mem_FreePool( &svgame.mempool ); return false; } - else Con_Reportf( "SV_LoadProgs: ^2initailized legacy EntityAPI ^7ver. %i\n", version ); + else Con_Reportf( "%s: ^2initailized legacy EntityAPI ^7ver. %i\n", __func__, version ); } - else Con_Reportf( "SV_LoadProgs: ^2initailized extended EntityAPI ^7ver. %i\n", version ); + else Con_Reportf( "%s: ^2initailized extended EntityAPI ^7ver. %i\n", __func__, version ); } else if( !GetEntityAPI( &svgame.dllFuncs, version )) { COM_FreeLibrary( svgame.hInstance ); - Con_Printf( S_ERROR "SV_LoadProgs: couldn't get entity API\n" ); + Con_Printf( S_ERROR "%s: couldn't get entity API\n", __func__ ); svgame.hInstance = NULL; Mem_FreePool( &svgame.mempool ); return false; } - else Con_Reportf( "SV_LoadProgs: ^2initailized legacy EntityAPI ^7ver. %i\n", version ); + else Con_Reportf( "%s: ^2initailized legacy EntityAPI ^7ver. %i\n", __func__, version ); SV_InitOperatorCommands(); Mod_InitStudioAPI(); if( !SV_InitPhysicsAPI( )) { - Con_Printf( S_WARN "SV_LoadProgs: couldn't get physics API\n" ); + Con_Printf( S_WARN "%s: couldn't get physics API\n", __func__ ); } // grab function SV_SaveGameComment diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index a00719b4..40d58512 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -328,7 +328,7 @@ static void SV_ProcessFile( sv_client_t *cl, const char *filename ) if( resource == &cl->resourcesneeded ) { - Con_Printf( "SV_ProcessFile: Unrequested decal\n" ); + Con_Printf( "%s: Unrequested decal\n", __func__ ); return; } diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 5709e616..d0b0510e 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -1772,7 +1772,7 @@ static void SV_Physics_Entity( edict_t *ent ) SV_Physics_Pusher( ent ); break; case MOVETYPE_WALK: - Host_Error( "SV_Physics: bad movetype %i\n", ent->v.movetype ); + Host_Error( "%s: bad movetype %i\n", __func__, ent->v.movetype ); break; } @@ -1966,7 +1966,7 @@ static const char *GAME_EXPORT SV_GetLightStyle( int style ) { if( style < 0 ) style = 0; if( style >= MAX_LIGHTSTYLES ) - Host_Error( "SV_GetLightStyle: style: %i >= %d", style, MAX_LIGHTSTYLES ); + Host_Error( "%s: style: %i >= %d", __func__, style, MAX_LIGHTSTYLES ); return sv.lightstyles[style].pattern; } @@ -2046,7 +2046,7 @@ pfnWriteBytes static void GAME_EXPORT pfnWriteBytes( const byte *bytes, int count ) { MSG_WriteBytes( &sv.multicast, bytes, count ); - if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __FUNCTION__, count ); + if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )\n", __func__, count ); svgame.msg_realsize += count; } @@ -2141,7 +2141,7 @@ qboolean SV_InitPhysicsAPI( void ) { if( pPhysIface( SV_PHYSICS_INTERFACE_VERSION, &gPhysicsAPI, &svgame.physFuncs )) { - Con_Reportf( "SV_LoadProgs: ^2initailized extended PhysicAPI ^7ver. %i\n", SV_PHYSICS_INTERFACE_VERSION ); + Con_Reportf( "%s: ^2initailized extended PhysicAPI ^7ver. %i\n", __func__, SV_PHYSICS_INTERFACE_VERSION ); if( svgame.physFuncs.SV_CheckFeatures != NULL ) { diff --git a/engine/server/sv_pmove.c b/engine/server/sv_pmove.c index 27da1e53..23ca6625 100644 --- a/engine/server/sv_pmove.c +++ b/engine/server/sv_pmove.c @@ -340,7 +340,7 @@ static void GAME_EXPORT pfnParticle( const float *origin, int color, float life, if( !origin ) { - Con_Reportf( S_ERROR "SV_StartParticle: NULL origin. Ignored\n" ); + Con_Reportf( S_ERROR "%s: NULL origin. Ignored\n", __func__ ); return; } diff --git a/filesystem/VFileSystem009.cpp b/filesystem/VFileSystem009.cpp index 6000bcce..d75243f3 100644 --- a/filesystem/VFileSystem009.cpp +++ b/filesystem/VFileSystem009.cpp @@ -367,7 +367,7 @@ public: if( i == nullptr ) { - Con_DPrintf( "FindClose: Can't find search state by handle %d\n", handle ); + Con_DPrintf( "%s: Can't find search state by handle %d\n", __func__, handle ); return; } diff --git a/filesystem/dir.c b/filesystem/dir.c index aaf7959f..19de4660 100644 --- a/filesystem/dir.c +++ b/filesystem/dir.c @@ -275,7 +275,7 @@ static inline qboolean FS_AppendToPath( char *dst, size_t *pi, const size_t len, if( i >= len ) { - Con_Printf( S_ERROR "FS_FixFileCase: overflow while searching %s (%s)\n", path, err ); + Con_Printf( S_ERROR "%s: overflow while appending %s (%s)\n", __func__, path, err ); return false; } return true; diff --git a/filesystem/filesystem.c b/filesystem/filesystem.c index 51a155da..264a79b5 100644 --- a/filesystem/filesystem.c +++ b/filesystem/filesystem.c @@ -504,7 +504,7 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo ) file_t *f = FS_Open( filepath, "w", false ); // we in binary-mode int i, write_ambients = false; - if( !f ) Sys_Error( "FS_WriteGameInfo: can't write %s\n", filepath ); // may be disk-space is out? + if( !f ) Sys_Error( "%s: can't write %s\n", __func__, filepath ); // may be disk-space is out? FS_Printf( f, "// generated by " XASH_ENGINE_NAME " " XASH_VERSION "-%s (%s-%s)\n\n\n", Q_buildcommit(), Q_buildos(), Q_buildarch() ); @@ -532,7 +532,7 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo ) FS_Printf( f, "version\t\t%g\n", GameInfo->version ); if( GameInfo->size != 0 ) - FS_Printf( f, "size\t\t%lu\n", GameInfo->size ); + FS_Printf( f, "size\t\t%zu\n", GameInfo->size ); if( COM_CheckStringEmpty( GameInfo->game_url ) ) FS_Printf( f, "url_info\t\t\"%s\"\n", GameInfo->game_url ); @@ -1154,7 +1154,7 @@ void FS_AddGameHierarchy( const char *dir, uint flags ) { dir = FI.games[i]->gamefolder; // fixup directory case - Con_Reportf( "FS_AddGameHierarchy: adding recursive basedir %s\n", FI.games[i]->basedir ); + Con_Reportf( "%s: adding recursive basedir %s\n", __func__, FI.games[i]->basedir ); if( !FI.games[i]->added && Q_stricmp( FI.games[i]->gamefolder, FI.games[i]->basedir )) { FI.games[i]->added = true; @@ -1200,7 +1200,7 @@ void FS_Rescan( void ) { const char *str; const int extrasFlags = FS_NOWRITE_PATH | FS_CUSTOM_PATH; - Con_Reportf( "FS_Rescan( %s )\n", GI->title ); + Con_Reportf( "%s( %s )\n", __func__, GI->title ); FS_ClearSearchPath(); @@ -1234,7 +1234,7 @@ void FS_LoadGameInfo( const char *rootfolder ) fs_ext_path = false; if( rootfolder ) Q_strncpy( fs_gamedir, rootfolder, sizeof( fs_gamedir )); - Con_Reportf( "FS_LoadGameInfo( %s )\n", fs_gamedir ); + Con_Reportf( "%s( %s )\n", __func__, fs_gamedir ); // clear any old pathes FS_ClearSearchPath(); @@ -1381,11 +1381,11 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll { #if XASH_WIN32 && XASH_X86 // a1ba: custom loader is non-portable (I just don't want to touch it) Con_Printf( S_WARN "%s: loading libraries from packs is deprecated " - "and will be removed in the future\n", __FUNCTION__ ); + "and will be removed in the future\n", __func__ ); dllInfo->custom_loader = true; #else Con_Printf( S_WARN "%s: loading libraries from packs is unsupported on " - "this platform\n", __FUNCTION__ ); + "this platform\n", __func__ ); dllInfo->custom_loader = false; #endif } @@ -1553,7 +1553,7 @@ qboolean FS_InitStdio( qboolean unused_set_to_true, const char *rootdir, const c stringlistfreecontents( &dirs ); - Con_Reportf( "FS_Init: done\n" ); + Con_Reportf( "%s: done\n", __func__ ); return true; } @@ -1863,7 +1863,7 @@ int FS_SetCurrentDirectory( const char *path ) } #else // it may be fine for some systems to skip chdir - Con_Printf( "FS_SetCurrentDirectory: not implemented, ignoring...\n" ); + Con_Printf( "%s: not implemented, ignoring...\n", __func__ ); return true; #endif @@ -2476,7 +2476,7 @@ static byte *FS_LoadFile_( const char *path, fs_offset_t *filesizeptr, const qbo if( unlikely( !buf )) // TODO: indicate errors { - Con_Reportf( "%s: can't alloc %d bytes, no free memory\n", __func__, filesize + 1 ); + Con_Reportf( "%s: can't alloc %li bytes, no free memory\n", __func__, (long)filesize + 1 ); FS_Close( file ); return NULL; } @@ -2608,7 +2608,7 @@ qboolean FS_WriteFile( const char *filename, const void *data, fs_offset_t len ) if( !file ) { - Con_Reportf( S_ERROR "FS_WriteFile: failed on %s\n", filename); + Con_Reportf( S_ERROR "%s: failed on %s\n", __func__, filename ); return false; } @@ -2787,7 +2787,7 @@ qboolean FS_Rename( const char *oldname, const char *newname ) if( ret < 0 ) { Con_Printf( "%s: failed to rename file %s (%s) to %s (%s): %s\n", - __FUNCTION__, oldpath, oldname2, newpath, newname2, strerror( errno )); + __func__, oldpath, oldname2, newpath, newname2, strerror( errno )); return false; } @@ -2818,7 +2818,7 @@ qboolean GAME_EXPORT FS_Delete( const char *path ) ret = remove( real_path ); if( ret < 0 && errno != ENOENT ) { - Con_Printf( "%s: failed to delete file %s (%s): %s\n", __FUNCTION__, real_path, path, strerror( errno )); + Con_Printf( "%s: failed to delete file %s (%s): %s\n", __func__, real_path, path, strerror( errno )); return false; } @@ -2845,7 +2845,7 @@ qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize ) if(( readSize = FS_Read( pInput, buf, size )) < size ) { - Con_Reportf( S_ERROR "FS_FileCopy: unexpected end of input file (%d < %d)\n", readSize, size ); + Con_Reportf( S_ERROR "%s: unexpected end of input file (%d < %d)\n", __func__, readSize, size ); fileSize = 0; done = false; break; diff --git a/filesystem/pak.c b/filesystem/pak.c index a4555e47..9510a968 100644 --- a/filesystem/pak.c +++ b/filesystem/pak.c @@ -341,7 +341,7 @@ searchpath_t *FS_AddPak_Fullpath( const char *pakfile, int flags ) if( !pak ) { if( errorcode != PAK_LOAD_NO_FILES ) - Con_Reportf( S_ERROR "FS_AddPak_Fullpath: unable to load pak \"%s\"\n", pakfile ); + Con_Reportf( S_ERROR "%s: unable to load pak \"%s\"\n", __func__, pakfile ); return NULL; } diff --git a/filesystem/wad.c b/filesystem/wad.c index 44d73a76..0bd8ade3 100644 --- a/filesystem/wad.c +++ b/filesystem/wad.c @@ -319,7 +319,7 @@ static wfile_t *W_Open( const char *filename, int *error ) if( wad->handle == NULL ) { - Con_Reportf( S_ERROR "W_Open: couldn't open %s: %s\n", filename, strerror( errno )); + Con_Reportf( S_ERROR "%s: couldn't open %s: %s\n", __func__, filename, strerror( errno )); if( error ) *error = WAD_LOAD_COULDNT_OPEN; FS_CloseWAD( wad ); return NULL; @@ -331,7 +331,7 @@ static wfile_t *W_Open( const char *filename, int *error ) if( FS_Read( wad->handle, &header, sizeof( dwadinfo_t )) != sizeof( dwadinfo_t )) { - Con_Reportf( S_ERROR "W_Open: %s can't read header\n", filename ); + Con_Reportf( S_ERROR "%s: %s can't read header\n", __func__, filename ); if( error ) *error = WAD_LOAD_BAD_HEADER; FS_CloseWAD( wad ); return NULL; @@ -339,7 +339,7 @@ static wfile_t *W_Open( const char *filename, int *error ) if( header.ident != IDWAD2HEADER && header.ident != IDWAD3HEADER ) { - Con_Reportf( S_ERROR "W_Open: %s is not a WAD2 or WAD3 file\n", filename ); + Con_Reportf( S_ERROR "%s: %s is not a WAD2 or WAD3 file\n", __func__, filename ); if( error ) *error = WAD_LOAD_BAD_HEADER; FS_CloseWAD( wad ); return NULL; @@ -349,12 +349,12 @@ static wfile_t *W_Open( const char *filename, int *error ) if( lumpcount >= MAX_FILES_IN_WAD ) { - Con_Reportf( S_WARN "W_Open: %s is full (%i lumps)\n", filename, lumpcount ); + Con_Reportf( S_WARN "%s: %s is full (%i lumps)\n", __func__, filename, lumpcount ); if( error ) *error = WAD_LOAD_TOO_MANY_FILES; } else if( lumpcount <= 0 ) { - Con_Reportf( S_ERROR "W_Open: %s has no lumps\n", filename ); + Con_Reportf( S_ERROR "%s: %s has no lumps\n", __func__, filename ); if( error ) *error = WAD_LOAD_NO_FILES; FS_CloseWAD( wad ); return NULL; @@ -365,7 +365,7 @@ static wfile_t *W_Open( const char *filename, int *error ) if( FS_Seek( wad->handle, wad->infotableofs, SEEK_SET ) == -1 ) { - Con_Reportf( S_ERROR "W_Open: %s can't find lump allocation table\n", filename ); + Con_Reportf( S_ERROR "%s: %s can't find lump allocation table\n", __func__, filename ); if( error ) *error = WAD_LOAD_BAD_FOLDERS; FS_CloseWAD( wad ); return NULL; @@ -378,7 +378,7 @@ static wfile_t *W_Open( const char *filename, int *error ) if( FS_Read( wad->handle, srclumps, lat_size ) != lat_size ) { - Con_Reportf( S_ERROR "W_ReadLumpTable: %s has corrupted lump allocation table\n", filename ); + Con_Reportf( S_ERROR "%s: %s has corrupted lump allocation table\n", __func__, filename ); if( error ) *error = WAD_LOAD_CORRUPTED; Mem_Free( srclumps ); FS_CloseWAD( wad ); @@ -608,7 +608,7 @@ static byte *W_ReadLump( searchpath_t *search, const char *path, int pack_ind, f if( FS_Seek( wad->handle, lump->filepos, SEEK_SET ) == -1 ) { - Con_Reportf( S_ERROR "W_ReadLump: %s is corrupted\n", lump->name ); + Con_Reportf( S_ERROR "%s: %s is corrupted\n", __func__, lump->name ); FS_Seek( wad->handle, oldpos, SEEK_SET ); return NULL; } @@ -626,7 +626,7 @@ static byte *W_ReadLump( searchpath_t *search, const char *path, int pack_ind, f if( size < lump->disksize ) { - Con_Reportf( S_WARN "W_ReadLump: %s is probably corrupted\n", lump->name ); + Con_Reportf( S_WARN "%s: %s is probably corrupted\n", __func__, lump->name ); pfnFree( buf ); return NULL; } @@ -652,7 +652,7 @@ searchpath_t *FS_AddWad_Fullpath( const char *wadfile, int flags ) if( !wad ) { if( errorcode != WAD_LOAD_NO_FILES ) - Con_Reportf( S_ERROR "FS_AddWad_Fullpath: unable to load wad \"%s\"\n", wadfile ); + Con_Reportf( S_ERROR "%s: unable to load wad \"%s\"\n", __func__, wadfile ); return NULL; } diff --git a/filesystem/zip.c b/filesystem/zip.c index cdf0e252..4f27ffb2 100644 --- a/filesystem/zip.c +++ b/filesystem/zip.c @@ -409,7 +409,7 @@ static file_t *FS_OpenFile_ZIP( searchpath_t *search, const char *filename, cons // compressed files handled in Zip_LoadFile if( pfile->flags != ZIP_COMPRESSION_NO_COMPRESSION ) { - Con_Printf( S_ERROR "%s: can't open compressed file %s\n", __FUNCTION__, pfile->name ); + Con_Printf( S_ERROR "%s: can't open compressed file %s\n", __func__, pfile->name ); return NULL; } @@ -447,14 +447,14 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in if( header.signature != ZIP_HEADER_LF ) { - Con_Reportf( S_ERROR "Zip_LoadFile: %s signature error\n", file->name ); + Con_Reportf( S_ERROR "%s: %s signature error\n", __func__, file->name ); return NULL; }*/ decompressed_buffer = pfnAlloc( file->size + 1 ); if( unlikely( !decompressed_buffer )) { - Con_Reportf( S_ERROR "%s: can't alloc %d bytes, no free memory\n", __func__, file->size + 1 ); + Con_Reportf( S_ERROR "%s: can't alloc %li bytes, no free memory\n", __func__, (long)file->size + 1 ); return NULL; } decompressed_buffer[file->size] = '\0'; @@ -464,7 +464,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in c = read( search->zip->handle, decompressed_buffer, file->size ); if( c != file->size ) { - Con_Reportf( S_ERROR "Zip_LoadFile: %s size doesn't match\n", file->name ); + Con_Reportf( S_ERROR "%s: %s size doesn't match\n", __func__, file->name ); return NULL; } @@ -476,7 +476,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in if( final_crc != file->crc32 ) { - Con_Reportf( S_ERROR "Zip_LoadFile: %s file crc32 mismatch\n", file->name ); + Con_Reportf( S_ERROR "%s: %s file crc32 mismatch\n", __func__, file->name ); pfnFree( decompressed_buffer ); return NULL; } @@ -494,7 +494,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in c = read( search->zip->handle, compressed_buffer, file->compressed_size ); if( c != file->compressed_size ) { - Con_Reportf( S_ERROR "Zip_LoadFile: %s compressed size doesn't match\n", file->name ); + Con_Reportf( S_ERROR "%s: %s compressed size doesn't match\n", __func__, file->name ); return NULL; } @@ -511,7 +511,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in if( inflateInit2( &decompress_stream, -MAX_WBITS ) != Z_OK ) { - Con_Printf( S_ERROR "Zip_LoadFile: inflateInit2 failed\n" ); + Con_Printf( S_ERROR "%s: inflateInit2 failed\n", __func__ ); Mem_Free( compressed_buffer ); Mem_Free( decompressed_buffer ); return NULL; @@ -531,7 +531,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in if( final_crc != file->crc32 ) { - Con_Reportf( S_ERROR "Zip_LoadFile: %s file crc32 mismatch\n", file->name ); + Con_Reportf( S_ERROR "%s: %s file crc32 mismatch\n", __func__, file->name ); pfnFree( decompressed_buffer ); return NULL; } @@ -543,7 +543,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in } else { - Con_Reportf( S_ERROR "Zip_LoadFile: %s : error while file decompressing. Zlib return code %d.\n", file->name, zlib_result ); + Con_Reportf( S_ERROR "%s: %s: error while file decompressing. Zlib return code %d.\n", __func__, file->name, zlib_result ); Mem_Free( compressed_buffer ); pfnFree( decompressed_buffer ); return NULL; @@ -552,7 +552,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in } else { - Con_Reportf( S_ERROR "Zip_LoadFile: %s : file compressed with unknown algorithm.\n", file->name ); + Con_Reportf( S_ERROR "%s: %s: file compressed with unknown algorithm.\n", __func__, file->name ); pfnFree( decompressed_buffer ); return NULL; } @@ -683,7 +683,7 @@ searchpath_t *FS_AddZip_Fullpath( const char *zipfile, int flags ) if( !zip ) { if( errorcode != ZIP_LOAD_NO_FILES ) - Con_Reportf( S_ERROR "FS_AddZip_Fullpath: unable to load zip \"%s\"\n", zipfile ); + Con_Reportf( S_ERROR "%s: unable to load zip \"%s\"\n", __func__, zipfile ); return NULL; } diff --git a/ref/gl/gl2_shim/gl2_shim.c b/ref/gl/gl2_shim/gl2_shim.c index bb7f844b..1f4e3b8c 100644 --- a/ref/gl/gl2_shim/gl2_shim.c +++ b/ref/gl/gl2_shim/gl2_shim.c @@ -270,7 +270,7 @@ static GLuint GL2_GenerateShader( gl2wrap_prog_t *prog, GLenum type ) if( status == GL_FALSE ) { - gEngfuncs.Con_Reportf( S_ERROR "GL2_GenerateShader( 0x%04x, 0x%x ): compile failed: %s\n", prog->flags, type, GL_PrintInfoLog( id, false )); + gEngfuncs.Con_Reportf( S_ERROR "%s( 0x%04x, 0x%x ): compile failed: %s\n", __func__, prog->flags, type, GL_PrintInfoLog( id, false )); gEngfuncs.Con_DPrintf( "Shader text:\n%s\n\n", shader ); pglDeleteObjectARB( id ); @@ -301,13 +301,13 @@ static gl2wrap_prog_t *GL2_GetProg( const GLuint flags ) if( i == MAX_PROGS ) { - gEngfuncs.Host_Error( "GL2_GetProg: Ran out of program slots for 0x%04x\n", flags ); + gEngfuncs.Host_Error( "%s: Ran out of program slots for 0x%04x\n", __func__, flags ); return NULL; } // new prog; generate shaders - gEngfuncs.Con_DPrintf( S_NOTE "GL2_GetProg: Generating progs for 0x%04x\n", flags ); + gEngfuncs.Con_DPrintf( S_NOTE "%s: Generating progs for 0x%04x\n", __func__, flags ); prog = &gl2wrap.progs[i]; prog->flags = flags; @@ -354,7 +354,7 @@ static gl2wrap_prog_t *GL2_GetProg( const GLuint flags ) pglGetObjectParameterivARB( glprog, GL_OBJECT_LINK_STATUS_ARB, &status ); if( status == GL_FALSE ) { - gEngfuncs.Con_Reportf( S_ERROR "GL2_GetProg: Failed linking progs for 0x%04x!\n%s\n", prog->flags, GL_PrintInfoLog( glprog, true )); + gEngfuncs.Con_Reportf( S_ERROR "%s: Failed linking progs for 0x%04x!\n%s\n", __func__, prog->flags, GL_PrintInfoLog( glprog, true )); prog->flags = 0; if( pglDeleteProgram ) pglDeleteProgram( glprog ); @@ -406,7 +406,7 @@ static gl2wrap_prog_t *GL2_GetProg( const GLuint flags ) pglUseProgramObjectARB( gl2wrap.cur_prog->glprog ); prog->glprog = glprog; - gEngfuncs.Con_DPrintf( S_NOTE "GL2_GetProg: Generated progs for 0x%04x\n", flags ); + gEngfuncs.Con_DPrintf( S_NOTE "%s: Generated progs for 0x%04x\n", __func__, flags ); return prog; } @@ -648,7 +648,7 @@ int GL2_ShimInit( void ) pglBindVertexArray( 0 ); rpglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); - gEngfuncs.Con_DPrintf( S_NOTE "GL2_ShimInit: %u bytes allocated for vertex buffer\n", total ); + gEngfuncs.Con_DPrintf( S_NOTE "%s: %u bytes allocated for vertex buffer\n", __func__, total ); if( !GL2_InitProgs( )) { @@ -660,7 +660,7 @@ int GL2_ShimInit( void ) { gl2wrap_config.version = 100; if( !GL2_InitProgs( )) - gEngfuncs.Host_Error( "GL2_ShimInit: Failed to compile shaders!\n" ); + gEngfuncs.Host_Error( "%s: Failed to compile shaders!\n", __func__ ); } } } @@ -863,7 +863,7 @@ static void GL2_FlushPrims( void ) prog = GL2_SetProg( flags ); if( !prog ) { - gEngfuncs.Host_Error( "GL2_End: Could not find program for flags 0x%04x!\n", flags ); + gEngfuncs.Host_Error( "%s: Could not find program for flags 0x%04x!\n", __func__, flags ); goto leave_label; } diff --git a/ref/gl/gl_alias.c b/ref/gl/gl_alias.c index 110cd0fc..d1e46e2d 100644 --- a/ref/gl/gl_alias.c +++ b/ref/gl/gl_alias.c @@ -557,7 +557,7 @@ static void *Mod_LoadAllSkins( model_t *mod, int numskins, daliasskintype_t *psk int i, size; if( numskins < 1 || numskins > MAX_SKINS ) - gEngfuncs.Host_Error( "Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins ); + gEngfuncs.Host_Error( "%s: Invalid # of skins: %d\n", __func__, numskins ); size = m_pAliasHeader->skinwidth * m_pAliasHeader->skinheight; @@ -1215,7 +1215,7 @@ static void R_SetupAliasFrame( cl_entity_t *e, aliashdr_t *paliashdr ) else if( newframe >= paliashdr->numframes ) { if( newframe > paliashdr->numframes ) - gEngfuncs.Con_Reportf( S_WARN "R_GetAliasFrame: no such frame %d (%s)\n", newframe, e->model->name ); + gEngfuncs.Con_Reportf( S_WARN "%s: no such frame %d (%s)\n", __func__, newframe, e->model->name ); newframe = paliashdr->numframes - 1; } diff --git a/ref/gl/gl_backend.c b/ref/gl/gl_backend.c index 68247f78..d9f66b1c 100644 --- a/ref/gl/gl_backend.c +++ b/ref/gl/gl_backend.c @@ -172,7 +172,7 @@ void GL_SelectTexture( GLint tmu ) if( tmu >= GL_MaxTextureUnits( )) { - gEngfuncs.Con_Reportf( S_ERROR "GL_SelectTexture: bad tmu state %i\n", tmu ); + gEngfuncs.Con_Reportf( S_ERROR "%s: bad tmu state %i\n", __func__, tmu ); return; } @@ -289,7 +289,7 @@ void GL_TextureTarget( uint target ) { if( glState.activeTMU < 0 || glState.activeTMU >= GL_MaxTextureUnits( )) { - gEngfuncs.Con_Reportf( S_ERROR "GL_TextureTarget: bad tmu state %i\n", glState.activeTMU ); + gEngfuncs.Con_Reportf( S_ERROR "%s: bad tmu state %i\n", __func__, glState.activeTMU ); return; } diff --git a/ref/gl/gl_beams.c b/ref/gl/gl_beams.c index 01f91129..14b9820a 100644 --- a/ref/gl/gl_beams.c +++ b/ref/gl/gl_beams.c @@ -859,7 +859,7 @@ static qboolean R_BeamComputePoint( int beamEnt, vec3_t pt ) if( !ent ) { - gEngfuncs.Con_DPrintf( S_ERROR "R_BeamComputePoint: invalid entity %i\n", BEAMENT_ENTITY( beamEnt )); + gEngfuncs.Con_DPrintf( S_ERROR "%s: invalid entity %i\n", __func__, BEAMENT_ENTITY( beamEnt )); VectorClear( pt ); return false; } diff --git a/ref/gl/gl_context.c b/ref/gl/gl_context.c index ba3880f6..3653b5a8 100644 --- a/ref/gl/gl_context.c +++ b/ref/gl/gl_context.c @@ -154,7 +154,7 @@ static qboolean Mod_ProcessRenderData( model_t *mod, qboolean create, const byte case mod_brush: // Mod_LoadBrushModel( mod, buf, loaded ); break; - default: gEngfuncs.Host_Error( "Mod_LoadModel: unsupported type %d\n", mod->type ); + default: gEngfuncs.Host_Error( "%s: unsupported type %d\n", __func__, mod->type ); } } diff --git a/ref/gl/gl_decals.c b/ref/gl/gl_decals.c index 222e2a5d..a12d019a 100644 --- a/ref/gl/gl_decals.c +++ b/ref/gl/gl_decals.c @@ -74,7 +74,7 @@ static void R_DecalUnlink( decal_t *pdecal ) else { tmp = pdecal->psurface->pdecals; - if( !tmp ) gEngfuncs.Host_Error( "R_DecalUnlink: bad decal list\n" ); + if( !tmp ) gEngfuncs.Host_Error( "%s: bad decal list\n", __func__ ); while( tmp->pnext ) { diff --git a/ref/gl/gl_draw.c b/ref/gl/gl_draw.c index ad383f35..08f5e3bf 100644 --- a/ref/gl/gl_draw.c +++ b/ref/gl/gl_draw.c @@ -145,9 +145,9 @@ void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, c } if( cols > glConfig.max_2d_texture_size ) - gEngfuncs.Host_Error( "R_DrawStretchRaw: size %i exceeds hardware limits\n", cols ); + gEngfuncs.Host_Error( "%s: size %i exceeds hardware limits\n", __func__, cols ); if( rows > glConfig.max_2d_texture_size ) - gEngfuncs.Host_Error( "R_DrawStretchRaw: size %i exceeds hardware limits\n", rows ); + gEngfuncs.Host_Error( "%s: size %i exceeds hardware limits\n", __func__, rows ); pglDisable( GL_BLEND ); pglDisable( GL_ALPHA_TEST ); @@ -220,9 +220,9 @@ void R_UploadStretchRaw( int texture, int cols, int rows, int width, int height, } if( cols > glConfig.max_2d_texture_size ) - gEngfuncs.Host_Error( "R_UploadStretchRaw: size %i exceeds hardware limits\n", cols ); + gEngfuncs.Host_Error( "%s: size %i exceeds hardware limits\n", __func__, cols ); if( rows > glConfig.max_2d_texture_size ) - gEngfuncs.Host_Error( "R_UploadStretchRaw: size %i exceeds hardware limits\n", rows ); + gEngfuncs.Host_Error( "%s: size %i exceeds hardware limits\n", __func__, rows ); tex = R_GetTexture( texture ); GL_Bind( GL_KEEP_UNIT, texture ); diff --git a/ref/gl/gl_image.c b/ref/gl/gl_image.c index 06c7a329..f2128303 100644 --- a/ref/gl/gl_image.c +++ b/ref/gl/gl_image.c @@ -91,7 +91,7 @@ void GL_Bind( GLint tmu, GLenum texnum ) if( texnum <= 0 || texnum >= MAX_TEXTURES ) { if( texnum != 0 ) - gEngfuncs.Con_DPrintf( S_ERROR "GL_Bind: invalid texturenum %d\n", texnum ); + gEngfuncs.Con_DPrintf( S_ERROR "%s: invalid texturenum %d\n", __func__, texnum ); texnum = tr.defaultTexture; } if( tmu != GL_KEEP_UNIT ) @@ -489,7 +489,7 @@ static size_t GL_CalcTextureSize( GLenum format, int width, int height, int dept size = width * height * depth * 4; break; default: - gEngfuncs.Host_Error( "GL_CalcTextureSize: bad texture internal format (%u)\n", format ); + gEngfuncs.Host_Error( "%s: bad texture internal format (%u)\n", __func__, format ); break; } @@ -1165,7 +1165,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic ) // make sure what target is correct if( tex->target == GL_NONE ) { - gEngfuncs.Con_DPrintf( S_ERROR "GL_UploadTexture: %s is not supported by your hardware\n", tex->name ); + gEngfuncs.Con_DPrintf( S_ERROR "%s: %s is not supported by your hardware\n", __func__, tex->name ); return false; } @@ -1173,7 +1173,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic ) { if( !GL_Support( GL_ARB_TEXTURE_COMPRESSION_BPTC )) { - gEngfuncs.Con_DPrintf( S_ERROR "GL_UploadTexture: BC6H/BC7 compression formats is not supported by your hardware\n" ); + gEngfuncs.Con_DPrintf( S_ERROR "%s: BC6H/BC7 compression formats is not supported by your hardware\n", __func__ ); return false; } } @@ -1189,7 +1189,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic ) if(( pic->width * pic->height ) & 3 ) { // will be resampled, just tell me for debug targets - gEngfuncs.Con_Reportf( "GL_UploadTexture: %s s&3 [%d x %d]\n", tex->name, pic->width, pic->height ); + gEngfuncs.Con_Reportf( "%s: %s s&3 [%d x %d]\n", __func__, tex->name, pic->width, pic->height ); } buf = pic->buffer; @@ -1208,7 +1208,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic ) { // track the buffer bounds if( buf != NULL && buf >= bufend ) - gEngfuncs.Host_Error( "GL_UploadTexture: %s image buffer overflow\n", tex->name ); + gEngfuncs.Host_Error( "%s: %s image buffer overflow\n", __func__, tex->name ); if( ImageCompressed( pic->type )) { @@ -1466,7 +1466,7 @@ static void GL_DeleteTexture( gl_texture_t *tex ) // debug if( !tex->name[0] ) { - gEngfuncs.Con_Printf( S_ERROR "GL_DeleteTexture: trying to free unnamed texture with texnum %i\n", tex->texnum ); + gEngfuncs.Con_Printf( S_ERROR "%s: trying to free unnamed texture with texnum %i\n", __func__, tex->texnum ); return; } @@ -1657,20 +1657,20 @@ int GL_LoadTextureArray( const char **names, int flags ) // mixed mode: DXT + RGB if( pic->type != src->type ) { - gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch image format for %s and %s\n", names[0], names[i] ); + gEngfuncs.Con_Printf( S_ERROR "%s: mismatch image format for %s and %s\n", __func__, names[0], names[i] ); break; } // different mipcount if( pic->numMips != src->numMips ) { - gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch mip count for %s and %s\n", names[0], names[i] ); + gEngfuncs.Con_Printf( S_ERROR "%s: mismatch mip count for %s and %s\n", __func__, names[0], names[i] ); break; } if( pic->encode != src->encode ) { - gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch custom encoding for %s and %s\n", names[0], names[i] ); + gEngfuncs.Con_Printf( S_ERROR "%s: mismatch custom encoding for %s and %s\n", __func__, names[0], names[i] ); break; } @@ -1680,7 +1680,7 @@ int GL_LoadTextureArray( const char **names, int flags ) if( pic->size != src->size ) { - gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch image size for %s and %s\n", names[0], names[i] ); + gEngfuncs.Con_Printf( S_ERROR "%s: mismatch image size for %s and %s\n", __func__, names[0], names[i] ); break; } } @@ -1716,7 +1716,7 @@ int GL_LoadTextureArray( const char **names, int flags ) // there were errors if( !pic || ( pic->depth != numLayers )) { - gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: not all layers were loaded. Texture array is not created\n" ); + gEngfuncs.Con_Printf( S_ERROR "%s: not all layers were loaded. Texture array is not created\n", __func__ ); if( pic ) gEngfuncs.FS_FreeImage( pic ); return 0; } @@ -1765,7 +1765,7 @@ int GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags if( update ) { if( tex == NULL ) - gEngfuncs.Host_Error( "GL_LoadTextureFromBuffer: couldn't find texture %s for update\n", name ); + gEngfuncs.Host_Error( "%s: couldn't find texture %s for update\n", __func__, name ); SetBits( tex->flags, flags ); } else @@ -1935,19 +1935,19 @@ void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor ) } else { - gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: bad operation for %s\n", image->name ); + gEngfuncs.Con_Printf( S_ERROR "%s: bad operation for %s\n", __func__, image->name ); return; } if( !image->original ) { - gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: no input data for %s\n", image->name ); + gEngfuncs.Con_Printf( S_ERROR "%s: no input data for %s\n", __func__, image->name ); return; } if( ImageCompressed( image->original->type )) { - gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: can't process compressed texture %s\n", image->name ); + gEngfuncs.Con_Printf( S_ERROR "%s: can't process compressed texture %s\n", __func__, image->name ); return; } diff --git a/ref/gl/gl_opengl.c b/ref/gl/gl_opengl.c index 7e4a18fa..156b52e3 100644 --- a/ref/gl/gl_opengl.c +++ b/ref/gl/gl_opengl.c @@ -480,7 +480,7 @@ void GL_SetExtension( int r_ext, int enable ) { if( r_ext >= 0 && r_ext < GL_EXTCOUNT ) glConfig.extension[r_ext] = enable ? GL_TRUE : GL_FALSE; - else gEngfuncs.Con_Printf( S_ERROR "GL_SetExtension: invalid extension %d\n", r_ext ); + else gEngfuncs.Con_Printf( S_ERROR "%s: invalid extension %d\n", __func__, r_ext ); } /* @@ -492,7 +492,7 @@ qboolean GL_Support( int r_ext ) { if( r_ext >= 0 && r_ext < GL_EXTCOUNT ) return glConfig.extension[r_ext] ? true : false; - gEngfuncs.Con_Printf( S_ERROR "GL_Support: invalid extension %d\n", r_ext ); + gEngfuncs.Con_Printf( S_ERROR "%s: invalid extension %d\n", __func__, r_ext ); return false; } @@ -522,7 +522,7 @@ qboolean GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char char desc[MAX_VA_STRING]; float glver = (float)glConfig.version_major + glConfig.version_minor / 10.0f; - gEngfuncs.Con_Reportf( "GL_CheckExtension: %s ", name ); + gEngfuncs.Con_Reportf( "%s: %s ", __func__, name ); GL_SetExtension( r_ext, true ); if( cvarname ) diff --git a/ref/gl/gl_rmain.c b/ref/gl/gl_rmain.c index a0f584cb..f647c41d 100644 --- a/ref/gl/gl_rmain.c +++ b/ref/gl/gl_rmain.c @@ -959,7 +959,7 @@ R_SetupRefParams must be called right before void R_RenderScene( void ) { if( !WORLDMODEL && RI.drawWorld ) - gEngfuncs.Host_Error( "R_RenderView: NULL worldmodel\n" ); + gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ ); // frametime is valid only for normal pass if( RP_NORMALPASS( )) diff --git a/ref/gl/gl_rsurf.c b/ref/gl/gl_rsurf.c index e28f256a..b6283895 100644 --- a/ref/gl/gl_rsurf.c +++ b/ref/gl/gl_rsurf.c @@ -135,7 +135,7 @@ static void SubdividePolygon_r( model_t *loadmodel, msurface_t *warpface, int nu glpoly_t *poly; if( numverts > ( SUBDIVIDE_SIZE - 4 )) - gEngfuncs.Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts ); + gEngfuncs.Host_Error( "%s: too many vertexes on face ( %i )\n", __func__, numverts ); sample_size = gEngfuncs.Mod_SampleSizeForFace( warpface ); BoundPoly( numverts, verts, mins, maxs ); @@ -691,7 +691,7 @@ static void LM_UploadBlock( qboolean dynamic ) tr.lightmapTextures[i] = GL_LoadTextureInternal( lmName, &r_lightmap, TF_NOMIPMAP|TF_ATLAS_PAGE ); if( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS ) - gEngfuncs.Host_Error( "AllocBlock: full\n" ); + gEngfuncs.Host_Error( "%s: full\n", __func__ ); } } @@ -1914,7 +1914,7 @@ void R_GenerateVBO( void ) vbotex->vboarray = vbo; // generate new array and new vbotexture node vbo->array = Mem_Calloc( vbos.mempool, sizeof( vbovertex_t ) * vbo->array_len ); - gEngfuncs.Con_Printf( "R_GenerateVBOs: allocated array of %d verts, texture %d, lm %d\n", vbo->array_len, j, k ); + gEngfuncs.Con_Printf( "%s: allocated array of %d verts, texture %d, lm %d\n", __func__, vbo->array_len, j, k ); vbo->next = Mem_Calloc( vbos.mempool, sizeof( vboarray_t ) ); vbo = vbo->next; vbotex->next = Mem_Calloc( vbos.mempool, sizeof( vbotexture_t ) ); @@ -1942,7 +1942,7 @@ void R_GenerateVBO( void ) // allocate last array vbo->array = Mem_Calloc( vbos.mempool, sizeof( vbovertex_t ) * vbo->array_len ); - gEngfuncs.Con_Printf( "R_GenerateVBOs: allocated array of %d verts\n", vbo->array_len ); + gEngfuncs.Con_Printf( "%s: allocated array of %d verts\n", __func__, vbo->array_len ); // switch to list begin vbo = vbos.arraylist; @@ -2723,7 +2723,7 @@ static void R_DrawVBODlights( vboarray_t *vbo, vbotexture_t *vbotex, texture_t * // try upload the block now if( !LM_AllocBlock( smax, tmax, &info->dlight_s, &info->dlight_t )) - gEngfuncs.Host_Error( "AllocBlock: full\n" ); + gEngfuncs.Host_Error( "%s: full\n", __func__ ); base = gl_lms.lightmap_buffer; base += ( info->dlight_t * BLOCK_SIZE + info->dlight_s ) * 4; @@ -3738,7 +3738,7 @@ static void GL_CreateSurfaceLightmap( msurface_t *surf, model_t *loadmodel ) LM_InitBlock(); if( !LM_AllocBlock( smax, tmax, &surf->light_s, &surf->light_t )) - gEngfuncs.Host_Error( "AllocBlock: full\n" ); + gEngfuncs.Host_Error( "%s: full\n", __func__ ); } surf->lightmaptexturenum = gl_lms.current_lightmap_texture; diff --git a/ref/gl/gl_sprite.c b/ref/gl/gl_sprite.c index e710b532..66313f01 100644 --- a/ref/gl/gl_sprite.c +++ b/ref/gl/gl_sprite.c @@ -431,7 +431,7 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw ) else if( frame >= psprite->numframes ) { if( frame > psprite->numframes ) - gEngfuncs.Con_Printf( S_WARN "R_GetSpriteFrame: no such frame %d (%s)\n", frame, pModel->name ); + gEngfuncs.Con_Printf( S_WARN "%s: no such frame %d (%s)\n", __func__, frame, pModel->name ); frame = psprite->numframes - 1; } @@ -499,7 +499,7 @@ static float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **old } else if( frame >= psprite->numframes ) { - gEngfuncs.Con_Reportf( S_WARN "R_GetSpriteFrameInterpolant: no such frame %d (%s)\n", frame, ent->model->name ); + gEngfuncs.Con_Reportf( S_WARN "%s: no such frame %d (%s)\n", __func__, frame, ent->model->name ); frame = psprite->numframes - 1; } diff --git a/ref/gl/gl_warp.c b/ref/gl/gl_warp.c index 2c824259..41209d80 100644 --- a/ref/gl/gl_warp.c +++ b/ref/gl/gl_warp.c @@ -145,7 +145,7 @@ static void ClipSkyPolygon( int nump, vec3_t vecs, int stage ) int i, j; if( nump > MAX_CLIP_VERTS ) - gEngfuncs.Host_Error( "ClipSkyPolygon: MAX_CLIP_VERTS\n" ); + gEngfuncs.Host_Error( "%s: MAX_CLIP_VERTS\n", __func__ ); loc1: if( stage == 6 ) { diff --git a/ref/soft/r_beams.c b/ref/soft/r_beams.c index 760e960f..70a100ad 100644 --- a/ref/soft/r_beams.c +++ b/ref/soft/r_beams.c @@ -872,7 +872,7 @@ static qboolean R_BeamComputePoint( int beamEnt, vec3_t pt ) if( !ent ) { - gEngfuncs.Con_DPrintf( S_ERROR "R_BeamComputePoint: invalid entity %i\n", BEAMENT_ENTITY( beamEnt )); + gEngfuncs.Con_DPrintf( S_ERROR "%s: invalid entity %i\n", __func__, BEAMENT_ENTITY( beamEnt )); VectorClear( pt ); return false; } diff --git a/ref/soft/r_context.c b/ref/soft/r_context.c index d2855dad..9617c752 100644 --- a/ref/soft/r_context.c +++ b/ref/soft/r_context.c @@ -86,7 +86,7 @@ static qboolean GAME_EXPORT Mod_ProcessRenderData( model_t *mod, qboolean create // Mod_LoadBrushModel( mod, buf, loaded ); break; - default: gEngfuncs.Host_Error( "Mod_LoadModel: unsupported type %d\n", mod->type ); + default: gEngfuncs.Host_Error( "%s: unsupported type %d\n", __func__, mod->type ); } } @@ -266,7 +266,7 @@ void Mod_UnloadTextures( model_t *mod ) case mod_sprite: Mod_SpriteUnloadTextures( mod->cache.data ); break; - default: gEngfuncs.Host_Error( "Mod_UnloadModel: unsupported type %d\n", mod->type ); + default: gEngfuncs.Host_Error( "%s: unsupported type %d\n", __func__, mod->type ); } } diff --git a/ref/soft/r_decals.c b/ref/soft/r_decals.c index 6e4000ec..c334dcb5 100644 --- a/ref/soft/r_decals.c +++ b/ref/soft/r_decals.c @@ -74,7 +74,7 @@ static void R_DecalUnlink( decal_t *pdecal ) else { tmp = pdecal->psurface->pdecals; - if( !tmp ) gEngfuncs.Host_Error( "D_DecalUnlink: bad decal list\n" ); + if( !tmp ) gEngfuncs.Host_Error( "%s: bad decal list\n", __func__ ); while( tmp->pnext ) { diff --git a/ref/soft/r_image.c b/ref/soft/r_image.c index 5c64b124..b47e0727 100644 --- a/ref/soft/r_image.c +++ b/ref/soft/r_image.c @@ -620,7 +620,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) // make sure what target is correct if( tex->target == GL_NONE ) { - gEngfuncs.Con_DPrintf( S_ERROR "GL_UploadTexture: %s is not supported by your hardware\n", tex->name ); + gEngfuncs.Con_DPrintf( S_ERROR "%s: %s is not supported by your hardware\n", __func__, tex->name ); return false; } @@ -635,7 +635,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) if(( pic->width * pic->height ) & 3 ) { // will be resampled, just tell me for debug targets - gEngfuncs.Con_Reportf( "GL_UploadTexture: %s s&3 [%d x %d]\n", tex->name, pic->width, pic->height ); + gEngfuncs.Con_Reportf( "%s: %s s&3 [%d x %d]\n", __func__, tex->name, pic->width, pic->height ); } buf = pic->buffer; @@ -653,7 +653,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) { // track the buffer bounds if( buf != NULL && buf >= bufend ) - gEngfuncs.Host_Error( "GL_UploadTexture: %s image buffer overflow\n", tex->name ); + gEngfuncs.Host_Error( "%s: %s image buffer overflow\n", __func__, tex->name ); if( ImageCompressed( pic->type )) { @@ -798,7 +798,7 @@ static qboolean GL_CheckTexName( const char *name ) // because multi-layered textures can exceed name string if( len >= sizeof( r_images->name )) { - gEngfuncs.Con_Printf( S_ERROR "LoadTexture: too long name %s (%d)\n", name, len); + gEngfuncs.Con_Printf( S_ERROR "%s: too long name %s (%d)\n", __func__, name, len); return false; } @@ -844,7 +844,7 @@ static image_t *GL_AllocTexture( const char *name, texFlags_t flags ) if( i == r_numImages ) { if( r_numImages == MAX_TEXTURES ) - gEngfuncs.Host_Error( "GL_AllocTexture: MAX_TEXTURES limit exceeds\n" ); + gEngfuncs.Host_Error( "%s: MAX_TEXTURES limit exceeds\n", __func__ ); r_numImages++; } @@ -883,7 +883,7 @@ static void GL_DeleteTexture( image_t *tex ) // debug if( !tex->name[0] ) { - gEngfuncs.Con_Printf( S_ERROR "GL_DeleteTexture: trying to free unnamed texture\n"); + gEngfuncs.Con_Printf( S_ERROR "%s: trying to free unnamed texture\n", __func__ ); return; } @@ -1027,7 +1027,7 @@ int GAME_EXPORT GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texF if( update ) { if( tex == NULL ) - gEngfuncs.Host_Error( "GL_LoadTextureFromBuffer: couldn't find texture %s for update\n", name ); + gEngfuncs.Host_Error( "%s: couldn't find texture %s for update\n", __func__, name ); SetBits( tex->flags, flags ); } else @@ -1160,19 +1160,19 @@ void GAME_EXPORT GL_ProcessTexture( int texnum, float gamma, int topColor, int b } else { - gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: bad operation for %s\n", image->name ); + gEngfuncs.Con_Printf( S_ERROR "%s: bad operation for %s\n", __func__, image->name ); return; } if( !image->original ) { - gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: no input data for %s\n", image->name ); + gEngfuncs.Con_Printf( S_ERROR "%s: no input data for %s\n", __func__, image->name ); return; } if( ImageCompressed( image->original->type )) { - gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: can't process compressed texture %s\n", image->name ); + gEngfuncs.Con_Printf( S_ERROR "%s: can't process compressed texture %s\n", __func__, image->name ); return; } diff --git a/ref/soft/r_main.c b/ref/soft/r_main.c index 51e5056f..da557f33 100644 --- a/ref/soft/r_main.c +++ b/ref/soft/r_main.c @@ -1561,7 +1561,7 @@ R_SetupRefParams must be called right before void GAME_EXPORT R_RenderScene( void ) { if( !WORLDMODEL && RI.drawWorld ) - gEngfuncs.Host_Error( "R_RenderView: NULL worldmodel\n" ); + gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ ); // frametime is valid only for normal pass if( RP_NORMALPASS( )) diff --git a/ref/soft/r_polyse.c b/ref/soft/r_polyse.c index 04f7798c..03b25f29 100644 --- a/ref/soft/r_polyse.c +++ b/ref/soft/r_polyse.c @@ -363,7 +363,7 @@ static void FloorDivMod (float numer, float denom, int *quotient, { int i; d_pdrawspans = R_PolysetStub; - gEngfuncs.Con_Printf( S_ERROR "FloorDivMod: q overflow!\n" ); + gEngfuncs.Con_Printf( S_ERROR "%s: q overflow!\n", __func__ ); q = 1; } @@ -371,7 +371,7 @@ static void FloorDivMod (float numer, float denom, int *quotient, { int i; d_pdrawspans = R_PolysetStub; - gEngfuncs.Con_Printf( S_ERROR "FloorDivMod: r overflow!\n"); + gEngfuncs.Con_Printf( S_ERROR "%s: r overflow!\n", __func__ ); r = 1; } diff --git a/ref/soft/r_sprite.c b/ref/soft/r_sprite.c index 4965c105..5acda0bd 100644 --- a/ref/soft/r_sprite.c +++ b/ref/soft/r_sprite.c @@ -417,7 +417,7 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw ) else if( frame >= psprite->numframes ) { if( frame > psprite->numframes ) - gEngfuncs.Con_Printf( S_WARN "R_GetSpriteFrame: no such frame %d (%s)\n", frame, pModel->name ); + gEngfuncs.Con_Printf( S_WARN "%s: no such frame %d (%s)\n", __func__, frame, pModel->name ); frame = psprite->numframes - 1; } @@ -485,7 +485,7 @@ static float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **old } else if( frame >= psprite->numframes ) { - gEngfuncs.Con_Reportf( S_WARN "R_GetSpriteFrameInterpolant: no such frame %d (%s)\n", frame, ent->model->name ); + gEngfuncs.Con_Reportf( S_WARN "%s: no such frame %d (%s)\n", __func__, frame, ent->model->name ); frame = psprite->numframes - 1; } diff --git a/ref/soft/r_surf.c b/ref/soft/r_surf.c index 7766e939..b694ed57 100644 --- a/ref/soft/r_surf.c +++ b/ref/soft/r_surf.c @@ -1030,15 +1030,15 @@ static surfcache_t *D_SCAlloc (int width, int size) qboolean wrapped_this_time; if ((width < 0) )// || (width > 256)) - gEngfuncs.Host_Error ("D_SCAlloc: bad cache width %d\n", width); + gEngfuncs.Host_Error ("%s: bad cache width %d\n", __func__, width); if ((size <= 0) || (size > 0x10000000)) - gEngfuncs.Host_Error ("D_SCAlloc: bad cache size %d\n", size); + gEngfuncs.Host_Error ("%s: bad cache size %d\n", __func__, size); size = (int)&((surfcache_t *)0)->data[size]; size = (size + 3) & ~3; if (size > sc_size) - gEngfuncs.Host_Error ("D_SCAlloc: %i > cache size of %i",size, sc_size); + gEngfuncs.Host_Error ("%s: %i > cache size of %i", __func__, size, sc_size); // if there is not size bytes after the rover, reset to the start wrapped_this_time = false; @@ -1062,7 +1062,7 @@ static surfcache_t *D_SCAlloc (int width, int size) // free another sc_rover = sc_rover->next; if (!sc_rover) - gEngfuncs.Host_Error ("D_SCAlloc: hit the end of memory"); + gEngfuncs.Host_Error ("%s: hit the end of memory", __func__); if (sc_rover->owner) *sc_rover->owner = NULL; diff --git a/wscript b/wscript index ce81cb04..8795dd50 100644 --- a/wscript +++ b/wscript @@ -293,7 +293,7 @@ def configure(conf): '-Werror=bool-operation', '-Werror=cast-align=strict', '-Werror=duplicated-cond', - # '-Werror=format=2', + '-Werror=format=2', '-Werror=implicit-fallthrough=2', '-Werror=logical-op', '-Werror=nonnull',