mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
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:
@@ -352,6 +352,11 @@ public:
|
|||||||
T* begin()
|
T* begin()
|
||||||
/// Returns the pointer to the beginning of the buffer.
|
/// 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();
|
return _buffer.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,6 +366,12 @@ public:
|
|||||||
if (available() == 0)
|
if (available() == 0)
|
||||||
throw InvalidAccessException("Buffer is full.");
|
throw InvalidAccessException("Buffer is full.");
|
||||||
|
|
||||||
|
if (_begin != 0)
|
||||||
|
{
|
||||||
|
std::memmove(_buffer.begin(), _buffer.begin() + _begin, _used * sizeof(T));
|
||||||
|
_begin = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return _buffer.begin() + _used;
|
return _buffer.begin() + _used;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user