From c6f13ed7432b8f9f75f8ea9386bd6cb0aefa09fb Mon Sep 17 00:00:00 2001 From: Christian Speckner Date: Sat, 9 Dec 2017 20:44:27 +0100 Subject: [PATCH] Trade potentially illegal use of size_t against container::size_type. --- src/common/LinkedObjectPool.hxx | 3 ++- src/common/RewindManager.cxx | 4 ++-- src/common/RewindManager.hxx | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/LinkedObjectPool.hxx b/src/common/LinkedObjectPool.hxx index 8d358f84a..f10bd22e9 100644 --- a/src/common/LinkedObjectPool.hxx +++ b/src/common/LinkedObjectPool.hxx @@ -55,6 +55,7 @@ class LinkedObjectPool public: using iter = typename std::list::iterator; using const_iter = typename std::list::const_iterator; + using size_type = typename std::list::size_type; /* Create a pool of size CAPACITY; the active list starts out empty. @@ -200,7 +201,7 @@ class LinkedObjectPool #endif uInt32 capacity() const { return CAPACITY; } - size_t size() const { return myList.size(); } + size_type size() const { return myList.size(); } bool empty() const { return myList.size() == 0; } bool full() const { return myList.size() >= CAPACITY; } diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx index 4193ff375..1b2841a83 100644 --- a/src/common/RewindManager.cxx +++ b/src/common/RewindManager.cxx @@ -126,9 +126,9 @@ void RewindManager::compressStates() uInt64 lastCycle = currentCycle; double expectedCycles = 76 * 262.0; // == cycles of 1 frame, TODO: use actual number of scanlines double maxDelta = 0; - size_t removeIdx = 0; + size_type removeIdx = 0; - size_t idx = myStateList.size() - 1; + size_type idx = myStateList.size() - 1; for(auto it = myStateList.last(); it != myStateList.first(); --it) { cerr << *it << endl << endl; // debug code diff --git a/src/common/RewindManager.hxx b/src/common/RewindManager.hxx index 295fe6799..17740d159 100644 --- a/src/common/RewindManager.hxx +++ b/src/common/RewindManager.hxx @@ -99,6 +99,8 @@ class RewindManager } }; + using size_type = Common::LinkedObjectPool::size_type; + // The linked-list to store states (internally it takes care of reducing // frequent (de)-allocations) Common::LinkedObjectPool myStateList;