Merge branch 'main' into blocks-metadata

This commit is contained in:
MihailRis
2024-09-13 13:22:27 +03:00
19 changed files with 267 additions and 51 deletions
+6 -2
View File
@@ -11,7 +11,7 @@ void ByteBuilder::put(ubyte b) {
}
void ByteBuilder::putCStr(const char* str) {
size_t size = strlen(str) + 1;
size_t size = std::strlen(str) + 1;
buffer.reserve(buffer.size() + size);
for (size_t i = 0; i < size; i++) {
buffer.push_back(str[i]);
@@ -172,7 +172,7 @@ const char* ByteReader::getCString() {
}
std::string ByteReader::getString() {
uint32_t length = (uint32_t)getInt32();
uint32_t length = static_cast<uint32_t>(getInt32());
if (pos + length > size) {
throw std::runtime_error("buffer underflow");
}
@@ -186,6 +186,10 @@ bool ByteReader::hasNext() const {
return pos < size;
}
size_t ByteReader::remaining() const {
return size - pos;
}
const ubyte* ByteReader::pointer() const {
return data + pos;
}