Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit cc087de

Browse files
committed
Added sizeof to all commented out sprintf_s calls
Removed a few commented out sprintf_s calls and stuff
1 parent dbdf123 commit cc087de

24 files changed

+94
-108
lines changed

Activities/GameActivity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2340,7 +2340,7 @@ void GameActivity::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int w
23402340
g_FrameMan.GetLargeFont()->DrawAligned(&pBitmapInt, MAX(16, g_SceneMan.GetScreenOcclusion(which).m_X + 16), yTextPos, str, GUIFont::Left);
23412341
/* Not applicable anymore to the 4-team games
23422342
// Body losses
2343-
sprintf_s(str, "%c Losses: %c%i %c%i", -39, -62, GetTeamDeathCount(Activity::TEAM_1), -59, GetTeamDeathCount(Activity::TEAM_2));
2343+
sprintf_s(str, sizeof(str), "%c Losses: %c%i %c%i", -39, -62, GetTeamDeathCount(Activity::TEAM_1), -59, GetTeamDeathCount(Activity::TEAM_2));
23442344
g_FrameMan.GetLargeFont()->DrawAligned(&pBitmapInt, MIN(pTargetBitmap->w - 4, pTargetBitmap->w - 4 + g_SceneMan.GetScreenOcclusion(which).m_X), yTextPos, str, GUIFont::Right);
23452345
*/
23462346
// Show the player's controller scheme icon in the upper right corner of his screen, but only for a minute

