mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-18 20:35:45 +01:00
Compare commits
5 Commits
b1950e282a
...
2cafddc2b3
| Author | SHA1 | Date | |
|---|---|---|---|
| 2cafddc2b3 | |||
| 96817cd061 | |||
| d561588490 | |||
| 3078a9fb5c | |||
| 16f74a91c1 |
12
.github/workflows/ci.yaml
vendored
12
.github/workflows/ci.yaml
vendored
@@ -43,11 +43,7 @@ jobs:
|
||||
git clone https://github.com/microsoft/vcpkg.git "$VCPKG_ROOT"
|
||||
"$VCPKG_ROOT/bootstrap-vcpkg.sh"
|
||||
"$VCPKG_ROOT/vcpkg" install $DEPS_VCPKG
|
||||
# compilation (using bulk compilation)
|
||||
- run: make all CALL=compile -j || echo "JOB_FAILED=1" >>"$GITHUB_ENV"
|
||||
# executing unit tests (using bulk flags)
|
||||
- run: make all CALL=run DEBUG=test -j || echo "JOB_FAILED=1" >>"$GITHUB_ENV"
|
||||
# exit if any errors occurred
|
||||
- name: exit on errors
|
||||
run: |
|
||||
[ "$JOB_FAILED" != "1" ]
|
||||
- name: compilation (using bulk compilation)
|
||||
run: make all CALL=compile -j
|
||||
- name: unit tests (using bulk flags)
|
||||
run: make all CALL=run DEBUG=test -j
|
||||
|
||||
@@ -13,19 +13,6 @@ const u8 *nbt_nexttag(const u8 *restrict buf, u16 naml) {
|
||||
return buf + naml + len + 3;
|
||||
}
|
||||
|
||||
/* compares the string in `buf` to `matstr`.
|
||||
* returns `=0` if equal, `>0` if buf is greater, `<0` if matstr is greater. */
|
||||
static int nbt_cmpstr(const char *restrict matstr, const u8 *restrict buf) {
|
||||
u16 len = be16toh(*(u16 *)buf);
|
||||
|
||||
// allocate and copy bytes
|
||||
char str[len + 1];
|
||||
memcpy(str, buf + 2, len);
|
||||
str[len] = '\0';
|
||||
|
||||
return strncmp(str, matstr, len);
|
||||
}
|
||||
|
||||
// TODO: not actually doing anything
|
||||
/* readies the output data for export, returns the new buffer position, or `NULL` upon an error (may be out of bounds) */
|
||||
static const u8 *nbt_proctag(const u8 *restrict buf, u16 slen) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../util/atrb.h"
|
||||
#include "../util/compat/endian.h"
|
||||
#include "../util/types.h"
|
||||
|
||||
/* NBT (named binary tag) is a tree data structure. Tags have a numeric type ID, name and a payload.
|
||||
@@ -48,7 +49,7 @@ atrb_pure atrb_nonnull(1) static inline u16 nbt_namelen(const u8 *restrict buf)
|
||||
|
||||
/* returns the (expected) pointer of the tag following this one.
|
||||
* `NULL` is returned if anything went wrong. */
|
||||
atrb_pure atrb((nonnull(1))) const u8 *nbt_nexttag(const u8 *restrict buf, u16 naml);
|
||||
atrb_pure atrb_nonnull(1) const u8 *nbt_nexttag(const u8 *restrict buf, u16 naml);
|
||||
|
||||
/* checks whether the tag is a primitive data tag. (not recommended for filtering tags, use a `switch`)
|
||||
* returns a boolean value. */
|
||||
|
||||
Reference in New Issue
Block a user