Core/Misc: Fix some static analysis issues

Fix some static analysis issues about uninitialized values. Most of them are false positives, always initialized before being accessed, while some of them are real issues spotted by valgrind too.
This commit is contained in:
jackpoz committed 2013-12-14 18:41:26 +01:00
1 parent dd546f073a
commit 1c0903e286
40 files changed
+203 -19

No files matched your search

+1
View File
@@ -364,6 +364,7 @@ LootItem::LootItem(LootStoreItem const& li)
randomSuffix = GenerateEnchSuffixFactor(itemid);
randomPropertyId = Item::GenerateItemRandomPropertyId(itemid);
count = 0;
is_looted = 0;
is_blocked = 0;
is_underthreshold = 0;
+4 -2
View File
@@ -148,7 +148,9 @@ struct LootItem
explicit LootItem(LootStoreItem const& li);
// Empty constructor for creating an empty LootItem to be filled in with DB data
LootItem() : canSave(true){ };
LootItem() : itemid(0), randomSuffix(0), randomPropertyId(0), count(0), is_looted(false), is_blocked(false),
freeforall(false), is_underthreshold(false), is_counted(false), needs_quest(false), follow_loot_rules(false),
canSave(true){ };
// Basic checks for player/item compatibility - if false no chance to see the item in the loot
bool AllowedForPlayer(Player const* player) const;
@@ -303,7 +305,7 @@ struct Loot
// Only set for inventory items that can be right-click looted
uint32 containerID;
Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { }
Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { }
~Loot() { clear(); }
// For deleting items at loot removal since there is no backward interface to the Item()