Activities/MultiplayerServerLobby.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ namespace RTE {
11761176
m_pGUIInput->GetMousePosition(&x, &y);
11771177
11781178
char buf[256];
1179-
sprintf_s(buf, "MB-%d%d%d MS-%d%d%d %d - %d", states[0], states[1], states[2], events[0], events[1], events[2], x, y);
1179+
sprintf_s(buf, sizeof(buf), "MB-%d%d%d MS-%d%d%d %d - %d", states[0], states[1], states[2], events[0], events[1], events[2], x, y);
11801180
11811181
result = result + buf;
11821182
g_FrameMan.SetScreenText(result, 0, 0, -1, false);

Entities/ACrab.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,7 +3253,7 @@ void ACrab::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
32533253
char gaugeColor = jetTimeRatio > 0.6 ? 149 : (jetTimeRatio > 0.3 ? 77 : 13);
32543254
rectfill(pTargetBitmap, drawPos.m_X, drawPos.m_Y + m_HUDStack + 6, drawPos.m_X + (16 * jetTimeRatio), drawPos.m_Y + m_HUDStack + 7, gaugeColor);
32553255
// rect(pTargetBitmap, drawPos.m_X, drawPos.m_Y + m_HUDStack - 2, drawPos.m_X + 24, drawPos.m_Y + m_HUDStack - 4, 238);
3256-
// sprintf_s(str, "%.0f Kg", mass);
3256+
// sprintf_s(str, sizeof(str), "%.0f Kg", mass);
32573257
// pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 0, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Left);
32583258

32593259
m_HUDStack += -10;
@@ -3289,7 +3289,7 @@ void ACrab::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
32893289

32903290
// Print aim angle and rot angle stoff
32913291
/*{
3292-
sprintf_s(str, "Aim %.2f Rot %.2f Lim %.2f", m_AimAngle, GetRotAngle(), m_AimRange + GetRotAngle());
3292+
sprintf_s(str, sizeof(str), "Aim %.2f Rot %.2f Lim %.2f", m_AimAngle, GetRotAngle(), m_AimRange + GetRotAngle());
32933293
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 0, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);
32943294
32953295
m_HUDStack += -10;
@@ -3305,22 +3305,22 @@ void ACrab::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
33053305
33063306
if (m_AIMode == AIMODE_SENTRY)
33073307
{
3308-
sprintf_s(str, "%s", "Sentry");
3308+
sprintf_s(str, sizeof(str), "%s", "Sentry");
33093309
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X, iconPos.m_Y - 18, str, GUIFont::Centre);
33103310
}
33113311
else if (m_AIMode == AIMODE_PATROL)
33123312
{
3313-
sprintf_s(str, "%s", "Patrol");
3313+
sprintf_s(str, sizeof(str), "%s", "Patrol");
33143314
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X - 9, iconPos.m_Y - 5, str, GUIFont::Right);
33153315
}
33163316
else if (m_AIMode == AIMODE_BRAINHUNT)
33173317
{
3318-
sprintf_s(str, "%s", "Brainhunt");
3318+
sprintf_s(str, sizeof(str), "%s", "Brainhunt");
33193319
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X + 9, iconPos.m_Y - 5, str, GUIFont::Left);
33203320
}
33213321
else if (m_AIMode == AIMODE_GOLDDIG)
33223322
{
3323-
sprintf_s(str, "%s", "Gold Dig");
3323+
sprintf_s(str, sizeof(str), "%s", "Gold Dig");
33243324
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X, iconPos.m_Y + 8, str, GUIFont::Centre);
33253325
}
33263326

Entities/ACraft.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,22 +1059,22 @@ void ACraft::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
10591059
10601060
if (m_AIMode == AIMODE_RETURN)
10611061
{
1062-
sprintf_s(str, "%s", "Return");
1062+
sprintf_s(str, sizeof(str), "%s", "Return");
10631063
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X, iconPos.m_Y - 18, str, GUIFont::Centre);
10641064
}
10651065
else if (m_AIMode == AIMODE_DELIVER)
10661066
{
1067-
sprintf_s(str, "%s", "Deliver");
1067+
sprintf_s(str, sizeof(str), "%s", "Deliver");
10681068
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X - 9, iconPos.m_Y - 5, str, GUIFont::Right);
10691069
}
10701070
else if (m_AIMode == AIMODE_SCUTTLE)
10711071
{
1072-
sprintf_s(str, "%s", "Scuttle");
1072+
sprintf_s(str, sizeof(str), "%s", "Scuttle");
10731073
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X + 9, iconPos.m_Y - 5, str, GUIFont::Left);
10741074
}
10751075
else if (m_AIMode == AIMODE_STAY)
10761076
{
1077-
sprintf_s(str, "%s", "Stay");
1077+
sprintf_s(str, sizeof(str), "%s", "Stay");
10781078
pSmallFont->DrawAligned(&pBitmapInt, iconPos.m_X, iconPos.m_Y + 8, str, GUIFont::Centre);
10791079
}
10801080

Entities/AHuman.cpp

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4892,7 +4892,7 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
48924892
char gaugeColor = jetTimeRatio > 0.6 ? 149 : (jetTimeRatio > 0.3 ? 77 : 13);
48934893
rectfill(pTargetBitmap, drawPos.m_X, drawPos.m_Y + m_HUDStack + 6, drawPos.m_X + (16 * jetTimeRatio), drawPos.m_Y + m_HUDStack + 7, gaugeColor);
48944894
// rect(pTargetBitmap, drawPos.m_X, drawPos.m_Y + m_HUDStack - 2, drawPos.m_X + 24, drawPos.m_Y + m_HUDStack - 4, 238);
4895-
// sprintf_s(str, "%.0f Kg", mass);
4895+
// sprintf_s(str, sizeof(str), "%.0f Kg", mass);
48964896
// pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 0, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Left);
48974897

48984898
m_HUDStack += -10;
@@ -4930,7 +4930,7 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
49304930
{
49314931
str[0] = m_GoldPicked ? -57 : -58; str[1] = 0;
49324932
pSymbolFont->DrawAligned(&allegroBitmap, drawPos.m_X - 11, drawPos.m_Y + m_HUDStack, str, GUIFont::Left);
4933-
sprintf_s(str, "%.0f oz", GetGoldCarried());
4933+
sprintf_s(str, sizeof(str), "%.0f oz", GetGoldCarried());
49344934
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 0, drawPos.m_Y + m_HUDStack + 2, str, GUIFont::Left);
49354935
49364936
m_HUDStack += -11;
@@ -4939,25 +4939,25 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
49394939
if (m_pFGArm->HoldsSomething())
49404940
{
49414941
/*
4942-
sprintf_s(str, " Œ Drop");
4942+
sprintf_s(str, sizeof(str), " Œ Drop");
49434943
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 12, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Left);
49444944
m_HUDStack += -9;
49454945
*/
4946-
// sprintf_s(str, " %s", m_pFGArm->GetHeldMO()->GetPresetName().c_str());
4946+
// sprintf_s(str, sizeof(str), " %s", m_pFGArm->GetHeldMO()->GetPresetName().c_str());
49474947
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X, drawPos.m_Y + m_HUDStack + 3, m_pFGArm->GetHeldMO()->GetPresetName().c_str(), GUIFont::Centre);
49484948
m_HUDStack += -9;
49494949
}
49504950
else
49514951
{
4952-
// sprintf_s(str, "æ EMPTY ø");
4952+
// sprintf_s(str, sizeof(str), "æ EMPTY ø");
49534953
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X, drawPos.m_Y + m_HUDStack + 3, "EMPTY", GUIFont::Centre);
49544954
m_HUDStack += -9;
49554955
}
49564956
/*
49574957
// Reload GUI, only show when there's nothing to pick up
49584958
if (!m_pItemInReach && m_pFGArm->HoldsSomething() && pHeldFirearm && !pHeldFirearm->IsFull())
49594959
{
4960-
sprintf_s(str, " œ Reload", pHeldFirearm);
4960+
sprintf_s(str, sizeof(str), " œ Reload", pHeldFirearm);
49614961
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 12, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Left);
49624962
}
49634963
*/
@@ -4975,7 +4975,6 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
49754975
{
49764976
if (m_pItemInReach && g_MovableMan.IsDevice(m_pItemInReach) && m_pFGArm && m_pFGArm->IsAttached())
49774977
{
4978-
// sprintf_s(str, " œ Pick up %s", m_pItemInReach->GetPresetName().c_str());
49794978
sprintf_s(str, sizeof(str), " %c %s", -49, m_pItemInReach->GetPresetName().c_str());
49804979
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X - 12, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Left);
49814980
}
@@ -4992,22 +4991,22 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
49924991
49934992
if (m_AIMode == AIMODE_SENTRY)
49944993
{
4995-
sprintf_s(str, "%s", "Sentry");
4994+
sprintf_s(str, sizeof(str), "%s", "Sentry");
49964995
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X, iconPos.m_Y - 18, str, GUIFont::Centre);
49974996
}
49984997
else if (m_AIMode == AIMODE_PATROL)
49994998
{
5000-
sprintf_s(str, "%s", "Patrol");
4999+
sprintf_s(str, sizeof(str), "%s", "Patrol");
50015000
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X - 9, iconPos.m_Y - 5, str, GUIFont::Right);
50025001
}
50035002
else if (m_AIMode == AIMODE_BRAINHUNT)
50045003
{
5005-
sprintf_s(str, "%s", "Brainhunt");
5004+
sprintf_s(str, sizeof(str), "%s", "Brainhunt");
50065005
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X + 9, iconPos.m_Y - 5, str, GUIFont::Left);
50075006
}
50085007
else if (m_AIMode == AIMODE_GOLDDIG)
50095008
{
5010-
sprintf_s(str, "%s", "Gold Dig");
5009+
sprintf_s(str, sizeof(str), "%s", "Gold Dig");
50115010
pSmallFont->DrawAligned(&allegroBitmap, iconPos.m_X, iconPos.m_Y + 8, str, GUIFont::Centre);
50125011
}
50135012
@@ -5040,58 +5039,58 @@ void AHuman::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichSc
50405039

