Merge pull request #7507 from dobrykafe/pr-replace-sizeof

replace `sizeof x` with `sizeof(x)`
This commit is contained in:
Dennis Felsing 2023-11-19 21:56:15 +00:00 committed by GitHub
commit 472c9f070b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 23 deletions

View file

@ -200,9 +200,9 @@ bool CUpdater::ReplaceClient()
str_format(aPath, sizeof(aPath), "update/%s", m_aClientExecTmp);
Success &= m_pStorage->RenameBinaryFile(aPath, PLAT_CLIENT_EXEC);
#if !defined(CONF_FAMILY_WINDOWS)
m_pStorage->GetBinaryPath(PLAT_CLIENT_EXEC, aPath, sizeof aPath);
m_pStorage->GetBinaryPath(PLAT_CLIENT_EXEC, aPath, sizeof(aPath));
char aBuf[512];
str_format(aBuf, sizeof aBuf, "chmod +x %s", aPath);
str_format(aBuf, sizeof(aBuf), "chmod +x %s", aPath);
if(system(aBuf))
{
dbg_msg("updater", "ERROR: failed to set client executable bit");
@ -224,9 +224,9 @@ bool CUpdater::ReplaceServer()
str_format(aPath, sizeof(aPath), "update/%s", m_aServerExecTmp);
Success &= m_pStorage->RenameBinaryFile(aPath, PLAT_SERVER_EXEC);
#if !defined(CONF_FAMILY_WINDOWS)
m_pStorage->GetBinaryPath(PLAT_SERVER_EXEC, aPath, sizeof aPath);
m_pStorage->GetBinaryPath(PLAT_SERVER_EXEC, aPath, sizeof(aPath));
char aBuf[512];
str_format(aBuf, sizeof aBuf, "chmod +x %s", aPath);
str_format(aBuf, sizeof(aBuf), "chmod +x %s", aPath);
if(system(aBuf))
{
dbg_msg("updater", "ERROR: failed to set server executable bit");
@ -241,7 +241,7 @@ void CUpdater::ParseUpdate()
char aPath[IO_MAX_PATH_LENGTH];
void *pBuf;
unsigned Length;
if(!m_pStorage->ReadFile(m_pStorage->GetBinaryPath("update/update.json", aPath, sizeof aPath), IStorage::TYPE_ABSOLUTE, &pBuf, &Length))
if(!m_pStorage->ReadFile(m_pStorage->GetBinaryPath("update/update.json", aPath, sizeof(aPath)), IStorage::TYPE_ABSOLUTE, &pBuf, &Length))
return;
json_value *pVersions = json_parse((json_char *)pBuf, Length);

View file

@ -1004,10 +1004,10 @@ void CGameContext::ConInviteTeam(IConsole::IResult *pResult, void *pUserData)
pSelf->m_apPlayers[pResult->m_ClientID]->m_LastInvited = pSelf->Server()->Tick();
char aBuf[512];
str_format(aBuf, sizeof aBuf, "'%s' invited you to team %d.", pSelf->Server()->ClientName(pResult->m_ClientID), Team);
str_format(aBuf, sizeof(aBuf), "'%s' invited you to team %d.", pSelf->Server()->ClientName(pResult->m_ClientID), Team);
pSelf->SendChatTarget(Target, aBuf);
str_format(aBuf, sizeof aBuf, "'%s' invited '%s' to your team.", pSelf->Server()->ClientName(pResult->m_ClientID), pSelf->Server()->ClientName(Target));
str_format(aBuf, sizeof(aBuf), "'%s' invited '%s' to your team.", pSelf->Server()->ClientName(pResult->m_ClientID), pSelf->Server()->ClientName(Target));
pSelf->SendChatTeam(Team, aBuf);
}
else

View file

@ -480,10 +480,10 @@ void CGameContext::VoteMute(const NETADDR *pAddr, int Secs, const char *pReason,
char aBuf[128];
if(pReason[0])
str_format(aBuf, sizeof aBuf, "'%s' banned '%s' for %d seconds from voting (%s)",
str_format(aBuf, sizeof(aBuf), "'%s' banned '%s' for %d seconds from voting (%s)",
Server()->ClientName(AuthedID), pDisplayName, Secs, pReason);
else
str_format(aBuf, sizeof aBuf, "'%s' banned '%s' for %d seconds from voting",
str_format(aBuf, sizeof(aBuf), "'%s' banned '%s' for %d seconds from voting",
Server()->ClientName(AuthedID), pDisplayName, Secs);
SendChat(-1, CHAT_ALL, aBuf);
}
@ -499,7 +499,7 @@ bool CGameContext::VoteUnmute(const NETADDR *pAddr, const char *pDisplayName, in
if(pDisplayName)
{
char aBuf[128];
str_format(aBuf, sizeof aBuf, "'%s' unbanned '%s' from voting.",
str_format(aBuf, sizeof(aBuf), "'%s' unbanned '%s' from voting.",
Server()->ClientName(AuthedID), pDisplayName);
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "voteunmute", aBuf);
}
@ -555,9 +555,9 @@ void CGameContext::Mute(const NETADDR *pAddr, int Secs, const char *pDisplayName
char aBuf[128];
if(pReason[0])
str_format(aBuf, sizeof aBuf, "'%s' has been muted for %d seconds (%s)", pDisplayName, Secs, pReason);
str_format(aBuf, sizeof(aBuf), "'%s' has been muted for %d seconds (%s)", pDisplayName, Secs, pReason);
else
str_format(aBuf, sizeof aBuf, "'%s' has been muted for %d seconds", pDisplayName, Secs);
str_format(aBuf, sizeof(aBuf), "'%s' has been muted for %d seconds", pDisplayName, Secs);
SendChat(-1, CHAT_ALL, aBuf);
}
@ -598,7 +598,7 @@ void CGameContext::ConVoteUnmute(IConsole::IResult *pResult, void *pUserData)
if(Found)
{
char aBuf[128];
str_format(aBuf, sizeof aBuf, "'%s' unbanned '%s' from voting.",
str_format(aBuf, sizeof(aBuf), "'%s' unbanned '%s' from voting.",
pSelf->Server()->ClientName(pResult->m_ClientID), pSelf->Server()->ClientName(Victim));
pSelf->SendChat(-1, 0, aBuf);
}
@ -624,7 +624,7 @@ void CGameContext::ConVoteMutes(IConsole::IResult *pResult, void *pUserData)
for(int i = 0; i < pSelf->m_NumVoteMutes; i++)
{
net_addr_str(&pSelf->m_aVoteMutes[i].m_Addr, aIpBuf, sizeof(aIpBuf), false);
str_format(aBuf, sizeof aBuf, "%d: \"%s\", %d seconds left (%s)", i,
str_format(aBuf, sizeof(aBuf), "%d: \"%s\", %d seconds left (%s)", i,
aIpBuf, (pSelf->m_aVoteMutes[i].m_Expire - pSelf->Server()->Tick()) / pSelf->Server()->TickSpeed(), pSelf->m_aVoteMutes[i].m_aReason);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "votemutes", aBuf);
}
@ -742,7 +742,7 @@ void CGameContext::ConMutes(IConsole::IResult *pResult, void *pUserData)
for(int i = 0; i < pSelf->m_NumMutes; i++)
{
net_addr_str(&pSelf->m_aMutes[i].m_Addr, aIpBuf, sizeof(aIpBuf), false);
str_format(aBuf, sizeof aBuf, "%d: \"%s\", %d seconds left (%s)", i, aIpBuf,
str_format(aBuf, sizeof(aBuf), "%d: \"%s\", %d seconds left (%s)", i, aIpBuf,
(pSelf->m_aMutes[i].m_Expire - pSelf->Server()->Tick()) / pSelf->Server()->TickSpeed(), pSelf->m_aMutes[i].m_aReason);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "mutes", aBuf);
}
@ -816,7 +816,7 @@ void CGameContext::ConFreezeHammer(IConsole::IResult *pResult, void *pUserData)
return;
char aBuf[128];
str_format(aBuf, sizeof aBuf, "'%s' got freeze hammer!",
str_format(aBuf, sizeof(aBuf), "'%s' got freeze hammer!",
pSelf->Server()->ClientName(Victim));
pSelf->SendChat(-1, CHAT_ALL, aBuf);
@ -834,7 +834,7 @@ void CGameContext::ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData
return;
char aBuf[128];
str_format(aBuf, sizeof aBuf, "'%s' lost freeze hammer!",
str_format(aBuf, sizeof(aBuf), "'%s' lost freeze hammer!",
pSelf->Server()->ClientName(Victim));
pSelf->SendChat(-1, CHAT_ALL, aBuf);
@ -912,9 +912,9 @@ void CGameContext::ConDumpLog(IConsole::IResult *pResult, void *pUserData)
char aBuf[256];
if(pEntry->m_FromServer)
str_format(aBuf, sizeof aBuf, "%s, %d seconds ago", pEntry->m_aDescription, Seconds);
str_format(aBuf, sizeof(aBuf), "%s, %d seconds ago", pEntry->m_aDescription, Seconds);
else
str_format(aBuf, sizeof aBuf, "%s, %d seconds ago < addr=<{%s}> name='%s' client=%d",
str_format(aBuf, sizeof(aBuf), "%s, %d seconds ago < addr=<{%s}> name='%s' client=%d",
pEntry->m_aDescription, Seconds, pEntry->m_aClientAddrStr, pEntry->m_aClientName, pEntry->m_ClientVersion);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "log", aBuf);
}

View file

@ -570,7 +570,7 @@ void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, in
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, i);
}
str_format(aBuf, sizeof aBuf, "Chat: %s", aText);
str_format(aBuf, sizeof(aBuf), "Chat: %s", aText);
LogEvent(aBuf, ChatterClientID);
}
else
@ -1558,7 +1558,7 @@ void CGameContext::OnClientEnter(int ClientID)
char aBuf[128];
NETADDR Addr;
Server()->GetClientAddr(ClientID, &Addr);
str_format(aBuf, sizeof aBuf, "This server has an initial chat delay, you will need to wait %d seconds before talking.", g_Config.m_SvChatInitialDelay);
str_format(aBuf, sizeof(aBuf), "This server has an initial chat delay, you will need to wait %d seconds before talking.", g_Config.m_SvChatInitialDelay);
SendChatTarget(ClientID, aBuf);
Mute(&Addr, g_Config.m_SvChatInitialDelay, Server()->ClientName(ClientID), "Initial chat delay", true);
}
@ -4203,9 +4203,9 @@ bool CGameContext::ProcessSpamProtection(int ClientID, bool RespectChatInitialDe
{
char aBuf[128];
if(Muted.m_InitialChatDelay)
str_format(aBuf, sizeof aBuf, "This server has an initial chat delay, you will be able to talk in %d seconds.", Expires);
str_format(aBuf, sizeof(aBuf), "This server has an initial chat delay, you will be able to talk in %d seconds.", Expires);
else
str_format(aBuf, sizeof aBuf, "You are not permitted to talk for the next %d seconds.", Expires);
str_format(aBuf, sizeof(aBuf), "You are not permitted to talk for the next %d seconds.", Expires);
SendChatTarget(ClientID, aBuf);
return true;
}