2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-22 01:45:19 +01:00

Rename _format to FORMAT_CHECK

This commit is contained in:
Alibek Omarov 2024-11-07 14:24:07 +03:00
parent 43609bc77c
commit d15949d2e8
15 changed files with 48 additions and 48 deletions

View File

@ -91,7 +91,7 @@ typedef uint64_t longtime_t;
#endif
#define NORETURN __attribute__(( noreturn ))
#define NONNULL __attribute__(( nonnull ))
#define _format( x ) __attribute__(( format( printf, x, x + 1 )))
#define FORMAT_CHECK( x ) __attribute__(( format( printf, x, x + 1 )))
#define ALLOC_CHECK( x ) __attribute__(( alloc_size( x )))
#define NO_ASAN __attribute__(( no_sanitize( "address" )))
#define WARN_UNUSED_RESULT __attribute__(( warn_unused_result ))
@ -107,7 +107,7 @@ typedef uint64_t longtime_t;
#define GAME_EXPORT
#define NORETURN
#define NONNULL
#define _format( x )
#define FORMAT_CHECK( x )
#define ALLOC_CHECK( x )
#define RENAME_SYMBOL( x )
#define MALLOC

View File

@ -807,7 +807,7 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height, int flags );
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... ) _format( 6 );
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... ) FORMAT_CHECK( 6 );
//

View File

@ -417,7 +417,7 @@ byte *FS_LoadDirectFile( const char *path, fs_offset_t *filesizeptr )
//
void Cbuf_Clear( void );
void Cbuf_AddText( const char *text );
void Cbuf_AddTextf( const char *text, ... ) _format( 1 );
void Cbuf_AddTextf( const char *text, ... ) FORMAT_CHECK( 1 );
void Cbuf_AddFilteredText( const char *text );
void Cbuf_InsertText( const char *text );
void Cbuf_ExecStuffCmds( void );
@ -531,14 +531,14 @@ typedef void( *pfnChangeGame )( const char *progname );
qboolean Host_IsQuakeCompatible( void );
void EXPORT Host_Shutdown( void );
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
void Host_EndGame( qboolean abort, const char *message, ... ) _format( 2 );
void Host_EndGame( qboolean abort, const char *message, ... ) FORMAT_CHECK( 2 );
void Host_AbortCurrentFrame( void ) NORETURN;
void Host_WriteServerConfig( const char *name );
void Host_WriteOpenGLConfig( void );
void Host_WriteVideoConfig( void );
void Host_WriteConfig( void );
void Host_ShutdownServer( void );
void Host_Error( const char *error, ... ) _format( 1 );
void Host_Error( const char *error, ... ) FORMAT_CHECK( 1 );
void Host_ValidateEngineFeatures( uint32_t mask, uint32_t features );
void Host_Frame( double time );
void Host_Credits( void );
@ -595,9 +595,9 @@ int COM_CheckParm( char *parm, char **ppnext );
void pfnGetGameDir( char *szGetGameDir );
int pfnGetModelType( model_t *mod );
int pfnIsMapValid( char *filename );
void Con_Reportf( const char *szFmt, ... ) _format( 1 );
void Con_DPrintf( const char *fmt, ... ) _format( 1 );
void Con_Printf( const char *szFmt, ... ) _format( 1 );
void Con_Reportf( const char *szFmt, ... ) FORMAT_CHECK( 1 );
void Con_DPrintf( const char *fmt, ... ) FORMAT_CHECK( 1 );
void Con_Printf( const char *szFmt, ... ) FORMAT_CHECK( 1 );
int pfnNumberOfEntities( void );
int pfnIsInGame( void );
float pfnTime( void );
@ -698,12 +698,12 @@ struct cmd_s *Cmd_GetFirstFunctionHandle( void );
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
struct cmdalias_s *Cmd_AliasGetList( void );
const char *Cmd_GetName( struct cmd_s *cmd );
void Log_Printf( const char *fmt, ... ) _format( 1 );
void SV_BroadcastCommand( const char *fmt, ... ) _format( 1 );
void SV_BroadcastPrintf( struct sv_client_s *ignore, const char *fmt, ... ) _format( 2 );
void Log_Printf( const char *fmt, ... ) FORMAT_CHECK( 1 );
void SV_BroadcastCommand( const char *fmt, ... ) FORMAT_CHECK( 1 );
void SV_BroadcastPrintf( struct sv_client_s *ignore, const char *fmt, ... ) FORMAT_CHECK( 2 );
void CL_ClearStaticEntities( void );
qboolean S_StreamGetCurrentState( char *currentTrack, size_t currentTrackSize, char *loopTrack, size_t loopTrackSize, int *position );
void CL_ServerCommand( qboolean reliable, const char *fmt, ... ) _format( 2 );
void CL_ServerCommand( qboolean reliable, const char *fmt, ... ) FORMAT_CHECK( 2 );
void CL_UpdateInfo( const char *key, const char *value );
void CL_HudMessage( const char *pMessage );
const char *CL_MsgInfo( int cmd );
@ -742,15 +742,15 @@ int SCR_GetAudioChunk( char *rawdata, int length );
wavdata_t *SCR_GetMovieInfo( void );
void SCR_Shutdown( void );
void Con_Print( const char *txt );
void Con_NPrintf( int idx, const char *fmt, ... ) _format( 2 );
void Con_NXPrintf( con_nprint_t *info, const char *fmt, ... ) _format( 2 );
void UI_NPrintf( int idx, const char *fmt, ... ) _format( 2 );
void UI_NXPrintf( con_nprint_t *info, const char *fmt, ... ) _format( 2 );
void Con_NPrintf( int idx, const char *fmt, ... ) FORMAT_CHECK( 2 );
void Con_NXPrintf( con_nprint_t *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
void UI_NPrintf( int idx, const char *fmt, ... ) FORMAT_CHECK( 2 );
void UI_NXPrintf( con_nprint_t *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
const char *Info_ValueForKey( const char *s, const char *key );
void Info_RemovePrefixedKeys( char *start, char prefix );
qboolean Info_RemoveKey( char *s, const char *key );
qboolean Info_SetValueForKey( char *s, const char *key, const char *value, int maxsize );
qboolean Info_SetValueForKeyf( char *s, const char *key, int maxsize, const char *format, ... ) _format( 4 );
qboolean Info_SetValueForKeyf( char *s, const char *key, int maxsize, const char *format, ... ) FORMAT_CHECK( 4 );
qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, int maxsize );
qboolean Info_IsValid( const char *s );
void Info_WriteVars( file_t *f );
@ -774,7 +774,7 @@ qboolean COM_ParseVector( char **pfile, float *v, size_t size );
int COM_FileSize( const char *filename );
void COM_FreeFile( void *buffer );
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare );
char *va( const char *format, ... ) _format( 1 );
char *va( const char *format, ... ) FORMAT_CHECK( 1 );
qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multiplayer );
static inline void COM_NormalizeAngles( vec3_t angles )