50415040
// Dig state
50425041
if (m_DigState == PREDIG)
5043-
sprintf_s(str, "PREDIG");
5042+
sprintf_s(str, sizeof(str), "PREDIG");
50445043
else if (m_DigState == STARTDIG)
5045-
sprintf_s(str, "STARTDIG");
5044+
sprintf_s(str, sizeof(str), "STARTDIG");
50465045
else if (m_DigState == TUNNELING)
5047-
sprintf_s(str, "TUNNELING");
5046+
sprintf_s(str, sizeof(str), "TUNNELING");
50485047
else if (m_DigState == FINISHINGDIG)
5049-
sprintf_s(str, "FINISHINGDIG");
5048+
sprintf_s(str, sizeof(str), "FINISHINGDIG");
50505049
else if (m_DigState == PAUSEDIGGER)
5051-
sprintf_s(str, "PAUSEDIGGER");
5050+
sprintf_s(str, sizeof(str), "PAUSEDIGGER");
50525051
else
5053-
sprintf_s(str, "NOTDIGGING");
5052+
sprintf_s(str, sizeof(str), "NOTDIGGING");
50545053
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X + 2, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);
50555054
m_HUDStack += -9;
50565055

50575056
// Device State
50585057
if (m_DeviceState == POINTING)
5059-
sprintf_s(str, "POINTING");
5058+
sprintf_s(str, sizeof(str), "POINTING");
50605059
else if (m_DeviceState == SCANNING)
5061-
sprintf_s(str, "SCANNING");
5060+
sprintf_s(str, sizeof(str), "SCANNING");
50625061
else if (m_DeviceState == AIMING)
5063-
sprintf_s(str, "AIMING");
5062+
sprintf_s(str, sizeof(str), "AIMING");
50645063
else if (m_DeviceState == FIRING)
5065-
sprintf_s(str, "FIRING");
5064+
sprintf_s(str, sizeof(str), "FIRING");
50665065
else if (m_DeviceState == THROWING)
5067-
sprintf_s(str, "THROWING");
5066+
sprintf_s(str, sizeof(str), "THROWING");
50685067
else if (m_DeviceState == DIGGING)
5069-
sprintf_s(str, "DIGGING");
5068+
sprintf_s(str, sizeof(str), "DIGGING");
50705069
else
5071-
sprintf_s(str, "STILL");
5070+
sprintf_s(str, sizeof(str), "STILL");
50725071
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X + 2, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);
50735072
m_HUDStack += -9;
50745073

