Skip to content

Commit

Permalink
Replace sprintf_s with xr_sprintf
Browse files Browse the repository at this point in the history
Our replacement of sprintf_s in Common/PlatformLinux.inl is faulty and
should be avoided. Check it: sprintf_s(x, "Works? %s", "no") and look at
x's value.
  • Loading branch information
Zegeri authored and eagleivg committed Oct 4, 2018
1 parent c03aa99 commit 6f881ce
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_GL/rgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ HRESULT CRender::shader_compile(
size_t def_len = def_it * 5;
size_t sources_len = source.size() + def_len + 2;
string256 name_comment;
sprintf_s(name_comment, "// %s\n", name);
xr_sprintf(name_comment, "// %s\n", name);
const char** sources = xr_alloc<const char*>(sources_len);
#ifdef DEBUG
sources[0] = "#version 450\n#pragma optimize (off)\n";
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/game_cl_mp_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ LPCSTR game_cl_mp_script::GetRoundTime()

split_time(dt, year, month, day, hours, mins, secs, milisecs);

sprintf_s(bufTime, "%02i:%02i", mins, secs);
xr_sprintf(bufTime, "%02i:%02i", mins, secs);

return bufTime;
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/xr_Client_BattlEye.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void BattlEyeClient::PrintMessage(char* message)
// if ( g_be_message_out )
{
string512 text;
sprintf_s(text, sizeof(text), "BattlEye Client: %s", message);
xr_sprintf(text, sizeof(text), "BattlEye Client: %s", message);
Msg("%s", text);

if (g_be_message_out) //==2
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/xr_Server_BattlEye.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void BattlEyeServer::PrintMessage(char* message)
// if( g_be_message_out )
{
string512 text;
sprintf_s(text, sizeof(text), "BattlEye Server: %s", message);
xr_sprintf(text, sizeof(text), "BattlEye Server: %s", message);
Msg("%s", text);

if (g_be_message_out) //==2
Expand Down

0 comments on commit 6f881ce

Please sign in to comment.