mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-18 22:15:46 +01:00
Compare commits
15 Commits
2cafddc2b3
...
d70888f9fb
| Author | SHA1 | Date | |
|---|---|---|---|
| d70888f9fb | |||
| 6dbf034ba1 | |||
| 1ea37b6e86 | |||
| f3273ed5d0 | |||
| 6ccb55de8b | |||
| 69dc174ff2 | |||
| 58d0dd01e2 | |||
| 4005163d61 | |||
| 8964a1a563 | |||
| f0c5408c51 | |||
| 1d5df8df0a | |||
| cdf13b7529 | |||
| 13e1ceddfc | |||
| 333417dadd | |||
| fd8db02e77 |
@@ -24,18 +24,18 @@ static const u8 *nbt_proctag(const u8 *restrict buf, u16 slen) {
|
||||
// integral types
|
||||
case NBT_I8: *dat = *ptr; return ptr;
|
||||
case NBT_I16: *(u16 *)dat = be16toh(*(u16 *)ptr); return ptr + 2;
|
||||
case NBT_I32: __attribute__((fallthrough));
|
||||
case NBT_I32: // fall through
|
||||
case NBT_F32: *(u32 *)dat = be16toh(*(u32 *)ptr); return ptr + 4;
|
||||
case NBT_I64: __attribute__((fallthrough));
|
||||
case NBT_I64: // fall through
|
||||
case NBT_F64: *(u64 *)dat = be16toh(*(u64 *)ptr); return ptr + 8;
|
||||
|
||||
// arrays, handled differently
|
||||
case NBT_LIST: __attribute__((fallthrough));
|
||||
case NBT_ARR_I8: __attribute__((fallthrough));
|
||||
case NBT_STR: __attribute__((fallthrough));
|
||||
case NBT_ARR_I32: __attribute__((fallthrough));
|
||||
case NBT_LIST:
|
||||
case NBT_ARR_I8:
|
||||
case NBT_STR:
|
||||
case NBT_ARR_I32:
|
||||
case NBT_ARR_I64:
|
||||
// arrlen = nbt_arrbsize(ptr);
|
||||
// TODO: arrlen = nbt_arrbsize(ptr);
|
||||
break;
|
||||
|
||||
default: return NULL;
|
||||
@@ -100,24 +100,26 @@ int nbt_primsize(u8 tag) {
|
||||
switch (tag) {
|
||||
case NBT_I8: return 1;
|
||||
case NBT_I16: return 2;
|
||||
case NBT_I32: __attribute__((fallthrough));
|
||||
case NBT_I32: // fall through
|
||||
case NBT_F32: return 4;
|
||||
case NBT_I64: __attribute__((fallthrough));
|
||||
case NBT_I64: // fall through
|
||||
case NBT_F64: return 8;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
size_t nbt_tagdatlen(const u8 *restrict buf) {
|
||||
i32 mems = 0;
|
||||
size_t mems = 0;
|
||||
|
||||
switch (*buf) {
|
||||
case NBT_I8: __attribute__((fallthrough));
|
||||
case NBT_I16: __attribute__((fallthrough));
|
||||
case NBT_I32: __attribute__((fallthrough));
|
||||
case NBT_F32: __attribute__((fallthrough));
|
||||
case NBT_I64: __attribute__((fallthrough));
|
||||
case NBT_F64: __attribute__((fallthrough));
|
||||
case NBT_I8:
|
||||
case NBT_I16:
|
||||
case NBT_I32:
|
||||
case NBT_F32:
|
||||
case NBT_I64:
|
||||
case NBT_F64:
|
||||
mems = nbt_primsize(*buf);
|
||||
return -(mems >= 0) & mems;
|
||||
|
||||
case NBT_ARR_I64: mems += sizeof(i64) - sizeof(i32); __attribute__((fallthrough));
|
||||
case NBT_ARR_I32: mems += sizeof(i32) - sizeof(i8); __attribute__((fallthrough));
|
||||
@@ -135,11 +137,11 @@ size_t nbt_tagdatlen(const u8 *restrict buf) {
|
||||
|
||||
int nbt_isprim(u8 tag) {
|
||||
switch (tag) {
|
||||
case NBT_I8: __attribute__((fallthrough));
|
||||
case NBT_I16: __attribute__((fallthrough));
|
||||
case NBT_I32: __attribute__((fallthrough));
|
||||
case NBT_F32: __attribute__((fallthrough));
|
||||
case NBT_I64: __attribute__((fallthrough));
|
||||
case NBT_I8:
|
||||
case NBT_I16:
|
||||
case NBT_I32:
|
||||
case NBT_F32:
|
||||
case NBT_I64:
|
||||
case NBT_F64:
|
||||
return 1;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user