Skip to content

Commit b8c21b7

Browse files
Frozen-H2OVauff
authored andcommitted
Minor cleanup
1 parent 103a92b commit b8c21b7

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/adminsystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ void CAdmin::SetImmunity(std::uint32_t iAdminImmunity)
12571257
if (!zpAdmin) // Authentication is checked in GetPlayerFromSteamId, so dont need to redo it here
12581258
return;
12591259

1260-
zpAdmin->SetAdminImmunity(static_cast<int>(iAdminImmunity)); // should be safe to cast, as range for std::uint32_t is [0, INT_MAX]
1260+
zpAdmin->SetAdminImmunity(static_cast<int>(iAdminImmunity)); // should be safe to cast due to earlier check
12611261
}
12621262

12631263
CAdminSystem::CAdminSystem()

src/utils/hud_manager.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ void StartFlashingFixTimer()
150150
std::string EscapeHTMLSpecialCharacters(std::string strMsg)
151151
{
152152
// Always replace & first, as it is used in html escaped characters (so dont want to replace inside an escape)
153-
for (size_t pos = 0; (pos = strMsg.find('&', pos)) != std::string::npos; pos += 5)
154-
strMsg.replace(pos, 1, "&amp;");
153+
for (size_t iPos = 0; (iPos = strMsg.find('&', iPos)) != std::string::npos; iPos += 5)
154+
strMsg.replace(iPos, 1, "&amp;");
155155

156156
std::unordered_map<std::string, std::string> mapReplacements{
157157
{"<", "&lt;"},
@@ -160,9 +160,9 @@ std::string EscapeHTMLSpecialCharacters(std::string strMsg)
160160
{"\'", "&apos;"}
161161
};
162162

163-
for (const auto& [badChar, escapedChar] : mapReplacements)
164-
for (size_t pos = 0; (pos = strMsg.find(badChar, pos)) != std::string::npos; pos += escapedChar.length())
165-
strMsg.replace(pos, 1, escapedChar);
163+
for (const auto& [strBadChar, strEscapedChar] : mapReplacements)
164+
for (size_t iPos = 0; (iPos = strMsg.find(strBadChar, iPos)) != std::string::npos; iPos += strEscapedChar.length())
165+
strMsg.replace(iPos, strBadChar.length(), strEscapedChar);
166166

167167
return strMsg;
168168
}

0 commit comments

Comments
 (0)