Use compare method instead of strcmp on std::string

This commit is contained in:
Kawe Mazidjatari 2022-08-09 14:01:29 +02:00
parent e97b4e53b2
commit 0b4eb06dd2
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ bool s_bBasePaksInitialized = false;
//-----------------------------------------------------------------------------
bool MOD_LevelHasChanged(const string& svLevelName)
{
return (strcmp(svLevelName.c_str(), g_svLevelName.c_str()) != 0);
return (g_svLevelName.compare(svLevelName) != 0);
}
//-----------------------------------------------------------------------------

View File

@ -93,11 +93,11 @@ void CNetAdr2::SetIPAndPort(string svInAdr)
void CNetAdr2::SetIPAndPort(string svInAdr, string svInPort)
{
SetType(netadrtype_t::NA_IP);
if (strcmp(svInAdr.c_str(), "loopback") == 0 || strcmp(svInAdr.c_str(), "::1") == 0)
if (svInAdr.compare("loopback") == 0 || svInAdr.compare("::1") == 0)
{
SetType(netadrtype_t::NA_LOOPBACK);
}
else if (strcmp(svInAdr.c_str(), "localhost") == 0)
else if (svInAdr.compare("localhost") == 0)
{
svInAdr = "127.0.0.1";
}