mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 07:35:45 +01:00
remove nbt_procdat struct
This commit is contained in:
@@ -5,27 +5,21 @@
|
|||||||
|
|
||||||
#include "../util/types.h"
|
#include "../util/types.h"
|
||||||
|
|
||||||
/* the data structure that functions passes between functions, so it can communicate with the central function */
|
|
||||||
struct nbt_procdat {
|
|
||||||
u32 ncomp; // the number of compound tags we've encountered
|
|
||||||
};
|
|
||||||
|
|
||||||
/* returns the string length from a specific location in the buffer */
|
/* returns the string length from a specific location in the buffer */
|
||||||
static inline u16 nbt_strlen(u8 const *restrict buf) {
|
static inline u16 nbt_strlen(u8 const *restrict buf) {
|
||||||
return be16toh(*(u16 *)(buf));
|
return be16toh(*(u16 *)(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
int nbt_proc(void **restrict datout, u8 const *restrict buf, size_t len) {
|
int nbt_proc(void **restrict datout, u8 const *restrict buf, size_t len) {
|
||||||
struct nbt_procdat procdat = {0};
|
|
||||||
|
|
||||||
// first byte should be a compound tag
|
// first byte should be a compound tag
|
||||||
if (*buf != NBT_COMPOUND) return 1;
|
if (*buf != NBT_COMPOUND) return 1;
|
||||||
|
uint ncomp = 1;
|
||||||
|
|
||||||
// ignore the first tag + its name, so we start with the juicy data
|
// ignore the first tag + its name, so we start with the juicy data
|
||||||
uint tmp = nbt_strlen(buf + 1) + 3;
|
uint tmp = nbt_strlen(buf + 1) + 3;
|
||||||
buf += tmp;
|
buf += tmp;
|
||||||
len -= tmp;
|
len -= tmp;
|
||||||
procdat.ncomp++;
|
|
||||||
|
|
||||||
// TODO: finish function
|
// TODO: finish function
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user