From 8916d1415f09ca273204a70d47d20ec6383ad5f5 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 31 Jul 2022 09:23:02 +0200 Subject: [PATCH] Revert "add RinStream::peek()" This reverts commit 26fc11d1a6c8a464fb29e517d0f148c5798b78e6. --- RingStream.cpp | 13 ++++++------- RingStream.h | 6 ++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/RingStream.cpp b/RingStream.cpp index 51a77d2..3197275 100644 --- a/RingStream.cpp +++ b/RingStream.cpp @@ -95,22 +95,21 @@ _count=prevCount+plength; return plength; } -int RingStream::read(byte advance) { +int RingStream::read() { if (_flashInsert) { // we are reading out of a flash string byte fb=GETFLASH(_flashInsert); - _flashInsert+=advance; + _flashInsert++; if (fb) return fb; // we have a byte from the flash // flash insert complete, clear and drop through to next buffer byte _flashInsert=NULL; } if ((_pos_read==_pos_write) && !_overflow) return -1; // empty - byte b=readRawByte(advance); + byte b=readRawByte(); if (b!=FLASH_INSERT_MARKER) return b; // Detected a flash insert // read address bytes LSB first (size depends on CPU) - if (advance == 0) readRawByte(); // read past it anyway uintptr_t iFlash=0; for (byte f=0; f( iFlash); // and try again... so will read the first byte of the insert. - return read(advance); + return read(); } -byte RingStream::readRawByte(byte advance) { +byte RingStream::readRawByte() { byte b=_buffer[_pos_read]; - _pos_read+=advance; + _pos_read++; if (_pos_read==_len) _pos_read=0; _overflow=false; return b; diff --git a/RingStream.h b/RingStream.h index 45b1c4e..a3bb7d0 100644 --- a/RingStream.h +++ b/RingStream.h @@ -39,8 +39,7 @@ class RingStream : public Print { virtual int availableForWrite() override; using Print::write; size_t printFlash(const FSH * flashBuffer); - inline int read() { return read(1); }; - inline int peek() { return read(0); }; + int read(); int count(); int freeSpace(); void mark(uint8_t b); @@ -48,9 +47,8 @@ class RingStream : public Print { uint8_t peekTargetMark(); void flush(); void info(); + byte readRawByte(); private: - int read(byte advance); - byte readRawByte(byte advance=1); int _len; int _pos_write; int _pos_read;