Changed FIFOBuffer's next() to reset FIFO data to the start of the internal buffer to make it compatible with writing to the next() pointer.

This commit is contained in:
Jonathan S 2015-02-21 20:31:44 -05:00
parent d89f41add0
commit 30ae0afd7b

View File

@ -352,6 +352,11 @@ public:
T* begin()
/// Returns the pointer to the beginning of the buffer.
{
if (_begin != 0)
{
std::memmove(_buffer.begin(), _buffer.begin() + _begin, _used * sizeof(T));
_begin = 0;
}
return _buffer.begin();
}
@ -361,6 +366,12 @@ public:
if (available() == 0)
throw InvalidAccessException("Buffer is full.");
if (_begin != 0)
{
std::memmove(_buffer.begin(), _buffer.begin() + _begin, _used * sizeof(T));
_begin = 0;
}
return _buffer.begin() + _used;
}