Merge pull request #181 from diamante0018/develop

Use sizeof operator more often
This commit is contained in:
Maurice Heumann 2021-05-13 09:15:46 +02:00 committed by GitHub
commit 74adf64039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -63,7 +63,7 @@ namespace game_console
void clear()
{
strncpy_s(con.buffer, "", 256);
strncpy_s(con.buffer, "", sizeof(con.buffer));
con.cursor = 0;
fixed_input = "";
@ -550,7 +550,7 @@ namespace game_console
if (history_index != -1)
{
strncpy_s(con.buffer, history.at(history_index).c_str(), 0x100);
strncpy_s(con.buffer, history.at(history_index).c_str(), sizeof(con.buffer));
con.cursor = static_cast<int>(strlen(con.buffer));
}
}
@ -565,7 +565,7 @@ namespace game_console
if (history_index != -1)
{
strncpy_s(con.buffer, history.at(history_index).c_str(), 0x100);
strncpy_s(con.buffer, history.at(history_index).c_str(), sizeof(con.buffer));
con.cursor = static_cast<int>(strlen(con.buffer));
}
}
@ -720,7 +720,7 @@ namespace game_console
con.output_visible = false;
con.display_line_offset = 0;
con.line_count = 0;
strncpy_s(con.buffer, "", 256);
strncpy_s(con.buffer, "", sizeof(con.buffer));
con.globals.x = 0.0f;
con.globals.y = 0.0f;

View File

@ -153,7 +153,7 @@ namespace party
if (game::mp::g_entities[i].client)
{
char client_name[16] = {0};
strncpy_s(client_name, game::mp::g_entities[i].client->name, 16);
strncpy_s(client_name, game::mp::g_entities[i].client->name, sizeof(client_name));
game::I_CleanStr(client_name);
if (client_name == name)

View File

@ -77,7 +77,7 @@ namespace rcon
const auto client = &game::mp::svs_clients[i];
char clean_name[32] = { 0 };
strncpy_s(clean_name, client->name, 32);
strncpy_s(clean_name, client->name, sizeof(clean_name));
game::I_CleanStr(clean_name);
if (client->header.state >= 1)

View File

@ -18,7 +18,7 @@ namespace videos
if (vid != video_replaces.end())
{
char path[256];
game::Sys_BuildAbsPath(path, 256, game::SF_VIDEO, vid->second.data(), ".bik");
game::Sys_BuildAbsPath(path, sizeof(path), game::SF_VIDEO, vid->second.data(), ".bik");
if (game::Sys_FileExists(path))
{