Fix various warnings. The core, the scripts and the tools now compile without warnings with -Wall -Wextra -pedantic.

-Fix warnings from -Woverflow on implicit constant conversion.
-Fix warnings from -pedantic.
-Fix warnings from -pedantic.
-Fix warnings from -Wformat.

Two minor changes in addition :

-Replace a defined value equal to 2^31 - 1 by std::numeric_limits<int>::max().
-Remove useless null-check on pointer returned by new. New doesn't returns nullptr on failure, it throws std::bad_alloc.
This commit is contained in:
Praetonus committed 2014-05-15 21:32:47 +02:00
1 parent 9d760098a5
commit f296095191
130 files changed
+799 -801

No files matched your search

+2 -5
View File
@@ -1020,7 +1020,7 @@ public:
}
else
{
if (newmoney > MAX_MONEY_AMOUNT)
if (newmoney > static_cast<int32>(MAX_MONEY_AMOUNT))
newmoney = MAX_MONEY_AMOUNT;
handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(moneyToAdd), handler->GetNameLink(target).c_str());
@@ -1035,10 +1035,7 @@ public:
if (handler->needReportToTarget(target))
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd);
if (moneyToAdd >= MAX_MONEY_AMOUNT)
moneyToAdd = MAX_MONEY_AMOUNT;
if (targetMoney >= uint32(MAX_MONEY_AMOUNT) - moneyToAdd)
if (targetMoney >= MAX_MONEY_AMOUNT - moneyToAdd)
moneyToAdd -= targetMoney;
target->ModifyMoney(moneyToAdd);