aboutsummaryrefslogtreecommitdiff
path: root/ByteBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ByteBuffer.cpp')
-rw-r--r--ByteBuffer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/ByteBuffer.cpp b/ByteBuffer.cpp
index c5f7905..07672ec 100644
--- a/ByteBuffer.cpp
+++ b/ByteBuffer.cpp
@@ -41,12 +41,12 @@ uint8_t ByteBuffer::get8(size_t index) {
}
uint8_t ByteBuffer::get8() {
- assertCanAccessRelative(1);
+ assertCanAccessRelative(0);
return *ptr++;
}
uint16_t ByteBuffer::get16le() {
- assertCanAccessRelative(1);
+ assertCanAccessRelative(0);
uint16_t value;
value = *ptr++;
value |= ((uint16_t) *ptr++) << 8;
@@ -82,12 +82,12 @@ void ByteBuffer::checkAndUpdateEnd(size_t newBytes) {
}
void ByteBuffer::assertCanAccessRelative(size_t diff) const {
- assertCanAccessIndex(ptr + diff - 1);
+ assertCanAccessIndex(ptr + diff);
}
void ByteBuffer::assertCanAccessIndex(uint8_t *p) const {
if (p >= end || p < zero) {
- throw ByteBufferException(string("Out of bounds! size=") + to_string(getSize()));
+ throw ByteBufferException(string("Out of bounds! size=") + to_string(getSize()) + ", index=" + to_string(p - zero));
}
}