mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 13:37:02 +00:00
Apply style fix pt3
This commit is contained in:
parent
1392c131e7
commit
d93dbd95fe
191 changed files with 9851 additions and 676 deletions
|
|
@ -115,7 +115,9 @@ bool Config::GetBoolDefault(const char* name, bool def)
|
|||
strcmp(str, "1") == 0)
|
||||
{ return true; }
|
||||
else
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int32 Config::GetIntDefault(const char* name, int32 def)
|
||||
|
|
|
|||
|
|
@ -303,7 +303,9 @@ char* DB2FileLoader::AutoProduceData(const char* format, uint32& records, char**
|
|||
indexTable[getRecord(y).getUInt(i)] = &dataTable[offset];
|
||||
}
|
||||
else
|
||||
{ indexTable[y] = &dataTable[offset]; }
|
||||
{
|
||||
indexTable[y] = &dataTable[offset];
|
||||
}
|
||||
|
||||
for (uint32 x = 0; x < fieldCount; ++x)
|
||||
{
|
||||
|
|
@ -409,7 +411,9 @@ char* DB2FileLoader::AutoProduceStringsArrayHolders(const char* format, char* da
|
|||
char* DB2FileLoader::AutoProduceStrings(const char* format, char* dataTable, LocaleConstant loc)
|
||||
{
|
||||
if(strlen(format)!=fieldCount)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// each string field at load have array of string for each locale
|
||||
size_t stringHolderSize = sizeof(char*) * MAX_LOCALE;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,9 @@ bool DBCFileLoader::Load(const char* filename, const char* fmt)
|
|||
fieldsOffset[i] += 1;
|
||||
}
|
||||
else // 4 byte fields (int32/float/strings)
|
||||
{ fieldsOffset[i] += 4; }
|
||||
{
|
||||
fieldsOffset[i] += 4;
|
||||
}
|
||||
}
|
||||
|
||||
data = new unsigned char[recordSize * recordCount + stringSize];
|
||||
|
|
@ -243,7 +245,9 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
|
|||
indexTable[getRecord(y).getUInt(i)] = &dataTable[offset];
|
||||
}
|
||||
else
|
||||
{ indexTable[y] = &dataTable[offset]; }
|
||||
{
|
||||
indexTable[y] = &dataTable[offset];
|
||||
}
|
||||
|
||||
for (uint32 x = 0; x < fieldCount; ++x)
|
||||
{
|
||||
|
|
@ -288,7 +292,9 @@ static char const* const nullStr = "";
|
|||
char* DBCFileLoader::AutoProduceStringsArrayHolders(const char* format, char* dataTable)
|
||||
{
|
||||
if(strlen(format)!=fieldCount)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// we store flat holders pool as single memory block
|
||||
size_t stringFields = GetFormatStringsFields(format);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,9 @@ class DBCStorage
|
|||
{
|
||||
typename std::map<uint32, T const*>::const_iterator it = data.find(id);
|
||||
if (it != data.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
return (id >= nCount) ? NULL : indexTable[id];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,9 @@ SqlPreparedStatement* SqlConnection::GetStmt(uint32 nIndex)
|
|||
m_holder[nIndex] = pStmt;
|
||||
}
|
||||
else
|
||||
{ pStmt = m_holder[nIndex]; }
|
||||
{
|
||||
pStmt = m_holder[nIndex];
|
||||
}
|
||||
|
||||
return pStmt;
|
||||
}
|
||||
|
|
@ -146,9 +148,13 @@ bool Database::Initialize(const char* infoString, int nConns /*= 1*/)
|
|||
m_nQueryConnPoolSize = MIN_CONNECTION_POOL_SIZE;
|
||||
}
|
||||
else if (nConns > MAX_CONNECTION_POOL_SIZE)
|
||||
{ m_nQueryConnPoolSize = MAX_CONNECTION_POOL_SIZE; }
|
||||
{
|
||||
m_nQueryConnPoolSize = MAX_CONNECTION_POOL_SIZE;
|
||||
}
|
||||
else
|
||||
{ m_nQueryConnPoolSize = nConns; }
|
||||
{
|
||||
m_nQueryConnPoolSize = nConns;
|
||||
}
|
||||
|
||||
// create connection pool for sync requests
|
||||
for (int i = 0; i < m_nQueryConnPoolSize; ++i)
|
||||
|
|
@ -263,7 +269,9 @@ SqlConnection* Database::getQueryConnection()
|
|||
m_nQueryCounter = 0;
|
||||
}
|
||||
else
|
||||
{ nCount = ++m_nQueryCounter; }
|
||||
{
|
||||
nCount = ++m_nQueryCounter;
|
||||
}
|
||||
|
||||
return m_pQueryConnections[nCount % m_nQueryConnPoolSize];
|
||||
}
|
||||
|
|
@ -658,7 +666,9 @@ SqlStatement Database::CreateStatement(SqlStatementID& index, const char* fmt)
|
|||
m_stmtRegistry[szFmt] = nId;
|
||||
}
|
||||
else
|
||||
{ nId = iter->second; }
|
||||
{
|
||||
nId = iter->second;
|
||||
}
|
||||
|
||||
// save initialized statement index info
|
||||
index.init(nId, nParams);
|
||||
|
|
|
|||
|
|
@ -184,7 +184,9 @@ bool MySQLConnection::Initialize(const char* infoString)
|
|||
DETAIL_LOG("AUTOCOMMIT SUCCESSFULLY SET TO 1");
|
||||
}
|
||||
else
|
||||
{ DETAIL_LOG("AUTOCOMMIT NOT SET TO 1"); }
|
||||
{
|
||||
DETAIL_LOG("AUTOCOMMIT NOT SET TO 1");
|
||||
}
|
||||
/*-------------------------------------*/
|
||||
|
||||
// set connection properties to UTF8 to properly handle locales for different
|
||||
|
|
|
|||
|
|
@ -97,7 +97,9 @@ bool PostgreSQLConnection::Initialize(const char* infoString)
|
|||
mPGconn = PQsetdbLogin(NULL, port_or_socket_dir == "." ? NULL : port_or_socket_dir.c_str(), NULL, NULL, database.c_str(), user.c_str(), password.c_str());
|
||||
}
|
||||
else
|
||||
{ mPGconn = PQsetdbLogin(host.c_str(), port_or_socket_dir.c_str(), NULL, NULL, database.c_str(), user.c_str(), password.c_str()); }
|
||||
{
|
||||
mPGconn = PQsetdbLogin(host.c_str(), port_or_socket_dir.c_str(), NULL, NULL, database.c_str(), user.c_str(), password.c_str());
|
||||
}
|
||||
|
||||
/* check to see that the backend connection was successfully made */
|
||||
if (PQstatus(mPGconn) != CONNECTION_OK)
|
||||
|
|
|
|||
|
|
@ -270,7 +270,9 @@ void SQLStorageLoaderBase<DerivedLoader, StorageClass>::Load(StorageClass& store
|
|||
sLog.outError("%s table is empty!\n", store.GetTableName());
|
||||
}
|
||||
else
|
||||
{ sLog.outString("%s table is empty!\n", store.GetTableName()); }
|
||||
{
|
||||
sLog.outString("%s table is empty!\n", store.GetTableName());
|
||||
}
|
||||
|
||||
recordCount = 0;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -188,7 +188,9 @@ QueryResult* SqlQueryHolder::GetResult(size_t index)
|
|||
return m_queries[index].second;
|
||||
}
|
||||
else
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void SqlQueryHolder::SetResult(size_t index, QueryResult* result)
|
||||
|
|
|
|||
|
|
@ -205,7 +205,9 @@ void Log::SetLogLevel(char* level)
|
|||
newLevel = LOG_LVL_MINIMAL;
|
||||
}
|
||||
else if (newLevel > LOG_LVL_DEBUG)
|
||||
{ newLevel = LOG_LVL_DEBUG; }
|
||||
{
|
||||
newLevel = LOG_LVL_DEBUG;
|
||||
}
|
||||
|
||||
m_logLevel = LogLevel(newLevel);
|
||||
|
||||
|
|
@ -221,7 +223,9 @@ void Log::SetLogFileLevel(char* level)
|
|||
newLevel = LOG_LVL_MINIMAL;
|
||||
}
|
||||
else if (newLevel > LOG_LVL_DEBUG)
|
||||
{ newLevel = LOG_LVL_DEBUG; }
|
||||
{
|
||||
newLevel = LOG_LVL_DEBUG;
|
||||
}
|
||||
|
||||
m_logFileLevel = LogLevel(newLevel);
|
||||
|
||||
|
|
@ -326,7 +330,9 @@ FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFl
|
|||
logfn.insert(dot_pos, m_logsTimestamp);
|
||||
}
|
||||
else
|
||||
{ logfn += m_logsTimestamp; }
|
||||
{
|
||||
logfn += m_logsTimestamp;
|
||||
}
|
||||
}
|
||||
|
||||
return fopen((m_logsDir + logfn).c_str(), mode);
|
||||
|
|
@ -610,7 +616,9 @@ void Log::outErrorEluna() {}
|
|||
void Log::outErrorEluna(const char* err, ...)
|
||||
{
|
||||
if (!err)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_colored)
|
||||
SetColor(false, m_colors[LogError]);
|
||||
|
|
@ -1060,7 +1068,9 @@ void Log::outErrorScriptLib()
|
|||
fprintf(logfile, "<%s ERROR:> ", m_scriptLibName);
|
||||
}
|
||||
else
|
||||
{ fprintf(logfile, "<Scripting Library ERROR>: "); }
|
||||
{
|
||||
fprintf(logfile, "<Scripting Library ERROR>: ");
|
||||
}
|
||||
fflush(logfile);
|
||||
}
|
||||
|
||||
|
|
@ -1112,7 +1122,9 @@ void Log::outErrorScriptLib(const char* err, ...)
|
|||
fprintf(logfile, "<%s ERROR>: ", m_scriptLibName);
|
||||
}
|
||||
else
|
||||
{ fprintf(logfile, "<Scripting Library ERROR>: "); }
|
||||
{
|
||||
fprintf(logfile, "<Scripting Library ERROR>: ");
|
||||
}
|
||||
|
||||
va_start(ap, err);
|
||||
vfprintf(logfile, err, ap);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ DelayExecutor::~DelayExecutor()
|
|||
int DelayExecutor::deactivate()
|
||||
{
|
||||
if (!activated())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
activated(false);
|
||||
queue_.queue()->deactivate();
|
||||
|
|
@ -86,10 +88,14 @@ int DelayExecutor::svc()
|
|||
int DelayExecutor::activate(int num_threads, ACE_Method_Request* pre_svc_hook, ACE_Method_Request* post_svc_hook)
|
||||
{
|
||||
if (activated())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (num_threads < 1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pre_svc_hook_)
|
||||
delete pre_svc_hook_;
|
||||
|
|
@ -103,7 +109,9 @@ int DelayExecutor::activate(int num_threads, ACE_Method_Request* pre_svc_hook, A
|
|||
queue_.queue()->activate();
|
||||
|
||||
if (ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, num_threads) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
activated(true);
|
||||
|
||||
|
|
@ -113,7 +121,9 @@ int DelayExecutor::activate(int num_threads, ACE_Method_Request* pre_svc_hook, A
|
|||
int DelayExecutor::execute(ACE_Method_Request* new_req)
|
||||
{
|
||||
if (new_req == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (queue_.enqueue(new_req, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -199,7 +199,9 @@ class ByteBuffer
|
|||
void FlushBits()
|
||||
{
|
||||
if (_bitpos == 8)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
append((uint8 *)&_curbitval, sizeof(uint8));
|
||||
_curbitval = 0;
|
||||
|
|
@ -983,7 +985,9 @@ class ByteBuffer
|
|||
ByteBuffer& append(const uint8* src, size_t cnt)
|
||||
{
|
||||
if (!cnt)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
MANGOS_ASSERT(size() < 10000000);
|
||||
|
||||
|
|
@ -1005,7 +1009,9 @@ class ByteBuffer
|
|||
ByteBuffer& append(const ByteBuffer& buffer)
|
||||
{
|
||||
if (buffer.wpos())
|
||||
{
|
||||
return append(buffer.contents(), buffer.wpos());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,9 @@ void stripLineInvisibleChars(std::string& str)
|
|||
str[wpos++] = str[pos];
|
||||
}
|
||||
else
|
||||
{ ++wpos; }
|
||||
{
|
||||
++wpos;
|
||||
}
|
||||
space = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -351,7 +353,9 @@ bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_
|
|||
{
|
||||
uint32 mask = subnetMask.get_ip_address();
|
||||
if ((net.get_ip_address() & mask) == (addr.get_ip_address() & mask))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -416,7 +420,9 @@ bool Utf8ToUpperOnlyLatin(std::string& utf8String)
|
|||
{
|
||||
std::wstring wstr;
|
||||
if (!Utf8toWStr(utf8String, wstr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::transform(wstr.begin(), wstr.end(), wstr.begin(), wcharToUpperOnlyLatin);
|
||||
|
||||
|
|
@ -655,7 +661,9 @@ void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result)
|
|||
encodedNibble = '0' + nibble;
|
||||
}
|
||||
else
|
||||
{ encodedNibble = 'A' + nibble - 0x0A; }
|
||||
{
|
||||
encodedNibble = 'A' + nibble - 0x0A;
|
||||
}
|
||||
ss << encodedNibble;
|
||||
}
|
||||
}
|
||||
|
|
@ -690,7 +698,9 @@ void HexStrToByteArray(std::string const& str, uint8* out, bool reverse /*= fals
|
|||
{
|
||||
// string must have even number of characters
|
||||
if (str.length() & 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int32 init = 0;
|
||||
int32 end = str.length();
|
||||
|
|
|
|||
|
|
@ -119,7 +119,9 @@ LONG WINAPI WheatyExceptionReport::WheatyUnhandledExceptionFilter(
|
|||
return m_previousFilter(pExceptionInfo);
|
||||
}
|
||||
else
|
||||
{ return EXCEPTION_EXECUTE_HANDLER/*EXCEPTION_CONTINUE_SEARCH*/; }
|
||||
{
|
||||
return EXCEPTION_EXECUTE_HANDLER/*EXCEPTION_CONTINUE_SEARCH*/;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxcount)
|
||||
|
|
@ -186,7 +188,9 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax)
|
|||
_tcsncat(szVersion, _T("Windows 8 "), cntMax);
|
||||
}
|
||||
else
|
||||
{ _tcsncat(szVersion, _T("Windows Server 2012 "), cntMax); }
|
||||
{
|
||||
_tcsncat(szVersion, _T("Windows Server 2012 "), cntMax);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
|
|
@ -194,7 +198,9 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax)
|
|||
_tcsncat(szVersion, _T("Windows 7 "), cntMax);
|
||||
}
|
||||
else
|
||||
{ _tcsncat(szVersion, _T("Windows Server 2008 R2 "), cntMax); }
|
||||
{
|
||||
_tcsncat(szVersion, _T("Windows Server 2008 R2 "), cntMax);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if (osvi.wProductType == VER_NT_WORKSTATION)
|
||||
|
|
@ -202,7 +208,9 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax)
|
|||
_tcsncat(szVersion, _T("Windows Vista "), cntMax);
|
||||
}
|
||||
else
|
||||
{ _tcsncat(szVersion, _T("Windows Server 2008 "), cntMax); }
|
||||
{
|
||||
_tcsncat(szVersion, _T("Windows Server 2008 "), cntMax);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
@ -260,7 +268,9 @@ void WheatyExceptionReport::PrintSystemInfo()
|
|||
_tprintf(_T("\r\n*** Operation System ***\r\n%s\r\n"), sString);
|
||||
}
|
||||
else
|
||||
{ _tprintf(_T("\r\n*** Operation System:\r\n<unknown>\r\n")); }
|
||||
{
|
||||
_tprintf(_T("\r\n*** Operation System:\r\n<unknown>\r\n"));
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
@ -701,7 +711,9 @@ bool WheatyExceptionReport::FormatSymbolValue(
|
|||
pszCurrBuffer += sprintf(pszCurrBuffer, "Parameter ");
|
||||
}
|
||||
else if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_LOCAL)
|
||||
{ pszCurrBuffer += sprintf(pszCurrBuffer, "Local "); }
|
||||
{
|
||||
pszCurrBuffer += sprintf(pszCurrBuffer, "Local ");
|
||||
}
|
||||
|
||||
// If it's a function, don't do anything.
|
||||
if (pSym->Tag == 5) // SymTagFunction from CVCONST.H from the DIA SDK
|
||||
|
|
@ -879,7 +891,9 @@ char* WheatyExceptionReport::FormatOutputValue(char* pszCurrBuffer,
|
|||
pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PBYTE)pAddress);
|
||||
}
|
||||
else if (length == 2)
|
||||
{ pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PWORD)pAddress); }
|
||||
{
|
||||
pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PWORD)pAddress);
|
||||
}
|
||||
else if (length == 4)
|
||||
{
|
||||
if (basicType == btFloat)
|
||||
|
|
@ -898,7 +912,9 @@ char* WheatyExceptionReport::FormatOutputValue(char* pszCurrBuffer,
|
|||
*(PDWORD)pAddress);
|
||||
}
|
||||
else
|
||||
{ pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PDWORD)pAddress); }
|
||||
{
|
||||
pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PDWORD)pAddress);
|
||||
}
|
||||
}
|
||||
else if (length == 8)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue