summaryrefslogtreecommitdiff
path: root/src/heretic/i_sound.c
diff options
context:
space:
mode:
authorSimon Howard2014-03-30 18:50:35 -0400
committerSimon Howard2014-03-30 18:50:35 -0400
commit6bb5f78bd2bdf10ddbb087171c6f640d425c9d40 (patch)
tree7e1139bcc7928983b8dd2556991be6076b95ed35 /src/heretic/i_sound.c
parent4465be140a27e47aa8bed15be4e58064297c7d94 (diff)
downloadchocolate-doom-6bb5f78bd2bdf10ddbb087171c6f640d425c9d40.tar.gz
chocolate-doom-6bb5f78bd2bdf10ddbb087171c6f640d425c9d40.tar.bz2
chocolate-doom-6bb5f78bd2bdf10ddbb087171c6f640d425c9d40.zip
heretic: Eliminate use of sprintf().
Use snprintf() in place of sprintf(). This is part of fixing #371.
Diffstat (limited to 'src/heretic/i_sound.c')
-rw-r--r--src/heretic/i_sound.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/heretic/i_sound.c b/src/heretic/i_sound.c
index d3f04767..2dc66239 100644
--- a/src/heretic/i_sound.c
+++ b/src/heretic/i_sound.c
@@ -211,7 +211,8 @@ int I_GetSfxLumpNum(sfxinfo_t * sound)
return 0;
if (sound->link)
sound = sound->link;
-// sprintf(namebuf, "d%c%s", snd_prefixen[snd_SfxDevice], sound->name);
+// snprintf(namebuf, sizeof(namebuf), "d%c%s",
+// snd_prefixen[snd_SfxDevice], sound->name);
return W_GetNumForName(sound->name);
}
@@ -319,14 +320,15 @@ void I_sndArbitrateCards(void)
{
if (debugmode)
{
- sprintf(tmp, "cfg p=0x%x, i=%d, d=%d\n",
- snd_SBport, snd_SBirq, snd_SBdma);
+ snprintf(tmp, sizeof(tmp), "cfg p=0x%x, i=%d, d=%d\n",
+ snd_SBport, snd_SBirq, snd_SBdma);
tprintf(tmp, 0);
}
if (SB_Detect(&snd_SBport, &snd_SBirq, &snd_SBdma, 0))
{
- sprintf(tmp, "SB isn't responding at p=0x%x, i=%d, d=%d\n",
- snd_SBport, snd_SBirq, snd_SBdma);
+ snprintf(tmp, sizeof(tmp),
+ "SB isn't responding at p=0x%x, i=%d, d=%d\n",
+ snd_SBport, snd_SBirq, snd_SBdma);
tprintf(tmp, 0);
}
else
@@ -334,8 +336,8 @@ void I_sndArbitrateCards(void)
if (debugmode)
{
- sprintf(tmp, "SB_Detect returned p=0x%x,i=%d,d=%d\n",
- snd_SBport, snd_SBirq, snd_SBdma);
+ snprintf(tmp, sizeof(tmp), "SB_Detect returned p=0x%x,i=%d,d=%d\n",
+ snd_SBport, snd_SBirq, snd_SBdma);
tprintf(tmp, 0);
}
}
@@ -352,14 +354,14 @@ void I_sndArbitrateCards(void)
{
if (debugmode)
{
- sprintf(tmp, "cfg p=0x%x\n", snd_Mport);
+ snprintf(tmp, sizeof(tmp), "cfg p=0x%x\n", snd_Mport);
tprintf(tmp, 0);
}
if (MPU_Detect(&snd_Mport, &i))
{
- sprintf(tmp, "The MPU-401 isn't reponding @ p=0x%x.\n",
- snd_Mport);
+ snprintf(tmp, sizeof(tmp),
+ "The MPU-401 isn't reponding @ p=0x%x.\n", snd_Mport);
tprintf(tmp, 0);
}
else
@@ -397,11 +399,11 @@ void I_StartupSound(void)
if (debugmode)
{
- sprintf(tmp, " Music device #%d & dmxCode=%d", snd_MusicDevice,
- dmxCodes[snd_MusicDevice]);
+ snprintf(tmp, sizeof(tmp), " Music device #%d & dmxCode=%d",
+ snd_MusicDevice, dmxCodes[snd_MusicDevice]);
tprintf(tmp, 0);
- sprintf(tmp, " Sfx device #%d & dmxCode=%d\n", snd_SfxDevice,
- dmxCodes[snd_SfxDevice]);
+ snprintf(tmp, sizeof(tmp), " Sfx device #%d & dmxCode=%d\n",
+ snd_SfxDevice, dmxCodes[snd_SfxDevice]);
tprintf(tmp, 0);
}
@@ -412,7 +414,7 @@ void I_StartupSound(void)
if (debugmode)
{
- sprintf(tmp, " DMX_Init() returned %d", rc);
+ snprintf(tmp, sizeof(tmp), " DMX_Init() returned %d", rc);
tprintf(tmp, 0);
}