diff options
| author | Shauren <none@none> | 2010-12-23 23:25:44 +0100 |
|---|---|---|
| committer | Shauren <none@none> | 2010-12-23 23:25:44 +0100 |
| commit | 928443d8993869dfbf3adceabe4ba0b3cfe0edef (patch) | |
| tree | b30f1385e6f2dd8d95357590593aa2988b094593 /src/server/shared | |
| parent | 95daf7998fc3b772fdcd70087c12db80bd5a031a (diff) | |
Core: Removed more operator workarounds for ACE_Singleton (missed previously because of inconsistent naming)
--HG--
branch : trunk
Diffstat (limited to 'src/server/shared')
| -rwxr-xr-x | src/server/shared/Configuration/Config.cpp | 2 | ||||
| -rwxr-xr-x | src/server/shared/Configuration/Config.h | 2 | ||||
| -rwxr-xr-x | src/server/shared/DataStores/DBCStore.h | 10 | ||||
| -rwxr-xr-x | src/server/shared/Database/DatabaseWorkerPool.h | 18 | ||||
| -rwxr-xr-x | src/server/shared/Database/Field.h | 24 | ||||
| -rwxr-xr-x | src/server/shared/Database/MySQLConnection.cpp | 72 | ||||
| -rwxr-xr-x | src/server/shared/Database/PreparedStatement.cpp | 4 | ||||
| -rwxr-xr-x | src/server/shared/Database/QueryHolder.cpp | 8 | ||||
| -rwxr-xr-x | src/server/shared/Database/QueryResult.cpp | 4 | ||||
| -rwxr-xr-x | src/server/shared/Database/SQLStorageImpl.h | 6 | ||||
| -rwxr-xr-x | src/server/shared/Database/Transaction.cpp | 4 | ||||
| -rwxr-xr-x | src/server/shared/Debugging/Errors.h | 6 | ||||
| -rwxr-xr-x | src/server/shared/Logging/Log.cpp | 44 | ||||
| -rwxr-xr-x | src/server/shared/Logging/Log.h | 2 | ||||
| -rwxr-xr-x | src/server/shared/Packets/ByteBuffer.h | 40 | ||||
| -rwxr-xr-x | src/server/shared/Utilities/ServiceWin32.cpp | 2 |
16 files changed, 124 insertions, 124 deletions
diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 1059324b30e..7e62486d3a0 100755 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -24,7 +24,7 @@ static bool GetValueHelper(ACE_Configuration_Heap *mConf, const char *name, ACE_ if (!mConf) return false; - ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, sConfig.mMtx, false); + ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, sConfig->mMtx, false); ACE_TString section_name; ACE_Configuration_Section_Key section_key; diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h index ae79f806bc7..703d88a8814 100755 --- a/src/server/shared/Configuration/Config.h +++ b/src/server/shared/Configuration/Config.h @@ -49,7 +49,7 @@ class Config ACE_Configuration_Heap *mConf; }; -#define sConfig (*ACE_Singleton<Config, ACE_Null_Mutex>::instance()) +#define sConfig ACE_Singleton<Config, ACE_Null_Mutex>::instance() #endif diff --git a/src/server/shared/DataStores/DBCStore.h b/src/server/shared/DataStores/DBCStore.h index dcf95f5741a..ee9e2995854 100755 --- a/src/server/shared/DataStores/DBCStore.h +++ b/src/server/shared/DataStores/DBCStore.h @@ -110,7 +110,7 @@ class DBCStorage // Check if sql index pos is valid if (int32(result->GetFieldCount()-1) < sql->sqlIndexPos) { - sLog.outError("Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str()); + sLog->outError("Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str()); return false; } } @@ -138,7 +138,7 @@ class DBCStorage uint32 id = fields[sql->sqlIndexPos].GetUInt32(); if (indexTable[id]) { - sLog.outError("Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str()); + sLog->outError("Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str()); return false; } indexTable[id]=(T*)&sqlDataTable[offset]; @@ -193,7 +193,7 @@ class DBCStorage offset+=1; break; case FT_STRING: - sLog.outError("Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); + sLog->outError("Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); return false; case FT_SORT: break; @@ -205,13 +205,13 @@ class DBCStorage } else { - sLog.outError("Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); + sLog->outError("Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); return false; } } if (sqlColumnNumber != (result->GetFieldCount()-1)) { - sLog.outError("SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str()); + sLog->outError("SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str()); return false; } diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 0ab86708fb8..ebfc382b409 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -64,7 +64,7 @@ class DatabaseWorkerPool ~DatabaseWorkerPool() { - sLog.outSQLDriver("~DatabaseWorkerPool for '%s'.", m_connectionInfo.database.c_str()); + sLog->outSQLDriver("~DatabaseWorkerPool for '%s'.", m_connectionInfo.database.c_str()); mysql_library_end(); } @@ -72,7 +72,7 @@ class DatabaseWorkerPool { m_connectionInfo = MySQLConnectionInfo(infoString); - sLog.outSQLDriver("Opening databasepool '%s'. Async threads: %u, synch threads: %u", m_connectionInfo.database.c_str(), async_threads, synch_threads); + sLog->outSQLDriver("Opening databasepool '%s'. Async threads: %u, synch threads: %u", m_connectionInfo.database.c_str(), async_threads, synch_threads); /// Open asynchronous connections (delayed operations) m_connections[IDX_ASYNC].resize(async_threads); @@ -94,13 +94,13 @@ class DatabaseWorkerPool ++m_connectionCount[IDX_SYNCH]; } - sLog.outSQLDriver("Databasepool opened succesfuly. %u total connections running.", (m_connectionCount[IDX_SYNCH] + m_connectionCount[IDX_ASYNC])); + sLog->outSQLDriver("Databasepool opened succesfuly. %u total connections running.", (m_connectionCount[IDX_SYNCH] + m_connectionCount[IDX_ASYNC])); return true; } void Close() { - sLog.outSQLDriver("Closing down databasepool '%s'.", m_connectionInfo.database.c_str()); + sLog->outSQLDriver("Closing down databasepool '%s'.", m_connectionInfo.database.c_str()); /// Shuts down delaythreads for this connection pool. m_queue->queue()->deactivate(); @@ -118,7 +118,7 @@ class DatabaseWorkerPool --m_connectionCount[IDX_ASYNC]; } - sLog.outSQLDriver("Asynchronous connections on databasepool '%s' terminated. Proceeding with synchronous connections.", m_connectionInfo.database.c_str()); + sLog->outSQLDriver("Asynchronous connections on databasepool '%s' terminated. Proceeding with synchronous connections.", m_connectionInfo.database.c_str()); /// Shut down the synchronous connections for (uint8 i = 0; i < m_connectionCount[IDX_SYNCH]; ++i) @@ -130,7 +130,7 @@ class DatabaseWorkerPool --m_connectionCount[IDX_SYNCH]; } - sLog.outSQLDriver("All connections on databasepool %s closed.", m_connectionInfo.database.c_str()); + sLog->outSQLDriver("All connections on databasepool %s closed.", m_connectionInfo.database.c_str()); } /** @@ -335,15 +335,15 @@ class DatabaseWorkerPool //! were appended to the transaction will be respected during execution. void CommitTransaction(SQLTransaction transaction) { - if (sLog.GetSQLDriverQueryLogging()) + if (sLog->GetSQLDriverQueryLogging()) { switch (transaction->GetSize()) { case 0: - sLog.outSQLDriver("Transaction contains 0 queries. Not executing."); + sLog->outSQLDriver("Transaction contains 0 queries. Not executing."); return; case 1: - sLog.outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code."); + sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code."); break; default: break; diff --git a/src/server/shared/Database/Field.h b/src/server/shared/Database/Field.h index 8b494d21679..cfe2e2149a2 100755 --- a/src/server/shared/Database/Field.h +++ b/src/server/shared/Database/Field.h @@ -43,7 +43,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetUInt8() on non-numeric field."); + sLog->outSQLDriver("Error: GetUInt8() on non-numeric field."); return 0; } #endif @@ -60,7 +60,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GeInt8() on non-numeric field."); + sLog->outSQLDriver("Error: GeInt8() on non-numeric field."); return 0; } #endif @@ -77,7 +77,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetUInt16() on non-numeric field."); + sLog->outSQLDriver("Error: GetUInt16() on non-numeric field."); return 0; } #endif @@ -94,7 +94,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetInt16() on non-numeric field."); + sLog->outSQLDriver("Error: GetInt16() on non-numeric field."); return 0; } #endif @@ -111,7 +111,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetUInt32() on non-numeric field."); + sLog->outSQLDriver("Error: GetUInt32() on non-numeric field."); return 0; } #endif @@ -128,7 +128,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetInt32() on non-numeric field."); + sLog->outSQLDriver("Error: GetInt32() on non-numeric field."); return 0; } #endif @@ -145,7 +145,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetUInt64() on non-numeric field."); + sLog->outSQLDriver("Error: GetUInt64() on non-numeric field."); return 0; } #endif @@ -162,7 +162,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetInt64() on non-numeric field."); + sLog->outSQLDriver("Error: GetInt64() on non-numeric field."); return 0; } #endif @@ -179,7 +179,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetFloat() on non-numeric field."); + sLog->outSQLDriver("Error: GetFloat() on non-numeric field."); return 0.0f; } #endif @@ -196,7 +196,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsNumeric()) { - sLog.outSQLDriver("Error: GetDouble() on non-numeric field."); + sLog->outSQLDriver("Error: GetDouble() on non-numeric field."); return 0.0f; } #endif @@ -213,7 +213,7 @@ class Field #ifdef TRINITY_DEBUG if (IsNumeric()) { - sLog.outSQLDriver("Error: GetCString() on numeric field."); + sLog->outSQLDriver("Error: GetCString() on numeric field."); return NULL; } #endif @@ -311,7 +311,7 @@ class Field MYSQL_TYPE_SET: */ default: - sLog.outSQLDriver("SQL::SizeForType(): invalid field type %u", uint32(field->type)); + sLog->outSQLDriver("SQL::SizeForType(): invalid field type %u", uint32(field->type)); return 0; } } diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 07d782c9304..bd90b528dba 100755 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -56,7 +56,7 @@ MySQLConnection::~MySQLConnection() { ASSERT (m_Mysql); /// MySQL context must be present at this point - sLog.outSQLDriver("MySQLConnection::~MySQLConnection()"); + sLog->outSQLDriver("MySQLConnection::~MySQLConnection()"); for (size_t i = 0; i < m_stmts.size(); ++i) delete m_stmts[i]; @@ -76,7 +76,7 @@ bool MySQLConnection::Open() mysqlInit = mysql_init(NULL); if (!mysqlInit) { - sLog.outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str()); + sLog->outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str()); return false; } @@ -120,13 +120,13 @@ bool MySQLConnection::Open() { if (!m_reconnecting) { - sLog.outSQLDriver("MySQL client library: %s", mysql_get_client_info()); - sLog.outSQLDriver("MySQL server ver: %s ", mysql_get_server_info(m_Mysql)); + sLog->outSQLDriver("MySQL client library: %s", mysql_get_client_info()); + sLog->outSQLDriver("MySQL server ver: %s ", mysql_get_server_info(m_Mysql)); if (mysql_get_server_version(m_Mysql) != mysql_get_client_version()) - sLog.outSQLDriver("[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements."); + sLog->outSQLDriver("[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements."); } - sLog.outDetail("Connected to MySQL database at %s", m_connectionInfo.host.c_str()); + sLog->outDetail("Connected to MySQL database at %s", m_connectionInfo.host.c_str()); mysql_autocommit(m_Mysql, 1); // set connection properties to UTF8 to properly handle locales for different @@ -136,7 +136,7 @@ bool MySQLConnection::Open() } else { - sLog.outError("Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit)); + sLog->outError("Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit)); mysql_close(mysqlInit); return false; } @@ -149,24 +149,24 @@ bool MySQLConnection::Execute(const char* sql) { uint32 _s = 0; - if (sLog.GetSQLDriverQueryLogging()) + if (sLog->GetSQLDriverQueryLogging()) _s = getMSTime(); if (mysql_query(m_Mysql, sql)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog.outSQLDriver("SQL: %s", sql); - sLog.outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql)); + sLog->outSQLDriver("SQL: %s", sql); + sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection) return Execute(sql); // Try again return false; } - else if (sLog.GetSQLDriverQueryLogging()) + else if (sLog->GetSQLDriverQueryLogging()) { - sLog.outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); + sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); } } @@ -191,13 +191,13 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) MYSQL_BIND* msql_BIND = m_mStmt->GetBind(); uint32 _s = 0; - if (sLog.GetSQLDriverQueryLogging()) + if (sLog->GetSQLDriverQueryLogging()) _s = getMSTime(); if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog.outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error binding params: [%u] %s", + sLog->outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error binding params: [%u] %s", index, m_connectionInfo.database.c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection) @@ -210,7 +210,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) if (mysql_stmt_execute(msql_STMT)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog.outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error executing: [%u] %s", + sLog->outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error executing: [%u] %s", index, m_connectionInfo.database.c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection) @@ -220,8 +220,8 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) return false; } - if (sLog.GetSQLDriverQueryLogging()) - sLog.outSQLDriver("[%u ms] Prepared SQL: %u on database `%s`", + if (sLog->GetSQLDriverQueryLogging()) + sLog->outSQLDriver("[%u ms] Prepared SQL: %u on database `%s`", getMSTimeDiff(_s, getMSTime()), index, m_connectionInfo.database.c_str()); m_mStmt->ClearParameters(); @@ -247,13 +247,13 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 MYSQL_BIND* msql_BIND = m_mStmt->GetBind(); uint32 _s = 0; - if (sLog.GetSQLDriverQueryLogging()) + if (sLog->GetSQLDriverQueryLogging()) _s = getMSTime(); if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog.outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error binding params: [%u] %s", + sLog->outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error binding params: [%u] %s", index, m_connectionInfo.database.c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection) @@ -266,7 +266,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 if (mysql_stmt_execute(msql_STMT)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog.outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error executing: [%u] %s", + sLog->outSQLDriver("[ERROR]: PreparedStatement (id: %u, database: `%s`) error executing: [%u] %s", index, m_connectionInfo.database.c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection) @@ -276,8 +276,8 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 return false; } - if (sLog.GetSQLDriverQueryLogging()) - sLog.outSQLDriver("[%u ms] Prepared SQL: %u on database `%s`", + if (sLog->GetSQLDriverQueryLogging()) + sLog->outSQLDriver("[%u ms] Prepared SQL: %u on database `%s`", getMSTimeDiff(_s, getMSTime()), index, m_connectionInfo.database.c_str()); m_mStmt->ClearParameters(); @@ -314,23 +314,23 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD * { uint32 _s = 0; - if (sLog.GetSQLDriverQueryLogging()) + if (sLog->GetSQLDriverQueryLogging()) _s = getMSTime(); if (mysql_query(m_Mysql, sql)) { uint32 lErrno = mysql_errno(m_Mysql); - sLog.outSQLDriver("SQL: %s", sql); - sLog.outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql)); + sLog->outSQLDriver("SQL: %s", sql); + sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled succesfuly (ie reconnection) return _Query(sql, pResult, pFields, pRowCount, pFieldCount); // We try again return false; } - else if (sLog.GetSQLDriverQueryLogging()) + else if (sLog->GetSQLDriverQueryLogging()) { - sLog.outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s,getMSTime()), sql); + sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s,getMSTime()), sql); } *pResult = mysql_store_result(m_Mysql); @@ -372,7 +372,7 @@ MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index) ASSERT(index < m_stmts.size()); MySQLPreparedStatement* ret = m_stmts[index]; if (!ret) - sLog.outSQLDriver("ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.", + sLog->outSQLDriver("ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.", index, m_connectionInfo.database.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous"); return ret; @@ -396,15 +396,15 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, bool async MYSQL_STMT * stmt = mysql_stmt_init(m_Mysql); if (!stmt) { - sLog.outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql); - sLog.outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql)); + sLog->outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql); + sLog->outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql)); exit(1); } if (mysql_stmt_prepare(stmt, sql, static_cast<unsigned long>(strlen(sql)))) { - sLog.outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql); - sLog.outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt)); + sLog->outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql); + sLog->outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt)); mysql_stmt_close(stmt); exit(1); } @@ -431,7 +431,7 @@ PreparedResultSet* MySQLConnection::Query(PreparedStatement* stmt) bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) { - sLog.outDebug("%s", __FUNCTION__); + sLog->outDebug("%s", __FUNCTION__); switch (errNo) { @@ -445,9 +445,9 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) mysql_close(GetHandle()); if (this->Open()) // Don't remove 'this' pointer unless you want to skip loading all prepared statements.... { - sLog.outSQLDriver("Connection to the MySQL server is active."); + sLog->outSQLDriver("Connection to the MySQL server is active."); if (oldThreadId != mysql_thread_id(GetHandle())) - sLog.outSQLDriver("Succesfuly reconnected to %s @%s:%s (%s).", + sLog->outSQLDriver("Succesfuly reconnected to %s @%s:%s (%s).", m_connectionInfo.database.c_str(), m_connectionInfo.host.c_str(), m_connectionInfo.port_or_socket.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous"); @@ -466,7 +466,7 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) return false; default: - sLog.outSQLDriver("Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo); + sLog->outSQLDriver("Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo); return false; } } diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index 95d0f89ba67..5faf8f6dbec 100755 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -70,7 +70,7 @@ void PreparedStatement::BindParameters() } #ifdef _DEBUG if (i < m_stmt->m_paramCount) - sLog.outSQLDriver("[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index); + sLog->outSQLDriver("[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index); #endif } @@ -224,7 +224,7 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index) return false; if (m_paramsSet[index]) - sLog.outSQLDriver("[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index); + sLog->outSQLDriver("[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index); return true; } diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp index 6a525bccc90..3268758c2b8 100755 --- a/src/server/shared/Database/QueryHolder.cpp +++ b/src/server/shared/Database/QueryHolder.cpp @@ -24,7 +24,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char *sql) { if (m_queries.size() <= index) { - sLog.outError("Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql); + sLog->outError("Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql); return false; } @@ -44,7 +44,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...) { if (!format) { - sLog.outError("Query (index: %zu) is empty.",index); + sLog->outError("Query (index: %zu) is empty.",index); return false; } @@ -56,7 +56,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...) if (res == -1) { - sLog.outError("SQL Query truncated (and not execute) for format: %s",format); + sLog->outError("SQL Query truncated (and not execute) for format: %s",format); return false; } @@ -67,7 +67,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt) { if (m_queries.size() <= index) { - sLog.outError("Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size()); + sLog->outError("Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size()); return false; } diff --git a/src/server/shared/Database/QueryResult.cpp b/src/server/shared/Database/QueryResult.cpp index 56ac07ed8a1..8f00ce47170 100755 --- a/src/server/shared/Database/QueryResult.cpp +++ b/src/server/shared/Database/QueryResult.cpp @@ -59,7 +59,7 @@ m_length(NULL) //- This is where we store the (entire) resultset if (mysql_stmt_store_result(m_stmt)) { - sLog.outSQLDriver("%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); + sLog->outSQLDriver("%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); return; } @@ -85,7 +85,7 @@ m_length(NULL) //- This is where we bind the bind the buffer to the statement if (mysql_stmt_bind_result(m_stmt, m_rBind)) { - sLog.outSQLDriver("%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); + sLog->outSQLDriver("%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); delete[] m_rBind; delete[] m_isNull; delete[] m_length; diff --git a/src/server/shared/Database/SQLStorageImpl.h b/src/server/shared/Database/SQLStorageImpl.h index 8f26805a051..481d87516b4 100755 --- a/src/server/shared/Database/SQLStorageImpl.h +++ b/src/server/shared/Database/SQLStorageImpl.h @@ -124,7 +124,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store) QueryResult result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", store.entry_field, store.table); if(!result) { - sLog.outError("Error loading %s table (not exist?)\n", store.table); + sLog->outError("Error loading %s table (not exist?)\n", store.table); exit(1); // Stop server at loading non exited table or not accessable table } @@ -143,7 +143,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store) if(!result) { - sLog.outError("%s table is empty!\n", store.table); + sLog->outError("%s table is empty!\n", store.table); store.RecordCount = 0; return; } @@ -154,7 +154,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store) if(store.iNumFields != result->GetFieldCount()) { store.RecordCount = 0; - sLog.outError("Error in %s table, probably sql file format was updated (there should be %d fields in sql).\n", store.table, store.iNumFields); + sLog->outError("Error in %s table, probably sql file format was updated (there should be %d fields in sql).\n", store.table, store.iNumFields); exit(1); // Stop server at loading broken or non-compatible table. } diff --git a/src/server/shared/Database/Transaction.cpp b/src/server/shared/Database/Transaction.cpp index cfda2f1c9b0..c3b49a708bd 100755 --- a/src/server/shared/Database/Transaction.cpp +++ b/src/server/shared/Database/Transaction.cpp @@ -83,7 +83,7 @@ bool TransactionTask::Execute() ASSERT(stmt); if (!m_conn->Execute(stmt)) { - sLog.outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size()); + sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size()); m_conn->RollbackTransaction(); return false; } @@ -96,7 +96,7 @@ bool TransactionTask::Execute() ASSERT(sql); if (!m_conn->Execute(sql)) { - sLog.outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size()); + sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size()); m_conn->RollbackTransaction(); return false; } diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h index 271182ae220..32f4e87e1ef 100755 --- a/src/server/shared/Debugging/Errors.h +++ b/src/server/shared/Debugging/Errors.h @@ -26,10 +26,10 @@ #else #define WPAssert( assertion ) { if (!(assertion)) { fprintf( stderr, "\n%s:%i in %s ASSERTION FAILED2:\n %s\n", __FILE__, __LINE__,__FUNCTION__, #assertion); assert( #assertion &&0 ); ((void(*)())NULL)();} } #endif -#define WPError( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); } -#define WPWarning( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); } +#define WPError( assertion, errmsg ) if( ! (assertion) ) { sLog->outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); } +#define WPWarning( assertion, errmsg ) if( ! (assertion) ) { sLog->outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); } -#define WPFatal( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( #assertion &&0 ); abort(); } +#define WPFatal( assertion, errmsg ) if( ! (assertion) ) { sLog->outError( "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( #assertion &&0 ); abort(); } #define ASSERT WPAssert #endif diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index e06495d0252..f186db0c7e2 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -104,16 +104,16 @@ void Log::SetDBLogLevel(char *Level) void Log::Initialize() { /// Check whether we'll log GM commands/RA events/character outputs/chat stuffs - m_dbChar = sConfig.GetBoolDefault("LogDB.Char", false); - m_dbRA = sConfig.GetBoolDefault("LogDB.RA", false); - m_dbGM = sConfig.GetBoolDefault("LogDB.GM", false); - m_dbChat = sConfig.GetBoolDefault("LogDB.Chat", false); + m_dbChar = sConfig->GetBoolDefault("LogDB.Char", false); + m_dbRA = sConfig->GetBoolDefault("LogDB.RA", false); + m_dbGM = sConfig->GetBoolDefault("LogDB.GM", false); + m_dbChat = sConfig->GetBoolDefault("LogDB.Chat", false); /// Realm must be 0 by default SetRealmID(0); /// Common log files data - m_logsDir = sConfig.GetStringDefault("LogsDir",""); + m_logsDir = sConfig->GetStringDefault("LogsDir",""); if (!m_logsDir.empty()) if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) m_logsDir.append("/"); @@ -122,18 +122,18 @@ void Log::Initialize() /// Open specific log files logfile = openLogFile("LogFile","LogTimestamp","w"); - InitColors(sConfig.GetStringDefault("LogColors", "")); + InitColors(sConfig->GetStringDefault("LogColors", "")); - m_gmlog_per_account = sConfig.GetBoolDefault("GmLogPerAccount",false); + m_gmlog_per_account = sConfig->GetBoolDefault("GmLogPerAccount",false); if(!m_gmlog_per_account) gmLogfile = openLogFile("GMLogFile","GmLogTimestamp","a"); else { // GM log settings for per account case - m_gmlog_filename_format = sConfig.GetStringDefault("GMLogFile", ""); + m_gmlog_filename_format = sConfig->GetStringDefault("GMLogFile", ""); if(!m_gmlog_filename_format.empty()) { - bool m_gmlog_timestamp = sConfig.GetBoolDefault("GmLogTimestamp",false); + bool m_gmlog_timestamp = sConfig->GetBoolDefault("GmLogTimestamp",false); size_t dot_pos = m_gmlog_filename_format.find_last_of("."); if(dot_pos!=m_gmlog_filename_format.npos) @@ -163,28 +163,28 @@ void Log::Initialize() sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a"); // Main log file settings - m_logLevel = sConfig.GetIntDefault("LogLevel", LOGL_NORMAL); - m_logFileLevel = sConfig.GetIntDefault("LogFileLevel", LOGL_NORMAL); - m_dbLogLevel = sConfig.GetIntDefault("DBLogLevel", LOGL_NORMAL); - m_sqlDriverQueryLogging = sConfig.GetBoolDefault("SQLDriverQueryLogging", false); + m_logLevel = sConfig->GetIntDefault("LogLevel", LOGL_NORMAL); + m_logFileLevel = sConfig->GetIntDefault("LogFileLevel", LOGL_NORMAL); + m_dbLogLevel = sConfig->GetIntDefault("DBLogLevel", LOGL_NORMAL); + m_sqlDriverQueryLogging = sConfig->GetBoolDefault("SQLDriverQueryLogging", false); m_logFilter = 0; - if(sConfig.GetBoolDefault("LogFilter_TransportMoves", true)) + if(sConfig->GetBoolDefault("LogFilter_TransportMoves", true)) m_logFilter |= LOG_FILTER_TRANSPORT_MOVES; - if(sConfig.GetBoolDefault("LogFilter_CreatureMoves", true)) + if(sConfig->GetBoolDefault("LogFilter_CreatureMoves", true)) m_logFilter |= LOG_FILTER_CREATURE_MOVES; - if(sConfig.GetBoolDefault("LogFilter_VisibilityChanges", true)) + if(sConfig->GetBoolDefault("LogFilter_VisibilityChanges", true)) m_logFilter |= LOG_FILTER_VISIBILITY_CHANGES; - if(sConfig.GetBoolDefault("LogFilter_AchievementUpdates", true)) + if(sConfig->GetBoolDefault("LogFilter_AchievementUpdates", true)) m_logFilter |= LOG_FILTER_ACHIEVEMENT_UPDATES; // Char log settings - m_charLog_Dump = sConfig.GetBoolDefault("CharLogDump", false); - m_charLog_Dump_Separate = sConfig.GetBoolDefault("CharLogDump.Separate", false); + m_charLog_Dump = sConfig->GetBoolDefault("CharLogDump", false); + m_charLog_Dump_Separate = sConfig->GetBoolDefault("CharLogDump.Separate", false); if (m_charLog_Dump_Separate) { - m_dumpsDir = sConfig.GetStringDefault("CharLogDump.SeparateDir", ""); + m_dumpsDir = sConfig->GetStringDefault("CharLogDump.SeparateDir", ""); if (!m_dumpsDir.empty()) if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\')) m_dumpsDir.append("/"); @@ -193,11 +193,11 @@ void Log::Initialize() FILE* Log::openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode) { - std::string logfn=sConfig.GetStringDefault(configFileName, ""); + std::string logfn=sConfig->GetStringDefault(configFileName, ""); if(logfn.empty()) return NULL; - if(configTimeStampFlag && sConfig.GetBoolDefault(configTimeStampFlag,false)) + if(configTimeStampFlag && sConfig->GetBoolDefault(configTimeStampFlag,false)) { size_t dot_pos = logfn.find_last_of("."); if(dot_pos!=logfn.npos) diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 2d3d5faccff..39857493b48 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -178,7 +178,7 @@ class Log std::string m_dumpsDir; }; -#define sLog (*ACE_Singleton<Log, ACE_Thread_Mutex>::instance()) +#define sLog ACE_Singleton<Log, ACE_Thread_Mutex>::instance() #endif diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 6fb28aa576b..5307c1051fd 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -35,7 +35,7 @@ class ByteBufferException void PrintPosError() const { - sLog.outError("Attempted to %s in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") value with size: " SIZEFMTD, + sLog->outError("Attempted to %s in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") value with size: " SIZEFMTD, (add ? "put" : "get"), pos, size, esize); } private: @@ -413,33 +413,33 @@ class ByteBuffer void print_storage() const { - if(!sLog.IsOutDebug()) // optimize disabled debug output + if(!sLog->IsOutDebug()) // optimize disabled debug output return; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); + sLog->outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); for (uint32 i = 0; i < size(); ++i) - sLog.outDebugInLine("%u - ", read<uint8>(i) ); - sLog.outDebug(" "); + sLog->outDebugInLine("%u - ", read<uint8>(i) ); + sLog->outDebug(" "); } void textlike() const { - if(!sLog.IsOutDebug()) // optimize disabled debug output + if(!sLog->IsOutDebug()) // optimize disabled debug output return; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); + sLog->outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); for (uint32 i = 0; i < size(); ++i) - sLog.outDebugInLine("%c", read<uint8>(i) ); - sLog.outDebug(" "); + sLog->outDebugInLine("%c", read<uint8>(i) ); + sLog->outDebug(" "); } void hexlike() const { - if(!sLog.IsOutDebug()) // optimize disabled debug output + if(!sLog->IsOutDebug()) // optimize disabled debug output return; uint32 j = 1, k = 1; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); + sLog->outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); for (uint32 i = 0; i < size(); ++i) { @@ -447,11 +447,11 @@ class ByteBuffer { if (read<uint8>(i) < 0x10) { - sLog.outDebugInLine("| 0%X ", read<uint8>(i) ); + sLog->outDebugInLine("| 0%X ", read<uint8>(i) ); } else { - sLog.outDebugInLine("| %X ", read<uint8>(i) ); + sLog->outDebugInLine("| %X ", read<uint8>(i) ); } ++j; } @@ -459,15 +459,15 @@ class ByteBuffer { if (read<uint8>(i) < 0x10) { - sLog.outDebugInLine("\n"); + sLog->outDebugInLine("\n"); - sLog.outDebugInLine("0%X ", read<uint8>(i) ); + sLog->outDebugInLine("0%X ", read<uint8>(i) ); } else { - sLog.outDebugInLine("\n"); + sLog->outDebugInLine("\n"); - sLog.outDebugInLine("%X ", read<uint8>(i) ); + sLog->outDebugInLine("%X ", read<uint8>(i) ); } ++k; @@ -477,15 +477,15 @@ class ByteBuffer { if (read<uint8>(i) < 0x10) { - sLog.outDebugInLine("0%X ", read<uint8>(i) ); + sLog->outDebugInLine("0%X ", read<uint8>(i) ); } else { - sLog.outDebugInLine("%X ", read<uint8>(i) ); + sLog->outDebugInLine("%X ", read<uint8>(i) ); } } } - sLog.outDebugInLine("\n"); + sLog->outDebugInLine("\n"); } protected: diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp index 4efa2af922b..08f58850bb3 100755 --- a/src/server/shared/Utilities/ServiceWin32.cpp +++ b/src/server/shared/Utilities/ServiceWin32.cpp @@ -257,7 +257,7 @@ bool WinServiceRun() if (!StartServiceCtrlDispatcher(serviceTable)) { - sLog.outError("StartService Failed. Error [%u]", ::GetLastError()); + sLog->outError("StartService Failed. Error [%u]", ::GetLastError()); return false; } return true; |
