Compare commits

..

2 Commits

Author SHA1 Message Date
f53e4315ee fix: dpt increment is unecessary. 2025-08-20 18:35:31 +02:00
24f9ba047e fix: not handling END tags in a list 2025-08-20 18:29:46 +02:00

View File

@@ -50,12 +50,13 @@ const u8 *nbt_nexttag(const u8 *restrict buf) {
case NBT_STR: ptr += 2 + (u16)be16toh(*(u16 *)ptr) * 1; break; case NBT_STR: ptr += 2 + (u16)be16toh(*(u16 *)ptr) * 1; break;
case NBT_END: dpt--; break; case NBT_END: dpt--; break;
case NBT_COMPOUND: dpt += (tags[dpt] && *tag) ? 1 : -1; break; case NBT_COMPOUND: dpt++; break;
case NBT_LIST: { case NBT_LIST: {
tag = ptr; // temporarily store the tag to cache later tag = ptr; // temporarily store the tag to cache later
switch (*(ptr++)) { switch (*(ptr++)) {
case NBT_END: break;
case NBT_I8: ptr += 1 * (i32)be32toh(*(u32 *)ptr); break; case NBT_I8: ptr += 1 * (i32)be32toh(*(u32 *)ptr); break;
case NBT_I16: ptr += 2 * (i32)be32toh(*(u32 *)ptr); break; case NBT_I16: ptr += 2 * (i32)be32toh(*(u32 *)ptr); break;
case NBT_I32: // fall through case NBT_I32: // fall through