possibly important fix for ring buffer write

This commit is contained in:
Robin Müller 2022-03-23 16:48:17 +01:00
parent e08bdd3e35
commit df97c582d7

View File

@ -48,6 +48,9 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) {
} }
ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) { ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) {
if(amount > maxSize()) {
return HasReturnvaluesIF::RETURN_FAILED;
}
if (availableWriteSpace() >= amount or overwriteOld) { if (availableWriteSpace() >= amount or overwriteOld) {
size_t amountTillWrap = writeTillWrap(); size_t amountTillWrap = writeTillWrap();
if (amountTillWrap >= amount) { if (amountTillWrap >= amount) {