Commit Graph

137 Commits

Author SHA1 Message Date
17357d4672 remove unused/unmaintained code.
this will likely re-appear in some form or another later on, but
currently I don't see its use.
2025-08-25 12:42:45 +02:00
5644d377de make helper functions for nbt_proctag have similar IO as itself.
fix: `procarr` was counting `nmem`, whilst we should be counting the
bytes.
fix: `procarr` wasn't actually writing to `struct nbt_array`'s `len`
member.
2025-08-25 12:41:12 +02:00
44d2271972 fix: return values and list processing was too funky with nbt_proctag.
- Updated documentation
- Fixed logic so `nbt_proctag` actually returns the next pointer.
2025-08-25 10:57:15 +02:00
6dae1d1600 use a flexible array member for including length with array data 2025-08-24 13:37:33 +02:00
a6442a851e write a function for processing NBT_LIST 2025-08-24 13:06:04 +02:00
ec04177f45 remove exessive comments 2025-08-24 12:52:43 +02:00
40b8c0ef30 write documentation for nbt_procarr. 2025-08-24 12:51:59 +02:00
7feb193c51 make procarr code more consise. 2025-08-24 12:48:21 +02:00
29c8a2b6ea improve documentation for the nbt_proctag function 2025-08-23 23:19:16 +02:00
8cd29225d1 remove outdated TODO comments 2025-08-23 23:13:27 +02:00
20ec45f230 fix: not actually returning NULL. 2025-08-23 23:13:27 +02:00
3cdee8b40c add nbt_proctag to nbt.h
also changed the `out` parameter from `u8` to `void`, to be more
acurrate that it may point to whatever.
2025-08-23 23:13:27 +02:00
89ceb5263c put attributes after function declarations
super confusing, but the formatter is being annoying otherwise
2025-08-23 23:09:09 +02:00
4fa0a84c94 fix attributes with parameters to be less messy due to vardiac arguments 2025-08-23 23:01:01 +02:00
f1ea7dcef8 continue working on nbt_proctag focussing on array processing. 2025-08-22 13:02:12 +02:00
9996e84ef5 move contents of do while loop in nbt_nexttag into its own funciton 2025-08-22 10:14:57 +02:00
949cac5bfe move NBT_LIST case into its own function 2025-08-22 10:14:53 +02:00
3eb92541db simplify the ptr increment a bit, so it's more clear what's going on 2025-08-20 19:00:57 +02:00
df3720b966 refactor via swapping values to instead have n * len, to be len * n
it is like this in other code, and makes it more obvious what the actual
unique value is.
At least to me, which is what mostly matters.
2025-08-20 19:00:37 +02:00
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
e67d8c7fd4 fix: lens[dpt] is not a type, should be tags[dpt] 2025-08-20 16:45:53 +02:00
23b64199d7 implement handling compound lists 2025-08-20 16:43:01 +02:00
6a9d6f75a4 fix: fatal macro not printing to stderr 2025-08-20 11:46:31 +02:00
e018e1ff1b reorder variables in nbt_nexttag 2025-08-20 10:46:37 +02:00
1b09d3d7f1 remove need for mems, since the compiler will likely optimise it away regardless 2025-08-20 10:44:46 +02:00
e4b90246c5 remove unused nbt_primsize function 2025-08-19 11:15:41 +02:00
c15046e017 small fix with nbt_proctag, and remove usage of nbt_primsize 2025-08-19 11:14:14 +02:00
e3a8063124 calling nbt_primsize actually takes up more lines than if I didn't. 2025-08-19 11:07:13 +02:00
10a2aca0a5 fix: remove recursive functions and improve (theoretical) performance
note that lists are no longer handled here, this will be re-implemented
in a newer commit. The basic functionality for compound/end and other
tags are there, though.
2025-08-18 14:35:05 +02:00
e6cc6ce2e8 fix: swapped calloc arguments 2025-08-18 13:51:49 +02:00
37181a299c write a note 2025-08-13 12:21:07 +02:00
5c57a77ad4 remove types.h, and start using intdef.h 2025-08-08 12:37:31 +02:00
bdf4d7b22b remove atrb_* macros for the attributes, and replace with single-word, all uppercase versions.
improves briefity, and reduces confusion.
2025-08-08 12:30:59 +02:00
114a7d4ea5 implement nbt_nextcompound
this is still flawed, due to recursion and there being a better way.
Just gotta find it.
2025-08-08 12:27:46 +02:00
e287f6034f add copyright information to nbt.c 2025-08-07 13:49:50 +02:00
0e00cb2d54 remove non-functional code 2025-08-07 13:23:47 +02:00
c3fc688c35 remove nbt_proc and replace it with nbt_initproc
we're moving towards that the user will handle most of the looping and
data feed.
So the use of these functions is no longer intended, becides, they
weren't being maintained whilst the parameters changed, causing the
portion of code to lag behind.
I'd rather rewrite code than have to prune old, unused code.
2025-08-07 13:23:33 +02:00
066e1c0049 remove nbt_isprim function, because it never really served any purpose.' 2025-08-07 13:02:08 +02:00
1052dcaac9 add functions for incrementing to the next tag 2025-08-07 13:01:27 +02:00
f952268152 fix: the + unary operator does not add 1, but just specifies intent.
I was very mistaken, and I feel like an idiot.
2025-08-07 13:00:09 +02:00
4b2404e903 move utility functions upwards to keep the logical order 2025-08-07 13:00:09 +02:00
ff7598a7e3 rework attributes to be a bit safer and more logical.
we are targeting GNU extensions, GNU attributes are a part of that.
added aliases for the new attribute names (name as all caps = shorter
due to `atrb_` prefix)
The aliases are likely to be removed in a later commit
2025-07-31 11:27:57 +02:00
e472d9c251 rename types.h to intdef.h and replace types.h with a symlink.
`intdef.h` is more clear in the purpose that it describes, rather than
`types`, `types` is too generic.
Note: floating points are still defined in this header, I imagine this
to be removed later, alongside the compatibility symlink.
2025-07-31 11:27:57 +02:00
d70888f9fb remove __attribute__((fallthrough)) from all that do not require it. Replace with // fall through in some places for readability 2025-07-24 16:32:41 +02:00
6dbf034ba1 add marker so I remember to add this back in 2025-07-24 16:29:03 +02:00
f3273ed5d0 fix: include my endian.h in nbt.h 2025-07-24 16:29:03 +02:00
6ccb55de8b remove unused function nbt_cmpstr, since we're performing this check directly now. 2025-07-24 16:29:03 +02:00
69dc174ff2 remove nbt_arrlen function 2025-07-24 16:29:03 +02:00
58d0dd01e2 move nbt_strlen to nbt.h, and rename to nbt_namelen 2025-07-24 16:29:03 +02:00