50755074
// Jump State
50765075
if (m_JumpState == FORWARDJUMP)
5077-
sprintf_s(str, "FORWARDJUMP");
5076+
sprintf_s(str, sizeof(str), "FORWARDJUMP");
50785077
else if (m_JumpState == PREUPJUMP)
5079-
sprintf_s(str, "PREUPJUMP");
5078+
sprintf_s(str, sizeof(str), "PREUPJUMP");
50805079
else if (m_JumpState == UPJUMP)
5081-
sprintf_s(str, "UPJUMP");
5080+
sprintf_s(str, sizeof(str), "UPJUMP");
50825081
else if (m_JumpState == APEXJUMP)
5083-
sprintf_s(str, "APEXJUMP");
5082+
sprintf_s(str, sizeof(str), "APEXJUMP");
50845083
else if (m_JumpState == LANDJUMP)
5085-
sprintf_s(str, "LANDJUMP");
5084+
sprintf_s(str, sizeof(str), "LANDJUMP");
50865085
else
5087-
sprintf_s(str, "NOTJUMPING");
5086+
sprintf_s(str, sizeof(str), "NOTJUMPING");
50885087
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X + 2, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);
50895088
m_HUDStack += -9;
50905089

50915090
if (m_Status == STABLE)
5092-
sprintf_s(str, "STABLE");
5091+
sprintf_s(str, sizeof(str), "STABLE");
50935092
else if (m_Status == UNSTABLE)
5094-
sprintf_s(str, "UNSTABLE");
5093+
sprintf_s(str, sizeof(str), "UNSTABLE");
50955094
pSmallFont->DrawAligned(&allegroBitmap, drawPos.m_X + 2, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);
50965095
m_HUDStack += -9;
50975096

