Core/Misc: Warning fixes

This commit is contained in:
Shauren
2012-08-21 18:20:42 +02:00
parent 7ccd254fdc
commit 7dc26c7ff7
3 changed files with 13 additions and 7 deletions

View File

@@ -141,10 +141,16 @@ extern int main(int argc, char **argv)
// Launch the listening network socket
RealmAcceptor acceptor;
uint16 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
int32 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
if (rmport < 0 || rmport > 0xFFFF)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)");
return 1;
}
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
ACE_INET_Addr bind_addr(rmport, bind_ip.c_str());
ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
@@ -238,14 +244,14 @@ bool StartDB()
return false;
}
uint8 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
int32 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (worker_threads < 1 || worker_threads > 32)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
worker_threads = 1;
}
uint8 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
int32 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
if (synch_threads < 1 || synch_threads > 32)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
@@ -253,7 +259,7 @@ bool StartDB()
}
// NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever.
if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads))
if (!LoginDatabase.Open(dbstring.c_str(), uint8(worker_threads), uint8(synch_threads)))
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot connect to database");
return false;