Core/Misc: Fix some static analysis issues
Fix some static analysis issues, mostly false positive about fields not initialized in the constructor. It's good practice anyway to always initialize them.
This commit is contained in:
@@ -36,7 +36,7 @@ namespace VMAP
|
||||
class MeshTriangle
|
||||
{
|
||||
public:
|
||||
MeshTriangle(){ }
|
||||
MeshTriangle() : idx0(0), idx1(0), idx2(0) { }
|
||||
MeshTriangle(uint32 na, uint32 nb, uint32 nc): idx0(na), idx1(nb), idx2(nc) { }
|
||||
|
||||
uint32 idx0;
|
||||
@@ -59,7 +59,7 @@ namespace VMAP
|
||||
bool writeToFile(FILE* wf);
|
||||
static bool readFromFile(FILE* rf, WmoLiquid* &liquid);
|
||||
private:
|
||||
WmoLiquid(): iHeight(0), iFlags(0) { }
|
||||
WmoLiquid(): iTilesX(0), iTilesY(0), iType(0), iHeight(0), iFlags(0) { }
|
||||
uint32 iTilesX; //!< number of tiles in x direction, each
|
||||
uint32 iTilesY;
|
||||
G3D::Vector3 iCorner; //!< the lower corner
|
||||
@@ -74,7 +74,7 @@ namespace VMAP
|
||||
class GroupModel
|
||||
{
|
||||
public:
|
||||
GroupModel(): iLiquid(0) { }
|
||||
GroupModel(): iMogpFlags(0), iGroupWMOID(0), iLiquid(0) { }
|
||||
GroupModel(const GroupModel &other);
|
||||
GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox &bound):
|
||||
iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) { }
|
||||
|
||||
@@ -56,7 +56,10 @@ protected:
|
||||
class ItemChatLink : public ChatLink
|
||||
{
|
||||
public:
|
||||
ItemChatLink() : ChatLink(), _item(NULL), _suffix(NULL), _property(NULL) { }
|
||||
ItemChatLink() : ChatLink(), _item(NULL), _suffix(NULL), _property(NULL)
|
||||
{
|
||||
memset(_data, 0, sizeof(_data));
|
||||
}
|
||||
virtual bool Initialize(std::istringstream& iss);
|
||||
virtual bool ValidateName(char* buffer, const char* context);
|
||||
|
||||
@@ -98,7 +101,10 @@ protected:
|
||||
class AchievementChatLink : public ChatLink
|
||||
{
|
||||
public:
|
||||
AchievementChatLink() : ChatLink(), _guid(0), _achievement(NULL) { }
|
||||
AchievementChatLink() : ChatLink(), _guid(0), _achievement(NULL)
|
||||
{
|
||||
memset(_data, 0, sizeof(_data));
|
||||
}
|
||||
virtual bool Initialize(std::istringstream& iss);
|
||||
virtual bool ValidateName(char* buffer, const char* context);
|
||||
|
||||
|
||||
@@ -93,13 +93,13 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent
|
||||
};
|
||||
ThreatManager* iThreatManager;
|
||||
public:
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostileReference = NULL; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = NULL; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iFValue = pValue; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; iFValue = pValue; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iBValue = pValue; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; iBValue = pValue; }
|
||||
|
||||
int32 getIValue() const { return iIValue; }
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
|
||||
lootingGroupLowGUID = 0;
|
||||
|
||||
ResetLootMode(); // restore default loot mode
|
||||
m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
GameObject::~GameObject()
|
||||
|
||||
@@ -536,7 +536,10 @@ class MapObject
|
||||
friend class ObjectGridLoader; //grid loader for loading creatures
|
||||
|
||||
protected:
|
||||
MapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) { }
|
||||
MapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE)
|
||||
{
|
||||
_newPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
private:
|
||||
Cell _currentCell;
|
||||
|
||||
@@ -251,7 +251,7 @@ typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
|
||||
struct PlayerInfo
|
||||
{
|
||||
// existence checked by displayId != 0
|
||||
PlayerInfo() : displayId_m(0), displayId_f(0), levelInfo(NULL) { }
|
||||
PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(NULL) { }
|
||||
|
||||
uint32 mapId;
|
||||
uint32 areaId;
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
#include "CellImpl.h"
|
||||
|
||||
Transport::Transport() : GameObject(),
|
||||
_transportInfo(NULL), _isMoving(true), _pendingStop(false)
|
||||
_transportInfo(NULL), _isMoving(true), _pendingStop(false),
|
||||
_triggeredArrivalEvent(false), _triggeredDepartureEvent(false)
|
||||
{
|
||||
m_updateFlag = UPDATEFLAG_TRANSPORT | UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_ROTATION;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,8 @@ ObjectMgr::ObjectMgr():
|
||||
_hiGoGuid(1),
|
||||
_hiDoGuid(1),
|
||||
_hiCorpseGuid(1),
|
||||
_hiMoTransGuid(1)
|
||||
_hiMoTransGuid(1),
|
||||
DBCLocaleIndex(LOCALE_enUS)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_CLASSES; ++i)
|
||||
{
|
||||
|
||||
@@ -457,7 +457,7 @@ typedef std::pair<QuestRelations::const_iterator, QuestRelations::const_iterator
|
||||
|
||||
struct PetLevelInfo
|
||||
{
|
||||
PetLevelInfo() : health(0), mana(0) { for (uint8 i=0; i < MAX_STATS; ++i) stats[i] = 0; }
|
||||
PetLevelInfo() : health(0), mana(0), armor(0) { for (uint8 i=0; i < MAX_STATS; ++i) stats[i] = 0; }
|
||||
|
||||
uint16 stats[MAX_STATS];
|
||||
uint16 health;
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef UNORDERED_MAP<uint32, std::set<uint32> > TransportInstanceMap;
|
||||
|
||||
struct KeyFrame
|
||||
{
|
||||
explicit KeyFrame(TaxiPathNodeEntry const& _node) : Node(&_node),
|
||||
explicit KeyFrame(TaxiPathNodeEntry const& _node) : Index(0), Node(&_node),
|
||||
DistSinceStop(-1.0f), DistUntilStop(-1.0f), DistFromPrev(-1.0f), TimeFrom(0.0f), TimeTo(0.0f),
|
||||
Teleport(false), ArriveTime(0), DepartureTime(0), Spline(NULL), NextDistFromPrev(0.0f), NextArriveTime(0)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ struct KeyFrame
|
||||
|
||||
struct TransportTemplate
|
||||
{
|
||||
TransportTemplate() : pathTime(0), accelTime(0.0f), accelDist(0.0f) { }
|
||||
TransportTemplate() : inInstance(false), pathTime(0), accelTime(0.0f), accelDist(0.0f), entry(0) { }
|
||||
~TransportTemplate();
|
||||
|
||||
std::set<uint32> mapsUsed;
|
||||
|
||||
@@ -33,6 +33,8 @@ PathGenerator::PathGenerator(const Unit* owner) :
|
||||
_endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL),
|
||||
_navMeshQuery(NULL)
|
||||
{
|
||||
memset(_pathPolyRefs, 0, sizeof(_pathPolyRefs));
|
||||
|
||||
TC_LOG_DEBUG("maps", "++ PathGenerator::PathGenerator for %u \n", _sourceUnit->GetGUIDLow());
|
||||
|
||||
uint32 mapId = _sourceUnit->GetMapId();
|
||||
|
||||
+2
@@ -73,6 +73,8 @@ public:
|
||||
go_blackrockaltar = 0;
|
||||
go_portcullis_active = 0;
|
||||
go_portcullis_tobossrooms = 0;
|
||||
memset(go_roomrunes, 0, sizeof(go_roomrunes));
|
||||
memset(go_emberseerrunes, 0, sizeof(go_emberseerrunes));
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) OVERRIDE
|
||||
|
||||
@@ -186,6 +186,7 @@ hyjal_trashAI::hyjal_trashAI(Creature* creature) : npc_escortAI(creature)
|
||||
faction = 0;
|
||||
useFlyPath = false;
|
||||
damageTaken = 0;
|
||||
memset(DummyTarget, 0, sizeof(DummyTarget));
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ HmacHash::HmacHash(uint32 len, uint8 *seed)
|
||||
{
|
||||
HMAC_CTX_init(&m_ctx);
|
||||
HMAC_Init_ex(&m_ctx, seed, len, EVP_sha1(), NULL);
|
||||
memset(m_digest, 0, sizeof(m_digest));
|
||||
}
|
||||
|
||||
HmacHash::~HmacHash()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "DBCFileLoader.h"
|
||||
#include "Errors.h"
|
||||
|
||||
DBCFileLoader::DBCFileLoader() : fieldsOffset(NULL), data(NULL), stringTable(NULL) { }
|
||||
DBCFileLoader::DBCFileLoader() : recordSize(0), recordCount(0), fieldCount(0), stringSize(0), fieldsOffset(NULL), data(NULL), stringTable(NULL) { }
|
||||
|
||||
bool DBCFileLoader::Load(const char* filename, const char* fmt)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,12 @@ private:
|
||||
uint32 _lastChange;
|
||||
uint32 _delaytime;
|
||||
public:
|
||||
FreezeDetectorRunnable() { _delaytime = 0; }
|
||||
FreezeDetectorRunnable()
|
||||
{
|
||||
_loops = 0;
|
||||
_lastChange = 0;
|
||||
_delaytime = 0;
|
||||
}
|
||||
|
||||
void SetDelayTime(uint32 t) { _delaytime = t; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user