Entities/Actor.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,7 @@ void Actor::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
19291929
// Draw the contol pointer, if controlled and under the icon's time limit
19301930
if (m_Controller.IsPlayetControlled() && m_NewControlTmr.GetElapsedSimTimeMS() < 1500)
19311931
{
1932-
sprintf_s(str, "%c", -38);
1932+
sprintf_s(str, sizeof(str), "%c", -38);
19331933
pSymbolFont->DrawAligned(&bitmapInt, cpuPos.m_X - 0, drawPos.m_Y + m_HUDStack, str, GUIFont::Left);
19341934
}
19351935
*/
@@ -1942,27 +1942,27 @@ void Actor::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whichScr
19421942

19431943
// Obstacle state
19441944
if (m_ObstacleState == PROCEEDING)
1945-
sprintf_s(str, "PROCEEDING");
1945+
sprintf_s(str, sizeof(str), "PROCEEDING");
19461946
else if (m_ObstacleState == BACKSTEPPING)
1947-
sprintf_s(str, "BACKSTEPPING");
1947+
sprintf_s(str, sizeof(str), "BACKSTEPPING");
19481948
else if (m_ObstacleState == JUMPING)
1949-
sprintf_s(str, "JUMPING");
1949+
sprintf_s(str, sizeof(str), "JUMPING");
19501950
else if (m_ObstacleState == SOFTLANDING)
1951-
sprintf_s(str, "SOFTLANDING");
1951+
sprintf_s(str, sizeof(str), "SOFTLANDING");
19521952
else
1953-
sprintf_s(str, "DIGPAUSING");
1953+
sprintf_s(str, sizeof(str), "DIGPAUSING");
19541954
pSmallFont->DrawAligned(&bitmapInt, drawPos.m_X + 2, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);
19551955
m_HUDStack += -9;
19561956

19571957
// Team Block State
19581958
if (m_TeamBlockState == BLOCKED)
1959-
sprintf_s(str, "BLOCKED");
1959+
sprintf_s(str, sizeof(str), "BLOCKED");
19601960
else if (m_TeamBlockState == IGNORINGBLOCK)
1961-
sprintf_s(str, "IGNORINGBLOCK");
1961+
sprintf_s(str, sizeof(str), "IGNORINGBLOCK");
19621962
else if (m_TeamBlockState == FOLLOWWAIT)
1963-
sprintf_s(str, "FOLLOWWAIT");
1963+
sprintf_s(str, sizeof(str), "FOLLOWWAIT");
19641964
else
1965-
sprintf_s(str, "NOTBLOCKED");
1965+
sprintf_s(str, sizeof(str), "NOTBLOCKED");
19661966
pSmallFont->DrawAligned(&bitmapInt, drawPos.m_X + 2, drawPos.m_Y + m_HUDStack + 3, str, GUIFont::Centre);
19671967
m_HUDStack += -9;
19681968

