Added format arguments to all printf, sprintf and snprintf calls missing them to prevent warnings/errors with some distributions of gcc
This commit is contained in:
parent
aa68347028
commit
4c7879b740
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
|||
20101014
|
||||
--------
|
||||
main/menu.c: Fixed compilation of menu.c when USE_SDLMIXER is not defined
|
||||
arch/sdl/jukebox.c, include/cfile.h, main/console.c, main/hud.c, main/menu.c, main/mission.c, main/net_ipx.c, main/net_udp.c, main/scores.c, main/titles.c, misc/physfsx.c: Added format arguments to all printf, sprintf and snprintf calls missing them to prevent warnings/errors with some distributions of gcc
|
||||
|
||||
20101010
|
||||
--------
|
||||
|
|
|
@ -164,7 +164,7 @@ void jukebox_load()
|
|||
if (PHYSFS_isDirectory(GameCfg.CMLevelMusicPath)) // it's a child of Sharepath, build full path
|
||||
{
|
||||
PHYSFSX_getRealPath(GameCfg.CMLevelMusicPath,abspath);
|
||||
snprintf(GameCfg.CMLevelMusicPath,sizeof(char)*PATH_MAX,abspath);
|
||||
snprintf(GameCfg.CMLevelMusicPath,sizeof(char)*PATH_MAX,"%s",abspath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ static inline int cfile_init(char *hogname, int add_to_end)
|
|||
{
|
||||
char hogname2[PATH_MAX], pathname[PATH_MAX];
|
||||
|
||||
snprintf(hogname2, strlen(hogname)+1, hogname);
|
||||
snprintf(hogname2, strlen(hogname)+1, "%s", hogname);
|
||||
PHYSFSEXT_locateCorrectCase(hogname2);
|
||||
|
||||
if (!PHYSFSX_getRealPath(hogname2, pathname))
|
||||
|
@ -57,7 +57,7 @@ static inline int cfile_close(char *hogname)
|
|||
{
|
||||
char hogname2[PATH_MAX], pathname[PATH_MAX];
|
||||
|
||||
snprintf(hogname2, strlen(hogname)+1, hogname);
|
||||
snprintf(hogname2, strlen(hogname)+1, "%s", hogname);
|
||||
PHYSFSEXT_locateCorrectCase(hogname2);
|
||||
|
||||
if (!PHYSFSX_getRealPath(hogname2, pathname))
|
||||
|
@ -72,7 +72,7 @@ static inline int cfile_size(char *hogname)
|
|||
char hogname2[PATH_MAX];
|
||||
int size;
|
||||
|
||||
snprintf(hogname2, strlen(hogname)+1, hogname);
|
||||
snprintf(hogname2, strlen(hogname)+1, "%s", hogname);
|
||||
PHYSFSEXT_locateCorrectCase(hogname2);
|
||||
|
||||
fp = PHYSFS_openRead(hogname2);
|
||||
|
|
|
@ -82,7 +82,7 @@ void con_printf(int priority, char *fmt, ...)
|
|||
con_add_buffer_line(priority, buffer);
|
||||
|
||||
/* Print output to stdout */
|
||||
printf(buffer);
|
||||
printf("%s",buffer);
|
||||
|
||||
/* Print output to gamelog.txt */
|
||||
if (gamelog_fp)
|
||||
|
|
|
@ -150,7 +150,7 @@ int HUD_init_message_va(char * format, va_list args)
|
|||
{
|
||||
HUD_nmessages++;
|
||||
}
|
||||
snprintf(HUD_messages[HUD_nmessages-1].message, sizeof(char)*HUD_MESSAGE_LENGTH, message);
|
||||
snprintf(HUD_messages[HUD_nmessages-1].message, sizeof(char)*HUD_MESSAGE_LENGTH, "%s", message);
|
||||
if (HUD_nmessages-HUD_MAX_NUM_DISP < 0)
|
||||
HUD_messages[HUD_nmessages-1].time = F1_0*3; // one message - display 3 secs
|
||||
else
|
||||
|
|
|
@ -1563,9 +1563,9 @@ void do_sound_menu()
|
|||
char old_CMLevelMusicPath[PATH_MAX+1], old_CMMiscMusic0[PATH_MAX+1];
|
||||
|
||||
memset(old_CMLevelMusicPath, 0, sizeof(char)*(PATH_MAX+1));
|
||||
snprintf(old_CMLevelMusicPath, strlen(GameCfg.CMLevelMusicPath)+1, GameCfg.CMLevelMusicPath);
|
||||
snprintf(old_CMLevelMusicPath, strlen(GameCfg.CMLevelMusicPath)+1, "%s", GameCfg.CMLevelMusicPath);
|
||||
memset(old_CMMiscMusic0, 0, sizeof(char)*(PATH_MAX+1));
|
||||
snprintf(old_CMMiscMusic0, strlen(GameCfg.CMMiscMusic[SONG_TITLE])+1, GameCfg.CMMiscMusic[SONG_TITLE]);
|
||||
snprintf(old_CMMiscMusic0, strlen(GameCfg.CMMiscMusic[SONG_TITLE])+1, "%s", GameCfg.CMMiscMusic[SONG_TITLE]);
|
||||
|
||||
MALLOC(m, newmenu_item, SOUND_MENU_NITEMS);
|
||||
if (!m)
|
||||
|
|
|
@ -536,19 +536,19 @@ int load_mission(mle *mission)
|
|||
{
|
||||
char *tmp, *ptr;
|
||||
MALLOC(tmp, char, FILENAME_LEN);
|
||||
snprintf(tmp, FILENAME_LEN, v);
|
||||
snprintf(tmp, FILENAME_LEN, "%s", v);
|
||||
if ((ptr = strrchr(tmp, '.'))) // if there's a filename extension, kill it. No one knows it's the right one.
|
||||
*ptr = '\0';
|
||||
strncat(tmp, ".tex", sizeof(char)*FILENAME_LEN); // apply tex-extenstion
|
||||
if (cfexist(tmp)) // check if this file exists ...
|
||||
snprintf(Briefing_text_filename, FILENAME_LEN, tmp); // ... and apply ...
|
||||
snprintf(Briefing_text_filename, FILENAME_LEN, "%s", tmp); // ... and apply ...
|
||||
else // ... otherwise ...
|
||||
{
|
||||
if ((ptr = strrchr(tmp, '.')))
|
||||
*ptr = '\0';
|
||||
strncat(tmp, ".txb", sizeof(char)*FILENAME_LEN); // apply txb extension
|
||||
if (cfexist(tmp)) // check if this file exists ...
|
||||
snprintf(Briefing_text_filename, FILENAME_LEN, tmp); // ... and apply ...
|
||||
snprintf(Briefing_text_filename, FILENAME_LEN, "%s", tmp); // ... and apply ...
|
||||
}
|
||||
d_free(tmp);
|
||||
}
|
||||
|
@ -561,19 +561,19 @@ int load_mission(mle *mission)
|
|||
{
|
||||
char *tmp, *ptr;
|
||||
MALLOC(tmp, char, FILENAME_LEN);
|
||||
snprintf(tmp, FILENAME_LEN, v);
|
||||
snprintf(tmp, FILENAME_LEN, "%s", v);
|
||||
if ((ptr = strrchr(tmp, '.'))) // if there's a filename extension, kill it. No one knows it's the right one.
|
||||
*ptr = '\0';
|
||||
strncat(tmp, ".tex", sizeof(char)*FILENAME_LEN); // apply tex-extenstion
|
||||
if (cfexist(tmp)) // check if this file exists ...
|
||||
snprintf(Briefing_text_filename, FILENAME_LEN, tmp); // ... and apply ...
|
||||
snprintf(Briefing_text_filename, FILENAME_LEN, "%s", tmp); // ... and apply ...
|
||||
else // ... otherwise ...
|
||||
{
|
||||
if ((ptr = strrchr(tmp, '.')))
|
||||
*ptr = '\0';
|
||||
strncat(tmp, ".txb", sizeof(char)*FILENAME_LEN); // apply txb extension
|
||||
if (cfexist(tmp)) // check if this file exists ...
|
||||
snprintf(Ending_text_filename, FILENAME_LEN, tmp); // ... and apply ...
|
||||
snprintf(Ending_text_filename, FILENAME_LEN, "%s", tmp); // ... and apply ...
|
||||
}
|
||||
d_free(tmp);
|
||||
}
|
||||
|
|
|
@ -696,7 +696,7 @@ int net_ipx_endlevel_poll( newmenu *menu, d_event *event, int *secret )
|
|||
{
|
||||
if (Countdown_seconds_left < 0)
|
||||
{
|
||||
sprintf(menus[N_players].text, TXT_REACTOR_EXPLODED);
|
||||
sprintf(menus[N_players].text, "%s", TXT_REACTOR_EXPLODED);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -860,7 +860,7 @@ int net_ipx_endlevel(int *secret)
|
|||
title = menu_text + (N_players + 1)*80;
|
||||
|
||||
if (Countdown_seconds_left < 0)
|
||||
sprintf(m[N_players].text, TXT_REACTOR_EXPLODED);
|
||||
sprintf(m[N_players].text, "%s", TXT_REACTOR_EXPLODED);
|
||||
else
|
||||
sprintf(m[N_players].text, "%s: %d %s ", TXT_TIME_REMAINING, Countdown_seconds_left, TXT_SECONDS);
|
||||
|
||||
|
@ -4146,7 +4146,7 @@ int net_ipx_show_game_stats(int choice)
|
|||
if(!netgame->mission_title)
|
||||
info+=sprintf(info,"Descent: First Strike");
|
||||
else
|
||||
info+=sprintf(info,netgame->mission_title);
|
||||
info+=sprintf(info,"%s",netgame->mission_title);
|
||||
|
||||
if( netgame->levelnum >= 0 )
|
||||
{
|
||||
|
|
|
@ -4721,7 +4721,7 @@ int net_udp_show_game_info()
|
|||
if(!netgame->mission_title)
|
||||
info+=sprintf(info,"Descent: First Strike");
|
||||
else
|
||||
info+=sprintf(info,netgame->mission_title);
|
||||
info+=sprintf(info,"%s",netgame->mission_title);
|
||||
|
||||
if( netgame->levelnum >= 0 )
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ void scores_read(all_scores *scores)
|
|||
int i;
|
||||
|
||||
// No error message needed, code will work without a scores file
|
||||
sprintf( scores->cool_saying, TXT_REGISTER_DESCENT );
|
||||
sprintf( scores->cool_saying, "%s", TXT_REGISTER_DESCENT );
|
||||
sprintf( scores->stats[0].name, "Parallax" );
|
||||
sprintf( scores->stats[1].name, "Mike" );
|
||||
sprintf( scores->stats[2].name, "Matt" );
|
||||
|
|
|
@ -889,9 +889,9 @@ int load_briefing_screen(briefing *br, char *fname)
|
|||
free_briefing_screen(br);
|
||||
|
||||
MALLOC(fname2, char, FILENAME_LEN);
|
||||
snprintf(fname2, sizeof(char)*FILENAME_LEN, fname);
|
||||
snprintf(fname2, sizeof(char)*FILENAME_LEN, "%s", fname);
|
||||
MALLOC(forigin, char, PATH_MAX);
|
||||
snprintf(forigin, sizeof(char)*PATH_MAX, PHYSFS_getRealDir(fname));
|
||||
snprintf(forigin, sizeof(char)*PATH_MAX, "%s", PHYSFS_getRealDir(fname));
|
||||
strlwr(forigin);
|
||||
|
||||
// check if we have a hires version of this image (not included in PC-version by default)
|
||||
|
@ -903,7 +903,7 @@ int load_briefing_screen(briefing *br, char *fname)
|
|||
*ptr = '\0';
|
||||
strncat(fname2, "h.pcx", sizeof(char)*FILENAME_LEN);
|
||||
if (!cfexist(fname2))
|
||||
snprintf(fname2, sizeof(char)*FILENAME_LEN, fname);
|
||||
snprintf(fname2, sizeof(char)*FILENAME_LEN, "%s", fname);
|
||||
}
|
||||
d_free(forigin);
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ PHYSFS_file *PHYSFSX_openReadBuffered(char *filename)
|
|||
filename++;
|
||||
}
|
||||
|
||||
snprintf(filename2, strlen(filename)+1, filename);
|
||||
snprintf(filename2, strlen(filename)+1, "%s", filename);
|
||||
PHYSFSEXT_locateCorrectCase(filename2);
|
||||
|
||||
fp = PHYSFS_openRead(filename2);
|
||||
|
|
Loading…
Reference in a new issue