diff options
author | Pär Björklund <per.bjorklund@gmail.com> | 2016-01-30 18:03:55 +0100 |
---|---|---|
committer | Pär Björklund <per.bjorklund@gmail.com> | 2016-02-02 19:08:26 +0100 |
commit | 1ea2d0cbc86ccb464222f37801d32bfa9463d301 (patch) | |
tree | cfe3a1ab033801a3390910a906866b3c23ac8a97 /lib/win32 | |
parent | 166f3e9bd3262228c54adb935564e2a3352f0807 (diff) |
Fixes that have come from the migration to vs2015
Missing include of iterator
Don't wait on addon update job when no repositories are found
whitespace changes
naming collisions
Diffstat (limited to 'lib/win32')
-rw-r--r-- | lib/win32/Effects11/inc/d3dxGlobal.h | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/lib/win32/Effects11/inc/d3dxGlobal.h b/lib/win32/Effects11/inc/d3dxGlobal.h index 5ea281388b..910e1d4b4c 100644 --- a/lib/win32/Effects11/inc/d3dxGlobal.h +++ b/lib/win32/Effects11/inc/d3dxGlobal.h @@ -54,7 +54,7 @@ using namespace D3DX11Debug; #if FXDEBUG #define __BREAK_ON_FAIL { __debugbreak(); } #else -#define __BREAK_ON_FAIL +#define __BREAK_ON_FAIL #endif #define VA(x, action) { hr = (x); if (FAILED(hr)) { action; __BREAK_ON_FAIL; return hr; } } @@ -138,7 +138,6 @@ _declspec(selectany) unsigned int g_TimerRolloverCount = 0x80000000; #endif // _DEBUG && !_M_X64 - ////////////////////////////////////////////////////////////////////////// // CEffectVector - A vector implementation ////////////////////////////////////////////////////////////////////////// @@ -228,7 +227,7 @@ public: HRESULT hr = S_OK; Clear(); VN( m_pData = new uint8_t[vOther.m_MaxSize * sizeof(T)] ); - + m_CurSize = vOther.m_CurSize; m_MaxSize = vOther.m_MaxSize; m_hLastError = vOther.m_hLastError; @@ -271,10 +270,10 @@ lExit: void Empty() { - + // manually invoke destructor on all elements for (size_t i = 0; i < m_CurSize; ++ i) - { + { ((T*)m_pData + i)->~T(); } m_CurSize = 0; @@ -341,7 +340,7 @@ lExit: HRESULT Insert(_In_ const T& var, _In_ uint32_t index) { assert(index < m_CurSize); - + if (FAILED(Grow())) return m_hLastError; @@ -355,7 +354,7 @@ lExit: HRESULT InsertRange(_In_reads_(count) const T *pVar, _In_ uint32_t index, _In_ uint32_t count) { assert(index < m_CurSize); - + if (m_CurSize + count < m_CurSize) { m_hLastError = E_OUTOFMEMORY; @@ -409,7 +408,7 @@ lExit: uint32_t FindIndexOf(_In_ const void *pEntry) const { for (size_t i = 0; i < m_CurSize; ++ i) - { + { if (((T*)m_pData + i) == pEntry) return i; } @@ -555,7 +554,6 @@ public: typedef CheckedNumber<uint32_t, _UI32_MAX> CCheckedDword; typedef CheckedNumber<uint64_t, _UI64_MAX> CCheckedDword64; - ////////////////////////////////////////////////////////////////////////// // Data Block Store - A linked list of allocations ////////////////////////////////////////////////////////////////////////// @@ -585,7 +583,6 @@ public: friend class CDataBlockStore; }; - class CDataBlockStore { protected: @@ -620,7 +617,7 @@ public: // The trick is that we never free, so we don't have to keep as much state around // Use PRIVATENEW in CEffectLoader -static void* __cdecl operator new(_In_ size_t s, _In_ CDataBlockStore &pAllocator) +inline void* __cdecl operator new(_In_ size_t s, _In_ CDataBlockStore &pAllocator) { #ifdef _M_X64 assert( s <= 0xffffffff ); @@ -628,13 +625,12 @@ static void* __cdecl operator new(_In_ size_t s, _In_ CDataBlockStore &pAllocato return pAllocator.Allocate( (uint32_t)s ); } -static void __cdecl operator delete(_In_opt_ void* p, _In_ CDataBlockStore &pAllocator) +inline void __cdecl operator delete(_In_opt_ void* p, _In_ CDataBlockStore &pAllocator) { UNREFERENCED_PARAMETER(p); UNREFERENCED_PARAMETER(pAllocator); } - ////////////////////////////////////////////////////////////////////////// // Hash table ////////////////////////////////////////////////////////////////////////// @@ -671,7 +667,7 @@ static uint32_t ComputeHash(_In_reads_bytes_(cbToHash) const uint8_t *pb, _In_ u c += pdw[2]; HASH_MIX(a,b,c); - pb += 12; + pb += 12; cbLeft -= 12; } @@ -720,7 +716,7 @@ static uint32_t ComputeHashLower(_In_reads_bytes_(cbToHash) const uint8_t *pb, _ c += pdw[2]; HASH_MIX(a,b,c); - pb += 12; + pb += 12; cbLeft -= 12; } @@ -756,13 +752,12 @@ static uint32_t ComputeHash(_In_z_ LPCSTR pString) return ComputeHash(reinterpret_cast<const uint8_t*>(pString), (uint32_t)strlen(pString)); } - // 1) these numbers are prime // 2) each is slightly less than double the last // 4) each is roughly in between two powers of 2; // (2^n hash table sizes are VERY BAD; they effectively truncate your // precision down to the n least significant bits of the hash) -static const uint32_t c_PrimeSizes[] = +static const uint32_t c_PrimeSizes[] = { 11, 23, @@ -871,7 +866,7 @@ public: // seize this hash entry, migrate it to the new table SHashEntry *pNewEntry; VN( pNewEntry = new SHashEntry ); - + pNewEntry->pNext = rgpNewHashEntries[index]; pNewEntry->Data = iter.pHashEntry->Data; pNewEntry->Hash = iter.pHashEntry->Hash; @@ -942,7 +937,7 @@ public: return DesiredSize; } - + // O(n) function // Grows to the next suitable size (based off of the prime number table) // DesiredSize is merely a suggestion @@ -968,10 +963,10 @@ public: else { OwnProvidedArray = true; - + VN( rgpNewHashEntries = new SHashEntry*[actualSize] ); } - + ZeroMemory(rgpNewHashEntries, sizeof(SHashEntry*) * actualSize); // Expensive operation: rebuild the hash table @@ -1025,7 +1020,7 @@ lExit: DPF(0, "Uninitialized hash table!"); return; } - + float variance = 0.0f; float mean = (float)m_NumEntries / (float)m_NumHashSlots; uint32_t unusedSlots = 0; @@ -1040,7 +1035,7 @@ lExit: while (nullptr != pCurrentEntry) { SHashEntry *pCurrentEntry2 = m_rgpHashEntries[i]; - + // check other hash entries in this slot for hash collisions or duplications while (pCurrentEntry2 != pCurrentEntry) { @@ -1067,7 +1062,7 @@ lExit: { ++ unusedSlots; } - + // mean must be greater than 0 at this point variance += (float)entries * (float)entries / mean; } |