View File

@ -35,7 +35,7 @@ cvar_t *Cvar_GetList( void );
convar_t *Cvar_FindVarExt( const char *var_name, int ignore_group );
void Cvar_RegisterVariable( convar_t *var );
convar_t *Cvar_Get( const char *var_name, const char *value, int flags, const char *description );
convar_t *Cvar_Getf( const char *var_name, int flags, const char *description, const char *format, ... ) _format( 4 );
convar_t *Cvar_Getf( const char *var_name, int flags, const char *description, const char *format, ... ) FORMAT_CHECK( 4 );
void Cvar_LookupVars( int checkbit, void *buffer, void *ptr, setpair_t callback );
void Cvar_FullSet( const char *var_name, const char *value, int flags );
void Cvar_DirectSet( convar_t *var, const char *value );

View File

@ -229,7 +229,7 @@ void MSG_WriteFloat( sizebuf_t *sb, float val );
void MSG_WriteVec3Coord( sizebuf_t *sb, const float *fa );
void MSG_WriteVec3Angles( sizebuf_t *sb, const float *fa );
qboolean MSG_WriteString( sizebuf_t *sb, const char *pStr ); // returns false if it overflows the buffer.
qboolean MSG_WriteStringf( sizebuf_t *sb, const char *format, ... ) _format( 2 );
qboolean MSG_WriteStringf( sizebuf_t *sb, const char *format, ... ) FORMAT_CHECK( 2 );
qboolean MSG_WriteBytes( sizebuf_t *sb, const void *pBuf, int nBytes );
// helper functions

View File

@ -307,7 +307,7 @@ void Netchan_CreateFragments( netchan_t *chan, sizebuf_t *msg );
int Netchan_CreateFileFragments( netchan_t *chan, const char *filename );
void Netchan_TransmitBits( netchan_t *chan, int lengthInBits, const byte *data );
void Netchan_OutOfBand( int net_socket, netadr_t adr, int length, const byte *data );
void Netchan_OutOfBandPrint( int net_socket, netadr_t adr, const char *format, ... ) _format( 3 );
void Netchan_OutOfBandPrint( int net_socket, netadr_t adr, const char *format, ... ) FORMAT_CHECK( 3 );
qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg );
void Netchan_UpdateProgress( netchan_t *chan );
qboolean Netchan_IncomingReady( netchan_t *chan );

View File

