diff --git a/src/decor.cxx b/src/decor.cxx index 7f0edf9..09c4509 100644 --- a/src/decor.cxx +++ b/src/decor.cxx @@ -238,7 +238,7 @@ bool CDecor::LoadImages () totalDim.y = DIMCELY * 2 * 6; iconDim.x = DIMCELX * 2; iconDim.y = DIMCELY * 2; - sprintf (filename, "image/floor%.3d.png", m_region); + snprintf (filename, sizeof (filename), "image/floor%.3d.png", m_region); if (!m_pPixmap->Cache (CHFLOOR, filename, totalDim, iconDim)) return false; @@ -246,11 +246,11 @@ bool CDecor::LoadImages () totalDim.y = DIMOBJY * 8; iconDim.x = DIMOBJX; iconDim.y = DIMOBJY; - sprintf (filename, "image/obj%.3d.png", m_region); + snprintf (filename, sizeof (filename), "image/obj%.3d.png", m_region); if (!m_pPixmap->Cache (CHOBJECT, filename, totalDim, iconDim)) return false; - sprintf (filename, "image/obj-o%.3d.png", m_region); + snprintf (filename, sizeof (filename), "image/obj-o%.3d.png", m_region); if (!m_pPixmap->Cache (CHOBJECTo, filename, totalDim, iconDim)) return false; @@ -708,7 +708,7 @@ void CDecor::BuildMoveObject (Sint32 x, Sint32 y, POINT pos, Sint32 rank) m_pPixmap->DrawIcon ( -1, m_decor[x / 2][y / 2].objectChannel, m_decor[x / 2][y / 2].objectIcon, pos); - sprintf (string, "%d", m_move[rank].icon - MOVEICONNB); + snprintf (string, sizeof (string), "%d", m_move[rank].icon - MOVEICONNB); textPos.x = pos.x + DIMCELX / 2 + 32; textPos.y = pos.y + (DIMOBJY - DIMCELY * 2) + 36; DrawTextCenter (m_pPixmap, textPos, string, FONTLITTLE); diff --git a/src/decstat.cxx b/src/decstat.cxx index 49cea60..c9f95dc 100644 --- a/src/decstat.cxx +++ b/src/decstat.cxx @@ -713,7 +713,7 @@ void CDecor::StatisticDraw () m_pPixmap->DrawIcon (-1, CHBUTTON, icon, pos); nb = pStatistic->nb; - sprintf (text, "%d", nb); + snprintf (text, sizeof (text), "%d", nb); pos.x += 3 + 34; pos.y += 5 + 7; DrawText (m_pPixmap, pos, text); diff --git a/src/event.cxx b/src/event.cxx index 011abc1..3943d01 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -2100,7 +2100,7 @@ bool CEvent::DrawButtons () m_pPixmap->DrawPart (-1, CHBACK, pos, rect, 1); // dessine le fond if (m_speed > 1) { - sprintf (res, "x%d", m_speed); + snprintf (res, sizeof (res), "x%d", m_speed); DrawText (m_pPixmap, pos, res); } @@ -2178,7 +2178,7 @@ bool CEvent::DrawButtons () world = m_fileWorld[i]; time = m_fileTime[i]; - sprintf (text, "%d", i + 1); + snprintf (text, sizeof (text), "%d", i + 1); lg = GetTextWidth (text); pos.x = (420 + 460) / 2 - lg / 2; pos.y = 30 + 12 + 42 * i; @@ -2436,19 +2436,19 @@ bool CEvent::DrawButtons () DrawTextCenter (gettext ("Music\nvolume"), 399 + 40, 80); DrawTextCenter (gettext ("Video\nsequences"), 514 + 40, 80); - sprintf (res, "x%d", m_speed); + snprintf (res, sizeof (res), "x%d", m_speed); lg = GetTextWidth (res); pos.x = (54 + 40) - lg / 2; pos.y = 330 - 20; DrawText (m_pPixmap, pos, res); - sprintf (res, "%d", m_pSound->GetAudioVolume ()); + snprintf (res, sizeof (res), "%d", m_pSound->GetAudioVolume ()); lg = GetTextWidth (res); pos.x = (284 + 40) - lg / 2; pos.y = 330 - 20; DrawText (m_pPixmap, pos, res); - sprintf (res, "%d", m_pSound->GetMidiVolume ()); + snprintf (res, sizeof (res), "%d", m_pSound->GetMidiVolume ()); lg = GetTextWidth (res); pos.x = (399 + 40) - lg / 2; pos.y = 330 - 20; @@ -2465,7 +2465,7 @@ bool CEvent::DrawButtons () if (!m_scrollSpeed) snprintf (res, sizeof (res), "%s", gettext ("None")); else - sprintf (res, "%d", m_scrollSpeed); + snprintf (res, sizeof (res), "%d", m_scrollSpeed); lg = GetTextWidth (res); pos.x = (169 + 40) - lg / 2; pos.y = 330 - 20; @@ -4275,7 +4275,7 @@ void CEvent::PrivateLibelle () snprintf ( buffer, sizeof (buffer), "%s", gettext ("1|The Blupi population must\n1|be of at least %d Blupi.")); - sprintf (string, buffer, term.nbMaxBlupi); + snprintf (string, sizeof (string), buffer, term.nbMaxBlupi); strcat (m_libelle, "\n1|\n"); strcat (m_libelle, string); } diff --git a/src/sound.cxx b/src/sound.cxx index 8089453..83201ab 100644 --- a/src/sound.cxx +++ b/src/sound.cxx @@ -137,7 +137,7 @@ void CSound::CacheAll () for (i = 0; i < MAXSOUND; i++) { - sprintf (name, "sound%.3d.wav", i); + snprintf (name, sizeof (name), "sound%.3d.wav", i); if (!Cache (i, name)) break; } diff --git a/src/text.cxx b/src/text.cxx index b915a26..7f1749e 100644 --- a/src/text.cxx +++ b/src/text.cxx @@ -335,7 +335,7 @@ void DrawBignum (CPixmap * pPixmap, POINT pos, Sint32 num) Sint32 start, lg; RECT rect; - sprintf (string, "%d", num); + snprintf (string, sizeof (string), "%d", num); rect.top = 0; rect.bottom = 52; @@ -361,7 +361,7 @@ Sint32 GetBignumWidth (Sint32 num) Sint32 start, lg; Sint32 width = -4; - sprintf (string, "%d", num); + snprintf (string, sizeof (string), "%d", num); while (string[i] != 0) {