diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 177910039..250c42fb0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/arch/sdl/jukebox.c b/arch/sdl/jukebox.c index a7f46cd54..0df1c4edd 100644 --- a/arch/sdl/jukebox.c +++ b/arch/sdl/jukebox.c @@ -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); } } diff --git a/include/cfile.h b/include/cfile.h index 02b82dcdf..703d95ed5 100644 --- a/include/cfile.h +++ b/include/cfile.h @@ -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); diff --git a/main/console.c b/main/console.c index b40251816..ebeaadccd 100644 --- a/main/console.c +++ b/main/console.c @@ -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) diff --git a/main/hud.c b/main/hud.c index 893e5886e..b41bd6a74 100644 --- a/main/hud.c +++ b/main/hud.c @@ -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 diff --git a/main/menu.c b/main/menu.c index f7b649857..b9bb081da 100644 --- a/main/menu.c +++ b/main/menu.c @@ -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) diff --git a/main/mission.c b/main/mission.c index f282110fc..2a3a95db4 100644 --- a/main/mission.c +++ b/main/mission.c @@ -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); } diff --git a/main/net_ipx.c b/main/net_ipx.c index 55655efac..9536d9217 100644 --- a/main/net_ipx.c +++ b/main/net_ipx.c @@ -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 ) { diff --git a/main/net_udp.c b/main/net_udp.c index a3cf6e381..6676e4de8 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -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 ) { diff --git a/main/scores.c b/main/scores.c index 9b2973f38..32217a932 100644 --- a/main/scores.c +++ b/main/scores.c @@ -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" ); diff --git a/main/titles.c b/main/titles.c index 95694c68b..d85d7e5b9 100644 --- a/main/titles.c +++ b/main/titles.c @@ -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); diff --git a/misc/physfsx.c b/misc/physfsx.c index e8b7a92d7..4b7054c9d 100644 --- a/misc/physfsx.c +++ b/misc/physfsx.c @@ -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);