Jump to content

Remarks???


Guest AandD

Recommended Posts

Hello, browsing the code dubugcmds.cpp i found something strange:

bool ChatHandler::HandleSendQuestPartyMsgCommand(const char* args)

{

uint32 msg = atol((char*)args);

if (msg >= 0)

m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);

return true;

}

bool ChatHandler::HandleSendQuestInvalidMsgCommand(const char* args)

{

uint32 msg = atol((char*)args);

if (msg >= 0)

m_session->GetPlayer()->SendCanTakeQuestResponse(msg);

return true;

}

As you know, uint can take only not negative values, so check if it positive is meanless :huh:

Or i missing something.

same in SocketHandler.cpp

void SocketHandler::Get(SOCKET s,bool& r,bool& w,bool& e)

{

if (s >= 0)

{

r = FD_ISSET(s, &m_rfds) ? true : false;

w = FD_ISSET(s, &m_wfds) ? true : false;

e = FD_ISSET(s, &m_efds) ? true : false;

}

}

void SocketHandler::Set(SOCKET s,bool bRead,bool bWrite,bool bException)

{

DEB( fprintf(stderr, "Set(%d, %s, %s, %s)\\n", s, bRead ? "true" : "false", bWrite ? "true" : "false", bException ? "true" : "false");)

if (s >= 0)

{

if (bRead)

{

if (!FD_ISSET(s, &m_rfds))

{

FD_SET(s, &m_rfds);

}

}

else

{

FD_CLR(s, &m_rfds);

}

if (bWrite)

{

if (!FD_ISSET(s, &m_wfds))

{

FD_SET(s, &m_wfds);

}

}

else

{

FD_CLR(s, &m_wfds);

}

if (bException)

{

if (!FD_ISSET(s, &m_efds))

{

FD_SET(s, &m_efds);

}

}

else

{

FD_CLR(s, &m_efds);

}

}

}

SOCKET s is uint, meanless to check again if (s>=0).

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use