diff options
author | Shauren <shauren.trinity@gmail.com> | 2012-09-04 14:40:41 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2012-09-04 14:40:41 +0200 |
commit | 1e9fc84a12ae08516328127c5e22f0d64bafc715 (patch) | |
tree | 858e4e7dca993aa350b99a20f569cb204b9cfc97 /src/server/shared/Utilities/Util.h | |
parent | b2bcc52fdaaef8752e72dbff9e300f168bf9a110 (diff) |
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'
Diffstat (limited to 'src/server/shared/Utilities/Util.h')
-rwxr-xr-x | src/server/shared/Utilities/Util.h | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 196882dc2a0..64a89885350 100755 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -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 |