aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-12-30 12:32:54 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-12-30 12:32:54 +0000
commitf0fc390a026dfff392ba465b76f60f3f0e5a70e2 (patch)
treeadd91b1a36f3c11bf1b5b6a5fd5aea145c1fef52
parentca2cf9c99df7ee76f13b7c9fa2d6ad706a3968fa (diff)
downloadioquake3-aero-f0fc390a026dfff392ba465b76f60f3f0e5a70e2.tar.gz
ioquake3-aero-f0fc390a026dfff392ba465b76f60f3f0e5a70e2.zip
- tag more functions with gnu format attribute
- fix format string bugs. still some left git-svn-id: svn://svn.icculus.org/quake3/trunk@1023 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/cgame/cg_main.c2
-rw-r--r--code/client/cl_cgame.c4
-rw-r--r--code/client/cl_curl.c4
-rw-r--r--code/client/cl_main.c2
-rw-r--r--code/client/cl_ui.c4
-rw-r--r--code/client/snd_openal.c2
-rw-r--r--code/game/bg_lib.h2
-rw-r--r--code/game/g_session.c4
-rw-r--r--code/qcommon/cvar.c5
-rw-r--r--code/qcommon/net_chan.c3
-rw-r--r--code/qcommon/q_shared.h12
-rw-r--r--code/qcommon/qcommon.h10
-rw-r--r--code/qcommon/vm.c2
-rw-r--r--code/server/sv_client.c2
-rw-r--r--code/server/sv_game.c4
-rw-r--r--code/ui/ui_main.c2
-rw-r--r--code/unix/sdl_snd.c2
17 files changed, 32 insertions, 34 deletions
diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c
index bee6c3f..8f1f46c 100644
--- a/code/cgame/cg_main.c
+++ b/code/cgame/cg_main.c
@@ -1448,7 +1448,7 @@ void CG_LoadMenus(const char *menuFile) {
trap_Error( va( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ) );
len = trap_FS_FOpenFile( "ui/hud.txt", &f, FS_READ );
if (!f) {
- trap_Error( va( S_COLOR_RED "default menu file not found: ui/hud.txt, unable to continue!\n", menuFile ) );
+ trap_Error( va( S_COLOR_RED "default menu file not found: ui/hud.txt, unable to continue!\n") );
}
}
diff --git a/code/client/cl_cgame.c b/code/client/cl_cgame.c
index 997a72c..4ebacb1 100644
--- a/code/client/cl_cgame.c
+++ b/code/client/cl_cgame.c
@@ -415,10 +415,10 @@ The cgame module is making a system call
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
switch( args[0] ) {
case CG_PRINT:
- Com_Printf( "%s", VMA(1) );
+ Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case CG_ERROR:
- Com_Error( ERR_DROP, "%s", VMA(1) );
+ Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case CG_MILLISECONDS:
return Sys_Milliseconds();
diff --git a/code/client/cl_curl.c b/code/client/cl_curl.c
index 38498ee..7a05b6f 100644
--- a/code/client/cl_curl.c
+++ b/code/client/cl_curl.c
@@ -105,7 +105,7 @@ static void *GPA(char *str)
}
else
{
- Com_DPrintf("Loaded symbol %s (0x%08X)\n", str, rv);
+ Com_DPrintf("Loaded symbol %s (0x%p)\n", str, rv);
return rv;
}
}
@@ -347,7 +347,7 @@ void CL_cURL_PerformDownload(void)
qcurl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE,
&code);
- Com_Error(ERR_DROP, "Download Error: %s Code: %d URL: %s",
+ Com_Error(ERR_DROP, "Download Error: %s Code: %ld URL: %s",
qcurl_easy_strerror(msg->data.result),
code, clc.downloadURL);
}
diff --git a/code/client/cl_main.c b/code/client/cl_main.c
index 598f3be..b460919 100644
--- a/code/client/cl_main.c
+++ b/code/client/cl_main.c
@@ -993,7 +993,7 @@ void CL_Setenv_f( void ) {
if ( env ) {
Com_Printf( "%s=%s\n", Cmd_Argv(1), env );
} else {
- Com_Printf( "%s undefined\n", Cmd_Argv(1), env );
+ Com_Printf( "%s undefined\n", Cmd_Argv(1));
}
}
}
diff --git a/code/client/cl_ui.c b/code/client/cl_ui.c
index e6aae53..0dc8774 100644
--- a/code/client/cl_ui.c
+++ b/code/client/cl_ui.c
@@ -767,11 +767,11 @@ The ui module is making a system call
intptr_t CL_UISystemCalls( intptr_t *args ) {
switch( args[0] ) {
case UI_ERROR:
- Com_Error( ERR_DROP, "%s", VMA(1) );
+ Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case UI_PRINT:
- Com_Printf( "%s", VMA(1) );
+ Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case UI_MILLISECONDS:
diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c
index d375479..1bbf5e5 100644
--- a/code/client/snd_openal.c
+++ b/code/client/snd_openal.c
@@ -896,7 +896,7 @@ static qboolean S_AL_CheckInput(int entityNum, sfxHandle_t sfx)
if (sfx < 0 || sfx >= numSfx)
{
- Com_Printf(S_COLOR_RED, "ERROR: S_AL_CheckInput: handle %i out of range\n", sfx);
+ Com_Printf(S_COLOR_RED "ERROR: S_AL_CheckInput: handle %i out of range\n", sfx);
return qtrue;
}
diff --git a/code/game/bg_lib.h b/code/game/bg_lib.h
index 467d59d..493afa2 100644
--- a/code/game/bg_lib.h
+++ b/code/game/bg_lib.h
@@ -76,7 +76,7 @@ int atoi( const char *string );
int _atoi( const char **stringPtr );
int vsprintf( char *buffer, const char *fmt, va_list argptr );
-int sscanf( const char *buffer, const char *fmt, ... );
+int sscanf( const char *buffer, const char *fmt, ... ) __attribute__ ((format (scanf, 2, 3)));
// Memory functions
void *memmove( void *dest, const void *src, size_t count );
diff --git a/code/game/g_session.c b/code/game/g_session.c
index a39b2f2..89bceec 100644
--- a/code/game/g_session.c
+++ b/code/game/g_session.c
@@ -54,7 +54,7 @@ void G_WriteClientSessionData( gclient_t *client ) {
client->sess.teamLeader
);
- var = va( "session%i", client - level.clients );
+ var = va( "session%i", (int)(client - level.clients) );
trap_Cvar_Set( var, s );
}
@@ -75,7 +75,7 @@ void G_ReadSessionData( gclient_t *client ) {
int spectatorState;
int sessionTeam;
- var = va( "session%i", client - level.clients );
+ var = va( "session%i", (int)(client - level.clients) );
trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );
sscanf( s, "%i %i %i %i %i %i %i",
diff --git a/code/qcommon/cvar.c b/code/qcommon/cvar.c
index e812a83..6e229c4 100644
--- a/code/qcommon/cvar.c
+++ b/code/qcommon/cvar.c
@@ -913,10 +913,9 @@ void Cvar_Update( vmCvar_t *vmCvar ) {
vmCvar->modificationCount = cv->modificationCount;
// bk001129 - mismatches.
if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING )
- Com_Error( ERR_DROP, "Cvar_Update: src %s length %d exceeds MAX_CVAR_VALUE_STRING",
+ Com_Error( ERR_DROP, "Cvar_Update: src %s length %zd exceeds MAX_CVAR_VALUE_STRING",
cv->string,
- strlen(cv->string),
- sizeof(vmCvar->string) );
+ strlen(cv->string));
// bk001212 - Q_strncpyz guarantees zero padding and dest[MAX_CVAR_VALUE_STRING-1]==0
// bk001129 - paranoia. Never trust the destination string.
// bk001129 - beware, sizeof(char*) is always 4 (for cv->string).
diff --git a/code/qcommon/net_chan.c b/code/qcommon/net_chan.c
index 5c92c5d..ac617cb 100644
--- a/code/qcommon/net_chan.c
+++ b/code/qcommon/net_chan.c
@@ -397,8 +397,7 @@ qboolean Netchan_Process( netchan_t *chan, msg_t *msg ) {
if ( fragmentStart != chan->fragmentLength ) {
if ( showdrop->integer || showpackets->integer ) {
Com_Printf( "%s:Dropped a message fragment\n"
- , NET_AdrToString( chan->remoteAddress )
- , sequence);
+ , NET_AdrToString( chan->remoteAddress ));
}
// we can still keep the part that we have so far,
// so we don't need to clear chan->fragmentLength
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index 335ef38..cf41290 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -599,8 +599,8 @@ int COM_GetCurrentParseLine( void );
char *COM_Parse( char **data_p );
char *COM_ParseExt( char **data_p, qboolean allowLineBreak );
int COM_Compress( char *data_p );
-void COM_ParseError( char *format, ... );
-void COM_ParseWarning( char *format, ... );
+void COM_ParseError( char *format, ... ) __attribute__ ((format (printf, 1, 2)));
+void COM_ParseWarning( char *format, ... ) __attribute__ ((format (printf, 1, 2)));
//int COM_ParseInfos( char *buf, int max, char infos[][MAX_INFO_STRING] );
#define MAX_TOKENLENGTH 1024
@@ -634,7 +634,7 @@ void Parse1DMatrix (char **buf_p, int x, float *m);
void Parse2DMatrix (char **buf_p, int y, int x, float *m);
void Parse3DMatrix (char **buf_p, int z, int y, int x, float *m);
-void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...);
+void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
char *Com_SkipTokens( char *s, int numTokens, char *sep );
char *Com_SkipCharset( char *s, char *sep );
@@ -706,7 +706,7 @@ float LittleFloat (const float *l);
void Swap_Init (void);
*/
-char * QDECL va(char *format, ...);
+char * QDECL va(char *format, ...) __attribute__ ((format (printf, 1, 2)));;
#define TRUNCATE_LENGTH 64
void Com_TruncateLongString( char *buffer, const char *s );
@@ -725,8 +725,8 @@ qboolean Info_Validate( const char *s );
void Info_NextPair( const char **s, char *key, char *value );
// this is only here so the functions in q_shared.c and bg_*.c can link
-void QDECL Com_Error( int level, const char *error, ... );
-void QDECL Com_Printf( const char *msg, ... );
+void QDECL Com_Error( int level, const char *error, ... ) __attribute__ ((format (printf, 2, 3)));
+void QDECL Com_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
/*
diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h
index 88e36b9..b07d77e 100644
--- a/code/qcommon/qcommon.h
+++ b/code/qcommon/qcommon.h
@@ -161,7 +161,7 @@ void NET_Restart( void );
void NET_Config( qboolean enableNetworking );
void NET_FlushPacketQueue(void);
void NET_SendPacket (netsrc_t sock, int length, const void *data, netadr_t to);
-void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ...);
+void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len );
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
@@ -725,9 +725,9 @@ void Info_Print( const char *s );
void Com_BeginRedirect (char *buffer, int buffersize, void (*flush)(char *));
void Com_EndRedirect( void );
-void QDECL Com_Printf( const char *fmt, ... );
-void QDECL Com_DPrintf( const char *fmt, ... );
-void QDECL Com_Error( int code, const char *fmt, ... );
+void QDECL Com_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
void Com_Quit_f( void );
int Com_EventLoop( void );
int Com_Milliseconds( void ); // will be journaled properly
@@ -989,7 +989,7 @@ void *Sys_GetBotLibAPI( void *parms );
char *Sys_GetCurrentUser( void );
-void QDECL Sys_Error( const char *error, ...);
+void QDECL Sys_Error( const char *error, ...) __attribute__ ((format (printf, 1, 2)));
void Sys_Quit (void);
char *Sys_GetClipboardData( void ); // note that this isn't journaled...
diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c
index efc0da8..0e35791 100644
--- a/code/qcommon/vm.c
+++ b/code/qcommon/vm.c
@@ -726,7 +726,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
lastVM = vm;
if ( vm_debugLevel ) {
- Com_Printf( "VM_Call( %ld )\n", callnum );
+ Com_Printf( "VM_Call( %d )\n", callnum );
}
// if we have a dll loaded, call it directly
diff --git a/code/server/sv_client.c b/code/server/sv_client.c
index 6f9af5c..5685457 100644
--- a/code/server/sv_client.c
+++ b/code/server/sv_client.c
@@ -1433,7 +1433,7 @@ static void SV_UserMove( client_t *cl, msg_t *msg, qboolean delta ) {
if (cl->state == CS_ACTIVE)
{
// we didn't get a cp yet, don't assume anything and just send the gamestate all over again
- Com_DPrintf( "%s: didn't get cp command, resending gamestate\n", cl->name, cl->state );
+ Com_DPrintf( "%s: didn't get cp command, resending gamestate\n", cl->name);
SV_SendClientGameState( cl );
}
return;
diff --git a/code/server/sv_game.c b/code/server/sv_game.c
index f1fee90..43556bc 100644
--- a/code/server/sv_game.c
+++ b/code/server/sv_game.c
@@ -308,10 +308,10 @@ The module is making a system call
intptr_t SV_GameSystemCalls( intptr_t *args ) {
switch( args[0] ) {
case G_PRINT:
- Com_Printf( "%s", VMA(1) );
+ Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case G_ERROR:
- Com_Error( ERR_DROP, "%s", VMA(1) );
+ Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case G_MILLISECONDS:
return Sys_Milliseconds();
diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c
index 95d2c34..e10e603 100644
--- a/code/ui/ui_main.c
+++ b/code/ui/ui_main.c
@@ -946,7 +946,7 @@ void UI_LoadMenus(const char *menuFile, qboolean reset) {
trap_Error( va( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ) );
handle = trap_PC_LoadSource( "ui/menus.txt" );
if (!handle) {
- trap_Error( va( S_COLOR_RED "default menu file not found: ui/menus.txt, unable to continue!\n", menuFile ) );
+ trap_Error( va( S_COLOR_RED "default menu file not found: ui/menus.txt, unable to continue!\n") );
}
}
diff --git a/code/unix/sdl_snd.c b/code/unix/sdl_snd.c
index 20d4bfd..e15ec02 100644
--- a/code/unix/sdl_snd.c
+++ b/code/unix/sdl_snd.c
@@ -186,7 +186,7 @@ static void print_audiospec(const char *str, const SDL_AudioSpec *spec)
if( fmt ) {
Com_Printf( " Format: %s\n", fmt );
} else {
- Com_Printf( " Format: " S_COLOR_RED "UNKNOWN\n", fmt );
+ Com_Printf( " Format: " S_COLOR_RED "UNKNOWN\n");
}
Com_Printf( " Freq: %d\n", (int) spec->freq );