diff options
| author | Shauren <shauren.trinity@gmail.com> | 2017-06-07 17:23:50 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2017-06-07 17:23:50 +0200 |
| commit | 4226eb2ea56a13f1e499b80e51cb73748cff82a1 (patch) | |
| tree | 3cf644eaebb18b2426583c948d163d14176a220b /src/common | |
| parent | 7e9a0414708ed1f9373c4c0e87ade501d3f7bc98 (diff) | |
Core/Misc: Some /W4 warning fixes
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/Cryptography/SHA256.cpp | 4 | ||||
| -rw-r--r-- | src/common/Cryptography/SHA256.h | 8 | ||||
| -rw-r--r-- | src/common/DataStores/DB2FileLoader.cpp | 4 | ||||
| -rw-r--r-- | src/common/Utilities/EventMap.cpp | 4 | ||||
| -rw-r--r-- | src/common/Utilities/EventMap.h | 4 | ||||
| -rw-r--r-- | src/common/Utilities/Random.cpp | 4 | ||||
| -rw-r--r-- | src/common/Utilities/Util.cpp | 2 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/common/Cryptography/SHA256.cpp b/src/common/Cryptography/SHA256.cpp index abb254d7f3a..976c9ade2ac 100644 --- a/src/common/Cryptography/SHA256.cpp +++ b/src/common/Cryptography/SHA256.cpp @@ -31,9 +31,9 @@ SHA256Hash::~SHA256Hash() SHA256_Init(&mC); } -void SHA256Hash::UpdateData(const uint8 *dta, int len) +void SHA256Hash::UpdateData(uint8 const* data, size_t len) { - SHA256_Update(&mC, dta, len); + SHA256_Update(&mC, data, len); } void SHA256Hash::UpdateData(const std::string &str) diff --git a/src/common/Cryptography/SHA256.h b/src/common/Cryptography/SHA256.h index 1ad46bba51e..93583eb227d 100644 --- a/src/common/Cryptography/SHA256.h +++ b/src/common/Cryptography/SHA256.h @@ -35,14 +35,14 @@ class TC_COMMON_API SHA256Hash void UpdateBigNumbers(BigNumber* bn0, ...); - void UpdateData(const uint8 *dta, int len); - void UpdateData(const std::string &str); + void UpdateData(uint8 const* data, size_t len); + void UpdateData(std::string const& str); void Initialize(); void Finalize(); - uint8 *GetDigest(void) { return mDigest; } - int GetLength(void) const { return SHA256_DIGEST_LENGTH; } + uint8 *GetDigest() { return mDigest; } + uint32 GetLength() const { return SHA256_DIGEST_LENGTH; } private: SHA256_CTX mC; diff --git a/src/common/DataStores/DB2FileLoader.cpp b/src/common/DataStores/DB2FileLoader.cpp index 0dc9edb19f0..6e2b455f48d 100644 --- a/src/common/DataStores/DB2FileLoader.cpp +++ b/src/common/DataStores/DB2FileLoader.cpp @@ -1125,7 +1125,7 @@ uint32 DB2FileLoaderSparseImpl::RecordGetVarInt(unsigned char const* record, uin uint16 DB2FileLoaderSparseImpl::GetFieldOffset(uint32 field, uint32 arrayIndex) const { - return _fieldAndArrayOffsets[_fieldAndArrayOffsets[field] + arrayIndex]; + return uint16(_fieldAndArrayOffsets[_fieldAndArrayOffsets[field] + arrayIndex]); } uint16 DB2FileLoaderSparseImpl::GetFieldSize(uint32 field) const @@ -1139,7 +1139,7 @@ std::size_t* DB2FileLoaderSparseImpl::RecordCreateDetachedFieldOffsets(std::size if (oldOffsets != _fieldAndArrayOffsets) return oldOffsets; - uint32 size = _loadInfo->Meta->FieldCount + _loadInfo->FieldCount - (!_loadInfo->Meta->HasIndexFieldInData() ? 1 : 0); + std::size_t size = _loadInfo->Meta->FieldCount + _loadInfo->FieldCount - (!_loadInfo->Meta->HasIndexFieldInData() ? 1 : 0); std::size_t* newOffsets = new std::size_t[size]; memcpy(newOffsets, _fieldAndArrayOffsets, size * sizeof(std::size_t)); return newOffsets; diff --git a/src/common/Utilities/EventMap.cpp b/src/common/Utilities/EventMap.cpp index e1c46d0ae65..49d7b5ab7d4 100644 --- a/src/common/Utilities/EventMap.cpp +++ b/src/common/Utilities/EventMap.cpp @@ -33,7 +33,7 @@ void EventMap::SetPhase(uint8 phase) _phase = uint8(1 << (phase - 1)); } -void EventMap::ScheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/) +void EventMap::ScheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group /*= 0*/, uint8 phase /*= 0*/) { ScheduleEvent(eventId, urand(uint32(minTime.count()), uint32(maxTime.count())), group, phase); } @@ -49,7 +49,7 @@ void EventMap::ScheduleEvent(uint32 eventId, uint32 time, uint32 group /*= 0*/, _eventMap.insert(EventStore::value_type(_time + time, eventId)); } -void EventMap::RescheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/) +void EventMap::RescheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group /*= 0*/, uint8 phase /*= 0*/) { RescheduleEvent(eventId, urand(uint32(minTime.count()), uint32(maxTime.count())), group, phase); } diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h index 22899ea6b60..249ad3a12ab 100644 --- a/src/common/Utilities/EventMap.h +++ b/src/common/Utilities/EventMap.h @@ -134,7 +134,7 @@ public: * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. */ - void ScheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group = 0, uint32 phase = 0); + void ScheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group = 0, uint8 phase = 0); /** * @name ScheduleEvent @@ -168,7 +168,7 @@ public: * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. */ - void RescheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group = 0, uint32 phase = 0); + void RescheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group = 0, uint8 phase = 0); /** * @name RescheduleEvent diff --git a/src/common/Utilities/Random.cpp b/src/common/Utilities/Random.cpp index 890ba1b8fce..e53209cc1cb 100644 --- a/src/common/Utilities/Random.cpp +++ b/src/common/Utilities/Random.cpp @@ -66,8 +66,8 @@ Milliseconds randtime(Milliseconds const& min, Milliseconds const& max) { long long diff = max.count() - min.count(); ASSERT(diff >= 0); - ASSERT(diff <= (uint32)-1); - return min + Milliseconds(urand(0, diff)); + ASSERT(diff <= 0xFFFFFFFF); + return min + Milliseconds(urand(0, uint32(diff))); } uint32 rand32() diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index 05dfee273d8..315f8290c84 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -570,6 +570,6 @@ void HexStrToByteArray(std::string const& str, uint8* out, bool reverse /*= fals bool StringToBool(std::string const& str) { std::string lowerStr = str; - std::transform(str.begin(), str.end(), lowerStr.begin(), ::tolower); + std::transform(str.begin(), str.end(), lowerStr.begin(), [](char c) { return char(::tolower(c)); }); return lowerStr == "1" || lowerStr == "true" || lowerStr == "yes"; } |
