diff options
Diffstat (limited to 'ByteBuffer.cpp')
-rw-r--r-- | ByteBuffer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ByteBuffer.cpp b/ByteBuffer.cpp index 2d4a258..d60ad6f 100644 --- a/ByteBuffer.cpp +++ b/ByteBuffer.cpp @@ -73,12 +73,12 @@ ByteBuffer ByteBuffer::view(uint8_t *ptr, const uint8_t *end) const { } void ByteBuffer::checkAndUpdateEnd(size_t newBytes) { - uint8_t *newPtr = ptr + newBytes; - if (newPtr >= end) { - if (newPtr >= &zero[capacity]) { - throw ByteBufferException(string("New size is too large! cursor=") + to_string(getCursor()) + ", size=" + to_string(getSize()) + ", capacity=" + to_string(capacity)); + uint8_t *newEnd = ptr + newBytes; + if (newEnd >= end) { + if (newEnd >= &zero[capacity]) { + throw ByteBufferException(string("New size is too large! cursor=") + to_string(getCursor()) + ", size=" + to_string(getSize()) + ", capacity=" + to_string(capacity) + ", new bytes=" + to_string(newBytes)); } - end = newPtr; + end = newEnd; } } |