mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Changed LimitedQueue::space() to signed value, eliminating underflows
This commit is contained in:
parent
4c5a0472cd
commit
45d0bd6299
|
@ -32,7 +32,7 @@ protected:
|
||||||
typedef std::shared_ptr<std::vector<Chunk>> ChunkVector;
|
typedef std::shared_ptr<std::vector<Chunk>> ChunkVector;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LimitedQueue(int limit = 1000)
|
LimitedQueue(size_t limit = 1000)
|
||||||
: limit_(limit)
|
: limit_(limit)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
|
@ -106,7 +106,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// create new chunk for the first one
|
// 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<qsizetype>(items.size()));
|
||||||
Chunk newFirstChunk = std::make_shared<std::vector<T>>();
|
Chunk newFirstChunk = std::make_shared<std::vector<T>>();
|
||||||
newFirstChunk->resize(this->chunks_->front()->size() + offset);
|
newFirstChunk->resize(this->chunks_->front()->size() + offset);
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t space()
|
qsizetype space()
|
||||||
{
|
{
|
||||||
size_t totalSize = 0;
|
size_t totalSize = 0;
|
||||||
for (Chunk &chunk : *this->chunks_) {
|
for (Chunk &chunk : *this->chunks_) {
|
||||||
|
|
Loading…
Reference in a new issue