Core/Misc: Fixed some of the Coverity defects

This commit is contained in:
Intel
2014-12-01 02:25:29 +02:00
parent 1153b89d3d
commit 44cede7684
8 changed files with 27 additions and 29 deletions

View File

@@ -598,7 +598,7 @@ struct ItemEffect
{
uint32 SpellID;
uint32 Trigger;
uint32 Charges;
int32 Charges;
int32 Cooldown;
uint32 Category;
int32 CategoryCooldown;

View File

@@ -359,7 +359,7 @@ void WorldSession::HandleMovementOpcodes(WorldPackets::Movement::ClientPlayerMov
mover->UpdatePosition(movementInfo.pos);
WorldPackets::Movement::ServerPlayerMovement playerMovement;
playerMovement.mover = mover;
playerMovement.movementInfo = &mover->m_movementInfo;
mover->SendMessageToSet(const_cast<WorldPacket*>(playerMovement.Write()), _player);
if (plrMover) // nothing is charmed, or player charmed

View File

@@ -143,8 +143,8 @@ namespace WorldPackets
ObjectGuid SenderAccountGUID;
ObjectGuid TargetGUID;
ObjectGuid PartyGUID;
uint32 SenderVirtualAddress;
uint32 TargetVirtualAddress;
uint32 SenderVirtualAddress = 0;
uint32 TargetVirtualAddress = 0;
std::string SenderName;
std::string TargetName;
std::string Prefix;
@@ -165,7 +165,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
ObjectGuid Guid;
int32 EmoteID;
int32 EmoteID = 0;
};
class CTextEmote final : public ClientPacket
@@ -176,8 +176,8 @@ namespace WorldPackets
void Read() override;
ObjectGuid Target;
int32 EmoteID;
int32 SoundIndex;
int32 EmoteID = 0;
int32 SoundIndex = -1;
};
class STextEmote final : public ServerPacket
@@ -190,8 +190,8 @@ namespace WorldPackets
ObjectGuid SourceGUID;
ObjectGuid SourceAccountGUID;
ObjectGuid TargetGUID;
int32 SoundIndex;
int32 EmoteID;
int32 SoundIndex = -1;
int32 EmoteID = 0;
};
}
}

View File

@@ -31,8 +31,8 @@ namespace WorldPackets
WorldPacket const* Write() override;
uint32 ProficiencyMask;
uint8 ProficiencyClass;
uint32 ProficiencyMask = 0;
uint8 ProficiencyClass = 0;
};
struct ItemBonusInstanceData

View File

@@ -300,9 +300,7 @@ WorldPacket const* WorldPackets::Movement::MoveSetFlag::Write()
WorldPacket const* WorldPackets::Movement::ServerPlayerMovement::Write()
{
MovementInfo movementInfo = mover->m_movementInfo;
_worldPacket << movementInfo;
_worldPacket << *movementInfo;
return &_worldPacket;
}

View File

@@ -43,23 +43,23 @@ namespace WorldPackets
WorldPacket const* Write() override;
Unit* mover;
MovementInfo* movementInfo = nullptr;
};
struct MonsterSplineFilterKey
{
int16 Idx;
int16 Speed;
int16 Idx = 0;
int16 Speed = 0;
};
struct MonsterSplineFilter
{
std::vector<MonsterSplineFilterKey> FilterKeys;
uint8 FilterFlags;
float BaseSpeed;
int16 StartOffset;
float DistToPrevFilterKey;
int16 AddedToStart;
uint8 FilterFlags = 0;
float BaseSpeed = 0.0f;
int16 StartOffset = 0;
float DistToPrevFilterKey = 0.0f;
int16 AddedToStart = 0;
};
struct MovementSpline
@@ -86,7 +86,7 @@ namespace WorldPackets
struct MovementMonsterSpline
{
uint32 ID;
uint32 ID = 0;
G3D::Vector3 Destination;
bool CrzTeleport = false;
MovementSpline Move;
@@ -134,7 +134,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
MovementInfo* movementInfo;
MovementInfo* movementInfo = nullptr;
float Speed = 1.0f;
};
@@ -196,8 +196,8 @@ namespace WorldPackets
WorldPacket const* Write() override;
int32 MapID = 0;
uint32 Reason = 0;
int32 MapID = 0;
uint32 Reason = 0;
Position Pos;
};
@@ -247,7 +247,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
MovementInfo* movementInfo;
MovementInfo* movementInfo = nullptr;
std::vector<MovementForce> MovementForces;
Optional<float> SwimBackSpeed;
Optional<float> FlightSpeed;

View File

@@ -181,7 +181,7 @@ namespace WorldPackets
void Read() override;
uint32 TableHash;
uint32 TableHash = 0;
std::vector<DBQueryRecord> Queries;
};

View File

@@ -60,7 +60,7 @@ class PlayerTextBuilder
{
std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale);
WorldPackets::Chat::Chat packet;
return ChatHandler::BuildChatPacket(&packet, _msgType, Language(_language), _talker, _target, text, 0, "", locale);
ChatHandler::BuildChatPacket(&packet, _msgType, Language(_language), _talker, _target, text, 0, "", locale);
data = *packet.Write();
}