lib/nbt: Fix #80

master
BodgeMaster 2023-06-18 03:17:20 +02:00
parent 01e5f5eaac
commit ae71322ba1
1 changed files with 12 additions and 6 deletions

View File

@ -1311,7 +1311,8 @@ namespace NBT {
goto returnError;
}
contents.push_back(new Tag::Int8Array("", nextArray.value));
*processedDataSize += (uint64_t) nextArray.value.size();
// +4 for the header of the array
*processedDataSize += (uint64_t) nextArray.value.size() + 4;
}
break;
}
@ -1370,7 +1371,8 @@ namespace NBT {
goto returnError;
}
contents.push_back(new Tag::Int32Array("", nextArray.value));
*processedDataSize += (uint64_t) nextArray.value.size() * 4;
// +4 for the header of the array
*processedDataSize += (uint64_t) nextArray.value.size() * 4 + 4;
}
break;
}
@ -1382,7 +1384,8 @@ namespace NBT {
goto returnError;
}
contents.push_back(new Tag::Int64Array("", nextArray.value));
*processedDataSize += (uint64_t) nextArray.value.size() * 8;
// +4 for the header of the array
*processedDataSize += (uint64_t) nextArray.value.size() * 8 + 4;
}
break;
}
@ -1627,7 +1630,8 @@ namespace NBT {
if (nextArray.isError) {
return false;
}
*processedDataSize += (uint64_t) nextArray.value.size();
// +4 for the header of the array
*processedDataSize += (uint64_t) nextArray.value.size() + 4;
}
return true;
}
@ -1678,7 +1682,8 @@ namespace NBT {
if (nextArray.isError) {
return false;
}
*processedDataSize += (uint64_t) nextArray.value.size() * 4;
// +4 for the header of the array
*processedDataSize += (uint64_t) nextArray.value.size() * 4 + 4;
}
return true;
}
@ -1688,7 +1693,8 @@ namespace NBT {
if (nextArray.isError) {
return false;
}
*processedDataSize += (uint64_t) nextArray.value.size() * 8;
// +4 for the header of the array
*processedDataSize += (uint64_t) nextArray.value.size() * 8 + 4;
}
return true;
}