diff options
Diffstat (limited to 'ByteBuffer.cpp')
-rw-r--r-- | ByteBuffer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ByteBuffer.cpp b/ByteBuffer.cpp index 912e697..f27deeb 100644 --- a/ByteBuffer.cpp +++ b/ByteBuffer.cpp @@ -3,11 +3,13 @@ #include <string.h> #include <sstream> #include <iomanip> +#include <cassert> using namespace std; ByteBuffer::ByteBuffer(uint8_t *bytes, size_t capacity, size_t size, size_t zero) : bytes(bytes), capacity(capacity), size(size), cursor(zero), zero(zero) { + assert(zero <= size); } ByteBuffer &ByteBuffer::add8(uint8_t value) { @@ -73,7 +75,7 @@ std::string ByteBuffer::toString() const { stringstream s; for(size_t i = zero; i < size; i++) { - s << hex << setfill('0') << setw(2) << bytes[i] << " "; + s << hex << setfill('0') << setw(2) << (int) bytes[i] << " "; } return string(s.str()); |