From 45d0bd6299f2f7c0252ee3e8a7497274bc2f0ab4 Mon Sep 17 00:00:00 2001 From: tetyys Date: Wed, 26 Sep 2018 22:21:38 +0300 Subject: [PATCH] Changed LimitedQueue::space() to signed value, eliminating underflows --- src/messages/LimitedQueue.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/messages/LimitedQueue.hpp b/src/messages/LimitedQueue.hpp index 5165efa94..c52d4a35c 100644 --- a/src/messages/LimitedQueue.hpp +++ b/src/messages/LimitedQueue.hpp @@ -32,7 +32,7 @@ protected: typedef std::shared_ptr> ChunkVector; public: - LimitedQueue(int limit = 1000) + LimitedQueue(size_t limit = 1000) : limit_(limit) { this->clear(); @@ -106,7 +106,7 @@ public: } // create new chunk for the first one - size_t offset = std::min(this->space(), items.size()); + size_t offset = std::min(this->space(), static_cast(items.size())); Chunk newFirstChunk = std::make_shared>(); newFirstChunk->resize(this->chunks_->front()->size() + offset); @@ -214,7 +214,7 @@ public: } private: - size_t space() + qsizetype space() { size_t totalSize = 0; for (Chunk &chunk : *this->chunks_) {