Entities/Arm.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,11 @@ void Arm::Update()
521521
/*
522522
if (m_PresetName == "Player BG Arm") {
523523
char str[64];
524-
sprintf_s(str, "TargetOffset: %f, %f", m_TargetPoint.m_X, m_TargetPoint.m_Y);
524+
sprintf_s(str, sizeof(str), "TargetOffset: %f, %f", m_TargetPoint.m_X, m_TargetPoint.m_Y);
525525
g_FrameMan.DrawText(g_SceneMan.GetMOBitmap(), str, m_Pos + Vector(4, -140), false);
526-
sprintf_s(str, "m_Pos: %f, %f", m_Pos.m_X, m_Pos.m_Y);
526+
sprintf_s(str, sizeof(str), "m_Pos: %f, %f", m_Pos.m_X, m_Pos.m_Y);
527527
g_FrameMan.DrawText(g_SceneMan.GetMOBitmap(), str, m_Pos + Vector(4, -120), false);
528-
sprintf_s(str, "handTarget: %f, %f", handTarget.m_X, handTarget.m_Y);
528+
sprintf_s(str, sizeof(str), "handTarget: %f, %f", handTarget.m_X, handTarget.m_Y);
529529
g_FrameMan.DrawText(g_SceneMan.GetMOBitmap(), str, m_Pos + Vector(4, -100), false);
530530
}
531531
*/
@@ -651,7 +651,7 @@ void Arm::Draw(BITMAP *pTargetBitmap,
651651
#ifdef DEBUG_BUILD
652652
if (m_PresetName == "Player BG Arm") {
653653
char str[64];
654-
sprintf_s(str, "m_Pos in draw: %f, %f", m_Pos.m_X, m_Pos.m_Y);
654+
sprintf_s(str, sizeof(str), "m_Pos in draw: %f, %f", m_Pos.m_X, m_Pos.m_Y);
655655
g_FrameMan.DrawText(pTargetBitmap, str, m_Pos + Vector(4, -80), false);
656656
}
657657
#endif
@@ -684,7 +684,7 @@ void Arm::DrawHand(BITMAP *pTargetBitmap,
684684
#ifdef DEBUG_BUILD
685685
if (m_PresetName == "Player BG Arm") {
686686
char str[64];
687-
sprintf_s(str, "HandPos in hand draw: %f, %f", handPos.m_X, handPos.m_Y);
687+
sprintf_s(str, sizeof(str), "HandPos in hand draw: %f, %f", handPos.m_X, handPos.m_Y);
688688
g_FrameMan.DrawText(pTargetBitmap, str, handPos + Vector(4, -40), false);
689689
}
690690
#endif

Entities/Entity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ int Entity::ReadProperty(std::string propName, Reader &reader)
283283
{
284284
/* Just read as an original preset instead of failing
285285
char error[256];
286-
sprintf_s(error, "Referring to an instance ('%s') to copy from that hasn't been defined!", refName.c_str());
286+
sprintf_s(error, sizeof(error), "Referring to an instance ('%s') to copy from that hasn't been defined!", refName.c_str());
287287
reader.ReportError(error);
288288
return -1;
289289
*/

Entities/HeldDevice.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,7 @@ void HeldDevice::DrawHUD(BITMAP *pTargetBitmap, const Vector &targetPos, int whi
543543
m_BlinkTimer.Reset();
544544

545545
pSymbolFont->DrawAligned(&pBitmapInt, drawPos.m_X - 1, drawPos.m_Y - 20, str, GUIFont::Centre);
546-
// sprintf_s(str, "%.0f", m_PresetName);
547546
sprintf_s(str, sizeof(str), "%s", m_PresetName.c_str());
548-
// sprintf_s(str, "%s", m_sClass.GetName().c_str());
549547
pTextFont->DrawAligned(&pBitmapInt, drawPos.m_X + 0, drawPos.m_Y - 29, str, GUIFont::Centre);
550548
}
551549
}

Entities/MOSParticle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ void MOSParticle::Draw(BITMAP *pTargetBitmap,
438438
/*
439439
if (!onlyPhysical) {
440440
char str[64];
441-
sprintf_s(str, "aVel:%.2f", m_AngularVel);
441+
sprintf_s(str, sizeof(str), "aVel:%.2f", m_AngularVel);
442442
g_FrameMan.DrawText(pTargetBitmap, str, m_Pos + Vector(-45, -75), false);
443443
}
444444
*/

0 commit comments

Comments
 (0)