@ -47,8 +47,8 @@ double Sys_DoubleTime( void );
char *Sys_GetClipboardData( void );
const char *Sys_GetCurrentUser( void );
int Sys_CheckParm( const char *parm );
void Sys_Warn( const char *format, ... ) _format( 1 );
void Sys_Error( const char *error, ... ) _format( 1 );
void Sys_Warn( const char *format, ... ) FORMAT_CHECK( 1 );
void Sys_Error( const char *error, ... ) FORMAT_CHECK( 1 );
qboolean Sys_LoadLibrary( dll_info_t *dll );
void* Sys_GetProcAddress( dll_info_t *dll, const char* name );
qboolean Sys_FreeLibrary( dll_info_t *dll );

View File

@ -89,10 +89,10 @@ typedef struct ui_enginefuncs_s
const char* (*pfnCmd_Args)( void );
// debug messages (in-menu shows only notify)
void (*Con_Printf)( const char *fmt, ... ) _format( 1 );
void (*Con_DPrintf)( const char *fmt, ... ) _format( 1 );
void (*Con_NPrintf)( int pos, const char *fmt, ... ) _format( 2 );
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ) _format( 2 );
void (*Con_Printf)( const char *fmt, ... ) FORMAT_CHECK( 1 );
void (*Con_DPrintf)( const char *fmt, ... ) FORMAT_CHECK( 1 );
void (*Con_NPrintf)( int pos, const char *fmt, ... ) FORMAT_CHECK( 2 );
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
// sound handlers
void (*pfnPlayLocalSound)( const char *szSound );
@ -118,7 +118,7 @@ typedef struct ui_enginefuncs_s
int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent );
// misc handlers
void (*pfnHostError)( const char *szFmt, ... ) _format( 1 );
void (*pfnHostError)( const char *szFmt, ... ) FORMAT_CHECK( 1 );
int (*pfnFileExists)( const char *filename, int gamedironly );
void (*pfnGetGameDir)( char *szGetGameDir );

View File

@ -338,13 +338,13 @@ typedef struct ref_api_s
void (*Cbuf_Execute)( void );
// logging
void (*Con_Printf)( const char *fmt, ... ) _format( 1 ); // typical console allowed messages
void (*Con_DPrintf)( const char *fmt, ... ) _format( 1 ); // -dev 1
void (*Con_Reportf)( const char *fmt, ... ) _format( 1 ); // -dev 2
void (*Con_Printf)( const char *fmt, ... ) FORMAT_CHECK( 1 ); // typical console allowed messages
void (*Con_DPrintf)( const char *fmt, ... ) FORMAT_CHECK( 1 ); // -dev 1
void (*Con_Reportf)( const char *fmt, ... ) FORMAT_CHECK( 1 ); // -dev 2
// debug print
void (*Con_NPrintf)( int pos, const char *fmt, ... ) _format( 2 );
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ) _format( 2 );
void (*Con_NPrintf)( int pos, const char *fmt, ... ) FORMAT_CHECK( 2 );
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... ) FORMAT_CHECK( 2 );
void (*CL_CenterPrint)( const char *s, float y );
void (*Con_DrawStringLen)( const char *pText, int *length, int *height );
int (*Con_DrawString)( int x, int y, const char *string, rgba_t setColor );
@ -385,7 +385,7 @@ typedef struct ref_api_s
// utils
void (*CL_ExtraUpdate)( void );
void (*Host_Error)( const char *fmt, ... ) _format( 1 );
void (*Host_Error)( const char *fmt, ... ) FORMAT_CHECK( 1 );
void (*COM_SetRandomSeed)( int lSeed );
float (*COM_RandomFloat)( float rmin, float rmax );
int (*COM_RandomLong)( int rmin, int rmax );

View File

@ -475,7 +475,7 @@ extern convar_t sv_expose_player_list;
// sv_main.c
//
void SV_FinalMessage( const char *message, qboolean reconnect );
void SV_KickPlayer( sv_client_t *cl, const char *fmt, ... ) _format( 2 );
void SV_KickPlayer( sv_client_t *cl, const char *fmt, ... ) FORMAT_CHECK( 2 );
void SV_DropClient( sv_client_t *cl, qboolean crash ) RENAME_SYMBOL( "SV_DropClient_" );
void SV_UpdateMovevars( qboolean initialize );
int SV_ModelIndex( const char *name );
@ -523,7 +523,7 @@ void SV_WaterMove( edict_t *ent );
// sv_send.c
//
void SV_SendClientMessages( void );
void SV_ClientPrintf( sv_client_t *cl, const char *fmt, ... ) _format( 2 );
void SV_ClientPrintf( sv_client_t *cl, const char *fmt, ... ) FORMAT_CHECK( 2 );
//
// sv_client.c
@ -546,7 +546,7 @@ qboolean SV_IsPlayerIndex( int idx );
int SV_CalcPing( sv_client_t *cl );
void SV_UpdateServerInfo( void );
void SV_EndRedirect( host_redirect_t *rd );
void SV_RejectConnection( netadr_t from, const char *fmt, ... ) _format( 2 );
void SV_RejectConnection( netadr_t from, const char *fmt, ... ) FORMAT_CHECK( 2 );
void SV_GetPlayerCount( int *clients, int *bots );
qboolean SV_HavePassword( void );

