diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-02-17 23:40:12 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-02-17 23:40:12 +0100 |
commit | dd6a36ea62b8c3e5f20f6d5fd432dec2275aac5a (patch) | |
tree | 40174dc2bd5ab8342da433eb4adea939c0df712f /ByteBuffer.cpp | |
parent | 08c735d7520e858868bc2c724572139998e39ada (diff) | |
download | ble-toys-dd6a36ea62b8c3e5f20f6d5fd432dec2275aac5a.tar.gz ble-toys-dd6a36ea62b8c3e5f20f6d5fd432dec2275aac5a.tar.bz2 ble-toys-dd6a36ea62b8c3e5f20f6d5fd432dec2275aac5a.tar.xz ble-toys-dd6a36ea62b8c3e5f20f6d5fd432dec2275aac5a.zip |
o Finally correct decoding of ATT response.
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; } } |