Fix any_of

This commit is contained in:
Dennis Felsing 2022-01-23 18:56:37 +01:00
parent ddc279c80f
commit 4da76e0e7d
4 changed files with 6 additions and 15 deletions

View file

@ -32,6 +32,7 @@ Checks: >
-clang-analyzer-optin.cplusplus.VirtualCall,
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-analyzer-security.insecureAPI.rand,
misc-*,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
@ -40,6 +41,8 @@ Checks: >
modernize-loop-convert,
readability-*,
-readability-braces-around-statements,
-readability-convert-member-functions-to-static,
-readability-else-after-return,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,

View file

@ -24,7 +24,7 @@ static const char *VANILLA_SKINS[] = {"bluekitty", "bluestripe", "brownbear",
static bool IsVanillaSkin(const char *pName)
{
return std::all_of(std::begin(VANILLA_SKINS), std::end(VANILLA_SKINS), [pName](const char *pVanillaSkin) { return str_comp(pName, pVanillaSkin) == 0; });
return std::any_of(std::begin(VANILLA_SKINS), std::end(VANILLA_SKINS), [pName](const char *pVanillaSkin) { return str_comp(pName, pVanillaSkin) == 0; });
}
int CSkins::CGetPngFile::OnCompletion(int State)

View file

@ -69,14 +69,7 @@ static const char *VANILLA_IMAGES[] = {
static bool IsVanillaImage(const char *pImage)
{
for(const auto *pVanillaImage : VANILLA_IMAGES)
{
if(str_comp(pImage, pVanillaImage) == 0)
{
return true;
}
}
return false;
return std::any_of(std::begin(VANILLA_IMAGES), std::end(VANILLA_IMAGES), [pImage](const char *pVanillaImage) { return str_comp(pImage, pVanillaImage) == 0; });
}
const void *CEditor::ms_pUiGotContext;

View file

@ -4102,12 +4102,7 @@ int CGameContext::GetClientVersion(int ClientID) const
bool CGameContext::PlayerModerating() const
{
for(const auto &pPlayer : m_apPlayers)
{
if(pPlayer && pPlayer->m_Moderating)
return true;
}
return false;
return std::any_of(std::begin(m_apPlayers), std::end(m_apPlayers), [](const CPlayer *pPlayer) { return pPlayer && pPlayer->m_Moderating; });
}
void CGameContext::ForceVote(int EnforcerID, bool Success)