From 71d8ef248f4f1a05646f5e1e7e6388a59f08b121 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 30 Mar 2014 18:07:52 -0400 Subject: Eliminate some uses of sprintf() from common code. As part of this, add DIR_SEPARATOR_S as a string version of the DIR_SEPARATOR macro. Change M_TempFile() to return a string allocated on the C heap rather than the zone heap. This is a first step towards fixing #371. --- src/d_iwad.c | 29 +++++++++++------------------ src/doom/m_menu.c | 4 ++-- src/doomtype.h | 2 ++ src/i_oplmusic.c | 30 +++++++++++++++++------------- src/i_sdlmusic.c | 7 +++---- src/i_sdlsound.c | 3 ++- src/i_video.c | 16 ++++++---------- src/m_config.c | 31 +++++++++++++------------------ src/m_controls.c | 2 +- src/m_misc.c | 6 +----- src/net_gui.c | 6 +++--- src/v_video.c | 2 +- 12 files changed, 62 insertions(+), 76 deletions(-) diff --git a/src/d_iwad.c b/src/d_iwad.c index cb955685..508abf9d 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -289,11 +289,8 @@ static void CheckCollectorsEdition(void) for (i=0; i 0) { - sprintf(buf, " (+%i observer clients)", - net_client_wait_data.num_drones); + snprintf(buf, sizeof(buf), " (+%i observer clients)", + net_client_wait_data.num_drones); TXT_SetLabel(drone_label, buf); } else diff --git a/src/v_video.c b/src/v_video.c index f37aac86..d8934456 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -818,7 +818,7 @@ void V_ScreenShot(char *format) for (i=0; i<=99; i++) { - sprintf(lbmname, format, i, ext); + snprintf(lbmname, sizeof(lbmname), format, i, ext); if (!M_FileExists(lbmname)) { -- cgit v1.2.3