Commit 91ed6916 authored by Ian Roddis's avatar Ian Roddis

Correctly setting the get pointer on ArrayStreamBuffer::feed()

parent 6f757654
......@@ -97,9 +97,15 @@ public:
bool feed(const char* data, size_t len) {
if (bytes.size() + len > MAX_SIZE) { return false; }
// get current offset
size_t readOffset = static_cast<size_t>(this->gptr() - this->eback());
std::copy(data, data + len, std::back_inserter(bytes));
if (readOffset == 0) {
readOffset = bytes.size() - len;
}
Base::setg(bytes.data()
, bytes.data() + bytes.size() - len
, bytes.data() + readOffset
, bytes.data() + bytes.size());
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment