Use void * over u8 *, to be more explicit we're working with raw data, and not just bytes.

The main problem with all my buffer-parsing code so-far is that they
often... always break strict aliasing rules.
Using a `void *` will make these bugs more explicit / noticable.
This commit is contained in:
2025-09-03 22:28:53 +02:00
parent 008604ff5e
commit be33f78109
5 changed files with 34 additions and 34 deletions

View File

@@ -49,8 +49,8 @@ struct nbt_array {
* if `buf` points to `NBT_I8`, `NBT_I16`, `NBT_I32`, `NBT_I64`, `NBT_F32`, or `NBT_F64`, `*out` is assumed
* to have the available byte width for one of these types. In the case of `NBT_ARR*` and `NBT_LIST`
* it must point to a `struct nbt_array*`. Where in the case of `NBT_LIST`, it must be one of the previous static-width types. */
const u8 *nbt_proctag(const u8 *restrict buf, u16 slen, void *restrict out) NONNULL((1, 3));
const void *nbt_proctag(const void *restrict buf, u16 slen, void *restrict out) NONNULL((1, 3));
/* searches for the end of a named tag without processing data, the final pointer is returned.
* `NULL` is returned upon failure, the otherwise returned pointer is not guaranteed to be valid. */
const u8 *nbt_nexttag(const u8 *restrict buf) NONNULL((1)) PURE;
const void *nbt_nexttag(const void *restrict buf) NONNULL((1)) PURE;