WIP: somethings wrong.. #19

Closed
muellerr wants to merge 808 commits from source/master into master
2 changed files with 17 additions and 5 deletions
Showing only changes of commit 4e9e465360 - Show all commits

View File

@ -2,16 +2,28 @@
#include <cstring>
SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld,
size_t maxExcessBytes) :
size_t maxExcessBytes) :
RingBufferBase<>(0, size, overwriteOld),
maxExcessBytes(maxExcessBytes) {
if(maxExcessBytes > size) {
this->maxExcessBytes = size;
}
else {
this->maxExcessBytes = maxExcessBytes;
}
buffer = new uint8_t[size + maxExcessBytes];
}
SimpleRingBuffer::SimpleRingBuffer(uint8_t *buffer, const size_t size,
bool overwriteOld, size_t maxExcessBytes):
RingBufferBase<>(0, size, overwriteOld), buffer(buffer),
maxExcessBytes(maxExcessBytes) {}
bool overwriteOld, size_t maxExcessBytes):
RingBufferBase<>(0, size, overwriteOld), buffer(buffer) {
if(maxExcessBytes > size) {
this->maxExcessBytes = size;
}
else {
this->maxExcessBytes = maxExcessBytes;
}
}
SimpleRingBuffer::~SimpleRingBuffer() {

View File

@ -111,7 +111,7 @@ public:
private:
static const uint8_t READ_PTR = 0;
uint8_t* buffer = nullptr;
const size_t maxExcessBytes;
size_t maxExcessBytes;
size_t excessBytes = 0;
};