Replaced atoi() with StringToInteger().
This commit is contained in:
parent
f243aa387c
commit
6ec5e8caa7
@ -205,8 +205,7 @@ void cBiomeGenList::InitializeBiomes(const AString & a_Biomes)
|
|||||||
int Count = 1;
|
int Count = 1;
|
||||||
if (Split2.size() >= 2)
|
if (Split2.size() >= 2)
|
||||||
{
|
{
|
||||||
Count = atol(Split2[1].c_str());
|
if (!StringToInteger(Split2[1], Count))
|
||||||
if (Count <= 0)
|
|
||||||
{
|
{
|
||||||
LOGWARNING("Cannot decode biome count: \"%s\"; using 1.", Split2[1].c_str());
|
LOGWARNING("Cannot decode biome count: \"%s\"; using 1.", Split2[1].c_str());
|
||||||
Count = 1;
|
Count = 1;
|
||||||
|
@ -55,7 +55,10 @@ void cHTTPMessage::AddHeader(const AString & a_Key, const AString & a_Value)
|
|||||||
}
|
}
|
||||||
else if (Key == "content-length")
|
else if (Key == "content-length")
|
||||||
{
|
{
|
||||||
m_ContentLength = static_cast<size_t>(atol(m_Headers[Key].c_str()));
|
if (!StringToInteger(m_Headers[Key], m_ContentLength))
|
||||||
|
{
|
||||||
|
m_ContentLength = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,8 +225,8 @@ bool cHTTPServer::Start(cCallbacks & a_Callbacks, const AStringVector & a_Ports)
|
|||||||
// Open up requested ports:
|
// Open up requested ports:
|
||||||
for (auto port : a_Ports)
|
for (auto port : a_Ports)
|
||||||
{
|
{
|
||||||
UInt16 PortNum = static_cast<UInt16>(atoi(port.c_str()));
|
UInt16 PortNum;
|
||||||
if (PortNum == 0)
|
if (!StringToInteger(port, PortNum))
|
||||||
{
|
{
|
||||||
LOGWARNING("WebServer: Invalid port value: \"%s\". Ignoring.", port.c_str());
|
LOGWARNING("WebServer: Invalid port value: \"%s\". Ignoring.", port.c_str());
|
||||||
continue;
|
continue;
|
||||||
|
@ -155,8 +155,8 @@ void cRCONServer::Initialize(cIniFile & a_IniFile)
|
|||||||
// Start listening on each specified port:
|
// Start listening on each specified port:
|
||||||
for (auto port: Ports)
|
for (auto port: Ports)
|
||||||
{
|
{
|
||||||
UInt16 PortNum = static_cast<UInt16>(atol(port.c_str()));
|
UInt16 PortNum;
|
||||||
if (PortNum == 0)
|
if (!StringToInteger(port, PortNum))
|
||||||
{
|
{
|
||||||
LOGINFO("Invalid RCON port value: \"%s\". Ignoring.", port.c_str());
|
LOGINFO("Invalid RCON port value: \"%s\". Ignoring.", port.c_str());
|
||||||
continue;
|
continue;
|
||||||
|
@ -393,8 +393,8 @@ bool cServer::Start(void)
|
|||||||
{
|
{
|
||||||
for (auto port: m_Ports)
|
for (auto port: m_Ports)
|
||||||
{
|
{
|
||||||
UInt16 PortNum = static_cast<UInt16>(atoi(port.c_str()));
|
UInt16 PortNum;
|
||||||
if (PortNum == 0)
|
if (!StringToInteger(port, PortNum))
|
||||||
{
|
{
|
||||||
LOGWARNING("Invalid port specified for server: \"%s\". Ignoring.", port.c_str());
|
LOGWARNING("Invalid port specified for server: \"%s\". Ignoring.", port.c_str());
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user