Core/Misc: Fixed issues found by coverity

CID 1374575, 1374574, 1374573, 1374572, 1374563, 1374556
This commit is contained in:
Shauren
2017-04-26 18:01:50 +02:00
parent 65eefebe43
commit 2f859ffd2e
8 changed files with 14 additions and 18 deletions

View File

@@ -766,7 +766,7 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
for (NamesReservedLocaleEntry const* namesReserved : sNamesReservedLocaleStore)
{
ASSERT(!(namesReserved->LocaleMask & ~((1 << TOTAL_LOCALES) - 1)));
ASSERT(!(namesReserved->LocaleMask & ~((1u << TOTAL_LOCALES) - 1)));
std::wstring name;
ASSERT(Utf8toWStr(namesReserved->Name, name));
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)

View File

@@ -105,6 +105,7 @@ public:
AreaTriggerTemplate()
{
Id = 0;
Type = AREATRIGGER_TYPE_MAX;
Flags = 0;
ScriptId = 0;
MaxSearchRadius = 0.0f;

View File

@@ -660,7 +660,7 @@ typedef std::list<VendorItemCount> VendorItemCounts;
struct TrainerSpell
{
TrainerSpell() : SpellID(0), MoneyCost(0), ReqSkillLine(0), ReqSkillRank(0), ReqLevel(0)
TrainerSpell() : SpellID(0), MoneyCost(0), ReqSkillLine(0), ReqSkillRank(0), ReqLevel(0), Index(0)
{
for (uint8 i = 0; i < MAX_TRAINERSPELL_ABILITY_REQS; ++i)
ReqAbility[i] = 0;

View File

@@ -26795,14 +26795,12 @@ float Player::GetAverageItemLevel() const
if (i == EQUIPMENT_SLOT_TABARD || i == EQUIPMENT_SLOT_RANGED || i == EQUIPMENT_SLOT_OFFHAND || i == EQUIPMENT_SLOT_BODY)
continue;
if (m_items[i] && m_items[i]->GetTemplate())
if (m_items[i])
sum += m_items[i]->GetItemLevel(this);
++count;
}
if (count == 0)
return 0;
return ((float)sum) / count;
}

View File

@@ -13207,14 +13207,11 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form) const
break;
}
}
else
{
if (Player::TeamForRace(getRace()) == ALLIANCE)
return (getRace() == RACE_WORGEN ? 37729 : 21243);
if (getRace() == RACE_TROLL)
return 37730;
return 21244;
}
if (Player::TeamForRace(getRace()) == ALLIANCE)
return (getRace() == RACE_WORGEN ? 37729 : 21243);
if (getRace() == RACE_TROLL)
return 37730;
return 21244;
case FORM_MOONKIN_FORM:
{
switch (getRace())

View File

@@ -218,8 +218,8 @@ namespace WorldPackets
ComplaintOffender Offender;
uint32 MailID = 0;
ComplaintChat Chat;
uint64 EventGuid;
uint64 InviteGuid;
uint64 EventGuid = 0;
uint64 InviteGuid = 0;
};
class ComplaintResult final : public ServerPacket

View File

@@ -19,7 +19,7 @@
#include "Database/DatabaseEnv.h"
#include "DB2Meta.h"
DB2LoadInfo::DB2LoadInfo() : DB2FileLoadInfo()
DB2LoadInfo::DB2LoadInfo() : DB2FileLoadInfo(), Statement(MAX_HOTFIXDATABASE_STATEMENTS)
{
}

View File

@@ -604,8 +604,8 @@ class TC_SHARED_API ByteBuffer
void append(const ByteBuffer& buffer)
{
if (buffer.wpos())
append(buffer.contents(), buffer.wpos());
if (!buffer.empty())
append(buffer.contents(), buffer.size());
}
// can be used in SMSG_MONSTER_MOVE opcode