Core/Misc: Fixed some -Weffc++ warnings
This commit is contained in:
@@ -81,6 +81,10 @@ namespace VMAP
|
||||
bool isTiled() const { return iIsTiled; }
|
||||
uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
|
||||
void getModelInstances(ModelInstance* &models, uint32 &count);
|
||||
|
||||
private:
|
||||
StaticMapTree(StaticMapTree const& right) DELETE_MEMBER;
|
||||
StaticMapTree& operator=(StaticMapTree const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
struct AreaInfo
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace VMAP
|
||||
bool writeToFile(FILE* wf);
|
||||
static bool readFromFile(FILE* rf, WmoLiquid* &liquid);
|
||||
private:
|
||||
WmoLiquid(): iTilesX(0), iTilesY(0), iType(0), iHeight(0), iFlags(0) { }
|
||||
WmoLiquid() : iTilesX(0), iTilesY(0), iCorner(), iType(0), iHeight(NULL), iFlags(NULL) { }
|
||||
uint32 iTilesX; //!< number of tiles in x direction, each
|
||||
uint32 iTilesY;
|
||||
G3D::Vector3 iCorner; //!< the lower corner
|
||||
@@ -74,10 +74,10 @@ namespace VMAP
|
||||
class GroupModel
|
||||
{
|
||||
public:
|
||||
GroupModel(): iMogpFlags(0), iGroupWMOID(0), iLiquid(0) { }
|
||||
GroupModel() : iBound(), iMogpFlags(0), iGroupWMOID(0), iLiquid(NULL) { }
|
||||
GroupModel(const GroupModel &other);
|
||||
GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox &bound):
|
||||
iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) { }
|
||||
iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(NULL) { }
|
||||
~GroupModel() { delete iLiquid; }
|
||||
|
||||
//! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry!
|
||||
|
||||
@@ -262,6 +262,10 @@ class UnitAI
|
||||
virtual void sQuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { }
|
||||
virtual bool sOnDummyEffect(Unit* /*caster*/, uint32 /*spellId*/, SpellEffIndex /*effIndex*/) { return false; }
|
||||
virtual void sOnGameEvent(bool /*start*/, uint16 /*eventId*/) { }
|
||||
|
||||
private:
|
||||
UnitAI(UnitAI const& right) DELETE_MEMBER;
|
||||
UnitAI& operator=(UnitAI const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
class PlayerAI : public UnitAI
|
||||
|
||||
@@ -702,7 +702,7 @@ class RBACPermission
|
||||
{
|
||||
public:
|
||||
RBACPermission(uint32 id = 0, std::string const& name = ""):
|
||||
_id(id), _name(name) { }
|
||||
_id(id), _name(name), _perms() { }
|
||||
|
||||
/// Gets the Name of the Object
|
||||
std::string const& GetName() const { return _name; }
|
||||
@@ -737,7 +737,8 @@ class RBACData
|
||||
{
|
||||
public:
|
||||
RBACData(uint32 id, std::string const& name, int32 realmId, uint8 secLevel = 255):
|
||||
_id(id), _name(name), _realmId(realmId), _secLevel(secLevel) { }
|
||||
_id(id), _name(name), _realmId(realmId), _secLevel(secLevel),
|
||||
_grantedPerms(), _deniedPerms(), _globalPerms() { }
|
||||
|
||||
/// Gets the Name of the Object
|
||||
std::string const& GetName() const { return _name; }
|
||||
|
||||
@@ -267,8 +267,8 @@ class Object
|
||||
|
||||
// for output helpfull error messages from asserts
|
||||
bool PrintIndexError(uint32 index, bool set) const;
|
||||
Object(const Object&); // prevent generation copy constructor
|
||||
Object& operator=(Object const&); // prevent generation assigment operator
|
||||
Object(Object const& right) DELETE_MEMBER;
|
||||
Object& operator=(Object const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
struct Position
|
||||
@@ -497,6 +497,8 @@ template<class T>
|
||||
class GridObject
|
||||
{
|
||||
public:
|
||||
virtual ~GridObject() { }
|
||||
|
||||
bool IsInGrid() const { return _gridRef.isValid(); }
|
||||
void AddToGrid(GridRefManager<T>& m) { ASSERT(!IsInGrid()); _gridRef.link(&m, (T*)this); }
|
||||
void RemoveFromGrid() { ASSERT(IsInGrid()); _gridRef.unlink(); }
|
||||
|
||||
@@ -183,6 +183,8 @@ template<class TObject> class UpdatableScript
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~UpdatableScript() { }
|
||||
|
||||
public:
|
||||
|
||||
virtual void OnUpdate(TObject* /*obj*/, uint32 /*diff*/) { }
|
||||
|
||||
@@ -138,6 +138,10 @@ public:
|
||||
|
||||
protected:
|
||||
WorldSession* const m_pSession;
|
||||
|
||||
private:
|
||||
PacketFilter(PacketFilter const& right) DELETE_MEMBER;
|
||||
PacketFilter& operator=(PacketFilter const& right) DELETE_MEMBER;
|
||||
};
|
||||
//process only thread-safe packets in Map::Update()
|
||||
class MapSessionFilter : public PacketFilter
|
||||
@@ -950,6 +954,9 @@ class WorldSession
|
||||
typedef UNORDERED_MAP<uint16, bool> OpcodeStatusMap;
|
||||
OpcodeStatusMap _isOpcodeAllowed; // could be bool array, but wouldn't be practical for game versions with non-linear opcodes
|
||||
Policy _policy;
|
||||
|
||||
DosProtection(DosProtection const& right) DELETE_MEMBER;
|
||||
DosProtection& operator=(DosProtection const& right) DELETE_MEMBER;
|
||||
} AntiDOS;
|
||||
|
||||
private:
|
||||
@@ -1003,6 +1010,9 @@ class WorldSession
|
||||
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
|
||||
time_t timeLastWhoCommand;
|
||||
rbac::RBACData* _RBACData;
|
||||
|
||||
WorldSession(WorldSession const& right) DELETE_MEMBER;
|
||||
WorldSession& operator=(WorldSession const& right) DELETE_MEMBER;
|
||||
};
|
||||
#endif
|
||||
/// @}
|
||||
|
||||
@@ -208,6 +208,8 @@ class WorldSocket : public WorldHandler
|
||||
|
||||
uint32 m_Seed;
|
||||
|
||||
WorldSocket(WorldSocket const& right) DELETE_MEMBER;
|
||||
WorldSocket& operator=(WorldSocket const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
#endif /* _WORLDSOCKET_H */
|
||||
|
||||
@@ -688,6 +688,9 @@ class Spell
|
||||
double rand_norm() { return m_caster->GetMap()->mtRand.randExc(); }
|
||||
double rand_chance() { return m_caster->GetMap()->mtRand.randExc(100.0); }
|
||||
#endif
|
||||
|
||||
Spell(Spell const& right) DELETE_MEMBER;
|
||||
Spell& operator=(Spell const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
namespace Trinity
|
||||
|
||||
@@ -491,14 +491,15 @@ struct CliCommandHolder
|
||||
CommandFinished* m_commandFinished;
|
||||
|
||||
CliCommandHolder(void* callbackArg, const char *command, Print* zprint, CommandFinished* commandFinished)
|
||||
: m_callbackArg(callbackArg), m_print(zprint), m_commandFinished(commandFinished)
|
||||
: m_callbackArg(callbackArg), m_command(strdup(command)), m_print(zprint), m_commandFinished(commandFinished)
|
||||
{
|
||||
size_t len = strlen(command)+1;
|
||||
m_command = new char[len];
|
||||
memcpy(m_command, command, len);
|
||||
}
|
||||
|
||||
~CliCommandHolder() { delete[] m_command; }
|
||||
~CliCommandHolder() { free(m_command); }
|
||||
|
||||
private:
|
||||
CliCommandHolder(CliCommandHolder const& right) DELETE_MEMBER;
|
||||
CliCommandHolder& operator=(CliCommandHolder const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, WorldSession*> SessionMap;
|
||||
|
||||
@@ -106,5 +106,8 @@ class DBCFileLoader
|
||||
uint32 *fieldsOffset;
|
||||
unsigned char *data;
|
||||
unsigned char *stringTable;
|
||||
|
||||
DBCFileLoader(DBCFileLoader const& right) DELETE_MEMBER;
|
||||
DBCFileLoader& operator=(DBCFileLoader const& right) DELETE_MEMBER;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -63,6 +63,10 @@ struct SqlDbc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
SqlDbc(SqlDbc const& right) DELETE_MEMBER;
|
||||
SqlDbc& operator=(SqlDbc const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@@ -291,6 +295,9 @@ class DBCStorage
|
||||
|
||||
T* dataTable;
|
||||
StringPoolList stringPoolList;
|
||||
|
||||
DBCStorage(DBCStorage const& right) DELETE_MEMBER;
|
||||
DBCStorage& operator=(DBCStorage const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#ifndef _WORKERTHREAD_H
|
||||
#define _WORKERTHREAD_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <ace/Task.h>
|
||||
#include <ace/Activation_Queue.h>
|
||||
|
||||
@@ -33,9 +34,11 @@ class DatabaseWorker : protected ACE_Task_Base
|
||||
int wait() { return ACE_Task_Base::wait(); }
|
||||
|
||||
private:
|
||||
DatabaseWorker() : ACE_Task_Base() { }
|
||||
ACE_Activation_Queue* m_queue;
|
||||
MySQLConnection* m_conn;
|
||||
|
||||
DatabaseWorker(DatabaseWorker const& right) DELETE_MEMBER;
|
||||
DatabaseWorker& operator=(DatabaseWorker const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -49,8 +49,7 @@ class DatabaseWorkerPool
|
||||
{
|
||||
public:
|
||||
/* Activity state */
|
||||
DatabaseWorkerPool() :
|
||||
_queue(new ACE_Activation_Queue())
|
||||
DatabaseWorkerPool() : _queue(new ACE_Activation_Queue()), _connectionInfo(NULL)
|
||||
{
|
||||
memset(_connectionCount, 0, sizeof(_connectionCount));
|
||||
_connections.resize(IDX_SIZE);
|
||||
@@ -66,7 +65,7 @@ class DatabaseWorkerPool
|
||||
bool Open(const std::string& infoString, uint8 async_threads, uint8 synch_threads)
|
||||
{
|
||||
bool res = true;
|
||||
_connectionInfo = MySQLConnectionInfo(infoString);
|
||||
_connectionInfo = new MySQLConnectionInfo(infoString);
|
||||
|
||||
TC_LOG_INFO("sql.driver", "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
|
||||
GetDatabaseName(), async_threads, synch_threads);
|
||||
@@ -75,7 +74,7 @@ class DatabaseWorkerPool
|
||||
_connections[IDX_ASYNC].resize(async_threads);
|
||||
for (uint8 i = 0; i < async_threads; ++i)
|
||||
{
|
||||
T* t = new T(_queue, _connectionInfo);
|
||||
T* t = new T(_queue, *_connectionInfo);
|
||||
res &= t->Open();
|
||||
if (res) // only check mysql version if connection is valid
|
||||
WPFatal(mysql_get_server_version(t->GetHandle()) >= MIN_MYSQL_SERVER_VERSION, "TrinityCore does not support MySQL versions below 5.1");
|
||||
@@ -87,7 +86,7 @@ class DatabaseWorkerPool
|
||||
_connections[IDX_SYNCH].resize(synch_threads);
|
||||
for (uint8 i = 0; i < synch_threads; ++i)
|
||||
{
|
||||
T* t = new T(_connectionInfo);
|
||||
T* t = new T(*_connectionInfo);
|
||||
res &= t->Open();
|
||||
_connections[IDX_SYNCH][i] = t;
|
||||
++_connectionCount[IDX_SYNCH];
|
||||
@@ -134,6 +133,9 @@ class DatabaseWorkerPool
|
||||
delete _queue;
|
||||
|
||||
TC_LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName());
|
||||
|
||||
delete _connectionInfo;
|
||||
_connectionInfo = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -507,7 +509,7 @@ class DatabaseWorkerPool
|
||||
|
||||
char const* GetDatabaseName() const
|
||||
{
|
||||
return _connectionInfo.database.c_str();
|
||||
return _connectionInfo->database.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -521,7 +523,7 @@ class DatabaseWorkerPool
|
||||
ACE_Activation_Queue* _queue; //! Queue shared by async worker threads.
|
||||
std::vector< std::vector<T*> > _connections;
|
||||
uint32 _connectionCount[2]; //! Counter of MySQL connections;
|
||||
MySQLConnectionInfo _connectionInfo;
|
||||
MySQLConnectionInfo* _connectionInfo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,8 +38,7 @@ enum ConnectionFlags
|
||||
|
||||
struct MySQLConnectionInfo
|
||||
{
|
||||
MySQLConnectionInfo() { }
|
||||
MySQLConnectionInfo(const std::string& infoString)
|
||||
explicit MySQLConnectionInfo(std::string const& infoString)
|
||||
{
|
||||
Tokenizer tokens(infoString, ';');
|
||||
|
||||
@@ -132,6 +131,9 @@ class MySQLConnection
|
||||
MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging)
|
||||
ConnectionFlags m_connectionFlags; //! Connection flags (for preparing relevant statements)
|
||||
ACE_Thread_Mutex m_Mutex;
|
||||
|
||||
MySQLConnection(MySQLConnection const& right) DELETE_MEMBER;
|
||||
MySQLConnection& operator=(MySQLConnection const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -101,6 +101,9 @@ class PreparedStatement
|
||||
MySQLPreparedStatement* m_stmt;
|
||||
uint32 m_index;
|
||||
std::vector<PreparedStatementData> statement_data; //- Buffer of parameters, not tied to MySQL in any way yet
|
||||
|
||||
PreparedStatement(PreparedStatement const& right) DELETE_MEMBER;
|
||||
PreparedStatement& operator=(PreparedStatement const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
//- Class of which the instances are unique per MySQLConnection
|
||||
@@ -145,6 +148,9 @@ class MySQLPreparedStatement
|
||||
uint32 m_paramCount;
|
||||
std::vector<bool> m_paramsSet;
|
||||
MYSQL_BIND* m_bind;
|
||||
|
||||
MySQLPreparedStatement(MySQLPreparedStatement const& right) DELETE_MEMBER;
|
||||
MySQLPreparedStatement& operator=(MySQLPreparedStatement const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
typedef ACE_Future<PreparedQueryResult> PreparedQueryResultFuture;
|
||||
|
||||
@@ -55,6 +55,9 @@ class ResultSet
|
||||
void CleanUp();
|
||||
MYSQL_RES* _result;
|
||||
MYSQL_FIELD* _fields;
|
||||
|
||||
ResultSet(ResultSet const& right) DELETE_MEMBER;
|
||||
ResultSet& operator=(ResultSet const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
typedef Trinity::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult;
|
||||
@@ -100,6 +103,8 @@ class PreparedResultSet
|
||||
void CleanUp();
|
||||
bool _NextRow();
|
||||
|
||||
PreparedResultSet(PreparedResultSet const& right) DELETE_MEMBER;
|
||||
PreparedResultSet& operator=(PreparedResultSet const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
typedef Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex> PreparedQueryResult;
|
||||
|
||||
@@ -69,6 +69,10 @@ class SQLOperation : public ACE_Method_Request
|
||||
virtual void SetConnection(MySQLConnection* con) { m_conn = con; }
|
||||
|
||||
MySQLConnection* m_conn;
|
||||
|
||||
private:
|
||||
SQLOperation(SQLOperation const& right) DELETE_MEMBER;
|
||||
SQLOperation& operator=(SQLOperation const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -73,9 +73,11 @@
|
||||
#if COMPILER_HAS_CPP11_SUPPORT
|
||||
# define OVERRIDE override
|
||||
# define FINAL final
|
||||
# define DELETE_MEMBER = delete
|
||||
#else
|
||||
# define OVERRIDE
|
||||
# define FINAL
|
||||
# define DELETE_MEMBER
|
||||
#endif //COMPILER_HAS_CPP11_SUPPORT
|
||||
|
||||
#define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER
|
||||
|
||||
@@ -85,6 +85,8 @@ class ByteBuffer
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ByteBuffer() { }
|
||||
|
||||
void clear()
|
||||
{
|
||||
_storage.clear();
|
||||
|
||||
@@ -109,6 +109,9 @@ class QueryCallback
|
||||
ACE_Future<Result> _result;
|
||||
ParamType _param;
|
||||
uint8 _stage;
|
||||
|
||||
QueryCallback(QueryCallback const& right) DELETE_MEMBER;
|
||||
QueryCallback& operator=(QueryCallback const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
template <typename Result, typename ParamType1, typename ParamType2, bool chain = false>
|
||||
@@ -201,6 +204,9 @@ class QueryCallback_2
|
||||
ParamType1 _param_1;
|
||||
ParamType2 _param_2;
|
||||
uint8 _stage;
|
||||
|
||||
QueryCallback_2(QueryCallback_2 const& right) DELETE_MEMBER;
|
||||
QueryCallback_2& operator=(QueryCallback_2 const& right) DELETE_MEMBER;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user