Core: Warning fixes
C4100: 'x' : unreferenced formal parameter C4310: cast truncates constant value C4389: '==' : signed/unsigned mismatch C4668: 'x' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' C4701: potentially uninitialized local variable 'x' used C4826: Conversion from 'HMODULE' to 'DWORD64' is sign-extended. This may cause unexpected runtime behavior. C6067: Parameter '3' in call to 'sprintf' must be the address of the string C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'CloseHandle'
This commit is contained in:
1 parent
b2bcc52fda
commit
1e9fc84a12
11 files changed
+27
-31
No files matched your search
@@ -364,7 +364,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
|
||||
return sScriptMgr->OnCriteriaCheck(this, const_cast<Player*>(source), const_cast<Unit*>(target));
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY:
|
||||
if (source->GetMap()->IsRaid())
|
||||
if (source->GetMap()->Is25ManRaid() != (difficulty.difficulty & RAID_DIFFICULTY_MASK_25MAN))
|
||||
if (source->GetMap()->Is25ManRaid() != ((difficulty.difficulty & RAID_DIFFICULTY_MASK_25MAN) != 0))
|
||||
return false;
|
||||
return source->GetMap()->GetSpawnMode() >= difficulty.difficulty;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
|
||||
|
||||
@@ -98,6 +98,12 @@ void Totem::InitSummon()
|
||||
|
||||
void Totem::UnSummon(uint32 msTime)
|
||||
{
|
||||
if (msTime)
|
||||
{
|
||||
m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(msTime));
|
||||
return;
|
||||
}
|
||||
|
||||
CombatStop();
|
||||
RemoveAurasDueToSpell(GetSpell(), GetGUID());
|
||||
|
||||
|
||||
@@ -1223,8 +1223,8 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
}
|
||||
if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
|
||||
{
|
||||
_liquidMap = new float[_liquidWidth*_liquidHeight];
|
||||
if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != _liquidWidth*_liquidHeight)
|
||||
_liquidMap = new float[uint32(_liquidWidth) * uint32(_liquidHeight)];
|
||||
if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != (uint32(_liquidWidth) * uint32(_liquidHeight)))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -140,7 +140,12 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
|
||||
angle = i_cur_angle + static_cast<float>(M_PI);
|
||||
distance /= 2;
|
||||
break;
|
||||
default:
|
||||
angle = 0.0f;
|
||||
distance = 0.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
temp_x = x + distance * cos(angle);
|
||||
temp_y = y + distance * sin(angle);
|
||||
Trinity::NormalizeMapCoord(temp_x);
|
||||
|
||||
@@ -766,7 +766,7 @@ void Aura::SetCharges(uint8 charges)
|
||||
|
||||
uint8 Aura::CalcMaxCharges(Unit* caster) const
|
||||
{
|
||||
uint8 maxProcCharges = m_spellInfo->ProcCharges;
|
||||
uint32 maxProcCharges = m_spellInfo->ProcCharges;
|
||||
if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
|
||||
maxProcCharges = procEntry->charges;
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ bool SpellEffectInfo::IsAura() const
|
||||
|
||||
bool SpellEffectInfo::IsAura(AuraType aura) const
|
||||
{
|
||||
return IsAura() && ApplyAuraName == aura;
|
||||
return IsAura() && ApplyAuraName == uint32(aura);
|
||||
}
|
||||
|
||||
bool SpellEffectInfo::IsTargetingArea() const
|
||||
|
||||
@@ -160,7 +160,7 @@ class go_broggok_lever : public GameObjectScript
|
||||
public:
|
||||
go_broggok_lever() : GameObjectScript("go_broggok_lever") {}
|
||||
|
||||
bool OnGossipHello(Player* player, GameObject* go)
|
||||
bool OnGossipHello(Player* /*player*/, GameObject* go)
|
||||
{
|
||||
if (InstanceScript* instance = go->GetInstanceScript())
|
||||
if (instance->GetData(TYPE_BROGGOK_EVENT) != DONE && instance->GetData(TYPE_BROGGOK_EVENT) != IN_PROGRESS)
|
||||
|
||||
@@ -409,11 +409,12 @@ void WheatyExceptionReport::printTracesForAllThreads()
|
||||
CONTEXT context;
|
||||
context.ContextFlags = 0xffffffff;
|
||||
HANDLE threadHandle = OpenThread(THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION, false, te32.th32ThreadID);
|
||||
if (threadHandle && GetThreadContext(threadHandle, &context))
|
||||
if (threadHandle)
|
||||
{
|
||||
WriteStackDetails(&context, false, threadHandle);
|
||||
if (GetThreadContext(threadHandle, &context))
|
||||
WriteStackDetails(&context, false, threadHandle);
|
||||
CloseHandle(threadHandle);
|
||||
}
|
||||
CloseHandle(threadHandle);
|
||||
}
|
||||
} while (Thread32Next(hThreadSnap, &te32));
|
||||
|
||||
@@ -521,7 +522,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
|
||||
_tprintf(_T("Global Variables\r\n"));
|
||||
|
||||
SymEnumSymbols(GetCurrentProcess(),
|
||||
(DWORD64)GetModuleHandle(szFaultingModule),
|
||||
(DWORD64)(DWORD)GetModuleHandle(szFaultingModule),
|
||||
0, EnumerateSymbolsCallback, 0);
|
||||
// #endif // X86 Only!
|
||||
|
||||
@@ -989,7 +990,7 @@ PVOID pAddress)
|
||||
if (!IsBadStringPtr(*(PSTR*)pAddress, 32))
|
||||
{
|
||||
pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%.31s\"",
|
||||
*(PDWORD)pAddress);
|
||||
*(PSTR*)pAddress);
|
||||
}
|
||||
else
|
||||
pszCurrBuffer += sprintf(pszCurrBuffer, " = %X",
|
||||
|
||||
@@ -59,7 +59,7 @@ void AppenderConsole::InitColors(std::string const& str)
|
||||
|
||||
void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
|
||||
{
|
||||
#if PLATFORM == PLATFORWINDOWS
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
static WORD WinColorFG[MaxColors] =
|
||||
{
|
||||
0, // BLACK
|
||||
@@ -146,7 +146,7 @@ void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
|
||||
|
||||
void AppenderConsole::ResetColor(bool stdout_stream)
|
||||
{
|
||||
#if PLATFORM == PLATFORWINDOWS
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
|
||||
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
|
||||
#else
|
||||
|
||||
@@ -92,7 +92,7 @@ Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve)
|
||||
|
||||
void stripLineInvisibleChars(std::string &str)
|
||||
{
|
||||
static std::string invChars = " \t\7\n";
|
||||
static std::string const invChars = " \t\7\n";
|
||||
|
||||
size_t wpos = 0;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ std::string TimeToTimestampStr(time_t t);
|
||||
inline uint32 secsToTimeBitFields(time_t secs)
|
||||
{
|
||||
tm* lt = localtime(&secs);
|
||||
return (lt->tm_year - 100) << 24 | lt->tm_mon << 20 | (lt->tm_mday - 1) << 14 | lt->tm_wday << 11 | lt->tm_hour << 6 | lt->tm_min;
|
||||
return uint32((lt->tm_year - 100) << 24 | lt->tm_mon << 20 | (lt->tm_mday - 1) << 14 | lt->tm_wday << 11 | lt->tm_hour << 6 | lt->tm_min);
|
||||
}
|
||||
|
||||
/* Return a random number in the range min..max; (max-min) must be smaller than 32768. */
|
||||
@@ -89,22 +89,6 @@ inline bool roll_chance_i(int chance)
|
||||
return chance > irand(0, 99);
|
||||
}
|
||||
|
||||
inline void ApplyModUInt32Var(uint32& var, int32 val, bool apply)
|
||||
{
|
||||
int32 cur = var;
|
||||
cur += (apply ? val : -val);
|
||||
if (cur < 0)
|
||||
cur = 0;
|
||||
var = cur;
|
||||
}
|
||||
|
||||
inline void ApplyModFloatVar(float& var, float val, bool apply)
|
||||
{
|
||||
var += (apply ? val : -val);
|
||||
if (var < 0)
|
||||
var = 0;
|
||||
}
|
||||
|
||||
inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
|
||||
{
|
||||
if (val == -100.0f) // prevent set var to zero
|
||||
|
||||
Reference in new issue
Block a user