View File

@ -2384,7 +2384,7 @@ pfnClientCommand
=========
*/
void GAME_EXPORT pfnClientCommand( edict_t* pEdict, char* szFmt, ... ) _format( 2 );
void GAME_EXPORT pfnClientCommand( edict_t* pEdict, char* szFmt, ... ) FORMAT_CHECK( 2 );
void GAME_EXPORT pfnClientCommand( edict_t* pEdict, char* szFmt, ... )
{
sv_client_t *cl;
@ -2877,7 +2877,7 @@ pfnAlertMessage
=============
*/
static void pfnAlertMessage( ALERT_TYPE type, char *szFmt, ... ) _format( 2 );
static void pfnAlertMessage( ALERT_TYPE type, char *szFmt, ... ) FORMAT_CHECK( 2 );
static void GAME_EXPORT pfnAlertMessage( ALERT_TYPE type, char *szFmt, ... )
{
char buffer[2048];

View File

@ -170,7 +170,7 @@ typedef struct fs_api_t
int (*UnGetc)( file_t *file, char c );
int (*Getc)( file_t *file );
int (*VPrintf)( file_t *file, const char *format, va_list ap );
int (*Printf)( file_t *file, const char *format, ... ) _format( 2 );
int (*Printf)( file_t *file, const char *format, ... ) FORMAT_CHECK( 2 );
int (*Print)( file_t *file, const char *msg );
fs_offset_t (*FileLength)( file_t *f );
qboolean (*FileCopy)( file_t *pOutput, file_t *pInput, int fileSize );
@ -208,11 +208,11 @@ typedef struct fs_api_t
typedef struct fs_interface_t
{
// logging
void (*_Con_Printf)( const char *fmt, ... ) _format( 1 ); // typical console allowed messages
void (*_Con_DPrintf)( const char *fmt, ... ) _format( 1 ); // -dev 1
void (*_Con_Reportf)( const char *fmt, ... ) _format( 1 ); // -dev 2
void (*_Con_Printf)( const char *fmt, ... ) FORMAT_CHECK( 1 ); // typical console allowed messages
void (*_Con_DPrintf)( const char *fmt, ... ) FORMAT_CHECK( 1 ); // -dev 1
void (*_Con_Reportf)( const char *fmt, ... ) FORMAT_CHECK( 1 ); // -dev 2
void (*_Sys_Error)( const char *fmt, ... ) _format( 1 );
void (*_Sys_Error)( const char *fmt, ... ) FORMAT_CHECK( 1 );
// memory
poolhandle_t (*_Mem_AllocPool)( const char *name, const char *filename, int fileline );

View File

@ -181,7 +181,7 @@ int FS_Gets( file_t *file, char *string, size_t bufsize );
int FS_UnGetc( file_t *file, char c );
int FS_Getc( file_t *file );
int FS_VPrintf( file_t *file, const char *format, va_list ap );
int FS_Printf( file_t *file, const char *format, ... ) _format( 2 );
int FS_Printf( file_t *file, const char *format, ... ) FORMAT_CHECK( 2 );
int FS_Print( file_t *file, const char *msg );
fs_offset_t FS_FileLength( file_t *f );
qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize );

View File

@ -80,7 +80,7 @@ const byte *Q_memmem( const byte *haystack, size_t haystacklen, const byte *need
void Q_memor( byte *XASH_RESTRICT dst, const byte *XASH_RESTRICT src, size_t len );
const char *Q_timestamp( int format );
int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list args );
int Q_snprintf( char *buffer, size_t buffersize, const char *format, ... ) _format( 3 );
int Q_snprintf( char *buffer, size_t buffersize, const char *format, ... ) FORMAT_CHECK( 3 );
#define Q_strpbrk strpbrk
void COM_StripColors( const char *in, char *out );
#define Q_memprint( val ) Q_pretifymem( val, 2 )

View File

@ -380,7 +380,7 @@ void R_TextureList_f( void );
void R_InitImages( void );
void R_ShutdownImages( void );
int GL_TexMemory( void );
qboolean R_SearchForTextureReplacement( char *out, size_t size, const char *modelname, const char *fmt, ... ) _format( 4 );
qboolean R_SearchForTextureReplacement( char *out, size_t size, const char *modelname, const char *fmt, ... ) FORMAT_CHECK( 4 );
void R_TextureReplacementReport( const char *modelname, int gl_texturenum, const char *foundpath );
//