mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
Merge branch 'main' into blocks-metadata
This commit is contained in:
commit
8447cf5ad5
19 changed files with 267 additions and 51 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue